feat(cli): add odek upgrade self-update command - #119
Merged
Conversation
Self-upgrade from GitHub Releases with OS/arch autodetection: - Maps runtime.GOOS/GOARCH to the odek-<goos>-<goarch> release asset; unsupported platforms get a clear build-from-source error - Fetches the latest release via the GitHub API and semver-compares against getVersion(); dev/commit-hash builds always count as older - Verifies the download against the release checksums.txt (SHA-256) and refuses unverifiable or mismatching installs - Installs atomically: temp dir next to the target binary, chmod to the original mode, os.Rename over the running binary; permission failures suggest sudo - --check reports the available upgrade without installing Tests (httptest fake release server): version compare, checksum parsing, platform mapping, end-to-end replace with mode preservation, up-to-date short-circuit, --check no-touch, checksum-mismatch refusal, API parsing. Also verified live: dev binary upgraded itself to v1.16.0 from GitHub.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
odek | 4dabec3 | Commit Preview URL Branch Preview URL |
Jul 27 2026, 11:02 AM |
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
New
odek upgrade [--check]command: self-upgrade from GitHub Releases with OS/arch autodetection.Behavior
runtime.GOOS/GOARCHto theodek-<goos>-<goarch>release asset (darwin/linux × amd64/arm64); unsupported platforms get a clear build-from-source errorrepos/BackendStack21/odek/releases/latestvia the GitHub API, semver-compares againstgetVersion(); dev/commit-hash builds always count as older; prints "up to date" when current ≥ latestchecksums.txt+ the asset, requires a matching SHA-256 (refuses unverifiable installs and checksum mismatches), then replaces the binary atomically: temp dir next to the target →chmodto the original mode →os.Rename(same filesystem). Permission failures suggestsudo odek upgrade--check— reports the available upgrade without touching the binaryTesting
cmd/odek/upgrade_test.goagainst an httptest fake release server: version compare, checksum parsing, platform mapping, end-to-end replace with mode preservation, up-to-date short-circuit,--checkno-touch, checksum-mismatch refusal, API payload parsingcmd/odeksuite green;gofmt/go vetcleanupgrade --check(correctly offered9a0c0fa → v1.16.0on darwin/arm64), thenupgrade— downloaded, verified, self-replaced, and reportedodek v1.16.0Docs:
docs/CLI.mdcommand row, usage text inmain.go, layout entry inAGENTS.md.