11package main
22
33import (
4+ "fmt"
45 "os"
56
67 "github.com/flanksource/captain/pkg/cli"
78 "github.com/flanksource/clicky"
89 "github.com/spf13/cobra"
910)
1011
11- var (
12- version = "dev"
13- commit = "none"
14- date = "unknown"
15- )
12+ var version = "dev"
1613
1714func main () {
1815 rootCmd := & cobra.Command {
@@ -28,13 +25,64 @@ func main() {
2825 clicky .AddNamedCommand ("history" , rootCmd , cli.HistoryOptions {}, cli .RunHistory )
2926 clicky .AddNamedCommand ("info" , rootCmd , cli.InfoOptions {}, cli .RunInfo )
3027 clicky .AddNamedCommand ("cost" , rootCmd , cli.CostOptions {}, cli .RunCost )
28+ sandboxCmd := & cobra.Command {
29+ Use : "sandbox" ,
30+ Short : "Sandbox configuration tools" ,
31+ }
32+ sandboxCmd .SetHelpFunc (func (c * cobra.Command , args []string ) {
33+ fmt .Fprint (os .Stderr , cli .SandboxHelp ().ANSI ())
34+ })
35+ rootCmd .AddCommand (sandboxCmd )
36+ clicky .AddNamedCommand ("generate" , sandboxCmd , cli.SRTGenerateOptions {}, cli .RunSRTGenerate ).Short = "Generate sandbox-runtime config"
37+ clicky .AddNamedCommand ("presets" , sandboxCmd , cli.SandboxPresetsOptions {}, cli .RunSandboxPresets ).Short = "List available sandbox-runtime presets"
3138
3239 aiCmd := & cobra.Command {Use : "ai" , Short : "AI provider commands" }
3340 rootCmd .AddCommand (aiCmd )
3441 clicky .AddNamedCommand ("prompt" , aiCmd , cli.AIPromptOptions {}, cli .RunAIPrompt )
3542 clicky .AddNamedCommand ("models" , aiCmd , cli.AIModelsOptions {}, cli .RunAIModels )
3643 clicky .AddNamedCommand ("test" , aiCmd , cli.AITestOptions {}, cli .RunAITest )
3744
45+ dodCmd := & cobra.Command {Use : "dod" , Short : "Definition of Done — gate Claude's stop on passing commands" }
46+ rootCmd .AddCommand (dodCmd )
47+ clicky .AddNamedCommand ("set" , dodCmd , cli.DodSetOptions {}, cli .RunDodSet )
48+ clicky .AddNamedCommand ("check" , dodCmd , cli.DodCheckOptions {}, cli .RunDodCheck )
49+ clicky .AddNamedCommand ("clear" , dodCmd , cli.DodClearOptions {}, cli .RunDodClear )
50+ clicky .AddNamedCommand ("status" , dodCmd , cli.DodStatusOptions {}, cli .RunDodStatus )
51+ clicky .AddNamedCommand ("run" , dodCmd , cli.DodRunOptions {}, cli .RunDodRun )
52+
53+ hookCmd := & cobra.Command {Use : "hook" , Short : "Claude Code hook commands" }
54+ rootCmd .AddCommand (hookCmd )
55+ bashCheckCmd := & cobra.Command {Use : "bash-check" , Short : "Scan bash command for violations (PreToolUse hook)" , RunE : func (cmd * cobra.Command , args []string ) error {
56+ _ , err := cli .RunBashCheck (cli.BashCheckOptions {})
57+ return err
58+ }}
59+ hookCmd .AddCommand (bashCheckCmd )
60+ clicky .AddNamedCommand ("install" , bashCheckCmd , cli.HookInstallOptions {}, cli .RunBashCheckInstall )
61+ dodHookCmd := & cobra.Command {Use : "dod" , Short : "Definition of Done hook" }
62+ hookCmd .AddCommand (dodHookCmd )
63+ clicky .AddNamedCommand ("install" , dodHookCmd , cli.HookInstallOptions {}, cli .RunDodInstall )
64+
65+ projectsCmd := & cobra.Command {Use : "projects" , Short : "Manage Claude Code project sessions" }
66+ rootCmd .AddCommand (projectsCmd )
67+ clicky .AddNamedCommand ("list" , projectsCmd , cli.ProjectsListOptions {}, cli .RunProjectsList )
68+ clicky .AddNamedCommand ("clean" , projectsCmd , cli.ProjectsCleanOptions {}, cli .RunProjectsClean )
69+
70+ containerCmd := & cobra.Command {
71+ Use : "container" ,
72+ Short : "Container sandbox builder for Claude Code" ,
73+ RunE : func (cmd * cobra.Command , args []string ) error {
74+ return cli .RunContainerTUI ()
75+ },
76+ }
77+ containerCmd .SetHelpFunc (func (c * cobra.Command , args []string ) {
78+ fmt .Fprint (os .Stderr , cli .ContainerHelp ().ANSI ())
79+ })
80+ rootCmd .AddCommand (containerCmd )
81+ clicky .AddNamedCommand ("list" , containerCmd , cli.ContainerListOptions {}, cli .RunContainerList ).Short = "List discovered components"
82+ clicky .AddNamedCommand ("generate" , containerCmd , cli.ContainerGenerateOptions {}, cli .RunContainerGenerate ).Short = "Generate Dockerfile and sandbox config"
83+ clicky .AddNamedCommand ("build" , containerCmd , cli.ContainerBuildOptions {}, cli .RunContainerBuild ).Short = "Build container image"
84+ clicky .AddNamedCommand ("run" , containerCmd , cli.ContainerRunOptions {}, cli .RunContainerRun ).Short = "Run container sandbox"
85+
3886 if err := rootCmd .Execute (); err != nil {
3987 os .Exit (1 )
4088 }
0 commit comments