repotoire 0.2.20

Graph-powered code analysis CLI
repotoire-0.2.20 is not a library.

Repotoire 🎼

Graph-Powered Code Intelligence β€” Local-First, Blazing Fast

Repotoire builds a knowledge graph of your codebase to detect architectural issues, code smells, and security vulnerabilities that traditional linters miss.

PyPI Python 3.10+ License: MIT

Why Repotoire?

Most linters analyze files in isolation. Repotoire sees the whole picture:

Traditional Linters          Repotoire
─────────────────────        ─────────────────────
file1.py βœ“                   file1.py ──┐
file2.py βœ“                   file2.py ──┼── Knowledge Graph
file3.py βœ“                   file3.py β”€β”€β”˜
                                  β”‚
                             Circular deps?
                             God classes?
                             Dead code?
                             Coupling hotspots?

Quick Start

Option 1: Download Binary (Easiest)

# Linux
curl -L https://github.com/Zach-hammad/repotoire/releases/latest/download/repotoire-linux-x86_64.tar.gz | tar xz
sudo mv repotoire /usr/local/bin/

# macOS (Apple Silicon)
curl -L https://github.com/Zach-hammad/repotoire/releases/latest/download/repotoire-macos-aarch64.tar.gz | tar xz
sudo mv repotoire /usr/local/bin/

# macOS (Intel)
curl -L https://github.com/Zach-hammad/repotoire/releases/latest/download/repotoire-macos-x86_64.tar.gz | tar xz
sudo mv repotoire /usr/local/bin/

Option 2: Cargo Binstall (No cmake needed)

cargo binstall repotoire

Option 3: Cargo Install

# Requires cmake (see Build Dependencies below)
cargo install repotoire

Option 3: pip

pip install repotoire

That's it. No API keys required. No Docker. No cloud account.

Upgrading from Python version? Delete the old database first: rm -rf .repotoire

Build Dependencies (for cargo install)

Building from source requires cmake:

# macOS
brew install cmake

# Ubuntu/Debian
sudo apt install cmake build-essential

# Fedora
sudo dnf install cmake gcc-c++

# Windows
winget install cmake

⚑ Performance

Rust-accelerated parsing. 3,000 files in under a minute.

Codebase Files Time Speed
Django 3,000 55s 54 files/sec
Express.js 141 0.02s 7,500 files/sec
Medium project 500 ~10s 50 files/sec

Progress bars show you what's happening:

Processing files... β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘ 75% (375/500) 0:00:08

What It Finds

47 detectors across 4 categories:

