Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

_apply.sh and debug command updates/refactoring

Dane Schneidera5c5c7f08163
diff --git a/app/cli/changes_tui/run.go b/app/cli/changes_tui/run.go
index 844885ad..106ccd1d 100644
--- a/app/cli/changes_tui/run.go
+++ b/app/cli/changes_tui/run.go
@@ -5,6 +5,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
shared "plandex-shared"
@@ -40,15 +41,16 @@ func StartChangesUI(currentPlan *shared.CurrentPlanState) error {
}
if mod.shouldApplyAll {
- flags := lib.ApplyFlags{
+ applyFlags := types.ApplyFlags{
AutoConfirm: true,
}
- lib.MustApplyPlan(
- lib.CurrentPlanId,
- lib.CurrentBranch,
- flags,
- plan_exec.GetOnApplyExecFail(flags),
- )
+ lib.MustApplyPlan(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: types.TellFlags{},
+ OnExecFail: plan_exec.GetOnApplyExecFail(applyFlags, types.TellFlags{}),
+ })
}
if mod.rejectFileErr != nil {
diff --git a/app/cli/cmd/apply.go b/app/cli/cmd/apply.go
index 37a37e0a..b5ad2d77 100644
--- a/app/cli/cmd/apply.go
+++ b/app/cli/cmd/apply.go
@@ -5,6 +5,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
"github.com/spf13/cobra"
)
@@ -33,7 +34,7 @@ func apply(cmd *cobra.Command, args []string) {
term.OutputNoCurrentPlanErrorAndExit()
}
- flags := lib.ApplyFlags{
+ applyFlags := types.ApplyFlags{
AutoConfirm: true,
AutoCommit: autoCommit,
NoCommit: skipCommit,
@@ -42,10 +43,20 @@ func apply(cmd *cobra.Command, args []string) {
AutoDebug: autoDebug,
}
- lib.MustApplyPlan(
- lib.CurrentPlanId,
- lib.CurrentBranch,
- flags,
- plan_exec.GetOnApplyExecFail(flags),
- )
+ tellFlags := types.TellFlags{
+ TellBg: tellBg,
+ TellStop: tellStop,
+ TellNoBuild: tellNoBuild,
+ AutoContext: tellAutoContext,
+ ExecEnabled: !noExec,
+ AutoApply: tellAutoApply,
+ }
+
+ lib.MustApplyPlan(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: tellFlags,
+ OnExecFail: plan_exec.GetOnApplyExecFail(applyFlags, tellFlags),
+ })
}
diff --git a/app/cli/cmd/build.go b/app/cli/cmd/build.go
index 36013363..1fb98cf7 100644
--- a/app/cli/cmd/build.go
+++ b/app/cli/cmd/build.go
@@ -6,6 +6,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
shared "plandex-shared"
@@ -51,7 +52,10 @@ func build(cmd *cobra.Command, args []string) {
auto := autoConfirm || tellAutoApply || tellAutoContext
return lib.CheckOutdatedContextWithOutput(auto, auto, maybeContexts)
},
- }, tellBg)
+ }, types.BuildFlags{
+ BuildBg: tellBg,
+ AutoApply: tellAutoApply,
+ })
if err != nil {
term.OutputErrorAndExit("Error building plan: %v", err)
@@ -68,7 +72,7 @@ func build(cmd *cobra.Command, args []string) {
fmt.Println()
term.PrintCmds("", "ps", "connect", "stop")
} else if tellAutoApply {
- flags := lib.ApplyFlags{
+ applyFlags := types.ApplyFlags{
AutoConfirm: true,
AutoCommit: autoCommit,
NoCommit: !autoCommit,
@@ -77,12 +81,19 @@ func build(cmd *cobra.Command, args []string) {
AutoDebug: autoDebug,
}
- lib.MustApplyPlan(
- lib.CurrentPlanId,
- lib.CurrentBranch,
- flags,
- plan_exec.GetOnApplyExecFail(flags),
- )
+ tellFlags := types.TellFlags{
+ AutoContext: tellAutoContext,
+ ExecEnabled: !noExec,
+ AutoApply: tellAutoApply,
+ }
+
+ lib.MustApplyPlan(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: tellFlags,
+ OnExecFail: plan_exec.GetOnApplyExecFail(applyFlags, tellFlags),
+ })
} else {
fmt.Println()
term.PrintCmds("", "diff", "diff --ui", "apply", "reject", "log")
diff --git a/app/cli/cmd/changes.go b/app/cli/cmd/changes.go
index ec47a55d..d18ff8c8 100644
--- a/app/cli/cmd/changes.go
+++ b/app/cli/cmd/changes.go
@@ -8,6 +8,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
shared "plandex-shared"
@@ -87,7 +88,7 @@ func changes(cmd *cobra.Command, args []string) {
CheckOutdatedContext: func(maybeContexts []*shared.Context) (bool, bool, error) {
return lib.CheckOutdatedContextWithOutput(true, false, maybeContexts)
},
- }, false)
+ }, types.BuildFlags{})
if err != nil {
term.OutputErrorAndExit("Error building plan: %v\n", err)
diff --git a/app/cli/cmd/chat.go b/app/cli/cmd/chat.go
index fcaa36ae..36aa4b45 100644
--- a/app/cli/cmd/chat.go
+++ b/app/cli/cmd/chat.go
@@ -5,6 +5,7 @@ import (
"plandex-cli/auth"
"plandex-cli/lib"
"plandex-cli/plan_exec"
+ "plandex-cli/types"
shared "plandex-shared"
@@ -58,7 +59,7 @@ func doChat(cmd *cobra.Command, args []string) {
auto := autoConfirm || tellAutoApply || tellAutoContext
return lib.CheckOutdatedContextWithOutput(auto, auto, maybeContexts)
},
- }, prompt, plan_exec.TellFlags{
+ }, prompt, types.TellFlags{
IsChatOnly: true,
AutoContext: tellAutoContext,
})
diff --git a/app/cli/cmd/continue.go b/app/cli/cmd/continue.go
index d8755a7c..490a0971 100644
--- a/app/cli/cmd/continue.go
+++ b/app/cli/cmd/continue.go
@@ -4,6 +4,7 @@ import (
"plandex-cli/auth"
"plandex-cli/lib"
"plandex-cli/plan_exec"
+ "plandex-cli/types"
shared "plandex-shared"
@@ -36,6 +37,16 @@ func doContinue(cmd *cobra.Command, args []string) {
apiKeys = lib.MustVerifyApiKeys()
}
+ tellFlags := types.TellFlags{
+ TellBg: tellBg,
+ TellStop: tellStop,
+ TellNoBuild: tellNoBuild,
+ IsUserContinue: true,
+ ExecEnabled: !noExec,
+ AutoContext: tellAutoContext,
+ AutoApply: tellAutoApply,
+ }
+
plan_exec.TellPlan(plan_exec.ExecParams{
CurrentPlanId: lib.CurrentPlanId,
CurrentBranch: lib.CurrentBranch,
@@ -45,17 +56,10 @@ func doContinue(cmd *cobra.Command, args []string) {
return lib.CheckOutdatedContextWithOutput(auto, auto, maybeContexts)
},
- }, "", plan_exec.TellFlags{
- TellBg: tellBg,
- TellStop: tellStop,
- TellNoBuild: tellNoBuild,
- IsUserContinue: true,
- ExecEnabled: !noExec,
- AutoContext: tellAutoContext,
- })
+ }, "", tellFlags)
if tellAutoApply {
- flags := lib.ApplyFlags{
+ applyFlags := types.ApplyFlags{
AutoConfirm: true,
AutoCommit: autoCommit,
NoCommit: !autoCommit,
@@ -64,11 +68,12 @@ func doContinue(cmd *cobra.Command, args []string) {
AutoDebug: autoDebug,
}
- lib.MustApplyPlan(
- lib.CurrentPlanId,
- lib.CurrentBranch,
- flags,
- plan_exec.GetOnApplyExecFail(flags),
- )
+ lib.MustApplyPlan(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: tellFlags,
+ OnExecFail: plan_exec.GetOnApplyExecFail(applyFlags, tellFlags),
+ })
}
}
diff --git a/app/cli/cmd/debug.go b/app/cli/cmd/debug.go
index 73a8595e..823cccd2 100644
--- a/app/cli/cmd/debug.go
+++ b/app/cli/cmd/debug.go
@@ -8,6 +8,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
"strconv"
"strings"
@@ -29,12 +30,13 @@ var debugCmd = &cobra.Command{
func init() {
RootCmd.AddCommand(debugCmd)
- debugCmd.Flags().BoolVarP(&autoCommit, "commit", "c", false, "Commit changes to git on each try")
+ debugCmd.Flags().BoolVarP(&autoCommit, "commit", "c", false, "Commit changes after successful execution")
}
func doDebug(cmd *cobra.Command, args []string) {
auth.MustResolveAuthWithOrg()
lib.MustResolveProject()
+ mustSetPlanExecFlags(cmd)
if lib.CurrentPlanId == "" {
term.OutputNoCurrentPlanErrorAndExit()
@@ -119,6 +121,12 @@ func doDebug(cmd *cobra.Command, args []string) {
prompt := fmt.Sprintf("'%s' failed with exit status %d. Output:\n\n%s\n\n--\n\n",
strings.Join(cmdArgs, " "), status, string(output))
+ tellFlags := types.TellFlags{
+ AutoContext: tellAutoContext,
+ ExecEnabled: false,
+ IsUserDebug: true,
+ }
+
plan_exec.TellPlan(plan_exec.ExecParams{
CurrentPlanId: lib.CurrentPlanId,
CurrentBranch: lib.CurrentBranch,
@@ -126,20 +134,23 @@ func doDebug(cmd *cobra.Command, args []string) {
CheckOutdatedContext: func(maybeContexts []*shared.Context) (bool, bool, error) {
return lib.CheckOutdatedContextWithOutput(true, true, maybeContexts)
},
- }, prompt, plan_exec.TellFlags{IsUserDebug: true})
+ }, prompt, tellFlags)
- flags := lib.ApplyFlags{
+ applyFlags := types.ApplyFlags{
AutoConfirm: true,
AutoCommit: autoCommit,
NoCommit: !autoCommit,
- NoExec: true,
+ NoExec: false,
+ AutoExec: true,
}
- lib.MustApplyPlan(
- lib.CurrentPlanId,
- lib.CurrentBranch,
- flags,
- plan_exec.GetOnApplyExecFail(flags),
- )
+ lib.MustApplyPlan(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: tellFlags,
+ OnExecFail: plan_exec.GetOnApplyExecFailWithCommand(applyFlags, tellFlags, cmdStr),
+ ExecCommand: cmdStr,
+ })
}
}
diff --git a/app/cli/cmd/tell.go b/app/cli/cmd/tell.go
index 34483cde..2d1c6f2d 100644
--- a/app/cli/cmd/tell.go
+++ b/app/cli/cmd/tell.go
@@ -10,6 +10,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
"strings"
shared "plandex-shared"
@@ -50,6 +51,15 @@ func doTell(cmd *cobra.Command, args []string) {
return
}
+ tellFlags := types.TellFlags{
+ TellBg: tellBg,
+ TellStop: tellStop,
+ TellNoBuild: tellNoBuild,
+ AutoContext: tellAutoContext,
+ ExecEnabled: !noExec,
+ AutoApply: tellAutoApply,
+ }
+
plan_exec.TellPlan(plan_exec.ExecParams{
CurrentPlanId: lib.CurrentPlanId,
CurrentBranch: lib.CurrentBranch,
@@ -58,16 +68,10 @@ func doTell(cmd *cobra.Command, args []string) {
auto := autoConfirm || tellAutoApply || tellAutoContext
return lib.CheckOutdatedContextWithOutput(auto, auto, maybeContexts)
},
- }, prompt, plan_exec.TellFlags{
- TellBg: tellBg,
- TellStop: tellStop,
- TellNoBuild: tellNoBuild,
- AutoContext: tellAutoContext,
- ExecEnabled: !noExec,
- })
+ }, prompt, tellFlags)
if tellAutoApply {
- flags := lib.ApplyFlags{
+ applyFlags := types.ApplyFlags{
AutoConfirm: true,
AutoCommit: autoCommit,
NoCommit: !autoCommit,
@@ -76,12 +80,13 @@ func doTell(cmd *cobra.Command, args []string) {
AutoDebug: autoDebug,
}
- lib.MustApplyPlan(
- lib.CurrentPlanId,
- lib.CurrentBranch,
- flags,
- plan_exec.GetOnApplyExecFail(flags),
- )
+ lib.MustApplyPlan(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: tellFlags,
+ OnExecFail: plan_exec.GetOnApplyExecFail(applyFlags, tellFlags),
+ })
}
}
diff --git a/app/cli/lib/apply.go b/app/cli/lib/apply.go
index 20abc64e..e1f21063 100644
--- a/app/cli/lib/apply.go
+++ b/app/cli/lib/apply.go
@@ -23,37 +23,36 @@ import (
"github.com/fatih/color"
)
-type ApplyFlags struct {
- AutoConfirm bool
- AutoCommit bool
- NoCommit bool
- AutoExec bool
- NoExec bool
- AutoDebug int
+type ApplyPlanParams struct {
+ PlanId string
+ Branch string
+ ApplyFlags types.ApplyFlags
+ TellFlags types.TellFlags
+ OnExecFail types.OnApplyExecFailFn
+ ExecCommand string
}
func MustApplyPlan(
- planId,
- branch string,
- flags ApplyFlags,
- onExecFail types.OnApplyExecFailFn,
+ params ApplyPlanParams,
) {
- MustApplyPlanAttempt(planId, branch, flags, onExecFail, 0)
+ MustApplyPlanAttempt(params, 0)
}
func MustApplyPlanAttempt(
- planId,
- branch string,
- flags ApplyFlags,
- onExecFail types.OnApplyExecFailFn,
+ params ApplyPlanParams,
attempt int,
) {
log.Println("Applying plan")
- autoConfirm := flags.AutoConfirm
- autoCommit := flags.AutoCommit
- noCommit := flags.NoCommit
- noExec := flags.NoExec
+ applyFlags := params.ApplyFlags
+ planId := params.PlanId
+ branch := params.Branch
+ onExecFail := params.OnExecFail
+
+ autoConfirm := applyFlags.AutoConfirm
+ autoCommit := applyFlags.AutoCommit
+ noCommit := applyFlags.NoCommit
+ noExec := applyFlags.NoExec
term.StartSpinner("")
@@ -224,14 +223,14 @@ func MustApplyPlanAttempt(
}
if _, ok := toApply["_apply.sh"]; ok && !noExec {
- handleApplyScript(flags, toApply, onErr, toRollback, onExecFail, attempt, onExecSuccess)
+ handleApplyScript(params, toApply, onErr, toRollback, onExecFail, attempt, onExecSuccess)
} else {
onExecSuccess()
}
}
func handleApplyScript(
- flags ApplyFlags,
+ params ApplyPlanParams,
toApply map[string]string,
onErr types.OnErrFn,
toRollback *types.ApplyRollbackPlan,
@@ -245,7 +244,12 @@ func handleApplyScript(
color.New(term.ColorHiCyan, color.Bold).Println("πŸš€ Commands to execute πŸ‘‡")
- content := toApply["_apply.sh"]
+ var content string
+ if params.ExecCommand != "" {
+ content = params.ExecCommand
+ } else {
+ content = toApply["_apply.sh"]
+ }
md, err := term.GetMarkdown("```bash\n" + content + "\n```")
@@ -258,7 +262,7 @@ func handleApplyScript(
log.Println("Asking user to confirm executing apply script")
var confirmed bool
- if flags.AutoExec {
+ if params.ApplyFlags.AutoExec {
confirmed = true
} else {
confirmed, err = term.ConfirmYesNo("Execute now?")
@@ -270,7 +274,7 @@ func handleApplyScript(
if confirmed {
log.Println("Executing apply script")
- execApplyScript(flags, toApply, onErr, toRollback, onExecFail, attempt, onSuccess)
+ execApplyScript(params, toApply, onErr, toRollback, onExecFail, attempt, onSuccess)
} else {
if toRollback != nil && toRollback.HasChanges() {
res, err := term.SelectFromList("Skipping execution. Apply file changes or roll back?", []string{string(types.ApplyRollbackOptionKeep), string(types.ApplyRollbackOptionRollback)})
@@ -305,7 +309,7 @@ trap 'echo "Error on line $LINENO: ${funcfiletrace[0]#*:}"' ERR
}
func execApplyScript(
- flags ApplyFlags,
+ params ApplyPlanParams,
toApply map[string]string,
onErr types.OnErrFn,
toRollback *types.ApplyRollbackPlan,
@@ -318,9 +322,15 @@ func execApplyScript(
color.New(term.ColorHiCyan, color.Bold).Println("πŸš€ Executing... Output below:")
fmt.Println()
- dstPath := filepath.Join(fs.ProjectRoot, "_apply.sh")
+ var content string
+
+ if params.ExecCommand != "" {
+ content = params.ExecCommand
+ } else {
+ content = toApply["_apply.sh"]
+ }
- content := toApply["_apply.sh"]
+ dstPath := filepath.Join(fs.ProjectRoot, "_apply.sh")
lines := strings.Split(content, "\n")
filteredLines := []string{}
@@ -385,35 +395,25 @@ func execApplyScript(
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
+ var interrupted bool
+
// Handle SIGINT and SIGTERM
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
go func() {
select {
- case sig := <-sigChan:
- os.Remove(dstPath)
-
- if toRollback != nil && toRollback.HasChanges() {
- color.New(term.ColorHiYellow, color.Bold).Println("⚠️ Execution interrupted")
- res, err := term.SelectFromList("Apply file changes or roll back?", []string{string(types.ApplyRollbackOptionKeep), string(types.ApplyRollbackOptionRollback)})
- if err != nil {
- onErr("failed to get rollback confirmation user input: %s", err)
- }
-
- if res == string(types.ApplyRollbackOptionRollback) {
- Rollback(toRollback, true)
- } else {
- onSuccess()
- }
- }
-
- execCmd.Process.Signal(sig)
+ case <-sigChan:
+ // child will receive this and exit since it's in the same process group
+ // but main process won't since we're listening for it with signal.Notify
+ // all we need to do is mark that we were interrupted, since we'll now proceed past '.Wait()' below
+ interrupted = true
case <-ctx.Done():
// Exit the goroutine when context is cancelled
return
}
}()
+
defer func() {
cancel() // Cancel context to clean up goroutine
signal.Stop(sigChan) // Stop catching signals
@@ -431,6 +431,29 @@ func execApplyScript(
err = execCmd.Wait()
+ success := err == nil
+
+ if interrupted {
+ os.Remove(dstPath)
+
+ fmt.Println()
+ color.New(term.ColorHiYellow, color.Bold).Println("⚠️ Execution interrupted")
+
+ didSucceed, canceled, err := term.ConfirmYesNoCancel("Did the commands succeed?")
+
+ if err != nil {
+ onErr("failed to get confirmation user input: %s", err)
+ }
+
+ success = didSucceed
+
+ if canceled {
+ // rollback and exit
+ Rollback(toRollback, true)
+ os.Exit(0)
+ }
+ }
+
// remove _apply.sh without overwriting err val
{
err := os.Remove(dstPath)
@@ -439,7 +462,7 @@ func execApplyScript(
}
}
- if err != nil {
+ if !success {
fmt.Println()
color.New(term.ColorHiRed, color.Bold).Println("🚨 Commands failed")
diff --git a/app/cli/main.go b/app/cli/main.go
index 20d4c77e..2a28d82f 100644
--- a/app/cli/main.go
+++ b/app/cli/main.go
@@ -11,6 +11,7 @@ import (
"plandex-cli/lib"
"plandex-cli/plan_exec"
"plandex-cli/term"
+ "plandex-cli/types"
"plandex-cli/ui"
shared "plandex-shared"
@@ -41,7 +42,7 @@ func init() {
CheckOutdatedContext: func(maybeContexts []*shared.Context) (bool, bool, error) {
return lib.CheckOutdatedContextWithOutput(true, autoConfirm, maybeContexts)
},
- }, false)
+ }, types.BuildFlags{})
})
// set up a rotating file logger
diff --git a/app/cli/plan_exec/apply_exec.go b/app/cli/plan_exec/apply_exec.go
index 71758bfe..d0df34ae 100644
--- a/app/cli/plan_exec/apply_exec.go
+++ b/app/cli/plan_exec/apply_exec.go
@@ -13,13 +13,21 @@ import (
"github.com/fatih/color"
)
-func GetOnApplyExecFail(flags lib.ApplyFlags) types.OnApplyExecFailFn {
+func GetOnApplyExecFail(applyFlags types.ApplyFlags, tellFlags types.TellFlags) types.OnApplyExecFailFn {
+ return getOnApplyExecFail(applyFlags, tellFlags, "")
+}
+
+func GetOnApplyExecFailWithCommand(applyFlags types.ApplyFlags, tellFlags types.TellFlags, execCommand string) types.OnApplyExecFailFn {
+ return getOnApplyExecFail(applyFlags, tellFlags, execCommand)
+}
+
+func getOnApplyExecFail(applyFlags types.ApplyFlags, tellFlags types.TellFlags, execCommand string) types.OnApplyExecFailFn {
var onExecFail types.OnApplyExecFailFn
onExecFail = func(status int, output string, attempt int, toRollback *types.ApplyRollbackPlan, onErr types.OnErrFn, onSuccess func()) {
var proceed bool
- if flags.AutoDebug > 0 {
- if attempt >= flags.AutoDebug {
+ if applyFlags.AutoDebug > 0 {
+ if attempt >= applyFlags.AutoDebug {
timesLbl := "times"
if attempt == 1 {
timesLbl = "time"
@@ -49,9 +57,23 @@ func GetOnApplyExecFail(flags lib.ApplyFlags) types.OnApplyExecFailFn {
if !auth.Current.IntegratedModelsMode {
apiKeys = lib.MustVerifyApiKeysSilent()
}
- prompt := fmt.Sprintf("Execution of '_apply.sh' failed with exit status %d. Output:\n\n%s\n\n--\n\n",
+ prompt := fmt.Sprintf("Execution failed with exit status %d. Output:\n\n%s\n\n--\n\n",
status, output)
+ tellFlags.IsUserContinue = false
+
+ if execCommand != "" {
+ tellFlags.IsApplyDebug = false
+ tellFlags.ExecEnabled = false
+ tellFlags.IsUserDebug = true
+ } else {
+ tellFlags.IsApplyDebug = true
+ tellFlags.ExecEnabled = true
+ tellFlags.IsUserDebug = false
+ }
+
+ log.Printf("Calling TellPlan for next debug attempt")
+
TellPlan(ExecParams{
CurrentPlanId: lib.CurrentPlanId,
CurrentBranch: lib.CurrentBranch,
@@ -59,11 +81,18 @@ func GetOnApplyExecFail(flags lib.ApplyFlags) types.OnApplyExecFailFn {
CheckOutdatedContext: func(maybeContexts []*shared.Context) (bool, bool, error) {
return lib.CheckOutdatedContextWithOutput(true, true, maybeContexts)
},
- }, prompt, TellFlags{IsApplyDebug: true, ExecEnabled: true})
+ }, prompt, tellFlags)
log.Printf("Applying plan after tell")
- lib.MustApplyPlanAttempt(lib.CurrentPlanId, lib.CurrentBranch, flags, onExecFail, attempt+1)
+ lib.MustApplyPlanAttempt(lib.ApplyPlanParams{
+ PlanId: lib.CurrentPlanId,
+ Branch: lib.CurrentBranch,
+ ApplyFlags: applyFlags,
+ TellFlags: tellFlags,
+ OnExecFail: onExecFail,
+ ExecCommand: execCommand,
+ }, attempt+1)
} else {
res, err := term.SelectFromList("Still apply file changes or roll back?", []string{string(types.ApplyRollbackOptionKeep), string(types.ApplyRollbackOptionRollback)})
diff --git a/app/cli/plan_exec/build.go b/app/cli/plan_exec/build.go
index eadb81cb..598e7b50 100644
--- a/app/cli/plan_exec/build.go
+++ b/app/cli/plan_exec/build.go
@@ -9,11 +9,14 @@ import (
"plandex-cli/stream"
streamtui "plandex-cli/stream_tui"
"plandex-cli/term"
+ "plandex-cli/types"
shared "plandex-shared"
)
-func Build(params ExecParams, buildBg bool) (bool, error) {
+func Build(params ExecParams, flags types.BuildFlags) (bool, error) {
+ buildBg := flags.BuildBg
+
term.StartSpinner("")
contexts, apiErr := api.Client.ListContext(params.CurrentPlanId, params.CurrentBranch)
diff --git a/app/cli/plan_exec/params.go b/app/cli/plan_exec/params.go
index 6e09153a..0cee67da 100644
--- a/app/cli/plan_exec/params.go
+++ b/app/cli/plan_exec/params.go
@@ -8,16 +8,3 @@ type ExecParams struct {
ApiKeys map[string]string
CheckOutdatedContext func(maybeContexts []*shared.Context) (bool, bool, error)
}
-
-type TellFlags struct {
- TellBg bool
- TellStop bool
- TellNoBuild bool
- IsUserContinue bool
- IsUserDebug bool
- IsApplyDebug bool
- IsChatOnly bool
- AutoContext bool
- ContinuedAfterAction bool
- ExecEnabled bool
-}