Generate README.md from any GitHub or local repository
Project description
repo2readme
Generate a professional README.md from any GitHub or local
repository. This tool analyzes your project structure and file
contents, then leverages AI models to intelligently craft a
comprehensive and informative README.
๐ Table of Contents
- About the Project
- Tech Stack
- Key Features
- Folder Structure
- Installation
- Usage
- Configuration
- How It Works
- License
About the Project
repo2readme is a command-line interface (CLI) tool designed to
automate the creation of high-quality README.md files. It
intelligently scans your repository, summarizes key files, and then
iteratively generates and refines a README using advanced AI agents.
Whether your project is hosted on GitHub or resides locally,
repo2readme streamlines documentation, ensuring your projects are
well-explained and easily understood.
Tech Stack
The repo2readme project leverages a modern Python ecosystem for its
functionality:
- ๐ Python (>=3.10)
- ๐ ๏ธ Setuptools
- ๐ฑ๏ธ Click: For building intuitive command-line interfaces.
- โจ Rich: For beautiful terminal output and progress displays.
- โ๏ธ GitPython: For programmatic interaction with Git repositories.
- ๐ python-dotenv: For managing environment variables.
- ๐ฆ LangChain: A framework for developing applications powered by
language models. - ๐ LangChain Community: Community integrations for LangChain.
- ๐ง LangChain Groq: Integration for Groq language models.
- ๐ LangChain Google GenAI: Integration for Google Generative AI
models. - ๐จ Groq: For fast inference with language models (specifically
openai/gpt-oss-120bfor summarization). - ๐ Google GenAI: For accessing Google Gemini models
(
gemini-2.5-flashfor README generation and review). - Pydantic: For data validation and settings management (used in
reviewer agent schema). - os, json, tempfile, shutil, stat, operator, typing: Standard Python libraries for system interactions, data handling, and type hinting.
Key Features
- 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 and structuredREADME.mdcontent. - Iterative Refinement: Utilizes an agent-based workflow with a
reviewer agent (Google Gemini) to iteratively score and improve the
generated README until a high-quality standard is met. - API Key Management: Securely stores and manages API keys for
Groq and Google Gemini services in your local environment. - File Filtering: Automatically ignores common development
artifacts (.git,node_modules,__pycache__, etc.) to focus on
relevant project files.
Folder Structure
Repo2Readme/
โโโ LICENSE
โโโ pyproject.toml
โโโ repo2readme/
โโโ config.py
โโโ cli/
โโโ main.py
โโโ loaders/
โโโ loader.py
โโโ repo_loader.py
โโโ readme/
โโโ agent_workflow.py
โโโ readme_generator.py
โโโ reviewer_agent.py
โโโ summerize/
โโโ summary.py
โโโ utils/
โโโ detect_language.py
โโโ filter.py
โโโ force_remove.py
โโโ tree.py
Installation
To install repo2readme, you need Python 3.10 or higher.
-
Clone the repository (optional, if installing from source):
git clone https://github.com/agsaru/repo2readme.git cd repo2readme
-
Install the package:
pip install repo2readme
Usage
repo2readme provides two main commands: run to generate a README
and reset to clear your stored API keys.
1. Generate a README
Use the run command with either a GitHub repository URL or a local
path.
From a GitHub Repository URL:
repo2readme run --url https://github.com/agsaru/repo2readme -o
README_NEW.md
From a Local Repository Path:
repo2readme run --local ./path/to/your/repo -o README_LOCAL.md
Options:
-u,--url <URL>: GitHub repository URL to process.-l,--local <PATH>: Path to a local repository.-o,--output <FILE_PATH>: File path to save the generated
README (defaults toREADME.md).
2. Reset API Keys
To clear your stored Groq and Google Gemini API keys:
repo2readme reset
This will delete the configuration file storing your keys, prompting
you to re-enter them on the next run command.
Configuration
repo2readme requires API keys for Groq and Google Gemini to interact
with large language models. These keys can be provided either as
environment variables or will be prompted for and saved locally.
API Keys
- GROQ_API_KEY: Required for accessing the Groq LLM (used for
file summarization). - GOOGLE_API_KEY: Required for accessing Google Generative AI
(Gemini) models (used for README generation and review).
When repo2readme run is executed for the first time or if keys are
missing, the CLI will interactively prompt you to enter them. These
keys are then saved in a JSON file at ~/.repo2readme_env.json for
future use.
Alternatively, you can set these as system environment variables:
export GROQ_API_KEY="your_groq_api_key"
export GOOGLE_API_KEY="your_google_api_key"
How It Works
The repo2readme tool orchestrates a sophisticated workflow to
generate a README:
-
Repository Loading:
- Based on your input (GitHub URL or local path), a
RepoLoaderdetermines whether to use aUrlRepoLoader(which clones the GitHub
repository into a temporary directory) or aLocalRepoLoader(which
reads from your local filesystem). - During loading, an intelligent filter (
github_file_filter) is applied to ignore irrelevant files and directories (e.g.,.git,
node_modules,package-lock.json,.env, various binary or data
files), focusing only on source code and essential project files.
- Based on your input (GitHub URL or local path), a
-
Repository Structure & File Analysis:
- A visual directory tree (
generate_tree) is constructed,
providing a clear overview of the project's structure. - For each relevant file, its programming language is detected
(detect_lang) based on its extension. - A
summarize_filefunction is then invoked, which uses a
specialized LangChain chain powered by the Groq LLM (openai/gpt-oss-120b) to generate a concise, JSON-formatted summary
of the file's content and purpose. This summary is tailored for README generation.
- A visual directory tree (
-
Iterative README Generation Workflow:
- The core of the README creation is handled by a LangGraph
state machine. This machine iteratively generates, reviews, and
refines the README. - Generation Node: The
generate_readme_nodeutilizes a
Google Gemini 2.5 Flash model via LangChain. It takes all file
summaries, the repository tree structure, any previousREADMEcontent, and reviewer feedback to produce a newREADME.mddraft. - Review Node: The
readme_reviewer_nodealso uses a
Google Gemini 2.5 Flash model. This agent evaluates the latest
README draft, assigns it a quality score (1-10), and provides constructive feedback for improvement. - Conditional Loop: The workflow continues looping between
generation and review. The process stops when the generatedREADME
achieves a score of 8.5 or higher, or if a maximum number of iterations is reached, ensuring a high-quality output while preventing infinite
loops.
- The core of the README creation is handled by a LangGraph
-
Output:
- The best-scoring
README.mdgenerated during the iterative
process is selected. - This final
READMEcontent is then either printed to the
console or saved to the specified output file (defaulting toREADME.md).
- The best-scoring
Throughout this process, repo2readme/config.py manages the secure
loading and saving of API keys, prompting the user for input if
necessary. Temporary directories created during remote repository
cloning are also safely cleaned up using force_remove.
License
This project is licensed under the MIT License.
Copyright (c) 2025 Sarowar Jahan Biswas
Permission is hereby granted, free of charge, to any person obtaining a
copy
of this software and associated documentation files (the "Software"),
to deal
in the Software without restriction, including without limitation the
rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
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 repo2readme-1.0.2.tar.gz.
File metadata
- Download URL: repo2readme-1.0.2.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1cd155f91e1f95cd0652eef96fde03246fa24aa5e4f33769730db522388a97c
|
|
| MD5 |
24fe357cd4e9db83ade5544bb4403d13
|
|
| BLAKE2b-256 |
c4af9512db347131870d02d5876223f9ed067feff222c94a22428093d517ceb1
|
File details
Details for the file repo2readme-1.0.2-py3-none-any.whl.
File metadata
- Download URL: repo2readme-1.0.2-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a42c469ac7078c1c4474a809d1b030c0c93e07bfed215f5cc321bcb2c2fa3619
|
|
| MD5 |
e3909f574de35fc917ec6ba4bf6a96b1
|
|
| BLAKE2b-256 |
55c39d2defb8b85ed975a5e60d9afac1f6fd12bd018ab9f939f0d0d1ef68a5b3
|