Repository navigation
Conversation
Check for latest release on GitHub, compare against installed version, prompt for confirmation, download with checksum verification, and atomically replace the running binary. Features: - Detects current binary path automatically - OS/arch detection (linux/darwin, x86_64/aarch64) - Primary: parse GitHub 302 redirect (no API rate limit) - Fallback: GitHub REST API - SHA256 checksum verification from release assets - Archive path traversal protection (CWE-22) - Atomic rename replace (safe on POSIX) - New binary verification before swap - --yes flag for non-interactive / CI use - Already-up-to-date detection (skip download) - Missing dev headers warning for cargo-installed binaries Closes #581
| "https://github.com/{REPO}/releases/download/{latest_version}/checksums-sha256.txt" | ||
| ); | ||
|
|
||
| println!("[INFO] Verifying checksum ..."); |
| println!("[WARN] Checksum for {archive_name} not found — skipping verification"); | ||
| } | ||
| } else { | ||
| println!("[WARN] Failed to download checksums — skipping verification"); |
| return Err(format!( | ||
| "New binary failed to run: {}", | ||
| String::from_utf8_lossy(&output.stderr) | ||
| ) |
| "x86_64" => "x86_64".to_string(), | ||
| "aarch64" => "aarch64".to_string(), | ||
| arch => arch.to_string(), | ||
| } |
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (4)
Review powered by cora-cli · BYOK · MIT |
Collaborator
Author
|
Closing in favor of fix PR with corrected naming (Update → Upgrade) and all compilation errors resolved. |
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 #581
Summary
Add
uteke updateCLI subcommand that checks for the latest release, compares against the installed version, prompts for confirmation, and downloads + atomically replaces the binary in-place.User Flow
Implementation
Files changed
crates/uteke-cli/Cargo.toml— addedsha2,flate2,tardepscrates/uteke-cli/src/cli.rs— addedUpdate { yes }variant toCommandsenumcrates/uteke-cli/src/commands/mod.rs— module declaration + dispatchcrates/uteke-cli/src/commands/update.rs— new file (~200 lines)Key design decisions
checksums-sha256.txtrelease asset..components.newtemp file first, thenfs::rename(atomic on POSIX)--versionon new binary before replacing--yes/-y— skip confirmation (useful for CI/cron)Dependencies added
sha2flate2tar