pai is a fast and command-line tool that creates a single markdown file containing the contents of all files in a folder (for chatting to your code). It also includes functionality for running a code generation agent using different large language models (NOT SAFE
- 📝 Markdown Generation: Generate a markdown file from code files.
- Fast recursive directory scanning
- Filter by specific extensions
- Customizable output file location
- Automatically skip binary files
- Ignore specific files or patterns
- 🤖 Code Generation Agent: Run a code generation agent using various large language models such as Claude, Google, DeepSeek, and OpenAI.
- Read and edit files with natural language instructions
- List directory contents
- Create new files from scratch
- Interactive chat interface
- Rust toolchain (1.70.0 or later recommended)
- Cargo (comes with Rust)
- API keys for the language models you intend to use
# Clone the repository
git clone [email protected]:FarhanAliRaza/pai.git
cd pai
# Build the project
cargo build --release
# The executable will be in target/release/pai
# From the project directory
cargo install --path .
# Or directly from the repository (if published)
cargo install pai
Set up the API keys for the language models you want to use:
# For Claude
export ANTHROPIC_API_KEY=your_api_key_here
# For OpenAI
export OPENAI_API_KEY=your_api_key_here
# For Google
export GOOGLE_API_KEY=your_api_key_here
# For DeepSeek
export DEEPSEEK_API_KEY=your_api_key_here
Generate a markdown file from code files:
# Basic usage with default settings (uses current directory and outputs to llm.md)
pai md
# Specify input directory and output file
pai md --input-dir /path/to/project --output documentation.md
# Filter by specific file extensions
pai md --extensions rs,toml,md
# Ignore specific files or patterns
pai md --ignore "target,.git,Cargo.lock"
Option | Description | Default |
---|---|---|
--input-dir , -i |
Directory to scan | Current directory (.) |
--output , -o |
Output markdown file path | llm.md |
--extensions , -e |
Comma-separated file extensions to include | All files |
--ignore , -n |
Comma-separated files or patterns to ignore | None |
Run the code generation agent:
# Run with default model (Claude)
pai code
# Specify a particular model
pai code --model claude
pai code --model openai
pai code --model google
pai code --model deepseek
Option | Description | Default |
---|---|---|
--model , -m |
LLM model to use (claude, openai, google, deepseek) | claude |
The code agent provides the following tools:
- 📄 read_file: Reads the contents of a file
- 📂 list_files: Lists files in a directory (recursively)
- ✏️ edit_file: Creates or modifies files with specified content
Once the agent is running, you can interact with it using natural language:
- "What files are in the src directory?"
- "Show me the content of main.rs"
- "Create a new file called utils.rs with a function to parse JSON"
- "Add error handling to the API request in network.rs"
- "Analyze and refactor this code to improve performance"
# Development build
cargo build
# Release build
cargo build --release
# Run all tests
cargo test
# Run specific tests
cargo test markdown_generator
This project is licensed under the MIT License. See the LICENSE
file for details.
Farhan Ali Raza [email protected]
Contributions are welcome! Please feel free to submit a Pull Request.