fix(cli): combine self-update improvements from #3941 and #3859#4005
Merged
Conversation
Add 'reasonix upgrade' (alias: 'reasonix update') to download and apply the latest release from GitHub in-place. Includes '--check' flag for version-only comparison without downloading. The command: - Fetches the latest release from the GitHub Releases API - Compares semver versions (dev builds are skipped) - Downloads the platform-appropriate binary (.tar.gz or .zip) - Verifies SHA256 checksum against the release's SHA256SUMS file - Atomically replaces the running binary via temp+rename Uses the project's existing netclient proxy support so corporate environments work transparently. All user-facing strings are bilingual (en/zh) via the i18n catalogue. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ngine#3859 Merge the best of both PRs per owner review feedback: - List /releases + isCLITag filter instead of /releases/latest (from esengine#3859) Fixes 100% breakage when newest release is desktop-v* or npm-v*. - Add --force flag for reinstalling the same version (from esengine#3859) - Add humanSize for download progress display (from esengine#3859) - Windows two-phase rename (.old) with rollback (new, based on minio/selfupdate) - Keep fail-closed checksum verification from esengine#3941 (hard-abort on mismatch) - Keep full en/zh i18n catalogue from esengine#3941 - Fix extractFromZip double-.exe bug (binName already carries .exe) - Add hide_windows.go / hide_other.go with build tags Refs: esengine#3941, esengine#3859
e5fbecc to
3dcd1c2
Compare
Owner
|
Solid work — combining the namespace filter (#3859) with the fail-closed checksum and i18n (#3941) is exactly what the review asked for, and the Windows two-phase rename with rollback is the right call. I verified the asset-name matching against a real release ( One follow-up I'll take care of separately: |
esengine
added a commit
that referenced
this pull request
Jun 12, 2026
`reasonix upgrade` deliberately tracks the newest 1.x, including rc: only 1.x carries this command and the 1.x line ships as rc on npm @next, so there is no stable user to hold back — the original #4005 already picked the newest v* release regardless of the prerelease flag, and that stays. Extract the selection into a pure pickCLIRelease (foreign desktop-v/npm-v tags skipped) and unit-test it without a network round-trip, including a case that locks in "a newer rc wins". Remove normalizeOS, a no-op returning runtime.GOOS unchanged behind a multi-line comment; real assets are reasonix-<goos>-<goarch>. No behavior change.
esengine
added a commit
that referenced
this pull request
Jun 12, 2026
`reasonix upgrade` deliberately tracks the newest 1.x, including rc: only 1.x carries this command and the 1.x line ships as rc on npm @next, so there is no stable user to hold back — the original #4005 already picked the newest v* release regardless of the prerelease flag, and that stays. Extract the selection into a pure pickCLIRelease (foreign desktop-v/npm-v tags skipped) and unit-test it without a network round-trip, including a case that locks in "a newer rc wins". Remove normalizeOS, a no-op returning runtime.GOOS unchanged behind a multi-line comment; real assets are reasonix-<goos>-<goarch>. No behavior change.
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
Combines the best of #3941 and #3859 per owner review feedback. Addresses all four checklist items: namespace filter ✅, fail-closed checksum ✅, Windows replace ✅, i18n ✅.
What changed from the original #3941
/releases/latestreturns desktop/npm releases/releases+isCLITagfilter (from #3859) — skipsdesktop-v*,npm-v*os.Renamefails on running exe.old→.new→ target, with rollback + best-effort hide (based onminio/selfupdatepattern)extractFromZipdouble.exebugfilepath.Base(f.Name) == name— caller already passesreasonix.exeon Windows--forceflagflag.FlagSet(from #3859)What's kept from #3941
x/mod/semverfor prerelease-correct comparisonNew from #3859
isCLITagnamespace filter--forceflaghumanSizefor download progressChecklist alignment
Files changed
internal/cli/upgrade.go--force, Windows.oldreplace,humanSizeinternal/cli/upgrade_test.goTestIsCLITag,TestHumanSize,TestFetchLatestRelease_FiltersTagsinternal/cli/hide_windows.goSetFileAttributeshidden-file helperinternal/cli/hide_other.gointernal/i18n/i18n.goUpgradeForcingfieldinternal/i18n/messages_en.go--forceusage,UpgradeForcing, download size formatinternal/i18n/messages_zh.goCloses #3859
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com