@contentful/experience-design-system-cli 2.37.1-dev-build-3c845a01.0 → 2.37.1-dev-build-c3291210.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
@@ -263,9 +263,14 @@ var init_home = __esm({
263
263
  });
264
264
 
265
265
  // packages/experience-design-system-cli/src/tui/import/PageContainer.tsx
266
- import { Box as Box2, Text as Text3, useInput as useInput2 } from "ink";
266
+ import { useEffect as useEffect3 } from "react";
267
+ import { Box as Box2, Text as Text3, useInput as useInput2, useStdout as useStdout2 } from "ink";
267
268
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
268
269
  function ImportScreen({ exitCode, onDone }) {
270
+ const { stdout } = useStdout2();
271
+ useEffect3(() => {
272
+ stdout.write("\x1B[H\x1B[0J");
273
+ }, [stdout]);
269
274
  useInput2((input, key) => {
270
275
  if (key.return || key.escape || input === "q") {
271
276
  onDone();
@@ -2121,7 +2126,7 @@ async function runAgent(options) {
2121
2126
  promptLen: prompt.length,
2122
2127
  promptHead: prompt.slice(0, 500)
2123
2128
  });
2124
- return new Promise((resolve26) => {
2129
+ return new Promise((resolve25) => {
2125
2130
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
2126
2131
  const child = spawn3(binary, args, {
2127
2132
  stdio: ["pipe", "pipe", "pipe"],
@@ -2170,7 +2175,7 @@ async function runAgent(options) {
2170
2175
  stderrLen: stderr.length,
2171
2176
  stderrTail: stderr.slice(-1e3)
2172
2177
  });
2173
- resolve26(result);
2178
+ resolve25(result);
2174
2179
  });
2175
2180
  });
2176
2181
  }
@@ -2192,7 +2197,7 @@ async function checkAgentAuth(agent) {
2192
2197
  return "not-found";
2193
2198
  if (agent !== "claude")
2194
2199
  return "ok";
2195
- return new Promise((resolve26) => {
2200
+ return new Promise((resolve25) => {
2196
2201
  const child = spawn4(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
2197
2202
  let stdout = "";
2198
2203
  let done = false;
@@ -2201,7 +2206,7 @@ async function checkAgentAuth(agent) {
2201
2206
  return;
2202
2207
  done = true;
2203
2208
  child.kill("SIGTERM");
2204
- resolve26("unauthenticated");
2209
+ resolve25("unauthenticated");
2205
2210
  }, 5e3);
2206
2211
  child.stdout?.on("data", (chunk) => {
2207
2212
  stdout += chunk.toString();
@@ -2212,14 +2217,14 @@ async function checkAgentAuth(agent) {
2212
2217
  done = true;
2213
2218
  clearTimeout(timer);
2214
2219
  if (code !== 0) {
2215
- resolve26("unauthenticated");
2220
+ resolve25("unauthenticated");
2216
2221
  return;
2217
2222
  }
2218
2223
  try {
2219
2224
  const status = JSON.parse(stdout);
2220
- resolve26(status.loggedIn ? "ok" : "unauthenticated");
2225
+ resolve25(status.loggedIn ? "ok" : "unauthenticated");
2221
2226
  } catch {
2222
- resolve26("unauthenticated");
2227
+ resolve25("unauthenticated");
2223
2228
  }
2224
2229
  });
2225
2230
  });
@@ -2229,9 +2234,9 @@ async function binaryIsOnPath(binary) {
2229
2234
  const fs = await import("node:fs/promises");
2230
2235
  return fs.access(binary).then(() => true, () => false);
2231
2236
  }
2232
- return new Promise((resolve26) => {
2237
+ return new Promise((resolve25) => {
2233
2238
  const child = spawn4(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
2234
- child.on("close", (code) => resolve26(code === 0));
2239
+ child.on("close", (code) => resolve25(code === 0));
2235
2240
  });
2236
2241
  }
2237
2242
  var init_check_agent_auth = __esm({
@@ -13144,11 +13149,11 @@ var init_load_and_validate_for_review = __esm({
13144
13149
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
13145
13150
  import { resolve as resolve15 } from "node:path";
13146
13151
  async function getRefineSessionPaths(sessionId, artifactsRoot) {
13147
- const sessionDir2 = resolve15(artifactsRoot, sessionId);
13152
+ const sessionDir = resolve15(artifactsRoot, sessionId);
13148
13153
  return {
13149
- sessionDir: sessionDir2,
13150
- eventsPath: resolve15(sessionDir2, "events.jsonl"),
13151
- statePath: resolve15(sessionDir2, "current-review-state.json")
13154
+ sessionDir,
13155
+ eventsPath: resolve15(sessionDir, "events.jsonl"),
13156
+ statePath: resolve15(sessionDir, "current-review-state.json")
13152
13157
  };
13153
13158
  }
13154
13159
  var init_review_session_paths = __esm({
@@ -14901,7 +14906,7 @@ function errorMessage(error) {
14901
14906
  return error instanceof Error && error.message ? error.message : String(error);
14902
14907
  }
14903
14908
  function defaultSleep(delayMs) {
14904
- return new Promise((resolve26) => setTimeout(resolve26, delayMs));
14909
+ return new Promise((resolve25) => setTimeout(resolve25, delayMs));
14905
14910
  }
14906
14911
  var MAX_RETRY_AFTER_MS;
14907
14912
  var init_http_utils = __esm({
@@ -15177,7 +15182,7 @@ var init_api_client = __esm({
15177
15182
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
15178
15183
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
15179
15184
  const jitter = Math.random() * baseDelay * 0.15;
15180
- await new Promise((resolve26) => setTimeout(resolve26, baseDelay + jitter));
15185
+ await new Promise((resolve25) => setTimeout(resolve25, baseDelay + jitter));
15181
15186
  }
15182
15187
  }
15183
15188
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -18734,7 +18739,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
18734
18739
  const message = error instanceof Error ? error.message : String(error);
18735
18740
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
18736
18741
  throw error;
18737
- await new Promise((resolve26) => setTimeout(resolve26, Math.min(250 * attempt, 2e3)));
18742
+ await new Promise((resolve25) => setTimeout(resolve25, Math.min(250 * attempt, 2e3)));
18738
18743
  }
18739
18744
  }
18740
18745
  }
@@ -19716,7 +19721,7 @@ var init_scan_files = __esm({
19716
19721
  });
19717
19722
 
19718
19723
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
19719
- import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
19724
+ import { useEffect as useEffect4, useMemo, useState as useState5 } from "react";
19720
19725
  import { Box as Box5, Text as Text6 } from "ink";
19721
19726
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
19722
19727
  function Row({ row }) {
@@ -19767,7 +19772,7 @@ function PathValidationScreen({
19767
19772
  }) {
19768
19773
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
19769
19774
  const [scan, setScan] = useState5();
19770
- useEffect3(() => {
19775
+ useEffect4(() => {
19771
19776
  setScan(scanFiles(resolvedPath));
19772
19777
  }, [resolvedPath]);
19773
19778
  const phase = phaseOf(scan);
@@ -20217,10 +20222,10 @@ var init_theme = __esm({
20217
20222
  });
20218
20223
 
20219
20224
  // packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
20220
- import { useEffect as useEffect4, useState as useState7 } from "react";
20225
+ import { useEffect as useEffect5, useState as useState7 } from "react";
20221
20226
  function useElapsed() {
20222
20227
  const [seconds, setSeconds] = useState7(0);
20223
- useEffect4(() => {
20228
+ useEffect5(() => {
20224
20229
  const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
20225
20230
  return () => clearInterval(timer);
20226
20231
  }, []);
@@ -20520,12 +20525,13 @@ async function writeSettings2(settings) {
20520
20525
  async function updateSettings2(patch) {
20521
20526
  await writeSettings2({ ...await readSettings2(), ...patch });
20522
20527
  }
20523
- var configFilePath2, runsFilePath2, oldConfigDir2;
20528
+ var configFilePath2, runsFilePath2, debugSessionsDir2, oldConfigDir2;
20524
20529
  var init_config = __esm({
20525
20530
  "packages/experience-design-system-types/dist/src/config/index.js"() {
20526
20531
  "use strict";
20527
20532
  configFilePath2 = () => join19(configRoot2(), "config.json");
20528
20533
  runsFilePath2 = () => join19(configRoot2(), "state", "runs.json");
20534
+ debugSessionsDir2 = () => join19(configRoot2(), "debug", "sessions");
20529
20535
  oldConfigDir2 = () => join19(homedir3(), ".config", "experiences");
20530
20536
  }
20531
20537
  });
@@ -20804,209 +20810,12 @@ var init_run = __esm({
20804
20810
  }
20805
20811
  });
20806
20812
 
20807
- // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
20808
- async function readDebugModeSetting() {
20809
- const { debugMode } = await readSettings2();
20810
- return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
20811
- }
20812
- async function writeDebugModeSetting(setting) {
20813
- await updateSettings2({ debugMode: setting });
20814
- }
20815
- var DEFAULT_DEBUG_MODE_SETTING;
20816
- var init_debug_mode_store = __esm({
20817
- "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
20818
- "use strict";
20819
- init_config();
20820
- DEFAULT_DEBUG_MODE_SETTING = {
20821
- enabled: true
20822
- };
20823
- }
20824
- });
20825
-
20826
- // packages/experience-design-system-cli/src/tui/debug-store.ts
20827
- var debug_store_exports = {};
20828
- __export(debug_store_exports, {
20829
- currentDebugSessionDir: () => currentDebugSessionDir,
20830
- currentSessionDir: () => currentSessionDir,
20831
- finishDebugRun: () => finishDebugRun,
20832
- startDebugRun: () => startDebugRun,
20833
- startDebugSessionIn: () => startDebugSessionIn
20834
- });
20835
- import { mkdir as mkdir8, writeFile as writeFile7 } from "node:fs/promises";
20836
- import { existsSync as existsSync11, readdirSync as readdirSync3 } from "node:fs";
20837
- import { join as join22, resolve as resolve23 } from "node:path";
20838
- function generateRunId() {
20839
- const now = /* @__PURE__ */ new Date();
20840
- const pad = (n) => String(n).padStart(2, "0");
20841
- return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
20842
- }
20843
- function datePrefix(now = /* @__PURE__ */ new Date()) {
20844
- const pad = (n) => String(n).padStart(2, "0");
20845
- return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
20846
- }
20847
- function slugify(value) {
20848
- return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
20849
- }
20850
- async function readBaseDir() {
20851
- try {
20852
- const dir = (await readSettings2())["contentfulBaseDir"];
20853
- return typeof dir === "string" && dir !== "" ? resolve23(dir) : void 0;
20854
- } catch {
20855
- return void 0;
20856
- }
20857
- }
20858
- function nextSessionId(contentfulDir) {
20859
- const today = datePrefix();
20860
- const existing = existsSync11(contentfulDir) ? readdirSync3(contentfulDir) : [];
20861
- const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
20862
- const maxSeq = existing.reduce((max, entry) => {
20863
- const match2 = seqPattern.exec(entry);
20864
- return match2 ? Math.max(max, Number(match2[1])) : max;
20865
- }, 0);
20866
- return `${today}-session-${maxSeq + 1}`;
20867
- }
20868
- function startSession(base, { replace }) {
20869
- const contentfulDir = join22(base, ".contentful");
20870
- if (replace || !sessionDir) sessionDir = join22(contentfulDir, nextSessionId(contentfulDir));
20871
- return sessionDir;
20872
- }
20873
- function currentDebugSessionDir() {
20874
- return sessionDir && join22(sessionDir, "debug");
20875
- }
20876
- function currentSessionDir() {
20877
- return sessionDir;
20878
- }
20879
- async function startDebugSessionIn(base, { replace = false } = {}) {
20880
- try {
20881
- if (!await isDebugModeEnabled()) return;
20882
- await mkdir8(join22(startSession(resolve23(base), { replace }), "debug"), { recursive: true });
20883
- } catch {
20884
- }
20885
- }
20886
- async function isDebugModeEnabled() {
20887
- try {
20888
- return (await readDebugModeSetting()).enabled;
20889
- } catch {
20890
- return true;
20891
- }
20892
- }
20893
- function redact(value) {
20894
- const clone = { ...value };
20895
- if ("cma_token" in clone) {
20896
- const raw = clone.cma_token;
20897
- clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
20898
- }
20899
- return clone;
20900
- }
20901
- function startDebugRun({
20902
- flow,
20903
- step,
20904
- menuOption,
20905
- inputs
20906
- }) {
20907
- const runId = generateRunId();
20908
- const startedAt = Date.now();
20909
- const redactedInputs = redact(inputs);
20910
- isDebugModeEnabled().then((enabled) => {
20911
- if (!enabled) return;
20912
- pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
20913
- });
20914
- }
20915
- async function finishDebugRun({
20916
- outputs,
20917
- status,
20918
- exitMethod
20919
- }) {
20920
- const run = pendingRun;
20921
- if (!run) return;
20922
- pendingRun = void 0;
20923
- const durationMs = Date.now() - run.startedAt;
20924
- const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
20925
- const root = currentDebugSessionDir();
20926
- if (!root) return;
20927
- const flowSegments = run.flow.split("/");
20928
- const dir = join22(root, ...flowSegments);
20929
- await mkdir8(dir, { recursive: true });
20930
- const filename = nextAttemptFilename(dir, run.menuOption);
20931
- await writeFile7(join22(dir, filename), content, { mode: 384 });
20932
- }
20933
- function nextAttemptFilename(dir, menuOption) {
20934
- const today = datePrefix();
20935
- const optionSlug = slugify(menuOption);
20936
- const existing = existsSync11(dir) ? readdirSync3(dir) : [];
20937
- const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
20938
- const maxAttempt = existing.reduce((max, entry) => {
20939
- const match2 = attemptPattern.exec(entry);
20940
- return match2 ? Math.max(max, Number(match2[1])) : max;
20941
- }, 0);
20942
- return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
20943
- }
20944
- function renderMarkdown(run, finish) {
20945
- const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
20946
- const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
20947
- const flowSlug = run.flow.split("/").join("-");
20948
- return `# Debug Log
20949
-
20950
- - Run ID: ${run.runId}
20951
- - Flow: ${flowSlug}
20952
- - Step: ${stepLabel2}
20953
- - Menu option: ${run.menuOption}
20954
- - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
20955
- - CLI version: ${readPackageVersion()}
20956
- - Platform: ${process.platform} / Node ${process.version}
20957
- - Duration on screen: ${finish.durationMs}ms
20958
- - Status: ${finish.status}
20959
- - Exit method: ${finish.exitMethod}
20960
-
20961
- ## Inputs
20962
- \`\`\`json
20963
- ${JSON.stringify(run.inputs, null, 2)}
20964
- \`\`\`
20965
-
20966
- ## Outputs
20967
- \`\`\`json
20968
- ${JSON.stringify(finish.outputs, null, 2)}
20969
- \`\`\`
20970
- `;
20971
- }
20972
- function handleCrash() {
20973
- return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
20974
- }
20975
- var pendingRun, sessionDir;
20976
- var init_debug_store = __esm({
20977
- "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
20978
- "use strict";
20979
- init_config();
20980
- init_version();
20981
- init_debug_mode_store();
20982
- void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
20983
- if (!enabled || !base) return void 0;
20984
- return mkdir8(join22(startSession(base, { replace: false }), "debug"), { recursive: true });
20985
- });
20986
- process.once("uncaughtException", (err) => {
20987
- void handleCrash().finally(() => {
20988
- throw err;
20989
- });
20990
- });
20991
- process.once("unhandledRejection", (reason) => {
20992
- void handleCrash().finally(() => {
20993
- throw reason;
20994
- });
20995
- });
20996
- process.once("SIGINT", () => {
20997
- void handleCrash().finally(() => {
20998
- process.exit(130);
20999
- });
21000
- });
21001
- }
21002
- });
21003
-
21004
20813
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21005
- import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
20814
+ import { useEffect as useEffect6, useRef as useRef2, useState as useState8 } from "react";
21006
20815
  function useExtraction(input) {
21007
20816
  const [state, setState] = useState8();
21008
20817
  const current = useRef2();
21009
- useEffect5(() => {
20818
+ useEffect6(() => {
21010
20819
  current.current = input;
21011
20820
  if (!input) {
21012
20821
  setState(void 0);
@@ -21020,7 +20829,6 @@ function useExtraction(input) {
21020
20829
  reuseTokens: input.tokenStrategy === "reuse"
21021
20830
  })
21022
20831
  });
21023
- void Promise.resolve().then(() => (init_debug_store(), debug_store_exports)).then((store) => store.startDebugSessionIn(input.projectPath));
21024
20832
  void runExtraction(input, (progress) => {
21025
20833
  if (current.current === input) setState({ status: "running", progress });
21026
20834
  }).then((result) => {
@@ -21243,7 +21051,7 @@ var init_windowed_panel = __esm({
21243
21051
  });
21244
21052
 
21245
21053
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/panels/added-column.tsx
21246
- import React6 from "react";
21054
+ import React7 from "react";
21247
21055
  import { Box as Box11, Text as Text12 } from "ink";
21248
21056
  import figures from "figures";
21249
21057
  import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
@@ -21261,7 +21069,7 @@ function AddedColumn(props) {
21261
21069
  const aiFlagged = aiFlaggedByKey?.get(entry.name) === true;
21262
21070
  const showSeparator = firstNonCycleIdx > 0 && i === firstNonCycleIdx;
21263
21071
  const style = sideColumnLabelStyle({ isCycle: entry.isCycle, isSelected, focused });
21264
- return /* @__PURE__ */ jsxs11(React6.Fragment, { children: [
21072
+ return /* @__PURE__ */ jsxs11(React7.Fragment, { children: [
21265
21073
  showSeparator && /* @__PURE__ */ jsx14(Text12, { dimColor: true, children: "\u2500".repeat(Math.max(0, width - 2)) }),
21266
21074
  /* @__PURE__ */ jsxs11(Box11, { children: [
21267
21075
  isCursor ? /* @__PURE__ */ jsx14(Text12, { color: PALETTE2.info, bold: true, children: figures.pointer }) : /* @__PURE__ */ jsx14(Text12, { children: " " }),
@@ -22442,8 +22250,8 @@ var init_useImmediateInput = __esm({
22442
22250
  });
22443
22251
 
22444
22252
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
22445
- import { useStdout as useStdout2 } from "ink";
22446
- import { useEffect as useEffect6, useState as useState9 } from "react";
22253
+ import { useStdout as useStdout3 } from "ink";
22254
+ import { useEffect as useEffect7, useState as useState9 } from "react";
22447
22255
  function readTerminalSize(stdout) {
22448
22256
  return {
22449
22257
  columns: stdout?.columns ?? 80,
@@ -22451,9 +22259,9 @@ function readTerminalSize(stdout) {
22451
22259
  };
22452
22260
  }
22453
22261
  function useTerminalSize() {
22454
- const { stdout } = useStdout2();
22262
+ const { stdout } = useStdout3();
22455
22263
  const [size, setSize] = useState9(() => readTerminalSize(stdout));
22456
- useEffect6(() => {
22264
+ useEffect7(() => {
22457
22265
  const updateSize = () => setSize(readTerminalSize(stdout));
22458
22266
  stdout?.on("resize", updateSize);
22459
22267
  updateSize();
@@ -22470,7 +22278,7 @@ var init_use_terminal_size = __esm({
22470
22278
  });
22471
22279
 
22472
22280
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/components/HelpOverlay.tsx
22473
- import React7 from "react";
22281
+ import React8 from "react";
22474
22282
  import { Box as Box18, Text as Text20 } from "ink";
22475
22283
  import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
22476
22284
  function HelpOverlay(props) {
@@ -22494,7 +22302,7 @@ function HelpOverlay(props) {
22494
22302
  overflowY: "hidden",
22495
22303
  children: [
22496
22304
  /* @__PURE__ */ jsx22(Text20, { bold: true, children: "\u2500".repeat(titleRule) + " Help " + "\u2500".repeat(titleRule) }),
22497
- props.sections.map((section) => /* @__PURE__ */ jsxs19(React7.Fragment, { children: [
22305
+ props.sections.map((section) => /* @__PURE__ */ jsxs19(React8.Fragment, { children: [
22498
22306
  /* @__PURE__ */ jsx22(Text20, { children: " " }),
22499
22307
  /* @__PURE__ */ jsx22(Text20, { bold: true, children: section.title }),
22500
22308
  section.entries.map((entry) => /* @__PURE__ */ jsx22(Text20, { children: entry.keys ? " " + entry.keys.padEnd(16) + " " + entry.label : " " + entry.label }, entry.keys + entry.label))
@@ -23398,7 +23206,7 @@ var init_state = __esm({
23398
23206
  });
23399
23207
 
23400
23208
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
23401
- import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
23209
+ import { useEffect as useEffect8, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
23402
23210
  function useScopeGate({ components, onConfirm, onQuit }) {
23403
23211
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
23404
23212
  const columnPlan = useMemo2(() => computeColumnWidths(totalWidth), [totalWidth]);
@@ -23442,7 +23250,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
23442
23250
  return seed;
23443
23251
  });
23444
23252
  const seededGroupsRef = useRef4(closures.size > 0 || cycleParticipants.size > 0);
23445
- useEffect7(() => {
23253
+ useEffect8(() => {
23446
23254
  if (seededGroupsRef.current) return;
23447
23255
  if (closures.size === 0 && cycleParticipants.size === 0) return;
23448
23256
  seededGroupsRef.current = true;
@@ -23532,7 +23340,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
23532
23340
  entryCount: 0
23533
23341
  });
23534
23342
  const panelLayout = useMemo2(() => computePanelLayout(visibleCount), [visibleCount]);
23535
- useEffect7(() => {
23343
+ useEffect8(() => {
23536
23344
  setNav((prev) => {
23537
23345
  const maxIdx = Math.max(0, visibleRows.length - 1);
23538
23346
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24094,13 +23902,13 @@ var init_load = __esm({
24094
23902
  });
24095
23903
 
24096
23904
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24097
- import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef5, useState as useState13 } from "react";
23905
+ import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef5, useState as useState13 } from "react";
24098
23906
  function useScopeGateFlow(input, deps = realDeps2) {
24099
23907
  const sessionId = input?.sessionId;
24100
23908
  const loaded = useMemo3(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24101
23909
  const cacheCheck = useRef5(void 0);
24102
23910
  const [confirmed, setConfirmed] = useState13();
24103
- useEffect8(() => {
23911
+ useEffect9(() => {
24104
23912
  if (!input || !loaded?.ok || cacheCheck.current) return;
24105
23913
  cacheCheck.current = deps.checkCache(input.cache);
24106
23914
  }, [input, loaded]);
@@ -24242,7 +24050,7 @@ var init_save_decisions = __esm({
24242
24050
  });
24243
24051
 
24244
24052
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
24245
- import { resolve as resolve24 } from "node:path";
24053
+ import { resolve as resolve23 } from "node:path";
24246
24054
  async function runGeneration(input, onProgress, deps = realDeps3) {
24247
24055
  let progress = { components: null, mapTokens: "idle", mapTokensEligible: null };
24248
24056
  const update = (change) => {
@@ -24328,7 +24136,7 @@ async function buildMapTokensOptions(input) {
24328
24136
  if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
24329
24137
  if (mapOverride?.kind === "path") {
24330
24138
  await resolvePromptOverride(mapOverride);
24331
- prompt.skillPathOverride = resolve24(mapOverride.value);
24139
+ prompt.skillPathOverride = resolve23(mapOverride.value);
24332
24140
  }
24333
24141
  if (input.existingEntitiesPath) {
24334
24142
  const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
@@ -24375,11 +24183,11 @@ var init_run2 = __esm({
24375
24183
  });
24376
24184
 
24377
24185
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
24378
- import { useEffect as useEffect9, useRef as useRef6, useState as useState14 } from "react";
24186
+ import { useEffect as useEffect10, useRef as useRef6, useState as useState14 } from "react";
24379
24187
  function useGeneration(input) {
24380
24188
  const [state, setState] = useState14();
24381
24189
  const current = useRef6();
24382
- useEffect9(() => {
24190
+ useEffect10(() => {
24383
24191
  current.current = input;
24384
24192
  if (!input) {
24385
24193
  setState(void 0);
@@ -24406,7 +24214,7 @@ var init_use_generation = __esm({
24406
24214
  });
24407
24215
 
24408
24216
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
24409
- import { join as join23 } from "node:path";
24217
+ import { join as join22 } from "node:path";
24410
24218
  function buildFlowStart(input) {
24411
24219
  const { extraction, handoff, saved, generatePromptPath } = input;
24412
24220
  const credentials = extraction.credentials ?? {
@@ -24419,7 +24227,7 @@ function buildFlowStart(input) {
24419
24227
  handoff,
24420
24228
  agent: extraction.agent,
24421
24229
  projectPath: extraction.projectPath,
24422
- outDir: extraction.projectPath ? join23(extraction.projectPath, ".contentful") : "",
24230
+ outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
24423
24231
  rawTokensPath: extraction.rawTokensPath,
24424
24232
  credentials: {
24425
24233
  spaceId: credentials.spaceId,
@@ -25254,7 +25062,7 @@ var init_scroll_offset = __esm({
25254
25062
  });
25255
25063
 
25256
25064
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
25257
- import React8, { useEffect as useEffect10, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
25065
+ import React9, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
25258
25066
  import figures5 from "figures";
25259
25067
  import { Box as Box21, measureElement, Text as Text23 } from "ink";
25260
25068
  import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
@@ -25934,9 +25742,9 @@ function FieldEditor({
25934
25742
  const [editorState, setEditorState] = useState15(initialState);
25935
25743
  const [parseErr] = useState15(parseError);
25936
25744
  const [listScrollStart, setListScrollStart] = useState15(0);
25937
- const initialFocusScrollApplied = React8.useRef(false);
25745
+ const initialFocusScrollApplied = React9.useRef(false);
25938
25746
  const [rowHeights, setRowHeights] = useState15({});
25939
- const rowMeasureRefs = React8.useRef(/* @__PURE__ */ new Map());
25747
+ const rowMeasureRefs = React9.useRef(/* @__PURE__ */ new Map());
25940
25748
  const initialFocus = (() => {
25941
25749
  if (initialFocusTarget?.kind === "description") {
25942
25750
  return {
@@ -26023,23 +25831,23 @@ function FieldEditor({
26023
25831
  const [showHelp, setShowHelp] = useState15(false);
26024
25832
  const props = editorState.props;
26025
25833
  const slots = editorState.slots;
26026
- const contentPropIndexes = React8.useMemo(
25834
+ const contentPropIndexes = React9.useMemo(
26027
25835
  () => props.flatMap((prop, index) => prop.category === "content" ? [index] : []),
26028
25836
  [props]
26029
25837
  );
26030
- const designPropIndexes = React8.useMemo(
25838
+ const designPropIndexes = React9.useMemo(
26031
25839
  () => props.flatMap((prop, index) => prop.category === "design" ? [index] : []),
26032
25840
  [props]
26033
25841
  );
26034
- const hiddenPropIndexes = React8.useMemo(
25842
+ const hiddenPropIndexes = React9.useMemo(
26035
25843
  () => showHiddenProps ? props.flatMap((prop, index) => prop.category === "state" || prop.category === "unattached" ? [index] : []) : [],
26036
25844
  [props, showHiddenProps]
26037
25845
  );
26038
- const visiblePropIndexes = React8.useMemo(
25846
+ const visiblePropIndexes = React9.useMemo(
26039
25847
  () => [...contentPropIndexes, ...designPropIndexes, ...hiddenPropIndexes],
26040
25848
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes]
26041
25849
  );
26042
- const propGroups = React8.useMemo(
25850
+ const propGroups = React9.useMemo(
26043
25851
  () => [
26044
25852
  {
26045
25853
  kind: "content",
@@ -26059,7 +25867,7 @@ function FieldEditor({
26059
25867
  ],
26060
25868
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes]
26061
25869
  );
26062
- const selectableRows = React8.useMemo(
25870
+ const selectableRows = React9.useMemo(
26063
25871
  () => [
26064
25872
  ...contentPropIndexes.map((idx) => ({ kind: "prop", idx })),
26065
25873
  ...designPropIndexes.map((idx) => ({ kind: "prop", idx })),
@@ -26069,7 +25877,7 @@ function FieldEditor({
26069
25877
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes, slots]
26070
25878
  );
26071
25879
  const visiblePropPosition = visiblePropIndexes.indexOf(propIdx);
26072
- const selectedSelectableIndex = React8.useMemo(
25880
+ const selectedSelectableIndex = React9.useMemo(
26073
25881
  () => selectableRows.findIndex(
26074
25882
  (row) => inSlots ? row.kind === "slot" && row.idx === slotIdx : row.kind === "prop" && row.idx === propIdx
26075
25883
  ),
@@ -26088,12 +25896,12 @@ function FieldEditor({
26088
25896
  }
26089
25897
  };
26090
25898
  const textEntryActive = focusLevel === "field" && editingField && activeField === "description" || focusLevel === "field" && editingField && activeField === "default" && (editorState.props[propIdx]?.type === "string" || editorState.props[propIdx]?.type === "token") || editingValue != null;
26091
- React8.useEffect(() => {
25899
+ React9.useEffect(() => {
26092
25900
  onTextEntryActiveChange?.(textEntryActive);
26093
25901
  }, [textEntryActive, onTextEntryActiveChange]);
26094
25902
  const currentProp = props[propIdx] ?? null;
26095
25903
  const currentSlot = slots[slotIdx] ?? null;
26096
- React8.useEffect(() => {
25904
+ React9.useEffect(() => {
26097
25905
  if (showHiddenProps || inSlots || inComponentDesc || visiblePropPosition >= 0) return;
26098
25906
  if (visiblePropIndexes.length > 0) {
26099
25907
  setPropIdx(visiblePropIndexes[0]);
@@ -26112,22 +25920,22 @@ function FieldEditor({
26112
25920
  setEditorState(next);
26113
25921
  onChange(serializeState(next, value));
26114
25922
  };
26115
- const canonicalize = React8.useCallback((json) => {
25923
+ const canonicalize = React9.useCallback((json) => {
26116
25924
  try {
26117
25925
  return JSON.stringify(JSON.parse(json));
26118
25926
  } catch {
26119
25927
  return `__unparseable__:${json}`;
26120
25928
  }
26121
25929
  }, []);
26122
- const initialStateRef = React8.useRef(initialState);
25930
+ const initialStateRef = React9.useRef(initialState);
26123
25931
  const baselineCanonical = canonicalize(serializeState(initialStateRef.current, value));
26124
25932
  const currentCanonical = canonicalize(serializeState(editorState, value));
26125
25933
  const isDirty = currentCanonical !== baselineCanonical;
26126
- React8.useEffect(() => {
25934
+ React9.useEffect(() => {
26127
25935
  onDirtyChange?.(isDirty);
26128
25936
  }, [isDirty, onDirtyChange]);
26129
- const lastDiscardTriggerRef = React8.useRef(discardTrigger);
26130
- React8.useEffect(() => {
25937
+ const lastDiscardTriggerRef = React9.useRef(discardTrigger);
25938
+ React9.useEffect(() => {
26131
25939
  if (discardTrigger === void 0) return;
26132
25940
  if (discardTrigger === lastDiscardTriggerRef.current) return;
26133
25941
  lastDiscardTriggerRef.current = discardTrigger;
@@ -26726,7 +26534,7 @@ function FieldEditor({
26726
26534
  }
26727
26535
  return Math.max(start + 1, end2);
26728
26536
  };
26729
- useEffect10(() => {
26537
+ useEffect11(() => {
26730
26538
  if (focusLevel === "field" || selectedRowIdx < 0) return;
26731
26539
  setListScrollStart((previous) => {
26732
26540
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -28097,7 +27905,7 @@ var init_FinalizeDialog = __esm({
28097
27905
  });
28098
27906
 
28099
27907
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
28100
- import { useEffect as useEffect11, useRef as useRef7, useState as useState16 } from "react";
27908
+ import { useEffect as useEffect12, useRef as useRef7, useState as useState16 } from "react";
28101
27909
  function useReviewFinalizePreview({
28102
27910
  components,
28103
27911
  ...options
@@ -28114,7 +27922,7 @@ function useFinalizePreview(opts) {
28114
27922
  const [scrollOffset, setScrollOffset] = useState16(0);
28115
27923
  const generationRef = useRef7(0);
28116
27924
  const acceptedKey = [...acceptedKeys].sort().join("\0");
28117
- useEffect11(() => {
27925
+ useEffect12(() => {
28118
27926
  if (!open) {
28119
27927
  setStatus("idle");
28120
27928
  setRemoved([]);
@@ -28166,7 +27974,7 @@ var init_use_finalize_preview = __esm({
28166
27974
  });
28167
27975
 
28168
27976
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
28169
- import { useCallback as useCallback2, useEffect as useEffect12, useRef as useRef8, useState as useState17 } from "react";
27977
+ import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef8, useState as useState17 } from "react";
28170
27978
  function useReviewSession({
28171
27979
  loadSession,
28172
27980
  tokensPath,
@@ -28185,7 +27993,7 @@ function useReviewSession({
28185
27993
  }));
28186
27994
  return { result, catalog };
28187
27995
  }, [loadSession, tokensPath]);
28188
- useEffect12(() => {
27996
+ useEffect13(() => {
28189
27997
  let disposed = false;
28190
27998
  void (async () => {
28191
27999
  try {
@@ -28238,7 +28046,7 @@ function useReviewSession({
28238
28046
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
28239
28047
  const [reviewMetadata, setReviewMetadata] = useState17(null);
28240
28048
  const [componentRationale, setComponentRationale] = useState17(null);
28241
- useEffect12(() => {
28049
+ useEffect13(() => {
28242
28050
  const current = components[selectedIdx];
28243
28051
  if (!current) {
28244
28052
  setReviewMetadata(null);
@@ -28270,7 +28078,7 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
28270
28078
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
28271
28079
  const historyRef = useRef8(null);
28272
28080
  const historySeededRef = useRef8(false);
28273
- useEffect12(() => {
28081
+ useEffect13(() => {
28274
28082
  if (loading || historySeededRef.current) return;
28275
28083
  historySeededRef.current = true;
28276
28084
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -28352,7 +28160,7 @@ var init_token_suggestions = __esm({
28352
28160
  });
28353
28161
 
28354
28162
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
28355
- import { useEffect as useEffect13, useRef as useRef9, useState as useState18 } from "react";
28163
+ import { useEffect as useEffect14, useRef as useRef9, useState as useState18 } from "react";
28356
28164
  function parseReviewEntry(draftValue) {
28357
28165
  const parsed = JSON.parse(draftValue);
28358
28166
  const keys = Object.keys(parsed);
@@ -28386,7 +28194,7 @@ function useReviewEditor({
28386
28194
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState18(/* @__PURE__ */ new Set());
28387
28195
  const tokenReviewSuggestedRef = useRef9(/* @__PURE__ */ new Map());
28388
28196
  const pendingGRef = useRef9(false);
28389
- useEffect13(() => {
28197
+ useEffect14(() => {
28390
28198
  setTokenReviewRow(0);
28391
28199
  setTokenReviewEditing(false);
28392
28200
  setTokenReviewEditCursor(0);
@@ -28859,7 +28667,7 @@ var init_preview_annotations = __esm({
28859
28667
  });
28860
28668
 
28861
28669
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
28862
- import { useCallback as useCallback3, useEffect as useEffect14, useRef as useRef10, useState as useState20 } from "react";
28670
+ import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef10, useState as useState20 } from "react";
28863
28671
  function useLivePreview(opts) {
28864
28672
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
28865
28673
  const [status, setStatus] = useState20("idle");
@@ -28869,14 +28677,14 @@ function useLivePreview(opts) {
28869
28677
  const latestRef = useRef10(0);
28870
28678
  const inflightRef = useRef10(0);
28871
28679
  const optsRef = useRef10(opts);
28872
- useEffect14(() => {
28680
+ useEffect15(() => {
28873
28681
  optsRef.current = opts;
28874
28682
  });
28875
28683
  const disabledRef = useRef10(disabled);
28876
- useEffect14(() => {
28684
+ useEffect15(() => {
28877
28685
  disabledRef.current = disabled;
28878
28686
  }, [disabled]);
28879
- useEffect14(() => {
28687
+ useEffect15(() => {
28880
28688
  return () => {
28881
28689
  if (timerRef.current) {
28882
28690
  clearTimeout(timerRef.current);
@@ -28957,7 +28765,7 @@ var init_use_live_preview = __esm({
28957
28765
  });
28958
28766
 
28959
28767
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
28960
- import { useCallback as useCallback4, useEffect as useEffect15, useState as useState21 } from "react";
28768
+ import { useCallback as useCallback4, useEffect as useEffect16, useState as useState21 } from "react";
28961
28769
  function useReviewPreview({
28962
28770
  components,
28963
28771
  loading,
@@ -28999,13 +28807,13 @@ function useReviewPreview({
28999
28807
  deleteAllComponents
29000
28808
  });
29001
28809
  const [spinnerTick, setSpinnerTick] = useState21(0);
29002
- useEffect15(() => {
28810
+ useEffect16(() => {
29003
28811
  if (livePreviewHook.status !== "running") return;
29004
28812
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
29005
28813
  return () => clearInterval(id);
29006
28814
  }, [livePreviewHook.status]);
29007
28815
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
29008
- useEffect15(() => {
28816
+ useEffect16(() => {
29009
28817
  if (loading) return;
29010
28818
  if (!livePreview) return;
29011
28819
  if (components.length === 0) return;
@@ -29062,7 +28870,7 @@ var init_LivePreviewSummary = __esm({
29062
28870
  });
29063
28871
 
29064
28872
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
29065
- import { useCallback as useCallback5, useEffect as useEffect16, useMemo as useMemo4, useRef as useRef11, useState as useState22 } from "react";
28873
+ import { useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo4, useRef as useRef11, useState as useState22 } from "react";
29066
28874
  import figures7 from "figures";
29067
28875
  import { Box as Box33, Text as Text36 } from "ink";
29068
28876
  import { Fragment as Fragment13, jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
@@ -29383,7 +29191,7 @@ function GenerateReviewStepView({
29383
29191
  [components]
29384
29192
  );
29385
29193
  const closures = useMemo4(() => computeAllClosures(componentGraph), [componentGraph]);
29386
- useEffect16(() => {
29194
+ useEffect17(() => {
29387
29195
  if (seededGroupsRef.current) return;
29388
29196
  if (closures.size === 0 && slotCycles.length === 0) return;
29389
29197
  seededGroupsRef.current = true;
@@ -29410,7 +29218,7 @@ function GenerateReviewStepView({
29410
29218
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
29411
29219
  }));
29412
29220
  }, [slotCycles, cycleView]);
29413
- useEffect16(() => {
29221
+ useEffect17(() => {
29414
29222
  const decision = computeAutoRejectDecision({
29415
29223
  loading,
29416
29224
  autoRejectFired: autoRejectFiredRef.current,
@@ -29454,7 +29262,7 @@ function GenerateReviewStepView({
29454
29262
  applySnapshot: applyHistorySnapshot
29455
29263
  });
29456
29264
  const autoRejectPushedRef = useRef11(false);
29457
- useEffect16(() => {
29265
+ useEffect17(() => {
29458
29266
  if (loading) return;
29459
29267
  if (!historySeededRef.current) return;
29460
29268
  if (!autoRejectFiredRef.current) return;
@@ -29538,7 +29346,7 @@ function GenerateReviewStepView({
29538
29346
  const panelHeight = leftPanelHeight + 2;
29539
29347
  const panelContentHeight = Math.max(1, panelHeight - 3);
29540
29348
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
29541
- useEffect16(() => {
29349
+ useEffect17(() => {
29542
29350
  if (selectableRowPositions.length === 0) return;
29543
29351
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
29544
29352
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -30615,7 +30423,7 @@ var init_DoneStep = __esm({
30615
30423
  });
30616
30424
 
30617
30425
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
30618
- import { resolve as resolve25 } from "node:path";
30426
+ import { resolve as resolve24 } from "node:path";
30619
30427
  import { homedir as homedir4 } from "node:os";
30620
30428
  function expandTilde(input) {
30621
30429
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -30629,7 +30437,7 @@ function normalizePath(input) {
30629
30437
  p = p.slice(1, -1);
30630
30438
  }
30631
30439
  p = expandTilde(p);
30632
- return resolve25(p);
30440
+ return resolve24(p);
30633
30441
  }
30634
30442
  var init_path_utils = __esm({
30635
30443
  "packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
@@ -30638,10 +30446,10 @@ var init_path_utils = __esm({
30638
30446
  });
30639
30447
 
30640
30448
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
30641
- import { useEffect as useEffect17, useState as useState23 } from "react";
30449
+ import { useEffect as useEffect18, useState as useState23 } from "react";
30642
30450
  function useBlinkingCursor() {
30643
30451
  const [visible, setVisible] = useState23(true);
30644
- useEffect17(() => {
30452
+ useEffect18(() => {
30645
30453
  const interval = setInterval(() => setVisible((current) => !current), 500);
30646
30454
  return () => clearInterval(interval);
30647
30455
  }, []);
@@ -30656,8 +30464,8 @@ var init_use_blinking_cursor = __esm({
30656
30464
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
30657
30465
  import { useState as useState24 } from "react";
30658
30466
  import { Box as Box37, Text as Text40 } from "ink";
30659
- import { readdirSync as readdirSync4 } from "node:fs";
30660
- import { dirname as dirname15, basename as basename6, join as join24 } from "node:path";
30467
+ import { readdirSync as readdirSync3 } from "node:fs";
30468
+ import { dirname as dirname15, basename as basename6, join as join23 } from "node:path";
30661
30469
  import { jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
30662
30470
  function autocomplete(partial) {
30663
30471
  if (!partial) return null;
@@ -30666,19 +30474,19 @@ function autocomplete(partial) {
30666
30474
  const base = basename6(normalized);
30667
30475
  let entries;
30668
30476
  try {
30669
- entries = readdirSync4(dir);
30477
+ entries = readdirSync3(dir);
30670
30478
  } catch {
30671
30479
  return null;
30672
30480
  }
30673
30481
  const matches = entries.filter((e) => e.startsWith(base));
30674
30482
  if (matches.length === 0) return null;
30675
- if (matches.length === 1) return join24(dir, matches[0]);
30483
+ if (matches.length === 1) return join23(dir, matches[0]);
30676
30484
  let prefix = matches[0];
30677
30485
  for (const m of matches) {
30678
30486
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
30679
30487
  if (!prefix) break;
30680
30488
  }
30681
- return prefix.length > base.length ? join24(dir, prefix) : null;
30489
+ return prefix.length > base.length ? join23(dir, prefix) : null;
30682
30490
  }
30683
30491
  function PathPrompt({
30684
30492
  defaultPath,
@@ -30768,12 +30576,12 @@ var init_StepHeader = __esm({
30768
30576
  });
30769
30577
 
30770
30578
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
30771
- import { useEffect as useEffect18, useState as useState25 } from "react";
30579
+ import { useEffect as useEffect19, useState as useState25 } from "react";
30772
30580
  import { Spinner as Spinner2 } from "@inkjs/ui";
30773
30581
  import { jsx as jsx49 } from "react/jsx-runtime";
30774
30582
  function useTimedSpinner() {
30775
30583
  const [elapsedSeconds, setElapsedSeconds] = useState25(0);
30776
- useEffect18(() => {
30584
+ useEffect19(() => {
30777
30585
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
30778
30586
  return () => {
30779
30587
  clearInterval(timer);
@@ -31019,7 +30827,7 @@ var init_preview_confirmation_input = __esm({
31019
30827
  });
31020
30828
 
31021
30829
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
31022
- import { useEffect as useEffect19, useState as useState26, useMemo as useMemo5 } from "react";
30830
+ import { useEffect as useEffect20, useState as useState26, useMemo as useMemo5 } from "react";
31023
30831
  import { Box as Box40, Text as Text43 } from "ink";
31024
30832
  import { Fragment as Fragment15, jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
31025
30833
  function buildPreviewSummaryLines(preview) {
@@ -31231,7 +31039,7 @@ function WizardPreviewStep({
31231
31039
  const activeLines = diffExpanded ? diffLines : summaryLines;
31232
31040
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
31233
31041
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
31234
- useEffect19(() => {
31042
+ useEffect20(() => {
31235
31043
  setScrollOffset((previous) => Math.min(previous, maxScroll));
31236
31044
  }, [maxScroll]);
31237
31045
  useImmediateInput((input, key) => {
@@ -31335,7 +31143,7 @@ var init_run_teaser = __esm({
31335
31143
  });
31336
31144
 
31337
31145
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
31338
- import { useEffect as useEffect20, useRef as useRef12 } from "react";
31146
+ import { useEffect as useEffect21, useRef as useRef12 } from "react";
31339
31147
  import { Box as Box41 } from "ink";
31340
31148
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
31341
31149
  function totalStepsFor(state) {
@@ -31357,7 +31165,7 @@ function FlowScreen({
31357
31165
  const totalSteps = totalStepsFor(state);
31358
31166
  const quit = () => onExit(0);
31359
31167
  const previousStep = useRef12(state.step);
31360
- useEffect20(() => {
31168
+ useEffect21(() => {
31361
31169
  if (previousStep.current !== state.step) {
31362
31170
  onStepChange?.();
31363
31171
  previousStep.current = state.step;
@@ -31881,8 +31689,8 @@ var init_run_print_files_helpers = __esm({
31881
31689
  });
31882
31690
 
31883
31691
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
31884
- import { writeFile as writeFile8 } from "node:fs/promises";
31885
- import { join as join25 } from "node:path";
31692
+ import { writeFile as writeFile7 } from "node:fs/promises";
31693
+ import { join as join24 } from "node:path";
31886
31694
  function buildSavedCDF(components, tokens, opts = {}) {
31887
31695
  const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
31888
31696
  if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
@@ -31894,7 +31702,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
31894
31702
  }
31895
31703
  async function runPrintFiles(input, deps, onPatch) {
31896
31704
  onPatch({ step: "printing" });
31897
- const componentsPath = join25(input.outDir, "components.json");
31705
+ const componentsPath = join24(input.outDir, "components.json");
31898
31706
  try {
31899
31707
  const db = deps.openDb();
31900
31708
  let components = [];
@@ -31978,10 +31786,10 @@ var init_save = __esm({
31978
31786
  realSaveDeps = () => ({
31979
31787
  openDb: openPipelineDb,
31980
31788
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
31981
- writeFile: (path5, contents) => writeFile8(path5, contents),
31789
+ writeFile: (path5, contents) => writeFile7(path5, contents),
31982
31790
  appendRun,
31983
31791
  buildSourceFingerprint,
31984
- sleep: (ms) => new Promise((resolve26) => setTimeout(resolve26, ms)),
31792
+ sleep: (ms) => new Promise((resolve25) => setTimeout(resolve25, ms)),
31985
31793
  warn: (message) => process.stderr.write(message)
31986
31794
  });
31987
31795
  }
@@ -32001,9 +31809,9 @@ var init_types9 = __esm({
32001
31809
 
32002
31810
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
32003
31811
  import { appendFileSync, writeFileSync } from "node:fs";
32004
- import { mkdir as mkdir9 } from "node:fs/promises";
31812
+ import { mkdir as mkdir8 } from "node:fs/promises";
32005
31813
  import { tmpdir } from "node:os";
32006
- import { join as join26 } from "node:path";
31814
+ import { join as join25 } from "node:path";
32007
31815
  function appendWizardLog(entry) {
32008
31816
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
32009
31817
  }
@@ -32011,9 +31819,6 @@ function startWizardLog() {
32011
31819
  writeFileSync(WIZARD_LOG, `--- experiences import session ${(/* @__PURE__ */ new Date()).toISOString()} ---
32012
31820
  `);
32013
31821
  }
32014
- async function realSessionDir() {
32015
- return (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).currentSessionDir();
32016
- }
32017
31822
  function realFlowDeps() {
32018
31823
  const log = (entry) => appendWizardLog(entry);
32019
31824
  return {
@@ -32029,14 +31834,13 @@ function realFlowDeps() {
32029
31834
  }
32030
31835
  },
32031
31836
  mkdir: async (path5) => {
32032
- await mkdir9(path5, { recursive: true });
31837
+ await mkdir8(path5, { recursive: true });
32033
31838
  },
32034
31839
  detectSaveConflict,
32035
31840
  buildTimestampedSubdir,
32036
31841
  rejectComponentsByName,
32037
31842
  log,
32038
- stderr: (text) => process.stderr.write(text),
32039
- sessionDir: realSessionDir
31843
+ stderr: (text) => process.stderr.write(text)
32040
31844
  };
32041
31845
  }
32042
31846
  function initialFlowState(start) {
@@ -32177,9 +31981,6 @@ function createFlowController(start, deps) {
32177
31981
  const startSave = (opts, patch = {}) => {
32178
31982
  pendingSave = opts;
32179
31983
  update({ ...patch, step: "path-prompt" });
32180
- void deps.sessionDir?.().then((session) => {
32181
- if (session && state.step === "path-prompt") update({ outDir: join26(session, "dsi-import") });
32182
- });
32183
31984
  };
32184
31985
  const proceedToWrite = async (path5) => {
32185
31986
  update({ outDir: path5 });
@@ -32284,12 +32085,12 @@ var init_controller = __esm({
32284
32085
  init_push();
32285
32086
  init_save();
32286
32087
  init_types9();
32287
- WIZARD_LOG = join26(tmpdir(), "experiences-import-wizard.log");
32088
+ WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
32288
32089
  }
32289
32090
  });
32290
32091
 
32291
32092
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
32292
- import { useEffect as useEffect21, useRef as useRef13, useSyncExternalStore } from "react";
32093
+ import { useEffect as useEffect22, useRef as useRef13, useSyncExternalStore } from "react";
32293
32094
  function useFlow(start, deps = realFlowDeps) {
32294
32095
  const controller = useRef13();
32295
32096
  if (start && !controller.current) {
@@ -32304,7 +32105,7 @@ function useFlow(start, deps = realFlowDeps) {
32304
32105
  (listener) => current?.subscribe(listener) ?? (() => void 0),
32305
32106
  () => current?.getState()
32306
32107
  );
32307
- useEffect21(() => {
32108
+ useEffect22(() => {
32308
32109
  if (!start) controller.current = void 0;
32309
32110
  }, [start]);
32310
32111
  return current && state ? { controller: current, state } : void 0;
@@ -32316,13 +32117,183 @@ var init_use_flow = __esm({
32316
32117
  }
32317
32118
  });
32318
32119
 
32120
+ // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
32121
+ async function readDebugModeSetting() {
32122
+ const { debugMode } = await readSettings2();
32123
+ return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
32124
+ }
32125
+ async function writeDebugModeSetting(setting) {
32126
+ await updateSettings2({ debugMode: setting });
32127
+ }
32128
+ var DEFAULT_DEBUG_MODE_SETTING;
32129
+ var init_debug_mode_store = __esm({
32130
+ "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
32131
+ "use strict";
32132
+ init_config();
32133
+ DEFAULT_DEBUG_MODE_SETTING = {
32134
+ enabled: true
32135
+ };
32136
+ }
32137
+ });
32138
+
32139
+ // packages/experience-design-system-cli/src/tui/debug-store.ts
32140
+ import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
32141
+ import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
32142
+ import { join as join26 } from "node:path";
32143
+ function generateRunId() {
32144
+ const now = /* @__PURE__ */ new Date();
32145
+ const pad = (n) => String(n).padStart(2, "0");
32146
+ return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
32147
+ }
32148
+ function datePrefix(now = /* @__PURE__ */ new Date()) {
32149
+ const pad = (n) => String(n).padStart(2, "0");
32150
+ return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
32151
+ }
32152
+ function slugify(value) {
32153
+ return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
32154
+ }
32155
+ function generateSessionId3() {
32156
+ const today = datePrefix();
32157
+ const root = debugSessionsDir2();
32158
+ const existing = existsSync11(root) ? readdirSync4(root) : [];
32159
+ const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
32160
+ const maxSeq = existing.reduce((max, entry) => {
32161
+ const match2 = seqPattern.exec(entry);
32162
+ return match2 ? Math.max(max, Number(match2[1])) : max;
32163
+ }, 0);
32164
+ return `${today}-session-${maxSeq + 1}`;
32165
+ }
32166
+ function sessionDebugDir() {
32167
+ return join26(debugSessionsDir2(), SESSION_ID);
32168
+ }
32169
+ function currentDebugSessionDir() {
32170
+ return sessionDebugDir();
32171
+ }
32172
+ async function isDebugModeEnabled() {
32173
+ try {
32174
+ return (await readDebugModeSetting()).enabled;
32175
+ } catch {
32176
+ return true;
32177
+ }
32178
+ }
32179
+ function redact(value) {
32180
+ const clone = { ...value };
32181
+ if ("cma_token" in clone) {
32182
+ const raw = clone.cma_token;
32183
+ clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
32184
+ }
32185
+ return clone;
32186
+ }
32187
+ function startDebugRun({
32188
+ flow,
32189
+ step,
32190
+ menuOption,
32191
+ inputs
32192
+ }) {
32193
+ const runId = generateRunId();
32194
+ const startedAt = Date.now();
32195
+ const redactedInputs = redact(inputs);
32196
+ isDebugModeEnabled().then((enabled) => {
32197
+ if (!enabled) return;
32198
+ pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
32199
+ });
32200
+ }
32201
+ async function finishDebugRun({
32202
+ outputs,
32203
+ status,
32204
+ exitMethod
32205
+ }) {
32206
+ const run = pendingRun;
32207
+ if (!run) return;
32208
+ pendingRun = void 0;
32209
+ const durationMs = Date.now() - run.startedAt;
32210
+ const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
32211
+ const flowSegments = run.flow.split("/");
32212
+ const dir = join26(sessionDebugDir(), ...flowSegments);
32213
+ await mkdir9(dir, { recursive: true });
32214
+ const filename = nextAttemptFilename(dir, run.menuOption);
32215
+ await writeFile8(join26(dir, filename), content, { mode: 384 });
32216
+ }
32217
+ function nextAttemptFilename(dir, menuOption) {
32218
+ const today = datePrefix();
32219
+ const optionSlug = slugify(menuOption);
32220
+ const existing = existsSync11(dir) ? readdirSync4(dir) : [];
32221
+ const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
32222
+ const maxAttempt = existing.reduce((max, entry) => {
32223
+ const match2 = attemptPattern.exec(entry);
32224
+ return match2 ? Math.max(max, Number(match2[1])) : max;
32225
+ }, 0);
32226
+ return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
32227
+ }
32228
+ function renderMarkdown(run, finish) {
32229
+ const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
32230
+ const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
32231
+ const flowSlug = run.flow.split("/").join("-");
32232
+ return `# Debug Log
32233
+
32234
+ - Run ID: ${run.runId}
32235
+ - Flow: ${flowSlug}
32236
+ - Step: ${stepLabel2}
32237
+ - Menu option: ${run.menuOption}
32238
+ - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
32239
+ - CLI version: ${readPackageVersion()}
32240
+ - Platform: ${process.platform} / Node ${process.version}
32241
+ - Duration on screen: ${finish.durationMs}ms
32242
+ - Status: ${finish.status}
32243
+ - Exit method: ${finish.exitMethod}
32244
+
32245
+ ## Inputs
32246
+ \`\`\`json
32247
+ ${JSON.stringify(run.inputs, null, 2)}
32248
+ \`\`\`
32249
+
32250
+ ## Outputs
32251
+ \`\`\`json
32252
+ ${JSON.stringify(finish.outputs, null, 2)}
32253
+ \`\`\`
32254
+ `;
32255
+ }
32256
+ function handleCrash() {
32257
+ return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
32258
+ }
32259
+ var pendingRun, SESSION_ID;
32260
+ var init_debug_store = __esm({
32261
+ "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
32262
+ "use strict";
32263
+ init_config();
32264
+ init_version();
32265
+ init_debug_mode_store();
32266
+ SESSION_ID = generateSessionId3();
32267
+ void isDebugModeEnabled().then((enabled) => {
32268
+ if (!enabled) return void 0;
32269
+ return mkdir9(sessionDebugDir(), { recursive: true });
32270
+ });
32271
+ process.once("uncaughtException", (err) => {
32272
+ void handleCrash().finally(() => {
32273
+ throw err;
32274
+ });
32275
+ });
32276
+ process.once("unhandledRejection", (reason) => {
32277
+ void handleCrash().finally(() => {
32278
+ throw reason;
32279
+ });
32280
+ });
32281
+ process.once("SIGINT", () => {
32282
+ void handleCrash().finally(() => {
32283
+ process.exit(130);
32284
+ });
32285
+ });
32286
+ }
32287
+ });
32288
+
32319
32289
  // packages/experience-design-system-cli/src/tui/help/help-info.ts
32320
32290
  async function readHelpInfo() {
32321
32291
  const debugMode = await readDebugModeSetting();
32322
32292
  return {
32323
32293
  storage: [
32324
32294
  { label: "Config folder", value: configRoot2() },
32325
- { label: "Settings file", value: configFilePath2() }
32295
+ { label: "Settings file", value: configFilePath2() },
32296
+ { label: "Debug logs", value: debugSessionsDir2() }
32326
32297
  ],
32327
32298
  troubleshooting: [
32328
32299
  { label: "CLI version", value: readPackageVersion() },
@@ -32331,7 +32302,7 @@ async function readHelpInfo() {
32331
32302
  { label: "Debug Mode", value: debugMode.enabled ? "on" : "off" },
32332
32303
  {
32333
32304
  label: "This session",
32334
- value: !debugMode.enabled ? "no logs written while Debug Mode is off" : currentDebugSessionDir() ?? "not started: set the Root Project Directory in Settings, or start an import"
32305
+ value: debugMode.enabled ? currentDebugSessionDir() : "no logs written while Debug Mode is off"
32335
32306
  }
32336
32307
  ]
32337
32308
  };
@@ -32347,7 +32318,7 @@ var init_help_info = __esm({
32347
32318
  });
32348
32319
 
32349
32320
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
32350
- import { useEffect as useEffect22, useState as useState27 } from "react";
32321
+ import { useEffect as useEffect23, useState as useState27 } from "react";
32351
32322
  import { Box as Box42, Text as Text44, useInput as useInput9 } from "ink";
32352
32323
  import { Fragment as Fragment16, jsx as jsx53, jsxs as jsxs43 } from "react/jsx-runtime";
32353
32324
  function Section({ title, rows }) {
@@ -32361,7 +32332,7 @@ function Section({ title, rows }) {
32361
32332
  }
32362
32333
  function HelpScreen({ onDone }) {
32363
32334
  const [info, setInfo] = useState27();
32364
- useEffect22(() => {
32335
+ useEffect23(() => {
32365
32336
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
32366
32337
  void readHelpInfo().then(setInfo);
32367
32338
  }, []);
@@ -32488,8 +32459,7 @@ async function readCredentials() {
32488
32459
  cmaToken: store.cmaToken || "",
32489
32460
  host: store.host || "",
32490
32461
  defaultComponentDir: store.defaultComponentDir || "",
32491
- defaultTokenFile: store.defaultTokenFile || "",
32492
- contentfulBaseDir: store.contentfulBaseDir || ""
32462
+ defaultTokenFile: store.defaultTokenFile || ""
32493
32463
  };
32494
32464
  }
32495
32465
  async function writeCredentials(config) {
@@ -32511,7 +32481,7 @@ var init_config_store = __esm({
32511
32481
  });
32512
32482
 
32513
32483
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
32514
- import { useEffect as useEffect23, useState as useState29 } from "react";
32484
+ import { useEffect as useEffect24, useState as useState29 } from "react";
32515
32485
  import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
32516
32486
  import TextInput4 from "ink-text-input";
32517
32487
  import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -32522,8 +32492,7 @@ function debugFields(config) {
32522
32492
  cma_token: config?.cmaToken ?? "",
32523
32493
  host: config?.host ?? "",
32524
32494
  default_component_dir: config?.defaultComponentDir ?? "",
32525
- default_token_file: config?.defaultTokenFile ?? "",
32526
- contentful_base_dir: config?.contentfulBaseDir ?? ""
32495
+ default_token_file: config?.defaultTokenFile ?? ""
32527
32496
  };
32528
32497
  }
32529
32498
  function ConfigurationScreen({ onDone }) {
@@ -32534,7 +32503,7 @@ function ConfigurationScreen({ onDone }) {
32534
32503
  const [lastSaved, setLastSaved] = useState29(null);
32535
32504
  const [editing, setEditing] = useState29(false);
32536
32505
  const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
32537
- useEffect23(() => {
32506
+ useEffect24(() => {
32538
32507
  readCredentials().then((cfg) => {
32539
32508
  setConfig(cfg);
32540
32509
  setStage("form");
@@ -32561,7 +32530,6 @@ function ConfigurationScreen({ onDone }) {
32561
32530
  setNotice(null);
32562
32531
  writeCredentials(config).then(() => {
32563
32532
  setLastSaved(config);
32564
- if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
32565
32533
  setNotice({ kind: "success", text: "Configuration saved" });
32566
32534
  setStage("form");
32567
32535
  }).catch((err) => {
@@ -32627,7 +32595,10 @@ function ConfigurationScreen({ onDone }) {
32627
32595
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
32628
32596
  return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
32629
32597
  /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
32630
- /* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
32598
+ /* @__PURE__ */ jsxs45(Text46, { bold: isActive, children: [
32599
+ FIELD_LABELS[field],
32600
+ ":"
32601
+ ] }),
32631
32602
  isActive && editing ? /* @__PURE__ */ jsx55(
32632
32603
  TextInput4,
32633
32604
  {
@@ -32636,8 +32607,7 @@ function ConfigurationScreen({ onDone }) {
32636
32607
  onSubmit: () => setEditing(false),
32637
32608
  mask: field === "cmaToken" ? "\u2022" : void 0
32638
32609
  }
32639
- ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
32640
- FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
32610
+ ) : /* @__PURE__ */ jsx55(Text46, { children: display || /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" }) })
32641
32611
  ] }, field);
32642
32612
  }) }),
32643
32613
  notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
@@ -32668,7 +32638,7 @@ function ConfigurationScreen({ onDone }) {
32668
32638
  )
32669
32639
  ] });
32670
32640
  }
32671
- var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
32641
+ var FIELD_ORDER, FIELD_LABELS;
32672
32642
  var init_ContentfulConfigScreen = __esm({
32673
32643
  "packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
32674
32644
  "use strict";
@@ -32682,22 +32652,16 @@ var init_ContentfulConfigScreen = __esm({
32682
32652
  "cmaToken",
32683
32653
  "host",
32684
32654
  "defaultComponentDir",
32685
- "defaultTokenFile",
32686
- "contentfulBaseDir"
32655
+ "defaultTokenFile"
32687
32656
  ];
32688
32657
  FIELD_LABELS = {
32689
32658
  spaceId: "Space ID",
32690
32659
  environmentId: "Environment ID",
32691
32660
  cmaToken: "CMA Token",
32692
- host: "API Host",
32693
- defaultComponentDir: "Default component directory",
32694
- defaultTokenFile: "Default token file",
32695
- contentfulBaseDir: "Root Project Directory"
32661
+ host: "API Host (optional)",
32662
+ defaultComponentDir: "Default component directory (optional)",
32663
+ defaultTokenFile: "Default token file (optional)"
32696
32664
  };
32697
- FIELD_HINTS = {
32698
- contentfulBaseDir: "(where .contentful goes)"
32699
- };
32700
- LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
32701
32665
  }
32702
32666
  });
32703
32667
 
@@ -32723,13 +32687,13 @@ var init_analytics_store = __esm({
32723
32687
  });
32724
32688
 
32725
32689
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
32726
- import { useEffect as useEffect24, useState as useState30 } from "react";
32690
+ import { useEffect as useEffect25, useState as useState30 } from "react";
32727
32691
  import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
32728
32692
  import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
32729
32693
  function OptInAnalyticsScreen({ onDone }) {
32730
32694
  const [loading, setLoading] = useState30(true);
32731
32695
  const [enabled, setEnabled] = useState30(true);
32732
- useEffect24(() => {
32696
+ useEffect25(() => {
32733
32697
  readAnalyticsSetting().then((setting) => {
32734
32698
  setEnabled(setting.enabled);
32735
32699
  setLoading(false);
@@ -32792,12 +32756,12 @@ var init_screen11 = __esm({
32792
32756
  });
32793
32757
 
32794
32758
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
32795
- import { useEffect as useEffect25, useState as useState31 } from "react";
32759
+ import { useEffect as useEffect26, useState as useState31 } from "react";
32796
32760
  import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
32797
32761
  import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
32798
32762
  function UpgradeScreen({ onDone }) {
32799
32763
  const [upgradeCheck, setUpgradeCheck] = useState31();
32800
- useEffect25(() => {
32764
+ useEffect26(() => {
32801
32765
  startDebugRun({
32802
32766
  flow: "upgrade",
32803
32767
  step: "01-upgrade",
@@ -32872,13 +32836,13 @@ var init_PageContainer4 = __esm({
32872
32836
  });
32873
32837
 
32874
32838
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
32875
- import { useEffect as useEffect26, useState as useState32 } from "react";
32839
+ import { useEffect as useEffect27, useState as useState32 } from "react";
32876
32840
  import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
32877
32841
  import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
32878
32842
  function DebugModeScreen({ onDone }) {
32879
32843
  const [loading, setLoading] = useState32(true);
32880
32844
  const [enabled, setEnabled] = useState32(true);
32881
- useEffect26(() => {
32845
+ useEffect27(() => {
32882
32846
  readDebugModeSetting().then((setting) => {
32883
32847
  setEnabled(setting.enabled);
32884
32848
  setLoading(false);
@@ -32941,7 +32905,7 @@ __export(app_exports, {
32941
32905
  runApp: () => runApp
32942
32906
  });
32943
32907
  import { join as join27 } from "node:path";
32944
- import { useEffect as useEffect27, useState as useState33 } from "react";
32908
+ import { useEffect as useEffect28, useState as useState33 } from "react";
32945
32909
  import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
32946
32910
  function App({ importOptions, inkClear }) {
32947
32911
  const [screen, setScreen] = useState33("start");
@@ -32973,7 +32937,7 @@ function App({ importOptions, inkClear }) {
32973
32937
  const [flowStart, setFlowStart] = useState33();
32974
32938
  const flow = useFlow(flowStart);
32975
32939
  const [importDefaults, setImportDefaults] = useState33();
32976
- useEffect27(() => {
32940
+ useEffect28(() => {
32977
32941
  if (screen !== "import") {
32978
32942
  setImportDefaults(void 0);
32979
32943
  return;
@@ -33031,12 +32995,12 @@ function App({ importOptions, inkClear }) {
33031
32995
  }
33032
32996
  });
33033
32997
  };
33034
- useEffect27(() => {
32998
+ useEffect28(() => {
33035
32999
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
33036
33000
  setExtractionRun(void 0);
33037
33001
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
33038
33002
  }, [extraction, extractionRun]);
33039
- useEffect27(() => {
33003
+ useEffect28(() => {
33040
33004
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
33041
33005
  const { extraction: produced, input, generatePromptPath } = scopeRun;
33042
33006
  setGenerationInput({
@@ -33054,7 +33018,7 @@ function App({ importOptions, inkClear }) {
33054
33018
  ...generatePromptPath ? { generatePromptPath } : {}
33055
33019
  });
33056
33020
  }, [scopeFlow, scopeRun, generationInput]);
33057
- useEffect27(() => {
33021
+ useEffect28(() => {
33058
33022
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
33059
33023
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
33060
33024
  inkClear();
@@ -33105,7 +33069,10 @@ function App({ importOptions, inkClear }) {
33105
33069
  state: flow.state,
33106
33070
  controller: flow.controller,
33107
33071
  generatePromptPath: flowStart.generatePromptPath,
33108
- onExit: setImportExitCode,
33072
+ onExit: (code) => {
33073
+ inkClear();
33074
+ setImportExitCode(code);
33075
+ },
33109
33076
  onStepChange: inkClear
33110
33077
  }
33111
33078
  );
@@ -33367,14 +33334,14 @@ function runDevWatch(args) {
33367
33334
  process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
33368
33335
  return Promise.resolve(1);
33369
33336
  }
33370
- return new Promise((resolve26) => {
33337
+ return new Promise((resolve25) => {
33371
33338
  const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
33372
33339
  process.on("SIGINT", () => void 0);
33373
- child.on("exit", (code) => resolve26(code ?? 0));
33340
+ child.on("exit", (code) => resolve25(code ?? 0));
33374
33341
  child.on("error", (err) => {
33375
33342
  process.stderr.write(`${err.message}
33376
33343
  `);
33377
- resolve26(1);
33344
+ resolve25(1);
33378
33345
  });
33379
33346
  });
33380
33347
  }