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

+13
View File
@@ -66,6 +66,19 @@ try {
$selection = Select-ConfiguredPlugins -RepositoryRoot $root -Client Codex -Mode Update -HomePath $mcporterHome
if (@($selection.Deselected | Where-Object { $_.name -eq 'Context7' }).Count -ne 1) { throw 'A different MCPorter server must not select Context7.' }
} finally { Remove-Item -LiteralPath $mcporterHome -Recurse -Force -ErrorAction SilentlyContinue }
$npmPrefix = Join-Path $root ('.npm-test-' + [Guid]::NewGuid())
$cliName = 'ai-config-test-cli-' + [Guid]::NewGuid().ToString('N')
try {
New-Item (Join-Path $npmPrefix 'bin') -ItemType Directory -Force | Out-Null
function npm { $npmPrefix }
if (Test-CliCommand -Name $cliName) { throw 'A missing CLI must not be detected.' }
New-Item (Join-Path $npmPrefix "$cliName.cmd") -ItemType File | Out-Null
New-Item (Join-Path $npmPrefix "bin/$cliName") -ItemType File | Out-Null
if (-not (Test-CliCommand -Name $cliName)) { throw 'A CLI in the npm global prefix must be detected when it is not on PATH.' }
} finally {
Remove-Item function:npm -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $npmPrefix -Recurse -Force -ErrorAction SilentlyContinue
}
$script:managedArguments = @()
function Invoke-Python { $script:managedArguments = @($args); $global:LASTEXITCODE = 0 }
$entry = [pscustomobject]@{ name = 'Test'; codex_method = 'plugin'; codex_marketplace = '-'; codex_plugin = 'test@market' }