fix(plugins): detect extensionless npm global CLIs on Unix
CI / CI configuration security checks (push) Successful in 3s
CI / Capabilities and shell quality (push) Successful in 13s
CI / Python tests and compilation (push) Successful in 25s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 18s
CI / PowerShell tests on Ubuntu (push) Successful in 1m11s
CI / Installed client configuration smoke tests (push) Successful in 39s
CI / Bash integration and installation guards (push) Failing after 59s
CI / CI configuration security checks (push) Successful in 3s
CI / Capabilities and shell quality (push) Successful in 13s
CI / Python tests and compilation (push) Successful in 25s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 18s
CI / PowerShell tests on Ubuntu (push) Successful in 1m11s
CI / Installed client configuration smoke tests (push) Successful in 39s
CI / Bash integration and installation guards (push) Failing after 59s
Test-CliCommand cast the matching suffix to bool. On Unix the only match is the empty suffix '', which [bool] treats as false, so CLIs such as MCPorter in the npm global prefix were never detected. Count matches instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
49636323f0
commit
20fcb9ea5b
1 file changed
+2
-1
@@ -74,7 +74,8 @@ function Test-CliCommand {
|
|||||||
$prefix = @(& npm prefix --global 2>$null | ForEach-Object { "$_".Trim() } | Where-Object { $_ }) | Select-Object -Last 1
|
$prefix = @(& npm prefix --global 2>$null | ForEach-Object { "$_".Trim() } | Where-Object { $_ }) | Select-Object -Last 1
|
||||||
if (-not $prefix) { return $false }
|
if (-not $prefix) { return $false }
|
||||||
$directory = if ([Environment]::OSVersion.Platform -eq [PlatformID]::Win32NT) { $prefix } else { Join-Path $prefix 'bin' }
|
$directory = if ([Environment]::OSVersion.Platform -eq [PlatformID]::Win32NT) { $prefix } else { Join-Path $prefix 'bin' }
|
||||||
return [bool](@('', '.cmd', '.exe', '.ps1') | Where-Object { Test-Path -LiteralPath (Join-Path $directory ($Name + $_)) -PathType Leaf })
|
# Count matches: the extensionless Unix match is '', which [bool] would treat as false.
|
||||||
|
return @(@('', '.cmd', '.exe', '.ps1') | Where-Object { Test-Path -LiteralPath (Join-Path $directory ($Name + $_)) -PathType Leaf }).Count -gt 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function Test-InstalledMCPServer {
|
function Test-InstalledMCPServer {
|
||||||
|
|||||||
Reference in new issue
Block a user