@stubbedev/atlassian-mcp 0.2.4 → 0.2.6
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 +20 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/bitbucket.js
CHANGED
|
@@ -321,6 +321,19 @@ export class BitbucketClient {
|
|
|
321
321
|
start = data.nextPageStart;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
+
// Fallback: search branches matching filterText and check each for an open PR.
|
|
325
|
+
// Used when exact branch name lookup yields no result (e.g. LLM provides a partial branch name).
|
|
326
|
+
async findOpenPrByBranchFilter(projectKey, repoSlug, filterText) {
|
|
327
|
+
const branches = await this.request('GET', `/projects/${projectKey}/repos/${repoSlug}/branches?limit=25&filterText=${encodeURIComponent(filterText)}`);
|
|
328
|
+
if (!branches?.values?.length)
|
|
329
|
+
return null;
|
|
330
|
+
for (const b of branches.values) {
|
|
331
|
+
const pr = await this.findOpenPrForBranch(projectKey, repoSlug, b.displayId);
|
|
332
|
+
if (pr)
|
|
333
|
+
return pr;
|
|
334
|
+
}
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
324
337
|
async listRepos(args) {
|
|
325
338
|
const { limit = 50, start = 0 } = args;
|
|
326
339
|
const qs = `?limit=${limit}&start=${start}`;
|
|
@@ -396,7 +409,11 @@ export class BitbucketClient {
|
|
|
396
409
|
if (!branch || branch === 'HEAD') {
|
|
397
410
|
throw new Error('Provide prId or fromBranch, or run from a checked-out branch.');
|
|
398
411
|
}
|
|
399
|
-
|
|
412
|
+
let found = await this.findOpenPrForBranch(projectKey, repoSlug, branch);
|
|
413
|
+
if (!found) {
|
|
414
|
+
// Fallback: search branches matching the input text, then check those for open PRs
|
|
415
|
+
found = await this.findOpenPrByBranchFilter(projectKey, repoSlug, branchDisplayId(branch));
|
|
416
|
+
}
|
|
400
417
|
if (!found)
|
|
401
418
|
throw new Error(`No open PR found for branch "${branchDisplayId(branch)}".`);
|
|
402
419
|
prId = found.id;
|
|
@@ -441,7 +458,8 @@ export class BitbucketClient {
|
|
|
441
458
|
if (statuses?.values?.length) {
|
|
442
459
|
const statusLines = statuses.values.map((s) => {
|
|
443
460
|
const icon = s.state === 'SUCCESSFUL' ? '✓' : s.state === 'FAILED' ? '✗' : '…';
|
|
444
|
-
|
|
461
|
+
const urlPart = s.url ? `\n URL: ${s.url}` : '';
|
|
462
|
+
return `${icon} [${s.state}] ${s.name ?? s.key}${s.description ? ` — ${s.description}` : ''}${urlPart}`;
|
|
445
463
|
});
|
|
446
464
|
sections.push(`Build status (${pr.fromRef.latestCommit.slice(0, 8)}):\n${statusLines.join('\n')}`);
|
|
447
465
|
}
|
package/dist/index.js
CHANGED
|
@@ -405,7 +405,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
405
405
|
},
|
|
406
406
|
required: ['prId'],
|
|
407
407
|
},
|
|
408
|
-
}
|
|
408
|
+
},
|
|
409
|
+
] : []),
|
|
409
410
|
// ── Combined workflow ─────────────────────────────────────────────────
|
|
410
411
|
...(jira && bitbucket ? [{
|
|
411
412
|
name: 'complete_work',
|