Run OpenCode 2 from the stable Homebrew formula #16

Merged
hermes merged 3 commits from fm/dotfiles-opencode2-stable-brew into main 2026-11-08 18:03:14 -05:00
Owner

Summary

Replace the OpenCode 2 npm beta with the stable Homebrew opencode 2.2.6 build.

  • configuration.nix: declare { name = "opencode"; link = false; }. link = false makes brew bundle install the formula and then unlink it, so /opt/homebrew/bin/opencode stays the npm-installed OpenCode 1.x CLI that the crew harness runs. This is deterministic because the pinned nix-darwin homebrew module (d31953c) supports this per-brew attribute and emits brew "opencode", link: false, trusted: true in the generated Brewfile (verified with nix eval). Relying on Homebrew's default "conflict, do not link" behavior would depend on install order and prior link state.
  • home.nix: remove home.activation.opencode2 and the npm beta install. node stays in brews for backpass and acpx.
  • home/bin/oc2: default to /opt/homebrew/opt/opencode/bin/opencode, keep OPENCODE2_BIN as the override, keep the OPENCODE_CONFIG isolation unchanged.
  • rebuild.sh: remove the retired npm beta @opencode-ai/cli if present, using Homebrew's npm, with a local-only check so an offline rebuild skips it and never fails. The OpenCode 1.x install block is unchanged.
  • AGENTS.md: correct the notes: stable formula, installed unlinked, launched only through home/bin/oc2, npm beta removed at rebuild time, and a build switch needs opencode service restart because of Background service uses an incompatible health protocol.

Verification (in the worktree)

  • bash -n home/bin/oc2 and bash -n rebuild.sh: ok
  • nix-instantiate --parse home.nix and nix-instantiate --parse configuration.nix: ok
  • nix eval .#darwinConfigurations.lt-mbp.config.homebrew.brewfile contains brew "opencode", link: false, trusted: true
  • home/bin/oc2 --version with OPENCODE2_BIN unset: opencode v2.2.6
  • home/bin/oc2 models with OPENCODE2_BIN unset: lists opencode-go/... models (isolated config and stored account resolve)

The rebuild will run: /opt/homebrew/bin/npm uninstall -g @opencode-ai/cli only when that global package is installed.

Out of scope

  • Moving the crew harness from OpenCode 1.x to OpenCode 2.x
  • Any change to firstmate's own config

No darwin-rebuild, rebuild.sh, brew install, or uninstall was run as part of this change.

## Summary Replace the OpenCode 2 npm beta with the stable Homebrew `opencode` 2.2.6 build. - `configuration.nix`: declare `{ name = "opencode"; link = false; }`. `link = false` makes `brew bundle` install the formula and then unlink it, so `/opt/homebrew/bin/opencode` stays the npm-installed OpenCode 1.x CLI that the crew harness runs. This is deterministic because the pinned nix-darwin homebrew module (`d31953c`) supports this per-brew attribute and emits `brew "opencode", link: false, trusted: true` in the generated Brewfile (verified with `nix eval`). Relying on Homebrew's default "conflict, do not link" behavior would depend on install order and prior link state. - `home.nix`: remove `home.activation.opencode2` and the npm beta install. `node` stays in `brews` for backpass and acpx. - `home/bin/oc2`: default to `/opt/homebrew/opt/opencode/bin/opencode`, keep `OPENCODE2_BIN` as the override, keep the `OPENCODE_CONFIG` isolation unchanged. - `rebuild.sh`: remove the retired npm beta `@opencode-ai/cli` if present, using Homebrew's npm, with a local-only check so an offline rebuild skips it and never fails. The OpenCode 1.x install block is unchanged. - `AGENTS.md`: correct the notes: stable formula, installed unlinked, launched only through `home/bin/oc2`, npm beta removed at rebuild time, and a build switch needs `opencode service restart` because of `Background service uses an incompatible health protocol`. ## Verification (in the worktree) - `bash -n home/bin/oc2` and `bash -n rebuild.sh`: ok - `nix-instantiate --parse home.nix` and `nix-instantiate --parse configuration.nix`: ok - `nix eval .#darwinConfigurations.lt-mbp.config.homebrew.brewfile` contains `brew "opencode", link: false, trusted: true` - `home/bin/oc2 --version` with `OPENCODE2_BIN` unset: `opencode v2.2.6` - `home/bin/oc2 models` with `OPENCODE2_BIN` unset: lists `opencode-go/...` models (isolated config and stored account resolve) The rebuild will run: `/opt/homebrew/bin/npm uninstall -g @opencode-ai/cli` only when that global package is installed. ## Out of scope - Moving the crew harness from OpenCode 1.x to OpenCode 2.x - Any change to firstmate's own config No `darwin-rebuild`, `rebuild.sh`, `brew install`, or uninstall was run as part of this change.
hermes added 3 commits 2026-11-08 12:38:06 -05:00
Declare the opencode formula with link = false so it never replaces the
npm-installed OpenCode 1.x CLI at /opt/homebrew/bin/opencode. Drop the npm
beta install from home.activation.opencode2, point home/bin/oc2 at the keg
binary, and correct the related notes.
hermes merged commit b03d71dc81 into main 2026-11-08 18:03:14 -05:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: transnet/dotfiles#16