@contentful/experience-design-system-cli 2.37.1-dev-build-2ec208d2.0 → 2.37.1-dev-build-f22bf3b7.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
@@ -32,7 +32,7 @@ var init_package_root = __esm({
32
32
  }
33
33
  });
34
34
 
35
- // packages/experience-design-system-cli/src/tui/upgrade/version.ts
35
+ // packages/experience-design-system-cli/src/tui/home/version.ts
36
36
  import { readFileSync as readFileSync2 } from "node:fs";
37
37
  import { join as join2 } from "node:path";
38
38
  import semver from "semver";
@@ -65,7 +65,7 @@ async function checkForUpgrade() {
65
65
  }
66
66
  var PACKAGE_NAME, TAGS_URL;
67
67
  var init_version = __esm({
68
- "packages/experience-design-system-cli/src/tui/upgrade/version.ts"() {
68
+ "packages/experience-design-system-cli/src/tui/home/version.ts"() {
69
69
  "use strict";
70
70
  init_package_root();
71
71
  PACKAGE_NAME = "@contentful/experience-design-system-cli";
@@ -2330,7 +2330,7 @@ var init_debug_store = __esm({
2330
2330
 
2331
2331
  // packages/experience-design-system-cli/app.tsx
2332
2332
  import { join as join26 } from "node:path";
2333
- import { useEffect as useEffect28, useState as useState37 } from "react";
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";
@@ -2431,18 +2431,14 @@ var SUBTITLE = "Let's import your design system into Contentful";
2431
2431
  var MIN_TERMINAL_WIDTH = 164;
2432
2432
  var START_ITEMS = [
2433
2433
  { label: "Import", screen: "import" },
2434
- { label: "Upgrade Version", screen: "upgrade" },
2435
2434
  { label: "Settings", screen: "settings" },
2436
2435
  { label: "Help", screen: "help" }
2437
2436
  ];
2438
- function upgradeItemDisplay(upgradeCheck) {
2437
+ function versionStatus(upgradeCheck) {
2439
2438
  if (upgradeCheck?.status === "update-available") {
2440
- return { label: `Upgrade Version (v${upgradeCheck.latest} available)`, color: PALETTE.warning };
2441
- }
2442
- if (upgradeCheck?.status === "up-to-date") {
2443
- return { label: "Upgrade Version (up to date)", color: PALETTE.muted };
2439
+ return { text: ` (upgrade available v${upgradeCheck.latest})`, color: PALETTE.success };
2444
2440
  }
2445
- return { label: "Upgrade Version" };
2441
+ return void 0;
2446
2442
  }
2447
2443
  function HomeScreen({ onNavigate }) {
2448
2444
  const [focusIdx, setFocusIdx] = useState2(0);
@@ -2450,7 +2446,7 @@ function HomeScreen({ onNavigate }) {
2450
2446
  const { exit } = useApp();
2451
2447
  const terminalWidth = useTerminalWidth();
2452
2448
  const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
2453
- const upgradeDisabled = upgradeCheck?.status === "up-to-date";
2449
+ const status = versionStatus(upgradeCheck);
2454
2450
  useEffect2(() => {
2455
2451
  checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
2456
2452
  }, []);
@@ -2470,7 +2466,6 @@ function HomeScreen({ onNavigate }) {
2470
2466
  }
2471
2467
  if (key.return) {
2472
2468
  const item = START_ITEMS[focusIdx];
2473
- if (item.screen === "upgrade" && upgradeDisabled) return;
2474
2469
  onNavigate(item.screen);
2475
2470
  return;
2476
2471
  }
@@ -2488,26 +2483,16 @@ function HomeScreen({ onNavigate }) {
2488
2483
  /* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
2489
2484
  /* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
2490
2485
  "v",
2491
- VERSION
2486
+ VERSION,
2487
+ status && /* @__PURE__ */ jsx2(Text2, { color: status.color, children: status.text })
2492
2488
  ] })
2493
2489
  ] }),
2494
2490
  /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
2495
2491
  const focused = i === focusIdx;
2496
- const isUpgradeItem = item.screen === "upgrade";
2497
- const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
2498
- const dimmed = isUpgradeItem && upgradeDisabled;
2499
- return /* @__PURE__ */ jsxs(
2500
- Text2,
2501
- {
2502
- bold: focused && !dimmed,
2503
- color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
2504
- children: [
2505
- focused ? `${FOCUS_MARKER} ` : " ",
2506
- display.label
2507
- ]
2508
- },
2492
+ return /* @__PURE__ */ jsxs(Text2, { bold: focused, color: focused ? PALETTE.accent : void 0, children: [
2493
+ focused ? `${FOCUS_MARKER} ` : " ",
2509
2494
  item.label
2510
- );
2495
+ ] }, item.label);
2511
2496
  }) }) }),
