@stubbedev/atlassian-mcp 0.2.9 → 0.2.10
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/jira.js +25 -8
- package/package.json +1 -1
package/dist/jira.js
CHANGED
|
@@ -95,6 +95,7 @@ export class JiraClient {
|
|
|
95
95
|
headers;
|
|
96
96
|
currentUserCache;
|
|
97
97
|
projectsCache;
|
|
98
|
+
issueLinkingEnabled;
|
|
98
99
|
constructor(baseUrl, token) {
|
|
99
100
|
this.baseUrl = baseUrl.replace(/\/$/, '');
|
|
100
101
|
this.headers = {
|
|
@@ -147,6 +148,13 @@ export class JiraClient {
|
|
|
147
148
|
this.currentUserCache = me;
|
|
148
149
|
return me;
|
|
149
150
|
}
|
|
151
|
+
async getIssueLinkingEnabled() {
|
|
152
|
+
if (this.issueLinkingEnabled !== undefined)
|
|
153
|
+
return this.issueLinkingEnabled;
|
|
154
|
+
const config = await this.request('GET', '/configuration');
|
|
155
|
+
this.issueLinkingEnabled = config?.issueLinkingEnabled ?? false;
|
|
156
|
+
return this.issueLinkingEnabled;
|
|
157
|
+
}
|
|
150
158
|
async assertOwnComment(comment) {
|
|
151
159
|
const me = await this.getCurrentUser();
|
|
152
160
|
const commentAuthorName = this.normalizeIdentity(comment.author.name);
|
|
@@ -602,14 +610,20 @@ export class JiraClient {
|
|
|
602
610
|
await this.request('POST', `/issue/${encodeURIComponent(issueKey)}/comment`, { body: validateCommentBody(args.comment) });
|
|
603
611
|
actions.push('added comment');
|
|
604
612
|
}
|
|
613
|
+
const warnings = [];
|
|
605
614
|
if (args.link) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
615
|
+
if (!(await this.getIssueLinkingEnabled())) {
|
|
616
|
+
warnings.push(`issue linking is disabled in this Jira instance — add the link manually`);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
const dir = args.link.direction ?? 'outward';
|
|
620
|
+
await this.request('POST', '/issueLink', {
|
|
621
|
+
type: { name: args.link.linkType },
|
|
622
|
+
outwardIssue: { key: dir === 'outward' ? issueKey : args.link.targetIssueKey },
|
|
623
|
+
inwardIssue: { key: dir === 'outward' ? args.link.targetIssueKey : issueKey },
|
|
624
|
+
});
|
|
625
|
+
actions.push(`linked ${args.link.linkType} → ${args.link.targetIssueKey}`);
|
|
626
|
+
}
|
|
613
627
|
}
|
|
614
628
|
if (args.worklog) {
|
|
615
629
|
const wBody = { timeSpent: args.worklog.timeSpent };
|
|
@@ -623,7 +637,10 @@ export class JiraClient {
|
|
|
623
637
|
if (actions.length === 0) {
|
|
624
638
|
return text('Nothing to mutate.');
|
|
625
639
|
}
|
|
626
|
-
|
|
640
|
+
const parts = [`Mutated ${issueKey}: ${actions.join(', ')}.`, this.issueUrl(issueKey)];
|
|
641
|
+
if (warnings.length)
|
|
642
|
+
parts.push(`Warnings: ${warnings.join('; ')}`);
|
|
643
|
+
return text(parts.join('\n'));
|
|
627
644
|
}
|
|
628
645
|
async getComments(args) {
|
|
629
646
|
const { issueKey, maxResults = 50, startAt = 0 } = args;
|