blob: 50c0845bfcb065bd750e595ecc69e7ee2a6f5332 [file] [log] [blame]
user5a7d60d2025-07-27 21:22:04 +04001package commands
2
3import (
4 "fmt"
5 "strings"
6
7 "github.com/spf13/cobra"
8)
9
10var listAgentsCmd = &cobra.Command{
11 Use: "list-agents",
12 Short: "List all configured agents",
13 Long: `List all configured agents with their settings and status.
14
15Examples:
16 staff list-agents`,
17 RunE: runListAgents,
18}
19
20func runListAgents(cmd *cobra.Command, args []string) error {
21 if len(cfg.Agents) == 0 {
22 fmt.Println("No agents configured")
23 return nil
24 }
25
26 fmt.Printf("Found %d configured agents:\n\n", len(cfg.Agents))
27
28 // Display agents in table format
29 fmt.Printf("%-20s %-15s %-12s %-10s %-30s\n", "Name", "Model", "Temperature", "Status", "Role/Description")
30 fmt.Printf("%s\n", strings.Repeat("-", 90))
31
32 for _, agent := range cfg.Agents {
33 status := "stopped"
34 if agentManager.IsAgentRunning(agent.Name) {
35 status = "running"
36 }
37
38 role := agent.Role
39 if role == "" {
40 role = "general"
41 }
42 if len(role) > 27 {
43 role = role[:27] + "..."
44 }
45
46 temp := 0.7
47 if agent.Temperature != nil {
48 temp = *agent.Temperature
49 }
50
iomodo50598c62025-07-27 22:06:32 +040051 fmt.Printf("%-20s %-15s %-12.1f %-10s %-30s\n",
52 agent.Name,
53 agent.Model,
54 temp,
user5a7d60d2025-07-27 21:22:04 +040055 status,
56 role)
57 }
58
59 fmt.Printf("\nUse 'staff start-agent <agent-name>' to start an agent\n")
60 fmt.Printf("Use 'staff stop-agent <agent-name>' to stop a running agent\n")
61
62 return nil
iomodo50598c62025-07-27 22:06:32 +040063}