SIGN IN SIGN UP

feat(sandbox): isolated dev sandbox so plugin edits never hit live OpenCode

`bun run install:link` symlinks src/index.ts into ~/.config/opencode/plugin,
which means every keystroke in src/ hot-reloads into every running OpenCode
session. Any parse-time error kills live sessions until we fix and save
again. The sandbox gives us an independent XDG tree where we can iterate
without touching the live install.

New surface:

- scripts/sandbox.ts — lifecycle manager with 'up', 'down', 'reinstall',
  'run', 'status', 'help'. Copies dist bundles (NEVER symlinks) so edits to
  src/ do not reach the sandbox until the next 'reinstall'.
- scripts/sandbox-env.sh — sourceable activator for bash/zsh. Exports
  XDG_CONFIG_HOME / XDG_DATA_HOME / XDG_CACHE_HOME / PATH /
  OPENCODE_ANTHROPIC_DEBUG so any subsequent 'opencode' invocation picks up
  the sandbox plugin instead of the live one.
- package.json — wire 'sandbox:up', 'sandbox:down', 'sandbox:reinstall',
  'sandbox:run', 'sandbox:status' for discoverability and CI ergonomics.
- tests/integration/scripts/sandbox.test.ts — 6 invariants: directories
  exist, plugin + CLI are COPIES not symlinks, 'up' leaves the user's live
  ~/.config/opencode untouched, 'reinstall' preserves sandbox state,
  'down' cleans up, 'status' reports absence correctly.

Verification:

- 75 test files / 1341 tests green (added 1 file / 6 tests)
- lint clean, typecheck clean
- cold-start 'bun scripts/sandbox.ts up' builds dist/ and writes into
  .sandbox/, leaving ~/.config/opencode/plugin untouched (still points to
  src/index.ts via the existing install:link symlink)

This unblocks the sandbox-first workflow required before iterating on
wire-visible behavior changes in later phases.
V
Vacbo committed
f7effa5c67868a1d778fbf864d188573361b6d00
Parent: 07e375a