Skip to main content

🏥 RepoDoctor

AI-Powered Repository Health Analysis Using GitHub Copilot CLI

RepoDoctor

Python 3.11+ License: MIT Code style: ruff Type checked: ty codecov PyPI version

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:

  1. Python 3.11 or higher
  2. GitHub Copilot CLI - RepoDoctor depends on this for all analysis
    npm install -g @github/copilot
    
  3. 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

  1. No Hardcoded Rules - All analysis is performed by Copilot CLI
  2. Schema-Driven - Pydantic schemas ensure consistent output
  3. Retry Logic - Automatic retry with stricter formatting on JSON parse failure
  4. Safe by Default - Never overwrites files without explicit --in-place flag
  5. 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 cache
  • DIET.md - Diet analysis output (default for diet command)
  • TOUR.md - Generated onboarding guide (default for tour command)
  • REPODOCTOR_REPORT.md - Generated report (default for report command)
  • Dockerfile.repodoc - Fixed Dockerfile (if you run docker --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

📮 Contact & Support


Built with ❤️ and 🤖 by @k1lgor using GitHub Copilot CLI

Metadata

Release files for repodoc 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repodoc 0.2.0
File Size Uploaded
repodoc-0.2.0.tar.gz 163.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for repodoc 0.2.0
File Interpreter ABI Platform
repodoc-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 221.6 kB

Release files / repodoc-0.2.0.tar.gz

Download URL repodoc-0.2.0.tar.gz
Size 163.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9966a83e2aef67be2699a4475aa36ca864e8e09c07e0897b2294b0081ace5f22
BLAKE2b-256 checksum
How to use checksums
df28cab957167730f046e343f8787874fd4266e7541631b57ed637ea971ef0c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

Release files / repodoc-0.2.0-py3-none-any.whl

Download URL repodoc-0.2.0-py3-none-any.whl
Size 58.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
463a80568b632a8987bbfaa9413de7716eb85965eb128632bc9191ebb2978a30
BLAKE2b-256 checksum
How to use checksums
e94a67898c95d7f2fbb92b7bb40678e18e7de243ad83c3a58df30fdaf38216ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page