@contentful/experience-design-system-cli 2.37.1-dev-build-049f8d38.0 → 2.37.1-dev-build-cf4224ad.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 { useEffect as useEffect8, useState as useState11 } from "react";
2
+ import { useEffect as useEffect9, useState as useState12 } 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";
@@ -349,6 +349,8 @@ function useTokenInputControls(onBack) {
349
349
 
350
350
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
351
351
  import { statSync } from "node:fs";
352
+
353
+ // packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
352
354
  import { homedir } from "node:os";
353
355
  import { resolve } from "node:path";
354
356
  function stripQuotes(value) {
@@ -358,8 +360,13 @@ function stripQuotes(value) {
358
360
  function expandHome(value) {
359
361
  return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
360
362
  }
363
+ function resolveUserPath(raw) {
364
+ return resolve(expandHome(stripQuotes(raw.trim())));
365
+ }
366
+
367
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
361
368
  function validateTokenPath(rawPath) {
362
- const path = resolve(expandHome(stripQuotes(rawPath.trim())));
369
+ const path = resolveUserPath(rawPath);
363
370
  let stats;
364
371
  try {
365
372
  stats = statSync(path);
@@ -428,18 +435,288 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
428
435
  ] });
429
436
  }
430
437
 
438
+ // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
439
+ import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
440
+ import { Box as Box5, Text as Text6 } from "ink";
441
+
442
+ // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
443
+ import { useInput as useInput5 } from "ink";
444
+
445
+ // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts
446
+ var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
447
+ "node_modules",
448
+ "dist",
449
+ "build",
450
+ ".next",
451
+ ".nuxt",
452
+ "coverage",
453
+ "storybook-static",
454
+ "out",
455
+ ".git"
456
+ ]);
457
+ var CATEGORY_BY_EXTENSION = /* @__PURE__ */ new Map([
458
+ ["tsx", "tsx"],
459
+ ["ts", "ts"],
460
+ ["vue", "vue"],
461
+ ["astro", "astro"],
462
+ ["jsx", "jsx"],
463
+ ["js", "js"],
464
+ ["json", "json"]
465
+ ]);
466
+ var COMPONENT_CATEGORIES = ["tsx", "ts", "vue", "astro", "jsx", "js"];
467
+ var ROW_LABELS = {
468
+ tsx: ".tsx files",
469
+ ts: ".ts files",
470
+ vue: ".vue files",
471
+ astro: ".astro files",
472
+ jsx: ".jsx files",
473
+ js: ".js files",
474
+ json: ".json files (design tokens)",
475
+ other: "other (ignored)"
476
+ };
477
+ var ROW_ORDER = ["tsx", "ts", "vue", "astro", "jsx", "js", "json", "other"];
478
+ function categorize(fileName) {
479
+ if (fileName.endsWith(".d.ts")) return "other";
480
+ const dot = fileName.lastIndexOf(".");
481
+ const extension = dot === -1 ? "" : fileName.slice(dot + 1);
482
+ return CATEGORY_BY_EXTENSION.get(extension) ?? "other";
483
+ }
484
+ function emptyCounts() {
485
+ return { tsx: 0, ts: 0, vue: 0, astro: 0, jsx: 0, js: 0, json: 0, other: 0, total: 0 };
486
+ }
487
+ function addFile(counts, fileName) {
488
+ const category = categorize(fileName);
489
+ return { ...counts, [category]: counts[category] + 1, total: counts.total + 1 };
490
+ }
491
+ function mergeCounts(a, b) {
492
+ return {
493
+ tsx: a.tsx + b.tsx,
494
+ ts: a.ts + b.ts,
495
+ vue: a.vue + b.vue,
496
+ astro: a.astro + b.astro,
497
+ jsx: a.jsx + b.jsx,
498
+ js: a.js + b.js,
499
+ json: a.json + b.json,
500
+ other: a.other + b.other,
501
+ total: a.total + b.total
502
+ };
503
+ }
504
+ function failureFromErrorCode(code) {
505
+ if (code === "ENOENT") return "not-found";
506
+ if (code === "EACCES") return "permission-denied";
507
+ return "unreadable";
508
+ }
509
+ function describeFailure(failure, path) {
510
+ switch (failure) {
511
+ case "is-file":
512
+ return {
513
+ headline: "That's a file, not a directory.",
514
+ hints: [
515
+ "Provide the path to your component library's root folder, not a specific file.",
516
+ "Example: ~/projects/my-design-system"
517
+ ]
518
+ };
519
+ case "not-found":
520
+ return {
521
+ headline: `Directory not found: ${path}`,
522
+ hints: ["Double-check the path and try again. Tip: you can use ~, relative, or absolute paths."]
523
+ };
524
+ case "permission-denied":
525
+ return {
526
+ headline: `Permission denied: ${path}`,
527
+ hints: ["You don't have read access to this directory."]
528
+ };
529
+ case "not-directory":
530
+ return { headline: `Not a directory: ${path}`, hints: [] };
531
+ case "unreadable":
532
+ return { headline: `Cannot access: ${path}`, hints: [] };
533
+ }
534
+ }
535
+ function summarize(counts) {
536
+ const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
537
+ const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
538
+ return { label: ROW_LABELS[category], count: counts[category], tone };
539
+ });
540
+ const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
541
+ if (componentFiles > 0) return { total: counts.total, rows };
542
+ if (counts.json > 0) {
543
+ return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
544
+ }
545
+ return {
546
+ total: counts.total,
547
+ rows,
548
+ warning: "No component or token files found. Try a different path."
549
+ };
550
+ }
551
+ function phaseOf(scan) {
552
+ if (scan === void 0) return "scanning";
553
+ return scan.ok ? "ready" : "failed";
554
+ }
555
+ function keyAction(phase, input, key) {
556
+ if (key.escape) return "back";
557
+ if (phase === "ready") {
558
+ if (key.return) return "confirm";
559
+ if (input === "e") return "change-path";
560
+ }
561
+ if (phase === "failed" && (key.return || input === "e")) return "change-path";
562
+ return void 0;
563
+ }
564
+
565
+ // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
566
+ var CONTROLS = {
567
+ scanning: [{ keys: "Esc", label: "Back" }],
568
+ ready: [
569
+ { keys: "Enter", label: "Yes, continue" },
570
+ { keys: "e", label: "Change path" },
571
+ { keys: "Esc", label: "Back" }
572
+ ],
573
+ failed: [
574
+ { keys: "Enter/e", label: "Try a different path" },
575
+ { keys: "Esc", label: "Back" }
576
+ ]
577
+ };
578
+ function controlsFor(phase) {
579
+ return CONTROLS[phase];
580
+ }
581
+ function usePathValidationControls(phase, handlers) {
582
+ useInput5((input, key) => {
583
+ const action = keyAction(phase, input, key);
584
+ if (action === "confirm") handlers.onConfirm();
585
+ else if (action === "change-path") handlers.onChangePath();
586
+ else if (action === "back") handlers.onBack();
587
+ });
588
+ }
589
+
590
+ // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/loader.ts
591
+ import { readdir, stat } from "node:fs/promises";
592
+ import { join as join3 } from "node:path";
593
+ async function isFile(path) {
594
+ try {
595
+ return (await stat(path)).isFile();
596
+ } catch {
597
+ return false;
598
+ }
599
+ }
600
+ async function countEntry(directory, entry) {
601
+ const path = join3(directory, entry.name);
602
+ if (entry.isDirectory()) return countFiles(path);
603
+ if (entry.isFile() || entry.isSymbolicLink() && await isFile(path)) return addFile(emptyCounts(), entry.name);
604
+ return emptyCounts();
605
+ }
606
+ async function countFiles(directory) {
607
+ let entries;
608
+ try {
609
+ entries = await readdir(directory, { withFileTypes: true });
610
+ } catch {
611
+ return emptyCounts();
612
+ }
613
+ const counts = await Promise.all(
614
+ entries.filter((entry) => !IGNORED_DIRECTORIES.has(entry.name)).map((entry) => countEntry(directory, entry))
615
+ );
616
+ return counts.reduce(mergeCounts, emptyCounts());
617
+ }
618
+ async function scanProject(directory) {
619
+ try {
620
+ const stats = await stat(directory);
621
+ if (stats.isFile()) return { ok: false, failure: "is-file" };
622
+ if (!stats.isDirectory()) return { ok: false, failure: "not-directory" };
623
+ } catch (error) {
624
+ return { ok: false, failure: failureFromErrorCode(error.code) };
625
+ }
626
+ return { ok: true, counts: await countFiles(directory) };
627
+ }
628
+
629
+ // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
630
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
631
+ function Row({ row }) {
632
+ return /* @__PURE__ */ jsxs5(Text6, { color: row.tone === "accent" ? PALETTE.accent : void 0, dimColor: row.tone === "muted", children: [
633
+ " \u2022 ",
634
+ String(row.count).padStart(3),
635
+ " ",
636
+ row.label
637
+ ] });
638
+ }
639
+ function Failure({ scan, path }) {
640
+ const { headline, hints } = describeFailure(scan.failure, path);
641
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
642
+ /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.error, children: [
643
+ "\u2717 ",
644
+ headline
645
+ ] }),
646
+ hints.map((hint) => /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: hint }, hint))
647
+ ] });
648
+ }
649
+ function Summary({ scan, path }) {
650
+ const { total, rows, warning } = summarize(scan.counts);
651
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, children: [
652
+ /* @__PURE__ */ jsxs5(Text6, { children: [
653
+ "Scanned ",
654
+ /* @__PURE__ */ jsx6(Text6, { bold: true, children: path })
655
+ ] }),
656
+ /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
657
+ /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.success, children: [
658
+ "\u2713 Found ",
659
+ total,
660
+ " files:"
661
+ ] }),
662
+ rows.map((row) => /* @__PURE__ */ jsx6(Row, { row }, row.label))
663
+ ] }),
664
+ warning && /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.warning, children: [
665
+ "\u26A0 ",
666
+ warning
667
+ ] }),
668
+ /* @__PURE__ */ jsx6(Text6, { children: "Does this look right?" })
669
+ ] });
670
+ }
671
+ function PathValidationScreen({
672
+ projectPath,
673
+ onConfirm,
674
+ onChangePath,
675
+ onBack
676
+ }) {
677
+ const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
678
+ const [scan, setScan] = useState5();
679
+ useEffect3(() => {
680
+ let cancelled = false;
681
+ setScan(void 0);
682
+ void scanProject(resolvedPath).then((result) => {
683
+ if (!cancelled) setScan(result);
684
+ });
685
+ return () => {
686
+ cancelled = true;
687
+ };
688
+ }, [resolvedPath]);
689
+ const phase = phaseOf(scan);
690
+ usePathValidationControls(phase, { onConfirm: () => onConfirm(resolvedPath), onChangePath, onBack });
691
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
692
+ scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
693
+ "Scanning ",
694
+ /* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath }),
695
+ "..."
696
+ ] }),
697
+ scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath }),
698
+ scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath }),
699
+ /* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
700
+ "[",
701
+ control.keys,
702
+ "] ",
703
+ control.label
704
+ ] }, control.keys)) })
705
+ ] });
706
+ }
707
+
431
708
  // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
432
709
  import { spawn } from "node:child_process";
433
710
 
434
711
  // packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts
435
712
  import { existsSync as existsSync2 } from "node:fs";
436
- import { join as join3 } from "node:path";
713
+ import { join as join4 } from "node:path";
437
714
  var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
438
715
  function findLegacyCliPath() {
439
716
  const root = findPackageRoot(import.meta.url, PACKAGE_NAME2);
440
717
  const candidates = [
441
- join3(root, "legacy", "bin", "cli.js"),
442
- join3(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
718
+ join4(root, "legacy", "bin", "cli.js"),
719
+ join4(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
443
720
  ];
444
721
  const found = candidates.find((candidate) => existsSync2(candidate));
445
722
  if (!found) {
@@ -495,24 +772,24 @@ function startReadingTerminal() {
495
772
  }
496
773
 
497
774
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
498
- import { useEffect as useEffect3, useState as useState5 } from "react";
499
- import { Box as Box5, Text as Text6, useInput as useInput5 } from "ink";
775
+ import { useEffect as useEffect4, useState as useState6 } from "react";
776
+ import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
500
777
 
501
778
  // packages/experience-design-system-cli/src/tui/debug-store.ts
502
779
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
503
780
  import { existsSync as existsSync3, readdirSync } from "node:fs";
504
- import { join as join5 } from "node:path";
781
+ import { join as join6 } from "node:path";
505
782
 
506
783
  // packages/experience-design-system-types/dist/src/config/index.js
507
784
  import { randomBytes } from "node:crypto";
508
785
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
509
786
  import { homedir as homedir2 } from "node:os";
510
- import { dirname as dirname2, join as join4 } from "node:path";
787
+ import { dirname as dirname2, join as join5 } from "node:path";
511
788
  function configRoot() {
512
- return process.env["EDS_HOME"] || join4(homedir2(), ".contentful", "experience-design-system-cli");
789
+ return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
513
790
  }
514
- var configFilePath = () => join4(configRoot(), "config.json");
515
- var debugSessionsDir = () => join4(configRoot(), "debug", "sessions");
791
+ var configFilePath = () => join5(configRoot(), "config.json");
792
+ var debugSessionsDir = () => join5(configRoot(), "debug", "sessions");
516
793
  async function readSettings() {
517
794
  try {
518
795
  return JSON.parse(await readFile(configFilePath(), "utf8"));
@@ -571,7 +848,7 @@ function generateSessionId() {
571
848
  }
572
849
  var SESSION_ID = generateSessionId();
573
850
  function sessionDebugDir() {
574
- return join5(debugSessionsDir(), SESSION_ID);
851
+ return join6(debugSessionsDir(), SESSION_ID);
575
852
  }
576
853
  function currentDebugSessionDir() {
577
854
  return sessionDebugDir();
@@ -620,10 +897,10 @@ async function finishDebugRun({
620
897
  const durationMs = Date.now() - run.startedAt;
621
898
  const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
622
899
  const flowSegments = run.flow.split("/");
623
- const dir = join5(sessionDebugDir(), ...flowSegments);
900
+ const dir = join6(sessionDebugDir(), ...flowSegments);
624
901
  await mkdir2(dir, { recursive: true });
625
902
  const filename = nextAttemptFilename(dir, run.menuOption);
626
- await writeFile2(join5(dir, filename), content, { mode: 384 });
903
+ await writeFile2(join6(dir, filename), content, { mode: 384 });
627
904
  }
628
905
  function nextAttemptFilename(dir, menuOption) {
629
906
  const today = datePrefix();
@@ -706,19 +983,19 @@ async function readHelpInfo() {
706
983
  }
707
984
 
708
985
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
709
- import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
986
+ import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
710
987
  function Section({ title, rows }) {
711
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
712
- /* @__PURE__ */ jsx6(Text6, { bold: true, color: PALETTE.accent, children: title }),
713
- rows.map((row) => /* @__PURE__ */ jsxs5(Box5, { gap: 1, children: [
714
- /* @__PURE__ */ jsx6(Box5, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: row.label }) }),
715
- /* @__PURE__ */ jsx6(Text6, { children: row.value })
988
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
989
+ /* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
990
+ rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
991
+ /* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: row.label }) }),
992
+ /* @__PURE__ */ jsx7(Text7, { children: row.value })
716
993
  ] }, row.label))
