@contentful/experience-design-system-cli 2.37.1-dev-build-b65632a0.0 → 2.37.1-dev-build-979aba4b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -77,11 +77,14 @@ var init_home_theme = __esm({
77
77
  orange: "#E44F20",
78
78
  yellow: "#FFDA00",
79
79
  white: "#FFFFFF",
80
- slate: "#8B8D91",
81
- steel: "#C4D1DE"
80
+ slate: "#A6B5C7",
81
+ steel: "#C4D1DE",
82
+ mist: "#DDE5EC",
83
+ fog: "#EFF2F6"
82
84
  };
83
85
  PALETTE = {
84
86
  accent: BRAND.blue,
87
+ heading: BRAND.white,
85
88
  success: BRAND.green,
86
89
  error: BRAND.orange,
87
90
  warning: BRAND.yellow,
@@ -168,11 +171,12 @@ var init_use_terminal_width = __esm({
168
171
  import { Text } from "ink";
169
172
  import { jsx } from "react/jsx-runtime";
170
173
  function ControlHints({ hints }) {
171
- return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) => `[${hint.keys}] ${hint.label}`).join(" \xB7 ") });
174
+ return /* @__PURE__ */ jsx(Text, { color: PALETTE.muted, children: hints.map((hint) => `${hint.keys} ${hint.label}`).join(" \xB7 ") });
172
175
  }
173
176
  var init_control_hints = __esm({
174
177
  "packages/experience-design-system-cli/src/tui/control-hints.tsx"() {
175
178
  "use strict";
179
+ init_home_theme();
176
180
  }
177
181
  });
178
182
 
@@ -228,7 +232,7 @@ function HomeScreen({ onNavigate }) {
228
232
  }
229
233
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
230
234
  /* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
231
- /* @__PURE__ */ jsx2(Text2, { bold: true, children: HEADING }),
235
+ /* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.heading, children: HEADING }),
232
236
  /* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
233
237
  /* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
234
238
  /* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
@@ -245,7 +249,8 @@ function HomeScreen({ onNavigate }) {
245
249
  Text2,
246
250
  {
247
251
  bold: focused && !dimmed,
248
- color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
252
+ dimColor: dimmed,
253
+ color: focused && !dimmed ? PALETTE.accent : display.color,
249
254
  children: [
250
255
  focused ? `${FOCUS_MARKER} ` : " ",
251
256
  display.label
@@ -298,13 +303,14 @@ function ImportScreen({ exitCode, onDone }) {
298
303
  });
299
304
  const isSuccess = exitCode === 0;
300
305
  return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
306
+ /* @__PURE__ */ jsx3(Text3, { bold: true, children: "Import" }),
301
307
  /* @__PURE__ */ jsx3(Text3, { children: " " }),
302
308
  isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
303
309
  "\u2717 Import failed: process exited with code ",
304
310
  exitCode ?? "unknown"
305
311
  ] }),
306
312
  /* @__PURE__ */ jsx3(Text3, { children: " " }),
