Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Exceptions are acceptable depending on the circumstances (critical bug fixes tha

### 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.
- added `version` subcommand to display the current CLI version
- added `self-update` subcommand to update the CLI binary from GitHub releases
- added `FlagBinder` optional interface for controllers to register command-specific flags
Expand Down
3 changes: 3 additions & 0 deletions cmd/code-guru/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"os"

"github.com/rios0rios0/cliforge/pkg/selfupdate"
logger "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -88,6 +89,8 @@ func main() {
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.
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.

if err := cobraRoot.Execute(); err != nil {
logger.Fatalf("error executing 'code-guru': %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/rios0rios0/codeguru

go 1.26.1

require github.com/rios0rios0/cliforge v0.1.1-0.20260402173400-cd7225c728db
require github.com/rios0rios0/cliforge v0.2.1-0.20260404230949-b9683f7eded2

require (
github.com/anthropics/anthropic-sdk-go v1.29.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rios0rios0/cliforge v0.1.1-0.20260402173400-cd7225c728db h1:uplUAe01ckRMX7GzquWtdmnYweYLh0yLr7UFZfjQ2nI=
github.com/rios0rios0/cliforge v0.1.1-0.20260402173400-cd7225c728db/go.mod h1:xqHRf5C15as2KOOTXdyNZQnfExtXOpSkRljkhZ4hVsQ=
github.com/rios0rios0/cliforge v0.2.1-0.20260404230949-b9683f7eded2 h1:cRuv/NTZ7B7UzTzO3JQy8VQlYxo45xC0RPhnVN6Ar7k=
github.com/rios0rios0/cliforge v0.2.1-0.20260404230949-b9683f7eded2/go.mod h1:Ma0C18zImHW305Ezt+XCsmUmtSj3BM1mcBk7G5lttv0=
github.com/rios0rios0/gitforge v0.9.1 h1:HykXcbckOwiMhOKvtJ1ICEry9pEq8/2gMIJcjqjIr6A=
github.com/rios0rios0/gitforge v0.9.1/go.mod h1:1ts/2K9iVaMYBk4b/XWPN5vfjt7A6ktWxXSgm0ox2FU=
github.com/rios0rios0/langforge v0.5.0 h1:mRXfvgna9PGc4S2iYBztmYmwTW9o8MHj0Ne1W8pAy80=
Expand Down