Skip to content

cli: add update check + self-update command #40

Description

@timbrinded

Summary

Add first-class update awareness to hlgo:

  1. Detect when a newer release exists.
  2. Provide a CLI command to update the binary in place.

Problem

Today users must manually discover and install new versions. That increases drift and slows rollout of fixes.

Goals

  • Expose a machine-readable way to know whether an update is available.
  • Provide an explicit command to update to the latest release (or a specific version).
  • Keep behavior safe, deterministic, and scriptable.

Proposed UX

  • hlgo version --check (or hlgo update --check) returns JSON with:
    • current_version
    • latest_version
    • update_available (bool)
  • hlgo update installs the latest compatible release for current OS/arch.
  • hlgo update --version vX.Y.Z installs a pinned version.
  • hlgo update --dry-run prints planned artifact URL + target install path without modifying filesystem.

Requirements

  • No auto-update side effects on normal command execution.
  • Structured JSON output and stable error codes.
  • Verify checksums/signatures of release artifacts before replacing binary.
  • Atomic replace strategy (download -> verify -> swap) with rollback on failure.
  • Respect install location overrides when possible.

Non-goals

  • Background updater daemon.
  • Silent automatic updates during trading commands.

Acceptance Criteria

  • Update check endpoint integration (GitHub Releases or equivalent) with retry/error handling.
  • hlgo update command implemented with latest + pinned version support.
  • Dry-run mode for update command.
  • Integrity verification before install.
  • Cross-platform behavior documented (Linux/macOS at minimum).
  • Unit tests for version parsing, channel selection, and failure modes.
  • E2E test for successful update flow in CI-safe mocked environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions