@displaydev/cli 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-client.js +208 -32
- package/dist/main-helpers.js +13 -1
- package/dist/main.js +633 -16
- package/dist/mcp-server.js +476 -51
- package/package.json +1 -1
package/dist/api-client.js
CHANGED
|
@@ -392,6 +392,141 @@ export var ApiClient = /*#__PURE__*/ function() {
|
|
|
392
392
|
}).call(this);
|
|
393
393
|
}
|
|
394
394
|
},
|
|
395
|
+
{
|
|
396
|
+
key: "addComment",
|
|
397
|
+
value: // ── Comments (feat-comments §3) ──────────────────────────────────────
|
|
398
|
+
// 1:1 with the public REST endpoints under
|
|
399
|
+
// `/v1/artifacts/:shortId/comments` and `/v1/comments/:commentId/...`.
|
|
400
|
+
// KB-page subjects 404 until KB ships.
|
|
401
|
+
function addComment(shortId, params) {
|
|
402
|
+
return _async_to_generator(function() {
|
|
403
|
+
return _ts_generator(this, function(_state) {
|
|
404
|
+
return [
|
|
405
|
+
2,
|
|
406
|
+
this.request('POST', "/v1/artifacts/".concat(shortId, "/comments"), params)
|
|
407
|
+
];
|
|
408
|
+
});
|
|
409
|
+
}).call(this);
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
key: "listComments",
|
|
414
|
+
value: function listComments(shortId, params) {
|
|
415
|
+
return _async_to_generator(function() {
|
|
416
|
+
var qs, suffix;
|
|
417
|
+
return _ts_generator(this, function(_state) {
|
|
418
|
+
qs = new URLSearchParams();
|
|
419
|
+
if (params === null || params === void 0 ? void 0 : params.status) {
|
|
420
|
+
qs.set('status', params.status);
|
|
421
|
+
}
|
|
422
|
+
if (params === null || params === void 0 ? void 0 : params.since) {
|
|
423
|
+
qs.set('since', params.since);
|
|
424
|
+
}
|
|
425
|
+
suffix = qs.toString() ? "?".concat(qs.toString()) : '';
|
|
426
|
+
return [
|
|
427
|
+
2,
|
|
428
|
+
this.request('GET', "/v1/artifacts/".concat(shortId, "/comments").concat(suffix))
|
|
429
|
+
];
|
|
430
|
+
});
|
|
431
|
+
}).call(this);
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
key: "editComment",
|
|
436
|
+
value: function editComment(commentId, body) {
|
|
437
|
+
return _async_to_generator(function() {
|
|
438
|
+
return _ts_generator(this, function(_state) {
|
|
439
|
+
return [
|
|
440
|
+
2,
|
|
441
|
+
this.request('POST', "/v1/comments/".concat(commentId, "/edit"), {
|
|
442
|
+
body: body
|
|
443
|
+
})
|
|
444
|
+
];
|
|
445
|
+
});
|
|
446
|
+
}).call(this);
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
key: "deleteComment",
|
|
451
|
+
value: function deleteComment(commentId) {
|
|
452
|
+
return _async_to_generator(function() {
|
|
453
|
+
return _ts_generator(this, function(_state) {
|
|
454
|
+
switch(_state.label){
|
|
455
|
+
case 0:
|
|
456
|
+
return [
|
|
457
|
+
4,
|
|
458
|
+
this.request('DELETE', "/v1/comments/".concat(commentId))
|
|
459
|
+
];
|
|
460
|
+
case 1:
|
|
461
|
+
_state.sent();
|
|
462
|
+
return [
|
|
463
|
+
2
|
|
464
|
+
];
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
}).call(this);
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
key: "resolveThread",
|
|
472
|
+
value: function resolveThread(commentId) {
|
|
473
|
+
return _async_to_generator(function() {
|
|
474
|
+
return _ts_generator(this, function(_state) {
|
|
475
|
+
return [
|
|
476
|
+
2,
|
|
477
|
+
this.request('POST', "/v1/comments/".concat(commentId, "/resolve"))
|
|
478
|
+
];
|
|
479
|
+
});
|
|
480
|
+
}).call(this);
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
key: "reopenThread",
|
|
485
|
+
value: function reopenThread(commentId) {
|
|
486
|
+
return _async_to_generator(function() {
|
|
487
|
+
return _ts_generator(this, function(_state) {
|
|
488
|
+
return [
|
|
489
|
+
2,
|
|
490
|
+
this.request('POST', "/v1/comments/".concat(commentId, "/reopen"))
|
|
491
|
+
];
|
|
492
|
+
});
|
|
493
|
+
}).call(this);
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
key: "watchArtifact",
|
|
498
|
+
value: function watchArtifact(shortId) {
|
|
499
|
+
return _async_to_generator(function() {
|
|
500
|
+
return _ts_generator(this, function(_state) {
|
|
501
|
+
return [
|
|
502
|
+
2,
|
|
503
|
+
this.request('POST', "/v1/artifacts/".concat(shortId, "/watch"))
|
|
504
|
+
];
|
|
505
|
+
});
|
|
506
|
+
}).call(this);
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
key: "unwatchArtifact",
|
|
511
|
+
value: function unwatchArtifact(shortId) {
|
|
512
|
+
return _async_to_generator(function() {
|
|
513
|
+
return _ts_generator(this, function(_state) {
|
|
514
|
+
switch(_state.label){
|
|
515
|
+
case 0:
|
|
516
|
+
return [
|
|
517
|
+
4,
|
|
518
|
+
this.request('DELETE', "/v1/artifacts/".concat(shortId, "/watch"))
|
|
519
|
+
];
|
|
520
|
+
case 1:
|
|
521
|
+
_state.sent();
|
|
522
|
+
return [
|
|
523
|
+
2
|
|
524
|
+
];
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}).call(this);
|
|
528
|
+
}
|
|
529
|
+
},
|
|
395
530
|
{
|
|
396
531
|
key: "buildPublishForm",
|
|
397
532
|
value: function buildPublishForm(params) {
|
|
@@ -549,44 +684,76 @@ export var ApiClient = /*#__PURE__*/ function() {
|
|
|
549
684
|
key: "find",
|
|
550
685
|
value: function find(params) {
|
|
551
686
|
return _async_to_generator(function() {
|
|
552
|
-
var searchParams,
|
|
687
|
+
var searchParams, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, a, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, v, qs;
|
|
553
688
|
return _ts_generator(this, function(_state) {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
searchParams.set('publishedBy', params.publishedBy);
|
|
565
|
-
}
|
|
566
|
-
if (params.since) {
|
|
567
|
-
searchParams.set('since', params.since);
|
|
689
|
+
searchParams = new URLSearchParams();
|
|
690
|
+
if (params.query) {
|
|
691
|
+
searchParams.set('q', params.query);
|
|
692
|
+
}
|
|
693
|
+
if (params.author) {
|
|
694
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
695
|
+
try {
|
|
696
|
+
for(_iterator = params.author[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
697
|
+
a = _step.value;
|
|
698
|
+
searchParams.append('author', a);
|
|
568
699
|
}
|
|
569
|
-
|
|
570
|
-
|
|
700
|
+
} catch (err) {
|
|
701
|
+
_didIteratorError = true;
|
|
702
|
+
_iteratorError = err;
|
|
703
|
+
} finally{
|
|
704
|
+
try {
|
|
705
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
706
|
+
_iterator.return();
|
|
707
|
+
}
|
|
708
|
+
} finally{
|
|
709
|
+
if (_didIteratorError) {
|
|
710
|
+
throw _iteratorError;
|
|
711
|
+
}
|
|
571
712
|
}
|
|
572
|
-
|
|
573
|
-
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (params.visibility) {
|
|
716
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
717
|
+
try {
|
|
718
|
+
for(_iterator1 = params.visibility[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
719
|
+
v = _step1.value;
|
|
720
|
+
searchParams.append('visibility', v);
|
|
574
721
|
}
|
|
575
|
-
|
|
576
|
-
|
|
722
|
+
} catch (err) {
|
|
723
|
+
_didIteratorError1 = true;
|
|
724
|
+
_iteratorError1 = err;
|
|
725
|
+
} finally{
|
|
726
|
+
try {
|
|
727
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
728
|
+
_iterator1.return();
|
|
729
|
+
}
|
|
730
|
+
} finally{
|
|
731
|
+
if (_didIteratorError1) {
|
|
732
|
+
throw _iteratorError1;
|
|
733
|
+
}
|
|
577
734
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
if (params.since) {
|
|
738
|
+
searchParams.set('since', params.since);
|
|
739
|
+
}
|
|
740
|
+
if (params.sort) {
|
|
741
|
+
searchParams.set('sort', params.sort);
|
|
742
|
+
}
|
|
743
|
+
if (params.dir) {
|
|
744
|
+
searchParams.set('dir', params.dir);
|
|
745
|
+
}
|
|
746
|
+
if (params.cursor) {
|
|
747
|
+
searchParams.set('cursor', params.cursor);
|
|
589
748
|
}
|
|
749
|
+
if (params.limit !== undefined) {
|
|
750
|
+
searchParams.set('limit', String(params.limit));
|
|
751
|
+
}
|
|
752
|
+
qs = searchParams.toString();
|
|
753
|
+
return [
|
|
754
|
+
2,
|
|
755
|
+
this.request('GET', "/v1/artifacts".concat(qs ? "?".concat(qs) : ''))
|
|
756
|
+
];
|
|
590
757
|
});
|
|
591
758
|
}).call(this);
|
|
592
759
|
}
|
|
@@ -940,6 +1107,15 @@ export var ApiClient = /*#__PURE__*/ function() {
|
|
|
940
1107
|
}
|
|
941
1108
|
throw new ApiError((_parsed_message = parsed.message) !== null && _parsed_message !== void 0 ? _parsed_message : "API error ".concat(res.status), res.status, parsed.details, parsed.reason, parsed.error);
|
|
942
1109
|
case 3:
|
|
1110
|
+
// 204 No Content (and 205 Reset Content) carry no body. Calling
|
|
1111
|
+
// res.json() on them throws SyntaxError; return undefined so void-
|
|
1112
|
+
// typed callers (deleteComment, unwatchArtifact) are satisfied.
|
|
1113
|
+
if (res.status === 204 || res.status === 205) {
|
|
1114
|
+
return [
|
|
1115
|
+
2,
|
|
1116
|
+
undefined
|
|
1117
|
+
];
|
|
1118
|
+
}
|
|
943
1119
|
return [
|
|
944
1120
|
2,
|
|
945
1121
|
res.json()
|
package/dist/main-helpers.js
CHANGED
|
@@ -287,6 +287,17 @@ function _ts_generator(thisArg, body) {
|
|
|
287
287
|
}
|
|
288
288
|
import { extname } from 'node:path';
|
|
289
289
|
export var DEFAULT_API_URL = 'https://api.display.dev';
|
|
290
|
+
export function classifyApiKey(apiKey) {
|
|
291
|
+
// BA mints keys with no separator after the prefix — `sk_live<body>`,
|
|
292
|
+
// not `sk_live_<body>`. Mirrors the live check at api/src/guards/auth.guard.ts.
|
|
293
|
+
if (apiKey.startsWith('sk_live')) {
|
|
294
|
+
return 'user';
|
|
295
|
+
}
|
|
296
|
+
if (apiKey.startsWith('org_live')) {
|
|
297
|
+
return 'org';
|
|
298
|
+
}
|
|
299
|
+
return 'session';
|
|
300
|
+
}
|
|
290
301
|
export var InvalidFlagError = /*#__PURE__*/ function(Error1) {
|
|
291
302
|
"use strict";
|
|
292
303
|
_inherits(InvalidFlagError, Error1);
|
|
@@ -399,7 +410,8 @@ export function resolveAuth(env, config) {
|
|
|
399
410
|
var apiUrl = (_ref = (_env_DISPLAYDEV_API_URL = env.DISPLAYDEV_API_URL) !== null && _env_DISPLAYDEV_API_URL !== void 0 ? _env_DISPLAYDEV_API_URL : config === null || config === void 0 ? void 0 : config.apiUrl) !== null && _ref !== void 0 ? _ref : DEFAULT_API_URL;
|
|
400
411
|
return {
|
|
401
412
|
apiKey: apiKey,
|
|
402
|
-
apiUrl: apiUrl
|
|
413
|
+
apiUrl: apiUrl,
|
|
414
|
+
keyType: classifyApiKey(apiKey)
|
|
403
415
|
};
|
|
404
416
|
}
|
|
405
417
|
export function classifyBrandingError(message) {
|