Skip to main content

Convert Git repositories into LLM-friendly context format

Project description

repo-context

uv Ruff Quality Check Unit Tests code coverage Publish

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.

Features

  • 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

Installation

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 .

Usage

Command Line Interface

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'])

Python API

from repo-context import RepoConverter

converter = RepoConverter(ignore_patterns=[".git", "*.pyc"])
context = converter.convert("/path/to/repo")

Output Format

The tool generates a Markdown file with the following structure:

# File: path/to/file1

``` 
[file1 content]
``` 

# File: path/to/file2
``` 
[file2 content]
``` 

Development

Requirements:

  • Python >=3.12
  • UV package manager

Setup development environment:

uv venv
uv pip install -e ".[dev]"

Run tests:

pytest tests/

License

MIT License

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo_context-0.4.0.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

repo_context-0.4.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file repo_context-0.4.0.tar.gz.

File metadata

  • Download URL: repo_context-0.4.0.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for repo_context-0.4.0.tar.gz
Algorithm Hash digest
SHA256 094f5d218cdda2d77e89149d1854b965a77c5d0032a926cb5ad357eff1c3f094
MD5 e79208751dd12d1503d484d6f4290566
BLAKE2b-256 976a074e14e36e1abd49ce55f8824068dfeb20b450dd753d16312f92d0a22412

See more details on using hashes here.

Provenance

The following attestation bundles were made for repo_context-0.4.0.tar.gz:

Publisher: publish.yaml on mathiasesn/repo-context

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repo_context-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: repo_context-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for repo_context-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 442790f3d725eceb5937031f8f21b2d981009169b37070c717fca6ee56796925
MD5 b19a9f0bb7d1b6102ea85226b6afe5c2
BLAKE2b-256 391b45ea497116f14295fa6e480443fd41a1a52d9dd7ff418993b9bf959cfdcf

See more details on using hashes here.

Provenance

The following attestation bundles were made for repo_context-0.4.0-py3-none-any.whl:

Publisher: publish.yaml on mathiasesn/repo-context

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page