feat: support binary self-replacement in upgrade command#81
Merged
Conversation
Detect whether archgate was installed via direct binary (install.sh/ install.ps1) or npm package manager, and upgrade accordingly. Binary installs fetch the latest release from GitHub Releases API, download the platform-specific archive, and replace the running binary in-place. On Windows, uses rename-then-replace since a running exe cannot be overwritten directly. Extracts binary upgrade helpers into src/helpers/binary-upgrade.ts to stay within the max-lines lint rule.
Deploying archgate-cli with
|
| Latest commit: |
44a0a2c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e982d2a0.archgate-cli.pages.dev |
| Branch Preview URL: | https://claude-condescending-taussig.archgate-cli.pages.dev |
When archgate is installed as a direct binary (~/.archgate/bin/), running `archgate clean` would delete the running binary along with the cache. Now detects binary installs and removes everything except bin/ to avoid self-destruction.
Builds a binary with a fake old version (0.0.1), places it in ~/.archgate/bin/, runs `archgate upgrade`, and verifies the binary was replaced with the latest release from GitHub.
The background update check is redundant and confusing when the user is already running `archgate upgrade`.
Convert the Windows-only smoke test workflow into a matrix job that runs on both Windows and Linux. Validates binary build and self-upgrade on both platforms.
Merged
rhuanbarreto
added a commit
that referenced
this pull request
Mar 20, 2026
* feat: support binary self-replacement in upgrade command Detect whether archgate was installed via direct binary (install.sh/ install.ps1) or npm package manager, and upgrade accordingly. Binary installs fetch the latest release from GitHub Releases API, download the platform-specific archive, and replace the running binary in-place. On Windows, uses rename-then-replace since a running exe cannot be overwritten directly. Extracts binary upgrade helpers into src/helpers/binary-upgrade.ts to stay within the max-lines lint rule. * fix: preserve bin/ directory during clean for binary installs When archgate is installed as a direct binary (~/.archgate/bin/), running `archgate clean` would delete the running binary along with the cache. Now detects binary installs and removes everything except bin/ to avoid self-destruction. * test: add binary self-upgrade smoke test to Windows CI Builds a binary with a fake old version (0.0.1), places it in ~/.archgate/bin/, runs `archgate upgrade`, and verifies the binary was replaced with the latest release from GitHub. * fix: skip update check notice when running upgrade command The background update check is redundant and confusing when the user is already running `archgate upgrade`. * test: add Linux smoke test for binary upgrade Convert the Windows-only smoke test workflow into a matrix job that runs on both Windows and Linux. Validates binary build and self-upgrade on both platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
install.sh/install.ps1to~/.archgate/bin/) or npm package manager, and upgrades accordingly.old, move new binary in place, spawn detached cleanup) since a running exe cannot be overwritten directlysrc/helpers/binary-upgrade.tsto stay within the max-lines lint ruleTest plan
bun run validatepasses (lint, typecheck, format, tests, ADR check, build check)archgate upgradeon a binary install (macOS/Linux)archgate upgradeon a binary install (Windows)archgate upgradeon an npm install (verify existing flow still works)