cloudaxe-opencode/packages/opencode/script
Kit Langton 5bc6a7f6d0 test(cli): opt-in pre-built binary for ~3x faster subprocess spawns
\`bun run --conditions=browser src/index.ts\` pays ~15s of JIT + plugin
init + DB migration per subprocess spawn in isolation mode. A pre-built
binary cuts that to ~5s — most of which is now the SQLite \`:memory:\`
migration that runs regardless of execution mode.

Adds \`script/prebuild-test-cli.ts\` which wraps the existing build.ts
with \`--single --skip-embed-web-ui --skip-install\`, then symlinks the
platform-specific output to \`dist/test-cli/bin/opencode\` so the
harness has a stable path.

The harness (test/lib/cli-process.ts) reads OPENCODE_TEST_CLI_PATH and
spawns the binary directly when set; falls back to dev mode otherwise.
Strictly opt-in — default behavior, CI, and local iteration are
unchanged. Anyone who wants the speedup runs:

  bun script/prebuild-test-cli.ts
  export OPENCODE_TEST_CLI_PATH="\$PWD/dist/test-cli/bin/opencode"
  bun test test/cli/

Measured locally:
  Dev mode (default):  29.9s  (331 tests)
  Binary mode:         22.1s  (-26%, after one-time 2.8s build)

The win compounds as more subprocess tests are added — every new test
that hits DB migration saves ~10s vs dev mode.
2026-05-19 11:36:15 -04:00
..
bench-test-suite.ts Speed up targeted opencode tests 2026-05-18 16:18:29 +00:00
build-node.ts Load models.dev snapshot from build global (#28077) 2026-05-17 21:59:44 -04:00
build.ts Load models.dev snapshot from build global (#28077) 2026-05-17 21:59:44 -04:00
check-migrations.ts
fix-node-pty.ts
generate.ts Load models.dev snapshot from build global (#28077) 2026-05-17 21:59:44 -04:00
httpapi-exercise.ts refactor(server): split HttpApi exercise harness (#26385) 2026-05-08 17:58:14 +00:00
postinstall.mjs Fix npm CLI binary installation (#27801) 2026-05-15 18:43:37 -04:00
prebuild-test-cli.ts test(cli): opt-in pre-built binary for ~3x faster subprocess spawns 2026-05-19 11:36:15 -04:00
profile-test-files.ts Speed up targeted opencode tests 2026-05-18 16:18:29 +00:00
publish.ts core: clarify postinstall error message when binary is missing 2026-05-15 23:12:00 -04:00
run-workspace-server chore: generate 2026-04-20 18:29:48 +00:00
schema.ts Validate TUI config with Effect Schema (#26952) 2026-05-11 23:51:45 +00:00
time.ts move useful scripts to script folder 2026-04-16 10:09:14 -04:00
trace-imports.ts move useful scripts to script folder 2026-04-16 10:09:14 -04:00