2512
2497
  /* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
2513
2498
  ControlHints,
@@ -28580,68 +28565,44 @@ function SettingsScreen({
28580
28565
 
28581
28566
  // packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
28582
28567
  import { useState as useState33 } from "react";
28583
- import { Box as Box48, Text as Text51, useInput as useInput13 } from "ink";
28568
+ import { Box as Box48, Text as Text51, useInput as useInput14 } from "ink";
28584
28569
 
28585
28570
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
28586
- import { useEffect as useEffect23, useState as useState31 } from "react";
28571
+ import { useEffect as useEffect23, useRef as useRef13, useState as useState31 } from "react";
28587
28572
  import { Box as Box46, Text as Text49, useInput as useInput12 } from "ink";
28588
28573
  init_debug_store();
28589
28574
 
28590
- // packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts
28575
+ // packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts
28591
28576
  init_config();
28592
- var readV1Store = readSettings2;
28593
- var writeV1Store = writeSettings2;
28594
-
28595
- // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
28596
- var AGENT_LABELS = {
28597
- claude: "Claude Code",
28598
- codex: "OpenAI Codex",
28599
- opencode: "OpenCode",
28600
- cursor: "Cursor",
28601
- copilot: "GitHub Copilot"
28602
- };
28603
- var asString = (value) => typeof value === "string" ? value : "";
28604
- function emptyAgents() {
28605
- return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
28577
+ import { existsSync as existsSync10 } from "node:fs";
28578
+ function diffSnapshots(before, after) {
28579
+ const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
28580
+ const changed_fields = names.filter((name) => before[name] !== after[name]);
28581
+ return { changed: changed_fields.length > 0, changed_fields };
28582
+ }
28583
+ var DEFAULT_TRAIL_LIMIT = 30;
28584
+ function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
28585
+ const actions = [];
28586
+ return {
28587
+ record(action) {
28588
+ actions.push(action);
28589
+ if (actions.length > limit) actions.shift();
28590
+ },
28591
+ entries: () => [...actions]
28592
+ };
28606
28593
  }
28607
- async function readAgentConfig() {
28608
- const store = await readV1Store();
28609
- const stored = asString(store["agent"]);
28610
- const defaultChosen = isAgentName(stored);
28611
- const defaultAgent = defaultChosen ? stored : DEFAULT_AGENT_NAME;
28612
- const agents = emptyAgents();
28613
- const saved = store["agents"];
28614
- if (saved && typeof saved === "object") {
28615
- for (const name of AGENT_NAMES) {
28616
- const entry = saved[name];
28617
- if (entry && typeof entry === "object") {
28618
- const fields2 = entry;
28619
- agents[name] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
28620
- }
28621
- }
28594
+ var MIN_SECRET_LENGTH = 6;
28595
+ function scrubError(error, secrets) {
28596
+ let message = error instanceof Error ? error.message : String(error);
28597
+ for (const secret of secrets) {
28598
+ if (secret.length < MIN_SECRET_LENGTH) continue;
28599
+ for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
28622
28600
  }
28623
- const legacyModel = asString(store["agentModel"]);
28624
- if (legacyModel && !agents[defaultAgent].model)
28625
- agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
28626
- return { defaultAgent, defaultChosen, agents };
28601
+ return message;
28627
28602
  }
28628
- async function writeAgentConfig(config) {
28629
- const existing = await readV1Store();
28630
- const merged = { ...existing };
28631
- const agents = {};
28632
- for (const name of AGENT_NAMES) {
28633
- const model = config.agents[name].model.trim();
28634
- const binary = config.agents[name].binary.trim();
28635
- if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
28636
- }
28637
- const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
28638
- if (config.defaultChosen) merged["agent"] = config.defaultAgent;
28639
- else delete merged["agent"];
28640
- if (defaultModel) merged["agentModel"] = defaultModel;
28641
- else delete merged["agentModel"];
28642
- if (Object.keys(agents).length > 0) merged["agents"] = agents;
28643
- else delete merged["agents"];
28644
- await writeV1Store(merged);
28603
+ function describeSettingsFile() {
28604
+ const path5 = configFilePath2();
28605
+ return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
28645
28606
  }
28646
28607
 
28647
28608
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
@@ -28847,6 +28808,94 @@ async function withBinaryEnv(name, binary, run) {
28847
28808
  }
28848
28809
  }
28849
28810
 
28811
+ // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
28812
+ function agentSnapshot(config) {
28813
+ const snapshot = { default_agent: config.defaultAgent };
28814
+ for (const name of AGENT_NAMES) {
28815
+ snapshot[`${name}.model`] = config.agents[name].model;
28816
+ snapshot[`${name}.binary`] = config.agents[name].binary;
28817
+ }
28818
+ return snapshot;
28819
+ }
28820
+ function environmentFrom(checks, savedBinary, envValue) {
28821
+ const path5 = checks.find((check) => check.step === "path");
28822
+ const version = checks.find((check) => check.step === "version");
28823
+ const overridden = envValue !== void 0 && envValue !== "" && envValue !== savedBinary.trim();
28824
+ return {
28825
+ found: path5?.ok === true,
28826
+ resolved_path: path5?.ok ? path5.detail : "",
28827
+ version: version?.ok ? version.detail : "",
28828
+ env_override: overridden ? envValue : ""
28829
+ };
28830
+ }
28831
+ async function describeAgents(config) {
28832
+ const entries = await Promise.all(
28833
+ AGENT_NAMES.map(async (name) => {
28834
+ const saved = config.agents[name].binary;
28835
+ const checks = await inspectAgent(name, saved);
28836
+ return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
28837
+ })
28838
+ );
28839
+ return Object.fromEntries(entries);
28840
+ }
28841
+
28842
+ // packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts
28843
+ init_config();
28844
+ var readV1Store = readSettings2;
28845
+ var writeV1Store = writeSettings2;
28846
+
28847
+ // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
28848
+ var AGENT_LABELS = {
28849
+ claude: "Claude Code",
28850
+ codex: "OpenAI Codex",
28851
+ opencode: "OpenCode",
28852
+ cursor: "Cursor",
28853
+ copilot: "GitHub Copilot"
28854
+ };
28855
+ var asString = (value) => typeof value === "string" ? value : "";
28856
+ function emptyAgents() {
28857
+ return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
28858
+ }
28859
+ async function readAgentConfig() {
28860
+ const store = await readV1Store();
28861
+ const stored = asString(store["agent"]);
28862
+ const defaultChosen = isAgentName(stored);
28863
+ const defaultAgent = defaultChosen ? stored : DEFAULT_AGENT_NAME;
28864
+ const agents = emptyAgents();
28865
+ const saved = store["agents"];
28866
+ if (saved && typeof saved === "object") {
28867
+ for (const name of AGENT_NAMES) {
28868
+ const entry = saved[name];
28869
+ if (entry && typeof entry === "object") {
28870
+ const fields2 = entry;
28871
+ agents[name] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
28872
+ }
28873
+ }
28874
+ }
28875
+ const legacyModel = asString(store["agentModel"]);
28876
+ if (legacyModel && !agents[defaultAgent].model)
28877
+ agents[defaultAgent] = { ...agents[defaultAgent], model: legacyModel };
28878
+ return { defaultAgent, defaultChosen, agents };
28879
+ }
28880
+ async function writeAgentConfig(config) {
28881
+ const existing = await readV1Store();
28882
+ const merged = { ...existing };
28883
+ const agents = {};
28884
+ for (const name of AGENT_NAMES) {
28885
+ const model = config.agents[name].model.trim();
28886
+ const binary = config.agents[name].binary.trim();
28887
+ if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
28888
+ }
28889
+ const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
28890
+ if (config.defaultChosen) merged["agent"] = config.defaultAgent;
28891
+ else delete merged["agent"];
28892
+ if (defaultModel) merged["agentModel"] = defaultModel;
28893
+ else delete merged["agentModel"];
28894
+ if (Object.keys(agents).length > 0) merged["agents"] = agents;
28895
+ else delete merged["agents"];
28896
+ await writeV1Store(merged);
28897
+ }
28898
+
28850
28899
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
28851
28900
  import { useEffect as useEffect22, useState as useState30 } from "react";
28852
28901
  import { Box as Box45, Text as Text48 } from "ink";
@@ -29048,7 +29097,8 @@ function AgentDetail({
29048
29097
  name,
29049
29098
  config,
29050
29099
  setConfig,
29051
- onBack
29100
+ onBack,
29101
+ record: record3
29052
29102
  }) {
29053
29103
  const settings = config.agents[name];
29054
29104
  const [saving, setSaving] = useState30(false);
@@ -29071,10 +29121,12 @@ function AgentDetail({
29071
29121
  setNotice(null);
29072
29122
  writeAgentConfig(config).then(() => {
29073
29123
  applyBinaryOverrides(config);
29124
+ record3(`saved ${name}`);
29074
29125
  setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
29075
- }).catch(
29076
- (err) => setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` })
29077
- ).finally(() => setSaving(false));
29126
+ }).catch((err) => {
29127
+ record3(`saving ${name} failed`, err);
29128
+ setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
29129
+ }).finally(() => setSaving(false));
29078
29130
  };
29079
29131
  const runTest = () => {
29080
29132
  setTesting(true);
@@ -29082,12 +29134,15 @@ function AgentDetail({
29082
29134
  testAgent(name, settings.binary, settings.model).then((result) => {
29083
29135
  setChecks(result);
29084
29136
  const outcome = testOutcome(result);
29137
+ if (!outcome || !outcome.ok)
29138
+ record3(`test of ${name} failed: ${outcome?.text ?? "the agent could not be started"}`);
29085
29139
  setNotice(
29086
29140
  outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
29087
29141
  );
29088
- }).catch(
29089
- (err) => setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` })
29090
- ).finally(() => setTesting(false));
29142
+ }).catch((err) => {
29143
+ record3(`test of ${name} could not run`, err);
29144
+ setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
29145
+ }).finally(() => setTesting(false));
29091
29146
  };
29092
29147
  const action = {
29093
29148
  label: "Run test",
@@ -29108,6 +29163,7 @@ function AgentDetail({
29108
29163
  onChange: (key, value) => {
29109
29164
  setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
29110
29165
  setNotice(null);
29166
+ record3(`edited ${name}.${key}`);
29111
29167
  },
29112
29168
  onSave: save,
29113
29169
  onQuit: onBack,
@@ -29134,6 +29190,12 @@ function AgentsScreen({ onDone }) {
29134
29190
  const [saving, setSaving] = useState31(false);
29135
29191
  const [loadError, setLoadError] = useState31(null);
29136
29192
  const [checks, setChecks] = useState31({});
29193
+ const visit = useRef13({
29194
+ trail: createTrail(),
29195
+ before: void 0,
29196
+ environment: void 0,
29197
+ error: ""
29198
+ }).current;
29137
29199
  const inspectAll = (loaded) => {
29138
29200
  for (const name of AGENT_NAMES) {
29139
29201
  void inspectAgent(name, loaded.agents[name].binary).then(
@@ -29145,14 +29207,38 @@ function AgentsScreen({ onDone }) {
29145
29207
  readAgentConfig().then((loaded) => {
29146
29208
  setConfig(loaded);
29147
29209
  inspectAll(loaded);
29210
+ visit.before = agentSnapshot(loaded);
29148
29211
  startDebugRun({
29149
29212
  flow: "settings/agents",
29150
29213
  step: "01-agents",
29151
29214
  menuOption: "Configuration > Agents",
29152
- inputs: { default_agent: loaded.defaultAgent }
29215
+ inputs: { ...visit.before, default_chosen: loaded.defaultChosen ?? false }
29216
+ });
29217
+ void describeAgents(loaded).then((found) => {
29218
+ visit.environment = found;
29153
29219
  });
29154
- }).catch((err) => setLoadError(err instanceof Error ? err.message : String(err)));
29220
+ }).catch((err) => {
29221
+ visit.error = scrubError(err, []);
29222
+ startDebugRun({ flow: "settings/agents", step: "01-agents", menuOption: "Configuration > Agents", inputs: {} });
29223
+ setLoadError(visit.error);
29224
+ });
29155
29225
  }, []);
29226
+ const endVisit = (current) => {
29227
+ const after = current ? agentSnapshot(current) : void 0;
29228
+ const change = visit.before && after ? diffSnapshots(visit.before, after) : { changed: false, changed_fields: [] };
29229
+ void finishDebugRun({
29230
+ outputs: {
29231
+ ...after ?? {},
29232
+ ...change,
29233
+ actions: visit.trail.entries(),
29234
+ // Missing only when the user left before the probes finished.
29235
+ ...visit.environment ? { agents: visit.environment } : {},
29236
+ ...visit.error ? { error: visit.error } : {}
29237
+ },
29238
+ status: visit.error ? "error" : "success",
29239
+ exitMethod: change.changed ? "saved" : "discarded"
29240
+ });
29241
+ };
29156
29242
  const makeDefault = (name) => {
29157
29243
  if (!config || saving) return;
29158
29244
  if (name === config.defaultAgent) {
@@ -29164,15 +29250,16 @@ function AgentsScreen({ onDone }) {
29164
29250
  writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
29165
29251
  setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
29166
29252
  setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
29167
- }).catch(
29168
- (err) => setNotice({
29169
- kind: "error",
29170
- text: `Default agent not changed: ${err instanceof Error ? err.message : String(err)}`
29171
- })
29172
- ).finally(() => setSaving(false));
29253
+ visit.trail.record(`made ${name} the default`);
29254
+ }).catch((err) => {
29255
+ visit.error = scrubError(err, []);
29256
+ visit.trail.record(`making ${name} the default failed`);
29257
+ setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
29258
+ }).finally(() => setSaving(false));
29173
29259
  };
29174
29260
  useInput12((input, key) => {
29175
29261
  if (loadError && (key.escape || input === "q")) {
29262
+ endVisit(null);
29176
29263
  onDone();
29177
29264
  return;
29178
29265
  }
@@ -29197,7 +29284,7 @@ function AgentsScreen({ onDone }) {
29197
29284
  return;
29198
29285
  }
29199
29286
  if (key.escape || input === "q") {
29200
- void finishDebugRun({ outputs: { default_agent: config.defaultAgent }, status: "success", exitMethod: "saved" });
29287
+ endVisit(config);
29201
29288
  onDone();
29202
29289
  }
29203
29290
  });
@@ -29222,6 +29309,10 @@ function AgentsScreen({ onDone }) {
29222
29309
  name: open,
29223
29310
  config,
29224
29311
  setConfig,
29312
+ record: (action, error) => {
29313
+ visit.trail.record(action);
29314
+ if (error !== void 0) visit.error = scrubError(error, []);
29315
+ },
29225
29316
  onBack: () => {
29226
29317
  setOpen(null);
29227
29318
  void readAgentConfig().then((saved) => {
@@ -29288,8 +29379,8 @@ function AgentsScreen({ onDone }) {
29288
29379
  }
29289
29380
 
29290
29381
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
29291
- import { useEffect as useEffect24, useState as useState32 } from "react";
29292
- import { Box as Box47, Text as Text50 } from "ink";
29382
+ import { useEffect as useEffect24, useRef as useRef14, useState as useState32 } from "react";
29383
+ import { Box as Box47, Text as Text50, useInput as useInput13 } from "ink";
29293
29384
  init_debug_store();
29294
29385
 
29295
29386
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/project-store.ts
@@ -29318,7 +29409,7 @@ async function writeCredentials(config) {
29318
29409
  }
29319
29410
 
29320
29411
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
29321
- import { jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
29412
+ import { Fragment as Fragment19, jsx as jsx59, jsxs as jsxs48 } from "react/jsx-runtime";
29322
29413
  var FIELDS2 = [
29323
29414
  { key: "spaceId", label: "Space ID" },
29324
29415
  { key: "environmentId", label: "Environment ID" },
@@ -29339,45 +29430,94 @@ function debugFields(config) {
29339
29430
  contentful_base_dir: config?.contentfulBaseDir ?? ""
29340
29431
  };
29341
29432
  }
29433
+ var snapshotOf = (config) => Object.fromEntries(FIELDS2.map(({ key }) => [key, config[key] || ""]));
29342
29434
  var valuesOf = (config) => Object.fromEntries(FIELDS2.map(({ key }) => [key, config[key] || ""]));
29343
29435
  function ProjectScreen({ onDone }) {
29344
29436
  const [config, setConfig] = useState32(null);
29345
29437
  const [saving, setSaving] = useState32(false);
29346
29438
  const [notice, setNotice] = useState32(null);
29347
- const [lastSaved, setLastSaved] = useState32(null);
29439
+ const [loadError, setLoadError] = useState32(null);
29440
+ const visit = useRef14({
29441
+ trail: createTrail(),
29442
+ before: void 0,
29443
+ persisted: void 0,
29444
+ error: ""
29445
+ }).current;
29446
+ const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
29348
29447
  useEffect24(() => {
29349
- void readCredentials().then((cfg) => {
29448
+ readCredentials().then((cfg) => {
29350
29449
  setConfig(cfg);
29450
+ visit.before = snapshotOf(cfg);
29451
+ visit.persisted = visit.before;
29351
29452
  startDebugRun({
29352
29453
  flow: "settings/contentful-configuration",
29353
29454
  step: "01-configuration",
29354
29455
  menuOption: "Configuration > Project",
29355
- inputs: debugFields(cfg)
29456
+ inputs: { ...debugFields(cfg), settings_file: describeSettingsFile() }
29356
29457
  });
29458
+ }).catch((err) => {
29459
+ visit.error = scrubError(err, []);
29460
+ startDebugRun({
29461
+ flow: "settings/contentful-configuration",
29462
+ step: "01-configuration",
29463
+ menuOption: "Configuration > Project",
29464
+ inputs: { settings_file: describeSettingsFile() }
29465
+ });
29466
+ setLoadError(visit.error);
29357
29467
  });
29358
29468
  }, []);
29469
+ const endVisit = (current) => {
29470
+ const onScreen = current ? snapshotOf(current) : void 0;
29471
+ const change = visit.before && visit.persisted ? diffSnapshots(visit.before, visit.persisted) : { changed: false, changed_fields: [] };
29472
+ const unsaved = visit.persisted && onScreen ? diffSnapshots(visit.persisted, onScreen) : { changed: false, changed_fields: [] };
29473
+ void finishDebugRun({
29474
+ outputs: {
29475
+ ...debugFields(current),
29476
+ ...change,
29477
+ unsaved_edits: unsaved.changed_fields,
29478
+ actions: visit.trail.entries(),
29479
+ ...visit.error ? { error: visit.error } : {}
29480
+ },
29481
+ status: visit.error ? "error" : "success",
29482
+ exitMethod: change.changed ? "saved" : "discarded"
29483
+ });
29484
+ };
29485
+ useInput13((input, key) => {
29486
+ if (!config && loadError && (key.escape || input === "q")) {
29487
+ endVisit(null);
29488
+ onDone();
29489
+ }
29490
+ });
29359
29491
  if (!config) {
29360
29492
  return /* @__PURE__ */ jsxs48(Box47, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29361
29493
  /* @__PURE__ */ jsx59(Text50, { bold: true, children: "Project" }),
29362
29494
  /* @__PURE__ */ jsx59(Text50, { children: " " }),
29363
- /* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
29495
+ loadError ? /* @__PURE__ */ jsxs48(Fragment19, { children: [
29496
+ /* @__PURE__ */ jsxs48(Text50, { color: PALETTE.error, children: [
29497
+ "\u2717 Could not read the settings: ",
29498
+ loadError
29499
+ ] }),
29500
+ /* @__PURE__ */ jsx59(Text50, { children: " " }),
29501
+ /* @__PURE__ */ jsx59(ControlHints, { hints: [{ keys: "Esc/q", label: "back" }] })
29502
+ ] }) : /* @__PURE__ */ jsx59(Text50, { color: PALETTE.accent, children: "Loading..." })
29364
29503
  ] });
