Documentation
¶
Overview ¶
Package groupprotectedbranches implements MCP tool handlers for GitLab group-level protected branch operations.
Index ¶
- func FormatListMarkdown(out ListOutput) string
- func FormatOutputMarkdown(out Output) string
- func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
- func Unprotect(ctx context.Context, client *gitlabclient.Client, input UnprotectInput) error
- type AccessLevelOutput
- type BranchPermissionInput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- type ProtectInput
- type UnprotectInput
- type UpdateInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a paginated list of group protected branches as Markdown.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders a single group protected branch as Markdown.
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
RegisterTools registers group protected branch tools on the MCP server.
func Unprotect ¶
func Unprotect(ctx context.Context, client *gitlabclient.Client, input UnprotectInput) error
Unprotect removes a group-level protected branch rule.
Types ¶
type AccessLevelOutput ¶
type AccessLevelOutput struct {
ID int64 `json:"id"`
AccessLevel int `json:"access_level"`
AccessLevelDescription string `json:"access_level_description"`
DeployKeyID int64 `json:"deploy_key_id,omitempty"`
UserID int64 `json:"user_id,omitempty"`
GroupID int64 `json:"group_id,omitempty"`
}
AccessLevelOutput represents an access description for a group protected branch.
type BranchPermissionInput ¶
type BranchPermissionInput struct {
ID *int64 `json:"id,omitempty" jsonschema:"Existing permission ID to update"`
UserID *int64 `json:"user_id,omitempty" jsonschema:"User ID"`
GroupID *int64 `json:"group_id,omitempty" jsonschema:"Group ID"`
DeployKeyID *int64 `json:"deploy_key_id,omitempty" jsonschema:"Deploy key ID"`
AccessLevel *int `json:"access_level,omitempty" jsonschema:"Access level (0=No access, 30=Developer, 40=Maintainer, 60=Admin)"`
Destroy *bool `json:"_destroy,omitempty" jsonschema:"Set true to remove this permission"`
}
BranchPermissionInput represents a permission entry for protect/update operations.
type GetInput ¶
type GetInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Branch string `json:"branch" jsonschema:"Branch name or wildcard,required"`
}
GetInput defines parameters for the Get action which retrieves a single group-level protected branch.
type ListInput ¶
type ListInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Search string `json:"search,omitempty" jsonschema:"Search by branch name"`
toolutil.PaginationInput
}
ListInput defines parameters for the List action which retrieves group-level protected branches.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Branches []Output `json:"branches"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput holds a paginated list of group protected branches.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves all group-level protected branches.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Name string `json:"name"`
PushAccessLevels []AccessLevelOutput `json:"push_access_levels"`
MergeAccessLevels []AccessLevelOutput `json:"merge_access_levels"`
UnprotectAccessLevels []AccessLevelOutput `json:"unprotect_access_levels"`
AllowForcePush bool `json:"allow_force_push"`
CodeOwnerApprovalRequired bool `json:"code_owner_approval_required"`
}
Output represents a single group-level protected branch.
func Protect ¶
func Protect(ctx context.Context, client *gitlabclient.Client, input ProtectInput) (Output, error)
Protect creates a new group-level protected branch rule.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update modifies a group-level protected branch rule.
type ProtectInput ¶
type ProtectInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Name string `json:"name" jsonschema:"Branch name or wildcard to protect,required"`
PushAccessLevel *int `` /* 126-byte string literal not displayed */
MergeAccessLevel *int `json:"merge_access_level,omitempty" jsonschema:"Merge access level"`
UnprotectAccessLevel *int `json:"unprotect_access_level,omitempty" jsonschema:"Unprotect access level"`
AllowForcePush *bool `json:"allow_force_push,omitempty" jsonschema:"Allow force push"`
CodeOwnerApprovalRequired *bool `json:"code_owner_approval_required,omitempty" jsonschema:"Require code owner approval"`
AllowedToPush []BranchPermissionInput `json:"allowed_to_push,omitempty" jsonschema:"Users/groups allowed to push"`
AllowedToMerge []BranchPermissionInput `json:"allowed_to_merge,omitempty" jsonschema:"Users/groups allowed to merge"`
AllowedToUnprotect []BranchPermissionInput `json:"allowed_to_unprotect,omitempty" jsonschema:"Users/groups allowed to unprotect"`
}
ProtectInput defines parameters for the Protect action which creates a group-level protected branch rule.
type UnprotectInput ¶
type UnprotectInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Branch string `json:"branch" jsonschema:"Branch name or wildcard to unprotect,required"`
}
UnprotectInput defines parameters for the Unprotect action which removes a group-level protected branch rule.
type UpdateInput ¶
type UpdateInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
Branch string `json:"branch" jsonschema:"Branch name or wildcard,required"`
Name string `json:"name,omitempty" jsonschema:"New branch name or wildcard"`
AllowForcePush *bool `json:"allow_force_push,omitempty" jsonschema:"Allow force push"`
CodeOwnerApprovalRequired *bool `json:"code_owner_approval_required,omitempty" jsonschema:"Require code owner approval"`
AllowedToPush []BranchPermissionInput `json:"allowed_to_push,omitempty" jsonschema:"Users/groups allowed to push"`
AllowedToMerge []BranchPermissionInput `json:"allowed_to_merge,omitempty" jsonschema:"Users/groups allowed to merge"`
AllowedToUnprotect []BranchPermissionInput `json:"allowed_to_unprotect,omitempty" jsonschema:"Users/groups allowed to unprotect"`
}
UpdateInput defines parameters for the Update action which modifies a group-level protected branch rule.