refactor(tui): unify commandType definition

Ayman Bagabas created

Change summary

internal/tui/components/dialogs/commands/commands.go | 10 ++++------
internal/uicmd/uicmd.go                              | 10 ++++++++++
2 files changed, 14 insertions(+), 6 deletions(-)

Detailed changes

internal/tui/components/dialogs/commands/commands.go 🔗

@@ -32,14 +32,12 @@ const (
 	defaultWidth int = 70
 )
 
-type commandType uint
-
-func (c commandType) String() string { return []string{"System", "User", "MCP"}[c] }
+type commandType = uicmd.CommandType
 
 const (
-	SystemCommands commandType = iota
-	UserCommands
-	MCPPrompts
+	SystemCommands = uicmd.SystemCommands
+	UserCommands   = uicmd.UserCommands
+	MCPPrompts     = uicmd.MCPPrompts
 )
 
 type listModel = list.FilterableList[list.CompletionItem[Command]]

internal/uicmd/uicmd.go 🔗

@@ -21,6 +21,16 @@ import (
 	"github.com/charmbracelet/crush/internal/tui/util"
 )
 
+type CommandType uint
+
+func (c CommandType) String() string { return []string{"System", "User", "MCP"}[c] }
+
+const (
+	SystemCommands CommandType = iota
+	UserCommands
+	MCPPrompts
+)
+
 // Command represents a command that can be executed
 type Command struct {
 	ID          string