Help us shape the future of Go! Take the 2026 Go Developer Survey

manager

package
v8.130.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 13 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.

muster exposes a session its meta-tools only -- list_tools, filter_tools, describe_tool, call_tool and their kin -- and every server's tool is called through call_tool, which wraps the tool's answer in a JSON envelope; the muster CLI and the platform's agents call tools the same way. Call sends that one meta-tool and unwraps the envelope.

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"

	// MetaToolCall is muster's call_tool, the meta-tool every tool of the
	// aggregator is called through: name and arguments in, the tool's
	// answer out as an envelope.
	MetaToolCall = "call_tool"
)

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 Approval added in v8.85.0

type Approval struct {
	PullRequest   int         `json:"pullRequest"`
	Team          string      `json:"team"`
	Author        string      `json:"author,omitempty"`
	Login         string      `json:"login"`
	Teams         []string    `json:"teams,omitempty"`
	Member        bool        `json:"member"`
	ReviewURL     string      `json:"reviewUrl,omitempty"`
	Merged        bool        `json:"merged"`
	AutoMerge     bool        `json:"autoMerge"`
	Rerendered    *Rerendered `json:"rerendered,omitempty"`
	RerenderError string      `json:"rerenderError,omitempty"`
	Message       string      `json:"message,omitempty"`
}

Approval is approve_change's answer.

type CIFacts added in v8.85.0

type CIFacts struct {
	Generated     bool     `json:"generated"`
	Orb           string   `json:"orb,omitempty"`
	ImagePush     bool     `json:"imagePush"`
	ChartPush     bool     `json:"chartPush"`
	Platforms     []string `json:"platforms,omitempty"`
	ARM64         *bool    `json:"arm64,omitempty"`
	ChinaPush     string   `json:"chinaPush,omitempty"`
	Signing       string   `json:"signing,omitempty"`
	SigningReason string   `json:"signingReason,omitempty"`
	Error         string   `json:"error,omitempty"`
}

CIFacts is what the CircleCI configuration on the default branch says.

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 Change added in v8.85.0

type Change struct {
	Kind        string             `json:"kind"`
	By          string             `json:"by,omitempty"`
	PullRequest *ChangePullRequest `json:"pullRequest,omitempty"`
	FromTeam    string             `json:"fromTeam,omitempty"`
}

Change is the change a run was for: created, added, transferred, archived, deleted, deprecated, changed, dispatched, nightly.

type ChangePullRequest added in v8.85.0

type ChangePullRequest struct {
	Number int    `json:"number"`
	URL    string `json:"url"`
}

ChangePullRequest is the team-file pull request behind a change.

type CircleCIFacts added in v8.85.0

type CircleCIFacts struct {
	Followed       *bool `json:"followed,omitempty"`
	SetupWorkflows *bool `json:"setupWorkflows,omitempty"`
	// Webhook says whether the repository carries the webhook CircleCI
	// installs on the follow, as the reconciler's circleci step read it;
	// nil when no run has read it.
	Webhook *bool     `json:"webhook,omitempty"`
	Head    *Statuses `json:"head,omitempty"`
	Source  string    `json:"source,omitempty"`
	Unknown []string  `json:"unknown,omitempty"`
	Error   string    `json:"error,omitempty"`
}

CircleCIFacts is what the statuses and the reconciler's run say about CircleCI; no CircleCI token is involved.

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 through muster's call_tool and returns the tool's payload: its structured content when it 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, or a muster that refuses the call (a tool it does not know, a toolset that excludes it), 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 Commit added in v8.85.0

type Commit struct {
	Date    time.Time `json:"date"`
	Author  string    `json:"author"`
	Message string    `json:"message,omitempty"`
}

Commit is one commit of the sampled history.

type Committed added in v8.85.0

type Committed struct {
	PullRequest *PullRequest `json:"pullRequest"`
	Ask         *Delivery    `json:"ask,omitempty"`
	Notice      *Delivery    `json:"notice,omitempty"`
	PendingRun  *PendingRun  `json:"pendingRun,omitempty"`
}

Committed is a write's outcome in mode commit.

type Declaration added in v8.85.0

