yao/registry
Max dae35cfe86 Implement force push option for agent and MCP commands
- Add a `--force` flag to the `push` command in both agent and MCP modules, allowing users to overwrite existing versions by deleting them before pushing.
- Update the `PushOptions` struct to include the `Force` field, ensuring the functionality is integrated into the push logic.
- Enhance E2E tests to validate the behavior of the force push feature, ensuring that existing versions are deleted as expected when the flag is used.
- Introduce tests for packing directories to respect `.yaoignore` rules, improving file exclusion handling during the packaging process.
2026-03-03 10:31:50 +08:00
..
manager Implement force push option for agent and MCP commands 2026-03-03 10:31:50 +08:00
testdata Enhance testing framework with Registry Client SDK integration 2026-03-02 21:16:22 +08:00
client.go Refactor GitHub workflows for Registry Client SDK tests 2026-03-02 21:39:22 +08:00
client_test.go Update test scope and remove obsolete E2E tests 2026-03-03 08:48:45 +08:00
README.md Refactor GitHub workflows for Registry Client SDK tests 2026-03-02 21:39:22 +08:00

registry

Go client SDK for Yao Registry.

Usage

import "github.com/yaoapp/yao/registry"

// Only the server URL is required. API prefix is auto-discovered
// via /.well-known/yao-registry on the first call.
c := registry.New("https://registry.yaoagents.com",
    registry.WithAuth("user", "pass"),  // optional, for push/delete
)

// Push a .yao.zip package
result, err := c.Push("assistants", "@yao", "hello", "1.0.0", zipBytes)

// Pull (by version or dist-tag)
data, digest, err := c.Pull("assistants", "@yao", "hello", "latest")

// Query
pack, err := c.GetPackument("assistants", "@yao", "hello")
ver, err  := c.GetVersion("assistants", "@yao", "hello", "1.0.0")
list, err := c.Search("hello", "assistants", 1, 20)

// Dependencies
deps, err := c.GetDependencies("assistants", "@yao", "hello", "1.0.0", true)

// Dist-tags
c.SetTag("assistants", "@yao", "hello", "stable", "1.0.0")
c.DeleteTag("assistants", "@yao", "hello", "stable")

// Delete
c.DeleteVersion("assistants", "@yao", "hello", "1.0.0")

Options

Option Description
WithAuth(user, pass) Basic Auth for push/delete
WithHTTPClient(hc) Custom *http.Client
WithTimeout(d) HTTP timeout

Environment

Tests require a running registry server. Set YAO_REGISTRY_URL (default http://localhost:8080) and create user yaoagents/yaoagents.

# Start registry with test user
REGISTRY_INIT_USER=yaoagents REGISTRY_INIT_PASS=yaoagents registry start

# Run tests
go test ./registry/... -v