项目文件夹

文件
Asim Aslam c7657f73f4
goreleaser / goreleaser (push) Has been cancelled
Refactor agent plan storage, update docs, and release v6 (#2977)
* test(harness): read agent plan from the scoped store

The store-scoping change moved an agent's plan from the default table
key agent/{name}/plan to its own table (database "agent", table {name},
key "plan"). The plan-delegate harness tests still read the old key and
failed with 'not found'; read through store.Scope(mem, "agent", name)
like the agent does.

* docs: orient agents-first across README, landing, and docs overview

Lead with agents (then services and flows), surface MCP + A2A as the
interop story, and frame agents as services. Landing hero and feature
grid reordered agents-first with an A2A gateway card.

* v6: module path go-micro.dev/v6, TLS secure by default, NewService

Cut v6. Three breaking changes, bundled so the major bump is paid once:

- Module path go-micro.dev/v5 -> go-micro.dev/v6 across all imports + go.mod.
- TLS verification on by default (was off). MICRO_TLS_SECURE removed;
  MICRO_TLS_INSECURE=true opts out for self-signed/dev.
- micro.NewService(name, opts...) is the canonical service constructor,
  symmetric with NewAgent/NewFlow; micro.New kept as a deprecated alias;
  the old name-less NewService(opts...) removed. Generators emit NewService.

Also ports the JWT auth token provider in-module (go-micro.dev/v6/auth/jwt/token
on golang-jwt/jwt/v5), dropping the v5-pinned github.com/micro/plugins/v5/auth/jwt
and the deprecated dgrijalva/jwt-go.

Docs/README/landing updated to v6 and @latest; v5->v6 migration guide added;
CHANGELOG cut as [6.0.0]. Blog posts left at their historical versions.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-18 11:55:35 +01:00

93 行
2.0 KiB
Go

package resource
import (
"fmt"
"github.com/urfave/cli/v2"
"go-micro.dev/v6/registry"
)
// registryCommand exposes the registry interface: list, get, watch.
func registryCommand() *cli.Command {
return &cli.Command{
Name: "registry",
Usage: "Inspect the service registry",
Description: `Interact with the service registry.
micro registry list List all registered services
micro registry get <name> Show nodes and endpoints for a service
micro registry watch Stream registration events`,
Subcommands: []*cli.Command{
{
Name: "list",
Usage: "List all registered services",
Action: registryList,
},
{
Name: "get",
Usage: "Show details for a service",
ArgsUsage: "<name>",
Action: registryGet,
},
{
Name: "watch",
Usage: "Stream registration events",
Action: registryWatch,
},
},
}
}
func registryList(c *cli.Context) error {
services, err := registry.ListServices()
if err != nil {
return fail("list services: %v", err)
}
out := make([]map[string]any, 0, len(services))
for _, s := range services {
out = append(out, map[string]any{
"name": s.Name,
"version": s.Version,
})
}
return printJSON(out)
}
func registryGet(c *cli.Context) error {
name := c.Args().First()
if name == "" {
return fail("usage: micro registry get <name>")
}
services, err := registry.GetService(name)
if err != nil {
return fail("get service %q: %v", name, err)
}
if len(services) == 0 {
return fail("service %q not found", name)
}
return printJSON(services)
}
func registryWatch(c *cli.Context) error {
w, err := registry.Watch()
if err != nil {
return fail("watch registry: %v", err)
}
defer w.Stop()
fmt.Println("Watching registry for changes (Ctrl-C to stop)...")
for {
res, err := w.Next()
if err != nil {
return fail("watch: %v", err)
}
name := ""
version := ""
if res.Service != nil {
name = res.Service.Name
version = res.Service.Version
}
fmt.Printf("%-10s %s %s\n", res.Action, name, version)
}
}