Complete CLI Command Reference for code-review-graph: build, update, visualize, wiki

code-review-graph provides four core CLI commands—build, update, visualize, and wiki—that manage the full lifecycle of a repository knowledge graph, from parsing source code to generating interactive visualizations and documentation.

The code-review-graph CLI, located in code_review_graph/cli.py, exposes a self-documented interface for creating, maintaining, and exploring code intelligence. This guide covers the complete code-review-graph command reference with exact syntax, flags, and source locations from the tirth8205/code-review-graph repository.


build Command: Parse Repository into Knowledge Graph

The code-review-graph build command performs the initial ingestion of your repository. It runs Tree-sitter parsers across all source files, extracts AST nodes (functions, classes, imports), and writes them to a SQLite database at .code-review-graph/graph.db.

Key behaviors:

  • First run: Full parse of the entire codebase
  • Subsequent runs: Incremental update (only changed files)
  • Storage: SQLite database with nodes, edges, call graphs, and inheritance relationships

# Full initial build

code-review-graph build

# Skip computationally expensive flow analysis

code-review-graph build --skip-flows

# Skip post-processing (embeddings, community detection)

code-review-graph build --skip-postprocess

Internally, build dispatches to the MCP tool build_or_update_graph_tool as documented in docs/COMMANDS.md. The parsing layer uses language-specific Tree-sitter grammars; the graph layer stores entities and relationships in normalized tables.


update Command: Force Incremental Refresh

The code-review-graph update command is a convenience alias that triggers the same build_or_update_graph_tool with incremental semantics. Use this when you want to ensure the graph reflects recent edits without the cognitive overhead of choosing between full and incremental builds.


# Refresh graph after file changes

code-review-graph update

Both build and update support file-watching hooks for near-real-time synchronization (≈2.5 seconds for a 3,000-file project).


visualize Command: Generate Interactive Graphs and Exports

The code-review-graph visualize command transforms the SQLite knowledge graph into human-explorable formats. It supports multiple output targets and can launch a local server for immediate inspection.

Export formats:

  • json – Raw graph payload for custom processing
  • graphml – Import into Gephi, yEd, or Cytoscape
  • svg – Static vector image
  • obsidian – Obsidian vault-compatible Markdown
  • cypher – Neo4j import statements

# Generate interactive D3.js HTML and open browser

code-review-graph visualize

# Export to GraphML for external tools

code-review-graph visualize --format graphml > mygraph.graphml

# Serve locally on custom port

code-review-graph visualize --serve --port 8765

# Export for Obsidian

code-review-graph visualize --format obsidian --output ./graph-vault

The visualization pipeline reads from graph.db, applies D3 force-directed layouts (for HTML output), or delegates to format-specific serializers in the MCP tool layer.


wiki Command: Browse Knowledge Base Locally or Export

The code-review-graph wiki command surfaces the structured graph data as a browsable wiki. This static site generation makes code relationships discoverable through hyperlinked pages rather than raw graph traversal.

Modes:

  • --serve – Launch local HTTP server (default behavior)
  • --format obsidian – Export Markdown vault for offline use
  • --output <path> – Specify destination directory

# Open wiki in local server

code-review-graph wiki --serve

# Export as Obsidian-compatible Markdown

code-review-graph wiki --format obsidian --output ./wiki-export

The wiki generator renders entities (functions, classes, modules) as interlinked Markdown pages with automatic back-references and call hierarchy.


Architecture: How Commands Connect to Implementation

Understanding the CLI architecture clarifies where customizations and debugging should occur:

Layer Location Responsibility
CLI entry code_review_graph/cli.py Argument parsing, subcommand dispatch
MCP tools Documented in docs/COMMANDS.md Core operations (build_or_update_graph_tool, run_postprocess_tool, list_graph_stats_tool)
Graph storage .code-review-graph/graph.db SQLite persistence of nodes and edges
Parsers Tree-sitter integrations Per-language AST extraction
Visualizers D3.js, format exporters Human-readable output generation

All four commands (build, update, visualize, wiki) ultimately invoke MCP tool implementations that operate on the shared SQLite database.


Quick Reference: Command Comparison

Command Primary Use Typical Flags
build Initial parse, full rebuild --skip-flows, --skip-postprocess
update Refresh after changes (inherits build flags)
visualize Explore graph visually --format, --serve, --port, --output
wiki Document relationships --serve, --format obsidian, --output

Summary

  • code-review-graph build creates or updates the SQLite knowledge graph via Tree-sitter parsing and MCP tools.
  • code-review-graph update provides a semantic shortcut for incremental refreshes.
  • code-review-graph visualize exports to multiple formats including interactive D3.js, GraphML, and Obsidian vaults.
  • code-review-graph wiki generates browsable documentation from graph relationships.

The canonical documentation lives in docs/COMMANDS.md within the repository. Run any command with --help for flag details, or consult docs/USAGE.md for extended examples.


Frequently Asked Questions

Where is the official command documentation located?

The docs/COMMANDS.md file in the tirth8205/code-review-graph repository contains the definitive reference for all CLI commands, MCP tool signatures, and slash commands. This file is version-controlled and updated with each release.

What database format does code-review-graph use?

All graph data persists to a SQLite database at .code-review-graph/graph.db. This includes nodes (functions, classes, files), edges (calls, inheritance, imports), and computed metadata like embeddings and community assignments.

Can I export the knowledge graph for use in other tools?

Yes. The visualize command supports graphml for Gephi/yEd/Cytoscape, cypher for Neo4j, json for custom processing, and obsidian for Markdown-based tools. Use code-review-graph visualize --format <type> to specify your target format.

How do I browse the generated wiki offline?

Run code-review-graph wiki --format obsidian --output ./my-wiki to export a complete Markdown vault. This produces interlinked pages compatible with Obsidian, GitHub, or any static site generator without requiring a running server.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →