Skip to content

feat(cli): add origin-aware CLI update command#18

Merged
francoischalifour merged 9 commits into
mainfrom
fc/add-auto-updater-system
Jul 2, 2026
Merged

feat(cli): add origin-aware CLI update command#18
francoischalifour merged 9 commits into
mainfrom
fc/add-auto-updater-system

Conversation

@francoischalifour

Copy link
Copy Markdown
Member

Users need a first-class way to discover and install new Altertable CLI releases without manually checking npm or GitHub. The CLI also ships in multiple forms, so update behavior has to respect how the current process was installed:

  • Native release binary
  • npm-style JavaScript package
  • Bun/source checkout

A single overwrite path would be risky, especially for source checkouts and package-manager installs.

What Changed

Adds a new altertable update command for release discovery, installation, and automatic update-check configuration.

The main flows are:

  • altertable update
    Checks the latest CLI release and reports whether an update is available.

  • altertable update --install
    Installs the latest available release using an origin-aware strategy.

  • altertable update --status
    Shows cached update metadata and the current automatic-check interval.

  • altertable update --check-interval daily|weekly|never
    Configures automatic human-facing update notices.

  • altertable update --clear-cache
    Clears cached update metadata.

  • altertable update --target-version <version>
    Checks or installs an explicit version instead of discovering latest.

Installation Behavior

--install chooses the safest installer for the current execution origin:

  • Native compiled binaries download GitHub release assets, verify checksums.txt, and replace the current binary using a backup/rename flow.
  • npm-style installs run the detected global package manager and verify the result with altertable --version.
  • Source/Bun checkouts are rejected in auto mode so development trees are updated with git instead of being overwritten by release artifacts.

Users can override the install strategy with:

altertable update --install --install-method package-manager
altertable update --install --install-method github-binary

Automatic Notices

After successful human-facing commands, the CLI can perform a quiet update check and print notices to stderr only. These checks are disabled for:

  • --json
  • --agent
  • CI
  • non-TTY output
  • altertable update
  • altertable completion

Environment overrides are also supported:

ALTERTABLE_NO_UPDATE_CHECK=1
ALTERTABLE_UPDATE_CHECK=never
ALTERTABLE_UPDATE_INSTALLER=bun|npm|pnpm|yarn
ALTERTABLE_UPDATE_INSTALL_METHOD=auto|package-manager|github-binary

Testing

  • Added updater unit coverage for version comparison, npm/GitHub release discovery, checksum parsing, binary replacement, package-manager installs, automatic notice policy, and command output.
  • Kept updater tests hermetic with fake fetch implementations and temporary executable scripts.

@francoischalifour francoischalifour merged commit 5077028 into main Jul 2, 2026
4 checks passed
@francoischalifour francoischalifour deleted the fc/add-auto-updater-system branch July 2, 2026 09:02
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.

2 participants