Skip to main content

CLI Overview

The Repotoire CLI provides a powerful command-line interface for analyzing codebases, managing knowledge graphs, and integrating with CI/CD pipelines.

Installation

# Using pip
pip install repotoire

# Using uv (recommended)
uv pip install repotoire

# With optional dependencies
pip install repotoire[dev,gds,all-languages]

Quick Start

# 1. Initialize configuration
repotoire init

# 2. Start Neo4j (if not running)
docker run -d --name neo4j -p 7474:7474 -p 7687:7687 \
  -e NEO4J_AUTH=neo4j/password neo4j:latest

# 3. Ingest your codebase
repotoire ingest ./my-project

# 4. Run analysis
repotoire analyze ./my-project

# 5. Ask questions with natural language
repotoire ask "Where is authentication handled?"

Command Categories

Core Commands

CommandDescription
ingestParse codebase and build knowledge graph
analyzeRun health analysis and generate reports
askAsk questions using natural language (RAG)
validateTest configuration and connectivity

Setup Commands

CommandDescription
initCreate configuration file interactively
show-configDisplay effective configuration
backendsShow available embedding backends

Analysis Commands

CommandDescription
hotspotsFind code flagged by multiple detectors
auto-fixAI-powered automatic code fixing
securitySecurity scanning and compliance
styleAnalyze code style conventions

Graph Commands

CommandDescription
graphDatabase management for multi-tenancy
schemaManage and inspect graph schema
embeddingsManage vector embeddings

History Commands

CommandDescription
historyIngest git history for temporal analysis
historicalQuery code evolution
metricsQuery historical metrics from TimescaleDB
compareCompare metrics between commits

Advanced Commands

CommandDescription
mlML commands for training data extraction
monorepoMonorepo analysis and optimization
ruleManage custom code quality rules
templatesManage fix templates
migrateDatabase schema migrations

Global Options

These options apply to all commands:

repotoire --help                    # Show help
repotoire --version                 # Show version
repotoire -c config.toml <cmd>      # Use specific config file
repotoire --log-level DEBUG <cmd>   # Set log level
repotoire --log-format json <cmd>   # JSON log output
repotoire --log-file app.log <cmd>  # Write logs to file

Configuration

Repotoire uses a hierarchical configuration system:

  1. Command-line options (highest priority)
  2. Config file (.reporc, falkor.toml)
  3. Environment variables
  4. Built-in defaults (lowest priority)

Configuration File

Create a config file with repotoire init or manually:

# .reporc or falkor.toml

[neo4j]
uri = "bolt://localhost:7687"
user = "neo4j"
password = "${NEO4J_PASSWORD}"  # Environment variable interpolation

[ingestion]
patterns = ["**/*.py", "**/*.js", "**/*.ts"]
batch_size = 100
max_file_size_mb = 10
follow_symlinks = false

[embeddings]
backend = "auto"  # auto, openai, local, deepinfra, voyage

[secrets]
policy = "redact"  # redact, block, warn, fail

[logging]
level = "INFO"
format = "human"  # human, json

Environment Variables

VariableDescription
REPOTOIRE_NEO4J_URINeo4j connection URI
REPOTOIRE_NEO4J_PASSWORDNeo4j password
REPOTOIRE_NEO4J_USERNeo4j username
REPOTOIRE_DB_TYPEDatabase type (neo4j/falkordb)
REPOTOIRE_TIMESCALE_URITimescaleDB connection string
REPOTOIRE_OFFLINERun in offline mode
OPENAI_API_KEYOpenAI API key
VOYAGE_API_KEYVoyage AI API key
ANTHROPIC_API_KEYAnthropic API key

Common Workflows

First-Time Setup

# 1. Create config
repotoire init

# 2. Verify connectivity
repotoire validate

# 3. Ingest codebase
repotoire ingest ./my-project

# 4. Run first analysis
repotoire analyze ./my-project

Daily Development

# Quick health check
repotoire analyze ./my-project -q

# Find problem areas
repotoire hotspots

# Get AI-powered fixes
repotoire auto-fix

# Ask about code
repotoire ask "What does the UserService do?"

CI/CD Integration

# JSON output for parsing
repotoire analyze ./my-project -f json -o results.json

# Exit with error on critical findings
repotoire analyze ./my-project --fail-on-critical

# Security-focused scan
repotoire security audit --format sarif -o security.sarif

Historical Analysis

# Ingest git history
repotoire history --max-commits 500

# Compare two commits
repotoire compare HEAD~10 HEAD

# Query metrics over time
repotoire metrics trend --metric health_score --days 30

Output Formats

Terminal (Default)

Rich, colorized output with tables and progress bars:

repotoire analyze ./my-project

JSON

Machine-readable output for CI/CD:

repotoire analyze ./my-project -f json

HTML

Visual report with code snippets:

repotoire analyze ./my-project -f html -o report.html

Exit Codes

CodeMeaning
0Success
1General error
2Critical findings detected
3Configuration error