code-review-graph-codeblackwell 2.3.6.post1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. code_review_graph/__init__.py +20 -0
  2. code_review_graph/__main__.py +4 -0
  3. code_review_graph/analysis.py +410 -0
  4. code_review_graph/changes.py +409 -0
  5. code_review_graph/cli.py +1255 -0
  6. code_review_graph/communities.py +874 -0
  7. code_review_graph/constants.py +23 -0
  8. code_review_graph/context_savings.py +317 -0
  9. code_review_graph/custom_languages.py +322 -0
  10. code_review_graph/daemon.py +1009 -0
  11. code_review_graph/daemon_cli.py +320 -0
  12. code_review_graph/docs/LLM-OPTIMIZED-REFERENCE.md +71 -0
  13. code_review_graph/embeddings.py +1006 -0
  14. code_review_graph/enrich.py +303 -0
  15. code_review_graph/eval/__init__.py +33 -0
  16. code_review_graph/eval/benchmarks/__init__.py +1 -0
  17. code_review_graph/eval/benchmarks/agent_baseline.py +193 -0
  18. code_review_graph/eval/benchmarks/build_performance.py +60 -0
  19. code_review_graph/eval/benchmarks/flow_completeness.py +36 -0
  20. code_review_graph/eval/benchmarks/impact_accuracy.py +220 -0
  21. code_review_graph/eval/benchmarks/multi_hop_retrieval.py +125 -0
  22. code_review_graph/eval/benchmarks/search_quality.py +59 -0
  23. code_review_graph/eval/benchmarks/token_efficiency.py +143 -0
  24. code_review_graph/eval/configs/code-review-graph.yaml +50 -0
  25. code_review_graph/eval/configs/express.yaml +45 -0
  26. code_review_graph/eval/configs/fastapi.yaml +48 -0
  27. code_review_graph/eval/configs/flask.yaml +50 -0
  28. code_review_graph/eval/configs/gin.yaml +51 -0
  29. code_review_graph/eval/configs/httpx.yaml +48 -0
  30. code_review_graph/eval/reporter.py +301 -0
  31. code_review_graph/eval/runner.py +211 -0
  32. code_review_graph/eval/scorer.py +85 -0
  33. code_review_graph/eval/token_benchmark.py +182 -0
  34. code_review_graph/exports.py +409 -0
  35. code_review_graph/flows.py +698 -0
  36. code_review_graph/graph.py +1427 -0
  37. code_review_graph/graph_diff.py +122 -0
  38. code_review_graph/hints.py +384 -0
  39. code_review_graph/incremental.py +1245 -0
  40. code_review_graph/jedi_resolver.py +303 -0
  41. code_review_graph/main.py +1079 -0
  42. code_review_graph/memory.py +142 -0
  43. code_review_graph/migrations.py +284 -0
  44. code_review_graph/parser.py +6957 -0
  45. code_review_graph/postprocessing.py +134 -0
  46. code_review_graph/prompts.py +159 -0
  47. code_review_graph/refactor.py +852 -0
  48. code_review_graph/registry.py +319 -0
  49. code_review_graph/rescript_resolver.py +206 -0
  50. code_review_graph/search.py +447 -0
  51. code_review_graph/skills.py +1481 -0
  52. code_review_graph/spring_resolver.py +200 -0
  53. code_review_graph/temporal_resolver.py +199 -0
  54. code_review_graph/token_benchmark.py +125 -0
  55. code_review_graph/tools/__init__.py +156 -0
  56. code_review_graph/tools/_common.py +176 -0
  57. code_review_graph/tools/analysis_tools.py +184 -0
  58. code_review_graph/tools/build.py +541 -0
  59. code_review_graph/tools/community_tools.py +246 -0
  60. code_review_graph/tools/context.py +152 -0
  61. code_review_graph/tools/docs.py +274 -0
  62. code_review_graph/tools/flows_tools.py +176 -0
  63. code_review_graph/tools/query.py +692 -0
  64. code_review_graph/tools/refactor_tools.py +168 -0
  65. code_review_graph/tools/registry_tools.py +125 -0
  66. code_review_graph/tools/review.py +477 -0
  67. code_review_graph/tsconfig_resolver.py +257 -0
  68. code_review_graph/visualization.py +2184 -0
  69. code_review_graph/wiki.py +305 -0
  70. code_review_graph_codeblackwell-2.3.6.post1.dist-info/METADATA +718 -0
  71. code_review_graph_codeblackwell-2.3.6.post1.dist-info/RECORD +74 -0
  72. code_review_graph_codeblackwell-2.3.6.post1.dist-info/WHEEL +4 -0
  73. code_review_graph_codeblackwell-2.3.6.post1.dist-info/entry_points.txt +3 -0
  74. code_review_graph_codeblackwell-2.3.6.post1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,718 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-review-graph-codeblackwell
