import atlassianPullRequestsService from '../services/vendor.atlassian.pullrequests.service.js'; import { Logger } from '../utils/logger.util.js'; import { handleControllerError } from '../utils/error-handler.util.js'; import { extractPaginationInfo, PaginationType } from '../utils/pagination.util.js'; import { formatPagination } from '../utils/formatter.util.js'; import { formatPullRequestsList, formatPullRequestDetails, formatPullRequestComments } from './atlassian.pullrequests.formatter.js'; import { PullRequestComment, PullRequestCommentsResponse } from '../services/vendor.atlassian.pullrequests.types.js'; import { DEFAULT_PAGE_SIZE, applyDefaults } from '../utils/defaults.util.js'; import { optimizeBitbucketMarkdown } from '../utils/formatter.util.js'; import { getDefaultWorkspace } from '../utils/workspace.util.js'; /** * Base controller for managing Bitbucket pull requests. * Contains shared utilities and types used by the specific PR controller files. * * NOTE ON MARKDOWN HANDLING: * Unlike Jira (which uses ADF) or Confluence (which uses a mix of formats), * Bitbucket Cloud API natively accepts Markdown for text content in both directions: * - When sending data TO the API (comments, PR descriptions) * - When receiving data FROM the API (PR descriptions, comments) * * The API expects content in the format: { content: { raw: "markdown-text" } } * * We use optimizeBitbucketMarkdown() to address specific rendering quirks in * Bitbucket's markdown renderer but it does NOT perform format conversion. * See formatter.util.ts for details on the specific issues it addresses. */ export interface PullRequestCommentWithSnippet extends PullRequestComment { codeSnippet?: string; } export type ListCommentsParams = { workspace: string; repo_slug: string; pull_request_id: number; pagelen?: number; page?: number; }; export type CreateCommentParams = { workspace: string; repo_slug: string; pull_request_id: number; content: { raw: string; }; inline?: { path: string; to?: number; }; parent?: { id: number; }; }; export type UpdateCommentParams = { workspace: string; repo_slug: string; pull_request_id: number; comment_id: number; content: { raw: string; }; }; export type DeleteCommentParams = { workspace: string; repo_slug: string; pull_request_id: number; comment_id: number; }; export declare function enhanceCommentsWithSnippets(commentsData: PullRequestCommentsResponse, controllerMethodName: string): Promise; export { atlassianPullRequestsService, Logger, handleControllerError, extractPaginationInfo, PaginationType, formatPagination, formatPullRequestsList, formatPullRequestDetails, formatPullRequestComments, DEFAULT_PAGE_SIZE, applyDefaults, optimizeBitbucketMarkdown, getDefaultWorkspace, };