(deps commandDeps)
| 227 | } |
| 228 | |
| 229 | func newAgentListCommand(deps commandDeps) *cobra.Command { |
| 230 | cmd := &cobra.Command{ |
| 231 | Use: agentListKey, |
| 232 | Short: "List installed agent definitions", |
| 233 | Example: ` # Show every agent definition available to the daemon |
| 234 | agh agent list |
| 235 | |
| 236 | # Show agents resolved for a workspace |
| 237 | agh agent list --workspace ~/dev/ai/acme-startup |
| 238 | |
| 239 | # Emit the same list as JSON |
| 240 | agh agent list -o json`, |
| 241 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 242 | client, err := clientFromDeps(deps) |
| 243 | if err != nil { |
| 244 | return err |
| 245 | } |
| 246 | |
| 247 | query, err := agentQueryFromCommand(cmd) |
| 248 | if err != nil { |
| 249 | return err |
| 250 | } |
| 251 | agents, err := client.ListAgents(cmd.Context(), query) |
| 252 | if err != nil { |
| 253 | return err |
| 254 | } |
| 255 | return writeCommandOutput(cmd, agentListBundle(agents)) |
| 256 | }, |
| 257 | } |
| 258 | cmd.Flags().String("workspace", "", "Resolve agents from a workspace id, name, or path") |
| 259 | return cmd |
| 260 | } |
| 261 | |
| 262 | func newAgentInfoCommand(deps commandDeps) *cobra.Command { |
| 263 | cmd := &cobra.Command{ |
no test coverage detected