feat(selfupdate): added automatic version check on CLI startup#59
feat(selfupdate): added automatic version check on CLI startup#59rios0rios0 wants to merge 1 commit intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
There was a problem hiding this comment.
Pull request overview
Adds a passive self-update version check during CLI startup so users can be warned when their code-guru binary is out of date, leveraging new functionality in cliforge.
Changes:
- Bumped
github.com/rios0rios0/cliforgedependency to a newer pseudo-version that includes the passive update check feature. - Invoked
CheckForUpdates()on startup in the CLI entrypoint. - Documented the new behavior in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
go.mod |
Updates cliforge dependency version. |
go.sum |
Updates checksums for the new cliforge version. |
cmd/code-guru/main.go |
Calls the self-update check during startup. |
CHANGELOG.md |
Notes the new automatic version check behavior. |
| appContext := injectAppContext() | ||
| addSubcommands(cobraRoot, appContext) | ||
|
|
||
| selfupdate.NewCommand("rios0rios0", "code-guru", "code-guru", version).CheckForUpdates() |
There was a problem hiding this comment.
CheckForUpdates() is invoked before cobraRoot.Execute(), so it will run even for --help / --version and before Cobra has parsed flags. Since this call is intended to warn users, it can add unexpected output and side effects to otherwise deterministic commands. Consider moving the update check into Cobra's execution flow (e.g., PersistentPreRunE/PreRunE on the root command) and/or gating it so it doesn't run for help/version invocations.
| appContext := injectAppContext() | ||
| addSubcommands(cobraRoot, appContext) | ||
|
|
||
| selfupdate.NewCommand("rios0rios0", "code-guru", "code-guru", version).CheckForUpdates() |
There was a problem hiding this comment.
The GitHub owner/repo/binary identifiers ("rios0rios0", "code-guru", "code-guru") are duplicated here and also in the DI registration for the self-updater repository. To avoid drift (e.g., rename of the binary or repo), centralize these identifiers (constants or a small helper) and reuse them in both places.
|
|
||
| ### Added | ||
|
|
||
| - added automatic version check on CLI startup using `CheckForUpdates` |
There was a problem hiding this comment.
The changelog entry references CheckForUpdates without parentheses; using the exact call form (CheckForUpdates()) would make it clearer that this is a function/method name and matches the implementation.
| - added automatic version check on CLI startup using `CheckForUpdates` | |
| - added automatic version check on CLI startup using `CheckForUpdates()` |



Summary
CheckForUpdates()call on CLI startup to warn users when a newer version is availablecliforgedependency to include the new passive version check featureTest plan
🤖 Generated with Claude Code