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
- func IsAuthRequired(err error) bool
- func IsInvalidConfig(err error) bool
- func IsTool(err error) bool
- func IsUnreachable(err error) bool
- type Approval
- type CIFacts
- type Caller
- type Change
- type ChangePullRequest
- type CircleCIFacts
- type Client
- type Commit
- type Committed
- type Declaration
- type Delivery
- type Dispatch
- type Failure
- type Finding
- type Info
- type Issue
- type LastRun
- type Listing
- type MissingRun
- type OptIn
- type PendingRun
- type Person
- type Phase
- type Plan
- type PlannedMessage
- type PlannedPullRequest
- type PlannedStep
- type Presence
- type PullRequest
- type Reality
- type Record
- type Release
- type RenovateFacts
- type RenovatePR
- type Rerendered
- type Row
- type RowCI
- type RowSetup
- type Setup
- type Statuses
- type Sweep
- type SweepSummary
- type Watch
- type WatchRelease
Constants ¶
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.
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
IsAuthRequired asserts authRequiredError: the endpoint refused the bearer (401 or 403); the person logs in to muster again.
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsTool ¶
IsTool asserts toolError: the manager answered with an error or an answer the client does not understand.
func IsUnreachable ¶
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
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"`
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.
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 []reposetup.Problem `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 string `json:"channel,omitempty"`
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 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 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
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
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 string `json:"channel,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
PlannedStep is one step's planned changes from the inventory's last check.
type Presence ¶ added in v8.85.0
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 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
WatchRelease is the first release.