@atercates/bitbucket-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +347 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.js +35 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/handlers/branching-model.d.ts +2 -0
- package/dist/handlers/branching-model.js +324 -0
- package/dist/handlers/branching-model.js.map +1 -0
- package/dist/handlers/commits.d.ts +2 -0
- package/dist/handlers/commits.js +78 -0
- package/dist/handlers/commits.js.map +1 -0
- package/dist/handlers/index.d.ts +17 -0
- package/dist/handlers/index.js +29 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/pipelines.d.ts +2 -0
- package/dist/handlers/pipelines.js +538 -0
- package/dist/handlers/pipelines.js.map +1 -0
- package/dist/handlers/pr-comments.d.ts +2 -0
- package/dist/handlers/pr-comments.js +509 -0
- package/dist/handlers/pr-comments.js.map +1 -0
- package/dist/handlers/pr-content.d.ts +2 -0
- package/dist/handlers/pr-content.js +332 -0
- package/dist/handlers/pr-content.js.map +1 -0
- package/dist/handlers/pr-tasks.d.ts +2 -0
- package/dist/handlers/pr-tasks.js +275 -0
- package/dist/handlers/pr-tasks.js.map +1 -0
- package/dist/handlers/pull-requests.d.ts +2 -0
- package/dist/handlers/pull-requests.js +902 -0
- package/dist/handlers/pull-requests.js.map +1 -0
- package/dist/handlers/refs.d.ts +2 -0
- package/dist/handlers/refs.js +225 -0
- package/dist/handlers/refs.js.map +1 -0
- package/dist/handlers/repositories.d.ts +2 -0
- package/dist/handlers/repositories.js +131 -0
- package/dist/handlers/repositories.js.map +1 -0
- package/dist/handlers/source.d.ts +2 -0
- package/dist/handlers/source.js +35 -0
- package/dist/handlers/source.js.map +1 -0
- package/dist/handlers/types.d.ts +42 -0
- package/dist/handlers/types.js +2 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/handlers/users.d.ts +2 -0
- package/dist/handlers/users.js +38 -0
- package/dist/handlers/users.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +60 -0
- package/dist/logger.js.map +1 -0
- package/dist/pagination.d.ts +32 -0
- package/dist/pagination.js +116 -0
- package/dist/pagination.js.map +1 -0
- package/dist/schemas.d.ts +21 -0
- package/dist/schemas.js +23 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +124 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.js +17 -0
- package/dist/utils.js.map +1 -0
- package/docs/README.md +216 -0
- package/docs/TOOLS.md +464 -0
- package/docs/architecture/ARCHITECTURE.md +302 -0
- package/docs/guides/ENVIRONMENT_VARIABLES.md +306 -0
- package/docs/guides/GETTING_STARTED.md +267 -0
- package/docs/guides/GITHUB_ACTIONS_SETUP.md +148 -0
- package/docs/guides/NPM_DEPLOYMENT.md +266 -0
- package/docs/guides/PROJECT_STRUCTURE.md +317 -0
- package/package.json +84 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { PAGINATION_BASE_SCHEMA, PAGINATION_ALL_SCHEMA } from "../schemas.js";
|
|
2
|
+
import { jsonResponse, textResponse } from "../utils.js";
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { BITBUCKET_MAX_PAGELEN } from "../pagination.js";
|
|
6
|
+
/** Schema for inline comment positioning */
|
|
7
|
+
const INLINE_COMMENT_SCHEMA = {
|
|
8
|
+
type: "object",
|
|
9
|
+
description: "Inline comment information for commenting on specific lines",
|
|
10
|
+
properties: {
|
|
11
|
+
path: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Path to the file in the repository",
|
|
14
|
+
},
|
|
15
|
+
from: {
|
|
16
|
+
type: "number",
|
|
17
|
+
description: "Line number in the old version of the file (for deleted or modified lines)",
|
|
18
|
+
},
|
|
19
|
+
to: {
|
|
20
|
+
type: "number",
|
|
21
|
+
description: "Line number in the new version of the file (for added or modified lines)",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ["path"],
|
|
25
|
+
};
|
|
26
|
+
/** Common PR comment parameters */
|
|
27
|
+
const PR_COMMENT_BASE_PROPERTIES = {
|
|
28
|
+
workspace: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Bitbucket workspace name",
|
|
31
|
+
},
|
|
32
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
33
|
+
pull_request_id: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Pull request ID",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const PR_COMMENT_BASE_REQUIRED = ["workspace", "repo_slug", "pull_request_id"];
|
|
39
|
+
/** Extended properties for single comment operations */
|
|
40
|
+
const PR_COMMENT_WITH_ID_PROPERTIES = {
|
|
41
|
+
...PR_COMMENT_BASE_PROPERTIES,
|
|
42
|
+
comment_id: { type: "string", description: "Comment ID" },
|
|
43
|
+
};
|
|
44
|
+
const PR_COMMENT_WITH_ID_REQUIRED = [...PR_COMMENT_BASE_REQUIRED, "comment_id"];
|
|
45
|
+
export const prCommentsModule = {
|
|
46
|
+
tools: [
|
|
47
|
+
{
|
|
48
|
+
name: "getPullRequestComments",
|
|
49
|
+
description: "List comments on a pull request",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
...PR_COMMENT_BASE_PROPERTIES,
|
|
54
|
+
...PAGINATION_BASE_SCHEMA,
|
|
55
|
+
all: PAGINATION_ALL_SCHEMA,
|
|
56
|
+
},
|
|
57
|
+
required: PR_COMMENT_BASE_REQUIRED,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "addPullRequestComment",
|
|
62
|
+
description: "Add a comment to a pull request (general or inline)",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
...PR_COMMENT_BASE_PROPERTIES,
|
|
67
|
+
content: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Comment content in markdown format",
|
|
70
|
+
},
|
|
71
|
+
pending: {
|
|
72
|
+
type: "boolean",
|
|
73
|
+
description: "Whether to create this comment as a pending comment (draft state)",
|
|
74
|
+
},
|
|
75
|
+
inline: INLINE_COMMENT_SCHEMA,
|
|
76
|
+
},
|
|
77
|
+
required: [...PR_COMMENT_BASE_REQUIRED, "content"],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "addPendingPullRequestComment",
|
|
82
|
+
description: "Add a pending (draft) comment to a pull request that can be published later",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
...PR_COMMENT_BASE_PROPERTIES,
|
|
87
|
+
content: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "Comment content in markdown format",
|
|
90
|
+
},
|
|
91
|
+
inline: INLINE_COMMENT_SCHEMA,
|
|
92
|
+
},
|
|
93
|
+
required: [...PR_COMMENT_BASE_REQUIRED, "content"],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "publishPendingComments",
|
|
98
|
+
description: "Publish all pending comments for a pull request",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: PR_COMMENT_BASE_PROPERTIES,
|
|
102
|
+
required: PR_COMMENT_BASE_REQUIRED,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "getPullRequestComment",
|
|
107
|
+
description: "Get a specific comment on a pull request",
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: PR_COMMENT_WITH_ID_PROPERTIES,
|
|
111
|
+
required: PR_COMMENT_WITH_ID_REQUIRED,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "updatePullRequestComment",
|
|
116
|
+
description: "Update a comment on a pull request",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
...PR_COMMENT_WITH_ID_PROPERTIES,
|
|
121
|
+
content: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "Updated comment content",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
required: [...PR_COMMENT_WITH_ID_REQUIRED, "content"],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "deletePullRequestComment",
|
|
131
|
+
description: "Delete a comment on a pull request",
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: PR_COMMENT_WITH_ID_PROPERTIES,
|
|
135
|
+
required: PR_COMMENT_WITH_ID_REQUIRED,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "resolveComment",
|
|
140
|
+
description: "Resolve a comment thread on a pull request",
|
|
141
|
+
inputSchema: {
|
|
142
|
+
type: "object",
|
|
143
|
+
properties: PR_COMMENT_WITH_ID_PROPERTIES,
|
|
144
|
+
required: PR_COMMENT_WITH_ID_REQUIRED,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "reopenComment",
|
|
149
|
+
description: "Reopen a resolved comment thread on a pull request",
|
|
150
|
+
inputSchema: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: PR_COMMENT_WITH_ID_PROPERTIES,
|
|
153
|
+
required: PR_COMMENT_WITH_ID_REQUIRED,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
dangerousTools: ["deletePullRequestComment"],
|
|
158
|
+
createHandlers: (client) => ({
|
|
159
|
+
getPullRequestComments: async (args) => {
|
|
160
|
+
const workspace = args.workspace;
|
|
161
|
+
const repo_slug = args.repo_slug;
|
|
162
|
+
const pull_request_id = args.pull_request_id;
|
|
163
|
+
const pagelen = args.pagelen;
|
|
164
|
+
const page = args.page;
|
|
165
|
+
const all = args.all;
|
|
166
|
+
try {
|
|
167
|
+
logger.info("Getting Bitbucket pull request comments", {
|
|
168
|
+
workspace,
|
|
169
|
+
repo_slug,
|
|
170
|
+
pull_request_id,
|
|
171
|
+
pagelen,
|
|
172
|
+
page,
|
|
173
|
+
all,
|
|
174
|
+
});
|
|
175
|
+
const result = await client.paginator.fetchValues(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments`, {
|
|
176
|
+
pagelen,
|
|
177
|
+
page,
|
|
178
|
+
all,
|
|
179
|
+
description: "getPullRequestComments",
|
|
180
|
+
});
|
|
181
|
+
return jsonResponse(result.values);
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
logger.error("Error getting pull request comments", {
|
|
185
|
+
error,
|
|
186
|
+
workspace,
|
|
187
|
+
repo_slug,
|
|
188
|
+
pull_request_id,
|
|
189
|
+
});
|
|
190
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get pull request comments: ${error instanceof Error ? error.message : String(error)}`);
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
addPullRequestComment: async (args) => {
|
|
194
|
+
const workspace = args.workspace;
|
|
195
|
+
const repo_slug = args.repo_slug;
|
|
196
|
+
const pull_request_id = args.pull_request_id;
|
|
197
|
+
const content = args.content;
|
|
198
|
+
const inline = args.inline;
|
|
199
|
+
const pending = args.pending;
|
|
200
|
+
try {
|
|
201
|
+
logger.info("Adding comment to Bitbucket pull request", {
|
|
202
|
+
workspace,
|
|
203
|
+
repo_slug,
|
|
204
|
+
pull_request_id,
|
|
205
|
+
inline: inline ? "inline comment" : "general comment",
|
|
206
|
+
});
|
|
207
|
+
// Prepare the comment data
|
|
208
|
+
const commentData = {
|
|
209
|
+
content: {
|
|
210
|
+
raw: content,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
// Add pending flag if provided
|
|
214
|
+
if (pending !== undefined) {
|
|
215
|
+
commentData.pending = pending;
|
|
216
|
+
}
|
|
217
|
+
// Add inline information if provided
|
|
218
|
+
if (inline) {
|
|
219
|
+
const inlineData = {
|
|
220
|
+
path: inline.path,
|
|
221
|
+
};
|
|
222
|
+
// Add line number information based on the type
|
|
223
|
+
if (inline.from !== undefined) {
|
|
224
|
+
inlineData.from = inline.from;
|
|
225
|
+
}
|
|
226
|
+
if (inline.to !== undefined) {
|
|
227
|
+
inlineData.to = inline.to;
|
|
228
|
+
}
|
|
229
|
+
commentData.inline = inlineData;
|
|
230
|
+
}
|
|
231
|
+
const response = await client.api.post(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments`, commentData);
|
|
232
|
+
return jsonResponse(response.data);
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
logger.error("Error adding comment to pull request", {
|
|
236
|
+
error,
|
|
237
|
+
workspace,
|
|
238
|
+
repo_slug,
|
|
239
|
+
pull_request_id,
|
|
240
|
+
});
|
|
241
|
+
throw new McpError(ErrorCode.InternalError, `Failed to add pull request comment: ${error instanceof Error ? error.message : String(error)}`);
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
addPendingPullRequestComment: async (args) => {
|
|
245
|
+
const workspace = args.workspace;
|
|
246
|
+
const repo_slug = args.repo_slug;
|
|
247
|
+
const pull_request_id = args.pull_request_id;
|
|
248
|
+
const content = args.content;
|
|
249
|
+
const inline = args.inline;
|
|
250
|
+
try {
|
|
251
|
+
logger.info("Adding pending comment to Bitbucket pull request", {
|
|
252
|
+
workspace,
|
|
253
|
+
repo_slug,
|
|
254
|
+
pull_request_id,
|
|
255
|
+
inline: inline ? "inline comment" : "general comment",
|
|
256
|
+
});
|
|
257
|
+
// Prepare the comment data with pending=true
|
|
258
|
+
const commentData = {
|
|
259
|
+
content: {
|
|
260
|
+
raw: content,
|
|
261
|
+
},
|
|
262
|
+
pending: true,
|
|
263
|
+
};
|
|
264
|
+
// Add inline information if provided
|
|
265
|
+
if (inline) {
|
|
266
|
+
const inlineData = {
|
|
267
|
+
path: inline.path,
|
|
268
|
+
};
|
|
269
|
+
if (inline.from !== undefined) {
|
|
270
|
+
inlineData.from = inline.from;
|
|
271
|
+
}
|
|
272
|
+
if (inline.to !== undefined) {
|
|
273
|
+
inlineData.to = inline.to;
|
|
274
|
+
}
|
|
275
|
+
commentData.inline = inlineData;
|
|
276
|
+
}
|
|
277
|
+
const response = await client.api.post(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments`, commentData);
|
|
278
|
+
return jsonResponse(response.data);
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
logger.error("Error adding pending comment to pull request", {
|
|
282
|
+
error,
|
|
283
|
+
workspace,
|
|
284
|
+
repo_slug,
|
|
285
|
+
pull_request_id,
|
|
286
|
+
});
|
|
287
|
+
throw new McpError(ErrorCode.InternalError, `Failed to add pending pull request comment: ${error instanceof Error ? error.message : String(error)}`);
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
publishPendingComments: async (args) => {
|
|
291
|
+
const workspace = args.workspace;
|
|
292
|
+
const repo_slug = args.repo_slug;
|
|
293
|
+
const pull_request_id = args.pull_request_id;
|
|
294
|
+
try {
|
|
295
|
+
logger.info("Publishing pending comments for Bitbucket pull request", {
|
|
296
|
+
workspace,
|
|
297
|
+
repo_slug,
|
|
298
|
+
pull_request_id,
|
|
299
|
+
});
|
|
300
|
+
// First, get all pending comments for the pull request
|
|
301
|
+
const commentsResult = await client.paginator.fetchValues(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments`, {
|
|
302
|
+
pagelen: BITBUCKET_MAX_PAGELEN,
|
|
303
|
+
all: true,
|
|
304
|
+
description: "publishPendingComments",
|
|
305
|
+
});
|
|
306
|
+
const comments = (commentsResult.values || []);
|
|
307
|
+
const pendingComments = comments.filter((comment) => comment.pending === true);
|
|
308
|
+
if (pendingComments.length === 0) {
|
|
309
|
+
return textResponse("No pending comments found to publish.");
|
|
310
|
+
}
|
|
311
|
+
// Publish each pending comment by updating it with pending=false
|
|
312
|
+
const publishResults = [];
|
|
313
|
+
for (const comment of pendingComments) {
|
|
314
|
+
try {
|
|
315
|
+
const updateResponse = await client.api.put(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments/${comment.id}`, {
|
|
316
|
+
content: comment.content,
|
|
317
|
+
pending: false,
|
|
318
|
+
...(comment.inline && { inline: comment.inline }),
|
|
319
|
+
});
|
|
320
|
+
publishResults.push({
|
|
321
|
+
commentId: comment.id,
|
|
322
|
+
status: "published",
|
|
323
|
+
data: updateResponse.data,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
publishResults.push({
|
|
328
|
+
commentId: comment.id,
|
|
329
|
+
status: "error",
|
|
330
|
+
error: error instanceof Error ? error.message : String(error),
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return jsonResponse({
|
|
335
|
+
message: `Published ${pendingComments.length} pending comments`,
|
|
336
|
+
results: publishResults,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
logger.error("Error publishing pending comments", {
|
|
341
|
+
error,
|
|
342
|
+
workspace,
|
|
343
|
+
repo_slug,
|
|
344
|
+
pull_request_id,
|
|
345
|
+
});
|
|
346
|
+
throw new McpError(ErrorCode.InternalError, `Failed to publish pending comments: ${error instanceof Error ? error.message : String(error)}`);
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
getPullRequestComment: async (args) => {
|
|
350
|
+
const workspace = args.workspace;
|
|
351
|
+
const repo_slug = args.repo_slug;
|
|
352
|
+
const pull_request_id = args.pull_request_id;
|
|
353
|
+
const comment_id = args.comment_id;
|
|
354
|
+
try {
|
|
355
|
+
logger.info("Getting pull request comment", {
|
|
356
|
+
workspace,
|
|
357
|
+
repo_slug,
|
|
358
|
+
pull_request_id,
|
|
359
|
+
comment_id,
|
|
360
|
+
});
|
|
361
|
+
const response = await client.api.get(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments/${comment_id}`);
|
|
362
|
+
return jsonResponse(response.data);
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
logger.error("Error getting pull request comment", {
|
|
366
|
+
error,
|
|
367
|
+
workspace,
|
|
368
|
+
repo_slug,
|
|
369
|
+
pull_request_id,
|
|
370
|
+
comment_id,
|
|
371
|
+
});
|
|
372
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get pull request comment: ${error instanceof Error ? error.message : String(error)}`);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
updatePullRequestComment: async (args) => {
|
|
376
|
+
const workspace = args.workspace;
|
|
377
|
+
const repo_slug = args.repo_slug;
|
|
378
|
+
const pull_request_id = args.pull_request_id;
|
|
379
|
+
const comment_id = args.comment_id;
|
|
380
|
+
const content = args.content;
|
|
381
|
+
try {
|
|
382
|
+
logger.info("Updating pull request comment", {
|
|
383
|
+
workspace,
|
|
384
|
+
repo_slug,
|
|
385
|
+
pull_request_id,
|
|
386
|
+
comment_id,
|
|
387
|
+
});
|
|
388
|
+
const response = await client.api.put(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments/${comment_id}`, {
|
|
389
|
+
content: { raw: content },
|
|
390
|
+
});
|
|
391
|
+
return jsonResponse(response.data);
|
|
392
|
+
}
|
|
393
|
+
catch (error) {
|
|
394
|
+
logger.error("Error updating pull request comment", {
|
|
395
|
+
error,
|
|
396
|
+
workspace,
|
|
397
|
+
repo_slug,
|
|
398
|
+
pull_request_id,
|
|
399
|
+
comment_id,
|
|
400
|
+
});
|
|
401
|
+
throw new McpError(ErrorCode.InternalError, `Failed to update pull request comment: ${error instanceof Error ? error.message : String(error)}`);
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
deletePullRequestComment: async (args) => {
|
|
405
|
+
const workspace = args.workspace;
|
|
406
|
+
const repo_slug = args.repo_slug;
|
|
407
|
+
const pull_request_id = args.pull_request_id;
|
|
408
|
+
const comment_id = args.comment_id;
|
|
409
|
+
try {
|
|
410
|
+
logger.info("Deleting pull request comment", {
|
|
411
|
+
workspace,
|
|
412
|
+
repo_slug,
|
|
413
|
+
pull_request_id,
|
|
414
|
+
comment_id,
|
|
415
|
+
});
|
|
416
|
+
await client.api.delete(`/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments/${comment_id}`);
|
|
417
|
+
return textResponse("Comment deleted successfully.");
|
|
418
|
+
}
|
|
419
|
+
catch (error) {
|
|
420
|
+
logger.error("Error deleting pull request comment", {
|
|
421
|
+
error,
|
|
422
|
+
workspace,
|
|
423
|
+
repo_slug,
|
|
424
|
+
pull_request_id,
|
|
425
|
+
comment_id,
|
|
426
|
+
});
|
|
427
|
+
throw new McpError(ErrorCode.InternalError, `Failed to delete pull request comment: ${error instanceof Error ? error.message : String(error)}`);
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
resolveComment: async (args) => {
|
|
431
|
+
const workspace = args.workspace;
|
|
432
|
+
const repo_slug = args.repo_slug;
|
|
433
|
+
const pull_request_id = args.pull_request_id;
|
|
434
|
+
const comment_id = args.comment_id;
|
|
435
|
+
return setCommentResolved(client, workspace, repo_slug, pull_request_id, comment_id, true);
|
|
436
|
+
},
|
|
437
|
+
reopenComment: async (args) => {
|
|
438
|
+
const workspace = args.workspace;
|
|
439
|
+
const repo_slug = args.repo_slug;
|
|
440
|
+
const pull_request_id = args.pull_request_id;
|
|
441
|
+
const comment_id = args.comment_id;
|
|
442
|
+
return setCommentResolved(client, workspace, repo_slug, pull_request_id, comment_id, false);
|
|
443
|
+
},
|
|
444
|
+
}),
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Helper function to resolve or reopen a comment thread
|
|
448
|
+
*/
|
|
449
|
+
async function setCommentResolved(client, workspace, repo_slug, pull_request_id, comment_id, resolved) {
|
|
450
|
+
try {
|
|
451
|
+
logger.info("Setting comment resolved state", {
|
|
452
|
+
workspace,
|
|
453
|
+
repo_slug,
|
|
454
|
+
pull_request_id,
|
|
455
|
+
comment_id,
|
|
456
|
+
resolved,
|
|
457
|
+
});
|
|
458
|
+
const commentUrl = (id) => `/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/comments/${id}`;
|
|
459
|
+
const resolveUrl = (id) => `${commentUrl(id)}/resolve`;
|
|
460
|
+
// Bitbucket resolves comment *threads*, and the API expects the thread root comment ID.
|
|
461
|
+
// If the provided comment_id is a reply, walk up the parent chain to find the root.
|
|
462
|
+
let targetCommentId = comment_id;
|
|
463
|
+
try {
|
|
464
|
+
const visited = new Set();
|
|
465
|
+
for (let depth = 0; depth < 25; depth++) {
|
|
466
|
+
if (visited.has(targetCommentId))
|
|
467
|
+
break;
|
|
468
|
+
visited.add(targetCommentId);
|
|
469
|
+
const commentResponse = await client.api.get(commentUrl(targetCommentId));
|
|
470
|
+
const parentId = commentResponse.data?.parent?.id;
|
|
471
|
+
if (parentId === undefined || parentId === null)
|
|
472
|
+
break;
|
|
473
|
+
targetCommentId = String(parentId);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
catch (lookupError) {
|
|
477
|
+
// If we fail to look up the comment hierarchy, still attempt to resolve the provided ID.
|
|
478
|
+
logger.warn("Failed to resolve comment thread root; falling back to comment_id", {
|
|
479
|
+
error: lookupError,
|
|
480
|
+
workspace,
|
|
481
|
+
repo_slug,
|
|
482
|
+
pull_request_id,
|
|
483
|
+
comment_id,
|
|
484
|
+
});
|
|
485
|
+
targetCommentId = comment_id;
|
|
486
|
+
}
|
|
487
|
+
const response = resolved
|
|
488
|
+
? await client.api.post(resolveUrl(targetCommentId))
|
|
489
|
+
: await client.api.delete(resolveUrl(targetCommentId));
|
|
490
|
+
const responseText = response.data === undefined || response.data === null || response.data === ""
|
|
491
|
+
? resolved
|
|
492
|
+
? `Comment thread resolved (comment_id: ${targetCommentId}).`
|
|
493
|
+
: `Comment thread reopened (comment_id: ${targetCommentId}).`
|
|
494
|
+
: JSON.stringify(response.data, null, 2);
|
|
495
|
+
return textResponse(responseText);
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
logger.error("Error setting comment resolved state", {
|
|
499
|
+
error,
|
|
500
|
+
workspace,
|
|
501
|
+
repo_slug,
|
|
502
|
+
pull_request_id,
|
|
503
|
+
comment_id,
|
|
504
|
+
resolved,
|
|
505
|
+
});
|
|
506
|
+
throw new McpError(ErrorCode.InternalError, `Failed to update comment resolved state: ${error instanceof Error ? error.message : String(error)}`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
//# sourceMappingURL=pr-comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-comments.js","sourceRoot":"","sources":["../../src/handlers/pr-comments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,4CAA4C;AAC5C,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,6DAA6D;IAC1E,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,oCAAoC;SAClD;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,4EAA4E;SAC1F;QACD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