Documentation
¶
Overview ¶
Package commits implements MCP tools for GitLab commit operations.
The package wraps the GitLab Commits API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func FormatCommentMarkdown(c CommentOutput) string
- func FormatCommentsMarkdown(out CommentsOutput) string
- func FormatDetailMarkdown(c DetailOutput) string
- func FormatDiffMarkdown(out DiffOutput) string
- func FormatGPGSignatureMarkdown(sig GPGSignatureOutput) string
- func FormatListMarkdown(out ListOutput) string
- func FormatMRsByCommitMarkdown(out MRsByCommitOutput) string
- func FormatOutputMarkdown(c Output) string
- func FormatRefsMarkdown(out RefsOutput) string
- func FormatStatusMarkdown(s StatusOutput) string
- func FormatStatusesMarkdown(out StatusesOutput) string
- func MisreadByClientGo(err error) bool
- type Action
- type BasicMROutput
- type BasicUserOutput
- type Captured
- type CherryPickInput
- type CommentOutput
- type CommentsInput
- type CommentsOutput
- type CommitStatsOutput
- type CreateInput
- type DetailOutput
- type DiffInput
- type DiffOutput
- type GPGSignatureInput
- type GPGSignatureOutput
- type GetInput
- type LastPipelineOutput
- type ListInput
- type ListOutput
- type MRsByCommitInput
- type MRsByCommitOutput
- type Output
- func CapturedOutput(captured *gitlabclient.ResponseCapture) (Output, error)
- func CapturedOutputs(captured *gitlabclient.ResponseCapture) ([]Output, error)
- func CherryPick(ctx context.Context, client *gitlabclient.Client, input CherryPickInput) (Output, error)
- func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
- func OutputFromCaptured(c *Captured) Output
- func Revert(ctx context.Context, client *gitlabclient.Client, input RevertInput) (Output, error)
- func ToOutput(c *gl.Commit) Output
- type PostCommentInput
- type RefOutput
- type RefsInput
- type RefsOutput
- type RevertInput
- type SSHSignatureKey
- type SetStatusInput
- type StatusOutput
- type StatusesInput
- type StatusesOutput
- type X509CertificateOutput
- type X509IssuerOutput
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 commit actions exposed as MCP tools. Every read, create, update, and history route is projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).
func FormatCommentMarkdown ¶
func FormatCommentMarkdown(c CommentOutput) string
FormatCommentMarkdown renders one commit comment as a card.
func FormatCommentsMarkdown ¶
func FormatCommentsMarkdown(out CommentsOutput) string
FormatCommentsMarkdown renders a page of commit comments as a Markdown table.
func FormatDetailMarkdown ¶
func FormatDetailMarkdown(c DetailOutput) string
FormatDetailMarkdown renders one commit in full as a card: its fields, then its message as quoted prose when the message says more than the title.
func FormatDiffMarkdown ¶
func FormatDiffMarkdown(out DiffOutput) string
FormatDiffMarkdown renders the files one commit changed as a Markdown table.
func FormatGPGSignatureMarkdown ¶
func FormatGPGSignatureMarkdown(sig GPGSignatureOutput) string
FormatGPGSignatureMarkdown renders a commit's signature as a card: the verdict, then whichever signer object the signing scheme carries.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a page of commits as a Markdown table.
func FormatMRsByCommitMarkdown ¶
func FormatMRsByCommitMarkdown(out MRsByCommitOutput) string
FormatMRsByCommitMarkdown renders the merge requests a commit belongs to as a Markdown table.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders one commit as a card.
A cherry-pick or revert run with dry_run commits nothing and GitLab answers with no commit at all, which this used to render as a commit card whose heading and every field were empty: a reader could not tell it from a commit that had been made.
func FormatRefsMarkdown ¶
func FormatRefsMarkdown(out RefsOutput) string
FormatRefsMarkdown renders the branches and tags a commit is on as a Markdown table.
func FormatStatusMarkdown ¶
func FormatStatusMarkdown(s StatusOutput) string
FormatStatusMarkdown renders one commit status as a card.
func FormatStatusesMarkdown ¶
func FormatStatusesMarkdown(out StatusesOutput) string
FormatStatusesMarkdown renders a page of commit statuses as a Markdown table.
func MisreadByClientGo ¶ added in v3.1.0
MisreadByClientGo reports whether err is client-go failing to decode an answer GitLab gave successfully into a struct of its own that cannot hold it, which is what a commit carrying a trailer produces (see Captured). Such an answer is read from the capture by a type that can hold it, so the failure is not the handler's; any other error is. When the answer does not fit that type either, decoding the capture fails and the handler reports that instead.
Types ¶
type Action ¶
type Action struct {
Action string `json:"action" jsonschema:"Action to perform on the file (create, update, delete, move, chmod),required"`
FilePath string `json:"file_path" jsonschema:"Full path of the file (e.g. src/main.go),required"`
PreviousPath string `json:"previous_path,omitempty" jsonschema:"Original path when action is move"`
Content string `json:"content,omitempty" jsonschema:"File content (required for create and update)"`
Encoding string `json:"encoding,omitempty" jsonschema:"Content encoding: 'text' (default) or 'base64'"`
LastCommitID string `json:"last_commit_id,omitempty" jsonschema:"Last known commit ID of this file for conflict detection"`
ExecuteFilemode bool `json:"execute_filemode,omitempty" jsonschema:"When true, enable or disable the executable flag on the file"`
}
Action specifies a single file operation within a commit. It mirrors gl.CommitActionOptions field-for-field (C-IMPORTS).
type BasicMROutput ¶
type BasicMROutput struct {
ID int64 `json:"id"`
IID int64 `json:"iid"`
ProjectID int64 `json:"project_id"`
Title string `json:"title"`
State string `json:"state"`
Draft bool `json:"draft,omitempty"`
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
MergeCommitSHA string `json:"merge_commit_sha,omitempty"`
Labels []string `json:"labels,omitempty"`
Author *toolutil.BasicUserOutput `json:"author,omitempty"`
WebURL string `json:"web_url"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
MergedAt string `json:"merged_at,omitempty"`
ClosedAt string `json:"closed_at,omitempty"`
}
BasicMROutput is one merge request a commit belongs to, as a compact row: which merge request it is and in which project, its state and branches, where the merge landed, who opened it, its labels, and its dates. GitLab answers the list with MergeRequestBasic, whose other keys (the description, the merge options, the reviewers and assignees, time tracking and the counters) are what merge_request.get returns.
type BasicUserOutput ¶
type BasicUserOutput struct {
ID int64 `json:"id,omitempty"`
Username string `json:"username,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
State string `json:"state,omitempty"`
Blocked bool `json:"blocked,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
}
BasicUserOutput mirrors gl.Author, the user object returned on commit comments and commit statuses.
type Captured ¶ added in v3.1.0
Captured is one commit as GitLab sends it, read off the captured response (ADR-0021) as client-go's Commit reads it, except for extended_trailers, which the field here takes over. lib/api/entities/commit.rb exposes it as each trailer mapped to the list of its values, and client-go's Commit declares it a map of strings: a commit carrying a trailer fails in client-go's decoder, which then returns no commit at all, and a page holding one such commit fails as a whole. encoding/json decodes a key into the shallowest field that names it, so the embedded Commit's own field stays empty.
It is exported for the handlers of other packages that publish Output from an answer of their own carrying commits, a comparison's among them.
type CherryPickInput ¶
type CherryPickInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA to cherry-pick,required"`
Branch string `json:"branch" jsonschema:"Target branch name,required"`
DryRun bool `json:"dry_run,omitempty" jsonschema:"If true, does not create the commit but checks for conflicts"`
Message string `json:"message,omitempty" jsonschema:"Custom commit message (defaults to original)"`
}
CherryPickInput defines parameters for cherry-picking a commit.
type CommentOutput ¶
type CommentOutput struct {
toolutil.HintableOutput
Note string `json:"note"`
Path string `json:"path,omitempty"`
Line int64 `json:"line,omitempty"`
LineType string `json:"line_type,omitempty"`
Author *BasicUserOutput `json:"author,omitempty"`
// CreatedAt is when the comment was written.
CreatedAt string `json:"created_at,omitempty"`
}
CommentOutput represents a single commit comment. It mirrors gl.CommitComment (C-IMPORTS), surfacing the author as a full user object.
func PostComment ¶
func PostComment(ctx context.Context, client *gitlabclient.Client, input PostCommentInput) (CommentOutput, error)
PostComment creates a comment on a commit.
type CommentsInput ¶
type CommentsInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA,required"`
OrderBy string `json:"order_by,omitempty" jsonschema:"For keyset pagination, the column to order results by"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order for keyset pagination: 'asc' or 'desc'"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
CommentsInput defines parameters for listing comments on a commit. It mirrors gl.GetCommitCommentsOptions (C-IMPORTS) and supports offset and keyset pagination via order_by/sort/page_token.
type CommentsOutput ¶
type CommentsOutput struct {
toolutil.HintableOutput
Comments []CommentOutput `json:"comments"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
CommentsOutput holds a paginated list of commit comments.
func GetComments ¶
func GetComments(ctx context.Context, client *gitlabclient.Client, input CommentsInput) (CommentsOutput, error)
GetComments retrieves the comments on a commit.
type CommitStatsOutput ¶
type CommitStatsOutput struct {
Additions int64 `json:"additions"`
Deletions int64 `json:"deletions"`
Total int64 `json:"total"`
}
CommitStatsOutput mirrors gl.CommitStats: line additions/deletions/total for a commit.
type CreateInput ¶
type CreateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
Branch string `json:"branch" jsonschema:"Target branch name,required"`
CommitMessage string `json:"commit_message" jsonschema:"Commit message,required"`
StartBranch string `json:"start_branch,omitempty" jsonschema:"Branch to start from if target branch does not exist"`
StartSHA string `json:"start_sha,omitempty" jsonschema:"SHA to start from if target branch does not exist (alternative to start_branch)"`
StartProject string `` /* 137-byte string literal not displayed */
Actions []Action `json:"actions" jsonschema:"List of file actions (create, update, delete, move, chmod),required"`
AuthorEmail string `json:"author_email,omitempty" jsonschema:"Custom author email"`
AuthorName string `json:"author_name,omitempty" jsonschema:"Custom author name"`
Stats bool `json:"stats,omitempty" jsonschema:"Include commit stats (additions, deletions, total) in the response"`
Force bool `json:"force,omitempty" jsonschema:"When true, force-overwrite the target branch even if a conflict exists"`
}
CreateInput defines parameters for creating a commit with file actions. It mirrors gl.CreateCommitOptions (C-IMPORTS).
type DetailOutput ¶
type DetailOutput struct {
toolutil.HintableOutput
ID string `json:"id"`
ShortID string `json:"short_id"`
Title string `json:"title"`
Message string `json:"message"`
AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email"`
AuthoredDate string `json:"authored_date,omitempty"`
CommitterName string `json:"committer_name"`
CommitterEmail string `json:"committer_email"`
CommittedDate string `json:"committed_date"`
CreatedAt string `json:"created_at,omitempty"`
WebURL string `json:"web_url"`
ParentIDs []string `json:"parent_ids"`
Status string `json:"status,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
Trailers map[string]string `json:"trailers,omitempty"`
ExtendedTrailers map[string][]string `json:"extended_trailers,omitempty"`
LastPipeline *LastPipelineOutput `json:"last_pipeline,omitempty"`
Stats *CommitStatsOutput `json:"stats,omitempty"`
}
DetailOutput represents a single commit with full details. It mirrors the full gl.Commit payload (C-IMPORTS), extended_trailers typed as GitLab sends it (see Output).
func Get ¶
func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (DetailOutput, error)
Get retrieves a single commit by SHA from a GitLab project.
func (DetailOutput) ResourceURIParams ¶ added in v3.3.0
func (o DetailOutput) ResourceURIParams() map[string]any
ResourceURIParams names the canonical resource commit_get embeds by the SHA GitLab returned (toolutil.ResourceURIParamsProvider). The call's sha parameter takes a branch or a tag as well, and a commit embedded under commit/main is a snapshot filed under a URI that reads another commit once the branch moves. An output with no SHA names nothing, so the call's own parameter is used.
type DiffInput ¶
type DiffInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA hash to get diffs for,required"`
Unidiff bool `json:"unidiff,omitempty" jsonschema:"Return diffs in unified diff format"`
OrderBy string `json:"order_by,omitempty" jsonschema:"For keyset pagination, the column to order results by"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order for keyset pagination: 'asc' or 'desc'"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
DiffInput defines parameters for retrieving diffs of a commit. It mirrors gl.GetCommitDiffOptions (C-IMPORTS) and supports offset and keyset pagination via order_by/sort/page_token.
type DiffOutput ¶
type DiffOutput struct {
toolutil.HintableOutput
Diffs []toolutil.DiffOutput `json:"diffs"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
DiffOutput holds the list of file diffs for a commit.
func Diff ¶
func Diff(ctx context.Context, client *gitlabclient.Client, input DiffInput) (DiffOutput, error)
Diff retrieves the file diffs for a specific commit.
type GPGSignatureInput ¶
type GPGSignatureInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA,required"`
}
GPGSignatureInput defines parameters for retrieving a commit's GPG signature.
type GPGSignatureOutput ¶
type GPGSignatureOutput struct {
toolutil.HintableOutput
SignatureType string `json:"signature_type,omitempty"`
VerificationStatus string `json:"verification_status"`
CommitSource string `json:"commit_source,omitempty"`
KeyID int64 `json:"gpg_key_id"`
KeyPrimaryKeyID string `json:"gpg_key_primary_keyid"`
KeyUserName string `json:"gpg_key_user_name"`
KeyUserEmail string `json:"gpg_key_user_email"`
KeySubkeyID int64 `json:"gpg_key_subkey_id,omitempty"`
Key *SSHSignatureKey `json:"key,omitempty"`
X509Certificate *X509CertificateOutput `json:"x509_certificate,omitempty"`
}
GPGSignatureOutput represents a commit's cryptographic signature. It mirrors the documented "Get the signature of a commit" response, which is a superset of gl.GPGSignature: the SDK struct only exposes the PGP (gpg_key_*) fields and verification_status, while the documented response also returns signature_type, commit_source, and the SSH (key) and X.509 (x509_certificate) sub-objects. Those documented-but-not-in-SDK fields are surfaced via a raw REST fetch (client.GL().NewRequest+Do, per doc/api/commits.md#get-the-signature-of-a-commit).
func GetGPGSignature ¶
func GetGPGSignature(ctx context.Context, client *gitlabclient.Client, input GPGSignatureInput) (GPGSignatureOutput, error)
GetGPGSignature retrieves the cryptographic signature of a commit. It uses a raw REST fetch to surface the full documented signature superset (PGP, SSH, and X.509 variants); the SDK's gl.GPGSignature only exposes the PGP subset.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA hash to retrieve,required"`
Stats bool `json:"stats,omitempty" jsonschema:"Include commit stats (additions, deletions, total). Defaults to true on GitLab"`
}
GetInput defines parameters for retrieving a single commit. It mirrors gl.GetCommitOptions (C-IMPORTS).
type LastPipelineOutput ¶
type LastPipelineOutput = toolutil.LastPipelineOutput
LastPipelineOutput mirrors gl.PipelineInfo, the pipeline summary embedded in a commit payload as last_pipeline. Canonical shape shared via toolutil.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
RefName string `json:"ref_name,omitempty" jsonschema:"Branch name, tag, or commit SHA to list commits from (default: default branch)"`
Since string `json:"since,omitempty" jsonschema:"Return commits after this date (ISO 8601 format, e.g. 2025-01-01T00:00:00Z)"`
Until string `json:"until,omitempty" jsonschema:"Return commits before this date (ISO 8601 format, e.g. 2025-12-31T23:59:59Z)"`
Path string `json:"path,omitempty" jsonschema:"File path to filter commits by (only commits touching this path)"`
Author string `json:"author,omitempty" jsonschema:"Filter by commit author name or email"`
All bool `json:"all,omitempty" jsonschema:"Retrieve every commit from the whole repository (across all branches)"`
WithStats bool `json:"with_stats,omitempty" jsonschema:"Include commit stats (additions, deletions, total)"`
FirstParent bool `json:"first_parent,omitempty" jsonschema:"Follow only the first parent commit upon seeing a merge commit"`
Trailers bool `json:"trailers,omitempty" jsonschema:"Parse and include Git trailers for every commit"`
OrderBy string `json:"order_by,omitempty" jsonschema:"For keyset pagination, the column to order results by"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order for keyset pagination: 'asc' or 'desc'"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListInput defines parameters for listing commits in a GitLab project. It mirrors gl.ListCommitsOptions (C-IMPORTS) and supports offset and keyset pagination via order_by/sort/page_token.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Commits []Output `json:"commits"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput holds a paginated list of commits.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves a paginated list of commits for a GitLab project. Supports filtering by branch/tag, date range, file path, and author.
type MRsByCommitInput ¶
type MRsByCommitInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA,required"`
toolutil.PaginationInput
}
MRsByCommitInput defines parameters for listing merge requests associated with a commit, and the page of them to list. client-go's ListMergeRequestsByCommit takes no options struct, so the page travels as a request option.
type MRsByCommitOutput ¶
type MRsByCommitOutput struct {
toolutil.HintableOutput
MergeRequests []BasicMROutput `json:"merge_requests"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
MRsByCommitOutput holds one page of the merge requests a commit belongs to and the pagination GitLab sent with it.
func ListMRsByCommit ¶
func ListMRsByCommit(ctx context.Context, client *gitlabclient.Client, input MRsByCommitInput) (MRsByCommitOutput, error)
ListMRsByCommit retrieves one page of the merge requests associated with a commit.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID string `json:"id"`
ShortID string `json:"short_id"`
Title string `json:"title"`
Message string `json:"message,omitempty"`
AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email"`
AuthoredDate string `json:"authored_date,omitempty"`
CommitterName string `json:"committer_name"`
CommitterEmail string `json:"committer_email"`
CommittedDate string `json:"committed_date"`
CreatedAt string `json:"created_at,omitempty"`
WebURL string `json:"web_url"`
ParentIDs []string `json:"parent_ids,omitempty"`
Status string `json:"status,omitempty"`
ProjectID int64 `json:"project_id,omitempty"`
Trailers map[string]string `json:"trailers,omitempty"`
ExtendedTrailers map[string][]string `json:"extended_trailers,omitempty"`
LastPipeline *LastPipelineOutput `json:"last_pipeline,omitempty"`
Stats *CommitStatsOutput `json:"stats,omitempty"`
}
Output represents a created commit. It mirrors the full gl.Commit payload (C-IMPORTS), surfacing trailers, the last associated pipeline, and stats.
extended_trailers maps each trailer to the list of its values, which is how Gitlab::Git::Commit#parse_commit_trailers builds it and how lib/api/entities/commit.rb documents it; client-go's Commit declares it a map of strings, so it is read off the captured response (Captured).
func CapturedOutput ¶ added in v3.1.0
func CapturedOutput(captured *gitlabclient.ResponseCapture) (Output, error)
CapturedOutput decodes the one commit a route answered with from the captured response.
func CapturedOutputs ¶ added in v3.1.0
func CapturedOutputs(captured *gitlabclient.ResponseCapture) ([]Output, error)
CapturedOutputs decodes the page of commits a route answered with from the captured response, in order.
func CherryPick ¶
func CherryPick(ctx context.Context, client *gitlabclient.Client, input CherryPickInput) (Output, error)
CherryPick cherry-picks a commit to a target branch.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create creates a new commit in the specified GitLab project with one or more file actions. Supports optional start branch (to create a new branch from an existing one) and custom author metadata. Returns the created commit details or an error if the API call fails.
func OutputFromCaptured ¶ added in v3.1.0
OutputFromCaptured converts a commit read off the captured response, extended_trailers included.
func Revert ¶
func Revert(ctx context.Context, client *gitlabclient.Client, input RevertInput) (Output, error)
Revert reverts a commit on a target branch.
func ToOutput ¶
ToOutput converts a GitLab API gl.Commit to the list/summary MCP tool output format, mirroring the full commit payload but for extended_trailers, which a Commit client-go decoded cannot hold (see [commitToFields]). A handler that holds the captured response converts with OutputFromCaptured, which adds them.
type PostCommentInput ¶
type PostCommentInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA,required"`
Note string `json:"note" jsonschema:"Comment text,required"`
Path string `json:"path,omitempty" jsonschema:"File path to comment on (for inline comments)"`
Line int64 `json:"line,omitempty" jsonschema:"Line number to comment on"`
LineType string `json:"line_type,omitempty" jsonschema:"Line type: new or old (default: new)"`
}
PostCommentInput defines parameters for posting a comment on a commit.
type RefsInput ¶
type RefsInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA to look up,required"`
Type string `json:"type,omitempty" jsonschema:"Filter by ref type: branch, tag, or all (default: all)"`
OrderBy string `json:"order_by,omitempty" jsonschema:"For keyset pagination, the column to order results by"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order for keyset pagination: 'asc' or 'desc'"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
RefsInput defines parameters for retrieving branches/tags referencing a commit. It mirrors gl.GetCommitRefsOptions (C-IMPORTS) and supports offset and keyset pagination via order_by/sort/page_token.
type RefsOutput ¶
type RefsOutput struct {
toolutil.HintableOutput
Refs []RefOutput `json:"refs"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
RefsOutput holds a paginated list of refs referencing a commit.
func GetRefs ¶
func GetRefs(ctx context.Context, client *gitlabclient.Client, input RefsInput) (RefsOutput, error)
GetRefs retrieves branches and tags a commit is pushed to.
type RevertInput ¶
type RevertInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA to revert,required"`
Branch string `json:"branch" jsonschema:"Target branch name,required"`
}
RevertInput defines parameters for reverting a commit.
type SSHSignatureKey ¶
type SSHSignatureKey struct {
ID int64 `json:"id"`
Title string `json:"title,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
Key string `json:"key,omitempty"`
UsageType string `json:"usage_type,omitempty"`
}
SSHSignatureKey mirrors the documented `key` object on an SSH-signed commit signature (doc/api/commits.md#get-the-signature-of-a-commit). The SDK gl.GPGSignature lacks this object, so it is decoded via the raw REST superset.
type SetStatusInput ¶
type SetStatusInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `json:"sha" jsonschema:"Commit SHA,required"`
State string `json:"state" jsonschema:"Status state: pending, running, success, failed, canceled,required"`
Ref string `json:"ref,omitempty" jsonschema:"Branch or tag name"`
Name string `json:"name,omitempty" jsonschema:"Status name / context"`
Context string `json:"context,omitempty" jsonschema:"Status context label (overrides name)"`
TargetURL string `json:"target_url,omitempty" jsonschema:"URL to link from the status"`
Description string `json:"description,omitempty" jsonschema:"Short description of the status"`
Coverage float64 `json:"coverage,omitempty" jsonschema:"Code coverage percentage"`
PipelineID int64 `json:"pipeline_id,omitempty" jsonschema:"Pipeline ID to associate the status with"`
}
SetStatusInput defines parameters for setting a commit pipeline status.
type StatusOutput ¶
type StatusOutput struct {
toolutil.HintableOutput
ID int64 `json:"id"`
SHA string `json:"sha"`
Ref string `json:"ref"`
Status string `json:"status"`
Name string `json:"name"`
TargetURL string `json:"target_url,omitempty"`
Description string `json:"description,omitempty"`
Coverage float64 `json:"coverage,omitempty"`
PipelineID int64 `json:"pipeline_id,omitempty"`
AllowFailure bool `json:"allow_failure,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
StartedAt string `json:"started_at,omitempty"`
FinishedAt string `json:"finished_at,omitempty"`
Author *BasicUserOutput `json:"author,omitempty"`
}
StatusOutput represents a single commit pipeline status. It mirrors gl.CommitStatus (C-IMPORTS), surfacing the author as a full user object.
func SetStatus ¶
func SetStatus(ctx context.Context, client *gitlabclient.Client, input SetStatusInput) (StatusOutput, error)
SetStatus sets the pipeline status of a commit.
type StatusesInput ¶
type StatusesInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
SHA string `` /* 229-byte string literal not displayed */
Ref string `json:"ref,omitempty" jsonschema:"Branch or tag name filter"`
Stage string `json:"stage,omitempty" jsonschema:"Stage name filter"`
Name string `json:"name,omitempty" jsonschema:"Status name filter"`
PipelineID int64 `json:"pipeline_id,omitempty" jsonschema:"Pipeline ID filter"`
All bool `json:"all,omitempty" jsonschema:"Return all statuses including retries"`
OrderBy string `json:"order_by,omitempty" jsonschema:"For keyset pagination, the column to order results by"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order for keyset pagination: 'asc' or 'desc'"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
StatusesInput defines parameters for listing pipeline statuses of a commit. It mirrors gl.GetCommitStatusesOptions (C-IMPORTS) and supports offset and keyset pagination via order_by/sort/page_token.
type StatusesOutput ¶
type StatusesOutput struct {
toolutil.HintableOutput
Statuses []StatusOutput `json:"statuses"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
StatusesOutput holds a paginated list of commit statuses.
func GetStatuses ¶
func GetStatuses(ctx context.Context, client *gitlabclient.Client, input StatusesInput) (StatusesOutput, error)
GetStatuses retrieves the pipeline statuses of a commit.
type X509CertificateOutput ¶
type X509CertificateOutput struct {
ID int64 `json:"id"`
Subject string `json:"subject,omitempty"`
SubjectKeyIdentifier string `json:"subject_key_identifier,omitempty"`
Email string `json:"email,omitempty"`
SerialNumber json.Number `json:"serial_number,omitempty"`
CertificateStatus string `json:"certificate_status,omitempty"`
X509Issuer *X509IssuerOutput `json:"x509_issuer,omitempty"`
}
X509CertificateOutput mirrors the documented `x509_certificate` object on an X.509-signed commit signature (doc/api/commits.md#get-the-signature-of-a-commit). The SDK gl.GPGSignature lacks this object, so it is decoded via the raw REST superset.
type X509IssuerOutput ¶
type X509IssuerOutput struct {
ID int64 `json:"id"`
Subject string `json:"subject,omitempty"`
SubjectKeyIdentifier string `json:"subject_key_identifier,omitempty"`
CRLURL string `json:"crl_url,omitempty"`
}
X509IssuerOutput mirrors the documented nested `x509_issuer` object of an X.509 certificate (doc/api/commits.md#get-the-signature-of-a-commit).