Metadata-Version: 2.4
Name: repo-context
Version: 0.2.0
Summary: Convert Git repositories into LLM-friendly context format
Author-email: Mathias Nielsen <mathiasesn1@gmail.com>
Maintainer-email: Mathias Nielsen <mathiasesn1@gmail.com>
License: MIT License
        
        Copyright (c) 2023 Mathias Nielsen
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: gitpython>=3.1.43
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: rich>=13.9.4
Requires-Dist: tqdm>=4.67.1
Description-Content-Type: text/markdown

# repo-context

[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Quality Check](https://github.com/mathiasesn/repo-context/actions/workflows/check.yaml/badge.svg?branch=master)](https://github.com/mathiasesn/repo-context/actions/workflows/check.yaml)
[![Unit Tests](https://github.com/mathiasesn/repo-context/actions/workflows/test.yaml/badge.svg)](https://github.com/mathiasesn/repo-context/actions/workflows/test.yaml)
![code coverage](https://raw.githubusercontent.com/mathiasesn/repo-context/coverage-badge/coverage.svg?raw=true)
[![Publish](https://github.com/mathiasesn/repo-context/actions/workflows/publish.yaml/badge.svg)](https://github.com/mathiasesn/repo-context/actions/workflows/publish.yaml)

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:
```bash
uv venv
uv pip install repo-context
```

From source:
```bash
git clone https://github.com/mathiasesn/repo-context
cd repo-context
uv venv
uv pip install -e .
```

## Usage

### Command Line Interface

Basic usage:
```bash
repo-context /path/to/local/repo
repo-context https://github.com/username/repo
```

Options:
```bash
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

```python
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:
````markdown
# File: path/to/file1

``` 
[file1 content]
``` 

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

## Development

Requirements:
- Python >=3.12
- UV package manager

Setup development environment:
```bash
uv venv
uv pip install -e ".[dev]"
```

Run tests:
```bash
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
