dsh-plugin-codegraph 0.4.2 → 0.5.0

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 (2) hide show
  1. package/README.md +18 -4
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -132,13 +132,26 @@ The CLI is the origin of the on-disk format this plugin reads and writes, and it
132
132
 
133
133
  What this plugin adds is not a better graph — it is the same graph, delivered where DSH can act on it: no second process, no MCP plumbing, a state line the model reads for free, a human command, and a UI.
134
134
 
135
- ## Roadmap: a Rust core
135
+ ## The Rust engine
136
136
 
137
- The indexer is the one place this plugin is visibly slow on a first run, and the reason is structural: parsing runs on the host's main thread through `web-tree-sitter`, one file at a time. On a 337-file workspace a cold walk is 920 ms, and parsing plus extraction is essentially all of it — measured serially, 425 ms of `parse` and 491 ms of `extractFile`.
137
+ Parsing was the one place this plugin was visibly slow, and the reason was structural: `parse` plus `extractFile` ran on the host's main thread through `web-tree-sitter`, one file at a time. A native addon now does that work instead — `tree-sitter` compiled into Rust, one worker per core through rayon — and it is on for **TypeScript, TSX, JavaScript and JSX** already.
138
138
 
139
- The plan is to move extraction into a Rust core — `tree-sitter`'s native crate behind a `napi-rs` addon, with a worker pool parsing files in parallel — keeping every behaviour above (same cache keys, same resolution rules, same schema v4 output) so nothing user-visible changes except the clock. A sibling indexer here went from 17.6 s single-threaded in JS to 4.1 s on 8 threads in Rust (4.3×) on a different, heavier workload; that is the right order of magnitude for this one, not a promise.
139
+ | | JS + WASM | Rust addon |
140
+ |---|---|---|
141
+ | parse + extract (336 files, same input) | 727 ms | **110 ms** |
142
+ | whole walk, 337-file workspace (median of 4) | 807–886 ms | **277–336 ms** (2.6–2.9×) |
143
+
144
+ The whole-walk number is lower than the engine number because the walk is not only extraction: reading files, hashing, caching decisions and the final write are unchanged, and three files in that workspace would need the JS engine anyway (below). On a workspace with no such files the gap widens.
145
+
146
+ Three details worth knowing:
147
+
148
+ - **It is optional, and it degrades quietly.** The addon ships as `.node` platform artifacts; if it is missing, unbuilt, or throws, every file falls back to the JS extractor. `engine: 'js'` forces that path, `'auto'` (default) uses the addon where it can.
149
+ - **The rule table is not duplicated.** The addon receives `LANGUAGE_TABLE` as JSON and builds its matchers from it, so the two engines cannot drift on what a rule says — only on how well they implement it, which is what the parity tests measure.
150
+ - **Files whose parse tree has errors are left to the JS engine.** The two grammars (WASM 0.20 vs crate 0.23/0.25) recover from malformed input differently — on a real workspace that showed up as one phantom definition and a line off by one — so the addon refuses those files and `walk` extracts them the old way. Correct over fast.
151
+
152
+ `packages/tree-sitter/tests/rust-parity.spec.ts` asserts the two engines produce **byte-identical** extractions on every fixture, and on a real workspace when `CODEGRAPH_PARITY_WORKSPACE` is set.
140
153
 
141
- **Not in the current release.** Until it lands, the parse cache is what makes repeats cheap, and the first run is what it is.
154
+ **Coverage and next.** Four languages today. Python, Go, Java, C/C++, Rust, C# and the rest still go through the JS extractor, which keeps working unchanged; each new language needs its own Rust-side special cases plus a parity run before it ships. Multi-platform binaries (Linux, Windows, both architectures) are not published yet — building the addon is documented in [`crates/indexer-rust/README.md`](crates/indexer-rust/README.md).
142
155
 
143
156
  ## Call resolution never guesses
144
157
 
@@ -184,6 +197,7 @@ The bundle mounts all four plugins in one layer. Retune any of them from the pro
184
197
  exclude: ['node_modules', 'dist', 'vendor']
185
198
  respectGitignore: true
186
199
  skipMinified: true # the default; set false to index committed bundles anyway
200
+ engine: auto # auto | js | rust — prefer the native addon where it applies
187
201
  watch: true # the default; shown for clarity — set false to keep indexing purely explicit
188
202
 
189
203
  - id: codegraph-tool
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-codegraph",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Structural code intelligence for DeepSeek Harness — gives the agent codegraph and codegraph_index tools to find where a symbol is declared, what calls it, what a change reaches, and how one symbol reaches another, from a tree-sitter index it builds itself",
5
5
  "keywords": [
6
6
  "dsh",
@@ -42,10 +42,10 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "dsh-plugin-codegraph-panel": "^0.4.2",
46
- "dsh-plugin-codegraph-service": "^0.4.2",
47
- "dsh-plugin-codegraph-sqlite": "^0.4.2",
48
- "dsh-plugin-codegraph-tree-sitter": "^0.4.2",
49
- "dsh-plugin-codegraph-tool": "^0.4.2"
45
+ "dsh-plugin-codegraph-panel": "^0.5.0",
46
+ "dsh-plugin-codegraph-service": "^0.5.0",
47
+ "dsh-plugin-codegraph-tool": "^0.5.0",
48
+ "dsh-plugin-codegraph-sqlite": "^0.5.0",
49
+ "dsh-plugin-codegraph-tree-sitter": "^0.5.0"
50
50
  }
51
51
  }