3
+ Version: 2.3.6.post1
4
+ Summary: Local-first knowledge graph for token-efficient code review through MCP and CLI. Fork of tirth8205/code-review-graph with additional fixes; CLI and MCP server remain `code-review-graph`.
5
+ Project-URL: Homepage, https://github.com/CodeBlackwell/code-review-graph-codeblackwell
6
+ Project-URL: Repository, https://github.com/CodeBlackwell/code-review-graph-codeblackwell
7
+ Project-URL: Documentation, https://github.com/CodeBlackwell/code-review-graph-codeblackwell/blob/main/docs/INDEX.md
8
+ Project-URL: Changelog, https://github.com/CodeBlackwell/code-review-graph-codeblackwell/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/CodeBlackwell/code-review-graph-codeblackwell/issues
10
+ Project-URL: Upstream, https://github.com/tirth8205/code-review-graph
11
+ Author: Tirth
12
+ Maintainer: LeChristopher Blackwell
13
+ License-Expression: MIT
14
+ License-File: LICENSE
15
+ Keywords: ai-coding-tools,code-review,knowledge-graph,mcp,tree-sitter
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Quality Assurance
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: fastmcp<4,>=3.2.4
27
+ Requires-Dist: mcp<2,>=1.0.0
28
+ Requires-Dist: networkx<4,>=3.2
29
+ Requires-Dist: tomli<3,>=2.0.0; python_version < '3.11'
30
+ Requires-Dist: tree-sitter-language-pack<1,>=0.3.0
31
+ Requires-Dist: tree-sitter<1,>=0.23.0
32
+ Requires-Dist: watchdog<6,>=4.0.0
33
+ Provides-Extra: all
34
+ Requires-Dist: igraph>=0.11.0; extra == 'all'
35
+ Requires-Dist: jedi>=0.19.2; extra == 'all'
36
+ Requires-Dist: matplotlib>=3.7.0; extra == 'all'
37
+ Requires-Dist: numpy<3,>=1.26; extra == 'all'
38
+ Requires-Dist: ollama>=0.1.0; extra == 'all'
39
+ Requires-Dist: pyyaml>=6.0; extra == 'all'
40
+ Requires-Dist: sentence-transformers<4,>=3.0.0; extra == 'all'
41
+ Provides-Extra: communities
42
+ Requires-Dist: igraph>=0.11.0; extra == 'communities'
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest-asyncio<1,>=0.23; extra == 'dev'
45
+ Requires-Dist: pytest-cov<8,>=4.0; extra == 'dev'
46
+ Requires-Dist: pytest<9,>=8.0; extra == 'dev'
47
+ Requires-Dist: ruff<1,>=0.3.0; extra == 'dev'
48
+ Requires-Dist: tomli>=2.0; (python_version < '3.11') and extra == 'dev'
49
+ Provides-Extra: embeddings
50
+ Requires-Dist: numpy<3,>=1.26; extra == 'embeddings'
51
+ Requires-Dist: sentence-transformers<4,>=3.0.0; extra == 'embeddings'
52
+ Provides-Extra: enrichment
53
+ Requires-Dist: jedi>=0.19.2; extra == 'enrichment'
54
+ Provides-Extra: eval
55
+ Requires-Dist: matplotlib>=3.7.0; extra == 'eval'
56
+ Requires-Dist: pyyaml>=6.0; extra == 'eval'
57
+ Provides-Extra: google-embeddings
58
+ Requires-Dist: google-generativeai<1,>=0.8.0; extra == 'google-embeddings'
59
+ Provides-Extra: wiki
60
+ Requires-Dist: ollama>=0.1.0; extra == 'wiki'
61
+ Description-Content-Type: text/markdown
62
+
63
+ <h1 align="center">code-review-graph</h1>
64
+
65
+ <p align="center">
66
+ <strong>Stop burning tokens. Start reviewing smarter.</strong>
67
+ </p>
68
+
69
+ > **Fork notice.** This package (`code-review-graph-codeblackwell` on PyPI) is a community fork of
70
+ > [tirth8205/code-review-graph](https://github.com/tirth8205/code-review-graph) by Tirth Kanani (MIT),
71
+ > maintained so fixes ship without waiting on upstream review. It is not the official package and is
72
+ > not affiliated with or endorsed by the original author. The CLI command and MCP server are still
73
+ > named `code-review-graph`. All upstream credit belongs to the original project.
74
+
75
+ <p align="center">
76
+ <a href="README.md">English</a> |
77
+ <a href="README.zh-CN.md">简体中文</a> |
78
+ <a href="README.ja-JP.md">日本語</a> |
79
+ <a href="README.ko-KR.md">한국어</a> |
80
+ <a href="README.hi-IN.md">हिन्दी</a>
81
+ </p>
82
+
83
+ <p align="center">
84
+ <a href="https://pypi.org/project/code-review-graph/"><img src="https://img.shields.io/pypi/v/code-review-graph?style=flat-square&color=blue" alt="PyPI"></a>
85
+ <a href="https://pepy.tech/project/code-review-graph"><img src="https://img.shields.io/pepy/dt/code-review-graph?style=flat-square" alt="Downloads"></a>
86
+ <a href="https://github.com/tirth8205/code-review-graph/stargazers"><img src="https://img.shields.io/github/stars/tirth8205/code-review-graph?style=flat-square" alt="Stars"></a>
87
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="MIT Licence"></a>
88
+ <a href="https://github.com/tirth8205/code-review-graph/actions/workflows/ci.yml"><img src="https://github.com/tirth8205/code-review-graph/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
89
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg?style=flat-square" alt="Python 3.10+"></a>
90
+ <a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-compatible-green.svg?style=flat-square" alt="MCP"></a>
91
+ <a href="https://code-review-graph.com"><img src="https://img.shields.io/badge/website-code--review--graph.com-blue?style=flat-square" alt="Website"></a>
92
+ <a href="https://discord.gg/3p58KXqGFN"><img src="https://img.shields.io/badge/discord-join-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord"></a>
93
+ </p>
94
+
95
+ <p align="center">
96
+ <a href="docs/USAGE.md">Usage</a> ·
97
+ <a href="docs/COMMANDS.md">Commands</a> ·
98
+ <a href="docs/FAQ.md">FAQ</a> ·
99
+ <a href="docs/TROUBLESHOOTING.md">Troubleshooting</a> ·
100
+ <a href="docs/GITHUB_ACTION.md">GitHub Action</a> ·
101
+ <a href="docs/REPRODUCING.md">Reproducing the benchmarks</a> ·
102
+ <a href="docs/ROADMAP.md">Roadmap</a>
103
+ </p>
104
+
105
+ <br>
106
+
107
+ AI coding tools can end up re-reading large parts of your codebase on review tasks. `code-review-graph` fixes that. It builds a structural map of your code with [Tree-sitter](https://tree-sitter.github.io/tree-sitter/), tracks changes incrementally, and gives your AI assistant precise context via [MCP](https://modelcontextprotocol.io/) so it reads only what matters.
108
+
109
+ <p align="center">
110
+ <img src="diagrams/diagram1_before_vs_after.png" alt="The Token Problem: 38x to 528x token reduction across 6 real repositories" width="85%" />
111
+ </p>
112
+
113
+ ---
114
+
115
+ ## Quick Start
116
+
117
+ ```bash
118
+ pip install code-review-graph # or: pipx install code-review-graph
119
+ code-review-graph install # auto-detects and configures all supported platforms
120
+ code-review-graph build # parse your codebase
121
+ ```
122
+
123
+ One command sets up everything. `install` detects which AI coding tools you have, writes the correct MCP configuration for each one, installs platform-native hooks/skills where supported, and injects graph-aware instructions into your platform rules. It auto-detects whether you installed via `uvx` or `pip`/`pipx` and generates the right config. Restart your editor/tool after installing.
124
+
125
+ <p align="center">
126
+ <img src="diagrams/diagram8_supported_platforms.png" alt="One Install, Every Platform: auto-detects Codex, Claude Code, Cursor, Windsurf, Zed, Continue, OpenCode, Antigravity, Gemini CLI, Qwen, Qoder, Kiro, and GitHub Copilot" width="85%" />
127
+ </p>
128
+
129
+ To target a specific platform:
130
+
131
+ ```bash
132
+ code-review-graph install --platform codex # configure only Codex
133
+ code-review-graph install --platform cursor # configure only Cursor
134
+ code-review-graph install --platform claude-code # configure only Claude Code
135
+ code-review-graph install --platform gemini-cli # configure only Gemini CLI
136
+ code-review-graph install --platform kiro # configure only Kiro
137
+ code-review-graph install --platform copilot # configure only GitHub Copilot (VS Code)
138
+ code-review-graph install --platform copilot-cli # configure only GitHub Copilot CLI
139
+ ```
140
+
141
+ Requires Python 3.10+. For the best experience, install [uv](https://docs.astral.sh/uv/) (the MCP config will use `uvx` if available, otherwise falls back to the `code-review-graph` command directly).
142
+
143
+ Then open your project and ask your AI assistant:
144
+
145
+ ```
146
+ Build the code review graph for this project
147
+ ```
148
+
149
+ The initial build takes ~10 seconds for a 500-file project. After that, watch mode and supported hooks can keep the graph updated automatically.
150
+
151
+
152
+ ## How It Works
153
+
154
+ <p align="center">
155
+ <img src="diagrams/diagram7_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%" />
156
+ </p>
157
+
158
+ Your 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.
159
+
160
+ <p align="center">
161
+ <img src="diagrams/diagram2_architecture_pipeline.png" alt="Architecture pipeline: Repository to Tree-sitter Parser to SQLite Graph to Blast Radius to Minimal Review Set" width="100%" />
162
+ </p>
163
+
164
+ ### Blast-radius analysis
165
+
166
+ When 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.
167
+
168
+ <p align="center">
169
+ <img src="diagrams/diagram3_blast_radius.png" alt="Blast radius visualization showing how a change to login() propagates to callers, dependents, and tests" width="70%" />
170
+ </p>
171
+
172
+ ### Incremental updates in < 2 seconds
173
+
174
+ When hooks or watch mode are enabled, file saves and supported commit hooks trigger incremental updates. 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.
175
+
176
+ <p align="center">
177
+ <img src="diagrams/diagram4_incremental_update.png" alt="Incremental update flow: supported hook or watch update triggers diff, finds dependents, re-parses only 5 files while 2,910 are skipped" width="90%" />
178
+ </p>
179
+
180
+ ### The monorepo problem, solved
181
+
182
+ Large 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.
183
+
184
+ <p align="center">
185
+ <img src="diagrams/diagram6_monorepo_funnel.png" alt="code-review-graph repo: 208,821 source tokens funnel down to ~2,495 token graph responses — 93x fewer tokens per question" width="80%" />
186
+ </p>
187
+
188
+ ### Broad language coverage + Jupyter notebooks
189
+
190
+ <p align="center">
191
+ <img src="diagrams/diagram9_language_coverage.png" alt="Language coverage organized by category: Web, Backend, Systems, Mobile, Scripting, Config, plus Jupyter and Databricks notebook support" width="90%" />
192
+ </p>
193
+
194
+ Parser support covers functions, classes, imports, call sites, inheritance, and test detection across the current parser surface, using Tree-sitter where available and targeted fallbacks where needed. Current support includes Python, JavaScript/TypeScript/TSX, Go, Rust, Java, C/C++, C#, Ruby, Kotlin, Swift, PHP, Scala, Solidity, Dart, R, Perl, Lua/Luau, Objective-C, shell scripts, Elixir, Zig, PowerShell, Julia, ReScript, GDScript, Nix, Verilog/SystemVerilog, SQL, Vue/Svelte SFCs, Astro files parsed through the TypeScript parser, Jupyter/Databricks notebooks (`.ipynb`), and Perl XS files (`.xs`).
195
+
196
+ ### Add your own language (no fork needed)
197
+
198
+ If your repo uses a language the parser does not cover yet, drop a `languages.toml` into `.code-review-graph/` mapping file extensions to any grammar bundled in `tree_sitter_language_pack`, plus the tree-sitter node types for functions, classes, imports, and calls:
199
+
200
+ ```toml
201
+ [languages.erlang]
202
+ extensions = [".erl"]
203
+ grammar = "erlang"
204
+ function_node_types = ["function_clause"]
205
+ class_node_types = ["record_decl"]
206
+ import_node_types = ["import_attribute"]
207
+ call_node_types = ["call"]
208
+ ```
209
+
210
+ The generic tree-sitter walker handles extraction from there — no code changes, and built-in languages can never be overridden. See [docs/CUSTOM_LANGUAGES.md](docs/CUSTOM_LANGUAGES.md) for the schema reference, validation rules, and a worked end-to-end example.
211
+
212
+ ### Risk-scored PR reviews in CI (GitHub Action)
213
+
214
+ The same analysis runs as a composite GitHub Action — and it stays local-first: the knowledge graph is built and queried entirely on your CI runner, with no source code sent to any external service. On each pull request the action posts a single sticky comment with risk-scored functions, affected execution flows, and test gaps, updated in place on every push. An optional `fail-on-risk` input turns the review into a merge gate.
215
+
216
+ ```yaml
217
+ # .github/workflows/code-review-graph.yml
218
+ on:
219
+ pull_request:
220
+
221
+ permissions:
222
+ contents: read
223
+ pull-requests: write
224
+
225
+ jobs:
226
+ review:
227
+ runs-on: ubuntu-latest
228
+ steps:
229
+ - uses: actions/checkout@v4
230
+ - uses: tirth8205/code-review-graph@v2.3.6
231
+ with:
232
+ github-token: ${{ secrets.GITHUB_TOKEN }}
233
+ ```
234
+
235
+ See [docs/GITHUB_ACTION.md](docs/GITHUB_ACTION.md) for inputs, risk levels, and caching details, or the dogfood workflow this repo runs on itself in [`.github/workflows/pr-review.yml`](.github/workflows/pr-review.yml).
236
+
237
+ ---
238
+
239
+ ## Benchmarks
240
+
241
+ <p align="center">
242
+ <img src="diagrams/diagram5_benchmark_board.png" alt="Benchmarks across 6 real repositories: ~82x median per-question token reduction (528x max), 0.71 average impact F1 against graph-derived ground truth" width="85%" />
243
+ </p>
244
+
245
+ **Headline number: the median per-question token reduction across the 6 repos is ~82x** (whole-corpus baseline vs graph query). The frequently quoted **528x is the maximum** — a single best-case repo (fastapi) — not the typical result.
246
+
247
+ All numbers come from the automated evaluation runner against 6 real open-source repositories (13 commits total). Every config pins an upstream SHA, the Leiden community detector runs with a fixed seed, and embeddings are deterministic on CPU — so two runs on different machines produce identical numbers. The full reproduction recipe with expected outputs is in [`docs/REPRODUCING.md`](docs/REPRODUCING.md). A weekly report-only run on the two smallest configs lives in [`.github/workflows/eval.yml`](.github/workflows/eval.yml).
248
+
249
+ <details>
250
+ <summary><strong>Token efficiency: ~82x median per-question reduction (range 38x – 528x; whole-corpus vs graph query)</strong></summary>
251
+ <br>
252
+
253
+ For a typical agent question (`"how does authentication work"`, `"what is the main entry point"`, etc.), the graph returns ~2,000–3,500 tokens of targeted search hits + neighbor edges instead of forcing the agent to read every source file. The table below averages over the 5 sample questions defined in `code_review_graph/token_benchmark.py`.
254
+
255
+ | Repo | Snapshot SHA | naive_corpus_tokens | avg graph_tokens | Reduction |
256
+ |------|---|-----------------:|----------------:|----------:|
257
+ | fastapi | `0227991a` | 951,071 | 2,169 | **528.4x** |
258
+ | code-review-graph | `84bde354` | 208,821 | 2,495 | **93.0x** |
259
+ | gin | `5c00df8a` | 166,868 | 1,990 | **91.8x** |
260
+ | flask | `a29f88ce` | 125,022 | 1,986 | **71.4x** |
261
+ | express | `b4ab7d65` | 135,955 | 3,465 | **40.6x** |
262
+ | httpx | `b55d4635` | 89,492 | 2,438 | **38.0x** |
263
+
264
+ Median per-question reduction across the 6 repos: **~82x**. The range is 38x – 528x, where **528x is the best case** (fastapi, the largest corpus), not the headline.
265
+
266
+ The whole-corpus baseline above is an upper bound no real agent pays: a competent agent greps for identifiers and reads only the best-matching files. The `agent_baseline` eval benchmark measures that realistic baseline — a pure-python grep over the corpus, top-3 files by match count, token-counted and compared to the graph query cost (`evaluate/results/<repo>_agent_baseline_*.csv`).
267
+
268
+ The formal `eval/benchmarks/token_efficiency.py` benchmark measures a different scenario — full `get_review_context()` JSON versus just the changed-file content of a commit — and reports ratios below 1 for small commits, because the review-context response carries impact-radius edges plus source snippets that exceed a tiny single-file diff. That is not a bug; the two benchmarks answer different questions. See [`docs/REPRODUCING.md`](docs/REPRODUCING.md) for the full methodology.
269
+
270
+ Since v2.3.4, review and impact tools attach a compact `context_savings` estimate so MCP clients can see the approximate context saved per call. In v2.3.5 the CLI surfaces this as the boxed `Token Savings` panel shown above (see "Token Savings panel" in the Usage section) and adds `--verify` to cross-check against OpenAI's `cl100k_base` tokenizer. Calibration data in [`docs/REPRODUCING.md`](docs/REPRODUCING.md) shows the estimate is within ~1% of real GPT-4 tokens in aggregate across 222 sample files.
271
+
272
+ </details>
273
+
274
+ <details>
275
+ <summary><strong>Impact accuracy: 0.71 average F1 against graph-derived ground truth (recall 1.0 is a circular upper bound, not "100% recall")</strong></summary>
276
+ <br>
277
+
278
+ Blast-radius analysis recovers every file in the ground truth on all 13 evaluation commits — **but read that as an upper bound, not as "100% recall"**: in this mode the ground truth (changed files + files with call/import edges into them) is derived from the same graph the predictor traverses, so it is circular by construction. The over-prediction visible in the precision column is a deliberate trade-off: better to flag too many files than miss a broken dependency.
279
+
280
+ | Repo | Commits | Avg F1 | Avg Precision | Recall (graph-derived upper bound) |
281
+ |------|--------:|-------:|--------------:|-------:|
282
+ | httpx | 2 | 0.864 | 0.786 | 1.0 |
283
+ | fastapi | 2 | 0.834 | 0.750 | 1.0 |
284
+ | code-review-graph | 2 | 0.734 | 0.584 | 1.0 |
285
+ | express | 2 | 0.667 | 0.500 | 1.0 |
286
+ | flask | 2 | 0.628 | 0.481 | 1.0 |
287
+ | gin | 3 | 0.609 | 0.439 | 1.0 |
288
+ | **Average** | **13** | **0.714** | **0.578** | **1.000** |
289
+
290
+ The benchmark also runs an honest **co-change mode**: the predictor is seeded with a single changed file and graded against the *other* files the author actually touched in the same commit — independent-ish evidence from git history, not from the graph. Both modes appear side by side in the result CSVs (`ground_truth_mode` column). Co-change numbers will be added to the canonical stats once captured by the eval runner; we do not quote them before measuring.
291
+
292
+ </details>
293
+
294
+ <details>
295
+ <summary><strong>Build performance</strong></summary>
296
+ <br>
297
+
298
+ | Repo | Files | Nodes | Edges | Flow Detection | Search Latency |
299
+ |------|------:|------:|------:|---------------:|---------------:|
300
+ | express | 141 | 1,910 | 17,553 | 106ms | 0.7ms |
301
+ | fastapi | 1,122 | 6,285 | 27,117 | 128ms | 1.5ms |
302
+ | flask | 83 | 1,446 | 7,974 | 95ms | 0.7ms |
303
+ | gin | 99 | 1,286 | 16,762 | 111ms | 0.5ms |
304
+ | httpx | 60 | 1,253 | 7,896 | 96ms | 0.4ms |
305
+
306
+ </details>
307
+
308
+ ### Limitations and known weaknesses
309
+
310
+ - **Impact "recall 1.0" is graph-derived and circular:** the historical ground truth comes from the same graph edges the predictor walks, so it is an upper bound by construction. The honest co-change mode (grade against files actually co-changed in the same commit) is measured alongside it; expect those numbers to be substantially lower.
311
+ - **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.
312
+ - **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.
313
+ - **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.
314
+ - **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.
315
+
316
+ ---
317
+
318
+ ## Features
319
+
320
+ | Feature | Details |
321
+ |---------|---------|
322
+ | **Incremental updates** | Re-parses only changed files. Subsequent updates complete in under 2 seconds. |
323
+ | **Broad language + notebook support** | Python, JavaScript/TypeScript/TSX, Go, Rust, Java, C/C++, C#, Ruby, Kotlin, Swift, PHP, Scala, Solidity, Dart, R, Perl, Lua/Luau, Objective-C, shell scripts, Elixir, Zig, PowerShell, Julia, ReScript, GDScript, Nix, Verilog/SystemVerilog, SQL, Vue/Svelte SFCs, Astro files parsed through the TypeScript parser, Jupyter/Databricks (.ipynb), and Perl XS (.xs) |
324
+ | **Blast-radius analysis** | Shows which functions, classes, and files are likely affected by a change |
325
+ | **Auto-update hooks** | Hooks and watch mode can update the graph on file saves and supported commit hooks |
326
+ | **Semantic search** | Optional vector embeddings via sentence-transformers, Google Gemini, MiniMax, or any OpenAI-compatible endpoint (real OpenAI, Azure, new-api, LiteLLM, vLLM, LocalAI) |
327
+ | **Interactive visualisation** | D3.js force-directed graph with search, community legend toggles, and degree-scaled nodes |
328
+ | **Hub & bridge detection** | Find most-connected nodes and architectural chokepoints via betweenness centrality |
329
+ | **Surprise scoring** | Detect unexpected coupling: cross-community, cross-language, peripheral-to-hub edges |
330
+ | **Knowledge gap analysis** | Identify isolated nodes, untested hotspots, thin communities, and structural weaknesses |
331
+ | **Suggested questions** | Auto-generated review questions from graph analysis (bridges, hubs, surprises) |
332
+ | **Edge confidence** | Three-tier confidence scoring (EXTRACTED/INFERRED/AMBIGUOUS) with float scores on edges |
333
+ | **Graph traversal** | Free-form BFS/DFS exploration from any node with configurable depth and token budget |
334
+ | **Export formats** | GraphML (Gephi/yEd), Neo4j Cypher, Obsidian vault with wikilinks, SVG static graph |
335
+ | **Graph diff** | Compare graph snapshots over time: new/removed nodes, edges, community changes |
336
+ | **Token benchmarking** | Measure naive full-corpus tokens vs graph query tokens with per-question ratios |
337
+ | **Estimated context savings** | Compact `context_savings` metadata on relevant MCP/CLI review outputs, labelled as estimated and kept to three small fields |
338
+ | **Memory loop** | Persist Q&A results as markdown for re-ingestion, so the graph grows from queries |
339
+ | **Community auto-split** | Oversized communities (>25% of graph) are recursively split via Leiden |
340
+ | **Execution flows** | Trace call chains from entry points, sorted by weighted criticality |
341
+ | **Community detection** | Cluster related code via Leiden algorithm with resolution scaling for large graphs |
342
+ | **Architecture overview** | Auto-generated architecture map with coupling warnings |
343
+ | **Risk-scored reviews** | `detect_changes` maps diffs to affected functions, flows, and test gaps |
344
+ | **Custom languages** | Add new languages via `.code-review-graph/languages.toml` — no fork or code changes needed |
345
+ | **GitHub Action** | Sticky risk-scored PR review comments in CI, with an optional `fail-on-risk` merge gate |
346
+ | **Refactoring tools** | Rename preview, framework-aware dead code detection, community-driven suggestions |
347
+ | **Wiki generation** | Auto-generate markdown wiki from community structure |
348
+ | **Multi-repo registry** | Register multiple repos, search across all of them |
349
+ | **Multi-repo daemon** | `crg-daemon` watches multiple repos as child processes, with health checks and auto-restart |
350
+ | **MCP prompts** | 5 workflow templates: review, architecture, debug, onboard, pre-merge |
351
+ | **Full-text search** | FTS5-powered hybrid search combining keyword and vector similarity |
352
+ | **Local storage** | SQLite file in `.code-review-graph/`. Core graph storage needs no external database or cloud service. |
353
+ | **Watch mode** | Continuous graph updates as you work |
354
+
355
+ ---
356
+
357
+ ## Usage
358
+
359
+ <details>
360
+ <summary><strong>Slash commands</strong></summary>
361
+ <br>
362
+
363
+ | Command | Description |
364
+ |---------|-------------|
365
+ | `/code-review-graph:build-graph` | Build or rebuild the code graph |
366
+ | `/code-review-graph:review-delta` | Review changes since last commit |
367
+ | `/code-review-graph:review-pr` | Full PR review with blast-radius analysis |
368
+
369
+ </details>
370
+
371
+ <details>
372
+ <summary><strong>CLI reference</strong></summary>
373
+ <br>
374
+
375
+ ```bash
376
+ code-review-graph install # Auto-detect and configure all platforms
377
+ code-review-graph install --platform <name> # Target a specific platform
378
+ code-review-graph build # Parse entire codebase
379
+ code-review-graph update # Incremental update (changed files only)
380
+ code-review-graph status # Graph statistics
381
+ code-review-graph watch # Auto-update on file changes
382
+ code-review-graph visualize # Generate interactive HTML graph
383
+ code-review-graph visualize --format graphml # Export as GraphML
384
+ code-review-graph visualize --format svg # Export as SVG
385
+ code-review-graph visualize --format obsidian # Export as Obsidian vault
386
+ code-review-graph visualize --format cypher # Export as Neo4j Cypher
387
+ code-review-graph wiki # Generate markdown wiki from communities
388
+ code-review-graph detect-changes --brief # Risk panel + token savings (read-only)
389
+ code-review-graph update --brief # Refresh graph + same panel
390
+ code-review-graph detect-changes --brief --verify # Cross-check vs tiktoken
391
+ code-review-graph register <path> # Register repo in multi-repo registry
392
+ code-review-graph unregister <id> # Remove repo from registry
393
+ code-review-graph repos # List registered repositories
394
+ code-review-graph daemon start # Start multi-repo watch daemon
395
+ code-review-graph daemon stop # Stop the daemon
396
+ code-review-graph daemon status # Show daemon status and repos
397
+ code-review-graph eval # Run evaluation benchmarks
398
+ code-review-graph serve # Start MCP server
399
+ ```
400
+
401
+ </details>
402
+
403
+ <details>
404
+ <summary><strong>Token Savings panel: <code>detect-changes --brief</code> vs <code>update --brief</code></strong></summary>
405
+ <br>
406
+
407
+ Both commands print the same compact panel showing how many tokens the
408
+ graph saved you compared to handing the changed files to an agent raw.
409
+ They differ in **one** thing: whether the graph gets refreshed first.
410
+
411
+ ```text
412
+ ┌─────────────────────── Token Savings ────────────────────────┐
413
+ │ Full context would be: 12,921 tokens │
414
+ │ Graph context used: 762 tokens │
415
+ │ Saved: 12,159 tokens (~94%) │
416
+ │ Breakdown: Functions 244 · Tests 191 · Risk 244 · Other 83 │
417
+ └──────────────────────────────────────────────────────────────┘
418
+ ```
419
+
420
+ | Command | What it does | When to use |
421
+ |---|---|---|
422
+ | `detect-changes --brief` | **Read-only.** Looks at your current changes, queries the **existing** graph, prints the panel. ~1 sec. | Most of the time — the hooks (or `crg-daemon`) keep the graph fresh in the background, so this is enough. |
423
+ | `update --brief` | **Re-parses your changed files into the graph first**, then prints the same panel. ~5 sec. | After a rebase, a large change set, or any time you suspect the graph is stale. |
424
+
425
+ Both end with the **same panel** because both call the same `analyze_changes()` step at the end. The difference is whether the graph itself got refreshed before that analysis ran.
426
+
427
+ Add `--verify` to either command to cross-check the displayed numbers against OpenAI's `cl100k_base` tokenizer (the GPT-4 family). Requires `pip install tiktoken`. The estimate stays within ~1% of real tokens on a typical change set — see [`docs/REPRODUCING.md`](docs/REPRODUCING.md) for the calibration data.
428
+
429
+ The same `context_savings` metadata is also attached automatically to the JSON responses of `get_impact_radius`, `get_review_context`, `detect_changes`, and `get_architecture_overview` MCP tools, so AI agents can surface the savings to humans in chat without any extra prompting.
430
+
431
+ </details>
432
+
433
+ <details>
434
+ <summary><strong>Multi-repo daemon</strong></summary>
435
+ <br>
436
+
437
+ If your editor doesn't support hooks (e.g. Cursor, OpenCode), or you just want your
438
+ graph to stay fresh in the background without any editor integration, the daemon is
439
+ for you. It watches your repos for file changes and automatically rebuilds the graph
440
+ — no manual `build` or `update` commands needed.
441
+
442
+ The daemon is included with `code-review-graph` — no separate install required.
443
+
444
+ **Quick setup:**
445
+
446
+ ```bash
447
+ # 1. Register the repos you want to watch
448
+ crg-daemon add ~/project-a --alias proj-a
449
+ crg-daemon add ~/project-b
450
+
451
+ # 2. Start the daemon (runs in the background)
452
+ crg-daemon start
453
+
454
+ # 3. That's it — graphs stay up to date automatically
455
+ crg-daemon status # check daemon and per-repo watcher status
456
+ crg-daemon logs --repo proj-a -f # tail logs for a specific repo
457
+ crg-daemon stop # stop daemon and all watcher processes
458
+ ```
459
+
460
+ Also available as `code-review-graph daemon start|stop|status|...`.
461
+
462
+ Under the hood, `crg-daemon add` writes to a TOML config file at
463
+ `~/.code-review-graph/watch.toml`. You can also edit this file directly:
464
+
465
+ ```toml
466
+ [[repos]]
467
+ path = "/home/user/project-a"
468
+ alias = "proj-a"
469
+
470
+ [[repos]]
471
+ path = "/home/user/project-b"
472
+ alias = "project-b"
473
+ ```
474
+
475
+ The daemon monitors this config file for changes and automatically starts/stops
476
+ watcher processes as repos are added or removed. Health checks every 30 seconds
477
+ restart dead watchers. No external dependencies required.
478
+
479
+ See [docs/COMMANDS.md](docs/COMMANDS.md#standalone-daemon-cli-crg-daemon) for the
480
+ full config reference and all available options.
481
+
482
+ </details>
483
+
484
+ <details>
485
+ <summary><strong>30 MCP tools</strong></summary>
486
+ <br>
487
+
488
+ Your AI assistant uses these automatically once the graph is built.
489
+
490
+ | Tool | Description |
491
+ |------|-------------|
492
+ | `build_or_update_graph_tool` | Build or incrementally update the graph |
493
+ | `run_postprocess_tool` | Re-run flow detection, community detection, and FTS indexing |
494
+ | `get_minimal_context_tool` | Ultra-compact context (~100 tokens) — call this first |
495
+ | `get_impact_radius_tool` | Blast radius of changed files |
496
+ | `get_review_context_tool` | Token-optimised review context with structural summary |
497
+ | `query_graph_tool` | Callers, callees, tests, imports, inheritance queries |
498
+ | `traverse_graph_tool` | BFS/DFS traversal from any node with token budget |
499
+ | `semantic_search_nodes_tool` | Search code entities by name or meaning |
500
+ | `embed_graph_tool` | Compute vector embeddings for semantic search |
501
+ | `list_graph_stats_tool` | Graph size and health |
502
+ | `get_docs_section_tool` | Retrieve documentation sections |
503
+ | `find_large_functions_tool` | Find functions/classes exceeding a line-count threshold |
504
+ | `list_flows_tool` | List execution flows sorted by criticality |
505
+ | `get_flow_tool` | Get details of a single execution flow |
506
+ | `get_affected_flows_tool` | Find flows affected by changed files |
507
+ | `list_communities_tool` | List detected code communities |
508
+ | `get_community_tool` | Get details of a single community |
509
+ | `get_architecture_overview_tool` | Architecture overview from community structure |
510
+ | `detect_changes_tool` | Risk-scored change impact analysis for code review |
511
+ | `get_hub_nodes_tool` | Find most-connected nodes (architectural hotspots) |
512
+ | `get_bridge_nodes_tool` | Find chokepoints via betweenness centrality |
513
+ | `get_knowledge_gaps_tool` | Identify structural weaknesses and untested hotspots |
514
+ | `get_surprising_connections_tool` | Detect unexpected cross-community coupling |
515
+ | `get_suggested_questions_tool` | Auto-generated review questions from analysis |
516
+ | `refactor_tool` | Rename preview, dead code detection, suggestions |
517
+ | `apply_refactor_tool` | Apply a previously previewed refactoring |
518
+ | `generate_wiki_tool` | Generate markdown wiki from communities |
519
+ | `get_wiki_page_tool` | Retrieve a specific wiki page |
520
+ | `list_repos_tool` | List registered repositories |
521
+ | `cross_repo_search_tool` | Search across all registered repositories |
522
+
523
+ **MCP Prompts** (5 workflow templates):
524
+ `review_changes`, `architecture_map`, `debug_issue`, `onboard_developer`, `pre_merge_check`
525
+
526
+ </details>
527
+
528
+ <details>
529
+ <summary><strong>Configuration</strong></summary>
530
+ <br>
531
+
532
+ To exclude paths from indexing, create a `.code-review-graphignore` file in your repository root:
533
+
534
+ ```
535
+ generated/**
536
+ *.generated.ts
537
+ vendor/**
538
+ node_modules/**
539
+ ```
540
+
541
+ Note: 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.
542
+
543
+ Optional dependency groups:
544
+
545
+ ```bash
546
+ pip install code-review-graph[embeddings] # Local vector embeddings (sentence-transformers)
547
+ pip install code-review-graph[google-embeddings] # Google Gemini embeddings
548
+ pip install code-review-graph[communities] # Community detection (igraph)
549
+ pip install code-review-graph[enrichment] # Python call-resolution enrichment (Jedi)
550
+ pip install code-review-graph[eval] # Evaluation benchmarks (matplotlib)
551
+ pip install code-review-graph[wiki] # Wiki generation with LLM summaries (ollama)
552
+ pip install code-review-graph[all] # All optional dependencies
553
+ ```
554
+
555
+ ### Environment Variables
556
+
557
+ | Variable | Description | Default |
558
+ |----------|-------------|---------|
559
+ | `CRG_GIT_TIMEOUT` | Timeout in seconds for Git operations | `30` |
560
+ | `CRG_DATA_DIR` | Override directory for graph databases and generated graph artefacts | - |
561
+ | `CRG_EMBEDDING_MODEL` | Default model for vector embeddings | `all-MiniLM-L6-v2` |
562
+ | `CRG_ACCEPT_CLOUD_EMBEDDINGS` | Suppress the cloud embedding egress warning after explicit acknowledgement | - |
563
+ | `CRG_ALLOW_REMOTE_CODE` | Allow HuggingFace models that require `trust_remote_code=True` | `0` |
564
+ | `CRG_MAX_IMPACT_NODES` | Maximum nodes to include in impact analysis | `500` |
565
+ | `CRG_MAX_IMPACT_DEPTH` | Search depth for blast-radius analysis | `2` |
566
+ | `CRG_MAX_BFS_DEPTH` | Maximum depth for graph traversal | `15` |
567
+ | `CRG_MAX_CHANGED_FUNCS` | Maximum changed functions analysed in one change report | `500` |
568
+ | `CRG_MAX_TRANSITIVE_FRONTIER` | Maximum frontier size for transitive caller/callee expansion | `50` |
569
+ | `CRG_TOOL_TIMEOUT` | Optional timeout in seconds for bounded MCP tools (`0` disables timeout) | `0` |
570
+ | `CRG_RECURSE_SUBMODULES` | Include git submodules in file collection when set to `1`, `true`, or `yes` | - |
571
+ | `CRG_TOOLS` | Comma-separated allowlist of MCP tools to expose when serving | - |
572
+ | `GOOGLE_API_KEY` | API key for Google Gemini embeddings | - |
573
+ | `MINIMAX_API_KEY` | API key for MiniMax embeddings | - |
574
+ | `CRG_OPENAI_BASE_URL` | OpenAI-compatible embeddings endpoint | - |
575
+ | `CRG_OPENAI_API_KEY` | API key for OpenAI-compatible embeddings | - |
576
+ | `CRG_OPENAI_MODEL` | Model name for OpenAI-compatible embeddings | - |
577
+ | `CRG_OPENAI_DIMENSION` | Pin embedding dimension (v3 models support reduction) | - |
578
+ | `NO_COLOR` | If set, disables ANSI colors in terminal | - |
579
+ | `CRG_SERIAL_PARSE` | If `1`, disables parallel parsing (use for debugging) | - |
580
+
581
+ OpenAI-compatible embeddings (real OpenAI, Azure, or any self-hosted gateway like
582
+ new-api / LiteLLM / vLLM / LocalAI / Ollama in openai mode) need no extra install —
583
+ just set the environment variables and pass `provider="openai"` to `embed_graph`:
584
+
585
+ ```bash
586
+ export CRG_OPENAI_BASE_URL=http://127.0.0.1:3000/v1 # or https://api.openai.com/v1
587
+ export CRG_OPENAI_API_KEY=sk-...
588
+ export CRG_OPENAI_MODEL=text-embedding-3-small # whatever your gateway serves
589
+ # optional:
590
+ export CRG_OPENAI_DIMENSION=1536 # pin dim (v3 models support reduction)
591
+ export CRG_OPENAI_BATCH_SIZE=100 # lower for gateways with tight limits
592
+ # (e.g. Qwen text-embedding-v4 caps at 10)
593
+ ```
594
+
595
+ The cloud-egress warning is auto-skipped when the base URL points to localhost
596
+ (`127.0.0.1`, `localhost`, `0.0.0.0`, `::1`).
597
+
598
+ > **Model selection tip.** Avoid `-preview` / `-beta` / `-exp` model IDs
599
+ > (e.g. `google/gemini-embedding-2-preview`) for anything you plan to keep
600
+ > long-term — preview models can change weights (different dimension → full
601
+ > re-embed required) or be deprecated without notice. Prefer stable GA
602
+ > releases such as `text-embedding-3-small` / `text-embedding-3-large` (OpenAI),
603
+ > `Qwen/Qwen3-Embedding-8B` (via self-hosted vLLM / LocalAI), or
604
+ > `gemini-embedding-001` (via the native Gemini provider, which requires
605
+ > `GOOGLE_API_KEY` instead of the OpenAI-compatible path).
606
+ >
607
+ > Also note: `code-review-graph` currently embeds **function signatures only**
608
+ > (~10 tokens per node, e.g. `"parse_file function (path: str) returns Tree"`).
609
+ > Models whose headline quality comes from long-context body understanding
610
+ > (such as Gemini 2 or Qwen3-8B at their MTEB-code SOTA scores) will see a
611
+ > much narrower quality gap against smaller models at this input length.
612
+ > Body/docstring embedding is tracked as a follow-up enhancement.
613
+
614
+ #### Tool Filtering
615
+
616
+ CRG exposes 30 MCP tools by default. In token-constrained environments, you can
617
+ limit the server to a subset of tools using `--tools` or the `CRG_TOOLS`
618
+ environment variable:
619
+
620
+ ```bash
621
+ # Via CLI flag
622
+ code-review-graph serve --tools query_graph_tool,semantic_search_nodes_tool,detect_changes_tool
623
+
624
+ # Via environment variable
625
+ CRG_TOOLS=query_graph_tool,semantic_search_nodes_tool code-review-graph serve
626
+ ```
627
+
628
+ The CLI flag takes precedence over the environment variable. When neither is set,
629
+ all tools are available. This is especially useful for MCP client configurations:
630
+
631
+ ```json
632
+ {
633
+ "mcpServers": {
634
+ "code-review-graph": {
635
+ "command": "code-review-graph",
636
+ "args": ["serve", "--tools", "query_graph_tool,semantic_search_nodes_tool,detect_changes_tool,get_review_context_tool"]
637
+ }
638
+ }
639
+ }
640
+ ```
641
+
642
+ </details>
643
+
644
+ ---
645
+
646
+ ## FAQ & how it compares
647
+
648
+ Short, honest answers in [docs/FAQ.md](docs/FAQ.md):
649
+
650
+ - [vs LSP / language servers](docs/FAQ.md#how-is-this-different-from-lsp-and-language-servers) — one persistent cross-language graph instead of per-language daemons; LSP stays more precise per symbol.
651
+ - [vs RAG / embeddings](docs/FAQ.md#isnt-this-just-rag) — structural edges parsed from the AST, not similarity chunks; embeddings are optional and only assist search.
652
+ - [vs grep / agentic search](docs/FAQ.md#why-not-just-grep) — grep wins on one-hop lookups; the graph wins on multi-hop questions (impact radius, callers-of-callers, tests-for, affected flows).
653
+ - [vs Serena, codegraph, claude-context, repomix](docs/FAQ.md#how-does-it-compare-to-serena-codegraph-claude-context-and-repomix) — factual comparison table.
654
+ - [When NOT to use it](docs/FAQ.md#when-should-i-not-use-it) — small repos, trivial single-file diffs, one-off questions.
655
+ - [Does it phone home?](docs/FAQ.md#does-it-phone-home) — no; zero telemetry, cloud embeddings are opt-in.
656
+ - [How do I verify it is working?](docs/FAQ.md#how-do-i-verify-it-is-working) — `status`, `detect-changes --brief`, `/mcp`.
657
+
658
+ ## Troubleshooting
659
+
660
+ ### `pip` / `pipx` cannot download `hatchling` (or `Errno 9` / `Bad file descriptor` to PyPI)
661
+
662
+ Installing 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/pip 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).
663
+
664
+ **Options:**
665
+
666
+ 1. 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://..."` .
667
+ 2. Use **[uv](https://docs.astral.sh/uv/)** to install the CLI from a checkout (uses different download machinery than `pip` in many cases):
668
+
669
+ ```bash
670
+ cd /path/to/code-review-graph
671
+ uv tool install . --force
672
+ ```
673
+
674
+ 3. For **development in a clone** without a global install, use `uv sync` and `uv run code-review-graph …` (or activate `.venv` after `uv sync`).
675
+
676
+ **Diagnose (optional):** `python3 scripts/diagnose_pypi_connectivity.py` — if it prints `FAILED`, the issue is environment/network, not a wrong package name in this repo.
677
+
678
+ ### Windows Configuration Issues (Invalid JSON / Connection Closed)
679
+ If 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 /c` wrapper in your config.
680
+
681
+ Ensure `fastmcp` is updated to at least `3.2.4+`. Then, configure your `~/.claude.json` to execute the `.exe` directly and pass the UTF-8 environment variable via the config:
682
+
683
+ ```json
684
+ "code-review-graph": {
685
+ "command": "C:\\path\\to\\your\\venv\\Scripts\\code-review-graph.exe",
686
+ "args": ["serve", "--repo", "C:\\path\\to\\your\\project"],
687
+ "env": { "PYTHONUTF8": "1" }
688
+ }
689
+ ```
690
+
691
+ ## Contributing
692
+
693
+ ```bash
694
+ git clone https://github.com/tirth8205/code-review-graph.git
695
+ cd code-review-graph
696
+ python3 -m venv .venv && source .venv/bin/activate
697
+ pip install -e ".[dev]"
698
+ pytest
699
+ ```
700
+
701
+ <details>
702
+ <summary><strong>Adding a new language</strong></summary>
703
+ <br>
704
+
705
+ Edit `code_review_graph/parser.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.
706
+
707
+ </details>
708
+
709
+ ## Licence
710
+
711
+ MIT. See [LICENSE](LICENSE).
712
+
713
+ <p align="center">
714
+ <br>
715
+ <a href="https://code-review-graph.com">code-review-graph.com</a><br><br>
716
+ <code>pip install code-review-graph && code-review-graph install</code><br>
717
+ <sub>Works with Codex, Claude Code, Cursor, Windsurf, Zed, Continue, OpenCode, Antigravity, Gemini CLI, Qwen, Qoder, Kiro, GitHub Copilot, and GitHub Copilot CLI</sub>
718
+ </p>