Repository navigation
fix(cli): the patchy CLI survives a Node version change - #944
Conversation
The installer put the CLI in the current Node's global npm prefix, so a Node version manager switching versions left the new Node without it. It now installs into ~/.patchy/cli and links ~/.local/bin/patchy (patchy.cmd on Windows), removes the copy an earlier installer left in the current Node's prefix, and accepts a version manager's shim that hands over to the new install. The package's executable refuses a Node older than 22.22.0 before loading the CLI. Closes #943 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 1: an earlier install whose npm prefix is ~/.local owns ~/.local/bin/patchy and now migrates instead of being refused; a shim that hands over is accepted only when ~/.local/bin is itself on PATH, exits 0, and answers within 30 seconds; dist/bin.js is executable in the checkout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review round 2: when npm's prefix is ~/.local, the advised npm uninstall --global patchy also removes the new launcher, so the advice now ends with rerunning the installer, which restores it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review rounds (GPT-6.1-Sol, xhigh)Round 1 on 16cc840: nothing blocking, four should-fix. All fixed in b781b62.
Round 2 on b781b62: nothing blocking, one should-fix. Fixed in 02ab557.
Round 2 also confirmed both prefix migrations, setup failing after migration, the bounded probe, both files' modes in the checkout and tarball, the installed command on Node 26.12.1 and 22.22.0, and |
Acceptance: PASS with notesChecked All five Done means pass, and the earlier classification blocker is resolved. This follow-up checked the unchanged head, updated PR body and labels against the original isolated acceptance evidence below. The PR now has Done means
Golden journeys
Checks and isolation
Rollback answers: They now match the diff and the evidence. A revert leaves the CLI in Not run
Notes
Main reproduces the bugPaths and instance origins are normalized; login JSON is omitted. Head: fresh install, migration, and both PATH modesPaths and instance origins are normalized; login JSON is omitted. Real old Node, minimum Node, and installer rerunPaths and instance origins are normalized; login JSON is omitted. Rollback installer: passing and failing PATH layoutsPaths and instance origins are normalized; login JSON is omitted. |
Stacked on #944 (ticket #943); merges with #944, after it. ## What changed Every CI job ran on Linux. So the installer's Windows path (cmd quoting, the new `patchy.cmd` launcher, `patchy setup`'s junctions, the PowerShell install line) and everything on macOS had never run in CI. This adds an `install` job on Linux, macOS and Windows for the code that runs on people's machines. ## Look at - **`scripts/packed-install-e2e.mjs`.** A dependency-free script run against the release packed once on Linux and served from a stub instance. On throwaway machines whose home has a space (and a `%` on Windows), with one npm prefix per Node as version managers keep them, it runs: 1. the platform's own install line from `/llms.txt`: POSIX through `sh` and `curl`, PowerShell through Windows PowerShell 5.1, then `patchy --version` in the same shell; 2. a Node switch, 22.22.0 → 26.11.1, with Node 22 removed from PATH and a preload recording which Node actually ran `patchy`, then `validate` and `status --json`; 3. the old-Node refusal; 4. a rerun over its own launcher; 5. `setup --remove`, checked with `lstat` so a dangling link counts, then `setup`, with both links resolving to the copy; 6. `auth set`, then `whoami` and the same file (its name has a space) published twice against the stub, the second as an update from the cached patch id. Each runs in a fresh shell with bare `patchy`, which is Windows PowerShell on Windows; 7. an install an earlier installer left in Node's npm prefix moving; 8. the not-on-PATH message. - **`.github/workflows/ci.yml`.** - `release-tarball` packs the release on `ubuntu-24.04` and uploads `packages/patchy/artifacts`. - `install (linux|macos|windows)` downloads it on `ubuntu-24.04`, `macos-15` and `windows-2025`, sets up both Nodes and runs the script. These jobs need no `pnpm install`. - **`pnpm verify`** runs the same script on the local platform (`pnpm test:packed-install-e2e`), and `docs/DEVELOPMENT.md` says so. **On the head, 535d897** ([run](https://github.com/allisonmahmood/patchy-cloud/actions/runs/40254949092)), all three pass, as they did on every earlier head. The first try of the run failed on `test (24)` with #723, a known dev-server flake in code this PR doesn't touch, and passed on a rerun. The Windows log for this head: ```text [packed-install-e2e] Node a C:\hostedtoolcache\windows\node\22.22.0\x64\node.exe, Node b C:\hostedtoolcache\windows\node\26.11.1\x64\node.exe, release 0.19.0 [packed-install-e2e] a fresh install through the install line, then a Node switch [packed-install-e2e] the executable refuses a Node older than the package needs [packed-install-e2e] a rerun under the other Node reinstalls over its own launcher [packed-install-e2e] setup --remove takes the skill links and copy, and setup puts them back [packed-install-e2e] a saved key, whoami and a file published twice, from a fresh shell with bare patchy [packed-install-e2e] an install an earlier installer left in Node a's npm prefix moves [packed-install-e2e] without ~/.local/bin on PATH it installs, then names the directory to add [packed-install-e2e] PASS on win32 ``` `install (macos)` prints the same steps ending `PASS on darwin`. Run against `main`'s installer, the script fails at the first step, because that installer's `Executable:` is in Node's npm prefix. ## How it was verified - Locally on Linux with real Node 22.22.0 and 26.12.1: PASS in 14 s. It also runs with Node 22.22.0 itself running the script, which imports `packages/api/src/install.ts` through Node's type stripping. - `actionlint` on `ci.yml`, prettier, `eslint scripts/verify.ts` and `pnpm typecheck:tests` pass. - The new jobs aren't required checks. Once a week of runs shows their queue times and flake rate, Allison can add `release-tarball`, `install (linux)`, `install (macos)` and `install (windows)` to the ruleset. `release-tarball` has to be in that list: if it fails, GitHub skips the install jobs, and a skipped required check counts as passing. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required CI and a test script only; nothing ships to the server or the package. - **What does a revert leave behind?** Nothing. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh). --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
… patchy survives a Node update (#962) ## What changed This PR adds release 20's What's new entry, written from `c5175bd`. It covers everything merged since release 19's `through` (`156a228`), and it sets the `patchy` release to `0.20.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. With this release patches can read and answer a company email address on Pidgeon, and the `patchy` command keeps working after a Node version change. | Change | PRs | | --- | --- | | New: Patches can read and answer a company email address | #921, #954, #955 | | Fixed: The patchy command survives a Node update | #944 | | Behind the scenes: Patchy keeps only a key for the connected address, never the Pidgeon admin key | #921 | Two merged PRs get no line: #941 is release 19's own entry, and #945 adds CI install checks on macOS and Windows, which is tooling. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. Its labels are the pages' own: Integrations, Read, Read and send. The 200 sends a day is `pidgeon.sends.daily`'s default. The Node fix says what #944's Release impact asks of the note: people whose terminal doesn't look in `~/.local/bin` are shown the line to add when they rerun the install line. - **Rollback safety, from the live commit `fe8a0f2` to `c5175bd`.** Three PRs in the range are labelled `one-way`: - **#921 and #954 (Pidgeon).** Release 19 hides Pidgeon connections and ignores the new `pidgeon_sends` table, but a patch whose current version declares or calls Pidgeon needs this release to serve. Recovering it means rolling forward. - **#944 (CLI install).** On machines where the new installer put `~/.local/bin/patchy` ahead of Node's own bin on PATH, release 19's install-and-login line refuses after installing. Those people would need to clean that up by hand. - **#955 and #945** answer both Release impact questions with "Yes". `rollback-rehearsal` passed on every landed head, including #954's migration `0028`. ## How it was verified - **Tests.** `whatsNew.test.ts` (4), `WhatsNewPages.test.ts` (6), `schemas.test.ts` (11) and the skill lock (1) pass. Typecheck passes for core, api and the CLI, and so do prettier and eslint on the changed files. - **The stack.** #921, #954 and #955 each had GPT 6.1 Sol reviews to merge-ready and an acceptance verdict of PASS with notes. Each landed after all 21 checks passed on its rebased head, `Pidgeon live` included. Each rebase left the tree byte-identical to the accepted head, and `main`'s tree at `c5175bd` is identical to #955's accepted `cce5019`. - **Deploy state.** The live commit was pinned from `/healthz/deep`: `fe8a0f2`, release 19. The Deploy run updated last succeeded, and none is unfinished. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required This PR changes only the changelog text and the `patchy` version. As with every release, a CLI installed before this deploy is told to upgrade. - **What does a revert leave behind?** Nothing. People whose seen marker reached 20 would just see no new release. - **Does the release before it still work with that?** Yes. Rolling back past #921 and #954 would stop any patch whose current version uses a Pidgeon connection from serving, and rolling back past #944 would break the install-and-login line on machines where the new installer put `~/.local/bin/patchy` ahead of Node on PATH; fix forward instead. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
After a Node version manager switched Node versions,
patchywas gone: the installer had put it in the old Node's npm prefix. The installer now puts the CLI in~/.patchy/cli, beside the skill copy it already made there, with the command at~/.local/bin/patchy, so switching Node keeps it. Rerunning the install line moves an earlier install.Closes #943
Look at
A real mise switch, 26.12.0 → 26.12.1. A throwaway HOME with its own mise data dir holding two Node installs, against this branch's
pnpm devinstance;<tmp>is the throwaway root, andmain-install.mjsismain's installer with this instance's address baked in. Each step runs as a fresh shell, as an agent's commands do.Before: main's installer, then the switch
After: this branch's install line over main's install, then the switch
Leftover copies in other Node versions. The installer removes only the copy in the current Node's npm prefix, and only one that carries Patchy's skill, which tells it apart from npm's unrelated
patchypackage. It never touches other Node installs. A mise shim kept alive by another version's copy hands over to~/.local/bin/patchyby default. So when~/.local/binis on PATH, the check also accepts apatchyahead of it whosepatchy --versionexits 0 with the installed release within 30 seconds. When the shim doesn't hand over (mise withnot_found_system_fallback = false, or an asdf shim), the installer names the fix:Transcript
PATH.
~/.local/binis where Claude Code's and uv's installers put their commands, so it is usually already on PATH. When it isn't, the installer says so with theexport PATH=…line, as it did for npm's bin, and the skill tells agents to call the printed executable by path until then. The installer edits no shell profile and no Windows user PATH. On Windows the command is%USERPROFILE%\.local\bin\patchy.cmd, a one-line forwarder to npm'spatchy.cmd. A~/.local/bin/patchythe installer didn't make is refused before anything downloads. The exception is npm's own link for an earlier install when npm's prefix was~/.local, which is migrated like any other earlier install.Whichever Node is current. The command now runs on the current Node, so the package's
binis a newdist/bin.jsthat refuses Node older than 22.22.0 before it loads the bundle. On real Node 20.19.5 and 22.12.0:Before, Node 20 died in undici with
TypeError: webidl.util.markAsUncloneable is not a function. Node 22.12 ran some commands with no guarantee.How it was verified
packages/sdk/src/install.test.ts: the CLI installs outside Node's npm prefix and runs after that prefix is deleted; an earlier global install is moved, from a per-Node prefix and from~/.localas npm's prefix; when that removal fails the CLI still works, and the cleanup it names plus a rerun restores the launcher; a shim that hands over passes, but not with~/.local/binoff PATH; apatchythat runs first and doesn't hand over is refused; a foreign~/.local/bin/patchyis refused before any download; the existing integrity, old-Node, no-npm and not-on-PATH cases still pass. The EACCES and Volta cases are gone, because the installer no longer writes npm's prefix.packages/patchy/src/cli.test.ts:dist/bin.jsruns the CLI, and refuses Node 22.21.1 as text and as--json.pnpm test:packed-cli-e2e: runs/llms.txt's line on a clean HOME and checksExecutable: ~/.local/bin/patchy, the skill links, the login handoff on both runs, and an empty npm prefix.pnpm patchyis unchanged apart from itsbinmoving todist/bin.js. pnpm links that the same way. The packed tier 1 and tier 2 e2e suites drive a repo'snode_modules/.bin/patchy./llms.txt, the CLI README, ADR-0004,docs/SKILL_DISTRIBUTION.md,docs/product.md, the glossary,docs/API.mdand the throwaway-machine recipe indocs/DEVELOPMENT.mdfollow the change. Theskills-lock.jsonhash is refreshed.pnpm verifyon 02ab557: format, lint, typecheck, synth, test, postgres-concurrency, cli-smoke, tier2-smoke and browser all pass. CI is green on the same head.patchy.cmdforwarder and the%-safe npm arguments are untested), nvm, fnm, asdf, and fish or zsh shells. An independent trace checked nvm and mise mechanics with copied Node installs; what ran here is Linux with real mise.Release impact
Existing installs keep working. On their next upgrade, the install line moves the CLI to
~/.patchy/cliand removes the copy in the current Node's npm prefix. Where~/.local/binisn't on PATH, that upgrade stops after installing and asks for it (export PATH="$HOME/.local/bin:$PATH"), so the release note should say so. A contributor's own~/.local/bin/patchyis refused until moved aside.~/.patchy/cli, the~/.local/bin/patchylink, and no copy in Node's npm prefix.one-way. The server does, and CLIs this installer placed keep running. But on machines where~/.local/bincomes before Node's bin on PATH, the older release's install line refuses after installing, so its install-and-login line stops before login ("~/.local/bin/patchycomes before<Node's bin>/patchyon PATH"). That install line is also the upgrade path after a rollback. Those machines need~/.local/bin/patchyand~/.patchy/clideleted, or that PATH order changed, before it works again. Acceptance reproduced it. Rolling production back past this PR means telling affected people that cleanup, so fix forward instead.Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).