@contentful/experience-design-system-cli 2.37.1-dev-build-be7b0e35.0 → 2.37.1-dev-build-2eb3abd8.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
@@ -1500,7 +1500,7 @@ async function runAgent(options) {
1500
1500
  promptLen: prompt.length,
1501
1501
  promptHead: prompt.slice(0, 500)
1502
1502
  });
1503
- return new Promise((resolve28) => {
1503
+ return new Promise((resolve27) => {
1504
1504
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
1505
1505
  const child = spawn(binary, args, {
1506
1506
  stdio: ["pipe", "pipe", "pipe"],
@@ -1549,7 +1549,7 @@ async function runAgent(options) {
1549
1549
  stderrLen: stderr.length,
1550
1550
  stderrTail: stderr.slice(-1e3)
1551
1551
  });
1552
- resolve28(result);
1552
+ resolve27(result);
1553
1553
  });
1554
1554
  });
1555
1555
  }
@@ -1571,7 +1571,7 @@ async function checkAgentAuth(agent) {
1571
1571
  return "not-found";
1572
1572
  if (agent !== "claude")
1573
1573
  return "ok";
1574
- return new Promise((resolve28) => {
1574
+ return new Promise((resolve27) => {
1575
1575
  const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
1576
1576
  let stdout = "";
1577
1577
  let done = false;
@@ -1580,7 +1580,7 @@ async function checkAgentAuth(agent) {
1580
1580
  return;
1581
1581
  done = true;
1582
1582
  child.kill("SIGTERM");
1583
- resolve28("unauthenticated");
1583
+ resolve27("unauthenticated");
1584
1584
  }, 5e3);
1585
1585
  child.stdout?.on("data", (chunk) => {
1586
1586
  stdout += chunk.toString();
@@ -1591,14 +1591,14 @@ async function checkAgentAuth(agent) {
1591
1591
  done = true;
1592
1592
  clearTimeout(timer);
1593
1593
  if (code !== 0) {
1594
- resolve28("unauthenticated");
1594
+ resolve27("unauthenticated");
1595
1595
  return;
1596
1596
  }
1597
1597
  try {
1598
1598
  const status = JSON.parse(stdout);
1599
- resolve28(status.loggedIn ? "ok" : "unauthenticated");
1599
+ resolve27(status.loggedIn ? "ok" : "unauthenticated");
1600
1600
  } catch {
1601
- resolve28("unauthenticated");
1601
+ resolve27("unauthenticated");
1602
1602
  }
1603
1603
  });
1604
1604
  });
@@ -1608,9 +1608,9 @@ async function binaryIsOnPath(binary) {
1608
1608
  const fs = await import("node:fs/promises");
1609
1609
  return fs.access(binary).then(() => true, () => false);
1610
1610
  }
1611
- return new Promise((resolve28) => {
1611
+ return new Promise((resolve27) => {
1612
1612
  const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
1613
- child.on("close", (code) => resolve28(code === 0));
1613
+ child.on("close", (code) => resolve27(code === 0));
1614
1614
  });
1615
1615
  }
1616
1616
  var init_check_agent_auth = __esm({
@@ -7916,10 +7916,10 @@ function extractVueSlotsFromSetup(options) {
7916
7916
  if (!body)
7917
7917
  return [];
7918
7918
  const slotsByName = /* @__PURE__ */ new Map();
7919
- for (const access7 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
7920
- if (access7.getExpression().getText() !== slotsName)
7919
+ for (const access6 of body.getDescendantsOfKind(SyntaxKind5.PropertyAccessExpression)) {
7920
+ if (access6.getExpression().getText() !== slotsName)
7921
7921
  continue;
7922
- const slotName = access7.getName();
7922
+ const slotName = access6.getName();
7923
7923
  if (!slotsByName.has(slotName)) {
7924
7924
  slotsByName.set(slotName, {
7925
7925
  name: slotName,
@@ -14333,7 +14333,7 @@ function errorMessage(error) {
14333
14333
  return error instanceof Error && error.message ? error.message : String(error);
14334
14334
  }
14335
14335
  function defaultSleep(delayMs) {
14336
- return new Promise((resolve28) => setTimeout(resolve28, delayMs));
14336
+ return new Promise((resolve27) => setTimeout(resolve27, delayMs));
14337
14337
  }
14338
14338
  var MAX_RETRY_AFTER_MS;
14339
14339
  var init_http_utils = __esm({
@@ -14609,7 +14609,7 @@ var init_api_client = __esm({
14609
14609
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
14610
14610
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
14611
14611
  const jitter = Math.random() * baseDelay * 0.15;
14612
- await new Promise((resolve28) => setTimeout(resolve28, baseDelay + jitter));
14612
+ await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
14613
14613
  }
14614
14614
  }
14615
14615
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -18527,7 +18527,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
18527
18527
  const message = error instanceof Error ? error.message : String(error);
18528
18528
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
18529
18529
  throw error;
18530
- await new Promise((resolve28) => setTimeout(resolve28, Math.min(250 * attempt, 2e3)));
18530
+ await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
18531
18531
  }
18532
18532
  }
18533
18533
  }
@@ -19446,7 +19446,6 @@ var init_src4 = __esm({
19446
19446
  init_agents();
19447
19447
  init_agent_name();
19448
19448
  init_models();
19449
- init_binaries();
19450
19449
  init_is_agent_name();
19451
19450
  init_agent_supports_bedrock();
19452
19451
  init_check_agent_auth();
@@ -19566,97 +19565,6 @@ var init_v1_store = __esm({
19566
19565
  }
19567
19566
  });
19568
19567
 
19569
- // packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts
19570
- function emptyAgents() {
19571
- return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
19572
- }
19573
- async function readAgentConfig() {
19574
- const store = await readV1Store();
19575
- const stored = asString(store["agent"]);
19576
- const defaultAgent = isAgentName(stored) ? stored : DEFAULT_AGENT3;
19577
- const agents = emptyAgents();
19578
- const saved = store["agents"];
19579
- if (saved && typeof saved === "object") {
19580
- for (const name of AGENT_NAMES) {
19581
- const entry = saved[name];
19582
- if (entry && typeof entry === "object") {
19583
- const fields = entry;
19584
- agents[name] = { model: asString(fields["model"]), binary: asString(fields["binary"]) };
19585
- }
19586
- }
19587
- }
19588
- const legacyModel = asString(store["agentModel"]);
19589
- if (legacyModel && !agents[defaultAgent].model)
19590
- agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
19591
- return { defaultAgent, agents };
19592
- }
19593
- async function writeAgentConfig(config) {
19594
- const existing = await readV1Store();
19595
- const merged = { ...existing };
19596
- const agents = {};
19597
- for (const name of AGENT_NAMES) {
19598
- const model = config.agents[name].model.trim();
19599
- const binary = config.agents[name].binary.trim();
19600
- if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
19601
- }
19602
- merged["agent"] = config.defaultAgent;
19603
- const defaultModel = agents[config.defaultAgent]?.model;
19604
- if (defaultModel) merged["agentModel"] = defaultModel;
19605
- else delete merged["agentModel"];
19606
- if (Object.keys(agents).length > 0) merged["agents"] = agents;
19607
- else delete merged["agents"];
19608
- await writeV1Store(merged);
19609
- }
19610
- var DEFAULT_AGENT3, AGENT_LABELS, AGENT_HINTS, asString;
19611
- var init_agent_store = __esm({
19612
- "packages/experience-design-system-cli/src/tui/settings/agents/agent-store.ts"() {
19613
- "use strict";
19614
- init_src4();
19615
- init_v1_store();
19616
- DEFAULT_AGENT3 = "claude";
19617
- AGENT_LABELS = {
19618
- claude: "Claude Code",
19619
- codex: "OpenAI Codex",
19620
- opencode: "OpenCode",
19621
- cursor: "Cursor",
19622
- copilot: "GitHub Copilot"
19623
- };
19624
- AGENT_HINTS = {
19625
- claude: "claude",
19626
- codex: "codex",
19627
- opencode: "opencode",
19628
- cursor: "cursor-agent",
19629
- copilot: "copilot"
19630
- };
19631
- asString = (value) => typeof value === "string" ? value : "";
19632
- }
19633
- });
19634
-
19635
- // packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts
19636
- function applyBinaryOverrides(config) {
19637
- for (const name of AGENT_NAMES) {
19638
- const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
19639
- const binary = config.agents[name].binary.trim();
19640
- if (binary) {
19641
- if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
19642
- process.env[key] = binary;
19643
- } else if (shellValues.has(key)) {
19644
- const shellValue = shellValues.get(key);
19645
- if (shellValue === void 0) delete process.env[key];
19646
- else process.env[key] = shellValue;
19647
- shellValues.delete(key);
19648
- }
19649
- }
19650
- }
19651
- var shellValues;
19652
- var init_apply_binary_overrides = __esm({
19653
- "packages/experience-design-system-cli/src/tui/settings/agents/apply-binary-overrides.ts"() {
19654
- "use strict";
19655
- init_src4();
19656
- shellValues = /* @__PURE__ */ new Map();
19657
- }
19658
- });
19659
-
19660
19568
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
19661
19569
  async function readAnalyticsSetting() {
19662
19570
  const store = await readV1Store();
@@ -19831,14 +19739,14 @@ var init_control_hints = __esm({
19831
19739
  import { useEffect as useEffect2, useState as useState2 } from "react";
19832
19740
  import { Box, Text as Text2, useApp, useInput } from "ink";
19833
19741
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
19834
- function upgradeItemDisplay(upgradeCheck) {
19742
+ function versionStatus(upgradeCheck) {
19835
19743
  if (upgradeCheck?.status === "update-available") {
19836
- return { label: `Upgrade Version (v${upgradeCheck.latest} available)`, color: PALETTE.warning };
19744
+ return { text: ` (upgrade available v${upgradeCheck.latest})`, color: PALETTE.warning };
19837
19745
  }
19838
19746
  if (upgradeCheck?.status === "up-to-date") {
19839
- return { label: "Upgrade Version (up to date)", color: PALETTE.muted };
19747
+ return { text: " (up to date)", color: PALETTE.muted };
19840
19748
  }
19841
- return { label: "Upgrade Version" };
19749
+ return void 0;
19842
19750
  }
19843
19751
  function HomeScreen({ onNavigate }) {
19844
19752
  const [focusIdx, setFocusIdx] = useState2(0);
@@ -19846,7 +19754,7 @@ function HomeScreen({ onNavigate }) {
19846
19754
  const { exit } = useApp();
19847
19755
  const terminalWidth = useTerminalWidth();
19848
19756
  const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
19849
- const upgradeDisabled = upgradeCheck?.status === "up-to-date";
19757
+ const status = versionStatus(upgradeCheck);
19850
19758
  useEffect2(() => {
19851
19759
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
19852
19760
  }, []);
@@ -19866,7 +19774,6 @@ function HomeScreen({ onNavigate }) {
19866
19774
  }
19867
19775
  if (key.return) {
19868
19776
  const item = START_ITEMS[focusIdx];
19869
- if (item.screen === "upgrade" && upgradeDisabled) return;
19870
19777
  onNavigate(item.screen);
19871
19778
  return;
19872
19779
  }
@@ -19884,26 +19791,16 @@ function HomeScreen({ onNavigate }) {
19884
19791
  /* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
19885
19792
  /* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
19886
19793
  "v",
19887
- VERSION
19794
+ VERSION,
19795
+ status && /* @__PURE__ */ jsx2(Text2, { color: status.color, children: status.text })
19888
19796
  ] })
19889
19797
  ] }),
19890
19798
  /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
19891
19799
  const focused = i === focusIdx;
19892
- const isUpgradeItem = item.screen === "upgrade";
19893
- const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
19894
- const dimmed = isUpgradeItem && upgradeDisabled;
19895
- return /* @__PURE__ */ jsxs(
19896
- Text2,
19897
- {
19898
- bold: focused && !dimmed,
19899
- color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
19900
- children: [
19901
- focused ? `${FOCUS_MARKER} ` : " ",
19902
- display.label
19903
- ]
19904
- },
19800
+ return /* @__PURE__ */ jsxs(Text2, { bold: focused, color: focused ? PALETTE.accent : void 0, children: [
19801
+ focused ? `${FOCUS_MARKER} ` : " ",
19905
19802
  item.label
19906
- );
19803
+ ] }, item.label);
19907
19804
  }) }) }),
19908
19805
  /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
19909
19806
  ControlHints,
@@ -19932,7 +19829,6 @@ var init_home = __esm({
19932
19829
  MIN_TERMINAL_WIDTH = 164;
19933
19830
  START_ITEMS = [
19934
19831
  { label: "Import", screen: "import" },
19935
- { label: "Upgrade Version", screen: "upgrade" },
19936
19832
  { label: "Settings", screen: "settings" },
19937
19833
  { label: "Help", screen: "help" }
19938
19834
  ];
@@ -32365,7 +32261,7 @@ var init_save = __esm({
32365
32261
  writeFile: (path5, contents) => writeFile7(path5, contents),
32366
32262
  appendRun,
32367
32263
  buildSourceFingerprint,
32368
- sleep: (ms) => new Promise((resolve28) => setTimeout(resolve28, ms)),
32264
+ sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
32369
32265
  warn: (message) => process.stderr.write(message)
32370
32266
  });
32371
32267
  }
@@ -32916,48 +32812,13 @@ var init_debug_store = __esm({
32916
32812
  }
32917
32813
  });
32918
32814
 
32919
- // packages/experience-design-system-cli/src/tui/help/file-locations.ts
32920
- import { join as join26, resolve as resolve27 } from "node:path";
32921
- function describeFileLocations({
32922
- contentfulBaseDir,
32923
- debugModeEnabled,
32924
- currentSessionDir: currentSessionDir2
32925
- }) {
32926
- if (!debugModeEnabled) {
32927
- return {
32928
- debugLogs: "none while Debug Mode is off",
32929
- importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
32930
- };
32931
- }
32932
- const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
32933
- const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
32934
- return {
32935
- debugLogs: join26(session, "debug"),
32936
- importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
32937
- };
32938
- }
32939
- var init_file_locations = __esm({
32940
- "packages/experience-design-system-cli/src/tui/help/file-locations.ts"() {
32941
- "use strict";
32942
- }
32943
- });
32944
-
32945
32815
  // packages/experience-design-system-cli/src/tui/help/help-info.ts
32946
32816
  async function readHelpInfo() {
32947
- const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
32948
- const base = settings["contentfulBaseDir"];
32949
- const locations = describeFileLocations({
32950
- contentfulBaseDir: typeof base === "string" ? base : "",
32951
- debugModeEnabled: debugMode.enabled,
32952
- currentSessionDir: currentSessionDir()
32953
- });
32817
+ const debugMode = await readDebugModeSetting();
32954
32818
  return {
32955
32819
  storage: [
32956
32820
  { label: "Config folder", value: configRoot2() },
32957
- { label: "Settings file", value: configFilePath2() },
32958
- { label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
32959
- { label: "Debug logs", value: locations.debugLogs },
32960
- { label: "Import files", value: locations.importFiles }
32821
+ { label: "Settings file", value: configFilePath2() }
32961
32822
  ],
32962
32823
  troubleshooting: [
32963
32824
  { label: "CLI version", value: readPackageVersion() },
@@ -32978,7 +32839,6 @@ var init_help_info = __esm({
32978
32839
  init_debug_store();
32979
32840
  init_debug_mode_store();
32980
32841
  init_version();
32981
- init_file_locations();
32982
32842
  }
32983
32843
  });
32984
32844
 
@@ -32990,7 +32850,7 @@ function Section({ title, rows }) {
32990
32850
  return /* @__PURE__ */ jsxs43(Box42, { flexDirection: "column", children: [
32991
32851
  /* @__PURE__ */ jsx53(Text44, { bold: true, color: PALETTE.accent, children: title }),
32992
32852
  rows.map((row) => /* @__PURE__ */ jsxs43(Box42, { gap: 1, children: [
32993
- /* @__PURE__ */ jsx53(Box42, { width: 16, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
32853
+ /* @__PURE__ */ jsx53(Box42, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx53(Text44, { color: PALETTE.muted, children: row.label }) }),
32994
32854
  /* @__PURE__ */ jsx53(Text44, { children: row.value })
32995
32855
  ] }, row.label))
32996
32856
  ] });
@@ -33105,730 +32965,6 @@ var init_PageContainer3 = __esm({
33105
32965
  }
33106
32966
  });
33107
32967
 
33108
- // packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts
33109
- import { execFile as execFile2 } from "node:child_process";
33110
- import { access as access6, constants } from "node:fs/promises";
33111
- function effectiveBinary(name, savedBinary) {
33112
- return savedBinary.trim() || AGENT_BINARIES[name];
33113
- }
33114
- function defaultModelLabel(name) {
33115
- const model = DEFAULT_MODELS[name];
33116
- return model && model !== "Auto" ? model : "chosen by the agent";
33117
- }
33118
- function resolveOnPath(binary) {
33119
- if (binary.includes("/")) {
33120
- return access6(binary, constants.X_OK).then(
33121
- () => binary,
33122
- () => null
33123
- );
33124
- }
33125
- return new Promise((resolve28) => {
33126
- execFile2(
33127
- process.platform === "win32" ? "where" : "which",
33128
- [binary],
33129
- (error, stdout) => resolve28(error ? null : stdout.split("\n")[0]?.trim() ?? null)
33130
- );
33131
- });
33132
- }
33133
- function readVersion(binary) {
33134
- return new Promise((resolve28) => {
33135
- execFile2(binary, ["--version"], { timeout: VERSION_TIMEOUT_MS }, (error, stdout) => {
33136
- const line = stdout.split("\n")[0]?.trim() ?? "";
33137
- if (!error && line) resolve28(pass("version", line));
33138
- else resolve28(fail3("version", "runs, but did not report a version"));
33139
- });
33140
- });
33141
- }
33142
- async function inspectAgent(name, binary) {
33143
- const target = effectiveBinary(name, binary);
33144
- const found = await resolveOnPath(target);
33145
- if (!found) return [fail3("path", `\`${target}\` was not found or is not executable`)];
33146
- const checks = [pass("path", found)];
33147
- checks.push(await readVersion(found));
33148
- if (name === "claude") {
33149
- const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
33150
- checks.push(
33151
- auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
33152
- );
33153
- }
33154
- return checks;
33155
- }
33156
- async function testAgent(name, binary, model) {
33157
- const checks = await inspectAgent(name, binary);
33158
- if (!checks.every((check) => check.step === "version" || check.ok)) return checks;
33159
- const target = effectiveBinary(name, binary);
33160
- const found = await resolveOnPath(target) ?? target;
33161
- const started = Date.now();
33162
- const result = await withBinaryEnv(
33163
- name,
33164
- found,
33165
- () => createLocalCliAgentInvoker().invoke({
33166
- agent: name,
33167
- ...model.trim() ? { model: model.trim() } : {},
33168
- prompt: TEST_PROMPT,
33169
- timeoutMs: PROMPT_TIMEOUT_MS
33170
- })
33171
- );
33172
- const seconds = ((Date.now() - started) / 1e3).toFixed(1);
33173
- if (result.timedOut) {
33174
- return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
33175
- }
33176
- if (result.exitCode !== 0) {
33177
- const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
33178
- return [...checks, fail3("prompt", reason)];
33179
- }
33180
- return [...checks, pass("prompt", `answered in ${seconds}s`)];
33181
- }
33182
- function statusFromChecks(name, checks, savedBinary) {
33183
- if (checks.length === 0) return "checking";
33184
- if (checks.some((check) => check.step === "path" && !check.ok)) {
33185
- return savedBinary.trim() ? "not-found" : "not-configured";
33186
- }
33187
- const prompt = checks.find((check) => check.step === "prompt");
33188
- if (prompt) {
33189
- if (prompt.ok) return "ready";
33190
- return prompt.timedOut ? "timed-out" : "test-failed";
33191
- }
33192
- const login = checks.find((check) => check.step === "login");
33193
- if (login) return login.ok ? "ready" : "not-logged-in";
33194
- return name === "claude" ? "ready" : "unknown";
33195
- }
33196
- function setupHint(name, status) {
33197
- if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
33198
- if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
33199
- if (status === "not-logged-in") return LOGIN_HINTS[name];
33200
- if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
33201
- if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
33202
- if (status === "unknown") return "run a full test to confirm it is logged in";
33203
- return "";
33204
- }
33205
- function testOutcome(checks) {
33206
- const prompt = checks?.find((check) => check.step === "prompt");
33207
- if (!prompt) return void 0;
33208
- if (prompt.ok) return { ok: true, text: `Test passed: ${prompt.detail}` };
33209
- if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
33210
- return { ok: false, text: `Test failed: ${prompt.detail}` };
33211
- }
33212
- function modelLine(name, savedModel) {
33213
- const model = savedModel.trim();
33214
- return model ? model : `${defaultModelLabel(name)} (built-in default)`;
33215
- }
33216
- function panelRows(name, checks, settings) {
33217
- if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
33218
- const status = statusFromChecks(name, checks, settings.binary);
33219
- const path5 = checks.find((check) => check.step === "path");
33220
- if (!path5?.ok) {
33221
- const rows2 = [
33222
- {
33223
- label: "Command",
33224
- value: settings.binary.trim() ? path5?.detail ?? "not found" : "not found on your PATH",
33225
- tone: settings.binary.trim() ? "bad" : "muted"
33226
- }
33227
- ];
33228
- const hint2 = setupHint(name, status);
33229
- if (hint2) rows2.push({ label: "Setup", value: hint2, tone: "muted" });
33230
- return rows2;
33231
- }
33232
- const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
33233
- const version = checks.find((check) => check.step === "version");
33234
- if (version?.ok) rows.push({ label: "Version", value: version.detail, tone: "ok" });
33235
- rows.push({ label: "Model", value: modelLine(name, settings.model), tone: "muted" });
33236
- const hint = setupHint(name, status);
33237
- if (hint) rows.push({ label: "Setup", value: hint, tone: "muted" });
33238
- return rows;
33239
- }
33240
- function statusRows(_name, checks, savedBinary) {
33241
- if (!checks) return [{ label: "Command", value: "checking...", tone: "muted" }];
33242
- const find = (step) => checks.find((check) => check.step === step);
33243
- const path5 = find("path");
33244
- if (!path5?.ok) {
33245
- if (savedBinary.trim()) return [{ label: "Command", value: path5?.detail ?? "not found", tone: "bad" }];
33246
- return [{ label: "Command", value: "not configured (not on the PATH)", tone: "muted" }];
33247
- }
33248
- const rows = [{ label: "Command", value: path5.detail, tone: "ok" }];
33249
- const version = find("version");
33250
- if (version) {
33251
- rows.push({
33252
- label: "Version",
33253
- value: version.ok ? version.detail : "could not be read",
33254
- tone: version.ok ? "ok" : "muted"
33255
- });
33256
- }
33257
- const login = find("login");
33258
- const prompt = find("prompt");
33259
- if (login) {
33260
- rows.push({ label: "Login", value: login.detail, tone: login.ok ? "ok" : "bad" });
33261
- } else if (prompt) {
33262
- rows.push({
33263
- label: "Login",
33264
- value: prompt.ok ? "confirmed by the test" : prompt.timedOut ? "unknown (the test timed out)" : "see the test result",
33265
- tone: prompt.ok ? "ok" : prompt.timedOut ? "muted" : "bad"
33266
- });
33267
- } else {
33268
- rows.push({ label: "Login", value: "not checked (use Run test)", tone: "muted" });
33269
- }
33270
- if (prompt) rows.push({ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" });
33271
- return rows;
33272
- }
33273
- async function withBinaryEnv(name, binary, run) {
33274
- const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
33275
- const previous = process.env[key];
33276
- process.env[key] = binary;
33277
- try {
33278
- return await run();
33279
- } finally {
33280
- if (previous === void 0) delete process.env[key];
33281
- else process.env[key] = previous;
33282
- }
33283
- }
33284
- var VERSION_TIMEOUT_MS, PROMPT_TIMEOUT_MS, TEST_PROMPT, INSTALL_HINTS, LOGIN_HINTS, fail3, pass, LIST_STATUS;
33285
- var init_agent_status = __esm({
33286
- "packages/experience-design-system-cli/src/tui/settings/agents/agent-status.ts"() {
33287
- "use strict";
33288
- init_src4();
33289
- VERSION_TIMEOUT_MS = 5e3;
33290
- PROMPT_TIMEOUT_MS = 6e4;
33291
- TEST_PROMPT = "Reply with the single word: ok";
33292
- INSTALL_HINTS = {
33293
- claude: "npm install -g @anthropic-ai/claude-code",
33294
- codex: "npm install -g @openai/codex",
33295
- opencode: "npm install -g opencode-ai",
33296
- cursor: "install Cursor\u2019s `cursor-agent` command",
33297
- copilot: "npm install -g @github/copilot"
33298
- };
33299
- LOGIN_HINTS = {
33300
- claude: "run `claude login`",
33301
- codex: "set OPENAI_API_KEY, or sign in with a ChatGPT account",
33302
- opencode: "run `opencode auth`",
33303
- cursor: "sign in from Cursor",
33304
- copilot: "run `copilot` and sign in"
33305
- };
33306
- fail3 = (step, detail) => ({ step, ok: false, detail });
33307
- pass = (step, detail) => ({ step, ok: true, detail });
33308
- LIST_STATUS = {
33309
- checking: { symbol: "\u2026", text: "checking", tone: "muted" },
33310
- ready: { symbol: "\u25CF", text: "ready", tone: "ok" },
33311
- "not-configured": { symbol: "\u25CB", text: "not installed", tone: "muted" },
33312
- "not-found": { symbol: "\u25CB", text: "not installed", tone: "bad" },
33313
- "not-logged-in": { symbol: "\u25D0", text: "not logged in", tone: "bad" },
33314
- "test-failed": { symbol: "\u2717", text: "test failed", tone: "bad" },
33315
- "timed-out": { symbol: "\u2717", text: "test timed out", tone: "bad" },
33316
- unknown: { symbol: "\u25D0", text: "installed, login unknown", tone: "muted" }
33317
- };
33318
- }
33319
- });
33320
-
33321
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx
33322
- import { Text as Text46 } from "ink";
33323
- import { jsx as jsx55 } from "react/jsx-runtime";
33324
- function AgentStatusBadge({
33325
- name,
33326
- checks,
33327
- binary
33328
- }) {
33329
- const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
33330
- return /* @__PURE__ */ jsx55(Text46, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
33331
- }
33332
- var TONE_COLOR;
33333
- var init_AgentStatusBadge = __esm({
33334
- "packages/experience-design-system-cli/src/tui/settings/agents/AgentStatusBadge.tsx"() {
33335
- "use strict";
33336
- init_theme();
33337
- init_agent_status();
33338
- TONE_COLOR = {
33339
- ok: PALETTE.success,
33340
- bad: PALETTE.error,
33341
- muted: PALETTE.muted
33342
- };
33343
- }
33344
- });
33345
-
33346
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx
33347
- import { useEffect as useEffect22, useState as useState29 } from "react";
33348
- import { Box as Box44, Text as Text47, useInput as useInput11 } from "ink";
33349
- import TextInput4 from "ink-text-input";
33350
- import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
33351
- function Row2({
33352
- pointer,
33353
- label,
33354
- labelProps,
33355
- children
33356
- }) {
33357
- return /* @__PURE__ */ jsxs45(Box44, { children: [
33358
- /* @__PURE__ */ jsx56(Box44, { width: POINTER_WIDTH, flexShrink: 0, children: pointer }),
33359
- /* @__PURE__ */ jsx56(Box44, { width: LABEL_WIDTH + LABEL_GAP, flexShrink: 0, children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, ...labelProps, children: label }) }),
33360
- children
33361
- ] });
33362
- }
33363
- function Section2({
33364
- title,
33365
- note,
33366
- interactive = false,
33367
- children
33368
- }) {
33369
- return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", marginTop: 1, children: [
33370
- /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
33371
- /* @__PURE__ */ jsx56(Text47, { bold: true, color: interactive ? PALETTE.accent : PALETTE.muted, children: title }),
33372
- /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: `\xB7 ${note}` })
33373
- ] }),
33374
- children
33375
- ] });
33376
- }
33377
- function AgentDetail({
33378
- name,
33379
- config,
33380
- setConfig,
33381
- onBack
33382
- }) {
33383
- const settings = config.agents[name];
33384
- const [focusIndex, setFocusIndex] = useState29(0);
33385
- const [editing, setEditing] = useState29(false);
33386
- const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
33387
- const [saving, setSaving] = useState29(false);
33388
- const [testing, setTesting] = useState29(false);
33389
- const [notice, setNotice] = useState29(null);
33390
- const [checks, setChecks] = useState29(void 0);
33391
- useEffect22(() => {
33392
- let active = true;
33393
- setChecks(void 0);
33394
- void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
33395
- return () => {
33396
- active = false;
33397
- };
33398
- }, [name, settings.binary]);
33399
- const setField = (field, value) => {
33400
- setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [field]: value } } });
33401
- setNotice(null);
33402
- };
33403
- const save = () => {
33404
- setSaving(true);
33405
- setNotice(null);
33406
- writeAgentConfig(config).then(() => {
33407
- applyBinaryOverrides(config);
33408
- setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
33409
- }).catch(
33410
- (err) => setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` })
33411
- ).finally(() => setSaving(false));
33412
- };
33413
- const runTest = () => {
33414
- setTesting(true);
33415
- setNotice(null);
33416
- testAgent(name, settings.binary, settings.model).then((result) => {
33417
- setChecks(result);
33418
- const outcome = testOutcome(result);
33419
- setNotice(
33420
- outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
33421
- );
33422
- }).catch(
33423
- (err) => setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` })
33424
- ).finally(() => setTesting(false));
33425
- };
33426
- const focused = FOCUS_ORDER[focusIndex];
33427
- const focusedField = focused === "test" ? null : focused;
33428
- useInput11((input, key) => {
33429
- if (saving || testing) return;
33430
- if (editing) {
33431
- if (key.escape && focusedField) {
33432
- setField(focusedField, valueBeforeEdit);
33433
- setEditing(false);
33434
- }
33435
- return;
33436
- }
33437
- if (key.escape || input === "q") {
33438
- onBack();
33439
- return;
33440
- }
33441
- if (input === "s") {
33442
- save();
33443
- return;
33444
- }
33445
- if (key.upArrow) {
33446
- setFocusIndex((i) => (i - 1 + FOCUS_ORDER.length) % FOCUS_ORDER.length);
33447
- return;
33448
- }
33449
- if (key.downArrow || key.tab) {
33450
- setFocusIndex((i) => (i + 1) % FOCUS_ORDER.length);
33451
- return;
33452
- }
33453
- if (input === "c" && focusedField) {
33454
- setField(focusedField, "");
33455
- return;
33456
- }
33457
- if (key.return) {
33458
- if (focusedField) {
33459
- setValueBeforeEdit(settings[focusedField]);
33460
- setEditing(true);
33461
- } else {
33462
- runTest();
33463
- }
33464
- }
33465
- });
33466
- const status = checks ? statusFromChecks(name, checks, settings.binary) : "checking";
33467
- const hint = setupHint(name, status);
33468
- const pointer = (isFocused) => /* @__PURE__ */ jsx56(Text47, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " });
33469
- return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33470
- /* @__PURE__ */ jsx56(Text47, { bold: true, children: AGENT_LABELS[name] }),
33471
- /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_HINTS[name]}\` command.` }),
33472
- (notice || testing || saving) && /* @__PURE__ */ jsx56(Box44, { marginTop: 1, children: testing || saving ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.accent, children: testing ? "\u2026 Running the test (up to 60s)" : "\u2026 Saving" }) : notice && /* @__PURE__ */ jsxs45(Text47, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
33473
- notice.kind === "success" ? "\u2713" : "\u2717",
33474
- " ",
33475
- notice.text
33476
- ] }) }),
33477
- /* @__PURE__ */ jsxs45(Section2, { title: "CONFIGURE", note: "you can change these", interactive: true, children: [
33478
- FIELDS2.map((field) => {
33479
- const isFocused = focused === field;
33480
- const value = settings[field];
33481
- const display = isFocused && editing ? /* @__PURE__ */ jsx56(TextInput4, { value, onChange: (next) => setField(field, next), onSubmit: () => setEditing(false) }) : value ? /* @__PURE__ */ jsx56(Text47, { bold: true, children: value }) : /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: fieldHint(name, field) });
33482
- return /* @__PURE__ */ jsx56(
33483
- Row2,
33484
- {
33485
- pointer: pointer(isFocused),
33486
- label: FIELD_LABEL[field],
33487
- labelProps: { bold: isFocused, color: isFocused ? PALETTE.accent : PALETTE.muted },
33488
- children: display
33489
- },
33490
- field
33491
- );
33492
- }),
33493
- /* @__PURE__ */ jsx56(
33494
- Row2,
33495
- {
33496
- pointer: pointer(focused === "test"),
33497
- label: "Run test",
33498
- labelProps: { bold: focused === "test", color: focused === "test" ? PALETTE.accent : PALETTE.muted },
33499
- children: /* @__PURE__ */ jsx56(Text47, { color: testing ? PALETTE.accent : PALETTE.muted, children: testing ? "running..." : "sends one small prompt (uses a few tokens)" })
33500
- }
33501
- )
33502
- ] }),
33503
- /* @__PURE__ */ jsxs45(Section2, { title: "STATUS", note: "read only", children: [
33504
- statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx56(Row2, { pointer: null, label: row.label, children: /* @__PURE__ */ jsx56(Text47, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label)),
33505
- hint && /* @__PURE__ */ jsx56(Row2, { pointer: null, label: "Setup", children: /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: hint }) })
33506
- ] }),
33507
- /* @__PURE__ */ jsx56(Text47, { children: " " }),
33508
- /* @__PURE__ */ jsx56(
33509
- ControlHints,
33510
- {
33511
- hints: editing ? [
33512
- { keys: "type", label: "edit" },
33513
- { keys: "\u2190/\u2192", label: "move cursor" },
33514
- { keys: "\u23CE", label: "done" },
33515
- { keys: "Esc", label: "cancel edit" }
33516
- ] : [
33517
- { keys: "\u2191/\u2193", label: "move" },
33518
- { keys: "\u23CE", label: focusedField ? "edit" : "run test" },
33519
- ...focusedField ? [{ keys: "c", label: "clear" }] : [],
33520
- { keys: "s", label: "save" },
33521
- { keys: "Esc/q", label: "back without saving" }
33522
- ]
33523
- }
33524
- )
33525
- ] });
33526
- }
33527
- var FOCUS_ORDER, FIELDS2, FIELD_LABEL, LABEL_WIDTH, LABEL_GAP, POINTER_WIDTH, fieldHint;
33528
- var init_AgentDetail = __esm({
33529
- "packages/experience-design-system-cli/src/tui/settings/agents/AgentDetail.tsx"() {
33530
- "use strict";
33531
- init_theme();
33532
- init_control_hints();
33533
- init_agent_store();
33534
- init_agent_status();
33535
- init_AgentStatusBadge();
33536
- init_apply_binary_overrides();
33537
- FOCUS_ORDER = ["binary", "model", "test"];
33538
- FIELDS2 = ["binary", "model"];
33539
- FIELD_LABEL = { binary: "Command path", model: "Model" };
33540
- LABEL_WIDTH = "Command path".length;
33541
- LABEL_GAP = 2;
33542
- POINTER_WIDTH = 2;
33543
- fieldHint = (name, field) => field === "binary" ? `(empty: \`${AGENT_HINTS[name]}\` from the PATH)` : `(empty: ${defaultModelLabel(name)})`;
33544
- }
33545
- });
33546
-
33547
- // packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx
33548
- import { useEffect as useEffect23, useState as useState30 } from "react";
33549
- import { Box as Box45, Text as Text48, useInput as useInput12 } from "ink";
33550
- import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33551
- function AgentsScreen({ onDone }) {
33552
- const [config, setConfig] = useState30(null);
33553
- const [focus, setFocus] = useState30(0);
33554
- const [open, setOpen] = useState30(null);
33555
- const [notice, setNotice] = useState30(null);
33556
- const [saving, setSaving] = useState30(false);
33557
- const [checks, setChecks] = useState30({});
33558
- const inspectAll = (loaded) => {
33559
- for (const name of AGENT_NAMES) {
33560
- void inspectAgent(name, loaded.agents[name].binary).then(
33561
- (result) => setChecks((previous) => ({ ...previous, [name]: result }))
33562
- );
33563
- }
33564
- };
33565
- useEffect23(() => {
33566
- void readAgentConfig().then((loaded) => {
33567
- setConfig(loaded);
33568
- inspectAll(loaded);
33569
- startDebugRun({
33570
- flow: "settings/agents",
33571
- step: "01-agents",
33572
- menuOption: "Configuration > Agents",
33573
- inputs: { default_agent: loaded.defaultAgent }
33574
- });
33575
- });
33576
- }, []);
33577
- const makeDefault = (name) => {
33578
- if (!config || saving) return;
33579
- if (name === config.defaultAgent) {
33580
- setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
33581
- return;
33582
- }
33583
- setSaving(true);
33584
- setNotice(null);
33585
- writeAgentConfig({ ...config, defaultAgent: name }).then(() => {
33586
- setConfig((current) => current ? { ...current, defaultAgent: name } : current);
33587
- setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
33588
- }).catch(
33589
- (err) => setNotice({
33590
- kind: "error",
33591
- text: `Default agent not changed: ${err instanceof Error ? err.message : String(err)}`
33592
- })
33593
- ).finally(() => setSaving(false));
33594
- };
33595
- useInput12((input, key) => {
33596
- if (!config || open || saving) return;
33597
- const focused = AGENT_NAMES[focus];
33598
- if (key.upArrow || key.downArrow || key.tab) setNotice(null);
33599
- if (key.upArrow) {
33600
- setFocus((i) => (i - 1 + AGENT_NAMES.length) % AGENT_NAMES.length);
33601
- return;
33602
- }
33603
- if (key.downArrow || key.tab) {
33604
- setFocus((i) => (i + 1) % AGENT_NAMES.length);
33605
- return;
33606
- }
33607
- if (key.return) {
33608
- makeDefault(focused);
33609
- return;
33610
- }
33611
- if (key.rightArrow) {
33612
- setNotice(null);
33613
- setOpen(focused);
33614
- return;
33615
- }
33616
- if (key.escape || input === "q") {
33617
- void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
33618
- onDone();
33619
- }
33620
- });
33621
- if (!config) {
33622
- return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33623
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
33624
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
33625
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "Loading..." })
33626
- ] });
33627
- }
33628
- if (open) {
33629
- return /* @__PURE__ */ jsx57(
33630
- AgentDetail,
33631
- {
33632
- name: open,
33633
- config,
33634
- setConfig,
33635
- onBack: () => {
33636
- setOpen(null);
33637
- void readAgentConfig().then((saved) => {
33638
- setConfig(saved);
33639
- inspectAll(saved);
33640
- });
33641
- }
33642
- }
33643
- );
33644
- }
33645
- const focusedAgent = AGENT_NAMES[focus];
33646
- return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33647
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Agents" }),
33648
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "The coding agent the CLI runs, and what was found for each one." }),
33649
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
33650
- /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
33651
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Default agent" }),
33652
- /* @__PURE__ */ jsx57(Text48, { bold: true, children: AGENT_LABELS[config.defaultAgent] }),
33653
- saving && /* @__PURE__ */ jsx57(Text48, { color: PALETTE.accent, children: "\u2026 saving" })
33654
- ] }),
33655
- /* @__PURE__ */ jsxs46(Box45, { marginTop: 1, gap: 1, children: [
33656
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
33657
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
33658
- /* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "AGENT" }) }),
33659
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "STATUS" })
33660
- ] }),
33661
- AGENT_NAMES.map((name) => {
33662
- const isFocused = focusedAgent === name;
33663
- return /* @__PURE__ */ jsxs46(Box45, { gap: 1, children: [
33664
- /* @__PURE__ */ jsx57(Text48, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
33665
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
33666
- /* @__PURE__ */ jsx57(Box45, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
33667
- /* @__PURE__ */ jsx57(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
33668
- ] }, name);
33669
- }),
33670
- /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", marginTop: 1, children: [
33671
- /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
33672
- panelRows(focusedAgent, checks[focusedAgent], config.agents[focusedAgent]).map((row) => /* @__PURE__ */ jsxs46(Box45, { gap: 1, paddingLeft: 1, children: [
33673
- /* @__PURE__ */ jsx57(Box45, { width: PANEL_LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: row.label }) }),
33674
- /* @__PURE__ */ jsx57(Text48, { color: TONE_COLOR[row.tone], children: row.value })
33675
- ] }, row.label))
33676
- ] }),
33677
- notice && /* @__PURE__ */ jsxs46(Fragment17, { children: [
33678
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
33679
- /* @__PURE__ */ jsxs46(Text48, { bold: true, color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
33680
- notice.kind === "success" ? "\u2713" : "\u2717",
33681
- " ",
33682
- notice.text
33683
- ] })
33684
- ] }),
33685
- /* @__PURE__ */ jsx57(Text48, { children: " " }),
33686
- /* @__PURE__ */ jsx57(
33687
- ControlHints,
33688
- {
33689
- hints: [
33690
- { keys: "\u2191/\u2193", label: "move" },
33691
- { keys: "\u23CE", label: "make default" },
33692
- { keys: "\u2192", label: "settings and test" },
33693
- { keys: "Esc/q", label: "back" }
33694
- ]
33695
- }
33696
- )
33697
- ] });
33698
- }
33699
- var NAME_WIDTH, PANEL_LABEL_WIDTH;
33700
- var init_AgentScreens = __esm({
33701
- "packages/experience-design-system-cli/src/tui/settings/agents/AgentScreens.tsx"() {
33702
- "use strict";
33703
- init_src4();
33704
- init_theme();
33705
- init_control_hints();
33706
- init_debug_store();
33707
- init_agent_store();
33708
- init_agent_status();
33709
- init_AgentDetail();
33710
- init_AgentStatusBadge();
33711
- NAME_WIDTH = 16;
33712
- PANEL_LABEL_WIDTH = "Command".length;
33713
- }
33714
- });
33715
-
33716
- // packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx
33717
- import { useState as useState31 } from "react";
33718
- import { Box as Box46, Text as Text49, useInput as useInput13 } from "ink";
33719
- import TextInput5 from "ink-text-input";
33720
- import { Fragment as Fragment18, jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
33721
- function FieldForm({
33722
- title,
33723
- subtitle,
33724
- fields,
33725
- values,
33726
- onChange,
33727
- onSave,
33728
- onQuit,
33729
- notice,
33730
- busy = false,
33731
- footer
33732
- }) {
33733
- const [active, setActive] = useState31(0);
33734
- const [editing, setEditing] = useState31(false);
33735
- const [valueBeforeEdit, setValueBeforeEdit] = useState31("");
33736
- const labelWidth = Math.max(...fields.map((field) => field.label.length));
33737
- const current = fields[active];
33738
- useInput13((input, key) => {
33739
- if (busy) return;
33740
- if (editing) {
33741
- if (key.escape) {
33742
- onChange(current.key, valueBeforeEdit);
33743
- setEditing(false);
33744
- }
33745
- return;
33746
- }
33747
- if (key.escape || input === "q") {
33748
- onQuit();
33749
- return;
33750
- }
33751
- if (input === "s") {
33752
- onSave();
33753
- return;
33754
- }
33755
- if (input === "c") {
33756
- onChange(current.key, "");
33757
- return;
33758
- }
33759
- if (key.tab || key.downArrow) {
33760
- setActive((i) => (i + 1) % fields.length);
33761
- return;
33762
- }
33763
- if (key.upArrow) {
33764
- setActive((i) => (i - 1 + fields.length) % fields.length);
33765
- return;
33766
- }
33767
- if (key.return) {
33768
- setValueBeforeEdit(values[current.key]);
33769
- setEditing(true);
33770
- }
33771
- });
33772
- return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33773
- /* @__PURE__ */ jsx58(Text49, { bold: true, children: title }),
33774
- subtitle && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: subtitle }),
33775
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
33776
- /* @__PURE__ */ jsx58(Box46, { flexDirection: "column", children: fields.map((field, index) => {
33777
- const isActive = index === active;
33778
- const value = values[field.key];
33779
- const display = field.masked ? "\u2022".repeat(value.length) : value;
33780
- return /* @__PURE__ */ jsxs47(Box46, { gap: 1, children: [
33781
- /* @__PURE__ */ jsx58(Text49, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
33782
- /* @__PURE__ */ jsx58(Box46, { width: labelWidth, flexShrink: 0, children: /* @__PURE__ */ jsx58(Text49, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: field.label }) }),
33783
- isActive && editing ? /* @__PURE__ */ jsx58(
33784
- TextInput5,
33785
- {
33786
- value,
33787
- onChange: (next) => onChange(field.key, next),
33788
- onSubmit: () => setEditing(false),
33789
- mask: field.masked ? "\u2022" : void 0
33790
- }
33791
- ) : /* @__PURE__ */ jsx58(Text49, { bold: !!display, children: display || (field.hint ? "" : /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: "(empty)" })) }),
33792
- field.hint && /* @__PURE__ */ jsx58(Text49, { color: PALETTE.muted, children: field.hint })
33793
- ] }, field.key);
33794
- }) }),
33795
- notice && /* @__PURE__ */ jsxs47(Fragment18, { children: [
33796
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
33797
- /* @__PURE__ */ jsxs47(Text49, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
33798
- notice.kind === "success" ? "\u2713" : "\u2717",
33799
- " ",
33800
- notice.text
33801
- ] })
33802
- ] }),
33803
- footer,
33804
- /* @__PURE__ */ jsx58(Text49, { children: " " }),
33805
- /* @__PURE__ */ jsx58(
33806
- ControlHints,
33807
- {
33808
- hints: editing ? [
33809
- { keys: "type", label: "edit" },
33810
- { keys: "\u2190/\u2192", label: "move cursor" },
33811
- { keys: "\u23CE", label: "done" },
33812
- { keys: "Esc", label: "cancel edit" }
33813
- ] : [
33814
- { keys: "\u2191/\u2193", label: "move" },
33815
- { keys: "\u23CE", label: "edit" },
33816
- { keys: "c", label: "clear" },
33817
- { keys: "s", label: "save" },
33818
- { keys: "Esc/q", label: "back without saving" }
33819
- ]
33820
- }
33821
- )
33822
- ] });
33823
- }
33824
- var init_FieldForm = __esm({
33825
- "packages/experience-design-system-cli/src/tui/settings/shared/FieldForm.tsx"() {
33826
- "use strict";
33827
- init_theme();
33828
- init_control_hints();
33829
- }
33830
- });
33831
-
33832
32968
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
33833
32969
  async function readCredentials() {
33834
32970
  const store = await readV1Store();
@@ -33860,10 +32996,11 @@ var init_config_store = __esm({
33860
32996
  }
33861
32997
  });
