An intent verb for the trunk-based loop: branch from base → write the file → open a PR → auto-merge (squash) → delete the branch. One call instead of orchestrating file_write_branch + pr_create + workflow_run_status + pr_merge + branch_delete and remembering the conventions each time. The load-bearing safety is a pure, fail-closed CI gate (evaluateShipGate): merge=true ONLY when every workflow run for the PR head commit is completed+success AND the base branch is not review-protected. Every other state — CI pending / red / absent, review-required base, or an unclean merge — fails closed to PR-only and returns the PR with a reason. A change with no CI gate is never auto-merged to trunk (cf. agentsquad#36: non-compiling code reviewer-approved straight to main with no CI wall). - ci_timeout_seconds polls the head commit's runs to completion (default 0 = snapshot, returns pending right after opening the PR). - Derives a deterministic short-lived branch (tbd/<slug>-<hash>); handles new and existing files (fetches the blob sha for updates). - Adds head.sha + mergeable to the PR struct. - Tests: full gate matrix (green/pending/red/cancelled/none/mixed/protected) + Call happy-merge, no-CI fail-closed, red fail-closed, allowlist. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
2.0 KiB
Go
61 lines
2.0 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(NewWorkflowRunList(c, a))
|
|
reg.Register(NewReleaseCreate(c, a))
|
|
reg.Register(NewRepoDelete(c, a))
|
|
}
|