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
go-prompt fixes, fix for loading of duplicate images, timeout for upgrade version check, remove special chars in help text
Dane Schneider07b475adca9a
diff --git a/app/cli/go.mod b/app/cli/go.modindex a1eb58a0..71f823d5 100644--- a/app/cli/go.mod+++ b/app/cli/go.mod@@ -9,7 +9,7 @@ require (github.com/muesli/reflow v0.3.0github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907agithub.com/olekukonko/tablewriter v0.0.5- github.com/plandex-ai/go-prompt v0.0.0-20250207121803-6be77f7193aa+ github.com/plandex-ai/go-prompt v0.0.0-20250304173555-1f364907fc6cgithub.com/plandex-ai/survey/v2 v2.3.7github.com/sashabaranov/go-openai v1.35.6github.com/shopspring/decimal v1.4.0diff --git a/app/cli/go.sum b/app/cli/go.sumindex 449174a5..8d053091 100644--- a/app/cli/go.sum+++ b/app/cli/go.sum@@ -607,8 +607,8 @@ github.com/pkg/term v1.2.0-beta.2 h1:L3y/h2jkuBVFdWiJvNfYfKmzcCnILw7mJWm2JQuMppwgithub.com/pkg/term v1.2.0-beta.2/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=github.com/pkoukk/tiktoken-go v0.1.7 h1:qOBHXX4PHtvIvmOtyg1EeKlwFRiMKAcoMp4Q+bLQDmw=github.com/pkoukk/tiktoken-go v0.1.7/go.mod h1:9NiV+i9mJKGj1rYOT+njbv+ZwA/zJxYdewGl6qVatpg=-github.com/plandex-ai/go-prompt v0.0.0-20250207121803-6be77f7193aa h1:kBelDvK3qBN8OQ6dtXCWKxtn7DR5H5QSFZbRon/OHRA=-github.com/plandex-ai/go-prompt v0.0.0-20250207121803-6be77f7193aa/go.mod h1:SqEsJfsIr0GYUyLatvezDOBe6XsCw64E7v33QzeH5PM=+github.com/plandex-ai/go-prompt v0.0.0-20250304173555-1f364907fc6c h1:bki/wkg5iFBOv3jCPUDNuH5yLngUPUdEJCSuvc2tiQ0=+github.com/plandex-ai/go-prompt v0.0.0-20250304173555-1f364907fc6c/go.mod h1:SqEsJfsIr0GYUyLatvezDOBe6XsCw64E7v33QzeH5PM=github.com/plandex-ai/survey/v2 v2.3.7 h1:u1o6bflbaBpW8i8krm+91Z2cOcvZcMVS+AjV+rgR8Rk=github.com/plandex-ai/survey/v2 v2.3.7/go.mod h1:RiBOKRDB5fOQrOzsiAPAN57hYqFKPkCxgSK7twcDOys=github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=diff --git a/app/cli/lib/context_load.go b/app/cli/lib/context_load.goindex 90c4dd98..a24f3607 100644--- a/app/cli/lib/context_load.go+++ b/app/cli/lib/context_load.go@@ -132,7 +132,7 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {existsByComposite := make(map[string]*shared.Context)for _, context := range existingContexts {switch context.ContextType {- case shared.ContextFileType, shared.ContextDirectoryTreeType, shared.ContextMapType:+ case shared.ContextFileType, shared.ContextDirectoryTreeType, shared.ContextMapType, shared.ContextImageType:existsByComposite[strings.Join([]string{string(context.ContextType), context.FilePath}, "|")] = contextcase shared.ContextURLType:existsByComposite[strings.Join([]string{string(context.ContextType), context.Url}, "|")] = context@@ -425,26 +425,24 @@ func MustLoadContext(resources []string, params *types.LoadContextParams) {go func(path string) {var fileContent []bytevar size int64- if shared.HasFileMapSupport(path) {- // File size check- fileInfo, err := os.Stat(path)- if err != nil {- errCh <- fmt.Errorf("failed to get file info for %s: %v", path, err)- return- }+ // File size check+ fileInfo, err := os.Stat(path)+ if err != nil {+ errCh <- fmt.Errorf("failed to get file info for %s: %v", path, err)+ return+ }- size = fileInfo.Size()+ size = fileInfo.Size()- if size > shared.MaxContextBodySize {- errCh <- fmt.Errorf("file %s exceeds size limit (size %.2f MB, limit %d MB)", path, float64(fileInfo.Size())/1024/1024, int(shared.MaxContextBodySize)/1024/1024)- return- }+ if size > shared.MaxContextBodySize {+ errCh <- fmt.Errorf("file %s exceeds size limit (size %.2f MB, limit %d MB)", path, float64(fileInfo.Size())/1024/1024, int(shared.MaxContextBodySize)/1024/1024)+ return+ }- fileContent, err = os.ReadFile(path)- if err != nil {- errCh <- fmt.Errorf("failed to read the file %s: %v", path, err)- return- }+ fileContent, err = os.ReadFile(path)+ if err != nil {+ errCh <- fmt.Errorf("failed to read the file %s: %v", path, err)+ return}contextMu.Lock()diff --git a/app/cli/term/help.go b/app/cli/term/help.goindex cc5cf28d..bc28aa5e 100644--- a/app/cli/term/help.go+++ b/app/cli/term/help.go@@ -19,29 +19,29 @@ 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},+ // {"--full", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", "'full'"), false},+ // {"--semi", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", "'semi'"), false},+ // {"--plus", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", "'plus'"), false},+ // {"--basic", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", "'basic'"), false},+ // {"--none", "", fmt.Sprintf("start the Plandex REPL with auto-mode %s", "'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},+ // {"--daily", "", fmt.Sprintf("start the Plandex REPL with %s model pack", "'daily-driver'"), false},+ // {"--strong", "", fmt.Sprintf("start the Plandex REPL with %s model pack", "'strong'"), false},+ // {"--cheap", "", fmt.Sprintf("start the Plandex REPL with %s model pack", "'cheap'"), false},+ // {"--oss", "", fmt.Sprintf("start the Plandex REPL with %s model pack", "'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 --full", "", fmt.Sprintf("start a new plan with auto-mode %s", "'full'"), true},+ {"new --semi", "", fmt.Sprintf("start a new plan with auto-mode %s", "'semi'"), true},+ {"new --plus", "", fmt.Sprintf("start a new plan with auto-mode %s", "'plus'"), true},+ {"new --basic", "", fmt.Sprintf("start a new plan with auto-mode %s", "'basic'"), true},+ {"new --none", "", fmt.Sprintf("start a new plan with auto-mode %s", "'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},+ {"new --daily", "", fmt.Sprintf("start a new plan with %s model pack", "'daily-driver'"), true},+ {"new --strong", "", fmt.Sprintf("start a new plan with %s model pack", "'strong'"), true},+ {"new --cheap", "", fmt.Sprintf("start a new plan with %s model pack", "'cheap'"), true},+ {"new --oss", "", fmt.Sprintf("start a new plan with %s model pack", "'oss'"), true},{"plans", "pl", "list plans", true},{"cd", "", "set current plan by name or index", true},@@ -55,11 +55,11 @@ var CliCommands = []CmdConfig{{"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 none", "", fmt.Sprintf("set auto-mode to %s", "'none'"), true},+ {"set-auto basic", "", fmt.Sprintf("set auto-mode to %s", "'basic'"), true},+ {"set-auto plus", "", fmt.Sprintf("set auto-mode to %s", "'plus'"), true},+ {"set-auto semi", "", fmt.Sprintf("set auto-mode to %s", "'semi'"), true},+ {"set-auto full", "", fmt.Sprintf("set auto-mode to %s", "'full'"), true},{"set-auto default", "", "set the default auto-mode for new plans", true},@@ -114,10 +114,10 @@ var CliCommands = []CmdConfig{{"set-model", "", "update current plan model settings", 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},+ {"set-model daily", "", fmt.Sprintf("Use %s model pack", "'daily-driver'"), true},+ {"set-model strong", "", fmt.Sprintf("Use %s model pack", "'strong'"), true},+ {"set-model cheap", "", fmt.Sprintf("Use %s model pack", "'cheap'"), true},+ {"set-model oss", "", fmt.Sprintf("Use %s model pack", "'oss'"), true},{"ps", "", "list active and recently finished plan streams", true},{"stop", "", "stop an active plan stream", true},@@ -180,7 +180,7 @@ func printCmds(w io.Writer, prefix string, colors []color.Attribute, cmds ...str}}- // desc += color.New(color.FgWhite).Sprintf(" • alias → %s", color.New(color.Bold).Sprint(alias))+ // desc += color.New(color.FgWhite).Sprintf(" • alias → %s", fmt.Sprint(a'lias'))}var styled string@@ -199,7 +199,7 @@ func printCmds(w io.Writer, prefix string, colors []color.Attribute, cmds ...strfunc PrintCustomCmd(prefix, cmd, alias, desc string) {cmd = strings.Replace(cmd, alias, fmt.Sprintf("(%s)", alias), 1)- // desc += color.New(color.FgWhite).Sprintf(" • alias → %s", color.New(color.Bold).Sprint(alias))+ // desc += color.New(color.FgWhite).Sprintf(" • alias → %s", fmt.Sprint(a'lias'))styled := color.New(color.Bold, color.FgHiWhite, color.BgCyan, color.FgHiWhite).Sprintf(" plandex %s ", cmd)fmt.Printf("%s%s 👉 %s\n", prefix, styled, desc)}diff --git a/app/cli/upgrade.go b/app/cli/upgrade.goindex e0820594..66195197 100644--- a/app/cli/upgrade.go+++ b/app/cli/upgrade.go@@ -3,6 +3,7 @@ package mainimport ("archive/tar""compress/gzip"+ "context""errors""fmt""io"@@ -16,6 +17,7 @@ import ("plandex-cli/version""runtime""strings"+ "time""github.com/Masterminds/semver""github.com/fatih/color"@@ -33,8 +35,15 @@ func checkForUpgrade() {term.StartSpinner("")defer term.StopSpinner()+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ defer cancel()latestVersionURL := "https://plandex.ai/v2/cli-version.txt"- resp, err := http.Get(latestVersionURL)+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, latestVersionURL, nil)+ if err != nil {+ log.Println("Error creating request:", err)+ return+ }+ resp, err := http.DefaultClient.Do(req)if err != nil {log.Println("Error checking latest version:", err)return