#!/usr/bin/env bash # Launch OpenCode with an isolated config so it cannot rewrite # ~/.config/opencode/opencode.json (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" "$@"