code-review-graph 1.8.2__tar.gz → 2.0.0__tar.gz
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.
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/.claude-plugin/marketplace.json +2 -2
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/.claude-plugin/plugin.json +1 -1
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/.gitignore +6 -4
- code_review_graph-2.0.0/PKG-INFO +384 -0
- code_review_graph-2.0.0/README.md +330 -0
- code_review_graph-2.0.0/code-review-graph-vscode/LICENSE +21 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/code-review-graph-vscode/README.md +10 -1
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/code_review_graph/__init__.py +2 -0
- code_review_graph-2.0.0/code_review_graph/changes.py +295 -0
- code_review_graph-2.0.0/code_review_graph/cli.py +501 -0
- code_review_graph-2.0.0/code_review_graph/communities.py +598 -0
- code_review_graph-2.0.0/code_review_graph/constants.py +10 -0
- code_review_graph-2.0.0/code_review_graph/embeddings.py +497 -0
- code_review_graph-2.0.0/code_review_graph/eval/__init__.py +33 -0
- code_review_graph-2.0.0/code_review_graph/eval/benchmarks/__init__.py +1 -0
- code_review_graph-2.0.0/code_review_graph/eval/benchmarks/build_performance.py +60 -0
- code_review_graph-2.0.0/code_review_graph/eval/benchmarks/flow_completeness.py +36 -0
- code_review_graph-2.0.0/code_review_graph/eval/benchmarks/impact_accuracy.py +90 -0
- code_review_graph-2.0.0/code_review_graph/eval/benchmarks/search_quality.py +57 -0
- code_review_graph-2.0.0/code_review_graph/eval/benchmarks/token_efficiency.py +105 -0
- code_review_graph-2.0.0/code_review_graph/eval/configs/express.yaml +25 -0
- code_review_graph-2.0.0/code_review_graph/eval/configs/fastapi.yaml +25 -0
- code_review_graph-2.0.0/code_review_graph/eval/configs/flask.yaml +25 -0
- code_review_graph-2.0.0/code_review_graph/eval/configs/gin.yaml +28 -0
- code_review_graph-2.0.0/code_review_graph/eval/configs/httpx.yaml +25 -0
- code_review_graph-2.0.0/code_review_graph/eval/configs/nextjs.yaml +25 -0
- code_review_graph-2.0.0/code_review_graph/eval/reporter.py +249 -0
- code_review_graph-2.0.0/code_review_graph/eval/runner.py +164 -0
- code_review_graph-2.0.0/code_review_graph/eval/scorer.py +85 -0
- code_review_graph-2.0.0/code_review_graph/flows.py +472 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/code_review_graph/graph.py +389 -28
- code_review_graph-2.0.0/code_review_graph/hints.py +384 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/code_review_graph/incremental.py +15 -5
- code_review_graph-2.0.0/code_review_graph/main.py +619 -0
- code_review_graph-2.0.0/code_review_graph/migrations.py +198 -0
- code_review_graph-2.0.0/code_review_graph/parser.py +1923 -0
- code_review_graph-2.0.0/code_review_graph/prompts.py +192 -0
- code_review_graph-2.0.0/code_review_graph/refactor.py +437 -0
- code_review_graph-2.0.0/code_review_graph/registry.py +258 -0
- code_review_graph-2.0.0/code_review_graph/search.py +391 -0
- code_review_graph-2.0.0/code_review_graph/skills.py +417 -0
- code_review_graph-2.0.0/code_review_graph/tools/__init__.py +123 -0
- code_review_graph-2.0.0/code_review_graph/tools/_common.py +85 -0
- code_review_graph-2.0.0/code_review_graph/tools/build.py +133 -0
- code_review_graph-2.0.0/code_review_graph/tools/community_tools.py +176 -0
- code_review_graph-2.0.0/code_review_graph/tools/docs.py +236 -0
- code_review_graph-2.0.0/code_review_graph/tools/flows_tools.py +162 -0
- code_review_graph-2.0.0/code_review_graph/tools/query.py +484 -0
- code_review_graph-2.0.0/code_review_graph/tools/refactor_tools.py +160 -0
- code_review_graph-2.0.0/code_review_graph/tools/registry_tools.py +124 -0
- code_review_graph-2.0.0/code_review_graph/tools/review.py +394 -0
- code_review_graph-2.0.0/code_review_graph/tsconfig_resolver.py +257 -0
- code_review_graph-2.0.0/code_review_graph/visualization.py +830 -0
- code_review_graph-2.0.0/code_review_graph/wiki.py +287 -0
- code_review_graph-2.0.0/docs/COMMANDS.md +258 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/docs/FEATURES.md +39 -2
- code_review_graph-2.0.0/docs/INDEX.md +11 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/docs/LLM-OPTIMIZED-REFERENCE.md +13 -8
- code_review_graph-2.0.0/docs/ROADMAP.md +67 -0
- code_review_graph-2.0.0/docs/TROUBLESHOOTING.md +67 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/docs/USAGE.md +48 -4
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/docs/architecture.md +20 -15
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/docs/schema.md +44 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/hooks/hooks.json +2 -14
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/pyproject.toml +27 -1
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/skills/build-graph/SKILL.md +1 -1
- code_review_graph-1.8.2/PKG-INFO +0 -301
- code_review_graph-1.8.2/README.md +0 -268
- code_review_graph-1.8.2/code_review_graph/cli.py +0 -266
- code_review_graph-1.8.2/code_review_graph/embeddings.py +0 -225
- code_review_graph-1.8.2/code_review_graph/main.py +0 -216
- code_review_graph-1.8.2/code_review_graph/parser.py +0 -578
- code_review_graph-1.8.2/code_review_graph/tools.py +0 -777
- code_review_graph-1.8.2/code_review_graph/visualization.py +0 -652
- code_review_graph-1.8.2/docs/COMMANDS.md +0 -176
- code_review_graph-1.8.2/docs/INDEX.md +0 -11
- code_review_graph-1.8.2/docs/ROADMAP.md +0 -65
- code_review_graph-1.8.2/docs/TROUBLESHOOTING.md +0 -38
- code_review_graph-1.8.2/docs/superpowers/specs/2026-03-16-vscode-extension-design.md +0 -308
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/LICENSE +0 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/code_review_graph/__main__.py +0 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/docs/LEGAL.md +0 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/hooks/session-start.sh +0 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/skills/review-delta/SKILL.md +0 -0
- {code_review_graph-1.8.2 → code_review_graph-2.0.0}/skills/review-pr/SKILL.md +0 -0
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Persistent incremental knowledge graph for token-efficient, context-aware code reviews with Claude Code",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "2.0.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "code-review-graph",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Persistent incremental knowledge graph for token-efficient, context-aware code reviews with Claude Code",
|
|
16
|
-
"version": "
|
|
16
|
+
"version": "2.0.0",
|
|
17
17
|
"category": "development",
|
|
18
18
|
"keywords": ["code-review", "knowledge-graph", "incremental", "tree-sitter", "mcp", "claude-code"]
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-review-graph",
|
|
3
3
|
"description": "Persistent incremental knowledge graph for token-efficient, context-aware code reviews with Claude Code",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Tirth Kanani",
|
|
7
7
|
"email": "tirthkanani18@gmail.com",
|
|
@@ -54,14 +54,16 @@ medium/
|
|
|
54
54
|
|
|
55
55
|
# Superpowers brainstorm
|
|
56
56
|
.superpowers/
|
|
57
|
+
docs/superpowers/plans/
|
|
58
|
+
docs/superpowers/specs/
|
|
57
59
|
|
|
58
|
-
# Diagrams
|
|
60
|
+
# Diagrams (PNGs + script tracked, excalidraw sources gitignored)
|
|
59
61
|
diagrams/*.excalidraw
|
|
60
62
|
diagrams/export_pngs.mjs
|
|
61
|
-
diagrams/generate_diagrams.py
|
|
62
63
|
*.excalidraw
|
|
63
64
|
|
|
65
|
+
# Evaluation test repos (third-party checkouts)
|
|
66
|
+
evaluate/test_repos/
|
|
67
|
+
|
|
64
68
|
# Draft/duplicate files
|
|
65
|
-
evaluate/results?2.csv
|
|
66
|
-
evaluate/results?3.csv
|
|
67
69
|
docs/assets/marketing-diagram*
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-review-graph
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Persistent incremental knowledge graph for token-efficient, context-aware code reviews with Claude Code
|
|
5
|
+
Project-URL: Homepage, https://github.com/tirth8205/code-review-graph
|
|
6
|
+
Project-URL: Repository, https://github.com/tirth8205/code-review-graph
|
|
7
|
+
Project-URL: Documentation, https://github.com/tirth8205/code-review-graph/blob/main/docs/INDEX.md
|
|
8
|
+
Project-URL: Changelog, https://github.com/tirth8205/code-review-graph/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/tirth8205/code-review-graph/issues
|
|
10
|
+
Author: Tirth
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: claude-code,code-review,knowledge-graph,mcp,tree-sitter
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: fastmcp<2,>=0.1.0
|
|
25
|
+
Requires-Dist: mcp<2,>=1.0.0
|
|
26
|
+
Requires-Dist: networkx<4,>=3.2
|
|
27
|
+
Requires-Dist: tree-sitter-language-pack<1,>=0.3.0
|
|
28
|
+
Requires-Dist: tree-sitter<1,>=0.23.0
|
|
29
|
+
Requires-Dist: watchdog<6,>=4.0.0
|
|
30
|
+
Provides-Extra: all
|
|
31
|
+
Requires-Dist: igraph>=0.11.0; extra == 'all'
|
|
32
|
+
Requires-Dist: matplotlib>=3.7.0; extra == 'all'
|
|
33
|
+
Requires-Dist: numpy<3,>=1.26; extra == 'all'
|
|
34
|
+
Requires-Dist: ollama>=0.1.0; extra == 'all'
|
|
35
|
+
Requires-Dist: pyyaml>=6.0; extra == 'all'
|
|
36
|
+
Requires-Dist: sentence-transformers<4,>=3.0.0; extra == 'all'
|
|
37
|
+
Provides-Extra: communities
|
|
38
|
+
Requires-Dist: igraph>=0.11.0; extra == 'communities'
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: pytest-asyncio<1,>=0.23; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest<9,>=8.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: ruff<1,>=0.3.0; extra == 'dev'
|
|
43
|
+
Provides-Extra: embeddings
|
|
44
|
+
Requires-Dist: numpy<3,>=1.26; extra == 'embeddings'
|
|
45
|
+
Requires-Dist: sentence-transformers<4,>=3.0.0; extra == 'embeddings'
|
|
46
|
+
Provides-Extra: eval
|
|
47
|
+
Requires-Dist: matplotlib>=3.7.0; extra == 'eval'
|
|
48
|
+
Requires-Dist: pyyaml>=6.0; extra == 'eval'
|
|
49
|
+
Provides-Extra: google-embeddings
|
|
50
|
+
Requires-Dist: google-generativeai<1,>=0.8.0; extra == 'google-embeddings'
|
|
51
|
+
Provides-Extra: wiki
|
|
52
|
+
Requires-Dist: ollama>=0.1.0; extra == 'wiki'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
<h1 align="center">code-review-graph</h1>
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<strong>Stop burning tokens. Start reviewing smarter.</strong>
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<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>
|
|
63
|
+
<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>
|
|
64
|
+
<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>
|
|
65
|
+
<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>
|
|
66
|
+
<a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-compatible-green.svg?style=flat-square" alt="MCP"></a>
|
|
67
|
+
<a href="#"><img src="https://img.shields.io/badge/version-2.0.0-purple.svg?style=flat-square" alt="v2.0.0"></a>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<br>
|
|
71
|
+
|
|
72
|
+
Claude Code re-reads your entire codebase on every task. `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 Claude precise context so it reads only what matters.
|
|
73
|
+
|
|
74
|
+
<p align="center">
|
|
75
|
+
<img src="diagrams/diagram1_before_vs_after.png" alt="The Token Problem: 8.2x average token reduction across 6 real repositories" width="85%" />
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install code-review-graph
|
|
84
|
+
code-review-graph install # auto-detects and configures all supported platforms
|
|
85
|
+
code-review-graph build # parse your codebase
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
One command sets up everything. `install` detects which AI coding tools you have and writes the correct MCP configuration for each one. Restart your editor/tool after installing.
|
|
89
|
+
|
|
90
|
+
To target a specific platform:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
code-review-graph install --platform cursor # configure only Cursor
|
|
94
|
+
code-review-graph install --platform claude-code # configure only Claude Code
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Requires Python 3.10+ and [uv](https://docs.astral.sh/uv/).
|
|
98
|
+
|
|
99
|
+
### Supported Platforms
|
|
100
|
+
|
|
101
|
+
| Platform | Config file | Auto-detected |
|
|
102
|
+
|----------|-------------|:---:|
|
|
103
|
+
| **Claude Code** | `.mcp.json` | Yes |
|
|
104
|
+
| **Cursor** | `.cursor/mcp.json` | Yes |
|
|
105
|
+
| **Windsurf** | `.windsurf/mcp.json` | Yes |
|
|
106
|
+
| **Zed** | `.zed/settings.json` | Yes |
|
|
107
|
+
| **Continue** | `.continue/config.json` | Yes |
|
|
108
|
+
| **OpenCode** | `.opencode/config.json` | Yes |
|
|
109
|
+
|
|
110
|
+
Then open your project and ask your AI assistant:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
Build the code review graph for this project
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The initial build takes ~10 seconds for a 500-file project. After that, the graph updates automatically on every file edit and git commit.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## How It Works
|
|
121
|
+
|
|
122
|
+
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 Claude needs to read.
|
|
123
|
+
|
|
124
|
+
<p align="center">
|
|
125
|
+
<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%" />
|
|
126
|
+
</p>
|
|
127
|
+
|
|
128
|
+
<details>
|
|
129
|
+
<summary><strong>Blast-radius analysis</strong></summary>
|
|
130
|
+
<br>
|
|
131
|
+
|
|
132
|
+
When a file changes, the graph traces every caller, dependent, and test that could be affected. This is the "blast radius" of the change. Claude reads only these files instead of scanning the whole project.
|
|
133
|
+
|
|
134
|
+
<p align="center">
|
|
135
|
+
<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%" />
|
|
136
|
+
</p>
|
|
137
|
+
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
<details>
|
|
141
|
+
<summary><strong>Incremental updates in < 2 seconds</strong></summary>
|
|
142
|
+
<br>
|
|
143
|
+
|
|
144
|
+
On 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.
|
|
145
|
+
|
|
146
|
+
<p align="center">
|
|
147
|
+
<img src="diagrams/diagram4_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%" />
|
|
148
|
+
</p>
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary><strong>18 supported languages</strong></summary>
|
|
154
|
+
<br>
|
|
155
|
+
|
|
156
|
+
Python, TypeScript/TSX, JavaScript, Vue, Go, Rust, Java, Scala, C#, Ruby, Kotlin, Swift, PHP, Solidity, C/C++, Dart, R, Perl
|
|
157
|
+
|
|
158
|
+
Each language has full Tree-sitter grammar support for functions, classes, imports, call sites, inheritance, and test detection.
|
|
159
|
+
|
|
160
|
+
</details>
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Benchmarks
|
|
165
|
+
|
|
166
|
+
All 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/reports/summary.md`](evaluate/reports/summary.md).
|
|
167
|
+
|
|
168
|
+
<details>
|
|
169
|
+
<summary><strong>Token efficiency: 8.2x average reduction (naive vs graph)</strong></summary>
|
|
170
|
+
<br>
|
|
171
|
+
|
|
172
|
+
The graph replaces reading entire source files with a compact structural context covering blast radius, dependency chains, and test coverage gaps.
|
|
173
|
+
|
|
174
|
+
| Repo | Commits | Avg Naive Tokens | Avg Graph Tokens | Reduction |
|
|
175
|
+
|------|--------:|-----------------:|----------------:|----------:|
|
|
176
|
+
| express | 2 | 693 | 983 | 0.7x |
|
|
177
|
+
| fastapi | 2 | 4,944 | 614 | 8.1x |
|
|
178
|
+
| flask | 2 | 44,751 | 4,252 | 9.1x |
|
|
179
|
+
| gin | 3 | 21,972 | 1,153 | 16.4x |
|
|
180
|
+
| httpx | 2 | 12,044 | 1,728 | 6.9x |
|
|
181
|
+
| nextjs | 2 | 9,882 | 1,249 | 8.0x |
|
|
182
|
+
| **Average** | **13** | | | **8.2x** |
|
|
183
|
+
|
|
184
|
+
**Why express shows <1x:** 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.
|
|
185
|
+
|
|
186
|
+
</details>
|
|
187
|
+
|
|
188
|
+
<details>
|
|
189
|
+
<summary><strong>Impact accuracy: 100% recall, 0.54 average F1</strong></summary>
|
|
190
|
+
<br>
|
|
191
|
+
|
|
192
|
+
The 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.
|
|
193
|
+
|
|
194
|
+
| Repo | Commits | Avg F1 | Avg Precision | Recall |
|
|
195
|
+
|------|--------:|-------:|--------------:|-------:|
|
|
196
|
+
| express | 2 | 0.667 | 0.50 | 1.0 |
|
|
197
|
+
| fastapi | 2 | 0.584 | 0.42 | 1.0 |
|
|
198
|
+
| flask | 2 | 0.475 | 0.34 | 1.0 |
|
|
199
|
+
| gin | 3 | 0.429 | 0.29 | 1.0 |
|
|
200
|
+
| httpx | 2 | 0.762 | 0.63 | 1.0 |
|
|
201
|
+
| nextjs | 2 | 0.331 | 0.20 | 1.0 |
|
|
202
|
+
| **Average** | **13** | **0.54** | **0.38** | **1.0** |
|
|
203
|
+
|
|
204
|
+
</details>
|
|
205
|
+
|
|
206
|
+
<details>
|
|
207
|
+
<summary><strong>Build performance</strong></summary>
|
|
208
|
+
<br>
|
|
209
|
+
|
|
210
|
+
| Repo | Files | Nodes | Edges | Flow Detection | Search Latency |
|
|
211
|
+
|------|------:|------:|------:|---------------:|---------------:|
|
|
212
|
+
| express | 141 | 1,910 | 17,553 | 106ms | 0.7ms |
|
|
213
|
+
| fastapi | 1,122 | 6,285 | 27,117 | 128ms | 1.5ms |
|
|
214
|
+
| flask | 83 | 1,446 | 7,974 | 95ms | 0.7ms |
|
|
215
|
+
| gin | 99 | 1,286 | 16,762 | 111ms | 0.5ms |
|
|
216
|
+
| httpx | 60 | 1,253 | 7,896 | 96ms | 0.4ms |
|
|
217
|
+
|
|
218
|
+
</details>
|
|
219
|
+
|
|
220
|
+
<details>
|
|
221
|
+
<summary><strong>Limitations and known weaknesses</strong></summary>
|
|
222
|
+
<br>
|
|
223
|
+
|
|
224
|
+
- **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.
|
|
225
|
+
- **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.
|
|
226
|
+
- **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.
|
|
227
|
+
- **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.
|
|
228
|
+
|
|
229
|
+
</details>
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Usage
|
|
234
|
+
|
|
235
|
+
<details>
|
|
236
|
+
<summary><strong>Slash commands</strong></summary>
|
|
237
|
+
<br>
|
|
238
|
+
|
|
239
|
+
| Command | Description |
|
|
240
|
+
|---------|-------------|
|
|
241
|
+
| `/code-review-graph:build-graph` | Build or rebuild the code graph |
|
|
242
|
+
| `/code-review-graph:review-delta` | Review changes since last commit |
|
|
243
|
+
| `/code-review-graph:review-pr` | Full PR review with blast-radius analysis |
|
|
244
|
+
|
|
245
|
+
</details>
|
|
246
|
+
|
|
247
|
+
<details>
|
|
248
|
+
<summary><strong>CLI reference</strong></summary>
|
|
249
|
+
<br>
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
code-review-graph install # Auto-detect and configure all platforms
|
|
253
|
+
code-review-graph install --platform <name> # Target a specific platform
|
|
254
|
+
code-review-graph build # Parse entire codebase
|
|
255
|
+
code-review-graph update # Incremental update (changed files only)
|
|
256
|
+
code-review-graph status # Graph statistics
|
|
257
|
+
code-review-graph watch # Auto-update on file changes
|
|
258
|
+
code-review-graph visualize # Generate interactive HTML graph
|
|
259
|
+
code-review-graph wiki # Generate markdown wiki from communities
|
|
260
|
+
code-review-graph detect-changes # Risk-scored change impact analysis
|
|
261
|
+
code-review-graph register <path> # Register repo in multi-repo registry
|
|
262
|
+
code-review-graph unregister <id> # Remove repo from registry
|
|
263
|
+
code-review-graph repos # List registered repositories
|
|
264
|
+
code-review-graph eval # Run evaluation benchmarks
|
|
265
|
+
code-review-graph serve # Start MCP server
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
</details>
|
|
269
|
+
|
|
270
|
+
<details>
|
|
271
|
+
<summary><strong>MCP tools</strong></summary>
|
|
272
|
+
<br>
|
|
273
|
+
|
|
274
|
+
Claude uses these automatically once the graph is built.
|
|
275
|
+
|
|
276
|
+
| Tool | Description |
|
|
277
|
+
|------|-------------|
|
|
278
|
+
| `build_or_update_graph_tool` | Build or incrementally update the graph |
|
|
279
|
+
| `get_impact_radius_tool` | Blast radius of changed files |
|
|
280
|
+
| `get_review_context_tool` | Token-optimised review context with structural summary |
|
|
281
|
+
| `query_graph_tool` | Callers, callees, tests, imports, inheritance queries |
|
|
282
|
+
| `semantic_search_nodes_tool` | Search code entities by name or meaning |
|
|
283
|
+
| `embed_graph_tool` | Compute vector embeddings for semantic search |
|
|
284
|
+
| `list_graph_stats_tool` | Graph size and health |
|
|
285
|
+
| `get_docs_section_tool` | Retrieve documentation sections |
|
|
286
|
+
| `find_large_functions_tool` | Find functions/classes exceeding a line-count threshold |
|
|
287
|
+
| `list_flows_tool` | List execution flows sorted by criticality |
|
|
288
|
+
| `get_flow_tool` | Get details of a single execution flow |
|
|
289
|
+
| `get_affected_flows_tool` | Find flows affected by changed files |
|
|
290
|
+
| `list_communities_tool` | List detected code communities |
|
|
291
|
+
| `get_community_tool` | Get details of a single community |
|
|
292
|
+
| `get_architecture_overview_tool` | Architecture overview from community structure |
|
|
293
|
+
| `detect_changes_tool` | Risk-scored change impact analysis for code review |
|
|
294
|
+
| `refactor_tool` | Rename preview, dead code detection, suggestions |
|
|
295
|
+
| `apply_refactor_tool` | Apply a previously previewed refactoring |
|
|
296
|
+
| `generate_wiki_tool` | Generate markdown wiki from communities |
|
|
297
|
+
| `get_wiki_page_tool` | Retrieve a specific wiki page |
|
|
298
|
+
| `list_repos_tool` | List registered repositories |
|
|
299
|
+
| `cross_repo_search_tool` | Search across all registered repositories |
|
|
300
|
+
|
|
301
|
+
**MCP Prompts** (5 workflow templates):
|
|
302
|
+
`review_changes`, `architecture_map`, `debug_issue`, `onboard_developer`, `pre_merge_check`
|
|
303
|
+
|
|
304
|
+
</details>
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Features
|
|
309
|
+
|
|
310
|
+
| Feature | Details |
|
|
311
|
+
|---------|---------|
|
|
312
|
+
| **Incremental updates** | Re-parses only changed files. Subsequent updates complete in under 2 seconds. |
|
|
313
|
+
| **18 languages** | Python, TypeScript/TSX, JavaScript, Vue, Go, Rust, Java, Scala, C#, Ruby, Kotlin, Swift, PHP, Solidity, C/C++, Dart, R, Perl |
|
|
314
|
+
| **Blast-radius analysis** | Shows exactly which functions, classes, and files are affected by any change |
|
|
315
|
+
| **Auto-update hooks** | Graph updates on every file edit and git commit without manual intervention |
|
|
316
|
+
| **Semantic search** | Optional vector embeddings via sentence-transformers, Google Gemini, or MiniMax |
|
|
317
|
+
| **Interactive visualisation** | D3.js force-directed graph with edge-type toggles and search |
|
|
318
|
+
| **Local storage** | SQLite file in `.code-review-graph/`. No external database, no cloud dependency. |
|
|
319
|
+
| **Watch mode** | Continuous graph updates as you work |
|
|
320
|
+
| **Execution flows** | Trace call chains from entry points, sorted by criticality |
|
|
321
|
+
| **Community detection** | Cluster related code via Leiden algorithm or file grouping |
|
|
322
|
+
| **Architecture overview** | Auto-generated architecture map with coupling warnings |
|
|
323
|
+
| **Risk-scored reviews** | `detect_changes` maps diffs to affected functions, flows, and test gaps |
|
|
324
|
+
| **Refactoring tools** | Rename preview, dead code detection, community-driven suggestions |
|
|
325
|
+
| **Wiki generation** | Auto-generate markdown wiki from community structure |
|
|
326
|
+
| **Multi-repo registry** | Register multiple repos, search across all of them |
|
|
327
|
+
| **MCP prompts** | 5 workflow templates: review, architecture, debug, onboard, pre-merge |
|
|
328
|
+
| **Full-text search** | FTS5-powered hybrid search combining keyword and vector similarity |
|
|
329
|
+
|
|
330
|
+
<details>
|
|
331
|
+
<summary><strong>Configuration</strong></summary>
|
|
332
|
+
<br>
|
|
333
|
+
|
|
334
|
+
To exclude paths from indexing, create a `.code-review-graphignore` file in your repository root:
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
generated/**
|
|
338
|
+
*.generated.ts
|
|
339
|
+
vendor/**
|
|
340
|
+
node_modules/**
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Optional dependency groups:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
pip install code-review-graph[embeddings] # Local vector embeddings (sentence-transformers)
|
|
347
|
+
pip install code-review-graph[google-embeddings] # Google Gemini embeddings
|
|
348
|
+
pip install code-review-graph[communities] # Community detection (igraph)
|
|
349
|
+
pip install code-review-graph[eval] # Evaluation benchmarks (matplotlib)
|
|
350
|
+
pip install code-review-graph[wiki] # Wiki generation with LLM summaries (ollama)
|
|
351
|
+
pip install code-review-graph[all] # All optional dependencies
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
</details>
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Contributing
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
git clone https://github.com/tirth8205/code-review-graph.git
|
|
362
|
+
cd code-review-graph
|
|
363
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
364
|
+
pip install -e ".[dev]"
|
|
365
|
+
pytest
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
<details>
|
|
369
|
+
<summary><strong>Adding a new language</strong></summary>
|
|
370
|
+
<br>
|
|
371
|
+
|
|
372
|
+
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.
|
|
373
|
+
|
|
374
|
+
</details>
|
|
375
|
+
|
|
376
|
+
## Licence
|
|
377
|
+
|
|
378
|
+
MIT. See [LICENSE](LICENSE).
|
|
379
|
+
|
|
380
|
+
<p align="center">
|
|
381
|
+
<br>
|
|
382
|
+
<code>pip install code-review-graph && code-review-graph install</code><br>
|
|
383
|
+
<sub>Works with Claude Code, Cursor, Windsurf, Zed, Continue, and OpenCode</sub>
|
|
384
|
+
</p>
|