| package commands |
| |
| import ( |
| "fmt" |
| "strings" |
| |
| "github.com/spf13/cobra" |
| ) |
| |
| var listAgentsCmd = &cobra.Command{ |
| Use: "list-agents", |
| Short: "List all configured agents", |
| Long: `List all configured agents with their settings and status. |
| |
| Examples: |
| staff list-agents`, |
| RunE: runListAgents, |
| } |
| |
| func runListAgents(cmd *cobra.Command, args []string) error { |
| if len(cfg.Agents) == 0 { |
| fmt.Println("No agents configured") |
| return nil |
| } |
| |
| fmt.Printf("Found %d configured agents:\n\n", len(cfg.Agents)) |
| |
| // Display agents in table format |
| fmt.Printf("%-20s %-15s %-12s %-10s %-30s\n", "Name", "Model", "Temperature", "Status", "Role/Description") |
| fmt.Printf("%s\n", strings.Repeat("-", 90)) |
| |
| for _, agent := range cfg.Agents { |
| status := "stopped" |
| if agentManager.IsAgentRunning(agent.Name) { |
| status = "running" |
| } |
| |
| role := agent.Role |
| if role == "" { |
| role = "general" |
| } |
| if len(role) > 27 { |
| role = role[:27] + "..." |
| } |
| |
| temp := 0.7 |
| if agent.Temperature != nil { |
| temp = *agent.Temperature |
| } |
| |
| fmt.Printf("%-20s %-15s %-12.1f %-10s %-30s\n", |
| agent.Name, |
| agent.Model, |
| temp, |
| status, |
| role) |
| } |
| |
| fmt.Printf("\nUse 'staff start-agent <agent-name>' to start an agent\n") |
| fmt.Printf("Use 'staff stop-agent <agent-name>' to stop a running agent\n") |
| |
| return nil |
| } |