Skip to content

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

help command

Dane Schneiderc35b54548377
diff --git a/app/cli/changes_tui/model.go b/app/cli/changes_tui/model.go
index 204f976b..9515664d 100644
--- a/app/cli/changes_tui/model.go
+++ b/app/cli/changes_tui/model.go
@@ -141,7 +141,7 @@ func initialModel() *changesUIModel {
// ),
quit: bubbleKey.NewBinding(
- bubbleKey.WithKeys("q", "ctrl+c", "esc"),
+ bubbleKey.WithKeys("q", "ctrl+c"),
bubbleKey.WithHelp("q", "quit"),
),
},
diff --git a/app/cli/cmd/continue.go b/app/cli/cmd/continue.go
index 9afb0221..0e4c406f 100644
--- a/app/cli/cmd/continue.go
+++ b/app/cli/cmd/continue.go
@@ -15,7 +15,7 @@ import (
var continueCmd = &cobra.Command{
Use: "continue",
Aliases: []string{"c"},
- Short: "Continue the plan.",
+ Short: "Continue the plan",
Run: doContinue,
}
diff --git a/app/cli/cmd/convo.go b/app/cli/cmd/convo.go
index 310473be..f10cb377 100644
--- a/app/cli/cmd/convo.go
+++ b/app/cli/cmd/convo.go
@@ -16,7 +16,7 @@ import (
// convoCmd represents the convo command
var convoCmd = &cobra.Command{
Use: "convo",
- Short: "Display complete conversation history.",
+ Short: "Display complete conversation history",
Run: convo,
}
diff --git a/app/cli/cmd/log.go b/app/cli/cmd/log.go
index 856ac559..7f1a2f1e 100644
--- a/app/cli/cmd/log.go
+++ b/app/cli/cmd/log.go
@@ -17,7 +17,7 @@ var logCmd = &cobra.Command{
Use: "log",
Aliases: []string{"history", "logs"},
Short: "Show plan history",
- Long: `Show plan history.`,
+ Long: `Show plan history`,
Args: cobra.NoArgs,
Run: runLog,
}
diff --git a/app/cli/cmd/new.go b/app/cli/cmd/new.go
index 205c7729..74763de9 100644
--- a/app/cli/cmd/new.go
+++ b/app/cli/cmd/new.go
@@ -20,7 +20,7 @@ var name string
var newCmd = &cobra.Command{
Use: "new",
Aliases: []string{"n"},
- Short: "Start a new plan.",
+ Short: "Start a new plan",
// Long: ``,
Args: cobra.ExactArgs(0),
Run: new,
diff --git a/app/cli/cmd/root.go b/app/cli/cmd/root.go
index 123cafab..46d69610 100644
--- a/app/cli/cmd/root.go
+++ b/app/cli/cmd/root.go
@@ -1,19 +1,11 @@
-func init() {
- var helpCmd = &cobra.Command{
- Use: "help",
- Short: "Display help for Plandex",
- Long: `Display help for Plandex.`,
- Run: func(cmd *cobra.Command, args []string) {
- term.PrintCustomHelp()
- },
- }
-
- RootCmd.AddCommand(helpCmd)
-}package cmd
+package cmd
import (
- "github.com/spf13/cobra"
+ "log"
+
"plandex/term"
+
+ "github.com/spf13/cobra"
)
// RootCmd represents the base command when called without any subcommands
@@ -37,3 +29,17 @@ func Execute() {
func run(cmd *cobra.Command, args []string) {
}
+
+func init() {
+ var helpCmd = &cobra.Command{
+ Use: "help",
+ Aliases: []string{"h"},
+ Short: "Display help for Plandex",
+ Long: `Display help for Plandex.`,
+ Run: func(cmd *cobra.Command, args []string) {
+ term.PrintCustomHelp()
+ },
+ }
+
+ RootCmd.AddCommand(helpCmd)
+}
diff --git a/app/cli/cmd/tell.go b/app/cli/cmd/tell.go
index ae187092..9262236e 100644
--- a/app/cli/cmd/tell.go
+++ b/app/cli/cmd/tell.go
@@ -27,7 +27,7 @@ var tellNoBuild bool
var tellCmd = &cobra.Command{
Use: "tell [prompt]",
Aliases: []string{"t"},
- Short: "Send a prompt for the current plan.",
+ Short: "Send a prompt for the current plan",
// Long: ``,
Args: cobra.RangeArgs(0, 1),
Run: doTell,
diff --git a/app/cli/stream_tui/model.go b/app/cli/stream_tui/model.go
index feab0353..d410c53e 100644
--- a/app/cli/stream_tui/model.go
+++ b/app/cli/stream_tui/model.go
@@ -98,7 +98,7 @@ func initialModel(prestartReply, prompt string, buildOnly bool) *streamUIModel {
reply: prestartReply,
keymap: keymap{
quit: bubbleKey.NewBinding(
- bubbleKey.WithKeys("b", "ctrl+c", "esc"),
+ bubbleKey.WithKeys("b", "ctrl+c"),
bubbleKey.WithHelp("ctrl+c", "quit"),
),
diff --git a/app/cli/term/errors.go b/app/cli/term/errors.go
index f6d1e231..9463e753 100644
--- a/app/cli/term/errors.go
+++ b/app/cli/term/errors.go
@@ -30,8 +30,11 @@ func OutputErrorAndExit(msg string, args ...interface{}) {
for n := 0; n < i; n++ {
displayMsg += " "
}
+ if i > 0 {
+ displayMsg += "→ "
+ }
- displayMsg += "→ " + shared.Capitalize(part)
+ displayMsg += shared.Capitalize(part)
}
} else {
displayMsg = shared.Capitalize(msg)
diff --git a/app/cli/term/term.go b/app/cli/term/help.go
similarity index 51%
rename from app/cli/term/term.go
rename to app/cli/term/help.go
index 1801b99a..994de213 100644
--- a/app/cli/term/term.go
+++ b/app/cli/term/help.go
@@ -1,58 +1,10 @@
package term
-// PrintCustomHelp prints the custom help output for the Plandex CLI
-func PrintCustomHelp() {
- fmt.Println("Usage:")
- fmt.Println(" plandex [command] [flags]")
- fmt.Println(" pdx [command] [flags]")
- fmt.Println()
-
- // Core functionalities
- fmt.Println("Core Commands:")
- PrintCmds("", "new", "load", "tell", "changes", "apply", "continue")
- fmt.Println()
-
- // Plan management
- fmt.Println("Plan Management:")
- PrintCmds("", "current", "plans", "cd", "delete-plan")
- fmt.Println()
-
- // Branch management
- fmt.Println("Branch Management:")
- PrintCmds("", "branches", "checkout", "delete-branch")
- fmt.Println()
-
- // Context management
- fmt.Println("Context Management:")
- PrintCmds("", "ls", "rm", "clear")
- fmt.Println()
-
- // Advanced features
- fmt.Println("Advanced Features:")
- PrintCmds("", "build", "models", "set-model", "log", "convo", "rewind")
- fmt.Println()
-
- // Streaming and collaboration
- fmt.Println("Streaming and Collaboration:")
- PrintCmds("", "ps", "connect", "stop")
- fmt.Println()
-
- // Help and settings
- fmt.Println("Help and Settings:")
- PrintCmds("", "help", "sign-in")
- fmt.Println()
-}
-package term
-
import (
"fmt"
- "log"
- "os"
- "os/exec"
"strings"
"github.com/fatih/color"
- "golang.org/x/term"
)
var CmdDesc = map[string][2]string{
@@ -64,7 +16,7 @@ var CmdDesc = map[string][2]string{
"changes": {"ch", "show plan changes"},
// "diffs": {"d", "show diffs between plan and project files"},
// "preview": {"pv", "preview the plan in a branch"},
- "apply": {"ap", "apply the plan to your project files"},
+ "apply": {"ap", "apply plan changes to project files"},
"continue": {"c", "continue the plan"},
// "status": {"s", "show status of the plan"},
"rewind": {"rw", "rewind to a previous state"},
@@ -88,6 +40,14 @@ var CmdDesc = map[string][2]string{
}
func PrintCmds(prefix string, cmds ...string) {
+ printCmds(prefix, []color.Attribute{color.Bold, color.FgHiWhite, color.BgCyan}, cmds...)
+}
+
+func PrintCmdsWithColors(prefix string, colors []color.Attribute, cmds ...string) {
+ printCmds(prefix, colors, cmds...)
+}
+
+func printCmds(prefix string, colors []color.Attribute, cmds ...string) {
for _, cmd := range cmds {
config, ok := CmdDesc[cmd]
if !ok {
@@ -107,10 +67,11 @@ func PrintCmds(prefix string, cmds ...string) {
// desc += color.New(color.FgWhite).Sprintf(" • alias → %s", color.New(color.Bold).Sprint(alias))
}
- styled := color.New(color.Bold, color.FgHiWhite, color.BgCyan).Sprintf(" plandex %s ", cmd)
+ styled := color.New(colors...).Sprintf(" plandex %s ", cmd)
fmt.Printf("%s%s 👉 %s\n", prefix, styled, desc)
}
+
}
func PrintCustomCmd(prefix, cmd, alias, desc string) {
@@ -120,72 +81,50 @@ func PrintCustomCmd(prefix, cmd, alias, desc string) {
fmt.Printf("%s%s 👉 %s\n", prefix, styled, desc)
}
-func AlternateScreen() {
- // Switch to alternate screen and hide the cursor
- fmt.Print("\x1b[?1049h\x1b[?25l")
-}
-
-func ClearScreen() {
- fmt.Print("\x1b[2J")
-}
-
-func MoveCursorToTopLeft() {
- fmt.Print("\x1b[H")
-}
+// PrintCustomHelp prints the custom help output for the Plandex CLI
+func PrintCustomHelp() {
+ color.New(color.Bold, color.BgGreen).Println(" Usage ")
+ color.New(color.Bold).Println(" plandex [command] [flags]")
+ color.New(color.Bold).Println(" pdx [command] [flags]")
+ fmt.Println()
-func ClearCurrentLine() {
- fmt.Print("\033[2K")
-}
+ color.New(color.Bold, color.BgGreen).Println(" Help ")
+ color.New(color.Bold).Println(" plandex help")
+ color.New(color.Bold).Println(" plandex [command] --help")
+ fmt.Println()
-func MoveUpLines(numLines int) {
- fmt.Printf("\033[%dA", numLines)
-}
+ color.New(color.Bold, color.BgMagenta).Println(" Getting Started ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "new", "load", "tell", "changes", "apply")
+ fmt.Println()
-func BackToMain() {
- // Switch back to main screen and show the cursor on exit
- fmt.Print("\x1b[?1049l\x1b[?25h")
-}
+ color.New(color.Bold, color.BgBlue).Println(" Plans ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "new", "plans", "cd", "current", "delete-plan")
+ fmt.Println()
-func PageOutput(output string) {
- cmd := exec.Command("less", "-R")
- cmd.Env = append(os.Environ(), "LESS=FRX", "LESSCHARSET=utf-8")
- cmd.Stdin = strings.NewReader(output)
- cmd.Stdout = os.Stdout
- cmd.Stderr = os.Stderr
+ color.New(color.Bold, color.BgBlue).Println(" Changes ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "changes", "apply")
+ fmt.Println()
- if err := cmd.Run(); err != nil {
- OutputErrorAndExit("Failed to page output: %v", err)
- }
-}
+ color.New(color.Bold, color.BgBlue).Println(" Context ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "load", "ls", "rm", "update", "clear")
+ fmt.Println()
-func PageOutputReverse(output string) {
- cmd := exec.Command("less", "-RX", "+G")
- cmd.Stdin = strings.NewReader(output)
- cmd.Stdout = os.Stdout
- cmd.Stderr = os.Stderr
+ color.New(color.Bold, color.BgBlue).Println(" Branches ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "branches", "checkout", "delete-branch")
+ fmt.Println()
- // Set the environment variables specifically for the less command
- cmd.Env = append(os.Environ(), "LESS=FRX", "LESSCHARSET=utf-8")
+ color.New(color.Bold, color.BgBlue).Println(" History ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "convo", "log", "rewind")
+ fmt.Println()
- if err := cmd.Run(); err != nil {
- OutputErrorAndExit("Failed to page output: %v", err)
- }
-}
+ color.New(color.Bold, color.BgBlue).Println(" Execution ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "tell", "continue", "build")
+ fmt.Println()
-func GetDivisionLine() string {
- // Get the terminal width
- terminalWidth, err := getTerminalWidth()
- if err != nil {
- log.Println("Error fetching terminal size:", err)
- terminalWidth = 50 // default width if unable to fetch width
- }
- return strings.Repeat("─", terminalWidth)
-}
+ color.New(color.Bold, color.BgBlue).Println(" Active Plans ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "ps", "connect", "stop")
+ fmt.Println()
-func getTerminalWidth() (int, error) {
- width, _, err := term.GetSize(int(os.Stdout.Fd()))
- if err != nil {
- return 0, err
- }
- return width, nil
+ color.New(color.Bold, color.BgBlue).Println(" AI Models ")
+ PrintCmdsWithColors(" ", []color.Attribute{color.Bold}, "models", "set-model")
}
diff --git a/app/cli/term/spinner.go b/app/cli/term/spinner.go
index c1f1c42b..4d291813 100644
--- a/app/cli/term/spinner.go
+++ b/app/cli/term/spinner.go
@@ -7,7 +7,7 @@ import (
)
const withMissageMinDuration = 700 * time.Millisecond
-const withoutMissageMinDuration = 400 * time.Millisecond
+const withoutMissageMinDuration = 200 * time.Millisecond
var s = spinner.New(spinner.CharSets[33], 100*time.Millisecond)
var startedAt time.Time
diff --git a/app/cli/term/utils.go b/app/cli/term/utils.go
new file mode 100644
index 00000000..b8d91ca5
--- /dev/null
+++ b/app/cli/term/utils.go
@@ -0,0 +1,81 @@
+package term
+
+import (
+ "fmt"
+ "log"
+ "os"
+ "os/exec"
+ "strings"
+
+ "golang.org/x/term"
+)
+
+func AlternateScreen() {
+ // Switch to alternate screen and hide the cursor
+ fmt.Print("\x1b[?1049h\x1b[?25l")
+}
+
+func ClearScreen() {
+ fmt.Print("\x1b[2J")
+}
+
+func MoveCursorToTopLeft() {
+ fmt.Print("\x1b[H")
+}
+
+func ClearCurrentLine() {
+ fmt.Print("\033[2K")
+}
+
+func MoveUpLines(numLines int) {
+ fmt.Printf("\033[%dA", numLines)
+}
+
+func BackToMain() {
+ // Switch back to main screen and show the cursor on exit
+ fmt.Print("\x1b[?1049l\x1b[?25h")
+}
+
+func PageOutput(output string) {
+ cmd := exec.Command("less", "-R")
+ cmd.Env = append(os.Environ(), "LESS=FRX", "LESSCHARSET=utf-8")
+ cmd.Stdin = strings.NewReader(output)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+
+ if err := cmd.Run(); err != nil {
+ OutputErrorAndExit("Failed to page output: %v", err)
+ }
+}
+
+func PageOutputReverse(output string) {
+ cmd := exec.Command("less", "-RX", "+G")
+ cmd.Stdin = strings.NewReader(output)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+
+ // Set the environment variables specifically for the less command
+ cmd.Env = append(os.Environ(), "LESS=FRX", "LESSCHARSET=utf-8")
+
+ if err := cmd.Run(); err != nil {
+ OutputErrorAndExit("Failed to page output: %v", err)
+ }
+}
+
+func GetDivisionLine() string {
+ // Get the terminal width
+ terminalWidth, err := getTerminalWidth()
+ if err != nil {
+ log.Println("Error fetching terminal size:", err)
+ terminalWidth = 50 // default width if unable to fetch width
+ }
+ return strings.Repeat("─", terminalWidth)
+}
+
+func getTerminalWidth() (int, error) {
+ width, _, err := term.GetSize(int(os.Stdout.Fd()))
+ if err != nil {
+ return 0, err
+ }
+ return width, nil
+}