aixtract v1.0.0

Flatten directories into AI-ready files with encoded path context 🗂️🤖

🗂️ 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.pysrc__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

Repository

aixtract

Owner
Statistic
  • 1
  • 0
  • 0
  • 0
  • 0
  • 11 days ago
  • January 24, 2025
License

MIT License

Links
Synced at

Tue, 04 Feb 2025 18:20:07 GMT

Languages