branchrules

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package branchrules implements MCP tools for GitLab branch rule discovery.

The package wraps GitLab GraphQL branch rule fields:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for branch rule actions.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a paginated list of branch rules as Markdown.

Types

type ApprovalRule

type ApprovalRule struct {
	Name              string `json:"name"`
	ApprovalsRequired int    `json:"approvals_required"`
	Type              string `json:"type,omitempty"`
}

ApprovalRule represents an approval rule associated with a branch rule.

type BranchProtection

type BranchProtection struct {
	AllowForcePush            bool `json:"allow_force_push"`
	CodeOwnerApprovalRequired bool `json:"code_owner_approval_required"`
}

BranchProtection holds protection settings for a branch rule.

type BranchRuleItem

type BranchRuleItem struct {
	Name                  string                `json:"name"`
	IsDefault             bool                  `json:"is_default"`
	IsProtected           bool                  `json:"is_protected"`
	MatchingBranchesCount int                   `json:"matching_branches_count"`
	CreatedAt             string                `json:"created_at,omitempty"`
	UpdatedAt             string                `json:"updated_at,omitempty"`
	BranchProtection      *BranchProtection     `json:"branch_protection,omitempty"`
	ApprovalRules         []ApprovalRule        `json:"approval_rules,omitempty"`
	ExternalStatusChecks  []ExternalStatusCheck `json:"external_status_checks,omitempty"`
}

BranchRuleItem represents a branch rule summary.

type ExternalStatusCheck

type ExternalStatusCheck struct {
	Name        string `json:"name"`
	ExternalURL string `json:"external_url"`
}

ExternalStatusCheck represents an external status check on a branch rule.

type ListInput

type ListInput struct {
	ProjectPath string `json:"project_path" jsonschema:"required,Project full path (e.g. my-group/my-project)"`
	toolutil.GraphQLPaginationInput
}

ListInput is the input for listing branch rules.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Rules      []BranchRuleItem                 `json:"rules"`
	Pagination toolutil.GraphQLPaginationOutput `json:"pagination"`
}

ListOutput is the output for listing branch rules.

func List

func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)

List retrieves branch rules for a project via the GitLab GraphQL API. It selects the EE query (with approval rules, external status checks, and code owner approval) when the client is configured for Enterprise, otherwise it uses the CE-compatible query that omits EE-only fields.

Jump to

Keyboard shortcuts

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