fix(plugins): detect npm global CLIs in plugin selection

The plugin selection checked CLI extensions such as MCPorter only on PATH,
so it showed them unchecked when npm's global bin directory was missing
from PATH, even though the installer already finds them there. Fall back
to the npm global prefix in both PowerShell and Bash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-16 09:23:45 +01:00
1 parent 870cad66ac
commit adc4745d10
4 files changed
+51 -2

No files matched your search

+16 -1
View File
@@ -25,6 +25,21 @@ except (ValueError, KeyError, TypeError) as error:
' "$client" "$plugin"
}
cli_installed() {
local name=$1 prefix
command -v "$name" >/dev/null 2>&1 && return 0
# npm's global bin directory is often missing from PATH; match managed-extensions.py find_executable.
command -v npm >/dev/null 2>&1 || return 1
prefix=$(npm prefix --global 2>/dev/null | tr -d '\r' | tail -n 1)
[ -n "$prefix" ] || return 1
case "$(uname -s 2>/dev/null)" in
MINGW*|MSYS*|CYGWIN*)
prefix=$(cygpath -u "$prefix" 2>/dev/null || printf '%s' "$prefix")
[ -f "$prefix/$name" ] || [ -f "$prefix/$name.cmd" ] || [ -f "$prefix/$name.exe" ] ;;
*) [ -x "$prefix/bin/$name" ] ;;
esac
}
run_plugin_command() {
local dry_run=$1
shift
@@ -151,7 +166,7 @@ select_configured_plugins() {
continue
fi
if [ "$(plugin_field "$root" "$name" codex_method)" = cli ]; then
if command -v "$(plugin_field "$root" "$name" codex_source)" >/dev/null 2>&1; then checked+=(true); else checked+=(false); fi
if cli_installed "$(plugin_field "$root" "$name" codex_source)"; then checked+=(true); else checked+=(false); fi
continue
fi
found=false