307
- /* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
313
+ /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "[Enter] Back to Start" })
308
314
  ] });
309
315
  }
310
316
  var init_PageContainer = __esm({
@@ -361,16 +367,16 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
361
367
  };
362
368
  return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
363
369
  /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
364
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
365
- /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
370
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
371
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
366
372
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
367
373
  OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
368
374
  /* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
369
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
375
+ /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: item.description })
370
376
  ] }, item.label)),
371
377
  /* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
372
378
  ] }),
373
- /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
379
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
374
380
  /* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
375
381
  /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
376
382
  /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
@@ -378,7 +384,7 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
378
384
  /* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
379
385
  ] })
380
386
  ] }),
381
- /* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
387
+ /* @__PURE__ */ jsx4(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { dimColor: true, children: [
382
388
  "[",
383
389
  control.keys,
384
390
  "] ",
@@ -510,7 +516,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
510
516
  };
511
517
  return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
512
518
  /* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
513
- /* @__PURE__ */ jsx5(Text5, { color: PALETTE.muted, 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 Design Token Group Format (DTCG)." }),
519
+ /* @__PURE__ */ jsx5(Text5, { 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 Design Token Group Format (DTCG)." }),
514
520
  /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
515
521
  /* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
516
522
  /* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
@@ -522,13 +528,13 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
522
528
  "\u2717 ",
523
529
  failure.error
524
530
  ] }),
525
- failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { color: PALETTE.muted, children: [
531
+ failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
526
532
  " Resolved to: ",
527
533
  failure.resolvedPath
528
534
  ] })
529
535
  ] })
530
536
  ] }),
531
- /* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
537
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
532
538
  "[",
533
539
  control.keys,
534
540
  "] ",
@@ -841,6 +847,245 @@ var init_screen3 = __esm({
841
847
  }
842
848
  });
843
849
 
850
+ // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
851
+ function keyAction2(input, key) {
852
+ if (key.escape) return "back";
853
+ if (key.tab) return "next-field";
854
+ if (key.ctrl && input === "s") return "skip";
855
+ return null;
856
+ }
857
+ function nextField(field) {
858
+ return FIELDS[(FIELDS.indexOf(field) + 1) % FIELDS.length];
859
+ }
860
+ function toConfiguredHost(host) {
861
+ const value = (host ?? "").trim().replace(/\/+$/, "");
862
+ return value === "" ? DEFAULT_HOST : value.replace(/^https:\/\//i, "");
863
+ }
864
+ function toApiHost(host) {
865
+ const value = host.trim().replace(/\/+$/, "");
866
+ if (value === "") return `https://${DEFAULT_HOST}`;
867
+ return /^[a-z][a-z\d+\-.]*:\/\//i.test(value) ? value : `https://${value}`;
868
+ }
869
+ function normalize(values) {
870
+ return {
871
+ spaceId: values.spaceId.trim(),
872
+ environmentId: values.environmentId.trim(),
873
+ cmaToken: values.cmaToken.trim(),
874
+ host: toConfiguredHost(values.host)
875
+ };
876
+ }
877
+ function missingField(values) {
878
+ return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
879
+ }
880
+ function isUnchanged(current, initial) {
881
+ return FIELDS.every((field) => current[field] === initial[field]);
882
+ }
883
+ var FIELDS, DEFAULT_HOST;
884
+ var init_logic4 = __esm({
885
+ "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
886
+ "use strict";
887
+ FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
888
+ DEFAULT_HOST = "api.contentful.com";
889
+ }
890
+ });
891
+
892
+ // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
893
+ import { useInput as useInput6 } from "ink";
894
+ function useCredentialsControls(handlers) {
895
+ useInput6((input, key) => {
896
+ if (handlers.disabled) return;
897
+ const action = keyAction2(input, key);
898
+ if (action === "back") handlers.onBack();
899
+ else if (action === "next-field") handlers.onNextField();
900
+ else if (action === "skip") handlers.onSkip();
901
+ });
902
+ }
903
+ var CREDENTIALS_CONTROLS;
904
+ var init_controls4 = __esm({
905
+ "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts"() {
906
+ "use strict";
907
+ init_logic4();
908
+ CREDENTIALS_CONTROLS = [
909
+ { keys: "Enter", label: "Next field / Continue" },
910
+ { keys: "Tab", label: "Switch field" },
911
+ { keys: "Ctrl+S", label: "Skip (no push)" },
912
+ { keys: "Esc", label: "Back" }
913
+ ];
914
+ }
915
+ });
916
+
917
+ // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts
918
+ function headers(token) {
919
+ return { Authorization: `Bearer ${token}`, "X-Contentful-User-Agent": USER_AGENT };
920
+ }
921
+ function isApsDenial(body) {
922
+ try {
923
+ const id = JSON.parse(body).sys?.id;
924
+ return id === "NotFound" || id === "AccessDenied";
925
+ } catch {
926
+ return false;
927
+ }
928
+ }
929
+ function messageFrom(body) {
930
+ try {
931
+ const message = JSON.parse(body).message;
932
+ return typeof message === "string" && message !== "" ? message : void 0;
933
+ } catch {
934
+ return void 0;
935
+ }
936
+ }
937
+ async function validateCredentials(values) {
938
+ const base = toApiHost(values.host);
939
+ let me;
940
+ try {
941
+ me = await fetch(`${base}/users/me`, { headers: headers(values.cmaToken) });
942
+ } catch (error) {
943
+ return { ok: false, error: `Could not reach ${base}: ${error instanceof Error ? error.message : String(error)}` };
944
+ }
945
+ if (me.status === 401) return { ok: false, error: "CMA token is invalid or revoked." };
946
+ if (!me.ok) return { ok: false, error: `Unexpected error validating the token (${me.status}).` };
947
+ let preflight;
948
+ try {
949
+ preflight = await fetch(
950
+ `${base}/spaces/${values.spaceId}/environments/${values.environmentId}/design_systems/preflight`,
951
+ { headers: headers(values.cmaToken) }
952
+ );
953
+ } catch {
954
+ return { ok: true };
955
+ }
956
+ if (preflight.ok || preflight.status >= 500) return { ok: true };
957
+ const body = await preflight.text();
958
+ if (preflight.status === 404 && !isApsDenial(body)) return { ok: true };
959
+ const detail = messageFrom(body);
960
+ if (preflight.status === 403) {
961
+ return { ok: false, error: `Access denied. ${detail ?? "Your token cannot write design system components here."}` };
962
+ }
963
+ if (preflight.status === 404) {
964
+ return {
965
+ ok: false,
966
+ error: `Not found. Check the space ID, environment and API host.${detail ? ` (${detail})` : ""}`
967
+ };
968
+ }
969
+ return { ok: false, error: `Credential check failed (${preflight.status}).${detail ? ` ${detail}` : ""}` };
970
+ }
971
+ var USER_AGENT;
972
+ var init_validate = __esm({
973
+ "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts"() {
974
+ "use strict";
975
+ init_logic4();
976
+ USER_AGENT = "app contentful.experience-design-system-cli";
977
+ }
978
+ });
979
+
980
+ // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
981
+ import { useRef, useState as useState6 } from "react";
982
+ import { Box as Box6, Text as Text7 } from "ink";
983
+ import TextInput3 from "ink-text-input";
984
+ import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
985
+ function CredentialsScreen({
986
+ onDone,
987
+ onBack,
988
+ initial = {},
989
+ validate = validateCredentials
990
+ }) {
991
+ const initialValues = useRef(
992
+ normalize({
993
+ spaceId: initial.spaceId ?? "",
994
+ environmentId: initial.environmentId || "master",
995
+ cmaToken: initial.cmaToken ?? "",
996
+ host: initial.host ?? ""
997
+ })
998
+ ).current;
999
+ const [values, setValues] = useState6(initialValues);
1000
+ const [active, setActive] = useState6("spaceId");
1001
+ const [error, setError] = useState6(null);
1002
+ const [validating, setValidating] = useState6(false);
1003
+ const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
1004
+ useCredentialsControls({
1005
+ disabled: validating,
1006
+ onBack,
1007
+ onNextField: () => setActive(nextField),
1008
+ onSkip: () => onDone({ skipped: true })
1009
+ });
1010
+ const change = (field) => (value) => {
1011
+ setValues((current) => ({ ...current, [field]: value }));
1012
+ setError(null);
1013
+ };
1014
+ const submit = async (field) => {
1015
+ if (field !== "host") {
1016
+ setActive(nextField(field));
1017
+ return;
1018
+ }
1019
+ const credentials = normalize(values);
1020
+ if (missingField(credentials)) {
1021
+ setError("Space ID, environment and CMA token are all required.");
1022
+ return;
1023
+ }
1024
+ setValidating(true);
1025
+ const result = await validate(credentials);
1026
+ setValidating(false);
1027
+ if (result.ok) onDone({ skipped: false, credentials });
1028
+ else setError(result.error);
1029
+ };
1030
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
1031
+ /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1032
+ /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Contentful credentials" }),
1033
+ /* @__PURE__ */ jsx7(Text7, { children: prefilled ? "Credentials pre-filled from the configuration settings." : "Enter the Contentful space you want to import into." }),
1034
+ !prefilled && /* @__PURE__ */ jsxs6(Fragment, { children: [
1035
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "We use it to check what components already exist and to push your import. If you skip, files are saved locally and nothing is pushed." }),
1036
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Tip: save these under Settings \u2192 Configuration so they pre-fill here." })
1037
+ ] })
1038
+ ] }),
1039
+ /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: FIELDS.map((field) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
1040
+ /* @__PURE__ */ jsx7(Text7, { color: active === field ? PALETTE.accent : void 0, children: "?" }),
1041
+ /* @__PURE__ */ jsxs6(Text7, { bold: active === field, children: [
1042
+ LABELS[field],
1043
+ ":"
1044
+ ] }),
1045
+ /* @__PURE__ */ jsx7(
1046
+ TextInput3,
1047
+ {
1048
+ value: values[field],
1049
+ focus: active === field && !validating,
1050
+ mask: field === "cmaToken" ? "\u2022" : void 0,
1051
+ placeholder: field === "host" ? DEFAULT_HOST : void 0,
1052
+ onChange: change(field),
1053
+ onSubmit: () => void submit(field)
1054
+ }
1055
+ )
1056
+ ] }, field)) }),
1057
+ active === "host" && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Default: api.contentful.com \xB7 EU spaces: api.eu.contentful.com" }),
1058
+ error && /* @__PURE__ */ jsxs6(Text7, { color: PALETTE.error, children: [
1059
+ "\u2717 ",
1060
+ error
1061
+ ] }),
1062
+ validating && /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Validating credentials..." }),
1063
+ !validating && !error && !isUnchanged(normalize(values), initialValues) && /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "Changed values are saved after they validate." }),
1064
+ /* @__PURE__ */ jsx7(Box6, { marginTop: 1, gap: 3, children: CREDENTIALS_CONTROLS.map((control) => /* @__PURE__ */ jsxs6(Text7, { dimColor: true, children: [
1065
+ "[",
1066
+ control.keys,
1067
+ "] ",
1068
+ control.label
1069
+ ] }, control.keys)) })
1070
+ ] });
1071
+ }
1072
+ var LABELS;
1073
+ var init_screen4 = __esm({
1074
+ "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
1075
+ "use strict";
1076
+ init_home_theme();
1077
+ init_controls4();
1078
+ init_logic4();
1079
+ init_validate();
1080
+ LABELS = {
1081
+ spaceId: "Space ID",
1082
+ environmentId: "Environment",
1083
+ cmaToken: "CMA Token",
1084
+ host: "API Host"
1085
+ };
1086
+ }
1087
+ });
1088
+
844
1089
  // packages/experience-design-system-cli/src/tui/import/steps/index.ts
