feat(cli): add self update command#381
Open
pesap wants to merge 1 commit into
Open
Conversation
5f4f871 to
9f65e80
Compare
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.
Closes #379
Summary
Adds a draft implementation of
torc self update [TARGET_VERSION]under the newselfnamespace. The command is local-only, uses
axoupdaterreceipts to guard eligible standaloneinstaller updates, supports
--token/GITHUB_TOKEN, and gives install-source guidance when thecurrent executable cannot be self-updated.
Draft PR: not ready to merge until maintainer review and forge CI are complete.
Acceptance criteria
torc self update [TARGET_VERSION]under a newselfnamespace.Evidence:
src/cli.rswiresSelfCommandasname = "self";cargo +1.95.0 run --quiet --bin torc -- self update --helpprintsUsage: torc self update [OPTIONS] [TARGET_VERSION].version checks, and ignores
--standalonestartup. Evidence:src/main.rsexcludesCommands::SelfCommand { .. }fromrequires_server; no server config is passed to the commandhandler.
AxoUpdater::new_for("torc"), loads the standalone installer receipt, andchecks that the receipt belongs to
std::env::current_exe()before updating. Evidence:src/client/commands/self_update.rscallsAxoUpdater::new_for(APP_NAME),load_receipt(), andcheck_receipt_is_for_this_executable()beforerun_sync().--tokenand
GITHUB_TOKEN. Evidence:SelfUpdateArgshas optionalTARGET_VERSIONand#[arg(long, env = "GITHUB_TOKEN")]; tests cover tag vs plain semver target routing.available for standalone installer installs. Evidence: missing-receipt unit test and manual CLI
command return exit 1 with the standalone installer requirement.
Docker, site-managed, and manual archive installs. Evidence:
unsupported_install_guidance()andmissing-receipt test assert the guidance categories.
opaque error. Evidence:
is_github_rate_limit()maps unauthenticated 403/429 reqwest errors to atoken-focused message.
cargo +1.95.0 test self_updateruns 5 passing tests including missing receipt and help output.Deviations from the original plan
archives, not cargo-dist installer assets/receipts, so actual successful self-update requires a
standalone installer distribution path to exist. This should stay as a follow-up if desired.
cargo +1.95.0locally because the active default toolchain was Rust 1.92 while the crate nowrequires Rust 1.95.
Testing Strategy
References
torc self updatecommand #379torc self updatecommand #379