Skip to content

feat: support binary self-replacement in upgrade command#81

Merged
rhuanbarreto merged 6 commits into
mainfrom
claude/condescending-taussig
Mar 18, 2026
Merged

feat: support binary self-replacement in upgrade command#81
rhuanbarreto merged 6 commits into
mainfrom
claude/condescending-taussig

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Detects whether archgate was installed via direct binary (install.sh/install.ps1 to ~/.archgate/bin/) or npm package manager, and upgrades 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 strategy (rename running exe to .old, move new binary in place, spawn detached cleanup) 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
  • Package manager upgrade flow remains unchanged

Test plan

  • bun run validate passes (lint, typecheck, format, tests, ADR check, build check)
  • Smoke test archgate upgrade on a binary install (macOS/Linux)
  • Smoke test archgate upgrade on a binary install (Windows)
  • Smoke test archgate upgrade on an npm install (verify existing flow still works)

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.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 18, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

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

View logs

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.
@rhuanbarreto rhuanbarreto merged commit 561c627 into main Mar 18, 2026
8 checks passed
@rhuanbarreto rhuanbarreto deleted the claude/condescending-taussig branch March 18, 2026 23:28
@github-actions github-actions Bot mentioned this pull request Mar 18, 2026
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.
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.

1 participant