Closes #52 — unblocks parallax#3 dispatch labeling, which needs to both discover a repo's label set and attach labels to an issue by name (the CAD pipeline doesn't track Gitea's internal numeric label IDs). - gitea.Client: ListLabels, AddIssueLabels (additive POST, matches Gitea's own semantics — no delete-then-post needed); extend the existing Label struct with Color for label_list's output. - tools.LabelList (read-only, allowlisted): lists a repo's labels. - tools.IssueLabel (allowlisted): resolves label names to IDs via ListLabels, so callers pass names (the primary interface) instead of hunting for numeric IDs; also accepts label_ids for callers that already have them. An unknown name fails closed, naming exactly which label wasn't found. - Bump TestRegisteredToolCount 39 -> 41 in the same commit (this project was bitten today by a locked count going stale silently). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package tools
|
|
|
|
import (
|
|
"git.d-ma.be/mathias/gitea-mcp/internal/allowlist"
|
|
"git.d-ma.be/mathias/gitea-mcp/internal/gitea"
|
|
"git.d-ma.be/mathias/gitea-mcp/internal/registry"
|
|
)
|
|
|
|
// RegisterAll registers every gitea-mcp tool on reg. main.go and the
|
|
// dispatch round-trip test share this single list so a newly added tool
|
|
// cannot be wired in one place but missing from the other.
|
|
//
|
|
// giteaBaseURL is needed by workflow_run_trigger; tmplOwner/tmplRepo seed
|
|
// create_project_from_template's default source template.
|
|
func RegisterAll(
|
|
reg *registry.Registry,
|
|
c *gitea.Client,
|
|
a *allowlist.Allowlist,
|
|
giteaBaseURL, tmplOwner, tmplRepo string,
|
|
) {
|
|
reg.Register(NewRepoList(c, a))
|
|
reg.Register(NewRepoGet(c, a))
|
|
reg.Register(NewRepoSearch(c, a))
|
|
reg.Register(NewRepoStatus(c, a))
|
|
reg.Register(NewFileRead(c, a))
|
|
reg.Register(NewFileWriteBranch(c, a))
|
|
reg.Register(NewFileDelete(c, a))
|
|
reg.Register(NewDirList(c, a))
|
|
reg.Register(NewBranchList(c, a))
|
|
reg.Register(NewBranchDelete(c, a))
|
|
reg.Register(NewBranchProtectionGet(c, a))
|
|
reg.Register(NewPRCreate(c, a))
|
|
reg.Register(NewPRGet(c, a))
|
|
reg.Register(NewPRList(c, a))
|
|
reg.Register(NewPRMerge(c, a))
|
|
reg.Register(NewTBDShip(c, a))
|
|
reg.Register(NewPRComment(c, a))
|
|
reg.Register(NewPRFilesDiff(c, a))
|
|
reg.Register(NewWorkflowRunTrigger(c, a, giteaBaseURL))
|
|
reg.Register(NewWorkflowRunStatus(c, a))
|
|
reg.Register(NewCodeSearch(c, a))
|
|
reg.Register(NewIssueCreate(c, a))
|
|
reg.Register(NewIssueEdit(c, a))
|
|
reg.Register(NewIssueComment(c, a))
|
|
reg.Register(NewCreateProjectFromTemplate(c, a, tmplOwner, tmplRepo))
|
|
reg.Register(NewTagCreate(c, a))
|
|
reg.Register(NewRepoCreate(c, a))
|
|
reg.Register(NewRepoUpdate(c, a))
|
|
reg.Register(NewRepoMirrorPush(c, a))
|
|
reg.Register(NewRepoTree(c, a))
|
|
reg.Register(NewRepoTopicsUpdate(c, a))
|
|
reg.Register(NewIssueGet(c, a))
|
|
reg.Register(NewIssueList(c, a))
|
|
reg.Register(NewIssueListComments(c, a))
|
|
reg.Register(NewIssueClose(c, a))
|
|
reg.Register(NewIssueReopen(c, a))
|
|
reg.Register(NewLabelList(c, a))
|
|
reg.Register(NewIssueLabel(c, a))
|
|
reg.Register(NewWorkflowRunList(c, a))
|
|
reg.Register(NewReleaseCreate(c, a))
|
|
reg.Register(NewRepoDelete(c, a))
|
|
}
|