✨ feat: process-rules upgrade updates the CLI in one step
process-rules upgrade updates this Mac's CLI in one step, so a Mac stops quietly running an old release.
- upgrade (
src/upgrade.ts) asks GitHub's publicreleases/latestfor the newest release, with no token. The repo is public, the same way the README's install line works. If that release is newer than the running CLI, it runspnpm add -g <that release's .tgz>and prints old → new, then which copy the shell runs. On the newest release it says so and exits 0. It never moves back. It exits 1, naming the problem, when GitHub can't be reached, when the release has no package attached yet, or when pnpm fails or is missing. - PATH check: afterwards it lists every
process-rulesonPATH, the waytype -adoes. If there's more than one, or the first isn't the new release, it lists each path with its version, marks pnpm's own copy (pnpm bin -g) to keep, names the others to remove, and exits 1. A stray older copy is the failure this slice exists to stop. When nothing was installed and PATH still holds an older copy (for example, running a newer build from elsewhere), it prints thepnpm add -gline instead of saying to remove pnpm's copy. A live run from this worktree's build caught that case: this Mac's PATH copy is 0.5.30. - onboard: its refusal of a newer pin now says
Update this Mac's process-rules first: process-rules upgrade. - doctor: on a Mac it gains the CLI findings: ▲ when a newer release is out (→
process-rules upgrade), ▲ when GitHub can't say, and ✗ when PATH holds another copy. There was no Mac installed-version finding before; only the cloud check had one, and its fix (bash cloud-setup.sh) stays, because a cloud session's CLI comes from that file. - README: install once with the
pnpm add -gline, thenprocess-rules upgrade. Upgrading a client isupgrade, thenonboardagain.docs/decisions.mdrecords P-46.
May it run in an agent session? On a Mac, yes:
- It needs no credential and never signs in.
- It only moves forward, to a release the Release workflow published from
main. - It does exactly what the owner would do by hand, so an agent finishing a release can update the Mac without an owner step.
- The guard still controls
ghand git around it.
In a Claude cloud session it refuses, because the CLI there is the one .github/process-rules/cloud-setup.sh installs at the workflow's pin, not pnpm's.
Notes: GitHub's "latest" is the newest release by date. That is also the highest version, because releases are tagged in order from main. A CLI from before this release has no upgrade, so the README keeps the pnpm add -g line for the first install.
Tests in src/upgrade.test.ts use the fake Sys: install, already newest, no downgrade, stray copies (older or newer, first or second), a copy that doesn't run, nothing on PATH, GitHub unreachable or answering an error, a bad tag, a missing package, pnpm failing or missing, cloud refusal, the command and its arguments, and doctor's findings. The fake answers releases/latest with this checkout's version. pnpm check passes; upgrade.ts has 100% line coverage.
Slice: #192
🤖 Generated with Claude Code
Summary by cubic
Adds process-rules upgrade, which installs the newest GitHub release and checks that the shell runs it, so a Mac stops quietly keeping an old CLI.
upgradereads GitHub's publicreleases/latestwith no token, installs a newer release withpnpm add -g, never moves back, and exits 1 naming the problem when GitHub, pnpm, or the release's package fails.- After an install, or when nothing needed installing, it walks
PATHastype -adoes, reading empty and relative entries against the working folder: when another copy is there or the first is not the new release, it lists each path and version, marks pnpm's copy to keep, names the others to remove, and exits 1. doctoron a Mac gains the CLI findings (▲ newer release out, ▲ GitHub unreachable, ✗ stray copy on PATH).onboard's refusal of a newer pin now says to runprocess-rules upgradefirst.- The command refuses in a Claude cloud session, where
cloud-setup.shinstalls the CLI, not pnpm. - README installs once with
pnpm add -g, then upgrades withprocess-rules upgrade;docs/decisions.mdrecords P-46.