opencode icon indicating copy to clipboard operation
opencode copied to clipboard

CLI build script fails on Windows (shebang + baseline artifact download issues)

Open christso opened this issue 3 weeks ago • 0 comments

Problem

The CLI build script (packages/opencode/package.json) fails on Windows because:

  1. Shebang not honored: The build script invokes ./script/build.ts directly, relying on the shebang (#!/usr/bin/env bun). Windows doesn't execute shebangs, causing the build to fail with "command not found".

  2. Flaky baseline artifact downloads: When using the --single flag (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 build should work on Windows
  • --single flag 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)

christso avatar Dec 20 '25 11:12 christso