Automated technical documentation generator for code repositories using LLM analysis
RepoDoctor analyzes your code repositories and generates comprehensive technical documentation using Large Language Model (LLM) analysis through OpenRouter API. It supports multiple programming languages and can output both Markdown documentation and beautiful Docusaurus websites.
- 🔍 Multi-language Analysis: Python, JavaScript, TypeScript, Java, C/C++, Rust, Go, and more
- 📊 Dependency Extraction: Automatic analysis of imports and module relationships
- 📚 Structured Documentation: Clean Markdown files with navigation
- 🌐 Docusaurus Integration: Generate modern documentation websites
- ⚡ Parallel Processing: Fast documentation generation with configurable workers
- 🎯 Smart Filtering: Ignore patterns and hidden file handling
- 🔧 Professional CLI: Easy-to-use command-line interface
pip install repodoctor
RepoDoctor uses OpenRouter API for LLM analysis. Get your API key from OpenRouter and set it:
export OPENROUTER_API_KEY="your-api-key-here"
Or create a .env
file:
OPENROUTER_API_KEY=your-api-key-here
# Generate documentation for a repository
repodoctor /path/to/your/project
# Generate with Docusaurus website
repodoctor /path/to/your/project --docusaurus
# Full automatic mode (generate + install + start)
repodoctor /path/to/your/project --docusaurus --auto-install --auto-start
# Analyze current directory
repodoctor .
# Analyze specific project
repodoctor ../my-awesome-project
# Custom output directory
repodoctor /path/to/project --output ./project-docs
# Dry run to see what will be documented
repodoctor /path/to/project --dry-run
# More parallel workers for faster processing
repodoctor /path/to/project --workers 8
# Verbose logging
repodoctor /path/to/project --verbose
# Include hidden files in Docusaurus
repodoctor /path/to/project --docusaurus --docusaurus-show-hidden
# Generate beautiful documentation website
repodoctor /path/to/project --docusaurus
# Auto-install dependencies and start dev server
repodoctor /path/to/project --docusaurus --auto-install --auto-start
# Manual Docusaurus setup (if not using --auto-install)
cd project-name-docusaurus/website
npm install
npm start
RepoDoctor follows a clean, modular architecture:
repodoctor/
├── __init__.py # Package exports
├── cli.py # Command-line interface
├── generator.py # Main documentation generator
├── analyzer.py # Code analysis and dependency extraction
├── client.py # OpenRouter API client
└── docusaurus.py # Docusaurus site generation
- 🔍 Repository Scanning: Discovers all supported code files
- 📊 Dependency Analysis: Extracts imports and relationships
- 🤖 LLM Analysis: Generates documentation using AI
- 📝 Markdown Creation: Creates structured documentation files
- 🌐 Website Generation: (Optional) Builds Docusaurus site
Language | Extensions | Dependency Analysis |
---|---|---|
Python | .py |
✅ (import, from) |
JavaScript | .js , .jsx |
✅ (import, require) |
TypeScript | .ts , .tsx |
✅ (import, require) |
Java | .java |
✅ (import) |
C/C++ | .c , .cpp , .h , .hpp |
✅ (#include) |
Rust | .rs |
✅ (use) |
Go | .go |
✅ (import) |
Config Files | .toml , .yaml , .json |
✅ |
Documentation | .md , .txt |
✅ |
docs/
├── README.md # Project overview and navigation
├── dependencies.md # Dependency graph analysis
├── file1.py.md # Individual file documentation
├── file2.js.md # Preserves directory structure
└── subdirectory/
└── module.py.md # Nested files maintained
project-docusaurus/
├── README.md # Setup instructions
├── website/ # Docusaurus project
│ ├── docs/ # Processed documentation
│ ├── src/ # React components
│ ├── static/ # Static assets
│ ├── docusaurus.config.ts # Site configuration
│ ├── sidebars.ts # Navigation structure
│ └── package.json # Dependencies
# Required
OPENROUTER_API_KEY=sk-or-v1-...
# Optional
OPENAI_BASE_URL=https://openrouter.ai/api/v1 # Default OpenRouter endpoint
repodoctor --help
Option | Description | Default |
---|---|---|
--output , -o |
Output directory | {project}-docs-{uuid} |
--workers , -w |
Parallel workers | 3 |
--api-key |
OpenRouter API key | From environment |
--verbose , -v |
Verbose logging | False |
--dry-run |
Preview without generating | False |
--docusaurus |
Generate Docusaurus site | False |
--auto-install |
Auto-install dependencies | False |
--auto-start |
Auto-start dev server | False |
--docusaurus-show-hidden |
Include hidden files | False |
from repodoctor import DocumentationGenerator
# Initialize generator
generator = DocumentationGenerator(
repo_path="/path/to/project",
output_path="./docs",
api_key="your-api-key"
)
# Generate documentation
generator.generate_documentation(
max_workers=5,
enable_docusaurus=True,
auto_install=True,
auto_start=True
)
# Clone repository
git clone https://github.com/AlexanderOrlov/repodoctor.git
cd repodoctor
# Install in development mode
pip install -e .[dev]
# Run tests
pytest
# Format code
black repodoctor/
isort repodoctor/
# Type checking
mypy repodoctor/
# Build package
python -m build
# Upload to PyPI (requires authentication)
python -m twine upload dist/*
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Homepage: https://github.com/AlexanderOrlov/repodoctor
- PyPI: https://pypi.org/project/repodoctor/
- Issues: https://github.com/AlexanderOrlov/repodoctor/issues
- OpenRouter: https://openrouter.ai/
- OpenRouter for providing access to state-of-the-art LLM models
- Docusaurus team for the excellent documentation platform
- All contributors and users of RepoDoctor
Made with ❤️ for developers who love good documentation