GitHub Repo to LLM Context Generator
An intelligent context generator for Large Language Models. This tool analyzes a public or private GitHub repository, extracts key information, and formats it into a single, comprehensive text file. It is available as a command-line tool and as a web UI.
You can use this when:
- You need to provide context to a Large Language Model without a "chat history" feature.
- Your conversation with an LLM is going in circles and you need to restart with full context.
- You have questions about a repository's implementation, dependencies, or structure.
The Problem
When working with Large Language Models on a software project, providing the full context of a repository is challenging:
- Limited Context Windows: LLMs can't read an entire codebase at once.
- Tedious Manual Work: Manually copying and pasting dozens of files is slow and error-prone.
- Irrelevant "Noise": A raw dump includes useless "noise" for an LLM, such as
node_modules,__pycache__, and build artifacts, which wastes precious context space. - Lack of Structure: A simple concatenation of files makes it hard for the LLM to distinguish where one file ends and another begins.
This tool solves these problems by creating a clean, intelligent, and structured snapshot of your repository's current state.
✨ Key Features
- Dual Interface: Use the friendly web UI or the powerful command-line tool (
repo-context) for easy integration into scripts. - Pip Installable: Easily install the tool with a single command:
pip install repo-context-generator. - Private Repository Support: Securely analyze private repositories using a GitHub Personal Access Token (PAT).
- Automated Dependency Analysis: Detects tech stacks (
Python,JavaScript, etc.) and lists dependencies from common package files. - Intelligent File Tagging: Adds heuristic tags like
[⭐ Likely Project Entry Point]to guide the LLM's focus. - Intelligent Filtering: Automatically respects the repository's
.gitignorefile and excludes common non-essential files. - Rich Metadata Header: The context starts with a header including the repo URL, timestamp, and latest commit details.
⚙️ Installation
Install the package directly from PyPI:
pip install repo-context-generator
🚀 Usage
You can use the tool via the Web UI or the Command-Line.
🖥️ Command-Line Interface
Once installed, you can use the repo-context command in your terminal.
1. Generate context and print to console:
repo-context "https://github.com/user/repo"
2. Save context to a file:
repo-context "https://github.com/user/repo/tree/main" -o my_project_context.md
3. Analyze a private repository:
You can provide a token via the --token flag or the GITHUB_TOKEN environment variable.
# Using a flag
repo-context "https://github.com/private-user/private-repo" --token YOUR_GITHUB_PAT
# Or by setting an environment variable
export GITHUB_TOKEN="YOUR_GITHUB_PAT"
repo-context "https://github.com/private-user/private-repo"
4. See all available options:
repo-context --help
🌐 Web UI
Try the app live here: https://repo-context.streamlit.app/
- Navigate to the deployed Streamlit application.
- Paste the full URL of a public or private GitHub repository.
- For private repositories, expand the "🔑 Private Repository Access" section and paste your Personal Access Token (PAT).
- Configure any optional settings, like file extensions or line limits.
- Click the "🚀 Generate Intelligent Context" button.
- Use the "📥 Download Context.md" button to save the output.
📝 Example Output Structure
The generated output is a single, enriched Markdown file designed to be easily parsed by an LLM.
# LLM CONTEXT SNAPSHOT
- **Repository Source:** https://github.com/user/my-python-app
- **Branch:** main
- **Snapshot Timestamp:** 2025-07-19 20:55:00 UTC
- **Last Commit Hash:** a1b2c3d4e5f6g7h8i9j0
- **Last Commit Message:** "feat: Implement user authentication"
- **Detected Technology Stack:** Python
1. Project Dependencies Analysis
Dependencies (requirements.txt):
streamlit==1.33.0
gitpython==3.1.43
pyyaml==6.0.1
2. Repository File Structure
📂 my-python-app
├── 📄 .gitignore
├── 📄 app.py
├── 📄 README.md
└── 📄 requirements.txt
3. File Contents
--- FILE: app.py [⭐ Likely Project Entry Point] (Lines: 152 | Chars: 4891 | Funcs/Classes: 6) ---
import streamlit as st
# ... rest of the file content
💻 Running for Development
To contribute to this project or run the web UI locally, follow these steps.
Prerequisites:
- Python 3.8+
- Git command-line tool
Setup:
-
Clone the repository:
git clone https://github.com/cbarkinozer/repo-context.git cd repo-context
-
Create and activate a virtual environment:
# For macOS/Linux python3 -m venv venv source venv/bin/activate # For Windows python -m venv venv .\venv\Scripts\activate
-
Install the project in editable mode: This command reads the
pyproject.tomlfile and installs all necessary dependencies, including Streamlit.pip install -e .
-
Run the Streamlit app:
streamlit run app.py
The application should now be running at http://localhost:8501.
🛠️ Technologies Used
- Framework: Streamlit
- Language: Python 3
- CLI:
argparse - Git Operations: GitPython
- File Parsing: gitignore-parser, tomli, PyYAML
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for repo-context-generator 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| repo_context_generator-0.1.0.tar.gz | 14.7 kB | Without provenance | Details for repo_context_generator-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| repo_context_generator-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for repo_context_generator-0.1.0-py3-none-any.whl |
Total release size: 27.7 kB
Release files / repo_context_generator-0.1.0.tar.gz
| Download URL | repo_context_generator-0.1.0.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1b924c69663c3aced592951b289dfdf13297f1867ec5cd89f244d8b28147e42
|
|
BLAKE2b-256 checksum How to use checksums |
a91e0c118607e007c15cbe6497fd9ca8098b717a44263a91f6436c7d59e76052
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / repo_context_generator-0.1.0-py3-none-any.whl
| Download URL | repo_context_generator-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96cc7f1ac7f65ccb6d0c4d343bd735858c81511de5768c4459ae142d4f1fa323
|
|
BLAKE2b-256 checksum How to use checksums |
2bafa135f4242d9770136e4793385d6b4ff6aa06f1dae84e9ef66ca3f88c485b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for repo-context-generator 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.