autoupdate 2/3: Add version check and update marker#1768
Open
yahanxing-stripe wants to merge 1 commit into
Open
autoupdate 2/3: Add version check and update marker#1768yahanxing-stripe wants to merge 1 commit into
yahanxing-stripe wants to merge 1 commit into
Conversation
After each command completes, check for a newer CLI version (once per day max). If a minor/patch update is available, write a marker file to ~/.stripe/state/update-available. Major version changes are skipped. The marker will be consumed by the apply step (next PR in the stack). This is part 2/3 of the auto-update feature for curl-installed binaries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Committed-By-Agent: claude
This was referenced Jul 9, 2026
Comment on lines
+72
to
+84
| func isMajorVersionChange(current, latest string) bool { | ||
| currentMajor := majorVersion(current) | ||
| latestMajor := majorVersion(latest) | ||
| return currentMajor != "" && latestMajor != "" && currentMajor != latestMajor | ||
| } | ||
|
|
||
| func majorVersion(v string) string { | ||
| parts := strings.SplitN(v, ".", 2) | ||
| if len(parts) == 0 { | ||
| return "" | ||
| } | ||
| return parts[0] | ||
| } |
Collaborator
There was a problem hiding this comment.
I think there's a semver library that we use in other places, could we use that here? Just to avoid having to maintain this or have to handle non-semver values
|
|
||
| func fetchLatestRelease() (ver string, downloadURL string, checksum string) { | ||
| client := github.NewClient(nil) | ||
| release, _, err := client.Repositories.GetLatestRelease(context.Background(), "stripe", "stripe-cli") |
Collaborator
There was a problem hiding this comment.
Should we time out after some amount of time?
| } | ||
|
|
||
| func fetchChecksumForAsset(checksumURL, assetName string) string { | ||
| resp, err := http.Get(checksumURL) //nolint:gosec |
Collaborator
There was a problem hiding this comment.
Same question about timeout here
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
~/.stripe/state/update-availablewith version, download URL, and checksumThis is part 2/3 of the auto-update feature for curl-installed binaries.
Stack: #1767 (config) → this → #1769 (apply)
Test plan
recordLastChecktimestamp🤖 Generated with Claude Code