[PR #5835] Make CLI build script Windows-friendly #11606

Closed
opened 2026-02-16 18:16:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5835

State: closed
Merged: Yes


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

  1. packages/opencode/package.json: Change build script from ./script/build.ts to bun run script/build.ts (Windows-compatible)
  2. packages/opencode/script/build.ts: When --single is used, build only the native target by default; pass --baseline to 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)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5835 **State:** closed **Merged:** Yes --- 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 1. **packages/opencode/package.json**: Change `build` script from `./script/build.ts` to `bun run script/build.ts` (Windows-compatible) 2. **packages/opencode/script/build.ts**: When `--single` is used, build only the native target by default; pass `--baseline` to also build the baseline (AVX2=false) variant when needed (eg. release parity) ## Testing Tested on Windows 11 with Bun 1.3.5: ```powershell bun run --cwd packages/opencode build -- --single --skip-install # Successfully builds opencode-windows-x64 (native target only) ```
yindo added the pull-request label 2026-02-16 18:16:29 -05:00
yindo closed this issue 2026-02-16 18:16:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11606