https://github.com/will282/repo-to-prompt
A Python CLI tool that converts local or remote Git repositories into token-limited structured files for use with generative AI models.
https://github.com/will282/repo-to-prompt
chatgpt claude cli genai git python
Last synced: 2 months ago
JSON representation
A Python CLI tool that converts local or remote Git repositories into token-limited structured files for use with generative AI models.
- Host: GitHub
- URL: https://github.com/will282/repo-to-prompt
- Owner: Will282
- License: mit
- Created: 2024-12-31T16:27:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-04T16:31:19.000Z (over 1 year ago)
- Last Synced: 2025-01-18T21:04:47.020Z (over 1 year ago)
- Topics: chatgpt, claude, cli, genai, git, python
- Language: Python
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Repo to Prompt (r2p)
## Overview
`Repo to Prompt` (r2p) is a Python CLI tool that converts a local or remote Git repository into a structured set of files for use with LLMs like ChatGPT or Claude. It helps developers generate code reviews, write tests, or optimize repositories by providing a token-limited, chunked representation of the repository structure and content.
## Features
- **Supports Local and Remote Git Repositories**: Automatically clones and processes repositories.
- **Token-Aware Splitting**: Outputs files in chunks, ensuring no chunk exceeds the specified token limit.
- **Customizable**: Configure output directories and token limits with CLI options.
- **Built with Modern Python**: Developed using `click`, `pydantic`, and `gitpython`.
## Installation
### Using [Poetry](https://python-poetry.org/)
```bash
poetry install
```
## Usage
### CLI Command: `r2p`
```bash
r2p [OPTIONS] REPO
```
#### Arguments:
- `REPO`: Path to a local repository or URL of a remote Git repository.
#### Options:
- `--output-dir `: Directory to store the output files (default: `output`).
- `--max-tokens `: Maximum tokens per output file (default: 2,000,000).
#### Examples:
1. **Process a Local Repository**:
```bash
r2p ./my-local-repo --output-dir ./output --max-tokens 100000
```
2. **Process a Remote Repository**:
```bash
r2p https://github.com/Will282/ec2-dev-machine --output-dir ./output
```
## Development
### Running Tests
```bash
poetry run pytest
```
### Pre-Commit Hooks
Ensure code quality with pre-commit:
```bash
pre-commit run --all-files
```
## Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
## License
This project is licensed under the [MIT License](LICENSE).
## Author
Created by **Will Parr**.