Skip to content

feat(cli): check for updates on setup/status via /api/cli/latest#202

Draft
vreshch wants to merge 1 commit into
masterfrom
feature/cli-update-check
Draft

feat(cli): check for updates on setup/status via /api/cli/latest#202
vreshch wants to merge 1 commit into
masterfrom
feature/cli-update-check

Conversation

@vreshch

@vreshch vreshch commented Jun 14, 2026

Copy link
Copy Markdown
Member

Option A - the CLI half (autoupdate on setup)

Wires the CLI into the public GET {api}/cli/latest endpoint (agentage/web#334) so setup and status tell the user when to update. No new dependencies.

Behaviour

status (and setup, which ends in a status print) now show an update line:

  • current✓ up to date
  • update-available↑ 0.3.0 available - npm i -g @agentage/cli@latest
  • unsupported (installed < minSupported floor) → red ✗ unsupported, update required - npm i -g @agentage/cli@latest
  • unknown (endpoint unreachable) → dim - update check unavailable

A server message (if set) prints below verbatim. The check runs in parallel with the existing /health reachability probe, so status stays snappy.

Design

  • lib/update-check.ts - pure compareVersions (numeric major.minor.patch, prerelease ignored) + evaluateUpdate + a fetchCliLatest that swallows all errors (offline / 404 / malformed = unknown, never throws). This is the CLI's one no-token server call - it works without auth (the authed API is Bearer-JWT-only and the CLI holds an opaque OAuth token).
  • status-info.ts adds update: UpdateInfo to the report; status.ts renders it.

Verified

  • Unit: 62/62 (new update-check.test.ts covers compare/fetch/evaluate; status.test.ts covers the rendered lines incl. the install hint). type-check + lint + prettier + build green.
  • Live smoke against prod (where /cli/latest 404s until #334 ships): status --json cleanly returns update.status.kind = "unknown", endpoint still reachable: true - graceful degradation confirmed.

Merge order

Ships after agentage/web#334 deploys (so /cli/latest is live); until then the CLI just shows "update check unavailable", which is harmless.

Adds a self-update check: setup (which ends in a status print) and
status now hit the public GET {api}/cli/latest and surface an 'update'
line - up to date / update available (with 'npm i -g @agentage/cli@latest')
/ unsupported (below the server-set minSupported floor) / unavailable.
Pure compare + evaluate logic, fetch swallows errors (offline = no-op),
runs in parallel with the existing reachability probe. No new deps.

Backend half: agentage/web#334.
@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Validation ✅ PASSED

Commit: d8fd662350093d56b39877d50669f75c29cb4971
Branch: feature/cli-update-check

Checks:

  • ✅ Release guard (no version/changelog changes)
  • ✅ Dependencies installed
  • ✅ Type check passed
  • ✅ Linting passed
  • ✅ Format check passed
  • ✅ Tests + coverage passed
  • ✅ Build successful

Ready to merge!


🔗 View workflow run
⏰ Generated at: 2026-06-14T20:44:33.379Z

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