type Declaration struct {
	Team          string   `json:"team"`
	File          string   `json:"file"`
	ComponentType string   `json:"componentType,omitempty"`
	Lifecycle     string   `json:"lifecycle,omitempty"`
	Language      string   `json:"language,omitempty"`
	Flavours      []string `json:"flavours,omitempty"`
	// Entry is the entry as the team file carries it, one YAML list item.
	Entry    string `json:"entry,omitempty"`
	Accepted bool   `json:"accepted"`
	// Problems are the schema's refusals of the entry, each `field: message`
	// as the inventory keeps them; a write's Plan carries them as fields.
	Problems []string `json:"problems,omitempty"`
}

Declaration is the repository's team-file entry as the inventory read it.

type Delivery added in v8.85.0

type Delivery struct {
	Team string `json:"team"`
	// Channel is the ID the gateway posted to: the debug channel under a
	// debug redirect, else the team's channel.
	Channel string `json:"channel,omitempty"`
	// ChannelName is the team's channel's name, also under a debug redirect.
	ChannelName string `json:"channelName,omitempty"`
	// IntendedChannel is the team's channel ID, set only under a debug
	// redirect.
	IntendedChannel string `json:"intendedChannel,omitempty"`
	Delivered       bool   `json:"delivered"`
	ReviewID        string `json:"reviewId,omitempty"`
	Error           string `json:"error,omitempty"`
}

Delivery is what became of an ask or notice.

type Dispatch added in v8.85.0

type Dispatch struct {
	Workflow   string              `json:"workflow"`
	Inputs     map[string]any      `json:"inputs"`
	As         string              `json:"as"`
	Dispatched bool                `json:"dispatched"`
	RunsURL    string              `json:"runsUrl"`
	Then       string              `json:"then"`
	Findings   []reconcile.Finding `json:"findings,omitempty"`
	PendingRun *PendingRun         `json:"pendingRun,omitempty"`
	Team       string              `json:"team,omitempty"`
	Declared   bool                `json:"declared"`
	OptedIn    bool                `json:"optedIn"`
	Mode       string              `json:"mode"`
	OptIn      *OptIn              `json:"optIn,omitempty"`
	Planned    []PlannedStep       `json:"planned,omitempty"`
	CheckedAt  string              `json:"checkedAt,omitempty"`
	Warning    string              `json:"warning"`
}

Dispatch is align_repository's answer: the mode the entry decides, the warning, the planned changes and what was dispatched or opened.

type Failure added in v8.85.0

type Failure struct {
	Phase  string `json:"phase"`
	Reason string `json:"reason"`
}

Failure is the phase that failed and why.

type Finding added in v8.85.0

type Finding struct {
	Kind    string `json:"kind"`
	Message string `json:"message"`
	Fix     string `json:"fix,omitempty"`
	Source  string `json:"source,omitempty"`
}

Finding is one of the record's findings: the engine's, or the inventory's own (declared-but-gone, undeclared-on-github, reconcile-run-missing).

type Info added in v8.85.0

type Info struct {
	Version    string  `json:"version"`
	ToolPrefix string  `json:"toolPrefix"`
	Caller     *Person `json:"caller"`
	Auth       struct {
		Mode                string `json:"mode"`
		AuthorizationServer string `json:"authorizationServer,omitempty"`
		Reason              string `json:"reason,omitempty"`
	} `json:"auth"`
	TeamFiles struct {
		Repository string `json:"repository"`
		Ref        string `json:"ref"`
		Readable   string `json:"readable"`
		Reason     string `json:"reason,omitempty"`
	} `json:"teamFiles"`
	Inventory struct {
		Identity  string `json:"identity"`
		Connected bool   `json:"connected"`
		Records   int    `json:"records"`
		Error     string `json:"error,omitempty"`
	} `json:"inventory"`
	CircleCI struct {
		Source string `json:"source"`
	} `json:"circleci"`
	Reviews struct {
		Configured   bool   `json:"configured"`
		DebugChannel string `json:"debugChannel,omitempty"`
	} `json:"reviews"`
	Engine struct {
		Module  string `json:"module"`
		Version string `json:"version"`
		Package string `json:"package"`
	} `json:"engine"`
	Capabilities struct {
		Modes        []string `json:"modes"`
		ApplyRefused bool     `json:"applyRefused"`
		WriteTools   []string `json:"writeTools"`
	} `json:"capabilities"`
}

Info is get_info's answer: the service and how the call is authenticated.

