Skip to content

feat: keep preview on npm's latest by itself - #2

Merged
cloudycotton merged 1 commit into
mainfrom
feat/auto-update
Oct 18, 2026
Merged

cloudycotton merged 1 commit into
mainfrom
feat/auto-update

Conversation

@cloudycotton

@cloudycotton cloudycotton commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Auto-update from design section 7, without signatures for now.

  • Check: any command starts a detached preview __update when the last check is more than 6 h old. It never blocks the command or writes to stdout.
  • Install: it reads @runablehq/preview-<platform> from the registry, downloads latest, checks the sha512 against the registry's integrity field, checks the new binary prints preview <v>, and installs it under ~/.runable/preview/versions/<v>.
  • Hand-off: at start, a binary execs the newest installed version named in ~/.runable/preview/current, so read-only installs (/usr/local/bin, images) update too.
  • Rollback: deprecate the version on the platform packages and move latest back.
  • Controls: PREVIEW_UPDATE=0, PREVIEW_VERSION=<v>, PREVIEW_REGISTRY=<mirror>, preview upgrade. preview --version now says preview 0.2.0 (checked 2 h ago), so the release workflow's version checks match on the prefix with updates off.
  • Smoke scenarios: update, rollback, corrupted tarball, and pin and opt-out, against a static fake registry (tests/registry.py).

Machines on 0.1.0 have no updater, so they need this release installed once by hand. After that they follow latest on their own.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Any command starts a detached update check when the last one is more
than 6 hours old; it never blocks the command or writes to stdout. The
check reads this platform's package from the registry, downloads the
latest tarball, verifies its sha512 against the registry's integrity
field, checks the new binary prints its version, and installs it under
~/.runable/preview/versions/<v>. At start a binary hands off to the
newest installed version, so it works for read-only installs too.

Deprecating a version and moving latest back rolls machines back.
PREVIEW_UPDATE=0 turns it off, PREVIEW_VERSION pins a version,
PREVIEW_REGISTRY points at a mirror, and `preview upgrade` checks now.

Smoke scenarios cover update, rollback, a corrupted tarball, and the
pin and opt-out controls against a static fake registry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudycotton
cloudycotton merged commit ba307ce into main Oct 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant