@contentful/experience-design-system-cli 2.35.1-dev-build-7780c1f7.0 → 2.35.1-dev-build-215f38d1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // packages/experience-design-system-cli/app.tsx
2
- import { useState as useState8 } 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";
@@ -230,6 +230,197 @@ function ImportScreen({ exitCode, onDone }) {
230
230
  ] });
231
231
  }
232
232
 
233
+ // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
234
+ import { useState as useState3 } from "react";
235
+ import { Box as Box3, Text as Text3 } from "ink";
236
+ import TextInput from "ink-text-input";
237
+
238
+ // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
239
+ import { useInput as useInput3 } from "ink";
240
+
241
+ // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
242
+ function shouldQuit(value, input, key) {
243
+ if (key.escape) return true;
244
+ return value === "" && input === "q" && !key.ctrl && !key.meta;
245
+ }
246
+ function toProjectPath(value) {
247
+ const projectPath = value.trim();
248
+ return projectPath === "" ? null : projectPath;
249
+ }
250
+
251
+ // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
252
+ var WELCOME_CONTROLS = [
253
+ { keys: "Enter", label: "Continue" },
254
+ { keys: "Esc/q", label: "Back to menu" }
255
+ ];
256
+ function useWelcomeControls(projectPath, onQuit) {
257
+ useInput3((input, key) => {
258
+ if (shouldQuit(projectPath, input, key)) onQuit();
259
+ });
260
+ }
261
+
262
+ // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
263
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
264
+ var RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
265
+ var OVERVIEW = [
266
+ { label: "Step 1", description: "Extract components from your codebase" },
267
+ { label: "Step 2", description: "Review what was extracted" },
268
+ { label: "Step 3", description: "Generate CDF definitions with Claude" },
269
+ { label: "Step 4", description: "Review generated definitions" },
270
+ { label: "Step 5", description: "Push to Contentful" }
271
+ ];
272
+ function WelcomeScreen({ onContinue, onQuit }) {
273
+ const [projectPath, setProjectPath] = useState3("");
274
+ useWelcomeControls(projectPath, onQuit);
275
+ const submit = (value) => {
276
+ const path = toProjectPath(value);
277
+ if (path) onContinue(path);
278
+ };
279
+ return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
280
+ /* @__PURE__ */ jsx3(Text3, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
281
+ /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
282
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
283
+ /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE }),
284
+ OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
285
+ /* @__PURE__ */ jsx3(Text3, { bold: true, children: item.label }),
286
+ /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: item.description })
287
+ ] }, item.label)),
288
+ /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: RULE })
289
+ ] }),
290
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
291
+ /* @__PURE__ */ jsx3(Text3, { children: "Where is your component library?" }),
292
+ /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
293
+ /* @__PURE__ */ jsx3(Text3, { color: PALETTE.accent, children: "?" }),
294
+ /* @__PURE__ */ jsx3(Text3, { children: "Project path:" }),
295
+ /* @__PURE__ */ jsx3(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
296
+ ] })
297
+ ] }),
298
+ /* @__PURE__ */ jsx3(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
299
+ "[",
300
+ control.keys,
301
+ "] ",
302
+ control.label
303
+ ] }, control.keys)) })
304
+ ] });
305
+ }
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
+
233
424
  // packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
234
425
  import { spawn } from "node:child_process";
235
426
 
@@ -257,6 +448,12 @@ function buildArgs(options) {
257
448
  if (options.project) {
258
449
  args.push("--project", options.project);
259
450
  }
451
+ if (options.tokens) {
452
+ args.push("--tokens", options.tokens);
453
+ }
454
+ if (options.skipTokenPrompt) {
455
+ args.push("--skip-token-prompt");
456
+ }
260
457
  return args;
261
458
  }
