manager

package
v8.84.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package manager is the client of giantswarm-repo-manager, the MCP server behind muster that keeps the repository inventory and lands the team-file changes as the person. The repo commands reach it through the person's muster endpoint with the muster token of the keychain; every tool of the manager is one call here, and the tool's answer is printed as it came.

Index

Constants

View Source
const (
	Server     = "giantswarm-repo-manager"
	ToolPrefix = "x_" + Server + "_"
)

Server is the manager's name in muster, and ToolPrefix what muster puts in front of every tool of an external server.

View Source
const (
	ToolGetInfo            = ToolPrefix + "get_info"
	ToolListRepositories   = ToolPrefix + "list_repositories"
	ToolGetRepository      = ToolPrefix + "get_repository"
	ToolRefreshRepository  = ToolPrefix + "refresh_repository"
	ToolSweepInventory     = ToolPrefix + "sweep_inventory"
	ToolValidateRepository = ToolPrefix + "validate_repository"
	ToolCreateRepository   = ToolPrefix + "create_repository"
	ToolWatchRepository    = ToolPrefix + "watch_repository"
	ToolAdoptRepository    = ToolPrefix + "adopt_repository"
	ToolUpdateRepository   = ToolPrefix + "update_repository"
	ToolTransferRepository = ToolPrefix + "transfer_repository"
	ToolSetLifecycle       = ToolPrefix + "set_lifecycle"
	ToolApproveChange      = ToolPrefix + "approve_change"
	ToolAlignRepository    = ToolPrefix + "align_repository"

	// ToolAuthLogin is muster's own: the sign-in to one of its servers,
	// answering the URL the person opens once.
	ToolAuthLogin = "core_auth_login"
)

The manager's tools, as muster exposes them.

Variables

This section is empty.

Functions

func IsAuthRequired added in v8.84.0

func IsAuthRequired(err error) bool

IsAuthRequired asserts authRequiredError: the endpoint refused the bearer (401 or 403); the person logs in to muster again.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsTool

func IsTool(err error) bool

IsTool asserts toolError: the manager answered with an error or an answer the client does not understand.

func IsUnreachable

func IsUnreachable(err error) bool

IsUnreachable asserts unreachableError: the endpoint did not answer, or not with MCP.

Types

type Caller added in v8.84.0

type Caller interface {
	Call(ctx context.Context, tool string, args map[string]any) (json.RawMessage, error)
}

Caller calls the manager's tools. Client satisfies it; a test fakes it.

type Client

type Client struct {
	// Endpoint is the muster MCP endpoint (https://muster.example/mcp).
	Endpoint string
	// Token is the person's bearer token for the endpoint; empty sends none.
	Token string
	// HTTPClient overrides the HTTP client; nil means one without a timeout
	// of its own, bounded by the context of every call.
	HTTPClient *http.Client
	// Version is reported as the client's version in the handshake.
	Version string
	// contains filtered or unexported fields
}

Client calls giantswarm-repo-manager's tools through a muster endpoint over MCP's streamable HTTP transport. One Client is one MCP session: initialized on the first call, kept for the next.

func (*Client) Call added in v8.84.0

func (c *Client) Call(ctx context.Context, tool string, args map[string]any) (json.RawMessage, error)

Call calls tool with args and returns the result's payload: its structured content when the tool has one, else its first text content as raw bytes (JSON when the text is JSON, the text otherwise). A tool that answers an error is IsTool with the text; an endpoint that refuses the bearer is IsAuthRequired; one that does not answer is IsUnreachable.

func (*Client) GetRepository

func (c *Client) GetRepository(ctx context.Context, repository string) (*Record, error)

GetRepository calls the get_repository tool for owner/name.

type Record

type Record struct {
	// Repository is owner/name.
	Repository string `json:"repository"`
	// Team is the slug of the team file that declares it; empty when no file
	// does.
	Team string `json:"team,omitempty"`
	// Setup is the engine's check result the inventory stores.
	Setup *reconcile.Result `json:"setup,omitempty"`
	// UpdatedAt is when the record was refreshed.
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

Record is one inventory record of giantswarm-repo-manager as `devctl repo status` reads it. The manager's tool schema is filled in by its own change; the client reads the fields below and ignores the rest, and a payload that is the set-up result itself is accepted as one too.

type RepositoryGetter

type RepositoryGetter interface {
	GetRepository(ctx context.Context, repository string) (*Record, error)
}

RepositoryGetter answers `devctl repo status` from the inventory. Client satisfies it; a test fakes it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL