@displaydev/cli 0.13.0 → 0.16.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.
@@ -448,14 +448,15 @@ export var ApiClient = /*#__PURE__*/ function() {
448
448
  value: /**
449
449
  * Metadata-only rename: updates the artifact's display name and
450
450
  * re-derives the URL slug. Does not bump the version or touch
451
- * storage. Maps to `PATCH /v1/artifacts/:shortId` — see
452
- * feat-artifact-rename.md §2a.
451
+ * storage. Maps to `POST /v1/artifacts/:shortId/rename` — see
452
+ * feat-artifact-rename.md §2a + api-conventions.md §1.3 (atomic
453
+ * action endpoints over generic PATCH).
453
454
  */ function renameArtifact(shortId, name) {
454
455
  return _async_to_generator(function() {
455
456
  return _ts_generator(this, function(_state) {
456
457
  return [
457
458
  2,
458
- this.request('PATCH', "/v1/artifacts/".concat(shortId), {
459
+ this.request('POST', "/v1/artifacts/".concat(shortId, "/rename"), {
459
460
  name: name
460
461
  })
461
462
  ];
@@ -521,8 +522,8 @@ export var ApiClient = /*#__PURE__*/ function() {
521
522
  if (params.mine) {
522
523
  searchParams.append('author', 'me');
523
524
  }
524
- if (params.published_by) {
525
- searchParams.set('published_by', params.published_by);
525
+ if (params.publishedBy) {
526
+ searchParams.set('publishedBy', params.publishedBy);
526
527
  }
527
528
  if (params.since) {
528
529
  searchParams.set('since', params.since);
@@ -695,7 +696,7 @@ export var ApiClient = /*#__PURE__*/ function() {
695
696
  return _ts_generator(this, function(_state) {
696
697
  return [
697
698
  2,
698
- this.requestNoAuth('POST', '/cli/auth-check', {
699
+ this.requestNoAuth('POST', '/v1/cli/auth-check', {
699
700
  email: email
700
701
  })
701
702
  ];
package/dist/main.js CHANGED
@@ -36,6 +36,19 @@ function _async_to_generator(fn) {
36
36
  });
37
37
  };
38
38
  }
39
+ function _define_property(obj, key, value) {
40
+ if (key in obj) {
41
+ Object.defineProperty(obj, key, {
42
+ value: value,
43
+ enumerable: true,
44
+ configurable: true,
45
+ writable: true
46
+ });
47
+ } else {
48
+ obj[key] = value;
49
+ }
50
+ return obj;
51
+ }
39
52
  function _instanceof(left, right) {
40
53
  "@swc/helpers - instanceof";
41
54
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -50,6 +63,21 @@ function _iterable_to_array(iter) {
50
63
  function _non_iterable_spread() {
51
64
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
52
65
  }
66
+ function _object_spread(target) {
67
+ for(var i = 1; i < arguments.length; i++){
68
+ var source = arguments[i] != null ? arguments[i] : {};
69
+ var ownKeys = Object.keys(source);
70
+ if (typeof Object.getOwnPropertySymbols === "function") {
71
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
72
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
73
+ }));
74
+ }
75
+ ownKeys.forEach(function(key) {
76
+ _define_property(target, key, source[key]);
77
+ });
78
+ }
79
+ return target;
80
+ }
53
81
  function _to_consumable_array(arr) {
54
82
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
55
83
  }
@@ -728,7 +756,7 @@ program.command('find [query]').description('Search for artifacts').option('--by
728
756
  4,
729
757
  client.find({
730
758
  query: query,
731
- published_by: opts.by,
759
+ publishedBy: opts.by,
732
760
  mine: opts.mine,
733
761
  since: opts.since,
734
762
  sort: opts.sort,
@@ -935,7 +963,7 @@ function openBrowser(url) {
935
963
  // --- login ---
936
964
  program.command('login').description('Authenticate with display.dev').option('--email <email>', 'Email address').option('--code <code>', 'OTP code (verify step; pair with --email)').option('--api-key [key]', 'Authenticate with an API key').option('--json', 'Machine-readable output (structured status, no prose)').action(function(opts) {
937
965
  return _async_to_generator(function() {
938
- var _process_env_DISPLAYDEV_API_URL, emit, emitErr, apiUrl, client, key, unused, rl, validation, email, rl1, method, check, unused1, err, msg, code, rl2, result, unused2, deviceResult, unused3, device_code, verification_uri_complete, initialInterval, expires_in, token, err1;
966
+ var _process_env_DISPLAYDEV_API_URL, emit, emitErr, apiUrl, client, key, unused, rl, validation, email, rl1, method, check, unused1, err, msg, code, rl2, result, unused2, deviceResult, unused3, device_code, verification_uri_complete, initialInterval, expires_in, tickCapMs, sleep, token, err1;
939
967
  return _ts_generator(this, function(_state) {
940
968
  switch(_state.label){
941
969
  case 0:
@@ -1306,12 +1334,23 @@ program.command('login').description('Authenticate with display.dev').option('--
1306
1334
  ,
1307
1335
  39
1308
1336
  ]);
1337
+ // DISPLAYDEV_TEST_TICK_MS caps each polling sleep so login-sso.spec.ts
1338
+ // doesn't burn real wall-clock seconds on the slow_down branch
1339
+ // (which adds +5s to interval). Same convention as DISPLAYDEV_SKIP_BROWSER.
1340
+ tickCapMs = Number(process.env.DISPLAYDEV_TEST_TICK_MS);
1341
+ sleep = Number.isFinite(tickCapMs) && tickCapMs > 0 ? function(ms) {
1342
+ return new Promise(function(resolve) {
1343
+ return setTimeout(resolve, Math.min(ms, tickCapMs));
1344
+ });
1345
+ } : undefined;
1309
1346
  return [
1310
1347
  4,
1311
- pollDeviceToken(client, device_code, 'dsp-cli', {
1348
+ pollDeviceToken(client, device_code, 'dsp-cli', _object_spread({
1312
1349
  intervalMs: (initialInterval || 5) * 1000,
1313
1350
  expiresAt: Date.now() + (expires_in || 600) * 1000
1314
- })
1351
+ }, sleep ? {
1352
+ sleep: sleep
1353
+ } : {}))
1315
1354
  ];
1316
1355
  case 36:
1317
1356
  token = _state.sent();
@@ -1354,8 +1393,8 @@ program.command('login').description('Authenticate with display.dev').option('--
1354
1393
  });
1355
1394
  })();
1356
1395
  });
1357
- // --- branding ---
1358
- program.command('branding <shortId> <mode>').description('Override display.dev branding for an existing artifact without re-publishing (show|hide|inherit)').action(function(shortId, modeRaw) {
1396
+ // --- set-branding ---
1397
+ program.command('set-branding <shortId> <mode>').description('Override display.dev branding for an existing artifact without re-publishing (show|hide|inherit)').action(function(shortId, modeRaw) {
1359
1398
  return _async_to_generator(function() {
1360
1399
  var mode, auth, client, result, err, msg;
1361
1400
  return _ts_generator(this, function(_state) {
@@ -27,6 +27,19 @@ function _async_to_generator(fn) {
27
27
  });
28
28
  };
29
29
  }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
30
43
  function _instanceof(left, right) {
31
44
  "@swc/helpers - instanceof";
32
45
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -35,6 +48,57 @@ function _instanceof(left, right) {
35
48
  return left instanceof right;
36
49
  }
37
50
  }
51
+ function _object_spread(target) {
52
+ for(var i = 1; i < arguments.length; i++){
53
+ var source = arguments[i] != null ? arguments[i] : {};
54
+ var ownKeys = Object.keys(source);
55
+ if (typeof Object.getOwnPropertySymbols === "function") {
56
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
57
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
58
+ }));
59
+ }
60
+ ownKeys.forEach(function(key) {
61
+ _define_property(target, key, source[key]);
62
+ });
63
+ }
64
+ return target;
65
+ }
66
+ function _object_without_properties(source, excluded) {
67
+ if (source == null) return {};
68
+ var target = {}, sourceKeys, key, i;
69
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
70
+ sourceKeys = Reflect.ownKeys(Object(source));
71
+ for(i = 0; i < sourceKeys.length; i++){
72
+ key = sourceKeys[i];
73
+ if (excluded.indexOf(key) >= 0) continue;
74
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
75
+ target[key] = source[key];
76
+ }
77
+ return target;
78
+ }
79
+ target = _object_without_properties_loose(source, excluded);
80
+ if (Object.getOwnPropertySymbols) {
81
+ sourceKeys = Object.getOwnPropertySymbols(source);
82
+ for(i = 0; i < sourceKeys.length; i++){
83
+ key = sourceKeys[i];
84
+ if (excluded.indexOf(key) >= 0) continue;
85
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
86
+ target[key] = source[key];
87
+ }
88
+ }
89
+ return target;
90
+ }
91
+ function _object_without_properties_loose(source, excluded) {
92
+ if (source == null) return {};
93
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
94
+ for(i = 0; i < sourceKeys.length; i++){
95
+ key = sourceKeys[i];
96
+ if (excluded.indexOf(key) >= 0) continue;
97
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
98
+ target[key] = source[key];
99
+ }
100
+ return target;
101
+ }
38
102
  function _ts_generator(thisArg, body) {
39
103
  var f, y, t, _ = {
40
104
  label: 0,
@@ -577,7 +641,7 @@ export function registerTools(server, api) {
577
641
  limit: z.number().optional().describe('Max results to return (1-100)')
578
642
  }, function(args) {
579
643
  return _async_to_generator(function() {
580
- var results, err;
644
+ var publishedBy, rest, results, err;
581
645
  return _ts_generator(this, function(_state) {
582
646
  switch(_state.label){
583
647
  case 0:
@@ -587,9 +651,19 @@ export function registerTools(server, api) {
587
651
  ,
588
652
  3
589
653
  ]);
654
+ // Translate the snake_case MCP arg to the camelCase wire shape that
655
+ // ApiClient.find() forwards to GET /v1/artifacts. MCP convention
656
+ // prefers snake_case in tool schemas; the wire is camelCase
657
+ // (api-conventions §1.2). Without this map, `published_by` was
658
+ // silently dropped on the floor and the filter went unfiltered.
659
+ publishedBy = args.published_by, rest = _object_without_properties(args, [
660
+ "published_by"
661
+ ]);
590
662
  return [
591
663
  4,
592
- api.find(args)
664
+ api.find(_object_spread({}, rest, publishedBy !== undefined ? {
665
+ publishedBy: publishedBy
666
+ } : {}))
593
667
  ];
594
668
  case 1:
595
669
  results = _state.sent();
@@ -878,7 +952,7 @@ export function registerTools(server, api) {
878
952
  // Metadata-only: does NOT bump the artifact version. Use the `publish`
879
953
  // tool (with `show_branding`) when you're changing content at the same
880
954
  // time so both writes happen in one transaction.
881
- server.tool('branding', 'Override display.dev branding for an existing artifact without re-publishing. Paid tiers only (free-tier orgs must keep inherit).', {
955
+ server.tool('set_branding', 'Override display.dev branding for an existing artifact without re-publishing. Paid tiers only (free-tier orgs must keep inherit).', {
882
956
  short_id: z.string().describe('Artifact shortId'),
883
957
  show_branding: z.enum([
884
958
  'show',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@displaydev/cli",
3
- "version": "0.13.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dsp": "dist/main.js"
@@ -17,14 +17,14 @@
17
17
  "test": "vitest run"
18
18
  },
19
19
  "dependencies": {
20
- "@modelcontextprotocol/sdk": "^1.29.0",
21
- "commander": "^14.0.3",
22
- "zod": "^4.3.6"
20
+ "@modelcontextprotocol/sdk": "1.29.0",
21
+ "commander": "14.0.3",
22
+ "zod": "4.3.6"
23
23
  },
24
24
  "devDependencies": {
25
- "@swc/cli": "^0.7.10",
26
- "@swc/core": "^1.15.24",
27
- "@types/node": "^24.12.2",
28
- "vitest": "^4.1.2"
25
+ "@swc/cli": "0.7.10",
26
+ "@swc/core": "1.15.24",
27
+ "@types/node": "24.12.2",
28
+ "vitest": "4.1.2"
29
29
  }
30
30
  }