Skip plain-forge install when Node.js is unavailable - #266
Skip plain-forge install when Node.js is unavailable#266pedjaradenkovic wants to merge 2 commits into
Conversation
The npx presence check passes when a version-manager shim (nvm, volta, asdf) is on PATH without a working Node.js behind it. The npx call then fails and aborts the whole installer: set -euo pipefail in bash, ErrorActionPreference=Stop in PowerShell. The PowerShell installer also marked plain-forge as installed even when the npx command failed. Verify node actually runs before invoking npx, skip the step with a clear message when it doesn't, and let a failed plain-forge install print a retry hint instead of aborting the remaining setup steps. The final next-steps screen already reminds the user to install plain-forge manually whenever the step was skipped or failed.
The bare "Node.js not found" line read like a status report and did not say what plain-forge is or why Node.js matters. Explain that plain-forge brings codeplain's agentic skills to the user's coding agent, that installing it requires Node.js, and how to add it later.
|
Tested this on macOS (Darwin 24.6.0, bash 3.2, Node v24.18.0) — bash installer Confirmed the fix does what it claims. Four things I'd still flag:
plain-forge is already installed in /Users/you/.claude. They're told installation failed and told to retry with the one command guaranteed to fail again —
Smaller nit: unlike ✓ uv detected / ✓ codeplain installed successfully! / ✓ plyn installed, the |
|
I couldn't reproduce 1. Can you tell me how did you reproduce it? I think it just reinstalls the plain-forge and continues - which is good enough for this use case (rarely will anyone install codeplain after they have plain-forge already installed). Regarding 2, 3 and 4, I don't think they are relevant (IMO it's a nitpicking for this change). |
|
The check applies to the resolved target directory, which is derived from the agent and scope. I reproduced it by running the install command twice against the same target: bash Anything that resolves to a different directory exits successfully. |
Problem
The installers already checked
command -v npx/Get-Command npx, but that check passes when a version-manager shim (nvm, volta, asdf) is on PATH without a working Node.js behind it. When the shim then fails:set -euo pipefailaborts the entire installer mid-flow — the plyn extension, examples, and final verification steps never run.$ErrorActionPreference = 'Stop'has the same exposure, and$plainForgeInstalledwas set to$trueeven when thenpxcommand failed.Fix
node --versionsucceeds) instead of only checking that annpxshim resolves. When it doesn't, skip the step with a clear "Node.js not found. Skipping plain-forge…" message plus the manualnpx plain-forge installhint.npx plain-forge installcall so a failure prints a retry hint and the installer continues with the remaining steps instead of aborting.Testing
bash -npasses on the bash installer.set -e(npx missing entirely, broken shim,npx plain-forge installexiting non-zero) — the installer skips or continues correctly in each case and reaches the end.pwshisn't available locally, so the PowerShell file was not syntax-checked — worth a quick run on a Windows box.