MCPcopy Create free account
hub / github.com/compozy/agh / newAgentInfoCommand

Function newAgentInfoCommand

internal/cli/agent.go:262–294  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

260}
261
262func 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
296func agentQueryFromCommand(cmd *cobra.Command) (AgentQuery, error) {
297 workspace, err := commandWorkspaceFlag(cmd)

Callers 1

newAgentCommandFunction · 0.85

Calls 7

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
agentQueryFromCommandFunction · 0.85
writeCommandOutputFunction · 0.85
agentBundleFunction · 0.85
GetAgentMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected