feat: insta upgrade + autoupdate (on by default while pre-1.0)

Merged
TO
4mo ago
+212-0

Adds Railway-style self-update so staleness stops being the user's problem during the fast-moving 0.0.x phase:

  • insta upgrade — channel-aware: native binary re-runs the checksummed release installer into its own dir; npm installs run npm i -g insta@latest; source checkouts get a git-pull hint.
  • Background version check — detached __update-check (hidden) caches the npm registry's latest (24h TTL). Start-up never blocks: sync cache read + detached spawns only.
  • Auto-update ON by default (pre-1.0) — when a newer version is known, the next invocation spawns a quiet detached upgrade + one stderr line; hourly throttle prevents retry loops. Disable: insta autoupdate off or INSTA_NO_AUTOUPDATE=1. Source checkouts only nudge.
  • insta autoupdate [on|off] — persisted in ~/.insta/config.json (autoUpdate).

Tests: +6 (semver, channel detection, cache round-trip, decide matrix incl. throttle) — 32/32 green. Verified live from source: nudge on stderr, help entries, status output.

Suggested follow-ups (separate): server-side minimum-version gate on the platform; skills cli-reference update for the two new commands.

🤖 Generated with Claude Code


Summary by cubic

Adds channel-aware self-update to the insta CLI with a new insta upgrade command and auto-update enabled by default pre-1.0. Background checks cache the latest version and trigger a quiet, detached upgrade without blocking startup.

  • New Features

    • insta upgrade: binary uses the release installer in-place; global npm installs run npm i -g insta@latest; source checkouts get a git-pull hint.
    • Background check: hidden insta __update-check caches the npm latest for 24h at ~/.insta/update-check.json; startup reads cache sync and only spawns detached tasks.
    • Auto-update: on by default until 1.0; when a newer version is known, the next run spawns a silent upgrade and prints one stderr line; hourly throttle; source only nudges.
    • insta autoupdate [on|off]: persists to ~/.insta/config.json (autoUpdate); INSTA_NO_AUTOUPDATE=1 also disables.
    • Tests: +6 covering semver compare, channel detection, cache round-trip, and decision logic with throttle.
  • Migration

    • No action needed. To disable, run insta autoupdate off or set INSTA_NO_AUTOUPDATE=1. To update manually, run insta upgrade.