mcp-bitbucket-server 1.0.0 → 1.0.9
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/services/bitbucket.d.ts +6 -1
- package/dist/services/bitbucket.d.ts.map +1 -1
- package/dist/services/bitbucket.js +8 -6
- package/dist/services/bitbucket.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +10 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/projects/list_projects.d.ts +1 -1
- package/dist/tools/projects/list_projects.d.ts.map +1 -1
- package/dist/tools/projects/list_projects.js +13 -41
- package/dist/tools/projects/list_projects.js.map +1 -1
- package/dist/tools/pull-requests/add_pr_comment.d.ts.map +1 -1
- package/dist/tools/pull-requests/add_pr_comment.js +17 -28
- package/dist/tools/pull-requests/add_pr_comment.js.map +1 -1
- package/dist/tools/pull-requests/add_pr_comment_reaction.d.ts +3 -0
- package/dist/tools/pull-requests/add_pr_comment_reaction.d.ts.map +1 -0
- package/dist/tools/pull-requests/add_pr_comment_reaction.js +35 -0
- package/dist/tools/pull-requests/add_pr_comment_reaction.js.map +1 -0
- package/dist/tools/pull-requests/add_pr_file_comment.d.ts +3 -0
- package/dist/tools/pull-requests/add_pr_file_comment.d.ts.map +1 -0
- package/dist/tools/pull-requests/add_pr_file_comment.js +33 -0
- package/dist/tools/pull-requests/add_pr_file_comment.js.map +1 -0
- package/dist/tools/pull-requests/add_pr_line_comment.d.ts +3 -0
- package/dist/tools/pull-requests/add_pr_line_comment.d.ts.map +1 -0
- package/dist/tools/pull-requests/add_pr_line_comment.js +41 -0
- package/dist/tools/pull-requests/add_pr_line_comment.js.map +1 -0
- package/dist/tools/pull-requests/create_pull_request.d.ts +3 -0
- package/dist/tools/pull-requests/create_pull_request.d.ts.map +1 -0
- package/dist/tools/pull-requests/create_pull_request.js +50 -0
- package/dist/tools/pull-requests/create_pull_request.js.map +1 -0
- package/dist/tools/pull-requests/delete_pr_comment.d.ts +3 -0
- package/dist/tools/pull-requests/delete_pr_comment.d.ts.map +1 -0
- package/dist/tools/pull-requests/delete_pr_comment.js +33 -0
- package/dist/tools/pull-requests/delete_pr_comment.js.map +1 -0
- package/dist/tools/pull-requests/get_inbox_pull_requests.d.ts +1 -1
- package/dist/tools/pull-requests/get_inbox_pull_requests.d.ts.map +1 -1
- package/dist/tools/pull-requests/get_inbox_pull_requests.js +18 -38
- package/dist/tools/pull-requests/get_inbox_pull_requests.js.map +1 -1
- package/dist/tools/pull-requests/get_pr_activities.d.ts +1 -1
- package/dist/tools/pull-requests/get_pr_activities.d.ts.map +1 -1
- package/dist/tools/pull-requests/get_pr_activities.js +61 -85
- package/dist/tools/pull-requests/get_pr_activities.js.map +1 -1
- package/dist/tools/pull-requests/get_pr_changes.d.ts +1 -1
- package/dist/tools/pull-requests/get_pr_changes.d.ts.map +1 -1
- package/dist/tools/pull-requests/get_pr_changes.js +18 -23
- package/dist/tools/pull-requests/get_pr_changes.js.map +1 -1
- package/dist/tools/pull-requests/get_pr_details.d.ts +3 -0
- package/dist/tools/pull-requests/get_pr_details.d.ts.map +1 -0
- package/dist/tools/pull-requests/get_pr_details.js +29 -0
- package/dist/tools/pull-requests/get_pr_details.js.map +1 -0
- package/dist/tools/pull-requests/get_pr_diff.d.ts +3 -0
- package/dist/tools/pull-requests/get_pr_diff.d.ts.map +1 -0
- package/dist/tools/pull-requests/get_pr_diff.js +44 -0
- package/dist/tools/pull-requests/get_pr_diff.js.map +1 -0
- package/dist/tools/pull-requests/get_pr_file_diff.d.ts +1 -1
- package/dist/tools/pull-requests/get_pr_file_diff.d.ts.map +1 -1
- package/dist/tools/pull-requests/get_pr_file_diff.js +19 -23
- package/dist/tools/pull-requests/get_pr_file_diff.js.map +1 -1
- package/dist/tools/pull-requests/index.d.ts +11 -2
- package/dist/tools/pull-requests/index.d.ts.map +1 -1
- package/dist/tools/pull-requests/index.js +11 -2
- package/dist/tools/pull-requests/index.js.map +1 -1
- package/dist/tools/pull-requests/remove_pr_comment_reaction.d.ts +3 -0
- package/dist/tools/pull-requests/remove_pr_comment_reaction.d.ts.map +1 -0
- package/dist/tools/pull-requests/remove_pr_comment_reaction.js +35 -0
- package/dist/tools/pull-requests/remove_pr_comment_reaction.js.map +1 -0
- package/dist/tools/pull-requests/update_review_status.d.ts +3 -0
- package/dist/tools/pull-requests/update_review_status.d.ts.map +1 -0
- package/dist/tools/pull-requests/update_review_status.js +33 -0
- package/dist/tools/pull-requests/update_review_status.js.map +1 -0
- package/dist/tools/repositories/list_repositories.d.ts.map +1 -1
- package/dist/tools/repositories/list_repositories.js +12 -28
- package/dist/tools/repositories/list_repositories.js.map +1 -1
- package/dist/tools/tools.types.d.ts +121 -0
- package/dist/tools/tools.types.d.ts.map +1 -0
- package/dist/tools/tools.types.js +7 -0
- package/dist/tools/tools.types.js.map +1 -0
- package/dist/tools/users/get_all_users.d.ts.map +1 -1
- package/dist/tools/users/get_all_users.js +7 -8
- package/dist/tools/users/get_all_users.js.map +1 -1
- package/dist/tools/users/get_user_profile.d.ts.map +1 -1
- package/dist/tools/users/get_user_profile.js +14 -28
- package/dist/tools/users/get_user_profile.js.map +1 -1
- package/package.json +21 -48
- package/BitbucketServerSwagger.json +0 -67522
- package/CLAUDE.md +0 -492
- package/LICENSE +0 -21
- package/biome.json +0 -35
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AASA,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// ============ Library Exports ============
|
|
3
|
+
// Re-export the Bitbucket client library (use bitbucket-data-center-client directly for library usage)
|
|
4
|
+
// ============ MCP Server Setup ============
|
|
2
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
6
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
7
|
import { registerTools } from './tools/index.js';
|
|
8
|
+
export * from 'bitbucket-data-center-client';
|
|
5
9
|
async function startMcpServer() {
|
|
6
10
|
const server = new McpServer({
|
|
7
11
|
name: 'mcp-bitbucket-server',
|
|
@@ -16,7 +20,8 @@ async function main() {
|
|
|
16
20
|
await startMcpServer();
|
|
17
21
|
}
|
|
18
22
|
main().catch((error) => {
|
|
19
|
-
|
|
23
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
24
|
+
console.error('Error:', message);
|
|
20
25
|
process.exit(1);
|
|
21
26
|
});
|
|
22
27
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,KAAK,UAAU,cAAc;IAC3B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAChD,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,cAAc,EAAE,CAAC;AACzB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,4CAA4C;AAC5C,uGAAuG;AACvG,6CAA6C;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,cAAc,8BAA8B,CAAC;AAE7C,KAAK,UAAU,cAAc;IAC3B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,aAAa,CAAC,MAAM,CAAC,CAAC;IAEtB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAChD,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,cAAc,EAAE,CAAC;AACzB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;IACzE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { BitbucketClient } from 'bitbucket-data-center-client';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton BitbucketClient instance for MCP tools.
|
|
4
|
+
* Created from environment configuration.
|
|
5
|
+
*/
|
|
6
|
+
export declare const bitbucketService: BitbucketClient;
|
|
2
7
|
//# sourceMappingURL=bitbucket.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket.d.ts","sourceRoot":"","sources":["../../src/services/bitbucket.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bitbucket.d.ts","sourceRoot":"","sources":["../../src/services/bitbucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,iBAG3B,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BitbucketClient } from 'bitbucket-data-center-client';
|
|
2
2
|
import { bitbucketConfig } from '../config.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Singleton BitbucketClient instance for MCP tools.
|
|
5
|
+
* Created from environment configuration.
|
|
6
|
+
*/
|
|
7
|
+
export const bitbucketService = new BitbucketClient({
|
|
8
|
+
baseUrl: bitbucketConfig.baseUrl,
|
|
9
|
+
token: bitbucketConfig.token,
|
|
8
10
|
});
|
|
9
11
|
//# sourceMappingURL=bitbucket.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket.js","sourceRoot":"","sources":["../../src/services/bitbucket.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"bitbucket.js","sourceRoot":"","sources":["../../src/services/bitbucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,eAAe,CAAC;IAClD,OAAO,EAAE,eAAe,CAAC,OAAO;IAChC,KAAK,EAAE,eAAe,CAAC,KAAK;CAC7B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,QA0B9C"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { addPrCommentTool, getPrChangesTool, getPrFileDiffTool, getPrActivitiesTool, getInboxPullRequestsTool } from './pull-requests/index.js';
|
|
2
1
|
import { listProjectsTool } from './projects/index.js';
|
|
2
|
+
import { addPrCommentReactionTool, addPrCommentTool, addPrFileCommentTool, addPrLineCommentTool, createPullRequestTool, deletePrCommentTool, getInboxPullRequestsTool, getPrActivitiesTool, getPrChangesTool, getPrFileDiffTool, getPullRequestDetailsTool, getPullRequestDiffTool, removePrCommentReactionTool, updateReviewStatusTool, } from './pull-requests/index.js';
|
|
3
3
|
import { listRepositoriesTool } from './repositories/index.js';
|
|
4
4
|
import { getAllUsersTool, getUserProfileTool } from './users/index.js';
|
|
5
5
|
export function registerTools(server) {
|
|
@@ -11,10 +11,19 @@ export function registerTools(server) {
|
|
|
11
11
|
// Repository tools
|
|
12
12
|
listRepositoriesTool(server);
|
|
13
13
|
// Pull request tools
|
|
14
|
+
createPullRequestTool(server);
|
|
14
15
|
getInboxPullRequestsTool(server);
|
|
16
|
+
getPullRequestDetailsTool(server);
|
|
15
17
|
addPrCommentTool(server);
|
|
18
|
+
addPrCommentReactionTool(server);
|
|
19
|
+
addPrFileCommentTool(server);
|
|
20
|
+
addPrLineCommentTool(server);
|
|
21
|
+
deletePrCommentTool(server);
|
|
16
22
|
getPrChangesTool(server);
|
|
23
|
+
getPullRequestDiffTool(server);
|
|
17
24
|
getPrFileDiffTool(server);
|
|
18
25
|
getPrActivitiesTool(server);
|
|
26
|
+
removePrCommentReactionTool(server);
|
|
27
|
+
updateReviewStatusTool(server);
|
|
19
28
|
}
|
|
20
29
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGvE,MAAM,UAAU,aAAa,CAAC,MAAiB;IAC7C,aAAa;IACb,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,gBAAgB;IAChB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEzB,mBAAmB;IACnB,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAE7B,qBAAqB;IACrB,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpC,sBAAsB,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_projects.d.ts","sourceRoot":"","sources":["../../../src/tools/projects/list_projects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list_projects.d.ts","sourceRoot":"","sources":["../../../src/tools/projects/list_projects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,SAsBjD,CAAC"}
|
|
@@ -1,51 +1,23 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
3
|
const schema = z.object({
|
|
4
|
-
name: z
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
permission: z
|
|
9
|
-
.string()
|
|
10
|
-
.optional()
|
|
11
|
-
.describe("Filter by permission (e.g., PROJECT_READ, PROJECT_WRITE, PROJECT_ADMIN)"),
|
|
12
|
-
start: z
|
|
13
|
-
.number()
|
|
14
|
-
.optional()
|
|
15
|
-
.describe("Starting index for pagination (default: 0)"),
|
|
16
|
-
limit: z
|
|
17
|
-
.number()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("Maximum number of projects to return (default: 25)"),
|
|
4
|
+
name: z.string().optional().describe('Filter projects by name (partial match)'),
|
|
5
|
+
permission: z.string().optional().describe('Filter by permission (e.g., PROJECT_READ, PROJECT_WRITE, PROJECT_ADMIN)'),
|
|
6
|
+
start: z.number().optional().describe('Starting index for pagination (default: 0)'),
|
|
7
|
+
limit: z.number().optional().describe('Maximum number of projects to return (default: 25)'),
|
|
20
8
|
});
|
|
21
9
|
export const listProjectsTool = (server) => {
|
|
22
|
-
server.registerTool(
|
|
23
|
-
title:
|
|
24
|
-
description:
|
|
10
|
+
server.registerTool('list_projects', {
|
|
11
|
+
title: 'List Projects',
|
|
12
|
+
description: 'Retrieve a page of projects. Only projects for which the authenticated user has PROJECT_VIEW permission will be returned. Can filter by name or permission level.',
|
|
25
13
|
inputSchema: schema.shape,
|
|
26
|
-
}, async (
|
|
27
|
-
const { name, permission, start, limit }
|
|
28
|
-
const queryParams = {};
|
|
29
|
-
if (name !== undefined) {
|
|
30
|
-
queryParams.name = name;
|
|
31
|
-
}
|
|
32
|
-
if (permission !== undefined) {
|
|
33
|
-
queryParams.permission = permission;
|
|
34
|
-
}
|
|
35
|
-
if (start !== undefined) {
|
|
36
|
-
queryParams.start = start.toString();
|
|
37
|
-
}
|
|
38
|
-
if (limit !== undefined) {
|
|
39
|
-
queryParams.limit = limit.toString();
|
|
40
|
-
}
|
|
41
|
-
const response = await bitbucketClient.get("/projects", {
|
|
42
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
43
|
-
});
|
|
14
|
+
}, async ({ name, permission, start, limit }) => {
|
|
15
|
+
const result = await bitbucketService.listProjects({ name, permission, start, limit });
|
|
44
16
|
return {
|
|
45
17
|
content: [
|
|
46
18
|
{
|
|
47
|
-
type:
|
|
48
|
-
text: JSON.stringify(
|
|
19
|
+
type: 'text',
|
|
20
|
+
text: JSON.stringify(result, null, 2),
|
|
49
21
|
},
|
|
50
22
|
],
|
|
51
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_projects.js","sourceRoot":"","sources":["../../../src/tools/projects/list_projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"list_projects.js","sourceRoot":"","sources":["../../../src/tools/projects/list_projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC/E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yEAAyE,CAAC;IACrH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACnF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;CAC5F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAiB,EAAE,EAAE;IACpD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,mKAAmK;QACrK,WAAW,EAAE,MAAM,CAAC,KAAK;KAC1B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAEvF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add_pr_comment.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_comment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add_pr_comment.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_comment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,SAgCjD,CAAC"}
|
|
@@ -1,44 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
3
|
const schema = z.object({
|
|
4
4
|
projectKey: z.string().describe('The Bitbucket project key'),
|
|
5
5
|
repositorySlug: z.string().describe('The repository slug'),
|
|
6
6
|
pullRequestId: z.number().describe('The pull request ID'),
|
|
7
7
|
text: z.string().describe('The comment text'),
|
|
8
|
-
parentId: z.number().optional().describe('Parent comment ID
|
|
9
|
-
path: z.string().optional().describe('File path for file-specific comments'),
|
|
10
|
-
line: z.number().optional().describe('Line number for inline comments'),
|
|
11
|
-
lineType: z.enum(['ADDED', 'REMOVED', 'CONTEXT']).optional().describe('Type of line (default: CONTEXT)'),
|
|
12
|
-
fileType: z.enum(['FROM', 'TO']).optional().describe('Side of diff (default: TO)'),
|
|
8
|
+
parentId: z.number().optional().describe('Parent comment ID to reply to an existing comment'),
|
|
13
9
|
});
|
|
14
10
|
export const addPrCommentTool = (server) => {
|
|
15
|
-
server.registerTool('
|
|
16
|
-
title: 'Add Pull Request Comment',
|
|
17
|
-
description: 'Add a comment to a pull request.
|
|
11
|
+
server.registerTool('add_pr_comment', {
|
|
12
|
+
title: 'Add General Pull Request Comment',
|
|
13
|
+
description: 'Add a general comment to a pull request (not attached to any specific file or line). Use parentId to reply to an existing comment. For file or line-specific comments, use add_pr_file_comment or add_pr_line_comment instead.',
|
|
18
14
|
inputSchema: schema.shape,
|
|
19
|
-
}, async (
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
line,
|
|
31
|
-
lineType: lineType || 'CONTEXT',
|
|
32
|
-
fileType: fileType || 'TO',
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const response = await bitbucketClient.post(`/projects/${projectKey}/repos/${repositorySlug}/pull-requests/${pullRequestId}/comments`, body);
|
|
15
|
+
}, async ({ projectKey, repositorySlug, pullRequestId, text, parentId }) => {
|
|
16
|
+
const result = await bitbucketService.addPullRequestComment({
|
|
17
|
+
projectKey,
|
|
18
|
+
repositorySlug,
|
|
19
|
+
pullRequestId,
|
|
20
|
+
text,
|
|
21
|
+
parentId,
|
|
22
|
+
});
|
|
23
|
+
const message = parentId
|
|
24
|
+
? `Reply added successfully. Comment ID: ${result.id}`
|
|
25
|
+
: `Comment added successfully. Comment ID: ${result.id}`;
|
|
37
26
|
return {
|
|
38
27
|
content: [
|
|
39
28
|
{
|
|
40
29
|
type: 'text',
|
|
41
|
-
text:
|
|
30
|
+
text: message,
|
|
42
31
|
},
|
|
43
32
|
],
|
|
44
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add_pr_comment.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_comment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add_pr_comment.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,E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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add_pr_comment_reaction.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_comment_reaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,eAAO,MAAM,wBAAwB,GAAI,QAAQ,SAAS,SA4BzD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
projectKey: z.string().describe('The Bitbucket project key'),
|
|
5
|
+
repositorySlug: z.string().describe('The repository slug'),
|
|
6
|
+
pullRequestId: z.number().describe('The pull request ID'),
|
|
7
|
+
commentId: z.number().describe('The comment ID'),
|
|
8
|
+
emoticon: z
|
|
9
|
+
.enum(['thumbsup', 'thumbsdown', 'heart', 'thinking_face', 'laughing'])
|
|
10
|
+
.describe('The emoticon to add (thumbsup, thumbsdown, heart, thinking_face, laughing)'),
|
|
11
|
+
});
|
|
12
|
+
export const addPrCommentReactionTool = (server) => {
|
|
13
|
+
server.registerTool('add_pr_comment_reaction', {
|
|
14
|
+
title: 'Add Emoticon Reaction to PR Comment',
|
|
15
|
+
description: 'Add an emoticon reaction to a pull request comment. Supported emoticons: thumbsup, thumbsdown, heart, thinking_face, laughing. The operation is idempotent - adding the same reaction twice will succeed.',
|
|
16
|
+
inputSchema: schema.shape,
|
|
17
|
+
}, async ({ projectKey, repositorySlug, pullRequestId, commentId, emoticon }) => {
|
|
18
|
+
const result = await bitbucketService.addPullRequestCommentReaction({
|
|
19
|
+
projectKey,
|
|
20
|
+
repositorySlug,
|
|
21
|
+
pullRequestId,
|
|
22
|
+
commentId,
|
|
23
|
+
emoticon,
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: `Reaction "${result.emoticon.shortcut}" added successfully to comment ${commentId} by ${result.user.displayName}.`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=add_pr_comment_reaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add_pr_comment_reaction.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_comment_reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC5D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC1D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACzD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAChD,QAAQ,EAAE,CAAC;SACR,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;SACtE,QAAQ,CAAC,4EAA4E,CAAC;CAC1F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAAiB,EAAE,EAAE;IAC5D,MAAM,CAAC,YAAY,CACjB,yBAAyB,EACzB;QACE,KAAK,EAAE,qCAAqC;QAC5C,WAAW,EACT,2MAA2M;QAC7M,WAAW,EAAE,MAAM,CAAC,KAAK;KAC1B,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC3E,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,6BAA6B,CAAC;YAClE,UAAU;YACV,cAAc;YACd,aAAa;YACb,SAAS;YACT,QAAQ;SACT,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,aAAa,MAAM,CAAC,QAAQ,CAAC,QAAQ,mCAAmC,SAAS,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG;iBACzH;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add_pr_file_comment.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_file_comment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,SA4BrD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
projectKey: z.string().describe('The Bitbucket project key'),
|
|
5
|
+
repositorySlug: z.string().describe('The repository slug'),
|
|
6
|
+
pullRequestId: z.number().describe('The pull request ID'),
|
|
7
|
+
text: z.string().describe('The comment text'),
|
|
8
|
+
path: z.string().describe('File path to attach the comment to (e.g., "src/main.ts")'),
|
|
9
|
+
});
|
|
10
|
+
export const addPrFileCommentTool = (server) => {
|
|
11
|
+
server.registerTool('add_pr_file_comment', {
|
|
12
|
+
title: 'Add File-Level Pull Request Comment',
|
|
13
|
+
description: 'Add a comment attached to a specific file in a pull request (not to a specific line). The comment will appear at the file level in the PR diff view. To reply to an existing comment (including file/line comments), use add_pr_comment instead.',
|
|
14
|
+
inputSchema: schema.shape,
|
|
15
|
+
}, async ({ projectKey, repositorySlug, pullRequestId, text, path }) => {
|
|
16
|
+
const result = await bitbucketService.addPullRequestComment({
|
|
17
|
+
projectKey,
|
|
18
|
+
repositorySlug,
|
|
19
|
+
pullRequestId,
|
|
20
|
+
text,
|
|
21
|
+
path,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: `File comment added successfully. Comment ID: ${result.id}`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=add_pr_file_comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add_pr_file_comment.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_file_comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC5D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC1D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACzD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CACtF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAiB,EAAE,EAAE;IACxD,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,qCAAqC;QAC5C,WAAW,EACT,kPAAkP;QACpP,WAAW,EAAE,MAAM,CAAC,KAAK;KAC1B,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QAClE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,qBAAqB,CAAC;YAC1D,UAAU;YACV,cAAc;YACd,aAAa;YACb,IAAI;YACJ,IAAI;SACL,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,gDAAgD,MAAM,CAAC,EAAE,EAAE;iBAClE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add_pr_line_comment.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_line_comment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAezE,eAAO,MAAM,oBAAoB,GAAI,QAAQ,SAAS,SA+BrD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
projectKey: z.string().describe('The Bitbucket project key'),
|
|
5
|
+
repositorySlug: z.string().describe('The repository slug'),
|
|
6
|
+
pullRequestId: z.number().describe('The pull request ID'),
|
|
7
|
+
text: z.string().describe('The comment text'),
|
|
8
|
+
path: z.string().describe('File path (e.g., "src/main.ts")'),
|
|
9
|
+
line: z.number().describe('Line number to comment on (use destination line number from diff)'),
|
|
10
|
+
lineType: z
|
|
11
|
+
.enum(['ADDED', 'REMOVED', 'CONTEXT'])
|
|
12
|
+
.describe('Type of line: ADDED (green +), REMOVED (red -), or CONTEXT (unchanged)'),
|
|
13
|
+
fileType: z.enum(['FROM', 'TO']).describe('Side of diff: FROM (source/old) or TO (destination/new)'),
|
|
14
|
+
});
|
|
15
|
+
export const addPrLineCommentTool = (server) => {
|
|
16
|
+
server.registerTool('add_pr_line_comment', {
|
|
17
|
+
title: 'Add Line-Level Pull Request Comment',
|
|
18
|
+
description: 'Add an inline comment to a specific line in a pull request. Use the line numbers from get_pull_request_file_diff (destination line for TO side, source line for FROM side). Match the lineType to the segment type from the diff (ADDED/REMOVED/CONTEXT). To reply to an existing comment (including file/line comments), use add_pr_comment instead.',
|
|
19
|
+
inputSchema: schema.shape,
|
|
20
|
+
}, async ({ projectKey, repositorySlug, pullRequestId, text, path, line, lineType, fileType }) => {
|
|
21
|
+
const result = await bitbucketService.addPullRequestComment({
|
|
22
|
+
projectKey,
|
|
23
|
+
repositorySlug,
|
|
24
|
+
pullRequestId,
|
|
25
|
+
text,
|
|
26
|
+
path,
|
|
27
|
+
line,
|
|
28
|
+
lineType,
|
|
29
|
+
fileType,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: `Line comment added successfully. Comment ID: ${result.id}`,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=add_pr_line_comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add_pr_line_comment.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/add_pr_line_comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC5D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC1D,aAAa,EAAE,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|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_pull_request.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/create_pull_request.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,eAAO,MAAM,qBAAqB,GAAI,QAAQ,SAAS,SA6CtD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
projectKey: z.string().describe('The Bitbucket project key'),
|
|
5
|
+
repositorySlug: z.string().describe('The repository slug'),
|
|
6
|
+
fromBranch: z.string().describe('Source branch name (e.g., "feature-x")'),
|
|
7
|
+
toBranch: z.string().describe('Target branch name (e.g., "main")'),
|
|
8
|
+
title: z.string().describe('PR title'),
|
|
9
|
+
description: z.string().optional().describe('PR description in markdown format'),
|
|
10
|
+
reviewers: z.array(z.string()).optional().describe('Array of reviewer usernames to add'),
|
|
11
|
+
});
|
|
12
|
+
export const createPullRequestTool = (server) => {
|
|
13
|
+
server.registerTool('create_pull_request', {
|
|
14
|
+
title: 'Create Pull Request',
|
|
15
|
+
description: 'Create a new pull request from a source branch to a target branch. Accepts simple branch names (e.g., "feature-x", "main") - they are automatically converted to full refs. If no reviewers are provided, default/required reviewers are automatically fetched and added. Returns the created PR details including ID, title, state, and web URL.',
|
|
16
|
+
inputSchema: schema.shape,
|
|
17
|
+
}, async ({ projectKey, repositorySlug, fromBranch, toBranch, title, description, reviewers }) => {
|
|
18
|
+
let finalReviewers = reviewers;
|
|
19
|
+
// Auto-fetch default reviewers if none provided
|
|
20
|
+
if (!reviewers || reviewers.length === 0) {
|
|
21
|
+
const repo = await bitbucketService.getRepository({ projectKey, repositorySlug });
|
|
22
|
+
const defaultReviewers = await bitbucketService.getRequiredReviewers({
|
|
23
|
+
projectKey,
|
|
24
|
+
repositorySlug,
|
|
25
|
+
repositoryId: repo.id,
|
|
26
|
+
sourceBranch: fromBranch,
|
|
27
|
+
targetBranch: toBranch,
|
|
28
|
+
});
|
|
29
|
+
finalReviewers = defaultReviewers.map((r) => r.name);
|
|
30
|
+
}
|
|
31
|
+
const result = await bitbucketService.createPullRequest({
|
|
32
|
+
projectKey,
|
|
33
|
+
repositorySlug,
|
|
34
|
+
title,
|
|
35
|
+
description,
|
|
36
|
+
fromBranch,
|
|
37
|
+
toBranch,
|
|
38
|
+
reviewers: finalReviewers,
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: JSON.stringify(result, null, 2),
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=create_pull_request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_pull_request.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/create_pull_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC5D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC1D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IACzE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM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OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtC;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete_pr_comment.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/delete_pr_comment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,SA4BpD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { bitbucketService } from '../../services/bitbucket.js';
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
projectKey: z.string().describe('The Bitbucket project key'),
|
|
5
|
+
repositorySlug: z.string().describe('The repository slug'),
|
|
6
|
+
pullRequestId: z.number().describe('The pull request ID'),
|
|
7
|
+
commentId: z.number().describe('The ID of the comment to delete'),
|
|
8
|
+
version: z.number().describe('The expected version of the comment (get from comment object)'),
|
|
9
|
+
});
|
|
10
|
+
export const deletePrCommentTool = (server) => {
|
|
11
|
+
server.registerTool('delete_pr_comment', {
|
|
12
|
+
title: 'Delete Pull Request Comment',
|
|
13
|
+
description: 'Delete a pull request comment. You can delete your own comments. Only REPO_ADMIN users can delete comments created by others. Comments with replies cannot be deleted. You must provide the comment version to prevent concurrent modification conflicts - get the version from the comment object.',
|
|
14
|
+
inputSchema: schema.shape,
|
|
15
|
+
}, async ({ projectKey, repositorySlug, pullRequestId, commentId, version }) => {
|
|
16
|
+
await bitbucketService.deletePullRequestComment({
|
|
17
|
+
projectKey,
|
|
18
|
+
repositorySlug,
|
|
19
|
+
pullRequestId,
|
|
20
|
+
commentId,
|
|
21
|
+
version,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: `Comment ${commentId} deleted successfully.`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=delete_pr_comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete_pr_comment.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/delete_pr_comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC5D,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAC1D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IACzD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACjE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;CAC9F,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAiB,EAAE,EAAE;IACvD,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;QACE,KAAK,EAAE,6BAA6B;QACpC,WAAW,EACT,qSAAqS;QACvS,WAAW,EAAE,MAAM,CAAC,KAAK;KAC1B,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1E,MAAM,gBAAgB,CAAC,wBAAwB,CAAC;YAC9C,UAAU;YACV,cAAc;YACd,aAAa;YACb,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,WAAW,SAAS,wBAAwB;iBACnD;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { McpServer } from
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
export declare const getInboxPullRequestsTool: (server: McpServer) => void;
|
|
3
3
|
//# sourceMappingURL=get_inbox_pull_requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_inbox_pull_requests.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/get_inbox_pull_requests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get_inbox_pull_requests.d.ts","sourceRoot":"","sources":["../../../src/tools/pull-requests/get_inbox_pull_requests.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,eAAO,MAAM,wBAAwB,GAAI,QAAQ,SAAS,SAyCzD,CAAC"}
|