package main import ( "fmt" "github.com/spf13/cobra" ) // version is set at build time via ldflags (-X main.version=...). // Defaults to "dev" for local go builds. var version = "dev" // formatVersion returns the user-facing version string. func formatVersion() string { return fmt.Sprintf("bug version %s", version) } func runVersion(cmd *cobra.Command) error { cmd.Println(formatVersion()) return nil } var versionCmd = &cobra.Command{ Use: "version", Short: "Print the bug CLI version", Long: `Print the version of the bug CLI. The version is embedded at build time from the version field in flake.nix. This helps agents know which features are available in the installed binary. Example: bug version`, RunE: func(cmd *cobra.Command, args []string) error { return runVersion(cmd) }, }