no-mistakes(review): Remove stale OpenCode npm shims and fix oc2 hint

This commit is contained in:
Lap Tran committed 2026-11-08 18:13:24 -05:00
1 parent 3c7d2662a4
commit 2787bcc9ac
2 files changed
+14 -3

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Launch OpenCode 2 with an isolated config so it cannot rewrite # Launch OpenCode with an isolated config so it cannot rewrite
# ~/.config/opencode/opencode.json (OpenCode 1 / firstmate). # ~/.config/opencode/opencode.json (firstmate).
set -euo pipefail set -euo pipefail
bin="${OPENCODE2_BIN:-/opt/homebrew/opt/opencode/bin/opencode}" bin="${OPENCODE2_BIN:-/opt/homebrew/opt/opencode/bin/opencode}"
@@ -8,7 +8,7 @@ cfg="${OPENCODE_CONFIG:-$HOME/.config/opencode2/opencode.json}"
if [ ! -x "$bin" ]; then if [ ! -x "$bin" ]; then
echo "oc2: stable opencode not installed. Rebuild, or run:" >&2 echo "oc2: stable opencode not installed. Rebuild, or run:" >&2
echo " brew install opencode && brew unlink opencode" >&2 echo " brew install opencode" >&2
exit 1 exit 1
fi fi
if [ ! -e "$cfg" ]; then if [ ! -e "$cfg" ]; then
+11
View File
@@ -33,6 +33,17 @@ if [ -x "$NPM" ] && npm_root="$("$NPM" root -g 2>/dev/null)"; then
fi fi
done done
fi fi
# `opencode` links without --overwrite, so any npm shim left in the Homebrew
# prefix aborts the switch's brew bundle link step. Drop the retired packages'
# shims directly, which also covers a failed uninstall and a missing npm.
for link in /opt/homebrew/bin/*; do
case "$(readlink "$link" 2>/dev/null || true)" in
*/node_modules/@opencode-ai/cli/* | */node_modules/opencode-ai/*)
rm -f "$link"
echo "==> Removed stale OpenCode npm shim $link"
;;
esac
done
echo "==> Updating no-mistakes..." echo "==> Updating no-mistakes..."
NO_MISTAKES_BIN="$HOME/.no-mistakes/bin/no-mistakes" NO_MISTAKES_BIN="$HOME/.no-mistakes/bin/no-mistakes"