33862
32998
 
33863
- // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx
33864
- import { useEffect as useEffect24, useState as useState32 } from "react";
33865
- import { Box as Box47, Text as Text50 } from "ink";
33866
- import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
32999
+ // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
33000
+ import { useEffect as useEffect22, useState as useState29 } from "react";
33001
+ import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
33002
+ import TextInput4 from "ink-text-input";
33003
+ import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
33867
33004
  function debugFields(config) {
33868
33005
  return {
33869
33006
  space_id: config?.spaceId ?? "",
@@ -33875,159 +33012,189 @@ function debugFields(config) {
33875
33012
  contentful_base_dir: config?.contentfulBaseDir ?? ""
33876
33013
  };
33877
33014
  }
33878
- function ProjectConfigScreen({ onDone }) {
33879
- const [config, setConfig] = useState32(null);
33880
- const [saving, setSaving] = useState32(false);
33881
- const [notice, setNotice] = useState32(null);
33882
- const [lastSaved, setLastSaved] = useState32(null);
33883
- useEffect24(() => {
33884
- void readCredentials().then((cfg) => {
33015
+ function ConfigurationScreen({ onDone }) {
33016
+ const [stage, setStage] = useState29("loading");
33017
+ const [config, setConfig] = useState29(null);
33018
+ const [activeField, setActiveField] = useState29("spaceId");
33019
+ const [notice, setNotice] = useState29(null);
33020
+ const [lastSaved, setLastSaved] = useState29(null);
33021
+ const [editing, setEditing] = useState29(false);
33022
+ const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
33023
+ useEffect22(() => {
33024
+ readCredentials().then((cfg) => {
33885
33025
  setConfig(cfg);
33026
+ setStage("form");
33886
33027
  startDebugRun({
33887
33028
  flow: "settings/contentful-configuration",
33888
33029
  step: "01-configuration",
33889
- menuOption: "Configuration > Project",
33030
+ menuOption: "Configuration",
33890
33031
  inputs: debugFields(cfg)
33891
33032
  });
33892
33033
  });
33893
33034
  }, []);
33894
- if (!config) {
33895
- return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33896
- /* @__PURE__ */ jsx59(Text50, { bold: true, children: "Project" }),
33897
- /* @__PURE__ */ jsx59(Text50, { children: " " }),
33898
- /* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
33899
- ] });
33035
+ function fieldValue(field) {
33036
+ if (!config) return "";
33037
+ return config[field] || "";
33038
+ }
33039
+ function setFieldValue(field, value) {
33040
+ if (!config) return;
33041
+ setConfig({ ...config, [field]: value });
33042
+ setNotice(null);
33900
33043
  }
33901
- const save = () => {
33902
- setSaving(true);
33044
+ function handleSave() {
33045
+ if (!config) return;
33046
+ setStage("saving");
33903
33047
  setNotice(null);
33904
33048
  writeCredentials(config).then(() => {
33905
33049
  setLastSaved(config);
33906
33050
  if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
33907
- setNotice({ kind: "success", text: "Project settings saved" });
33051
+ setNotice({ kind: "success", text: "Configuration saved" });
33052
+ setStage("form");
33908
33053
  }).catch((err) => {
33909
33054
  setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
33910
- }).finally(() => setSaving(false));
33911
- };
33912
- const quit = () => {
33055
+ setStage("form");
33056
+ });
33057
+ }
33058
+ function quit() {
33913
33059
  void finishDebugRun(
33914
33060
  lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
33915
33061
  );
33916
33062
  onDone();
33917
- };
33918
- return /* @__PURE__ */ jsx59(
33919
- FieldForm,
33920
- {
33921
- title: "Project",
33922
- subtitle: "The Contentful space and where the CLI keeps its files.",
33923
- fields: FIELDS3,
33924
- values: valuesOf(config),
33925
- onChange: (key, value) => {
33926
- setConfig({ ...config, [key]: value });
33927
- setNotice(null);
33928
- },
33929
- onSave: save,
33930
- onQuit: quit,
33931
- notice,
33932
- busy: saving
33933
- }
33934
- );
33935
- }
33936
- var FIELDS3, valuesOf;
33937
- var init_ProjectConfigScreen = __esm({
33938
- "packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ProjectConfigScreen.tsx"() {
33939
- "use strict";
33940
- init_theme();
33941
- init_debug_store();
33942
- init_FieldForm();
33943
- init_config_store();
33944
- FIELDS3 = [
33945
- { key: "spaceId", label: "Space ID" },
33946
- { key: "environmentId", label: "Environment ID" },
33947
- { key: "cmaToken", label: "CMA Token", masked: true },
33948
- { key: "host", label: "API Host" },
33949
- { key: "defaultComponentDir", label: "Default component directory" },
33950
- { key: "defaultTokenFile", label: "Default token file" },
33951
- { key: "contentfulBaseDir", label: "Root Project Directory", hint: "(where .contentful goes)" }
33952
- ];
33953
- valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
33954
33063
  }
33955
- });
33956
-
33957
- // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
33958
- import { useState as useState33 } from "react";
33959
- import { Box as Box48, Text as Text51, useInput as useInput14 } from "ink";
33960
- import { jsx as jsx60, jsxs as jsxs49 } from "react/jsx-runtime";
33961
- function ConfigurationScreen({ onDone }) {
33962
- const [focus, setFocus] = useState33(0);
33963
- const [open, setOpen] = useState33(null);
33964
- const close = () => setOpen(null);
33965
- useInput14((input, key) => {
33966
- if (open) return;
33967
- if (key.upArrow) {
33968
- setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
33064
+ useInput11((input, key) => {
33065
+ if (stage === "loading" || stage === "saving") return;
33066
+ if (editing) {
33067
+ if (key.escape) {
33068
+ setFieldValue(activeField, valueBeforeEdit);
33069
+ setEditing(false);
33070
+ }
33969
33071
  return;
33970
33072
  }
33971
- if (key.downArrow || key.tab) {
33972
- setFocus((i) => (i + 1) % SECTIONS.length);
33073
+ if (key.escape || input === "q") {
33074
+ quit();
33973
33075
  return;
33974
33076
  }
33975
- if (key.return) {
33976
- setOpen(SECTIONS[focus].id);
33077
+ if (input === "s") {
33078
+ handleSave();
33079
+ return;
33080
+ }
33081
+ if (input === "c") {
33082
+ setFieldValue(activeField, "");
33083
+ return;
33084
+ }
33085
+ if (key.tab || key.downArrow) {
33086
+ const idx = FIELD_ORDER.indexOf(activeField);
33087
+ setActiveField(FIELD_ORDER[(idx + 1) % FIELD_ORDER.length]);
33088
+ return;
33089
+ }
33090
+ if (key.upArrow) {
33091
+ const idx = FIELD_ORDER.indexOf(activeField);
33092
+ setActiveField(FIELD_ORDER[(idx - 1 + FIELD_ORDER.length) % FIELD_ORDER.length]);
33977
33093
  return;
33978
33094
  }
33979
- if (key.escape || input === "q") onDone();
33095
+ if (key.return) {
33096
+ setValueBeforeEdit(fieldValue(activeField));
33097
+ setEditing(true);
33098
+ }
33980
33099
  });
33981
- if (open === "project") return /* @__PURE__ */ jsx60(ProjectConfigScreen, { onDone: close });
33982
- if (open === "agents") return /* @__PURE__ */ jsx60(AgentsScreen, { onDone: close });
33983
- return /* @__PURE__ */ jsxs49(Box48, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33984
- /* @__PURE__ */ jsx60(Text51, { bold: true, children: "Configuration" }),
33985
- /* @__PURE__ */ jsx60(Text51, { children: " " }),
33986
- SECTIONS.map((section, index) => /* @__PURE__ */ jsxs49(Box48, { gap: 1, children: [
33987
- /* @__PURE__ */ jsx60(Text51, { color: index === focus ? PALETTE.accent : void 0, children: index === focus ? "\u276F" : " " }),
33988
- /* @__PURE__ */ jsx60(Box48, { width: 9, flexShrink: 0, children: /* @__PURE__ */ jsx60(Text51, { bold: index === focus, color: index === focus ? PALETTE.accent : void 0, children: section.label }) }),
33989
- /* @__PURE__ */ jsx60(Text51, { color: PALETTE.muted, children: section.description })
33990
- ] }, section.id)),
33991
- /* @__PURE__ */ jsx60(Text51, { children: " " }),
33992
- /* @__PURE__ */ jsx60(
33100
+ if (stage === "loading") {
33101
+ return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33102
+ /* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
33103
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
33104
+ /* @__PURE__ */ jsx55(Text46, { color: PALETTE.accent, children: "Loading..." })
33105
+ ] });
33106
+ }
33107
+ return /* @__PURE__ */ jsxs45(Box44, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33108
+ /* @__PURE__ */ jsx55(Text46, { bold: true, children: "Configuration" }),
33109
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
33110
+ /* @__PURE__ */ jsx55(Box44, { flexDirection: "column", children: FIELD_ORDER.map((field) => {
33111
+ const isActive = activeField === field;
33112
+ const value = fieldValue(field);
33113
+ const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
33114
+ return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
33115
+ /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
33116
+ /* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
33117
+ isActive && editing ? /* @__PURE__ */ jsx55(
33118
+ TextInput4,
33119
+ {
33120
+ value,
33121
+ onChange: (next) => setFieldValue(field, next),
33122
+ onSubmit: () => setEditing(false),
33123
+ mask: field === "cmaToken" ? "\u2022" : void 0
33124
+ }
33125
+ ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
33126
+ FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
33127
+ ] }, field);
33128
+ }) }),
33129
+ notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
33130
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
33131
+ /* @__PURE__ */ jsxs45(Text46, { color: notice.kind === "success" ? PALETTE.success : PALETTE.error, children: [
33132
+ notice.kind === "success" ? "\u2713" : "\u2717",
33133
+ " ",
33134
+ notice.text
33135
+ ] })
33136
+ ] }),
33137
+ /* @__PURE__ */ jsx55(Text46, { children: " " }),
33138
+ /* @__PURE__ */ jsx55(
33993
33139
  ControlHints,
33994
33140
  {
33995
- hints: [
33141
+ hints: editing ? [
33142
+ { keys: "type", label: "edit" },
33143
+ { keys: "\u2190/\u2192", label: "move cursor" },
33144
+ { keys: "\u23CE", label: "done" },
33145
+ { keys: "Esc", label: "cancel edit" }
33146
+ ] : [
33996
33147
  { keys: "\u2191/\u2193", label: "move" },
33997
- { keys: "\u23CE", label: "open" },
33998
- { keys: "Esc/q", label: "back" }
33148
+ { keys: "\u23CE", label: "edit" },
33149
+ { keys: "c", label: "clear" },
33150
+ { keys: "s", label: "save" },
33151
+ { keys: "Esc/q", label: "quit without saving" }
33999
33152
  ]
34000
33153
  }
34001
33154
  )
34002
33155
  ] });
34003
33156
  }
34004
- var SECTIONS;
33157
+ var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
34005
33158
  var init_ContentfulConfigScreen = __esm({
34006
33159
  "packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
34007
33160
  "use strict";
34008
33161
  init_theme();
33162
+ init_config_store();
33163
+ init_debug_store();
34009
33164
  init_control_hints();
34010
- init_AgentScreens();
34011
- init_ProjectConfigScreen();
34012
- SECTIONS = [
34013
- {
34014
- id: "project",
34015
- label: "Project",
34016
- description: "Contentful space, credentials, defaults and where .contentful goes"
34017
- },
34018
- { id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
33165
+ FIELD_ORDER = [
33166
+ "spaceId",
33167
+ "environmentId",
33168
+ "cmaToken",
33169
+ "host",
33170
+ "defaultComponentDir",
33171
+ "defaultTokenFile",
33172
+ "contentfulBaseDir"
34019
33173
  ];
33174
+ FIELD_LABELS = {
33175
+ spaceId: "Space ID",
33176
+ environmentId: "Environment ID",
33177
+ cmaToken: "CMA Token",
33178
+ host: "API Host",
33179
+ defaultComponentDir: "Default component directory",
33180
+ defaultTokenFile: "Default token file",
33181
+ contentfulBaseDir: "Root Project Directory"
33182
+ };
33183
+ FIELD_HINTS = {
33184
+ contentfulBaseDir: "(where .contentful goes)"
33185
+ };
33186
+ LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
34020
33187
  }
34021
33188
  });
34022
33189
 
34023
33190
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34024
- import { useEffect as useEffect25, useState as useState34 } from "react";
34025
- import { Box as Box49, Text as Text52, useInput as useInput15 } from "ink";
34026
- import { Fragment as Fragment19, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
33191
+ import { useEffect as useEffect23, useState as useState30 } from "react";
33192
+ import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
33193
+ import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
34027
33194
  function OptInAnalyticsScreen({ onDone }) {
34028
- const [loading, setLoading] = useState34(true);
34029
- const [enabled, setEnabled] = useState34(true);
34030
- useEffect25(() => {
33195
+ const [loading, setLoading] = useState30(true);
33196
+ const [enabled, setEnabled] = useState30(true);
33197
+ useEffect23(() => {
34031
33198
  readAnalyticsSetting().then((setting) => {
34032
33199
  setEnabled(setting.enabled);
34033
33200
  setLoading(false);
@@ -34039,7 +33206,7 @@ function OptInAnalyticsScreen({ onDone }) {
34039
33206
  });
34040
33207
  });
34041
33208
  }, []);
34042
- useInput15((input, key) => {
33209
+ useInput12((input, key) => {
34043
33210
  if (loading) return;
34044
33211
  if (key.return || input === " ") {
34045
33212
  setEnabled((current) => {
@@ -34054,21 +33221,21 @@ function OptInAnalyticsScreen({ onDone }) {
34054
33221
  onDone();
34055
33222
  }
34056
33223
  });
34057
- return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
34058
- /* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
34059
- /* @__PURE__ */ jsx61(Text52, { children: " " }),
34060
- loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment19, { children: [
34061
- /* @__PURE__ */ jsxs50(Text52, { children: [
33224
+ return /* @__PURE__ */ jsxs46(Box45, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33225
+ /* @__PURE__ */ jsx56(Text47, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
33226
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
33227
+ loading ? /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs46(Fragment18, { children: [
33228
+ /* @__PURE__ */ jsxs46(Text47, { children: [
34062
33229
  "Share anonymous usage data:",
34063
33230
  " ",
34064
- /* @__PURE__ */ jsx61(Text52, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
33231
+ /* @__PURE__ */ jsx56(Text47, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
34065
33232
  ] }),
34066
- /* @__PURE__ */ jsx61(Text52, { children: " " }),
34067
- /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
34068
- /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
33233
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
33234
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
33235
+ /* @__PURE__ */ jsx56(Text47, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
34069
33236
  ] }),
34070
- /* @__PURE__ */ jsx61(Text52, { children: " " }),
34071
- /* @__PURE__ */ jsx61(
33237
+ /* @__PURE__ */ jsx56(Text47, { children: " " }),
33238
+ /* @__PURE__ */ jsx56(
34072
33239
  ControlHints,
34073
33240
  {
34074
33241
  hints: [
@@ -34089,95 +33256,14 @@ var init_screen11 = __esm({
34089
33256
  }
34090
33257
  });
34091
33258
 
34092
- // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
34093
- import { useEffect as useEffect26, useState as useState35 } from "react";
34094
- import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
34095
- import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
34096
- function UpgradeScreen({ onDone }) {
34097
- const [upgradeCheck, setUpgradeCheck] = useState35();
34098
- useEffect26(() => {
34099
- startDebugRun({
34100
- flow: "upgrade",
34101
- step: "01-upgrade",
34102
- menuOption: "Upgrade",
34103
- inputs: { currentVersion: readPackageVersion() }
34104
- });
34105
- checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
34106
- }, []);
34107
- useInput16((_input, key) => {
34108
- if (key.return) {
34109
- void finishDebugRun({
34110
- outputs: upgradeCheck ?? {},
34111
- status: upgradeCheck?.status === "error" ? "error" : "success",
34112
- exitMethod: "saved"
34113
- });
34114
- onDone();
34115
- return;
34116
- }
34117
- });
34118
- return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
34119
- /* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
34120
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
34121
- renderBody(upgradeCheck),
34122
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
34123
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
34124
- FOCUS_MARKER,
34125
- " Go Back"
34126
- ] })
34127
- ] });
34128
- }
34129
- function renderBody(upgradeCheck) {
34130
- if (!upgradeCheck) {
34131
- return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
34132
- }
34133
- if (upgradeCheck.status === "error") {
34134
- return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
34135
- }
34136
- if (upgradeCheck.status === "up-to-date") {
34137
- return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
34138
- "You're already on the latest version (v",
34139
- upgradeCheck.current,
34140
- ")."
34141
- ] });
34142
- }
34143
- return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
34144
- /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
34145
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
34146
- "v",
34147
- upgradeCheck.latest
34148
- ] }),
34149
- " ",
34150
- "is available (you're on ",
34151
- /* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
34152
- "v",
34153
- upgradeCheck.current
34154
- ] }),
34155
- "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
34156
- ] }),
34157
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
34158
- /* @__PURE__ */ jsx62(Box50, { flexDirection: "column", borderStyle: "round", borderColor: PALETTE.border, paddingX: 1, children: UPGRADE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx62(Text53, { bold: true, children: cmd }, cmd)) })
34159
- ] });
34160
- }
34161
- var UPGRADE_COMMANDS;
34162
- var init_PageContainer4 = __esm({
34163
- "packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx"() {
34164
- "use strict";
34165
- init_theme();
34166
- init_home_theme();
34167
- init_version();
34168
- init_debug_store();
34169
- UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
34170
- }
34171
- });
34172
-
34173
33259
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34174
- import { useEffect as useEffect27, useState as useState36 } from "react";
34175
- import { Box as Box51, Text as Text54, useInput as useInput17 } from "ink";
34176
- import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
33260
+ import { useEffect as useEffect24, useState as useState31 } from "react";
33261
+ import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
33262
+ import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
34177
33263
  function DebugModeScreen({ onDone }) {
34178
- const [loading, setLoading] = useState36(true);
34179
- const [enabled, setEnabled] = useState36(true);
34180
- useEffect27(() => {
33264
+ const [loading, setLoading] = useState31(true);
33265
+ const [enabled, setEnabled] = useState31(true);
33266
+ useEffect24(() => {
34181
33267
  readDebugModeSetting().then((setting) => {
34182
33268
  setEnabled(setting.enabled);
34183
33269
  setLoading(false);
@@ -34189,7 +33275,7 @@ function DebugModeScreen({ onDone }) {
34189
33275
  });
34190
33276
  });
34191
33277
  }, []);
34192
- useInput17((input, key) => {
33278
+ useInput13((input, key) => {
34193
33279
  if (loading) return;
34194
33280
  if (key.return || input === " ") {
34195
33281
  setEnabled((current) => {
@@ -34204,16 +33290,16 @@ function DebugModeScreen({ onDone }) {
34204
33290
  onDone();
34205
33291
  }
34206
33292
  });
34207
- return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
34208
- /* @__PURE__ */ jsx63(Text54, { bold: true, children: "Settings \u203A Debug Mode" }),
34209
- /* @__PURE__ */ jsx63(Text54, { children: " " }),
34210
- loading ? /* @__PURE__ */ jsx63(Text54, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text54, { children: [
33293
+ return /* @__PURE__ */ jsxs47(Box46, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
33294
+ /* @__PURE__ */ jsx57(Text48, { bold: true, children: "Settings \u203A Debug Mode" }),
33295
+ /* @__PURE__ */ jsx57(Text48, { children: " " }),
33296
+ loading ? /* @__PURE__ */ jsx57(Text48, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs47(Text48, { children: [
34211
33297
  "Debug logging:",
34212
33298
  " ",
34213
- /* @__PURE__ */ jsx63(Text54, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
33299
+ /* @__PURE__ */ jsx57(Text48, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
34214
33300
  ] }),
34215
- /* @__PURE__ */ jsx63(Text54, { children: " " }),
34216
- /* @__PURE__ */ jsx63(
33301
+ /* @__PURE__ */ jsx57(Text48, { children: " " }),
33302
+ /* @__PURE__ */ jsx57(
34217
33303
  ControlHints,
34218
33304
  {
34219
33305
  hints: [
@@ -34239,20 +33325,20 @@ var app_exports = {};
34239
33325
  __export(app_exports, {
34240
33326
  runApp: () => runApp
34241
33327
  });
34242
- import { join as join27 } from "node:path";
34243
- import { useEffect as useEffect28, useState as useState37 } from "react";
34244
- import { Fragment as Fragment20, jsx as jsx64 } from "react/jsx-runtime";
33328
+ import { join as join26 } from "node:path";
33329
+ import { useEffect as useEffect25, useState as useState32 } from "react";
33330
+ import { Fragment as Fragment19, jsx as jsx58 } from "react/jsx-runtime";
34245
33331
  function App({ importOptions, inkClear }) {
34246
- const [screen, setScreen] = useState37("start");
34247
- const [importExitCode, setImportExitCode] = useState37();
33332
+ const [screen, setScreen] = useState32("start");
33333
+ const [importExitCode, setImportExitCode] = useState32();
34248
33334
  const showImportResult = importExitCode !== void 0;
34249
- const [projectPath, setProjectPath] = useState37();
34250
- const [tokensPath, setTokensPath] = useState37();
34251
- const [scannedFiles, setScannedFiles] = useState37();
34252
- const [pendingLaunch, setPendingLaunch] = useState37();
34253
- const [extractionRun, setExtractionRun] = useState37();
33335
+ const [projectPath, setProjectPath] = useState32();
33336
+ const [tokensPath, setTokensPath] = useState32();
33337
+ const [scannedFiles, setScannedFiles] = useState32();
33338
+ const [pendingLaunch, setPendingLaunch] = useState32();
33339
+ const [extractionRun, setExtractionRun] = useState32();
34254
33340
  const extraction = useExtraction(extractionRun?.input);
34255
- const [scopeRun, setScopeRun] = useState37();
33341
+ const [scopeRun, setScopeRun] = useState32();
34256
33342
  const scopeFlow = useScopeGateFlow(
34257
33343
  scopeRun && {
34258
33344
  sessionId: scopeRun.extraction.sessionId,
@@ -34267,12 +33353,12 @@ function App({ importOptions, inkClear }) {
34267
33353
  }
34268
33354
  }
34269
33355
  );
34270
- const [generationInput, setGenerationInput] = useState37();
33356
+ const [generationInput, setGenerationInput] = useState32();
34271
33357
  const generation = useGeneration(generationInput);
34272
- const [flowStart, setFlowStart] = useState37();
33358
+ const [flowStart, setFlowStart] = useState32();
34273
33359
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34274
- const [importDefaults, setImportDefaults] = useState37();
34275
- useEffect28(() => {
33360
+ const [importDefaults, setImportDefaults] = useState32();
33361
+ useEffect25(() => {
34276
33362
  if (screen !== "import") {
34277
33363
  setImportDefaults(void 0);
34278
33364
  return;
@@ -34290,7 +33376,7 @@ function App({ importOptions, inkClear }) {
34290
33376
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
34291
33377
  const state2 = await inspectTokens({
34292
33378
  rawTokensPath: tokens,
34293
- contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
33379
+ contentfulDir: join26(resolveUserPath(projectPath2), ".contentful"),
34294
33380
  cache: importOptions.cache
34295
33381
  });
34296
33382
  if (state2.kind === "cached") {
@@ -34332,12 +33418,12 @@ function App({ importOptions, inkClear }) {
34332
33418
  }
34333
33419
  });
34334
33420
  };
34335
- useEffect28(() => {
33421
+ useEffect25(() => {
34336
33422
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34337
33423
  setExtractionRun(void 0);
34338
33424
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34339
33425
  }, [extraction, extractionRun]);
34340
- useEffect28(() => {
33426
+ useEffect25(() => {
34341
33427
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34342
33428
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34343
33429
  setGenerationInput({
@@ -34355,7 +33441,7 @@ function App({ importOptions, inkClear }) {
34355
33441
  ...generatePromptPath ? { generatePromptPath } : {}
34356
33442
  });
34357
33443
  }, [scopeFlow, scopeRun, generationInput]);
34358
- useEffect28(() => {
33444
+ useEffect25(() => {
34359
33445
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34360
33446
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
34361
33447
  inkClear();
@@ -34398,9 +33484,9 @@ function App({ importOptions, inkClear }) {
34398
33484
  };
34399
33485
  switch (screen) {
34400
33486
  case "import":
34401
- if (showImportResult) return /* @__PURE__ */ jsx64(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
33487
+ if (showImportResult) return /* @__PURE__ */ jsx58(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
34402
33488
  if (flow && flowStart) {
34403
- return /* @__PURE__ */ jsx64(
33489
+ return /* @__PURE__ */ jsx58(
34404
33490
  FlowScreen,
34405
33491
  {
34406
33492
  state: flow.state,
@@ -34410,12 +33496,12 @@ function App({ importOptions, inkClear }) {
34410
33496
  }
34411
33497
  );
34412
33498
  }
34413
- if (importDefaults === void 0) return /* @__PURE__ */ jsx64(Fragment20, {});
33499
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx58(Fragment19, {});
34414
33500
  if (projectPath === void 0) {
34415
- return /* @__PURE__ */ jsx64(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
33501
+ return /* @__PURE__ */ jsx58(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
34416
33502
  }
34417
33503
  if (tokensPath === void 0) {
34418
- return /* @__PURE__ */ jsx64(
33504
+ return /* @__PURE__ */ jsx58(
34419
33505
  TokenInputScreen,
34420
33506
  {
34421
33507
  initialPath: importDefaults.tokenFile,
@@ -34425,7 +33511,7 @@ function App({ importOptions, inkClear }) {
34425
33511
  );
34426
33512
  }
34427
33513
  if (scannedFiles === void 0) {
34428
- return /* @__PURE__ */ jsx64(
33514
+ return /* @__PURE__ */ jsx58(
34429
33515
  PathValidationScreen,
34430
33516
  {
34431
33517
  projectPath,
@@ -34437,10 +33523,10 @@ function App({ importOptions, inkClear }) {
34437
33523
  }
34438
33524
  if (extractionRun) {
34439
33525
  if (extraction?.status === "done" && !extraction.result.ok) {
34440
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
33526
+ return /* @__PURE__ */ jsx58(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
34441
33527
  }
34442
33528
  if (extraction?.status === "running") {
34443
- return /* @__PURE__ */ jsx64(
33529
+ return /* @__PURE__ */ jsx58(
34444
33530
  ExtractionScreen,
34445
33531
  {
34446
33532
  progress: extraction.progress,
@@ -34449,14 +33535,14 @@ function App({ importOptions, inkClear }) {
34449
33535
  }
34450
33536
  );
34451
33537
  }
34452
- return /* @__PURE__ */ jsx64(Fragment20, {});
33538
+ return /* @__PURE__ */ jsx58(Fragment19, {});
34453
33539
  }
34454
33540
  if (scopeRun && scopeFlow) {
34455
33541
  if (scopeFlow.status === "failed") {
34456
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
33542
+ return /* @__PURE__ */ jsx58(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
34457
33543
  }
34458
33544
  if (scopeFlow.status === "deciding") {
34459
- return /* @__PURE__ */ jsx64(
33545
+ return /* @__PURE__ */ jsx58(
34460
33546
  ScopeGateScreen,
34461
33547
  {
34462
33548
  components: scopeFlow.load.components,
@@ -34466,7 +33552,7 @@ function App({ importOptions, inkClear }) {
34466
33552
  );
34467
33553
  }
34468
33554
  if (generation?.status === "done" && !generation.result.ok) {
34469
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
33555
+ return /* @__PURE__ */ jsx58(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
34470
33556
  }
34471
33557
  if (generation?.status === "running") {
34472
33558
  const hasRawTokens = scopeRun.input.rawTokensPath !== "";
@@ -34474,7 +33560,7 @@ function App({ importOptions, inkClear }) {
34474
33560
  hasRawTokens,
34475
33561
  mapTokensEligible: generation.progress.mapTokensEligible
34476
33562
  });
34477
- return /* @__PURE__ */ jsx64(
33563
+ return /* @__PURE__ */ jsx58(
34478
33564
  GenerationScreen,
34479
33565
  {
34480
33566
  progress: generation.progress,
@@ -34486,10 +33572,10 @@ function App({ importOptions, inkClear }) {
34486
33572
  }
34487
33573
  );
34488
33574
  }
34489
- return /* @__PURE__ */ jsx64(Fragment20, {});
33575
+ return /* @__PURE__ */ jsx58(Fragment19, {});
34490
33576
  }
34491
33577
  if (pendingLaunch?.cached) {
34492
- return /* @__PURE__ */ jsx64(
33578
+ return /* @__PURE__ */ jsx58(
34493
33579
  TokenReuseScreen,
34494
33580
  {
34495
33581
  tokensPath: pendingLaunch.cached.tokensPath,
@@ -34500,7 +33586,7 @@ function App({ importOptions, inkClear }) {
34500
33586
  }
34501
33587
  );
34502
33588
  }
34503
- return /* @__PURE__ */ jsx64(
33589
+ return /* @__PURE__ */ jsx58(
34504
33590
  CredentialsScreen,
34505
33591
  {
34506
33592
  initial: importDefaults.credentials,
@@ -34509,19 +33595,17 @@ function App({ importOptions, inkClear }) {
34509
33595
  }
34510
33596
  );
34511
33597
  case "help":
34512
- return /* @__PURE__ */ jsx64(HelpScreen, { onDone: goToStart });
34513
- case "upgrade":
34514
- return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
33598
+ return /* @__PURE__ */ jsx58(HelpScreen, { onDone: goToStart });
34515
33599
  case "settings":
34516
- return /* @__PURE__ */ jsx64(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
33600
+ return /* @__PURE__ */ jsx58(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
34517
33601
  case "settings-configuration":
34518
- return /* @__PURE__ */ jsx64(ConfigurationScreen, { onDone: goToSettings });
33602
+ return /* @__PURE__ */ jsx58(ConfigurationScreen, { onDone: goToSettings });
34519
33603
  case "settings-opt-in-analytics":
34520
- return /* @__PURE__ */ jsx64(OptInAnalyticsScreen, { onDone: goToSettings });
33604
+ return /* @__PURE__ */ jsx58(OptInAnalyticsScreen, { onDone: goToSettings });
34521
33605
  case "settings-debug-mode":
34522
- return /* @__PURE__ */ jsx64(DebugModeScreen, { onDone: goToSettings });
33606
+ return /* @__PURE__ */ jsx58(DebugModeScreen, { onDone: goToSettings });
34523
33607
  case "start":
34524
- return /* @__PURE__ */ jsx64(HomeScreen, { onNavigate: setScreen });
33608
+ return /* @__PURE__ */ jsx58(HomeScreen, { onNavigate: setScreen });
34525
33609
  }
34526
33610
  }
34527
33611
  async function runApp(renderApp, importOptions) {
@@ -34529,7 +33613,7 @@ async function runApp(renderApp, importOptions) {
34529
33613
  instance.clear?.();
34530
33614
  process.stdout.write("\x1B[H\x1B[0J");
34531
33615
  };
34532
- const instance = renderApp(/* @__PURE__ */ jsx64(App, { importOptions, inkClear }));
33616
+ const instance = renderApp(/* @__PURE__ */ jsx58(App, { importOptions, inkClear }));
34533
33617
  await instance.waitUntilExit();
34534
33618
  }
34535
33619
  var init_app = __esm({
@@ -34555,7 +33639,6 @@ var init_app = __esm({
34555
33639
  init_PageContainer3();
34556
33640
  init_ContentfulConfigScreen();
34557
33641
  init_screen11();
34558
- init_PageContainer4();
34559
33642
  init_screen12();
34560
33643
  init_config_store();
34561
33644
  }
@@ -34564,7 +33647,7 @@ var init_app = __esm({
34564
33647
  // packages/experience-design-system-cli/program.ts
34565
33648
  init_src4();
34566
33649
  import { readFileSync as readFileSync9 } from "node:fs";
34567
- import { join as join28 } from "node:path";
33650
+ import { join as join27 } from "node:path";
34568
33651
  import { Command } from "commander";
34569
33652
 
34570
33653
  // packages/experience-design-system-cli/src/commands/import-options.ts
@@ -34592,14 +33675,14 @@ function runDevWatch(args) {
34592
33675
  process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
34593
33676
  return Promise.resolve(1);
34594
33677
  }
34595
- return new Promise((resolve28) => {
33678
+ return new Promise((resolve27) => {
34596
33679
  const child = spawn3(process.execPath, [script, ...args], { stdio: "inherit" });
34597
33680
  process.on("SIGINT", () => void 0);
34598
- child.on("exit", (code) => resolve28(code ?? 0));
33681
+ child.on("exit", (code) => resolve27(code ?? 0));
34599
33682
  child.on("error", (err) => {
34600
33683
  process.stderr.write(`${err.message}
34601
33684
  `);
34602
- resolve28(1);
33685
+ resolve27(1);
34603
33686
  });
34604
33687
  });
34605
33688
  }
@@ -34624,13 +33707,11 @@ function registerImportCommand(program, openTui) {
34624
33707
  }
34625
33708
 
34626
33709
  // packages/experience-design-system-cli/program.ts
34627
- init_agent_store();
34628
- init_apply_binary_overrides();
34629
33710
  init_analytics_store();
34630
33711
  init_package_root();
34631
33712
  var pkg = JSON.parse(
34632
33713
  readFileSync9(
34633
- join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
33714
+ join27(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
34634
33715
  "utf8"
34635
33716
  )
34636
33717
  );
@@ -34647,7 +33728,6 @@ function createProgram() {
34647
33728
  const commandChain = chain.join(" ") || actionCommand.name();
34648
33729
  const { enabled } = await readAnalyticsSetting();
34649
33730
  setPersistedAnalyticsDisabled(!enabled);
34650
- await readAgentConfig().then(applyBinaryOverrides, () => void 0);
34651
33731
  setCliVersion(pkg.version);
34652
33732
  noteCommandStart(commandChain);
34653
33733
  });
@@ -34671,7 +33751,7 @@ init_config();
34671
33751
  init_package_root();
34672
33752
  import { existsSync as existsSync11 } from "node:fs";
34673
33753
  import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
34674
- import { dirname as dirname16, join as join29 } from "node:path";
33754
+ import { dirname as dirname16, join as join28 } from "node:path";
34675
33755
  var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
34676
33756
  async function readJson(path5) {
34677
33757
  try {
@@ -34682,9 +33762,9 @@ async function readJson(path5) {
34682
33762
  }
34683
33763
  async function migrateOldConfig() {
34684
33764
  try {
34685
- const oldCredentials = join29(oldConfigDir2(), "credentials.json");
34686
- const oldRuns = join29(oldConfigDir2(), "runs.json");
34687
- const oldDebugMode = join29(
33765
+ const oldCredentials = join28(oldConfigDir2(), "credentials.json");
33766
+ const oldRuns = join28(oldConfigDir2(), "runs.json");
33767
+ const oldDebugMode = join28(
34688
33768
  findPackageRoot(import.meta.url, PACKAGE_NAME3),
34689
33769
  ".contentful",
34690
33770
  "config",