Add luca update command to upgrade to the latest GitHub release#45
Merged
albertodebortoli merged 1 commit intomainfrom Mar 24, 2026
Merged
Add luca update command to upgrade to the latest GitHub release#45albertodebortoli merged 1 commit intomainfrom
luca update command to upgrade to the latest GitHub release#45albertodebortoli merged 1 commit intomainfrom
Conversation
Implements a new `update` CLI command that fetches the latest release from the GitHub API, compares it against the running version, and installs the new binary if one is available. Reuses the existing self-update install infrastructure via a shared `performUpdate(from:to:)` method, keeping both the pinned-version and explicit-update flows in sync. Key changes: - New `UpdateCommand` (LucaCLI) wires up `luca update` via ArgumentParser - `SelfUpdater.updateToLatest(currentVersion:)` fetches `/releases/latest`, normalises `v`-prefixed tags, and delegates to `performUpdate` - `LatestReleaseInfo` is a minimal Decodable model for the GitHub API response - `SelfUpdating` protocol gains `updateToLatest(currentVersion:)` - `SelfUpdater` now accepts an injectable `DataDownloading` dependency - New `latestVersionFetchFailed(Int)` error case with localised description - Tests extended: `DataDownloaderMock` gains `.rawData` and `.error` cases; seven new `updateToLatest` test scenarios added Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
luca updateCLI command that fetches the latest release from GitHub and installs it if a newer version is availableperformUpdate(from:to:)method so bothupdateIfNeeded(pin-based) andupdateToLatest(explicit update) reuse the same download-extract-install flowLatestReleaseInfoDecodable model andlatestVersionFetchFailederror case; injectsDataDownloadingintoSelfUpdaterfor testabilityTest plan
swift buildpasses (macOS)swift testpasses — 225 tests, all greenluca updatewhen already on the latest version prints "✅ luca X.Y.Z is already up to date."luca updatewhen a newer release is available downloads and installs the new binaryluca updatewith no network prints a clear error🤖 Generated with Claude Code