Repository navigation
fix: don't crash on npm 12, where grammar install scripts don't run - #594
Conversation
…one is missing npm 12 blocks dependency install scripts by default. tree-sitter-kotlin ships no prebuilt binary, so after `npm install -g` its addon is absent, and the static imports in extract.ts threw at module load: every command crashed, the MCP server and hooks included, even in a repo with no Kotlin. - native.ts requires tree-sitter and each grammar on first use, caches the result, and never throws. A missing core binding disables the native tier without crashing. - A language whose native grammar can't load goes to its WASM stand-in in the breadth tier (vendored tags query for kotlin/swift/php/java, the bundle's tags.scm for typescript/tsx/python/go/r). .vue scripts follow their language. - build and check share one dispatch (tierOf/warmGrammarsFor), so check stays in sync with a fallback build. - Cached stand-in parses are marked (`via`) and re-parsed once the native grammar loads again. - The build prints one line naming the languages that fell back and the install that fixes it, using the installed package name; nothing when all grammars load.
🌱 graft blast radius3 areas changed → 6 areas can be affected. 21 dependent symbols, depth 2. flowchart TB
A0(("Pull Request Review<br/>10 symbols"))
A1(("Workspace Federation<br/>4 symbols"))
A2(("MCP Tool Invocation<br/>3 symbols"))
A3(("Graph Engine<br/>2 symbols"))
A4(("Viewer Build<br/>1 symbol"))
AX(("1 smaller area<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2,A3,A4 reached;
classDef tail fill:#EEF2F3,stroke:#9AA4A9,stroke-width:1px,color:#3A4247;
class AX tail;
Who knows this code — 4 people across 9 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 21 dependent symbols, grouped by areaPull Request Review — 10 symbols in 6 files
Workspace Federation — 4 symbols in 2 files
MCP Tool Invocation — 3 symbols in 1 file
Graph Engine — 2 symbols in 1 file
Viewer Build — 1 symbol in 1 file
Synchronous Execution — 1 symbol in 1 file
Test signal per changed area — 1 ✓ · 2 –Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
40 test suites also reference this code51 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
npm 12 stops packages from running install scripts unless you allow them. Our tree-sitter grammars build their native code in an install script, so on npm 12 they never get built. Today that makes
trail build(andgraft build) crash with "No native build was found ... tree-sitter-kotlin", even in repos with no Kotlin in them.What changes:
@nanonets/graftand@trailhq/trail-code).build,checkand workspace builds warm only the grammars the repo needs.Node 26 still ships npm 11, so today this only hits people who upgraded npm themselves. That number grows as npm 12 rolls out.
Tests:
test/graph-native-fallback.test.tscovers the lazy load and the WASM fallback. Full suite passes locally (1374 tests).🤖 Generated with Claude Code