Generate a professional README.md from any GitHub or local repository. repo2readme analyzes your project structure and file contents, then uses AI models to draft and iteratively refine a comprehensive, well-written README.
- About the Project
- Key Features
- Installation
- Usage
- Configuration
- Tech Stack
- How It Works
- Contributing
- License
repo2readme is a command-line interface (CLI) tool designed to automate the creation of high-quality README.md files. It scans your repository, summarizes key files, and iteratively generates and refines a README using AI agents. Whether your project is hosted on GitHub or resides locally, repo2readme streamlines documentation so your projects stay well-explained and easy to understand.
- Repository Analysis β automatically loads files and content from GitHub URLs or local directories.
- Intelligent Summarization β uses a Groq LLM to summarize individual source files, capturing their purpose and functionality.
- Hierarchical Tree Generation β creates a visual representation of your repository's directory structure.
- AI-Powered README Creation β employs a Google Gemini model to draft comprehensive, structured
README.mdcontent. - Iterative Refinement β a reviewer agent (Google Gemini) scores and improves the generated README until a high-quality standard is met.
- File Filtering β automatically ignores common development artifacts (
.git,node_modules,__pycache__, lock files, images, archives, etc.), with--include/--exclude/--max-file-size-kbfor fine control.
Requires Python 3.10+.
pip install repo2readmeOr install from source:
git clone https://github.com/agsaru/repo2readme.git
cd repo2readme
pip install -e .Verify it installed:
repo2readme --helprepo2readme provides two commands: run to generate a README, and reset to clear stored API keys.
From a GitHub repository URL:
repo2readme run --url https://github.com/agsaru/repo2readme -o README_NEW.mdFrom a local repository path:
repo2readme run --local ./path/to/your/repo -o README_LOCAL.md| Flag | Short | Description |
|---|---|---|
--url <URL> |
-u |
GitHub repository URL to process. |
--local <PATH> |
-l |
Path to a local repository. |
--output <FILE_PATH> |
-o |
Output file path (defaults to README.md). |
--force |
-f |
Overwrite output and skip the confirmation prompt. |
--dry-run |
Preview file selection & token estimate β no API calls, no keys required. | |
--include <PATTERN> |
Glob pattern to force-include a file, even if normally filtered. | |
--exclude <PATTERN> |
Glob pattern to exclude a file. | |
--max-file-size-kb <N> |
Skip files larger than N KB. |
You must provide exactly one of --url or --local.
Before making any API calls, repo2readme estimates file count, token usage, and request size, then asks for confirmation:
Repository Analysis
Files to summarize : 45
Estimated tokens : ~120,000
Request size : ~420.5 KB
Proceed? [y/N]
Pass --force to skip this prompt and overwrite the output automatically.
Preview what will be processed β no API calls, no API keys needed:
repo2readme run --local ./path/to/your/repo --dry-runRepository Tree
project/
βββ src/
βββ tests/
βββ README.md
Files to be processed
β src/main.py
β src/api.py
β tests/test_api.py
...
Repository Analysis
Files selected : 45
Estimated tokens : ~120,000
Request size : ~420.5 KB
Dry run complete.
No API requests were made.
Default filters skip generated files, build artifacts, lock files, images, archives, and similar noise. Adjust with --include/--exclude/--max-file-size-kb:
repo2readme run --local ./my-project --include "package.json"
repo2readme run --local ./my-project --exclude "tests/*"
repo2readme run --local ./my-project --include "*.json" --max-file-size-kb 200repo2readme resetDeletes the local key config file; you'll be re-prompted on the next run.
repo2readme needs two API keys:
| Variable | Used for |
|---|---|
GROQ_API_KEY |
File summarization (Groq openai/gpt-oss-120b) |
GOOGLE_API_KEY |
README generation & review (Gemini 2.5-flash) |
On first run, the CLI prompts for these interactively and saves them to ~/.repo2readme_env.json for future runs. Alternatively, set them as environment variables:
export GROQ_API_KEY="your_groq_api_key"
export GOOGLE_API_KEY="your_google_api_key"- π Python (>=3.10)
- π οΈ Setuptools
- π±οΈ Click β CLI interface
- β¨ Rich β terminal output & progress displays
- βοΈ GitPython β Git repository interaction
- π python-dotenv β environment variable management
- π¦ LangChain (+ Community, Groq, Google GenAI integrations)
- π¨ Groq β fast inference (
openai/gpt-oss-120bfor summarization) - π Google GenAI β Gemini models (
gemini-2.5-flashfor generation & review) - Pydantic β data validation for the reviewer agent schema
- Repository Loading β a
RepoLoaderpicks aUrlRepoLoader(clones the GitHub repo into a temp directory) orLocalRepoLoader(reads your filesystem), and appliesgithub_file_filterto skip irrelevant files (.git,node_modules,package-lock.json,.env, binaries, etc.). - Structure & File Analysis β
generate_treebuilds a visual directory tree; each file's language is detected viadetect_lang;summarize_fileuses a Groq LLM to produce a concise, JSON-formatted summary of each file's purpose. - Iterative README Generation β a LangGraph state machine alternates between:
- Generation (
generate_readme_node, Gemini 2.5 Flash) β drafts a README from file summaries, the repo tree, prior drafts, and reviewer feedback. - Review (
readme_reviewer_node, Gemini 2.5 Flash) β scores the draft (1β10) with feedback. - The loop stops once the README scores 8.5+ or a max iteration count is hit.
- Generation (
- Output β the best-scoring README is printed or saved to your chosen output file (default
README.md).
repo2readme/config.py handles secure API key storage/loading, and force_remove safely cleans up temporary clone directories.
Contributions are welcome! Whether you're fixing bugs, improving documentation, or adding new features, your help is appreciated. Please read the Contributing Guide for setup, coding standards, and the pull request process. By participating, you agree to abide by our Code of Conduct.
This project is licensed under the MIT License. See LICENSE for details.
Copyright (c) 2025 Sarowar Jahan Biswas