Phase 0 of the Rust extraction-kernel migration (docs/design/ rust-kernel-migration-plan.md, now checked in with §3a recording the shipped state): - codegraph-kernel/ napi-rs crate: extractFile(path, content, language) → five flat buffers (meta/nodes/edges/refs/arena), one JS boundary crossing per file. Node ids computed Rust-side, byte-identical to generateNodeId (pinned by test vector). Reserved per-node metrics slot for the Arc 3.2 code-metrics work. - Generic .scm-driven emitter (@def.<kind>/@name/@ref.<kind> captures, byte-range scope stack → ::-joined qualified names, contains edges, refs attributed to the innermost enclosing symbol). Seed TS/JS queries are smoke-level; R2 replaces them with the full port. - Routing seam in extractFromSource with per-file wasm fallback. DEFAULT_ROUTED is empty — no behavior change until a language passes its equivalence gate (R3). Dev opt-in: CODEGRAPH_KERNEL_LANGS. Kill switch: CODEGRAPH_KERNEL=0. Loader verifies ABI + kind tables before routing; EDGE_KINDS became a runtime array because kind order is now wire contract. - Grammar-source parity: vendored TS/TSX/JS wasm grammars built from the exact crate revisions (tree-sitter-typescript v0.23.2, tree-sitter-javascript v0.25.0, checked-in parser.c, ts-cli 0.25.10) — the tree-sitter-wasms builds were 2023-era, which the new kernel-grammar-parity test caught on day one. Production TS/JS parsing gets 2.5 years of grammar fixes; full suite green (2456 tests). - Build/release wiring: scripts/build-kernel.sh + npm run build:kernel; release.yml kernel prebuild matrix (continue-on-error — the kernel is optional everywhere, bundles fall back to the wasm path); bundles stage lib/kernel/codegraph-kernel.node; release job runs the kernel suites with CODEGRAPH_KERNEL_EXPECT=1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
22 lines
1.2 KiB
Scheme
22 lines
1.2 KiB
Scheme
; Seed query for the R1 scaffold — smoke-level coverage that proves the
|
|
; buffer contract and emitter mechanics end to end. NOT extraction parity:
|
|
; R2 replaces this with the full TypeScript/TSX port.
|
|
;
|
|
; Capture convention (see emitter.rs):
|
|
; @def.<NodeKind> — the declaration node; pairs with @name in the pattern
|
|
; @name — the declaration's name node
|
|
; @ref.<EdgeKind> — a reference; the capture's own text is the name
|
|
|
|
(class_declaration name: (type_identifier) @name) @def.class
|
|
(abstract_class_declaration name: (type_identifier) @name) @def.class
|
|
(interface_declaration name: (type_identifier) @name) @def.interface
|
|
(enum_declaration name: (identifier) @name) @def.enum
|
|
(type_alias_declaration name: (type_identifier) @name) @def.type_alias
|
|
(function_declaration name: (identifier) @name) @def.function
|
|
(generator_function_declaration name: (identifier) @name) @def.function
|
|
(method_definition name: (property_identifier) @name) @def.method
|
|
|
|
(call_expression function: (identifier) @ref.calls)
|
|
(call_expression function: (member_expression property: (property_identifier) @ref.calls))
|
|
(new_expression constructor: (identifier) @ref.instantiates)
|