Skip to content

feat(self-update): add maybeOfferUpdate notifier (FR-024)#4

Merged
kreneskyp merged 2 commits into
mainfrom
feat/update-notifier
Jun 27, 2026
Merged

feat(self-update): add maybeOfferUpdate notifier (FR-024)#4
kreneskyp merged 2 commits into
mainfrom
feat/update-notifier

Conversation

@kreneskyp

Copy link
Copy Markdown
Contributor

What

A shared, framework-agnostic update notifier (maybeOfferUpdate) so every npm-distributed IX CLI (quoin, ix-flow, …) can tell the user a newer version is published and offer to install it — without re-implementing the throttled check or the prompt. Builds on FR-023's runSelfUpdate.

Behavior (designed to never throw into or block the host)

  • Skips in CI, on NO_UPDATE_NOTIFIER, when non-interactive (stdin/stdout not both TTYs), or within a 24h per-package throttle cache (<cacheRoot>/update-check.json).
  • Swallows any registry/cache failure (records lastCheck even on failure so a flaky registry isn't hit every run).
  • Offers only strictly-newer versions by numeric major.minor.patch (-dirty/pre-release ignored), so a local dev build ahead of the release isn't offered a downgrade.
  • Prompts [Y/n] (Enter = yes) and delegates to runSelfUpdate on accept.

Reuses the existing defaultConfirm (now exported) for an identical prompt. Exposes interactive/ttlMs/cachePath/now/env/confirm seams for host control + tests.

Spec & tests

  • New FR-024 (Update Notifier) tracing to StR-003; matrix updated (test-file map, StR-003 row, 6 AC rows).
  • 10 unit tests (update-notifier.test.ts): CI/opt-out/non-interactive/throttle skips, accept→install, decline, equal/dev-ahead no-prompt, cache throttling, registry-failure swallow. Full suite: 238 pass.

🤖 Generated with Claude Code

A shared, framework-agnostic update notifier so every npm-distributed IX CLI
can tell the user a newer version is published and offer to install it —
without re-implementing the throttled check or prompt.

maybeOfferUpdate():
- never throws into or blocks the host: skips in CI, on NO_UPDATE_NOTIFIER,
  when non-interactive, or within a 24h per-package throttle cache
  (<cacheRoot>/update-check.json), and swallows registry/cache failures;
- queries latest via the FR-023 registry helper (same ambient-config default
  and scope-specific --registry override);
- offers only strictly-newer versions (numeric major.minor.patch; -dirty/
  pre-release ignored) so a dev build ahead of the release isn't downgraded;
- prompts [Y/n] (Enter = yes) and delegates to runSelfUpdate on accept.

Exports the helper + result/option types; reuses the existing defaultConfirm
(now exported) for an identical prompt. Adds FR-024 + matrix coverage and 10
unit tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Code-review finding: when the user accepted the offer but the install failed,
the generic outer catch returned {checked:false, reason:"error"}, dropping
latest/updateAvailable and mislabeling the check as not-run. Catch the install
failure locally and return {checked:true, updateAvailable:true, updated:false}.
Add a test for the accept→install-failure path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kreneskyp kreneskyp merged commit 29ee8a0 into main Jun 27, 2026
3 checks passed
@kreneskyp kreneskyp deleted the feat/update-notifier branch June 27, 2026 14:39
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