fix(qmd): run global npm CLIs without relying on PATH
CI / CI configuration security checks (push) Successful in 2s
CI / Capabilities and shell quality (push) Successful in 12s
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 15s
CI / PowerShell tests on Ubuntu (push) Successful in 1m5s
CI / Installed client configuration smoke tests (push) Successful in 40s
CI / Bash integration and installation guards (push) Successful in 1m10s
CI / CI configuration security checks (push) Successful in 2s
CI / Capabilities and shell quality (push) Successful in 12s
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 15s
CI / PowerShell tests on Ubuntu (push) Successful in 1m5s
CI / Installed client configuration smoke tests (push) Successful in 40s
CI / Bash integration and installation guards (push) Successful in 1m10s
npm's global bin directory is often missing from PATH on Windows, so the installer failed at `qmd pull` right after installing the package. Run the QMD CLI through node from `npm root --global`, as the QMD scripts already do, and look up other globally installed CLIs such as mcporter in `npm prefix --global` when they are not on PATH. Doctor now warns when npm's global bin directory is missing from PATH, since agents call mcporter directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a89be2604b
commit
6fad45105f
7 files changed
+101
-7
No files matched your search
@@ -38,6 +38,16 @@ foreach ($tool in @('codex','claude')) {
|
||||
} else { Result 'WARN' "$tool unavailable" }
|
||||
}
|
||||
if (Get-Command jq -ErrorAction SilentlyContinue) { Result 'PASS' 'jq available for Claude Bash status line' } else { Result 'WARN' 'jq unavailable; Claude Bash status line is disabled' }
|
||||
# Globally installed npm CLIs (qmd, mcporter) must be callable by agents, so npm's global bin directory belongs on PATH.
|
||||
if (Get-Command npm -ErrorAction SilentlyContinue) {
|
||||
$npmPrefix = @((Invoke-DoctorCommand -Command 'npm' -Arguments @('prefix', '--global')).Output | ForEach-Object { "$_".Trim() } | Where-Object { $_ }) | Select-Object -Last 1
|
||||
if ($npmPrefix) {
|
||||
$npmBin = if ([Environment]::OSVersion.Platform -eq [PlatformID]::Win32NT) { $npmPrefix } else { Join-Path $npmPrefix 'bin' }
|
||||
$pathEntries = @($env:PATH -split [regex]::Escape([string][System.IO.Path]::PathSeparator) | ForEach-Object { $_.TrimEnd([char[]]@('\', '/')) })
|
||||
if ($pathEntries -contains $npmBin.TrimEnd([char[]]@('\', '/'))) { Result 'PASS' "npm global bin directory is on PATH ($npmBin)" }
|
||||
else { Result 'WARN' "npm global bin directory $npmBin is not on PATH; agents cannot call globally installed CLIs such as mcporter. Add it to your user PATH and restart the terminal." }
|
||||
}
|
||||
}
|
||||
$python = Get-PythonCommand
|
||||
if ($python) { Result 'PASS' "Python available ($($python.Display))" }
|
||||
else { Result 'FAIL' "$(Get-PythonMissingMessage) Without it, build validation fails and the completion-evidence, correction-prompt, and session-state hooks are silently skipped." }
|
||||
|
||||
@@ -36,6 +36,20 @@ for tool in codex claude; do
|
||||
else result WARN "$tool unavailable"; fi
|
||||
done
|
||||
command -v jq >/dev/null && result PASS 'jq available for Claude Bash status line' || result WARN 'jq unavailable; Claude Bash status line is disabled'
|
||||
# Globally installed npm CLIs (qmd, mcporter) must be callable by agents, so npm's global bin directory belongs on PATH.
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
npm_prefix=$(npm prefix --global 2>/dev/null | tr -d '␍' | tail -n 1)
|
||||
if [ -n "$npm_prefix" ]; then
|
||||
case "$(uname -s 2>/dev/null)" in
|
||||
MINGW*|MSYS*|CYGWIN*) npm_bin=$(cygpath -u "$npm_prefix" 2>/dev/null || printf '%s' "$npm_prefix") ;;
|
||||
*) npm_bin="$npm_prefix/bin" ;;
|
||||
esac
|
||||
case ":$PATH:" in
|
||||
*":$npm_bin:"*|*":$npm_bin/:"*) result PASS "npm global bin directory is on PATH ($npm_bin)" ;;
|
||||
*) result WARN "npm global bin directory $npm_bin is not on PATH; agents cannot call globally installed CLIs such as mcporter. Add it to your user PATH and restart the terminal." ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if resolve_python; then
|
||||
result PASS "Python available ($(python_display))"
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user