Skip to content

feat(no-ticket): add update notifications and cloudsmith upgrade - #399

Draft
cloudsmith-iduffy wants to merge 1 commit into
masterfrom
feat/update-check-and-upgrade
Draft

feat(no-ticket): add update notifications and cloudsmith upgrade#399
cloudsmith-iduffy wants to merge 1 commit into
masterfrom
feat/update-check-and-upgrade

Conversation

@cloudsmith-iduffy

Copy link
Copy Markdown
Contributor

Description

The CLI now tells users when a newer version exists and gives them a working path to it, whatever way they installed it.

The version metadata already existed: the release workflow publishes a per-target manifest.txt raw package to the public cloudsmith/cli repository, with a versions/latest alias (the Homebrew formula's livecheck polls it today). The CLI now polls the same endpoint — no server-side or workflow changes.

Update notice. At most once a day, a daemon thread fetches the latest manifest alongside whatever command is running and caches {checked_at, latest_version} in the app directory. When a newer version is cached, a two-line notice prints on stderr after the command. The check stamps the cache before fetching, waits at most one second at exit, and stays silent in CI, without a TTY, in -F json modes (re-checked at close time, after the subcommand parses its own -F), under cloudsmith mcp, and when CLOUDSMITH_NO_UPDATE_CHECK=1 is set. All HTTP goes through the shared session, so proxies and custom CAs keep working. The startup-import guard stays green — requests/tomlkit are deferred.

cloudsmith upgrade (alias update). Detects the install channel:

  • Standalone binary: self-updates — fetches the manifest for its own runtime-detected target, downloads the archive, verifies the sha256 from the manifest, extracts, and atomically swaps the install directory (rollback on failure). Windows refuses with instructions for now (the running exe is locked; a deferred-swap helper is a follow-up).
  • pip / pipx / uv tool / uv pip / Homebrew / Docker / aqua: prints the exact upgrade command for that channel. The CLI does not drive foreign package managers, matching what gh and rustup do.

Channel detection: frozen builds by executable path (aqua dir, Homebrew Cellar, official container image layout — /.dockerenv, /run/.containerenv, or Kubernetes env), Python installs via the distribution path and INSTALLER record.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

Deliberately deferred: Windows self-swap, a channel-agnostic metadata.json in the release workflow (room for announcements and minimum-version messaging), an embedded build-target file in the PyInstaller bundle, GPG verification of Linux archives during self-update, and a config-file key for the opt-out.

Two behaviors to weigh in review: the notice also prints after a failing command, and it arms on --help/--version. Both match npm-style update notifiers; easy to restrict if we'd rather not.

Smoke-tested live: the manifest endpoint answers anonymously in about a second, and cloudsmith upgrade correctly reports up to date on 1.25.0.

🤖 Generated with Claude Code

The release workflow publishes a per-target install manifest to the
public Cloudsmith raw repository with a versions/latest alias. The CLI
now polls that manifest to learn the latest released version.

A background thread refreshes a cached latest-version record at most
once a day and a notice is printed on stderr when a newer version
exists. The check rides alongside the command and waits at most one
second at exit, at most once a day. It stays silent in CI, without a
TTY, in JSON output modes, under `cloudsmith mcp`, and when
CLOUDSMITH_NO_UPDATE_CHECK is set. All HTTP goes through the shared
session so proxy and custom-CA setups keep working.

`cloudsmith upgrade` (alias: `update`) detects the install channel.
A standalone binary downloads the archive for its own target, verifies
the manifest checksum and swaps the install directory atomically. The
pip, pipx, uv, Homebrew, Docker and aqua channels get the exact
upgrade command for that channel printed instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant