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
[44;97;1m 🤖 Plandex [0;0;22m
Dane Schneider235497a0e811
diff --git a/cli/cmd/tell.go b/cli/cmd/tell.goindex 8cbb65d0..7a70c008 100644--- a/cli/cmd/tell.go+++ b/cli/cmd/tell.go@@ -110,6 +110,49 @@ func tell(cmd *cobra.Command, args []string) {}func prepareEditorCommand(editor string, filename string) *exec.Cmd {+ switch editor {+ case "vim":+ vimInstructions := "Write your prompt below, then save and exit to send it to Plandex.\n\n" ++ "Vim Instructions:\n" ++ "Use the arrow keys or 'hjkl' to navigate around the text.\n" ++ "Press 'i' to enter 'Insert' mode and start typing your prompt.\n" ++ "To exit 'Insert' mode and go back to 'Normal' mode, press 'Esc'.\n" ++ "In 'Normal' mode, type ':wq' followed by 'Enter' key to save and exit.\n" ++ "If you want to exit without saving, type ':q!' followed by 'Enter'."++ // Write the Vim specific instructions into the temporary file+ err := os.WriteFile(filename, []byte(vimInstructions), 0644)+ if err != nil {+ fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)+ return nil+ }++ return exec.Command(editor, filename)++ case "nano":+ nanoInstructions := "Write your prompt below, then save and exit to send it to Plandex.\n\n" ++ "Nano Instructions:\n" ++ "Use the arrow keys to navigate around the text.\n" ++ "Type your prompt as needed.\n" ++ "When you're ready, press 'Ctrl + O' to save the file, then 'Enter' to confirm.\n" ++ "Finally, press 'Ctrl + X' to exit Nano and send your prompt."++ // Write the Nano specific instructions into the temporary file+ err := os.WriteFile(filename, []byte(nanoInstructions), 0644)+ if err != nil {+ fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)+ return nil+ }++ return exec.Command(editor, filename)+ default:+ return exec.Command(editor, filename)+ }+ if err != nil {+ fmt.Fprintln(os.Stderr, "Failed to write instructions to temporary file:", err)+ return nil+ }+switch editor {case "vim":return exec.Command(editor, "+normal G$", "+startinsert!", filename)diff --git a/cli/lib/select.go b/cli/lib/select.gonew file mode 100644index 00000000..51e45e3a--- /dev/null+++ b/cli/lib/select.go@@ -0,0 +1,31 @@+package lib++import (+ "fmt"++ "github.com/fatih/color"+ "github.com/plandex-ai/survey/v2"+)++func SelectFromList(msg string, options []string) (string, error) {+ var selected string+ prompt := &survey.Select{+ Message: color.New(color.FgHiMagenta, color.Bold).Sprint(msg),+ Options: convertToStringSlice(options),+ FilterMessage: "",+ }+ err := survey.AskOne(prompt, &selected)+ if err != nil {+ return "", err+ }++ return selected, nil+}++func convertToStringSlice[T any](input []T) []string {+ var result []string+ for _, v := range input {+ result = append(result, fmt.Sprint(v))+ }+ return result+}