rustcodegraph 1.2.0 → 1.2.2

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.2.2] - 2026-07-09
6
+
7
+ ### Fixes
8
+
9
+ - Published a maintenance release with the latest packaging and release workflow updates.
10
+
11
+ ## [1.2.1] - 2026-07-08
12
+
13
+ ### Fixes
14
+
15
+ - Published a maintenance release with the latest packaging and release workflow updates.
5
16
 
6
17
  ## [1.2.0] - 2026-07-01
7
18
 
package/README.md CHANGED
@@ -4,44 +4,35 @@
4
4
 
5
5
  English · [简体中文](README.zh-CN.md)
6
6
 
7
- RustCodeGraph in this repository is based on CodeGraph and adapted for our current Rust-first CLI and MCP workflow. It keeps the original local-first code intelligence direction, while the documentation, packaging, and product description here reflect the current `rustcodegraph` project rather than the older CodeGraph branding.
7
+ Semantic code intelligence for Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini, Antigravity, and Kiro.
8
8
 
9
- ## 🎉 1.0 Released!
9
+ **Local-first · Rust native · MCP-ready**
10
10
 
11
- Already installed? Run `rustcodegraph upgrade` to update in place.
12
-
13
- ### Supercharge Claude Code, Cursor, Codex, OpenCode, Hermes Agent, Gemini, Antigravity, and Kiro with Semantic Code Intelligence
14
-
15
- **~16% cheaper · ~58% fewer tool calls · 100% local**
16
-
17
- ### [Documentation →](docs/user/README.md)
11
+ [Documentation](docs/user/README.md) · [Issues](https://github.com/hunzhiwange/rustcodegraph/issues)
18
12
 
19
13
  [![npm version](https://img.shields.io/npm/v/rustcodegraph.svg)](https://www.npmjs.com/package/rustcodegraph)
20
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
15
  [![Self-contained](https://img.shields.io/badge/Rust-native%20%C2%B7%20no%20Node%20runtime-brightgreen.svg)](https://github.com/hunzhiwange/rustcodegraph/releases)
22
16
 
23
- [![Windows](https://img.shields.io/badge/Windows-supported-blue.svg)](#supported-platforms)
24
- [![macOS](https://img.shields.io/badge/macOS-supported-blue.svg)](#supported-platforms)
25
- [![Linux](https://img.shields.io/badge/Linux-supported-blue.svg)](#supported-platforms)
17
+ </div>
26
18
 
27
- [![Claude Code](https://img.shields.io/badge/Claude_Code-supported-blueviolet.svg)](#supported-agents)
28
- [![Cursor](https://img.shields.io/badge/Cursor-supported-blueviolet.svg)](#supported-agents)
29
- [![Codex](https://img.shields.io/badge/Codex-supported-blueviolet.svg)](#supported-agents)
30
- [![opencode](https://img.shields.io/badge/opencode-supported-blueviolet.svg)](#supported-agents)
31
- [![Hermes Agent](https://img.shields.io/badge/Hermes_Agent-supported-blueviolet.svg)](#supported-agents)
32
- [![Gemini](https://img.shields.io/badge/Gemini-supported-blueviolet.svg)](#supported-agents)
33
- [![Antigravity](https://img.shields.io/badge/Antigravity-supported-blueviolet.svg)](#supported-agents)
34
- [![Kiro](https://img.shields.io/badge/Kiro-supported-blueviolet.svg)](#supported-agents)
19
+ ## What It Is
35
20
 
36
- <br>
21
+ RustCodeGraph indexes a project into a local `.rustcodegraph/` knowledge graph. It parses source with tree-sitter, stores symbols, files, calls, imports, framework routes, and cross-file relationships in SQLite, then exposes that graph to coding agents through MCP and a CLI.
37
22
 
38
- </div>
23
+ Instead of asking an agent to repeatedly grep and read files, RustCodeGraph lets it ask structural questions directly:
39
24
 
40
- ## Get Started
25
+ - Where is this symbol defined?
26
+ - Who calls this function?
27
+ - What does this code call?
28
+ - What might change if I edit this symbol?
29
+ - How does a request, callback, render path, or bridge flow across files?
41
30
 
42
- ### 1. Install the CLI
31
+ RustCodeGraph is the Rust port of the original TypeScript CodeGraph implementation, rebuilt around a native CLI, local SQLite index, and MCP workflow.
43
32
 
44
- **No Node.js required** — one command grabs the right build for your OS:
33
+ ## Quick Start
34
+
35
+ ### 1. Install
45
36
 
46
37
  ```bash
47
38
  # macOS / Linux
@@ -52,686 +43,132 @@ brew install hunzhiwange/tap/rustcodegraph
52
43
 
53
44
  # Windows (PowerShell)
54
45
  irm https://raw.githubusercontent.com/hunzhiwange/rustcodegraph/main/install.ps1 | iex
55
- ```
56
-
57
- <details>
58
- <summary><b>Already have Node? Use npm instead</b></summary>
59
46
 
60
- ```bash
47
+ # npm, if you already use Node.js
61
48
  npm i -g rustcodegraph
62
49
  ```
63
50
 
64
- <sub>The npm package downloads the matching Rust binary from GitHub Releases — nothing to compile, no TypeScript runtime to build. The installer puts `rustcodegraph` on your PATH but **doesn't change your current shell** — open a new terminal before the next step so the command resolves.</sub>
65
-
66
- <sub>**Upgrade any time** with `rustcodegraph upgrade` — it detects how you installed (bundle, npm, or npx) and updates in place. Add `--check` to see if an update is available, or `rustcodegraph upgrade <version>` to pin one.</sub>
67
-
68
- </details>
69
-
70
- ### 2. Wire up your agent(s)
51
+ Open a new terminal after installing so `rustcodegraph` is on your `PATH`.
71
52
 
72
- In a **new terminal**, run the installer to connect RustCodeGraph to the agents you use:
53
+ ### 2. Connect Your Agent
73
54
 
74
55
  ```bash
75
56
  rustcodegraph install
76
57
  ```
77
58
 
78
- <sub>Detects and auto-configures Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, and Kiro — wiring the RustCodeGraph MCP server into each. **This is the step that connects RustCodeGraph to your agent;** installing the CLI in step 1 does not do it on its own.</sub>
59
+ The installer auto-detects supported agents and writes the MCP configuration they need to launch RustCodeGraph.
79
60
 
80
- ### 3. Initialize each project
61
+ ### 3. Index a Project
81
62
 
82
63
  ```bash
83
64
  cd your-project
84
65
  rustcodegraph init -i
85
66
  ```
86
67
 
87
- <sub>`rustcodegraph init -i` creates the local `.rustcodegraph/` directory and builds the full graph in the same step. Use plain `rustcodegraph init` only when you want to create the database without indexing yet.</sub>
88
-
89
- <div align="center">
90
-
91
- ![1_C_VYnhpys0UHrOuOgpgoyw](https://github.com/user-attachments/assets/f168182f-4d9a-44e0-94d7-08d018cc8a3a)
92
-
93
- </div>
94
-
95
- ### 4. No more syncing!
96
-
97
- Auto-sync is enabled by default. RustCodeGraph watches the project and batches file changes into automatic graph updates while your agent edits code, or you add, modify, or delete files. During a batch window, CLI and MCP status call out the pending files so you know the graph is waiting for the next sync instead of silently drifting.
68
+ This creates `.rustcodegraph/`, builds the first index, and enables automatic sync while the MCP server is running.
98
69
 
99
- ### Uninstall
100
-
101
- Changed your mind? One command removes RustCodeGraph from every agent it configured:
70
+ ### 4. Uninstall
102
71
 
103
72
  ```bash
104
- rustcodegraph uninstall
73
+ rustcodegraph uninstall # remove agent configuration
74
+ rustcodegraph uninit # remove the current project's index
105
75
  ```
106
76
 
107
- <sub>Reverses the installer — strips RustCodeGraph's MCP server config, instructions, and permissions from each configured agent. Your project indexes (`.rustcodegraph/`) are left untouched; remove those per-project with `rustcodegraph uninit`. If you installed through npm and also want to remove the package, run this before uninstalling `rustcodegraph`; npm package removal does not edit agent configs. Use `--target` to remove from specific agents, or `--yes` to run non-interactively.</sub>
108
-
109
- ---
110
-
111
- ## Why RustCodeGraph?
112
-
113
- When Claude Code explores a codebase, it spawns **Explore agents** that scan files with grep, glob, and Read — consuming tokens on every tool call.
114
-
115
- **RustCodeGraph gives those agents a pre-indexed knowledge graph** — symbol relationships, call graphs, and code structure. Agents query the graph instantly instead of scanning files.
116
-
117
- ### Benchmark Results
118
-
119
- Tested across **7 real-world open-source codebases** spanning 7 languages, comparing an agent (Claude Code, headless) answering one architecture question **with** and **without** RustCodeGraph. Each cell is the savings at the **median of 4 runs per arm**. _Re-validated on Opus 4.8 (2026-06-02), on the current build (`rustcodegraph_explore` as the primary tool)._
120
-
121
- > **Average: 16% cheaper · 47% fewer tokens · 22% faster · 58% fewer tool calls**
122
-
123
- | Codebase | Language | Cost | Tokens | Time | Tool calls |
124
- |----------|----------|------|--------|------|------------|
125
- | **VS Code** | TypeScript · ~10k files | 18% cheaper | 64% fewer | 11% faster | 81% fewer |
126
- | **Excalidraw** | TypeScript · ~640 | even | 25% fewer | 27% faster | 40% fewer |
127
- | **Django** | Python · ~3k | 8% cheaper | 60% fewer | 13% faster | 77% fewer |
128
- | **Tokio** | Rust · ~790 | even | 38% fewer | 18% faster | 57% fewer |
129
- | **OkHttp** | Java · ~645 | 25% cheaper | 54% fewer | 31% faster | 50% fewer |
130
- | **Gin** | Go · ~110 | 19% cheaper | 23% fewer | 24% faster | 44% fewer |
131
- | **Alamofire** | Swift · ~110 | 40% cheaper | 64% fewer | 33% faster | 58% fewer |
132
-
133
- RustCodeGraph cuts **tokens, tool calls, and wall-clock time on every repo** — across small, medium, and large codebases — and answers them with **near-zero file reads**, while the no-RustCodeGraph agent spends its budget on grep/find/Read discovery. `rustcodegraph_explore` shows the answer in full — the mechanism plus the exact methods you asked about, even when they're buried in a multi-thousand-line file — while collapsing redundant interchangeable implementations to signatures, so the response is sized to the *answer* rather than the file count. **Cost stays flat-to-cheaper everywhere** — largest on the small repos (Alamofire, OkHttp), roughly break-even on the most response-heavy ones (Excalidraw, Tokio), where RustCodeGraph trades the no-RustCodeGraph agent's many small grep/read round-trips for a few large, cache-heavy tool responses.
134
-
135
- <details>
136
- <summary><strong>Per-repo breakdown — WITH vs WITHOUT (median of 4)</strong></summary>
137
-
138
- **VS Code** · ~10k files
139
- | Metric | WITH cg | WITHOUT cg | Δ |
140
- |---|---|---|---|
141
- | Time | 1m 59s | 2m 13s | 11% faster |
142
- | File Reads | 0 | 9 | −9 |
143
- | Grep/Bash | 0 | 11 | −11 |
144
- | Tool calls | 4 | 21 | 81% fewer |
145
- | Total tokens | 640k | 1.79M | 64% fewer |
146
- | Cost | $0.68 | $0.83 | 18% cheaper |
147
-
148
- **Excalidraw** · ~640 files
149
- | Metric | WITH cg | WITHOUT cg | Δ |
150
- |---|---|---|---|
151
- | Time | 1m 32s | 2m 6s | 27% faster |
152
- | File Reads | 0 | 7 | −7 |
153
- | Grep/Bash | 1 | 8 | −7 |
154
- | Tool calls | 9 | 15 | 40% fewer |
155
- | Total tokens | 1.27M | 1.69M | 25% fewer |
156
- | Cost | $0.78 | $0.78 | even |
157
-
158
- **Django** · ~3k files
159
- | Metric | WITH cg | WITHOUT cg | Δ |
160
- |---|---|---|---|
161
- | Time | 1m 43s | 1m 58s | 13% faster |
162
- | File Reads | 0 | 9 | −9 |
163
- | Grep/Bash | 0 | 5 | −5 |
164
- | Tool calls | 3 | 13 | 77% fewer |
165
- | Total tokens | 559k | 1.41M | 60% fewer |
166
- | Cost | $0.57 | $0.62 | 8% cheaper |
167
-
168
- **Tokio** · ~790 files
169
- | Metric | WITH cg | WITHOUT cg | Δ |
170
- |---|---|---|---|
171
- | Time | 1m 55s | 2m 20s | 18% faster |
172
- | File Reads | 0 | 8 | −8 |
173
- | Grep/Bash | 0 | 6 | −6 |
174
- | Tool calls | 6 | 14 | 57% fewer |
175
- | Total tokens | 1.08M | 1.73M | 38% fewer |
176
- | Cost | $0.82 | $0.82 | even |
177
-
178
- **OkHttp** · ~645 files
179
- | Metric | WITH cg | WITHOUT cg | Δ |
180
- |---|---|---|---|
181
- | Time | 1m 1s | 1m 29s | 31% faster |
182
- | File Reads | 0 | 4 | −4 |
183
- | Grep/Bash | 2 | 6 | −4 |
184
- | Tool calls | 5 | 10 | 50% fewer |
185
- | Total tokens | 502k | 1.10M | 54% fewer |
186
- | Cost | $0.41 | $0.55 | 25% cheaper |
187
-
188
- **Gin** · ~110 files
189
- | Metric | WITH cg | WITHOUT cg | Δ |
190
- |---|---|---|---|
191
- | Time | 1m 14s | 1m 37s | 24% faster |
192
- | File Reads | 1 | 6 | −5 |
193
- | Grep/Bash | 1 | 2 | −1 |
194
- | Tool calls | 5 | 9 | 44% fewer |
195
- | Total tokens | 651k | 847k | 23% fewer |
196
- | Cost | $0.46 | $0.57 | 19% cheaper |
197
-
198
- **Alamofire** · ~110 files
199
- | Metric | WITH cg | WITHOUT cg | Δ |
200
- |---|---|---|---|
201
- | Time | 1m 35s | 2m 21s | 33% faster |
202
- | File Reads | 0 | 9 | −9 |
203
- | Grep/Bash | 0 | 4 | −4 |
204
- | Tool calls | 5 | 12 | 58% fewer |
205
- | Total tokens | 766k | 2.10M | 64% fewer |
206
- | Cost | $0.57 | $0.95 | 40% cheaper |
207
-
208
- </details>
209
-
210
- <details>
211
- <summary><strong>Full benchmark details</strong></summary>
212
-
213
- **Methodology.** Each arm is `claude -p` (Claude Opus 4.8) run headlessly against the repo with `--strict-mcp-config`: **WITH** = RustCodeGraph's MCP server enabled, **WITHOUT** = an empty MCP config. Built-in Read/Grep/Bash stay available to both. Same question per repo, **4 runs per arm, median reported**. Cost = the run's `total_cost_usd`; Tokens = total tokens processed (input incl. cached + output); Time = wall-clock; Tool calls = every tool invocation, including those inside any sub-agents the model spawns. Repos cloned at `--depth 1` and indexed by the same RustCodeGraph build that served them. Re-validated 2026-06-02 on the current build. These numbers are lower than the prior Opus 4.7 validation — not a RustCodeGraph regression but a stronger native baseline: Opus 4.8 greps/reads efficiently on the main thread instead of fanning out into large Explore-subagent sweeps, so the no-RustCodeGraph arm is leaner than it used to be. Per-repo numbers move run-to-run with how hard the without-arm thrashes (the median-of-4 smooths it, but tails remain — e.g. Django's without-arm hit $2.71/14m one batch).
214
-
215
- **Queries:**
216
- | Codebase | Query |
217
- |----------|-------|
218
- | VS Code | "How does the extension host communicate with the main process?" |
219
- | Excalidraw | "How does Excalidraw render and update canvas elements?" |
220
- | Django | "How does Django's ORM build and execute a query from a QuerySet?" |
221
- | Tokio | "How does tokio schedule and run async tasks on its runtime?" |
222
- | OkHttp | "How does OkHttp process a request through its interceptor chain?" |
223
- | Gin | "How does gin route requests through its middleware chain?" |
224
- | Alamofire | "How does Alamofire build, send, and validate a request?" |
225
-
226
- **Why RustCodeGraph wins:** with the index available, the agent answers directly — usually one `rustcodegraph_explore` returns the relevant source — and stops, usually with zero file reads. Without it, the agent spends most of its budget on discovery (find/ls/grep) before reading the right code. RustCodeGraph only helps when queried *directly*, so its instructions steer agents to answer directly rather than delegate exploration to file-reading sub-agents — otherwise a sub-agent reads files regardless and RustCodeGraph becomes overhead.
227
-
228
- </details>
229
-
230
- ---
231
-
232
- ## Key Features
233
-
234
- | | |
235
- |---|---|
236
- | **Smart Context Building** | One tool call returns entry points, related symbols, and code snippets — no expensive exploration agents |
237
- | **Full-Text Search** | Find code by name instantly across your entire codebase, powered by FTS5 |
238
- | **Impact Analysis** | Trace callers, callees, and the full impact radius of any symbol before making changes |
239
- | **Batched Auto-Sync** | File watcher uses native OS events (FSEvents/inotify/ReadDirectoryChangesW) with debounced, memory-aware auto-sync — the graph catches up as you code and clearly reports pending batch windows |
240
- | **20+ Languages** | TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C, C++, Objective-C, Swift, Kotlin, Scala, Dart, Lua, Luau, R, Svelte, Vue, Astro, Liquid, Pascal/Delphi |
241
- | **Framework-aware Routes** | Recognizes web-framework routing files and links URL patterns to their handlers across 17 frameworks |
242
- | **Mixed iOS / React Native / Expo** | Closes cross-language flows that static parsing misses: Swift ↔ ObjC bridging, React Native legacy bridge + TurboModules + Fabric view components, native → JS event emitters, Expo Modules |
243
- | **100% Local** | No data leaves your machine. No API keys. No external services. SQLite database only |
244
-
245
- <details>
246
- <summary><strong>How auto-syncing works — and why you don't need to run <code>rustcodegraph sync</code> manually</strong></summary>
247
-
248
- When your agent (Claude Code, Cursor, Codex, opencode) launches `rustcodegraph serve --mcp`, three layers keep the index in step with your code — and make sure the agent never gets a silent wrong answer in the brief window between an edit and the next sync:
249
-
250
- 1. **File watcher with debounced auto-sync.** A native FSEvents / inotify / ReadDirectoryChangesW watcher captures every source-file create / modify / delete and triggers a re-index after a debounce window (default `2000ms`, tunable via `RUSTCODEGRAPH_WATCH_DEBOUNCE_MS`, clamped to `[100ms, 60s]`). Bursts of edits collapse into a single sync — but a continuous stream that never pauses (copying a large folder in) can't postpone the sync forever: a maximum wait (`RUSTCODEGRAPH_WATCH_MAX_DEBOUNCE_MS`, default a few debounce windows, clamped to `60s`) forces the index to catch up at a steady cadence while files are still streaming in. Under heavy bursts the watcher also protects itself from running the process out of memory: it skips a sync's heavy re-parsing when memory is near a ceiling (the change stays pending and syncs once memory frees up) and enforces a minimum interval between back-to-back syncs. Both are tunable via `RUSTCODEGRAPH_WATCH_MEMORY_LIMIT_MB` (default `1024`) and `RUSTCODEGRAPH_WATCH_MIN_SYNC_INTERVAL_MS` (defaults to the debounce window, clamped to `60s`). For AI write storms or large generated batches, set `RUSTCODEGRAPH_WATCH_DEBOUNCE_MS=60000`, `RUSTCODEGRAPH_WATCH_MAX_DEBOUNCE_MS=60000`, and `RUSTCODEGRAPH_WATCH_MIN_SYNC_INTERVAL_MS=60000` to merge changes into roughly one sync per minute while the storm continues.
251
-
252
- 2. **Per-file staleness banner.** During a debounce or batch window, MCP tool responses that would reference a still-pending file prepend a `⚠️` banner naming it and explaining that the graph entry is waiting for the next batch sync. Pending files NOT referenced by the response surface as a small footer instead. Either way, the agent gets an explicit signal without being nudged back into a raw Read/Grep loop.
253
-
254
- 3. **Connect-time catch-up.** When the MCP server (re)connects, RustCodeGraph runs a fast `(size, mtime)` + content-hash reconciliation against the working tree before answering the first query — so edits made while no MCP server was running (a `git pull` from the terminal, edits from another editor, a previous agent session that exited) get absorbed on the next session's first tool call.
255
-
256
- ```
257
- agent writes src/Widget.ts
258
- → watcher fires (<100ms)
259
- → debounce / batch window (default 2s, configurable up to 60s)
260
- → sync; Widget.ts is in the index
261
- → next agent query sees it
262
- ```
263
-
264
- **Verify any time** with `rustcodegraph_status` (via MCP) or `rustcodegraph status` (CLI). If anything is pending, you'll see a `### Pending sync:` section naming the files, their edit age, and the fact that they are waiting for the next batch sync.
265
-
266
- The handful of cases where manual `rustcodegraph sync` makes sense: the watcher is disabled (sandboxed environments, or `RUSTCODEGRAPH_NO_DAEMON=1`), you want an immediate refresh before a long configured batch window expires, or you're scripting against the index outside an agent session and want a pre-flight sync at the start of your script.
267
-
268
- → Full deep-dive in [Guides → Indexing a Project](docs/user/guides/indexing.md#stay-fresh-automatically).
269
-
270
- </details>
77
+ ## Core Features
271
78
 
272
- ---
273
-
274
- ## Framework-aware Routes
275
-
276
- RustCodeGraph detects web-framework routing files and emits `route` nodes linked by `references` edges to their handler classes or functions. Querying callers of a view/controller now surfaces the URL pattern that binds it.
277
-
278
- | Framework | Shapes recognized |
79
+ | Feature | Summary |
279
80
  |---|---|
280
- | **Django** | `path()`, `re_path()`, `url()`, `include()` in `urls.py` (CBV `.as_view()`, dotted paths) |
281
- | **Flask** | `@app.route('/path', methods=[...])`, blueprint routes |
282
- | **FastAPI** | `@app.get(...)`, `@router.post(...)`, all standard methods |
283
- | **Express** | `app.get(...)`, `router.post(...)` with middleware chains |
284
- | **NestJS** | `@Controller` + `@Get/@Post/...`, GraphQL `@Resolver` + `@Query/@Mutation`, `@MessagePattern`/`@EventPattern`, `@SubscribeMessage` |
285
- | **Laravel** | `Route::get()`, `Route::resource()`, `Controller@action`, tuple syntax |
286
- | **Drupal** | `*.routing.yml` routes (`_controller`, `_form`, entity handlers); `hook_*` implementations in `.module`/`.theme`/`.install`/`.inc` |
287
- | **Rails** | `get '/x', to: 'users#index'`, hash-rocket `=>` syntax |
288
- | **Spring** | `@GetMapping`, `@PostMapping`, `@RequestMapping` on methods |
289
- | **Play** | `GET`/`POST`/… verb routes in `conf/routes` → `Controller.method` actions (Scala + Java) |
290
- | **Gin / chi / gorilla / mux** | `r.GET(...)`, `router.HandleFunc(...)` |
291
- | **Axum / actix / Rocket** | `.route("/x", get(handler))` |
292
- | **ASP.NET** | `[HttpGet("/x")]` attributes on action methods |
293
- | **Vapor** | `app.get("x", use: handler)` |
294
- | **React Router** / **SvelteKit** | Route component nodes |
295
- | **Vue Router** / **Nuxt** | `pages/` file-based routes, `server/api/` endpoints, route middleware |
296
- | **Astro** | `src/pages/` file-based routes (`.astro` pages + `.ts` endpoints, `[param]`/`[...rest]` syntax) |
297
-
298
- ---
299
-
300
- ## Mixed iOS / React Native / Expo bridging
301
-
302
- Real iOS and React Native codebases live across multiple languages — a Swift caller invokes an Objective-C selector that's been auto-bridged, a JS file calls into a native module via the React Native bridge, a JSX component delegates to a native view manager. Static tree-sitter extraction stops at each language boundary. RustCodeGraph bridges them so `rustcodegraph_explore`, `rustcodegraph_callers`, `rustcodegraph_callees`, and `rustcodegraph_impact` connect end-to-end across the gap.
303
-
304
- | Boundary | JS / Swift side | Native side | How |
305
- |---|---|---|---|
306
- | **Swift → ObjC** | Swift `obj.foo(bar:)` | ObjC selector `-fooWithBar:` | `@objc` auto-bridging rules (including init/property/protocol forms) + Cocoa preposition prefixes (`With`/`For`/`By`/`In`/`On`/`At`/…) |
307
- | **ObjC → Swift** | ObjC `[obj fooWithBar:]` | Swift `@objc func foo(bar:)` | Reverse-bridge name candidates; verifies `@objc` exposure from source |
308
- | **React Native legacy bridge** | JS `NativeModules.X.fn(...)` | ObjC `RCT_EXPORT_METHOD` / `RCT_REMAP_METHOD` · Java/Kotlin `@ReactMethod` | Parses macro/annotation declarations to build a JS-name → native-method map |
309
- | **React Native TurboModules** | JS `import M from './NativeM'; M.fn(...)` | Native impl matching the Codegen spec | Treats the `Native<X>.ts` spec interface as ground truth |
310
- | **RN native → JS events** | JS `new NativeEventEmitter(...).addListener('e', cb)` | ObjC `[self sendEventWithName:@"e" body:...]` · Swift `sendEvent(withName: "e", ...)` · Java/Kotlin `.emit("e", ...)` | Synthesized cross-language event channel keyed by literal event name |
311
- | **Expo Modules** | JS `requireNativeModule('X').fn(...)` | Swift / Kotlin `Module { Name("X"); AsyncFunction("fn") { ... } }` | Parses the Expo DSL literals; synthetic method nodes resolve via existing name-match |
312
- | **Fabric view components** | JSX `<MyView prop={v}/>` | TS Codegen spec + native impl class | Spec → `component` node; convention-based name+suffix lookup (`View`/`ComponentView`/`Manager`/`ViewManager`) bridges to native |
313
- | **Legacy Paper view managers** | JSX `<MyView prop={v}/>` | ObjC `RCT_EXPORT_VIEW_PROPERTY` · Java/Kotlin `@ReactProp` | Same as Fabric — Paper-era declarations also produce `component` + `property` nodes |
314
-
315
- **Validated on real codebases** (small + medium + large for each bridge):
316
-
317
- | Bridge | Small | Medium | Large |
318
- |---|---|---|---|
319
- | Swift ↔ ObjC | [Charts](https://github.com/danielgindi/Charts) | [realm-swift](https://github.com/realm/realm-swift) | [Wikipedia-iOS](https://github.com/wikimedia/wikipedia-ios) |
320
- | RN legacy bridge | [AsyncStorage](https://github.com/react-native-async-storage/async-storage) | [react-native-svg](https://github.com/software-mansion/react-native-svg) | [react-native-firebase](https://github.com/invertase/react-native-firebase) |
321
- | RN native → JS events | [RNGeolocation](https://github.com/Agontuk/react-native-geolocation-service) | — | react-native-firebase |
322
- | Expo Modules | expo-haptics | expo-camera | expo SDK sweep (7 packages) |
323
- | Fabric / Paper views | [react-native-segmented-control](https://github.com/react-native-segmented-control/segmented-control) | [react-native-screens](https://github.com/software-mansion/react-native-screens) | [react-native-skia](https://github.com/Shopify/react-native-skia) |
324
-
325
- Each bridge emits edges tagged `provenance:'heuristic'` with `metadata.synthesizedBy:` set to a stable channel name (e.g. `swift-objc-bridge`, `rn-event-channel`, `fabric-native-impl`, `expo-module-extract`), so the agent can tell at a glance how a hop got into the graph.
326
-
327
- ---
328
-
329
- ## Quick Start
330
-
331
- ### 1. Run the Installer
332
-
333
- ```bash
334
- rustcodegraph install
335
- ```
336
-
337
- The installer will:
338
- - Ask which agent(s) to configure — auto-detects installed ones from: **Claude Code**, **Cursor**, **Codex CLI**, **opencode**, **Hermes Agent**, **Gemini CLI**, **Antigravity IDE**, **Kiro**
339
- - Prompt to install `rustcodegraph` on your PATH (so agents can launch the MCP server)
340
- - Ask whether configs apply to all your projects or just this one
341
- - Write each chosen agent's MCP server config, plus the small RustCodeGraph guidance block used by that agent target when needed. Removed cleanly by `rustcodegraph uninstall`.
342
- - Set up auto-allow permissions when Claude Code is one of the targets
343
- - Initialize your current project (local installs only)
344
-
345
- **Non-interactive (scripting / CI):**
346
-
347
- ```bash
348
- rustcodegraph install --yes # auto-detect agents, install global
349
- rustcodegraph install --target=cursor,claude --yes # explicit target list
350
- rustcodegraph install --target=auto --location=local # detected agents, project-local
351
- rustcodegraph install --print-config codex # print snippet, no file writes
352
- ```
353
-
354
- | Flag | Values | Default |
355
- |---|---|---|
356
- | `--target` | `auto`, `all`, `none`, or csv (`claude,cursor,...`) | prompt |
357
- | `--location` | `global`, `local` | prompt |
358
- | `--yes` | (boolean) | prompt every step |
359
- | `--no-permissions` | (boolean) skip Claude auto-allow list | permissions on |
360
- | `--print-config <id>` | dump snippet for one agent and exit | — |
361
-
362
- ### 2. Restart Your Agent
81
+ | Local knowledge graph | Stores code structure in project-local SQLite; no external indexing service required. |
82
+ | Agent-first context | `rustcodegraph_explore` returns relevant source, relationships, and flow paths in one response. |
83
+ | Search and navigation | Find symbols, callers, callees, and impact radius from CLI or MCP. |
84
+ | Auto-sync | Native file watchers keep the graph fresh after edits. |
85
+ | Framework awareness | Links routes, components, framework conventions, and bridge boundaries to the code that handles them. See [Supported Frameworks and Bridges](#supported-frameworks-and-bridges). |
86
+ | Cross-language bridges | Connects common Swift/Objective-C, React Native, Expo Modules, and native-view flows that plain static parsing usually misses. |
87
+ | Privacy-first | Code, paths, filenames, symbol names, and queries stay on your machine. |
363
88
 
364
- Restart your agent (Claude Code / Cursor / Codex CLI / opencode / Hermes Agent / Gemini CLI / Antigravity IDE / Kiro) for the MCP server to load.
89
+ ## CLI
365
90
 
366
- ### 3. Initialize Projects
367
-
368
- ```bash
369
- cd your-project
370
- rustcodegraph init -i
371
- ```
372
-
373
- Builds the per-project knowledge graph index, which then auto-syncs on every file change. A single global `rustcodegraph install` works in every project you open — no need to re-run the installer per project.
374
-
375
- That's it — your agent will use RustCodeGraph tools automatically when a `.rustcodegraph/` directory exists.
376
-
377
- <details>
378
- <summary><strong>Manual Setup (Alternative)</strong></summary>
379
-
380
- **Install globally:**
381
91
  ```bash
382
- # macOS / Linux
383
- curl -fsSL https://raw.githubusercontent.com/hunzhiwange/rustcodegraph/main/install.sh | sh
384
-
385
- # Homebrew (macOS / Linux)
386
- brew install hunzhiwange/tap/rustcodegraph
387
-
388
- # Or use npm.
389
- npm install -g rustcodegraph
390
- ```
391
-
392
- **Add to `~/.claude.json`:**
393
- ```json
394
- {
395
- "mcpServers": {
396
- "rustcodegraph": {
397
- "type": "stdio",
398
- "command": "rustcodegraph",
399
- "args": ["serve", "--mcp"]
400
- }
401
- }
402
- }
92
+ rustcodegraph install # configure supported agents
93
+ rustcodegraph uninstall # remove RustCodeGraph from agent configs
94
+ rustcodegraph init -i # initialize and index the current project
95
+ rustcodegraph uninit # remove the current project's index
96
+ rustcodegraph index # rebuild the full index
97
+ rustcodegraph sync # run an incremental update
98
+ rustcodegraph status # show index status
99
+ rustcodegraph query UserService # search symbols
100
+ rustcodegraph explore "auth login" # return related source and flow paths
101
+ rustcodegraph node UserService # show one symbol or file
102
+ rustcodegraph callers login # show call sites
103
+ rustcodegraph callees login # show outgoing calls
104
+ rustcodegraph impact login # show affected code
105
+ rustcodegraph affected --stdin # map changed files to affected tests
106
+ rustcodegraph upgrade # update the installed binary
403
107
  ```
404
108
 
405
- **Add to `~/.claude/settings.json` (optional, for auto-allow):**
406
- ```json
407
- {
408
- "permissions": {
409
- "allow": [
410
- "mcp__rustcodegraph__rustcodegraph_search",
411
- "mcp__rustcodegraph__rustcodegraph_explore",
412
- "mcp__rustcodegraph__rustcodegraph_callers",
413
- "mcp__rustcodegraph__rustcodegraph_callees",
414
- "mcp__rustcodegraph__rustcodegraph_impact",
415
- "mcp__rustcodegraph__rustcodegraph_node",
416
- "mcp__rustcodegraph__rustcodegraph_status",
417
- "mcp__rustcodegraph__rustcodegraph_files"
418
- ]
419
- }
420
- }
421
- ```
422
-
423
- </details>
424
-
425
- <details>
426
- <summary><strong>Agent Tool Guidance</strong></summary>
427
-
428
- RustCodeGraph's MCP server delivers its usage guidance to your agent **automatically**, in the MCP `initialize` response. In short, it tells the agent to:
429
-
430
- - **Answer structural questions directly with RustCodeGraph** — it *is* the pre-built index, so a grep/read loop just repeats work it already did. Treat the returned source as already read.
431
- - **Pick the tool by intent:** `rustcodegraph_explore` for almost anything — "how does X work", a flow/"how does X reach Y", or surveying an area (one call returns the relevant symbols' source grouped by file); `rustcodegraph_search` to just locate a symbol; `rustcodegraph_callers` for every call site (including callback registrations); `rustcodegraph_node` for one symbol's full source + callers, or to read a file like the Read tool.
432
- - **Trust the results — don't re-verify with grep**, and check the staleness banner after edits.
433
- - In a workspace with no index, RustCodeGraph announces itself inactive and serves no tools — indexing stays your decision.
434
-
435
- The exact text is `src/mcp/server_instructions.rs` — the single source of truth for the main agent. Because subagents and non-MCP harnesses never see the MCP guidance, the installer also writes a short marker-fenced section into the agent's instructions file pointing at the `rustcodegraph explore` / `rustcodegraph node` CLI equivalents.
436
-
437
- </details>
438
-
439
- ---
440
-
441
- ## How It Works
442
-
443
- ```
444
- ┌───────────────────────────────────────────────────────────────────┐
445
- │ Claude Code │
446
- │ │
447
- │ "How does a request reach the database?" │
448
- │ calls RustCodeGraph tools directly — no Explore sub-agent │
449
- │ │ │
450
- └─────────────────────────────────┬─────────────────────────────────┘
451
-
452
-
453
- ┌───────────────────────────────────────────────────────────────────┐
454
- │ RustCodeGraph MCP Server │
455
- │ │
456
- │ explore · search · callers · callees · impact · node │
457
- │ │ │
458
- │ ▼ │
459
- │ SQLite knowledge graph │
460
- │ symbols · edges · files · FTS5 full-text search │
461
- └───────────────────────────────────────────────────────────────────┘
462
- ```
463
-
464
- 1. **Extraction** — [tree-sitter](https://tree-sitter.github.io/) parses source code into ASTs. Language-specific queries extract nodes (functions, classes, methods) and edges (calls, imports, extends, implements).
465
-
466
- 2. **Storage** — Everything goes into a local SQLite database (`.rustcodegraph/rustcodegraph.db`) with FTS5 full-text search.
467
-
468
- 3. **Resolution** — After extraction, references are resolved: function calls → definitions, imports → source files, class inheritance, and framework-specific patterns.
469
-
470
- 4. **Auto-Sync** — The MCP server watches your project using native OS file events. Changes are debounced, filtered to source files only, and synced in memory-aware batches; pending files are reported while the watcher waits for the next batch sync.
471
-
472
- ---
473
-
474
- ## CLI Reference
475
-
476
- ```bash
477
- rustcodegraph # Run interactive installer
478
- rustcodegraph install # Run installer (explicit)
479
- rustcodegraph uninstall # Remove RustCodeGraph from your agents (inverse of install)
480
- rustcodegraph init [path] # Initialize only; add -i/--index to build the graph too
481
- rustcodegraph uninit [path] # Remove RustCodeGraph from a project (--force to skip prompt)
482
- rustcodegraph index [path] # Full index (--force to re-index, --quiet for less output)
483
- rustcodegraph sync [path] # Incremental update
484
- rustcodegraph status [path] # Show statistics
485
- rustcodegraph unlock [path] # Remove a stale lock file that's blocking indexing
486
- rustcodegraph query <search> # Search symbols (--kind, --limit, --json)
487
- rustcodegraph explore <query> # Relevant symbols' source + call paths in one shot (same output as the rustcodegraph_explore MCP tool)
488
- rustcodegraph node <symbol|file> # One symbol's source + callers, or read a file with line numbers (same output as rustcodegraph_node)
489
- rustcodegraph files [path] # Show file structure (--format, --filter, --max-depth, --json)
490
- rustcodegraph callers <symbol> # Find what calls a function/method (--limit, --json)
491
- rustcodegraph callees <symbol> # Find what a function/method calls (--limit, --json)
492
- rustcodegraph impact <symbol> # Analyze what code is affected by changing a symbol (--depth, --json)
493
- rustcodegraph affected [files...] # Find test files affected by changes (see below)
494
- rustcodegraph daemon # Manage background daemons — pick one to stop (alias: daemons)
495
- rustcodegraph telemetry [on|off] # Show or change anonymous usage telemetry
496
- rustcodegraph upgrade [version] # Update to the latest release (--check, --force)
497
- rustcodegraph version # Print the installed version (also -v, --version)
498
- rustcodegraph help [command] # Show help, optionally for one command
499
- ```
500
-
501
- ### `rustcodegraph affected`
502
-
503
- Traces import dependencies transitively to find which test files are affected by changed source files.
504
-
505
- ```bash
506
- rustcodegraph affected src/utils.ts src/api.ts # Pass files as arguments
507
- git diff --name-only | rustcodegraph affected --stdin # Pipe from git diff
508
- rustcodegraph affected src/auth.ts --filter "e2e/*" # Custom test file pattern
509
- ```
510
-
511
- | Option | Description | Default |
512
- |--------|-------------|---------|
513
- | `--stdin` | Read file list from stdin | `false` |
514
- | `-d, --depth <n>` | Max dependency traversal depth | `5` |
515
- | `-f, --filter <glob>` | Custom glob to identify test files | auto-detect |
516
- | `-j, --json` | Output as JSON | `false` |
517
- | `-q, --quiet` | Output file paths only | `false` |
518
-
519
- **CI/hook example:**
520
-
521
- ```bash
522
- #!/usr/bin/env bash
523
- AFFECTED=$(git diff --name-only HEAD | rustcodegraph affected --stdin --quiet)
524
- if [ -n "$AFFECTED" ]; then
525
- npx vitest run $AFFECTED
526
- fi
527
- ```
528
-
529
- ---
530
-
531
109
  ## MCP Tools
532
110
 
533
- When running as an MCP server, RustCodeGraph exposes a focused set of four tools measured agent behavior showed a leaner list steers agents to the right tool and saves context every session:
111
+ RustCodeGraph exposes a small MCP tool set optimized for coding agents:
534
112
 
535
113
  | Tool | Purpose |
536
- |------|---------|
537
- | `rustcodegraph_explore` | **Primary.** Answer almost any question in one call — "how does X work", a flow ("how does X reach Y"), or surveying an area — returning the relevant symbols' verbatim source grouped by file, plus a relationship map and blast radius. Surfaces dynamic-dispatch hops (callbacks, React re-render, interface→impl) grep can't follow. |
538
- | `rustcodegraph_node` | One symbol's full source + caller/callee trail (every overload for an ambiguous name) — or pass a file path to **read a whole file like the Read tool** (same line-numbered output, `offset`/`limit`), with its dependents attached. |
539
- | `rustcodegraph_search` | Find symbols by name across the codebase |
540
- | `rustcodegraph_callers` | Every call site of a function — including where it's registered as a callback with one section per definition when several share a name |
541
-
542
- Four more tools (`rustcodegraph_callees`, `rustcodegraph_impact`, `rustcodegraph_files`, `rustcodegraph_status`) stay fully functional but unlisted by default — measured across eval runs, agents never or rarely picked them, and their information already arrives inline on the four above (explore's blast-radius section, node's dependents note, a symbol's body as its callee list). Re-enable any of them with the `RUSTCODEGRAPH_MCP_TOOLS` environment variable (e.g. `RUSTCODEGRAPH_MCP_TOOLS=explore,node,search,callers,impact`), or use their CLI equivalents (`rustcodegraph callees` / `impact` / `files` / `status`).
543
-
544
- In a workspace with no `.rustcodegraph/` index, the server announces itself inactive and lists **no** tools — agents work normally with their built-in tools, and indexing stays your decision.
545
-
546
- ---
547
-
548
- ## Library Usage
549
-
550
- The production runtime is Rust. Rust callers can embed RustCodeGraph directly from
551
- the crate. npm packages are CLI distribution packages only; they do not expose
552
- `require()` or `import` entrypoints.
553
-
554
- ```rust
555
- use rustcodegraph::{RustCodeGraph, IndexOptions};
556
-
557
- let mut cg = RustCodeGraph::init_sync("/path/to/project")?;
558
- cg.index_all(IndexOptions::default())?;
559
-
560
- let results = cg.search_nodes("UserService", None);
561
- let callers = cg.get_callers(&results[0].node.id);
562
-
563
- cg.close();
564
- ```
565
-
566
- Node.js integrations should shell out to `rustcodegraph` when they need the CLI;
567
- there is no published JavaScript SDK surface.
568
-
569
- ---
570
-
571
- ## Configuration
572
-
573
- There isn't any — RustCodeGraph is zero-config, with **no config file** to write or
574
- keep in sync. Language support is automatic from the file extension; there's
575
- nothing to wire up per language.
576
-
577
- What it skips out of the box:
578
-
579
- - **Dependency, build, and cache directories** — `node_modules`, `vendor`,
580
- `dist`, `build`, `target`, `.venv`, `Pods`, `.next`, and the like across every
581
- [supported stack](#supported-languages) — so the graph is your code, not
582
- third-party noise. This holds even with no `.gitignore`.
583
- - **Anything in your `.gitignore`** — honored in git repos via git, and in
584
- non-git projects by reading `.gitignore` directly (root and nested).
585
- - **Files larger than 1 MB** — generated bundles, minified JS, vendored blobs.
586
-
587
- To keep something else out, add it to `.gitignore`. To pull a default-excluded
588
- directory back **in** (say you really do want a vendored dependency indexed),
589
- add a negation — `!vendor/`. The defaults apply uniformly, so committing a
590
- dependency or build directory doesn't force it into the graph; the `.gitignore`
591
- negation is the explicit opt-in.
114
+ |---|---|
115
+ | `rustcodegraph_explore` | Primary tool for "how does X work?" and "how does X reach Y?" questions. |
116
+ | `rustcodegraph_node` | Full source for one symbol, overload set, or file, with caller/callee context. |
117
+ | `rustcodegraph_search` | Symbol search by name. |
118
+ | `rustcodegraph_callers` | All known call sites, including callback registrations. |
592
119
 
593
- ## Telemetry
120
+ If a workspace has no `.rustcodegraph/` index, the MCP server reports itself inactive and hides its tools. Indexing always remains a user choice.
594
121
 
595
- RustCodeGraph collects **anonymous usage statistics** — which tools and commands get
596
- used, which languages get indexed — to guide where language and agent support
597
- work goes. **Never** any code, paths, file or symbol names, queries, or IP
598
- addresses; usage is aggregated locally into daily totals before anything is
599
- sent, and the ingest endpoint is [public code in this repo](telemetry-worker/)
600
- that enforces the documented field list. The installer asks up front; turn it
601
- off any time:
122
+ ## Supported Agents
602
123
 
603
- ```bash
604
- rustcodegraph telemetry off # or: RUSTCODEGRAPH_TELEMETRY=0, or DO_NOT_TRACK=1
605
- ```
124
+ `rustcodegraph install` can configure:
606
125
 
607
- [`TELEMETRY.md`](TELEMETRY.md) lists every field, with the off-switches and the
608
- full data-handling story.
126
+ - Claude Code
127
+ - Cursor
128
+ - Codex CLI
129
+ - opencode
130
+ - Hermes Agent
131
+ - Gemini CLI
132
+ - Antigravity IDE
133
+ - Kiro
609
134
 
610
- ## Supported Platforms
135
+ ## Supported Languages
611
136
 
612
- Every release ships a self-contained native Rust build nothing to compile and
613
- no Node.js runtime required for the standalone installers — for all three
614
- desktop OSes, on both Intel/AMD (x64) and ARM (arm64):
137
+ **Source languages:** TypeScript/TSX, JavaScript/JSX, Python, Go, Rust, Java, C, C++, C#, PHP, Ruby, Swift, Kotlin, Dart, Pascal/Delphi, Scala, Lua, Luau, Objective-C, and R.
615
138
 
616
- | Platform | Architectures | Install |
617
- |----------|---------------|---------|
618
- | Windows | x64, arm64 | PowerShell installer or npm |
619
- | macOS | x64, arm64 | shell installer, Homebrew, or npm |
620
- | Linux | x64, arm64 | shell installer, Homebrew, or npm |
139
+ **Component, template, and config formats:** Razor/Blazor, Svelte, Vue, Astro, Liquid, YAML, Twig, XML, and Java `.properties`.
621
140
 
622
- See [Get Started](#get-started) for the one-line install commands.
141
+ Language support is selected automatically from file extensions. RustCodeGraph skips common dependency, build, and cache directories, honors `.gitignore`, and ignores files larger than 1 MB by default.
623
142
 
624
- ## Supported Agents
143
+ ## Supported Frameworks and Bridges
625
144
 
626
- The interactive installer auto-detects and configures each of these wiring up
627
- the MCP server and a short instruction marker for subagents/non-MCP harnesses:
145
+ **Backend and web routes:** Django, Flask, FastAPI, Express, NestJS, Laravel, Drupal, Rails, Spring, Play Framework, Gin, chi, gorilla/mux, Axum, actix, Rocket, ASP.NET, and Vapor.
628
146
 
629
- - **Claude Code**
630
- - **Cursor**
631
- - **Codex CLI**
632
- - **opencode**
633
- - **Hermes Agent**
634
- - **Gemini CLI**
635
- - **Antigravity IDE**
636
- - **Kiro**
147
+ **Frontend routes and components:** React, React Router, Next.js, Svelte/SvelteKit, Vue/Vue Router/Nuxt, and Astro.
637
148
 
638
- ## Supported Languages
149
+ **Native, mobile, and cross-language flows:** SwiftUI, UIKit, Swift/Objective-C bridging, React Native legacy bridge, React Native TurboModules, React Native native events, Expo Modules, and Fabric/Paper native views.
639
150
 
640
- | Language | Extension | Status |
641
- |----------|-----------|--------|
642
- | TypeScript | `.ts`, `.tsx` | Full support |
643
- | JavaScript | `.js`, `.jsx`, `.mjs` | Full support |
644
- | Python | `.py` | Full support |
645
- | Go | `.go` | Full support |
646
- | Rust | `.rs` | Full support |
647
- | Java | `.java` | Full support |
648
- | C# | `.cs` | Full support |
649
- | PHP | `.php` | Full support |
650
- | Ruby | `.rb` | Full support |
651
- | C | `.c`, `.h` | Full support |
652
- | C++ | `.cpp`, `.hpp`, `.cc` | Full support |
653
- | Objective-C | `.m`, `.mm`, `.h` | Partial support (classes, protocols, methods, `@property`, `#import`, message sends; `.mm` ObjC++ may parse incompletely) |
654
- | Swift | `.swift` | Full support |
655
- | Kotlin | `.kt`, `.kts` | Full support |
656
- | Scala | `.scala`, `.sc` | Full support (classes, traits, methods, type aliases, Scala 3 enums) |
657
- | Dart | `.dart` | Full support |
658
- | Svelte | `.svelte` | Full support (script extraction, Svelte 5 runes, SvelteKit routes) |
659
- | Vue | `.vue` | Full support (script + script-setup extraction, Nuxt page/API/middleware routes) |
660
- | Astro | `.astro` | Full support (frontmatter + script extraction, template component/call references, `src/pages/` routes) |
661
- | Liquid | `.liquid` | Full support |
662
- | Pascal / Delphi | `.pas`, `.dpr`, `.dpk`, `.lpr` | Full support (classes, records, interfaces, enums, DFM/FMX form files) |
663
- | Lua | `.lua` | Full support (functions, methods with receivers, local variables, `require` imports, call edges) |
664
- | R | `.R` `.r` | Full support (functions in every assignment form, S4/R5/R6 classes with methods, `library`/`require` imports, `source()` file references, call edges) |
665
- | Luau | `.luau` | Full support (everything in Lua, plus `type`/`export type` aliases, typed signatures, and Roblox instance-path `require`) |
666
-
667
- ## Measured cross-file coverage
668
-
669
- Impact and blast-radius queries are only as good as the dependency graph behind them, so coverage is measured rather than asserted. **Fair coverage** = the share of symbol-bearing source files that have at least one *resolved cross-file dependent* — something that imports, calls, references, or (through a framework convention) routes to them — on a real-world benchmark repo per language. The residual is always a genuine static-analysis frontier (runtime dynamic dispatch, reflection / DI containers, framework-convention entry points, vendored third-party code), never hidden by gaming the denominator.
670
-
671
- | Language | Benchmark repo | Coverage |
672
- |---|---|---|
673
- | TypeScript / JavaScript | this repo | 95.8% |
674
- | Python | psf/requests | 100% |
675
- | Go | gin-gonic/gin | 96.6% |
676
- | Rust | BurntSushi/ripgrep | 86.7% |
677
- | Java | google/gson | 93.3% |
678
- | C# | jbogard/MediatR | 85.2% |
679
- | PHP | guzzle/guzzle | 100% |
680
- | Ruby | sidekiq/sidekiq | 100% |
681
- | C | redis/redis | 92.2% |
682
- | C++ | google/leveldb | 94.8% |
683
- | Objective-C | SDWebImage | 91.6% |
684
- | Swift | Alamofire | 95.3% |
685
- | Kotlin | square/okhttp | 96.2% |
686
- | Scala | gatling/gatling | 91.2% |
687
- | Dart | flutter/packages | 92.4% |
688
- | Svelte / SvelteKit | sveltejs/realworld | 100% |
689
- | Vue / Nuxt | nuxt/movies | 93.5% |
690
- | Astro | xingwangzhe/stalux | 93.0% |
691
- | Lua | nvim-telescope/telescope.nvim | 84.2% |
692
- | Luau | dphfox/Fusion | 92.2% |
693
- | Liquid | Shopify/dawn | 73.8% |
694
- | Pascal / Delphi | PascalCoin | 77.4% |
695
-
696
- Framework routing is validated the same way, on a canonical app per framework: Express 100%, FastAPI 98%, Flask 100%, NestJS 96.8%, Gin 96.5%, Axum 100%, Rocket 93.8%, Vapor 100%, Laravel 92%, Rails 89.6%, React Router 100% — and the convention/reflection-heavy ones at their honest static-analysis ceiling: ASP.NET 83.9%, Spring 83.3%, Drupal 78.9%, Play 76.3%, Django 74.1%. SvelteKit, Vue/Nuxt, and Astro use file-based routing, so their page/endpoint coverage is the Svelte/SvelteKit (100%), Vue/Nuxt (93.5%), and Astro (93.0% — every `src/pages/` file maps to a route node on the two validation repos) figures in the table above.
151
+ **Workspace conventions:** Cargo workspaces, TypeScript path aliases, SvelteKit `$lib`, and Nuxt/Vue auto imports.
697
152
 
698
153
  ## Troubleshooting
699
154
 
700
- **"RustCodeGraph not initialized"** — Run `rustcodegraph init -i` in your project directory first.
701
-
702
- **Indexing is slow** — Check that `node_modules` and other large directories are excluded. Use `--quiet` to reduce output overhead.
703
-
704
- **MCP hits `database is locked`** — current builds shouldn't: the Rust runtime uses SQLite in WAL mode, where concurrent reads normally do not block on a writer. If you still see it:
155
+ **`RustCodeGraph not initialized`**
156
+ Run `rustcodegraph init -i` in the project directory.
705
157
 
706
- - **You're still running the old CodeGraph package or binary.** RustCodeGraph is a separate project and does not upgrade CodeGraph in place. Install RustCodeGraph separately — `curl -fsSL https://raw.githubusercontent.com/hunzhiwange/rustcodegraph/main/install.sh | sh` (macOS/Linux), `irm https://raw.githubusercontent.com/hunzhiwange/rustcodegraph/main/install.ps1 | iex` (Windows), or `npm i -g rustcodegraph` — then make sure your MCP config points at `rustcodegraph`.
707
- - **`rustcodegraph status` shows `Journal:` other than `wal`** WAL couldn't be enabled on this filesystem (common on network shares and WSL2 `/mnt`), so reads can block on writes. Move the project (with its `.rustcodegraph/` folder) onto a local disk.
158
+ **Indexing is slow**
159
+ Make sure large generated or dependency directories are ignored by `.gitignore`.
708
160
 
709
- **MCP server not connecting** — Your agent starts the server itself, so you don't launch it by hand. Make sure the project is initialized and indexed (`rustcodegraph status`) and that the path in your MCP config is correct. If it still won't connect, re-run `rustcodegraph install` to rewrite the config.
161
+ **MCP server does not connect**
162
+ Agents start the server themselves. Check `rustcodegraph status`, then re-run `rustcodegraph install` if the agent configuration looks stale.
710
163
 
711
- **Missing symbols** — The MCP server auto-syncs on save (wait a couple seconds). Run `rustcodegraph sync` manually if needed. Check that the file's language is supported and isn't inside a `.gitignore`d or default-excluded directory (e.g. `node_modules`, `dist`).
164
+ **Migrating from the TypeScript CodeGraph version**
165
+ Install `rustcodegraph` and make sure your MCP configuration points at the Rust binary. Existing TypeScript-era CodeGraph configuration is not reused automatically.
712
166
 
713
- **Sharing one checkout between Windows and WSL** — Don't point both at the same `.rustcodegraph/`: the background-server lock and the SQLite index are tied to the OS that wrote them, and SQLite locking across the WSL2/Windows filesystem boundary is unreliable. Give each side its own index in the same tree by setting `RUSTCODEGRAPH_DIR` to a distinct name on one of them — e.g. `RUSTCODEGRAPH_DIR=.rustcodegraph-win` on Windows, leaving WSL on the default `.rustcodegraph`. RustCodeGraph skips any sibling `.rustcodegraph-*` directory when indexing and watching, so the two never trip over each other.
167
+ ## More
714
168
 
715
- ## Star History
716
-
717
- <a href="https://www.star-history.com/?repos=hunzhiwange%2Frustcodegraph&type=date&legend=top-left">
718
- <picture>
719
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=hunzhiwange/rustcodegraph&type=date&theme=dark&legend=top-left" />
720
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=hunzhiwange/rustcodegraph&type=date&legend=top-left" />
721
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=hunzhiwange/rustcodegraph&type=date&legend=top-left" />
722
- </picture>
723
- </a>
169
+ - [User documentation](docs/user/README.md)
170
+ - [Changelog](CHANGELOG.md)
724
171
 
725
172
  ## License
726
173
 
727
174
  MIT
728
-
729
- ---
730
-
731
- <div align="center">
732
-
733
- **Made for AI coding agents — Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, and Kiro**
734
-
735
- [Report Bug](https://github.com/hunzhiwange/rustcodegraph/issues) · [Request Feature](https://github.com/hunzhiwange/rustcodegraph/issues)
736
-
737
- </div>
@@ -23,7 +23,7 @@
23
23
  "hasInstallScript": true,
24
24
  "license": "MIT",
25
25
  "name": "rustcodegraph",
26
- "version": "1.2.0"
26
+ "version": "1.2.2"
27
27
  },
28
28
  "node_modules/@isaacs/balanced-match": {
29
29
  "engines": {
@@ -896,5 +896,5 @@
896
896
  }
897
897
  },
898
898
  "requires": true,
899
- "version": "1.2.0"
899
+ "version": "1.2.2"
900
900
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "artifactDownloadUrl": "https://github.com/hunzhiwange/rustcodegraph/releases/download/v1.2.0",
2
+ "artifactDownloadUrl": "https://github.com/hunzhiwange/rustcodegraph/releases/download/v1.2.2",
3
3
  "bin": {
4
4
  "rustcodegraph": "run-rustcodegraph.js"
5
5
  },
@@ -90,7 +90,7 @@
90
90
  "zipExt": ".tar.xz"
91
91
  }
92
92
  },
93
- "version": "1.2.0",
93
+ "version": "1.2.2",
94
94
  "volta": {
95
95
  "node": "18.14.1",
96
96
  "npm": "9.5.0"