type Issue added in v8.85.0

type Issue struct {
	Number int    `json:"number"`
	Title  string `json:"title"`
}

Issue is an issue by number and title.

type LastRun added in v8.85.0

type LastRun struct {
	Result    reconcile.Result `json:"result"`
	RunURL    string           `json:"runUrl"`
	Timestamp time.Time        `json:"timestamp"`
	Change    *Change          `json:"change,omitempty"`
}

LastRun is the last reconciler run's artifact.

type Listing added in v8.85.0

type Listing struct {
	Scope        string        `json:"scope"`
	Teams        []string      `json:"teams,omitempty"`
	TeamsSource  string        `json:"teamsSource,omitempty"`
	Note         string        `json:"note,omitempty"`
	Sweep        *SweepSummary `json:"sweep"`
	SweepRunning bool          `json:"sweepRunning"`
	Total        int           `json:"total"`
	Matched      int           `json:"matched"`
	Shown        int           `json:"shown"`
	Repositories []Row         `json:"repositories"`
}

Listing is list_repositories' answer.

type MissingRun added in v8.85.0

type MissingRun struct {
	DispatchedAt time.Time `json:"dispatchedAt"`
	By           string    `json:"by"`
	Kind         string    `json:"kind,omitempty"`
	NoticedAt    time.Time `json:"noticedAt"`
	RunsURL      string    `json:"runsUrl"`
	RunURL       string    `json:"runUrl,omitempty"`
	Conclusion   string    `json:"conclusion,omitempty"`
}

MissingRun is an expected run given up: completed without a report, or never reported.

type OptIn added in v8.85.0

type OptIn struct {
	Plan      Plan       `json:"plan"`
	Committed *Committed `json:"committed,omitempty"`
}

OptIn is the pull request that opts a repository in, planned and committed.

type PendingRun added in v8.85.0

type PendingRun struct {
	DispatchedAt   time.Time          `json:"dispatchedAt"`
	By             string             `json:"by"`
	Kind           string             `json:"kind,omitempty"`
	PullRequest    *ChangePullRequest `json:"pullRequest,omitempty"`
	MergedAt       *time.Time         `json:"mergedAt,omitempty"`
	ConflictsSince *time.Time         `json:"conflictsSince,omitempty"`
}

PendingRun is the reconciler run the record expects: an Align now, or the run of a team-file pull request once it merges.

type Person added in v8.85.0

type Person struct {
	Login string `json:"login"`
	ID    int64  `json:"id"`
}

Person is who the manager sees calling: the GitHub login the person's token acts as.

type Phase added in v8.85.0

type Phase struct {
	Name    string    `json:"name"`
	At      time.Time `json:"at"`
	Seconds int       `json:"seconds"`
}

Phase is one phase reached.

type Plan added in v8.85.0

type Plan struct {
	Repository  string              `json:"repository"`
	Team        string              `json:"team"`
	FromTeam    string              `json:"fromTeam,omitempty"`
	Before      string              `json:"before,omitempty"`
	Entry       string              `json:"entry,omitempty"`
	Problems    []reposetup.Problem `json:"problems,omitempty"`
	Accepted    bool                `json:"accepted"`
	PullRequest PlannedPullRequest  `json:"pullRequest"`
	Ask         *PlannedMessage     `json:"ask,omitempty"`
	Notice      *PlannedMessage     `json:"notice,omitempty"`
}

Plan is a write's dry run: the entry before and after, the pull request as it would land, the ask and the notice that would follow.

type PlannedMessage added in v8.85.0

type PlannedMessage struct {
	Team string `json:"team"`
	// Channel is the Slack channel ID the message goes to; ChannelName is
	// that channel's name, for display.
	Channel     string `json:"channel,omitempty"`
	ChannelName string `json:"channelName,omitempty"`
	Text        string `json:"text"`
	Deliverable bool   `json:"deliverable"`
	Reason      string `json:"reason,omitempty"`
}

PlannedMessage is an ask or notice before it is posted.

type PlannedPullRequest added in v8.85.0

type PlannedPullRequest struct {
	Repository string   `json:"repository"`
	Branch     string   `json:"branch"`
	Title      string   `json:"title"`
	Files      []string `json:"files"`
	Body       string   `json:"body"`
	As         string   `json:"as"`
}

