@stubbedev/atlassian-mcp 0.3.1 → 0.3.2
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/bitbucket.js +9 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/bitbucket.js
CHANGED
|
@@ -84,6 +84,7 @@ function commentMatchesState(comment, state) {
|
|
|
84
84
|
const threadState = comment.threadResolved ? 'RESOLVED' : 'OPEN';
|
|
85
85
|
if (threadState === state)
|
|
86
86
|
return true;
|
|
87
|
+
return (comment.comments ?? []).some((child) => commentMatchesState(child, state));
|
|
87
88
|
}
|
|
88
89
|
const currentState = comment.state ?? 'OPEN';
|
|
89
90
|
if (currentState === state)
|
|
@@ -125,7 +126,7 @@ function uniqueCommentsFromActivities(activities) {
|
|
|
125
126
|
}
|
|
126
127
|
return Array.from(byId.values())
|
|
127
128
|
.filter((comment) => !comment.deleted)
|
|
128
|
-
.sort((a, b) => (
|
|
129
|
+
.sort((a, b) => (b.createdDate ?? 0) - (a.createdDate ?? 0));
|
|
129
130
|
}
|
|
130
131
|
function pageHint(data) {
|
|
131
132
|
return data.isLastPage ? '' : ` (use start=${data.nextPageStart} for next page)`;
|
|
@@ -535,13 +536,15 @@ export class BitbucketClient {
|
|
|
535
536
|
if (includeComments) {
|
|
536
537
|
const commentsLimit = args.commentsLimit ?? 50;
|
|
537
538
|
const commentsStart = args.commentsStart ?? 0;
|
|
538
|
-
const commentsState = args.commentsState ?? '
|
|
539
|
+
const commentsState = args.commentsState ?? 'ALL';
|
|
539
540
|
const commentsSeverity = args.commentsSeverity ?? 'ALL';
|
|
540
541
|
if (commentsSeverity === 'BLOCKER' && commentsState === 'PENDING') {
|
|
541
|
-
throw new Error('commentsState=PENDING is not valid when commentsSeverity=BLOCKER. Use OPEN or
|
|
542
|
+
throw new Error('commentsState=PENDING is not valid when commentsSeverity=BLOCKER. Use OPEN, RESOLVED, or ALL.');
|
|
542
543
|
}
|
|
543
544
|
if (commentsSeverity === 'BLOCKER') {
|
|
544
|
-
const qs = new URLSearchParams({ limit: String(commentsLimit), start: String(commentsStart)
|
|
545
|
+
const qs = new URLSearchParams({ limit: String(commentsLimit), start: String(commentsStart) });
|
|
546
|
+
if (commentsState !== 'ALL')
|
|
547
|
+
qs.set('state', commentsState);
|
|
545
548
|
const data = await this.request('GET', `${this.rp(projectKey, repoSlug)}/pull-requests/${prId}/blocker-comments?${qs}`);
|
|
546
549
|
if (!data || data.values.length === 0) {
|
|
547
550
|
sections.push(`Comments:\n(no ${commentsState} BLOCKER comments)`);
|
|
@@ -556,7 +559,7 @@ export class BitbucketClient {
|
|
|
556
559
|
else {
|
|
557
560
|
const activityData = await this.request('GET', `${this.rp(projectKey, repoSlug)}/pull-requests/${prId}/activities?limit=${commentsLimit}&start=${commentsStart}`);
|
|
558
561
|
const comments = uniqueCommentsFromActivities(activityData?.values ?? []).filter((comment) => {
|
|
559
|
-
const matchesState = commentMatchesState(comment, commentsState);
|
|
562
|
+
const matchesState = commentsState === 'ALL' ? true : commentMatchesState(comment, commentsState);
|
|
560
563
|
return matchesState && commentMatchesSeverity(comment, commentsSeverity);
|
|
561
564
|
});
|
|
562
565
|
for (const comment of comments)
|
|
@@ -567,7 +570,7 @@ export class BitbucketClient {
|
|
|
567
570
|
else {
|
|
568
571
|
const blocks = comments.flatMap((comment) => formatCommentThread(comment));
|
|
569
572
|
const paging = activityData ? pageHint(activityData) : '';
|
|
570
|
-
sections.push(`Comments (${comments.length} thread(s))${paging}:\n\n${blocks.join('\n\n')}`);
|
|
573
|
+
sections.push(`Comments (${comments.length} thread(s), newest first)${paging}:\n\n${blocks.join('\n\n')}`);
|
|
571
574
|
}
|
|
572
575
|
}
|
|
573
576
|
}
|
package/dist/index.js
CHANGED
|
@@ -372,7 +372,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
372
372
|
includeComments: { type: 'boolean', description: 'Include review comments and blockers (default true)', default: true },
|
|
373
373
|
includeDiff: { type: 'boolean', description: 'Include diff text (default false)', default: false },
|
|
374
374
|
includeBuildStatus: { type: 'boolean', description: 'Include CI/build status for the head commit (default true)', default: true },
|
|
375
|
-
commentsState: { type: 'string', enum: ['OPEN', 'RESOLVED', 'PENDING'], description: 'Comment state filter (default OPEN
|
|
375
|
+
commentsState: { type: 'string', enum: ['ALL', 'OPEN', 'RESOLVED', 'PENDING'], description: 'Comment state filter (default ALL — returns every comment with its state badge so nothing is silently hidden). Pass OPEN/RESOLVED only when explicitly narrowing.', default: 'ALL' },
|
|
376
376
|
commentsSeverity: { type: 'string', enum: ['ALL', 'NORMAL', 'BLOCKER'], description: 'Comment severity filter (default ALL)', default: 'ALL' },
|
|
377
377
|
commentsLimit: { type: 'number', description: 'Max comments (default 50)', default: 50 },
|
|
378
378
|
commentsStart: { type: 'number', description: 'Comment pagination offset (default 0)', default: 0 },
|