(deps commandDeps)
| 260 | } |
| 261 | |
| 262 | func newAgentInfoCommand(deps commandDeps) *cobra.Command { |
| 263 | cmd := &cobra.Command{ |
| 264 | Use: agentInfoNameValue, |
| 265 | Short: "Show one agent definition", |
| 266 | Example: ` # Inspect the default bootstrap agent |
| 267 | agh agent info general |
| 268 | |
| 269 | # Inspect a workspace-local agent |
| 270 | agh agent info reviewer --workspace ~/dev/ai/acme-startup |
| 271 | |
| 272 | # Inspect an agent definition as JSON |
| 273 | agh agent info reviewer -o json`, |
| 274 | Args: exactOneNonBlankArg(), |
| 275 | RunE: func(cmd *cobra.Command, args []string) error { |
| 276 | client, err := clientFromDeps(deps) |
| 277 | if err != nil { |
| 278 | return err |
| 279 | } |
| 280 | |
| 281 | query, err := agentQueryFromCommand(cmd) |
| 282 | if err != nil { |
| 283 | return err |
| 284 | } |
| 285 | agent, err := client.GetAgent(cmd.Context(), args[0], query) |
| 286 | if err != nil { |
| 287 | return err |
| 288 | } |
| 289 | return writeCommandOutput(cmd, agentBundle(agent)) |
| 290 | }, |
| 291 | } |
| 292 | cmd.Flags().String("workspace", "", "Resolve the agent from a workspace id, name, or path") |
| 293 | return cmd |
| 294 | } |
| 295 | |
| 296 | func agentQueryFromCommand(cmd *cobra.Command) (AgentQuery, error) { |
| 297 | workspace, err := commandWorkspaceFlag(cmd) |
no test coverage detected