@stubbedev/atlassian-mcp 0.1.12 → 0.1.13
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 +31 -9
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/dist/bitbucket.js
CHANGED
|
@@ -690,25 +690,47 @@ export class BitbucketClient {
|
|
|
690
690
|
const body = { text: validateCommentText(commentText) };
|
|
691
691
|
if (args.parentCommentId)
|
|
692
692
|
body.parent = { id: args.parentCommentId };
|
|
693
|
-
|
|
693
|
+
let inlineAnchor;
|
|
694
|
+
if (args.filePath !== undefined || args.line !== undefined) {
|
|
695
|
+
if (args.filePath === undefined || args.line === undefined) {
|
|
696
|
+
throw new Error('filePath and line must be provided together for inline comments.');
|
|
697
|
+
}
|
|
694
698
|
const pr = await this.request('GET', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}`);
|
|
695
|
-
|
|
699
|
+
inlineAnchor = {
|
|
696
700
|
diffType: 'EFFECTIVE',
|
|
697
701
|
fileType: args.fileType ?? 'TO',
|
|
698
|
-
fromHash: pr?.fromRef.latestCommit ?? '',
|
|
699
|
-
toHash: pr?.toRef.latestCommit ?? '',
|
|
700
702
|
line: args.line,
|
|
701
703
|
lineType: args.lineType ?? 'ADDED',
|
|
702
704
|
path: args.filePath,
|
|
703
|
-
srcPath: args.srcPath ?? args.filePath,
|
|
704
705
|
};
|
|
706
|
+
if (args.srcPath !== undefined) {
|
|
707
|
+
inlineAnchor.srcPath = args.srcPath;
|
|
708
|
+
}
|
|
709
|
+
const fromHash = pr?.toRef.latestCommit;
|
|
710
|
+
const toHash = pr?.fromRef.latestCommit;
|
|
711
|
+
if (fromHash && toHash) {
|
|
712
|
+
inlineAnchor.fromHash = fromHash;
|
|
713
|
+
inlineAnchor.toHash = toHash;
|
|
714
|
+
}
|
|
705
715
|
if (args.multilineStartLine !== undefined) {
|
|
706
|
-
|
|
707
|
-
|
|
716
|
+
inlineAnchor.multilineStartLine = args.multilineStartLine;
|
|
717
|
+
inlineAnchor.multilineStartLineType = args.multilineStartLineType ?? args.lineType ?? 'ADDED';
|
|
718
|
+
}
|
|
719
|
+
body.anchor = inlineAnchor;
|
|
720
|
+
}
|
|
721
|
+
let created;
|
|
722
|
+
try {
|
|
723
|
+
created = await this.request('POST', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}/comments`, body);
|
|
724
|
+
}
|
|
725
|
+
catch (error) {
|
|
726
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
727
|
+
if (!inlineAnchor || !message.includes('Bitbucket 409') || !('fromHash' in inlineAnchor) || !('toHash' in inlineAnchor)) {
|
|
728
|
+
throw error;
|
|
708
729
|
}
|
|
709
|
-
|
|
730
|
+
const { fromHash: _fromHash, toHash: _toHash, ...anchorWithoutHashes } = inlineAnchor;
|
|
731
|
+
body.anchor = anchorWithoutHashes;
|
|
732
|
+
created = await this.request('POST', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}/comments`, body);
|
|
710
733
|
}
|
|
711
|
-
const created = await this.request('POST', `/projects/${projectKey}/repos/${repoSlug}/pull-requests/${args.prId}/comments`, body);
|
|
712
734
|
if (!created)
|
|
713
735
|
return text(`Comment added to PR #${args.prId}.`);
|
|
714
736
|
if (args.parentCommentId) {
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
44
44
|
// ── Context ───────────────────────────────────────────────────────────
|
|
45
45
|
{
|
|
46
46
|
name: 'get_dev_context',
|
|
47
|
-
description: 'Use when you want one quick snapshot before coding or reviewing: current git branch/status, Jira tickets detected from branch name, and the open Bitbucket PR for that branch.',
|
|
47
|
+
description: 'Use when you want one quick snapshot before coding or reviewing: current git branch/status, Jira tickets detected from branch name, and the open Bitbucket PR for that branch. For review requests, use this first to resolve the branch and PR without assuming it is in your personal inbox.',
|
|
48
48
|
inputSchema: {
|
|
49
49
|
type: 'object',
|
|
50
50
|
properties: {
|
|
@@ -311,7 +311,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
313
|
name: 'bitbucket_list_pull_requests',
|
|
314
|
-
description: 'Use when you want pull requests for a repo (open, merged, or declined) with pagination. You can pass projectKey/repoSlug or project/repo.',
|
|
314
|
+
description: 'Use when you want pull requests for a repo (open, merged, or declined) with pagination. Primary review-discovery flow: resolve the branch, then filter by fromBranch to find the PR for that branch (do not assume it is your own PR). You can pass projectKey/repoSlug or project/repo.',
|
|
315
315
|
inputSchema: {
|
|
316
316
|
type: 'object',
|
|
317
317
|
properties: {
|
|
@@ -329,7 +329,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
329
329
|
},
|
|
330
330
|
{
|
|
331
331
|
name: 'bitbucket_my_prs',
|
|
332
|
-
description: 'Use when you want your personal PR inbox (reviews requested, authored by you, or participated PRs).',
|
|
332
|
+
description: 'Use only when you explicitly want your personal PR inbox (reviews requested, authored by you, or participated PRs). Do not use this for branch-based review targeting.',
|
|
333
333
|
inputSchema: {
|
|
334
334
|
type: 'object',
|
|
335
335
|
properties: {
|
|
@@ -356,7 +356,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
name: 'bitbucket_get_pr_overview',
|
|
359
|
-
description: 'Use when you want one bulk PR snapshot in a single call: metadata, commits, comments, task-style BLOCKER comments, and optional diff.',
|
|
359
|
+
description: 'Use when you want one bulk PR snapshot in a single call: metadata, commits, comments, task-style BLOCKER comments, and optional diff. If prId is unknown during review, discover it from branch context first (get_dev_context or bitbucket_list_pull_requests with fromBranch).',
|
|
360
360
|
inputSchema: {
|
|
361
361
|
type: 'object',
|
|
362
362
|
properties: {
|
|
@@ -548,7 +548,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
548
548
|
},
|
|
549
549
|
{
|
|
550
550
|
name: 'bitbucket_get_pr_comments',
|
|
551
|
-
description: 'Use when you want PR review discussion in bulk: comment threads, task-style BLOCKER comments, and blocker counts with pagination. You can pass projectKey/repoSlug or project/repo.',
|
|
551
|
+
description: 'Use when you want PR review discussion in bulk: comment threads, task-style BLOCKER comments, and blocker counts with pagination. For review tasks, locate PR by branch first instead of assuming it is in your inbox. You can pass projectKey/repoSlug or project/repo.',
|
|
552
552
|
inputSchema: {
|
|
553
553
|
type: 'object',
|
|
554
554
|
properties: {
|
|
@@ -571,6 +571,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
571
571
|
name: 'bitbucket_add_pr_comment',
|
|
572
572
|
description: `Add a PR review comment or reply to an existing thread.
|
|
573
573
|
|
|
574
|
+
FOR REVIEW FEEDBACK, DEFAULT TO INLINE + EXAMPLE: Prefer anchored inline comments with a concrete code change example (suggestion) over top-level prose. Use top-level comments only for overall PR-wide feedback.
|
|
575
|
+
|
|
574
576
|
INLINE COMMENTS ARE STRONGLY PREFERRED: Whenever your comment refers to a specific line or block of code, you MUST provide filePath and line to anchor it as an inline comment on the diff. General top-level comments (no filePath/line) should only be used for overall PR feedback that does not relate to any particular line.
|
|
575
577
|
|
|
576
578
|
SUGGESTIONS ARE STRONGLY PREFERRED OVER PLAIN COMMENTS: When you are pointing out something that should be changed, always provide a suggestion (the corrected code) rather than describing the change in words. A suggestion lets the author apply the fix with one click. Only omit suggestion if you are asking a question or raising a concern that has no clear single answer.
|