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