feat(self-update): add maybeOfferUpdate notifier (FR-024)#4
Merged
Conversation
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>
This was referenced Jun 27, 2026
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>
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.
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'srunSelfUpdate.Behavior (designed to never throw into or block the host)
NO_UPDATE_NOTIFIER, when non-interactive (stdin/stdout not both TTYs), or within a 24h per-package throttle cache (<cacheRoot>/update-check.json).lastCheckeven on failure so a flaky registry isn't hit every run).major.minor.patch(-dirty/pre-release ignored), so a local dev build ahead of the release isn't offered a downgrade.[Y/n](Enter = yes) and delegates torunSelfUpdateon accept.Reuses the existing
defaultConfirm(now exported) for an identical prompt. Exposesinteractive/ttlMs/cachePath/now/env/confirmseams for host control + tests.Spec & 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