A Copilot-first CLI tool for repository health analysis
Project description
๐ฅ RepoDoctor
AI-Powered Repository Health Analysis Using GitHub Copilot CLI
RepoDoctor is a Copilot-first CLI tool that analyzes your repository's health by delegating all analysis logic to GitHub Copilot CLI. Instead of hardcoded rules, RepoDoctor acts as a prompt library and workflow orchestrator, letting AI provide contextual, intelligent insights about your codebase.
โจ Features
- ๐ Diet Analysis - Identify bloat, large files, and missing hygiene files
- ๐ Tour Generation - Create onboarding guides (TOUR.md) for new contributors
- ๐ณ Dockerfile Analysis - Security and optimization recommendations
- ๐ Dead Code Detection - Find unused code with confidence levels
- ๐ฌ Health Scanning - Comprehensive multi-module analysis with scoring
- ๐ Report Generation - Beautiful Markdown reports from scan results
๐ฏ Why RepoDoctor?
Traditional static analysis tools use hardcoded rules that can't understand context.
RepoDoctor is different:
- โ Uses AI (GitHub Copilot) for contextual understanding
- โ Provides actionable recommendations, not just lint errors
- โ Understands your specific tech stack and patterns
- โ Generates human-readable reports and documentation
- โ Easy to extend with new prompt templates
๐ Prerequisites
Before using RepoDoctor, you need:
- Python 3.11 or higher
- GitHub Copilot CLI - RepoDoctor depends on this for all analysis
npm install -g @github/copilot
- Authenticated Copilot - Make sure you're authenticated:
copilot -> /login
Note: RepoDoctor delegates all analysis to Copilot CLI. Without it, RepoDoctor cannot function.
๐ Installation
Using uv (Recommended)
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install RepoDoctor
uv tool install repodoc
# Or install from source
git clone https://github.com/k1lgor/RepoDoctor.git
cd RepoDoctor
uv pip install -e .
Using pip
pip install repodoc
# Or from source
git clone https://github.com/k1lgor/RepoDoctor.git
cd RepoDoctor
pip install -e .
๐ Quick Start
Run a Full Health Scan
cd your-repository
repodoc scan
This will analyze your repository across multiple dimensions and provide an overall health score.
Analyze Repository Bloat
repodoc diet
Identifies large files, build artifacts, and missing hygiene files like .gitignore or LICENSE.
Generate an Onboarding Guide
repodoc tour
Creates a TOUR.md file with a comprehensive overview of your repository structure and architecture.
Analyze Dockerfiles
repodoc docker
Provides security and optimization recommendations for your Dockerfiles.
Detect Dead Code
repodoc deadcode
Finds potentially unused code with confidence levels (high/medium/low).
Generate a Report
repodoc report
Creates a detailed Markdown report from your latest scan results.
๐ Command Reference
repodoc scan
Run a comprehensive repository health scan across all analysis modules.
repodoc scan # Run full scan
repodoc scan --skip-docker # Skip Dockerfile analysis
repodoc scan --json # Output JSON instead of formatted text
repodoc scan --out results.json # Save results to file
repodoc scan --timeout 600 # Increase timeout for large repos
What it analyzes:
- Repository bloat and hygiene (diet module)
- Onboarding documentation quality (tour module)
- Dockerfile security and optimization (docker module)
- Dead code detection (deadcode module)
- Overall repository health score
repodoc diet
Analyze repository bloat and missing hygiene files.
repodoc diet # Run analysis (outputs Markdown to DIET.md)
repodoc diet --out report.md # Save to custom file
repodoc diet --json # Output JSON format
repodoc diet --timeout 300 # Optional: Custom timeout for large repos
Identifies:
- Largest files and directories
- Suspected build artifacts
- Missing hygiene files (.gitignore, LICENSE, etc.)
- Repository size breakdown
repodoc tour
Generate a comprehensive onboarding guide.
repodoc tour # Generate TOUR.md
repodoc tour --out GUIDE.md # Custom output file
repodoc tour --json # Output structured data
Creates:
- Project overview and architecture
- Tech stack identification
- Entry points and key directories
- Development setup instructions
repodoc docker
Analyze Dockerfiles for security and optimization.
repodoc docker # Analyze Dockerfiles
repodoc docker --fix # Generate Dockerfile.repodoc with fixes
repodoc docker --in-place # Apply fixes directly (โ ๏ธ overwrites!)
Checks for:
- Security vulnerabilities
- Best practices violations
- Optimization opportunities
- Multi-stage build recommendations
repodoc deadcode
Detect potentially unused code.
repodoc deadcode # Detect dead code
repodoc deadcode --json # Output JSON
Detects:
- Unused functions and classes
- Unreachable code
- Confidence levels (high/medium/low)
- Reasoning for each finding
repodoc report
Generate a Markdown report from scan results.
repodoc report # Generate REPODOCTOR_REPORT.md
repodoc report --out custom.md # Custom output file
๐จ Output Formats
RepoDoctor supports multiple output formats:
Terminal (Default)
Rich, colored terminal output with tables, panels, and progress indicators.
repodoc scan
JSON
Structured JSON output for programmatic consumption.
repodoc scan --json
File Output
Save results to a file for later analysis.
repodoc scan --out results.json
๐๏ธ Architecture
RepoDoctor follows a Copilot-first architecture:
โโโโโโโโโโโโโโโ
โ repodoc โ CLI Interface
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Prompt Templatesโ Structured prompts for each analysis type
โโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Copilot Invoker โ Subprocess management & retry logic
โโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ GitHub Copilot โ AI-powered analysis
โ CLI โ
โโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Output Parser โ JSON extraction & schema validation
โโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Renderers โ Terminal, JSON, or Markdown output
โโโโโโโโโโโโโโโโโโโโ
Key Design Principles
- No Hardcoded Rules - All analysis is performed by Copilot CLI
- Schema-Driven - Pydantic schemas ensure consistent output
- Retry Logic - Automatic retry with stricter formatting on JSON parse failure
- Safe by Default - Never overwrites files without explicit
--in-placeflag - Extensible - Add new analysis types by creating prompt templates
๐ง Configuration
RepoDoctor uses prompt templates stored in src/repodoc/prompts/v1/.
Custom Timeout
For large repositories, increase the timeout:
repodoc scan --timeout 600 # 10 minutes
Skip Modules
Skip specific analysis modules:
repodoc scan --skip-docker --skip-deadcode
๐ Troubleshooting
"Copilot CLI not found"
Solution: Install GitHub Copilot CLI:
npm install -g @github/copilot
"Authentication failed"
Solution: Authenticate with Copilot:
copilot -> /login
"Timeout error"
Solution: Increase timeout for large repositories:
repodoc scan --timeout 600
"Empty repository" error
Solution: Make sure you're in a directory with code files. RepoDoctor validates that the directory contains analyzable content.
JSON parsing failures
RepoDoctor automatically retries with stricter formatting instructions. If both attempts fail, check .repodoc/logs/ for raw output.
๐ Output Files
RepoDoctor creates the following in your repository:
.repodoc/- Cache directory for results and logs.repodoc/logs/- Raw Copilot CLI outputs for debugging.repodoc/last_scan.json- Latest scan results cacheDIET.md- Diet analysis output (default fordietcommand)TOUR.md- Generated onboarding guide (default fortourcommand)REPODOCTOR_REPORT.md- Generated report (default forreportcommand)Dockerfile.repodoc- Fixed Dockerfile (if you rundocker --fix)
Note: Consider adding .repodoc/ to your .gitignore to avoid committing cache files.
๐งช Development
Setup
# Clone the repository
git clone https://github.com/yourusername/repodoc.git
cd repodoc
# Install with development dependencies using uv
uv pip install -e ".[dev]"
# Or with pip
pip install -e ".[dev]"
Running Tests
# Run all tests with coverage
uv run pytest
# Run specific test file
uv run pytest tests/test_copilot.py
# Run with verbose output
uv run pytest -v
# Run only unit tests
uv run pytest -m unit
Code Quality
# Format code
uv run ruff format src/ tests/
# Lint code
uv run ruff check src/ tests/
# Type check
uv run ty check src/
# Run all quality checks
uv run ruff check src/ && uv run ty check src/
Project Structure
repodoc/
โโโ src/repodoc/ # Main package
โ โโโ cli.py # CLI entry point
โ โโโ commands/ # Command implementations
โ โโโ core/ # Core functionality
โ โ โโโ copilot.py # Copilot CLI invocation
โ โ โโโ parser.py # Output parsing
โ โ โโโ logger.py # Logging utilities
โ โ โโโ exceptions.py # Custom exceptions
โ โโโ prompts/ # Prompt templates
โ โ โโโ v1/ # Version 1 templates
โ โโโ renderers/ # Output formatting
โ โโโ schemas/ # Pydantic schemas
โ โโโ __init__.py
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ pyproject.toml # Project metadata
โโโ README.md # This file
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Ways to Contribute
- ๐ Report bugs and issues
- ๐ก Suggest new features or analysis types
- ๐ Improve documentation
- ๐ง Submit pull requests
- ๐ Add new prompt templates
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with Typer for the CLI framework
- Uses Rich for beautiful terminal output
- Powered by GitHub Copilot CLI for AI analysis
- Schema validation with Pydantic
๐ฎ Contact & Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Author: Plamen Ivanov
Built with โค๏ธ and ๐ค by @k1lgor using GitHub Copilot CLI
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 repodoc-0.2.0.tar.gz.
File metadata
- Download URL: repodoc-0.2.0.tar.gz
- Upload date:
- Size: 163.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9966a83e2aef67be2699a4475aa36ca864e8e09c07e0897b2294b0081ace5f22
|
|
| MD5 |
1d790a96902781c7177bb02b1816a5a6
|
|
| BLAKE2b-256 |
df28cab957167730f046e343f8787874fd4266e7541631b57ed637ea971ef0c6
|
Provenance
The following attestation bundles were made for repodoc-0.2.0.tar.gz:
Publisher:
release.yml on k1lgor/RepoDoctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
repodoc-0.2.0.tar.gz -
Subject digest:
9966a83e2aef67be2699a4475aa36ca864e8e09c07e0897b2294b0081ace5f22 - Sigstore transparency entry: 1077042597
- Sigstore integration time:
-
Permalink:
k1lgor/RepoDoctor@66e8081b3f4c97ccdf9ec94843d1afe7f79031b4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/k1lgor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66e8081b3f4c97ccdf9ec94843d1afe7f79031b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file repodoc-0.2.0-py3-none-any.whl.
File metadata
- Download URL: repodoc-0.2.0-py3-none-any.whl
- Upload date:
- Size: 58.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
463a80568b632a8987bbfaa9413de7716eb85965eb128632bc9191ebb2978a30
|
|
| MD5 |
3b951c18ff21449b10651a9319162ea9
|
|
| BLAKE2b-256 |
e94a67898c95d7f2fbb92b7bb40678e18e7de243ad83c3a58df30fdaf38216ae
|
Provenance
The following attestation bundles were made for repodoc-0.2.0-py3-none-any.whl:
Publisher:
release.yml on k1lgor/RepoDoctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
repodoc-0.2.0-py3-none-any.whl -
Subject digest:
463a80568b632a8987bbfaa9413de7716eb85965eb128632bc9191ebb2978a30 - Sigstore transparency entry: 1077042606
- Sigstore integration time:
-
Permalink:
k1lgor/RepoDoctor@66e8081b3f4c97ccdf9ec94843d1afe7f79031b4 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/k1lgor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66e8081b3f4c97ccdf9ec94843d1afe7f79031b4 -
Trigger Event:
push
-
Statement type: