system_commands.go
1 package commands 2 3 import ( 4 "fmt" 5 "os" 6 "time" 7 ) 8 9 // HelpCommand shows available commands 10 type HelpCommand struct { 11 registry *Registry 12 } 13 14 func (c *HelpCommand) Handle(args []string) (Message, error) { 15 return Message{ 16 Role: "system", 17 Content: c.registry.GetHelp(), 18 Timestamp: time.Now(), 19 }, nil 20 } 21 22 func (c *HelpCommand) Usage() string { 23 return "/help" 24 } 25 26 func (c *HelpCommand) Description() string { 27 return "Show available commands" 28 } 29 30 // ClearCommand clears conversation history 31 type ClearCommand struct{} 32 33 func (c *ClearCommand) Handle(args []string) (Message, error) { 34 return Message{ 35 Role: "system", 36 Content: "๐งน Conversation history cleared.", 37 Timestamp: time.Now(), 38 }, nil 39 } 40 41 func (c *ClearCommand) Usage() string { 42 return "/clear" 43 } 44 45 func (c *ClearCommand) Description() string { 46 return "Clear conversation history" 47 } 48 49 // PwdCommand shows current directory 50 type PwdCommand struct{} 51 52 func (c *PwdCommand) Handle(args []string) (Message, error) { 53 wd, err := os.Getwd() 54 if err != nil { 55 wd = "unknown" 56 } 57 58 return Message{ 59 Role: "system", 60 Content: fmt.Sprintf("๐ Current directory: %s", wd), 61 Timestamp: time.Now(), 62 }, nil 63 } 64 65 func (c *PwdCommand) Usage() string { 66 return "/pwd" 67 } 68 69 func (c *PwdCommand) Description() string { 70 return "Show current directory" 71 }