@jagadeesh52423/atlassian-mcp-server 1.1.2 → 1.3.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/.env.example +6 -1
- package/README.md +154 -395
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +0 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -5
- package/dist/constants.js.map +1 -1
- package/dist/formatters/adf-formatter.d.ts +5 -2
- package/dist/formatters/adf-formatter.d.ts.map +1 -1
- package/dist/formatters/adf-formatter.js +271 -52
- package/dist/formatters/adf-formatter.js.map +1 -1
- package/dist/formatters/adf-to-text.d.ts +9 -0
- package/dist/formatters/adf-to-text.d.ts.map +1 -0
- package/dist/formatters/adf-to-text.js +25 -0
- package/dist/formatters/adf-to-text.js.map +1 -0
- package/dist/formatters/index.d.ts +7 -1
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +7 -1
- package/dist/formatters/index.js.map +1 -1
- package/dist/formatters/markdown-to-adf.d.ts +6 -0
- package/dist/formatters/markdown-to-adf.d.ts.map +1 -0
- package/dist/formatters/markdown-to-adf.js +27 -0
- package/dist/formatters/markdown-to-adf.js.map +1 -0
- package/dist/handlers/bitbucket-handlers.d.ts +7 -0
- package/dist/handlers/bitbucket-handlers.d.ts.map +1 -1
- package/dist/handlers/bitbucket-handlers.js +20 -0
- package/dist/handlers/bitbucket-handlers.js.map +1 -1
- package/dist/handlers/confluence-handlers.d.ts +2 -0
- package/dist/handlers/confluence-handlers.d.ts.map +1 -1
- package/dist/handlers/confluence-handlers.js +2 -2
- package/dist/handlers/confluence-handlers.js.map +1 -1
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/services/bitbucket.d.ts +5 -0
- package/dist/services/bitbucket.d.ts.map +1 -1
- package/dist/services/bitbucket.js +23 -4
- package/dist/services/bitbucket.js.map +1 -1
- package/dist/services/confluence.d.ts +79 -12
- package/dist/services/confluence.d.ts.map +1 -1
- package/dist/services/confluence.js +291 -310
- package/dist/services/confluence.js.map +1 -1
- package/dist/services/jira/base.d.ts +0 -1
- package/dist/services/jira/base.d.ts.map +1 -1
- package/dist/services/jira/base.js +2 -3
- package/dist/services/jira/base.js.map +1 -1
- package/dist/snapshot/decorators/bitbucket-snapshots.d.ts +4 -0
- package/dist/snapshot/decorators/bitbucket-snapshots.d.ts.map +1 -0
- package/dist/snapshot/decorators/bitbucket-snapshots.js +65 -0
- package/dist/snapshot/decorators/bitbucket-snapshots.js.map +1 -0
- package/dist/snapshot/decorators/confluence-snapshots.d.ts +4 -0
- package/dist/snapshot/decorators/confluence-snapshots.d.ts.map +1 -0
- package/dist/snapshot/decorators/confluence-snapshots.js +71 -0
- package/dist/snapshot/decorators/confluence-snapshots.js.map +1 -0
- package/dist/snapshot/decorators/jira-snapshots.d.ts +4 -0
- package/dist/snapshot/decorators/jira-snapshots.d.ts.map +1 -0
- package/dist/snapshot/decorators/jira-snapshots.js +171 -0
- package/dist/snapshot/decorators/jira-snapshots.js.map +1 -0
- package/dist/snapshot/index.d.ts +7 -0
- package/dist/snapshot/index.d.ts.map +1 -0
- package/dist/snapshot/index.js +7 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/snapshot/snapshot-decorator.d.ts +4 -0
- package/dist/snapshot/snapshot-decorator.d.ts.map +1 -0
- package/dist/snapshot/snapshot-decorator.js +74 -0
- package/dist/snapshot/snapshot-decorator.js.map +1 -0
- package/dist/snapshot/snapshot-manager.d.ts +9 -0
- package/dist/snapshot/snapshot-manager.d.ts.map +1 -0
- package/dist/snapshot/snapshot-manager.js +56 -0
- package/dist/snapshot/snapshot-manager.js.map +1 -0
- package/dist/snapshot/snapshot-types.d.ts +26 -0
- package/dist/snapshot/snapshot-types.d.ts.map +1 -0
- package/dist/snapshot/snapshot-types.js +2 -0
- package/dist/snapshot/snapshot-types.js.map +1 -0
- package/dist/tools/bitbucket-tools.d.ts.map +1 -1
- package/dist/tools/bitbucket-tools.js +30 -0
- package/dist/tools/bitbucket-tools.js.map +1 -1
- package/dist/tools/confluence-tools.d.ts.map +1 -1
- package/dist/tools/confluence-tools.js +17 -12
- package/dist/tools/confluence-tools.js.map +1 -1
- package/dist/types.d.ts +50 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -2
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ConfluenceConfig, JiraConfig, AtlassianConfig, BitbucketConfig } from './types.js';
|
|
1
|
+
import { ConfluenceConfig, JiraConfig, AtlassianConfig, BitbucketConfig, SnapshotConfig } from './types.js';
|
|
2
2
|
export declare const confluenceConfig: ConfluenceConfig;
|
|
3
3
|
export declare const jiraConfig: JiraConfig;
|
|
4
4
|
export declare const atlassianConfig: AtlassianConfig;
|
|
5
5
|
export declare const bitbucketConfig: BitbucketConfig;
|
|
6
|
+
export declare const snapshotConfig: SnapshotConfig;
|
|
6
7
|
export declare function validateConfig(): void;
|
|
7
8
|
export declare function getConfluenceAuth(): string;
|
|
8
9
|
export declare function getJiraAuth(): string;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5G,eAAO,MAAM,gBAAgB,EAAE,gBAI9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAMxB,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,eAM7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAI7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC;AAEF,wBAAgB,cAAc,IAAI,IAAI,CAmBrC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAKzC;AAGD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import dotenv from 'dotenv';
|
|
2
|
+
import * as os from 'os';
|
|
3
|
+
import * as path from 'path';
|
|
2
4
|
dotenv.config();
|
|
3
5
|
export const confluenceConfig = {
|
|
4
6
|
domain: process.env.CONFLUENCE_DOMAIN || process.env.ATLASSIAN_DOMAIN || '',
|
|
@@ -25,6 +27,11 @@ export const bitbucketConfig = {
|
|
|
25
27
|
username: process.env.BITBUCKET_USERNAME || '',
|
|
26
28
|
apiToken: process.env.BITBUCKET_API_TOKEN || '',
|
|
27
29
|
};
|
|
30
|
+
export const snapshotConfig = {
|
|
31
|
+
enabled: process.env.MCP_SNAPSHOTS_ENABLED !== 'false',
|
|
32
|
+
dir: process.env.MCP_SNAPSHOT_DIR || path.join(os.homedir(), '.atlassian-mcp-snapshots'),
|
|
33
|
+
retentionDays: parseInt(process.env.MCP_SNAPSHOT_RETENTION_DAYS || '30', 10),
|
|
34
|
+
};
|
|
28
35
|
export function validateConfig() {
|
|
29
36
|
const errors = [];
|
|
30
37
|
// Check if we have at least one service configured
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MA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.ts
CHANGED
|
@@ -30,10 +30,6 @@ export declare const API_ENDPOINTS: {
|
|
|
30
30
|
readonly JIRA_ATTACHMENT: "/rest/api/3/attachment";
|
|
31
31
|
readonly BITBUCKET_BASE_URL: "https://api.bitbucket.org/2.0";
|
|
32
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
33
|
export declare const JIRA_FIELDS: {
|
|
38
34
|
readonly SEARCH_FIELDS: "summary,description,status,assignee,created,updated";
|
|
39
35
|
readonly ISSUE_FIELDS: readonly ["summary", "description", "status", "assignee", "created", "updated"];
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,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"}
|
package/dist/constants.js
CHANGED
|
@@ -36,11 +36,6 @@ export const API_ENDPOINTS = {
|
|
|
36
36
|
// Bitbucket
|
|
37
37
|
BITBUCKET_BASE_URL: 'https://api.bitbucket.org/2.0',
|
|
38
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
39
|
// Jira field defaults
|
|
45
40
|
export const JIRA_FIELDS = {
|
|
46
41
|
SEARCH_FIELDS: 'summary,description,status,assignee,created,updated',
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +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;IACjC,kBAAkB,EAAE,MAAM;IAC1B,qBAAqB,EAAE,MAAM;CACrB,CAAC;AAEX,gBAAgB;AAChB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa;IACb,kBAAkB,EAAE,wBAAwB;IAC5C,yBAAyB,EAAE,+BAA+B;IAC1D,gBAAgB,EAAE,sBAAsB;IAExC,OAAO;IACP,WAAW,EAAE,wBAAwB;IACrC,UAAU,EAAE,mBAAmB;IAC/B,YAAY,EAAE,qBAAqB;IACnC,gBAAgB,EAAE,yBAAyB;IAC3C,eAAe,EAAE,uBAAuB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;AAC5B,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;CACd,CAAC;AAEX,iBAAiB;AACjB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB,EAAE,iDAAiD;IACrE,cAAc,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,mBAAmB,IAAI,EAAE;IAC3D,YAAY,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,iBAAiB,IAAI,EAAE;CAC/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"}
|
|
@@ -25,10 +25,13 @@ export declare function extractTextFromADF(body: any): string;
|
|
|
25
25
|
export declare function formatWikiMarkup(text: string): string;
|
|
26
26
|
/**
|
|
27
27
|
* Parses inline formatting like **bold**, *italic*, `code`, {{code}}
|
|
28
|
+
* When wikiMode is true, single *text* is treated as bold (wiki convention).
|
|
29
|
+
* Also handles [text|url] wiki links and [text](url) markdown links.
|
|
28
30
|
*/
|
|
29
|
-
export declare function parseInlineFormatting(text: string): any[];
|
|
31
|
+
export declare function parseInlineFormatting(text: string, wikiMode?: boolean): any[];
|
|
30
32
|
/**
|
|
31
|
-
* Enhanced description parser that converts text to proper ADF format
|
|
33
|
+
* Enhanced description parser that converts text to proper ADF format.
|
|
34
|
+
* Auto-detects wiki markup vs markdown and adjusts parsing accordingly.
|
|
32
35
|
*/
|
|
33
36
|
export declare function parseDescriptionToADF(description: string): any;
|
|
34
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adf-formatter.d.ts","sourceRoot":"","sources":["../../src/formatters/adf-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"adf-formatter.d.ts","sourceRoot":"","sources":["../../src/formatters/adf-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyLH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAKpD;AAqDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqErD;AAqBD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAe,GAAG,GAAG,EAAE,CAwKpF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG,CA0Y9D;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6HxE;AA0DD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2HpE"}
|
|
@@ -23,6 +23,72 @@ function normalizeCodeLanguage(lang) {
|
|
|
23
23
|
const lower = lang.toLowerCase();
|
|
24
24
|
return LANGUAGE_ALIASES[lower] ?? lower;
|
|
25
25
|
}
|
|
26
|
+
const TABLE_TOTAL_WIDTH_PX = 760;
|
|
27
|
+
const TABLE_MIN_COL_WIDTH_PX = 60;
|
|
28
|
+
const TABLE_MAX_COL_WIDTH_PX = 400;
|
|
29
|
+
function extractCellText(cell) {
|
|
30
|
+
const para = cell?.content?.[0];
|
|
31
|
+
if (!para?.content)
|
|
32
|
+
return '';
|
|
33
|
+
return para.content.map((n) => n.text ?? '').join('');
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sets attrs.colwidth on every cell so Confluence renders columns proportional
|
|
37
|
+
* to their max content length, clamped to [TABLE_MIN_COL_WIDTH_PX, TABLE_MAX_COL_WIDTH_PX].
|
|
38
|
+
*/
|
|
39
|
+
function applyColWidths(tableRows) {
|
|
40
|
+
if (!tableRows.length)
|
|
41
|
+
return;
|
|
42
|
+
const numCols = Math.max(...tableRows.map(r => r.content?.length ?? 0));
|
|
43
|
+
if (numCols === 0)
|
|
44
|
+
return;
|
|
45
|
+
const maxLens = new Array(numCols).fill(1);
|
|
46
|
+
for (const row of tableRows) {
|
|
47
|
+
row.content?.forEach((cell, idx) => {
|
|
48
|
+
const len = extractCellText(cell).length || 1;
|
|
49
|
+
if (len > maxLens[idx])
|
|
50
|
+
maxLens[idx] = len;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const totalLen = maxLens.reduce((a, b) => a + b, 0) || 1;
|
|
54
|
+
const widths = maxLens.map((len) => {
|
|
55
|
+
const proportional = (len / totalLen) * TABLE_TOTAL_WIDTH_PX;
|
|
56
|
+
return Math.round(Math.min(TABLE_MAX_COL_WIDTH_PX, Math.max(TABLE_MIN_COL_WIDTH_PX, proportional)));
|
|
57
|
+
});
|
|
58
|
+
for (const row of tableRows) {
|
|
59
|
+
row.content?.forEach((cell, idx) => {
|
|
60
|
+
cell.attrs = { ...(cell.attrs ?? {}), colwidth: [widths[idx]] };
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const STORAGE_TABLE_MIN_PCT = 5;
|
|
65
|
+
/**
|
|
66
|
+
* Builds a Confluence storage-format <colgroup> sized proportionally to the
|
|
67
|
+
* max content length per column. Returns '' for empty/single-column input.
|
|
68
|
+
*/
|
|
69
|
+
function buildColGroupHtml(tableRows) {
|
|
70
|
+
if (!tableRows.length)
|
|
71
|
+
return '';
|
|
72
|
+
const numCols = Math.max(...tableRows.map(r => r.length));
|
|
73
|
+
if (numCols < 2)
|
|
74
|
+
return '';
|
|
75
|
+
const maxLens = new Array(numCols).fill(1);
|
|
76
|
+
for (const row of tableRows) {
|
|
77
|
+
row.forEach((cell, idx) => {
|
|
78
|
+
const len = (cell ?? '').length || 1;
|
|
79
|
+
if (len > maxLens[idx])
|
|
80
|
+
maxLens[idx] = len;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const totalLen = maxLens.reduce((a, b) => a + b, 0) || 1;
|
|
84
|
+
const raw = maxLens.map((len) => Math.max(STORAGE_TABLE_MIN_PCT, (len / totalLen) * 100));
|
|
85
|
+
const sum = raw.reduce((a, b) => a + b, 0);
|
|
86
|
+
const normalized = raw.map((p) => (p / sum) * 100);
|
|
87
|
+
const cols = normalized
|
|
88
|
+
.map((p) => `<col style="width: ${p.toFixed(1)}%;" />`)
|
|
89
|
+
.join('');
|
|
90
|
+
return `<colgroup>${cols}</colgroup>`;
|
|
91
|
+
}
|
|
26
92
|
/**
|
|
27
93
|
* Recursively converts a single ADF node to plain text.
|
|
28
94
|
* Mirrors sooperset's adf_to_text recursive approach:
|
|
@@ -243,10 +309,34 @@ export function formatWikiMarkup(text) {
|
|
|
243
309
|
});
|
|
244
310
|
return text.trim();
|
|
245
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Detects whether the given text uses Jira/Confluence wiki markup rather than markdown.
|
|
314
|
+
* Returns true if any wiki-specific patterns are found.
|
|
315
|
+
*/
|
|
316
|
+
function isWikiMarkup(text) {
|
|
317
|
+
// h1. through h6. headings at line start
|
|
318
|
+
if (/^h[1-6]\.\s/m.test(text))
|
|
319
|
+
return true;
|
|
320
|
+
// {code} or {code:lang} blocks
|
|
321
|
+
if (/\{code[}:]/.test(text))
|
|
322
|
+
return true;
|
|
323
|
+
// [text|url] wiki links — pipe inside brackets is unambiguous wiki syntax
|
|
324
|
+
if (/\[[^\]\|]+\|[^\]]+\]/.test(text))
|
|
325
|
+
return true;
|
|
326
|
+
// ||header|| wiki table headers at line start
|
|
327
|
+
if (/^\|\|/m.test(text))
|
|
328
|
+
return true;
|
|
329
|
+
// {panel blocks
|
|
330
|
+
if (/\{panel/.test(text))
|
|
331
|
+
return true;
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
246
334
|
/**
|
|
247
335
|
* Parses inline formatting like **bold**, *italic*, `code`, {{code}}
|
|
336
|
+
* When wikiMode is true, single *text* is treated as bold (wiki convention).
|
|
337
|
+
* Also handles [text|url] wiki links and [text](url) markdown links.
|
|
248
338
|
*/
|
|
249
|
-
export function parseInlineFormatting(text) {
|
|
339
|
+
export function parseInlineFormatting(text, wikiMode = false) {
|
|
250
340
|
const result = [];
|
|
251
341
|
let currentPos = 0;
|
|
252
342
|
// Process patterns in order of precedence to avoid conflicts
|
|
@@ -258,18 +348,55 @@ export function parseInlineFormatting(text) {
|
|
|
258
348
|
{ regex: /\{\{(.+?)\}\}/g, type: 'code' }, // {{code}} (Confluence/Jira wiki style)
|
|
259
349
|
];
|
|
260
350
|
let matches = [];
|
|
261
|
-
//
|
|
351
|
+
// Process links FIRST to avoid conflicts with brackets and formatting markers
|
|
352
|
+
// Wiki links: [text|url]
|
|
353
|
+
const wikiLinkRegex = /\[([^\]\|]+)\|([^\]]+)\]/g;
|
|
354
|
+
let wikiLinkMatch;
|
|
355
|
+
while ((wikiLinkMatch = wikiLinkRegex.exec(text)) !== null) {
|
|
356
|
+
matches.push({
|
|
357
|
+
start: wikiLinkMatch.index,
|
|
358
|
+
end: wikiLinkMatch.index + wikiLinkMatch[0].length,
|
|
359
|
+
text: wikiLinkMatch[1],
|
|
360
|
+
type: 'link',
|
|
361
|
+
href: wikiLinkMatch[2],
|
|
362
|
+
fullMatch: wikiLinkMatch[0]
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
// Markdown links: [text](url)
|
|
366
|
+
const mdLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
367
|
+
let mdLinkMatch;
|
|
368
|
+
while ((mdLinkMatch = mdLinkRegex.exec(text)) !== null) {
|
|
369
|
+
// Only add if not overlapping with an already-found wiki link
|
|
370
|
+
const overlaps = matches.some(existing => (mdLinkMatch.index >= existing.start && mdLinkMatch.index < existing.end) ||
|
|
371
|
+
(mdLinkMatch.index + mdLinkMatch[0].length > existing.start && mdLinkMatch.index + mdLinkMatch[0].length <= existing.end));
|
|
372
|
+
if (!overlaps) {
|
|
373
|
+
matches.push({
|
|
374
|
+
start: mdLinkMatch.index,
|
|
375
|
+
end: mdLinkMatch.index + mdLinkMatch[0].length,
|
|
376
|
+
text: mdLinkMatch[1],
|
|
377
|
+
type: 'link',
|
|
378
|
+
href: mdLinkMatch[2],
|
|
379
|
+
fullMatch: mdLinkMatch[0]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
// Find all formatting matches (skip regions already claimed by links)
|
|
262
384
|
patterns.forEach(pattern => {
|
|
263
385
|
let match;
|
|
264
386
|
const regex = new RegExp(pattern.regex.source, 'g');
|
|
265
387
|
while ((match = regex.exec(text)) !== null) {
|
|
266
|
-
matches.
|
|
267
|
-
start
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
388
|
+
const overlapsLink = matches.some(existing => (match.index >= existing.start && match.index < existing.end) ||
|
|
389
|
+
(match.index + match[0].length > existing.start && match.index + match[0].length <= existing.end) ||
|
|
390
|
+
(match.index <= existing.start && match.index + match[0].length >= existing.end));
|
|
391
|
+
if (!overlapsLink) {
|
|
392
|
+
matches.push({
|
|
393
|
+
start: match.index,
|
|
394
|
+
end: match.index + match[0].length,
|
|
395
|
+
text: match[1],
|
|
396
|
+
type: pattern.type,
|
|
397
|
+
fullMatch: match[0]
|
|
398
|
+
});
|
|
399
|
+
}
|
|
273
400
|
}
|
|
274
401
|
});
|
|
275
402
|
// Sort matches by position and remove overlapping matches
|
|
@@ -280,16 +407,17 @@ export function parseInlineFormatting(text) {
|
|
|
280
407
|
matches.forEach(match => {
|
|
281
408
|
tempText = tempText.substring(0, match.start) + ' '.repeat(match.end - match.start) + tempText.substring(match.end);
|
|
282
409
|
});
|
|
283
|
-
// Now find
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
410
|
+
// Now find single *text* patterns in the remaining text
|
|
411
|
+
// In wiki mode: *text* = bold (strong). In markdown mode: *text* = italic (em).
|
|
412
|
+
const singleStarRegex = /\*([^*]+?)\*/g;
|
|
413
|
+
let singleStarMatch;
|
|
414
|
+
while ((singleStarMatch = singleStarRegex.exec(tempText)) !== null) {
|
|
287
415
|
matches.push({
|
|
288
|
-
start:
|
|
289
|
-
end:
|
|
290
|
-
text:
|
|
291
|
-
type: 'em',
|
|
292
|
-
fullMatch:
|
|
416
|
+
start: singleStarMatch.index,
|
|
417
|
+
end: singleStarMatch.index + singleStarMatch[0].length,
|
|
418
|
+
text: singleStarMatch[1],
|
|
419
|
+
type: wikiMode ? 'strong' : 'em',
|
|
420
|
+
fullMatch: singleStarMatch[0]
|
|
293
421
|
});
|
|
294
422
|
}
|
|
295
423
|
// Sort matches by position and remove overlapping matches
|
|
@@ -319,11 +447,20 @@ export function parseInlineFormatting(text) {
|
|
|
319
447
|
}
|
|
320
448
|
}
|
|
321
449
|
// Add formatted text
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
450
|
+
if (match.type === 'link') {
|
|
451
|
+
result.push({
|
|
452
|
+
type: 'text',
|
|
453
|
+
text: match.text,
|
|
454
|
+
marks: [{ type: 'link', attrs: { href: match.href } }]
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
result.push({
|
|
459
|
+
type: 'text',
|
|
460
|
+
text: match.text,
|
|
461
|
+
marks: [{ type: match.type }]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
327
464
|
currentPos = match.end;
|
|
328
465
|
});
|
|
329
466
|
// Add remaining text
|
|
@@ -346,11 +483,28 @@ export function parseInlineFormatting(text) {
|
|
|
346
483
|
return result;
|
|
347
484
|
}
|
|
348
485
|
/**
|
|
349
|
-
* Enhanced description parser that converts text to proper ADF format
|
|
486
|
+
* Enhanced description parser that converts text to proper ADF format.
|
|
487
|
+
* Auto-detects wiki markup vs markdown and adjusts parsing accordingly.
|
|
350
488
|
*/
|
|
351
489
|
export function parseDescriptionToADF(description) {
|
|
352
|
-
|
|
353
|
-
|
|
490
|
+
const wikiMode = isWikiMarkup(description);
|
|
491
|
+
// Extract {code}...{code} blocks before line-by-line processing (wiki mode only)
|
|
492
|
+
const codeBlockStore = [];
|
|
493
|
+
let processedDesc = description;
|
|
494
|
+
if (wikiMode) {
|
|
495
|
+
processedDesc = description.replace(/\{code(?::([^}]*))?\}([\s\S]*?)\{code\}/g, (_full, params, code) => {
|
|
496
|
+
const idx = codeBlockStore.length;
|
|
497
|
+
let lang = '';
|
|
498
|
+
if (params) {
|
|
499
|
+
const langMatch = params.match(/(?:language=)?(\w+)/);
|
|
500
|
+
if (langMatch)
|
|
501
|
+
lang = normalizeCodeLanguage(langMatch[1]);
|
|
502
|
+
}
|
|
503
|
+
codeBlockStore.push({ lang, code: code.replace(/^\n/, '').replace(/\n$/, '') });
|
|
504
|
+
return `\x00WIKICODE_${idx}\x00`;
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
const lines = processedDesc.split('\n');
|
|
354
508
|
const content = [];
|
|
355
509
|
for (let i = 0; i < lines.length; i++) {
|
|
356
510
|
const line = lines[i].trim();
|
|
@@ -358,6 +512,17 @@ export function parseDescriptionToADF(description) {
|
|
|
358
512
|
// Skip empty lines - let Claude handle spacing naturally
|
|
359
513
|
continue;
|
|
360
514
|
}
|
|
515
|
+
// Restore wiki {code} block placeholders
|
|
516
|
+
const wikiCodeMatch = line.match(/^\x00WIKICODE_(\d+)\x00$/);
|
|
517
|
+
if (wikiCodeMatch) {
|
|
518
|
+
const { lang, code } = codeBlockStore[parseInt(wikiCodeMatch[1])];
|
|
519
|
+
content.push({
|
|
520
|
+
type: 'codeBlock',
|
|
521
|
+
attrs: lang ? { language: lang } : {},
|
|
522
|
+
content: [{ type: 'text', text: code }]
|
|
523
|
+
});
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
361
526
|
// Handle Confluence wiki markup headers (h1., h2., h3., etc.)
|
|
362
527
|
const confluenceHeaderMatch = line.match(/^h([1-6])\.\s*(.*)$/);
|
|
363
528
|
if (confluenceHeaderMatch) {
|
|
@@ -366,42 +531,51 @@ export function parseDescriptionToADF(description) {
|
|
|
366
531
|
content.push({
|
|
367
532
|
type: 'heading',
|
|
368
533
|
attrs: { level },
|
|
369
|
-
content:
|
|
370
|
-
type: 'text',
|
|
371
|
-
text: headerText
|
|
372
|
-
}]
|
|
534
|
+
content: parseInlineFormatting(headerText, wikiMode)
|
|
373
535
|
});
|
|
374
536
|
continue;
|
|
375
537
|
}
|
|
538
|
+
// In wiki mode, # at line start = ordered list (not heading)
|
|
539
|
+
if (wikiMode && /^#+\s/.test(line)) {
|
|
540
|
+
const listText = line.replace(/^#+\s*/, '');
|
|
541
|
+
const lastItem = content[content.length - 1];
|
|
542
|
+
if (lastItem && lastItem.type === 'orderedList') {
|
|
543
|
+
lastItem.content.push({
|
|
544
|
+
type: 'listItem',
|
|
545
|
+
content: [{ type: 'paragraph', content: parseInlineFormatting(listText, wikiMode) }]
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
content.push({
|
|
550
|
+
type: 'orderedList',
|
|
551
|
+
content: [{
|
|
552
|
+
type: 'listItem',
|
|
553
|
+
content: [{ type: 'paragraph', content: parseInlineFormatting(listText, wikiMode) }]
|
|
554
|
+
}]
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
376
559
|
// Handle markdown headers (## Header, ### Header)
|
|
377
560
|
if (line.startsWith('###')) {
|
|
378
561
|
content.push({
|
|
379
562
|
type: 'heading',
|
|
380
563
|
attrs: { level: 3 },
|
|
381
|
-
content:
|
|
382
|
-
type: 'text',
|
|
383
|
-
text: line.substring(3).trim()
|
|
384
|
-
}]
|
|
564
|
+
content: parseInlineFormatting(line.substring(3).trim(), wikiMode)
|
|
385
565
|
});
|
|
386
566
|
}
|
|
387
567
|
else if (line.startsWith('##')) {
|
|
388
568
|
content.push({
|
|
389
569
|
type: 'heading',
|
|
390
570
|
attrs: { level: 2 },
|
|
391
|
-
content:
|
|
392
|
-
type: 'text',
|
|
393
|
-
text: line.substring(2).trim()
|
|
394
|
-
}]
|
|
571
|
+
content: parseInlineFormatting(line.substring(2).trim(), wikiMode)
|
|
395
572
|
});
|
|
396
573
|
}
|
|
397
574
|
else if (line.startsWith('#')) {
|
|
398
575
|
content.push({
|
|
399
576
|
type: 'heading',
|
|
400
577
|
attrs: { level: 1 },
|
|
401
|
-
content:
|
|
402
|
-
type: 'text',
|
|
403
|
-
text: line.substring(1).trim()
|
|
404
|
-
}]
|
|
578
|
+
content: parseInlineFormatting(line.substring(1).trim(), wikiMode)
|
|
405
579
|
});
|
|
406
580
|
}
|
|
407
581
|
// Handle horizontal rules (---- or ----)
|
|
@@ -424,7 +598,7 @@ export function parseDescriptionToADF(description) {
|
|
|
424
598
|
if (panelLine) {
|
|
425
599
|
panelContent.push({
|
|
426
600
|
type: 'paragraph',
|
|
427
|
-
content: parseInlineFormatting(panelLine)
|
|
601
|
+
content: parseInlineFormatting(panelLine, wikiMode)
|
|
428
602
|
});
|
|
429
603
|
}
|
|
430
604
|
i++;
|
|
@@ -457,7 +631,7 @@ export function parseDescriptionToADF(description) {
|
|
|
457
631
|
type: 'listItem',
|
|
458
632
|
content: [{
|
|
459
633
|
type: 'paragraph',
|
|
460
|
-
content: parseInlineFormatting(bulletText)
|
|
634
|
+
content: parseInlineFormatting(bulletText, wikiMode)
|
|
461
635
|
}]
|
|
462
636
|
});
|
|
463
637
|
}
|
|
@@ -468,7 +642,7 @@ export function parseDescriptionToADF(description) {
|
|
|
468
642
|
type: 'listItem',
|
|
469
643
|
content: [{
|
|
470
644
|
type: 'paragraph',
|
|
471
|
-
content: parseInlineFormatting(bulletText)
|
|
645
|
+
content: parseInlineFormatting(bulletText, wikiMode)
|
|
472
646
|
}]
|
|
473
647
|
}]
|
|
474
648
|
});
|
|
@@ -485,7 +659,7 @@ export function parseDescriptionToADF(description) {
|
|
|
485
659
|
type: 'listItem',
|
|
486
660
|
content: [{
|
|
487
661
|
type: 'paragraph',
|
|
488
|
-
content: parseInlineFormatting(listText)
|
|
662
|
+
content: parseInlineFormatting(listText, wikiMode)
|
|
489
663
|
}]
|
|
490
664
|
});
|
|
491
665
|
}
|
|
@@ -496,7 +670,7 @@ export function parseDescriptionToADF(description) {
|
|
|
496
670
|
type: 'listItem',
|
|
497
671
|
content: [{
|
|
498
672
|
type: 'paragraph',
|
|
499
|
-
content: parseInlineFormatting(listText)
|
|
673
|
+
content: parseInlineFormatting(listText, wikiMode)
|
|
500
674
|
}]
|
|
501
675
|
}]
|
|
502
676
|
});
|
|
@@ -523,6 +697,50 @@ export function parseDescriptionToADF(description) {
|
|
|
523
697
|
};
|
|
524
698
|
content.push(codeBlock);
|
|
525
699
|
}
|
|
700
|
+
// Handle wiki tables (||header|| for headers, |cell| for data rows)
|
|
701
|
+
else if (wikiMode && line.startsWith('||')) {
|
|
702
|
+
const tableRows = [];
|
|
703
|
+
let tableIdx = i;
|
|
704
|
+
while (tableIdx < lines.length) {
|
|
705
|
+
const tableLine = lines[tableIdx].trim();
|
|
706
|
+
if (!tableLine || (!tableLine.startsWith('||') && !tableLine.startsWith('|')))
|
|
707
|
+
break;
|
|
708
|
+
if (tableLine.startsWith('||')) {
|
|
709
|
+
// Header row - split on || and filter empties
|
|
710
|
+
const cells = tableLine.split('||').filter(c => c !== '');
|
|
711
|
+
const headerCells = cells.map(cellText => ({
|
|
712
|
+
type: 'tableHeader',
|
|
713
|
+
attrs: {},
|
|
714
|
+
content: [{ type: 'paragraph', content: parseInlineFormatting(cellText.trim(), wikiMode) }]
|
|
715
|
+
}));
|
|
716
|
+
tableRows.push({ type: 'tableRow', content: headerCells });
|
|
717
|
+
}
|
|
718
|
+
else if (tableLine.startsWith('|')) {
|
|
719
|
+
// Data row - split on | and filter empties
|
|
720
|
+
const cells = tableLine.split('|').filter(c => c !== '');
|
|
721
|
+
// Skip separator rows like |-|-|
|
|
722
|
+
if (!tableLine.match(/^\|[\s\-:|]+\|?$/)) {
|
|
723
|
+
const dataCells = cells.map(cellText => ({
|
|
724
|
+
type: 'tableCell',
|
|
725
|
+
attrs: {},
|
|
726
|
+
content: [{ type: 'paragraph', content: parseInlineFormatting(cellText.trim(), wikiMode) }]
|
|
727
|
+
}));
|
|
728
|
+
tableRows.push({ type: 'tableRow', content: dataCells });
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
tableIdx++;
|
|
732
|
+
}
|
|
733
|
+
if (tableRows.length > 0) {
|
|
734
|
+
applyColWidths(tableRows);
|
|
735
|
+
content.push({
|
|
736
|
+
type: 'table',
|
|
737
|
+
attrs: { isNumberColumnEnabled: false, layout: 'default' },
|
|
738
|
+
content: tableRows
|
|
739
|
+
});
|
|
740
|
+
i = tableIdx - 1; // -1 because the for loop will increment
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
526
744
|
// Handle markdown tables - convert to proper ADF table structure
|
|
527
745
|
else if (line.includes('|') && line.trim() !== '|') {
|
|
528
746
|
const cells = line.split('|').map(cell => cell.trim()).filter(cell => cell !== '');
|
|
@@ -570,7 +788,7 @@ export function parseDescriptionToADF(description) {
|
|
|
570
788
|
attrs: {},
|
|
571
789
|
content: [{
|
|
572
790
|
type: 'paragraph',
|
|
573
|
-
content: parseInlineFormatting(cellText)
|
|
791
|
+
content: parseInlineFormatting(cellText, wikiMode)
|
|
574
792
|
}]
|
|
575
793
|
}));
|
|
576
794
|
tableRows.push({
|
|
@@ -585,7 +803,7 @@ export function parseDescriptionToADF(description) {
|
|
|
585
803
|
attrs: {},
|
|
586
804
|
content: [{
|
|
587
805
|
type: 'paragraph',
|
|
588
|
-
content: parseInlineFormatting(cellText)
|
|
806
|
+
content: parseInlineFormatting(cellText, wikiMode)
|
|
589
807
|
}]
|
|
590
808
|
}));
|
|
591
809
|
tableRows.push({
|
|
@@ -593,6 +811,7 @@ export function parseDescriptionToADF(description) {
|
|
|
593
811
|
content: dataCells
|
|
594
812
|
});
|
|
595
813
|
}
|
|
814
|
+
applyColWidths(tableRows);
|
|
596
815
|
// Create the complete table structure
|
|
597
816
|
content.push({
|
|
598
817
|
type: 'table',
|
|
@@ -610,14 +829,14 @@ export function parseDescriptionToADF(description) {
|
|
|
610
829
|
// If we reach here, it's not a valid table, treat as regular paragraph
|
|
611
830
|
content.push({
|
|
612
831
|
type: 'paragraph',
|
|
613
|
-
content: parseInlineFormatting(line)
|
|
832
|
+
content: parseInlineFormatting(line, wikiMode)
|
|
614
833
|
});
|
|
615
834
|
}
|
|
616
835
|
// Regular paragraph
|
|
617
836
|
else {
|
|
618
837
|
content.push({
|
|
619
838
|
type: 'paragraph',
|
|
620
|
-
content: parseInlineFormatting(line)
|
|
839
|
+
content: parseInlineFormatting(line, wikiMode)
|
|
621
840
|
});
|
|
622
841
|
}
|
|
623
842
|
}
|
|
@@ -878,7 +1097,7 @@ export function markdownToConfluenceStorage(markdown) {
|
|
|
878
1097
|
i++;
|
|
879
1098
|
}
|
|
880
1099
|
if (tableRows.length > 0) {
|
|
881
|
-
let html = '<table
|
|
1100
|
+
let html = '<table data-layout="default" data-table-width="760">' + buildColGroupHtml(tableRows) + '<tbody>';
|
|
882
1101
|
html += '<tr>' + tableRows[0].map(c => `<th>${applyInlineStorageFormat(c)}</th>`).join('') + '</tr>';
|
|
883
1102
|
for (let r = 1; r < tableRows.length; r++) {
|
|
884
1103
|
html += '<tr>' + tableRows[r].map(c => `<td>${applyInlineStorageFormat(c)}</td>`).join('') + '</tr>';
|