CLI Commands
code-insights init
Section titled “code-insights init”Configure Code Insights with your Firebase credentials.
# Import from JSON files (recommended)code-insights init \ --from-json ~/Downloads/serviceAccountKey.json \ --web-config ~/Downloads/firebase-web-config.js
# Interactive setupcode-insights initFlags:
| Flag | Description |
|---|---|
--from-json <path> | Path to Firebase service account JSON file |
--web-config <path> | Path to Firebase web SDK config file (JSON or JS snippet) |
You can use one flag, both, or neither. Values not provided via flags are collected interactively.
Configuration is stored in ~/.code-insights/config.json. Web config is stored separately in ~/.code-insights/web-config.json.
code-insights sync
Section titled “code-insights sync”Sync Claude Code sessions to Firestore.
# Sync new/modified sessionscode-insights sync
# Force re-sync all sessionscode-insights sync --force
# Preview what would be syncedcode-insights sync --dry-run
# Sync a specific project onlycode-insights sync --project "my-project"
# Quiet mode (for hooks)code-insights sync -q
# Regenerate all session titlescode-insights sync --regenerate-titlesFlags:
| Flag | Short | Description |
|---|---|---|
--force | -f | Re-sync all sessions, ignoring the sync state cache |
--project <name> | -p | Only sync sessions from the named project |
--dry-run | Show what would be synced without uploading | |
--quiet | -q | Suppress all output (useful for hooks) |
--regenerate-titles | Regenerate titles for all sessions |
Sync state is tracked in ~/.code-insights/sync-state.json. Only new or modified files are processed unless --force is used.
code-insights status
Section titled “code-insights status”Show sync status and statistics.
code-insights statusDisplays:
- Configuration status
- Total sessions synced
- Projects tracked
- Last sync time
No flags.
code-insights connect
Section titled “code-insights connect”Generate a URL to connect the web dashboard to your Firebase.
# Print URL and QR codecode-insights connect
# URL only, no QR codecode-insights connect --no-qrFlags:
| Flag | Description |
|---|---|
--no-qr | Skip QR code output (print URL only) |
The URL includes your Firebase web config base64-encoded as a query parameter. Open it in a browser to connect the dashboard to your Firestore automatically.
code-insights install-hook
Section titled “code-insights install-hook”Install a Claude Code hook for automatic sync after each session.
code-insights install-hookThis adds a hook that runs code-insights sync -q whenever a Claude Code session ends. No flags.
code-insights uninstall-hook
Section titled “code-insights uninstall-hook”Remove the automatic sync hook.
code-insights uninstall-hookNo flags.
code-insights reset
Section titled “code-insights reset”Delete all data from Firestore and reset local sync state.
# Interactive (asks for confirmation)code-insights reset
# Skip confirmation promptcode-insights reset --confirmFlags:
| Flag | Description |
|---|---|
--confirm | Skip the confirmation prompt |
This deletes all documents from the projects, sessions, messages, and insights collections in Firestore, and removes the local sync state file.
Global Options
Section titled “Global Options”code-insights --version # Print versioncode-insights --help # Show helpcode-insights <cmd> --help # Show help for a specific command