845
1090
  var init_steps = __esm({
846
1091
  "packages/experience-design-system-cli/src/tui/import/steps/index.ts"() {
@@ -848,6 +1093,7 @@ var init_steps = __esm({
848
1093
  init_screen();
849
1094
  init_screen2();
850
1095
  init_screen3();
1096
+ init_screen4();
851
1097
  }
852
1098
  });
853
1099
 
@@ -868,7 +1114,8 @@ async function spawnV1Import(options = {}) {
868
1114
  const args = buildArgs(options);
869
1115
  return new Promise((resolvePromise) => {
870
1116
  const child = spawn3("node", [cliPath, ...args], {
871
- stdio: "inherit"
1117
+ stdio: "inherit",
1118
+ env: options.skipCredentials ? { ...process.env, EDS_IMPORT_SKIP_CREDENTIALS: "1" } : process.env
872
1119
  });
873
1120
  child.on("close", (code) => {
874
1121
  resolvePromise({ exitCode: code ?? 1, result: void 0, stdout: "", stderr: "" });
@@ -1146,20 +1393,20 @@ var init_help_info = __esm({
1146
1393
  });
1147
1394
 
1148
1395
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
1149
- import { useEffect as useEffect4, useState as useState6 } from "react";
1150
- import { Box as Box6, Text as Text7, useInput as useInput6 } from "ink";
1151
- import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1396
+ import { useEffect as useEffect4, useState as useState7 } from "react";
1397
+ import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
1398
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1152
1399
  function Section({ title, rows }) {
1153
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1154
- /* @__PURE__ */ jsx7(Text7, { bold: true, color: PALETTE.accent, children: title }),
1155
- rows.map((row) => /* @__PURE__ */ jsxs6(Box6, { gap: 1, children: [
1156
- /* @__PURE__ */ jsx7(Box6, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, children: row.label }) }),
1157
- /* @__PURE__ */ jsx7(Text7, { children: row.value })
1400
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1401
+ /* @__PURE__ */ jsx8(Text8, { bold: true, color: PALETTE.accent, children: title }),
1402
+ rows.map((row) => /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
1403
+ /* @__PURE__ */ jsx8(Box7, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx8(Text8, { dimColor: true, children: row.label }) }),
1404
+ /* @__PURE__ */ jsx8(Text8, { children: row.value })
1158
1405
  ] }, row.label))
1159
1406
  ] });
1160
1407
  }
1161
1408
  function HelpScreen({ onDone }) {
1162
- const [info, setInfo] = useState6();
1409
+ const [info, setInfo] = useState7();
1163
1410
  useEffect4(() => {
1164
1411
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
1165
1412
  void readHelpInfo().then(setInfo);
@@ -1168,7 +1415,7 @@ function HelpScreen({ onDone }) {
1168
1415
  void finishDebugRun({ outputs: {}, status: "success", exitMethod });
1169
1416
  onDone();
1170
1417
  };
1171
- useInput6((input, key) => {
1418
+ useInput7((input, key) => {
1172
1419
  if (key.return) {
1173
1420
  leave("saved");
1174
1421
  return;
@@ -1178,14 +1425,14 @@ function HelpScreen({ onDone }) {
1178
1425
  return;
1179
1426
  }
1180
1427
  });
1181
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
1182
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Help" }),
1183
- info ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1184
- /* @__PURE__ */ jsx7(Section, { title: "Where things are stored", rows: info.storage }),
1185
- /* @__PURE__ */ jsx7(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
1186
- /* @__PURE__ */ jsx7(Text7, { color: PALETTE.muted, 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." })
1187
- ] }) : /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." }),
1188
- /* @__PURE__ */ jsx7(
1428
+ return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, gap: 1, children: [
1429
+ /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Help" }),
1430
+ info ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
1431
+ /* @__PURE__ */ jsx8(Section, { title: "Where things are stored", rows: info.storage }),
1432
+ /* @__PURE__ */ jsx8(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
1433
+ /* @__PURE__ */ jsx8(Text8, { 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." })
1434
+ ] }) : /* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." }),
1435
+ /* @__PURE__ */ jsx8(
1189
1436
  ControlHints,
1190
1437
  {
1191
1438
  hints: [
@@ -1207,20 +1454,20 @@ var init_PageContainer2 = __esm({
1207
1454
  });
1208
1455
 
1209
1456
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
1210
- import { useState as useState7 } from "react";
1211
- import { Box as Box7, Text as Text8, useInput as useInput7 } from "ink";
1212
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1457
+ import { useState as useState8 } from "react";
1458
+ import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
1459
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1213
1460
  function SettingsScreen({
1214
1461
  onNavigate,
1215
1462
  onBack
1216
1463
  }) {
1217
- const [focusIdx, setFocusIdx] = useState7(0);
1464
+ const [focusIdx, setFocusIdx] = useState8(0);
1218
1465
  const items = [
1219
1466
  { label: "Configuration", screen: "settings-configuration" },
1220
1467
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
1221
1468
  { label: "Debug Mode", screen: "settings-debug-mode" }
1222
1469
  ];
1223
- useInput7((input, key) => {
1470
+ useInput8((input, key) => {
1224
1471
  if (key.upArrow) {
1225
1472
  setFocusIdx((i) => (i - 1 + items.length) % items.length);
1226
1473
  return;
@@ -1240,15 +1487,15 @@ function SettingsScreen({
1240
1487
  onBack();
1241
1488
  }
1242
1489
  });
1243
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1244
- /* @__PURE__ */ jsx8(Text8, { bold: true, children: "Settings" }),
1245
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1246
- items.map((item, i) => /* @__PURE__ */ jsxs7(Text8, { color: i === focusIdx ? "cyan" : void 0, children: [
1490
+ return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1491
+ /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Settings" }),
1492
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1493
+ items.map((item, i) => /* @__PURE__ */ jsxs8(Text9, { color: i === focusIdx ? "cyan" : void 0, children: [
1247
1494
  i === focusIdx ? "> " : " ",
1248
1495
  item.label
1249
1496
  ] }, item.label)),
1250
- /* @__PURE__ */ jsx8(Text8, { children: " " }),
1251
- /* @__PURE__ */ jsx8(
1497
+ /* @__PURE__ */ jsx9(Text9, { children: " " }),
1498
+ /* @__PURE__ */ jsx9(
1252
1499
  ControlHints,
1253
1500
  {
1254
1501
  hints: [
@@ -1309,10 +1556,10 @@ var init_config_store = __esm({
1309
1556
  });
1310
1557
 
1311
1558
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
1312
- import { useEffect as useEffect5, useState as useState8 } from "react";
1313
- import { Box as Box8, Text as Text9, useInput as useInput8 } from "ink";
1314
- import TextInput3 from "ink-text-input";
1315
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1559
+ import { useEffect as useEffect5, useState as useState9 } from "react";
1560
+ import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
1561
+ import TextInput4 from "ink-text-input";
1562
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1316
1563
  function debugFields(config) {
1317
1564
  return {
1318
1565
  space_id: config?.spaceId ?? "",
@@ -1324,13 +1571,13 @@ function debugFields(config) {
1324
1571
  };
1325
1572
  }
1326
1573
  function ConfigurationScreen({ onDone }) {
1327
- const [stage, setStage] = useState8("loading");
1328
- const [config, setConfig] = useState8(null);
1329
- const [activeField, setActiveField] = useState8("spaceId");
1330
- const [notice, setNotice] = useState8(null);
1331
- const [lastSaved, setLastSaved] = useState8(null);
1332
- const [editing, setEditing] = useState8(false);
1333
- const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
1574
+ const [stage, setStage] = useState9("loading");
1575
+ const [config, setConfig] = useState9(null);
1576
+ const [activeField, setActiveField] = useState9("spaceId");
1577
+ const [notice, setNotice] = useState9(null);
1578
+ const [lastSaved, setLastSaved] = useState9(null);
1579
+ const [editing, setEditing] = useState9(false);
1580
+ const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
1334
1581
  useEffect5(() => {
1335
1582
  readCredentials().then((cfg) => {
1336
1583
  setConfig(cfg);
@@ -1371,7 +1618,7 @@ function ConfigurationScreen({ onDone }) {
1371
1618
  );
1372
1619
  onDone();
1373
1620
  }
1374
- useInput8((input, key) => {
1621
+ useInput9((input, key) => {
1375
1622
  if (stage === "loading" || stage === "saving") return;
1376
1623
  if (editing) {
1377
1624
  if (key.escape) {
@@ -1408,46 +1655,46 @@ function ConfigurationScreen({ onDone }) {
1408
1655
  }
1409
1656
  });
1410
1657
  if (stage === "loading") {
1411
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1412
- /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
1413
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1414
- /* @__PURE__ */ jsx9(Text9, { color: PALETTE.accent, children: "Loading..." })
1658
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1659
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
1660
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1661
+ /* @__PURE__ */ jsx10(Text10, { color: PALETTE.accent, children: "Loading..." })
1415
1662
  ] });
1416
1663
  }
1417
- return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1418
- /* @__PURE__ */ jsx9(Text9, { bold: true, children: "Configuration" }),
1419
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1420
- /* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
1664
+ return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1665
+ /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Configuration" }),
1666
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1667
+ /* @__PURE__ */ jsx10(Box9, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
1421
1668
  const isActive = activeField === field;
1422
1669
  const value = fieldValue(field);
1423
1670
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
1424
- return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
1425
- /* @__PURE__ */ jsx9(Text9, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
1426
- /* @__PURE__ */ jsxs8(Text9, { bold: isActive, children: [
1671
+ return /* @__PURE__ */ jsxs9(Box9, { gap: 1, children: [
1672
+ /* @__PURE__ */ jsx10(Text10, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
1673
+ /* @__PURE__ */ jsxs9(Text10, { bold: isActive, children: [
1427
1674
  FIELD_LABELS[field],
1428
1675
  ":"
1429
1676
  ] }),
1430
- isActive && editing ? /* @__PURE__ */ jsx9(
1431
- TextInput3,
1677
+ isActive && editing ? /* @__PURE__ */ jsx10(
1678
+ TextInput4,
1432
1679
  {
1433
1680
  value,
1434
1681
  onChange: (next) => setFieldValue(field, next),
1435
1682
  onSubmit: () => setEditing(false),
1436
1683
  mask: field === "cmaToken" ? "\u2022" : void 0
1437
1684
  }
1438
- ) : /* @__PURE__ */ jsx9(Text9, { children: display || /* @__PURE__ */ jsx9(Text9, { color: PALETTE.muted, children: "(empty)" }) })
1685
+ ) : /* @__PURE__ */ jsx10(Text10, { children: display || /* @__PURE__ */ jsx10(Text10, { dimColor: true, children: "(empty)" }) })
1439
1686
  ] }, field);
1440
1687
  }) }),
1441
- notice && /* @__PURE__ */ jsxs8(Fragment2, { children: [
1442
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1443
- /* @__PURE__ */ jsxs8(Text9, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
1688
+ notice && /* @__PURE__ */ jsxs9(Fragment3, { children: [
1689
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1690
+ /* @__PURE__ */ jsxs9(Text10, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
1444
1691
  notice.kind === "success" ? "\u2713" : "\u2717",
1445
1692
  " ",
1446
1693
  notice.text
1447
1694
  ] })
1448
1695
  ] }),
1449
- /* @__PURE__ */ jsx9(Text9, { children: " " }),
1450
- /* @__PURE__ */ jsx9(
1696
+ /* @__PURE__ */ jsx10(Text10, { children: " " }),
1697
+ /* @__PURE__ */ jsx10(
1451
1698
  ControlHints,
1452
1699
  {
1453
1700
  hints: editing ? [
@@ -1515,12 +1762,12 @@ var init_analytics_store = __esm({
1515
1762
  });
1516
1763
 
1517
1764
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
1518
- import { useEffect as useEffect6, useState as useState9 } from "react";
1519
- import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
1520
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1765
+ import { useEffect as useEffect6, useState as useState10 } from "react";
1766
+ import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
1767
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1521
1768
  function OptInAnalyticsScreen({ onDone }) {
1522
- const [loading, setLoading] = useState9(true);
1523
- const [enabled, setEnabled] = useState9(true);
1769
+ const [loading, setLoading] = useState10(true);
1770
+ const [enabled, setEnabled] = useState10(true);
1524
1771
  useEffect6(() => {
1525
1772
  readAnalyticsSetting().then((setting) => {
1526
1773
  setEnabled(setting.enabled);
@@ -1533,7 +1780,7 @@ function OptInAnalyticsScreen({ onDone }) {
1533
1780
  });
1534
1781
  });
1535
1782
  }, []);
1536
- useInput9((input, key) => {
1783
+ useInput10((input, key) => {
1537
1784
  if (loading) return;
1538
1785
  if (key.return || input === " ") {
1539
1786
  setEnabled((current) => {
@@ -1548,21 +1795,21 @@ function OptInAnalyticsScreen({ onDone }) {
1548
1795
  onDone();
1549
1796
  }
1550
1797
  });
1551
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1552
- /* @__PURE__ */ jsx10(Text10, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
1553
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1554
- loading ? /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs9(Fragment3, { children: [
1555
- /* @__PURE__ */ jsxs9(Text10, { children: [
1798
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1799
+ /* @__PURE__ */ jsx11(Text11, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
1800
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1801
+ loading ? /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs10(Fragment4, { children: [
1802
+ /* @__PURE__ */ jsxs10(Text11, { children: [
1556
1803
  "Share anonymous usage data:",
1557
1804
  " ",
1558
- /* @__PURE__ */ jsx10(Text10, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1805
+ /* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1559
1806
  ] }),
1560
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1561
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1562
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
1807
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1808
+ /* @__PURE__ */ jsx11(Text11, { dimColor: true, children: "Shares which CLI commands are used and where imports succeed or fail." }),
1809
+ /* @__PURE__ */ jsx11(Text11, { dimColor: true, children: "Never includes source code, file paths, credentials, or authored content." })
1563
1810
  ] }),
1564
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1565
- /* @__PURE__ */ jsx10(
1811
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1812
+ /* @__PURE__ */ jsx11(
1566
1813
  ControlHints,
1567
1814
  {
1568
1815
  hints: [
@@ -1573,7 +1820,7 @@ function OptInAnalyticsScreen({ onDone }) {
1573
1820
  )
1574
1821
  ] });
1575
1822
  }
1576
- var init_screen4 = __esm({
1823
+ var init_screen5 = __esm({
1577
1824
  "packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx"() {
1578
1825
  "use strict";
1579
1826
  init_home_theme();
@@ -1584,11 +1831,11 @@ var init_screen4 = __esm({
1584
1831
  });
1585
1832
 
1586
1833
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
1587
- import { useEffect as useEffect7, useState as useState10 } from "react";
1588
- import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
1589
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1834
+ import { useEffect as useEffect7, useState as useState11 } from "react";
1835
+ import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
1836
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1590
1837
  function UpgradeScreen({ onDone }) {
1591
- const [upgradeCheck, setUpgradeCheck] = useState10();
1838
+ const [upgradeCheck, setUpgradeCheck] = useState11();
1592
1839
  useEffect7(() => {
1593
1840
  startDebugRun({
1594
1841
  flow: "upgrade",
@@ -1598,7 +1845,7 @@ function UpgradeScreen({ onDone }) {
1598
1845
  });
1599
1846
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
1600
1847
  }, []);
1601
- useInput10((_input, key) => {
1848
+ useInput11((_input, key) => {
1602
1849
  if (key.return) {
1603
1850
  void finishDebugRun({
1604
1851
  outputs: upgradeCheck ?? {},
@@ -1609,12 +1856,12 @@ function UpgradeScreen({ onDone }) {
1609
1856
  return;
1610
1857
  }
1611
1858
  });
1612
- return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1613
- /* @__PURE__ */ jsx11(Text11, { bold: true, children: "Upgrade" }),
1614
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
1859
+ return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1860
+ /* @__PURE__ */ jsx12(Text12, { bold: true, children: "Upgrade" }),
1861
+ /* @__PURE__ */ jsx12(Text12, { children: " " }),
1615
1862
  renderBody(upgradeCheck),
1616
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
1617
- /* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.accent, children: [
1863
+ /* @__PURE__ */ jsx12(Text12, { children: " " }),
1864
+ /* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.accent, children: [
1618
1865
  FOCUS_MARKER,
1619
1866
  " Go Back"
1620
1867
  ] })
@@ -1622,34 +1869,34 @@ function UpgradeScreen({ onDone }) {
1622
1869
  }
1623
1870
  function renderBody(upgradeCheck) {
1624
1871
  if (!upgradeCheck) {
1625
- return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1872
+ return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Checking for updates\u2026" });
1626
1873
  }
1627
1874
  if (upgradeCheck.status === "error") {
1628
- return /* @__PURE__ */ jsx11(Text11, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1875
+ return /* @__PURE__ */ jsx12(Text12, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
1629
1876
  }
1630
1877
  if (upgradeCheck.status === "up-to-date") {
1631
- return /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.success, children: [
1878
+ return /* @__PURE__ */ jsxs11(Text12, { color: PALETTE.success, children: [
1632
1879
  "You're already on the latest version (v",
1633
1880
  upgradeCheck.current,
1634
1881
  ")."
1635
1882
  ] });
1636
1883
  }
1637
- return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
1638
- /* @__PURE__ */ jsxs10(Text11, { color: PALETTE.muted, children: [
1639
- /* @__PURE__ */ jsxs10(Text11, { bold: true, color: PALETTE.success, children: [
1884
+ return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
1885
+ /* @__PURE__ */ jsxs11(Text12, { color: PALETTE.muted, children: [
1886
+ /* @__PURE__ */ jsxs11(Text12, { bold: true, color: PALETTE.success, children: [
1640
1887
  "v",
1641
1888
  upgradeCheck.latest
1642
1889
  ] }),
1643
1890
  " ",
1644
1891
  "is available (you're on ",
1645
- /* @__PURE__ */ jsxs10(Text11, { bold: true, children: [
1892
+ /* @__PURE__ */ jsxs11(Text12, { bold: true, children: [
1646
1893
  "v",
1647
1894
  upgradeCheck.current
1648
1895
  ] }),
1649
1896
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
1650
1897
  ] }),
1651
- /* @__PURE__ */ jsx11(Text11, { children: " " }),
1652
- /* @__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)) })
1898
+ /* @__PURE__ */ jsx12(Text12, { children: " " }),
1899
+ /* @__PURE__ */ jsx12(Box11, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx12(Text12, { bold: true, children: cmd }, cmd)) })
1653
1900
  ] });
1654
1901
  }
1655
1902
  var UPGRADE_COMMANDS;
@@ -1664,12 +1911,12 @@ var init_PageContainer4 = __esm({
1664
1911
  });
1665
1912
 
1666
1913
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
1667
- import { useEffect as useEffect8, useState as useState11 } from "react";
1668
- import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
1669
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1914
+ import { useEffect as useEffect8, useState as useState12 } from "react";
1915
+ import { Box as Box12, Text as Text13, useInput as useInput12 } from "ink";
1916
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1670
1917
  function DebugModeScreen({ onDone }) {
1671
- const [loading, setLoading] = useState11(true);
1672
- const [enabled, setEnabled] = useState11(true);
1918
+ const [loading, setLoading] = useState12(true);
1919
+ const [enabled, setEnabled] = useState12(true);
1673
1920
  useEffect8(() => {
1674
1921
  readDebugModeSetting().then((setting) => {
1675
1922
  setEnabled(setting.enabled);
@@ -1682,7 +1929,7 @@ function DebugModeScreen({ onDone }) {
1682
1929
  });
1683
1930
  });
1684
1931
  }, []);
1685
- useInput11((input, key) => {
1932
+ useInput12((input, key) => {
1686
1933
  if (loading) return;
1687
1934
  if (key.return || input === " ") {
1688
1935
  setEnabled((current) => {
@@ -1697,16 +1944,16 @@ function DebugModeScreen({ onDone }) {
1697
1944
  onDone();
1698
1945
  }
1699
1946
  });
1700
- return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1701
- /* @__PURE__ */ jsx12(Text12, { bold: true, children: "Settings \u203A Debug Mode" }),
1702
- /* @__PURE__ */ jsx12(Text12, { children: " " }),
1703
- loading ? /* @__PURE__ */ jsx12(Text12, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs11(Text12, { children: [
1947
+ return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1948
+ /* @__PURE__ */ jsx13(Text13, { bold: true, children: "Settings \u203A Debug Mode" }),
1949
+ /* @__PURE__ */ jsx13(Text13, { children: " " }),
1950
+ loading ? /* @__PURE__ */ jsx13(Text13, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs12(Text13, { children: [
1704
1951
  "Debug logging:",
1705
1952
  " ",
1706
- /* @__PURE__ */ jsx12(Text12, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1953
+ /* @__PURE__ */ jsx13(Text13, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
1707
1954
  ] }),
1708
- /* @__PURE__ */ jsx12(Text12, { children: " " }),
1709
- /* @__PURE__ */ jsx12(
1955
+ /* @__PURE__ */ jsx13(Text13, { children: " " }),
1956
+ /* @__PURE__ */ jsx13(
1710
1957
  ControlHints,
1711
1958
  {
1712
1959
  hints: [
@@ -1717,7 +1964,7 @@ function DebugModeScreen({ onDone }) {
1717
1964
  )
1718
1965
  ] });
1719
1966
  }
1720
- var init_screen5 = __esm({
1967
+ var init_screen6 = __esm({
1721
1968
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
1722
1969
  "use strict";
1723
1970
  init_home_theme();
@@ -1732,29 +1979,39 @@ var app_exports = {};
1732
1979
  __export(app_exports, {
1733
1980
  runApp: () => runApp
1734
1981
  });
1735
- import { useEffect as useEffect9, useState as useState12 } from "react";
1736
- import { Fragment as Fragment4, jsx as jsx13 } from "react/jsx-runtime";
1982
+ import { useEffect as useEffect9, useState as useState13 } from "react";
1983
+ import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
1737
1984
  function App({ onLaunchImport, importExitCode }) {
1738
1985
  const returnedFromImport = importExitCode !== void 0;
1739
- const [screen, setScreen] = useState12(returnedFromImport ? "import" : "start");
1740
- const [showImportResult, setShowImportResult] = useState12(returnedFromImport);
1741
- const [projectPath, setProjectPath] = useState12();
1742
- const [tokensPath, setTokensPath] = useState12();
1743
- const [importDefaults, setImportDefaults] = useState12();
1986
+ const [screen, setScreen] = useState13(returnedFromImport ? "import" : "start");
1987
+ const [showImportResult, setShowImportResult] = useState13(returnedFromImport);
1988
+ const [projectPath, setProjectPath] = useState13();
1989
+ const [tokensPath, setTokensPath] = useState13();
1990
+ const [pathConfirmed, setPathConfirmed] = useState13(false);
1991
+ const [importDefaults, setImportDefaults] = useState13();
1744
1992
  useEffect9(() => {
1745
1993
  if (screen !== "import") {
1746
1994
  setImportDefaults(void 0);
1747
1995
  return;
1748
1996
  }
1749
1997
  void readCredentials().then(
1750
- (saved) => setImportDefaults({ componentDir: saved.defaultComponentDir ?? "", tokenFile: saved.defaultTokenFile ?? "" })
1998
+ (saved) => setImportDefaults({
1999
+ componentDir: saved.defaultComponentDir ?? "",
2000
+ tokenFile: saved.defaultTokenFile ?? "",
2001
+ credentials: saved
2002
+ })
1751
2003
  );
1752
2004
  }, [screen]);
2005
+ const finishCredentials = async (result, project, tokens) => {
2006
+ if (!result.skipped) await writeCredentials({ ...result.credentials });
2007
+ onLaunchImport?.({ project, tokens, skipCredentials: result.skipped });
2008
+ };
1753
2009
  const goToStart = () => setScreen("start");
1754
2010
  const goToSettings = () => setScreen("settings");
1755
2011
  const resetImport = () => {
1756
2012
  setProjectPath(void 0);
1757
2013
  setTokensPath(void 0);
2014
+ setPathConfirmed(false);
1758
2015
  };
1759
2016
  const finishImportResult = () => {
1760
2017
  setShowImportResult(false);
@@ -1767,13 +2024,13 @@ function App({ onLaunchImport, importExitCode }) {
1767
2024
  };
1768
2025
  switch (screen) {
1769
2026
  case "import":
1770
- if (showImportResult) return /* @__PURE__ */ jsx13(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
1771
- if (importDefaults === void 0) return /* @__PURE__ */ jsx13(Fragment4, {});
2027
+ if (showImportResult) return /* @__PURE__ */ jsx14(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
2028
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx14(Fragment5, {});
1772
2029
  if (projectPath === void 0) {
1773
- return /* @__PURE__ */ jsx13(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
2030
+ return /* @__PURE__ */ jsx14(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
1774
2031
  }
1775
2032
  if (tokensPath === void 0) {
1776
- return /* @__PURE__ */ jsx13(
2033
+ return /* @__PURE__ */ jsx14(
1777
2034
  TokenInputScreen,
1778
2035
  {
1779
2036
  initialPath: importDefaults.tokenFile,
@@ -1782,35 +2039,45 @@ function App({ onLaunchImport, importExitCode }) {
1782
2039
  }
1783
2040
  );
1784
2041
  }
1785
- return /* @__PURE__ */ jsx13(
1786
- PathValidationScreen,
2042
+ if (!pathConfirmed) {
2043
+ return /* @__PURE__ */ jsx14(
2044
+ PathValidationScreen,
2045
+ {
2046
+ projectPath,
2047
+ onConfirm: () => setPathConfirmed(true),
2048
+ onChangePath: resetImport,
2049
+ onBack: () => setTokensPath(void 0)
2050
+ }
2051
+ );
2052
+ }
2053
+ return /* @__PURE__ */ jsx14(
2054
+ CredentialsScreen,
1787
2055
  {
1788
- projectPath,
1789
- onConfirm: (project) => onLaunchImport?.({ project, tokens: tokensPath }),
1790
- onChangePath: resetImport,
1791
- onBack: () => setTokensPath(void 0)
2056
+ initial: importDefaults.credentials,
2057
+ onBack: () => setPathConfirmed(false),
2058
+ onDone: (result) => void finishCredentials(result, projectPath, tokensPath)
1792
2059
  }
1793
2060
  );
1794
2061
  case "help":
1795
- return /* @__PURE__ */ jsx13(HelpScreen, { onDone: goToStart });
2062
+ return /* @__PURE__ */ jsx14(HelpScreen, { onDone: goToStart });
1796
2063
  case "upgrade":
1797
- return /* @__PURE__ */ jsx13(UpgradeScreen, { onDone: goToStart });
2064
+ return /* @__PURE__ */ jsx14(UpgradeScreen, { onDone: goToStart });
1798
2065
  case "settings":
1799
- return /* @__PURE__ */ jsx13(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
2066
+ return /* @__PURE__ */ jsx14(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
1800
2067
  case "settings-configuration":
1801
- return /* @__PURE__ */ jsx13(ConfigurationScreen, { onDone: goToSettings });
2068
+ return /* @__PURE__ */ jsx14(ConfigurationScreen, { onDone: goToSettings });
1802
2069
  case "settings-opt-in-analytics":
1803
- return /* @__PURE__ */ jsx13(OptInAnalyticsScreen, { onDone: goToSettings });
2070
+ return /* @__PURE__ */ jsx14(OptInAnalyticsScreen, { onDone: goToSettings });
1804
2071
  case "settings-debug-mode":
1805
- return /* @__PURE__ */ jsx13(DebugModeScreen, { onDone: goToSettings });
2072
+ return /* @__PURE__ */ jsx14(DebugModeScreen, { onDone: goToSettings });
1806
2073
  case "start":
1807
- return /* @__PURE__ */ jsx13(HomeScreen, { onNavigate: setScreen });
2074
+ return /* @__PURE__ */ jsx14(HomeScreen, { onNavigate: setScreen });
1808
2075
  }
1809
2076
  }
1810
2077
  async function renderUntilImportRequestedOrExit(renderApp, importExitCode) {
1811
2078
  let requestedImport;
1812
2079
  const instance = renderApp(
1813
- /* @__PURE__ */ jsx13(
2080
+ /* @__PURE__ */ jsx14(
1814
2081
  App,
1815
2082
  {
1816
2083
  importExitCode,
@@ -1849,9 +2116,9 @@ var init_app = __esm({
1849
2116
  init_PageContainer2();
1850
2117
  init_PageContainer3();
1851
2118
  init_ContentfulConfigScreen();
1852
- init_screen4();
1853
- init_PageContainer4();
1854
2119
  init_screen5();
2120
+ init_PageContainer4();
2121
+ init_screen6();
1855
2122
  init_config_store();
1856
2123
  CLEAR_SCREEN = "\x1B[2J\x1B[H";
1857
2124
  }