Generate a comprehensive summary and visualization of a repository structure, enhanced with AI-powered descriptions and developer considerations.
Project description
๐บ๏ธ repo-map
repo-map is an advanced tool for generating comprehensive, AI-enhanced summaries of software repositories. It provides developers with valuable insights into project structures, file purposes, and potential considerations across various programming languages. Using efficient caching, repo-map only processes files that have changed since the last run, making it ideal for continuous use in evolving projects. This tool not only aids in understanding and documenting codebases but can also assist LLM agents in writing accurate and functional code within your existing project structure.
๐ Features
- ๐ Generates detailed repository structure summaries
- ๐ง AI-powered enhancements:
- ๐ก Developer considerations for potential issues or unique aspects
- ๐ฃ๏ธ Concise explanations of file purposes and functionality
- ๐ Insights into code structure and organization
- ๐ Analyzes code structure across multiple programming languages
- ๐ Supports various file types including Python, Java, JavaScript, TypeScript, and more
- ๐พ Caching mechanism using SQLite for efficient processing of unchanged files
- ๐ณ Tree-like visualization of the repository structure
- ๐ Markdown output for easy sharing and documentation
- ๐ Respects the root
.gitignorefile and includes a robust set of default ignore patterns - ๐ฆ Implements rate limiting and exponential backoff for LLM API calls
- โก Asynchronous processing for improved performance
๐ ๏ธ Installation
- Clone the repository:
git clone https://github.com/cyanheads/repo-map.git cd repo-map
- Install dependencies using Poetry:
poetry install
๐ Usage
To generate a repository map, run the following command from the project root:
poetry run repo-map <repository_path> [options]
Replace <repository_path> with the path to the repository you want to analyze.
Options:
-y,--yes: Automatically accept the disclaimer and proceed without prompting.--model MODEL: Specify the OpenRouter LLM model to use (default:google/gemini-2.5-flash-preview-09-2025).--concurrency INT: Set the number of concurrent API calls (default: 3).
Examples:
# Basic usage
repo-map /path/to/your/repo
# Use a specific model
repo-map /path/to/your/repo --model "google/gemini-2.5-flash-preview-09-2025"
# Auto-accept disclaimer
repo-map /path/to/your/repo -y
๐ Example: Snake Game Repository Map
Here's an example of a repo-map generated for an advanced Snake game implemented in Python:
/ (SSSnakeGame)
โโโ main.py (Python)
โ โโโ Description: Entry point for the Snake game, initializes the game environment and runs the main event loop.
โ โโโ Developer Consideration: "The game loop is tightly bound to Pygame's event system; any significant changes will require familiarity with Pygame's architecture."
โ โโโ Maintenance Flag: Stable
โ โโโ Architectural Role: Entrypoint
โ โโโ Code Quality Score: 8/10
โ โโโ Refactoring Suggestions: "Isolate game state management from the rendering logic to improve testability and reduce complexity."
โ โโโ Security Assessment: "None"
โโโ config.py (Python)
โ โโโ Description: Centralizes all static configuration parameters for the game, such as screen dimensions, colors, and snake speed.
โ โโโ Developer Consideration: "Changing screen dimensions may require adjustments to the food spawning logic to ensure it appears within bounds."
โ โโโ Maintenance Flag: Volatile
โ โโโ Architectural Role: Configuration
โ โโโ Code Quality Score: 9/10
โ โโโ Refactoring Suggestions: "Consider using a more structured configuration format like YAML or JSON for easier management, especially if settings become more complex."
โ โโโ Security Assessment: "None"
โโโ assets/
โ โโโ images/
โ โ โโโ snake_head.png (Image)
โ โ โโโ food.png (Image)
โ โโโ sounds/
โ โโโ eat.wav (Audio)
โ โโโ game_over.mp3 (Audio)
โโโ requirements.txt (Text)
โ โโโ Description: Lists all Python package dependencies required to run the project, such as `pygame`.
โโโ README.md (Markdown)
โโโ Description: Provides a comprehensive overview of the project, including setup instructions, gameplay details, and contribution guidelines.
โโโโโโโโโโโโโโโ
This example demonstrates how repo-map provides a comprehensive overview of a Snake game project, including file descriptions, developer considerations, and key structural information.
๐ง Requirements
- Python 3.12+
- Poetry for dependency management.
- Dependencies are listed in
pyproject.toml.
๐ Configuration
Before using repo-map, you need to set up your OpenRouter API key. Set the following environment variable:
export OPENROUTER_API_KEY=your_api_key_here
Replace your_api_key_here with your actual OpenRouter API key.
๐งฉ How It Works
- ๐ Walks through the repository directory structure
- ๐ Analyzes file contents and extracts key information (imports, functions, classes)
- ๐ค Utilizes an LLM (via OpenRouter) to generate descriptions and developer considerations
- ๐๏ธ Caches results in SQLite for efficient processing of unchanged files
- ๐ Generates a comprehensive tree-like structure of the repository
- ๐พ Saves the output as a Markdown file for easy viewing and sharing
๐ Key Components
main.py: Encapsulates the core CLI application logic within theRepoMapAppclass and serves as the main entry point.file_scanner.py: Handles scanning the repository, parsing.gitignore, and summarizing files.code_parser.py: Extracts structures like classes, functions, and imports from code files.llm_service.py: Manages interaction with the LLM for generating descriptions.cache_manager.py: Implements caching logic using SQLite to avoid reprocessing unchanged files.config.py: Manages application settings and API keys using Pydantic.models.py: Contains data models, including the list of supported languages.
๐ Additional Notes
- The tool supports a wide range of file types and programming languages. Check the
SUPPORTED_LANGUAGESdictionary in the script for a full list. - A pre-enhanced repository summary is saved to
.repo_map_structure.jsonas an intermediate step. - The tool uses a manual ignore list for generated files like
.repo_map_structure.jsonand.repo-map-cache.db. - SSL verification is handled using the certifi library for secure API communications.
๐ก๏ธ License
This project is licensed under the Apache 2.0 License. See the LICENSE file in the root directory of this project for the full license text.
๐ค Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
๐ Support
If you encounter any problems or have any questions, please open an issue in the GitHub repository.
๐ฆ Version
Current version: 0.4.0
โ ๏ธ Disclaimer
By using this tool, you acknowledge that files will be sent to the OpenRouter LLM for processing. Ensure you have the necessary permissions and consider any sensitive information in your repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repo_map-0.4.0.tar.gz.
File metadata
- Download URL: repo_map-0.4.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cea7d0535ae7d1b876a4719befe4d19d2b9e59f2be45c7527a685ce8c185584b
|
|
| MD5 |
1283d40763e787f65f67449d751cdd9f
|
|
| BLAKE2b-256 |
74e2e2cec13392db7149808ac6d23079eb07017f2f5c931ebde978c700dddf65
|
File details
Details for the file repo_map-0.4.0-py3-none-any.whl.
File metadata
- Download URL: repo_map-0.4.0-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a18f9243fab6a4f93952c4b2f96382e6bb186bdac7300f03f0bc3dd41be1695b
|
|
| MD5 |
40911820df45e61c51800f534ed96559
|
|
| BLAKE2b-256 |
6a9236ce5fc69379fdeae9535e6ca325ed0c5895aa45af83e8cd48bdb374f459
|