@contentful/experience-design-system-cli 2.35.1-dev-build-a963233a.0 → 2.35.1-dev-build-fa950e44.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/index.js CHANGED
@@ -388,11 +388,151 @@ var init_screen = __esm({
388
388
  }
389
389
  });
390
390
 
391
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
392
+ function isPlainKeyOnEmptyField(value, input, key, expected) {
393
+ return value === "" && input === expected && !key.ctrl && !key.meta;
394
+ }
395
+ function shouldGoBack(value, input, key) {
396
+ return key.escape || isPlainKeyOnEmptyField(value, input, key, "q");
397
+ }
398
+ function shouldSkip(value, input, key) {
399
+ return isPlainKeyOnEmptyField(value, input, key, "s");
400
+ }
401
+ function toTokenPath(value) {
402
+ const tokenPath = value.trim();
403
+ return tokenPath === "" ? null : tokenPath;
404
+ }
405
+ var init_logic2 = __esm({
406
+ "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts"() {
407
+ "use strict";
408
+ }
409
+ });
410
+
411
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
412
+ import { useInput as useInput4 } from "ink";
413
+ function useTokenInputControls(tokenPath, onSkip, onBack) {
414
+ useInput4((input, key) => {
415
+ if (shouldGoBack(tokenPath, input, key)) onBack();
416
+ else if (shouldSkip(tokenPath, input, key)) onSkip();
417
+ });
418
+ }
419
+ var TOKEN_INPUT_CONTROLS;
420
+ var init_controls2 = __esm({
421
+ "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts"() {
422
+ "use strict";
423
+ init_logic2();
424
+ TOKEN_INPUT_CONTROLS = [
425
+ { keys: "Enter", label: "Continue (skips if empty)" },
426
+ { keys: "s", label: "Skip" },
427
+ { keys: "Esc/q", label: "Back" }
428
+ ];
429
+ }
430
+ });
431
+
432
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
433
+ import { statSync } from "node:fs";
434
+ import { homedir } from "node:os";
435
+ import { resolve } from "node:path";
436
+ function stripQuotes(value) {
437
+ const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
438
+ return value.length >= 2 && quoted ? value.slice(1, -1) : value;
439
+ }
440
+ function expandHome(value) {
441
+ return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
442
+ }
443
+ function validateTokenPath(rawPath) {
444
+ const path = resolve(expandHome(stripQuotes(rawPath.trim())));
445
+ let stats;
446
+ try {
447
+ stats = statSync(path);
448
+ } catch {
449
+ return { ok: false, error: `Path not found: ${path}`, resolvedPath: path };
450
+ }
451
+ if (stats.isDirectory()) {
452
+ return {
453
+ ok: false,
454
+ error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
455
+ resolvedPath: path
456
+ };
457
+ }
458
+ if (!stats.isFile()) {
459
+ return { ok: false, error: `Not a regular file: ${path}`, resolvedPath: path };
460
+ }
461
+ return { ok: true, path };
462
+ }
463
+ var init_validate_path = __esm({
464
+ "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts"() {
465
+ "use strict";
466
+ }
467
+ });
468
+
469
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
470
+ import { useState as useState4 } from "react";
471
+ import { Box as Box4, Text as Text4 } from "ink";
472
+ import TextInput2 from "ink-text-input";
473
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
474
+ function TokenInputScreen({ onConfirm, onSkip, onBack }) {
475
+ const [tokenPath, setTokenPath] = useState4("");
476
+ const [failure, setFailure] = useState4(null);
477
+ useTokenInputControls(tokenPath, onSkip, onBack);
478
+ const change = (value) => {
479
+ setTokenPath(value);
480
+ setFailure(null);
481
+ };
482
+ const submit = (value) => {
483
+ const rawPath = toTokenPath(value);
484
+ if (!rawPath) {
485
+ onSkip();
486
+ return;
487
+ }
488
+ const check = validateTokenPath(rawPath);
489
+ if (check.ok) onConfirm(check.path);
490
+ else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
491
+ };
492
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
493
+ /* @__PURE__ */ jsx4(Text4, { bold: true, children: "Design tokens" }),
494
+ /* @__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." }),
495
+ /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
496
+ /* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
497
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
498
+ /* @__PURE__ */ jsx4(Text4, { children: "Token path:" }),
499
+ /* @__PURE__ */ jsx4(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
500
+ ] }),
501
+ failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
502
+ /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.error, children: [
503
+ "\u2717 ",
504
+ failure.error
505
+ ] }),
506
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
507
+ " Resolved to: ",
508
+ failure.resolvedPath
509
+ ] })
510
+ ] })
511
+ ] }),
512
+ /* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
513
+ "[",
514
+ control.keys,
515
+ "] ",
516
+ control.label
517
+ ] }, control.keys)) })
518
+ ] });
519
+ }
520
+ var init_screen2 = __esm({
521
+ "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
522
+ "use strict";
523
+ init_home_theme();
524
+ init_controls2();
525
+ init_logic2();
526
+ init_validate_path();
527
+ }
528
+ });
529
+
391
530
  // packages/experience-design-system-cli/src/tui/import/steps/index.ts
392
531
  var init_steps = __esm({
393
532
  "packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
394
533
  "use strict";
395
534
  init_screen();
535
+ init_screen2();
396
536
  }
397
537
  });
398
538
 
@@ -403,6 +543,9 @@ function buildArgs(options) {
403
543
  if (options.project) {
404
544
  args.push("--project", options.project);
405
545
  }
546
+ if (options.tokens) {
547
+ args.push("--tokens", options.tokens);
548
+ }
406
549
  return args;
407
550
  }
408
551
  async function spawnV1Import(options = {}) {
@@ -432,7 +575,7 @@ function getTerminalHandle() {
432
575
  return process.stdin._handle;
433
576
  }
434
577
  async function stopReadingTerminal() {
435
- await new Promise((resolve) => setImmediate(resolve));
578
+ await new Promise((resolve2) => setImmediate(resolve2));
436
579
  const handle = getTerminalHandle();
437
580
  if (!handle?.readStop) return;
438
581
  handle.reading = false;
@@ -636,8 +779,8 @@ var init_debug_store = __esm({
636
779
 
637
780
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
638
781
  import { useEffect as useEffect3 } from "react";
639
- import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
640
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
782
+ import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
783
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
641
784
  function HelpScreen({ onDone }) {
642
785
  useEffect3(() => {
643
786
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
@@ -646,7 +789,7 @@ function HelpScreen({ onDone }) {
646
789
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
647
790
  onDone();
648
791
  };
649
- useInput4((input, key) => {
792
+ useInput5((input, key) => {
650
793
  if (key.return) {
651
794
  leave("saved");
652
795
  return;
@@ -656,12 +799,12 @@ function HelpScreen({ onDone }) {
656
799
  return;
657
800
  }
658
801
  });
659
- return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
660
- /* @__PURE__ */ jsx4(Text4, { bold: true, children: "Help" }),
661
- /* @__PURE__ */ jsx4(Text4, { children: " " }),
662
- /* @__PURE__ */ jsx4(Text4, { children: "This is a placeholder screen for v2 help content." }),
663
- /* @__PURE__ */ jsx4(Text4, { children: " " }),
664
- /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
802
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
803
+ /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Help" }),
804
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
805
+ /* @__PURE__ */ jsx5(Text5, { children: "This is a placeholder screen for v2 help content." }),
806
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
807
+ /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
665
808
  ] });