262
459
  async function spawnV1Import(options = {}) {
@@ -280,7 +477,7 @@ function getTerminalHandle() {
280
477
  return process.stdin._handle;
281
478
  }
282
479
  async function stopReadingTerminal() {
283
- await new Promise((resolve) => setImmediate(resolve));
480
+ await new Promise((resolve2) => setImmediate(resolve2));
284
481
  const handle = getTerminalHandle();
285
482
  if (!handle?.readStop) return;
286
483
  handle.reading = false;
@@ -295,7 +492,7 @@ function startReadingTerminal() {
295
492
 
296
493
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
297
494
  import { useEffect as useEffect3 } from "react";
298
- import { Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
495
+ import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
299
496
 
300
497
  // packages/experience-design-system-cli/src/tui/debug-store.ts
301
498
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
@@ -469,7 +666,7 @@ process.once("SIGINT", () => {
469
666
  });
470
667
 
471
668
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
472
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
669
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
473
670
  function HelpScreen({ onDone }) {
474
671
  useEffect3(() => {
475
672
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
@@ -478,7 +675,7 @@ function HelpScreen({ onDone }) {
478
675
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
479
676
  onDone();
480
677
  };
481
- useInput3((input, key) => {
678
+ useInput5((input, key) => {
482
679
  if (key.return) {
483
680
  leave("saved");
484
681
  return;
@@ -488,30 +685,30 @@ function HelpScreen({ onDone }) {
488
685
  return;
489
686
  }
490
687
  });
491
- return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
492
- /* @__PURE__ */ jsx3(Text3, { bold: true, children: "Help" }),
493
- /* @__PURE__ */ jsx3(Text3, { children: " " }),
494
- /* @__PURE__ */ jsx3(Text3, { children: "This is a placeholder screen for v2 help content." }),
495
- /* @__PURE__ */ jsx3(Text3, { children: " " }),
496
- /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
688
+ return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
689
+ /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Help" }),
690
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
691
+ /* @__PURE__ */ jsx5(Text5, { children: "This is a placeholder screen for v2 help content." }),
692
+ /* @__PURE__ */ jsx5(Text5, { children: " " }),
693
+ /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[Enter] Complete [Esc/q] Exit \u2014 both return to Start" })
497
694
  ] });
498
695
  }
499
696
 
500
697
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
501
- import { useState as useState3 } from "react";
502
- import { Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
503
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
698
+ import { useState as useState5 } from "react";
699
+ import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
700
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
504
701
  function SettingsScreen({
505
702
  onNavigate,
506
703
  onBack
507
704
  }) {
508
- const [focusIdx, setFocusIdx] = useState3(0);
705
+ const [focusIdx, setFocusIdx] = useState5(0);
509
706
  const items = [
510
707
  { label: "Configuration", screen: "settings-configuration" },
511
708
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
512
709
  { label: "Debug Mode", screen: "settings-debug-mode" }
513
710
  ];
514
- useInput4((input, key) => {
711
+ useInput6((input, key) => {
515
712
  if (key.upArrow) {
516
713
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
517
714
  return;
@@ -531,27 +728,27 @@ function SettingsScreen({
531
728
  onBack();
532
729
  }
533
730
  });
534
- return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
535
- /* @__PURE__ */ jsx4(Text4, { bold: true, children: "Settings" }),
536
- /* @__PURE__ */ jsx4(Text4, { children: " " }),
537
- items.map((item, i) => /* @__PURE__ */ jsxs4(Text4, { color: i === focusIdx ? "cyan" : void 0, children: [
731
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
732
+ /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Settings" }),
733
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
734
+ items.map((item, i) => /* @__PURE__ */ jsxs6(Text6, { color: i === focusIdx ? "cyan" : void 0, children: [
538
735
  i === focusIdx ? "> " : " ",
539
736
  item.label
540
737
  ] }, item.label)),
541
- /* @__PURE__ */ jsx4(Text4, { children: " " }),
542
- /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
738
+ /* @__PURE__ */ jsx6(Text6, { children: " " }),
739
+ /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[\u2191/\u2193] Navigate [Enter] Select [Esc/q] Back to Start" })
543
740
  ] });
544
741
  }
545
742
 
546
743
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
547
- import { useEffect as useEffect4, useState as useState4 } from "react";
548
- import { Box as Box5, Text as Text5, useInput as useInput5 } from "ink";
744
+ import { useEffect as useEffect4, useState as useState6 } from "react";
745
+ import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
549
746
 
550
747
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
551
748
  import { readFile as readFile2, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
552
749
  import { join as join6 } from "node:path";
553
- import { homedir } from "node:os";
554
- var V1_STORE_PATH = join6(homedir(), ".config", "experiences", "credentials.json");
750
+ import { homedir as homedir2 } from "node:os";
751
+ var V1_STORE_PATH = join6(homedir2(), ".config", "experiences", "credentials.json");
555
752
  async function readV1Store() {
556
753
  try {
557
754
  const raw = await readFile2(V1_STORE_PATH, "utf8");
@@ -561,7 +758,7 @@ async function readV1Store() {
561
758
  }
562
759
  }
563
760
  async function writeV1Store(data) {
564
- await mkdir3(join6(homedir(), ".config", "experiences"), { recursive: true });
761
+ await mkdir3(join6(homedir2(), ".config", "experiences"), { recursive: true });
565
762
  await writeFile3(V1_STORE_PATH, `${JSON.stringify(data, null, 2)}
566
763
  `, { mode: 384 });
567
764
  }
@@ -589,7 +786,7 @@ async function writeCredentials(config) {
589
786
  }
590
787
 
591
788
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
592
- import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
789
+ import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
593
790
  var FIELD_ORDER = ["spaceId", "environmentId", "cmaToken", "host"];
594
791
  function debugFields(config) {
595
792
  return {
@@ -606,10 +803,10 @@ var FIELD_LABELS = {
606
803
  host: "API Host (optional)"
607
804
  };
608
805
  function ConfigurationScreen({ onDone }) {
609
- const [stage, setStage] = useState4("loading");
610
- const [config, setConfig] = useState4(null);
611
- const [activeField, setActiveField] = useState4("spaceId");
612
- const [message, setMessage] = useState4(null);
806
+ const [stage, setStage] = useState6("loading");
807
+ const [config, setConfig] = useState6(null);
808
+ const [activeField, setActiveField] = useState6("spaceId");
809
+ const [message, setMessage] = useState6(null);
613
810
  useEffect4(() => {
614
811
  readCredentials().then((cfg) => {
615
812
  setConfig(cfg);
@@ -642,7 +839,7 @@ function ConfigurationScreen({ onDone }) {
642
839
  setStage("form");
643
840
  });
644
841
  }
645
- useInput5((input, key) => {
842
+ useInput7((input, key) => {
646
843
  if (stage === "loading" || stage === "saving") return;
647
844
  if (stage === "saved") {
648
845
  if (key.return || key.escape || input === "q") {
@@ -685,57 +882,57 @@ function ConfigurationScreen({ onDone }) {
685
882
  }
686
883
  });
687
884
  if (stage === "loading") {
688
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
689
- /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Configuration" }),
690
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
691
- /* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "Loading..." })
885
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
886
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
887
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
888
+ /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
692
889
  ] });
693
890
  }
694
891
  if (stage === "saved") {
695
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
696
- /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Configuration" }),
697
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
698
- /* @__PURE__ */ jsxs5(Text5, { color: PALETTE.success, children: [
892
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
893
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
894
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
895
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
699
896
  "\u2713 ",
700
897
  message
701
898
  ] }),
702
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
703
- /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[Enter] Back to Settings" })
899
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
900
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
704
901
  ] });
705
902
  }
706
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
707
- /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Configuration" }),
708
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
709
- /* @__PURE__ */ jsx5(Text5, { children: "Contentful API Credentials" }),
710
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
711
- /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
903
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
904
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
905
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
906
+ /* @__PURE__ */ jsx7(Text7, { children: "Contentful API Credentials" }),
907
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
908
+ /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
712
909
  const isActive = activeField === field;
713
910
  const value = fieldValue(field);
714
911
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
715
- return /* @__PURE__ */ jsxs5(Box5, { gap: 1, children: [
716
- /* @__PURE__ */ jsx5(Text5, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
717
- /* @__PURE__ */ jsxs5(Text5, { bold: isActive, children: [
912
+ return /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
913
+ /* @__PURE__ */ jsx7(Text7, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
914
+ /* @__PURE__ */ jsxs7(Text7, { bold: isActive, children: [
718
915
  FIELD_LABELS[field],
719
916
  ":"
720
917
  ] }),
721
- /* @__PURE__ */ jsx5(Text5, { children: display || /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "(empty)" }) })
918
+ /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
722
919
  ] }, field);
723
920
  }) }),
724
- message && /* @__PURE__ */ jsxs5(Fragment, { children: [
725
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
726
- /* @__PURE__ */ jsxs5(Text5, { color: PALETTE.error, children: [
921
+ message && /* @__PURE__ */ jsxs7(Fragment, { children: [
922
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
923
+ /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.error, children: [
727
924
  "\u2717 ",
728
925
  message
729
926
  ] })
730
927
  ] }),
731
- /* @__PURE__ */ jsx5(Text5, { children: " " }),
732
- /* @__PURE__ */ jsx5(Text5, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
928
+ /* @__PURE__ */ jsx7(Text7, { children: " " }),
929
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
733
930
  ] });
734
931
  }
735
932
 
736
933
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
737
- import { useEffect as useEffect5, useState as useState5 } from "react";
738
- import { Box as Box6, Text as Text6, useInput as useInput6 } from "ink";
934
+ import { useEffect as useEffect5, useState as useState7 } from "react";
935
+ import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
739
936
 
740
937
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
741
938
  async function readAnalyticsSetting() {
@@ -753,10 +950,10 @@ async function writeAnalyticsSetting(setting) {
753
950
  }
754
951
 
755
952
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
756
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
953
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
757
954
  function OptInAnalyticsScreen({ onDone }) {
758
- const [loading, setLoading] = useState5(true);
759
- const [enabled, setEnabled] = useState5(true);
955
+ const [loading, setLoading] = useState7(true);
956
+ const [enabled, setEnabled] = useState7(true);
760
957
  useEffect5(() => {
761
958
  readAnalyticsSetting().then((setting) => {
762
959
  setEnabled(setting.enabled);
@@ -769,7 +966,7 @@ function OptInAnalyticsScreen({ onDone }) {
769
966
  });
770
967
  });
771
968
  }, []);
772
- useInput6((input, key) => {
969
+ useInput8((input, key) => {
773
970
  if (loading) return;
774
971
  if (key.return || input === " ") {
775
972
  setEnabled((current) => {
@@ -784,31 +981,31 @@ function OptInAnalyticsScreen({ onDone }) {
784
981
  onDone();
785
982
  }
786
983
  });
787
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
788
- /* @__PURE__ */ jsx6(Text6, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
789
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
790
- loading ? /* @__PURE__ */ jsx6(Text6, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
791
- /* @__PURE__ */ jsxs6(Text6, { children: [
984
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
985
+ /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
986
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
987
+ loading ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Fragment2, { children: [
988
+ /* @__PURE__ */ jsxs8(Text8, { children: [
792
989
  "Share anonymous usage data:",
793
990
  " ",
794
- /* @__PURE__ */ jsx6(Text6, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
991
+ /* @__PURE__ */ jsx8(Text8, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
795
992
  ] }),
796
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
797
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
798
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
993
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
994
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
995
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
799
996
  ] }),
800
- /* @__PURE__ */ jsx6(Text6, { children: " " }),
801
- /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
997
+ /* @__PURE__ */ jsx8(Text8, { children: " " }),
998
+ /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
802
999
  ] });
803
1000
  }
804
1001
 
805
1002
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
806
- import { useEffect as useEffect6, useState as useState6 } from "react";
807
- import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
808
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1003
+ import { useEffect as useEffect6, useState as useState8 } from "react";
1004
+ import { Box as Box9, Text as Text9, useInput as useInput9 } from "ink";
1005
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
809
1006
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
810
1007
  function UpgradeScreen({ onDone }) {
811
- const [upgradeCheck, setUpgradeCheck] = useState6();
1008
+ const [upgradeCheck, setUpgradeCheck] = useState8();
812
1009
  useEffect6(() => {
813
1010
  startDebugRun({
814
1011
  flow: "upgrade",
@@ -818,7 +1015,7 @@ function UpgradeScreen({ onDone }) {
818
1015
  });
819
1016
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
820
1017
  }, []);
821
- useInput7((_input, key) => {
1018
+ useInput9((_input, key) => {
822
1019
  if (key.return) {
823
1020
  void finishDebugRun({
824
1021
  outputs: upgradeCheck ?? {},
@@ -829,12 +1026,12 @@ function UpgradeScreen({ onDone }) {
829
1026
  return;
830
1027
  }
831
1028
  });
832
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
833
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Upgrade" }),
834
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
1029
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1030
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Upgrade" }),
1031
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
835
1032
  renderBody(upgradeCheck),
836
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
837
- /* @__PURE__ */ jsxs7(Text7, { bold: true, color: PALETTE.accent, children: [
1033
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1034
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.accent, children: [
838
1035
  FOCUS_MARKER,
839
1036
  " Go Back"
840
1037
  ] })
@@ -842,44 +1039,44 @@ function UpgradeScreen({ onDone }) {
842
1039
  }
843
1040
  function renderBody(upgradeCheck) {
844
1041
  if (!upgradeCheck) {
845
- return /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1042
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "Checking for updates\u2026" });
846
1043
  }
847
1044
  if (upgradeCheck.status === "error") {
848
- return /* @__PURE__ */ jsx7(Text7, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1045
+ return /* @__PURE__ */ jsx9(Text9, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
849
1046
  }
850
1047
  if (upgradeCheck.status === "up-to-date") {
851
- return /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
1048
+ return /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.success, children: [
852
1049
  "You're already on the latest version (v",
853
1050
  upgradeCheck.current,
854
1051
  ")."
855
1052
  ] });
856
1053
  }
857
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
858
- /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.muted, children: [
859
- /* @__PURE__ */ jsxs7(Text7, { bold: true, color: PALETTE.success, children: [
1054
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
1055
+ /* @__PURE__ */ jsxs9(Text9, { color: PALETTE.muted, children: [
1056
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, color: PALETTE.success, children: [
860
1057
  "v",
861
1058
  upgradeCheck.latest
862
1059
  ] }),
863
1060
  " ",
864
1061
  "is available (you're on ",
865
- /* @__PURE__ */ jsxs7(Text7, { bold: true, children: [
1062
+ /* @__PURE__ */ jsxs9(Text9, { bold: true, children: [
866
1063
  "v",
867
1064
  upgradeCheck.current
868
1065
  ] }),
869
1066
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
870
1067
  ] }),
871
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
872
- /* @__PURE__ */ jsx7(Box7, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx7(Text7, { bold: true, children: cmd }, cmd)) })
1068
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1069
+ /* @__PURE__ */ jsx9(Box9, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx9(Text9, { bold: true, children: cmd }, cmd)) })
873
1070
  ] });
874
1071
  }
875
1072
 
876
1073
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
877
- import { useEffect as useEffect7, useState as useState7 } from "react";
878
- import { Box as Box8, Text as Text8, useInput as useInput8 } from "ink";
879
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1074
+ import { useEffect as useEffect7, useState as useState9 } from "react";
1075
+ import { Box as Box10, Text as Text10, useInput as useInput10 } from "ink";
1076
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
880
1077
  function DebugModeScreen({ onDone }) {
881
- const [loading, setLoading] = useState7(true);
882
- const [enabled, setEnabled] = useState7(true);
1078
+ const [loading, setLoading] = useState9(true);
1079
+ const [enabled, setEnabled] = useState9(true);
883
1080
  useEffect7(() => {
884
1081
  readDebugModeSetting().then((setting) => {
885
1082
  setEnabled(setting.enabled);
@@ -892,7 +1089,7 @@ function DebugModeScreen({ onDone }) {
892
1089
  });
893
1090
  });
894
1091
  }, []);
895
- useInput8((input, key) => {
1092
+ useInput10((input, key) => {
896
1093
  if (loading) return;
897
1094
  if (key.return || input === " ") {
898
1095
  setEnabled((current) => {
@@ -907,61 +1104,74 @@ function DebugModeScreen({ onDone }) {
907
1104
  onDone();
908
1105
  }
909
1106
  });
910
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
911
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings \u203A Debug Mode" }),
912
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
913
- loading ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs8(Text8, { children: [
1107
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1108
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Debug Mode" }),
1109
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1110
+ loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Text10, { children: [
914
1111
  "Debug logging:",
915
1112
  " ",
916
- /* @__PURE__ */ jsx8(Text8, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1113
+ /* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
917
1114
  ] }),
918
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
919
- /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
1115
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1116
+ /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "[Enter/Space] Toggle [Esc/q] Back to Settings" })
920
1117
  ] });
921
1118
  }
922
1119
 
923
1120
  // packages/experience-design-system-cli/app.tsx
924
- import { jsx as jsx9 } from "react/jsx-runtime";
1121
+ import { jsx as jsx11 } from "react/jsx-runtime";
925
1122
  function App({ onLaunchImport, importExitCode }) {
926
1123
  const returnedFromImport = importExitCode !== void 0;
927
- const [screen, setScreen] = useState8(returnedFromImport ? "import" : "start");
1124
+ const [screen, setScreen] = useState10(returnedFromImport ? "import" : "start");
1125
+ const [showImportResult, setShowImportResult] = useState10(returnedFromImport);
1126
+ const [projectPath, setProjectPath] = useState10();
928
1127
  const goToStart = () => setScreen("start");
929
1128
  const goToSettings = () => setScreen("settings");
930
- const navigateFromHome = (next) => {
931
- if (next === "import" && onLaunchImport) {
932
- onLaunchImport();
933
- return;
934
- }
935
- setScreen(next);
1129
+ const finishImportResult = () => {
1130
+ setShowImportResult(false);
1131
+ setProjectPath(void 0);
1132
+ goToStart();
1133
+ };
1134
+ const leaveImport = () => {
1135
+ setProjectPath(void 0);
1136
+ goToStart();
936
1137
  };
937
1138
  switch (screen) {
938
1139
  case "import":
939
- return /* @__PURE__ */ jsx9(ImportScreen, { exitCode: importExitCode, onDone: goToStart });
1140
+ if (showImportResult) return /* @__PURE__ */ jsx11(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1141
+ if (projectPath === void 0) return /* @__PURE__ */ jsx11(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport });
1142
+ return /* @__PURE__ */ jsx11(
1143
+ TokenInputScreen,
1144
+ {
1145
+ onConfirm: (tokens) => onLaunchImport?.({ project: projectPath, tokens }),
1146
+ onSkip: () => onLaunchImport?.({ project: projectPath, skipTokenPrompt: true }),
1147
+ onBack: () => setProjectPath(void 0)
1148
+ }
1149
+ );
940
1150
  case "help":
941
- return /* @__PURE__ */ jsx9(HelpScreen, { onDone: goToStart });
1151
+ return /* @__PURE__ */ jsx11(HelpScreen, { onDone: goToStart });
942
1152
  case "upgrade":
943
- return /* @__PURE__ */ jsx9(UpgradeScreen, { onDone: goToStart });
1153
+ return /* @__PURE__ */ jsx11(UpgradeScreen, { onDone: goToStart });
944
1154
  case "settings":
945
- return /* @__PURE__ */ jsx9(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1155
+ return /* @__PURE__ */ jsx11(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
946
1156
  case "settings-configuration":
947
- return /* @__PURE__ */ jsx9(ConfigurationScreen, { onDone: goToSettings });
1157
+ return /* @__PURE__ */ jsx11(ConfigurationScreen, { onDone: goToSettings });
948
1158
  case "settings-opt-in-analytics":
949
- return /* @__PURE__ */ jsx9(OptInAnalyticsScreen, { onDone: goToSettings });
1159
+ return /* @__PURE__ */ jsx11(OptInAnalyticsScreen, { onDone: goToSettings });
950
1160
  case "settings-debug-mode":
951
- return /* @__PURE__ */ jsx9(DebugModeScreen, { onDone: goToSettings });
1161
+ return /* @__PURE__ */ jsx11(DebugModeScreen, { onDone: goToSettings });
952
1162
  case "start":
953
- return /* @__PURE__ */ jsx9(HomeScreen, { onNavigate: navigateFromHome });
1163
+ return /* @__PURE__ */ jsx11(HomeScreen, { onNavigate: setScreen });
954
1164
  }
955
1165
  }
956
1166
  async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
957
- let importRequested = false;
1167
+ let requestedImport;
958
1168
  const instance = renderApp(
959
- /* @__PURE__ */ jsx9(
1169
+ /* @__PURE__ */ jsx11(
960
1170
  App,
961
1171
  {
962
1172
  importExitCode,
963
- onLaunchImport: () => {
964
- importRequested = true;
1173
+ onLaunchImport: (options) => {
1174
+ requestedImport = options;
965
1175
  instance.unmount();
966
1176
  }
967
1177
  }
@@ -969,13 +1179,15 @@ async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
969
1179
  );
970
1180
  await instance.waitUntilExit();
971
1181
  await stopReadingTerminal();
972
- return importRequested;
1182
+ return requestedImport;
973
1183
  }
974
1184
  async function runApp(renderApp) {
975
1185
  let importExitCode;
976
- while (await renderUntilImportRequestedOrExit(renderApp, importExitCode)) {
977
- importExitCode = (await spawnV1Import({})).exitCode;
1186
+ let requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
1187
+ while (requestedImport !== void 0) {
1188
+ importExitCode = (await spawnV1Import(requestedImport)).exitCode;
978
1189
  startReadingTerminal();
1190
+ requestedImport = await renderUntilImportRequestedOrExit(renderApp, importExitCode);
979
1191
  }
980
1192
  }
981
1193
  export {