* fix(agent): installs without Node ask for it the way that works
The commands that install Node first, for a machine without it (#727),
failed in ways that say nothing about the real problem.
On a Mac or Linux, `curl -o- … | bash` keeps going when the download
fails: a pipe's status is the last command's, so blocked or 404'd
(raw.githubusercontent.com is commonly unreachable), bash reads nothing,
still exits 0, and the user is told `nvm.sh: No such file or directory`
— the network's fault told as a missing file. The vendor commands beside
it all curl with -f (install.go's own scripts do); this one now does too,
so a failed download stops the line with curl's own words.
On Windows, winget asks to accept the msstore source's agreements the
first time it runs, which waits for input a copy-pasted command can't
give: Node isn't installed, and npm.cmd isn't found. The command now
carries --accept-source-agreements and --accept-package-agreements, the
flags Microsoft documents for unattended installs; they are idempotent
where the source is already accepted.
TestInstallCommandsWithoutNode expects the two commands as they now
stand, and fails on the old ones ("curl -o- …" and the winget line
without the flags, on darwin, linux and windows alike);
TestInstallWithoutNodeParses still reads each line with `bash -n`.
Validation on Windows: go test ./internal/agent under a temp HOME leaves
the three Unix-only failures the base commit leaves (TestCodexStaleOnly
ForMagpiesChange, TestSuffixModesReachAgentFiles, TestWSLProbeScript
SaysWhere); go vet ./internal/... and the darwin, linux and windows
builds pass.
* fix(agent): a failed Node download stops the line where it failed
yetone's review of the first cut: `curl -fsSL … | bash` doesn't stop at a
failed download either, and my claim that -f alone fixes it was wrong — a
pipe's status is the shell's, bash reading nothing exits 0, and the &&
chain goes on to source nvm.sh, which reports the missing file exactly as
before. Reproduced against a 404 server on this machine: `curl: (22) …
404` then `bash: …/.nvm/nvm.sh: No such file or directory`.
The command downloads to a file now and runs that: a failed download ends
the chain at curl, with curl's own words about why. pipefail isn't an
option — the line is pasted into the user's own shell, and not every one
of them sets it.
TestInstallWithoutNodeStopsWhenTheDownloadFails runs the real line,
against a local 404 server with a temporary HOME, on each POSIX shell
here: the old line failed with the download's error *and* nvm.sh missing,
the new one stops at curl's own error and never mentions nvm.sh. It is
skipped where there is no curl. TestInstallCommandsWithoutNode expects
the line as it now stands.
Validation on Windows: go test ./internal/agent under a temp HOME leaves
the three Unix-only failures the base commit leaves (TestCodexStaleOnly
ForMagpiesChange, TestSuffixModesReachAgentFiles, TestWSLProbeScript
SaysWhere); go vet ./internal/..., the darwin, GOOS=linux and GOOS=windows
builds pass.