feat: add update command and passive version-check notification#6
Merged
Conversation
Add `flashduty update` to check for and install the latest release, and a background version check that reminds users to update after a 24-hour interval. The update command shells out to the existing install scripts rather than replacing the binary in-process.
- Add explicit error ignoring for fmt.Fprintf and resp.Body.Close - Clear CI env vars in tests so ShouldCheck doesn't short-circuit on GitHub Actions runners - Set USERPROFILE alongside HOME for Windows test compatibility - Use unambiguously invalid YAML for corrupt state file test
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
flashduty updatecommand that checks GitHub Releases for the latest version and shells out to the existing install script (install.sh/install.ps1) to perform the upgradeflashduty update --checkflag for check-only mode (no install)draft: truetodraft: falseso the/releases/latestAPI endpoint returns published releasesGating logic (passive check is skipped when)
devor(devel)(local build)FLASHDUTY_NO_UPDATE_CHECK=1is setCI,GITHUB_ACTIONS,JENKINS_URL,GITLAB_CI)~/.flashduty/state.yaml)updateorversionNew files
internal/update/check.go— version check logic, state file, GitHub API, semver comparisoninternal/update/check_test.go— 14 test casesinternal/cli/update.go—flashduty updateCobra commandModified files
internal/cli/root.go— PersistentPreRun/PersistentPostRun hooks, register update command.goreleaser.yml—draft: falseTest plan
go test -race ./internal/update/...passesgo test -race ./...passesflashduty update --checkprints current vs latest versionflashduty updatedownloads and installs latest version via install scriptflashduty version) does NOT trigger background check (excluded command)FLASHDUTY_NO_UPDATE_CHECK=1suppresses the background check