feat(cua-driver-rs): check-update CLI verb + check_for_update MCP tool#1734
Conversation
Add a focused, machine-readable update-check surface so both humans and Hermes-style agents can ask "is there a newer cua-driver?" without scraping `cua-driver update` text output. New surfaces (all share `version_check::check_update_state` so they never disagree on which release is "latest"): - `cua-driver check-update [--json] [--no-cache]` — pure check verb, never installs. Default human text; `--json` for scripted consumers; `--no-cache` bypasses the 20h cache. - `cua-driver update --json` — same structured payload from the existing apply verb. Text behaviour unchanged when `--json` isn't passed. - `check_for_update` MCP tool — read-only, idempotent, empty input schema. Registered from `main.rs` so the dep on `ureq` stays in `cua-driver` and doesn't propagate into `cua-driver-core` (which would break cross-target Windows builds from macOS host via `ring`). Telemetry event `cua_driver_check_update`, docs page at `/cua-driver/guide/getting-started/updating`, SKILL.md one-liner under the shell-management section. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR introduces a complete update-checking feature for ChangesUpdate Check Feature
Sequence DiagramsequenceDiagram
participant User
participant CheckUpdateCLI
participant MCP_LLM
participant check_update_state
participant GitHubAPI
participant DiskCache
User->>CheckUpdateCLI: cua-driver check-update --json
CheckUpdateCLI->>check_update_state: check_update_state(no_cache=false)
check_update_state->>DiskCache: load (20h freshness)
alt Cache valid
DiskCache-->>check_update_state: UpdateState
else Cache miss/stale
check_update_state->>GitHubAPI: fetch latest (accept pre-release)
GitHubAPI-->>check_update_state: release tag
check_update_state->>DiskCache: save UpdateState
end
check_update_state-->>CheckUpdateCLI: UpdateState {update_available, latest_version, ...}
CheckUpdateCLI->>User: JSON stdout
MCP_LLM->>check_update_state: invoke check_for_update tool
check_update_state-->>MCP_LLM: text + structured {update_available, ...}
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cua-driver-rs is pre-1.0 and the CD pipeline marks every release `prerelease=true` by convention (visible on every cua-driver-rs-v* release on `trycua/cua`). The previous filter — written when the banner was added before any release existed — silently stripped them, so both `cua-driver update` and the new `cua-driver check-update` returned "no matching cua-driver-rs-v* release in response" against the real GitHub. Drop the `prerelease` skip in `pick_latest_release`. Drafts are still filtered (drafts are explicitly not for consumption). Doc-comment + unit test renamed + updated to reflect the new behaviour. Verified live: `cua-driver check-update` against 0.3.1 now correctly reports "You're on the latest release." with `latest_version: "0.3.1"` in JSON.
… hardcoded version floor Replace the per-OS MIN_CUA_DRIVER_VERSION soft-warning (hardcoded, rot-prone) with cua-driver's native check-update — the source-of-truth freshness check shipped in trycua/cua#1734 (`check-update --json` CLI verb / `check_for_update` MCP tool). - cua_backend: cua_driver_update_check() shells `check-update --json` (stdin=DEVNULL so a pre-NousResearch#1734 driver that falls through to a stdin read fails fast instead of blocking; timeout-guarded). Returns None when indeterminate (verb absent / offline / error payload / unparseable) so callers stay quiet. cua_driver_update_nudge() formats the one-liner; the startup nudge runs off-thread so the (cached, ~20h) GitHub poll never blocks the first computer_use action. - status: `hermes computer-use status` reports current/latest and an "update available" line via the native check. - update: install_cua_driver(upgrade=True) skips the network re-install when the driver reports it's already on the latest release. - Graceful on pre-NousResearch#1734 drivers (e.g. 0.2.18 on the dev host): verb absent → stay quiet (verified: returns None in ~0.4s). - tests: TestUpdateCheck replaces TestVersionWarning. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Add a focused, machine-readable update-check surface so both humans and Hermes-style agents can ask "is there a newer cua-driver?" without scraping
cua-driver updatetext output.Three new surfaces, all reading from the same primitive (
version_check::check_update_state) so the CLI, MCP, and launch-time banner never disagree on which release is latest:cua-driver check-update [--json] [--no-cache]— pure check verb, never installs. Default text output for humans;--jsonemits the same payload as the MCP tool;--no-cacheforces a fresh GitHub round-trip (bypasses the existing 20h cache).cua-driver update --json— same JSON payload from the existing apply verb. The text behaviour ofcua-driver update(no--json) is byte-for-byte unchanged for backward compat.check_for_updateMCP tool — read-only, idempotent, empty input schema. Mirror ofcheck-update --json. Registered frommain.rsvia a smallregister_into(&mut ToolRegistry)shim so theureq+ rustls + ring dep tree stays incua-driverand never reachescua-driver-core(which would break cross-target Windows builds from macOS host).How Hermes (and any MCP client) will consume this
JSON schema (same shape on both paths):
current_versionCARGO_PKG_VERSION.latest_versioncua-driver-rs-v*tag.nullon fetch failure with no cache.update_availablesource"github_releases"today.checked_atcache_hitinstall_commandnullwhen up-to-date.release_notes_urlnullwhen up-to-date.errorWhat was NOT done (intentional)
--applyoncheck-update— separation of intent. Apply lives onupdate.applyvariant of the MCP tool — installing over MCP forces self-replacement of the running MCP server.maybe_announce_update) untouched.Verification run locally
cargo build --release -p cua-driver(macOS) — clean.cargo check -p platform-windows --target=x86_64-pc-windows-msvc— clean.cargo check -p platform-linux— clean (existing warnings only).cargo test -p cua-driver --bin cua-driver version_check— 22/22 pass.~/.local/bin/cua-driver check-update— text path.~/.local/bin/cua-driver check-update --json | jq .update_available— parseable, branches cleanly.~/.local/bin/cua-driver check-update --no-cache --json— fresh fetch (cache bypassed).~/.local/bin/cua-driver call check_for_update '{}'— MCP path returns the same JSON shape viastructuredContent.~/.local/bin/cua-driver update— text output byte-for-byte identical to pre-change behaviour.~/.local/bin/cua-driver update --json— structured payload, no text noise.~/.local/bin/cua-driver list-tools | grep check_for_update— tool registered on macOS.The existing
cua-driver-rs-v*releases ontrycua/cuaare all markedprerelease=trueon GitHub today, which the canonical filter (pick_latest_release) strips — so live runs currently surface"no matching cua-driver-rs-v* release in response"in theerrorfield. This is pre-existing behaviour shared withcua-driver update; the JSON path still returns a well-formed payload and exits with the documented code, so consumers can detect and report it.Test plan
cua-driver-rs-v*tag and re-verifyupdate_available: true/falseflips correctly across the version boundary.--no-cachetriggers a fresh fetch (delete~/.cua-driver-rs/version_check.jsonand observe re-write).check_for_updateis listed incua-driver list-toolsand returns the same shape.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
check-updatecommand to verify available updates with JSON and cache options.Documentation