feat(cli): check for updates on setup/status via /api/cli/latest#202
Draft
vreshch wants to merge 1 commit into
Draft
feat(cli): check for updates on setup/status via /api/cli/latest#202vreshch wants to merge 1 commit into
vreshch wants to merge 1 commit into
Conversation
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.
Contributor
|
🎉 PR Validation ✅ PASSED Commit: Checks:
Ready to merge! ✨ 🔗 View workflow run |
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.
Option A - the CLI half (autoupdate on setup)
Wires the CLI into the public
GET {api}/cli/latestendpoint (agentage/web#334) sosetupandstatustell the user when to update. No new dependencies.Behaviour
status(andsetup, which ends in a status print) now show anupdateline:✓ up to date↑ 0.3.0 available - npm i -g @agentage/cli@latest< minSupportedfloor) → red✗ unsupported, update required - npm i -g @agentage/cli@latest- update check unavailableA server
message(if set) prints below verbatim. The check runs in parallel with the existing/healthreachability probe, sostatusstays snappy.Design
lib/update-check.ts- purecompareVersions(numeric major.minor.patch, prerelease ignored) +evaluateUpdate+ afetchCliLatestthat 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.tsaddsupdate: UpdateInfoto the report;status.tsrenders it.Verified
update-check.test.tscovers compare/fetch/evaluate;status.test.tscovers the rendered lines incl. the install hint). type-check + lint + prettier + build green./cli/latest404s until #334 ships):status --jsoncleanly returnsupdate.status.kind = "unknown", endpoint stillreachable: true- graceful degradation confirmed.Merge order
Ships after agentage/web#334 deploys (so
/cli/latestis live); until then the CLI just shows "update check unavailable", which is harmless.