@displaydev/cli 0.8.0 → 0.9.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.
@@ -561,17 +561,29 @@ export var ApiClient = /*#__PURE__*/ function() {
561
561
  {
562
562
  key: "exportSource",
563
563
  value: /**
564
- * Fetch the raw source bytes of an artifact (the markdown for `.md`,
565
- * the served HTML for `.html`). Returns the body plus the response's
566
- * Content-Type so callers can disambiguate. Throws `ApiError` on
567
- * non-2xx (the CLI maps 404 to a clean message + exit 4).
568
- */ function exportSource(shortId, version) {
564
+ * Fetch the source bytes of an artifact. `format: 'original'` returns
565
+ * the publisher's upload (markdown for `.md`, HTML for `.html`).
566
+ * `format: 'markdown'` returns markdown regardless `.md` is unchanged,
567
+ * `.html` is converted server-side via Workers AI (cached).
568
+ *
569
+ * Returns the body plus the response's Content-Type. Throws `ApiError`
570
+ * on non-2xx (CLI maps 404 to a clean message + exit 4).
571
+ */ function exportSource(shortId, version, format) {
569
572
  return _async_to_generator(function() {
570
- var _res_headers_get, qs, url, res, _parsed_message, text, parsed, arrayBuffer;
573
+ var _res_headers_get, params, qs, url, res, _parsed_message, text, parsed, arrayBuffer;
571
574
  return _ts_generator(this, function(_state) {
572
575
  switch(_state.label){
573
576
  case 0:
574
- qs = version !== undefined ? "?v=".concat(version) : '';
577
+ params = [];
578
+ if (version !== undefined) {
579
+ params.push("v=".concat(version));
580
+ }
581
+ // `original` is the API default — omit so smoke tests / network
582
+ // logs aren't littered with redundant query params.
583
+ if (format !== undefined && format !== 'original') {
584
+ params.push("format=".concat(format));
585
+ }
586
+ qs = params.length > 0 ? "?".concat(params.join('&')) : '';
575
587
  url = "".concat(this.baseUrl, "/v1/artifacts/").concat(shortId, "/source").concat(qs);
576
588
  return [
577
589
  4,
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) {
@@ -781,7 +781,7 @@ program.command('get <shortId>').description('Get artifact details').option('--i
781
781
  })();
782
782
  });
783
783
  // --- export ---
784
- program.command('export <shortId>').description('Print the published source bytes to stdout. Pin a version with @<n>.').action(function(shortIdArg) {
784
+ program.command('export <shortId>').description('Print the published source bytes to stdout. Pin a version with @<n>.').option('--format <format>', 'Representation: "original" (default — bytes as uploaded) or "markdown" (.html artifacts are converted via Workers AI).', 'original').action(function(shortIdArg, opts) {
785
785
  return _async_to_generator(function() {
786
786
  var parsed, auth, client, result, err, msg;
787
787
  return _ts_generator(this, function(_state) {
@@ -792,6 +792,10 @@ program.command('export <shortId>').description('Print the published source byte
792
792
  console.error('Invalid argument. Expected <shortId> or <shortId>@<version> (version must be a positive integer).');
793
793
  process.exit(2);
794
794
  }
795
+ if (opts.format !== 'original' && opts.format !== 'markdown') {
796
+ console.error('Invalid --format. Expected "original" or "markdown".');
797
+ process.exit(2);
798
+ }
795
799
  return [
796
800
  4,
797
801
  resolveAuthOrConfig()
@@ -809,7 +813,7 @@ program.command('export <shortId>').description('Print the published source byte
809
813
  ]);
810
814
  return [
811
815
  4,
812
- client.exportSource(parsed.shortId, parsed.version)
816
+ client.exportSource(parsed.shortId, parsed.version, opts.format)
813
817
  ];
814
818
  case 3:
815
819
  result = _state.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@displaydev/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "dsp": "dist/main.js"