@zhanglc77/bitbucket-mcp-server 1.0.1
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/CHANGELOG.md +280 -0
- package/LICENSE +21 -0
- package/README.md +1090 -0
- package/build/handlers/branch-handlers.d.ts +55 -0
- package/build/handlers/branch-handlers.d.ts.map +1 -0
- package/build/handlers/branch-handlers.js +522 -0
- package/build/handlers/branch-handlers.js.map +1 -0
- package/build/handlers/file-handlers.d.ts +33 -0
- package/build/handlers/file-handlers.d.ts.map +1 -0
- package/build/handlers/file-handlers.js +308 -0
- package/build/handlers/file-handlers.js.map +1 -0
- package/build/handlers/pull-request-handlers.d.ts +101 -0
- package/build/handlers/pull-request-handlers.d.ts.map +1 -0
- package/build/handlers/pull-request-handlers.js +955 -0
- package/build/handlers/pull-request-handlers.js.map +1 -0
- package/build/handlers/review-handlers.d.ts +67 -0
- package/build/handlers/review-handlers.d.ts.map +1 -0
- package/build/handlers/review-handlers.js +252 -0
- package/build/handlers/review-handlers.js.map +1 -0
- package/build/handlers/search-handlers.d.ts +20 -0
- package/build/handlers/search-handlers.d.ts.map +1 -0
- package/build/handlers/search-handlers.js +151 -0
- package/build/handlers/search-handlers.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +120 -0
- package/build/index.js.map +1 -0
- package/build/tools/definitions.d.ts +1191 -0
- package/build/tools/definitions.d.ts.map +1 -0
- package/build/tools/definitions.js +655 -0
- package/build/tools/definitions.js.map +1 -0
- package/build/types/bitbucket.d.ts +483 -0
- package/build/types/bitbucket.d.ts.map +1 -0
- package/build/types/bitbucket.js +2 -0
- package/build/types/bitbucket.js.map +1 -0
- package/build/types/guards.d.ts +140 -0
- package/build/types/guards.d.ts.map +1 -0
- package/build/types/guards.js +140 -0
- package/build/types/guards.js.map +1 -0
- package/build/utils/api-client.d.ts +22 -0
- package/build/utils/api-client.d.ts.map +1 -0
- package/build/utils/api-client.js +111 -0
- package/build/utils/api-client.js.map +1 -0
- package/build/utils/diff-parser.d.ts +42 -0
- package/build/utils/diff-parser.d.ts.map +1 -0
- package/build/utils/diff-parser.js +165 -0
- package/build/utils/diff-parser.js.map +1 -0
- package/build/utils/formatters.d.ts +8 -0
- package/build/utils/formatters.d.ts.map +1 -0
- package/build/utils/formatters.js +207 -0
- package/build/utils/formatters.js.map +1 -0
- package/build/utils/suggestion-formatter.d.ts +6 -0
- package/build/utils/suggestion-formatter.d.ts.map +1 -0
- package/build/utils/suggestion-formatter.js +17 -0
- package/build/utils/suggestion-formatter.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BitbucketApiClient } from '../utils/api-client.js';
|
|
2
|
+
export declare class BranchHandlers {
|
|
3
|
+
private apiClient;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
constructor(apiClient: BitbucketApiClient, baseUrl: string);
|
|
6
|
+
handleListBranches(args: any): Promise<{
|
|
7
|
+
content: {
|
|
8
|
+
type: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
isError: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
content: {
|
|
14
|
+
type: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}[];
|
|
17
|
+
}>;
|
|
18
|
+
handleDeleteBranch(args: any): Promise<{
|
|
19
|
+
content: {
|
|
20
|
+
type: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
isError: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
content: {
|
|
26
|
+
type: string;
|
|
27
|
+
text: string;
|
|
28
|
+
}[];
|
|
29
|
+
}>;
|
|
30
|
+
handleGetBranch(args: any): Promise<{
|
|
31
|
+
content: {
|
|
32
|
+
type: string;
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
isError: boolean;
|
|
36
|
+
} | {
|
|
37
|
+
content: {
|
|
38
|
+
type: string;
|
|
39
|
+
text: string;
|
|
40
|
+
}[];
|
|
41
|
+
}>;
|
|
42
|
+
handleListBranchCommits(args: any): Promise<{
|
|
43
|
+
content: {
|
|
44
|
+
type: string;
|
|
45
|
+
text: string;
|
|
46
|
+
}[];
|
|
47
|
+
isError: boolean;
|
|
48
|
+
} | {
|
|
49
|
+
content: {
|
|
50
|
+
type: string;
|
|
51
|
+
text: string;
|
|
52
|
+
}[];
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=branch-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/branch-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAgB5D,qBAAa,cAAc;IAEvB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;gBADP,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,MAAM;IAGnB,kBAAkB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;IA0F5B,kBAAkB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;IA+E5B,eAAe,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;IAmNzB,uBAAuB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;CAuLxC"}
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { isListBranchesArgs, isDeleteBranchArgs, isGetBranchArgs, isListBranchCommitsArgs } from '../types/guards.js';
|
|
3
|
+
import { formatServerCommit, formatCloudCommit } from '../utils/formatters.js';
|
|
4
|
+
export class BranchHandlers {
|
|
5
|
+
apiClient;
|
|
6
|
+
baseUrl;
|
|
7
|
+
constructor(apiClient, baseUrl) {
|
|
8
|
+
this.apiClient = apiClient;
|
|
9
|
+
this.baseUrl = baseUrl;
|
|
10
|
+
}
|
|
11
|
+
async handleListBranches(args) {
|
|
12
|
+
if (!isListBranchesArgs(args)) {
|
|
13
|
+
throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for list_branches');
|
|
14
|
+
}
|
|
15
|
+
const { workspace, repository, filter, limit = 25, start = 0 } = args;
|
|
16
|
+
try {
|
|
17
|
+
let apiPath;
|
|
18
|
+
let params = {};
|
|
19
|
+
if (this.apiClient.getIsServer()) {
|
|
20
|
+
// Bitbucket Server API - using latest version for better filtering support
|
|
21
|
+
apiPath = `/rest/api/latest/projects/${workspace}/repos/${repository}/branches`;
|
|
22
|
+
params = {
|
|
23
|
+
limit,
|
|
24
|
+
start,
|
|
25
|
+
details: true,
|
|
26
|
+
orderBy: 'MODIFICATION'
|
|
27
|
+
};
|
|
28
|
+
if (filter) {
|
|
29
|
+
params.filterText = filter;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// Bitbucket Cloud API
|
|
34
|
+
apiPath = `/repositories/${workspace}/${repository}/refs/branches`;
|
|
35
|
+
params = {
|
|
36
|
+
pagelen: limit,
|
|
37
|
+
page: Math.floor(start / limit) + 1,
|
|
38
|
+
};
|
|
39
|
+
if (filter) {
|
|
40
|
+
params.q = `name ~ "${filter}"`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const response = await this.apiClient.makeRequest('get', apiPath, undefined, { params });
|
|
44
|
+
// Format the response
|
|
45
|
+
let branches = [];
|
|
46
|
+
let totalCount = 0;
|
|
47
|
+
let nextPageStart = null;
|
|
48
|
+
if (this.apiClient.getIsServer()) {
|
|
49
|
+
// Bitbucket Server response
|
|
50
|
+
branches = (response.values || []).map((branch) => ({
|
|
51
|
+
name: branch.displayId,
|
|
52
|
+
id: branch.id,
|
|
53
|
+
latest_commit: branch.latestCommit,
|
|
54
|
+
is_default: branch.isDefault || false
|
|
55
|
+
}));
|
|
56
|
+
totalCount = response.size || 0;
|
|
57
|
+
if (!response.isLastPage && response.nextPageStart !== undefined) {
|
|
58
|
+
nextPageStart = response.nextPageStart;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Bitbucket Cloud response
|
|
63
|
+
branches = (response.values || []).map((branch) => ({
|
|
64
|
+
name: branch.name,
|
|
65
|
+
target: branch.target.hash,
|
|
66
|
+
is_default: branch.name === 'main' || branch.name === 'master'
|
|
67
|
+
}));
|
|
68
|
+
totalCount = response.size || 0;
|
|
69
|
+
if (response.next) {
|
|
70
|
+
nextPageStart = start + limit;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: JSON.stringify({
|
|
78
|
+
branches,
|
|
79
|
+
total_count: totalCount,
|
|
80
|
+
start,
|
|
81
|
+
limit,
|
|
82
|
+
has_more: nextPageStart !== null,
|
|
83
|
+
next_start: nextPageStart
|
|
84
|
+
}, null, 2),
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
return this.apiClient.handleApiError(error, `listing branches in ${workspace}/${repository}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async handleDeleteBranch(args) {
|
|
94
|
+
if (!isDeleteBranchArgs(args)) {
|
|
95
|
+
throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for delete_branch');
|
|
96
|
+
}
|
|
97
|
+
const { workspace, repository, branch_name, force } = args;
|
|
98
|
+
try {
|
|
99
|
+
let apiPath;
|
|
100
|
+
if (this.apiClient.getIsServer()) {
|
|
101
|
+
// First, we need to get the branch details to find the latest commit
|
|
102
|
+
const branchesPath = `/rest/api/latest/projects/${workspace}/repos/${repository}/branches`;
|
|
103
|
+
const branchesResponse = await this.apiClient.makeRequest('get', branchesPath, undefined, {
|
|
104
|
+
params: {
|
|
105
|
+
filterText: branch_name,
|
|
106
|
+
limit: 100
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
// Find the exact branch
|
|
110
|
+
const branch = branchesResponse.values?.find((b) => b.displayId === branch_name);
|
|
111
|
+
if (!branch) {
|
|
112
|
+
throw new Error(`Branch '${branch_name}' not found`);
|
|
113
|
+
}
|
|
114
|
+
// Now delete using branch-utils endpoint with correct format
|
|
115
|
+
apiPath = `/rest/branch-utils/latest/projects/${workspace}/repos/${repository}/branches`;
|
|
116
|
+
try {
|
|
117
|
+
await this.apiClient.makeRequest('delete', apiPath, {
|
|
118
|
+
name: branch_name,
|
|
119
|
+
endPoint: branch.latestCommit
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (deleteError) {
|
|
123
|
+
// If the error is about empty response but status is 204 (No Content), it's successful
|
|
124
|
+
if (deleteError.originalError?.response?.status === 204 ||
|
|
125
|
+
deleteError.message?.includes('No content to map')) {
|
|
126
|
+
// Branch was deleted successfully
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
throw deleteError;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// Bitbucket Cloud API
|
|
135
|
+
apiPath = `/repositories/${workspace}/${repository}/refs/branches/${branch_name}`;
|
|
136
|
+
try {
|
|
137
|
+
await this.apiClient.makeRequest('delete', apiPath);
|
|
138
|
+
}
|
|
139
|
+
catch (deleteError) {
|
|
140
|
+
// If the error is about empty response but status is 204 (No Content), it's successful
|
|
141
|
+
if (deleteError.originalError?.response?.status === 204 ||
|
|
142
|
+
deleteError.message?.includes('No content to map')) {
|
|
143
|
+
// Branch was deleted successfully
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
throw deleteError;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
content: [
|
|
152
|
+
{
|
|
153
|
+
type: 'text',
|
|
154
|
+
text: JSON.stringify({
|
|
155
|
+
message: `Branch '${branch_name}' deleted successfully`,
|
|
156
|
+
branch: branch_name,
|
|
157
|
+
repository: `${workspace}/${repository}`
|
|
158
|
+
}, null, 2),
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
return this.apiClient.handleApiError(error, `deleting branch '${branch_name}' in ${workspace}/${repository}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async handleGetBranch(args) {
|
|
168
|
+
if (!isGetBranchArgs(args)) {
|
|
169
|
+
throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for get_branch');
|
|
170
|
+
}
|
|
171
|
+
const { workspace, repository, branch_name, include_merged_prs = false } = args;
|
|
172
|
+
try {
|
|
173
|
+
// Step 1: Get branch details
|
|
174
|
+
let branchInfo;
|
|
175
|
+
let branchCommitInfo = {};
|
|
176
|
+
if (this.apiClient.getIsServer()) {
|
|
177
|
+
// Bitbucket Server - get branch details
|
|
178
|
+
const branchesPath = `/rest/api/latest/projects/${workspace}/repos/${repository}/branches`;
|
|
179
|
+
const branchesResponse = await this.apiClient.makeRequest('get', branchesPath, undefined, {
|
|
180
|
+
params: {
|
|
181
|
+
filterText: branch_name,
|
|
182
|
+
limit: 100,
|
|
183
|
+
details: true
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
// Find the exact branch
|
|
187
|
+
const branch = branchesResponse.values?.find((b) => b.displayId === branch_name);
|
|
188
|
+
if (!branch) {
|
|
189
|
+
throw new Error(`Branch '${branch_name}' not found`);
|
|
190
|
+
}
|
|
191
|
+
branchInfo = {
|
|
192
|
+
name: branch.displayId,
|
|
193
|
+
id: branch.id,
|
|
194
|
+
latest_commit: {
|
|
195
|
+
id: branch.latestCommit,
|
|
196
|
+
message: branch.metadata?.['com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata']?.message || null,
|
|
197
|
+
author: branch.metadata?.['com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata']?.author || null,
|
|
198
|
+
date: branch.metadata?.['com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata']?.authorTimestamp
|
|
199
|
+
? new Date(branch.metadata['com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata'].authorTimestamp).toISOString()
|
|
200
|
+
: null
|
|
201
|
+
},
|
|
202
|
+
is_default: branch.isDefault || false
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
// Bitbucket Cloud - get branch details
|
|
207
|
+
const branchPath = `/repositories/${workspace}/${repository}/refs/branches/${encodeURIComponent(branch_name)}`;
|
|
208
|
+
const branch = await this.apiClient.makeRequest('get', branchPath);
|
|
209
|
+
branchInfo = {
|
|
210
|
+
name: branch.name,
|
|
211
|
+
id: `refs/heads/${branch.name}`,
|
|
212
|
+
latest_commit: {
|
|
213
|
+
id: branch.target.hash,
|
|
214
|
+
message: branch.target.message,
|
|
215
|
+
author: branch.target.author.user?.display_name || branch.target.author.raw,
|
|
216
|
+
date: branch.target.date
|
|
217
|
+
},
|
|
218
|
+
is_default: false // Will check this with default branch info
|
|
219
|
+
};
|
|
220
|
+
// Check if this is the default branch
|
|
221
|
+
try {
|
|
222
|
+
const repoPath = `/repositories/${workspace}/${repository}`;
|
|
223
|
+
const repoInfo = await this.apiClient.makeRequest('get', repoPath);
|
|
224
|
+
branchInfo.is_default = branch.name === repoInfo.mainbranch?.name;
|
|
225
|
+
}
|
|
226
|
+
catch (e) {
|
|
227
|
+
// Ignore error, just assume not default
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// Step 2: Get open PRs from this branch
|
|
231
|
+
let openPRs = [];
|
|
232
|
+
if (this.apiClient.getIsServer()) {
|
|
233
|
+
// Bitbucket Server
|
|
234
|
+
const prPath = `/rest/api/1.0/projects/${workspace}/repos/${repository}/pull-requests`;
|
|
235
|
+
const prResponse = await this.apiClient.makeRequest('get', prPath, undefined, {
|
|
236
|
+
params: {
|
|
237
|
+
state: 'OPEN',
|
|
238
|
+
direction: 'OUTGOING',
|
|
239
|
+
at: `refs/heads/${branch_name}`,
|
|
240
|
+
limit: 100
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
openPRs = (prResponse.values || []).map((pr) => ({
|
|
244
|
+
id: pr.id,
|
|
245
|
+
title: pr.title,
|
|
246
|
+
destination_branch: pr.toRef.displayId,
|
|
247
|
+
author: pr.author.user.displayName,
|
|
248
|
+
created_on: new Date(pr.createdDate).toISOString(),
|
|
249
|
+
reviewers: pr.reviewers.map((r) => r.user.displayName),
|
|
250
|
+
approval_status: {
|
|
251
|
+
approved_by: pr.reviewers.filter((r) => r.approved).map((r) => r.user.displayName),
|
|
252
|
+
changes_requested_by: pr.reviewers.filter((r) => r.status === 'NEEDS_WORK').map((r) => r.user.displayName),
|
|
253
|
+
pending: pr.reviewers.filter((r) => !r.approved && r.status !== 'NEEDS_WORK').map((r) => r.user.displayName)
|
|
254
|
+
},
|
|
255
|
+
url: `${this.baseUrl}/projects/${workspace}/repos/${repository}/pull-requests/${pr.id}`
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// Bitbucket Cloud
|
|
260
|
+
const prPath = `/repositories/${workspace}/${repository}/pullrequests`;
|
|
261
|
+
const prResponse = await this.apiClient.makeRequest('get', prPath, undefined, {
|
|
262
|
+
params: {
|
|
263
|
+
state: 'OPEN',
|
|
264
|
+
q: `source.branch.name="${branch_name}"`,
|
|
265
|
+
pagelen: 50
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
openPRs = (prResponse.values || []).map((pr) => ({
|
|
269
|
+
id: pr.id,
|
|
270
|
+
title: pr.title,
|
|
271
|
+
destination_branch: pr.destination.branch.name,
|
|
272
|
+
author: pr.author.display_name,
|
|
273
|
+
created_on: pr.created_on,
|
|
274
|
+
reviewers: pr.reviewers.map((r) => r.display_name),
|
|
275
|
+
approval_status: {
|
|
276
|
+
approved_by: pr.participants.filter((p) => p.approved).map((p) => p.user.display_name),
|
|
277
|
+
changes_requested_by: [], // Cloud doesn't have explicit "changes requested" status
|
|
278
|
+
pending: pr.reviewers.filter((r) => !pr.participants.find((p) => p.user.account_id === r.account_id && p.approved))
|
|
279
|
+
.map((r) => r.display_name)
|
|
280
|
+
},
|
|
281
|
+
url: pr.links.html.href
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
// Step 3: Optionally get merged PRs
|
|
285
|
+
let mergedPRs = [];
|
|
286
|
+
if (include_merged_prs) {
|
|
287
|
+
if (this.apiClient.getIsServer()) {
|
|
288
|
+
// Bitbucket Server
|
|
289
|
+
const mergedPrPath = `/rest/api/1.0/projects/${workspace}/repos/${repository}/pull-requests`;
|
|
290
|
+
const mergedPrResponse = await this.apiClient.makeRequest('get', mergedPrPath, undefined, {
|
|
291
|
+
params: {
|
|
292
|
+
state: 'MERGED',
|
|
293
|
+
direction: 'OUTGOING',
|
|
294
|
+
at: `refs/heads/${branch_name}`,
|
|
295
|
+
limit: 25
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
mergedPRs = (mergedPrResponse.values || []).map((pr) => ({
|
|
299
|
+
id: pr.id,
|
|
300
|
+
title: pr.title,
|
|
301
|
+
merged_at: new Date(pr.updatedDate).toISOString(), // Using updated date as merge date
|
|
302
|
+
merged_by: pr.participants.find((p) => p.role === 'PARTICIPANT' && p.approved)?.user.displayName || 'Unknown'
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
// Bitbucket Cloud
|
|
307
|
+
const mergedPrPath = `/repositories/${workspace}/${repository}/pullrequests`;
|
|
308
|
+
const mergedPrResponse = await this.apiClient.makeRequest('get', mergedPrPath, undefined, {
|
|
309
|
+
params: {
|
|
310
|
+
state: 'MERGED',
|
|
311
|
+
q: `source.branch.name="${branch_name}"`,
|
|
312
|
+
pagelen: 25
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
mergedPRs = (mergedPrResponse.values || []).map((pr) => ({
|
|
316
|
+
id: pr.id,
|
|
317
|
+
title: pr.title,
|
|
318
|
+
merged_at: pr.updated_on,
|
|
319
|
+
merged_by: pr.closed_by?.display_name || 'Unknown'
|
|
320
|
+
}));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// Step 4: Calculate statistics
|
|
324
|
+
const daysSinceLastCommit = branchInfo.latest_commit.date
|
|
325
|
+
? Math.floor((Date.now() - new Date(branchInfo.latest_commit.date).getTime()) / (1000 * 60 * 60 * 24))
|
|
326
|
+
: null;
|
|
327
|
+
// Step 5: Format and return combined response
|
|
328
|
+
return {
|
|
329
|
+
content: [
|
|
330
|
+
{
|
|
331
|
+
type: 'text',
|
|
332
|
+
text: JSON.stringify({
|
|
333
|
+
branch: branchInfo,
|
|
334
|
+
open_pull_requests: openPRs,
|
|
335
|
+
merged_pull_requests: mergedPRs,
|
|
336
|
+
statistics: {
|
|
337
|
+
total_open_prs: openPRs.length,
|
|
338
|
+
total_merged_prs: mergedPRs.length,
|
|
339
|
+
days_since_last_commit: daysSinceLastCommit
|
|
340
|
+
}
|
|
341
|
+
}, null, 2),
|
|
342
|
+
},
|
|
343
|
+
],
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
catch (error) {
|
|
347
|
+
// Handle specific not found error
|
|
348
|
+
if (error.message?.includes('not found')) {
|
|
349
|
+
return {
|
|
350
|
+
content: [
|
|
351
|
+
{
|
|
352
|
+
type: 'text',
|
|
353
|
+
text: `Branch '${branch_name}' not found in ${workspace}/${repository}`,
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
isError: true,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return this.apiClient.handleApiError(error, `getting branch '${branch_name}' in ${workspace}/${repository}`);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
async handleListBranchCommits(args) {
|
|
363
|
+
if (!isListBranchCommitsArgs(args)) {
|
|
364
|
+
throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for list_branch_commits');
|
|
365
|
+
}
|
|
366
|
+
const { workspace, repository, branch_name, limit = 25, start = 0, since, until, author, include_merge_commits = true, search } = args;
|
|
367
|
+
try {
|
|
368
|
+
let apiPath;
|
|
369
|
+
let params = {};
|
|
370
|
+
let commits = [];
|
|
371
|
+
let totalCount = 0;
|
|
372
|
+
let nextPageStart = null;
|
|
373
|
+
if (this.apiClient.getIsServer()) {
|
|
374
|
+
// Bitbucket Server API
|
|
375
|
+
apiPath = `/rest/api/1.0/projects/${workspace}/repos/${repository}/commits`;
|
|
376
|
+
params = {
|
|
377
|
+
until: `refs/heads/${branch_name}`,
|
|
378
|
+
limit,
|
|
379
|
+
start,
|
|
380
|
+
withCounts: true
|
|
381
|
+
};
|
|
382
|
+
// Add filters
|
|
383
|
+
if (since) {
|
|
384
|
+
params.since = since;
|
|
385
|
+
}
|
|
386
|
+
if (!include_merge_commits) {
|
|
387
|
+
params.merges = 'exclude';
|
|
388
|
+
}
|
|
389
|
+
const response = await this.apiClient.makeRequest('get', apiPath, undefined, { params });
|
|
390
|
+
// Format commits
|
|
391
|
+
commits = (response.values || []).map((commit) => formatServerCommit(commit));
|
|
392
|
+
// Apply client-side filters for Server API
|
|
393
|
+
if (author) {
|
|
394
|
+
// Filter by author email or name
|
|
395
|
+
commits = commits.filter(c => c.author.email === author ||
|
|
396
|
+
c.author.name === author ||
|
|
397
|
+
c.author.email.toLowerCase() === author.toLowerCase() ||
|
|
398
|
+
c.author.name.toLowerCase() === author.toLowerCase());
|
|
399
|
+
}
|
|
400
|
+
// Filter by date if 'until' is provided (Server API doesn't support 'until' param directly)
|
|
401
|
+
if (until) {
|
|
402
|
+
const untilDate = new Date(until).getTime();
|
|
403
|
+
commits = commits.filter(c => new Date(c.date).getTime() <= untilDate);
|
|
404
|
+
}
|
|
405
|
+
// Filter by message search if provided
|
|
406
|
+
if (search) {
|
|
407
|
+
const searchLower = search.toLowerCase();
|
|
408
|
+
commits = commits.filter(c => c.message.toLowerCase().includes(searchLower));
|
|
409
|
+
}
|
|
410
|
+
// If we applied client-side filters, update the total count
|
|
411
|
+
if (author || until || search) {
|
|
412
|
+
totalCount = commits.length;
|
|
413
|
+
// Can't determine if there are more results when filtering client-side
|
|
414
|
+
nextPageStart = null;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
totalCount = response.size || commits.length;
|
|
418
|
+
if (!response.isLastPage && response.nextPageStart !== undefined) {
|
|
419
|
+
nextPageStart = response.nextPageStart;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
// Bitbucket Cloud API
|
|
425
|
+
apiPath = `/repositories/${workspace}/${repository}/commits/${encodeURIComponent(branch_name)}`;
|
|
426
|
+
params = {
|
|
427
|
+
pagelen: limit,
|
|
428
|
+
page: Math.floor(start / limit) + 1
|
|
429
|
+
};
|
|
430
|
+
// Build query string for filters
|
|
431
|
+
const queryParts = [];
|
|
432
|
+
if (author) {
|
|
433
|
+
queryParts.push(`author.raw ~ "${author}"`);
|
|
434
|
+
}
|
|
435
|
+
if (!include_merge_commits) {
|
|
436
|
+
// Cloud API doesn't have direct merge exclusion, we'll filter client-side
|
|
437
|
+
}
|
|
438
|
+
if (queryParts.length > 0) {
|
|
439
|
+
params.q = queryParts.join(' AND ');
|
|
440
|
+
}
|
|
441
|
+
const response = await this.apiClient.makeRequest('get', apiPath, undefined, { params });
|
|
442
|
+
// Format commits
|
|
443
|
+
let cloudCommits = (response.values || []).map((commit) => formatCloudCommit(commit));
|
|
444
|
+
// Apply client-side filters
|
|
445
|
+
if (!include_merge_commits) {
|
|
446
|
+
cloudCommits = cloudCommits.filter((c) => !c.is_merge_commit);
|
|
447
|
+
}
|
|
448
|
+
if (since) {
|
|
449
|
+
const sinceDate = new Date(since).getTime();
|
|
450
|
+
cloudCommits = cloudCommits.filter((c) => new Date(c.date).getTime() >= sinceDate);
|
|
451
|
+
}
|
|
452
|
+
if (until) {
|
|
453
|
+
const untilDate = new Date(until).getTime();
|
|
454
|
+
cloudCommits = cloudCommits.filter((c) => new Date(c.date).getTime() <= untilDate);
|
|
455
|
+
}
|
|
456
|
+
if (search) {
|
|
457
|
+
const searchLower = search.toLowerCase();
|
|
458
|
+
cloudCommits = cloudCommits.filter((c) => c.message.toLowerCase().includes(searchLower));
|
|
459
|
+
}
|
|
460
|
+
commits = cloudCommits;
|
|
461
|
+
totalCount = response.size || commits.length;
|
|
462
|
+
if (response.next) {
|
|
463
|
+
nextPageStart = start + limit;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
// Get branch head info
|
|
467
|
+
let branchHead = null;
|
|
468
|
+
try {
|
|
469
|
+
if (this.apiClient.getIsServer()) {
|
|
470
|
+
const branchesPath = `/rest/api/latest/projects/${workspace}/repos/${repository}/branches`;
|
|
471
|
+
const branchesResponse = await this.apiClient.makeRequest('get', branchesPath, undefined, {
|
|
472
|
+
params: { filterText: branch_name, limit: 1 }
|
|
473
|
+
});
|
|
474
|
+
const branch = branchesResponse.values?.find((b) => b.displayId === branch_name);
|
|
475
|
+
branchHead = branch?.latestCommit || null;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
const branchPath = `/repositories/${workspace}/${repository}/refs/branches/${encodeURIComponent(branch_name)}`;
|
|
479
|
+
const branch = await this.apiClient.makeRequest('get', branchPath);
|
|
480
|
+
branchHead = branch.target?.hash || null;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
catch (e) {
|
|
484
|
+
// Ignore error, branch head is optional
|
|
485
|
+
}
|
|
486
|
+
// Build filters applied summary
|
|
487
|
+
const filtersApplied = {};
|
|
488
|
+
if (author)
|
|
489
|
+
filtersApplied.author = author;
|
|
490
|
+
if (since)
|
|
491
|
+
filtersApplied.since = since;
|
|
492
|
+
if (until)
|
|
493
|
+
filtersApplied.until = until;
|
|
494
|
+
if (include_merge_commits !== undefined)
|
|
495
|
+
filtersApplied.include_merge_commits = include_merge_commits;
|
|
496
|
+
if (search)
|
|
497
|
+
filtersApplied.search = search;
|
|
498
|
+
return {
|
|
499
|
+
content: [
|
|
500
|
+
{
|
|
501
|
+
type: 'text',
|
|
502
|
+
text: JSON.stringify({
|
|
503
|
+
branch_name,
|
|
504
|
+
branch_head: branchHead,
|
|
505
|
+
commits,
|
|
506
|
+
total_count: totalCount,
|
|
507
|
+
start,
|
|
508
|
+
limit,
|
|
509
|
+
has_more: nextPageStart !== null,
|
|
510
|
+
next_start: nextPageStart,
|
|
511
|
+
filters_applied: filtersApplied
|
|
512
|
+
}, null, 2),
|
|
513
|
+
},
|
|
514
|
+
],
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
catch (error) {
|
|
518
|
+
return this.apiClient.handleApiError(error, `listing commits for branch '${branch_name}' in ${workspace}/${repository}`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
//# sourceMappingURL=branch-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch-handlers.js","sourceRoot":"","sources":["../../src/handlers/branch-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,MAAM,OAAO,cAAc;IAEf;IACA;IAFV,YACU,SAA6B,EAC7B,OAAe;QADf,cAAS,GAAT,SAAS,CAAoB;QAC7B,YAAO,GAAP,OAAO,CAAQ;IACtB,CAAC;IAEJ,KAAK,CAAC,kBAAkB,CAAC,IAAS;QAChC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,aAAa,EACvB,qCAAqC,CACtC,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,KA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,IAAI,KAAK;gBAAE,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;YACxC,IAAI,KAAK;gBAAE,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;YACxC,IAAI,qBAAqB,KAAK,SAAS;gBAAE,cAAc,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;YACtG,IAAI,MAAM;gBAAE,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;YAE3C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,WAAW;4BACX,WAAW,EAAE,UAAU;4BACvB,OAAO;4BACP,WAAW,EAAE,UAAU;4BACvB,KAAK;4BACL,KAAK;4BACL,QAAQ,EAAE,aAAa,KAAK,IAAI;4BAChC,UAAU,EAAE,aAAa;4BACzB,eAAe,EAAE,cAAc;yBAChC,EAAE,IAAI,EAAE,CAAC,CAAC;qBACZ;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,+BAA+B,WAAW,QAAQ,SAAS,IAAI,UAAU,EAAE,CAAC,CAAC;QAC3H,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BitbucketApiClient } from '../utils/api-client.js';
|
|
2
|
+
export declare class FileHandlers {
|
|
3
|
+
private apiClient;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
private readonly DEFAULT_LINES_BY_EXT;
|
|
6
|
+
constructor(apiClient: BitbucketApiClient, baseUrl: string);
|
|
7
|
+
handleListDirectoryContent(args: any): Promise<{
|
|
8
|
+
content: {
|
|
9
|
+
type: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
isError: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
content: {
|
|
15
|
+
type: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}[];
|
|
18
|
+
}>;
|
|
19
|
+
handleGetFileContent(args: any): Promise<{
|
|
20
|
+
content: {
|
|
21
|
+
type: string;
|
|
22
|
+
text: string;
|
|
23
|
+
}[];
|
|
24
|
+
isError: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
content: {
|
|
27
|
+
type: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
31
|
+
private getDefaultLines;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=file-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/file-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAY5D,qBAAa,YAAY;IAWrB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;IAVjB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAMnC;gBAGQ,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,MAAM;IAGnB,0BAA0B,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;IAwFpC,oBAAoB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;IA6NpC,OAAO,CAAC,eAAe;CAcxB"}
|