Skip to content

feat: show version update notification on CLI startup#380

Merged
notgitika merged 4 commits intoaws:mainfrom
notgitika:feat/update-notification
Feb 23, 2026
Merged

feat: show version update notification on CLI startup#380
notgitika merged 4 commits intoaws:mainfrom
notgitika:feat/update-notification

Conversation

@notgitika
Copy link
Contributor

@notgitika notgitika commented Feb 23, 2026

Description

Adds a non-blocking startup notification that checks npm for newer CLI versions and displays a colored notice. Includes 24-hour caching to avoid slowing down every invocation.

This is how it looks like once you exit the TUI

image

---0

image

Closes #264

Changes

  • src/cli/update-notifier.ts — New module with checkForUpdate() (cache read/write, fetch, compare) and printUpdateNotification() (colored stderr output)
  • src/cli/cli.ts — Fire-and-forget update check at startup; print notification after command completes (CLI) or after TUI exits
  • src/cli/__tests__/update-notifier.test.ts — 10 unit tests covering cache behavior, error handling, and notification formatting

How it works

  1. On every invocation, checkForUpdate() runs concurrently with the actual command
  2. Reads ~/.agentcore/update-check.json — skips network call if last check was < 24h ago
  3. Fetches latest version from npm via existing fetchLatestVersion()
  4. Compares using existing compareVersions() (with prerelease support from fix: handle pre-release versions in compareVersions #357)
  5. After the command finishes, prints a colored notice to stderr if an update is available
  6. Skipped for agentcore update (redundant)
  7. Never throws — all errors silently return null

Test plan

  • npm run format:check passes
  • npm run lint passes
  • npm run typecheck passes
  • npm test — 1747 tests pass including 10 new ones
  • Manual: run agentcore status with an older version → notification appears
  • Manual: run again immediately → uses cache (no network request)
  • Manual: agentcore update → no notification
  • Manual: agentcore (TUI) → notification appears after exit

@notgitika notgitika requested a review from a team February 23, 2026 03:17
@github-actions github-actions bot added the size/m PR size: M label Feb 23, 2026
@github-actions github-actions bot added size/m PR size: M and removed size/m PR size: M labels Feb 23, 2026
@notgitika notgitika requested a review from tejaskash February 23, 2026 21:20
@notgitika notgitika merged commit dd17167 into aws:main Feb 23, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show version update notification on CLI startup

3 participants