29365
29504
  }
29366
29505
  const save = () => {
29367
29506
  setSaving(true);
29368
29507
  setNotice(null);
29369
29508
  writeCredentials(config).then(() => {
29370
- setLastSaved(config);
29509
+ visit.persisted = snapshotOf(config);
29510
+ visit.trail.record("saved");
29371
29511
  if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
29372
29512
  setNotice({ kind: "success", text: "Project settings saved" });
29373
29513
  }).catch((err) => {
29514
+ visit.error = scrub(err);
29515
+ visit.trail.record("save failed");
29374
29516
  setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
29375
29517
  }).finally(() => setSaving(false));
29376
29518
  };
29377
29519
  const quit = () => {
29378
- void finishDebugRun(
29379
- lastSaved ? { outputs: debugFields(lastSaved), status: "success", exitMethod: "saved" } : { outputs: {}, status: "success", exitMethod: "discarded" }
29380
- );
29520
+ endVisit(config);
29381
29521
  onDone();
29382
29522
  };
29383
29523
  return /* @__PURE__ */ jsx59(
@@ -29390,6 +29530,7 @@ function ProjectScreen({ onDone }) {
29390
29530
  onChange: (key, value) => {
29391
29531
  setConfig({ ...config, [key]: value });
29392
29532
  setNotice(null);
29533
+ visit.trail.record(`edited ${key}`);
29393
29534
  },
29394
29535
  onSave: save,
29395
29536
  onQuit: quit,
@@ -29413,7 +29554,7 @@ function ConfigurationScreen({ onDone }) {
29413
29554
  const [focus, setFocus] = useState33(0);
29414
29555
  const [open, setOpen] = useState33(null);
29415
29556
  const close = () => setOpen(null);
29416
- useInput13((input, key) => {
29557
+ useInput14((input, key) => {
29417
29558
  if (open) return;
29418
29559
  if (key.upArrow) {
29419
29560
  setFocus((i) => (i - 1 + SECTIONS.length) % SECTIONS.length);
@@ -29455,7 +29596,7 @@ function ConfigurationScreen({ onDone }) {
29455
29596
 
29456
29597
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
29457
29598
  import { useEffect as useEffect25, useState as useState34 } from "react";
29458
- import { Box as Box49, Text as Text52, useInput as useInput14 } from "ink";
29599
+ import { Box as Box49, Text as Text52, useInput as useInput15 } from "ink";
29459
29600
 
29460
29601
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
29461
29602
  async function readAnalyticsSetting() {
@@ -29474,7 +29615,7 @@ async function writeAnalyticsSetting(setting) {
29474
29615
 
29475
29616
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
29476
29617
  init_debug_store();
29477
- import { Fragment as Fragment19, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
29618
+ import { Fragment as Fragment20, jsx as jsx61, jsxs as jsxs50 } from "react/jsx-runtime";
29478
29619
  function OptInAnalyticsScreen({ onDone }) {
29479
29620
  const [loading, setLoading] = useState34(true);
29480
29621
  const [enabled, setEnabled] = useState34(true);
@@ -29490,7 +29631,7 @@ function OptInAnalyticsScreen({ onDone }) {
29490
29631
  });
29491
29632
  });
29492
29633
  }, []);
29493
- useInput14((input, key) => {
29634
+ useInput15((input, key) => {
29494
29635
  if (loading) return;
29495
29636
  if (key.return || input === " ") {
29496
29637
  setEnabled((current) => {
@@ -29508,7 +29649,7 @@ function OptInAnalyticsScreen({ onDone }) {
29508
29649
  return /* @__PURE__ */ jsxs50(Box49, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29509
29650
  /* @__PURE__ */ jsx61(Text52, { bold: true, children: "Settings \u203A Opt-in Analytics" }),
29510
29651
  /* @__PURE__ */ jsx61(Text52, { children: " " }),
29511
- loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment19, { children: [
29652
+ loading ? /* @__PURE__ */ jsx61(Text52, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs50(Fragment20, { children: [
29512
29653
  /* @__PURE__ */ jsxs50(Text52, { children: [
29513
29654
  "Share anonymous usage data:",
29514
29655
  " ",
@@ -29531,89 +29672,16 @@ function OptInAnalyticsScreen({ onDone }) {
29531
29672
  ] });
29532
29673
  }
29533
29674
 
29534
- // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
29535
- import { useEffect as useEffect26, useState as useState35 } from "react";
29536
- import { Box as Box50, Text as Text53, useInput as useInput15 } from "ink";
29537
- init_version();
29538
- init_debug_store();
29539
- import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
29540
- var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
29541
- function UpgradeScreen({ onDone }) {
29542
- const [upgradeCheck, setUpgradeCheck] = useState35();
29543
- useEffect26(() => {
29544
- startDebugRun({
29545
- flow: "upgrade",
29546
- step: "01-upgrade",
29547
- menuOption: "Upgrade",
29548
- inputs: { currentVersion: readPackageVersion() }
29549
- });
29550
- checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
29551
- }, []);
29552
- useInput15((_input, key) => {
29553
- if (key.return) {
29554
- void finishDebugRun({
29555
- outputs: upgradeCheck ?? {},
29556
- status: upgradeCheck?.status === "error" ? "error" : "success",
29557
- exitMethod: "saved"
29558
- });
29559
- onDone();
29560
- return;
29561
- }
29562
- });
29563
- return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29564
- /* @__PURE__ */ jsx62(Text53, { bold: true, children: "Upgrade" }),
29565
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
29566
- renderBody(upgradeCheck),
29567
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
29568
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
29569
- FOCUS_MARKER,
29570
- " Go Back"
29571
- ] })
29572
- ] });
29573
- }
29574
- function renderBody(upgradeCheck) {
29575
- if (!upgradeCheck) {
29576
- return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Checking for updates\u2026" });
29577
- }
29578
- if (upgradeCheck.status === "error") {
29579
- return /* @__PURE__ */ jsx62(Text53, { color: PALETTE.warning, children: "Couldn't check for updates \u2014 check your network connection and try again." });
29580
- }
29581
- if (upgradeCheck.status === "up-to-date") {
29582
- return /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.success, children: [
29583
- "You're already on the latest version (v",
29584
- upgradeCheck.current,
29585
- ")."
29586
- ] });
29587
- }
29588
- return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", children: [
29589
- /* @__PURE__ */ jsxs51(Text53, { color: PALETTE.muted, children: [
29590
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.success, children: [
29591
- "v",
29592
- upgradeCheck.latest
29593
- ] }),
29594
- " ",
29595
- "is available (you're on ",
29596
- /* @__PURE__ */ jsxs51(Text53, { bold: true, children: [
29597
- "v",
29598
- upgradeCheck.current
29599
- ] }),
29600
- "). Exit this program, cd into the root of your local clone of contentful/experience-design-system-sdk-public, then run:"
29601
- ] }),
29602
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
29603
- /* @__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)) })
29604
- ] });
29605
- }
29606
-
29607
29675
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
29608
- import { useEffect as useEffect27, useState as useState36 } from "react";
29609
- import { Box as Box51, Text as Text54, useInput as useInput16 } from "ink";
29676
+ import { useEffect as useEffect26, useState as useState35 } from "react";
29677
+ import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
29610
29678
  init_debug_mode_store();
29611
29679
  init_debug_store();
29612
- import { jsx as jsx63, jsxs as jsxs52 } from "react/jsx-runtime";
29680
+ import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
29613
29681
  function DebugModeScreen({ onDone }) {
29614
- const [loading, setLoading] = useState36(true);
29615
- const [enabled, setEnabled] = useState36(true);
29616
- useEffect27(() => {
29682
+ const [loading, setLoading] = useState35(true);
29683
+ const [enabled, setEnabled] = useState35(true);
29684
+ useEffect26(() => {
29617
29685
  readDebugModeSetting().then((setting) => {
29618
29686
  setEnabled(setting.enabled);
29619
29687
  setLoading(false);
@@ -29640,16 +29708,16 @@ function DebugModeScreen({ onDone }) {
29640
29708
  onDone();
29641
29709
  }
29642
29710
  });
29643
- return /* @__PURE__ */ jsxs52(Box51, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29644
- /* @__PURE__ */ jsx63(Text54, { bold: true, children: "Settings \u203A Debug Mode" }),
29645
- /* @__PURE__ */ jsx63(Text54, { children: " " }),
29646
- loading ? /* @__PURE__ */ jsx63(Text54, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs52(Text54, { children: [
29711
+ return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29712
+ /* @__PURE__ */ jsx62(Text53, { bold: true, children: "Settings \u203A Debug Mode" }),
29713
+ /* @__PURE__ */ jsx62(Text53, { children: " " }),
29714
+ loading ? /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs51(Text53, { children: [
29647
29715
  "Debug logging:",
29648
29716
  " ",
29649
- /* @__PURE__ */ jsx63(Text54, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29717
+ /* @__PURE__ */ jsx62(Text53, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29650
29718
  ] }),
29651
- /* @__PURE__ */ jsx63(Text54, { children: " " }),
29652
- /* @__PURE__ */ jsx63(
29719
+ /* @__PURE__ */ jsx62(Text53, { children: " " }),
29720
+ /* @__PURE__ */ jsx62(
29653
29721
  ControlHints,
29654
29722
  {
29655
29723
  hints: [
@@ -29662,18 +29730,18 @@ function DebugModeScreen({ onDone }) {
29662
29730
  }
29663
29731
 
29664
29732
  // packages/experience-design-system-cli/app.tsx
29665
- import { Fragment as Fragment20, jsx as jsx64 } from "react/jsx-runtime";
29733
+ import { Fragment as Fragment21, jsx as jsx63 } from "react/jsx-runtime";
29666
29734
  function App({ importOptions, inkClear }) {
29667
- const [screen, setScreen] = useState37("start");
29668
- const [importExitCode, setImportExitCode] = useState37();
29735
+ const [screen, setScreen] = useState36("start");
29736
+ const [importExitCode, setImportExitCode] = useState36();
29669
29737
  const showImportResult = importExitCode !== void 0;
29670
- const [projectPath, setProjectPath] = useState37();
29671
- const [tokensPath, setTokensPath] = useState37();
29672
- const [scannedFiles, setScannedFiles] = useState37();
29673
- const [pendingLaunch, setPendingLaunch] = useState37();
29674
- const [extractionRun, setExtractionRun] = useState37();
29738
+ const [projectPath, setProjectPath] = useState36();
29739
+ const [tokensPath, setTokensPath] = useState36();
29740
+ const [scannedFiles, setScannedFiles] = useState36();
29741
+ const [pendingLaunch, setPendingLaunch] = useState36();
29742
+ const [extractionRun, setExtractionRun] = useState36();
29675
29743
  const extraction = useExtraction(extractionRun?.input);
29676
- const [scopeRun, setScopeRun] = useState37();
29744
+ const [scopeRun, setScopeRun] = useState36();
29677
29745
  const scopeFlow = useScopeGateFlow(
29678
29746
  scopeRun && {
29679
29747
  sessionId: scopeRun.extraction.sessionId,
@@ -29688,12 +29756,12 @@ function App({ importOptions, inkClear }) {
29688
29756
  }
29689
29757
  }
29690
29758
  );
29691
- const [generationInput, setGenerationInput] = useState37();
29759
+ const [generationInput, setGenerationInput] = useState36();
29692
29760
  const generation = useGeneration(generationInput);
29693
- const [flowStart, setFlowStart] = useState37();
29761
+ const [flowStart, setFlowStart] = useState36();
29694
29762
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
29695
- const [importDefaults, setImportDefaults] = useState37();
29696
- useEffect28(() => {
29763
+ const [importDefaults, setImportDefaults] = useState36();
29764
+ useEffect27(() => {
29697
29765
  if (screen !== "import") {
29698
29766
  setImportDefaults(void 0);
29699
29767
  return;
@@ -29753,12 +29821,12 @@ function App({ importOptions, inkClear }) {
29753
29821
  }
29754
29822
  });
29755
29823
  };
29756
- useEffect28(() => {
29824
+ useEffect27(() => {
29757
29825
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
29758
29826
  setExtractionRun(void 0);
29759
29827
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
29760
29828
  }, [extraction, extractionRun]);
29761
- useEffect28(() => {
29829
+ useEffect27(() => {
29762
29830
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
29763
29831
  const { extraction: produced, input, generatePromptPath } = scopeRun;
29764
29832
  setGenerationInput({
@@ -29776,7 +29844,7 @@ function App({ importOptions, inkClear }) {
29776
29844
  ...generatePromptPath ? { generatePromptPath } : {}
29777
29845
  });
29778
29846
  }, [scopeFlow, scopeRun, generationInput]);
29779
- useEffect28(() => {
29847
+ useEffect27(() => {
29780
29848
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
29781
29849
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
29782
29850
  inkClear();
@@ -29819,9 +29887,9 @@ function App({ importOptions, inkClear }) {
29819
29887
  };
29820
29888
  switch (screen) {
29821
29889
  case "import":
29822
- if (showImportResult) return /* @__PURE__ */ jsx64(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
29890
+ if (showImportResult) return /* @__PURE__ */ jsx63(ImportScreen, { exitCode: importExitCode, onDone: finishImportResult });
29823
29891
  if (flow && flowStart) {
29824
- return /* @__PURE__ */ jsx64(
29892
+ return /* @__PURE__ */ jsx63(
29825
29893
  FlowScreen,
29826
29894
  {
29827
29895
  state: flow.state,
@@ -29831,12 +29899,12 @@ function App({ importOptions, inkClear }) {
29831
29899
  }
29832
29900
  );
29833
29901
  }
29834
- if (importDefaults === void 0) return /* @__PURE__ */ jsx64(Fragment20, {});
29902
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx63(Fragment21, {});
29835
29903
  if (projectPath === void 0) {
29836
- return /* @__PURE__ */ jsx64(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29904
+ return /* @__PURE__ */ jsx63(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29837
29905
  }
29838
29906
  if (tokensPath === void 0) {
29839
- return /* @__PURE__ */ jsx64(
29907
+ return /* @__PURE__ */ jsx63(
29840
29908
  TokenInputScreen,
29841
29909
  {
29842
29910
  initialPath: importDefaults.tokenFile,
@@ -29846,7 +29914,7 @@ function App({ importOptions, inkClear }) {
29846
29914
  );
29847
29915
  }
29848
29916
  if (scannedFiles === void 0) {
29849
- return /* @__PURE__ */ jsx64(
29917
+ return /* @__PURE__ */ jsx63(
29850
29918
  PathValidationScreen,
29851
29919
  {
29852
29920
  projectPath,
@@ -29858,10 +29926,10 @@ function App({ importOptions, inkClear }) {
29858
29926
  }
29859
29927
  if (extractionRun) {
29860
29928
  if (extraction?.status === "done" && !extraction.result.ok) {
29861
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
29929
+ return /* @__PURE__ */ jsx63(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
29862
29930
  }
29863
29931
  if (extraction?.status === "running") {
29864
- return /* @__PURE__ */ jsx64(
29932
+ return /* @__PURE__ */ jsx63(
29865
29933
  ExtractionScreen,
29866
29934
  {
29867
29935
  progress: extraction.progress,
@@ -29870,14 +29938,14 @@ function App({ importOptions, inkClear }) {
29870
29938
  }
29871
29939
  );
29872
29940
  }
29873
- return /* @__PURE__ */ jsx64(Fragment20, {});
29941
+ return /* @__PURE__ */ jsx63(Fragment21, {});
29874
29942
  }
29875
29943
  if (scopeRun && scopeFlow) {
29876
29944
  if (scopeFlow.status === "failed") {
29877
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
29945
+ return /* @__PURE__ */ jsx63(ErrorStep, { stepName: "scope gate", message: scopeFlow.message, onExit: leaveImport });
29878
29946
  }
29879
29947
  if (scopeFlow.status === "deciding") {
29880
- return /* @__PURE__ */ jsx64(
29948
+ return /* @__PURE__ */ jsx63(
29881
29949
  ScopeGateScreen,
29882
29950
  {
29883
29951
  components: scopeFlow.load.components,
@@ -29887,7 +29955,7 @@ function App({ importOptions, inkClear }) {
29887
29955
  );
29888
29956
  }
29889
29957
  if (generation?.status === "done" && !generation.result.ok) {
29890
- return /* @__PURE__ */ jsx64(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
29958
+ return /* @__PURE__ */ jsx63(ErrorStep, { stepName: generation.result.step, message: generation.result.message, onExit: leaveImport });
29891
29959
  }
29892
29960
  if (generation?.status === "running") {
29893
29961
  const hasRawTokens = scopeRun.input.rawTokensPath !== "";
@@ -29895,7 +29963,7 @@ function App({ importOptions, inkClear }) {
29895
29963
  hasRawTokens,
29896
29964
  mapTokensEligible: generation.progress.mapTokensEligible
29897
29965
  });
29898
- return /* @__PURE__ */ jsx64(
29966
+ return /* @__PURE__ */ jsx63(
29899
29967
  GenerationScreen,
29900
29968
  {
29901
29969
  progress: generation.progress,
@@ -29907,10 +29975,10 @@ function App({ importOptions, inkClear }) {
29907
29975
  }
29908
29976
  );
29909
29977
  }
29910
- return /* @__PURE__ */ jsx64(Fragment20, {});
29978
+ return /* @__PURE__ */ jsx63(Fragment21, {});
29911
29979
  }
29912
29980
  if (pendingLaunch?.cached) {
29913
- return /* @__PURE__ */ jsx64(
29981
+ return /* @__PURE__ */ jsx63(
29914
29982
  TokenReuseScreen,
29915
29983
  {
29916
29984
  tokensPath: pendingLaunch.cached.tokensPath,
@@ -29921,7 +29989,7 @@ function App({ importOptions, inkClear }) {
29921
29989
  }
29922
29990
  );
29923
29991
  }
29924
- return /* @__PURE__ */ jsx64(
29992
+ return /* @__PURE__ */ jsx63(
29925
29993
  CredentialsScreen,
29926
29994
  {
29927
29995
  initial: importDefaults.credentials,
@@ -29930,19 +29998,17 @@ function App({ importOptions, inkClear }) {
29930
29998
  }
29931
29999
  );
29932
30000
  case "help":
29933
- return /* @__PURE__ */ jsx64(HelpScreen, { onDone: goToStart });
29934
- case "upgrade":
29935
- return /* @__PURE__ */ jsx64(UpgradeScreen, { onDone: goToStart });
30001
+ return /* @__PURE__ */ jsx63(HelpScreen, { onDone: goToStart });
29936
30002
  case "settings":
29937
- return /* @__PURE__ */ jsx64(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
30003
+ return /* @__PURE__ */ jsx63(SettingsScreen, { onNavigate: setScreen, onBack: goToStart });
29938
30004
  case "settings-configuration":
29939
- return /* @__PURE__ */ jsx64(ConfigurationScreen, { onDone: goToSettings });
30005
+ return /* @__PURE__ */ jsx63(ConfigurationScreen, { onDone: goToSettings });
29940
30006
  case "settings-opt-in-analytics":
29941
- return /* @__PURE__ */ jsx64(OptInAnalyticsScreen, { onDone: goToSettings });
30007
+ return /* @__PURE__ */ jsx63(OptInAnalyticsScreen, { onDone: goToSettings });
29942
30008
  case "settings-debug-mode":
29943
- return /* @__PURE__ */ jsx64(DebugModeScreen, { onDone: goToSettings });
30009
+ return /* @__PURE__ */ jsx63(DebugModeScreen, { onDone: goToSettings });
29944
30010
  case "start":
29945
- return /* @__PURE__ */ jsx64(HomeScreen, { onNavigate: setScreen });
30011
+ return /* @__PURE__ */ jsx63(HomeScreen, { onNavigate: setScreen });
29946
30012
  }
29947
30013
  }
29948
30014
  async function runApp(renderApp, importOptions) {
@@ -29950,7 +30016,7 @@ async function runApp(renderApp, importOptions) {
29950
30016
  instance.clear?.();
29951
30017
  process.stdout.write("\x1B[H\x1B[0J");
29952
30018
  };
29953
- const instance = renderApp(/* @__PURE__ */ jsx64(App, { importOptions, inkClear }));
30019
+ const instance = renderApp(/* @__PURE__ */ jsx63(App, { importOptions, inkClear }));
29954
30020
  await instance.waitUntilExit();
29955
30021
  }
29956
30022
  export {