Skip to content

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

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.go
index 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.go
index 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.go
index 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.go
index 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 error
prevRes := res
res, err = ExecApplyTreeSitter(
diff --git a/app/shared/convo_message.go b/app/shared/convo_message.go
index 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.go
index 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 = true
p.AutoDebug = true
p.AutoDebugTries = defaultAutoDebugTries
+ p.AutoRevertOnRewind = true
case AutoModeSemi:
p.AutoContinue = true
@@ -138,6 +140,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = true
p.AutoExec = false
p.AutoDebug = false
+ p.AutoRevertOnRewind = true
case AutoModeBasicPlus:
p.AutoContinue = true
@@ -150,6 +153,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = true
p.AutoExec = false
p.AutoDebug = false
+ p.AutoRevertOnRewind = false
case AutoModeBasic:
p.AutoContinue = true
@@ -162,6 +166,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = false
p.AutoExec = false
p.AutoDebug = false
+ p.AutoRevertOnRewind = false
case AutoModeNone:
p.AutoContinue = false
@@ -174,6 +179,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = false
p.AutoExec = false
p.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() {