confluencedc-cli 0.0.1
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/commands/attachment/delete.d.ts +3 -0
- package/dist/commands/attachment/delete.d.ts.map +1 -0
- package/dist/commands/attachment/delete.js +19 -0
- package/dist/commands/attachment/delete.js.map +1 -0
- package/dist/commands/attachment/download-all.d.ts +3 -0
- package/dist/commands/attachment/download-all.d.ts.map +1 -0
- package/dist/commands/attachment/download-all.js +51 -0
- package/dist/commands/attachment/download-all.js.map +1 -0
- package/dist/commands/attachment/download.d.ts +3 -0
- package/dist/commands/attachment/download.d.ts.map +1 -0
- package/dist/commands/attachment/download.js +21 -0
- package/dist/commands/attachment/download.js.map +1 -0
- package/dist/commands/attachment/index.d.ts +3 -0
- package/dist/commands/attachment/index.d.ts.map +1 -0
- package/dist/commands/attachment/index.js +22 -0
- package/dist/commands/attachment/index.js.map +1 -0
- package/dist/commands/attachment/list.d.ts +3 -0
- package/dist/commands/attachment/list.d.ts.map +1 -0
- package/dist/commands/attachment/list.js +22 -0
- package/dist/commands/attachment/list.js.map +1 -0
- package/dist/commands/attachment/upload.d.ts +3 -0
- package/dist/commands/attachment/upload.d.ts.map +1 -0
- package/dist/commands/attachment/upload.js +43 -0
- package/dist/commands/attachment/upload.js.map +1 -0
- package/dist/commands/comment/add.d.ts +3 -0
- package/dist/commands/comment/add.d.ts.map +1 -0
- package/dist/commands/comment/add.js +20 -0
- package/dist/commands/comment/add.js.map +1 -0
- package/dist/commands/comment/index.d.ts +3 -0
- package/dist/commands/comment/index.d.ts.map +1 -0
- package/dist/commands/comment/index.js +13 -0
- package/dist/commands/comment/index.js.map +1 -0
- package/dist/commands/comment/list.d.ts +3 -0
- package/dist/commands/comment/list.d.ts.map +1 -0
- package/dist/commands/comment/list.js +22 -0
- package/dist/commands/comment/list.js.map +1 -0
- package/dist/commands/label/add.d.ts +3 -0
- package/dist/commands/label/add.d.ts.map +1 -0
- package/dist/commands/label/add.js +20 -0
- package/dist/commands/label/add.js.map +1 -0
- package/dist/commands/label/index.d.ts +3 -0
- package/dist/commands/label/index.d.ts.map +1 -0
- package/dist/commands/label/index.js +13 -0
- package/dist/commands/label/index.js.map +1 -0
- package/dist/commands/label/list.d.ts +3 -0
- package/dist/commands/label/list.d.ts.map +1 -0
- package/dist/commands/label/list.js +21 -0
- package/dist/commands/label/list.js.map +1 -0
- package/dist/commands/page/children.d.ts +3 -0
- package/dist/commands/page/children.d.ts.map +1 -0
- package/dist/commands/page/children.js +22 -0
- package/dist/commands/page/children.js.map +1 -0
- package/dist/commands/page/create.d.ts +3 -0
- package/dist/commands/page/create.d.ts.map +1 -0
- package/dist/commands/page/create.js +33 -0
- package/dist/commands/page/create.js.map +1 -0
- package/dist/commands/page/delete.d.ts +3 -0
- package/dist/commands/page/delete.d.ts.map +1 -0
- package/dist/commands/page/delete.js +19 -0
- package/dist/commands/page/delete.js.map +1 -0
- package/dist/commands/page/get.d.ts +3 -0
- package/dist/commands/page/get.d.ts.map +1 -0
- package/dist/commands/page/get.js +58 -0
- package/dist/commands/page/get.js.map +1 -0
- package/dist/commands/page/history.d.ts +3 -0
- package/dist/commands/page/history.d.ts.map +1 -0
- package/dist/commands/page/history.js +21 -0
- package/dist/commands/page/history.js.map +1 -0
- package/dist/commands/page/index.d.ts +3 -0
- package/dist/commands/page/index.d.ts.map +1 -0
- package/dist/commands/page/index.js +25 -0
- package/dist/commands/page/index.js.map +1 -0
- package/dist/commands/page/update.d.ts +3 -0
- package/dist/commands/page/update.d.ts.map +1 -0
- package/dist/commands/page/update.js +41 -0
- package/dist/commands/page/update.js.map +1 -0
- package/dist/commands/search/index.d.ts +3 -0
- package/dist/commands/search/index.d.ts.map +1 -0
- package/dist/commands/search/index.js +5 -0
- package/dist/commands/search/index.js.map +1 -0
- package/dist/commands/search/search.d.ts +3 -0
- package/dist/commands/search/search.d.ts.map +1 -0
- package/dist/commands/search/search.js +25 -0
- package/dist/commands/search/search.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/client.d.ts +3 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +11 -0
- package/dist/utils/client.js.map +1 -0
- package/dist/utils/output.d.ts +3 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +10 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/strip-response.d.ts +6 -0
- package/dist/utils/strip-response.d.ts.map +1 -0
- package/dist/utils/strip-response.js +29 -0
- package/dist/utils/strip-response.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/attachment/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,QAc/C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function deleteAttachment(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('delete <attachmentId>')
|
|
6
|
+
.description('Delete an attachment')
|
|
7
|
+
.addHelpText('after', '\nExamples:\n confluencedc attachment delete att12345')
|
|
8
|
+
.action(async (attachmentId) => {
|
|
9
|
+
try {
|
|
10
|
+
const client = getClient();
|
|
11
|
+
await client.attachments.delete({ attachmentId });
|
|
12
|
+
output({ deleted: true, attachmentId });
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
handleError(err);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/attachment/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,gBAAgB,CAAC,MAAe;IAC9C,MAAM;SACH,OAAO,CAAC,uBAAuB,CAAC;SAChC,WAAW,CAAC,sBAAsB,CAAC;SACnC,WAAW,CAAC,OAAO,EAAE,wDAAwD,CAAC;SAC9E,MAAM,CAAC,KAAK,EAAE,YAAoB,EAAE,EAAE;QACrC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;YAClD,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-all.d.ts","sourceRoot":"","sources":["../../../src/commands/attachment/download-all.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,QAgD1C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { mkdirSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { getClient } from '../../utils/client.js';
|
|
4
|
+
import { output, handleError } from '../../utils/output.js';
|
|
5
|
+
export function downloadAll(parent) {
|
|
6
|
+
parent
|
|
7
|
+
.command('download-all <pageId>')
|
|
8
|
+
.description('Download all attachments from a page')
|
|
9
|
+
.requiredOption('--output <dir>', 'Local directory to save attachments into')
|
|
10
|
+
.addHelpText('after', '\nExamples:\n confluencedc attachment download-all 12345 --output ./downloads')
|
|
11
|
+
.action(async (pageId, opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = getClient();
|
|
14
|
+
mkdirSync(opts.output, { recursive: true });
|
|
15
|
+
const attachments = await client.attachments.get({ pageId });
|
|
16
|
+
const items = attachments.results ?? [];
|
|
17
|
+
if (items.length === 0) {
|
|
18
|
+
output({ pageId, downloaded: 0, files: [] });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const results = [];
|
|
22
|
+
const failed = [];
|
|
23
|
+
for (const att of items) {
|
|
24
|
+
const downloadUrl = att._links?.download;
|
|
25
|
+
if (!downloadUrl) {
|
|
26
|
+
failed.push({ filename: att.title, error: 'No download URL' });
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const destPath = join(opts.output, att.title);
|
|
30
|
+
try {
|
|
31
|
+
await client.attachments.download({ downloadUrl, destinationPath: destPath });
|
|
32
|
+
results.push({ filename: att.title, size: att.fileSize ?? 0, path: destPath });
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
failed.push({ filename: att.title, error: String(err) });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
output({
|
|
39
|
+
pageId,
|
|
40
|
+
downloaded: results.length,
|
|
41
|
+
total: items.length,
|
|
42
|
+
files: results,
|
|
43
|
+
...(failed.length > 0 && { failed }),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
handleError(err);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=download-all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-all.js","sourceRoot":"","sources":["../../../src/commands/attachment/download-all.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,MAAM;SACH,OAAO,CAAC,uBAAuB,CAAC;SAChC,WAAW,CAAC,sCAAsC,CAAC;SACnD,cAAc,CAAC,gBAAgB,EAAE,0CAA0C,CAAC;SAC5E,WAAW,CAAC,OAAO,EAAE,gFAAgF,CAAC;SACtG,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAwB,EAAE,EAAE;QACzD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAE5C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7D,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;YAExC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7C,OAAO;YACT,CAAC;YAED,MAAM,OAAO,GAAuD,EAAE,CAAC;YACvE,MAAM,MAAM,GAA0C,EAAE,CAAC;YAEzD,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;gBACzC,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;oBAC/D,SAAS;gBACX,CAAC;gBACD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;gBAC9C,IAAI,CAAC;oBACH,MAAM,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAC;oBAC9E,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;gBACjF,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;YAED,MAAM,CAAC;gBACL,MAAM;gBACN,UAAU,EAAE,OAAO,CAAC,MAAM;gBAC1B,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,KAAK,EAAE,OAAO;gBACd,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;aACrC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/commands/attachment/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,QAgBvC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function download(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('download')
|
|
6
|
+
.description('Download a single attachment by URL')
|
|
7
|
+
.requiredOption('--url <downloadUrl>', 'Download URL from attachment _links.download')
|
|
8
|
+
.requiredOption('--output <path>', 'Local file path to save to')
|
|
9
|
+
.addHelpText('after', '\nExamples:\n confluencedc attachment download --url "/download/attachments/12345/report.pdf" --output ./report.pdf')
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
try {
|
|
12
|
+
const client = getClient();
|
|
13
|
+
await client.attachments.download({ downloadUrl: opts.url, destinationPath: opts.output });
|
|
14
|
+
output({ downloaded: true, path: opts.output });
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
handleError(err);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../../src/commands/attachment/download.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,QAAQ,CAAC,MAAe;IACtC,MAAM;SACH,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,qCAAqC,CAAC;SAClD,cAAc,CAAC,qBAAqB,EAAE,8CAA8C,CAAC;SACrF,cAAc,CAAC,iBAAiB,EAAE,4BAA4B,CAAC;SAC/D,WAAW,CAAC,OAAO,EAAE,sHAAsH,CAAC;SAC5I,MAAM,CAAC,KAAK,EAAE,IAAqC,EAAE,EAAE;QACtD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3F,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/attachment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,QAe1D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { list } from './list.js';
|
|
2
|
+
import { download } from './download.js';
|
|
3
|
+
import { downloadAll } from './download-all.js';
|
|
4
|
+
import { upload } from './upload.js';
|
|
5
|
+
import { deleteAttachment } from './delete.js';
|
|
6
|
+
export function registerAttachmentCommands(program) {
|
|
7
|
+
const attachment = program.command('attachment').description('Attachment operations')
|
|
8
|
+
.addHelpText('after', `
|
|
9
|
+
Examples:
|
|
10
|
+
$ confluencedc attachment list 12345
|
|
11
|
+
$ confluencedc attachment download --url "/download/attachments/12345/file.pdf" --output ./file.pdf
|
|
12
|
+
$ confluencedc attachment download-all 12345 --output ./downloads
|
|
13
|
+
$ confluencedc attachment upload 12345 --files report.pdf,notes.txt
|
|
14
|
+
$ confluencedc attachment delete att12345
|
|
15
|
+
`);
|
|
16
|
+
list(attachment);
|
|
17
|
+
download(attachment);
|
|
18
|
+
downloadAll(attachment);
|
|
19
|
+
upload(attachment);
|
|
20
|
+
deleteAttachment(attachment);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/attachment/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC;SAClF,WAAW,CAAC,OAAO,EAAE;;;;;;;CAOzB,CAAC,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,CAAC;IACjB,QAAQ,CAAC,UAAU,CAAC,CAAC;IACrB,WAAW,CAAC,UAAU,CAAC,CAAC;IACxB,MAAM,CAAC,UAAU,CAAC,CAAC;IACnB,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/attachment/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,QAiBnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function list(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('list <pageId>')
|
|
6
|
+
.description('Get attachments on a page')
|
|
7
|
+
.option('--start <number>', 'Starting index', parseInt)
|
|
8
|
+
.option('--limit <number>', 'Maximum results', parseInt)
|
|
9
|
+
.option('--filename <name>', 'Filter by filename')
|
|
10
|
+
.addHelpText('after', '\nExamples:\n confluencedc attachment list 12345\n confluencedc attachment list 12345 --filename report.pdf')
|
|
11
|
+
.action(async (pageId, opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = getClient();
|
|
14
|
+
const result = await client.attachments.get({ pageId, start: opts.start, limit: opts.limit, filename: opts.filename });
|
|
15
|
+
output(result);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
handleError(err);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/attachment/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,IAAI,CAAC,MAAe;IAClC,MAAM;SACH,OAAO,CAAC,eAAe,CAAC;SACxB,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;SACtD,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,CAAC;SACvD,MAAM,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;SACjD,WAAW,CAAC,OAAO,EAAE,+GAA+G,CAAC;SACrI,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAA2D,EAAE,EAAE;QAC5F,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/commands/attachment/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QA0CrC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function upload(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('upload <pageId>')
|
|
6
|
+
.description('Upload attachments to a page')
|
|
7
|
+
.requiredOption('--files <paths>', 'Comma-separated local file paths')
|
|
8
|
+
.option('--comment <text>', 'Attachment comment')
|
|
9
|
+
.option('--no-minor-edit', 'Mark as regular edit (default: minor edit)')
|
|
10
|
+
.addHelpText('after', '\nExamples:\n confluencedc attachment upload 12345 --files report.pdf\n confluencedc attachment upload 12345 --files file1.txt,file2.pdf --comment "Updated docs"')
|
|
11
|
+
.action(async (pageId, opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = getClient();
|
|
14
|
+
const filePaths = opts.files.split(',').map((p) => p.trim()).filter(Boolean);
|
|
15
|
+
const results = [];
|
|
16
|
+
const failed = [];
|
|
17
|
+
for (const filePath of filePaths) {
|
|
18
|
+
try {
|
|
19
|
+
const result = await client.attachments.upload({
|
|
20
|
+
pageId,
|
|
21
|
+
filePath,
|
|
22
|
+
comment: opts.comment,
|
|
23
|
+
minorEdit: opts.minorEdit,
|
|
24
|
+
});
|
|
25
|
+
results.push({ filename: result.title, id: result.id });
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
failed.push({ filePath, error: err instanceof Error ? err.message : String(err) });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
output({
|
|
32
|
+
pageId,
|
|
33
|
+
uploaded: results.length,
|
|
34
|
+
files: results,
|
|
35
|
+
...(failed.length > 0 && { failed }),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
handleError(err);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/commands/attachment/upload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,8BAA8B,CAAC;SAC3C,cAAc,CAAC,iBAAiB,EAAE,kCAAkC,CAAC;SACrE,MAAM,CAAC,kBAAkB,EAAE,oBAAoB,CAAC;SAChD,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;SACvE,WAAW,CACV,OAAO,EACP,qKAAqK,CACtK;SACA,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAA8D,EAAE,EAAE;QAC/F,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7E,MAAM,OAAO,GAAuC,EAAE,CAAC;YACvD,MAAM,MAAM,GAA0C,EAAE,CAAC;YAEzD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;wBAC7C,MAAM;wBACN,QAAQ;wBACR,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,SAAS,EAAE,IAAI,CAAC,SAAS;qBAC1B,CAAC,CAAC;oBACH,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC1D,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACrF,CAAC;YACH,CAAC;YAED,MAAM,CAAC;gBACL,MAAM;gBACN,QAAQ,EAAE,OAAO,CAAC,MAAM;gBACxB,KAAK,EAAE,OAAO;gBACd,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;aACrC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/comment/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,QAelC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function add(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('add <pageId>')
|
|
6
|
+
.description('Add a comment to a page')
|
|
7
|
+
.requiredOption('--body <text>', 'Comment body in wiki markup')
|
|
8
|
+
.addHelpText('after', '\nExamples:\n confluencedc comment add 12345 --body "Looks good, approved."')
|
|
9
|
+
.action(async (pageId, opts) => {
|
|
10
|
+
try {
|
|
11
|
+
const client = getClient();
|
|
12
|
+
const result = await client.comments.add({ pageId, body: opts.body });
|
|
13
|
+
output(result);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
handleError(err);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/comment/add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,CAAC,MAAe;IACjC,MAAM;SACH,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,yBAAyB,CAAC;SACtC,cAAc,CAAC,eAAe,EAAE,6BAA6B,CAAC;SAC9D,WAAW,CAAC,OAAO,EAAE,8EAA8E,CAAC;SACpG,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAsB,EAAE,EAAE;QACvD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACtE,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/comment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QASvD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { list } from './list.js';
|
|
2
|
+
import { add } from './add.js';
|
|
3
|
+
export function registerCommentCommands(program) {
|
|
4
|
+
const comment = program.command('comment').description('Comment operations')
|
|
5
|
+
.addHelpText('after', `
|
|
6
|
+
Examples:
|
|
7
|
+
$ confluencedc comment list 12345
|
|
8
|
+
$ confluencedc comment add 12345 --body "Great work!"
|
|
9
|
+
`);
|
|
10
|
+
list(comment);
|
|
11
|
+
add(comment);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/comment/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,oBAAoB,CAAC;SACzE,WAAW,CAAC,OAAO,EAAE;;;;CAIzB,CAAC,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,CAAC;IACd,GAAG,CAAC,OAAO,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/comment/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,QAiBnC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function list(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('list <pageId>')
|
|
6
|
+
.description('Get comments on a page')
|
|
7
|
+
.option('--start <number>', 'Starting index', parseInt)
|
|
8
|
+
.option('--limit <number>', 'Maximum results', parseInt)
|
|
9
|
+
.option('--depth <depth>', 'Comment depth (e.g., "all" for all threads)')
|
|
10
|
+
.addHelpText('after', '\nExamples:\n confluencedc comment list 12345\n confluencedc comment list 12345 --depth all --limit 50')
|
|
11
|
+
.action(async (pageId, opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = getClient();
|
|
14
|
+
const result = await client.comments.get({ pageId, start: opts.start, limit: opts.limit, depth: opts.depth });
|
|
15
|
+
output(result);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
handleError(err);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/comment/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,IAAI,CAAC,MAAe;IAClC,MAAM;SACH,OAAO,CAAC,eAAe,CAAC;SACxB,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;SACtD,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,CAAC;SACvD,MAAM,CAAC,iBAAiB,EAAE,6CAA6C,CAAC;SACxE,WAAW,CAAC,OAAO,EAAE,0GAA0G,CAAC;SAChI,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAwD,EAAE,EAAE;QACzF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YAC9G,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/label/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,QAelC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function add(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('add <pageId>')
|
|
6
|
+
.description('Add a label to a page')
|
|
7
|
+
.requiredOption('--label <name>', 'Label name')
|
|
8
|
+
.addHelpText('after', '\nExamples:\n confluencedc label add 12345 --label important')
|
|
9
|
+
.action(async (pageId, opts) => {
|
|
10
|
+
try {
|
|
11
|
+
const client = getClient();
|
|
12
|
+
const result = await client.labels.add({ pageId, label: opts.label });
|
|
13
|
+
output(result);
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
handleError(err);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/label/add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,CAAC,MAAe;IACjC,MAAM;SACH,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,uBAAuB,CAAC;SACpC,cAAc,CAAC,gBAAgB,EAAE,YAAY,CAAC;SAC9C,WAAW,CAAC,OAAO,EAAE,+DAA+D,CAAC;SACrF,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAuB,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACtE,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QASrD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { list } from './list.js';
|
|
2
|
+
import { add } from './add.js';
|
|
3
|
+
export function registerLabelCommands(program) {
|
|
4
|
+
const label = program.command('label').description('Label operations')
|
|
5
|
+
.addHelpText('after', `
|
|
6
|
+
Examples:
|
|
7
|
+
$ confluencedc label list 12345
|
|
8
|
+
$ confluencedc label add 12345 --label important
|
|
9
|
+
`);
|
|
10
|
+
list(label);
|
|
11
|
+
add(label);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/label/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC;SACnE,WAAW,CAAC,OAAO,EAAE;;;;CAIzB,CAAC,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,CAAC;IACZ,GAAG,CAAC,KAAK,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/label/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,QAgBnC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function list(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('list <pageId>')
|
|
6
|
+
.description('Get labels on a page')
|
|
7
|
+
.option('--start <number>', 'Starting index', parseInt)
|
|
8
|
+
.option('--limit <number>', 'Maximum results', parseInt)
|
|
9
|
+
.addHelpText('after', '\nExamples:\n confluencedc label list 12345')
|
|
10
|
+
.action(async (pageId, opts) => {
|
|
11
|
+
try {
|
|
12
|
+
const client = getClient();
|
|
13
|
+
const result = await client.labels.get({ pageId, start: opts.start, limit: opts.limit });
|
|
14
|
+
output(result);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
handleError(err);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/label/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,IAAI,CAAC,MAAe;IAClC,MAAM;SACH,OAAO,CAAC,eAAe,CAAC;SACxB,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;SACtD,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,CAAC;SACvD,WAAW,CAAC,OAAO,EAAE,8CAA8C,CAAC;SACpE,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAwC,EAAE,EAAE;QACzE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACzF,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"children.d.ts","sourceRoot":"","sources":["../../../src/commands/page/children.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,QAiBvC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function children(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('children <pageId>')
|
|
6
|
+
.description('Get child pages of a page')
|
|
7
|
+
.option('--start <number>', 'Starting index', parseInt)
|
|
8
|
+
.option('--limit <number>', 'Maximum results', parseInt)
|
|
9
|
+
.option('--expand <expand>', 'Expand options')
|
|
10
|
+
.addHelpText('after', '\nExamples:\n confluencedc page children 12345\n confluencedc page children 12345 --limit 10')
|
|
11
|
+
.action(async (pageId, opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = getClient();
|
|
14
|
+
const result = await client.pages.getChildren({ pageId, start: opts.start, limit: opts.limit, expand: opts.expand });
|
|
15
|
+
output(result);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
handleError(err);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=children.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"children.js","sourceRoot":"","sources":["../../../src/commands/page/children.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,QAAQ,CAAC,MAAe;IACtC,MAAM;SACH,OAAO,CAAC,mBAAmB,CAAC;SAC5B,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;SACtD,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,CAAC;SACvD,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;SAC7C,WAAW,CAAC,OAAO,EAAE,gGAAgG,CAAC;SACtH,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAyD,EAAE,EAAE;QAC1F,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACrH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/page/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QA+BrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function create(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('create')
|
|
6
|
+
.description('Create a new page')
|
|
7
|
+
.requiredOption('--space <key>', 'Space key')
|
|
8
|
+
.requiredOption('--title <title>', 'Page title')
|
|
9
|
+
.requiredOption('--body <content>', 'Page content (XHTML storage format by default)')
|
|
10
|
+
.option('--parent <pageId>', 'Parent page ID (creates as child page)')
|
|
11
|
+
.option('--format <format>', 'Content format: storage (default) or wiki', 'storage')
|
|
12
|
+
.addHelpText('after', `\nExamples:
|
|
13
|
+
confluencedc page create --space DEV --title "New Page" --body "<p>Hello world</p>"
|
|
14
|
+
confluencedc page create --space DEV --title "Child Page" --body "<p>Content</p>" --parent 12345
|
|
15
|
+
confluencedc page create --space DEV --title "Wiki Page" --body "h1. Title" --format wiki`)
|
|
16
|
+
.action(async (opts) => {
|
|
17
|
+
try {
|
|
18
|
+
const client = getClient();
|
|
19
|
+
const result = await client.pages.create({
|
|
20
|
+
spaceKey: opts.space,
|
|
21
|
+
title: opts.title,
|
|
22
|
+
body: opts.body,
|
|
23
|
+
parentId: opts.parent,
|
|
24
|
+
contentFormat: opts.format,
|
|
25
|
+
});
|
|
26
|
+
output(result);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
handleError(err);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/page/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mBAAmB,CAAC;SAChC,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC;SAC5C,cAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC;SAC/C,cAAc,CAAC,kBAAkB,EAAE,gDAAgD,CAAC;SACpF,MAAM,CAAC,mBAAmB,EAAE,wCAAwC,CAAC;SACrE,MAAM,CAAC,mBAAmB,EAAE,2CAA2C,EAAE,SAAS,CAAC;SACnF,WAAW,CACV,OAAO,EACP;;;4FAGsF,CACvF;SACA,MAAM,CAAC,KAAK,EAAE,IAAqF,EAAE,EAAE;QACtG,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;gBACvC,QAAQ,EAAE,IAAI,CAAC,KAAK;gBACpB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,aAAa,EAAE,IAAI,CAAC,MAA4B;aACjD,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/page/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,QAczC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function deletePage(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('delete <pageId>')
|
|
6
|
+
.description('Delete a page')
|
|
7
|
+
.addHelpText('after', '\nExamples:\n confluencedc page delete 12345')
|
|
8
|
+
.action(async (pageId) => {
|
|
9
|
+
try {
|
|
10
|
+
const client = getClient();
|
|
11
|
+
await client.pages.delete({ pageId });
|
|
12
|
+
output({ deleted: true, pageId });
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
handleError(err);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/page/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,UAAU,CAAC,MAAe;IACxC,MAAM;SACH,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,eAAe,CAAC;SAC5B,WAAW,CAAC,OAAO,EAAE,+CAA+C,CAAC;SACrE,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,EAAE;QAC/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YACtC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/page/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,QA2DlC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function get(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('get [pageId]')
|
|
6
|
+
.description('Get a page by ID, or by title + space key')
|
|
7
|
+
.option('--title <title>', 'Page title (requires --space)')
|
|
8
|
+
.option('--space <key>', 'Space key (requires --title)')
|
|
9
|
+
.option('--page-version <number>', 'Version number for historical content', parseInt)
|
|
10
|
+
.option('--expand <expand>', 'Expand options (default: "body.storage,version,space")')
|
|
11
|
+
.addHelpText('after', `\nExamples:
|
|
12
|
+
confluencedc page get 12345
|
|
13
|
+
confluencedc page get 12345 --page-version 3
|
|
14
|
+
confluencedc page get --title "Meeting Notes" --space DEV
|
|
15
|
+
confluencedc page get 12345 --expand body.wiki,version`)
|
|
16
|
+
.action(async (pageId, opts) => {
|
|
17
|
+
try {
|
|
18
|
+
const client = getClient();
|
|
19
|
+
let resolvedPageId = pageId;
|
|
20
|
+
if (!resolvedPageId) {
|
|
21
|
+
if (!opts.title || !opts.space) {
|
|
22
|
+
process.stderr.write(JSON.stringify({ error: 'Provide <pageId> or both --title and --space' }) + '\n');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const searchResult = await client.search.query({
|
|
26
|
+
cql: `title = "${opts.title}" AND space = "${opts.space}" AND type = page`,
|
|
27
|
+
limit: 1,
|
|
28
|
+
});
|
|
29
|
+
const results = searchResult.results ?? [];
|
|
30
|
+
if (results.length === 0) {
|
|
31
|
+
process.stderr.write(JSON.stringify({ error: `No page found with title "${opts.title}" in space "${opts.space}"` }) + '\n');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const content = results[0].content ?? results[0];
|
|
35
|
+
const id = content.id;
|
|
36
|
+
if (!id) {
|
|
37
|
+
process.stderr.write(JSON.stringify({ error: `Page found but missing ID: title="${opts.title}" in space "${opts.space}"` }) + '\n');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
resolvedPageId = String(id);
|
|
41
|
+
}
|
|
42
|
+
const params = {
|
|
43
|
+
pageId: resolvedPageId,
|
|
44
|
+
expand: opts.expand,
|
|
45
|
+
};
|
|
46
|
+
if (opts.pageVersion !== undefined) {
|
|
47
|
+
params.version = opts.pageVersion;
|
|
48
|
+
params.status = 'historical';
|
|
49
|
+
}
|
|
50
|
+
const result = await client.pages.get(params);
|
|
51
|
+
output(result);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
handleError(err);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/page/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,CAAC,MAAe;IACjC,MAAM;SACH,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,iBAAiB,EAAE,+BAA+B,CAAC;SAC1D,MAAM,CAAC,eAAe,EAAE,8BAA8B,CAAC;SACvD,MAAM,CAAC,yBAAyB,EAAE,uCAAuC,EAAE,QAAQ,CAAC;SACpF,MAAM,CAAC,mBAAmB,EAAE,wDAAwD,CAAC;SACrF,WAAW,CACV,OAAO,EACP;;;;yDAImD,CACpD;SACA,MAAM,CAAC,KAAK,EAAE,MAA0B,EAAE,IAA+E,EAAE,EAAE;QAC5H,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,IAAI,cAAc,GAAG,MAAM,CAAC;YAE5B,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;oBAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,8CAA8C,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;oBACvG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBACD,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;oBAC7C,GAAG,EAAE,YAAY,IAAI,CAAC,KAAK,kBAAkB,IAAI,CAAC,KAAK,mBAAmB;oBAC1E,KAAK,EAAE,CAAC;iBACT,CAAC,CAAC;gBACH,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,EAAE,CAAC;gBAC3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,6BAA6B,IAAI,CAAC,KAAK,eAAe,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;oBAC5H,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBACD,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;gBACjD,MAAM,EAAE,GAAI,OAAmC,CAAC,EAAE,CAAC;gBACnD,IAAI,CAAC,EAAE,EAAE,CAAC;oBACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,qCAAqC,IAAI,CAAC,KAAK,eAAe,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;oBACpI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBACD,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;YAC9B,CAAC;YAED,MAAM,MAAM,GAA6F;gBACvG,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC;YACF,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACnC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;gBAClC,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC;YAC/B,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC9C,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/commands/page/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,QAgBtC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function history(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('history <pageId>')
|
|
6
|
+
.description('Get version history of a page')
|
|
7
|
+
.option('--start <number>', 'Starting index', parseInt)
|
|
8
|
+
.option('--limit <number>', 'Maximum results', parseInt)
|
|
9
|
+
.addHelpText('after', '\nExamples:\n confluencedc page history 12345\n confluencedc page history 12345 --limit 5')
|
|
10
|
+
.action(async (pageId, opts) => {
|
|
11
|
+
try {
|
|
12
|
+
const client = getClient();
|
|
13
|
+
const result = await client.pages.getHistory({ pageId, start: opts.start, limit: opts.limit });
|
|
14
|
+
output(result);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
handleError(err);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/commands/page/history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,OAAO,CAAC,MAAe;IACrC,MAAM;SACH,OAAO,CAAC,kBAAkB,CAAC;SAC3B,WAAW,CAAC,+BAA+B,CAAC;SAC5C,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;SACtD,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,QAAQ,CAAC;SACvD,WAAW,CAAC,OAAO,EAAE,6FAA6F,CAAC;SACnH,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAwC,EAAE,EAAE;QACzE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YAC/F,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/page/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAiBpD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { get } from './get.js';
|
|
2
|
+
import { children } from './children.js';
|
|
3
|
+
import { history } from './history.js';
|
|
4
|
+
import { create } from './create.js';
|
|
5
|
+
import { update } from './update.js';
|
|
6
|
+
import { deletePage } from './delete.js';
|
|
7
|
+
export function registerPageCommands(program) {
|
|
8
|
+
const page = program.command('page').description('Page operations')
|
|
9
|
+
.addHelpText('after', `
|
|
10
|
+
Examples:
|
|
11
|
+
$ confluencedc page get 12345
|
|
12
|
+
$ confluencedc page get --title "Meeting Notes" --space DEV
|
|
13
|
+
$ confluencedc page children 12345
|
|
14
|
+
$ confluencedc page create --space DEV --title "New Page" --body "<p>Content</p>"
|
|
15
|
+
$ confluencedc page update 12345 --title "Title" --body "<p>Updated</p>"
|
|
16
|
+
$ confluencedc page delete 12345
|
|
17
|
+
`);
|
|
18
|
+
get(page);
|
|
19
|
+
children(page);
|
|
20
|
+
history(page);
|
|
21
|
+
create(page);
|
|
22
|
+
update(page);
|
|
23
|
+
deletePage(page);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/page/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC;SAChE,WAAW,CAAC,OAAO,EAAE;;;;;;;;CAQzB,CAAC,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,CAAC;IACV,QAAQ,CAAC,IAAI,CAAC,CAAC;IACf,OAAO,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,UAAU,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/page/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QAuCrC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function update(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('update <pageId>')
|
|
6
|
+
.description('Update a page. Version is auto-fetched if not provided.')
|
|
7
|
+
.requiredOption('--title <title>', 'Page title')
|
|
8
|
+
.requiredOption('--body <content>', 'Page content (XHTML storage format by default)')
|
|
9
|
+
.option('--version <number>', 'Current version number (auto-fetched if omitted)', parseInt)
|
|
10
|
+
.option('--minor-edit', 'Mark as minor edit (default: false)')
|
|
11
|
+
.option('--message <text>', 'Version comment')
|
|
12
|
+
.option('--format <format>', 'Content format: storage (default) or wiki', 'storage')
|
|
13
|
+
.addHelpText('after', `\nExamples:
|
|
14
|
+
confluencedc page update 12345 --title "Updated Title" --body "<p>New content</p>"
|
|
15
|
+
confluencedc page update 12345 --title "Title" --body "<p>Fix typo</p>" --minor-edit --message "Fixed typo"
|
|
16
|
+
confluencedc page update 12345 --title "Title" --body "<p>Content</p>" --version 5`)
|
|
17
|
+
.action(async (pageId, opts) => {
|
|
18
|
+
try {
|
|
19
|
+
const client = getClient();
|
|
20
|
+
let version = opts.version;
|
|
21
|
+
if (version === undefined) {
|
|
22
|
+
const current = await client.pages.get({ pageId, expand: 'version' });
|
|
23
|
+
version = current.version?.number ?? 1;
|
|
24
|
+
}
|
|
25
|
+
const result = await client.pages.update({
|
|
26
|
+
pageId,
|
|
27
|
+
title: opts.title,
|
|
28
|
+
body: opts.body,
|
|
29
|
+
version,
|
|
30
|
+
minorEdit: opts.minorEdit,
|
|
31
|
+
versionMessage: opts.message,
|
|
32
|
+
contentFormat: opts.format,
|
|
33
|
+
});
|
|
34
|
+
output(result);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
handleError(err);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/page/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,yDAAyD,CAAC;SACtE,cAAc,CAAC,iBAAiB,EAAE,YAAY,CAAC;SAC/C,cAAc,CAAC,kBAAkB,EAAE,gDAAgD,CAAC;SACpF,MAAM,CAAC,oBAAoB,EAAE,kDAAkD,EAAE,QAAQ,CAAC;SAC1F,MAAM,CAAC,cAAc,EAAE,qCAAqC,CAAC;SAC7D,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;SAC7C,MAAM,CAAC,mBAAmB,EAAE,2CAA2C,EAAE,SAAS,CAAC;SACnF,WAAW,CACV,OAAO,EACP;;;qFAG+E,CAChF;SACA,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAA8G,EAAE,EAAE;QAC/I,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC3B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;gBACtE,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;gBACvC,MAAM;gBACN,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO;gBACP,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,cAAc,EAAE,IAAI,CAAC,OAAO;gBAC5B,aAAa,EAAE,IAAI,CAAC,MAA4B;aACjD,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAEtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/search/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,MAAM,CAAC,OAAO,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/search/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QAuBrC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function search(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('search <cql>')
|
|
6
|
+
.description('Search Confluence using CQL (Confluence Query Language)')
|
|
7
|
+
.option('--start <number>', 'Starting index for pagination (default: 0)', parseInt)
|
|
8
|
+
.option('--limit <number>', 'Maximum results per page (default: 25)', parseInt)
|
|
9
|
+
.option('--expand <expand>', 'Expand options (e.g., "body.wiki,version")')
|
|
10
|
+
.addHelpText('after', `\nExamples:
|
|
11
|
+
confluencedc search "type = page AND space = DEV"
|
|
12
|
+
confluencedc search "title ~ \\"meeting notes\\"" --limit 10
|
|
13
|
+
confluencedc search "label = important AND lastModified > now('-7d')" --expand body.wiki`)
|
|
14
|
+
.action(async (cql, opts) => {
|
|
15
|
+
try {
|
|
16
|
+
const client = getClient();
|
|
17
|
+
const result = await client.search.query({ cql, start: opts.start, limit: opts.limit, expand: opts.expand });
|
|
18
|
+
output(result);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
handleError(err);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/commands/search/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,yDAAyD,CAAC;SACtE,MAAM,CAAC,kBAAkB,EAAE,4CAA4C,EAAE,QAAQ,CAAC;SAClF,MAAM,CAAC,kBAAkB,EAAE,wCAAwC,EAAE,QAAQ,CAAC;SAC9E,MAAM,CAAC,mBAAmB,EAAE,4CAA4C,CAAC;SACzE,WAAW,CACV,OAAO,EACP;;;2FAGqF,CACtF;SACA,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,IAAyD,EAAE,EAAE;QACvF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7G,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { styleText } from 'node:util';
|
|
5
|
+
import { registerSearchCommands } from './commands/search/index.js';
|
|
6
|
+
import { registerPageCommands } from './commands/page/index.js';
|
|
7
|
+
import { registerCommentCommands } from './commands/comment/index.js';
|
|
8
|
+
import { registerLabelCommands } from './commands/label/index.js';
|
|
9
|
+
import { registerAttachmentCommands } from './commands/attachment/index.js';
|
|
10
|
+
const DIM = '\x1b[2m';
|
|
11
|
+
const RESET = '\x1b[0m';
|
|
12
|
+
const program = new Command();
|
|
13
|
+
program
|
|
14
|
+
.name('confluencedc')
|
|
15
|
+
.description('Confluence Data Center CLI')
|
|
16
|
+
.version('1.0.0')
|
|
17
|
+
.configureHelp({
|
|
18
|
+
styleTitle: (str) => styleText('bold', str),
|
|
19
|
+
styleUsage: (str) => styleText('dim', str),
|
|
20
|
+
styleCommandDescription: (str) => styleText('dim', str),
|
|
21
|
+
styleOptionDescription: (str) => styleText('dim', str),
|
|
22
|
+
styleSubcommandDescription: (str) => styleText('dim', str),
|
|
23
|
+
})
|
|
24
|
+
.addHelpText('beforeAll', `\n${styleText('bold', 'confluencedc')} ${DIM}— Confluence Data Center CLI${RESET}\n`)
|
|
25
|
+
.addHelpText('after', `
|
|
26
|
+
${styleText('bold', 'Environment:')}
|
|
27
|
+
CONFLUENCE_URL Confluence Server base URL ${DIM}(e.g., https://confluence.example.com)${RESET}
|
|
28
|
+
CONFLUENCE_TOKEN Personal Access Token ${DIM}(generate in Confluence > Profile > Personal Access Tokens)${RESET}
|
|
29
|
+
|
|
30
|
+
${styleText('bold', 'Examples:')}
|
|
31
|
+
${DIM}$${RESET} confluencedc search "type = page AND space = DEV" --limit 10
|
|
32
|
+
${DIM}$${RESET} confluencedc page get 12345
|
|
33
|
+
${DIM}$${RESET} confluencedc page get --title "Meeting Notes" --space DEV
|
|
34
|
+
${DIM}$${RESET} confluencedc page create --space DEV --title "New Page" --body "<p>Content</p>"
|
|
35
|
+
${DIM}$${RESET} confluencedc page children 12345
|
|
36
|
+
${DIM}$${RESET} confluencedc comment add 12345 --body "Looks good"
|
|
37
|
+
${DIM}$${RESET} confluencedc label add 12345 --label important
|
|
38
|
+
${DIM}$${RESET} confluencedc attachment list 12345
|
|
39
|
+
`);
|
|
40
|
+
registerSearchCommands(program);
|
|
41
|
+
registerPageCommands(program);
|
|
42
|
+
registerCommentCommands(program);
|
|
43
|
+
registerLabelCommands(program);
|
|
44
|
+
registerAttachmentCommands(program);
|
|
45
|
+
program.parse();
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,cAAc,CAAC;KACpB,WAAW,CAAC,4BAA4B,CAAC;KACzC,OAAO,CAAC,OAAO,CAAC;KAChB,aAAa,CAAC;IACb,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3C,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;IAC1C,uBAAuB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;IACvD,sBAAsB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;IACtD,0BAA0B,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;CAC3D,CAAC;KACD,WAAW,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,GAAG,+BAA+B,KAAK,IAAI,CAAC;KAC/G,WAAW,CAAC,OAAO,EAAE;EACtB,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;mDACgB,GAAG,yCAAyC,KAAK;8CACtD,GAAG,8DAA8D,KAAK;;EAElH,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC5B,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;IACZ,GAAG,IAAI,KAAK;CACf,CAAC,CAAC;AAEH,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAChC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACjC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAEpC,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/utils/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,wBAAgB,SAAS,IAAI,gBAAgB,CAY5C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConfluenceClient } from 'confluence-data-center-client';
|
|
2
|
+
export function getClient() {
|
|
3
|
+
const baseUrl = process.env.CONFLUENCE_URL;
|
|
4
|
+
const token = process.env.CONFLUENCE_TOKEN;
|
|
5
|
+
if (!baseUrl || !token) {
|
|
6
|
+
process.stderr.write(JSON.stringify({ error: 'Missing required environment variables: CONFLUENCE_URL and CONFLUENCE_TOKEN' }) + '\n');
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
return new ConfluenceClient({ baseUrl, token });
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/utils/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,UAAU,SAAS;IACvB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAE3C,IAAI,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,6EAA6E,EAAE,CAAC,GAAG,IAAI,CAChH,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,IAAI,gBAAgB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE1C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAI9C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { stripResponse } from './strip-response.js';
|
|
2
|
+
export function output(data) {
|
|
3
|
+
process.stdout.write(JSON.stringify(stripResponse(data), null, 2) + '\n');
|
|
4
|
+
}
|
|
5
|
+
export function handleError(err) {
|
|
6
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7
|
+
process.stderr.write(JSON.stringify({ error: message }) + '\n');
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,UAAU,MAAM,CAAC,IAAa;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively strip verbose fields from API responses to reduce token usage.
|
|
3
|
+
* Removes: self URLs, avatar URL dicts, _links, _expandable, expand metadata.
|
|
4
|
+
*/
|
|
5
|
+
export declare function stripResponse(obj: unknown): unknown;
|
|
6
|
+
//# sourceMappingURL=strip-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-response.d.ts","sourceRoot":"","sources":["../../src/utils/strip-response.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CA8BnD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively strip verbose fields from API responses to reduce token usage.
|
|
3
|
+
* Removes: self URLs, avatar URL dicts, _links, _expandable, expand metadata.
|
|
4
|
+
*/
|
|
5
|
+
export function stripResponse(obj) {
|
|
6
|
+
if (Array.isArray(obj)) {
|
|
7
|
+
return obj.map(stripResponse);
|
|
8
|
+
}
|
|
9
|
+
if (obj === null || typeof obj !== 'object') {
|
|
10
|
+
return obj;
|
|
11
|
+
}
|
|
12
|
+
const record = obj;
|
|
13
|
+
const result = {};
|
|
14
|
+
for (const [key, value] of Object.entries(record)) {
|
|
15
|
+
// Skip noisy fields
|
|
16
|
+
if (key === 'self' ||
|
|
17
|
+
key === '_links' ||
|
|
18
|
+
key === '_expandable' ||
|
|
19
|
+
key === 'expand' ||
|
|
20
|
+
key === 'avatarUrls' ||
|
|
21
|
+
key === 'avatarId' ||
|
|
22
|
+
key === 'iconUrl') {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
result[key] = stripResponse(value);
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=strip-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-response.js","sourceRoot":"","sources":["../../src/utils/strip-response.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,MAAM,GAAG,GAA8B,CAAC;IAC9C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,oBAAoB;QACpB,IACE,GAAG,KAAK,MAAM;YACd,GAAG,KAAK,QAAQ;YAChB,GAAG,KAAK,aAAa;YACrB,GAAG,KAAK,QAAQ;YAChB,GAAG,KAAK,YAAY;YACpB,GAAG,KAAK,UAAU;YAClB,GAAG,KAAK,SAAS,EACjB,CAAC;YACD,SAAS;QACX,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "confluencedc-cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"publish": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"confluencedc": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"commander": "^13.1.0",
|
|
15
|
+
"dotenv": "17.2.3",
|
|
16
|
+
"confluence-data-center-client": "0.0.5"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "24.10.4",
|
|
20
|
+
"eslint": "^9.39.0",
|
|
21
|
+
"tsx": "^4.19.2",
|
|
22
|
+
"typescript": "^5.7.2",
|
|
23
|
+
"vitest": "^4.0.16",
|
|
24
|
+
"config-eslint": "0.0.0",
|
|
25
|
+
"config-typescript": "0.0.0"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.0.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"dev": "tsx src/index.ts",
|
|
33
|
+
"lint": "eslint src",
|
|
34
|
+
"lint:fix": "eslint src --fix",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"test:integration": "vitest run tests/integration"
|
|
37
|
+
}
|
|
38
|
+
}
|