Files
dotfiles/home/bin/oc2
T
Lap Tran 1fda5c09b7 Run OpenCode 2 from the stable Homebrew formula
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.
2026-11-08 12:15:22 -05:00

21 lines
579 B
Bash
Executable File

#!/usr/bin/env bash
# Launch OpenCode 2 with an isolated config so it cannot rewrite
# ~/.config/opencode/opencode.json (OpenCode 1 / firstmate).
set -euo pipefail
bin="${OPENCODE2_BIN:-/opt/homebrew/opt/opencode/bin/opencode}"
cfg="${OPENCODE_CONFIG:-$HOME/.config/opencode2/opencode.json}"
if [ ! -x "$bin" ]; then
echo "oc2: stable opencode not installed. Rebuild, or run:" >&2
echo " brew install opencode" >&2
exit 1
fi
if [ ! -e "$cfg" ]; then
echo "oc2: missing config $cfg (managed by home.nix)" >&2
exit 1
fi
export OPENCODE_CONFIG="$cfg"
exec "$bin" "$@"