Skip to content

Comments

CLI - Notify users if there's an update available#4363

Open
clockwork-labs-bot wants to merge 3 commits intomasterfrom
bot/cli-version-check
Open

CLI - Notify users if there's an update available#4363
clockwork-labs-bot wants to merge 3 commits intomasterfrom
bot/cli-version-check

Conversation

@clockwork-labs-bot
Copy link
Collaborator

@clockwork-labs-bot clockwork-labs-bot commented Feb 20, 2026

Summary

Adds a version update check to the spacetimedb-update proxy, so users are notified when a newer version of SpacetimeDB is available.

Changes

Adds crates/update/src/update_notice.rs — a lightweight update check that runs in the proxy path before exec'ing the CLI:

  • Cache-based: Stores the last check result in ~/.spacetime/.update_check_cache. Only hits the network once every 24 hours.
  • Non-blocking on cache hit: If the cache is fresh, it's a single file read — no network, no delay.
  • Short timeout: When the cache is stale, makes a single HTTP request to GitHub releases API with a 5-second timeout. Uses the same SPACETIME_UPDATE_RELEASES_URL env var as spacetime version upgrade.
  • Best-effort: Any failure (network, parse, file I/O) is silently ignored. The update check never interferes with the user's command.
  • Uses semver: Proper version comparison via the semver crate (already a dependency).

Output

When a newer version is available:

A new version of SpacetimeDB is available: v2.1.0 (current: v2.0.0)
Run `spacetime version upgrade` to update.

Design

Per @bfops's feedback: the check lives in spacetimedb-update (the proxy binary) rather than spacetimedb-cli, reusing the existing release infrastructure. Since spacetime is an alias for spacetimedb-update which proxies to the CLI, this is the natural place for it.

Closes #1822

@bfops bfops changed the title Add CLI version update check CLI - Notify users if there's an update available Feb 20, 2026
Instead of duplicating release-checking logic in spacetimedb-cli,
add the update notice to spacetimedb-update's proxy path. This runs
before exec'ing the CLI, so users see the notice regardless of which
CLI command they run.

Uses the same GitHub releases API and mirror URL as spacetime version
upgrade. Caches the result for 24 hours to avoid network overhead on
every invocation. Network checks use a 5s timeout and are best-effort
(failures are silently ignored).

Closes #1822
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.

CLI - Let users know if there's a new version available

2 participants