@gohcltech/bitbucket-mcp
Version:
Bitbucket integration for Claude via Model Context Protocol
273 lines • 9.06 kB
TypeScript
/**
* @fileoverview TypeScript types for Bitbucket pull request operations.
*
* This module contains TypeScript interfaces that correspond to pull request-related
* entities returned by the Bitbucket API v2.0. Pull requests are central to the
* code review and collaboration workflow in Bitbucket, enabling teams to review
* and discuss changes before merging them into target branches.
*
* These types cover:
* - Pull request metadata and state information
* - Source and destination branch details
* - Comment and discussion entities
* - Author and reviewer information
*
* These types are used throughout the MCP server for:
* - Parsing Bitbucket pull request API responses
* - Ensuring type safety in code review operations
* - Supporting pull request creation and management workflows
* - Managing discussions and feedback on code changes
*/
/**
* Bitbucket pull request entity representing a code review request.
*
* A pull request is a request to merge changes from a source branch into a
* destination branch. It facilitates code review, discussion, and collaboration
* before changes are integrated into the main codebase. Pull requests track
* their state through various phases from creation to completion.
*
* @example
* ```typescript
* const pullRequest: PullRequest = {
* id: 123,
* title: "Add OAuth 2.0 authentication support",
* description: "Implements OAuth 2.0 flow for secure user authentication...",
* state: "OPEN",
* author: {
* display_name: "Kurt Wolf",
* uuid: "{user-uuid}"
* },
* source: {
* branch: { name: "feature/oauth-auth" },
* repository: { name: "bitbucket-mcp" }
* },
* destination: {
* branch: { name: "develop" },
* repository: { name: "bitbucket-mcp" }
* },
* created_on: "2025-09-23T10:30:00.000Z",
* updated_on: "2025-09-23T14:22:33.456Z",
* links: {
* html: {
* href: "https://bitbucket.org/gohcl/bitbucket-mcp/pull-requests/123"
* }
* }
* };
* ```
*/
export interface PullRequest {
/**
* Unique numeric identifier for the pull request.
*
* This is the sequential ID assigned by Bitbucket when the pull request
* is created. It's used in URLs and API calls to reference this specific
* pull request within the repository.
*/
id: number;
/**
* Pull request title summarizing the changes.
*
* A concise, descriptive title that explains what changes are being
* proposed. This appears in lists, notifications, and the pull request
* header. Should be clear and informative.
*/
title: string;
/**
* Optional detailed description of the pull request.
*
* Contains comprehensive information about the changes, including:
* - What problem is being solved
* - How the solution works
* - Testing instructions
* - Breaking changes or migration notes
* Supports markdown formatting for rich text presentation.
*/
description?: string;
/**
* Current lifecycle state of the pull request.
*
* - 'OPEN': Pull request is active and awaiting review/merge
* - 'MERGED': Changes have been successfully merged into destination
* - 'DECLINED': Pull request was rejected and closed without merging
* - 'SUPERSEDED': Pull request was replaced by another pull request
*/
state: 'OPEN' | 'MERGED' | 'DECLINED' | 'SUPERSEDED';
/**
* Information about the user who created the pull request.
*
* The author is responsible for the changes and typically responds
* to feedback and review comments.
*/
author: {
/** Display name of the pull request author */
display_name: string;
/** Unique UUID identifier for the author */
uuid: string;
};
/**
* Source branch and repository information.
*
* Defines where the changes are coming from. The source branch
* contains the commits that will be merged if the pull request
* is approved and merged.
*/
source: {
/**
* Source branch containing the proposed changes.
*/
branch: {
/** Name of the source branch (e.g., "feature/oauth-auth") */
name: string;
};
/**
* Repository containing the source branch.
*
* Usually the same as the destination repository, but can be
* different in the case of cross-repository pull requests (forks).
*/
repository: {
/** Name of the source repository */
name: string;
};
};
/**
* Destination branch and repository information.
*
* Defines where the changes will be merged if the pull request
* is approved. This is typically the main development branch
* or a release branch.
*/
destination: {
/**
* Destination branch that will receive the changes.
*/
branch: {
/** Name of the destination branch (e.g., "develop", "master") */
name: string;
};
/**
* Repository containing the destination branch.
*
* This is where the changes will be merged and is typically
* the main repository in the workflow.
*/
repository: {
/** Name of the destination repository */
name: string;
};
};
/**
* ISO 8601 timestamp when the pull request was created.
*
* This timestamp is set when the pull request is first opened
* and never changes. Used for sorting and age calculations.
*/
created_on: string;
/**
* ISO 8601 timestamp when the pull request was last modified.
*
* Updated whenever the pull request metadata changes, including
* new commits, comments, reviews, or state changes. Used to
* track activity and sort by recent activity.
*/
updated_on: string;
/**
* Collection of related URLs for the pull request.
*
* Provides direct access to the pull request's web interface
* and related resources for navigation and integration.
*/
links: {
/**
* Direct link to the pull request's page in the Bitbucket web interface.
*
* Opens the full pull request view with diff, comments, and actions.
*/
html: {
/** Full URL to the pull request page */
href: string;
};
};
}
/**
* Bitbucket pull request comment entity representing discussion and feedback.
*
* Comments are used for code review discussions, questions, suggestions,
* and general communication about the changes in a pull request. They can
* be general comments on the pull request or specific inline comments on
* particular lines of code.
*
* @example
* ```typescript
* const comment: Comment = {
* id: 456789,
* content: {
* raw: "This implementation looks good! Consider adding error handling for edge cases."
* },
* user: {
* display_name: "Jane Smith"
* },
* created_on: "2025-09-23T11:15:30.000Z",
* updated_on: "2025-09-23T11:15:30.000Z"
* };
* ```
*/
export interface Comment {
/**
* Unique numeric identifier for the comment.
*
* This is the sequential ID assigned by Bitbucket when the comment
* is created. Used for referencing, updating, or deleting specific
* comments through the API.
*/
id: number;
/**
* Comment content and formatting information.
*
* Contains the actual text of the comment in various formats.
* The raw format contains the original markdown or plain text
* as entered by the user.
*/
content: {
/**
* Raw comment text as entered by the user.
*
* May contain markdown formatting, mentions (@username),
* issue references (#123), or other Bitbucket-specific syntax.
* This is the source format used for editing and processing.
*/
raw: string;
};
/**
* Information about the user who wrote the comment.
*
* Contains identification and display information for the comment
* author, used for attribution and notifications.
*/
user: {
/**
* Display name of the comment author.
*
* This is the human-readable name shown in the interface
* next to the comment for user identification.
*/
display_name: string;
};
/**
* ISO 8601 timestamp when the comment was created.
*
* This timestamp is set when the comment is first posted
* and never changes. Used for chronological ordering
* and age display.
*/
created_on: string;
/**
* ISO 8601 timestamp when the comment was last modified.
*
* Updated whenever the comment content is edited. If the
* comment has never been edited, this will be the same
* as created_on.
*/
updated_on: string;
}
//# sourceMappingURL=types.d.ts.map