| user | 5a7d60d | 2025-07-27 21:22:04 +0400 | [diff] [blame] | 1 | package commands |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/spf13/cobra" |
| 7 | ) |
| 8 | |
| 9 | var stopAgentCmd = &cobra.Command{ |
| 10 | Use: "stop-agent [agent-name]", |
| 11 | Short: "Stop a running agent", |
| 12 | Long: `Stop a specific running agent. |
| 13 | |
| 14 | Examples: |
| 15 | staff stop-agent backend-engineer |
| 16 | staff stop-agent frontend-engineer`, |
| 17 | Args: cobra.ExactArgs(1), |
| 18 | RunE: runStopAgent, |
| 19 | } |
| 20 | |
| 21 | func runStopAgent(cmd *cobra.Command, args []string) error { |
| 22 | agentName := args[0] |
| 23 | |
| 24 | err := agentManager.StopAgent(agentName) |
| 25 | if err != nil { |
| 26 | return fmt.Errorf("failed to stop agent: %w", err) |
| 27 | } |
| 28 | |
| 29 | fmt.Printf("Agent %s stopped successfully\n", agentName) |
| 30 | return nil |
| iomodo | 50598c6 | 2025-07-27 22:06:32 +0400 | [diff] [blame^] | 31 | } |