Skip to content

Flatten directories into AI-ready files with encoded path context πŸ—‚οΈπŸ€–

License

Notifications You must be signed in to change notification settings

xthezealot/aixtract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‚οΈ aixtract

Flatten directory structures for AI analysis while preserving hierarchy context

Description

aixtract transforms nested file structures into flat directories with encoded path information, making it ideal for uploading codebases to AI assistants that lack directory support.

How it works:

  • Reads file paths from .aixtract configuration
  • Copies files to a new timestamped temporary directory
  • Encodes original paths using double underscores (__)

Example transformation:
src/models/user.py β†’ src__models__user.py

Why Use This?

  • πŸ€– AI-Friendly: Maintain file relationships for LLMs without directory support
  • πŸ•΅οΈ Context Preservation: Hierarchical information remains visible in filenames
  • ⚑ Zero Dependencies: Single binary for macOS/Linux

πŸ“¦ Installation

Precompiled Binaries

# Ensure target directory exists
mkdir -p ~/.local/bin

# macOS (Apple Silicon)
curl -L https://github.com/xthezealot/aixtract/releases/download/v1.0.0/aixtract-darwin-arm64 -o ~/.local/bin/aixtract && chmod +x ~/.local/bin/aixtract

# Linux (AMD64)
wget https://github.com/xthezealot/aixtract/releases/download/v1.0.0/aixtract-linux-amd64 -O ~/.local/bin/aixtract && chmod +x ~/.local/bin/aixtract

# Linux (ARM64)
wget https://github.com/xthezealot/aixtract/releases/download/v1.0.0/aixtract-linux-arm64 -O ~/.local/bin/aixtract && chmod +x ~/.local/bin/aixtract

Add to PATH (if not already):

export PATH="$HOME/.local/bin:$PATH"

πŸ’» Usage

  1. Create Configuration File
    Create .aixtract in your project root with target files:

    # Example .aixtract file
    src/models/user.py
    tests/test_user.py
    config/settings.json
    
    # Use find to auto-generate (e.g., all Python files)
    # find . -name "*.py" >> .aixtract
  2. Run Extraction
    From your project directory:

    aixtract
  3. Access Output
    Files are copied to:
    ~/Downloads/<project_name>_<timestamp>/
    (Automatically opened on macOS/Linux)

🌟 Example Transformation

Original Structure:

myproject/
β”œβ”€β”€ .aixtract
β”œβ”€β”€ src/
β”‚   └── models/
β”‚       └── user.py
β”œβ”€β”€ tests/
β”‚   └── test_user.py
└── config/
    └── settings.json

After Processing:

/tmp/myproject_20250101123456/
β”œβ”€β”€ src__models__user.py
β”œβ”€β”€ tests__test_user.py
└── config__settings.json

β˜‘οΈ Requirements

  • OS: macOS 10.15+ or modern Linux distro
  • Arch: x86_64 or ARM64
  • Permissions: Read access to source files, write access to output directory

❓ FAQ

Q: Can I use this for non-code files?
A: Absolutely! Works with any file type