Make CLI build script Windows-friendly
Fixes #5836
Problem
Issue 1: Build script fails on Windows
The build script in packages/opencode/package.json invokes ./script/build.ts directly, relying on the shebang (#!/usr/bin/env bun) to execute. Windows doesn't honor shebangs, causing the script to fail.
Issue 2: --single flag downloads flaky baseline artifacts
When building with --single (current platform only), the script still attempts to build the baseline (non-AVX2) target, which requires downloading additional Bun artifacts. These downloads frequently fail on Windows with "Failed to extract executable" errors.
Reproduction
See issue #5836 for full reproduction steps.
Changes
-
packages/opencode/package.json: Change
buildscript from./script/build.tstobun run script/build.ts(Windows-compatible) -
packages/opencode/script/build.ts: When
--singleis used, build only the native target by default; pass--baselineto also build the baseline (AVX2=false) variant when needed (eg. release parity)
Testing
Tested on Windows 11 with Bun 1.3.5:
bun run --cwd packages/opencode build -- --single --skip-install
# Successfully builds opencode-windows-x64 (native target only)
/review
lgtm