Documentation
¶
Overview ¶
Package mrdraftnotes implements MCP tools for GitLab merge request draft note operations.
The package wraps GitLab GraphQL draft note fields:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatListMarkdown(out ListOutput) string
- func FormatOutputMarkdown(out Output) string
- func Publish(ctx context.Context, client *gitlabclient.Client, input PublishInput) error
- func PublishAll(ctx context.Context, client *gitlabclient.Client, input PublishAllInput) error
- type CreateInput
- type DeleteInput
- type DiffLinePosition
- type DiffLineRange
- type DiffPosition
- type GetInput
- type ListInput
- type ListOutput
- type Output
- func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
- func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)
- func ToOutput(d *gl.DraftNote) Output
- func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
- type PositionOutput
- type PublishAllInput
- type PublishInput
- type UpdateInput
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 merge request draft note actions. The list, get, create, update, delete, publish, and publish_all routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete deletes a draft note from a merge request.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a page of draft notes as a Markdown table: a collection of objects that share columns.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders one draft note as the card of one object.
func Publish ¶
func Publish(ctx context.Context, client *gitlabclient.Client, input PublishInput) error
Publish publishes a single draft note, making it visible to all.
func PublishAll ¶
func PublishAll(ctx context.Context, client *gitlabclient.Client, input PublishAllInput) error
PublishAll publishes all pending draft notes on a merge request, and with them the summary note and reviewer state the caller named, if any.
It calls the options variant because the other binding sends none of the three parameters. client-go marks that variant deprecated only because it plans to fold the options into PublishAllDraftNotes in v4, and says to use it meanwhile whenever the options are needed. The options are always a non-nil value, so a call naming none of them sends the empty object `{}`, the one empty body Grape parses to the parameter set it means; a nil pointer would reach the body as the `null` recorded in docs/development/upstream-bugs.md.
Types ¶
type CreateInput ¶
type CreateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
Note string `json:"note" jsonschema:"Note body text (Markdown),required"`
CommitID string `json:"commit_id,omitempty" jsonschema:"SHA of the commit to comment on"`
InReplyToDiscussionID string `json:"in_reply_to_discussion_id,omitempty" jsonschema:"Discussion ID to reply to"`
ResolveDiscussion *bool `json:"resolve_discussion,omitempty" jsonschema:"Resolve the discussion when published"`
Position *DiffPosition `` /* 136-byte string literal not displayed */
}
CreateInput defines parameters for creating a draft note.
type DeleteInput ¶
type DeleteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
NoteID int64 `json:"note_id" jsonschema:"Draft note ID,required"`
}
DeleteInput defines parameters for deleting a draft note.
type DiffLinePosition ¶
type DiffLinePosition struct {
LineCode string `json:"line_code,omitempty" jsonschema:"Line code identifying the diff line (sha_oldline_newline)."`
Type string `json:"type,omitempty" jsonschema:"Line type: 'new', 'old', or empty for unchanged context lines."`
OldLine int `json:"old_line,omitempty" jsonschema:"Line number in the old file for this range boundary."`
NewLine int `json:"new_line,omitempty" jsonschema:"Line number in the new file for this range boundary."`
}
DiffLinePosition describes a single line position within a line range. It mirrors the GitLab client-go LinePositionOptions.
type DiffLineRange ¶
type DiffLineRange struct {
Start *DiffLinePosition `json:"start,omitempty" jsonschema:"Start line position of the range."`
End *DiffLinePosition `json:"end,omitempty" jsonschema:"End line position of the range."`
}
DiffLineRange describes the start and end line positions of a multi-line inline draft note. It mirrors the GitLab client-go LineRangeOptions.
type DiffPosition ¶
type DiffPosition struct {
BaseSHA string `json:"base_sha" jsonschema:"Base commit SHA (merge-base),required"`
StartSHA string `json:"start_sha" jsonschema:"SHA of the first commit in the MR,required"`
HeadSHA string `json:"head_sha" jsonschema:"HEAD commit SHA of the MR source branch,required"`
OldPath string `json:"old_path,omitempty" jsonschema:"File path before the change (for modified/deleted files)"`
NewPath string `json:"new_path" jsonschema:"File path after the change,required"`
PositionType string `json:"position_type,omitempty" jsonschema:"Position type: 'text' for code diffs (default) or 'image' for image diffs."`
OldLine int `` /* 199-byte string literal not displayed */
NewLine int `` /* 199-byte string literal not displayed */
LineRange *DiffLineRange `` /* 142-byte string literal not displayed */
Width int `json:"width,omitempty" jsonschema:"Image width in pixels. Only for position_type 'image'."`
Height int `json:"height,omitempty" jsonschema:"Image height in pixels. Only for position_type 'image'."`
X float64 `json:"x,omitempty" jsonschema:"X coordinate of the comment on an image diff. Only for position_type 'image'."`
Y float64 `json:"y,omitempty" jsonschema:"Y coordinate of the comment on an image diff. Only for position_type 'image'."`
}
DiffPosition defines the location of an inline diff comment on a merge request. Use this to place a draft note on a specific line in the diff. It mirrors the GitLab client-go PositionOptions (discussions.go) one-to-one.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
NoteID int64 `json:"note_id" jsonschema:"Draft note ID,required"`
}
GetInput defines parameters for retrieving a single draft note.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
OrderBy string `json:"order_by,omitempty" jsonschema:"Order by: id (default)"`
Sort string `json:"sort,omitempty" jsonschema:"Sort: asc or desc (default)"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListInput defines parameters for listing draft notes in a merge request.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
DraftNotes []Output `json:"draft_notes"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput holds a paginated list of draft notes.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves all draft notes for a merge request.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
AuthorID int64 `json:"author_id"`
MergeRequestID int64 `json:"merge_request_id"`
Note string `json:"note"`
CommitID string `json:"commit_id,omitempty"`
LineCode string `json:"line_code,omitempty"`
DiscussionID string `json:"discussion_id,omitempty"`
ResolveDiscussion bool `json:"resolve_discussion"`
Position *PositionOutput `json:"position,omitempty"`
}
Output represents a single draft note.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create creates a new draft note on a merge request.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update updates an existing draft note.
type PositionOutput ¶
type PositionOutput struct {
BaseSHA string `json:"base_sha"`
StartSHA string `json:"start_sha"`
HeadSHA string `json:"head_sha"`
PositionType string `json:"position_type,omitempty"`
NewPath string `json:"new_path,omitempty"`
OldPath string `json:"old_path,omitempty"`
NewLine int64 `json:"new_line,omitempty"`
OldLine int64 `json:"old_line,omitempty"`
LineRange *toolutil.LineRangeOutput `json:"line_range,omitempty"`
}
PositionOutput represents the diff position of an inline draft note. It mirrors the GitLab client-go NotePosition (notes.go) one-to-one.
type PublishAllInput ¶
type PublishAllInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
Note string `` /* 135-byte string literal not displayed */
Internal *bool `` /* 182-byte string literal not displayed */
ReviewerState string `` /* 182-byte string literal not displayed */
}
PublishAllInput defines parameters for publishing all draft notes. The three optional fields finish the review in the same call: a summary note posted after the drafts, whether that note is internal, and the review state the caller records as a reviewer.
type PublishInput ¶
type PublishInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
NoteID int64 `json:"note_id" jsonschema:"Draft note ID,required"`
}
PublishInput defines parameters for publishing a single draft note.
type UpdateInput ¶
type UpdateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
MRIID int64 `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
NoteID int64 `json:"note_id" jsonschema:"Draft note ID,required"`
Note string `json:"note,omitempty" jsonschema:"Updated note body text (Markdown)"`
Position *DiffPosition `json:"position,omitempty" jsonschema:"Updated diff position for inline comments"`
}
UpdateInput defines parameters for updating a draft note.