Skip to content

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

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

feat(selfupdate): added automatic version check on CLI startup#64
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 4, 2026 23:25
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

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 notification by checking for newer releases when the CLI starts up, and updates the cliforge dependency to support that behavior.

Changes:

  • Bumps github.com/rios0rios0/cliforge to a newer pseudo-version that includes passive update checking.
  • Calls CheckForUpdates() during CLI startup.
  • Documents the new startup update check in the changelog.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
go.mod Updates cliforge dependency version.
go.sum Updates module checksums for the new cliforge version.
cmd/devforge/main.go Triggers an update check on startup via CheckForUpdates().
CHANGELOG.md Notes the new automatic version check under Unreleased.

rootCmd.AddCommand(newVersionCmd())
rootCmd.AddCommand(newSelfUpdateCmd())

selfupdate.NewCommand(repoOwner, repoName, binaryName, version).CheckForUpdates()
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

CheckForUpdates() is invoked unconditionally on startup before Cobra parses/executes subcommands. This means it will run for every invocation (including dev version, which is intended to be stdout-only for script/pipe compatibility, and dev self-update, which likely already checks). Consider moving the update check into a rootCmd.PersistentPreRun{E} (so you can skip specific commands) and ensure any warning/output goes to stderr and doesn’t block command execution (e.g., run with a short timeout or in a goroutine).

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