@displaydev/cli 0.7.0 → 0.8.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.
@@ -434,6 +434,26 @@ export var ApiClient = /*#__PURE__*/ function() {
434
434
  return form;
435
435
  }
436
436
  },
437
+ {
438
+ key: "renameArtifact",
439
+ value: /**
440
+ * Metadata-only rename: updates the artifact's display name and
441
+ * re-derives the URL slug. Does not bump the version or touch
442
+ * storage. Maps to `PATCH /v1/artifacts/:shortId` — see
443
+ * feat-artifact-rename.md §2a.
444
+ */ function renameArtifact(shortId, name) {
445
+ return _async_to_generator(function() {
446
+ return _ts_generator(this, function(_state) {
447
+ return [
448
+ 2,
449
+ this.request('PATCH', "/v1/artifacts/".concat(shortId), {
450
+ name: name
451
+ })
452
+ ];
453
+ });
454
+ }).call(this);
455
+ }
456
+ },
437
457
  {
438
458
  key: "getOrgBranding",
439
459
  value: function getOrgBranding() {
package/dist/main.js CHANGED
@@ -250,7 +250,7 @@ function parseShowBrandingOrExit(raw) {
250
250
  }
251
251
  }
252
252
  // --- publish ---
253
- program.command('publish <path>').description('Publish an HTML or Markdown file. Use "-" to read from stdin (requires --id).').option('--name <name>', 'Artifact display name').option('--id <shortId>', 'Update existing artifact (new version)').option('--public', 'Make artifact publicly accessible (alias for --visibility public)').option('--company', 'Restrict artifact to company auth (alias for --visibility company)').option('--visibility <level>', 'public | company | private. "private" requires the Teams plan.').option('--share <email>', 'Add an email to sharedWith (repeatable; alias for --share-with)', collectEmails, []).option('--share-with <emails>', 'Comma-separated email list for sharedWith', function(val) {
253
+ program.command('publish <path>').description('Publish an HTML or Markdown file. Use "-" to read from stdin (requires --id).').option('--name <name>', 'Artifact display name').option('--id <shortId>', 'Update existing artifact (new version)').option('--public', 'Make artifact publicly accessible (alias for --visibility public)').option('--company', 'Restrict artifact to company auth (alias for --visibility company)').option('--visibility <level>', 'public | company | private. "private" requires the Pro plan.').option('--share <email>', 'Add an email to sharedWith (repeatable; alias for --share-with)', collectEmails, []).option('--share-with <emails>', 'Comma-separated email list for sharedWith', function(val) {
254
254
  return val.split(',').map(function(e) {
255
255
  return e.trim();
256
256
  }).filter(Boolean);
@@ -529,7 +529,7 @@ program.command('publish <path>').description('Publish an HTML or Markdown file.
529
529
  })();
530
530
  });
531
531
  // --- share ---
532
- program.command('share <shortId>').description('Change an artifact\'s visibility and/or add/remove shared-with emails.').option('--visibility <level>', 'public | company | private. "private" requires the Teams plan.').option('--add-users <emails>', 'Comma-separated emails to add to sharedWith', function(val) {
532
+ program.command('share <shortId>').description('Change an artifact\'s visibility and/or add/remove shared-with emails.').option('--visibility <level>', 'public | company | private. "private" requires the Pro plan.').option('--add-users <emails>', 'Comma-separated emails to add to sharedWith', function(val) {
533
533
  return val.split(',').map(function(e) {
534
534
  return e.trim();
535
535
  }).filter(Boolean);
@@ -584,7 +584,7 @@ program.command('share <shortId>').description('Change an artifact\'s visibility
584
584
  case 4:
585
585
  err = _state.sent();
586
586
  if (_instanceof(err, ApiError) && err.status === 402) {
587
- console.error('Error: Private visibility requires the Teams plan. Upgrade at https://display.dev/pricing');
587
+ console.error('Error: Private visibility requires the Pro plan. Upgrade at https://display.dev/pricing');
588
588
  process.exit(1);
589
589
  }
590
590
  if (_instanceof(err, ApiError) && err.status === 404) {
@@ -618,6 +618,65 @@ program.command('share <shortId>').description('Change an artifact\'s visibility
618
618
  });
619
619
  })();
620
620
  });
621
+ // --- rename ---
622
+ program.command('rename <shortId>').description('Rename a published artifact. Slug re-derives from the new name; old URLs still resolve via shortId.').requiredOption('--name <name>', 'New display name').action(function(shortId, opts) {
623
+ return _async_to_generator(function() {
624
+ var auth, client, result, err, msg;
625
+ return _ts_generator(this, function(_state) {
626
+ switch(_state.label){
627
+ case 0:
628
+ return [
629
+ 4,
630
+ resolveAuthOrConfig()
631
+ ];
632
+ case 1:
633
+ auth = _state.sent();
634
+ client = createClient(auth);
635
+ _state.label = 2;
636
+ case 2:
637
+ _state.trys.push([
638
+ 2,
639
+ 4,
640
+ ,
641
+ 5
642
+ ]);
643
+ return [
644
+ 4,
645
+ client.renameArtifact(shortId, opts.name)
646
+ ];
647
+ case 3:
648
+ result = _state.sent();
649
+ console.log(result.url);
650
+ console.log("Renamed to ".concat(result.name, " (").concat(result.shortId, ")"));
651
+ return [
652
+ 3,
653
+ 5
654
+ ];
655
+ case 4:
656
+ err = _state.sent();
657
+ if (_instanceof(err, ApiError) && err.status === 404) {
658
+ console.error("Artifact not found: ".concat(shortId));
659
+ process.exit(4);
660
+ }
661
+ if (_instanceof(err, ApiError) && err.status === 401) {
662
+ console.error('Your credential is no longer valid. Run: dsp login (or rotate DISPLAYDEV_API_KEY).');
663
+ process.exit(1);
664
+ }
665
+ msg = _instanceof(err, Error) ? err.message : String(err);
666
+ console.error(msg);
667
+ process.exit(1);
668
+ return [
669
+ 3,
670
+ 5
671
+ ];
672
+ case 5:
673
+ return [
674
+ 2
675
+ ];
676
+ }
677
+ });
678
+ })();
679
+ });
621
680
  // --- find ---
622
681
  program.command('find [query]').description('Search for artifacts').option('--by <email>', 'Filter by publisher email').option('--mine', 'Show only artifacts you published').option('--since <date>', 'Filter by date (ISO format)').option('--sort <col>', 'Sort column: updated_at, view_count, name', 'updated_at').option('--dir <direction>', 'Sort direction: asc or desc').option('--limit <n>', 'Max rows to fetch (1-100)', function(v) {
623
682
  return parseInt(v, 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@displaydev/cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dsp": "dist/main.js"