@klevar/portal-cli 0.1.9 → 0.1.11
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/index.d.ts +13 -0
- package/dist/commands/portal.js +1 -1
- package/dist/commands/portal.js.map +1 -1
- package/dist/commands/updates.d.ts +13 -0
- package/dist/commands/updates.js +4 -2
- package/dist/commands/updates.js.map +1 -1
- package/dist/lib/legacy-runner.js +36 -3
- package/package.json +1 -1
package/dist/commands/index.d.ts
CHANGED
|
@@ -481,6 +481,19 @@ export declare const COMMAND_GROUPS: {
|
|
|
481
481
|
description: string;
|
|
482
482
|
body: string[];
|
|
483
483
|
};
|
|
484
|
+
'comments.update': {
|
|
485
|
+
method: "PATCH";
|
|
486
|
+
path: string;
|
|
487
|
+
auth: "apiKey";
|
|
488
|
+
description: string;
|
|
489
|
+
body: string[];
|
|
490
|
+
};
|
|
491
|
+
'comments.delete': {
|
|
492
|
+
method: "DELETE";
|
|
493
|
+
path: string;
|
|
494
|
+
auth: "apiKey";
|
|
495
|
+
description: string;
|
|
496
|
+
};
|
|
484
497
|
};
|
|
485
498
|
onboarding: {
|
|
486
499
|
'onboarding.list': {
|
package/dist/commands/portal.js
CHANGED
|
@@ -6,7 +6,7 @@ export const portalCommands = {
|
|
|
6
6
|
'portal.recent-updates': { method: 'GET', path: '/api/portal/updates/recent', auth: 'portalToken', description: 'List recent portal updates' },
|
|
7
7
|
'portal.updates': { method: 'GET', path: '/api/portal/projects/:id/updates', auth: 'portalToken', description: 'List portal project updates' },
|
|
8
8
|
'portal.comments.list': { method: 'GET', path: '/api/portal/projects/:id/updates/:updateId/comments', auth: 'portalToken', description: 'List portal update comments' },
|
|
9
|
-
'portal.comments.create': { method: 'POST', path: '/api/portal/projects/:id/updates/:updateId/comments', auth: 'portalToken', description: 'Create portal update comment', body: ['content'] },
|
|
9
|
+
'portal.comments.create': { method: 'POST', path: '/api/portal/projects/:id/updates/:updateId/comments', auth: 'portalToken', description: 'Create portal update comment (--content, --content-file, or --stdin)', body: ['content'] },
|
|
10
10
|
'portal.search': { method: 'GET', path: '/api/portal/search', auth: 'portalToken', description: 'Search portal content', queryParams: ['q|query'] },
|
|
11
11
|
'portal.my-tasks': { method: 'GET', path: '/api/portal/tasks/mine', auth: 'portalToken', description: 'List client-submitted portal requests' },
|
|
12
12
|
'portal.tasks': { method: 'GET', path: '/api/portal/projects/:id/tasks', auth: 'portalToken', description: 'List portal project tasks' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../commands/portal.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,4BAA4B,EAAE;IACtH,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE;IAC9H,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE;IAC5H,gBAAgB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,qBAAqB,EAAE;IAC9H,uBAAuB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,4BAA4B,EAAE;IAC9I,gBAAgB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,kCAAkC,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,6BAA6B,EAAE;IAC9I,sBAAsB,EAAE,EAAE,MAAM,EAAE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WAAW,EAAE,4BAA4B,EAAE;IAC3J,sBAAsB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,kDAAkD,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,0BAA0B,EAAE;IACjK,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,mCAAmC,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE;IACzI,kBAAkB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,oCAAoC,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,uBAAuB,EAAE;IAC5I,0BAA0B,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,yCAAyC,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,0BAA0B,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;IACnL,yBAAyB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,wCAAwC,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;CAC1J,CAAC"}
|
|
@@ -39,4 +39,17 @@ export declare const updateCommands: {
|
|
|
39
39
|
description: string;
|
|
40
40
|
body: string[];
|
|
41
41
|
};
|
|
42
|
+
'comments.update': {
|
|
43
|
+
method: "PATCH";
|
|
44
|
+
path: string;
|
|
45
|
+
auth: "apiKey";
|
|
46
|
+
description: string;
|
|
47
|
+
body: string[];
|
|
48
|
+
};
|
|
49
|
+
'comments.delete': {
|
|
50
|
+
method: "DELETE";
|
|
51
|
+
path: string;
|
|
52
|
+
auth: "apiKey";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
42
55
|
};
|
package/dist/commands/updates.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export const updateCommands = {
|
|
2
2
|
'updates.list': { method: 'GET', path: '/api/admin/projects/:id/updates', auth: 'apiKey', description: 'List updates' },
|
|
3
3
|
'updates.create': { method: 'POST', path: '/api/admin/projects/:id/updates', auth: 'apiKey', description: 'Create update', body: ['content', 'visibility', 'author'], supportsFiles: true },
|
|
4
|
-
'updates.update': { method: 'PATCH', path: '/api/admin/updates/:updateId', auth: 'apiKey', description: '
|
|
4
|
+
'updates.update': { method: 'PATCH', path: '/api/admin/updates/:updateId', auth: 'apiKey', description: 'Edit an existing update in place', body: ['content', 'visibility'] },
|
|
5
5
|
'updates.delete': { method: 'DELETE', path: '/api/admin/updates/:updateId', auth: 'apiKey', description: 'Delete update' },
|
|
6
6
|
'comments.list': { method: 'GET', path: '/api/admin/projects/:id/updates/:updateId/comments', auth: 'apiKey', description: 'List update comments' },
|
|
7
|
-
'comments.create': { method: 'POST', path: '/api/admin/projects/:id/updates/:updateId/comments', auth: 'apiKey', description: 'Create update comment', body: ['content'] },
|
|
7
|
+
'comments.create': { method: 'POST', path: '/api/admin/projects/:id/updates/:updateId/comments', auth: 'apiKey', description: 'Create update comment (--content, --content-file, or --stdin)', body: ['content'] },
|
|
8
|
+
'comments.update': { method: 'PATCH', path: '/api/admin/comments/:commentId', auth: 'apiKey', description: 'Edit your admin comment in place (--content, --content-file, or --stdin)', body: ['content'] },
|
|
9
|
+
'comments.delete': { method: 'DELETE', path: '/api/admin/comments/:commentId', auth: 'apiKey', description: 'Delete your admin comment' },
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=updates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../../commands/updates.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,iCAAiC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;IACvH,gBAAgB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,I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AE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+DAA+D,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;IAClN,iBAAiB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,gCAAgC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0EAA0E,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE;IAC1M,iBAAiB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,gCAAgC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;CACnH,CAAC"}
|
|
@@ -269,6 +269,18 @@ function parseArgs(args) {
|
|
|
269
269
|
return { positional, flags };
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
+
function normalizeCliMultiline(value) {
|
|
273
|
+
return typeof value === 'string'
|
|
274
|
+
? value.replace(/\\r\\n/g, '\n').replace(/\\n/g, '\n')
|
|
275
|
+
: value;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function supportsCommentContentInput(commandKey) {
|
|
279
|
+
return commandKey === 'comments.create' ||
|
|
280
|
+
commandKey === 'comments.update' ||
|
|
281
|
+
commandKey === 'portal.comments.create';
|
|
282
|
+
}
|
|
283
|
+
|
|
272
284
|
function interpolatePath(template, id) {
|
|
273
285
|
return template.replace(':id', id);
|
|
274
286
|
}
|
|
@@ -569,9 +581,15 @@ function formatOutput(data, commandKey) {
|
|
|
569
581
|
return;
|
|
570
582
|
}
|
|
571
583
|
|
|
572
|
-
if (commandKey === 'comments.create' && data.comment) {
|
|
584
|
+
if ((commandKey === 'comments.create' || commandKey === 'comments.update' || commandKey === 'comments.delete') && data.comment) {
|
|
573
585
|
const c = data.comment;
|
|
574
|
-
|
|
586
|
+
if (commandKey === 'comments.update') {
|
|
587
|
+
console.log(`Comment edited by ${c.authorName} [${c.id}]`);
|
|
588
|
+
} else if (commandKey === 'comments.delete') {
|
|
589
|
+
console.log(`Comment deleted by ${c.authorName} [${c.id}]`);
|
|
590
|
+
} else {
|
|
591
|
+
console.log(`Comment posted by ${c.authorName} [${c.authorType}] on ${c.visibility} update`);
|
|
592
|
+
}
|
|
575
593
|
return;
|
|
576
594
|
}
|
|
577
595
|
|
|
@@ -623,7 +641,9 @@ function formatOutput(data, commandKey) {
|
|
|
623
641
|
if (data.update) {
|
|
624
642
|
const u = data.update;
|
|
625
643
|
const vis = u.visibility === 'internal' ? ' [INTERNAL]' : '';
|
|
626
|
-
|
|
644
|
+
const action = commandKey === 'updates.update' ? 'Update edited in place' : 'Update posted';
|
|
645
|
+
const edited = commandKey === 'updates.update' && u.editedAt ? ` (edited ${u.editedAt})` : '';
|
|
646
|
+
console.log(`${action}${vis}: ${u.content.slice(0, 80)}${u.content.length > 80 ? '...' : ''} [${u.id}]${edited}`);
|
|
627
647
|
return;
|
|
628
648
|
}
|
|
629
649
|
if (data.portalToken) {
|
|
@@ -730,6 +750,16 @@ OUTPUT_JSON = flags.json === 'true';
|
|
|
730
750
|
COMPACT_JSON = flags.compact === 'true';
|
|
731
751
|
const id = positional[0];
|
|
732
752
|
|
|
753
|
+
if (supportsCommentContentInput(commandKey)) {
|
|
754
|
+
if (flags['content-file']) {
|
|
755
|
+
flags.content = readFileSync(flags['content-file'], 'utf-8');
|
|
756
|
+
} else if (flags.stdin === 'true') {
|
|
757
|
+
flags.content = readFileSync(0, 'utf-8');
|
|
758
|
+
} else if (flags.content !== undefined) {
|
|
759
|
+
flags.content = normalizeCliMultiline(flags.content);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
733
763
|
// Interpolate path
|
|
734
764
|
let path = cmd.path;
|
|
735
765
|
const pathParams = [...path.matchAll(/:([A-Za-z][A-Za-z0-9_]*)/g)].map((match) => match[1]);
|
|
@@ -785,6 +815,9 @@ if (cmd.fixedBody) {
|
|
|
785
815
|
if (commandKey === 'updates.create' && !body && positional[1]) {
|
|
786
816
|
body = { content: positional.slice(1).join(' '), visibility: 'client' };
|
|
787
817
|
}
|
|
818
|
+
if (supportsCommentContentInput(commandKey) && !body && positional[pathParams.length]) {
|
|
819
|
+
body = { content: normalizeCliMultiline(positional.slice(pathParams.length).join(' ')) };
|
|
820
|
+
}
|
|
788
821
|
|
|
789
822
|
// ── Search Command ──
|
|
790
823
|
if (commandKey === 'search') {
|