SIGN IN SIGN UP

Switch tree-sitter wasm embed from base64 string to `with { type: 'file' }`

The base64-in-source approach didn't survive `bun --compile` on Windows.
The CI build's `verifyTreeSitterWasmEmbedded` step caught it:

    Embedded tree-sitter.wasm from D:\a\...\tree-sitter.wasm (205488 bytes
      → 273984 chars base64)
    [343ms]  minify  -16.58 MB
    Embedded tree-sitter wasm prefix not found in D:\a\...\codebuff.exe.

So the embed step wrote the bytes to disk and bun read them, but the
274KB string literal didn't end up in the compiled output — likely
tree-shaken or transformed by the minifier on Windows. The same code
worked on macOS and Linux locally and in CI.

Switch to Bun's documented asset-embed mechanism: import the wasm with
`with { type: 'file' }`. Bun handles this through the bundler's asset
pipeline rather than as a generic string literal, and the resulting
binary contains the wasm bytes verbatim at a bunfs path.

- cli/src/pre-init/tree-sitter-wasm.ts: import the wasm path, set the
  env var (for the locateFile fallback), and try a synchronous read so
  Parser.init can take the wasmBinary fast path. If the read throws
  (some Windows configurations have done this), log loudly so user
  reports include the diagnostic, then fall through to the locateFile
  flow — which init-node.ts now accepts bunfs paths through, even when
  fs.existsSync misreports them.
- The --smoke-tree-sitter handler is now a top-level `await` instead
  of a fire-and-forget IIFE. Without that, commander.parse() ran
  synchronously in main() and failed on the unknown flag before the
  smoke handler could exit cleanly.
- cli/scripts/build-binary.ts: drop the base64 stub-overwrite step
  entirely. New verifyTreeSitterWasmEmbedded reads a 64-byte chunk
  from the *middle* of the source wasm and asserts it appears in the
  compiled binary — that proves *this specific* tree-sitter.wasm
  shipped, not just any wasm (OpenTUI also embeds tree-sitter language
  wasms, so a magic-bytes-only scan would false-pass).
- Delete cli/src/pre-init/tree-sitter-wasm-bytes.ts: no longer used.

Verified locally: build embeds tree-sitter.wasm via the file-attribute
import, post-build verification finds the source bytes at offset
77319353 of the compiled binary, --smoke-tree-sitter exits 0 with
"tree-sitter smoke ok (wasmBinary, 205488 bytes)".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
J
James Grugett committed
54c07293f4074bfc1924e4f099092892a9940ab1
Parent: ad6a900