CLI Commands
Complete reference for all code-insights CLI commands and flags — init, sync, stats, dashboard, config, reset, install-hook, and more.
Global
code-insights --version # Print version
code-insights --help # Show helpinit
code-insights initInteractive setup. Detects installed AI coding tools and initializes the local database at ~/.code-insights/data.db.
sync
code-insights sync [options]Syncs sessions from all supported source tools to the local SQLite database.
| Flag | Description |
|---|---|
--force | Re-sync all sessions (ignores modification times) |
--dry-run | Preview what would be synced without writing |
-q, --quiet | Suppress all output |
--source <tool> | Sync only from: claude-code, cursor, codex-cli, copilot-cli, copilot |
open
code-insights open [options]Opens the local dashboard in your default browser. If the dashboard server is already running, this opens a new browser tab to it.
| Flag | Description |
|---|---|
--project | Open filtered to the current project |
dashboard
code-insights dashboard [options]Starts the embedded Hono server and opens localhost:7890 in your browser.
| Flag | Default | Description |
|---|---|---|
-p, --port <number> | 7890 | Port number for the dashboard server |
--no-open | — | Do not open browser automatically |
status
code-insights statusShows sync statistics: total sessions, messages, last sync time, and source tool breakdown.
stats
code-insights stats [subcommand] [options]Terminal analytics. See Terminal Analytics for details.
| Subcommand | Description |
|---|---|
| (none) | Overview dashboard |
cost | Cost breakdown by project and model |
projects | Per-project detail cards |
today | Today's sessions |
models | Model usage distribution |
Shared flags:
| Flag | Default | Description |
|---|---|---|
--period 7d|30d|90d|all | 7d | Time range |
--project <name> | — | Scope to a specific project |
--source <tool> | — | Filter by source tool |
--no-sync | — | Skip auto-sync before showing stats |
config
code-insights configShows the current configuration summary (sync paths, dashboard port, LLM provider, telemetry status).
config set
code-insights config set <key> <value>Set a configuration value. Currently supported keys:
| Key | Values | Description |
|---|---|---|
telemetry | true / false | Enable or disable anonymous telemetry |
config llm
code-insights config llm [options]Configure the LLM provider for AI-powered session analysis. Without flags, runs an interactive wizard.
| Flag | Description |
|---|---|
--provider <provider> | LLM provider (openai, anthropic, gemini, ollama) |
--model <model> | Model ID (e.g., gpt-4o, claude-sonnet-4-20250514) |
--api-key <key> | API key for the selected provider |
--base-url <url> | Custom base URL (for Ollama or local endpoints) |
--show | Show current LLM configuration |
install-hook
code-insights install-hookAdds a Stop hook to ~/.claude/settings.json that runs code-insights sync -q after every Claude Code session.
uninstall-hook
code-insights uninstall-hookRemoves the auto-sync hook from ~/.claude/settings.json.
reset
code-insights reset --confirmDeletes all local data: ~/.code-insights/data.db, sync-state.json, and device-id. Requires the --confirm flag to prevent accidental deletion.
telemetry
code-insights telemetry [subcommand]View and manage anonymous telemetry settings.
| Subcommand | Description |
|---|---|
status | Show current telemetry status and what data is collected |
opt-out | Disable anonymous telemetry |
opt-in | Re-enable anonymous telemetry |
Telemetry can also be disabled via environment variables: CODE_INSIGHTS_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1.