UNPKG

@monsoft/mcp-github-project-manager

Version:

A Model Context Protocol GitHub Project Manager implementation

658 lines (657 loc) 27.4 kB
import { CreatePullRequestParams, UpdatePullRequestParams, ListPullRequestsParams, GetPullRequestParams, MergePullRequestParams, CreatePullRequestReviewParams, ListPullRequestReviewsParams, CreatePullRequestReviewCommentParams, ListPullRequestReviewCommentsParams, RequestReviewersParams, UpdatePullRequestBranchParams } from '../types/index.js'; /** * Service for managing GitHub pull requests */ export declare class GitHubPullRequestService { private octokit; /** * Create a new GitHub Pull Request Service * @param token GitHub API token */ constructor(token: string); /** * Create a new pull request in a GitHub repository * @param params Pull request creation parameters * @returns The created pull request */ createPullRequest(params: CreatePullRequestParams): Promise<{ url: string; id: number; node_id: string; html_url: string; diff_url: string; patch_url: string; issue_url: string; commits_url: string; review_comments_url: string; review_comment_url: string; comments_url: string; statuses_url: string; number: number; state: "open" | "closed"; locked: boolean; title: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; body: string | null; labels: { id: number; node_id: string; url: string; name: string; description: string | null; color: string; default: boolean; }[]; milestone: import("@octokit/openapi-types").components["schemas"]["nullable-milestone"]; active_lock_reason?: string | null; created_at: string; updated_at: string; closed_at: string | null; merged_at: string | null; merge_commit_sha: string | null; assignee: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; assignees?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_reviewers?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_teams?: import("@octokit/openapi-types").components["schemas"]["team-simple"][] | null; head: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; }; base: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; }; _links: { comments: import("@octokit/openapi-types").components["schemas"]["link"]; commits: import("@octokit/openapi-types").components["schemas"]["link"]; statuses: import("@octokit/openapi-types").components["schemas"]["link"]; html: import("@octokit/openapi-types").components["schemas"]["link"]; issue: import("@octokit/openapi-types").components["schemas"]["link"]; review_comments: import("@octokit/openapi-types").components["schemas"]["link"]; review_comment: import("@octokit/openapi-types").components["schemas"]["link"]; self: import("@octokit/openapi-types").components["schemas"]["link"]; }; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; auto_merge: import("@octokit/openapi-types").components["schemas"]["auto-merge"]; draft?: boolean; merged: boolean; mergeable: boolean | null; rebaseable?: boolean | null; mergeable_state: string; merged_by: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; comments: number; review_comments: number; maintainer_can_modify: boolean; commits: number; additions: number; deletions: number; changed_files: number; }>; /** * Update an existing pull request in a GitHub repository * @param params Pull request update parameters * @returns The updated pull request */ updatePullRequest(params: UpdatePullRequestParams): Promise<{ url: string; id: number; node_id: string; html_url: string; diff_url: string; patch_url: string; issue_url: string; commits_url: string; review_comments_url: string; review_comment_url: string; comments_url: string; statuses_url: string; number: number; state: "open" | "closed"; locked: boolean; title: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; body: string | null; labels: { id: number; node_id: string; url: string; name: string; description: string | null; color: string; default: boolean; }[]; milestone: import("@octokit/openapi-types").components["schemas"]["nullable-milestone"]; active_lock_reason?: string | null; created_at: string; updated_at: string; closed_at: string | null; merged_at: string | null; merge_commit_sha: string | null; assignee: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; assignees?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_reviewers?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_teams?: import("@octokit/openapi-types").components["schemas"]["team-simple"][] | null; head: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; }; base: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; }; _links: { comments: import("@octokit/openapi-types").components["schemas"]["link"]; commits: import("@octokit/openapi-types").components["schemas"]["link"]; statuses: import("@octokit/openapi-types").components["schemas"]["link"]; html: import("@octokit/openapi-types").components["schemas"]["link"]; issue: import("@octokit/openapi-types").components["schemas"]["link"]; review_comments: import("@octokit/openapi-types").components["schemas"]["link"]; review_comment: import("@octokit/openapi-types").components["schemas"]["link"]; self: import("@octokit/openapi-types").components["schemas"]["link"]; }; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; auto_merge: import("@octokit/openapi-types").components["schemas"]["auto-merge"]; draft?: boolean; merged: boolean; mergeable: boolean | null; rebaseable?: boolean | null; mergeable_state: string; merged_by: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; comments: number; review_comments: number; maintainer_can_modify: boolean; commits: number; additions: number; deletions: number; changed_files: number; }>; /** * List pull requests in a GitHub repository * @param params Pull request listing parameters * @returns List of pull requests */ listPullRequests(params: ListPullRequestsParams): Promise<{ url: string; id: number; node_id: string; html_url: string; diff_url: string; patch_url: string; issue_url: string; commits_url: string; review_comments_url: string; review_comment_url: string; comments_url: string; statuses_url: string; number: number; state: string; locked: boolean; title: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; body: string | null; labels: { id: number; node_id: string; url: string; name: string; description: string; color: string; default: boolean; }[]; milestone: import("@octokit/openapi-types").components["schemas"]["nullable-milestone"]; active_lock_reason?: string | null; created_at: string; updated_at: string; closed_at: string | null; merged_at: string | null; merge_commit_sha: string | null; assignee: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; assignees?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_reviewers?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_teams?: import("@octokit/openapi-types").components["schemas"]["team"][] | null; head: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; }; base: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; }; _links: { comments: import("@octokit/openapi-types").components["schemas"]["link"]; commits: import("@octokit/openapi-types").components["schemas"]["link"]; statuses: import("@octokit/openapi-types").components["schemas"]["link"]; html: import("@octokit/openapi-types").components["schemas"]["link"]; issue: import("@octokit/openapi-types").components["schemas"]["link"]; review_comments: import("@octokit/openapi-types").components["schemas"]["link"]; review_comment: import("@octokit/openapi-types").components["schemas"]["link"]; self: import("@octokit/openapi-types").components["schemas"]["link"]; }; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; auto_merge: import("@octokit/openapi-types").components["schemas"]["auto-merge"]; draft?: boolean; }[]>; /** * Get a specific pull request from a GitHub repository * @param params Pull request parameters * @returns The requested pull request */ getPullRequest(params: GetPullRequestParams): Promise<{ url: string; id: number; node_id: string; html_url: string; diff_url: string; patch_url: string; issue_url: string; commits_url: string; review_comments_url: string; review_comment_url: string; comments_url: string; statuses_url: string; number: number; state: "open" | "closed"; locked: boolean; title: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; body: string | null; labels: { id: number; node_id: string; url: string; name: string; description: string | null; color: string; default: boolean; }[]; milestone: import("@octokit/openapi-types").components["schemas"]["nullable-milestone"]; active_lock_reason?: string | null; created_at: string; updated_at: string; closed_at: string | null; merged_at: string | null; merge_commit_sha: string | null; assignee: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; assignees?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_reviewers?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_teams?: import("@octokit/openapi-types").components["schemas"]["team-simple"][] | null; head: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; }; base: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; }; _links: { comments: import("@octokit/openapi-types").components["schemas"]["link"]; commits: import("@octokit/openapi-types").components["schemas"]["link"]; statuses: import("@octokit/openapi-types").components["schemas"]["link"]; html: import("@octokit/openapi-types").components["schemas"]["link"]; issue: import("@octokit/openapi-types").components["schemas"]["link"]; review_comments: import("@octokit/openapi-types").components["schemas"]["link"]; review_comment: import("@octokit/openapi-types").components["schemas"]["link"]; self: import("@octokit/openapi-types").components["schemas"]["link"]; }; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; auto_merge: import("@octokit/openapi-types").components["schemas"]["auto-merge"]; draft?: boolean; merged: boolean; mergeable: boolean | null; rebaseable?: boolean | null; mergeable_state: string; merged_by: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; comments: number; review_comments: number; maintainer_can_modify: boolean; commits: number; additions: number; deletions: number; changed_files: number; }>; /** * Merge a pull request * @param params Merge pull request parameters * @returns The merge result */ mergePullRequest(params: MergePullRequestParams): Promise<{ sha: string; merged: boolean; message: string; }>; /** * Check if a pull request has been merged * @param owner Repository owner * @param repo Repository name * @param pull_number Pull request number * @returns Boolean indicating if the pull request has been merged */ isPullRequestMerged(owner: string, repo: string, pull_number: number): Promise<boolean>; /** * Create a review for a pull request * @param params Pull request review parameters * @returns The created review */ createPullRequestReview(params: CreatePullRequestReviewParams): Promise<{ id: number; node_id: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; body: string; state: string; html_url: string; pull_request_url: string; _links: { html: { href: string; }; pull_request: { href: string; }; }; submitted_at?: string; commit_id: string | null; body_html?: string; body_text?: string; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; }>; /** * List reviews for a pull request * @param params List pull request reviews parameters * @returns List of reviews */ listPullRequestReviews(params: ListPullRequestReviewsParams): Promise<{ id: number; node_id: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; body: string; state: string; html_url: string; pull_request_url: string; _links: { html: { href: string; }; pull_request: { href: string; }; }; submitted_at?: string; commit_id: string | null; body_html?: string; body_text?: string; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; }[]>; /** * Create a review comment for a pull request * @param params Pull request review comment parameters * @returns The created comment */ createPullRequestReviewComment(params: CreatePullRequestReviewCommentParams): Promise<{ url: string; pull_request_review_id: number | null; id: number; node_id: string; diff_hunk: string; path: string; position?: number; original_position?: number; commit_id: string; original_commit_id: string; in_reply_to_id?: number; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; body: string; created_at: string; updated_at: string; html_url: string; pull_request_url: string; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; _links: { self: { href: string; }; html: { href: string; }; pull_request: { href: string; }; }; start_line?: number | null; original_start_line?: number | null; start_side?: "LEFT" | "RIGHT" | null; line?: number; original_line?: number; side?: "LEFT" | "RIGHT"; subject_type?: "line" | "file"; reactions?: import("@octokit/openapi-types").components["schemas"]["reaction-rollup"]; body_html?: string; body_text?: string; }>; /** * List review comments for a pull request * @param params List pull request review comments parameters * @returns List of review comments */ listPullRequestReviewComments(params: ListPullRequestReviewCommentsParams): Promise<{ url: string; pull_request_review_id: number | null; id: number; node_id: string; diff_hunk: string; path: string; position?: number; original_position?: number; commit_id: string; original_commit_id: string; in_reply_to_id?: number; user: import("@octokit/openapi-types").components["schemas"]["simple-user"]; body: string; created_at: string; updated_at: string; html_url: string; pull_request_url: string; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; _links: { self: { href: string; }; html: { href: string; }; pull_request: { href: string; }; }; start_line?: number | null; original_start_line?: number | null; start_side?: "LEFT" | "RIGHT" | null; line?: number; original_line?: number; side?: "LEFT" | "RIGHT"; subject_type?: "line" | "file"; reactions?: import("@octokit/openapi-types").components["schemas"]["reaction-rollup"]; body_html?: string; body_text?: string; }[]>; /** * Request reviewers for a pull request * @param params Request reviewers parameters * @returns The updated pull request */ requestReviewers(params: RequestReviewersParams): Promise<{ url: string; id: number; node_id: string; html_url: string; diff_url: string; patch_url: string; issue_url: string; commits_url: string; review_comments_url: string; review_comment_url: string; comments_url: string; statuses_url: string; number: number; state: string; locked: boolean; title: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; body: string | null; labels: { id: number; node_id: string; url: string; name: string; description: string; color: string; default: boolean; }[]; milestone: import("@octokit/openapi-types").components["schemas"]["nullable-milestone"]; active_lock_reason?: string | null; created_at: string; updated_at: string; closed_at: string | null; merged_at: string | null; merge_commit_sha: string | null; assignee: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; assignees?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_reviewers?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_teams?: import("@octokit/openapi-types").components["schemas"]["team"][] | null; head: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; }; base: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; }; _links: { comments: import("@octokit/openapi-types").components["schemas"]["link"]; commits: import("@octokit/openapi-types").components["schemas"]["link"]; statuses: import("@octokit/openapi-types").components["schemas"]["link"]; html: import("@octokit/openapi-types").components["schemas"]["link"]; issue: import("@octokit/openapi-types").components["schemas"]["link"]; review_comments: import("@octokit/openapi-types").components["schemas"]["link"]; review_comment: import("@octokit/openapi-types").components["schemas"]["link"]; self: import("@octokit/openapi-types").components["schemas"]["link"]; }; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; auto_merge: import("@octokit/openapi-types").components["schemas"]["auto-merge"]; draft?: boolean; }>; /** * Remove requested reviewers from a pull request * @param owner Repository owner * @param repo Repository name * @param pull_number Pull request number * @param reviewers Reviewers to remove * @param team_reviewers Team reviewers to remove * @returns The updated pull request */ removeRequestedReviewers(owner: string, repo: string, pull_number: number, reviewers: string[], team_reviewers?: string[]): Promise<{ url: string; id: number; node_id: string; html_url: string; diff_url: string; patch_url: string; issue_url: string; commits_url: string; review_comments_url: string; review_comment_url: string; comments_url: string; statuses_url: string; number: number; state: string; locked: boolean; title: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; body: string | null; labels: { id: number; node_id: string; url: string; name: string; description: string; color: string; default: boolean; }[]; milestone: import("@octokit/openapi-types").components["schemas"]["nullable-milestone"]; active_lock_reason?: string | null; created_at: string; updated_at: string; closed_at: string | null; merged_at: string | null; merge_commit_sha: string | null; assignee: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; assignees?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_reviewers?: import("@octokit/openapi-types").components["schemas"]["simple-user"][] | null; requested_teams?: import("@octokit/openapi-types").components["schemas"]["team"][] | null; head: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; }; base: { label: string; ref: string; repo: import("@octokit/openapi-types").components["schemas"]["repository"]; sha: string; user: import("@octokit/openapi-types").components["schemas"]["nullable-simple-user"]; }; _links: { comments: import("@octokit/openapi-types").components["schemas"]["link"]; commits: import("@octokit/openapi-types").components["schemas"]["link"]; statuses: import("@octokit/openapi-types").components["schemas"]["link"]; html: import("@octokit/openapi-types").components["schemas"]["link"]; issue: import("@octokit/openapi-types").components["schemas"]["link"]; review_comments: import("@octokit/openapi-types").components["schemas"]["link"]; review_comment: import("@octokit/openapi-types").components["schemas"]["link"]; self: import("@octokit/openapi-types").components["schemas"]["link"]; }; author_association: import("@octokit/openapi-types").components["schemas"]["author-association"]; auto_merge: import("@octokit/openapi-types").components["schemas"]["auto-merge"]; draft?: boolean; }>; /** * Update a pull request branch * @param params Update pull request branch parameters * @returns The update result */ updatePullRequestBranch(params: UpdatePullRequestBranchParams): Promise<{ message?: string; url?: string; }>; }