717
994
  ] });
718
995
  }
719
996
  function HelpScreen({ onDone }) {
720
- const [info, setInfo] = useState5();
721
- useEffect3(() => {
997
+ const [info, setInfo] = useState6();
998
+ useEffect4(() => {
722
999
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
723
1000
  void readHelpInfo().then(setInfo);
724
1001
  }, []);
@@ -726,7 +1003,7 @@ function HelpScreen({ onDone }) {
726
1003
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
727
1004
  onDone();
728
1005
  };
729
- useInput5((input, key) => {
1006
+ useInput6((input, key) => {
730
1007
  if (key.return) {
731
1008
  leave("saved");
732
1009
  return;
@@ -736,14 +1013,14 @@ function HelpScreen({ onDone }) {
736
1013
  return;
737
1014
  }
738
1015
  });
739
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
740
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Help" }),
741
- info ? /* @__PURE__ */ jsxs5(Fragment, { children: [
742
- /* @__PURE__ */ jsx6(Section, { title: "Where things are stored", rows: info.storage }),
743
- /* @__PURE__ */ jsx6(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
744
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
745
- ] }) : /* @__PURE__ */ jsx6(Text6, { color: PALETTE.accent, children: "Loading..." }),
746
- /* @__PURE__ */ jsx6(
1016
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
1017
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
1018
+ info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1019
+ /* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
1020
+ /* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
1021
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
1022
+ ] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
1023
+ /* @__PURE__ */ jsx7(
747
1024
  ControlHints,
748
1025
  {
749
1026
  hints: [
@@ -756,20 +1033,20 @@ function HelpScreen({ onDone }) {
756
1033
  }
757
1034
 
758
1035
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
759
- import { useState as useState6 } from "react";
760
- import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
761
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1036
+ import { useState as useState7 } from "react";
1037
+ import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
1038
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
762
1039
  function SettingsScreen({
763
1040
  onNavigate,
764
1041
  onBack
765
1042
  }) {
766
- const [focusIdx, setFocusIdx] = useState6(0);
1043
+ const [focusIdx, setFocusIdx] = useState7(0);
767
1044
  const items = [
768
1045
  { label: "Configuration", screen: "settings-configuration" },
769
1046
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
770
1047
  { label: "Debug Mode", screen: "settings-debug-mode" }
771
1048
  ];
772
- useInput6((input, key) => {
1049
+ useInput7((input, key) => {
773
1050
  if (key.upArrow) {
774
1051
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
775
1052
  return;
@@ -789,15 +1066,15 @@ function SettingsScreen({
789
1066
  onBack();
790
1067
  }
791
1068
  });
792
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
793
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Settings" }),
794
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
795
- items.map((item, i) => /* @__PURE__ */ jsxs6(Text7, { color: i === focusIdx ? "cyan" : void 0, children: [
1069
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1070
+ /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
1071
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1072
+ items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
796
1073
  i === focusIdx ? "> " : " ",
797
1074
  item.label
798
1075
  ] }, item.label)),
799
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
800
- /* @__PURE__ */ jsx7(
1076
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
1077
+ /* @__PURE__ */ jsx8(
801
1078
  ControlHints,
802
1079
  {
803
1080
  hints: [
@@ -811,8 +1088,8 @@ function SettingsScreen({
811
1088
  }
812
1089
 
813
1090
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
814
- import { useEffect as useEffect4, useState as useState7 } from "react";
815
- import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
1091
+ import { useEffect as useEffect5, useState as useState8 } from "react";
1092
+ import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
816
1093
  import TextInput3 from "ink-text-input";
817
1094
 
818
1095
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
@@ -844,7 +1121,7 @@ async function writeCredentials(config) {
844
1121
  }
845
1122
 
846
1123
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
847
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1124
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
848
1125
  var FIELD_ORDER = [
849
1126
  "spaceId",
850
1127
  "environmentId",
@@ -872,14 +1149,14 @@ var FIELD_LABELS = {
872
1149
  defaultTokenFile: "Default token file (optional)"
873
1150
  };
874
1151
  function ConfigurationScreen({ onDone }) {
875
- const [stage, setStage] = useState7("loading");
876
- const [config, setConfig] = useState7(null);
877
- const [activeField, setActiveField] = useState7("spaceId");
878
- const [notice, setNotice] = useState7(null);
879
- const [lastSaved, setLastSaved] = useState7(null);
880
- const [editing, setEditing] = useState7(false);
881
- const [valueBeforeEdit, setValueBeforeEdit] = useState7("");
882
- useEffect4(() => {
1152
+ const [stage, setStage] = useState8("loading");
1153
+ const [config, setConfig] = useState8(null);
1154
+ const [activeField, setActiveField] = useState8("spaceId");
1155
+ const [notice, setNotice] = useState8(null);
1156
+ const [lastSaved, setLastSaved] = useState8(null);
1157
+ const [editing, setEditing] = useState8(false);
1158
+ const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
1159
+ useEffect5(() => {
883
1160
  readCredentials().then((cfg) => {
884
1161
  setConfig(cfg);
885
1162
  setStage("form");
@@ -919,7 +1196,7 @@ function ConfigurationScreen({ onDone }) {
919
1196
  );
920
1197
  onDone();
921
1198
  }
922
- useInput7((input, key) => {
1199
+ useInput8((input, key) => {
923
1200
  if (stage === "loading" || stage === "saving") return;
924
1201
  if (editing) {
925
1202
  if (key.escape) {
@@ -956,26 +1233,26 @@ function ConfigurationScreen({ onDone }) {
956
1233
  }
957
1234
  });
958
1235
  if (stage === "loading") {
959
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
960
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Configuration" }),
961
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
962
- /* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." })
1236
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1237
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
1238
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1239
+ /* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
963
1240
  ] });
964
1241
  }
965
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
966
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Configuration" }),
967
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
968
- /* @__PURE__ */ jsx8(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
1242
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1243
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
1244
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1245
+ /* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
969
1246
  const isActive = activeField === field;
970
1247
  const value = fieldValue(field);
971
1248
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
972
- return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
973
- /* @__PURE__ */ jsx8(Text8, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
974
- /* @__PURE__ */ jsxs7(Text8, { bold: isActive, children: [
1249
+ return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
1250
+ /* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
1251
+ /* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
975
1252
  FIELD_LABELS[field],
976
1253
  ":"
977
1254
  ] }),
978
- isActive && editing ? /* @__PURE__ */ jsx8(
1255
+ isActive && editing ? /* @__PURE__ */ jsx9(
979
1256
  TextInput3,
980
1257
  {
981
1258
  value,
@@ -983,19 +1260,19 @@ function ConfigurationScreen({ onDone }) {
983
1260
  onSubmit: () => setEditing(false),
984
1261
  mask: field === "cmaToken" ? "\u2022" : void 0
985
1262
  }
986
- ) : /* @__PURE__ */ jsx8(Text8, { children: display || /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "(empty)" }) })
1263
+ ) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "(empty)" }) })
987
1264
  ] }, field);
988
1265
  }) }),
989
- notice && /* @__PURE__ */ jsxs7(Fragment2, { children: [
990
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
991
- /* @__PURE__ */ jsxs7(Text8, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
1266
+ notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
1267
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1268
+ /* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
992
1269
  notice.kind === "success" ? "\u2713" : "\u2717",
993
1270
  " ",
994
1271
  notice.text
995
1272
  ] })
996
1273
  ] }),
997
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
998
- /* @__PURE__ */ jsx8(
1274
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1275
+ /* @__PURE__ */ jsx9(
999
1276
  ControlHints,
1000
1277
  {
1001
1278
  hints: editing ? [
@@ -1016,8 +1293,8 @@ function ConfigurationScreen({ onDone }) {
1016
1293
  }
1017
1294
 
1018
1295
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
1019
- import { useEffect as useEffect5, useState as useState8 } from "react";
1020
- import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
1296
+ import { useEffect as useEffect6, useState as useState9 } from "react";
1297
+ import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
1021
1298
 
1022
1299
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
1023
1300
  async function readAnalyticsSetting() {
@@ -1035,11 +1312,11 @@ async function writeAnalyticsSetting(setting) {
1035
1312
  }
1036
1313
 
1037
1314
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
1038
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1315
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1039
1316
  function OptInAnalyticsScreen({ onDone }) {
1040
- const [loading, setLoading] = useState8(true);
1041
- const [enabled, setEnabled] = useState8(true);
1042
- useEffect5(() => {
1317
+ const [loading, setLoading] = useState9(true);
1318
+ const [enabled, setEnabled] = useState9(true);
1319
+ useEffect6(() => {
1043
1320
  readAnalyticsSetting().then((setting) => {
1044
1321
  setEnabled(setting.enabled);
1045
1322
  setLoading(false);
@@ -1051,7 +1328,7 @@ function OptInAnalyticsScreen({ onDone }) {
1051
1328
  });
1052
1329
  });
1053
1330
  }, []);
1054
- useInput8((input, key) => {
1331
+ useInput9((input, key) => {
1055
1332
  if (loading) return;
1056
1333
  if (key.return || input === " ") {
1057
1334
  setEnabled((current) => {
@@ -1066,21 +1343,21 @@ function OptInAnalyticsScreen({ onDone }) {
1066
1343
  onDone();
1067
1344
  }
1068
1345
  });
1069
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1070
- /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
1071
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1072
- loading ? /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
1073
- /* @__PURE__ */ jsxs8(Text9, { children: [
1346
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1347
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
1348
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1349
+ loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
1350
+ /* @__PURE__ */ jsxs9(Text10, { children: [
1074
1351
  "Share anonymous usage data:",
1075
1352
  " ",
1076
- /* @__PURE__ */ jsx9(Text9, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1353
+ /* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1077
1354
  ] }),
1078
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1079
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1080
- /* @__PURE__ */ jsx9(Text9, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
1355
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1356
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1357
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
1081
1358
  ] }),
1082
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1083
- /* @__PURE__ */ jsx9(
1359
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1360
+ /* @__PURE__ */ jsx10(
1084
1361
  ControlHints,
1085
1362
  {
1086
1363
  hints: [
@@ -1093,13 +1370,13 @@ function OptInAnalyticsScreen({ onDone }) {
1093
1370
  }
1094
1371
 
1095
1372
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
1096
- import { useEffect as useEffect6, useState as useState9 } from "react";
1097
- import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
1098
- import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1373
+ import { useEffect as useEffect7, useState as useState10 } from "react";
1374
+ import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
1375
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1099
1376
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
1100
1377
  function UpgradeScreen({ onDone }) {
1101
- const [upgradeCheck, setUpgradeCheck] = useState9();
1102
- useEffect6(() => {
1378
+ const [upgradeCheck, setUpgradeCheck] = useState10();
1379
+ useEffect7(() => {
1103
1380
  startDebugRun({
1104
1381
  flow: "upgrade",
1105
1382
  step: "01-upgrade",
@@ -1108,7 +1385,7 @@ function UpgradeScreen({ onDone }) {
1108
1385
  });
1109
1386
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
1110
1387
  }, []);
1111
- useInput9((_input, key) => {
1388
+ useInput10((_input, key) => {
1112
1389
  if (key.return) {
1113
1390
  void finishDebugRun({
1114
1391
  outputs: upgradeCheck ?? {},
@@ -1119,12 +1396,12 @@ function UpgradeScreen({ onDone }) {
1119
1396
  return;
1120
1397
  }
1121
1398
  });
1122
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1123
- /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Upgrade" }),
1124
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1399
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1400
+ /* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
1401
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1125
1402
  renderBody(upgradeCheck),
1126
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1127
- /* @__PURE__ */ jsxs9(Text10, { bold: true, color: PALETTE.accent, children: [
1403
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1404
+ /* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
1128
1405
  FOCUS_MARKER,
1129
1406
  " Go Back"
1130
1407
  ] })
@@ -1132,45 +1409,45 @@ function UpgradeScreen({ onDone }) {
1132
1409
  }
1133
1410
  function renderBody(upgradeCheck) {
1134
1411
  if (!upgradeCheck) {
1135
- return /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1412
+ return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1136
1413
  }
1137
1414
  if (upgradeCheck.status === "error") {
1138
- return /* @__PURE__ */ jsx10(Text10, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1415
+ return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1139
1416
  }
1140
1417
  if (upgradeCheck.status === "up-to-date") {
1141
- return /* @__PURE__ */ jsxs9(Text10, { color: PALETTE.success, children: [
1418
+ return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
1142
1419
  "You're already on the latest version (v",
1143
1420
  upgradeCheck.current,
1144
1421
  ")."
1145
1422
  ] });
1146
1423
  }
1147
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
1148
- /* @__PURE__ */ jsxs9(Text10, { color: PALETTE.muted, children: [
1149
- /* @__PURE__ */ jsxs9(Text10, { bold: true, color: PALETTE.success, children: [
1424
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
1425
+ /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
1426
+ /* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
1150
1427
  "v",
1151
1428
  upgradeCheck.latest
1152
1429
  ] }),
1153
1430
  " ",
1154
1431
  "is available (you're on ",
1155
- /* @__PURE__ */ jsxs9(Text10, { bold: true, children: [
1432
+ /* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
1156
1433
  "v",
1157
1434
  upgradeCheck.current
1158
1435
  ] }),
1159
1436
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
1160
1437
  ] }),
1161
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1162
- /* @__PURE__ */ jsx10(Box9, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx10(Text10, { bold: true, children: cmd }, cmd)) })
1438
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1439
+ /* @__PURE__ */ jsx11(Box10, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx11(Text11, { bold: true, children: cmd }, cmd)) })
1163
1440
  ] });
1164
1441
  }
1165
1442
 
1166
1443
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
1167
- import { useEffect as useEffect7, useState as useState10 } from "react";
1168
- import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
1169
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1444
+ import { useEffect as useEffect8, useState as useState11 } from "react";
1445
+ import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
1446
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1170
1447
  function DebugModeScreen({ onDone }) {
1171
- const [loading, setLoading] = useState10(true);
1172
- const [enabled, setEnabled] = useState10(true);
1173
- useEffect7(() => {
1448
+ const [loading, setLoading] = useState11(true);
1449
+ const [enabled, setEnabled] = useState11(true);
1450
+ useEffect8(() => {
1174
1451
  readDebugModeSetting().then((setting) => {
1175
1452
  setEnabled(setting.enabled);
1176
1453
  setLoading(false);
@@ -1182,7 +1459,7 @@ function DebugModeScreen({ onDone }) {
1182
1459
  });
1183
1460
  });
1184
1461
  }, []);
1185
- useInput10((input, key) => {
1462
+ useInput11((input, key) => {
1186
1463
  if (loading) return;
1187
1464
  if (key.return || input === " ") {
1188
1465
  setEnabled((current) => {
@@ -1197,16 +1474,16 @@ function DebugModeScreen({ onDone }) {
1197
1474
  onDone();
1198
1475
  }
1199
1476
  });
1200
- return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1201
- /* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Debug Mode" }),
1202
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
1203
- loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text11, { children: [
1477
+ return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1478
+ /* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
1479
+ /* @__PURE__ */ jsx12(Text12, { children: " " }),
1480
+ loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
1204
1481
  "Debug logging:",
1205
1482
  " ",
1206
- /* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1483
+ /* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1207
1484
  ] }),
1208
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
1209
- /* @__PURE__ */ jsx11(
1485
+ /* @__PURE__ */ jsx12(Text12, { children: " " }),
1486
+ /* @__PURE__ */ jsx12(
1210
1487
  ControlHints,
1211
1488
  {
1212
1489
  hints: [
@@ -1219,14 +1496,15 @@ function DebugModeScreen({ onDone }) {
1219
1496
  }
1220
1497
 
1221
1498
  // packages/experience-design-system-cli/app.tsx
1222
- import { Fragment as Fragment4, jsx as jsx12 } from "react/jsx-runtime";
1499
+ import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
1223
1500
  function App({ onLaunchImport, importExitCode }) {
1224
1501
  const returnedFromImport = importExitCode !== void 0;
1225
- const [screen, setScreen] = useState11(returnedFromImport ? "import" : "start");
1226
- const [showImportResult, setShowImportResult] = useState11(returnedFromImport);
1227
- const [projectPath, setProjectPath] = useState11();
1228
- const [importDefaults, setImportDefaults] = useState11();
1229
- useEffect8(() => {
1502
+ const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
1503
+ const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
1504
+ const [projectPath, setProjectPath] = useState12();
1505
+ const [tokensPath, setTokensPath] = useState12();
1506
+ const [importDefaults, setImportDefaults] = useState12();
1507
+ useEffect9(() => {
1230
1508
  if (screen !== "import") {
1231
1509
  setImportDefaults(void 0);
1232
1510
  return;
@@ -1237,51 +1515,66 @@ function App({ onLaunchImport, importExitCode }) {
1237
1515
  }, [screen]);
1238
1516
  const goToStart = () => setScreen("start");
1239
1517
  const goToSettings = () => setScreen("settings");
1518
+ const resetImport = () => {
1519
+ setProjectPath(void 0);
1520
+ setTokensPath(void 0);
1521
+ };
1240
1522
  const finishImportResult = () => {
1241
1523
  setShowImportResult(false);
1242
- setProjectPath(void 0);
1524
+ resetImport();
1243
1525
  goToStart();
1244
1526
  };
1245
1527
  const leaveImport = () => {
1246
- setProjectPath(void 0);
1528
+ resetImport();
1247
1529
  goToStart();
1248
1530
  };
1249
1531
  switch (screen) {
1250
1532
  case "import":
1251
- if (showImportResult) return /* @__PURE__ */ jsx12(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1252
- if (importDefaults === void 0) return /* @__PURE__ */ jsx12(Fragment4, {});
1533
+ if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1534
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
1253
1535
  if (projectPath === void 0) {
1254
- return /* @__PURE__ */ jsx12(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
1536
+ return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
1255
1537
  }
1256
- return /* @__PURE__ */ jsx12(
1257
- TokenInputScreen,
1538
+ if (tokensPath === void 0) {
1539
+ return /* @__PURE__ */ jsx13(
1540
+ TokenInputScreen,
1541
+ {
1542
+ initialPath: importDefaults.tokenFile,
1543
+ onConfirm: setTokensPath,
1544
+ onBack: () => setProjectPath(void 0)
1545
+ }
1546
+ );
1547
+ }
1548
+ return /* @__PURE__ */ jsx13(
1549
+ PathValidationScreen,
1258
1550
  {
1259
- initialPath: importDefaults.tokenFile,
1260
- onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
1261
- onBack: () => setProjectPath(void 0)
1551
+ projectPath,
1552
+ onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
1553
+ onChangePath: resetImport,
1554
+ onBack: () => setTokensPath(void 0)
1262
1555
  }
1263
1556
  );
1264
1557
  case "help":
1265
- return /* @__PURE__ */ jsx12(HelpScreen, { onDone: goToStart });
1558
+ return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
1266
1559
  case "upgrade":
1267
- return /* @__PURE__ */ jsx12(UpgradeScreen, { onDone: goToStart });
1560
+ return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
1268
1561
  case "settings":
1269
- return /* @__PURE__ */ jsx12(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1562
+ return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1270
1563
  case "settings-configuration":
1271
- return /* @__PURE__ */ jsx12(ConfigurationScreen, { onDone: goToSettings });
1564
+ return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
1272
1565
  case "settings-opt-in-analytics":
1273
- return /* @__PURE__ */ jsx12(OptInAnalyticsScreen, { onDone: goToSettings });
1566
+ return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
1274
1567
  case "settings-debug-mode":
1275
- return /* @__PURE__ */ jsx12(DebugModeScreen, { onDone: goToSettings });
1568
+ return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
1276
1569
  case "start":
1277
- return /* @__PURE__ */ jsx12(HomeScreen, { onNavigate: setScreen });
1570
+ return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
1278
1571
  }
1279
1572
  }
1280
1573
  var CLEAR_SCREEN = "\x1B[2J\x1B[H";
1281
1574
  async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1282
1575
  let requestedImport;
1283
1576
  const instance = renderApp(
1284
- /* @__PURE__ */ jsx12(
1577
+ /* @__PURE__ */ jsx13(
1285
1578
  App,
1286
1579
  {
1287
1580
  importExitCode,