Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Register 'check' as a subcommand of 'version' so 'beacon version check' works

Cursor Agent593865869336
diff --git a/cli/beacon/cmd/version.go b/cli/beacon/cmd/version.go
index 8399b27a..79fa179d 100644
--- a/cli/beacon/cmd/version.go
+++ b/cli/beacon/cmd/version.go
@@ -12,7 +12,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Display the version of the Beacon CLI",
Long: `Display the version number, git commit, and build date of the Beacon CLI.`,
- Args: cobra.NoArgs,
SilenceUsage: true,
RunE: runVersion,
}
diff --git a/cli/beacon/cmd/version_check.go b/cli/beacon/cmd/version_check.go
index ade9d215..1db8297e 100644
--- a/cli/beacon/cmd/version_check.go
+++ b/cli/beacon/cmd/version_check.go
@@ -15,6 +15,13 @@ type versionChecker interface {
Check(context.Context) (updatecheck.Result, error)
}
+var versionCheckCmd = &cobra.Command{
+ Use: "check",
+ Short: "Check whether a newer Beacon CLI release is available",
+ SilenceUsage: true,
+ RunE: runVersionCheck,
+}
+
var (
versionCheck = false
@@ -24,6 +31,10 @@ var (
versionCheckTimeout = 2 * time.Second
)
+func init() {
+ versionCmd.AddCommand(versionCheckCmd)
+}
+
func runVersionCheck(cmd *cobra.Command, args []string) error {
parent := cmd.Context()
if parent == nil {
diff --git a/cli/beacon/cmd/version_check_test.go b/cli/beacon/cmd/version_check_test.go
index 078037f8..437474a3 100644
--- a/cli/beacon/cmd/version_check_test.go
+++ b/cli/beacon/cmd/version_check_test.go
@@ -38,6 +38,19 @@ func TestVersionCheckFlagRegistered(t *testing.T) {
}
}
+func TestVersionCheckSubcommandRegistered(t *testing.T) {
+ cmd, _, err := rootCmd.Find([]string{"version", "check"})
+ if err != nil {
+ t.Fatalf("Find version check returned error: %v", err)
+ }
+ if cmd == nil {
+ t.Fatal("version check subcommand not registered")
+ }
+ if cmd.Use != "check" {
+ t.Fatalf("found command Use = %q, want %q", cmd.Use, "check")
+ }
+}
+
func TestRunVersionWithoutCheckPrintsVersionOnly(t *testing.T) {
restoreVersion := setVersionForTest(t, "v0.0.10")
defer restoreVersion()