@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/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,12 @@ 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
+ }
549
+ if (options.skipTokenPrompt) {
550
+ args.push("--skip-token-prompt");
551
+ }
406
552
  return args;
407
553
  }
408
554
  async function spawnV1Import(options = {}) {
@@ -432,7 +578,7 @@ function getTerminalHandle() {
432
578
  return process.stdin._handle;
433
579
  }
434
580
  async function stopReadingTerminal() {
435
- await new Promise((resolve) => setImmediate(resolve));
581
+ await new Promise((resolve2) => setImmediate(resolve2));
436
582
  const handle = getTerminalHandle();
437
583
  if (!handle?.readStop) return;
438
584
  handle.reading = false;
@@ -636,8 +782,8 @@ var init_debug_store = __esm({
636
782
 
637
783
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
638
784
  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";
785
+ import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
786
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
641
787
  function HelpScreen({ onDone }) {
642
788
  useEffect3(() => {
643
789
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
@@ -646,7 +792,7 @@ function HelpScreen({ onDone }) {
646
792
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
647
793
  onDone();
648
794
  };
649
- useInput4((input, key) => {
795
+ useInput5((input, key) => {
650
796
  if (key.return) {
651
797
  leave("saved");
652
798
  return;
@@ -656,12 +802,12 @@ function HelpScreen({ onDone }) {
656
802
  return;
657
803
  }
658
804
  });
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" })
805
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
806
+ /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Help" }),
807
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
808
+ /* @__PURE__ */ jsx5(Text5, { children: "This is a placeholder screen for v2 help content." }),
809
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
810
+ /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
665
811
  ] });
666
812
  }
667
813
  var init_PageContainer2 = __esm({
@@ -672,20 +818,20 @@ var init_PageContainer2 = __esm({
672
818
  });
673
819
 
674
820
  // 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";
821
+ import { useState as useState5 } from "react";
822
+ import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
823
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
678
824
  function SettingsScreen({
679
825
  onNavigate,
680
826
  onBack
681
827
  }) {
682
- const [focusIdx, setFocusIdx] = useState4(0);
828
+ const [focusIdx, setFocusIdx] = useState5(0);
683
829
  const items = [
684
830
  { label: "Configuration", screen: "settings-configuration" },
685
831
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
686
832
  { label: "Debug Mode", screen: "settings-debug-mode" }
687
833
  ];
688
- useInput5((input, key) => {
834
+ useInput6((input, key) => {
689
835
  if (key.upArrow) {
690
836
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
691
837
  return;
@@ -705,15 +851,15 @@ function SettingsScreen({
705
851
  onBack();
706
852
  }
707
853
  });
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: [
854
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
855
+ /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Settings" }),
856
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
857
+ items.map((item, i) => /* @__PURE__ */ jsxs6(Text6, { color: i === focusIdx ? "cyan" : void 0, children: [
712
858
  i === focusIdx ? "> " : " ",
713
859
  item.label
714
860
  ] }, item.label)),
715
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
716
- /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
861
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
862
+ /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
717
863
  ] });
718
864
  }
719
865
  var init_PageContainer3 = __esm({
@@ -725,7 +871,7 @@ var init_PageContainer3 = __esm({
725
871
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
726
872
  import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
727
873
  import { join as join6 } from "node:path";
728
- import { homedir } from "node:os";
874
+ import { homedir as homedir2 } from "node:os";
729
875
  async function readV1Store() {
730
876
  try {
731
877
  const raw = await readFile2(V1_STORE_PATH, "utf8");
@@ -735,7 +881,7 @@ async function readV1Store() {
735
881
  }
736
882
  }
737
883
  async function writeV1Store(data) {
738
- await mkdir3(join6(homedir(), ".config", "experiences"), { recursive: true });
884
+ await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
739
885
  await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
740
886
  `, { mode: 384 });
741
887
  }
@@ -743,7 +889,7 @@ var V1_STORE_PATH;
743
889
  var init_v1_store = __esm({
744
890
  "packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
745
891
  "use strict";
746
- V1_STORE_PATH = join6(homedir(), ".config", "experiences", "credentials.json");
892
+ V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
747
893
  }
748
894
  });
749
895
 
@@ -776,9 +922,9 @@ var init_config_store = __esm({
776
922
  });
777
923
 
778
924
  // 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";
925
+ import { useEffect as useEffect4, useState as useState6 } from "react";
926
+ import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
927
+ import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
782
928
  function debugFields(config) {
783
929
  return {
784
930
  space_id: config?.spaceId ?? "",
@@ -788,10 +934,10 @@ function debugFields(config) {
788
934
  };
789
935
  }
790
936
  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);
937
+ const [stage, setStage] = useState6("loading");
938
+ const [config, setConfig] = useState6(null);
939
+ const [activeField, setActiveField] = useState6("spaceId");
940
+ const [message, setMessage] = useState6(null);
795
941
  useEffect4(() => {
796
942
  readCredentials().then((cfg) => {
797
943
  setConfig(cfg);
@@ -824,7 +970,7 @@ function ConfigurationScreen({ onDone }) {
824
970
  setStage("form");
825
971
  });
826
972
  }
827
- useInput6((input, key) => {
973
+ useInput7((input, key) => {
828
974
  if (stage === "loading" || stage === "saving") return;
829
975
  if (stage === "saved") {
830
976
  if (key.return || key.escape || input === "q") {
@@ -867,51 +1013,51 @@ function ConfigurationScreen({ onDone }) {
867
1013
  }
868
1014
  });
869
1015
  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..." })
1016
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1017
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1018
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1019
+ /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
874
1020
  ] });
875
1021
  }
876
1022
  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: [
1023
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1024
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1025
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1026
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
881
1027
  "\u2713 ",
882
1028
  message
883
1029
  ] }),
884
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
885
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter] Back to Settings" })
1030
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1031
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
886
1032
  ] });
887
1033
  }
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) => {
1034
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1035
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1036
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1037
+ /* @__PURE__ */ jsx7(Text7, { children: "Contentful API Credentials" }),
1038
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1039
+ /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
894
1040
  const isActive = activeField === field;
895
1041
  const value = fieldValue(field);
896
1042
  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: [
1043
+ return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
1044
+ /* @__PURE__ */ jsx7(Text7, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
1045
+ /* @__PURE__ */ jsxs7(Text7, { bold: isActive, children: [
900
1046
  FIELD_LABELS[field],
901
1047
  ":"
902
1048
  ] }),
903
- /* @__PURE__ */ jsx6(Text6, { children: display || /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "(empty)" }) })
1049
+ /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
904
1050
  ] }, field);
905
1051
  }) }),
906
- message && /* @__PURE__ */ jsxs6(Fragment, { children: [
907
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
908
- /* @__PURE__ */ jsxs6(Text6, { color: PALETTE.error, children: [
1052
+ message && /* @__PURE__ */ jsxs7(Fragment, { children: [
1053
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1054
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
909
1055
  "\u2717 ",
910
1056
  message
911
1057
  ] })
912
1058
  ] }),
913
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
914
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
1059
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
1060
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
915
1061
  ] });
916
1062
  }
917
1063
  var FIELD_ORDER, FIELD_LABELS;
@@ -953,12 +1099,12 @@ var init_analytics_store = __esm({
953
1099
  });
954
1100
 
955
1101
  // 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";
1102
+ import { useEffect as useEffect5, useState as useState7 } from "react";
1103
+ import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
1104
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
959
1105
  function OptInAnalyticsScreen({ onDone }) {
960
- const [loading, setLoading] = useState6(true);
961
- const [enabled, setEnabled] = useState6(true);
1106
+ const [loading, setLoading] = useState7(true);
1107
+ const [enabled, setEnabled] = useState7(true);
962
1108
  useEffect5(() => {
963
1109
  readAnalyticsSetting().then((setting) => {
964
1110
  setEnabled(setting.enabled);
@@ -971,7 +1117,7 @@ function OptInAnalyticsScreen({ onDone }) {
971
1117
  });
972
1118
  });
973
1119
  }, []);
974
- useInput7((input, key) => {
1120
+ useInput8((input, key) => {
975
1121
  if (loading) return;
976
1122
  if (key.return || input === " ") {
977
1123
  setEnabled((current) => {
@@ -986,24 +1132,24 @@ function OptInAnalyticsScreen({ onDone }) {
986
1132
  onDone();
987
1133
  }
988
1134
  });
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: [
1135
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1136
+ /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
1137
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1138
+ loading ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
1139
+ /* @__PURE__ */ jsxs8(Text8, { children: [
994
1140
  "Share anonymous usage data:",
995
1141
  " ",
996
- /* @__PURE__ */ jsx7(Text7, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1142
+ /* @__PURE__ */ jsx8(Text8, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
997
1143
  ] }),
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." })
1144
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1145
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1146
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
1001
1147
  ] }),
1002
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
1003
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1148
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1149
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1004
1150
  ] });
1005
1151
  }
1006
- var init_screen2 = __esm({
1152
+ var init_screen3 = __esm({
1007
1153
  "packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
1008
1154
  "use strict";
1009
1155
  init_home_theme();
@@ -1013,11 +1159,11 @@ var init_screen2 = __esm({
1013
1159
  });
1014
1160
 
1015
1161
  // 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";
1162
+ import { useEffect as useEffect6, useState as useState8 } from "react";
1163
+ import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
1164
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1019
1165
  function UpgradeScreen({ onDone }) {
1020
- const [upgradeCheck, setUpgradeCheck] = useState7();
1166
+ const [upgradeCheck, setUpgradeCheck] = useState8();
1021
1167
  useEffect6(() => {
1022
1168
  startDebugRun({
1023
1169
  flow: "upgrade",
@@ -1027,7 +1173,7 @@ function UpgradeScreen({ onDone }) {
1027
1173
  });
1028
1174
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
1029
1175
  }, []);
1030
- useInput8((_input, key) => {
1176
+ useInput9((_input, key) => {
1031
1177
  if (key.return) {
1032
1178
  void finishDebugRun({
1033
1179
  outputs: upgradeCheck ?? {},
@@ -1038,12 +1184,12 @@ function UpgradeScreen({ onDone }) {
1038
1184
  return;
1039
1185
  }
1040
1186
  });
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: " " }),
1187
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1188
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Upgrade" }),
1189
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1044
1190
  renderBody(upgradeCheck),
1045
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1046
- /* @__PURE__ */ jsxs8(Text8, { bold: true, color: PALETTE.accent, children: [
1191
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1192
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.accent, children: [
1047
1193
  FOCUS_MARKER,
1048
1194
  " Go Back"
1049
1195
  ] })
@@ -1051,34 +1197,34 @@ function UpgradeScreen({ onDone }) {
1051
1197
  }
1052
1198
  function renderBody(upgradeCheck) {
1053
1199
  if (!upgradeCheck) {
1054
- return /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1200
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1055
1201
  }
1056
1202
  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." });
1203
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1058
1204
  }
1059
1205
  if (upgradeCheck.status === "up-to-date") {
1060
- return /* @__PURE__ */ jsxs8(Text8, { color: PALETTE.success, children: [
1206
+ return /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.success, children: [
1061
1207
  "You're already on the latest version (v",
1062
1208
  upgradeCheck.current,
1063
1209
  ")."
1064
1210
  ] });
1065
1211
  }
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: [
1212
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
1213
+ /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.muted, children: [
1214
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.success, children: [
1069
1215
  "v",
1070
1216
  upgradeCheck.latest
1071
1217
  ] }),
1072
1218
  " ",
1073
1219
  "is available (you're on ",
1074
- /* @__PURE__ */ jsxs8(Text8, { bold: true, children: [
1220
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, children: [
1075
1221
  "v",
1076
1222
  upgradeCheck.current
1077
1223
  ] }),
1078
1224
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
1079
1225
  ] }),
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)) })
1226
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1227
+ /* @__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
1228
  ] });
1083
1229
  }
1084
1230
  var UPGRADE_COMMANDS;
@@ -1093,12 +1239,12 @@ var init_PageContainer4 = __esm({
1093
1239
  });
1094
1240
 
1095
1241
  // 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";
1242
+ import { useEffect as useEffect7, useState as useState9 } from "react";
1243
+ import { Box as Box10, Text as Text10, useInput as useInput10 } from "ink";
1244
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1099
1245
  function DebugModeScreen({ onDone }) {
1100
- const [loading, setLoading] = useState8(true);
1101
- const [enabled, setEnabled] = useState8(true);
1246
+ const [loading, setLoading] = useState9(true);
1247
+ const [enabled, setEnabled] = useState9(true);
1102
1248
  useEffect7(() => {
1103
1249
  readDebugModeSetting().then((setting) => {
1104
1250
  setEnabled(setting.enabled);
@@ -1111,7 +1257,7 @@ function DebugModeScreen({ onDone }) {
1111
1257
  });
1112
1258
  });
1113
1259
  }, []);
1114
- useInput9((input, key) => {
1260
+ useInput10((input, key) => {
1115
1261
  if (loading) return;
1116
1262
  if (key.return || input === " ") {
1117
1263
  setEnabled((current) => {
@@ -1126,19 +1272,19 @@ function DebugModeScreen({ onDone }) {
1126
1272
  onDone();
1127
1273
  }
1128
1274
  });
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: [
1275
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1276
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Debug Mode" }),
1277
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1278
+ loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text10, { children: [
1133
1279
  "Debug logging:",
1134
1280
  " ",
1135
- /* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1281
+ /* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1136
1282
  ] }),
1137
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1138
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1283
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1284
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1139
1285
  ] });
1140
1286
  }
1141
- var init_screen3 = __esm({
1287
+ var init_screen4 = __esm({
1142
1288
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
1143
1289
  "use strict";
1144
1290
  init_home_theme();
@@ -1152,46 +1298,61 @@ var app_exports = {};
1152
1298
  __export(app_exports, {
1153
1299
  runApp: () => runApp
1154
1300
  });
1155
- import { useState as useState9 } from "react";
1156
- import { jsx as jsx10 } from "react/jsx-runtime";
1301
+ import { useState as useState10 } from "react";
1302
+ import { jsx as jsx11 } from "react/jsx-runtime";
1157
1303
  function App({ onLaunchImport, importExitCode }) {
1158
1304
  const returnedFromImport = importExitCode !== void 0;
1159
- const [screen, setScreen] = useState9(returnedFromImport ? "import" : "start");
1160
- const [showImportResult, setShowImportResult] = useState9(returnedFromImport);
1305
+ const [screen, setScreen] = useState10(returnedFromImport ? "import" : "start");
1306
+ const [showImportResult, setShowImportResult] = useState10(returnedFromImport);
1307
+ const [projectPath, setProjectPath] = useState10();
1161
1308
  const goToStart = () => setScreen("start");
1162
1309
  const goToSettings = () => setScreen("settings");
1163
1310
  const finishImportResult = () => {
1164
1311
  setShowImportResult(false);
1312
+ setProjectPath(void 0);
1313
+ goToStart();
1314
+ };
1315
+ const leaveImport = () => {
1316
+ setProjectPath(void 0);
1165
1317
  goToStart();
1166
1318
  };
1167
1319
  switch (screen) {
1168
1320
  case "import":
1169
- return showImportResult ? /* @__PURE__ */ jsx10(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult }) : /* @__PURE__ */ jsx10(WelcomeScreen, { onContinue: (projectPath) => onLaunchImport?.(projectPath), onQuit: goToStart });
1321
+ if (showImportResult) return /* @__PURE__ */ jsx11(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1322
+ if (projectPath === void 0) return /* @__PURE__ */ jsx11(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport });
1323
+ return /* @__PURE__ */ jsx11(
1324
+ TokenInputScreen,
1325
+ {
1326
+ onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
1327
+ onSkip: () => onLaunchImport?.({ project: projectPath, skipTokenPrompt: true }),
1328
+ onBack: () => setProjectPath(void 0)
1329
+ }
1330
+ );
1170
1331
  case "help":
1171
- return /* @__PURE__ */ jsx10(HelpScreen, { onDone: goToStart });
1332
+ return /* @__PURE__ */ jsx11(HelpScreen, { onDone: goToStart });
1172
1333
  case "upgrade":
1173
- return /* @__PURE__ */ jsx10(UpgradeScreen, { onDone: goToStart });
1334
+ return /* @__PURE__ */ jsx11(UpgradeScreen, { onDone: goToStart });
1174
1335
  case "settings":
1175
- return /* @__PURE__ */ jsx10(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1336
+ return /* @__PURE__ */ jsx11(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1176
1337
  case "settings-configuration":
1177
- return /* @__PURE__ */ jsx10(ConfigurationScreen, { onDone: goToSettings });
1338
+ return /* @__PURE__ */ jsx11(ConfigurationScreen, { onDone: goToSettings });
1178
1339
  case "settings-opt-in-analytics":
1179
- return /* @__PURE__ */ jsx10(OptInAnalyticsScreen, { onDone: goToSettings });
1340
+ return /* @__PURE__ */ jsx11(OptInAnalyticsScreen, { onDone: goToSettings });
1180
1341
  case "settings-debug-mode":
1181
- return /* @__PURE__ */ jsx10(DebugModeScreen, { onDone: goToSettings });
1342
+ return /* @__PURE__ */ jsx11(DebugModeScreen, { onDone: goToSettings });
1182
1343
  case "start":
1183
- return /* @__PURE__ */ jsx10(HomeScreen, { onNavigate: setScreen });
1344
+ return /* @__PURE__ */ jsx11(HomeScreen, { onNavigate: setScreen });
1184
1345
  }
1185
1346
  }
1186
1347
  async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1187
- let requestedProjectPath;
1348
+ let requestedImport;
1188
1349
  const instance = renderApp(
1189
- /* @__PURE__ */ jsx10(
1350
+ /* @__PURE__ */ jsx11(
1190
1351
  App,
1191
1352
  {
1192
1353
  importExitCode,
1193
- onLaunchImport: (projectPath) => {
1194
- requestedProjectPath = projectPath;
1354
+ onLaunchImport: (options) => {
1355
+ requestedImport = options;
1195
1356
  instance.unmount();
1196
1357
  }
1197
1358
  }
@@ -1199,15 +1360,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1199
1360
  );
1200
1361
  await instance.waitUntilExit();
1201
1362
  await stopReadingTerminal();
1202
- return requestedProjectPath;
1363
+ return requestedImport;
1203
1364
  }
1204
1365
  async function runApp(renderApp) {
1205
1366
  let importExitCode;
1206
- let projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1207
- while (projectPath !== void 0) {
1208
- importExitCode = (await spawnV1Import({ project: projectPath })).exitCode;
1367
+ let requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1368
+ while (requestedImport !== void 0) {
1369
+ importExitCode = (await spawnV1Import(requestedImport)).exitCode;
1209
1370
  startReadingTerminal();
1210
- projectPath = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1371
+ requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1211
1372
  }
1212
1373
  }
1213
1374
  var init_app = __esm({
@@ -1221,9 +1382,9 @@ var init_app = __esm({
1221
1382
  init_PageContainer2();
1222
1383
  init_PageContainer3();
1223
1384
  init_ContentfulConfigScreen();
1224
- init_screen2();
1225
- init_PageContainer4();
1226
1385
  init_screen3();
1386
+ init_PageContainer4();
1387
+ init_screen4();
1227
1388
  }
1228
1389
  });
1229
1390