@contentful/experience-design-system-cli 2.35.1-dev-build-a963233a.0 → 2.35.1-dev-build-215f38d1.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/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // packages/experience-design-system-cli/app.tsx
2
- import { useState as useState9 } from "react";
2
+ import { useState as useState10 } from "react";
3
3
 
4
4
  // packages/experience-design-system-cli/src/tui/home/home.tsx
5
5
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -304,6 +304,123 @@ function WelcomeScreen({ onContinue, onQuit }) {
304
304
  ] });
305
305
  }
306
306
 
307
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
308
+ import { useState as useState4 } from "react";
309
+ import { Box as Box4, Text as Text4 } from "ink";
310
+ import TextInput2 from "ink-text-input";
311
+
312
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
313
+ import { useInput as useInput4 } from "ink";
314
+
315
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
316
+ function isPlainKeyOnEmptyField(value, input, key, expected) {
317
+ return value === "" && input === expected && !key.ctrl && !key.meta;
318
+ }
319
+ function shouldGoBack(value, input, key) {
320
+ return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
321
+ }
322
+ function shouldSkip(value, input, key) {
323
+ return isPlainKeyOnEmptyField(value, input, key, "s");
324
+ }
325
+ function toTokenPath(value) {
326
+ const tokenPath = value.trim();
327
+ return tokenPath === "" ? null : tokenPath;
328
+ }
329
+
330
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
331
+ var TOKEN_INPUT_CONTROLS = [
332
+ { keys: "Enter", label: "Continue (skips if empty)" },
333
+ { keys: "s", label: "Skip" },
334
+ { keys: "Esc/q", label: "Back" }
335
+ ];
336
+ function useTokenInputControls(tokenPath, onSkip, onBack) {
337
+ useInput4((input, key) => {
338
+ if (shouldGoBack(tokenPath, input, key)) onBack();
339
+ else if (shouldSkip(tokenPath, input, key)) onSkip();
340
+ });
341
+ }
342
+
343
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
344
+ import { statSync } from "node:fs";
345
+ import { homedir } from "node:os";
346
+ import { resolve } from "node:path";
347
+ function stripQuotes(value) {
348
+ const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
349
+ return value.length >= 2 && quoted ? value.slice(1, -1) : value;
350
+ }
351
+ function expandHome(value) {
352
+ return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
353
+ }
354
+ function validateTokenPath(rawPath) {
355
+ const path = resolve(expandHome(stripQuotes(rawPath.trim())));
356
+ let stats;
357
+ try {
358
+ stats = statSync(path);
359
+ } catch {
360
+ return { ok: false, error: `Path not found: ${path}`, resolvedPath: path };
361
+ }
362
+ if (stats.isDirectory()) {
363
+ return {
364
+ ok: false,
365
+ error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
366
+ resolvedPath: path
367
+ };
368
+ }
369
+ if (!stats.isFile()) {
370
+ return { ok: false, error: `Not a regular file: ${path}`, resolvedPath: path };
371
+ }
372
+ return { ok: true, path };
373
+ }
374
+
375
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
376
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
377
+ function TokenInputScreen({ onConfirm, onSkip, onBack }) {
378
+ const [tokenPath, setTokenPath] = useState4("");
379
+ const [failure, setFailure] = useState4(null);
380
+ useTokenInputControls(tokenPath, onSkip, onBack);
381
+ const change = (value) => {
382
+ setTokenPath(value);
383
+ setFailure(null);
384
+ };
385
+ const submit = (value) => {
386
+ const rawPath = toTokenPath(value);
387
+ if (!rawPath) {
388
+ onSkip();
389
+ return;
390
+ }
391
+ const check = validateTokenPath(rawPath);
392
+ if (check.ok) onConfirm(check.path);
393
+ else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
394
+ };
395
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
396
+ /* @__PURE__ */ jsx4(Text4, { bold: true, children: "Design tokens" }),
397
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "Point me to your raw token file (e.g. ~/design-tokens/tokens.json). You can use ~, relative, or absolute paths. Claude will map it to DTCG format." }),
398
+ /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
399
+ /* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
400
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
401
+ /* @__PURE__ */ jsx4(Text4, { children: "Token path:" }),
402
+ /* @__PURE__ */ jsx4(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
403
+ ] }),
404
+ failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
405
+ /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.error, children: [
406
+ "\u2717 ",
407
+ failure.error
408
+ ] }),
409
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
410
+ " Resolved to: ",
411
+ failure.resolvedPath
412
+ ] })
413
+ ] })
414
+ ] }),
415
+ /* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
416
+ "[",
417
+ control.keys,
418
+ "] ",
419
+ control.label
420
+ ] }, control.keys)) })
421
+ ] });
422
+ }
423
+
307
424
  // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
308
425
  import { spawn } from "node:child_process";
309
426
 
@@ -331,6 +448,12 @@ function buildArgs(options) {
331
448
  if (options.project) {
332
449
  args.push("--project", options.project);
333
450
  }
451
+ if (options.tokens) {
452
+ args.push("--tokens", options.tokens);
453
+ }
454
+ if (options.skipTokenPrompt) {
455
+ args.push("--skip-token-prompt");
456
+ }
334
457
  return args;
335
458
  }
336
459
  async function spawnV1Import(options = {}) {
@@ -354,7 +477,7 @@ function getTerminalHandle() {
354
477
  return process.stdin._handle;
355
478
  }
356
479
  async function stopReadingTerminal() {
357
- await new Promise((resolve) => setImmediate(resolve));
480
+ await new Promise((resolve2) => setImmediate(resolve2));
358
481
  const handle = getTerminalHandle();
359
482
  if (!handle?.readStop) return;
360
483
  handle.reading = false;
@@ -369,7 +492,7 @@ function startReadingTerminal() {
369
492
 
370
493
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
371
494
  import { useEffect as useEffect3 } from "react";
372
- import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
495
+ import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
373
496
 
374
497
  // packages/experience-design-system-cli/src/tui/debug-store.ts
375
498
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
@@ -543,7 +666,7 @@ process.once("SIGINT", () => {
543
666
  });
544
667
 
545
668
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
546
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
669
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
547
670
  function HelpScreen({ onDone }) {
548
671
  useEffect3(() => {
549
672
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
@@ -552,7 +675,7 @@ function HelpScreen({ onDone }) {
552
675
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
553
676
  onDone();
554
677
  };
555
- useInput4((input, key) => {
678
+ useInput5((input, key) => {
556
679
  if (key.return) {
557
680
  leave("saved");
558
681
  return;
@@ -562,30 +685,30 @@ function HelpScreen({ onDone }) {
562
685
  return;
563
686
  }
564
687
  });
565
- return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
566
- /* @__PURE__ */ jsx4(Text4, { bold: true, children: "Help" }),
567
- /* @__PURE__ */ jsx4(Text4, { children: " " }),
568
- /* @__PURE__ */ jsx4(Text4, { children: "This is a placeholder screen for v2 help content." }),
569
- /* @__PURE__ */ jsx4(Text4, { children: " " }),
570
- /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
688
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
689
+ /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Help" }),
690
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
691
+ /* @__PURE__ */ jsx5(Text5, { children: "This is a placeholder screen for v2 help content." }),
692
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
693
+ /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
571
694
  ] });