πŸ—οΈ Architecture

  • Circular dependencies (Tarjan's SCC algorithm)
  • Architectural bottlenecks (betweenness centrality)
  • Hub dependencies (fragile central nodes)
  • Module cohesion problems

πŸ” Code Smells

  • God classes (too many responsibilities)
  • Dead code (unreachable functions/classes)
  • Feature envy (methods using wrong class data)
  • Shotgun surgery (changes ripple everywhere)
  • AI-generated code patterns (complexity spikes, churn, naming)

πŸ”’ Security

  • SQL injection patterns
  • Hardcoded secrets (API keys, passwords)
  • Unsafe deserialization (pickle, yaml.load)
  • Eval/exec with user input
  • GitHub Actions injection

πŸ“Š Quality

  • Complexity hotspots
  • Type hint coverage gaps
  • Duplicate code blocks
  • Missing tests for new functions

Sample Output

╔════════════════════ 🎼 Repotoire Health Report ════════════════════╗
β•‘  Grade: B                                                          β•‘
β•‘  Score: 82.5/100                                                   β•‘
β•‘  Good - Minor improvements recommended                             β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Category            β”‚ Weight β”‚ Score     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Graph Structure     β”‚  40%   β”‚ 85.0/100  β”‚
β”‚ Code Quality        β”‚  30%   β”‚ 78.3/100  β”‚
β”‚ Architecture Health β”‚  30%   β”‚ 84.2/100  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Findings (23 total)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ”΄ Critical β”‚     2 β”‚
β”‚ 🟠 High     β”‚     5 β”‚
β”‚ 🟑 Medium   β”‚    12 β”‚
β”‚ πŸ”΅ Low      β”‚     4 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜

Supported Languages

Language Parsing Call Graph Imports Inheritance
Python βœ… βœ… βœ… βœ…
TypeScript βœ… βœ… βœ… βœ…
JavaScript βœ… βœ… βœ… βœ…
Go βœ… βœ… βœ… βœ…
Java βœ… βœ… βœ… βœ…
Rust βœ… βœ… βœ… βœ…
C/C++ βœ… βœ… βœ… βœ…
C# βœ… βœ… βœ… βœ…
Kotlin βœ… βœ… βœ… βœ…

All languages use tree-sitter for parsing, compiled to native code via Rust.

CLI Reference

# Analysis
repotoire analyze .                    # Full analysis
repotoire analyze . --offline          # Skip cloud sync
repotoire analyze . --output report.json
repotoire analyze . --format html

# Graph operations
repotoire ingest .                     # Build graph only
repotoire ask "what calls UserService" # Natural language queries

# Utilities
repotoire doctor                       # Check your setup
repotoire version                      # Show version info

Doctor Output

$ repotoire doctor

Repotoire Doctor

βœ“ Python version: 3.12.0
βœ“ Rust extension: Loaded
⚠ API keys: Present: OPENAI | Missing: ANTHROPIC, DEEPINFRA
βœ“ Kuzu database: Importable v0.11.3
βœ“ Disk space (home): 150.2GB free (35% used)

AI-Powered Fixes (Optional)

Bring your own API key for AI-assisted fixes:

# Pick any provider (in order of recommendation):
export ANTHROPIC_API_KEY=sk-ant-...   # Claude (best quality)
export OPENAI_API_KEY=sk-...          # GPT-4
export DEEPINFRA_API_KEY=...          # Llama 3.3 (cheapest!)
export OPENROUTER_API_KEY=...         # Any model

repotoire fix 1                       # Fix finding #1

Get your key:

No API key? No problem. All analysis works offline.

Configuration

Create .repotoirerc or repotoire.toml:

[analysis]
patterns = ["**/*.py", "**/*.ts", "**/*.go", "**/*.java", "**/*.rs", "**/*.c", "**/*.cpp", "**/*.cs", "**/*.kt"]
exclude = ["**/node_modules/**", "**/venv/**", "**/target/**", "**/bin/**", "**/obj/**"]

[detectors.god_class]
threshold_methods = 20
threshold_lines = 500

[detectors.circular_dependency]
enabled = true

How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Source  │───▢│ Rust Parser   │───▢│  Kuzu Graph  │───▢│ Detectorsβ”‚
β”‚  Files   β”‚    β”‚ (tree-sitter) β”‚    β”‚  (embedded)  β”‚    β”‚   (47)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚                                      β”‚
     β”‚         6 languages                  β”‚      Graph algorithms:
     β”‚         Parallel parsing             β”‚      β€’ Tarjan's SCC
     β”‚         ~7,500 files/sec             β”‚      β€’ Betweenness centrality
     β”‚                                      β”‚      β€’ Community detection
     β”‚                                      β–Ό
     β”‚                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     └──────────────────────────────▢│   Reports    β”‚
                                     β”‚ CLI/HTML/JSONβ”‚
                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key components:

  • Tree-sitter β€” Fast, accurate parsing for all languages
  • Kuzu β€” Embedded graph database (no external deps)
  • Rust extension β€” Native speed for parsing + graph algorithms

CI/CD Integration

GitHub Actions

- name: Code Health Check
  run: |
    pip install repotoire
    repotoire analyze . --output report.json
    
- name: Fail on critical issues
  run: |
    CRITICAL=$(jq '.findings | map(select(.severity == "critical")) | length' report.json)
    if [ "$CRITICAL" -gt 0 ]; then exit 1; fi

Pre-commit Hook

# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: repotoire
        name: repotoire
        entry: repotoire analyze . --offline
        language: system
        pass_filenames: false

Comparison

Feature Repotoire SonarQube CodeClimate
Local-first βœ… ❌ ❌
No Docker βœ… ❌ βœ…
Graph analysis βœ… Partial ❌
Multi-language 6 Many Many
Circular deps βœ… βœ… ❌
Dead code βœ… βœ… βœ…
AI code smell detection βœ… ❌ ❌
BYOK AI fixes βœ… ❌ ❌
Free βœ… Limited Limited

Troubleshooting

"Cannot open file .repotoire/kuzu_db/.lock: Not a directory"

You have a stale database from a previous version. Delete it:

rm -rf .repotoire
repotoire analyze .

"cmake not installed" during cargo install

Install cmake first:

# macOS
brew install cmake

# Ubuntu/Debian
sudo apt install cmake build-essential

# Or use cargo binstall (no cmake needed)
cargo binstall repotoire

Analysis is slow

Use --relaxed for faster runs (only high-severity findings):

repotoire analyze . --relaxed

Documentation

  • Schema Reference β€” Graph node/edge types and Cypher examples
  • Detectors β€” Full list of 47 detectors with configuration

Contributing

git clone https://github.com/Zach-hammad/repotoire
cd repotoire
pip install -e ".[dev]"
pytest

The Rust extension builds automatically on first install.

License

MIT β€” see LICENSE


Get started β†’

pip install repotoire && repotoire analyze .