Skip to content

feat(selfupdate): added automatic version check on CLI startup#59

Open
rios0rios0 wants to merge 1 commit intomainfrom
feat/add-update-check
Open

feat(selfupdate): added automatic version check on CLI startup#59
rios0rios0 wants to merge 1 commit intomainfrom
feat/add-update-check

Conversation

@rios0rios0
Copy link
Copy Markdown
Owner

Summary

  • Added CheckForUpdates() call on CLI startup to warn users when a newer version is available
  • Updated cliforge dependency to include the new passive version check feature

Test plan

  • Verify CLI starts without errors
  • Verify warning appears when running an outdated binary

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 5, 2026 02:00
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/cliforge dependency 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()
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
appContext := injectAppContext()
addSubcommands(cobraRoot, appContext)

selfupdate.NewCommand("rios0rios0", "code-guru", "code-guru", version).CheckForUpdates()
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

### Added

- added automatic version check on CLI startup using `CheckForUpdates`
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- added automatic version check on CLI startup using `CheckForUpdates`
- added automatic version check on CLI startup using `CheckForUpdates()`

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants