Repository navigation
feat(cli): auto-update with versioned layout, verify gate + automatic rollback - #98
Merged
Merged
Conversation
adds verifyStaged() — runs the staged binary with --version and daemon self-check; both must pass before any swap. adds tar + @types/tar deps.
downloadAndStage fetches tarball + runs npm install for native deps in isolation. activate captures previous version before swap so rollback always has a target. rollback is a no-op when previousVersion is absent. pruneOldVersions protects active + previousVersion; removes oldest beyond keep limit. bad-version backoff persists to bad-versions.json with a 1-hour window.
…gration Wires the auto-update pipeline into runDaemon: - migrateFlatInstall on boot (after singleton lock, before sync start) - probation → stable promotion after 60s clean uptime via unref'd timer - runUpdateCheck now downloads, verifies, activates and restarts when outdated + opted-in + version not bad + no update in flight - scheduleDaemonRestart spawns fresh process via currentEntryPath() (resolves through `current` symlink), unrefs, exits so new daemon acquires the lock
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 of 4 tasks
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Existing users only got fixes via a manual nudge/
curl. This makes the CLI auto-update to the latest release, safely — a bad release can never leave a user stuck. Designed + spec'd + planned, then built TDD across 16 commits with independent review of the safety-critical core and a final whole-feature review.How it works
~/.distrotv/versions/<v>/per version + acurrentsymlink to the active one. Shims and Claude hooks resolve through the stable~/.distrotv/current/dist/index.js, so a version swap is invisible to them.install.shlays this out for fresh installs; the CLI self-migrates legacy flat installs on first boot.npm installnative deps into a staging dir → verify (node <staged> --versionmatches ANDdaemon self-checkexits 0) → atomicallyrenameintoversions/<v>+ repointcurrent→ restart throughcurrent.nodeon the staged build before it can becomecurrent.previousVersion) before the symlink swap.probation; healthy ~60s →stable+ prune old (semver-aware, keep last 1).currentto the previous version and marks the bad version (1h backoff). Hooks always resolve throughcurrentand always exit 0.DISTRO_NO_AUTOUPDATE=1orcli.autoUpdate:false. No server gate (yank/replace the release to halt a bad one).distro upgradenow applies the update (download→verify→activate), and is markedstableimmediately (not probation).Verification (on this machine)
auto-update-e2e.test.ts) runs the real pipeline with realnode: happy-path activates, a broken build is rejected (no activation), rollback revertscurrent, opt-out disables. 151/151 CLI tests pass.auto-update.tscaught + fixed: previousVersion-loss window, lexicographic prune bug, staging cleanup. Final whole-feature review: no Critical; two Important (manual-upgrade probation + staging leak) fixed.sh -n install.shall green.Rollout note
Auto-update lives in the CLI, so existing installs only gain it once on the first release that contains it (
cli-v0.2.10+). The first hop still rides the manual nudge/curl/distro upgrade; every update after is automatic. No release is cut by this PR — merging only updates the liveinstall.sh(versioned layout for fresh installs). Design/plan:docs/superpowers/{specs,plans}/2026-05-27-cli-auto-update*(local).Test plan
sh -nget.distrotv.xyz/install.shproduces a runnablecurrent/dist/index.jscli-v0.2.10is cut (separate, on your go): one machine updates 0.2.9→0.2.10 automatically; verify rollback by publishing a deliberately-broken test build to a scratch repo