// Package cli wires teabot's cobra command tree. package cli import ( "fmt" "os" "github.com/spf13/cobra" "git.unkin.net/unkin/teabot/internal/config" ) var ( // configPath is the --config flag shared by the commands that need it. configPath string buildVer string ) func newRootCmd() *cobra.Command { root := &cobra.Command{ Use: "teabot", Short: "Watch Gitea repos and dispatch one-shot Claude Code sessions", Long: "teabot polls Gitea repositories for new issues, pull requests, and comments,\n" + "then dispatches one-shot Claude Code sessions in Docker containers to implement\n" + "issues and review pull requests using configurable bot personalities.", SilenceUsage: true, SilenceErrors: true, Version: buildVer, } root.PersistentFlags().StringVarP(&configPath, "config", "c", config.DefaultConfigPath(), "path to teabot config file") root.AddCommand(newRunCmd()) root.AddCommand(newConfigCmd()) return root } // Execute runs the CLI with the given build version. func Execute(version string) { buildVer = version if err := newRootCmd().Execute(); err != nil { fmt.Fprintln(os.Stderr, "teabot:", err) os.Exit(1) } }