fix: npm 10+ compatibility across the update and install surfaces - #773
fix: npm 10+ compatibility across the update and install surfaces#773ayushnangia wants to merge 2 commits into
Conversation
fixes PrimeIntellect-ai#738, fixes PrimeIntellect-ai#749 Defect 1 (PrimeIntellect-ai#738): the standalone update command hard-rejects package targets ('Package updates moved to the package command'), but the TUI kept spawning 'update --extensions' for the advertised /update --extensions flow, so it always exited 1. Non-self updates now spawn 'package update' with legacy flags translated (--extensions -> bare, --extension <src> -> positional, daemon-socket plumbing dropped). Defect 2 (PrimeIntellect-ai#738): npm >= 11 emits a JSON array from 'npm view <pkg> version --json'; comparing ['2.87.2'] !== '2.87.2' made the startup update notice a permanent false positive that funneled users into defect 1. normalizeNpmViewVersion handles both forms and fails loudly on malformed output. PrimeIntellect-ai#749: install.sh's PATH-recovery guidance printed 'npm bin -g', removed in npm 10; it now prints the npm-prefix form.
fixes PrimeIntellect-ai#741 npm 12 defaults allow-remote=none and the published tarball has transitive URL dependencies (R2-hosted runtime packages), so the installer's 'npm install -g' exits with EALLOWREMOTE. 'root' is insufficient because the blocked tarballs are transitive. Scope allow-remote=all to the install invocation via env (no ~/.npmrc changes), gated to npm >= 12 so older versions see no unknown-config warnings. Mechanism and override verified on npm 12.0.2 by @d4not.
|
Noting this for whichever maintainer picks the npm-compat area: given the clean-room approach you used on #717 → #1153 and #731 → #1164, I assume these remaining fix PRs of mine (this one, #721, #722, #723, #724, #730) are also best treated as bug reports rather than import candidates — which is completely fine. Each contains a full diagnosis, a minimal repro, and regression tests that stand alone: the npm-12 EALLOWREMOTE semantics in this one were independently verified by @d4not (comment history). Happy to leave them open as living reports, or convert each into a proper issue if that fits your triage flow better — just say which you'd prefer. The root causes matter more than the diffs. |
|
Hi, thanks for taking the time to contribute to Prime Agent! Since open sourcing the project, we’ve received far more pull requests than we can responsibly review and validate. Prime Agent runs directly on users’ machines, so we need to be deliberate about which changes we accept and how they are reviewed. Rather than leave a large backlog that we cannot meaningfully work through, we’re closing the current PR queue and moving to a discussion-first contribution process. We have established new contribution guidelines to help us continue iterating on Prime Agent and better manage contributions from the community. Going forward, we won’t review unsolicited pull requests. Instead, please start with a GitHub Discussion. We’ll identify recurring bugs and feature requests, create Issues for work we want to pursue, and invite pull requests from maintainers or vouched contributors when implementation is ready. Please read the full process documented in our contribution guidelines. While we’re closing this backlog, we’re still reviewing it at a high level to identify recurring bugs, useful ideas, and important problems that we should address ourselves. Thanks again for the time you put into this! |
|
Makes sense — a local agent that runs on users' machines needs the tighter intake, and discussions-first is the right shape for it. The six reports this account left behind (#721, #722, #723, #724, #730, #773) each contain a full diagnosis and standalone repro/regression tests; if any of them correspond to work you'd want pursued, happy to file them as Discussions with the diagnostics carried over — or just let them stand as reference material while you triage the backlog. Thanks for the deliberate process. |
Fixes #738. Fixes #749. Fixes #741.
Problem
Three faces of one drift: npm's CLI moved (10, 11) and prime-agent's own update-command migration left the TUI behind.
/update --extensionsalways fails (/update --extensionsalways fails with "Update exited with code 1"; update-available notice is a false positive on npm >= 11 #738): the standaloneupdatecommand deliberately hard-rejects package targets ("Package updates moved to the package command",public-command.ts:129) — but the TUI still spawnsupdate --extensionsfor the flow it advertises in the slash hint and the startup notice. Every advertised path exits 1./update --extensionsalways fails with "Update exited with code 1"; update-available notice is a false positive on npm >= 11 #738):npm view <pkg> version --jsonnow emits a JSON array;getLatestNpmVersionparsed it verbatim, and["2.87.2"] !== "2.87.2"is always true — so every startup nags, funneling users into defect 1.npm bin -gPATH instructions on npm 10+ #749):install.shtells users to runnpm bin -g, which npm 10 removed.Change
interactive-mode.ts: non-self updates now spawnpackage updatewith legacy flags translated (translatePackageUpdateArgs:--extensions→ bare,--extension <src>→ positional, daemon-socket plumbing dropped). Self-updates unchanged. The advertised/update --extensionsflow now runs the command the CLI migration intended.package-manager.ts:normalizeNpmViewVersionhandles the npm 10 bare-string and npm ≥ 11 array forms, takes the newest entry, and fails loudly on malformed output.install.sh: PATH guidance printsecho "$(npm prefix -g)/bin"instead ofnpm bin -g.Tests
test/suite/regressions/738-npm-update-compat.test.ts(9 tests, fail on main — the helpers don't exist): all translation shapes, agreement withupdateArgsIncludeSelfabout what routes to the package path, both npm output forms, newest-entry selection, loud rejection of empty/malformed output, and the exact false-positive equality from the report.Neighbor suites (
interactive-mode-effort-command,public-command): 47/47.npm run checkclean, including the installer render gate.Scope notes
EALLOWREMOTEfrom transitive URL dependencies (R2-hosted runtime tarballs),rootinsufficient. The installer scopesnpm_config_allow_remote=allto its ownnpm install -ginvocations via env (no~/.npmrcchanges), gated to npm ≥ 12 so older versions see no unknown-config warnings. Scope notes: the npm self-update step (config.tsmakeSelfUpdateCommandStep) has the same exposure on npm 12; and the deeper fix — publishing without URL transitive deps — is a release-pipeline call, so both are left for maintainers rather than decided here.argumentHintand startup-notice wording still advertise--extensions; they now work as advertised, so the wording is untouched.Note
Fix npm 10+ compatibility in package install and update flows
npm bin -gwithnpm prefix -gin install.sh and addsnpm_config_allow_remote=allenv prefix for npm >= 12 to avoidEALLOWREMOTEerrors from transitive URL dependencies.normalizeNpmViewVersionin package-manager.ts to handle the changed output format ofnpm view <pkg> version --jsonbetween npm 10 (string) and npm 11+ (array)./updateflags into thepackage updatesubcommand syntax, fixing package updates that broke with newer npm CLI argument handling.Macroscope summarized 00d8d19.