Skip to content

fix(package): vendor grammar WASM so installs need no native toolchain - #14

Merged
pkieltyka merged 1 commit into
masterfrom
ci-up
Jul 26, 2026
Merged

fix(package): vendor grammar WASM so installs need no native toolchain#14
pkieltyka merged 1 commit into
masterfrom
ci-up

Conversation

@pkieltyka

Copy link
Copy Markdown
Collaborator

tree-sitter-solidity@1.2.13 misspells its optional-peer metadata key as tree_sitter, so npm reads tree-sitter as a required peer, installs the native binding, and compiles it from source — which fails against Node >= 23 V8 headers ("C++20 or later required"). That broke npm install -g @0xsequence/codegenie and the GitHub Action for every consumer as soon as 0.5.0 added the Solidity grammar. pnpm hid it locally: pnpm-workspace.yaml already ignores the missing peer and denies those builds, and the consumer test ran under that same policy, so the npm path was never exercised.

codegenie parses through web-tree-sitter and needs only the published WASM, so the grammar packages become devDependencies and the build vendors their WASM into bundled-grammars/. Every installed dependency is now pure JavaScript.

  • scripts/copy-grammars.mjs vendors the 7 grammars at build time
  • tree-sitter-service resolves the bundled copy, falling back to the devDependency so a fresh checkout parses before its first build
  • new test walks the prod closure and fails on any native install hook, binding.gyp, or peer that npm would treat as required
  • new test pins every documented action tag to the package version

Verified with a real npm install -g on Node 26 with scripts enabled: 119 packages in 4s, no ERESOLVE, no node-gyp, and all 7 grammars parse from the installed package.

tree-sitter-solidity@1.2.13 misspells its optional-peer metadata key as
`tree_sitter`, so npm reads `tree-sitter` as a *required* peer, installs the
native binding, and compiles it from source — which fails against Node >= 23
V8 headers ("C++20 or later required"). That broke `npm install -g
@0xsequence/codegenie` and the GitHub Action for every consumer as soon as
0.5.0 added the Solidity grammar. pnpm hid it locally: pnpm-workspace.yaml
already ignores the missing peer and denies those builds, and the consumer
test ran under that same policy, so the npm path was never exercised.

codegenie parses through web-tree-sitter and needs only the published WASM, so
the grammar packages become devDependencies and the build vendors their WASM
into bundled-grammars/. Every installed dependency is now pure JavaScript.

- scripts/copy-grammars.mjs vendors the 7 grammars at build time
- tree-sitter-service resolves the bundled copy, falling back to the
  devDependency so a fresh checkout parses before its first build
- new test walks the prod closure and fails on any native install hook,
  binding.gyp, or peer that npm would treat as required
- new test pins every documented action tag to the package version

Verified with a real `npm install -g` on Node 26 with scripts enabled: 119
packages in 4s, no ERESOLVE, no node-gyp, and all 7 grammars parse from the
installed package.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pkieltyka
pkieltyka merged commit 8cc8936 into master Jul 26, 2026
7 checks passed
@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown

codegenie review

No credible findings.

Coverage

Reviewed 20/25 hunks.
Incomplete work: skipped 5.
Coverage levels: deep 12, normal 5, light 3, skip 5.

  • pnpm-lock.yaml: lockfile

Needs Human Attention

  • Does make clean removing bundled-grammars/ break any workflow that expects vendored WASM to persist without re-running the copy-grammars build step (e.g. dev flows that run clean then test without build)?
    Files: Makefile, scripts/copy-grammars.mjs
    Symbols: build, clean
    Reason: Packet reviewer could not resolve this question from the reviewed context.

Stats

Model: anthropic claude-opus-5 high
Elapsed time: 8m 42s
Git: 0xPolygon/codegenie from master to ci-up (56e6f6f)
Review completeness: complete.
Usage: model calls 41, tokens 895340, cost $3.5601.
Effective caps: tokens 8000000.
Local context pressure: 2 tool-budget rejections, 19 degraded tool results, 15 degraded hunks.

No Findings

No credible findings were found.

workflow run

@pkieltyka
pkieltyka deleted the ci-up branch July 26, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant