Convert Git repositories into LLM-friendly context format. This tool processes local repositories or GitHub URLs and generates a formatted file suitable for use with Large Language Models.
- Process local Git repositories or GitHub URLs
- Configurable file ignore patterns
- Progress tracking with rich console output
- Markdown-formatted output optimized for LLM context
- Built with UV package manager support
Using UV:
uv venv
uv pip install repo-context
From source:
git clone https://github.com/mathiasesn/repo-context
cd repo-context
uv venv
uv pip install -e .
Basic usage:
repo-context /path/to/local/repo
repo-context https://github.com/username/repo
Options:
repo-context --help
usage: repo-context [-h] [--output OUTPUT] [--ignore IGNORE [IGNORE ...]] source
Convert a repository into LLM-friendly context
positional arguments:
source Local path or GitHub URL to repository
options:
-h, --help show this help message and exit
--output OUTPUT, -o OUTPUT
Output file path (default: context.md)
--ignore IGNORE [IGNORE ...]
Patterns to ignore (default: ['.git', '__pycache__', '*.pyc', '*.pyo', '*.pyd', '.DS_Store'])
from repo-context import RepoConverter
converter = RepoConverter(ignore_patterns=[".git", "*.pyc"])
context = converter.convert("/path/to/repo")
The tool generates a Markdown file with the following structure:
# File: path/to/file1
```
[file1 content]
```
# File: path/to/file2
```
[file2 content]
```
Requirements:
- Python >=3.12
- UV package manager
Setup development environment:
uv venv
uv pip install -e ".[dev]"
Run tests:
pytest tests/
MIT License
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request