@jagadeesh52423/atlassian-mcp-server 1.0.2 → 1.1.0
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/clients/base-client.d.ts +26 -0
- package/dist/clients/base-client.d.ts.map +1 -0
- package/dist/clients/base-client.js +58 -0
- package/dist/clients/base-client.js.map +1 -0
- package/dist/clients/bitbucket-client.d.ts +17 -0
- package/dist/clients/bitbucket-client.d.ts.map +1 -0
- package/dist/clients/bitbucket-client.js +36 -0
- package/dist/clients/bitbucket-client.js.map +1 -0
- package/dist/clients/confluence-client.d.ts +8 -0
- package/dist/clients/confluence-client.d.ts.map +1 -0
- package/dist/clients/confluence-client.js +16 -0
- package/dist/clients/confluence-client.js.map +1 -0
- package/dist/clients/index.d.ts +5 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +5 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/jira-client.d.ts +8 -0
- package/dist/clients/jira-client.d.ts.map +1 -0
- package/dist/clients/jira-client.js +16 -0
- package/dist/clients/jira-client.js.map +1 -0
- package/dist/constants.d.ts +67 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +78 -0
- package/dist/constants.js.map +1 -0
- package/dist/error-handler.d.ts +83 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/error-handler.js +141 -0
- package/dist/error-handler.js.map +1 -0
- package/dist/formatters/adf-formatter.d.ts +25 -0
- package/dist/formatters/adf-formatter.d.ts.map +1 -0
- package/dist/formatters/adf-formatter.js +609 -0
- package/dist/formatters/adf-formatter.js.map +1 -0
- package/dist/formatters/index.d.ts +2 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +2 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/handlers/bitbucket-handlers.d.ts +94 -0
- package/dist/handlers/bitbucket-handlers.d.ts.map +1 -0
- package/dist/handlers/bitbucket-handlers.js +251 -0
- package/dist/handlers/bitbucket-handlers.js.map +1 -0
- package/dist/handlers/confluence-handlers.d.ts +106 -0
- package/dist/handlers/confluence-handlers.d.ts.map +1 -0
- package/dist/handlers/confluence-handlers.js +340 -0
- package/dist/handlers/confluence-handlers.js.map +1 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +4 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/jira-handlers.d.ts +237 -0
- package/dist/handlers/jira-handlers.d.ts.map +1 -0
- package/dist/handlers/jira-handlers.js +816 -0
- package/dist/handlers/jira-handlers.js.map +1 -0
- package/dist/index.js +189 -2536
- package/dist/index.js.map +1 -1
- package/dist/services/bitbucket.d.ts +11 -1
- package/dist/services/bitbucket.d.ts.map +1 -1
- package/dist/services/bitbucket.js +78 -0
- package/dist/services/bitbucket.js.map +1 -1
- package/dist/services/confluence.d.ts +5 -0
- package/dist/services/confluence.d.ts.map +1 -1
- package/dist/services/confluence.js +59 -4
- package/dist/services/confluence.js.map +1 -1
- package/dist/services/jira.d.ts +57 -0
- package/dist/services/jira.d.ts.map +1 -1
- package/dist/services/jira.js +395 -24
- package/dist/services/jira.js.map +1 -1
- package/dist/tools/bitbucket-tools.d.ts +6 -0
- package/dist/tools/bitbucket-tools.d.ts.map +1 -0
- package/dist/tools/bitbucket-tools.js +386 -0
- package/dist/tools/bitbucket-tools.js.map +1 -0
- package/dist/tools/confluence-tools.d.ts +17 -0
- package/dist/tools/confluence-tools.d.ts.map +1 -0
- package/dist/tools/confluence-tools.js +440 -0
- package/dist/tools/confluence-tools.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +15 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/jira-tools.d.ts +6 -0
- package/dist/tools/jira-tools.d.ts.map +1 -0
- package/dist/tools/jira-tools.js +1032 -0
- package/dist/tools/jira-tools.js.map +1 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
export interface ClientConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
auth: string;
|
|
5
|
+
serviceName: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Base API client that provides common HTTP methods for all Atlassian services.
|
|
9
|
+
* Eliminates code duplication across confluence-client, jira-client, and atlassian-client.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class BaseApiClient {
|
|
12
|
+
protected client: AxiosInstance;
|
|
13
|
+
protected baseUrl: string;
|
|
14
|
+
protected serviceName: string;
|
|
15
|
+
constructor(config: ClientConfig);
|
|
16
|
+
get<T>(endpoint: string, params?: any): Promise<T>;
|
|
17
|
+
post<T>(endpoint: string, data: any): Promise<T>;
|
|
18
|
+
put<T>(endpoint: string, data: any): Promise<T>;
|
|
19
|
+
delete<T>(endpoint: string): Promise<T>;
|
|
20
|
+
postFormData<T>(endpoint: string, formData: any): Promise<T>;
|
|
21
|
+
/**
|
|
22
|
+
* For Bitbucket which needs access to the raw axios instance for custom requests
|
|
23
|
+
*/
|
|
24
|
+
protected getAxiosInstance(): AxiosInstance;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=base-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-client.d.ts","sourceRoot":"","sources":["../../src/clients/base-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAiB,MAAM,OAAO,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,8BAAsB,aAAa;IACjC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;IAChC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;gBAElB,MAAM,EAAE,YAAY;IAsB1B,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAKlD,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAKhD,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAK/C,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAKvC,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAUlE;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,aAAa;CAG5C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* Base API client that provides common HTTP methods for all Atlassian services.
|
|
4
|
+
* Eliminates code duplication across confluence-client, jira-client, and atlassian-client.
|
|
5
|
+
*/
|
|
6
|
+
export class BaseApiClient {
|
|
7
|
+
client;
|
|
8
|
+
baseUrl;
|
|
9
|
+
serviceName;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.baseUrl = config.baseUrl;
|
|
12
|
+
this.serviceName = config.serviceName;
|
|
13
|
+
this.client = axios.create({
|
|
14
|
+
baseURL: this.baseUrl,
|
|
15
|
+
headers: {
|
|
16
|
+
'Authorization': `Basic ${config.auth}`,
|
|
17
|
+
'Accept': 'application/json',
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
this.client.interceptors.response.use((response) => response, (error) => {
|
|
22
|
+
console.error(`${this.serviceName} API Error:`, error.response?.data || error.message);
|
|
23
|
+
throw error;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async get(endpoint, params) {
|
|
27
|
+
const response = await this.client.get(endpoint, { params });
|
|
28
|
+
return response.data;
|
|
29
|
+
}
|
|
30
|
+
async post(endpoint, data) {
|
|
31
|
+
const response = await this.client.post(endpoint, data);
|
|
32
|
+
return response.data;
|
|
33
|
+
}
|
|
34
|
+
async put(endpoint, data) {
|
|
35
|
+
const response = await this.client.put(endpoint, data);
|
|
36
|
+
return response.data;
|
|
37
|
+
}
|
|
38
|
+
async delete(endpoint) {
|
|
39
|
+
const response = await this.client.delete(endpoint);
|
|
40
|
+
return response.data;
|
|
41
|
+
}
|
|
42
|
+
async postFormData(endpoint, formData) {
|
|
43
|
+
const response = await this.client.post(endpoint, formData, {
|
|
44
|
+
headers: {
|
|
45
|
+
...formData.getHeaders(),
|
|
46
|
+
'X-Atlassian-Token': 'no-check',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
return response.data;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* For Bitbucket which needs access to the raw axios instance for custom requests
|
|
53
|
+
*/
|
|
54
|
+
getAxiosInstance() {
|
|
55
|
+
return this.client;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=base-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-client.js","sourceRoot":"","sources":["../../src/clients/base-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAQ5D;;;GAGG;AACH,MAAM,OAAgB,aAAa;IACvB,MAAM,CAAgB;IACtB,OAAO,CAAS;IAChB,WAAW,CAAS;IAE9B,YAAY,MAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QAEtC,IAAI,CAAC,MAAM,GAAG,KAA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AM,CAAC,QAAQ,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,YAAY,CAAI,QAAgB,EAAE,QAAa;QACnD,MAAM,QAAQ,GAAqB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE;YAC5E,OAAO,EAAE;gBACP,GAAG,QAAQ,CAAC,UAAU,EAAE;gBACxB,mBAAmB,EAAE,UAAU;aAChC;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACO,gBAAgB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseApiClient } from './base-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bitbucket API client extending the base client
|
|
4
|
+
*/
|
|
5
|
+
export declare class BitbucketClient extends BaseApiClient {
|
|
6
|
+
readonly workspace: string;
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Get raw text content (for diffs and file contents)
|
|
10
|
+
*/
|
|
11
|
+
getRawText(endpoint: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Post form data for file uploads
|
|
14
|
+
*/
|
|
15
|
+
postMultipartFormData(endpoint: string, formData: FormData): Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=bitbucket-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-client.d.ts","sourceRoot":"","sources":["../../src/clients/bitbucket-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAChD,SAAgB,SAAS,EAAE,MAAM,CAAC;;IAWlC;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD;;OAEG;IACG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;CAQhF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseApiClient } from './base-client.js';
|
|
2
|
+
import { bitbucketConfig, getBitbucketAuth } from '../config.js';
|
|
3
|
+
import { SERVICE_NAMES, API_ENDPOINTS } from '../constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Bitbucket API client extending the base client
|
|
6
|
+
*/
|
|
7
|
+
export class BitbucketClient extends BaseApiClient {
|
|
8
|
+
workspace;
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
baseUrl: API_ENDPOINTS.BITBUCKET_BASE_URL,
|
|
12
|
+
auth: getBitbucketAuth(),
|
|
13
|
+
serviceName: SERVICE_NAMES.BITBUCKET,
|
|
14
|
+
});
|
|
15
|
+
this.workspace = bitbucketConfig.workspace;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get raw text content (for diffs and file contents)
|
|
19
|
+
*/
|
|
20
|
+
async getRawText(endpoint) {
|
|
21
|
+
const response = await this.getAxiosInstance().get(endpoint, { responseType: 'text' });
|
|
22
|
+
return response.data;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Post form data for file uploads
|
|
26
|
+
*/
|
|
27
|
+
async postMultipartFormData(endpoint, formData) {
|
|
28
|
+
const response = await this.getAxiosInstance().post(endpoint, formData, {
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'multipart/form-data',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return response.data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=bitbucket-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket-client.js","sourceRoot":"","sources":["../../src/clients/bitbucket-client.ts"],"names":[],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
|
|
1
|
+
import { BaseApiClient } from './base-client.js';
|
|
2
|
+
import { confluenceConfig, getConfluenceAuth } from '../config.js';
|
|
3
|
+
import { SERVICE_NAMES } from '../constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Confluence API client extending the base client
|
|
6
|
+
*/
|
|
7
|
+
export class ConfluenceClient extends BaseApiClient {
|
|
8
|
+
constructor() {
|
|
9
|
+
super({
|
|
10
|
+
baseUrl: `https://${confluenceConfig.domain}`,
|
|
11
|
+
auth: getConfluenceAuth(),
|
|
12
|
+
serviceName: SERVICE_NAMES.CONFLUENCE,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=confluence-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confluence-client.js","sourceRoot":"","sources":["../../src/clients/confluence-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IACjD;QACE,KAAK,CAAC;YACJ,OAAO,EAAE,WAAW,gBAAgB,CAAC,MAAM,EAAE;YAC7C,IAAI,EAAE,iBAAiB,EAAE;YACzB,WAAW,EAAE,aAAa,CAAC,UAAU;SACtC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jira-client.d.ts","sourceRoot":"","sources":["../../src/clients/jira-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD;;GAEG;AACH,qBAAa,UAAW,SAAQ,aAAa;;CAQ5C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseApiClient } from './base-client.js';
|
|
2
|
+
import { jiraConfig, getJiraAuth } from '../config.js';
|
|
3
|
+
import { SERVICE_NAMES } from '../constants.js';
|
|
4
|
+
/**
|
|
5
|
+
* Jira API client extending the base client
|
|
6
|
+
*/
|
|
7
|
+
export class JiraClient extends BaseApiClient {
|
|
8
|
+
constructor() {
|
|
9
|
+
super({
|
|
10
|
+
baseUrl: `https://${jiraConfig.domain}`,
|
|
11
|
+
auth: getJiraAuth(),
|
|
12
|
+
serviceName: SERVICE_NAMES.JIRA,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=jira-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jira-client.js","sourceRoot":"","sources":["../../src/clients/jira-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,aAAa;IAC3C;QACE,KAAK,CAAC;YACJ,OAAO,EAAE,WAAW,UAAU,CAAC,MAAM,EAAE;YACvC,IAAI,EAAE,WAAW,EAAE;YACnB,WAAW,EAAE,aAAa,CAAC,IAAI;SAChC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application-wide constants
|
|
3
|
+
* Centralizes all magic numbers and hardcoded values for easy maintenance
|
|
4
|
+
*/
|
|
5
|
+
export declare const PAGINATION: {
|
|
6
|
+
readonly CONFLUENCE_DEFAULT_LIMIT: 25;
|
|
7
|
+
readonly JIRA_DEFAULT_LIMIT: 50;
|
|
8
|
+
readonly BITBUCKET_DEFAULT_LIMIT: 10;
|
|
9
|
+
readonly USER_SEARCH_LIMIT: 10;
|
|
10
|
+
};
|
|
11
|
+
export declare const DEFAULTS: {
|
|
12
|
+
readonly BRANCH_NAME: "main";
|
|
13
|
+
readonly JIRA_ISSUE_TYPE: "Task";
|
|
14
|
+
readonly JIRA_DATE_FILTER: "-90d";
|
|
15
|
+
readonly BITBUCKET_ISSUE_KIND: "bug";
|
|
16
|
+
readonly BITBUCKET_ISSUE_PRIORITY: "major";
|
|
17
|
+
readonly BITBUCKET_PR_STATE: "OPEN";
|
|
18
|
+
readonly BITBUCKET_ISSUE_STATE: "open";
|
|
19
|
+
};
|
|
20
|
+
export declare const API_ENDPOINTS: {
|
|
21
|
+
readonly CONFLUENCE_CONTENT: "/wiki/rest/api/content";
|
|
22
|
+
readonly CONFLUENCE_CONTENT_SEARCH: "/wiki/rest/api/content/search";
|
|
23
|
+
readonly CONFLUENCE_SPACE: "/wiki/rest/api/space";
|
|
24
|
+
readonly JIRA_SEARCH: "/rest/api/3/search/jql";
|
|
25
|
+
readonly JIRA_ISSUE: "/rest/api/3/issue";
|
|
26
|
+
readonly JIRA_PROJECT: "/rest/api/3/project";
|
|
27
|
+
readonly JIRA_USER_SEARCH: "/rest/api/3/user/search";
|
|
28
|
+
readonly JIRA_ISSUE_LINK: "/rest/api/3/issueLink";
|
|
29
|
+
readonly JIRA_ISSUE_LINK_TYPE: "/rest/api/3/issueLinkType";
|
|
30
|
+
readonly JIRA_ATTACHMENT: "/rest/api/3/attachment";
|
|
31
|
+
readonly BITBUCKET_BASE_URL: "https://api.bitbucket.org/2.0";
|
|
32
|
+
};
|
|
33
|
+
export declare const CONFLUENCE_EXPAND: {
|
|
34
|
+
readonly PAGE_DEFAULT: readonly ["body.storage", "version", "space"];
|
|
35
|
+
readonly COMMENT_DEFAULT: readonly ["body.storage", "version", "history"];
|
|
36
|
+
};
|
|
37
|
+
export declare const JIRA_FIELDS: {
|
|
38
|
+
readonly SEARCH_FIELDS: "summary,description,status,assignee,created,updated";
|
|
39
|
+
readonly ISSUE_FIELDS: readonly ["summary", "description", "status", "assignee", "created", "updated"];
|
|
40
|
+
};
|
|
41
|
+
export declare const SERVICE_NAMES: {
|
|
42
|
+
readonly CONFLUENCE: "Confluence";
|
|
43
|
+
readonly JIRA: "Jira";
|
|
44
|
+
readonly BITBUCKET: "Bitbucket";
|
|
45
|
+
readonly ATLASSIAN: "Atlassian";
|
|
46
|
+
};
|
|
47
|
+
export declare const ERROR_MESSAGES: {
|
|
48
|
+
readonly MISSING_FILE_INPUT: "Either filePath or fileContent must be provided";
|
|
49
|
+
readonly FILE_NOT_FOUND: (path: string) => string;
|
|
50
|
+
readonly UNKNOWN_TOOL: (name: string) => string;
|
|
51
|
+
};
|
|
52
|
+
export declare const ICONS: {
|
|
53
|
+
readonly SUCCESS: "✅";
|
|
54
|
+
readonly ERROR: "❌";
|
|
55
|
+
readonly SUGGESTION: "💡";
|
|
56
|
+
readonly TICKET: "🎫";
|
|
57
|
+
readonly SUMMARY: "📝";
|
|
58
|
+
readonly STATUS: "📊";
|
|
59
|
+
readonly DATE: "📅";
|
|
60
|
+
readonly DESCRIPTION: "📄";
|
|
61
|
+
readonly LINK: "🔗";
|
|
62
|
+
readonly PRIORITY: "🔥";
|
|
63
|
+
readonly LABELS: "🏷️";
|
|
64
|
+
readonly COMPONENTS: "🧩";
|
|
65
|
+
readonly ASSIGNEE: "👤";
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAGX,eAAO,MAAM,QAAQ;;;;;;;;CAQX,CAAC;AAGX,eAAO,MAAM,aAAa;;;;;;;;;;;;CAiBhB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAGX,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAGX,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAGX,eAAO,MAAM,cAAc;;oCAEF,MAAM;kCACR,MAAM;CACnB,CAAC;AAGX,eAAO,MAAM,KAAK;;;;;;;;;;;;;;CAcR,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application-wide constants
|
|
3
|
+
* Centralizes all magic numbers and hardcoded values for easy maintenance
|
|
4
|
+
*/
|
|
5
|
+
// Pagination defaults
|
|
6
|
+
export const PAGINATION = {
|
|
7
|
+
CONFLUENCE_DEFAULT_LIMIT: 25,
|
|
8
|
+
JIRA_DEFAULT_LIMIT: 50,
|
|
9
|
+
BITBUCKET_DEFAULT_LIMIT: 10,
|
|
10
|
+
USER_SEARCH_LIMIT: 10,
|
|
11
|
+
};
|
|
12
|
+
// Default values
|
|
13
|
+
export const DEFAULTS = {
|
|
14
|
+
BRANCH_NAME: 'main',
|
|
15
|
+
JIRA_ISSUE_TYPE: 'Task',
|
|
16
|
+
JIRA_DATE_FILTER: '-90d',
|
|
17
|
+
BITBUCKET_ISSUE_KIND: 'bug',
|
|
18
|
+
BITBUCKET_ISSUE_PRIORITY: 'major',
|
|
19
|
+
BITBUCKET_PR_STATE: 'OPEN',
|
|
20
|
+
BITBUCKET_ISSUE_STATE: 'open',
|
|
21
|
+
};
|
|
22
|
+
// API endpoints
|
|
23
|
+
export const API_ENDPOINTS = {
|
|
24
|
+
// Confluence
|
|
25
|
+
CONFLUENCE_CONTENT: '/wiki/rest/api/content',
|
|
26
|
+
CONFLUENCE_CONTENT_SEARCH: '/wiki/rest/api/content/search',
|
|
27
|
+
CONFLUENCE_SPACE: '/wiki/rest/api/space',
|
|
28
|
+
// Jira
|
|
29
|
+
JIRA_SEARCH: '/rest/api/3/search/jql',
|
|
30
|
+
JIRA_ISSUE: '/rest/api/3/issue',
|
|
31
|
+
JIRA_PROJECT: '/rest/api/3/project',
|
|
32
|
+
JIRA_USER_SEARCH: '/rest/api/3/user/search',
|
|
33
|
+
JIRA_ISSUE_LINK: '/rest/api/3/issueLink',
|
|
34
|
+
JIRA_ISSUE_LINK_TYPE: '/rest/api/3/issueLinkType',
|
|
35
|
+
JIRA_ATTACHMENT: '/rest/api/3/attachment',
|
|
36
|
+
// Bitbucket
|
|
37
|
+
BITBUCKET_BASE_URL: 'https://api.bitbucket.org/2.0',
|
|
38
|
+
};
|
|
39
|
+
// Confluence expand options
|
|
40
|
+
export const CONFLUENCE_EXPAND = {
|
|
41
|
+
PAGE_DEFAULT: ['body.storage', 'version', 'space'],
|
|
42
|
+
COMMENT_DEFAULT: ['body.storage', 'version', 'history'],
|
|
43
|
+
};
|
|
44
|
+
// Jira field defaults
|
|
45
|
+
export const JIRA_FIELDS = {
|
|
46
|
+
SEARCH_FIELDS: 'summary,description,status,assignee,created,updated',
|
|
47
|
+
ISSUE_FIELDS: ['summary', 'description', 'status', 'assignee', 'created', 'updated'],
|
|
48
|
+
};
|
|
49
|
+
// Service names for logging
|
|
50
|
+
export const SERVICE_NAMES = {
|
|
51
|
+
CONFLUENCE: 'Confluence',
|
|
52
|
+
JIRA: 'Jira',
|
|
53
|
+
BITBUCKET: 'Bitbucket',
|
|
54
|
+
ATLASSIAN: 'Atlassian',
|
|
55
|
+
};
|
|
56
|
+
// Error messages
|
|
57
|
+
export const ERROR_MESSAGES = {
|
|
58
|
+
MISSING_FILE_INPUT: 'Either filePath or fileContent must be provided',
|
|
59
|
+
FILE_NOT_FOUND: (path) => `File not found: ${path}`,
|
|
60
|
+
UNKNOWN_TOOL: (name) => `Unknown tool: ${name}`,
|
|
61
|
+
};
|
|
62
|
+
// Success icons for formatted responses
|
|
63
|
+
export const ICONS = {
|
|
64
|
+
SUCCESS: '✅',
|
|
65
|
+
ERROR: '❌',
|
|
66
|
+
SUGGESTION: '💡',
|
|
67
|
+
TICKET: '🎫',
|
|
68
|
+
SUMMARY: '📝',
|
|
69
|
+
STATUS: '📊',
|
|
70
|
+
DATE: '📅',
|
|
71
|
+
DESCRIPTION: '📄',
|
|
72
|
+
LINK: '🔗',
|
|
73
|
+
PRIORITY: '🔥',
|
|
74
|
+
LABELS: '🏷️',
|
|
75
|
+
COMPONENTS: '🧩',
|
|
76
|
+
ASSIGNEE: '👤',
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AACtB,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,wBAAwB,EAAE,EAAE;IAC5B,kBAAkB,EAAE,EAAE;IACtB,uBAAuB,EAAE,EAAE;IAC3B,iBAAiB,EAAE,EAAE;CACb,CAAC;AAEX,iBAAiB;AACjB,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,MAAM;IACvB,gBAAgB,EAAE,MAAM;IACxB,oBAAoB,EAAE,KAAK;IAC3B,wBAAwB,EAAE,OAAO;IAC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C/C,CAAC;AAEX,wCAAwC;AACxC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;IACV,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,IAAI;CACN,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard MCP tool response type
|
|
3
|
+
*/
|
|
4
|
+
export interface ToolResponse {
|
|
5
|
+
content: Array<{
|
|
6
|
+
type: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}>;
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Error context for building informative error messages
|
|
13
|
+
*/
|
|
14
|
+
export interface ErrorContext {
|
|
15
|
+
operation: string;
|
|
16
|
+
params?: Record<string, any>;
|
|
17
|
+
tip?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates a successful response with text content
|
|
21
|
+
*/
|
|
22
|
+
export declare function successResponse(text: string): ToolResponse;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a successful response with JSON content
|
|
25
|
+
*/
|
|
26
|
+
export declare function jsonResponse(data: any): ToolResponse;
|
|
27
|
+
/**
|
|
28
|
+
* Creates an error response with detailed information
|
|
29
|
+
*/
|
|
30
|
+
export declare function errorResponse(error: any, context: ErrorContext): ToolResponse;
|
|
31
|
+
/**
|
|
32
|
+
* Wraps an async operation with standardized error handling
|
|
33
|
+
*/
|
|
34
|
+
export declare function withErrorHandling<T>(operation: () => Promise<T>, context: ErrorContext, formatResult: (result: T) => ToolResponse): Promise<ToolResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Common error tips for different scenarios
|
|
37
|
+
*/
|
|
38
|
+
export declare const ERROR_TIPS: {
|
|
39
|
+
readonly CONFLUENCE_SEARCH: "Check your Confluence permissions and that the domain is accessible.";
|
|
40
|
+
readonly CONFLUENCE_PAGE_VIEW: "Check if the page ID exists and you have permission to view it.";
|
|
41
|
+
readonly CONFLUENCE_PAGE_CREATE: "Check if the space exists and you have permission to create pages in it.";
|
|
42
|
+
readonly CONFLUENCE_PAGE_EDIT: "Check if the page exists, version is correct, and you have permission to edit it.";
|
|
43
|
+
readonly CONFLUENCE_SPACE: "Check your Confluence permissions and API access.";
|
|
44
|
+
readonly CONFLUENCE_ATTACHMENT: "Check if the page exists and you have permission to attach files.";
|
|
45
|
+
readonly CONFLUENCE_COMMENT: "Check if the page/comment exists and you have the appropriate permissions.";
|
|
46
|
+
readonly JIRA_SEARCH: "Check your JQL syntax and Jira permissions.";
|
|
47
|
+
readonly JIRA_ISSUE_VIEW: "Check if the issue key exists and you have permission to view it.";
|
|
48
|
+
readonly JIRA_ISSUE_CREATE: "Check if all required fields are provided and project exists.";
|
|
49
|
+
readonly JIRA_ISSUE_EDIT: "Check if the issue exists and you have permission to update it.";
|
|
50
|
+
readonly JIRA_COMMENT: "Check if the issue/comment exists and you have the appropriate permissions.";
|
|
51
|
+
readonly JIRA_TRANSITION: "Check if the transition ID is valid for this issue and you have permission to transition it.";
|
|
52
|
+
readonly JIRA_ATTACHMENT: "Check if the issue exists and file content is properly base64 encoded.";
|
|
53
|
+
readonly JIRA_LINK: "Check if both issues exist and the link type is valid. Use jira_get_link_types to see available link types.";
|
|
54
|
+
readonly JIRA_WORKLOG: "Check if the issue/worklog exists and you have permission.";
|
|
55
|
+
readonly JIRA_WATCHER: "Check if the issue and user exist, and you have permission.";
|
|
56
|
+
readonly JIRA_SUBTASK: "Check if the parent issue exists, the project allows sub-tasks, and you have permission to create issues.";
|
|
57
|
+
readonly JIRA_AGILE: "Check that the board exists and you have permission to view it. Agile boards require a Jira Software license.";
|
|
58
|
+
readonly JIRA_BATCH: "Check that all issues have valid project keys, required fields, and you have permission to create issues. Max 50 issues per request.";
|
|
59
|
+
readonly JIRA_DEV_STATUS: "Check that the issue ID is numeric (not the key) and a dev tool integration (GitHub, Bitbucket, etc.) is connected.";
|
|
60
|
+
readonly JIRA_DELETE: "Check if the issue exists and you have permission to delete it. Issues with subtasks require deleteSubtasks=true.";
|
|
61
|
+
readonly CONFLUENCE_LABEL: "Check if the page exists and you have permission to manage labels.";
|
|
62
|
+
readonly CONFLUENCE_DELETE: "Check if the page exists and you have permission to delete it. Pages with children may require special handling.";
|
|
63
|
+
readonly BITBUCKET_REPO: "Check your Bitbucket permissions and API access.";
|
|
64
|
+
readonly BITBUCKET_REPO_VIEW: "Check if the repository exists and you have access to it.";
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Format helpers for common response patterns
|
|
68
|
+
*/
|
|
69
|
+
export declare const formatHelpers: {
|
|
70
|
+
/**
|
|
71
|
+
* Format a success message with optional details
|
|
72
|
+
*/
|
|
73
|
+
success(message: string, details?: Record<string, any>): string;
|
|
74
|
+
/**
|
|
75
|
+
* Format an issue creation success message
|
|
76
|
+
*/
|
|
77
|
+
issueCreated(issue: any, optionalFields?: Record<string, any>): string;
|
|
78
|
+
/**
|
|
79
|
+
* Format an issue update success message
|
|
80
|
+
*/
|
|
81
|
+
issueUpdated(issue: any, updatedFields: string[]): string;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../src/error-handler.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAI1D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,YAAY,CAIpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CAsB7E;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,YAAY,GACxC,OAAO,CAAC,YAAY,CAAC,CAOvB;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;qBACc,MAAM,YAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAU/D;;OAEG;wBACiB,GAAG,mBAAmB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAsBtE;;OAEG;wBACiB,GAAG,iBAAiB,MAAM,EAAE,GAAG,MAAM;CAe1D,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ICONS } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a successful response with text content
|
|
4
|
+
*/
|
|
5
|
+
export function successResponse(text) {
|
|
6
|
+
return {
|
|
7
|
+
content: [{ type: 'text', text }],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates a successful response with JSON content
|
|
12
|
+
*/
|
|
13
|
+
export function jsonResponse(data) {
|
|
14
|
+
return {
|
|
15
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates an error response with detailed information
|
|
20
|
+
*/
|
|
21
|
+
export function errorResponse(error, context) {
|
|
22
|
+
const errorDetails = error.response?.data || error.message;
|
|
23
|
+
const paramsText = context.params
|
|
24
|
+
? Object.entries(context.params)
|
|
25
|
+
.map(([key, value]) => `- ${key}: ${value ?? 'none'}`)
|
|
26
|
+
.join('\n')
|
|
27
|
+
: '';
|
|
28
|
+
let text = `${ICONS.ERROR} ${context.operation}\n\n**Error Details:**\n${JSON.stringify(errorDetails, null, 2)}`;
|
|
29
|
+
if (paramsText) {
|
|
30
|
+
text += `\n\n**Request:**\n${paramsText}`;
|
|
31
|
+
}
|
|
32
|
+
if (context.tip) {
|
|
33
|
+
text += `\n\n**Tip:** ${context.tip}`;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: 'text', text }],
|
|
37
|
+
isError: true,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Wraps an async operation with standardized error handling
|
|
42
|
+
*/
|
|
43
|
+
export async function withErrorHandling(operation, context, formatResult) {
|
|
44
|
+
try {
|
|
45
|
+
const result = await operation();
|
|
46
|
+
return formatResult(result);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return errorResponse(error, context);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Common error tips for different scenarios
|
|
54
|
+
*/
|
|
55
|
+
export const ERROR_TIPS = {
|
|
56
|
+
// Confluence
|
|
57
|
+
CONFLUENCE_SEARCH: 'Check your Confluence permissions and that the domain is accessible.',
|
|
58
|
+
CONFLUENCE_PAGE_VIEW: 'Check if the page ID exists and you have permission to view it.',
|
|
59
|
+
CONFLUENCE_PAGE_CREATE: 'Check if the space exists and you have permission to create pages in it.',
|
|
60
|
+
CONFLUENCE_PAGE_EDIT: 'Check if the page exists, version is correct, and you have permission to edit it.',
|
|
61
|
+
CONFLUENCE_SPACE: 'Check your Confluence permissions and API access.',
|
|
62
|
+
CONFLUENCE_ATTACHMENT: 'Check if the page exists and you have permission to attach files.',
|
|
63
|
+
CONFLUENCE_COMMENT: 'Check if the page/comment exists and you have the appropriate permissions.',
|
|
64
|
+
// Jira
|
|
65
|
+
JIRA_SEARCH: 'Check your JQL syntax and Jira permissions.',
|
|
66
|
+
JIRA_ISSUE_VIEW: 'Check if the issue key exists and you have permission to view it.',
|
|
67
|
+
JIRA_ISSUE_CREATE: 'Check if all required fields are provided and project exists.',
|
|
68
|
+
JIRA_ISSUE_EDIT: 'Check if the issue exists and you have permission to update it.',
|
|
69
|
+
JIRA_COMMENT: 'Check if the issue/comment exists and you have the appropriate permissions.',
|
|
70
|
+
JIRA_TRANSITION: 'Check if the transition ID is valid for this issue and you have permission to transition it.',
|
|
71
|
+
JIRA_ATTACHMENT: 'Check if the issue exists and file content is properly base64 encoded.',
|
|
72
|
+
JIRA_LINK: 'Check if both issues exist and the link type is valid. Use jira_get_link_types to see available link types.',
|
|
73
|
+
JIRA_WORKLOG: 'Check if the issue/worklog exists and you have permission.',
|
|
74
|
+
JIRA_WATCHER: 'Check if the issue and user exist, and you have permission.',
|
|
75
|
+
JIRA_SUBTASK: 'Check if the parent issue exists, the project allows sub-tasks, and you have permission to create issues.',
|
|
76
|
+
JIRA_AGILE: 'Check that the board exists and you have permission to view it. Agile boards require a Jira Software license.',
|
|
77
|
+
JIRA_BATCH: 'Check that all issues have valid project keys, required fields, and you have permission to create issues. Max 50 issues per request.',
|
|
78
|
+
JIRA_DEV_STATUS: 'Check that the issue ID is numeric (not the key) and a dev tool integration (GitHub, Bitbucket, etc.) is connected.',
|
|
79
|
+
JIRA_DELETE: 'Check if the issue exists and you have permission to delete it. Issues with subtasks require deleteSubtasks=true.',
|
|
80
|
+
CONFLUENCE_LABEL: 'Check if the page exists and you have permission to manage labels.',
|
|
81
|
+
CONFLUENCE_DELETE: 'Check if the page exists and you have permission to delete it. Pages with children may require special handling.',
|
|
82
|
+
// Bitbucket
|
|
83
|
+
BITBUCKET_REPO: 'Check your Bitbucket permissions and API access.',
|
|
84
|
+
BITBUCKET_REPO_VIEW: 'Check if the repository exists and you have access to it.',
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Format helpers for common response patterns
|
|
88
|
+
*/
|
|
89
|
+
export const formatHelpers = {
|
|
90
|
+
/**
|
|
91
|
+
* Format a success message with optional details
|
|
92
|
+
*/
|
|
93
|
+
success(message, details) {
|
|
94
|
+
let text = `${ICONS.SUCCESS} ${message}`;
|
|
95
|
+
if (details) {
|
|
96
|
+
text += '\n\n' + Object.entries(details)
|
|
97
|
+
.map(([key, value]) => `**${key}:** ${value}`)
|
|
98
|
+
.join('\n');
|
|
99
|
+
}
|
|
100
|
+
return text;
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Format an issue creation success message
|
|
104
|
+
*/
|
|
105
|
+
issueCreated(issue, optionalFields) {
|
|
106
|
+
const domain = process.env.JIRA_DOMAIN || process.env.ATLASSIAN_DOMAIN || 'your-domain.atlassian.net';
|
|
107
|
+
let text = `${ICONS.SUCCESS} **Jira Issue Created Successfully**
|
|
108
|
+
|
|
109
|
+
${ICONS.TICKET} **Issue Key:** ${issue.key}
|
|
110
|
+
${ICONS.SUMMARY} **Summary:** ${issue.summary}
|
|
111
|
+
${ICONS.STATUS} **Status:** ${issue.status}
|
|
112
|
+
${ICONS.DATE} **Created:** ${new Date(issue.created).toLocaleString()}`;
|
|
113
|
+
if (optionalFields) {
|
|
114
|
+
const fieldLines = Object.entries(optionalFields)
|
|
115
|
+
.filter(([_, value]) => value)
|
|
116
|
+
.map(([key, value]) => `${key}: ${value}`);
|
|
117
|
+
if (fieldLines.length > 0) {
|
|
118
|
+
text += '\n\n' + fieldLines.join('\n');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
text += `\n\n${ICONS.LINK} **Issue URL:** [View Issue](https://${domain}/browse/${issue.key})`;
|
|
122
|
+
return text;
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Format an issue update success message
|
|
126
|
+
*/
|
|
127
|
+
issueUpdated(issue, updatedFields) {
|
|
128
|
+
const domain = process.env.JIRA_DOMAIN || process.env.ATLASSIAN_DOMAIN || 'your-domain.atlassian.net';
|
|
129
|
+
let text = `${ICONS.SUCCESS} **Jira Issue Updated Successfully**
|
|
130
|
+
|
|
131
|
+
${ICONS.TICKET} **Issue Key:** ${issue.key}
|
|
132
|
+
${ICONS.STATUS} **Current Status:** ${issue.status}
|
|
133
|
+
${ICONS.DATE} **Last Updated:** ${new Date(issue.updated).toLocaleString()}`;
|
|
134
|
+
if (updatedFields.length > 0) {
|
|
135
|
+
text += `\n\n**Updated Fields:**\n${updatedFields.join('\n')}`;
|
|
136
|
+
}
|
|
137
|
+
text += `\n\n${ICONS.LINK} **Issue URL:** [View Issue](https://${domain}/browse/${issue.key})`;
|
|
138
|
+
return text;
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../src/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAmBvC;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAS;IACpC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,E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