Rust Ingest, a Rust-based code ingestion tool for preparing codebases for analysis with Large Language Models (LLMs).
Ringest simplifies the process of preparing code for LLM analysis by:
- Cloning remote code repositories or reading local code directories
- Filtering files based on include/exclude patterns
- Processing and formatting text files with appropriate markers
- Outputting the processed content to a file or clipboard
- Providing specialized code analysis prompts
This tool bridges the gap between codebases and language models, making it easier to analyze and understand code using AI assistants.
- Repository Processing: Clone remote Git repositories or process local directories
- Selective File Processing: Include or exclude files using custom patterns
- Text File Recognition: Automatically identify and process common text file formats
- File Marking: Add clear start/end markers to distinguish between files
- Flexible Output: Choose between file output or clipboard copying
- Analysis Prompts: Built-in prompts for Rust-specific and general code analysis
- Gitignore Support: Respect
.gitignorerules when processing files
- Rust toolchain (rustc, cargo)
- Git (for cloning repositories)
# Clone the repository
git clone https://github.com/yourusername/ringest.git
cd ringest
# Build the project
cargo build --release
# Run the executable
./target/release/ringest# Basic usage with local directory
ringest -s src
# Clone and process a remote repository
ringest -a https://github.com/username/repo.git
# Include only specific file types
ringest -a . -i "*.rs" "*.toml"
# Exclude specific files or directories
ringest -a . -e "target/*" "*.json"
# Output to a specific file
ringest -a . -o code_analysis.txt
# Copy output to clipboard
ringest -a . -c
# Combine multiple options
ringest -a https://github.com/username/repo.git -i "*.rs" -e "tests/*" -o analysis.txt| Argument | Long form | Description | Default |
|---|---|---|---|
-a |
--address |
Repository URL or local directory path | . (current directory) |
-s |
--src |
Source directory within the repository | src |
-c |
--copy |
Copy output to clipboard | false |
-o |
--output |
Output file path | ./llms.txt |
-i |
--include |
Patterns to include (comma-separated) | None (include all) |
-e |
--exclude |
Patterns to exclude (comma-separated) | None (exclude nothing) |
Ringest consists of several modules working together to process and prepare code:
- main.rs: Entry point and CLI argument handling
- git.rs: Repository cloning and URL validation
- file.rs: File traversal, filtering, and content processing
- llm.rs: LLM client interface (for future integration)
- prompts.rs: Predefined analysis prompts
The tool follows this workflow:
- Parse command line arguments
- Clone repository (if remote) or use local directory
- Walk through files applying include/exclude filters
- Process each file with appropriate formatting
- Concatenate all content with file markers
- Output the result to a file or clipboard
This project relies on the following Rust crates:
reqwest: HTTP client for API requeststokio: Asynchronous runtimeserde/serde_json: JSON serialization/deserializationanyhow: Error handlingclap: Command line argument parsinggit2: Git repository operationsasync-trait: Async trait supporttempfile: Temporary file/directory handlingarboard: Clipboard accessignore: File pattern matching and .gitignore support
MIT
Contributions are welcome! Feel free to submit a Pull Request.