no-mistakes(review): Remove stale OpenCode npm shims and fix oc2 hint
This commit is contained in:
1 parent
3c7d2662a4
commit
2787bcc9ac
2 files changed
+14
-3
No files matched your search
+3
-3
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Launch OpenCode 2 with an isolated config so it cannot rewrite
|
||||
# ~/.config/opencode/opencode.json (OpenCode 1 / firstmate).
|
||||
# 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}"
|
||||
@@ -8,7 +8,7 @@ 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 && brew unlink opencode" >&2
|
||||
echo " brew install opencode" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e "$cfg" ]; then
|
||||
|
||||
+11
@@ -33,6 +33,17 @@ if [ -x "$NPM" ] && npm_root="$("$NPM" root -g 2>/dev/null)"; then
|
||||
fi
|
||||
done
|
||||
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..."
|
||||
NO_MISTAKES_BIN="$HOME/.no-mistakes/bin/no-mistakes"
|
||||
|
||||
Reference in new issue
Block a user