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
Update state management and configuration with improved auto-revert behavior
Dane Schneider8ad60baf20c2
diff --git a/app/cli/auth/auth.go b/app/cli/auth/auth.goindex ed6034b9..181d4860 100644--- a/app/cli/auth/auth.go+++ b/app/cli/auth/auth.go@@ -91,7 +91,6 @@ func RefreshInvalidToken() error {if Current == nil {return fmt.Errorf("error refreshing token: auth not loaded")}-res, err := verifyEmail(Current.Email, Current.Host)if err != nil {diff --git a/app/cli/lib/repl.go b/app/cli/lib/repl.goindex cb566546..9a6bc464 100644--- a/app/cli/lib/repl.go+++ b/app/cli/lib/repl.go@@ -177,6 +177,7 @@ func ExecPlandexCommandWithParams(args []string, params ExecPlandexCommandParams"PLANDEX_COLUMNS="+strconv.Itoa(columns),"PLANDEX_STREAM_FOREGROUND_COLOR="+streamForegroundColor.Sequence(false),"GLAMOUR_STYLE="+glamourStyle,+ "PLANDEX_SKIP_UPGRADE=1",)}diff --git a/app/server/model/plan/state.go b/app/server/model/plan/state.goindex 435a4468..4121ab34 100644--- a/app/server/model/plan/state.go+++ b/app/server/model/plan/state.go@@ -122,7 +122,7 @@ func DeleteActivePlan(orgId, userId, planId, branch string) {}}()- err := db.GitClearUncommittedChanges(orgId, planId)+ err := db.GitClearUncommittedChanges(orgId, planId, branch)if err != nil {log.Printf("Error clearing uncommitted changes for plan %s: %v\n", planId, err)}diff --git a/app/server/syntax/structured_edits_apply.go b/app/server/syntax/structured_edits_apply.goindex 375bdcc1..49a9b466 100644--- a/app/server/syntax/structured_edits_apply.go+++ b/app/server/syntax/structured_edits_apply.go@@ -227,7 +227,7 @@ func ApplyChanges(// log.Println("--------------------------------")}- if len(res.NeedsVerifyReasons) == 1 && res.NeedsVerifyReasons[0] == NeedsVerifyReasonAmbiguousLocation {+ if len(res.NeedsVerifyReasons) == 1 && res.NeedsVerifyReasons[0] == NeedsVerifyReasonAmbiguousLocation && parser != nil {var err errorprevRes := resres, err = ExecApplyTreeSitter(diff --git a/app/shared/convo_message.go b/app/shared/convo_message.goindex 6bc093c7..18bfea6d 100644--- a/app/shared/convo_message.go+++ b/app/shared/convo_message.go@@ -8,6 +8,8 @@ func (f *ConvoMessageFlags) GetReplyTags() []string {if f.DidMakePlan {if f.DidMakeDebuggingPlan {replyTags = append(replyTags, "π Made Debug Plan")+ } else if f.DidRemoveTasks {+ replyTags = append(replyTags, "π Revised Plan")} else {replyTags = append(replyTags, "π Made Plan")}diff --git a/app/shared/plan_config.go b/app/shared/plan_config.goindex 706f4487..af0bf3df 100644--- a/app/shared/plan_config.go+++ b/app/shared/plan_config.go@@ -70,6 +70,8 @@ type PlanConfig struct {AutoDebug bool `json:"autoDebug"`AutoDebugTries int `json:"autoDebugTries"`+ AutoRevertOnRewind bool `json:"autoRevertOnRewind"`+// ReplMode bool `json:"replMode"`// DefaultRepl ReplType `json:"defaultRepl"`@@ -78,7 +80,6 @@ type PlanConfig struct {// PlainTextStream bool `json:"plainTextStream"`}-// autonomy settings are configured below in init()var DefaultPlanConfig = PlanConfig{Editor: defaultEditor,}@@ -126,6 +127,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {p.AutoExec = truep.AutoDebug = truep.AutoDebugTries = defaultAutoDebugTries+ p.AutoRevertOnRewind = truecase AutoModeSemi:p.AutoContinue = true@@ -138,6 +140,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {p.CanExec = truep.AutoExec = falsep.AutoDebug = false+ p.AutoRevertOnRewind = truecase AutoModeBasicPlus:p.AutoContinue = true@@ -150,6 +153,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {p.CanExec = truep.AutoExec = falsep.AutoDebug = false+ p.AutoRevertOnRewind = falsecase AutoModeBasic:p.AutoContinue = true@@ -162,6 +166,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {p.CanExec = falsep.AutoExec = falsep.AutoDebug = false+ p.AutoRevertOnRewind = falsecase AutoModeNone:p.AutoContinue = false@@ -174,6 +179,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {p.CanExec = falsep.AutoExec = falsep.AutoDebug = false+ p.AutoRevertOnRewind = false}}@@ -437,6 +443,19 @@ var ConfigSettingsByKey = map[string]ConfigSetting{return fmt.Sprintf("%d", p.AutoDebugTries)},},+ "autorevert": {+ Name: "auto-revert",+ Desc: "Automatically update project files when rewinding plan",+ BoolSetter: func(p *PlanConfig, enabled bool) {+ if enabled != p.AutoRevertOnRewind {+ p.AutoMode = AutoModeCustom+ }+ p.AutoRevertOnRewind = enabled+ },+ Getter: func(p *PlanConfig) string {+ return fmt.Sprintf("%t", p.AutoRevertOnRewind)+ },+ },}func init() {