PlannedPullRequest is the pull request before it exists.

type PlannedStep added in v8.85.0

type PlannedStep struct {
	Step    string   `json:"step"`
	Changes []string `json:"changes"`
}

PlannedStep is one step's planned changes from the inventory's last check.

type Presence added in v8.85.0

type Presence struct {
	Present bool   `json:"present"`
	Team    string `json:"team,omitempty"`
}

Presence says whether the catalog or the mapping has the repository.

type PullRequest added in v8.85.0

type PullRequest struct {
	Number    int    `json:"number"`
	URL       string `json:"url"`
	Branch    string `json:"branch"`
	Title     string `json:"title"`
	Author    string `json:"author,omitempty"`
	Existing  bool   `json:"existing,omitempty"`
	AutoMerge bool   `json:"autoMerge"`
}

PullRequest is a team-file pull request the manager opened as the person.

type Reality added in v8.85.0

type Reality struct {
	URL              string   `json:"url"`
	Description      string   `json:"description,omitempty"`
	Visibility       string   `json:"visibility,omitempty"`
	DefaultBranch    string   `json:"defaultBranch,omitempty"`
	IsArchived       bool     `json:"isArchived"`
	IsFork           bool     `json:"isFork"`
	IsEmpty          bool     `json:"isEmpty"`
	Language         string   `json:"language,omitempty"`
	LastCommit       *Commit  `json:"lastCommit,omitempty"`
	LastPersonCommit *Commit  `json:"lastPersonCommit,omitempty"`
	LatestRelease    *Release `json:"latestRelease,omitempty"`
	CodeownersTeams  []string `json:"codeownersTeams,omitempty"`
	OpenIssues       int      `json:"openIssues"`
}

Reality is what GitHub says.

type Record

type Record struct {
	// Repository is owner/name, Name the name alone.
	Repository string `json:"repository"`
	Name       string `json:"name,omitempty"`
	// Declaration is nil for an unassigned repository (no team file declares it).
	Declaration *Declaration `json:"declaration"`
	// Reality is nil for a repository gone from GitHub.
	Reality  *Reality       `json:"reality"`
	CircleCI *CircleCIFacts `json:"circleci,omitempty"`
	CI       *CIFacts       `json:"ci,omitempty"`
	Renovate *RenovateFacts `json:"renovate,omitempty"`
	Catalog  *Presence      `json:"catalog,omitempty"`
	Mapping  *Presence      `json:"mapping,omitempty"`
	Setup    Setup          `json:"setup"`
	Findings []Finding      `json:"findings,omitempty"`
	// RefreshedAt is when the record was built, Source by what (sweep,
	// refresh, reconciler), Age how long ago, filled on read.
	RefreshedAt time.Time `json:"refreshedAt,omitempty"`
	Source      string    `json:"source,omitempty"`
	Age         string    `json:"age,omitempty"`
}

Record is one inventory record: the declaration joined with the reality on GitHub, CircleCI, Renovate and the catalog, the set-up state and the findings.

type Release added in v8.85.0

type Release struct {
	Tag         string    `json:"tag"`
	PublishedAt time.Time `json:"publishedAt"`
	Build       *Statuses `json:"build,omitempty"`
}

Release is the latest release and whether CircleCI built it.

type RenovateFacts added in v8.85.0

type RenovateFacts struct {
	Configured      bool        `json:"configured"`
	Path            string      `json:"path,omitempty"`
	Enabled         bool        `json:"enabled"`
	DashboardIssue  *Issue      `json:"dashboardIssue,omitempty"`
	LastPullRequest *RenovatePR `json:"lastPullRequest,omitempty"`
	LastCommit      *time.Time  `json:"lastCommit,omitempty"`
}

RenovateFacts is the Renovate configuration and activity.

type RenovatePR added in v8.85.0

type RenovatePR struct {
	Number    int       `json:"number"`
	Title     string    `json:"title"`
	CreatedAt time.Time `json:"createdAt"`
}

RenovatePR is the newest open Renovate pull request.

type Rerendered added in v8.85.0

type Rerendered struct {
	Number  int      `json:"number"`
	Branch  string   `json:"branch"`
	Base    string   `json:"base"`
	Commit  string   `json:"commit"`
	Files   []string `json:"files"`
	Entries []string `json:"entries"`
}

