Skip to content

feat(cli): auto-update when version mismatch detected#1126

Merged
christso merged 7 commits intomainfrom
feat/1125-auto-update
Apr 16, 2026
Merged

feat(cli): auto-update when version mismatch detected#1126
christso merged 7 commits intomainfrom
feat/1125-auto-update

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented Apr 16, 2026

Summary

  • Replaces "Continue anyway?" prompt with "Update now? (Y/n)" when required_version doesn't satisfy the installed version
  • Y → runs self-update inline using the config's version range (e.g., agentv@">=4.1.0 <5.0.0" instead of @latest), preventing unintended major-version jumps, then exits with a re-run message
  • N → continues the command without interruption (no second prompt)
  • Non-interactive and --strict behavior unchanged
  • Extracts shared update logic into self-update.ts so both the version check and agentv self update reuse the same code

Test plan

  • Interactive: version mismatch prompts "Update now? (Y/n)" (single prompt)
  • Y runs the update inline (npm or bun, auto-detected) using the config range, capped at current major (>=4.21.0 <5.0.0)
  • After failed update, prints actionable fallback message ("Run agentv self update manually")
  • N continues the command without interruption (eval proceeds immediately)
  • Non-interactive behavior unchanged (warn + continue, no prompt)
  • --strict behavior unchanged (warn + abort with upgrade hint)
  • agentv self update still works independently (uses @latest)
  • All 2,230 existing tests pass (1686 core + 67 eval + 477 cli)

E2E evidence

Interactive — decline update (N)

Warning: This project requires agentv >=99.0.0 but you have 4.20.0.
? Update now? (Y/n) n
✔ Update now? No
Artifact directory: ...  ← eval continues

Interactive — accept update (Y) with major-version cap

Warning: This project requires agentv >=4.21.0 but you have 4.20.0.
? Update now? (Y/n) y
✔ Update now? Yes
npm ERR! notarget No matching version found for agentv@>=4.21.0 <5.0.0.
Update failed. Run `agentv self update` manually.

Confirms: version range >=4.21.0 <5.0.0 is correctly capped at current major (4.x).

Strict mode

Warning: This project requires agentv >=99.0.0 but you have 4.20.0.
  Run `agentv self update` to upgrade.
Aborting: --strict mode requires the installed version to satisfy the required range.

Non-interactive

Warning: This project requires agentv >=99.0.0 but you have 4.20.0.
  Run `agentv self update` to upgrade.
Artifact directory: ...  ← eval continues

Self update command

$ agentv self update --help
agentv self update
> Update agentv to the latest version
FLAGS:
  --npm, --bun, --help

Closes #1125

🤖 Generated with Claude Code

christso and others added 3 commits April 16, 2026 07:12
Replace "Continue anyway?" prompt with "Update now? (Y/n)" when
required_version doesn't satisfy the installed version. Selecting Y
runs self-update inline using the config's version range (respecting
major-version constraints), then exits with a re-run message. N
continues the command without interruption.

Extract shared update logic into self-update.ts so both the version
check and `agentv self update` command reuse the same code.

Closes #1125

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Intersect the config's required_version range with <(major+1).0.0
so auto-update never pulls in a new major version with potential
breaking changes. E.g., if current is 4.14.2 and range is ">=4.1.0",
installs ">=4.1.0 <5.0.0" instead of ">=4.1.0".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 16, 2026

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4885ef0
Status: ✅  Deploy successful!
Preview URL: https://881f85ad.agentv.pages.dev
Branch Preview URL: https://feat-1125-auto-update.agentv.pages.dev

View logs

christso and others added 4 commits April 16, 2026 07:22
Remove shell: true from spawn() to avoid shell interpretation of semver
operators (>, <, |) in version ranges. Also restore upgrade hint in
strict mode output and unexport runCommand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make it explicit that agents must execute each test plan item from the
issue/PR checklist, mark them [x], and include CLI output as evidence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Step 4: push + draft PR after FIRST commit (not after implementation)
- Step 5: implement incrementally, push at each checkpoint
- Step 6: E2E verification is BLOCKING before marking ready; includes
  checking off test plan items with CLI output evidence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@christso christso marked this pull request as ready for review April 16, 2026 07:44
@christso christso merged commit 8279c34 into main Apr 16, 2026
4 checks passed
@christso christso deleted the feat/1125-auto-update branch April 16, 2026 07:44
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.

feat(cli): Auto-update when version mismatch detected

1 participant