MCPcopy
hub / github.com/micro/go-micro / init

Function init

cmd/micro/cli/agent/agent.go:17–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15)
16
17func init() {
18 cmd.Register(&cli.Command{
19 Name: "runs",
20 Usage: "Show recorded agent runs",
21 ArgsUsage: "[agent] [run-id]",
22 Flags: runFlags(),
23 Action: func(c *cli.Context) error {
24 name := c.Args().First()
25 if name == "" {
26 return fmt.Errorf("usage: micro runs [agent] [run-id]")
27 }
28 if runID := c.Args().Get(1); runID != "" {
29 return printRunHistory(name, runID, c.Bool("json"))
30 }
31 return printRunIndex(name, runOptions(c), c.Bool("json"))
32 },
33 })
34
35 cmd.Register(&cli.Command{
36 Name: "agent",
37 Usage: "Manage AI agents",
38 Subcommands: []*cli.Command{
39 {
40 Name: "preflight",
41 Aliases: []string{"doctor"},
42 Usage: "Check local prerequisites before the first provider-backed agent",
43 Action: func(c *cli.Context) error {
44 return runAgentPreflight(os.Stdout, defaultPreflightDeps())
45 },
46 },
47 {
48 Name: "list",
49 Usage: "List registered agents",
50 Action: func(c *cli.Context) error {
51 svcs, err := registry.ListServices()
52 if err != nil {
53 return err
54 }
55 found := false
56 for _, svc := range svcs {
57 records, err := registry.GetService(svc.Name)
58 if err != nil || len(records) == 0 {
59 continue
60 }
61 meta := records[0].Metadata
62 if meta == nil || meta["type"] != "agent" {
63 if len(records[0].Nodes) > 0 {
64 meta = records[0].Nodes[0].Metadata
65 }
66 if meta == nil || meta["type"] != "agent" {
67 continue
68 }
69 }
70 found = true
71 services := meta["services"]
72 if services == "" {
73 services = "(all)"
74 }

Callers

nothing calls this directly

Calls 14

MessagesMethod · 0.95
RegisterFunction · 0.92
ListServicesFunction · 0.92
GetServiceFunction · 0.92
ScopeFunction · 0.92
runFlagsFunction · 0.85
printRunHistoryFunction · 0.85
printRunIndexFunction · 0.85
runOptionsFunction · 0.85
runAgentPreflightFunction · 0.85
defaultPreflightDepsFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…