572
695
  }
573
696
 
574
697
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
575
- import { useState as useState4 } from "react";
576
- import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
577
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
698
+ import { useState as useState5 } from "react";
699
+ import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
700
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
578
701
  function SettingsScreen({
579
702
  onNavigate,
580
703
  onBack
581
704
  }) {
582
- const [focusIdx, setFocusIdx] = useState4(0);
705
+ const [focusIdx, setFocusIdx] = useState5(0);
583
706
  const items = [
584
707
  { label: "Configuration", screen: "settings-configuration" },
585
708
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
586
709
  { label: "Debug Mode", screen: "settings-debug-mode" }
587
710
  ];
588
- useInput5((input, key) => {
711
+ useInput6((input, key) => {
589
712
  if (key.upArrow) {
590
713
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
591
714
  return;
@@ -605,27 +728,27 @@ function SettingsScreen({
605
728
  onBack();
606
729
  }
607
730
  });
608
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
609
- /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Settings" }),
610
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
611
- items.map((item, i) => /* @__PURE__ */ jsxs5(Text5, { color: i === focusIdx ? "cyan" : void 0, children: [
731
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
732
+ /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Settings" }),
733
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
734
+ items.map((item, i) => /* @__PURE__ */ jsxs6(Text6, { color: i === focusIdx ? "cyan" : void 0, children: [
612
735
  i === focusIdx ? "> " : " ",
613
736
  item.label
614
737
  ] }, item.label)),
615
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
616
- /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
738
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
739
+ /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
617
740
  ] });
618
741
  }
619
742
 
620
743
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
621
- import { useEffect as useEffect4, useState as useState5 } from "react";
622
- import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
744
+ import { useEffect as useEffect4, useState as useState6 } from "react";
745
+ import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
623
746
 
624
747
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
625
748
  import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
626
749
  import { join as join6 } from "node:path";
627
- import { homedir } from "node:os";
628
- var V1_STORE_PATH = join6(homedir(), ".config", "experiences", "credentials.json");
750
+ import { homedir as homedir2 } from "node:os";
751
+ var V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
629
752
  async function readV1Store() {
630
753
  try {
631
754
  const raw = await readFile2(V1_STORE_PATH, "utf8");
@@ -635,7 +758,7 @@ async function readV1Store() {
635
758
  }
636
759
  }
637
760
  async function writeV1Store(data) {
638
- await mkdir3(join6(homedir(), ".config", "experiences"), { recursive: true });
761
+ await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
639
762
  await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
640
763
  `, { mode: 384 });
641
764
  }
@@ -663,7 +786,7 @@ async function writeCredentials(config) {
663
786
  }
664
787
 
665
788
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
666
- import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
789
+ import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
667
790
  var FIELD_ORDER = ["spaceId", "environmentId", "cmaToken", "host"];
668
791
  function debugFields(config) {
669
792
  return {
@@ -680,10 +803,10 @@ var FIELD_LABELS = {
680
803
  host: "API Host (optional)"
681
804
  };
682
805
  function ConfigurationScreen({ onDone }) {
683
- const [stage, setStage] = useState5("loading");
684
- const [config, setConfig] = useState5(null);
685
- const [activeField, setActiveField] = useState5("spaceId");
686
- const [message, setMessage] = useState5(null);
806
+ const [stage, setStage] = useState6("loading");
807
+ const [config, setConfig] = useState6(null);
808
+ const [activeField, setActiveField] = useState6("spaceId");
809
+ const [message, setMessage] = useState6(null);
687
810
  useEffect4(() => {
688
811
  readCredentials().then((cfg) => {
689
812
  setConfig(cfg);
@@ -716,7 +839,7 @@ function ConfigurationScreen({ onDone }) {
716
839
  setStage("form");
717
840
  });
718
841
  }
719
- useInput6((input, key) => {
842
+ useInput7((input, key) => {
720
843
  if (stage === "loading" || stage === "saving") return;
721
844
  if (stage === "saved") {
722
845
  if (key.return || key.escape || input === "q") {
@@ -759,57 +882,57 @@ function ConfigurationScreen({ onDone }) {
759
882
  }
760
883
  });
761
884
  if (stage === "loading") {
762
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
763
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
764
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
765
- /* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." })
885
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
886
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
887
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
888
+ /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
766
889
  ] });
767
890
  }
768
891
  if (stage === "saved") {
769
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
770
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
771
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
772
- /* @__PURE__ */ jsxs6(Text6, { color: PALETTE.success, children: [
892
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
893
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
894
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
895
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
773
896
  "\u2713 ",
774
897
  message
775
898
  ] }),
776
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
777
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter] Back to Settings" })
899
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
900
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
778
901
  ] });
779
902
  }
780
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
781
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
782
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
783
- /* @__PURE__ */ jsx6(Text6, { children: "Contentful API Credentials" }),
784
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
785
- /* @__PURE__ */ jsx6(Box6, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
903
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
904
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
905
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
906
+ /* @__PURE__ */ jsx7(Text7, { children: "Contentful API Credentials" }),
907
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
908
+ /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
786
909
  const isActive = activeField === field;
787
910
  const value = fieldValue(field);
788
911
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
789
- return /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
790
- /* @__PURE__ */ jsx6(Text6, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
791
- /* @__PURE__ */ jsxs6(Text6, { bold: isActive, children: [
912
+ return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
913
+ /* @__PURE__ */ jsx7(Text7, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
914
+ /* @__PURE__ */ jsxs7(Text7, { bold: isActive, children: [
792
915
  FIELD_LABELS[field],
793
916
  ":"
794
917
  ] }),
795
- /* @__PURE__ */ jsx6(Text6, { children: display || /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "(empty)" }) })
918
+ /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
796
919
  ] }, field);
797
920
  }) }),
798
- message && /* @__PURE__ */ jsxs6(Fragment, { children: [
799
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
800
- /* @__PURE__ */ jsxs6(Text6, { color: PALETTE.error, children: [
921
+ message && /* @__PURE__ */ jsxs7(Fragment, { children: [
922
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
923
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
801
924
  "\u2717 ",
802
925
  message
803
926
  ] })
804
927
  ] }),
805
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
806
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
928
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
929
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
807
930
  ] });
808
931
  }
809
932
 
810
933
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
811
- import { useEffect as useEffect5, useState as useState6 } from "react";
812
- import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
934
+ import { useEffect as useEffect5, useState as useState7 } from "react";
935
+ import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
813
936
 
814
937
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
815
938
  async function readAnalyticsSetting() {
@@ -827,10 +950,10 @@ async function writeAnalyticsSetting(setting) {
827
950
  }
828
951
 
829
952
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
830
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
953
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
831
954
  function OptInAnalyticsScreen({ onDone }) {
832
- const [loading, setLoading] = useState6(true);
833
- const [enabled, setEnabled] = useState6(true);
955
+ const [loading, setLoading] = useState7(true);
956
+ const [enabled, setEnabled] = useState7(true);
834
957
  useEffect5(() => {
835
958
  readAnalyticsSetting().then((setting) => {
836
959
  setEnabled(setting.enabled);
@@ -843,7 +966,7 @@ function OptInAnalyticsScreen({ onDone }) {
843
966
  });
844
967
  });
845
968
  }, []);
846
- useInput7((input, key) => {
969
+ useInput8((input, key) => {
847
970
  if (loading) return;
848
971
  if (key.return || input === " ") {
849
972
  setEnabled((current) => {
@@ -858,31 +981,31 @@ function OptInAnalyticsScreen({ onDone }) {
858
981
  onDone();
859
982
  }
860
983
  });
861
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
862
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
863
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
864
- loading ? /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
865
- /* @__PURE__ */ jsxs7(Text7, { children: [
984
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
985
+ /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
986
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
987
+ loading ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
988
+ /* @__PURE__ */ jsxs8(Text8, { children: [
866
989
  "Share anonymous usage data:",
867
990
  " ",
868
- /* @__PURE__ */ jsx7(Text7, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
991
+ /* @__PURE__ */ jsx8(Text8, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
869
992
  ] }),
870
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
871
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
872
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
993
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
994
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
995
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
873
996
  ] }),
874
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
875
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
997
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
998
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
876
999
  ] });
877
1000
  }
878
1001
 
879
1002
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
880
- import { useEffect as useEffect6, useState as useState7 } from "react";
881
- import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
882
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1003
+ import { useEffect as useEffect6, useState as useState8 } from "react";
1004
+ import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
1005
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
883
1006
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
884
1007
  function UpgradeScreen({ onDone }) {
885
- const [upgradeCheck, setUpgradeCheck] = useState7();
1008
+ const [upgradeCheck, setUpgradeCheck] = useState8();
886
1009
  useEffect6(() => {
887
1010
  startDebugRun({
888
1011
  flow: "upgrade",
@@ -892,7 +1015,7 @@ function UpgradeScreen({ onDone }) {
892
1015
  });
893
1016
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
894
1017
  }, []);
895
- useInput8((_input, key) => {
1018
+ useInput9((_input, key) => {
896
1019
  if (key.return) {
897
1020
  void finishDebugRun({
898
1021
  outputs: upgradeCheck ?? {},
@@ -903,12 +1026,12 @@ function UpgradeScreen({ onDone }) {
903
1026
  return;
904
1027
  }
905
1028
  });
906
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
907
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Upgrade" }),
908
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1029
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1030
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Upgrade" }),
1031
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
909
1032
  renderBody(upgradeCheck),
910
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
911
- /* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.accent, children: [
1033
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1034
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.accent, children: [
912
1035
  FOCUS_MARKER,
913
1036
  " Go Back"
914
1037
  ] })
@@ -916,44 +1039,44 @@ function UpgradeScreen({ onDone }) {
916
1039
  }
917
1040
  function renderBody(upgradeCheck) {
918
1041
  if (!upgradeCheck) {
919
- return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1042
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Checking for updates\u2026" });
920
1043
  }
921
1044
  if (upgradeCheck.status === "error") {
922
- return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1045
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
923
1046
  }
924
1047
  if (upgradeCheck.status === "up-to-date") {
925
- return /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.success, children: [
1048
+ return /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.success, children: [
926
1049
  "You're already on the latest version (v",
927
1050
  upgradeCheck.current,
928
1051
  ")."
929
1052
  ] });
930
1053
  }
931
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
932
- /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.muted, children: [
933
- /* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.success, children: [
1054
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
1055
+ /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.muted, children: [
1056
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.success, children: [
934
1057
  "v",
935
1058
  upgradeCheck.latest
936
1059
  ] }),
937
1060
  " ",
938
1061
  "is available (you're on ",
939
- /* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
1062
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, children: [
940
1063
  "v",
941
1064
  upgradeCheck.current
942
1065
  ] }),
943
1066
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
944
1067
  ] }),
945
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
946
- /* @__PURE__ */ jsx8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx8(Text8, { bold: true, children: cmd }, cmd)) })
1068
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1069
+ /* @__PURE__ */ jsx9(Box9, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx9(Text9, { bold: true, children: cmd }, cmd)) })
947
1070
  ] });
948
1071
  }
949
1072
 
950
1073
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
951
- import { useEffect as useEffect7, useState as useState8 } from "react";
952
- import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
953
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1074
+ import { useEffect as useEffect7, useState as useState9 } from "react";
1075
+ import { Box as Box10, Text as Text10, useInput as useInput10 } from "ink";
1076
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
954
1077
  function DebugModeScreen({ onDone }) {
955
- const [loading, setLoading] = useState8(true);
956
- const [enabled, setEnabled] = useState8(true);
1078
+ const [loading, setLoading] = useState9(true);
1079
+ const [enabled, setEnabled] = useState9(true);
957
1080
  useEffect7(() => {
958
1081
  readDebugModeSetting().then((setting) => {
959
1082
  setEnabled(setting.enabled);
@@ -966,7 +1089,7 @@ function DebugModeScreen({ onDone }) {
966
1089
  });
967
1090
  });
968
1091
  }, []);
969
- useInput9((input, key) => {
1092
+ useInput10((input, key) => {
970
1093
  if (loading) return;
971
1094
  if (key.return || input === " ") {
972
1095
  setEnabled((current) => {
@@ -981,59 +1104,74 @@ function DebugModeScreen({ onDone }) {
981
1104
  onDone();
982
1105
  }
983
1106
  });
984
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
985
- /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Debug Mode" }),
986
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
987
- loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Text9, { children: [
1107
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1108
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Debug Mode" }),
1109
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1110
+ loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text10, { children: [
988
1111
  "Debug logging:",
989
1112
  " ",
990
- /* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1113
+ /* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
991
1114
  ] }),
992
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
993
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1115
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1116
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
994
1117
  ] });
995
1118
  }
996
1119
 
997
1120
  // packages/experience-design-system-cli/app.tsx
998
- import { jsx as jsx10 } from "react/jsx-runtime";
1121
+ import { jsx as jsx11 } from "react/jsx-runtime";
999
1122
  function App({ onLaunchImport, importExitCode }) {
1000
1123
  const returnedFromImport = importExitCode !== void 0;
1001
- const [screen, setScreen] = useState9(returnedFromImport ? "import" : "start");
1002
- const [showImportResult, setShowImportResult] = useState9(returnedFromImport);
1124
+ const [screen, setScreen] = useState10(returnedFromImport ? "import" : "start");
1125
+ const [showImportResult, setShowImportResult] = useState10(returnedFromImport);
1126
+ const [projectPath, setProjectPath] = useState10();
1003
1127
  const goToStart = () => setScreen("start");
1004
1128
  const goToSettings = () => setScreen("settings");
1005
1129
  const finishImportResult = () => {
1006
1130
  setShowImportResult(false);
1131
+ setProjectPath(void 0);
1132
+ goToStart();
1133
+ };
1134
+ const leaveImport = () => {
1135
+ setProjectPath(void 0);
1007
1136
  goToStart();
1008
1137
  };
1009
1138
  switch (screen) {
1010
1139
  case "import":
1011
- return showImportResult ? /* @__PURE__ */ jsx10(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult }) : /* @__PURE__ */ jsx10(WelcomeScreen, { onContinue: (projectPath) => onLaunchImport?.(projectPath), onQuit: goToStart });
1140
+ if (showImportResult) return /* @__PURE__ */ jsx11(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1141
+ if (projectPath === void 0) return /* @__PURE__ */ jsx11(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport });
1142
+ return /* @__PURE__ */ jsx11(
1143
+ TokenInputScreen,
1144
+ {
1145
+ onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
1146
+ onSkip: () => onLaunchImport?.({ project: projectPath, skipTokenPrompt: true }),
1147
+ onBack: () => setProjectPath(void 0)
1148
+ }
1149
+ );
1012
1150
  case "help":
1013
- return /* @__PURE__ */ jsx10(HelpScreen, { onDone: goToStart });
1151
+ return /* @__PURE__ */ jsx11(HelpScreen, { onDone: goToStart });
1014
1152
  case "upgrade":
1015
- return /* @__PURE__ */ jsx10(UpgradeScreen, { onDone: goToStart });
1153
+ return /* @__PURE__ */ jsx11(UpgradeScreen, { onDone: goToStart });
1016
1154
  case "settings":
1017
- return /* @__PURE__ */ jsx10(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1155
+ return /* @__PURE__ */ jsx11(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1018
1156
  case "settings-configuration":
1019
- return /* @__PURE__ */ jsx10(ConfigurationScreen, { onDone: goToSettings });
1157
+ return /* @__PURE__ */ jsx11(ConfigurationScreen, { onDone: goToSettings });
1020
1158
  case "settings-opt-in-analytics":
1021
- return /* @__PURE__ */ jsx10(OptInAnalyticsScreen, { onDone: goToSettings });
1159
+ return /* @__PURE__ */ jsx11(OptInAnalyticsScreen, { onDone: goToSettings });
1022
1160
  case "settings-debug-mode":
1023
- return /* @__PURE__ */ jsx10(DebugModeScreen, { onDone: goToSettings });
1161
+ return /* @__PURE__ */ jsx11(DebugModeScreen, { onDone: goToSettings });
1024
1162
  case "start":
1025
- return /* @__PURE__ */ jsx10(HomeScreen, { onNavigate: setScreen });
1163
+ return /* @__PURE__ */ jsx11(HomeScreen, { onNavigate: setScreen });
1026
1164
  }
1027
1165
  }
1028
1166
  async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1029
- let requestedProjectPath;
1167
+ let requestedImport;
1030
1168
  const instance = renderApp(
1031
- /* @__PURE__ */ jsx10(
1169
+ /* @__PURE__ */ jsx11(
1032
1170
  App,
1033
1171
  {
1034
1172
  importExitCode,
1035
- onLaunchImport: (projectPath) => {
1036
- requestedProjectPath = projectPath;
1173
+ onLaunchImport: (options) => {
1174
+ requestedImport = options;
1037
1175
  instance.unmount();
1038
1176
  }
1039
1177
  }
@@ -1041,15 +1179,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1041
1179
  );
1042
1180
  await instance.waitUntilExit();
1043
1181
  await stopReadingTerminal();
1044
- return requestedProjectPath;
1182
+ return requestedImport;
1045
1183
  }
1046
1184
  async function runApp(renderApp) {
1047
1185
  let importExitCode;
1048
- let projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1049
- while (projectPath !== void 0) {
1050
- importExitCode = (await spawnV1Import({ project: projectPath })).exitCode;
1186
+ let requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1187
+ while (requestedImport !== void 0) {
1188
+ importExitCode = (await spawnV1Import(requestedImport)).exitCode;
1051
1189
  startReadingTerminal();
1052
- projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1190
+ requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1053
1191
  }
1054
1192
  }
1055
1193
  export {