Skip to content

feat: add CLI self-upgrade command - #493

Merged
alongubkin merged 5 commits into
mainfrom
alon/alien-577-add-a-self-update-command-to-the-alien-cli
Aug 25, 2026
Merged

feat: add CLI self-upgrade command#493
alongubkin merged 5 commits into
mainfrom
alon/alien-577-add-a-self-update-command-to-the-alien-cli

Conversation

@alongubkin

Copy link
Copy Markdown
Member

Summary

  • add alien upgrade with a visible alien update alias
  • stream and checksum-verify immutable binaries from the stable release channel before atomic replacement
  • delegate npm and Homebrew installations to their package managers
  • add --dry-run and --force safeguards

Research

Reviewed Alien's release workflow, stable S3/CloudFront channel, installer routes, npm wrapper, Homebrew publishing, and public installation docs. Compared Codex, Claude Code, Deno, uv, and mise update behavior. The resulting model follows the common split: standalone installs self-replace; package-managed installs delegate to their owner.

Validation

  • cargo check -p alien-cli --locked
  • cargo test -p alien-cli commands::upgrade --lib
  • cargo test -p alien-cli update_alias_parses_as_upgrade --lib
  • target/debug/alien upgrade --dry-run
  • target/debug/alien update --dry-run
  • npm delegation dry-run via ALIEN_INSTALL_METHOD=npm
  • end-to-end local release server: streamed a checksum-tagged mock v99.0.0 executable, validated it, replaced a copied Alien binary, then executed the replaced path and confirmed alien 99.0.0

Linear: ALIEN-577

Companion docs PR follows.

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds self-upgrade support for standalone, npm, and Homebrew installations, including dry-run and forced same-version reinstall behavior.

  • Downloads stable standalone binaries as a stream, verifies their release checksum and reported version, then replaces the running executable.
  • Delegates package-managed upgrades to npm or Homebrew.
  • Adds post-replacement synchronization and warning-based handling for durability errors.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure is established at the current revision.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/alien-cli/src/commands/upgrade.rs Implements package-manager delegation and checksum-verified standalone replacement, including the follow-up safeguards and synchronization handling.
crates/alien-cli/src/lib.rs Adds the upgrade command, visible update alias, parsing coverage, and early context-free dispatch.
packages/alien-cli-npm/bin/alien.js Marks binaries launched through the npm wrapper so upgrades delegate back to npm.
crates/alien-cli/src/error.rs Adds a structured error variant for upgrade failures.
crates/alien-cli/Cargo.toml Enables streaming downloads and adds the semantic-versioning and executable-replacement dependencies.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[alien upgrade or update] --> B{Installation method}
    B -->|npm| C[npm install -g latest]
    B -->|Homebrew| D[brew upgrade alien]
    B -->|Standalone| E[Fetch stable version]
    E --> F{Newer or forced same version?}
    F -->|No| G[Leave installation unchanged]
    F -->|Yes| H[Stream release binary]
    H --> I[Verify checksum]
    I --> J[Execute version validation]
    J --> K[Replace current executable]
    K --> L[Synchronize replacement]
    L --> M[Report completion]
Loading

Reviews (5): Last reviewed commit: "fix: report completed CLI replacements a..." | Re-trigger Greptile

Comment thread crates/alien-cli/src/commands/upgrade.rs Outdated
Comment thread crates/alien-cli/src/commands/upgrade.rs
Comment thread crates/alien-cli/src/commands/upgrade.rs
Comment thread crates/alien-cli/src/commands/upgrade.rs
Comment thread crates/alien-cli/src/commands/upgrade.rs
Comment thread crates/alien-cli/src/commands/upgrade.rs Outdated
@alongubkin

Copy link
Copy Markdown
Member Author

Production-channel verification passed after CI: copied the locally built PR binary to a temporary path, then ran the temporary binary with alien upgrade --force against the default https://releases.alien.dev. It fetched stable v3.3.18, verified/validated the production artifact, replaced only the temporary binary, and the replaced path executed successfully as alien 3.3.18. Binary comparison confirmed replacement: local debug build 554,816,488 bytes / SHA-256 702592ed..., installed production artifact 191,867,152 bytes / SHA-256 49579f21.... The user-installed CLI was not modified.

@alongubkin
alongubkin merged commit 62f340d into main Aug 25, 2026
25 checks passed
@alongubkin
alongubkin deleted the alon/alien-577-add-a-self-update-command-to-the-alien-cli branch August 25, 2026 22:57
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