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

Function newAgentListCommand

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

Source from the content-addressed store, hash-verified

227}
228
229func 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
262func newAgentInfoCommand(deps commandDeps) *cobra.Command {
263 cmd := &cobra.Command{

Callers 1

newAgentCommandFunction · 0.85

Calls 6

clientFromDepsFunction · 0.85
agentQueryFromCommandFunction · 0.85
writeCommandOutputFunction · 0.85
agentListBundleFunction · 0.85
ListAgentsMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected