Skip to content

feat: update notifier + `labdev upgrade` self-update

Akram GASSEM requested to merge feat/update-notifier into main

Tell devs when a newer release exists and let them update in place, instead of silently running a stale binary.

  • internal/selfupdate: latest-release lookup (GitLab releases API), internal semver compare (no new dep), verified download (SHA256SUMS), in-place binary replace (os.Rename on Unix, rename-swap on Windows via os.Executable), and a 24h-throttled on-disk check state next to setup.yaml.
  • Passive notice: cmd.Execute prints a one-line "update available" hint on success. Best-effort, silent on failure, throttled to ≤1 network call/day. Suppressed on dev builds, non-TTY, CI, and via LABDEV_NO_UPDATE_CHECK.
  • labdev upgrade [--check] [--version <tag>] [--yes]: Cobra-only (not exposed to the Command Registry / API — no remote self-rewrite). Resolves the release source from setup.yaml's forge-url (fallback: canonical forge), auth via GITLAB_TOKEN.
  • README: "Updating" section.

Tests cover version compare, throttle, notice guards, asset-name mapping, and checksum verification (no network — fetch is injected).

Merge request reports

Loading