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:
1 parent
870cad66ac
commit
adc4745d10
4 files changed
+51
-2
No files matched your search
@@ -48,6 +48,16 @@ select_configured_plugins "$root" codex Update true selected deselected
|
||||
printf '%s\n' '{"mcpServers":{"context7":{"baseUrl":"https://example.invalid/mcp"}}}' > "$test_home/.mcporter/mcporter.json"
|
||||
select_configured_plugins "$root" codex Update true selected deselected
|
||||
[[ " ${deselected[*]} " == *' Context7 '* ]] || { printf 'A different MCPorter server must not select Context7.\n' >&2; exit 1; }
|
||||
npm_prefix=$(mktemp -d "$root/.npm-test.XXXXXX")
|
||||
cli_name="ai-config-test-cli-${npm_prefix##*.}"
|
||||
npm() { printf '%s\n' "$npm_prefix"; }
|
||||
if cli_installed "$cli_name"; then rm -rf -- "$npm_prefix"; printf 'A missing CLI must not be detected.\n' >&2; exit 1; fi
|
||||
mkdir -p "$npm_prefix/bin"
|
||||
touch "$npm_prefix/$cli_name.cmd" "$npm_prefix/bin/$cli_name"
|
||||
chmod +x "$npm_prefix/bin/$cli_name"
|
||||
if ! cli_installed "$cli_name"; then rm -rf -- "$npm_prefix"; printf 'A CLI in the npm global prefix must be detected when it is not on PATH.\n' >&2; exit 1; fi
|
||||
rm -rf -- "$npm_prefix"
|
||||
unset -f npm
|
||||
# shellcheck disable=SC2034
|
||||
selected=()
|
||||
plugin_installed() { printf 'Empty selection must not query installed plugins.\n' >&2; exit 1; }
|
||||
|
||||
Reference in new issue
Block a user