opencode
opencode copied to clipboard
CLI build script fails on Windows (shebang + baseline artifact download issues)
Problem
The CLI build script (packages/opencode/package.json) fails on Windows because:
-
Shebang not honored: The
buildscript invokes./script/build.tsdirectly, relying on the shebang (#!/usr/bin/env bun). Windows doesn't execute shebangs, causing the build to fail with "command not found". -
Flaky baseline artifact downloads: When using the
--singleflag (build for current platform only), the script still attempts to build the baseline (non-AVX2) target. This requires downloading additional Bun baseline artifacts, which frequently fail on Windows with "Failed to extract executable" errors.
Reproduction
Issue 1: Shebang failure
bun run --cwd packages/opencode build
# Error: bun: command not found: ./script/build.ts
Issue 2: Baseline artifact download failure
bun run --cwd packages/opencode script/build.ts --single
# Error: Failed to extract executable for 'bun-windows-x64-baseline-v1.3.5'
Expected Behavior
-
bun run --cwd packages/opencode buildshould work on Windows -
--singleflag should build only the native (AVX2) target by default, avoiding flaky baseline artifact downloads
Environment
- OS: Windows 11
- Bun version: 1.3.5
- Repo: sst/opencode (dev branch)