Rerendered says the pull request was re-rendered on its base first.

type Row added in v8.85.0

type Row struct {
	Repository       string   `json:"repository"`
	Team             string   `json:"team,omitempty"`
	Lifecycle        string   `json:"lifecycle,omitempty"`
	Visibility       string   `json:"visibility,omitempty"`
	Archived         bool     `json:"archived"`
	Fork             bool     `json:"fork,omitempty"`
	Gone             bool     `json:"gone,omitempty"`
	Renovate         string   `json:"renovate,omitempty"`
	LastPersonCommit string   `json:"lastPersonCommit,omitempty"`
	Findings         []string `json:"findings,omitempty"`
	CI               *RowCI   `json:"ci,omitempty"`
	Setup            RowSetup `json:"setup"`
	Age              string   `json:"age"`
}

Row is one line of the listing.

type RowCI added in v8.85.0

type RowCI struct {
	Orb       string `json:"orb,omitempty"`
	ARM64     *bool  `json:"arm64,omitempty"`
	ChinaPush string `json:"chinaPush"`
	Signing   string `json:"signing"`
}

RowCI is the CI facts of a row.

type RowSetup added in v8.85.0

type RowSetup struct {
	Converged  *bool       `json:"converged,omitempty"`
	Refused    bool        `json:"refused,omitempty"`
	CheckedAt  string      `json:"checkedAt,omitempty"`
	LastRun    string      `json:"lastRun,omitempty"`
	PendingRun *PendingRun `json:"pendingRun,omitempty"`
	Error      string      `json:"error,omitempty"`
}

RowSetup is the set-up state of a row.

type Setup added in v8.85.0

type Setup struct {
	Checks     *reconcile.Result `json:"checks,omitempty"`
	CheckedAt  time.Time         `json:"checkedAt,omitempty"`
	CheckError string            `json:"checkError,omitempty"`
	LastRun    *LastRun          `json:"lastRun,omitempty"`
	PendingRun *PendingRun       `json:"pendingRun,omitempty"`
	MissingRun *MissingRun       `json:"missingRun,omitempty"`
}

Setup is the set-up state: the engine's checks in read mode, the last reconciler run and the run awaited.

type Statuses added in v8.85.0

type Statuses struct {
	State    string   `json:"state"`
	Contexts []string `json:"contexts,omitempty"`
}

Statuses is the worst state of a commit's ci/circleci: statuses.

type Sweep added in v8.85.0

type Sweep struct {
	Running bool          `json:"running"`
	Started bool          `json:"started"`
	Last    *SweepSummary `json:"last,omitempty"`
	Login   string        `json:"login"`
	Teams   []string      `json:"teams"`
}

Sweep is sweep_inventory's answer.

type SweepSummary added in v8.85.0

type SweepSummary struct {
	StartedAt    time.Time `json:"startedAt"`
	FinishedAt   time.Time `json:"finishedAt"`
	Duration     string    `json:"duration"`
	Repositories int       `json:"repositories"`
	Declared     int       `json:"declared"`
	Undeclared   int       `json:"undeclared"`
	Gone         int       `json:"gone"`
	Archived     int       `json:"archived"`
	EngineChecks int       `json:"engineChecks"`
	Errors       []string  `json:"errors,omitempty"`
}

SweepSummary is the last inventory sweep.

type Watch added in v8.85.0

type Watch struct {
	Repository    string              `json:"repository"`
	PullRequest   string              `json:"pullRequest,omitempty"`
	Phases        []Phase             `json:"phases"`
	Changed       bool                `json:"changed"`
	Ready         bool                `json:"ready"`
	Pending       string              `json:"pending,omitempty"`
	PendingReason string              `json:"pendingReason,omitempty"`
	Failure       *Failure            `json:"failure,omitempty"`
	Release       *WatchRelease       `json:"release,omitempty"`
	Findings      []reconcile.Finding `json:"findings,omitempty"`
	Waited        int                 `json:"waited"`
}

Watch is watch_repository's answer: the phases of a new repository on its way to readiness.

type WatchRelease added in v8.85.0

type WatchRelease struct {
	Tag string `json:"tag"`
	URL string `json:"url"`
}

WatchRelease is the first release.

Jump to

Keyboard shortcuts

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