Skip to main content

DIRAI - Enhanced Directory Structure Analyzer with Security Features for AI Models

Project description

🤖 DIRAI: Your AI-Powered Directory Navigator 🚀

Build Status PyPI version License: MIT

✨ Unveiling the Magic of Your Project's Structure ✨

DIRAI isn't just another directory tool. It's your AI-enhanced companion for exploring, understanding, and documenting the intricate landscape of your projects. With its sleek design and powerful features, DIRAI transforms the mundane task of directory analysis into an insightful and visually engaging experience.

🌈 Feature Spotlight: What Makes DIRAI Shine?

  • 🎨 Profile Perfection: Tailor your analysis with custom profiles, each tuned to specific project types or tasks. Switch effortlessly between configurations for web projects, documentation, security audits, and more!
  • 🔍 Smart Filters: Wield the power of gitignore-style patterns to include or exclude files and directories with surgical precision. Focus on what truly matters.
  • 🎛️ Depth Dynamics: Control the exploration depth to zoom in on critical areas or get a bird's-eye view of your project's architecture.
  • 🔗 Symlink Savvy: Navigate the labyrinth of symbolic links with grace. Choose to follow them or skip them, and let DIRAI handle recursive traps.
  • 📝 Content Chronicles: Peek inside files without leaving your terminal! DIRAI displays file contents with customizable line limits, binary file awareness, and a touch of elegance.
  • 🙈 Secret Sentinel: Safeguard sensitive data with automatic redaction. API keys, tokens, and passwords vanish before your eyes, thanks to configurable patterns and ignore lists.
  • 🤝 Gitignore Guru: Seamlessly integrate with your existing .gitignore files for effortless exclusion management.
  • 💾 Output Oasis: Generate reports in your preferred format, be it plain text for quick scans or Markdown for stunning documentation. Or, pipe the output directly to your console for instant gratification.
  • 💬 Verbose Visionary: Debug with ease using detailed error messages that illuminate the path to resolution.
  • ⚙️ Configuration Charm: Bend DIRAI to your will using a .dirai.yaml file. Define profiles, defaults, and preferences with the elegance of YAML.

🛠️ Installation: Get Started in a Flash

Prerequisites

  • Python 3.7+
  • pip (the trusty Python package installer)

Steps

  1. Clone the Repository:

    git clone https://github.com/salah-alhajj/dirai.git 
    cd dirai
    
  2. Install with pip:

    pip install dirai
    

    Boom! DIRAI is now at your fingertips, ready to serve as a command-line companion.

🎮 Usage: Unleash the Power of DIRAI

Basic Command

dirai [OPTIONS]

Options: Your Control Panel

Option Description Default
-p, --profile Select your configuration profile default
--profiles Run multiple profiles sequentially. Use 'all' for a config file profiles all
-d, --directory Specify the target directory .
-o, --output Choose the output file name (profile)
-x, --exclude Apply exclusion patterns (gitignore style!) (profile)
-i, --include Set inclusion patterns (also gitignore style!) (profile)
--max-depth Limit the analysis depth (profile)
--use-gitignore Toggle gitignore usage (true/false) (profile)
--gitignore-paths Add extra gitignore files to the mix (profile)
--show-content Display file contents (with redaction!) (profile)
--follow-symlinks Decide whether to follow symbolic links (profile)
--verbose Get the full story with detailed error messages false

Examples: DIRAI in Action

  1. Quick Scan (Default Profile):

    dirai
    
  2. Web Project Analysis:

    dirai -p web -d /path/to/your/website
    
  3. Targeted Exclusions:

    dirai -x "node_modules/" ".git/"
    
  4. Precision Inclusions:

    dirai -i "*.py" "*.md"
    
  5. Depth Control:

    dirai --max-depth 3
    
  6. Markdown Magic:

    dirai -o beautiful_report.md
    
  7. Content Preview with Security:

    dirai --show-content
    
  8. Symlink Exploration:

    dirai --follow-symlinks
    
  9. Run All Profiles from Config:

    dirai --profiles all
    
  10. Run Selected Profiles:

    dirai --profiles web,security
    

⚙️ Configuration: Your .dirai.yaml Sanctuary

Customize DIRAI's behavior with a .dirai.yaml file. Place it in your project's root, your home directory, or the current working directory.

Default Configuration: The Foundation

default:
  exclude: []
  include: []
  use_gitignore: true
  show_content: true
  show_hidden: false
  output: structure.txt
  max_depth: null
  follow_symlinks: false
  gitignore_paths: []
  max_lines: -1
  include_vcs: false
  ignore_variables: []
  redaction_patterns:
    - api[_-]?key
    - secret[_-]?key
    - token
    - password
    - credentials
    - auth
    - authorization
    - access
    - session
    - cookie
    - bearer
    - api_key
    - api_token
    - api_secret
    - api_password
    - api_username
    - apikey
    - apitoken
    - apisecret
    - apipassword
    - apiusername

Example Configuration: A Glimpse into Customization

default:
  exclude:
    - "node_modules/"
    - ".venv/"
  max_depth: 5
  max_lines: 50

web:
  include:
    - "*.html"
    - "*.css"
    - "*.js"
  exclude:
    - "tests/"
  output: web_wonder.md

docs:
  include:
    - "*.md"
    - "*.rst"
  output: docs_digest.txt

Configuration Hierarchy: The Order of Power

  1. Command-line Arguments: The ultimate authority.
  2. .dirai.yaml Profile Settings: Your custom preferences.
  3. Default Settings: The fallback for anything not specified.

🙌 Contributing: Join the DIRAI Movement

We welcome contributions! Check out CONTRIBUTING.md for guidelines.

📜 License

This project is licensed under the MIT License. See LICENSE for details.

🙏 Acknowledgements

  • Inspired by the venerable tree command.
  • Powered by the pathspec library for gitignore pattern matching.

📞 Contact

For questions, issues, or just to say hi, open an issue on our cozy GitHub repository. Let's make DIRAI even better together! 🌠

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dirai_tool-0.0.5.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dirai_tool-0.0.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file dirai_tool-0.0.5.tar.gz.

File metadata

  • Download URL: dirai_tool-0.0.5.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for dirai_tool-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1d1e38eafbb8f4cb5825c98a38fe156014b2de1bafe94fbc3897efce94364796
MD5 959e5f319bef1b2d02bd52149e8dc756
BLAKE2b-256 51d9ad60bd41873f63e0bd29ba551d53c16b4d57cca7539d266155248a89b074

See more details on using hashes here.

File details

Details for the file dirai_tool-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: dirai_tool-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for dirai_tool-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4dcb3ddbbd0866221439a8de44b8fb391e23a996a0d20d9068c9ac5ae391d713
MD5 fd898810f017c0c3767842d646205f2c
BLAKE2b-256 1e8240e15cea0e2c96c96ca64ff48cf5dd9b303dd4e00eafe990f8757a42a2de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page