[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73972":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":16,"starSnapshotCount":16,"syncStatus":42,"lastSyncTime":43,"discoverSource":44},73972,"code-review-graph","tirth8205\u002Fcode-review-graph","tirth8205","Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.","https:\u002F\u002Fcode-review-graph.com",null,"Python",18378,1969,66,59,0,48,347,1610,248,44.88,"MIT License",false,"main",true,[27,28,29,30,31,32,33,34,35,36,37,38],"ai-coding","claude","claude-code","code-review","graphrag","incremental","knowledge-graph","llm","mcp","python","static-analysis","tree-sitter","2026-06-12 02:03:20","\u003Ch1 align=\"center\">code-review-graph\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Stop burning tokens. Start reviewing smarter.\u003C\u002Fstrong>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"README.md\">English\u003C\u002Fa> |\n  \u003Ca href=\"README.zh-CN.md\">简体中文\u003C\u002Fa> |\n  \u003Ca href=\"README.ja-JP.md\">日本語\u003C\u002Fa> |\n  \u003Ca href=\"README.ko-KR.md\">한국어\u003C\u002Fa> |\n  \u003Ca href=\"README.hi-IN.md\">हिन्दी\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fcode-review-graph\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fcode-review-graph?style=flat-square&color=blue\" alt=\"PyPI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fpepy.tech\u002Fproject\u002Fcode-review-graph\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpepy\u002Fdt\u002Fcode-review-graph?style=flat-square\" alt=\"Downloads\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftirth8205\u002Fcode-review-graph\u002Fstargazers\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Ftirth8205\u002Fcode-review-graph?style=flat-square\" alt=\"Stars\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg?style=flat-square\" alt=\"MIT Licence\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftirth8205\u002Fcode-review-graph\u002Factions\u002Fworkflows\u002Fci.yml\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Ftirth8205\u002Fcode-review-graph\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg\" alt=\"CI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fwww.python.org\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.10%2B-blue.svg?style=flat-square\" alt=\"Python 3.10+\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fmodelcontextprotocol.io\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FMCP-compatible-green.svg?style=flat-square\" alt=\"MCP\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcode-review-graph.com\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fwebsite-code--review--graph.com-blue?style=flat-square\" alt=\"Website\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002F3p58KXqGFN\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdiscord-join-5865F2?style=flat-square&logo=discord&logoColor=white\" alt=\"Discord\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cbr>\n\nAI coding tools re-read your entire codebase on every task. `code-review-graph` fixes that. It builds a structural map of your code with [Tree-sitter](https:\u002F\u002Ftree-sitter.github.io\u002Ftree-sitter\u002F), tracks changes incrementally, and gives your AI assistant precise context via [MCP](https:\u002F\u002Fmodelcontextprotocol.io\u002F) so it reads only what matters.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram1_before_vs_after.png\" alt=\"The Token Problem: 8.2x average token reduction across 6 real repositories\" width=\"85%\" \u002F>\n\u003C\u002Fp>\n\n---\n\n## Quick Start\n\n```bash\npip install code-review-graph                     # or: pipx install code-review-graph\ncode-review-graph install          # auto-detects and configures all supported platforms\ncode-review-graph build            # parse your codebase\n```\n\nOne command sets up everything. `install` detects which AI coding tools you have, writes the correct MCP configuration for each one, installs platform-native hooks\u002Fskills where supported, and injects graph-aware instructions into your platform rules. It auto-detects whether you installed via `uvx` or `pip`\u002F`pipx` and generates the right config. Restart your editor\u002Ftool after installing.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram8_supported_platforms.png\" alt=\"One Install, Every Platform: auto-detects Codex, Claude Code, Cursor, Windsurf, Zed, Continue, OpenCode, Antigravity, Qwen, Qoder, Kiro, and GitHub Copilot\" width=\"85%\" \u002F>\n\u003C\u002Fp>\n\nTo target a specific platform:\n\n```bash\ncode-review-graph install --platform codex       # configure only Codex\ncode-review-graph install --platform cursor      # configure only Cursor\ncode-review-graph install --platform claude-code  # configure only Claude Code\ncode-review-graph install --platform gemini-cli   # configure only Gemini CLI\ncode-review-graph install --platform kiro         # configure only Kiro\ncode-review-graph install --platform copilot      # configure only GitHub Copilot (VS Code)\ncode-review-graph install --platform copilot-cli  # configure only GitHub Copilot CLI\n```\n\nRequires Python 3.10+. For the best experience, install [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) (the MCP config will use `uvx` if available, otherwise falls back to the `code-review-graph` command directly).\n\nThen open your project and ask your AI assistant:\n\n```\nBuild the code review graph for this project\n```\n\nThe initial build takes ~10 seconds for a 500-file project. After that, the graph updates automatically on every file edit and git commit.\n\n\n## How It Works\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram7_mcp_integration_flow.png\" alt=\"How your AI assistant uses the graph: User asks for review, AI checks MCP tools, graph returns blast radius and risk scores, AI reads only what matters\" width=\"80%\" \u002F>\n\u003C\u002Fp>\n\nYour repository is parsed into an AST with Tree-sitter, stored as a graph of nodes (functions, classes, imports) and edges (calls, inheritance, test coverage), then queried at review time to compute the minimal set of files your AI assistant needs to read.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram2_architecture_pipeline.png\" alt=\"Architecture pipeline: Repository to Tree-sitter Parser to SQLite Graph to Blast Radius to Minimal Review Set\" width=\"100%\" \u002F>\n\u003C\u002Fp>\n\n### Blast-radius analysis\n\nWhen a file changes, the graph traces every caller, dependent, and test that could be affected. This is the \"blast radius\" of the change. Your AI reads only these files instead of scanning the whole project.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram3_blast_radius.png\" alt=\"Blast radius visualization showing how a change to login() propagates to callers, dependents, and tests\" width=\"70%\" \u002F>\n\u003C\u002Fp>\n\n### Incremental updates in \u003C 2 seconds\n\nOn every git commit or file save, a hook fires. The graph diffs changed files, finds their dependents via SHA-256 hash checks, and re-parses only what changed. A 2,900-file project re-indexes in under 2 seconds.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram4_incremental_update.png\" alt=\"Incremental update flow: git commit triggers diff, finds dependents, re-parses only 5 files while 2,910 are skipped\" width=\"90%\" \u002F>\n\u003C\u002Fp>\n\n### The monorepo problem, solved\n\nLarge monorepos are where token waste is most painful. The graph cuts through the noise — 27,700+ files excluded from review context, only ~15 files actually read.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram6_monorepo_funnel.png\" alt=\"Next.js monorepo: 27,732 files funnelled through code-review-graph down to ~15 files — 49x fewer tokens\" width=\"80%\" \u002F>\n\u003C\u002Fp>\n\n### 24 languages + Jupyter notebooks\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram9_language_coverage.png\" alt=\"24 languages organized by category: Web, Backend, Systems, Mobile, Scripting, Config (Nix), plus Jupyter\u002FDatabricks notebook support\" width=\"90%\" \u002F>\n\u003C\u002Fp>\n\nFull Tree-sitter grammar support for functions, classes, imports, call sites, inheritance, and test detection in every language. Includes Zig, PowerShell, Julia, Svelte SFC, and flake-aware Nix support. Plus Jupyter\u002FDatabricks notebook parsing (`.ipynb`) with multi-language cell support (Python, R, SQL), and Perl XS files (`.xs`).\n\n---\n\n## Benchmarks\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"diagrams\u002Fdiagram5_benchmark_board.png\" alt=\"Benchmarks across real repos: 4.9x to 27.3x fewer tokens, higher review quality\" width=\"85%\" \u002F>\n\u003C\u002Fp>\n\nAll numbers come from the automated evaluation runner against 6 real open-source repositories (13 commits total). Reproduce with `code-review-graph eval --all`. Raw data in [`evaluate\u002Freports\u002Fsummary.md`](evaluate\u002Freports\u002Fsummary.md).\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Token efficiency: 8.2x average reduction (naive vs graph)\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\nThe graph replaces reading entire source files with a compact structural context covering blast radius, dependency chains, and test coverage gaps.\n\n| Repo | Commits | Avg Naive Tokens | Avg Graph Tokens | Reduction |\n|------|--------:|-----------------:|----------------:|----------:|\n| express | 2 | 693 | 983 | 0.7x |\n| fastapi | 2 | 4,944 | 614 | 8.1x |\n| flask | 2 | 44,751 | 4,252 | 9.1x |\n| gin | 3 | 21,972 | 1,153 | 16.4x |\n| httpx | 2 | 12,044 | 1,728 | 6.9x |\n| nextjs | 2 | 9,882 | 1,249 | 8.0x |\n| **Average** | **13** | | | **8.2x** |\n\n**Why express shows \u003C1x:** For single-file changes in small packages, the graph context (metadata, edges, review guidance) can exceed the raw file size. The graph approach pays off on multi-file changes where it prunes irrelevant code.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Impact accuracy: 100% recall, 0.54 average F1\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\nThe blast-radius analysis never misses an actually impacted file (perfect recall). It over-predicts in some cases, which is a conservative trade-off — better to flag too many files than miss a broken dependency.\n\n| Repo | Commits | Avg F1 | Avg Precision | Recall |\n|------|--------:|-------:|--------------:|-------:|\n| express | 2 | 0.667 | 0.50 | 1.0 |\n| fastapi | 2 | 0.584 | 0.42 | 1.0 |\n| flask | 2 | 0.475 | 0.34 | 1.0 |\n| gin | 3 | 0.429 | 0.29 | 1.0 |\n| httpx | 2 | 0.762 | 0.63 | 1.0 |\n| nextjs | 2 | 0.331 | 0.20 | 1.0 |\n| **Average** | **13** | **0.54** | **0.38** | **1.0** |\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Build performance\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\n| Repo | Files | Nodes | Edges | Flow Detection | Search Latency |\n|------|------:|------:|------:|---------------:|---------------:|\n| express | 141 | 1,910 | 17,553 | 106ms | 0.7ms |\n| fastapi | 1,122 | 6,285 | 27,117 | 128ms | 1.5ms |\n| flask | 83 | 1,446 | 7,974 | 95ms | 0.7ms |\n| gin | 99 | 1,286 | 16,762 | 111ms | 0.5ms |\n| httpx | 60 | 1,253 | 7,896 | 96ms | 0.4ms |\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Limitations and known weaknesses\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\n- **Small single-file changes:** Graph context can exceed naive file reads for trivial edits (see express results above). The overhead is the structural metadata that enables multi-file analysis.\n- **Search quality (MRR 0.35):** Keyword search finds the right result in the top-4 for most queries, but ranking needs improvement. Express queries return 0 hits due to module-pattern naming.\n- **Flow detection (33% recall):** Only reliably detects entry points in Python repos (fastapi, httpx) where framework patterns are recognized. JavaScript and Go flow detection needs work.\n- **Precision vs recall trade-off:** Impact analysis is deliberately conservative. It flags files that *might* be affected, which means some false positives in large dependency graphs.\n\n\u003C\u002Fdetails>\n\n---\n\n## Features\n\n| Feature | Details |\n|---------|---------|\n| **Incremental updates** | Re-parses only changed files. Subsequent updates complete in under 2 seconds. |\n| **24 languages + notebooks** | Python, TypeScript\u002FTSX, JavaScript, Vue, Svelte, Go, Rust, Java, Scala, C#, Ruby, Kotlin, Swift, PHP, Solidity, C\u002FC++, Dart, R, Perl, Lua, Zig, PowerShell, Julia, Nix, Jupyter\u002FDatabricks (.ipynb) |\n| **Blast-radius analysis** | Shows exactly which functions, classes, and files are affected by any change |\n| **Auto-update hooks** | Graph updates on every file edit and git commit without manual intervention |\n| **Semantic search** | Optional vector embeddings via sentence-transformers, Google Gemini, MiniMax, or any OpenAI-compatible endpoint (real OpenAI, Azure, new-api, LiteLLM, vLLM, LocalAI) |\n| **Interactive visualisation** | D3.js force-directed graph with search, community legend toggles, and degree-scaled nodes |\n| **Hub & bridge detection** | Find most-connected nodes and architectural chokepoints via betweenness centrality |\n| **Surprise scoring** | Detect unexpected coupling: cross-community, cross-language, peripheral-to-hub edges |\n| **Knowledge gap analysis** | Identify isolated nodes, untested hotspots, thin communities, and structural weaknesses |\n| **Suggested questions** | Auto-generated review questions from graph analysis (bridges, hubs, surprises) |\n| **Edge confidence** | Three-tier confidence scoring (EXTRACTED\u002FINFERRED\u002FAMBIGUOUS) with float scores on edges |\n| **Graph traversal** | Free-form BFS\u002FDFS exploration from any node with configurable depth and token budget |\n| **Export formats** | GraphML (Gephi\u002FyEd), Neo4j Cypher, Obsidian vault with wikilinks, SVG static graph |\n| **Graph diff** | Compare graph snapshots over time: new\u002Fremoved nodes, edges, community changes |\n| **Token benchmarking** | Measure naive full-corpus tokens vs graph query tokens with per-question ratios |\n| **Memory loop** | Persist Q&A results as markdown for re-ingestion, so the graph grows from queries |\n| **Community auto-split** | Oversized communities (>25% of graph) are recursively split via Leiden |\n| **Execution flows** | Trace call chains from entry points, sorted by weighted criticality |\n| **Community detection** | Cluster related code via Leiden algorithm with resolution scaling for large graphs |\n| **Architecture overview** | Auto-generated architecture map with coupling warnings |\n| **Risk-scored reviews** | `detect_changes` maps diffs to affected functions, flows, and test gaps |\n| **Refactoring tools** | Rename preview, framework-aware dead code detection, community-driven suggestions |\n| **Wiki generation** | Auto-generate markdown wiki from community structure |\n| **Multi-repo registry** | Register multiple repos, search across all of them |\n| **Multi-repo daemon** | `crg-daemon` watches multiple repos as child processes, with health checks and auto-restart |\n| **MCP prompts** | 5 workflow templates: review, architecture, debug, onboard, pre-merge |\n| **Full-text search** | FTS5-powered hybrid search combining keyword and vector similarity |\n| **Local storage** | SQLite file in `.code-review-graph\u002F`. No external database, no cloud dependency. |\n| **Watch mode** | Continuous graph updates as you work |\n\n---\n\n## Usage\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Slash commands\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\n| Command | Description |\n|---------|-------------|\n| `\u002Fcode-review-graph:build-graph` | Build or rebuild the code graph |\n| `\u002Fcode-review-graph:review-delta` | Review changes since last commit |\n| `\u002Fcode-review-graph:review-pr` | Full PR review with blast-radius analysis |\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>CLI reference\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\n```bash\ncode-review-graph install          # Auto-detect and configure all platforms\ncode-review-graph install --platform \u003Cname>  # Target a specific platform\ncode-review-graph build            # Parse entire codebase\ncode-review-graph update           # Incremental update (changed files only)\ncode-review-graph status           # Graph statistics\ncode-review-graph watch            # Auto-update on file changes\ncode-review-graph visualize        # Generate interactive HTML graph\ncode-review-graph visualize --format graphml   # Export as GraphML\ncode-review-graph visualize --format svg       # Export as SVG\ncode-review-graph visualize --format obsidian  # Export as Obsidian vault\ncode-review-graph visualize --format cypher    # Export as Neo4j Cypher\ncode-review-graph wiki             # Generate markdown wiki from communities\ncode-review-graph detect-changes   # Risk-scored change impact analysis\ncode-review-graph register \u003Cpath>  # Register repo in multi-repo registry\ncode-review-graph unregister \u003Cid>  # Remove repo from registry\ncode-review-graph repos            # List registered repositories\ncode-review-graph daemon start     # Start multi-repo watch daemon\ncode-review-graph daemon stop      # Stop the daemon\ncode-review-graph daemon status    # Show daemon status and repos\ncode-review-graph eval             # Run evaluation benchmarks\ncode-review-graph serve            # Start MCP server\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Multi-repo daemon\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\nIf your editor doesn't support hooks (e.g. Cursor, OpenCode), or you just want your\ngraph to stay fresh in the background without any editor integration, the daemon is\nfor you. It watches your repos for file changes and automatically rebuilds the graph\n— no manual `build` or `update` commands needed.\n\nThe daemon is included with `code-review-graph` — no separate install required.\n\n**Quick setup:**\n\n```bash\n# 1. Register the repos you want to watch\ncrg-daemon add ~\u002Fproject-a --alias proj-a\ncrg-daemon add ~\u002Fproject-b\n\n# 2. Start the daemon (runs in the background)\ncrg-daemon start\n\n# 3. That's it — graphs stay up to date automatically\ncrg-daemon status                 # check daemon and per-repo watcher status\ncrg-daemon logs --repo proj-a -f  # tail logs for a specific repo\ncrg-daemon stop                   # stop daemon and all watcher processes\n```\n\nAlso available as `code-review-graph daemon start|stop|status|...`.\n\nUnder the hood, `crg-daemon add` writes to a TOML config file at\n`~\u002F.code-review-graph\u002Fwatch.toml`. You can also edit this file directly:\n\n```toml\n[[repos]]\npath = \"\u002Fhome\u002Fuser\u002Fproject-a\"\nalias = \"proj-a\"\n\n[[repos]]\npath = \"\u002Fhome\u002Fuser\u002Fproject-b\"\nalias = \"project-b\"\n```\n\nThe daemon monitors this config file for changes and automatically starts\u002Fstops\nwatcher processes as repos are added or removed. Health checks every 30 seconds\nrestart dead watchers. No external dependencies required.\n\nSee [docs\u002FCOMMANDS.md](docs\u002FCOMMANDS.md#standalone-daemon-cli-crg-daemon) for the\nfull config reference and all available options.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>28 MCP tools\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\nYour AI assistant uses these automatically once the graph is built.\n\n| Tool | Description |\n|------|-------------|\n| `build_or_update_graph_tool` | Build or incrementally update the graph |\n| `get_minimal_context_tool` | Ultra-compact context (~100 tokens) — call this first |\n| `get_impact_radius_tool` | Blast radius of changed files |\n| `get_review_context_tool` | Token-optimised review context with structural summary |\n| `query_graph_tool` | Callers, callees, tests, imports, inheritance queries |\n| `traverse_graph_tool` | BFS\u002FDFS traversal from any node with token budget |\n| `semantic_search_nodes_tool` | Search code entities by name or meaning |\n| `embed_graph_tool` | Compute vector embeddings for semantic search |\n| `list_graph_stats_tool` | Graph size and health |\n| `get_docs_section_tool` | Retrieve documentation sections |\n| `find_large_functions_tool` | Find functions\u002Fclasses exceeding a line-count threshold |\n| `list_flows_tool` | List execution flows sorted by criticality |\n| `get_flow_tool` | Get details of a single execution flow |\n| `get_affected_flows_tool` | Find flows affected by changed files |\n| `list_communities_tool` | List detected code communities |\n| `get_community_tool` | Get details of a single community |\n| `get_architecture_overview_tool` | Architecture overview from community structure |\n| `detect_changes_tool` | Risk-scored change impact analysis for code review |\n| `get_hub_nodes_tool` | Find most-connected nodes (architectural hotspots) |\n| `get_bridge_nodes_tool` | Find chokepoints via betweenness centrality |\n| `get_knowledge_gaps_tool` | Identify structural weaknesses and untested hotspots |\n| `get_surprising_connections_tool` | Detect unexpected cross-community coupling |\n| `get_suggested_questions_tool` | Auto-generated review questions from analysis |\n| `refactor_tool` | Rename preview, dead code detection, suggestions |\n| `apply_refactor_tool` | Apply a previously previewed refactoring |\n| `generate_wiki_tool` | Generate markdown wiki from communities |\n| `get_wiki_page_tool` | Retrieve a specific wiki page |\n| `list_repos_tool` | List registered repositories |\n| `cross_repo_search_tool` | Search across all registered repositories |\n\n**MCP Prompts** (5 workflow templates):\n`review_changes`, `architecture_map`, `debug_issue`, `onboard_developer`, `pre_merge_check`\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Configuration\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\nTo exclude paths from indexing, create a `.code-review-graphignore` file in your repository root:\n\n```\ngenerated\u002F**\n*.generated.ts\nvendor\u002F**\nnode_modules\u002F**\n```\n\nNote: in git repos, only tracked files are indexed (`git ls-files`), so gitignored files are skipped automatically. Use `.code-review-graphignore` to exclude tracked files or when git isn't available.\n\nOptional dependency groups:\n\n```bash\npip install code-review-graph[embeddings]          # Local vector embeddings (sentence-transformers)\npip install code-review-graph[google-embeddings]   # Google Gemini embeddings\npip install code-review-graph[communities]         # Community detection (igraph)\npip install code-review-graph[eval]                # Evaluation benchmarks (matplotlib)\npip install code-review-graph[wiki]                # Wiki generation with LLM summaries (ollama)\npip install code-review-graph[all]                 # All optional dependencies\n```\n\n### Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `CRG_GIT_TIMEOUT` | Timeout in seconds for Git operations | `30` |\n| `CRG_EMBEDDING_MODEL` | Default model for vector embeddings | `all-MiniLM-L6-v2` |\n| `CRG_MAX_IMPACT_NODES` | Maximum nodes to include in impact analysis | `500` |\n| `CRG_MAX_IMPACT_DEPTH` | Search depth for blast-radius analysis | `2` |\n| `CRG_MAX_BFS_DEPTH` | Maximum depth for graph traversal | `15` |\n| `GOOGLE_API_KEY` | API key for Google Gemini embeddings | - |\n| `MINIMAX_API_KEY` | API key for MiniMax embeddings | - |\n| `CRG_OPENAI_BASE_URL` | OpenAI-compatible embeddings endpoint | - |\n| `CRG_OPENAI_API_KEY` | API key for OpenAI-compatible embeddings | - |\n| `CRG_OPENAI_MODEL` | Model name for OpenAI-compatible embeddings | - |\n| `CRG_OPENAI_DIMENSION` | Pin embedding dimension (v3 models support reduction) | - |\n| `NO_COLOR` | If set, disables ANSI colors in terminal | - |\n| `CRG_SERIAL_PARSE` | If `1`, disables parallel parsing (use for debugging) | - |\n\nOpenAI-compatible embeddings (real OpenAI, Azure, or any self-hosted gateway like\nnew-api \u002F LiteLLM \u002F vLLM \u002F LocalAI \u002F Ollama in openai mode) need no extra install —\njust set the environment variables and pass `provider=\"openai\"` to `embed_graph`:\n\n```bash\nexport CRG_OPENAI_BASE_URL=http:\u002F\u002F127.0.0.1:3000\u002Fv1     # or https:\u002F\u002Fapi.openai.com\u002Fv1\nexport CRG_OPENAI_API_KEY=sk-...\nexport CRG_OPENAI_MODEL=text-embedding-3-small          # whatever your gateway serves\n# optional:\nexport CRG_OPENAI_DIMENSION=1536                        # pin dim (v3 models support reduction)\nexport CRG_OPENAI_BATCH_SIZE=100                        # lower for gateways with tight limits\n                                                        # (e.g. Qwen text-embedding-v4 caps at 10)\n```\n\nThe cloud-egress warning is auto-skipped when the base URL points to localhost\n(`127.0.0.1`, `localhost`, `0.0.0.0`, `::1`).\n\n> **Model selection tip.** Avoid `-preview` \u002F `-beta` \u002F `-exp` model IDs\n> (e.g. `google\u002Fgemini-embedding-2-preview`) for anything you plan to keep\n> long-term — preview models can change weights (different dimension → full\n> re-embed required) or be deprecated without notice. Prefer stable GA\n> releases such as `text-embedding-3-small` \u002F `text-embedding-3-large` (OpenAI),\n> `Qwen\u002FQwen3-Embedding-8B` (via self-hosted vLLM \u002F LocalAI), or\n> `gemini-embedding-001` (via the native Gemini provider, which requires\n> `GOOGLE_API_KEY` instead of the OpenAI-compatible path).\n>\n> Also note: `code-review-graph` currently embeds **function signatures only**\n> (~10 tokens per node, e.g. `\"parse_file function (path: str) returns Tree\"`).\n> Models whose headline quality comes from long-context body understanding\n> (such as Gemini 2 or Qwen3-8B at their MTEB-code SOTA scores) will see a\n> much narrower quality gap against smaller models at this input length.\n> Body\u002Fdocstring embedding is tracked as a follow-up enhancement.\n\n#### Tool Filtering\n\nCRG exposes 28 MCP tools by default. In token-constrained environments, you can\nlimit the server to a subset of tools using `--tools` or the `CRG_TOOLS`\nenvironment variable:\n\n```bash\n# Via CLI flag\ncode-review-graph serve --tools query_graph_tool,semantic_search_nodes_tool,detect_changes_tool\n\n# Via environment variable\nCRG_TOOLS=query_graph_tool,semantic_search_nodes_tool code-review-graph serve\n```\n\nThe CLI flag takes precedence over the environment variable. When neither is set,\nall tools are available. This is especially useful for MCP client configurations:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-review-graph\": {\n      \"command\": \"code-review-graph\",\n      \"args\": [\"serve\", \"--tools\", \"query_graph_tool,semantic_search_nodes_tool,detect_changes_tool,get_review_context_tool\"]\n    }\n  }\n}\n```\n\n\u003C\u002Fdetails>\n\n---\n\n## Troubleshooting\n\n### `pip` \u002F `pipx` cannot download `hatchling` (or `Errno 9` \u002F `Bad file descriptor` to PyPI)\n\nInstalling from a **source tree** (for example `pipx install .`) needs build dependencies from **PyPI** (for example `hatchling`). If you see `Could not find a version that satisfies the requirement hatchling` after connection warnings, the Python\u002Fpip in that **terminal** may not be able to open an HTTPS client to `pypi.org` (sometimes seen in an integrated editor terminal; less often system-wide with VPN, firewall, or proxy).\n\n**Options:**\n\n1. Run the same command from **macOS Terminal.app** (or iTerm) instead of the IDE’s terminal, then retry `pipx install .` or `pipx install \"git+https:\u002F\u002F...\"` .\n2. Use **[uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F)** to install the CLI from a checkout (uses different download machinery than `pip` in many cases):\n\n   ```bash\n   cd \u002Fpath\u002Fto\u002Fcode-review-graph\n   uv tool install . --force\n   ```\n\n3. For **development in a clone** without a global install, use `uv sync` and `uv run code-review-graph …` (or activate `.venv` after `uv sync`).\n\n**Diagnose (optional):** `python3 scripts\u002Fdiagnose_pypi_connectivity.py` — if it prints `FAILED`, the issue is environment\u002Fnetwork, not a wrong package name in this repo.\n\n### Windows Configuration Issues (Invalid JSON \u002F Connection Closed)\nIf you are using Windows and encounter `Invalid JSON: EOF while parsing` or `MCP error -32000: Connection closed` when connecting via Claude Code, do not use the `cmd \u002Fc` wrapper in your config.\n\nEnsure `fastmcp` is updated to at least `3.2.4+`. Then, configure your `~\u002F.claude.json` to execute the `.exe` directly and pass the UTF-8 environment variable via the config:\n\n```json\n\"code-review-graph\": {\n  \"command\": \"C:\\\\path\\\\to\\\\your\\\\venv\\\\Scripts\\\\code-review-graph.exe\",\n  \"args\": [\"serve\", \"--repo\", \"C:\\\\path\\\\to\\\\your\\\\project\"],\n  \"env\": { \"PYTHONUTF8\": \"1\" }\n}\n```\n\n## Contributing\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Ftirth8205\u002Fcode-review-graph.git\ncd code-review-graph\npython3 -m venv .venv && source .venv\u002Fbin\u002Factivate\npip install -e \".[dev]\"\npytest\n```\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Adding a new language\u003C\u002Fstrong>\u003C\u002Fsummary>\n\u003Cbr>\n\nEdit `code_review_graph\u002Fparser.py` and add your extension to `EXTENSION_TO_LANGUAGE` along with node type mappings in `_CLASS_TYPES`, `_FUNCTION_TYPES`, `_IMPORT_TYPES`, and `_CALL_TYPES`. Include a test fixture and open a PR.\n\n\u003C\u002Fdetails>\n\n## Licence\n\nMIT. See [LICENSE](LICENSE).\n\n\u003Cp align=\"center\">\n\u003Cbr>\n\u003Ca href=\"https:\u002F\u002Fcode-review-graph.com\">code-review-graph.com\u003C\u002Fa>\u003Cbr>\u003Cbr>\n\u003Ccode>pip install code-review-graph && code-review-graph install\u003C\u002Fcode>\u003Cbr>\n\u003Csub>Works with Codex, Claude Code, Cursor, Windsurf, Zed, Continue, OpenCode, Antigravity, Gemini CLI, Qwen, Qoder, Kiro, GitHub Copilot, and GitHub Copilot CLI\u003C\u002Fsub>\n\u003C\u002Fp>\n","code-review-graph 是一个用于构建代码知识图谱的本地工具，旨在减少AI代码审查和日常编码任务中的token消耗。它通过Tree-sitter解析器生成代码库的结构化映射，并利用MCP协议为AI助手提供精确上下文，从而显著减少了不必要的代码重读。项目支持多种编程平台，能够自动检测并配置相关环境，适用于需要高效代码审查及优化AI辅助开发流程的场景。",2,"2026-06-11 03:48:12","high_star"]