Skip to content

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

feat: upgrade auto-mode system with clearer options and better UX

Dane Schneidere9d706a2da7b
diff --git a/app/cli/cmd/new.go b/app/cli/cmd/new.go
index 6387eb05..43c78548 100644
--- a/app/cli/cmd/new.go
+++ b/app/cli/cmd/new.go
@@ -32,6 +32,8 @@ func init() {
RootCmd.AddCommand(newCmd)
newCmd.Flags().StringVarP(&name, "name", "n", "", "Name of the new plan")
newCmd.Flags().StringVar(&contextBaseDir, "context-dir", ".", "Base directory to auto-load context from")
+
+ AddNewPlanFlags(newCmd)
}
func new(cmd *cobra.Command, args []string) {
@@ -90,7 +92,11 @@ func new(cmd *cobra.Command, args []string) {
term.StopSpinner()
fmt.Printf("✅ Started new plan %s and set it to current plan\n", color.New(color.Bold, term.ColorHiGreen).Sprint(name))
- fmt.Println("⚙️ Using default config")
+ fmt.Printf("⚙️ Using default config\n")
+
+ resolveAutoMode(config)
+
+ resolveModelPack()
// autoModeLabel := shared.ConfigSettingsByKey["automode"].KeyToLabel(string(config.AutoMode))
// fmt.Println("⚡️ Auto-mode:", autoModeLabel)
@@ -106,6 +112,7 @@ func new(cmd *cobra.Command, args []string) {
lib.MustLoadContext([]string{baseDir}, &types.LoadContextParams{
DefsOnly: true,
SkipIgnoreWarning: true,
+ AutoLoaded: true,
})
} else {
fmt.Println()
diff --git a/app/cli/cmd/repl.go b/app/cli/cmd/repl.go
index 80c7b9ed..b59708c2 100644
--- a/app/cli/cmd/repl.go
+++ b/app/cli/cmd/repl.go
@@ -11,13 +11,12 @@ import (
"plandex-cli/term"
"plandex-cli/types"
"plandex-cli/version"
+ shared "plandex-shared"
"regexp"
"sort"
"strings"
"unicode"
- shared "plandex-shared"
-
"github.com/fatih/color"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
@@ -42,6 +41,8 @@ func init() {
replCmd.Flags().BoolP("chat", "c", false, "Start in chat mode")
replCmd.Flags().BoolP("tell", "t", false, "Start in tell mode")
+ AddNewPlanFlags(replCmd)
+
for _, config := range term.CliCommands {
if config.Repl {
desc := config.Desc
@@ -90,7 +91,31 @@ func runRepl(cmd *cobra.Command, args []string) {
afterNew := false
if lib.CurrentPlanId == "" {
os.Setenv("PLANDEX_DISABLE_SUGGESTIONS", "1")
- newCmd.Run(newCmd, []string{})
+ args := []string{}
+
+ if noAuto {
+ args = append(args, "--no-auto")
+ } else if basicAuto {
+ args = append(args, "--basic")
+ } else if plusAuto {
+ args = append(args, "--plus")
+ } else if semiAuto {
+ args = append(args, "--semi")
+ } else if fullAuto {
+ args = append(args, "--full")
+ }
+
+ if ossModels {
+ args = append(args, "--oss")
+ } else if strongModels {
+ args = append(args, "--strong")
+ } else if cheapModels {
+ args = append(args, "--cheap")
+ } else if dailyModels {
+ args = append(args, "--daily")
+ }
+
+ newCmd.Run(newCmd, args)
os.Setenv("PLANDEX_DISABLE_SUGGESTIONS", "")
afterNew = true
}
@@ -100,7 +125,47 @@ func runRepl(cmd *cobra.Command, args []string) {
color.New(term.ColorHiRed).Printf("Error getting project paths: %v\n", err)
}
- replWelcome(afterNew, false)
+ config, apiErr := api.Client.GetPlanConfig(lib.CurrentPlanId)
+ if apiErr != nil {
+ term.OutputErrorAndExit("Error getting plan config: %v", apiErr.Msg)
+ }
+
+ settings, apiErr := api.Client.GetSettings(lib.CurrentPlanId, lib.CurrentBranch)
+ if apiErr != nil {
+ term.OutputErrorAndExit("Error getting settings: %v", apiErr.Msg)
+ }
+
+ var printAutoFn func()
+ var printModelFn func()
+ if !afterNew {
+ var didUpdateConfig bool
+ var updatedConfig *shared.PlanConfig
+ var updatedSettings *shared.PlanSettings
+ didUpdateConfig, updatedConfig, printAutoFn = resolveAutoModeSilent(config)
+ updatedSettings, printModelFn = resolveModelPackSilent(settings)
+
+ if didUpdateConfig {
+ loadMapIfNeeded(config, updatedConfig)
+ removeMapIfNeeded(config, updatedConfig)
+
+ if updatedConfig != nil {
+ config = updatedConfig
+ }
+ }
+
+ if updatedSettings != nil {
+ settings = updatedSettings
+ }
+ }
+
+ replWelcome(replWelcomeParams{
+ afterNew: afterNew,
+ isHelp: false,
+ printAutoFn: printAutoFn,
+ printModelFn: printModelFn,
+ config: config,
+ packName: settings.ModelPack.Name,
+ })
var p *prompt.Prompt
p = prompt.New(
@@ -725,17 +790,46 @@ func completer(in prompt.Document) ([]prompt.Suggest, pstrings.RuneNumber, pstri
return fuzzySuggestions, startIndex, endIndex
}
-func replWelcome(afterNew, isHelp bool) {
+type replWelcomeParams struct {
+ afterNew bool
+ isHelp bool
+ printAutoFn func()
+ printModelFn func()
+ packName string
+ config *shared.PlanConfig
+}
+
+func replWelcome(params replWelcomeParams) {
// print REPL welcome message and basic info
// have to make these requests serially in case re-authentication is needed
+ afterNew := params.afterNew
+ isHelp := params.isHelp
+ printAutoFn := params.printAutoFn
+ printModelFn := params.printModelFn
+ packName := params.packName
+
plan, apiErr := api.Client.GetPlan(lib.CurrentPlanId)
if apiErr != nil {
term.OutputErrorAndExit("Error getting plan: %v", apiErr.Msg)
}
- config, apiErr := api.Client.GetPlanConfig(lib.CurrentPlanId)
- if apiErr != nil {
- term.OutputErrorAndExit("Error getting plan config: %v", apiErr.Msg)
+
+ config := params.config
+ if config == nil {
+ config, apiErr = api.Client.GetPlanConfig(lib.CurrentPlanId)
+ if apiErr != nil {
+ term.OutputErrorAndExit("Error getting plan config: %v", apiErr.Msg)
+ }
+ }
+
+ currentBranchesByPlanId, err := api.Client.GetCurrentBranchByPlanId(lib.CurrentProjectId, shared.GetCurrentBranchByPlanIdRequest{
+ CurrentBranchByPlanId: map[string]string{
+ lib.CurrentPlanId: lib.CurrentBranch,
+ },
+ })
+
+ if err != nil {
+ term.OutputErrorAndExit("Error getting current branches: %v", err)
}
term.StopSpinner()
@@ -754,42 +848,80 @@ func replWelcome(afterNew, isHelp bool) {
fmt.Println()
fmt.Println()
+ fmt.Println(lib.GetCurrentPlanTable(plan, currentBranchesByPlanId, nil))
+
table := tablewriter.NewWriter(os.Stdout)
table.SetAutoWrapText(false)
- table.SetHeader([]string{"Current Plan", "Branch", "REPL Mode", "Auto Mode", "Context"})
-
- var replModeIcon string
- if lib.CurrentReplState.Mode == lib.ReplModeTell {
- replModeIcon = "⚡️"
- } else if lib.CurrentReplState.Mode == lib.ReplModeChat {
- replModeIcon = "💬"
- }
-
var contextMode string
if config.AutoLoadContext {
- contextMode = "Auto"
+ contextMode = "auto"
} else {
- contextMode = "Manual"
+ contextMode = "manual"
}
- table.Append([]string{
- color.New(term.ColorHiGreen, color.Bold).Sprint(plan.Name),
- lib.CurrentBranch,
- strings.Title(string(lib.CurrentReplState.Mode)) + " " + replModeIcon,
- shared.AutoModeLabels[config.AutoMode],
- contextMode,
- })
+ var applyMode string
+ if config.AutoApply {
+ applyMode = "auto"
+ } else {
+ applyMode = "approve"
+ }
+
+ var executionMode string
+ if config.AutoExec {
+ executionMode = "auto"
+ } else if config.CanExec {
+ executionMode = "approve"
+ } else {
+ executionMode = "disabled"
+ }
- table.Render()
+ var commitMode string
+ if config.AutoCommit {
+ commitMode = "auto"
+ } else if config.SkipCommit {
+ commitMode = "skip"
+ } else {
+ commitMode = "manual"
+ }
- fmt.Println()
+ filesStr := "%s for loading files into context"
+ if contextMode == "auto" {
+ filesStr += " manually (optional)"
+ }
+ filesStr += "\n"
color.New(color.FgHiWhite).Printf("%s for commands\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\"))
- color.New(color.FgHiWhite).Printf("%s for loading files into context\n", color.New(term.ColorHiCyan, color.Bold).Sprint("@"))
+ color.New(color.FgHiWhite).Printf(filesStr, color.New(term.ColorHiCyan, color.Bold).Sprint("@"))
color.New(color.FgHiWhite).Printf("%s (\\h) for help\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\help"))
color.New(color.FgHiWhite).Printf("%s (\\q) to exit\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\quit"))
+ fmt.Println()
+
+ if printAutoFn != nil {
+ printAutoFn()
+ } else {
+ fmt.Printf("🚀 Using auto mode %s\n", color.New(color.Bold, term.ColorHiMagenta).Sprint(config.AutoMode))
+ }
+ fmt.Printf("⚙️ %s → %s · %s → %s · %s → %s · %s → %s\n",
+ color.New(color.FgHiWhite, color.Bold).Sprint("context"), contextMode,
+ color.New(color.FgHiWhite, color.Bold).Sprint("apply changes"), applyMode,
+ color.New(color.FgHiWhite, color.Bold).Sprint("execution"), executionMode,
+ color.New(color.FgHiWhite, color.Bold).Sprint("commits"), commitMode,
+ )
+ color.New(color.FgHiWhite).Printf("%s to change auto mode\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\set-auto"))
+ color.New(color.FgHiWhite).Printf("%s to see config\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\config"))
+ color.New(color.FgHiWhite).Printf("%s to customize config\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\set-config"))
+ fmt.Println()
+
+ if printModelFn != nil {
+ printModelFn()
+ } else {
+ fmt.Printf("🧠 Using model pack %s\n", color.New(color.Bold, term.ColorHiMagenta).Sprint(packName))
+ }
+ color.New(color.FgHiWhite).Printf("%s to see model details\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\models"))
+ color.New(color.FgHiWhite).Printf("%s to change models\n", color.New(term.ColorHiCyan, color.Bold).Sprint("\\set-model"))
+
showReplMode()
showMultiLineMode()
fmt.Println()
@@ -806,7 +938,10 @@ func replWelcome(afterNew, isHelp bool) {
}
func replHelp() {
- replWelcome(false, true)
+ replWelcome(replWelcomeParams{
+ afterNew: false,
+ isHelp: true,
+ })
term.PrintHelpAllCommands()
}
diff --git a/app/cli/cmd/root.go b/app/cli/cmd/root.go
index 6c700ed6..f11c2ae3 100644
--- a/app/cli/cmd/root.go
+++ b/app/cli/cmd/root.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"plandex-cli/term"
+ "strings"
"github.com/fatih/color"
"github.com/spf13/cobra"
@@ -26,8 +27,12 @@ var RootCmd = &cobra.Command{
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
// if no arguments were passed, start the repl
- if len(os.Args) == 1 {
- // call repl command
+ if len(os.Args) == 1 ||
+ (len(os.Args) == 2 && strings.HasPrefix(os.Args[1], "--") && os.Args[1] != "--help") ||
+ (len(os.Args) == 3 && strings.HasPrefix(os.Args[1], "--") && os.Args[1] != "--help" && strings.HasPrefix(os.Args[2], "--") && os.Args[2] != "--help") {
+
+ // Instead of directly calling replCmd.Run, parse the flags first
+ replCmd.ParseFlags(os.Args[1:])
replCmd.Run(replCmd, []string{})
return
}
diff --git a/app/cli/cmd/set_config.go b/app/cli/cmd/set_config.go
index b903fa99..77517e53 100644
--- a/app/cli/cmd/set_config.go
+++ b/app/cli/cmd/set_config.go
@@ -12,12 +12,15 @@ import (
shared "plandex-shared"
+ "github.com/fatih/color"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(setCmd)
setCmd.AddCommand(defaultSetCmd)
+ RootCmd.AddCommand(setAutoCmd)
+ setAutoCmd.AddCommand(setAutoDefaultCmd)
}
var setCmd = &cobra.Command{
@@ -34,6 +37,28 @@ var defaultSetCmd = &cobra.Command{
Args: cobra.MaximumNArgs(2),
}
+var setAutoCmd = &cobra.Command{
+ Use: "set-auto [value]",
+ Short: "Update config auto-mode",
+ Run: setAuto,
+ Args: cobra.MaximumNArgs(1),
+}
+
+var setAutoDefaultCmd = &cobra.Command{
+ Use: "default [value]",
+ Short: "Update default config auto-mode",
+ Run: setAutoDefault,
+ Args: cobra.MaximumNArgs(1),
+}
+
+func setAuto(cmd *cobra.Command, args []string) {
+ set(cmd, append([]string{"auto-mode"}, args...))
+}
+
+func setAutoDefault(cmd *cobra.Command, args []string) {
+ defaultSet(cmd, append([]string{"auto-mode"}, args...))
+}
+
func set(cmd *cobra.Command, args []string) {
auth.MustResolveAuthWithOrg()
lib.MustResolveProject()
@@ -75,25 +100,23 @@ func set(cmd *cobra.Command, args []string) {
lib.ShowPlanConfig(updatedConfig, key)
fmt.Println()
- if updatedConfig.AutoLoadContext && !config.AutoLoadContext {
- hasMap := false
+ loadMapIfNeeded(config, updatedConfig)
+ removeMapIfNeeded(config, updatedConfig)
- context, err := api.Client.ListContext(lib.CurrentPlanId, lib.CurrentBranch)
+ if !(config.AutoApply && config.AutoExec) && updatedConfig.AutoApply && updatedConfig.AutoExec {
+ color.New(term.ColorHiYellow, color.Bold).Println("⚠️ You enabled automatic apply and execution.")
- if err == nil {
- for _, c := range context {
- if c.ContextType == shared.ContextMapType {
- hasMap = true
- break
- }
- }
-
- if !hasMap {
- lib.MustLoadAutoContextMap()
- }
- }
+ fmt.Println()
+ } else if !config.AutoApply && updatedConfig.AutoApply {
+ color.New(term.ColorHiYellow, color.Bold).Println("⚠️ You enabled automatic apply.")
+ fmt.Println()
+ } else if !config.AutoExec && updatedConfig.AutoExec {
+ color.New(term.ColorHiYellow, color.Bold).Println("⚠️ You enabled automatic execution.")
+ fmt.Println()
}
+ term.StopSpinner()
+
term.PrintCmds("", "config", "config default", "set-config default")
}
@@ -294,3 +317,51 @@ func parseBooleanArg(value string) (bool, error) {
}
}
+
+func loadMapIfNeeded(originalConfig, updatedConfig *shared.PlanConfig) {
+ if updatedConfig.AutoLoadContext && !originalConfig.AutoLoadContext {
+ hasMap := false
+
+ term.StartSpinner("")
+ context, err := api.Client.ListContext(lib.CurrentPlanId, lib.CurrentBranch)
+
+ if err == nil {
+ for _, c := range context {
+ if c.ContextType == shared.ContextMapType {
+ hasMap = true
+ break
+ }
+ }
+
+ if !hasMap {
+ lib.MustLoadAutoContextMap()
+ fmt.Println()
+ }
+ }
+ }
+}
+
+func removeMapIfNeeded(originalConfig, updatedConfig *shared.PlanConfig) {
+ if originalConfig.AutoLoadContext && !updatedConfig.AutoLoadContext {
+ term.StartSpinner("")
+ context, err := api.Client.ListContext(lib.CurrentPlanId, lib.CurrentBranch)
+
+ if err == nil {
+ for _, c := range context {
+ if c.ContextType == shared.ContextMapType && (c.AutoLoaded || c.FilePath == ".") {
+ res, err := api.Client.DeleteContext(lib.CurrentPlanId, lib.CurrentBranch, shared.DeleteContextRequest{
+ Ids: map[string]bool{c.Id: true},
+ })
+ term.StopSpinner()
+ if err != nil {
+ term.OutputErrorAndExit("Error deleting context: %v", err)
+ return
+ }
+ fmt.Println("✅ " + res.Msg)
+ break
+ }
+ }
+ }
+
+ }
+}
diff --git a/app/cli/lib/apply.go b/app/cli/lib/apply.go
index acd70871..824224f4 100644
--- a/app/cli/lib/apply.go
+++ b/app/cli/lib/apply.go
@@ -115,6 +115,8 @@ func MustApplyPlanAttempt(
os.Exit(0)
}
+ term.ResumeSpinner()
+
currentPlanFiles := currentPlanState.CurrentPlanFiles
isRepo := fs.ProjectRootIsGitRepo()
@@ -145,6 +147,7 @@ func MustApplyPlanAttempt(
onGitErr := func(errMsg, unformattedErrMsg string) {
term.StopSpinner()
+ fmt.Println()
term.OutputSimpleError(errMsg, unformattedErrMsg)
}
@@ -302,12 +305,8 @@ var shellShebangs = map[string]string{
}
var applyScriptErrorHandling = map[string]string{
- "/bin/bash": `set -euo pipefail
-trap 'echo "Error on line $LINENO: $BASH_COMMAND"' ERR
-`,
- "/bin/zsh": `set -euo pipefail
-trap 'echo "Error on line $LINENO: ${funcfiletrace[0]#*:}"' ERR
-`,
+ "/bin/bash": `set -euo pipefail`,
+ "/bin/zsh": `set -euo pipefail`,
}
func execApplyScript(
diff --git a/app/cli/lib/context_load.go b/app/cli/lib/context_load.go
index 3e609304..062469b4 100644
--- a/app/cli/lib/context_load.go
+++ b/app/cli/lib/context_load.go
@@ -74,6 +74,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
ApiKeys: apiKeys,
OpenAIBase: openAIBase,
OpenAIOrgId: os.Getenv("OPENAI_ORG_ID"),
+ AutoLoaded: params.AutoLoaded,
})
}
@@ -91,6 +92,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
ApiKeys: apiKeys,
OpenAIBase: openAIBase,
OpenAIOrgId: os.Getenv("OPENAI_ORG_ID"),
+ AutoLoaded: params.AutoLoaded,
})
}
}
@@ -278,6 +280,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
Body: body,
FilePath: inputFilePath,
ForceSkipIgnore: params.ForceSkipIgnore,
+ AutoLoaded: params.AutoLoaded,
})
errCh <- nil
@@ -443,6 +446,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
Body: base64.StdEncoding.EncodeToString(fileContent),
FilePath: path,
ImageDetail: params.ImageDetail,
+ AutoLoaded: params.AutoLoaded,
})
} else {
loadContextReq = append(loadContextReq, &shared.LoadContextParams{
@@ -450,6 +454,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
Name: path,
Body: string(fileContent),
FilePath: path,
+ AutoLoaded: params.AutoLoaded,
})
}
@@ -475,6 +480,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
Name: name,
MapInputs: mapInputsByPath[inputPath],
FilePath: inputPath,
+ AutoLoaded: params.AutoLoaded,
})
}
}
@@ -512,6 +518,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {
Name: name,
Body: body,
Url: u,
+ AutoLoaded: params.AutoLoaded,
})
errCh <- nil
@@ -649,6 +656,7 @@ func AutoLoadContextFiles(ctx context.Context, files []string) (string, error) {
FilePath: path,
Name: path,
Body: string(body),
+ AutoLoaded: true,
})
errCh <- nil
@@ -677,22 +685,19 @@ func AutoLoadContextFiles(ctx context.Context, files []string) (string, error) {
}
func MustLoadAutoContextMap() {
- fmt.Println("Select a base directory to load context from. Press enter to use current directory (.), otherwise use a relative path like 'src' or 'lib'.")
- fmt.Println()
+ // fmt.Println("Select a base directory to load context from. Press enter to use current directory (.), otherwise use a relative path like 'src' or 'lib'.")
+ // fmt.Println()
- baseDir, err := term.GetUserStringInputWithDefault("Base directory for context:", ".")
+ // baseDir, err := term.GetUserStringInputWithDefault("Base directory for context:", ".")
- if err != nil {
- term.OutputErrorAndExit("Error: %v", err)
- }
-
- if baseDir == "" {
- baseDir = "."
- }
+ // if err != nil {
+ // term.OutputErrorAndExit("Error: %v", err)
+ // }
- MustLoadContext([]string{baseDir}, &types.LoadContextParams{
+ MustLoadContext([]string{"."}, &types.LoadContextParams{
DefsOnly: true,
SkipIgnoreWarning: true,
+ AutoLoaded: true,
})
}
diff --git a/app/cli/term/help.go b/app/cli/term/help.go
index 71a0e682..5168b9d5 100644
--- a/app/cli/term/help.go
+++ b/app/cli/term/help.go
@@ -18,7 +18,31 @@ type CmdConfig struct {
var CliCommands = []CmdConfig{
{"", "", "start the Plandex REPL", false},
+
+ {"--full", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", color.New(color.Bold).Sprint("full")), false},
+ {"--semi", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", color.New(color.Bold).Sprint("semi")), false},
+ {"--plus", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", color.New(color.Bold).Sprint("plus")), false},
+ {"--basic", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", color.New(color.Bold).Sprint("basic")), false},
+ {"--none", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", color.New(color.Bold).Sprint("none")), false},
+
+ {"--daily", "", fmt.Sprintf("start the Plandex REPL with %s model pack", color.New(color.Bold).Sprint("daily-driver")), false},
+ {"--strong", "", fmt.Sprintf("start the Plandex REPL with %s model pack", color.New(color.Bold).Sprint("strong")), false},
+ {"--cheap", "", fmt.Sprintf("start the Plandex REPL with %s model pack", color.New(color.Bold).Sprint("cheap")), false},
+ {"--oss", "", fmt.Sprintf("start the Plandex REPL with %s model pack", color.New(color.Bold).Sprint("oss")), false},
+
{"new", "", "start a new plan", true},
+
+ {"new --full", "", fmt.Sprintf("start a new plan with auto-mode %s", color.New(color.Bold).Sprint("full")), true},
+ {"new --semi", "", fmt.Sprintf("start a new plan with auto-mode %s", color.New(color.Bold).Sprint("semi")), true},
+ {"new --plus", "", fmt.Sprintf("start a new plan with auto-mode %s", color.New(color.Bold).Sprint("plus")), true},
+ {"new --basic", "", fmt.Sprintf("start a new plan with auto-mode %s", color.New(color.Bold).Sprint("basic")), true},
+ {"new --none", "", fmt.Sprintf("start a new plan with auto-mode %s", color.New(color.Bold).Sprint("none")), true},
+
+ {"new --daily", "", fmt.Sprintf("start a new plan with %s model pack", color.New(color.Bold).Sprint("daily-driver")), true},
+ {"new --strong", "", fmt.Sprintf("start a new plan with %s model pack", color.New(color.Bold).Sprint("strong")), true},
+ {"new --cheap", "", fmt.Sprintf("start a new plan with %s model pack", color.New(color.Bold).Sprint("cheap")), true},
+ {"new --oss", "", fmt.Sprintf("start a new plan with %s model pack", color.New(color.Bold).Sprint("oss")), true},
+
{"plans", "pl", "list plans", true},
{"cd", "", "set current plan by name or index", true},
{"current", "cu", "show current plan", true},
@@ -27,8 +51,17 @@ var CliCommands = []CmdConfig{
{"config", "", "show current plan config", true},
{"set-config", "", "update current plan config", true},
- {"config default", "", "show default config for new plans", true},
- {"set-config default", "", "update default config for new plans", true},
+ {"config default", "", "show the default config for new plans", true},
+ {"set-config default", "", "update the default config for new plans", true},
+
+ {"set-auto", "", "update auto-mode (autonomy level) for current plan", true},
+ {"set-auto none", "", fmt.Sprintf("set auto-mode to %s", color.New(color.Bold).Sprint("none")), true},
+ {"set-auto basic", "", fmt.Sprintf("set auto-mode to %s", color.New(color.Bold).Sprint("basic")), true},
+ {"set-auto plus", "", fmt.Sprintf("set auto-mode to %s", color.New(color.Bold).Sprint("plus")), true},
+ {"set-auto semi", "", fmt.Sprintf("set auto-mode to %s", color.New(color.Bold).Sprint("semi")), true},
+ {"set-auto full", "", fmt.Sprintf("set auto-mode to %s", color.New(color.Bold).Sprint("full")), true},
+
+ {"set-auto default", "", "set the default auto-mode for new plans", true},
{"tell", "t", "describe a task to complete", false},
{"chat", "ch", "ask a question or chat", false},
@@ -40,9 +73,8 @@ var CliCommands = []CmdConfig{
{"update", "u", "update outdated context", true},
{"show", "", "show current context by name or index", true},
- // {"changes", "", "review pending changes in a TUI", false},
- {"diff", "", "review pending changes", true},
- {"diff --git", "", "review pending changes in 'git diff' format", true},
+ {"diff --ui", "", "review pending changes in a browser UI", true},
+ {"diff", "", "review pending changes in 'git diff' format", true},
{"diff --plain", "", "review pending changes in 'git diff' format with no color formatting", false},
{"summary", "", "show the latest summary of the current plan", true},
@@ -70,7 +102,7 @@ var CliCommands = []CmdConfig{
{"unarchive", "unarc", "unarchive a plan", true},
{"models", "", "show current plan model settings", true},
- {"models default", "", "show org-wide default model settings for new plans", true},
+ {"models default", "", "show the default model settings for new plans", true},
{"models available", "", "show all available models", true},
{"models available --custom", "", "show available custom models only", true},
{"models delete", "", "delete a custom model", true},
@@ -80,7 +112,12 @@ var CliCommands = []CmdConfig{
{"model-packs delete", "", "delete a custom model pack", true},
{"model-packs --custom", "", "show custom model packs only", true},
{"set-model", "", "update current plan model settings", true},
- {"set-model default", "", "update org-wide default model settings for new plans", true},
+ {"set-model default", "", "update the default model settings for new plans", true},
+
+ {"set-model daily", "", fmt.Sprintf("Use %s model pack", color.New(color.Bold).Sprint("daily-driver")), true},
+ {"set-model strong", "", fmt.Sprintf("Use %s model pack", color.New(color.Bold).Sprint("strong")), true},
+ {"set-model cheap", "", fmt.Sprintf("Use %s model pack", color.New(color.Bold).Sprint("cheap")), true},
+ {"set-model oss", "", fmt.Sprintf("Use %s model pack", color.New(color.Bold).Sprint("oss")), true},
{"ps", "", "list active and recently finished plan streams", true},
{"stop", "", "stop an active plan stream", true},
@@ -184,31 +221,54 @@ func PrintCustomHelp(all bool) {
color.New(color.Bold, color.BgMagenta, color.FgHiWhite).Fprintln(builder, " Getting Started ")
fmt.Fprintln(builder)
- fmt.Fprintf(builder, " 1 - Create a new plan in your project's root directory with %s\n", color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" plandex new "))
+ fmt.Fprintf(builder, " 🚀 Start the Plandex REPL in a project directory with %s or %s\n", color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" plandex "), color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" pdx "))
+ fmt.Fprintln(builder)
+ fmt.Fprintf(builder, " 💻 You can also use any command outside the REPL with %s or %s\n", color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" plandex [command] "), color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" pdx [command] "))
fmt.Fprintln(builder)
- fmt.Fprintf(builder, " 2 - Load any relevant context with %s\n", color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" plandex load [file-path-or-url] "))
+
+ color.New(color.Bold, color.BgMagenta, color.FgHiWhite).Fprintln(builder, " REPL Options ")
fmt.Fprintln(builder)
- fmt.Fprintf(builder, " 3 - Describe a task to complete with %s\n", color.New(color.Bold, color.BgCyan, color.FgHiWhite).Sprint(" plandex tell "))
+ // Add REPL startup flags
+ fmt.Fprintln(builder, color.New(color.Bold, color.FgHiBlue).Sprint(" Mode "))
+ fmt.Fprintln(builder, " --chat, -c Start in chat mode (for conversation without making changes)")
+ fmt.Fprintln(builder, " --tell, -t Start in tell mode (for implementation)")
fmt.Fprintln(builder)
- if all {
+ fmt.Fprintln(builder, color.New(color.Bold, color.FgHiBlue).Sprint(" Autonomy "))
+ fmt.Fprintln(builder, " --no-auto None → step-by-step, no automation")
+ fmt.Fprintln(builder, " --basic Basic → auto-continue plans")
+ fmt.Fprintln(builder, " --plus Plus → auto-update context, smart context, auto-commit changes")
+ fmt.Fprintln(builder, " --semi Semi-Auto → auto-load context")
+ fmt.Fprintln(builder, " --full Full-Auto → auto-apply, auto-exec, auto-debug")
+ fmt.Fprintln(builder)
- } else {
+ fmt.Fprintln(builder, color.New(color.Bold, color.FgHiBlue).Sprint(" Models "))
+ fmt.Fprintln(builder, " --daily Daily driver pack")
+ fmt.Fprintln(builder, " --strong Strong pack")
+ fmt.Fprintln(builder, " --cheap Cheap pack")
+ fmt.Fprintln(builder, " --oss Open source pack")
+ fmt.Fprintln(builder)
+ if all {
+ fmt.Print(builder.String())
+ PrintHelpAllCommands()
+ } else {
+ fmt.Print(builder.String())
// in the same style as 'getting started' section, output See All Commands
color.New(color.Bold, color.BgHiBlue, color.FgHiWhite).Fprintln(builder, " Use 'plandex help --all' or 'plandex help -a' for a list of all commands ")
+ fmt.Fprintln(builder)
+ fmt.Print(builder.String())
}
- fmt.Print(builder.String())
}
func PrintHelpAllCommands() {
builder := &strings.Builder{}
color.New(color.Bold, color.BgMagenta, color.FgHiWhite).Fprintln(builder, " Key Commands ")
- printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiMagenta}, "new", "load", "tell", "diff", "diff --ui", "apply", "reject", "debug", "chat")
+ printCmds(builder, " ", []color.Attribute{color.Bold, color.FgHiMagenta}, "new", "load", "tell", "diff", "diff --ui", "apply", "reject", "debug", "chat")
fmt.Fprintln(builder)
color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Plans ")
@@ -243,8 +303,16 @@ func PrintHelpAllCommands() {
printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "config", "set-config", "config default", "set-config default")
fmt.Fprintln(builder)
+ color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Autonomy ")
+ printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "set-auto", "set-auto default", "set-auto full", "set-auto semi", "set-auto plus", "set-auto basic", "set-auto none")
+ fmt.Fprintln(builder)
+
color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " AI Models ")
- printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "models", "models default", "models available", "set-model", "set-model default", "models available --custom", "models add", "models delete", "model-packs", "model-packs --custom", "model-packs create", "model-packs delete")
+ printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "models", "models default", "model-packs", "set-model", "set-model daily", "set-model strong", "set-model cheap", "set-model oss", "set-model default")
+ fmt.Fprintln(builder)
+
+ color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Custom Models ")
+ printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "models available", "models available --custom", "models add", "models delete", "model-packs --custom", "model-packs create", "model-packs delete")
fmt.Fprintln(builder)
color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Accounts ")
@@ -253,6 +321,11 @@ func PrintHelpAllCommands() {
color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Cloud ")
printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "credits", "usage", "billing")
+ fmt.Fprintln(builder)
+
+ color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " New Plan Shortcuts ")
+ printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "new --full", "new --semi", "new --plus", "new --basic", "new --none", "new --daily", "new --strong", "new --cheap", "new --oss")
+ fmt.Fprintln(builder)
fmt.Print(builder.String())
}
diff --git a/app/shared/plan_config.go b/app/shared/plan_config.go
index af0bf3df..69a2b4d3 100644
--- a/app/shared/plan_config.go
+++ b/app/shared/plan_config.go
@@ -19,21 +19,30 @@ const defaultEditor = EditorTypeVim
type AutoModeType string
const (
- AutoModeFull AutoModeType = "full"
- AutoModeSemi AutoModeType = "semi"
- AutoModeBasicPlus AutoModeType = "basic-plus"
- AutoModeBasic AutoModeType = "basic"
- AutoModeNone AutoModeType = "none"
- AutoModeCustom AutoModeType = "custom"
+ AutoModeFull AutoModeType = "full"
+ AutoModeSemi AutoModeType = "semi"
+ AutoModePlus AutoModeType = "plus"
+ AutoModeBasic AutoModeType = "basic"
+ AutoModeNone AutoModeType = "none"
+ AutoModeCustom AutoModeType = "custom"
)
+var AutoModeDescriptions = map[AutoModeType]string{
+ AutoModeFull: "Fully automated: context, apply, execution and debugging",
+ AutoModeSemi: "Auto context, manual apply and execution",
+ AutoModePlus: "Manual context with auto updates and smart loading, manual apply and execution",
+ AutoModeBasic: "Manual context, manual apply and execution",
+ AutoModeNone: "Fully manual and step-by-step, one response at a time, manual builds",
+ AutoModeCustom: "Choose settings individually with set-config command",
+}
+
var AutoModeOptions = [][3]string{
- {string(AutoModeFull), "Full Auto", "Fully automated: context, apply, execution and debugging"},
- {string(AutoModeSemi), "Semi Auto", "Auto context, manual apply and execution"},
- {string(AutoModeBasicPlus), "Basic Plus", "Manual context with auto updates and smart loading, manual apply and execution"},
- {string(AutoModeBasic), "Basic", "Manual context, manual apply and execution"},
- {string(AutoModeNone), "None", "Fully manual and step-by-step, one response at a time, manual builds"},
- {string(AutoModeCustom), "Custom", "Choose your own combination of automation settings"},
+ {string(AutoModeFull), "Full Auto", AutoModeDescriptions[AutoModeFull]},
+ {string(AutoModeSemi), "Semi Auto", AutoModeDescriptions[AutoModeSemi]},
+ {string(AutoModePlus), "Basic Plus", AutoModeDescriptions[AutoModePlus]},
+ {string(AutoModeBasic), "Basic", AutoModeDescriptions[AutoModeBasic]},
+ {string(AutoModeNone), "None", AutoModeDescriptions[AutoModeNone]},
+ {string(AutoModeCustom), "Custom", AutoModeDescriptions[AutoModeCustom]},
}
var AutoModeLabels = map[AutoModeType]string{}
@@ -142,7 +151,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.AutoDebug = false
p.AutoRevertOnRewind = true
- case AutoModeBasicPlus:
+ case AutoModePlus:
p.AutoContinue = true
p.AutoBuild = true
p.AutoUpdateContext = true
@@ -153,7 +162,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = true
p.AutoExec = false
p.AutoDebug = false
- p.AutoRevertOnRewind = false
+ p.AutoRevertOnRewind = true
case AutoModeBasic:
p.AutoContinue = true
@@ -166,7 +175,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = false
p.AutoExec = false
p.AutoDebug = false
- p.AutoRevertOnRewind = false
+ p.AutoRevertOnRewind = true
case AutoModeNone:
p.AutoContinue = false
@@ -179,7 +188,7 @@ func (p *PlanConfig) SetAutoMode(mode AutoModeType) {
p.CanExec = false
p.AutoExec = false
p.AutoDebug = false
- p.AutoRevertOnRewind = false
+ p.AutoRevertOnRewind = true
}
}