Move --smoke-tree-sitter handler to main() to bypass commander
Last attempt put the handler at top-level in the pre-init module behind
a top-level await, on the theory that ESM would pause subsequent module
evaluation until it resolved. That worked on macOS locally but not on
Windows in CI:
smoke-binary: spawning ./codebuff.exe for 10s…
error: tree-sitter smoke failed with exit code 1
error: unknown option '--smoke-tree-sitter'
So commander.parse() ran before our handler exited, which means
top-level await is not actually blocking parent-module evaluation in
the bun --compile output on Windows (or it's getting transformed away
by `--production` minification).
Move the handler to the top of main() in cli/src/index.tsx, before
parseArgs(). At that point commander hasn't run yet, so we can short-
circuit cleanly. The pre-init module's only job is now to publish the
embedded wasm bytes (globalThis) and path (env var); the handler reads
those out of the same channels the production runtime uses.
Verified locally: ./codebuff --smoke-tree-sitter prints
"tree-sitter smoke ok (wasmBinary, 205488 bytes)" and exits 0; full
smoke-binary.ts run passes both the tree-sitter pre-check and the
boot-screen window.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> J
James Grugett committed
7d5829478ef86da325cf3e75685e71e20bdefad0
Parent: 01fefda