Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
add --apply/a flag to 'build' command, validate tell flags across 'tell', 'continue' and 'build' commands
Dane Schneiderfade131bfe23
diff --git a/app/cli/cmd/build.go b/app/cli/cmd/build.goindex becf46b6..5c1e8e17 100644--- a/app/cli/cmd/build.go+++ b/app/cli/cmd/build.go@@ -11,8 +11,6 @@ import ("github.com/spf13/cobra")-var buildBg bool-var buildCmd = &cobra.Command{Use: "build",Aliases: []string{"b"},@@ -24,11 +22,16 @@ var buildCmd = &cobra.Command{func init() {RootCmd.AddCommand(buildCmd)- buildCmd.Flags().BoolVar(&buildBg, "bg", false, "Execute autonomously in the background")+ buildCmd.Flags().BoolVar(&tellBg, "bg", false, "Execute autonomously in the background")+buildCmd.Flags().BoolVarP(&autoConfirm, "yes", "y", false, "Automatically confirm context updates")+ continueCmd.Flags().BoolVarP(&tellAutoApply, "apply", "a", false, "Automatically apply changes (and confirm context updates)")+ continueCmd.Flags().BoolVarP(&autoCommit, "commit", "c", false, "Commit changes to git when --apply/-a is passed")}func build(cmd *cobra.Command, args []string) {+ validateTellFlags()+auth.MustResolveAuthWithOrg()lib.MustResolveProject()@@ -48,7 +51,7 @@ func build(cmd *cobra.Command, args []string) {CheckOutdatedContext: func(maybeContexts []*shared.Context) (bool, bool, error) {return lib.CheckOutdatedContextWithOutput(false, autoConfirm, maybeContexts)},- }, buildBg)+ }, tellBg)if err != nil {term.OutputErrorAndExit("Error building plan: %v", err)@@ -60,10 +63,12 @@ func build(cmd *cobra.Command, args []string) {return}- if buildBg {+ if tellBg {fmt.Println("ποΈ Building plan in the background")fmt.Println()term.PrintCmds("", "ps", "connect", "stop")+ } else if tellAutoApply {+ lib.MustApplyPlan(lib.CurrentPlanId, lib.CurrentBranch, true, autoCommit, !autoCommit)} else {fmt.Println()term.PrintCmds("", "diff", "diff --ui", "apply", "reject", "log")diff --git a/app/cli/cmd/continue.go b/app/cli/cmd/continue.goindex 44560301..97af1551 100644--- a/app/cli/cmd/continue.go+++ b/app/cli/cmd/continue.go@@ -30,6 +30,8 @@ func init() {}func doContinue(cmd *cobra.Command, args []string) {+ validateTellFlags()+auth.MustResolveAuthWithOrg()lib.MustResolveProject()diff --git a/app/cli/cmd/tell.go b/app/cli/cmd/tell.goindex 0d5d383c..7cadb895 100644--- a/app/cli/cmd/tell.go+++ b/app/cli/cmd/tell.go@@ -52,6 +52,8 @@ func init() {}func doTell(cmd *cobra.Command, args []string) {+ validateTellFlags()+auth.MustResolveAuthWithOrg()lib.MustResolveProject()@@ -184,3 +186,15 @@ func getEditorPrompt() string {return prompt}++func validateTellFlags() {+ if tellAutoApply && tellNoBuild {+ term.OutputErrorAndExit("π¨ --apply/-a can't be used with --no-build/-n")+ }+ if tellAutoApply && tellBg {+ term.OutputErrorAndExit("π¨ --apply/-a can't be used with --bg")+ }+ if autoCommit && !tellAutoApply {+ term.OutputErrorAndExit("π¨ --commit/-c can only be used with --apply/-a")+ }+}