2 releases
new 0.1.1 | Feb 25, 2025 |
---|---|
0.1.0 | Feb 25, 2025 |
#440 in Command line utilities
15KB
248 lines
LLM Context Generator
A command-line tool that processes a directory of source code files and creates a set of text files suitable for uploading as context to Large Language Models (LLMs).
Features
- Traverses directory structures respecting
.gitignore
rules - Generates text files with clear format: filename followed by content
- Creates a file tree visualization
- Skips binary files, large files, and common directories like
node_modules
- Customizable ignore patterns
Installation
Using Cargo (recommended)
If you have Rust and Cargo installed:
cargo install llm-context-gen
From Source
-
Clone the repository:
git clone https://github.com/anishpras/llm-context-gen.git cd llm-context-gen
-
Build and install:
cargo install --path .
Usage
# Process the current directory and output to "llm-context"
llm-context-gen
# Process a specific directory
llm-context-gen -d /path/to/your/project
# Specify a custom output directory
llm-context-gen -o custom-output-dir
# Add additional directories to ignore
llm-context-gen -i "temp,logs,cache"
# See all options
llm-context-gen --help
Output Format
The tool creates:
-
A text file for each source file with the format:
filename.ext [file content]
-
A
file-tree.txt
showing the directory structure.
License
MIT
llm-context-gen
Dependencies
~7–15MB
~192K SLoC