666
809
  }
667
810
  var init_PageContainer2 = __esm({
@@ -672,20 +815,20 @@ var init_PageContainer2 = __esm({
672
815
  });
673
816
 
674
817
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
675
- import { useState as useState4 } from "react";
676
- import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
677
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
818
+ import { useState as useState5 } from "react";
819
+ import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
820
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
678
821
  function SettingsScreen({
679
822
  onNavigate,
680
823
  onBack
681
824
  }) {
682
- const [focusIdx, setFocusIdx] = useState4(0);
825
+ const [focusIdx, setFocusIdx] = useState5(0);
683
826
  const items = [
684
827
  { label: "Configuration", screen: "settings-configuration" },
685
828
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
686
829
  { label: "Debug Mode", screen: "settings-debug-mode" }
687
830
  ];
688
- useInput5((input, key) => {
831
+ useInput6((input, key) => {
689
832
  if (key.upArrow) {
690
833
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
691
834
  return;
@@ -705,15 +848,15 @@ function SettingsScreen({
705
848
  onBack();
706
849
  }
707
850
  });
708
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
709
- /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Settings" }),
710
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
711
- items.map((item, i) => /* @__PURE__ */ jsxs5(Text5, { color: i === focusIdx ? "cyan" : void 0, children: [
851
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
852
+ /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Settings" }),
853
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
854
+ items.map((item, i) => /* @__PURE__ */ jsxs6(Text6, { color: i === focusIdx ? "cyan" : void 0, children: [
712
855
  i === focusIdx ? "> " : " ",
713
856
  item.label
714
857
  ] }, item.label)),
715
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
716
- /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
858
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
859
+ /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
717
860
  ] });
718
861
  }
719
862
  var init_PageContainer3 = __esm({
@@ -725,7 +868,7 @@ var init_PageContainer3 = __esm({
725
868
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
726
869
  import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
727
870
  import { join as join6 } from "node:path";
728
- import { homedir } from "node:os";
871
+ import { homedir as homedir2 } from "node:os";
729
872
  async function readV1Store() {
730
873
  try {
731
874
  const raw = await readFile2(V1_STORE_PATH, "utf8");
@@ -735,7 +878,7 @@ async function readV1Store() {
735
878
  }
736
879
  }
737
880
  async function writeV1Store(data) {
738
- await mkdir3(join6(homedir(), ".config", "experiences"), { recursive: true });
881
+ await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
739
882
  await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
740
883
  `, { mode: 384 });
741
884
  }
@@ -743,7 +886,7 @@ var V1_STORE_PATH;
743
886
  var init_v1_store = __esm({
744
887
  "packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
745
888
  "use strict";
746
- V1_STORE_PATH = join6(homedir(), ".config", "experiences", "credentials.json");
889
+ V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
747
890
  }
748
891
  });
749
892
 
@@ -776,9 +919,9 @@ var init_config_store = __esm({
776
919
  });
777
920
 
778
921
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
779
- import { useEffect as useEffect4, useState as useState5 } from "react";
780
- import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
781
- import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
922
+ import { useEffect as useEffect4, useState as useState6 } from "react";
923
+ import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
924
+ import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
782
925
  function debugFields(config) {
783
926
  return {
784
927
  space_id: config?.spaceId ?? "",
@@ -788,10 +931,10 @@ function debugFields(config) {
788
931
  };
789
932
  }
790
933
  function ConfigurationScreen({ onDone }) {
791
- const [stage, setStage] = useState5("loading");
792
- const [config, setConfig] = useState5(null);
793
- const [activeField, setActiveField] = useState5("spaceId");
794
- const [message, setMessage] = useState5(null);
934
+ const [stage, setStage] = useState6("loading");
935
+ const [config, setConfig] = useState6(null);
936
+ const [activeField, setActiveField] = useState6("spaceId");
937
+ const [message, setMessage] = useState6(null);
795
938
  useEffect4(() => {
796
939
  readCredentials().then((cfg) => {
797
940
  setConfig(cfg);
@@ -824,7 +967,7 @@ function ConfigurationScreen({ onDone }) {
824
967
  setStage("form");
825
968
  });
826
969
  }
827
- useInput6((input, key) => {
970
+ useInput7((input, key) => {
828
971
  if (stage === "loading" || stage === "saving") return;
829
972
  if (stage === "saved") {
830
973
  if (key.return || key.escape || input === "q") {
@@ -867,51 +1010,51 @@ function ConfigurationScreen({ onDone }) {
867
1010
  }
868
1011
  });
869
1012
  if (stage === "loading") {
870
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
871
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
872
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
873
- /* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." })
1013
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1014
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1015
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1016
+ /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
874
1017
  ] });
875
1018
  }
876
1019
  if (stage === "saved") {
877
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
878
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
879
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
880
- /* @__PURE__ */ jsxs6(Text6, { color: PALETTE.success, children: [
1020
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1021
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1022
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1023
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
881
1024
  "\u2713 ",
882
1025
  message
883
1026
  ] }),
884
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
885
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter] Back to Settings" })
1027
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1028
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
886
1029
  ] });
887
1030
  }
888
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
889
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Configuration" }),
890
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
891
- /* @__PURE__ */ jsx6(Text6, { children: "Contentful API Credentials" }),
892
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
893
- /* @__PURE__ */ jsx6(Box6, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
1031
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1032
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1033
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1034
+ /* @__PURE__ */ jsx7(Text7, { children: "Contentful API Credentials" }),
1035
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1036
+ /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
894
1037
  const isActive = activeField === field;
895
1038
  const value = fieldValue(field);
896
1039
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
897
- return /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
898
- /* @__PURE__ */ jsx6(Text6, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
899
- /* @__PURE__ */ jsxs6(Text6, { bold: isActive, children: [
1040
+ return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
1041
+ /* @__PURE__ */ jsx7(Text7, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
1042
+ /* @__PURE__ */ jsxs7(Text7, { bold: isActive, children: [
900
1043
  FIELD_LABELS[field],
901
1044
  ":"
902
1045
  ] }),
903
- /* @__PURE__ */ jsx6(Text6, { children: display || /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "(empty)" }) })
1046
+ /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
904
1047
  ] }, field);
905
1048
  }) }),
906
- message && /* @__PURE__ */ jsxs6(Fragment, { children: [
907
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
908
- /* @__PURE__ */ jsxs6(Text6, { color: PALETTE.error, children: [
1049
+ message && /* @__PURE__ */ jsxs7(Fragment, { children: [
1050
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1051
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
909
1052
  "\u2717 ",
910
1053
  message
911
1054
  ] })
912
1055
  ] }),
913
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
914
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
1056
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1057
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
915
1058
  ] });
916
1059
  }
917
1060
  var FIELD_ORDER, FIELD_LABELS;
@@ -953,12 +1096,12 @@ var init_analytics_store = __esm({
953
1096
  });
954
1097
 
955
1098
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
956
- import { useEffect as useEffect5, useState as useState6 } from "react";
957
- import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
958
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1099
+ import { useEffect as useEffect5, useState as useState7 } from "react";
1100
+ import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
1101
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
959
1102
  function OptInAnalyticsScreen({ onDone }) {
960
- const [loading, setLoading] = useState6(true);
961
- const [enabled, setEnabled] = useState6(true);
1103
+ const [loading, setLoading] = useState7(true);
1104
+ const [enabled, setEnabled] = useState7(true);
962
1105
  useEffect5(() => {
963
1106
  readAnalyticsSetting().then((setting) => {
964
1107
  setEnabled(setting.enabled);
@@ -971,7 +1114,7 @@ function OptInAnalyticsScreen({ onDone }) {
971
1114
  });
972
1115
  });
973
1116
  }, []);
974
- useInput7((input, key) => {
1117
+ useInput8((input, key) => {
975
1118
  if (loading) return;
976
1119
  if (key.return || input === " ") {
977
1120
  setEnabled((current) => {
@@ -986,24 +1129,24 @@ function OptInAnalyticsScreen({ onDone }) {
986
1129
  onDone();
987
1130
  }
988
1131
  });
989
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
990
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
991
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
992
- loading ? /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
993
- /* @__PURE__ */ jsxs7(Text7, { children: [
1132
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1133
+ /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
1134
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1135
+ loading ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
1136
+ /* @__PURE__ */ jsxs8(Text8, { children: [
994
1137
  "Share anonymous usage data:",
995
1138
  " ",
996
- /* @__PURE__ */ jsx7(Text7, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1139
+ /* @__PURE__ */ jsx8(Text8, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
997
1140
  ] }),
998
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
999
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1000
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
1141
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1142
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1143
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
1001
1144
  ] }),
1002
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
1003
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1145
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1146
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1004
1147
  ] });
1005
1148
  }
1006
- var init_screen2 = __esm({
1149
+ var init_screen3 = __esm({
1007
1150
  "packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
1008
1151
  "use strict";
1009
1152
  init_home_theme();
@@ -1013,11 +1156,11 @@ var init_screen2 = __esm({
1013
1156
  });
1014
1157
 
1015
1158
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
1016
- import { useEffect as useEffect6, useState as useState7 } from "react";
1017
- import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
1018
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1159
+ import { useEffect as useEffect6, useState as useState8 } from "react";
1160
+ import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
1161
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1019
1162
  function UpgradeScreen({ onDone }) {
1020
- const [upgradeCheck, setUpgradeCheck] = useState7();
1163
+ const [upgradeCheck, setUpgradeCheck] = useState8();
1021
1164
  useEffect6(() => {
1022
1165
  startDebugRun({
1023
1166
  flow: "upgrade",
@@ -1027,7 +1170,7 @@ function UpgradeScreen({ onDone }) {
1027
1170
  });
1028
1171
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
1029
1172
  }, []);
1030
- useInput8((_input, key) => {
1173
+ useInput9((_input, key) => {
1031
1174
  if (key.return) {
1032
1175
  void finishDebugRun({
1033
1176
  outputs: upgradeCheck ?? {},
@@ -1038,12 +1181,12 @@ function UpgradeScreen({ onDone }) {
1038
1181
  return;
1039
1182
  }
1040
1183
  });
1041
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1042
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Upgrade" }),
1043
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1184
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1185
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Upgrade" }),
1186
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1044
1187
  renderBody(upgradeCheck),
1045
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1046
- /* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.accent, children: [
1188
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1189
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.accent, children: [
1047
1190
  FOCUS_MARKER,
1048
1191
  " Go Back"
1049
1192
  ] })
@@ -1051,34 +1194,34 @@ function UpgradeScreen({ onDone }) {
1051
1194
  }
1052
1195
  function renderBody(upgradeCheck) {
1053
1196
  if (!upgradeCheck) {
1054
- return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1197
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1055
1198
  }
1056
1199
  if (upgradeCheck.status === "error") {
1057
- return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1200
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1058
1201
  }
1059
1202
  if (upgradeCheck.status === "up-to-date") {
1060
- return /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.success, children: [
1203
+ return /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.success, children: [
1061
1204
  "You're already on the latest version (v",
1062
1205
  upgradeCheck.current,
1063
1206
  ")."
1064
1207
  ] });
1065
1208
  }
1066
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1067
- /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.muted, children: [
1068
- /* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.success, children: [
1209
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
1210
+ /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.muted, children: [
1211
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.success, children: [
1069
1212
  "v",
1070
1213
  upgradeCheck.latest
1071
1214
  ] }),
1072
1215
  " ",
1073
1216
  "is available (you're on ",
1074
- /* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
1217
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, children: [
1075
1218
  "v",
1076
1219
  upgradeCheck.current
1077
1220
  ] }),
1078
1221
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
1079
1222
  ] }),
1080
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1081
- /* @__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)) })
1223
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1224
+ /* @__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)) })
1082
1225
  ] });
1083
1226
  }
1084
1227
  var UPGRADE_COMMANDS;
@@ -1093,12 +1236,12 @@ var init_PageContainer4 = __esm({
1093
1236
  });
1094
1237
 
1095
1238
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
1096
- import { useEffect as useEffect7, useState as useState8 } from "react";
1097
- import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
1098
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1239
+ import { useEffect as useEffect7, useState as useState9 } from "react";
1240
+ import { Box as Box10, Text as Text10, useInput as useInput10 } from "ink";
1241
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1099
1242
  function DebugModeScreen({ onDone }) {
1100
- const [loading, setLoading] = useState8(true);
1101
- const [enabled, setEnabled] = useState8(true);
1243
+ const [loading, setLoading] = useState9(true);
1244
+ const [enabled, setEnabled] = useState9(true);
1102
1245
  useEffect7(() => {
1103
1246
  readDebugModeSetting().then((setting) => {
1104
1247
  setEnabled(setting.enabled);
@@ -1111,7 +1254,7 @@ function DebugModeScreen({ onDone }) {
1111
1254
  });
1112
1255
  });
1113
1256
  }, []);
1114
- useInput9((input, key) => {
1257
+ useInput10((input, key) => {
1115
1258
  if (loading) return;
1116
1259
  if (key.return || input === " ") {
1117
1260
  setEnabled((current) => {
@@ -1126,19 +1269,19 @@ function DebugModeScreen({ onDone }) {
1126
1269
  onDone();
1127
1270
  }
1128
1271
  });
1129
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1130
- /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Debug Mode" }),
1131
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1132
- loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Text9, { children: [
1272
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1273
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Debug Mode" }),
1274
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1275
+ loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text10, { children: [
1133
1276
  "Debug logging:",
1134
1277
  " ",
1135
- /* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1278
+ /* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1136
1279
  ] }),
1137
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1138
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1280
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1281
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1139
1282
  ] });
1140
1283
  }
1141
- var init_screen3 = __esm({
1284
+ var init_screen4 = __esm({
1142
1285
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
1143
1286
  "use strict";
1144
1287
  init_home_theme();
@@ -1152,46 +1295,61 @@ var app_exports = {};
1152
1295
  __export(app_exports, {
1153
1296
  runApp: () => runApp
1154
1297
  });
1155
- import { useState as useState9 } from "react";
1156
- import { jsx as jsx10 } from "react/jsx-runtime";
1298
+ import { useState as useState10 } from "react";
1299
+ import { jsx as jsx11 } from "react/jsx-runtime";
1157
1300
  function App({ onLaunchImport, importExitCode }) {
1158
1301
  const returnedFromImport = importExitCode !== void 0;
1159
- const [screen, setScreen] = useState9(returnedFromImport ? "import" : "start");
1160
- const [showImportResult, setShowImportResult] = useState9(returnedFromImport);
1302
+ const [screen, setScreen] = useState10(returnedFromImport ? "import" : "start");
1303
+ const [showImportResult, setShowImportResult] = useState10(returnedFromImport);
1304
+ const [projectPath, setProjectPath] = useState10();
1161
1305
  const goToStart = () => setScreen("start");
1162
1306
  const goToSettings = () => setScreen("settings");
1163
1307
  const finishImportResult = () => {
1164
1308
  setShowImportResult(false);
1309
+ setProjectPath(void 0);
1310
+ goToStart();
1311
+ };
1312
+ const leaveImport = () => {
1313
+ setProjectPath(void 0);
1165
1314
  goToStart();
1166
1315
  };
1167
1316
  switch (screen) {
1168
1317
  case "import":
1169
- return showImportResult ? /* @__PURE__ */ jsx10(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult }) : /* @__PURE__ */ jsx10(WelcomeScreen, { onContinue: (projectPath) => onLaunchImport?.(projectPath), onQuit: goToStart });
1318
+ if (showImportResult) return /* @__PURE__ */ jsx11(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1319
+ if (projectPath === void 0) return /* @__PURE__ */ jsx11(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport });
1320
+ return /* @__PURE__ */ jsx11(
1321
+ TokenInputScreen,
1322
+ {
1323
+ onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
1324
+ onSkip: () => onLaunchImport?.({ project: projectPath }),
1325
+ onBack: () => setProjectPath(void 0)
1326
+ }
1327
+ );
1170
1328
  case "help":
1171
- return /* @__PURE__ */ jsx10(HelpScreen, { onDone: goToStart });
1329
+ return /* @__PURE__ */ jsx11(HelpScreen, { onDone: goToStart });
1172
1330
  case "upgrade":
1173
- return /* @__PURE__ */ jsx10(UpgradeScreen, { onDone: goToStart });
1331
+ return /* @__PURE__ */ jsx11(UpgradeScreen, { onDone: goToStart });
1174
1332
  case "settings":
1175
- return /* @__PURE__ */ jsx10(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1333
+ return /* @__PURE__ */ jsx11(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1176
1334
  case "settings-configuration":
1177
- return /* @__PURE__ */ jsx10(ConfigurationScreen, { onDone: goToSettings });
1335
+ return /* @__PURE__ */ jsx11(ConfigurationScreen, { onDone: goToSettings });
1178
1336
  case "settings-opt-in-analytics":
1179
- return /* @__PURE__ */ jsx10(OptInAnalyticsScreen, { onDone: goToSettings });
1337
+ return /* @__PURE__ */ jsx11(OptInAnalyticsScreen, { onDone: goToSettings });
1180
1338
  case "settings-debug-mode":
1181
- return /* @__PURE__ */ jsx10(DebugModeScreen, { onDone: goToSettings });
1339
+ return /* @__PURE__ */ jsx11(DebugModeScreen, { onDone: goToSettings });
1182
1340
  case "start":
1183
- return /* @__PURE__ */ jsx10(HomeScreen, { onNavigate: setScreen });
1341
+ return /* @__PURE__ */ jsx11(HomeScreen, { onNavigate: setScreen });
1184
1342
  }
1185
1343
  }
1186
1344
  async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1187
- let requestedProjectPath;
1345
+ let requestedImport;
1188
1346
  const instance = renderApp(
1189
- /* @__PURE__ */ jsx10(
1347
+ /* @__PURE__ */ jsx11(
1190
1348
  App,
1191
1349
  {
1192
1350
  importExitCode,
1193
- onLaunchImport: (projectPath) => {
1194
- requestedProjectPath = projectPath;
1351
+ onLaunchImport: (options) => {
1352
+ requestedImport = options;
1195
1353
  instance.unmount();
1196
1354
  }
1197
1355
  }
@@ -1199,15 +1357,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1199
1357
  );
1200
1358
  await instance.waitUntilExit();
1201
1359
  await stopReadingTerminal();
1202
- return requestedProjectPath;
1360
+ return requestedImport;
1203
1361
  }
1204
1362
  async function runApp(renderApp) {
1205
1363
  let importExitCode;
1206
- let projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1207
- while (projectPath !== void 0) {
1208
- importExitCode = (await spawnV1Import({ project: projectPath })).exitCode;
1364
+ let requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1365
+ while (requestedImport !== void 0) {
1366
+ importExitCode = (await spawnV1Import(requestedImport)).exitCode;
1209
1367
  startReadingTerminal();
1210
- projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1368
+ requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1211
1369
  }
1212
1370
  }
1213
1371
  var init_app = __esm({
@@ -1221,9 +1379,9 @@ var init_app = __esm({
1221
1379
  init_PageContainer2();
1222
1380
  init_PageContainer3();
1223
1381
  init_ContentfulConfigScreen();
1224
- init_screen2();
1225
- init_PageContainer4();
1226
1382
  init_screen3();
1383
+ init_PageContainer4();
1384
+ init_screen4();
1227
1385
  }
1228
1386
  });
1229
1387