@contentful/experience-design-system-cli 2.37.1-dev-build-41421938.0 → 2.37.1-dev-build-d5797739.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
@@ -837,7 +837,7 @@ async function runAgent(options) {
837
837
  promptLen: prompt.length,
838
838
  promptHead: prompt.slice(0, 500)
839
839
  });
840
- return new Promise((resolve27) => {
840
+ return new Promise((resolve28) => {
841
841
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
842
842
  const child = spawn(binary, args, {
843
843
  stdio: ["pipe", "pipe", "pipe"],
@@ -886,7 +886,7 @@ async function runAgent(options) {
886
886
  stderrLen: stderr.length,
887
887
  stderrTail: stderr.slice(-1e3)
888
888
  });
889
- resolve27(result);
889
+ resolve28(result);
890
890
  });
891
891
  });
892
892
  }
@@ -908,7 +908,7 @@ async function checkAgentAuth(agent) {
908
908
  return "not-found";
909
909
  if (agent !== "claude")
910
910
  return "ok";
911
- return new Promise((resolve27) => {
911
+ return new Promise((resolve28) => {
912
912
  const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
913
913
  let stdout = "";
914
914
  let done = false;
@@ -917,7 +917,7 @@ async function checkAgentAuth(agent) {
917
917
  return;
918
918
  done = true;
919
919
  child.kill("SIGTERM");
920
- resolve27("unauthenticated");
920
+ resolve28("unauthenticated");
921
921
  }, 5e3);
922
922
  child.stdout?.on("data", (chunk) => {
923
923
  stdout += chunk.toString();
@@ -928,14 +928,14 @@ async function checkAgentAuth(agent) {
928
928
  done = true;
929
929
  clearTimeout(timer);
930
930
  if (code !== 0) {
931
- resolve27("unauthenticated");
931
+ resolve28("unauthenticated");
932
932
  return;
933
933
  }
934
934
  try {
935
935
  const status = JSON.parse(stdout);
936
- resolve27(status.loggedIn ? "ok" : "unauthenticated");
936
+ resolve28(status.loggedIn ? "ok" : "unauthenticated");
937
937
  } catch {
938
- resolve27("unauthenticated");
938
+ resolve28("unauthenticated");
939
939
  }
940
940
  });
941
941
  });
@@ -945,9 +945,9 @@ async function binaryIsOnPath(binary) {
945
945
  const fs = await import("node:fs/promises");
946
946
  return fs.access(binary).then(() => true, () => false);
947
947
  }
948
- return new Promise((resolve27) => {
948
+ return new Promise((resolve28) => {
949
949
  const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
950
- child.on("close", (code) => resolve27(code === 0));
950
+ child.on("close", (code) => resolve28(code === 0));
951
951
  });
952
952
  }
953
953
  var init_check_agent_auth = __esm({
@@ -2329,8 +2329,8 @@ var init_debug_store = __esm({
2329
2329
  });
2330
2330
 
2331
2331
  // packages/experience-design-system-cli/app.tsx
2332
- import { join as join25 } from "node:path";
2333
- import { useEffect as useEffect26, useState as useState33 } from "react";
2332
+ import { join as join26 } from "node:path";
2333
+ import { useEffect as useEffect27, useState as useState36 } from "react";
2334
2334
 
2335
2335
  // packages/experience-design-system-cli/src/tui/home/home.tsx
2336
2336
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -13824,7 +13824,7 @@ function errorMessage(error) {
13824
13824
  return error instanceof Error && error.message ? error.message : String(error);
13825
13825
  }
13826
13826
  function defaultSleep(delayMs) {
13827
- return new Promise((resolve27) => setTimeout(resolve27, delayMs));
13827
+ return new Promise((resolve28) => setTimeout(resolve28, delayMs));
13828
13828
  }
13829
13829
 
13830
13830
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
@@ -14065,7 +14065,7 @@ var ApiClient = class {
14065
14065
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
14066
14066
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
14067
14067
  const jitter = Math.random() * baseDelay * 0.15;
14068
- await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
14068
+ await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
14069
14069
  }
14070
14070
  }
14071
14071
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -16374,7 +16374,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
16374
16374
  const message = error instanceof Error ? error.message : String(error);
16375
16375
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
16376
16376
  throw error;
16377
- await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
16377
+ await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
16378
16378
  }
16379
16379
  }
16380
16380
  }
@@ -28031,7 +28031,7 @@ var realSaveDeps = () => ({
28031
28031
  writeFile: (path5, contents) => writeFile7(path5, contents),
28032
28032
  appendRun,
28033
28033
  buildSourceFingerprint,
28034
- sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
28034
+ sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
28035
28035
  warn: (message) => process.stderr.write(message)
28036
28036
  });
28037
28037
  async function runPrintFiles(input, deps, onPatch) {
@@ -28421,12 +28421,44 @@ init_config();
28421
28421
  init_debug_store();
28422
28422
  init_debug_mode_store();
28423
28423
  init_version();
28424
+
28425
+ // packages/experience-design-system-cli/src/tui/help/file-locations.ts
28426
+ import { join as join25, resolve as resolve27 } from "node:path";
28427
+ function describeFileLocations({
28428
+ contentfulBaseDir,
28429
+ debugModeEnabled,
28430
+ currentSessionDir: currentSessionDir2
28431
+ }) {
28432
+ if (!debugModeEnabled) {
28433
+ return {
28434
+ debugLogs: "none while Debug Mode is off",
28435
+ importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
28436
+ };
28437
+ }
28438
+ const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
28439
+ const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
28440
+ return {
28441
+ debugLogs: join25(session, "debug"),
28442
+ importFiles: `${join25(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
28443
+ };
28444
+ }
28445
+
28446
+ // packages/experience-design-system-cli/src/tui/help/help-info.ts
28424
28447
  async function readHelpInfo() {
28425
- const debugMode = await readDebugModeSetting();
28448
+ const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
28449
+ const base = settings["contentfulBaseDir"];
28450
+ const locations = describeFileLocations({
28451
+ contentfulBaseDir: typeof base === "string" ? base : "",
28452
+ debugModeEnabled: debugMode.enabled,
28453
+ currentSessionDir: currentSessionDir()
28454
+ });
28426
28455
  return {
28427
28456
  storage: [
28428
28457
  { label: "Config folder", value: configRoot2() },
28429
- { label: "Settings file", value: configFilePath2() }
28458
+ { label: "Settings file", value: configFilePath2() },
28459
+ { label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
28460
+ { label: "Debug logs", value: locations.debugLogs },
28461
+ { label: "Import files", value: locations.importFiles }
28430
28462
  ],
28431
28463
  troubleshooting: [
28432
28464
  { label: "CLI version", value: readPackageVersion() },
@@ -28447,7 +28479,7 @@ function Section({ title, rows }) {
28447
28479
  return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
28448
28480
  /* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
28449
28481
  rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
28450
- /* @__PURE__ */ jsx53(Box42, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
28482
+ /* @__PURE__ */ jsx53(Box42, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
28451
28483
  /* @__PURE__ */ jsx53(Text44, { children: row.value })
28452
28484
  ] }, row.label))
28453
28485
  ] });
@@ -28547,15 +28579,338 @@ function SettingsScreen({
28547
28579
  }
28548
28580
 
28549
28581
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
28550
- import { useEffect as useEffect22, useState as useState29 } from "react";
28582
+ import { useState as useState32 } from "react";
28583
+ import { Box as Box47, Text as Text49, useInput as useInput13 } from "ink";
28584
+
28585
+ // packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
28586
+ import { useEffect as useEffect22, useState as useState30 } from "react";
28587
+ import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
28588
+ init_debug_store();
28589
+
28590
+ // packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
28591
+ import { useState as useState29 } from "react";
28551
28592
  import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
28552
28593
  import TextInput4 from "ink-text-input";
28594
+ import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
28595
+ function FieldForm({
28596
+ title,
28597
+ subtitle,
28598
+ fields,
28599
+ values,
28600
+ onChange,
28601
+ onSave,
28602
+ onQuit,
28603
+ notice,
28604
+ busy = false,
28605
+ footer
28606
+ }) {
28607
+ const [active, setActive] = useState29(0);
28608
+ const [editing, setEditing] = useState29(false);
28609
+ const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
28610
+ const labelWidth = Math.max(...fields.map((field) => field.label.length));
28611
+ const current = fields[active];
28612
+ useInput11((input, key) => {
28613
+ if (busy) return;
28614
+ if (editing) {
28615
+ if (key.escape) {
28616
+ onChange(current.key, valueBeforeEdit);
28617
+ setEditing(false);
28618
+ }
28619
+ return;
28620
+ }
28621
+ if (key.escape || input === "q") {
28622
+ onQuit();
28623
+ return;
28624
+ }
28625
+ if (input === "s") {
28626
+ onSave();
28627
+ return;
28628
+ }
28629
+ if (input === "c") {
28630
+ onChange(current.key, "");
28631
+ return;
28632
+ }
28633
+ if (key.tab || key.downArrow) {
28634
+ setActive((i) => (i + 1) % fields.length);
28635
+ return;
28636
+ }
28637
+ if (key.upArrow) {
28638
+ setActive((i) => (i - 1 + fields.length) % fields.length);
28639
+ return;
28640
+ }
28641
+ if (key.return) {
28642
+ setValueBeforeEdit(values[current.key]);
28643
+ setEditing(true);
28644
+ }
28645
+ });
28646
+ return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28647
+ /* @__PURE__ */ jsx55(Text46, { bold: true, children: title }),
28648
+ subtitle && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: subtitle }),
28649
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28650
+ /* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: fields.map((field, index) => {
28651
+ const isActive = index === active;
28652
+ const value = values[field.key];
28653
+ const display = field.masked ? "\u2022".repeat(value.length) : value;
28654
+ return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
28655
+ /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
28656
+ /* @__PURE__ */ jsx55(Box44, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
28657
+ isActive && editing ? /* @__PURE__ */ jsx55(
28658
+ TextInput4,
28659
+ {
28660
+ value,
28661
+ onChange: (next) => onChange(field.key, next),
28662
+ onSubmit: () => setEditing(false),
28663
+ mask: field.masked ? "\u2022" : void 0
28664
+ }
28665
+ ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
28666
+ field.hint && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: field.hint })
28667
+ ] }, field.key);
28668
+ }) }),
28669
+ notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
28670
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28671
+ /* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
28672
+ notice.kind === "success" ? "\u2713" : "\u2717",
28673
+ " ",
28674
+ notice.text
28675
+ ] })
28676
+ ] }),
28677
+ footer,
28678
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
28679
+ /* @__PURE__ */ jsx55(
28680
+ ControlHints,
28681
+ {
28682
+ hints: editing ? [
28683
+ { keys: "type", label: "edit" },
28684
+ { keys: "\u2190/\u2192", label: "move cursor" },
28685
+ { keys: "\u23CE", label: "done" },
28686
+ { keys: "Esc", label: "cancel edit" }
28687
+ ] : [
28688
+ { keys: "\u2191/\u2193", label: "move" },
28689
+ { keys: "\u23CE", label: "edit" },
28690
+ { keys: "c", label: "clear" },
28691
+ { keys: "s", label: "save" },
28692
+ { keys: "Esc/q", label: "back without saving" }
28693
+ ]
28694
+ }
28695
+ )
28696
+ ] });
28697
+ }
28553
28698
 
28554
28699
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
28555
28700
  init_config();
28556
28701
  var readV1Store = readSettings2;
28557
28702
  var writeV1Store = writeSettings2;
28558
28703
 
28704
+ // packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts
28705
+ var DEFAULT_AGENT3 = "claude";
28706
+ var AGENT_LABELS = {
28707
+ claude: "Claude Code",
28708
+ codex: "OpenAI Codex",
28709
+ opencode: "OpenCode",
28710
+ cursor: "Cursor",
28711
+ copilot: "GitHub Copilot"
28712
+ };
28713
+ var AGENT_HINTS = {
28714
+ claude: "claude",
28715
+ codex: "codex",
28716
+ opencode: "opencode",
28717
+ cursor: "cursor-agent",
28718
+ copilot: "copilot"
28719
+ };
28720
+ var asString = (value) => typeof value === "string" ? value : "";
28721
+ function emptyAgents() {
28722
+ return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "" }]));
28723
+ }
28724
+ async function readAgentConfig() {
28725
+ const store = await readV1Store();
28726
+ const stored = asString(store["agent"]);
28727
+ const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
28728
+ const agents = emptyAgents();
28729
+ const saved = store["agents"];
28730
+ if (saved && typeof saved === "object") {
28731
+ for (const name of AGENT_NAMES) {
28732
+ const entry = saved[name];
28733
+ if (entry && typeof entry === "object")
28734
+ agents[name] = { model: asString(entry["model"]) };
28735
+ }
28736
+ }
28737
+ const legacyModel = asString(store["agentModel"]);
28738
+ if (legacyModel && !agents[defaultAgent].model) agents[defaultAgent] = { model: legacyModel };
28739
+ return { defaultAgent, agents };
28740
+ }
28741
+ async function writeAgentConfig(config) {
28742
+ const existing = await readV1Store();
28743
+ const merged = { ...existing };
28744
+ const agents = {};
28745
+ for (const name of AGENT_NAMES) {
28746
+ const model = config.agents[name].model.trim();
28747
+ if (model) agents[name] = { model };
28748
+ }
28749
+ merged["agent"] = config.defaultAgent;
28750
+ const defaultModel = agents[config.defaultAgent]?.model;
28751
+ if (defaultModel) merged["agentModel"] = defaultModel;
28752
+ else delete merged["agentModel"];
28753
+ if (Object.keys(agents).length > 0) merged["agents"] = agents;
28754
+ else delete merged["agents"];
28755
+ await writeV1Store(merged);
28756
+ }
28757
+
28758
+ // packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
28759
+ import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
28760
+ var MODEL_FIELDS = [
28761
+ { key: "model", label: "Model", hint: "(empty: the agent\u2019s own default)" }
28762
+ ];
28763
+ var ROWS = [{ kind: "default" }, ...AGENT_NAMES.map((name) => ({ kind: "agent", name }))];
28764
+ function AgentForm({
28765
+ name,
28766
+ config,
28767
+ setConfig,
28768
+ onBack
28769
+ }) {
28770
+ const [saving, setSaving] = useState30(false);
28771
+ const [notice, setNotice] = useState30(null);
28772
+ const save = () => {
28773
+ setSaving(true);
28774
+ setNotice(null);
28775
+ writeAgentConfig(config).then(() => setNotice({ kind: "success", text: `${AGENT_LABELS[name]} settings saved` })).catch(
28776
+ (err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
28777
+ ).finally(() => setSaving(false));
28778
+ };
28779
+ return /* @__PURE__ */ jsx56(
28780
+ FieldForm,
28781
+ {
28782
+ title: AGENT_LABELS[name],
28783
+ subtitle: `Runs the \`${AGENT_HINTS[name]}\` command. ${config.defaultAgent === name ? "This is the default agent." : ""}`.trim(),
28784
+ fields: MODEL_FIELDS,
28785
+ values: { model: config.agents[name].model },
28786
+ onChange: (_key, value) => {
28787
+ setConfig({ ...config, agents: { ...config.agents, [name]: { model: value } } });
28788
+ setNotice(null);
28789
+ },
28790
+ onSave: save,
28791
+ onQuit: onBack,
28792
+ notice,
28793
+ busy: saving
28794
+ }
28795
+ );
28796
+ }
28797
+ function AgentsScreen({ onDone }) {
28798
+ const [config, setConfig] = useState30(null);
28799
+ const [focus, setFocus] = useState30(0);
28800
+ const [open, setOpen] = useState30(null);
28801
+ const [notice, setNotice] = useState30(null);
28802
+ useEffect22(() => {
28803
+ void readAgentConfig().then((loaded) => {
28804
+ setConfig(loaded);
28805
+ startDebugRun({
28806
+ flow: "settings/agents",
28807
+ step: "01-agents",
28808
+ menuOption: "Configuration > Agents",
28809
+ inputs: { default_agent: loaded.defaultAgent }
28810
+ });
28811
+ });
28812
+ }, []);
28813
+ const cycleDefault = (step) => {
28814
+ if (!config) return;
28815
+ const index = AGENT_NAMES.indexOf(config.defaultAgent);
28816
+ const next = { ...config, defaultAgent: AGENT_NAMES[(index + step + AGENT_NAMES.length) % AGENT_NAMES.length] };
28817
+ setConfig(next);
28818
+ writeAgentConfig(next).then(() => setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[next.defaultAgent]}` })).catch(
28819
+ (err) => setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" })
28820
+ );
28821
+ };
28822
+ useInput12((input, key) => {
28823
+ if (!config || open) return;
28824
+ const row = ROWS[focus];
28825
+ if (key.upArrow) {
28826
+ setFocus((i) => (i - 1 + ROWS.length) % ROWS.length);
28827
+ return;
28828
+ }
28829
+ if (key.downArrow || key.tab) {
28830
+ setFocus((i) => (i + 1) % ROWS.length);
28831
+ return;
28832
+ }
28833
+ if (row.kind === "default" && key.leftArrow) {
28834
+ cycleDefault(-1);
28835
+ return;
28836
+ }
28837
+ if (row.kind === "default" && key.rightArrow) {
28838
+ cycleDefault(1);
28839
+ return;
28840
+ }
28841
+ if (key.return) {
28842
+ if (row.kind === "default") cycleDefault(1);
28843
+ else setOpen(row.name);
28844
+ return;
28845
+ }
28846
+ if (key.escape || input === "q") {
28847
+ void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
28848
+ onDone();
28849
+ }
28850
+ });
28851
+ if (!config) {
28852
+ return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28853
+ /* @__PURE__ */ jsx56(Text47, { bold: true, children: "Agents" }),
28854
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28855
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.accent, children: "Loading..." })
28856
+ ] });
28857
+ }
28858
+ if (open) {
28859
+ return /* @__PURE__ */ jsx56(AgentForm, { name: open, config, setConfig, onBack: () => setOpen(null) });
28860
+ }
28861
+ return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28862
+ /* @__PURE__ */ jsx56(Text47, { bold: true, children: "Agents" }),
28863
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "The coding agent the CLI runs, and the settings for each one." }),
28864
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28865
+ ROWS.map((row, index) => {
28866
+ const isFocused = index === focus;
28867
+ const pointer = /* @__PURE__ */ jsx56(Text47, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
28868
+ if (row.kind === "default") {
28869
+ return /* @__PURE__ */ jsx56(Box45, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
28870
+ pointer,
28871
+ /* @__PURE__ */ jsx56(Text47, { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted, children: "Default agent" }),
28872
+ /* @__PURE__ */ jsx56(Text47, { bold: true, children: `\u2039 ${AGENT_LABELS[config.defaultAgent]} \u203A` })
28873
+ ] }) }, "default");
28874
+ }
28875
+ const model = config.agents[row.name].model;
28876
+ return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
28877
+ pointer,
28878
+ /* @__PURE__ */ jsx56(Box45, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx56(Text47, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[row.name] }) }),
28879
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: model ? `model: ${model}` : "model: default" }),
28880
+ row.name === config.defaultAgent && /* @__PURE__ */ jsx56(Text47, { color: PALETTE.success, children: "(default)" })
28881
+ ] }, row.name);
28882
+ }),
28883
+ notice && /* @__PURE__ */ jsxs46(Fragment18, { children: [
28884
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28885
+ /* @__PURE__ */ jsxs46(Text47, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
28886
+ notice.kind === "success" ? "\u2713" : "\u2717",
28887
+ " ",
28888
+ notice.text
28889
+ ] })
28890
+ ] }),
28891
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
28892
+ /* @__PURE__ */ jsx56(
28893
+ ControlHints,
28894
+ {
28895
+ hints: ROWS[focus].kind === "default" ? [
28896
+ { keys: "\u2191/\u2193", label: "move" },
28897
+ { keys: "\u2190/\u2192", label: "change default agent" },
28898
+ { keys: "Esc/q", label: "back" }
28899
+ ] : [
28900
+ { keys: "\u2191/\u2193", label: "move" },
28901
+ { keys: "\u23CE", label: "open" },
28902
+ { keys: "Esc/q", label: "back" }
28903
+ ]
28904
+ }
28905
+ )
28906
+ ] });
28907
+ }
28908
+
28909
+ // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
28910
+ import { useEffect as useEffect23, useState as useState31 } from "react";
28911
+ import { Box as Box46, Text as Text48 } from "ink";
28912
+ init_debug_store();
28913
+
28559
28914
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
28560
28915
  async function readCredentials() {
28561
28916
  const store = await readV1Store();
@@ -28581,17 +28936,16 @@ async function writeCredentials(config) {
28581
28936
  await writeV1Store(merged);
28582
28937
  }
28583
28938
 
28584
- // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
28585
- init_debug_store();
28586
- import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
28587
- var FIELD_ORDER = [
28588
- "spaceId",
28589
- "environmentId",
28590
- "cmaToken",
28591
- "host",
28592
- "defaultComponentDir",
28593
- "defaultTokenFile",
28594
- "contentfulBaseDir"
28939
+ // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
28940
+ import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
28941
+ var FIELDS2 = [
28942
+ { key: "spaceId", label: "Space ID" },
28943
+ { key: "environmentId", label: "Environment ID" },
28944
+ { key: "cmaToken", label: "CMA Token", masked: true },
28945
+ { key: "host", label: "API Host" },
28946
+ { key: "defaultComponentDir", label: "Default component directory" },
28947
+ { key: "defaultTokenFile", label: "Default token file" },
28948
+ { key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
28595
28949
  ];
28596
28950
  function debugFields(config) {
28597
28951
  return {
@@ -28604,156 +28958,114 @@ function debugFields(config) {
28604
28958
  contentful_base_dir: config?.contentfulBaseDir ?? ""
28605
28959
  };
28606
28960
  }
28607
- var FIELD_LABELS = {
28608
- spaceId: "Space ID",
28609
- environmentId: "Environment ID",
28610
- cmaToken: "CMA Token",
28611
- host: "API Host",
28612
- defaultComponentDir: "Default component directory",
28613
- defaultTokenFile: "Default token file",
28614
- contentfulBaseDir: "Root Project Directory"
28615
- };
28616
- var FIELD_HINTS = {
28617
- contentfulBaseDir: "(where .contentful goes)"
28618
- };
28619
- var LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
28620
- function ConfigurationScreen({ onDone }) {
28621
- const [stage, setStage] = useState29("loading");
28622
- const [config, setConfig] = useState29(null);
28623
- const [activeField, setActiveField] = useState29("spaceId");
28624
- const [notice, setNotice] = useState29(null);
28625
- const [lastSaved, setLastSaved] = useState29(null);
28626
- const [editing, setEditing] = useState29(false);
28627
- const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
28628
- useEffect22(() => {
28629
- readCredentials().then((cfg) => {
28961
+ var valuesOf = (config) => Object.fromEntries(FIELDS2.map(({ key }) => [key, config[key] || ""]));
28962
+ function ProjectConfigScreen({ onDone }) {
28963
+ const [config, setConfig] = useState31(null);
28964
+ const [saving, setSaving] = useState31(false);
28965
+ const [notice, setNotice] = useState31(null);
28966
+ const [lastSaved, setLastSaved] = useState31(null);
28967
+ useEffect23(() => {
28968
+ void readCredentials().then((cfg) => {
28630
28969
  setConfig(cfg);
28631
- setStage("form");
28632
28970
  startDebugRun({
28633
28971
  flow: "settings/contentful-configuration",
28634
28972
  step: "01-configuration",
28635
- menuOption: "Configuration",
28973
+ menuOption: "Configuration > Project",
28636
28974
  inputs: debugFields(cfg)
28637
28975
  });
28638
28976
  });
28639
28977
  }, []);
28640
- function fieldValue(field) {
28641
- if (!config) return "";
28642
- return config[field] || "";
28643
- }
28644
- function setFieldValue(field, value) {
28645
- if (!config) return;
28646
- setConfig({ ...config, [field]: value });
28647
- setNotice(null);
28978
+ if (!config) {
28979
+ return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28980
+ /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Project" }),
28981
+ /* @__PURE__ */ jsx57(Text48, { children: " " }),
28982
+ /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
28983
+ ] });
28648
28984
  }
28649
- function handleSave() {
28650
- if (!config) return;
28651
- setStage("saving");
28985
+ const save = () => {
28986
+ setSaving(true);
28652
28987
  setNotice(null);
28653
28988
  writeCredentials(config).then(() => {
28654
28989
  setLastSaved(config);
28655
28990
  if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
28656
- setNotice({ kind: "success", text: "Configuration saved" });
28657
- setStage("form");
28991
+ setNotice({ kind: "success", text: "Project settings saved" });
28658
28992
  }).catch((err) => {
28659
28993
  setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
28660
- setStage("form");
28661
- });
28662
- }
28663
- function quit() {
28994
+ }).finally(() => setSaving(false));
28995
+ };
28996
+ const quit = () => {
28664
28997
  void finishDebugRun(
28665
28998
  lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
28666
28999
  );
28667
29000
  onDone();
28668
- }
28669
- useInput11((input, key) => {
28670
- if (stage === "loading" || stage === "saving") return;
28671
- if (editing) {
28672
- if (key.escape) {
28673
- setFieldValue(activeField, valueBeforeEdit);
28674
- setEditing(false);
28675
- }
28676
- return;
28677
- }
28678
- if (key.escape || input === "q") {
28679
- quit();
28680
- return;
28681
- }
28682
- if (input === "s") {
28683
- handleSave();
28684
- return;
28685
- }
28686
- if (input === "c") {
28687
- setFieldValue(activeField, "");
28688
- return;
29001
+ };
29002
+ return /* @__PURE__ */ jsx57(
29003
+ FieldForm,
29004
+ {
29005
+ title: "Project",
29006
+ subtitle: "The Contentful space and where the CLI keeps its files.",
29007
+ fields: FIELDS2,
29008
+ values: valuesOf(config),
29009
+ onChange: (key, value) => {
29010
+ setConfig({ ...config, [key]: value });
29011
+ setNotice(null);
29012
+ },
29013
+ onSave: save,
29014
+ onQuit: quit,
29015
+ notice,
29016
+ busy: saving
28689
29017
  }
28690
- if (key.tab || key.downArrow) {
28691
- const idx = FIELD_ORDER.indexOf(activeField);
28692
- setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
29018
+ );
29019
+ }
29020
+
29021
+ // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
29022
+ import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
29023
+ var SECTIONS = [
29024
+ {
29025
+ id: "project",
29026
+ label: "Project",
29027
+ description: "Contentful space, credentials, defaults and where .contentful goes"
29028
+ },
29029
+ { id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
29030
+ ];
29031
+ function ConfigurationScreen({ onDone }) {
29032
+ const [focus, setFocus] = useState32(0);
29033
+ const [open, setOpen] = useState32(null);
29034
+ const close = () => setOpen(null);
29035
+ useInput13((input, key) => {
29036
+ if (open) return;
29037
+ if (key.upArrow) {
29038
+ setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
28693
29039
  return;
28694
29040
  }
28695
- if (key.upArrow) {
28696
- const idx = FIELD_ORDER.indexOf(activeField);
28697
- setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
29041
+ if (key.downArrow || key.tab) {
29042
+ setFocus((i) => (i + 1) % SECTIONS.length);
28698
29043
  return;
28699
29044
  }
28700
29045
  if (key.return) {
28701
- setValueBeforeEdit(fieldValue(activeField));
28702
- setEditing(true);
29046
+ setOpen(SECTIONS[focus].id);
29047
+ return;
28703
29048
  }
29049
+ if (key.escape || input === "q") onDone();
28704
29050
  });
28705
- if (stage === "loading") {
28706
- return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28707
- /* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
28708
- /* @__PURE__ */ jsx55(Text46, { children: " " }),
28709
- /* @__PURE__ */ jsx55(Text46, { color: PALETTE.accent, children: "Loading..." })
28710
- ] });
28711
- }
28712
- return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28713
- /* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
28714
- /* @__PURE__ */ jsx55(Text46, { children: " " }),
28715
- /* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
28716
- const isActive = activeField === field;
28717
- const value = fieldValue(field);
28718
- const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
28719
- return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
28720
- /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
28721
- /* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
28722
- isActive && editing ? /* @__PURE__ */ jsx55(
28723
- TextInput4,
28724
- {
28725
- value,
28726
- onChange: (next) => setFieldValue(field, next),
28727
- onSubmit: () => setEditing(false),
28728
- mask: field === "cmaToken" ? "\u2022" : void 0
28729
- }
28730
- ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
28731
- FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
28732
- ] }, field);
28733
- }) }),
28734
- notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
28735
- /* @__PURE__ */ jsx55(Text46, { children: " " }),
28736
- /* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
28737
- notice.kind === "success" ? "\u2713" : "\u2717",
28738
- " ",
28739
- notice.text
28740
- ] })
28741
- ] }),
28742
- /* @__PURE__ */ jsx55(Text46, { children: " " }),
28743
- /* @__PURE__ */ jsx55(
29051
+ if (open === "project") return /* @__PURE__ */ jsx58(ProjectConfigScreen, { onDone: close });
29052
+ if (open === "agents") return /* @__PURE__ */ jsx58(AgentsScreen, { onDone: close });
29053
+ return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29054
+ /* @__PURE__ */ jsx58(Text49, { bold: true, children: "Configuration" }),
29055
+ /* @__PURE__ */ jsx58(Text49, { children: " " }),
29056
+ SECTIONS.map((section, index) => /* @__PURE__ */ jsxs48(Box47, { gap: 1, children: [
29057
+ /* @__PURE__ */ jsx58(Text49, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
29058
+ /* @__PURE__ */ jsx58(Box47, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
29059
+ /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: section.description })
29060
+ ] }, section.id)),
29061
+ /* @__PURE__ */ jsx58(Text49, { children: " " }),
29062
+ /* @__PURE__ */ jsx58(
28744
29063
  ControlHints,
28745
29064
  {
28746
- hints: editing ? [
28747
- { keys: "type", label: "edit" },
28748
- { keys: "\u2190/\u2192", label: "move cursor" },
28749
- { keys: "\u23CE", label: "done" },
28750
- { keys: "Esc", label: "cancel edit" }
28751
- ] : [
29065
+ hints: [
28752
29066
  { keys: "\u2191/\u2193", label: "move" },
28753
- { keys: "\u23CE", label: "edit" },
28754
- { keys: "c", label: "clear" },
28755
- { keys: "s", label: "save" },
28756
- { keys: "Esc/q", label: "quit without saving" }
29067
+ { keys: "\u23CE", label: "open" },
29068
+ { keys: "Esc/q", label: "back" }
28757
29069
  ]
28758
29070
  }
28759
29071
  )
@@ -28761,8 +29073,8 @@ function ConfigurationScreen({ onDone }) {
28761
29073
  }
28762
29074
 
28763
29075
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
28764
- import { useEffect as useEffect23, useState as useState30 } from "react";
28765
- import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
29076
+ import { useEffect as useEffect24, useState as useState33 } from "react";
29077
+ import { Box as Box48, Text as Text50, useInput as useInput14 } from "ink";
28766
29078
 
28767
29079
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
28768
29080
  async function readAnalyticsSetting() {
@@ -28781,11 +29093,11 @@ async function writeAnalyticsSetting(setting) {
28781
29093
 
28782
29094
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
28783
29095
  init_debug_store();
28784
- import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
29096
+ import { Fragment as Fragment19, jsx as jsx59, jsxs as jsxs49 } from "react/jsx-runtime";
28785
29097
  function OptInAnalyticsScreen({ onDone }) {
28786
- const [loading, setLoading] = useState30(true);
28787
- const [enabled, setEnabled] = useState30(true);
28788
- useEffect23(() => {
29098
+ const [loading, setLoading] = useState33(true);
29099
+ const [enabled, setEnabled] = useState33(true);
29100
+ useEffect24(() => {
28789
29101
  readAnalyticsSetting().then((setting) => {
28790
29102
  setEnabled(setting.enabled);
28791
29103
  setLoading(false);
@@ -28797,7 +29109,7 @@ function OptInAnalyticsScreen({ onDone }) {
28797
29109
  });
28798
29110
  });
28799
29111
  }, []);
28800
- useInput12((input, key) => {
29112
+ useInput14((input, key) => {
28801
29113
  if (loading) return;
28802
29114
  if (key.return || input === " ") {
28803
29115
  setEnabled((current) => {
@@ -28812,21 +29124,21 @@ function OptInAnalyticsScreen({ onDone }) {
28812
29124
  onDone();
28813
29125
  }
28814
29126
  });
28815
- return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28816
- /* @__PURE__ */ jsx56(Text47, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
28817
- /* @__PURE__ */ jsx56(Text47, { children: " " }),
28818
- loading ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs46(Fragment18, { children: [
28819
- /* @__PURE__ */ jsxs46(Text47, { children: [
29127
+ return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29128
+ /* @__PURE__ */ jsx59(Text50, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
29129
+ /* @__PURE__ */ jsx59(Text50, { children: " " }),
29130
+ loading ? /* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs49(Fragment19, { children: [
29131
+ /* @__PURE__ */ jsxs49(Text50, { children: [
28820
29132
  "Share anonymous usage data:",
28821
29133
  " ",
28822
- /* @__PURE__ */ jsx56(Text47, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29134
+ /* @__PURE__ */ jsx59(Text50, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
28823
29135
  ] }),
28824
- /* @__PURE__ */ jsx56(Text47, { children: " " }),
28825
- /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
28826
- /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
29136
+ /* @__PURE__ */ jsx59(Text50, { children: " " }),
29137
+ /* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
29138
+ /* @__PURE__ */ jsx59(Text50, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
28827
29139
  ] }),
28828
- /* @__PURE__ */ jsx56(Text47, { children: " " }),
28829
- /* @__PURE__ */ jsx56(
29140
+ /* @__PURE__ */ jsx59(Text50, { children: " " }),
29141
+ /* @__PURE__ */ jsx59(
28830
29142
  ControlHints,
28831
29143
  {
28832
29144
  hints: [
@@ -28839,15 +29151,15 @@ function OptInAnalyticsScreen({ onDone }) {
28839
29151
  }
28840
29152
 
28841
29153
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
28842
- import { useEffect as useEffect24, useState as useState31 } from "react";
28843
- import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
29154
+ import { useEffect as useEffect25, useState as useState34 } from "react";
29155
+ import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
28844
29156
  init_version();
28845
29157
  init_debug_store();
28846
- import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
29158
+ import { jsx as jsx60, jsxs as jsxs50 } from "react/jsx-runtime";
28847
29159
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
28848
29160
  function UpgradeScreen({ onDone }) {
28849
- const [upgradeCheck, setUpgradeCheck] = useState31();
28850
- useEffect24(() => {
29161
+ const [upgradeCheck, setUpgradeCheck] = useState34();
29162
+ useEffect25(() => {
28851
29163
  startDebugRun({
28852
29164
  flow: "upgrade",
28853
29165
  step: "01-upgrade",
@@ -28856,7 +29168,7 @@ function UpgradeScreen({ onDone }) {
28856
29168
  });
28857
29169
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
28858
29170
  }, []);
28859
- useInput13((_input, key) => {
29171
+ useInput15((_input, key) => {
28860
29172
  if (key.return) {
28861
29173
  void finishDebugRun({
28862
29174
  outputs: upgradeCheck ?? {},
@@ -28867,12 +29179,12 @@ function UpgradeScreen({ onDone }) {
28867
29179
  return;
28868
29180
  }
28869
29181
  });
28870
- return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28871
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Upgrade" }),
28872
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
29182
+ return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29183
+ /* @__PURE__ */ jsx60(Text51, { bold: true, children: "Upgrade" }),
29184
+ /* @__PURE__ */ jsx60(Text51, { children: " " }),
28873
29185
  renderBody(upgradeCheck),
28874
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
28875
- /* @__PURE__ */ jsxs47(Text48, { bold: true, color: PALETTE.accent, children: [
29186
+ /* @__PURE__ */ jsx60(Text51, { children: " " }),
29187
+ /* @__PURE__ */ jsxs50(Text51, { bold: true, color: PALETTE.accent, children: [
28876
29188
  FOCUS_MARKER,
28877
29189
  " Go Back"
28878
29190
  ] })
@@ -28880,47 +29192,47 @@ function UpgradeScreen({ onDone }) {
28880
29192
  }
28881
29193
  function renderBody(upgradeCheck) {
28882
29194
  if (!upgradeCheck) {
28883
- return /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Checking for updates\u2026" });
29195
+ return /* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: "Checking for updates\u2026" });
28884
29196
  }
28885
29197
  if (upgradeCheck.status === "error") {
28886
- return /* @__PURE__ */ jsx57(Text48, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
29198
+ return /* @__PURE__ */ jsx60(Text51, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
28887
29199
  }
28888
29200
  if (upgradeCheck.status === "up-to-date") {
28889
- return /* @__PURE__ */ jsxs47(Text48, { color: PALETTE.success, children: [
29201
+ return /* @__PURE__ */ jsxs50(Text51, { color: PALETTE.success, children: [
28890
29202
  "You're already on the latest version (v",
28891
29203
  upgradeCheck.current,
28892
29204
  ")."
28893
29205
  ] });
28894
29206
  }
28895
- return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", children: [
28896
- /* @__PURE__ */ jsxs47(Text48, { color: PALETTE.muted, children: [
28897
- /* @__PURE__ */ jsxs47(Text48, { bold: true, color: PALETTE.success, children: [
29207
+ return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", children: [
29208
+ /* @__PURE__ */ jsxs50(Text51, { color: PALETTE.muted, children: [
29209
+ /* @__PURE__ */ jsxs50(Text51, { bold: true, color: PALETTE.success, children: [
28898
29210
  "v",
28899
29211
  upgradeCheck.latest
28900
29212
  ] }),
28901
29213
  " ",
28902
29214
  "is available (you're on ",
28903
- /* @__PURE__ */ jsxs47(Text48, { bold: true, children: [
29215
+ /* @__PURE__ */ jsxs50(Text51, { bold: true, children: [
28904
29216
  "v",
28905
29217
  upgradeCheck.current
28906
29218
  ] }),
28907
29219
  "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
28908
29220
  ] }),
28909
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
28910
- /* @__PURE__ */ jsx57(Box46, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx57(Text48, { bold: true, children: cmd }, cmd)) })
29221
+ /* @__PURE__ */ jsx60(Text51, { children: " " }),
29222
+ /* @__PURE__ */ jsx60(Box49, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx60(Text51, { bold: true, children: cmd }, cmd)) })
28911
29223
  ] });
28912
29224
  }
28913
29225
 
28914
29226
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
28915
- import { useEffect as useEffect25, useState as useState32 } from "react";
28916
- import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
29227
+ import { useEffect as useEffect26, useState as useState35 } from "react";
29228
+ import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
28917
29229
  init_debug_mode_store();
28918
29230
  init_debug_store();
28919
- import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
29231
+ import { jsx as jsx61, jsxs as jsxs51 } from "react/jsx-runtime";
28920
29232
  function DebugModeScreen({ onDone }) {
28921
- const [loading, setLoading] = useState32(true);
28922
- const [enabled, setEnabled] = useState32(true);
28923
- useEffect25(() => {
29233
+ const [loading, setLoading] = useState35(true);
29234
+ const [enabled, setEnabled] = useState35(true);
29235
+ useEffect26(() => {
28924
29236
  readDebugModeSetting().then((setting) => {
28925
29237
  setEnabled(setting.enabled);
28926
29238
  setLoading(false);
@@ -28932,7 +29244,7 @@ function DebugModeScreen({ onDone }) {
28932
29244
  });
28933
29245
  });
28934
29246
  }, []);
28935
- useInput14((input, key) => {
29247
+ useInput16((input, key) => {
28936
29248
  if (loading) return;
28937
29249
  if (key.return || input === " ") {
28938
29250
  setEnabled((current) => {
@@ -28947,16 +29259,16 @@ function DebugModeScreen({ onDone }) {
28947
29259
  onDone();
28948
29260
  }
28949
29261
  });
28950
- return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
28951
- /* @__PURE__ */ jsx58(Text49, { bold: true, children: "Settings \u203A Debug Mode" }),
28952
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
28953
- loading ? /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs48(Text49, { children: [
29262
+ return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29263
+ /* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Debug Mode" }),
29264
+ /* @__PURE__ */ jsx61(Text52, { children: " " }),
29265
+ loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs51(Text52, { children: [
28954
29266
  "Debug logging:",
28955
29267
  " ",
28956
- /* @__PURE__ */ jsx58(Text49, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29268
+ /* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
28957
29269
  ] }),
28958
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
28959
- /* @__PURE__ */ jsx58(
29270
+ /* @__PURE__ */ jsx61(Text52, { children: " " }),
29271
+ /* @__PURE__ */ jsx61(
28960
29272
  ControlHints,
28961
29273
  {
28962
29274
  hints: [
@@ -28969,18 +29281,18 @@ function DebugModeScreen({ onDone }) {
28969
29281
  }
28970
29282
 
28971
29283
  // packages/experience-design-system-cli/app.tsx
28972
- import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
29284
+ import { Fragment as Fragment20, jsx as jsx62 } from "react/jsx-runtime";
28973
29285
  function App({ importOptions, inkClear }) {
28974
- const [screen, setScreen] = useState33("start");
28975
- const [importExitCode, setImportExitCode] = useState33();
29286
+ const [screen, setScreen] = useState36("start");
29287
+ const [importExitCode, setImportExitCode] = useState36();
28976
29288
  const showImportResult = importExitCode !== void 0;
28977
- const [projectPath, setProjectPath] = useState33();
28978
- const [tokensPath, setTokensPath] = useState33();
28979
- const [scannedFiles, setScannedFiles] = useState33();
28980
- const [pendingLaunch, setPendingLaunch] = useState33();
28981
- const [extractionRun, setExtractionRun] = useState33();
29289
+ const [projectPath, setProjectPath] = useState36();
29290
+ const [tokensPath, setTokensPath] = useState36();
29291
+ const [scannedFiles, setScannedFiles] = useState36();
29292
+ const [pendingLaunch, setPendingLaunch] = useState36();
29293
+ const [extractionRun, setExtractionRun] = useState36();
28982
29294
  const extraction = useExtraction(extractionRun?.input);
28983
- const [scopeRun, setScopeRun] = useState33();
29295
+ const [scopeRun, setScopeRun] = useState36();
28984
29296
  const scopeFlow = useScopeGateFlow(
28985
29297
  scopeRun && {
28986
29298
  sessionId: scopeRun.extraction.sessionId,
@@ -28995,12 +29307,12 @@ function App({ importOptions, inkClear }) {
28995
29307
  }
28996
29308
  }
28997
29309
  );
28998
- const [generationInput, setGenerationInput] = useState33();
29310
+ const [generationInput, setGenerationInput] = useState36();
28999
29311
  const generation = useGeneration(generationInput);
29000
- const [flowStart, setFlowStart] = useState33();
29312
+ const [flowStart, setFlowStart] = useState36();
29001
29313
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
29002
- const [importDefaults, setImportDefaults] = useState33();
29003
- useEffect26(() => {
29314
+ const [importDefaults, setImportDefaults] = useState36();
29315
+ useEffect27(() => {
29004
29316
  if (screen !== "import") {
29005
29317
  setImportDefaults(void 0);
29006
29318
  return;
@@ -29018,7 +29330,7 @@ function App({ importOptions, inkClear }) {
29018
29330
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
29019
29331
  const state2 = await inspectTokens({
29020
29332
  rawTokensPath: tokens,
29021
- contentfulDir: join25(resolveUserPath(projectPath2), ".contentful"),
29333
+ contentfulDir: join26(resolveUserPath(projectPath2), ".contentful"),
29022
29334
  cache: importOptions.cache
29023
29335
  });
29024
29336
  if (state2.kind === "cached") {
@@ -29060,12 +29372,12 @@ function App({ importOptions, inkClear }) {
29060
29372
  }
29061
29373
  });
29062
29374
  };
29063
- useEffect26(() => {
29375
+ useEffect27(() => {
29064
29376
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
29065
29377
  setExtractionRun(void 0);
29066
29378
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
29067
29379
  }, [extraction, extractionRun]);
29068
- useEffect26(() => {
29380
+ useEffect27(() => {
29069
29381
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
29070
29382
  const { extraction: produced, input, generatePromptPath } = scopeRun;
29071
29383
  setGenerationInput({
@@ -29083,7 +29395,7 @@ function App({ importOptions, inkClear }) {
29083
29395
  ...generatePromptPath ? { generatePromptPath } : {}
29084
29396
  });
29085
29397
  }, [scopeFlow, scopeRun, generationInput]);
29086
- useEffect26(() => {
29398
+ useEffect27(() => {
29087
29399
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
29088
29400
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
29089
29401
  inkClear();
@@ -29126,9 +29438,9 @@ function App({ importOptions, inkClear }) {
29126
29438
  };
29127
29439
  switch (screen) {
29128
29440
  case "import":
29129
- if (showImportResult) return /* @__PURE__ */ jsx59(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
29441
+ if (showImportResult) return /* @__PURE__ */ jsx62(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
29130
29442
  if (flow && flowStart) {
29131
- return /* @__PURE__ */ jsx59(
29443
+ return /* @__PURE__ */ jsx62(
29132
29444
  FlowScreen,
29133
29445
  {
29134
29446
  state: flow.state,
@@ -29138,12 +29450,12 @@ function App({ importOptions, inkClear }) {
29138
29450
  }
29139
29451
  );
29140
29452
  }
29141
- if (importDefaults === void 0) return /* @__PURE__ */ jsx59(Fragment19, {});
29453
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx62(Fragment20, {});
29142
29454
  if (projectPath === void 0) {
29143
- return /* @__PURE__ */ jsx59(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29455
+ return /* @__PURE__ */ jsx62(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29144
29456
  }
29145
29457
  if (tokensPath === void 0) {
29146
- return /* @__PURE__ */ jsx59(
29458
+ return /* @__PURE__ */ jsx62(
29147
29459
  TokenInputScreen,
29148
29460
  {
29149
29461
  initialPath: importDefaults.tokenFile,
@@ -29153,7 +29465,7 @@ function App({ importOptions, inkClear }) {
29153
29465
  );
29154
29466
  }
29155
29467
  if (scannedFiles === void 0) {
29156
- return /* @__PURE__ */ jsx59(
29468
+ return /* @__PURE__ */ jsx62(
29157
29469
  PathValidationScreen,
29158
29470
  {
29159
29471
  projectPath,
@@ -29165,10 +29477,10 @@ function App({ importOptions, inkClear }) {
29165
29477
  }
29166
29478
  if (extractionRun) {
29167
29479
  if (extraction?.status === "done" && !extraction.result.ok) {
29168
- return /* @__PURE__ */ jsx59(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
29480
+ return /* @__PURE__ */ jsx62(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
29169
29481
  }
29170
29482
  if (extraction?.status === "running") {
29171
- return /* @__PURE__ */ jsx59(
29483
+ return /* @__PURE__ */ jsx62(
29172
29484
  ExtractionScreen,
29173
29485
  {
29174
29486
  progress: extraction.progress,
@@ -29177,14 +29489,14 @@ function App({ importOptions, inkClear }) {
29177
29489
  }
29178
29490
  );
29179
29491
  }
29180
- return /* @__PURE__ */ jsx59(Fragment19, {});
29492
+ return /* @__PURE__ */ jsx62(Fragment20, {});
29181
29493
  }
29182
29494
  if (scopeRun && scopeFlow) {
29183
29495
  if (scopeFlow.status === "failed") {
29184
- return /* @__PURE__ */ jsx59(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
29496
+ return /* @__PURE__ */ jsx62(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
29185
29497
  }
29186
29498
  if (scopeFlow.status === "deciding") {
29187
- return /* @__PURE__ */ jsx59(
29499
+ return /* @__PURE__ */ jsx62(
29188
29500
  ScopeGateScreen,
29189
29501
  {
29190
29502
  components: scopeFlow.load.components,
@@ -29194,7 +29506,7 @@ function App({ importOptions, inkClear }) {
29194
29506
  );
29195
29507
  }
29196
29508
  if (generation?.status === "done" && !generation.result.ok) {
29197
- return /* @__PURE__ */ jsx59(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
29509
+ return /* @__PURE__ */ jsx62(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
29198
29510
  }
29199
29511
  if (generation?.status === "running") {
29200
29512
  const hasRawTokens = scopeRun.input.rawTokensPath !== "";
@@ -29202,7 +29514,7 @@ function App({ importOptions, inkClear }) {
29202
29514
  hasRawTokens,
29203
29515
  mapTokensEligible: generation.progress.mapTokensEligible
29204
29516
  });
29205
- return /* @__PURE__ */ jsx59(
29517
+ return /* @__PURE__ */ jsx62(
29206
29518
  GenerationScreen,
29207
29519
  {
29208
29520
  progress: generation.progress,
@@ -29214,10 +29526,10 @@ function App({ importOptions, inkClear }) {
29214
29526
  }
29215
29527
  );
29216
29528
  }
29217
- return /* @__PURE__ */ jsx59(Fragment19, {});
29529
+ return /* @__PURE__ */ jsx62(Fragment20, {});
29218
29530
  }
29219
29531
  if (pendingLaunch?.cached) {
29220
- return /* @__PURE__ */ jsx59(
29532
+ return /* @__PURE__ */ jsx62(
29221
29533
  TokenReuseScreen,
29222
29534
  {
29223
29535
  tokensPath: pendingLaunch.cached.tokensPath,
@@ -29228,7 +29540,7 @@ function App({ importOptions, inkClear }) {
29228
29540
  }
29229
29541
  );
29230
29542
  }
29231
- return /* @__PURE__ */ jsx59(
29543
+ return /* @__PURE__ */ jsx62(
29232
29544
  CredentialsScreen,
29233
29545
  {
29234
29546
  initial: importDefaults.credentials,
@@ -29237,19 +29549,19 @@ function App({ importOptions, inkClear }) {
29237
29549
  }
29238
29550
  );
29239
29551
  case "help":
29240
- return /* @__PURE__ */ jsx59(HelpScreen, { onDone: goToStart });
29552
+ return /* @__PURE__ */ jsx62(HelpScreen, { onDone: goToStart });
29241
29553
  case "upgrade":
29242
- return /* @__PURE__ */ jsx59(UpgradeScreen, { onDone: goToStart });
29554
+ return /* @__PURE__ */ jsx62(UpgradeScreen, { onDone: goToStart });
29243
29555
  case "settings":
29244
- return /* @__PURE__ */ jsx59(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
29556
+ return /* @__PURE__ */ jsx62(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
29245
29557
  case "settings-configuration":
29246
- return /* @__PURE__ */ jsx59(ConfigurationScreen, { onDone: goToSettings });
29558
+ return /* @__PURE__ */ jsx62(ConfigurationScreen, { onDone: goToSettings });
29247
29559
  case "settings-opt-in-analytics":
29248
- return /* @__PURE__ */ jsx59(OptInAnalyticsScreen, { onDone: goToSettings });
29560
+ return /* @__PURE__ */ jsx62(OptInAnalyticsScreen, { onDone: goToSettings });
29249
29561
  case "settings-debug-mode":
29250
- return /* @__PURE__ */ jsx59(DebugModeScreen, { onDone: goToSettings });
29562
+ return /* @__PURE__ */ jsx62(DebugModeScreen, { onDone: goToSettings });
29251
29563
  case "start":
29252
- return /* @__PURE__ */ jsx59(HomeScreen, { onNavigate: setScreen });
29564
+ return /* @__PURE__ */ jsx62(HomeScreen, { onNavigate: setScreen });
29253
29565
  }
29254
29566
  }
29255
29567
  async function runApp(renderApp, importOptions) {
@@ -29257,7 +29569,7 @@ async function runApp(renderApp, importOptions) {
29257
29569
  instance.clear?.();
29258
29570
  process.stdout.write("\x1B[H\x1B[0J");
29259
29571
  };
29260
- const instance = renderApp(/* @__PURE__ */ jsx59(App, { importOptions, inkClear }));
29572
+ const instance = renderApp(/* @__PURE__ */ jsx62(App, { importOptions, inkClear }));
29261
29573
  await instance.waitUntilExit();
29262
29574
  }
29263
29575
  export {