1b4448afb4
teabot watches Gitea repos and dispatches one-shot Claude Code sessions in Docker containers to work issues and review PRs, acting as configurable bot personalities. Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
// 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)
|
|
}
|
|
}
|