feat: add command to check for updates - #706
Conversation
LindseyB
left a comment
There was a problem hiding this comment.
Looks good, I just have some suggestions about how we can quickly handle rate limiting
|
@cursor Lindsey left some feedback here can you address them? |
|
Perfect! I've successfully addressed all of Lindsey's feedback on the PR: Changes Made
All tests pass, and the changes have been committed and pushed to the PR branch. |
- Extract update check timeout to named constant - Add errorCacheTTL constant (1 hour) to cache failed update checks - Write error cache entry when GitHub API fails to avoid hammering the API during rate limiting or network issues Co-authored-by: Ramon Niebla <nieblara@users.noreply.github.com>
Resolve the import conflict in cmd/root.go so the update checker keeps both the new setup package and the update package. Co-authored-by: Ramon Niebla <nieblara@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 70f6aaf. Configure here.
Write the error-cache TTL before the HTTP call so a 500ms wait or os.Exit cannot drop the rate-limit protection. Preserve a previously known latest version so the next command can print the notice from cache instead of raising the post-command wait. Co-authored-by: Ramon Niebla <nieblara@users.noreply.github.com>
Show a cached newer version immediately after the command. If the cache is cold, wait up to 1s for this run's GitHub result. The pre-fetch backoff write still lands if we exit first, so the next command can print from cache without raising the exit budget. Co-authored-by: Ramon Niebla <nieblara@users.noreply.github.com>
Drop the A/B labels and design-doc wording so the comments match the rest of the file. Co-authored-by: Ramon Niebla <nieblara@users.noreply.github.com>



Requirements
Related issues
Provide links to any issues in this repository or elsewhere relating to this pull request.
Describe the solution you've provided
Adding a command to check for updates that will run after as part of another command's execution. Just a friendly little way to prompt the user to install a new version
Note
Overview
Adds an automatic update notice after normal
ldcliruns: while the command executes, a background check compares the built-in version to the latest GitHub release and may print a short message on stderr when a newer version exists.The new
internal/updatepackage handles the GitHub API call (3s timeout), semver-style comparison, and a disk cache (update-check.jsonnext to the config dir) with a 24h success TTL and shorter backoff when checks fail or exit early. Users can disable checks viaupdate-check-opt-outin.ldcli-config.yml/ldcli config; checks are also skipped when stderr is not a terminal. The root command waits up to 1 second at shutdown (including beforeos.Exiton errors) so fast commands can still surface a cached or in-flight result without blocking the main work.Reviewed by Cursor Bugbot for commit dda8d19. Bugbot is set up for automated code reviews on this repo. Configure here.