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.
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.
- 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
.gitignore
file and excludes common non-essential files. - Rich Metadata Header: The context starts with a header including the repo URL, timestamp, and latest commit details.
Install the package directly from PyPI:
pip install repo-context-generator
You can use the tool via the Web UI or the Command-Line.
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
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.
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
Dependencies (requirements.txt
):
streamlit==1.33.0
gitpython==3.1.43
pyyaml==6.0.1
📂 my-python-app
├── 📄 .gitignore
├── 📄 app.py
├── 📄 README.md
└── 📄 requirements.txt
--- FILE: app.py [⭐ Likely Project Entry Point] (Lines: 152 | Chars: 4891 | Funcs/Classes: 6) ---
import streamlit as st
# ... rest of the file content
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.toml
file 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
.
- Framework: Streamlit
- Language: Python 3
- CLI:
argparse
- Git Operations: GitPython
- File Parsing: gitignore-parser, tomli, PyYAML
This project is licensed under the MIT License. See the LICENSE
file for details.