@contentful/experience-design-system-cli 2.42.1-dev-build-9c1908dc.0 → 2.42.1-dev-build-c7f654e2.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
@@ -8318,8 +8318,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
8318
8318
  continue;
8319
8319
  const entryPath = join5(dir, entry);
8320
8320
  try {
8321
- const stat5 = statSync2(entryPath);
8322
- if (stat5.isDirectory()) {
8321
+ const stat6 = statSync2(entryPath);
8322
+ if (stat6.isDirectory()) {
8323
8323
  scanDir(entryPath, depth + 1);
8324
8324
  }
8325
8325
  } catch {
@@ -11834,11 +11834,11 @@ function getPathPreferenceScore(filePath) {
11834
11834
  const normalized = filePath.replace(/\\/g, "/");
11835
11835
  const segments = normalized.split("/").filter(Boolean);
11836
11836
  const filename = segments.at(-1) ?? "";
11837
- const basename7 = filename.replace(/\.[^.]+$/, "");
11837
+ const basename8 = filename.replace(/\.[^.]+$/, "");
11838
11838
  let score = 0;
11839
11839
  if (/^index\.[jt]sx?$/.test(filename))
11840
11840
  score += 100;
11841
- if (basename7 && segments.at(-2) === basename7)
11841
+ if (basename8 && segments.at(-2) === basename8)
11842
11842
  score -= 10;
11843
11843
  const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
11844
11844
  score -= componentsSegmentCount * 8;
@@ -13785,15 +13785,15 @@ import { statSync as statSync4 } from "node:fs";
13785
13785
  import path4 from "node:path";
13786
13786
  function collectFiles(root, options = {}) {
13787
13787
  const resolved = path4.resolve(root);
13788
- let stat5;
13788
+ let stat6;
13789
13789
  try {
13790
- stat5 = statSync4(resolved);
13790
+ stat6 = statSync4(resolved);
13791
13791
  } catch (err) {
13792
13792
  return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
13793
13793
  }
13794
- if (stat5.isFile())
13794
+ if (stat6.isFile())
13795
13795
  return { ok: false, failure: "is-file", rootPath: resolved };
13796
- if (!stat5.isDirectory())
13796
+ if (!stat6.isDirectory())
13797
13797
  return { ok: false, failure: "not-directory", rootPath: resolved };
13798
13798
  const result = {
13799
13799
  filePaths: [],
@@ -19501,6 +19501,7 @@ __export(debug_store_exports, {
19501
19501
  currentSessionDir: () => currentSessionDir,
19502
19502
  finishDebugRun: () => finishDebugRun,
19503
19503
  setDebugRunProgress: () => setDebugRunProgress,
19504
+ settleDebugLogs: () => settleDebugLogs,
19504
19505
  startDebugRun: () => startDebugRun,
19505
19506
  startDebugSessionIn: () => startDebugSessionIn,
19506
19507
  startImportRun: () => startImportRun
@@ -19605,7 +19606,19 @@ function startDebugRun({
19605
19606
  function setDebugRunProgress(outputs) {
19606
19607
  if (pendingRun) pendingRun.progress = outputs;
19607
19608
  }
19608
- async function finishDebugRun({
19609
+ function track(work) {
19610
+ unsettled.add(work);
19611
+ const forget = () => void unsettled.delete(work);
19612
+ work.then(forget, forget);
19613
+ return work;
19614
+ }
19615
+ async function settleDebugLogs() {
19616
+ while (unsettled.size > 0) await Promise.allSettled([...unsettled]);
19617
+ }
19618
+ function finishDebugRun(args) {
19619
+ return track(finishRun(args));
19620
+ }
19621
+ async function finishRun({
19609
19622
  outputs,
19610
19623
  status,
19611
19624
  exitMethod
@@ -19688,7 +19701,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
19688
19701
  function handleCrash() {
19689
19702
  return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
19690
19703
  }
19691
- var pendingRun, sessionDir, WAITING_LIMIT, waiting;
19704
+ var pendingRun, sessionDir, unsettled, WAITING_LIMIT, waiting;
19692
19705
  var init_debug_store = __esm({
19693
19706
  "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
19694
19707
  "use strict";
@@ -19718,6 +19731,7 @@ var init_debug_store = __esm({
19718
19731
  );
19719
19732
  }
19720
19733
  });
19734
+ unsettled = /* @__PURE__ */ new Set();
19721
19735
  WAITING_LIMIT = 50;
19722
19736
  waiting = [];
19723
19737
  process.once("uncaughtException", (err) => {
@@ -19860,10 +19874,135 @@ var init_controls = __esm({
19860
19874
  }
19861
19875
  });
19862
19876
 
19877
+ // packages/experience-design-system-cli/src/tui/zip.ts
19878
+ import { crc32, deflateRawSync } from "node:zlib";
19879
+ function dosDateTime(date) {
19880
+ const year = Math.max(1980, date.getFullYear());
19881
+ return {
19882
+ day: year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate(),
19883
+ time: date.getHours() << 11 | date.getMinutes() << 5 | date.getSeconds() >> 1
19884
+ };
19885
+ }
19886
+ function createZip(entries) {
19887
+ const body = [];
19888
+ const directory = [];
19889
+ let offset = 0;
19890
+ for (const entry of entries) {
19891
+ const name = Buffer.from(entry.name, "utf8");
19892
+ const compressed = deflateRawSync(entry.data);
19893
+ const checksum = crc32(entry.data);
19894
+ const { day, time } = dosDateTime(entry.modified);
19895
+ const local = Buffer.alloc(30);
19896
+ local.writeUInt32LE(LOCAL_HEADER, 0);
19897
+ local.writeUInt16LE(VERSION2, 4);
19898
+ local.writeUInt16LE(UTF8_NAMES, 6);
19899
+ local.writeUInt16LE(DEFLATE, 8);
19900
+ local.writeUInt16LE(time, 10);
19901
+ local.writeUInt16LE(day, 12);
19902
+ local.writeUInt32LE(checksum, 14);
19903
+ local.writeUInt32LE(compressed.length, 18);
19904
+ local.writeUInt32LE(entry.data.length, 22);
19905
+ local.writeUInt16LE(name.length, 26);
19906
+ body.push(local, name, compressed);
19907
+ const central = Buffer.alloc(46);
19908
+ central.writeUInt32LE(CENTRAL_HEADER, 0);
19909
+ central.writeUInt16LE(VERSION2, 4);
19910
+ central.writeUInt16LE(VERSION2, 6);
19911
+ central.writeUInt16LE(UTF8_NAMES, 8);
19912
+ central.writeUInt16LE(DEFLATE, 10);
19913
+ central.writeUInt16LE(time, 12);
19914
+ central.writeUInt16LE(day, 14);
19915
+ central.writeUInt32LE(checksum, 16);
19916
+ central.writeUInt32LE(compressed.length, 20);
19917
+ central.writeUInt32LE(entry.data.length, 24);
19918
+ central.writeUInt16LE(name.length, 28);
19919
+ central.writeUInt32LE(offset, 42);
19920
+ directory.push(central, name);
19921
+ offset += local.length + name.length + compressed.length;
19922
+ }
19923
+ const directoryBytes = Buffer.concat(directory);
19924
+ const end = Buffer.alloc(22);
19925
+ end.writeUInt32LE(END_OF_ARCHIVE, 0);
19926
+ end.writeUInt16LE(entries.length, 8);
19927
+ end.writeUInt16LE(entries.length, 10);
19928
+ end.writeUInt32LE(directoryBytes.length, 12);
19929
+ end.writeUInt32LE(offset, 16);
19930
+ return Buffer.concat([...body, directoryBytes, end]);
19931
+ }
19932
+ var LOCAL_HEADER, CENTRAL_HEADER, END_OF_ARCHIVE, VERSION2, UTF8_NAMES, DEFLATE;
19933
+ var init_zip = __esm({
19934
+ "packages/experience-design-system-cli/src/tui/zip.ts"() {
19935
+ "use strict";
19936
+ LOCAL_HEADER = 67324752;
19937
+ CENTRAL_HEADER = 33639248;
19938
+ END_OF_ARCHIVE = 101010256;
19939
+ VERSION2 = 20;
19940
+ UTF8_NAMES = 2048;
19941
+ DEFLATE = 8;
19942
+ }
19943
+ });
19944
+
19945
+ // packages/experience-design-system-cli/src/tui/support-bundle.ts
19946
+ import { spawn as spawn4 } from "node:child_process";
19947
+ import { readdir as readdir3, readFile as readFile21, stat as stat5, writeFile as writeFile8 } from "node:fs/promises";
19948
+ import { basename as basename6, dirname as dirname16, join as join20, sep } from "node:path";
19949
+ async function bundleDebugLogs() {
19950
+ const session = currentSessionDir();
19951
+ const debugDir = currentDebugSessionDir();
19952
+ if (!session || !debugDir) return { status: "no-logs" };
19953
+ try {
19954
+ await settleDebugLogs();
19955
+ const logs = (await readdir3(debugDir, { recursive: true })).filter((file) => file.endsWith(".md")).sort();
19956
+ if (logs.length === 0) return { status: "no-logs" };
19957
+ const entries = await Promise.all(
19958
+ logs.map(async (file) => {
19959
+ const path6 = join20(debugDir, file);
19960
+ return { name: file.split(sep).join("/"), data: await readFile21(path6), modified: (await stat5(path6)).mtime };
19961
+ })
19962
+ );
19963
+ const path5 = join20(session, `${basename6(session)}-debug-logs.zip`);
19964
+ await writeFile8(path5, createZip(entries), { mode: 384 });
19965
+ return { status: "created", path: path5, files: entries.length };
19966
+ } catch {
19967
+ return { status: "failed", folder: debugDir };
19968
+ }
19969
+ }
19970
+ function openSupportBundle(bundle) {
19971
+ if (bundle.status === "no-logs") return;
19972
+ const target = bundle.status === "created" ? bundle.path : bundle.folder;
19973
+ const command = process.platform === "darwin" ? { file: "open", args: bundle.status === "created" ? ["-R", target] : [target] } : process.platform === "win32" ? { file: "explorer.exe", args: bundle.status === "created" ? [`/select,${target}`] : [target] } : { file: "xdg-open", args: [bundle.status === "created" ? dirname16(target) : target] };
19974
+ try {
19975
+ const child = spawn4(command.file, command.args, { stdio: "ignore", detached: true });
19976
+ child.on("error", () => void 0);
19977
+ child.unref();
19978
+ } catch {
19979
+ }
19980
+ }
19981
+ function supportInstruction(bundle) {
19982
+ switch (bundle.status) {
19983
+ case "created":
19984
+ return `Debug logs saved to ${bundle.path}
19985
+ Send this file to Contentful support so they can look into it.`;
19986
+ case "no-logs":
19987
+ return "No debug logs were recorded. To get help, turn on Debug Mode in Settings, run the import again and send the zip file it saves to Contentful support.";
19988
+ case "failed":
19989
+ return `Your debug logs are in ${bundle.folder}
19990
+ Zip that folder and send it to Contentful support so they can look into it.`;
19991
+ }
19992
+ }
19993
+ var init_support_bundle = __esm({
19994
+ "packages/experience-design-system-cli/src/tui/support-bundle.ts"() {
19995
+ "use strict";
19996
+ init_debug_store();
19997
+ init_zip();
19998
+ }
19999
+ });
20000
+
19863
20001
  // packages/experience-design-system-cli/src/tui/import/shared/error-step/logic.ts
19864
20002
  function errorAction(input, key, available) {
19865
20003
  if (key.return && available.canAcknowledge) return "acknowledge";
19866
20004
  if (input === "r" && available.canRetry) return "retry";
20005
+ if (input === "o" && available.canOpen) return "open";
19867
20006
  if (key.return || key.escape) return "exit";
19868
20007
  return null;
19869
20008
  }
@@ -19871,7 +20010,8 @@ function errorControls(available) {
19871
20010
  return [
19872
20011
  available.canAcknowledge ? { keys: "Enter", label: "Acknowledge and apply" } : { keys: "Enter", label: "Exit" },
19873
20012
  ...available.canAcknowledge ? [{ keys: "Esc", label: "Exit" }] : [],
19874
- ...available.canRetry ? [{ keys: "r", label: "Re-enter credentials" }] : []
20013
+ ...available.canRetry ? [{ keys: "r", label: "Re-enter credentials" }] : [],
20014
+ ...available.canOpen ? [{ keys: "o", label: "Show debug logs in file manager" }] : []
19875
20015
  ];
19876
20016
  }
19877
20017
  var init_logic2 = __esm({
@@ -19886,10 +20026,12 @@ function useErrorControls(handlers) {
19886
20026
  useInput4((input, key) => {
19887
20027
  const action = errorAction(input, key, {
19888
20028
  canRetry: handlers.onRetry !== void 0,
19889
- canAcknowledge: handlers.onAcknowledge !== void 0
20029
+ canAcknowledge: handlers.onAcknowledge !== void 0,
20030
+ canOpen: handlers.onOpen !== void 0
19890
20031
  });
19891
20032
  if (action === "acknowledge") handlers.onAcknowledge?.();
19892
20033
  else if (action === "retry") handlers.onRetry?.();
20034
+ else if (action === "open") handlers.onOpen?.();
19893
20035
  else if (action === "exit") handlers.onExit();
19894
20036
  });
19895
20037
  }
@@ -19900,6 +20042,28 @@ var init_controls2 = __esm({
19900
20042
  }
19901
20043
  });
19902
20044
 
20045
+ // packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
20046
+ import { useEffect as useEffect3, useState as useState3 } from "react";
20047
+ function useSupportBundle() {
20048
+ const [bundle, setBundle] = useState3();
20049
+ useEffect3(() => {
20050
+ let active = true;
20051
+ void bundleDebugLogs().then((result) => {
20052
+ if (active) setBundle(result);
20053
+ });
20054
+ return () => {
20055
+ active = false;
20056
+ };
20057
+ }, []);
20058
+ return bundle;
20059
+ }
20060
+ var init_use_support_bundle = __esm({
20061
+ "packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts"() {
20062
+ "use strict";
20063
+ init_support_bundle();
20064
+ }
20065
+ });
20066
+
19903
20067
  // packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
19904
20068
  import { Box as Box4, Text as Text4 } from "ink";
19905
20069
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -19910,10 +20074,18 @@ function ErrorStep({
19910
20074
  onRetryCredentials,
19911
20075
  onAcknowledgeBreakingChanges
19912
20076
  }) {
19913
- useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
20077
+ const bundle = useSupportBundle();
20078
+ const canOpen = bundle !== void 0 && bundle.status !== "no-logs";
20079
+ useErrorControls({
20080
+ onExit,
20081
+ onRetry: onRetryCredentials,
20082
+ onAcknowledge: onAcknowledgeBreakingChanges,
20083
+ onOpen: canOpen ? () => openSupportBundle(bundle) : void 0
20084
+ });
19914
20085
  const controls = errorControls({
19915
20086
  canRetry: onRetryCredentials !== void 0,
19916
- canAcknowledge: onAcknowledgeBreakingChanges !== void 0
20087
+ canAcknowledge: onAcknowledgeBreakingChanges !== void 0,
20088
+ canOpen
19917
20089
  });
19918
20090
  return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
19919
20091
  /* @__PURE__ */ jsxs4(Text4, { bold: true, color: PALETTE.error, children: [
@@ -19922,6 +20094,7 @@ function ErrorStep({
19922
20094
  " failed"
19923
20095
  ] }),
19924
20096
  /* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
20097
+ bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
19925
20098
  /* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
19926
20099
  "[",
19927
20100
  control.keys,
@@ -19934,8 +20107,10 @@ var init_error_step = __esm({
19934
20107
  "packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx"() {
19935
20108
  "use strict";
19936
20109
  init_theme();
20110
+ init_support_bundle();
19937
20111
  init_controls2();
19938
20112
  init_logic2();
20113
+ init_use_support_bundle();
19939
20114
  }
19940
20115
  });
19941
20116
 
@@ -20186,10 +20361,10 @@ var init_theme2 = __esm({
20186
20361
  });
20187
20362
 
20188
20363
  // packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
20189
- import { useEffect as useEffect3, useState as useState3 } from "react";
20364
+ import { useEffect as useEffect4, useState as useState4 } from "react";
20190
20365
  function useElapsed() {
20191
- const [seconds2, setSeconds] = useState3(0);
20192
- useEffect3(() => {
20366
+ const [seconds2, setSeconds] = useState4(0);
20367
+ useEffect4(() => {
20193
20368
  const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
20194
20369
  return () => clearInterval(timer);
20195
20370
  }, []);
@@ -20272,13 +20447,13 @@ var init_shared2 = __esm({
20272
20447
  });
20273
20448
 
20274
20449
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
20275
- import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
20450
+ import { useEffect as useEffect5, useRef, useState as useState5 } from "react";
20276
20451
  import { Box as Box9, Text as Text9 } from "ink";
20277
20452
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
20278
20453
  function PreflightScreen({ onChoose, onQuit }) {
20279
- const [focus, setFocus] = useState4(0);
20454
+ const [focus, setFocus] = useState5(0);
20280
20455
  const viewed = useRef([optionAt(0)]).current;
20281
- useEffect4(() => {
20456
+ useEffect5(() => {
20282
20457
  startDebugRun({
20283
20458
  flow: "import/preflight",
20284
20459
  step: "00-preflight",
@@ -20403,13 +20578,13 @@ var init_controls4 = __esm({
20403
20578
  });
20404
20579
 
20405
20580
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
20406
- import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
20581
+ import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
20407
20582
  import { Box as Box10, Text as Text10 } from "ink";
20408
20583
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
20409
20584
  function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
20410
- const [projectPath, setProjectPath] = useState5(initialPath);
20585
+ const [projectPath, setProjectPath] = useState6(initialPath);
20411
20586
  const visit = useRef3({ emptySubmits: 0 }).current;
20412
- useEffect5(() => {
20587
+ useEffect6(() => {
20413
20588
  startDebugRun({
20414
20589
  flow: "import/welcome",
20415
20590
  step: "01-welcome",
@@ -20558,7 +20733,7 @@ var init_validate_path = __esm({
20558
20733
  });
20559
20734
 
20560
20735
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
20561
- import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
20736
+ import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
20562
20737
  import { Box as Box11, Text as Text11 } from "ink";
20563
20738
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
20564
20739
  function TokenInputScreen({
@@ -20567,10 +20742,10 @@ function TokenInputScreen({
20567
20742
  onBack,
20568
20743
  initialPath = ""
20569
20744
  }) {
20570
- const [tokenPath, setTokenPath] = useState6(initialPath);
20571
- const [failure, setFailure] = useState6(null);
20745
+ const [tokenPath, setTokenPath] = useState7(initialPath);
20746
+ const [failure, setFailure] = useState7(null);
20572
20747
  const rejected = useRef4([]).current;
20573
- useEffect6(() => {
20748
+ useEffect7(() => {
20574
20749
  startDebugRun({
20575
20750
  flow: "import/token-input",
20576
20751
  step: "02-token-input",
@@ -20812,7 +20987,7 @@ var init_scan_files = __esm({
20812
20987
  });
20813
20988
 
20814
20989
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
20815
- import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
20990
+ import { useEffect as useEffect8, useMemo, useState as useState8 } from "react";
20816
20991
  import { Box as Box12, Text as Text12 } from "ink";
20817
20992
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
20818
20993
  function Row({ row }) {
@@ -20868,8 +21043,8 @@ function PathValidationScreen({
20868
21043
  hasTokens = true
20869
21044
  }) {
20870
21045
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20871
- const [scan, setScan] = useState7();
20872
- useEffect7(() => {
21046
+ const [scan, setScan] = useState8();
21047
+ useEffect8(() => {
20873
21048
  startDebugRun({
20874
21049
  flow: "import/path-validation",
20875
21050
  step: "03-path-validation",
@@ -20877,7 +21052,7 @@ function PathValidationScreen({
20877
21052
  inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
20878
21053
  });
20879
21054
  }, []);
20880
- useEffect7(() => {
21055
+ useEffect8(() => {
20881
21056
  setScan(scanFiles(resolvedPath));
20882
21057
  }, [resolvedPath]);
20883
21058
  const phase = phaseOf(scan);
@@ -20932,7 +21107,7 @@ var init_screen4 = __esm({
20932
21107
  });
20933
21108
 
20934
21109
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
20935
- import { useState as useState8 } from "react";
21110
+ import { useState as useState9 } from "react";
20936
21111
  import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
20937
21112
  import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
20938
21113
  function formLabelWidth(rows) {
@@ -20968,9 +21143,9 @@ function FieldForm({
20968
21143
  busy = false,
20969
21144
  children
20970
21145
  }) {
20971
- const [active, setActive] = useState8(0);
20972
- const [editing, setEditing] = useState8(false);
20973
- const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
21146
+ const [active, setActive] = useState9(0);
21147
+ const [editing, setEditing] = useState9(false);
21148
+ const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
20974
21149
  const rowCount = fields2.length + actions.length;
20975
21150
  const labelWidth = formLabelWidth([...fields2, ...actions]);
20976
21151
  const currentField = active < fields2.length ? fields2[active] : void 0;
@@ -21254,7 +21429,7 @@ var init_validate4 = __esm({
21254
21429
  });
21255
21430
 
21256
21431
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21257
- import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
21432
+ import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
21258
21433
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21259
21434
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21260
21435
  function CredentialsScreen({
@@ -21273,16 +21448,16 @@ function CredentialsScreen({
21273
21448
  host: initial.host ?? ""
21274
21449
  })
21275
21450
  ).current;
21276
- const [values, setValues] = useState9(initialValues);
21277
- const [notice, setNotice] = useState9(null);
21278
- const [validating, setValidating] = useState9(false);
21451
+ const [values, setValues] = useState10(initialValues);
21452
+ const [notice, setNotice] = useState10(null);
21453
+ const [validating, setValidating] = useState10(false);
21279
21454
  const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
21280
- const [editing, setEditing] = useState9(!prefilled);
21281
- const [focus, setFocus] = useState9(0);
21282
- const [active, setActive] = useState9(0);
21283
- const [beforeEdit, setBeforeEdit] = useState9(initialValues);
21455
+ const [editing, setEditing] = useState10(!prefilled);
21456
+ const [focus, setFocus] = useState10(0);
21457
+ const [active, setActive] = useState10(0);
21458
+ const [beforeEdit, setBeforeEdit] = useState10(initialValues);
21284
21459
  const visit = useRef5({ attempts: [], lastReason: "" }).current;
21285
- useEffect8(() => {
21460
+ useEffect9(() => {
21286
21461
  startDebugRun({
21287
21462
  flow: "import/credentials",
21288
21463
  step: "04-credentials",
@@ -21707,15 +21882,15 @@ var init_load = __esm({
21707
21882
  });
21708
21883
 
21709
21884
  // packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
21710
- import { useEffect as useEffect9, useMemo as useMemo2, useState as useState10 } from "react";
21885
+ import { useEffect as useEffect10, useMemo as useMemo2, useState as useState11 } from "react";
21711
21886
  import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
21712
21887
  import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
21713
21888
  function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
21714
21889
  const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
21715
21890
  const rows = loaded.ok ? loaded.rows : [];
21716
21891
  const columns = useTerminalWidth();
21717
- const [selected, setSelected] = useState10(0);
21718
- useEffect9(() => {
21892
+ const [selected, setSelected] = useState11(0);
21893
+ useEffect10(() => {
21719
21894
  startDebugRun({
21720
21895
  flow: "import/token-review",
21721
21896
  step: "05-token-review",
@@ -21830,13 +22005,13 @@ var init_steps = __esm({
21830
22005
 
21831
22006
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
21832
22007
  import { existsSync as existsSync11 } from "node:fs";
21833
- import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
22008
+ import { dirname as dirname17, join as join21, resolve as resolve22 } from "node:path";
21834
22009
  import { fileURLToPath as fileURLToPath4 } from "node:url";
21835
22010
  function findSkillPath(fileName) {
21836
- const thisDir = dirname16(fileURLToPath4(import.meta.url));
22011
+ const thisDir = dirname17(fileURLToPath4(import.meta.url));
21837
22012
  let dir = thisDir;
21838
22013
  for (; ; ) {
21839
- const candidate = join20(dir, "skills", fileName);
22014
+ const candidate = join21(dir, "skills", fileName);
21840
22015
  if (existsSync11(candidate)) return candidate;
21841
22016
  const parent = resolve22(dir, "..");
21842
22017
  if (parent === dir) {
@@ -21949,9 +22124,9 @@ var init_selection2 = __esm({
21949
22124
 
21950
22125
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
21951
22126
  import { mkdir as mkdir8 } from "node:fs/promises";
21952
- import { join as join21, resolve as resolve24 } from "node:path";
22127
+ import { join as join22, resolve as resolve24 } from "node:path";
21953
22128
  async function runExtraction(input, onProgress, deps = realDeps) {
21954
- const outDir = input.outDir ?? join21(resolve24(input.projectPath), ".contentful");
22129
+ const outDir = input.outDir ?? join22(resolve24(input.projectPath), ".contentful");
21955
22130
  let progress = initialProgress({
21956
22131
  hasCredentials: input.credentials !== null,
21957
22132
  hasRawTokens: input.rawTokensPath !== ""
@@ -22101,11 +22276,11 @@ var init_run = __esm({
22101
22276
  });
22102
22277
 
22103
22278
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
22104
- import { useEffect as useEffect10, useRef as useRef6, useState as useState11 } from "react";
22279
+ import { useEffect as useEffect11, useRef as useRef6, useState as useState12 } from "react";
22105
22280
  function useExtraction(input) {
22106
- const [state2, setState] = useState11();
22281
+ const [state2, setState] = useState12();
22107
22282
  const current = useRef6();
22108
- useEffect10(() => {
22283
+ useEffect11(() => {
22109
22284
  current.current = input;
22110
22285
  if (!input) {
22111
22286
  setState(void 0);
@@ -22195,11 +22370,11 @@ var init_run_tokens_only = __esm({
22195
22370
  });
22196
22371
 
22197
22372
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
22198
- import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
22373
+ import { useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
22199
22374
  function useTokensOnly(input) {
22200
- const [state2, setState] = useState12();
22375
+ const [state2, setState] = useState13();
22201
22376
  const current = useRef7();
22202
- useEffect11(() => {
22377
+ useEffect12(() => {
22203
22378
  current.current = input;
22204
22379
  if (!input) {
22205
22380
  setState(void 0);
@@ -22453,32 +22628,32 @@ function CounterStrip(props) {
22453
22628
  const labelAcc = condensed ? "Acc" : "Accepted";
22454
22629
  const labelRej = condensed ? "Rej" : "Rejected";
22455
22630
  const labelUnd = condensed ? "Und" : "Undecided";
22456
- const sep = condensed ? " | " : " ";
22631
+ const sep2 = condensed ? " | " : " ";
22457
22632
  return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
22458
22633
  /* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
22459
22634
  labelGrp,
22460
22635
  " "
22461
22636
  ] }),
22462
22637
  /* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
22463
- /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
22638
+ /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
22464
22639
  /* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
22465
22640
  labelAcc,
22466
22641
  " "
22467
22642
  ] }),
22468
22643
  /* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
22469
- /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
22644
+ /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
22470
22645
  /* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
22471
22646
  labelRej,
22472
22647
  " "
22473
22648
  ] }),
22474
22649
  /* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
22475
- /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
22650
+ /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
22476
22651
  /* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
22477
22652
  labelUnd,
22478
22653
  " "
22479
22654
  ] }),
22480
22655
  /* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
22481
- /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep })
22656
+ /* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 })
22482
22657
  ] }) });
22483
22658
  }
22484
22659
  var init_CounterStrip = __esm({
@@ -23509,7 +23684,7 @@ var init_useImmediateInput = __esm({
23509
23684
 
23510
23685
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23511
23686
  import { useStdout as useStdout2 } from "ink";
23512
- import { useEffect as useEffect12, useState as useState13 } from "react";
23687
+ import { useEffect as useEffect13, useState as useState14 } from "react";
23513
23688
  function readTerminalSize(stdout) {
23514
23689
  return {
23515
23690
  columns: stdout?.columns ?? 80,
@@ -23518,8 +23693,8 @@ function readTerminalSize(stdout) {
23518
23693
  }
23519
23694
  function useTerminalSize() {
23520
23695
  const { stdout } = useStdout2();
23521
- const [size, setSize] = useState13(() => readTerminalSize(stdout));
23522
- useEffect12(() => {
23696
+ const [size, setSize] = useState14(() => readTerminalSize(stdout));
23697
+ useEffect13(() => {
23523
23698
  const updateSize = () => setSize(readTerminalSize(stdout));
23524
23699
  stdout?.on("resize", updateSize);
23525
23700
  updateSize();
@@ -24246,15 +24421,15 @@ var init_group_collapse = __esm({
24246
24421
  });
24247
24422
 
24248
24423
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
24249
- import { useState as useState14 } from "react";
24424
+ import { useState as useState15 } from "react";
24250
24425
  function useSidebarSearchState() {
24251
- const [searchOpen, setSearchOpen] = useState14(false);
24252
- const [searchQuery, setSearchQuery] = useState14("");
24253
- const [autocompleteCandidates, setAutocompleteCandidates] = useState14([]);
24254
- const [jumpFilterTarget, setJumpFilterTarget] = useState14(null);
24255
- const [columnOneView, setColumnOneView] = useState14("grouped");
24256
- const [activeFilters, setActiveFilters] = useState14(/* @__PURE__ */ new Set());
24257
- const [showHelp, setShowHelp] = useState14(false);
24426
+ const [searchOpen, setSearchOpen] = useState15(false);
24427
+ const [searchQuery, setSearchQuery] = useState15("");
24428
+ const [autocompleteCandidates, setAutocompleteCandidates] = useState15([]);
24429
+ const [jumpFilterTarget, setJumpFilterTarget] = useState15(null);
24430
+ const [columnOneView, setColumnOneView] = useState15("grouped");
24431
+ const [activeFilters, setActiveFilters] = useState15(/* @__PURE__ */ new Set());
24432
+ const [showHelp, setShowHelp] = useState15(false);
24258
24433
  return {
24259
24434
  searchOpen,
24260
24435
  setSearchOpen,
@@ -24279,10 +24454,10 @@ var init_sidebar_search_state = __esm({
24279
24454
  });
24280
24455
 
24281
24456
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
24282
- import { useCallback, useState as useState15 } from "react";
24457
+ import { useCallback, useState as useState16 } from "react";
24283
24458
  function useOverlayPanel(opts) {
24284
24459
  const { toggleKey, onClose } = opts;
24285
- const [isOpen, setIsOpen] = useState15(false);
24460
+ const [isOpen, setIsOpen] = useState16(false);
24286
24461
  const open = useCallback(() => {
24287
24462
  setIsOpen(true);
24288
24463
  }, []);
@@ -24521,23 +24696,23 @@ var init_state = __esm({
24521
24696
  });
24522
24697
 
24523
24698
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24524
- import { useEffect as useEffect13, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24699
+ import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState17 } from "react";
24525
24700
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24526
24701
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24527
24702
  const columnPlan = useMemo3(
24528
24703
  () => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
24529
24704
  [totalWidth, tokenCount, tokensWidth]
24530
24705
  );
24531
- const [decisions, setDecisions] = useState16(/* @__PURE__ */ new Map());
24532
- const [nav, setNav] = useState16({ cursor: 0, scrollOffset: 0 });
24533
- const [focusedColumn, setFocusedColumn] = useState16("main");
24534
- const [tokensCursor, setTokensCursor] = useState16(0);
24535
- const [showDependencies, setShowDependencies] = useState16(false);
24536
- const [cyclesPanelOpen, setCyclesPanelOpen] = useState16(false);
24537
- const [cyclesCursor, setCyclesCursor] = useState16(0);
24706
+ const [decisions, setDecisions] = useState17(/* @__PURE__ */ new Map());
24707
+ const [nav, setNav] = useState17({ cursor: 0, scrollOffset: 0 });
24708
+ const [focusedColumn, setFocusedColumn] = useState17("main");
24709
+ const [tokensCursor, setTokensCursor] = useState17(0);
24710
+ const [showDependencies, setShowDependencies] = useState17(false);
24711
+ const [cyclesPanelOpen, setCyclesPanelOpen] = useState17(false);
24712
+ const [cyclesCursor, setCyclesCursor] = useState17(0);
24538
24713
  const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
24539
- const [aiCursor, setAiCursor] = useState16(0);
24540
- const [pendingRejectCascade, setPendingRejectCascade] = useState16(null);
24714
+ const [aiCursor, setAiCursor] = useState17(0);
24715
+ const [pendingRejectCascade, setPendingRejectCascade] = useState17(null);
24541
24716
  const search = useSidebarSearchState();
24542
24717
  const {
24543
24718
  searchOpen,
@@ -24562,13 +24737,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24562
24737
  () => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
24563
24738
  [slotCycles]
24564
24739
  );
24565
- const [expandedGroups, setExpandedGroups] = useState16(() => {
24740
+ const [expandedGroups, setExpandedGroups] = useState17(() => {
24566
24741
  const seed = new Set(closures.keys());
24567
24742
  for (const p of cycleParticipants) seed.add(p);
24568
24743
  return seed;
24569
24744
  });
24570
24745
  const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24571
- useEffect13(() => {
24746
+ useEffect14(() => {
24572
24747
  if (seededGroupsRef.current) return;
24573
24748
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24574
24749
  seededGroupsRef.current = true;
@@ -24659,7 +24834,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24659
24834
  entryCount: 0
24660
24835
  });
24661
24836
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24662
- useEffect13(() => {
24837
+ useEffect14(() => {
24663
24838
  setNav((prev) => {
24664
24839
  const maxIdx = Math.max(0, visibleRows.length - 1);
24665
24840
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -25004,7 +25179,7 @@ var init_use_scope_gate = __esm({
25004
25179
  });
25005
25180
 
25006
25181
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
25007
- import { useEffect as useEffect14, useMemo as useMemo4 } from "react";
25182
+ import { useEffect as useEffect15, useMemo as useMemo4 } from "react";
25008
25183
  import { Box as Box25, Text as Text26 } from "ink";
25009
25184
  import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
25010
25185
  function ScopeGateScreen({
@@ -25018,7 +25193,7 @@ function ScopeGateScreen({
25018
25193
  return loaded?.ok ? loaded.rows : [];
25019
25194
  }, [tokensPath]);
25020
25195
  const longest = useMemo4(() => longestEntries(tokens), [tokens]);
25021
- useEffect14(() => {
25196
+ useEffect15(() => {
25022
25197
  startDebugRun({
25023
25198
  flow: "import/scope-gate",
25024
25199
  step: "07-scope-gate",
@@ -25251,13 +25426,13 @@ var init_load2 = __esm({
25251
25426
  });
25252
25427
 
25253
25428
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
25254
- import { useEffect as useEffect15, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
25429
+ import { useEffect as useEffect16, useMemo as useMemo5, useRef as useRef10, useState as useState18 } from "react";
25255
25430
  function useScopeGateFlow(input, deps = realDeps3) {
25256
25431
  const sessionId = input?.sessionId;
25257
25432
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
25258
25433
  const cacheCheck = useRef10(void 0);
25259
- const [confirmed, setConfirmed] = useState17();
25260
- useEffect15(() => {
25434
+ const [confirmed, setConfirmed] = useState18();
25435
+ useEffect16(() => {
25261
25436
  if (!sessionId || !loaded || loaded.ok) return;
25262
25437
  startDebugRun({
25263
25438
  flow: "import/scope-gate",
@@ -25271,7 +25446,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
25271
25446
  exitMethod: "discarded"
25272
25447
  });
25273
25448
  }, [sessionId, loaded]);
25274
- useEffect15(() => {
25449
+ useEffect16(() => {
25275
25450
  if (!input || !loaded?.ok || cacheCheck.current) return;
25276
25451
  cacheCheck.current = deps.checkCache(input.cache);
25277
25452
  }, [input, loaded]);
@@ -25597,11 +25772,11 @@ var init_run2 = __esm({
25597
25772
  });
25598
25773
 
25599
25774
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25600
- import { useEffect as useEffect16, useRef as useRef11, useState as useState18 } from "react";
25775
+ import { useEffect as useEffect17, useRef as useRef11, useState as useState19 } from "react";
25601
25776
  function useGeneration(input) {
25602
- const [state2, setState] = useState18();
25777
+ const [state2, setState] = useState19();
25603
25778
  const current = useRef11();
25604
- useEffect16(() => {
25779
+ useEffect17(() => {
25605
25780
  current.current = input;
25606
25781
  if (!input) {
25607
25782
  setState(void 0);
@@ -25646,7 +25821,7 @@ var init_use_generation = __esm({
25646
25821
  });
25647
25822
 
25648
25823
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
25649
- import { join as join22 } from "node:path";
25824
+ import { join as join23 } from "node:path";
25650
25825
  function buildFlowStart(input) {
25651
25826
  const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
25652
25827
  const credentials = extraction.credentials ?? {
@@ -25659,7 +25834,7 @@ function buildFlowStart(input) {
25659
25834
  handoff,
25660
25835
  agent: extraction.agent,
25661
25836
  projectPath: extraction.projectPath,
25662
- outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
25837
+ outDir: extraction.projectPath ? join23(extraction.projectPath, ".contentful") : "",
25663
25838
  rawTokensPath: extraction.rawTokensPath,
25664
25839
  credentials: {
25665
25840
  spaceId: credentials.spaceId,
@@ -26691,7 +26866,7 @@ var init_scroll_offset = __esm({
26691
26866
  });
26692
26867
 
26693
26868
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26694
- import React13, { useEffect as useEffect17, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26869
+ import React13, { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState20 } from "react";
26695
26870
  import figures6 from "figures";
26696
26871
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26697
26872
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27368,11 +27543,11 @@ function FieldEditor({
27368
27543
  headerHeight = 2
27369
27544
  }) {
27370
27545
  const { state: initialState, error: parseError } = parseToState(value);
27371
- const [editorState, setEditorState] = useState19(initialState);
27372
- const [parseErr] = useState19(parseError);
27373
- const [listScrollStart, setListScrollStart] = useState19(0);
27546
+ const [editorState, setEditorState] = useState20(initialState);
27547
+ const [parseErr] = useState20(parseError);
27548
+ const [listScrollStart, setListScrollStart] = useState20(0);
27374
27549
  const initialFocusScrollApplied = React13.useRef(false);
27375
- const [rowHeights, setRowHeights] = useState19({});
27550
+ const [rowHeights, setRowHeights] = useState20({});
27376
27551
  const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
27377
27552
  const initialFocus = (() => {
27378
27553
  if (initialFocusTarget?.kind === "description") {
@@ -27440,25 +27615,25 @@ function FieldEditor({
27440
27615
  textCursor: 0
27441
27616
  };
27442
27617
  })();
27443
- const [focusLevel, setFocusLevel] = useState19(initialFocus.focusLevel);
27444
- const [propIdx, setPropIdx] = useState19(initialFocus.propIdx);
27445
- const [slotIdx, setSlotIdx] = useState19(initialFocus.slotIdx);
27446
- const [inSlots, setInSlots] = useState19(initialFocus.inSlots);
27447
- const [inComponentDesc, setInComponentDesc] = useState19(initialFocus.focusLevel === "componentDescription");
27448
- const [activeField, setActiveField] = useState19(initialFocus.activeField);
27449
- const [editingField, setEditingField] = useState19(false);
27450
- const [textCursor, setTextCursor] = useState19(initialFocus.textCursor);
27451
- const [valueCursor, setValueCursor] = useState19(0);
27452
- const [editingValue, setEditingValue] = useState19(null);
27453
- const [valueText, setValueText] = useState19("");
27454
- const [pickerCursor, setPickerCursor] = useState19(0);
27455
- const [validationError, setValidationError] = useState19(null);
27456
- const [cursorVisible] = useState19(true);
27457
- const [sourceOpen, setSourceOpen] = useState19(false);
27458
- const [rationaleOpen, setRationaleOpen] = useState19(false);
27459
- const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
27460
- const [showHelp, setShowHelp] = useState19(false);
27461
- const [pendingDelete, setPendingDelete] = useState19(null);
27618
+ const [focusLevel, setFocusLevel] = useState20(initialFocus.focusLevel);
27619
+ const [propIdx, setPropIdx] = useState20(initialFocus.propIdx);
27620
+ const [slotIdx, setSlotIdx] = useState20(initialFocus.slotIdx);
27621
+ const [inSlots, setInSlots] = useState20(initialFocus.inSlots);
27622
+ const [inComponentDesc, setInComponentDesc] = useState20(initialFocus.focusLevel === "componentDescription");
27623
+ const [activeField, setActiveField] = useState20(initialFocus.activeField);
27624
+ const [editingField, setEditingField] = useState20(false);
27625
+ const [textCursor, setTextCursor] = useState20(initialFocus.textCursor);
27626
+ const [valueCursor, setValueCursor] = useState20(0);
27627
+ const [editingValue, setEditingValue] = useState20(null);
27628
+ const [valueText, setValueText] = useState20("");
27629
+ const [pickerCursor, setPickerCursor] = useState20(0);
27630
+ const [validationError, setValidationError] = useState20(null);
27631
+ const [cursorVisible] = useState20(true);
27632
+ const [sourceOpen, setSourceOpen] = useState20(false);
27633
+ const [rationaleOpen, setRationaleOpen] = useState20(false);
27634
+ const [rationaleScrollOffset, setRationaleScrollOffset] = useState20(0);
27635
+ const [showHelp, setShowHelp] = useState20(false);
27636
+ const [pendingDelete, setPendingDelete] = useState20(null);
27462
27637
  const props = editorState.props;
27463
27638
  const slots = editorState.slots;
27464
27639
  const contentPropIndexes = React13.useMemo(
@@ -28218,7 +28393,7 @@ function FieldEditor({
28218
28393
  }
28219
28394
  return Math.max(start + 1, end2);
28220
28395
  };
28221
- useEffect17(() => {
28396
+ useEffect18(() => {
28222
28397
  if (focusLevel === "field" || selectedRowIdx < 0) return;
28223
28398
  setListScrollStart((previous) => {
28224
28399
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29613,7 +29788,7 @@ var init_FinalizeDialog = __esm({
29613
29788
  });
29614
29789
 
29615
29790
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29616
- import { useEffect as useEffect18, useRef as useRef12, useState as useState20 } from "react";
29791
+ import { useEffect as useEffect19, useRef as useRef12, useState as useState21 } from "react";
29617
29792
  function useReviewFinalizePreview({
29618
29793
  components,
29619
29794
  ...options
@@ -29625,12 +29800,12 @@ function useReviewFinalizePreview({
29625
29800
  }
29626
29801
  function useFinalizePreview(opts) {
29627
29802
  const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
29628
- const [status, setStatus] = useState20("idle");
29629
- const [removed, setRemoved] = useState20([]);
29630
- const [scrollOffset, setScrollOffset] = useState20(0);
29803
+ const [status, setStatus] = useState21("idle");
29804
+ const [removed, setRemoved] = useState21([]);
29805
+ const [scrollOffset, setScrollOffset] = useState21(0);
29631
29806
  const generationRef = useRef12(0);
29632
29807
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29633
- useEffect18(() => {
29808
+ useEffect19(() => {
29634
29809
  if (!open) {
29635
29810
  setStatus("idle");
29636
29811
  setRemoved([]);
@@ -29682,16 +29857,16 @@ var init_use_finalize_preview = __esm({
29682
29857
  });
29683
29858
 
29684
29859
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29685
- import { useCallback as useCallback2, useEffect as useEffect19, useRef as useRef13, useState as useState21 } from "react";
29860
+ import { useCallback as useCallback2, useEffect as useEffect20, useRef as useRef13, useState as useState22 } from "react";
29686
29861
  function useReviewSession({
29687
29862
  loadSession,
29688
29863
  tokensPath,
29689
29864
  onExtraLoaded
29690
29865
  }) {
29691
- const [components, setComponents] = useState21([]);
29692
- const [loading, setLoading] = useState21(true);
29693
- const [loadError, setLoadError] = useState21(null);
29694
- const [availableTokens, setAvailableTokens] = useState21([]);
29866
+ const [components, setComponents] = useState22([]);
29867
+ const [loading, setLoading] = useState22(true);
29868
+ const [loadError, setLoadError] = useState22(null);
29869
+ const [availableTokens, setAvailableTokens] = useState22([]);
29695
29870
  const loadInitialState = useCallback2(async () => {
29696
29871
  const result = loadSession();
29697
29872
  if (result.error || !tokensPath) return { result, catalog: result.tokens };
@@ -29701,7 +29876,7 @@ function useReviewSession({
29701
29876
  }));
29702
29877
  return { result, catalog };
29703
29878
  }, [loadSession, tokensPath]);
29704
- useEffect19(() => {
29879
+ useEffect20(() => {
29705
29880
  let disposed = false;
29706
29881
  void (async () => {
29707
29882
  try {
@@ -29752,9 +29927,9 @@ function useReviewSession({
29752
29927
  };
29753
29928
  }
29754
29929
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29755
- const [reviewMetadata, setReviewMetadata] = useState21(null);
29756
- const [componentRationale, setComponentRationale] = useState21(null);
29757
- useEffect19(() => {
29930
+ const [reviewMetadata, setReviewMetadata] = useState22(null);
29931
+ const [componentRationale, setComponentRationale] = useState22(null);
29932
+ useEffect20(() => {
29758
29933
  const current = components[selectedIdx];
29759
29934
  if (!current) {
29760
29935
  setReviewMetadata(null);
@@ -29792,7 +29967,7 @@ function useReviewHistory({
29792
29967
  }) {
29793
29968
  const historyRef = useRef13(null);
29794
29969
  const historySeededRef = useRef13(false);
29795
- useEffect19(() => {
29970
+ useEffect20(() => {
29796
29971
  if (loading || historySeededRef.current) return;
29797
29972
  historySeededRef.current = true;
29798
29973
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29879,7 +30054,7 @@ var init_token_suggestions = __esm({
29879
30054
  });
29880
30055
 
29881
30056
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29882
- import { useEffect as useEffect20, useRef as useRef14, useState as useState22 } from "react";
30057
+ import { useEffect as useEffect21, useRef as useRef14, useState as useState23 } from "react";
29883
30058
  function parseReviewEntry(draftValue) {
29884
30059
  const parsed = JSON.parse(draftValue);
29885
30060
  const keys = Object.keys(parsed);
@@ -29899,21 +30074,21 @@ function useReviewEditor({
29899
30074
  onEditSaved,
29900
30075
  onTokenSaved
29901
30076
  }) {
29902
- const [panelOpen, setPanelOpen] = useState22("none");
29903
- const [panelScrollOffset, setPanelScrollOffset] = useState22(0);
29904
- const [jsonScrollOffset, setJsonScrollOffset] = useState22(0);
29905
- const [textEntryActive, setTextEntryActive] = useState22(false);
29906
- const [showJson, setShowJson] = useState22(false);
29907
- const [showHiddenProps, setShowHiddenProps] = useState22(false);
29908
- const [draftValue, setDraftValue] = useState22("");
29909
- const [saveError, setSaveError] = useState22(null);
29910
- const [tokenReviewRow, setTokenReviewRow] = useState22(0);
29911
- const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
29912
- const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
29913
- const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
30077
+ const [panelOpen, setPanelOpen] = useState23("none");
30078
+ const [panelScrollOffset, setPanelScrollOffset] = useState23(0);
30079
+ const [jsonScrollOffset, setJsonScrollOffset] = useState23(0);
30080
+ const [textEntryActive, setTextEntryActive] = useState23(false);
30081
+ const [showJson, setShowJson] = useState23(false);
30082
+ const [showHiddenProps, setShowHiddenProps] = useState23(false);
30083
+ const [draftValue, setDraftValue] = useState23("");
30084
+ const [saveError, setSaveError] = useState23(null);
30085
+ const [tokenReviewRow, setTokenReviewRow] = useState23(0);
30086
+ const [tokenReviewEditing, setTokenReviewEditing] = useState23(false);
30087
+ const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState23(0);
30088
+ const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState23(/* @__PURE__ */ new Set());
29914
30089
  const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29915
30090
  const pendingGRef = useRef14(false);
29916
- useEffect20(() => {
30091
+ useEffect21(() => {
29917
30092
  setTokenReviewRow(0);
29918
30093
  setTokenReviewEditing(false);
29919
30094
  setTokenReviewEditCursor(0);
@@ -30033,12 +30208,12 @@ var init_use_review_editor = __esm({
30033
30208
  });
30034
30209
 
30035
30210
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
30036
- import { useState as useState23 } from "react";
30211
+ import { useState as useState24 } from "react";
30037
30212
  function useReviewSurfaceState(initialFinalizeError = null) {
30038
- const [sidebarFocused, setSidebarFocused] = useState23(true);
30039
- const [showFinalize, setShowFinalize] = useState23(false);
30040
- const [showQuit, setShowQuit] = useState23(false);
30041
- const [finalizeError, setFinalizeError] = useState23(initialFinalizeError);
30213
+ const [sidebarFocused, setSidebarFocused] = useState24(true);
30214
+ const [showFinalize, setShowFinalize] = useState24(false);
30215
+ const [showQuit, setShowQuit] = useState24(false);
30216
+ const [finalizeError, setFinalizeError] = useState24(initialFinalizeError);
30042
30217
  return {
30043
30218
  sidebarFocused,
30044
30219
  setSidebarFocused,
@@ -30395,24 +30570,24 @@ var init_preview_annotations = __esm({
30395
30570
  });
30396
30571
 
30397
30572
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
30398
- import { useCallback as useCallback3, useEffect as useEffect21, useRef as useRef15, useState as useState24 } from "react";
30573
+ import { useCallback as useCallback3, useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
30399
30574
  function useLivePreview(opts) {
30400
30575
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
30401
- const [status, setStatus] = useState24("idle");
30402
- const [disabled, setDisabled] = useState24(false);
30576
+ const [status, setStatus] = useState25("idle");
30577
+ const [disabled, setDisabled] = useState25(false);
30403
30578
  const timerRef = useRef15(null);
30404
30579
  const generationRef = useRef15(0);
30405
30580
  const latestRef = useRef15(0);
30406
30581
  const inflightRef = useRef15(0);
30407
30582
  const optsRef = useRef15(opts);
30408
- useEffect21(() => {
30583
+ useEffect22(() => {
30409
30584
  optsRef.current = opts;
30410
30585
  });
30411
30586
  const disabledRef = useRef15(disabled);
30412
- useEffect21(() => {
30587
+ useEffect22(() => {
30413
30588
  disabledRef.current = disabled;
30414
30589
  }, [disabled]);
30415
- useEffect21(() => {
30590
+ useEffect22(() => {
30416
30591
  return () => {
30417
30592
  if (timerRef.current) {
30418
30593
  clearTimeout(timerRef.current);
@@ -30493,7 +30668,7 @@ var init_use_live_preview = __esm({
30493
30668
  });
30494
30669
 
30495
30670
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
30496
- import { useCallback as useCallback4, useEffect as useEffect22, useState as useState25 } from "react";
30671
+ import { useCallback as useCallback4, useEffect as useEffect23, useState as useState26 } from "react";
30497
30672
  function useReviewPreview({
30498
30673
  components,
30499
30674
  loading,
@@ -30507,8 +30682,8 @@ function useReviewPreview({
30507
30682
  deleteAllComponents,
30508
30683
  onResult
30509
30684
  }) {
30510
- const [previewAnnotations, setPreviewAnnotations] = useState25(/* @__PURE__ */ new Map());
30511
- const [removedComponents, setRemovedComponents] = useState25([]);
30685
+ const [previewAnnotations, setPreviewAnnotations] = useState26(/* @__PURE__ */ new Map());
30686
+ const [removedComponents, setRemovedComponents] = useState26([]);
30512
30687
  const handleResult = useCallback4(
30513
30688
  (response) => {
30514
30689
  if (!response) return;
@@ -30534,14 +30709,14 @@ function useReviewPreview({
30534
30709
  onResult: handleResult,
30535
30710
  deleteAllComponents
30536
30711
  });
30537
- const [spinnerTick, setSpinnerTick] = useState25(0);
30538
- useEffect22(() => {
30712
+ const [spinnerTick, setSpinnerTick] = useState26(0);
30713
+ useEffect23(() => {
30539
30714
  if (livePreviewHook.status !== "running") return;
30540
30715
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
30541
30716
  return () => clearInterval(id);
30542
30717
  }, [livePreviewHook.status]);
30543
30718
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
30544
- useEffect22(() => {
30719
+ useEffect23(() => {
30545
30720
  if (loading) return;
30546
30721
  if (!livePreview) return;
30547
30722
  if (components.length === 0) return;
@@ -30626,7 +30801,7 @@ var init_review_log = __esm({
30626
30801
  });
30627
30802
 
30628
30803
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
30629
- import { useEffect as useEffect23, useRef as useRef16 } from "react";
30804
+ import { useEffect as useEffect24, useRef as useRef16 } from "react";
30630
30805
  function useReviewLog({
30631
30806
  loading,
30632
30807
  loadError,
@@ -30636,7 +30811,7 @@ function useReviewLog({
30636
30811
  const started = useRef16(false);
30637
30812
  const latest = useRef16(components);
30638
30813
  latest.current = components;
30639
- useEffect23(() => {
30814
+ useEffect24(() => {
30640
30815
  if (loading || started.current) return;
30641
30816
  started.current = true;
30642
30817
  startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
@@ -30651,7 +30826,7 @@ function useReviewLog({
30651
30826
  trail.current = openReviewTrail(components, Date.now());
30652
30827
  setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
30653
30828
  }, [loading, loadError, components]);
30654
- useEffect23(
30829
+ useEffect24(
30655
30830
  () => () => {
30656
30831
  const open = trail.current;
30657
30832
  trail.current = void 0;
@@ -30719,7 +30894,7 @@ var init_LivePreviewSummary = __esm({
30719
30894
  });
30720
30895
 
30721
30896
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30722
- import { useCallback as useCallback5, useEffect as useEffect24, useMemo as useMemo6, useRef as useRef17, useState as useState26 } from "react";
30897
+ import { useCallback as useCallback5, useEffect as useEffect25, useMemo as useMemo6, useRef as useRef17, useState as useState27 } from "react";
30723
30898
  import figures8 from "figures";
30724
30899
  import { Box as Box38, Text as Text40 } from "ink";
30725
30900
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30884,7 +31059,7 @@ function GenerateReviewStepView({
30884
31059
  initialFinalizeError = null
30885
31060
  }) {
30886
31061
  const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
30887
- const [slotCycles, setSlotCycles] = useState26([]);
31062
+ const [slotCycles, setSlotCycles] = useState27([]);
30888
31063
  const setLoadedSlotCycles = useCallback5((cycles) => {
30889
31064
  setSlotCycles(cycles ?? []);
30890
31065
  }, []);
@@ -30917,7 +31092,7 @@ function GenerateReviewStepView({
30917
31092
  onExtraLoaded: setLoadedSlotCycles
30918
31093
  });
30919
31094
  const reviewLog = useReviewLog({ loading, loadError, components });
30920
- const [nav, setNav] = useState26({
31095
+ const [nav, setNav] = useState27({
30921
31096
  cursorRowIdx: 0,
30922
31097
  sidebarScrollOffset: 0
30923
31098
  });
@@ -30933,10 +31108,10 @@ function GenerateReviewStepView({
30933
31108
  finalizeError,
30934
31109
  setFinalizeError
30935
31110
  } = reviewSurface;
30936
- const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
31111
+ const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState27(false);
30937
31112
  const removedBannerDefaultedRef = useRef17(false);
30938
- const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30939
- const [cyclesCursor, setCyclesCursor] = useState26(0);
31113
+ const [cyclePanelScroll, setCyclePanelScroll] = useState27(0);
31114
+ const [cyclesCursor, setCyclesCursor] = useState27(0);
30940
31115
  const cyclePanel = useOverlayPanel({
30941
31116
  toggleKey: "c",
30942
31117
  onClose: () => {
@@ -30951,9 +31126,9 @@ function GenerateReviewStepView({
30951
31126
  setBreakConfirm(false);
30952
31127
  }
30953
31128
  });
30954
- const [breakCursor, setBreakCursor] = useState26(0);
30955
- const [breakConfirm, setBreakConfirm] = useState26(false);
30956
- const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
31129
+ const [breakCursor, setBreakCursor] = useState27(0);
31130
+ const [breakConfirm, setBreakConfirm] = useState27(false);
31131
+ const [expandedGroups, setExpandedGroups] = useState27(/* @__PURE__ */ new Set());
30957
31132
  const seededGroupsRef = useRef17(false);
30958
31133
  const {
30959
31134
  searchOpen,
@@ -30972,14 +31147,14 @@ function GenerateReviewStepView({
30972
31147
  setShowHelp
30973
31148
  } = useSidebarSearchState();
30974
31149
  const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
30975
- const [breakingChanges, setBreakingChanges] = useState26([]);
30976
- const [breakingCursor, setBreakingCursor] = useState26(0);
30977
- const [breakingDetailOpen, setBreakingDetailOpen] = useState26(false);
30978
- const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30979
- const [autoRejected, setAutoRejected] = useState26([]);
30980
- const [undoSnapshot, setUndoSnapshot] = useState26(null);
31150
+ const [breakingChanges, setBreakingChanges] = useState27([]);
31151
+ const [breakingCursor, setBreakingCursor] = useState27(0);
31152
+ const [breakingDetailOpen, setBreakingDetailOpen] = useState27(false);
31153
+ const [pendingEditorFocus, setPendingEditorFocus] = useState27(null);
31154
+ const [autoRejected, setAutoRejected] = useState27([]);
31155
+ const [undoSnapshot, setUndoSnapshot] = useState27(null);
30981
31156
  const autoRejectFiredRef = useRef17(false);
30982
- const [showReloadDialog, setShowReloadDialog] = useState26(false);
31157
+ const [showReloadDialog, setShowReloadDialog] = useState27(false);
30983
31158
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30984
31159
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
30985
31160
  components,
@@ -31044,7 +31219,7 @@ function GenerateReviewStepView({
31044
31219
  [components]
31045
31220
  );
31046
31221
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
31047
- useEffect24(() => {
31222
+ useEffect25(() => {
31048
31223
  if (seededGroupsRef.current) return;
31049
31224
  if (closures.size === 0 && slotCycles.length === 0) return;
31050
31225
  seededGroupsRef.current = true;
@@ -31071,7 +31246,7 @@ function GenerateReviewStepView({
31071
31246
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
31072
31247
  }));
31073
31248
  }, [slotCycles, cycleView]);
31074
- useEffect24(() => {
31249
+ useEffect25(() => {
31075
31250
  const decision = computeAutoRejectDecision({
31076
31251
  loading,
31077
31252
  autoRejectFired: autoRejectFiredRef.current,
@@ -31116,7 +31291,7 @@ function GenerateReviewStepView({
31116
31291
  onAction: reviewLog.record
31117
31292
  });
31118
31293
  const autoRejectPushedRef = useRef17(false);
31119
- useEffect24(() => {
31294
+ useEffect25(() => {
31120
31295
  if (loading) return;
31121
31296
  if (!historySeededRef.current) return;
31122
31297
  if (!autoRejectFiredRef.current) return;
@@ -31200,7 +31375,7 @@ function GenerateReviewStepView({
31200
31375
  const panelHeight = leftPanelHeight + 2;
31201
31376
  const panelContentHeight = Math.max(1, panelHeight - 3);
31202
31377
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
31203
- useEffect24(() => {
31378
+ useEffect25(() => {
31204
31379
  if (selectableRowPositions.length === 0) return;
31205
31380
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
31206
31381
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -32283,10 +32458,10 @@ var init_path_utils = __esm({
32283
32458
  });
32284
32459
 
32285
32460
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
32286
- import { useEffect as useEffect25, useState as useState27 } from "react";
32461
+ import { useEffect as useEffect26, useState as useState28 } from "react";
32287
32462
  function useBlinkingCursor() {
32288
- const [visible, setVisible] = useState27(true);
32289
- useEffect25(() => {
32463
+ const [visible, setVisible] = useState28(true);
32464
+ useEffect26(() => {
32290
32465
  const interval = setInterval(() => setVisible((current) => !current), 500);
32291
32466
  return () => clearInterval(interval);
32292
32467
  }, []);
@@ -32299,16 +32474,16 @@ var init_use_blinking_cursor = __esm({
32299
32474
  });
32300
32475
 
32301
32476
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
32302
- import { useState as useState28 } from "react";
32477
+ import { useState as useState29 } from "react";
32303
32478
  import { Box as Box42, Text as Text44 } from "ink";
32304
32479
  import { readdirSync as readdirSync4 } from "node:fs";
32305
- import { dirname as dirname17, basename as basename6, join as join23 } from "node:path";
32480
+ import { dirname as dirname18, basename as basename7, join as join24 } from "node:path";
32306
32481
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
32307
32482
  function autocomplete(partial) {
32308
32483
  if (!partial) return null;
32309
32484
  const normalized = normalizePath(partial);
32310
- const dir = dirname17(normalized);
32311
- const base = basename6(normalized);
32485
+ const dir = dirname18(normalized);
32486
+ const base = basename7(normalized);
32312
32487
  let entries;
32313
32488
  try {
32314
32489
  entries = readdirSync4(dir);
@@ -32317,13 +32492,13 @@ function autocomplete(partial) {
32317
32492
  }
32318
32493
  const matches = entries.filter((e) => e.startsWith(base));
32319
32494
  if (matches.length === 0) return null;
32320
- if (matches.length === 1) return join23(dir, matches[0]);
32495
+ if (matches.length === 1) return join24(dir, matches[0]);
32321
32496
  let prefix = matches[0];
32322
32497
  for (const m of matches) {
32323
32498
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
32324
32499
  if (!prefix) break;
32325
32500
  }
32326
- return prefix.length > base.length ? join23(dir, prefix) : null;
32501
+ return prefix.length > base.length ? join24(dir, prefix) : null;
32327
32502
  }
32328
32503
  function PathPrompt({
32329
32504
  defaultPath,
@@ -32332,7 +32507,7 @@ function PathPrompt({
32332
32507
  label = "Save to",
32333
32508
  summary
32334
32509
  }) {
32335
- const [input, setInput] = useState28("");
32510
+ const [input, setInput] = useState29("");
32336
32511
  const cursorVisible = useBlinkingCursor();
32337
32512
  useImmediateInput((rawInput, key) => {
32338
32513
  if (key.return) {
@@ -32423,12 +32598,12 @@ var init_produced = __esm({
32423
32598
  });
32424
32599
 
32425
32600
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
32426
- import { useEffect as useEffect26, useState as useState29 } from "react";
32601
+ import { useEffect as useEffect27, useState as useState30 } from "react";
32427
32602
  import { Spinner as Spinner2 } from "@inkjs/ui";
32428
32603
  import { jsx as jsx53 } from "react/jsx-runtime";
32429
32604
  function useTimedSpinner() {
32430
- const [elapsedSeconds, setElapsedSeconds] = useState29(0);
32431
- useEffect26(() => {
32605
+ const [elapsedSeconds, setElapsedSeconds] = useState30(0);
32606
+ useEffect27(() => {
32432
32607
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
32433
32608
  return () => {
32434
32609
  clearInterval(timer);
@@ -32701,7 +32876,7 @@ var init_preview_confirmation_input = __esm({
32701
32876
  });
32702
32877
 
32703
32878
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32704
- import { useEffect as useEffect27, useState as useState30, useMemo as useMemo7 } from "react";
32879
+ import { useEffect as useEffect28, useState as useState31, useMemo as useMemo7 } from "react";
32705
32880
  import { Box as Box44, Text as Text46 } from "ink";
32706
32881
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32707
32882
  function buildPreviewSummaryLines(preview) {
@@ -32895,8 +33070,8 @@ function WizardPreviewStep({
32895
33070
  onQuit
32896
33071
  }) {
32897
33072
  const breakingWithImpact = hasBreakingChangesWithImpact(preview);
32898
- const [diffExpanded, setDiffExpanded] = useState30(false);
32899
- const [scrollOffset, setScrollOffset] = useState30(0);
33073
+ const [diffExpanded, setDiffExpanded] = useState31(false);
33074
+ const [scrollOffset, setScrollOffset] = useState31(0);
32900
33075
  const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
32901
33076
  const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
32902
33077
  const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
@@ -32911,7 +33086,7 @@ function WizardPreviewStep({
32911
33086
  const activeLines = diffExpanded ? diffLines : summaryLines;
32912
33087
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32913
33088
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32914
- useEffect27(() => {
33089
+ useEffect28(() => {
32915
33090
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32916
33091
  }, [maxScroll]);
32917
33092
  useImmediateInput((input, key) => {
@@ -33178,11 +33353,11 @@ var init_flow_log = __esm({
33178
33353
  });
33179
33354
 
33180
33355
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
33181
- import { useEffect as useEffect28, useRef as useRef18 } from "react";
33356
+ import { useEffect as useEffect29, useRef as useRef18 } from "react";
33182
33357
  function useFlowLog(state2) {
33183
33358
  const trail = useRef18(void 0);
33184
33359
  const previous = useRef18(void 0);
33185
- useEffect28(() => {
33360
+ useEffect29(() => {
33186
33361
  const before = previous.current;
33187
33362
  previous.current = state2;
33188
33363
  const moved = before !== void 0 && before.step !== state2.step;
@@ -33205,7 +33380,7 @@ function useFlowLog(state2) {
33205
33380
  trail.current = open;
33206
33381
  setDebugRunProgress(flowProgress(open, now));
33207
33382
  }, [state2]);
33208
- useEffect28(
33383
+ useEffect29(
33209
33384
  () => () => {
33210
33385
  const open = trail.current;
33211
33386
  trail.current = void 0;
@@ -33752,8 +33927,8 @@ var init_run_print_files_helpers = __esm({
33752
33927
  });
33753
33928
 
33754
33929
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
33755
- import { writeFile as writeFile8 } from "node:fs/promises";
33756
- import { join as join24 } from "node:path";
33930
+ import { writeFile as writeFile9 } from "node:fs/promises";
33931
+ import { join as join25 } from "node:path";
33757
33932
  function buildSavedCDF(components, tokens, opts = {}) {
33758
33933
  const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
33759
33934
  if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
@@ -33765,7 +33940,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
33765
33940
  }
33766
33941
  async function runPrintFiles(input, deps, onPatch) {
33767
33942
  onPatch({ step: "printing" });
33768
- const componentsPath = join24(input.outDir, "components.json");
33943
+ const componentsPath = join25(input.outDir, "components.json");
33769
33944
  try {
33770
33945
  const db = deps.openDb();
33771
33946
  let components = [];
@@ -33854,7 +34029,7 @@ var init_save = __esm({
33854
34029
  realSaveDeps = () => ({
33855
34030
  openDb: openPipelineDb,
33856
34031
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
33857
- writeFile: (path5, contents) => writeFile8(path5, contents),
34032
+ writeFile: (path5, contents) => writeFile9(path5, contents),
33858
34033
  appendRun,
33859
34034
  buildSourceFingerprint,
33860
34035
  sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
@@ -33879,7 +34054,7 @@ var init_types9 = __esm({
33879
34054
  import { appendFileSync, writeFileSync } from "node:fs";
33880
34055
  import { mkdir as mkdir9 } from "node:fs/promises";
33881
34056
  import { tmpdir } from "node:os";
33882
- import { join as join25, resolve as resolve27 } from "node:path";
34057
+ import { join as join26, resolve as resolve27 } from "node:path";
33883
34058
  function appendWizardLog(entry) {
33884
34059
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
33885
34060
  }
@@ -34164,12 +34339,12 @@ var init_controller = __esm({
34164
34339
  init_push();
34165
34340
  init_save();
34166
34341
  init_types9();
34167
- WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
34342
+ WIZARD_LOG = join26(tmpdir(), "experiences-import-wizard.log");
34168
34343
  }
34169
34344
  });
34170
34345
 
34171
34346
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
34172
- import { useEffect as useEffect29, useRef as useRef19, useSyncExternalStore } from "react";
34347
+ import { useEffect as useEffect30, useRef as useRef19, useSyncExternalStore } from "react";
34173
34348
  function useFlow(start, options = {}) {
34174
34349
  const controller = useRef19();
34175
34350
  if (start && !controller.current) {
@@ -34188,7 +34363,7 @@ function useFlow(start, options = {}) {
34188
34363
  (listener) => current?.subscribe(listener) ?? (() => void 0),
34189
34364
  () => current?.getState()
34190
34365
  );
34191
- useEffect29(() => {
34366
+ useEffect30(() => {
34192
34367
  if (!start) controller.current = void 0;
34193
34368
  }, [start]);
34194
34369
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -34201,7 +34376,7 @@ var init_use_flow = __esm({
34201
34376
  });
34202
34377
 
34203
34378
  // packages/experience-design-system-cli/src/tui/help/file-locations.ts
34204
- import { join as join26, resolve as resolve28 } from "node:path";
34379
+ import { join as join27, resolve as resolve28 } from "node:path";
34205
34380
  function describeFileLocations({
34206
34381
  contentfulBaseDir,
34207
34382
  debugModeEnabled,
@@ -34210,14 +34385,14 @@ function describeFileLocations({
34210
34385
  if (!debugModeEnabled) {
34211
34386
  return {
34212
34387
  debugLogs: "none while Debug Mode is off",
34213
- importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
34388
+ importFiles: `${join27("<project>", ".contentful")}/ (tokens.json, components.json)`
34214
34389
  };
34215
34390
  }
34216
34391
  const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
34217
- const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
34392
+ const session = currentSessionDir2 ?? join27(base, ".contentful", "<date>-session-<n>");
34218
34393
  return {
34219
- debugLogs: join26(session, "debug"),
34220
- importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
34394
+ debugLogs: join27(session, "debug"),
34395
+ importFiles: `${join27(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
34221
34396
  };
34222
34397
  }
34223
34398
  var init_file_locations = __esm({
@@ -34267,7 +34442,7 @@ var init_help_info = __esm({
34267
34442
  });
34268
34443
 
34269
34444
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
34270
- import { useEffect as useEffect30, useState as useState31 } from "react";
34445
+ import { useEffect as useEffect31, useState as useState32 } from "react";
34271
34446
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
34272
34447
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
34273
34448
  function Section({ title, rows }) {
@@ -34280,8 +34455,8 @@ function Section({ title, rows }) {
34280
34455
  ] });
34281
34456
  }
34282
34457
  function HelpScreen({ onDone }) {
34283
- const [info, setInfo] = useState31();
34284
- useEffect30(() => {
34458
+ const [info, setInfo] = useState32();
34459
+ useEffect31(() => {
34285
34460
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
34286
34461
  void readHelpInfo().then(setInfo);
34287
34462
  }, []);
@@ -34328,14 +34503,14 @@ var init_PageContainer2 = __esm({
34328
34503
  });
34329
34504
 
34330
34505
  // packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
34331
- import { useState as useState32 } from "react";
34506
+ import { useState as useState33 } from "react";
34332
34507
  import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
34333
34508
  import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
34334
34509
  function SettingsScreen({
34335
34510
  onNavigate,
34336
34511
  onBack
34337
34512
  }) {
34338
- const [focusIdx, setFocusIdx] = useState32(0);
34513
+ const [focusIdx, setFocusIdx] = useState33(0);
34339
34514
  const items = [
34340
34515
  { label: "Configuration", screen: "settings-configuration" },
34341
34516
  { label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
@@ -34663,7 +34838,7 @@ var init_AgentStatusBadge = __esm({
34663
34838
  });
34664
34839
 
34665
34840
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
34666
- import { useEffect as useEffect31, useState as useState33 } from "react";
34841
+ import { useEffect as useEffect32, useState as useState34 } from "react";
34667
34842
  import { Box as Box48, Text as Text50 } from "ink";
34668
34843
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
34669
34844
  function StatusHeading() {
@@ -34680,11 +34855,11 @@ function AgentDetail({
34680
34855
  record: record3
34681
34856
  }) {
34682
34857
  const settings = config.agents[name];
34683
- const [saving, setSaving] = useState33(false);
34684
- const [testing, setTesting] = useState33(false);
34685
- const [notice, setNotice] = useState33(null);
34686
- const [checks, setChecks] = useState33(void 0);
34687
- useEffect31(() => {
34858
+ const [saving, setSaving] = useState34(false);
34859
+ const [testing, setTesting] = useState34(false);
34860
+ const [notice, setNotice] = useState34(null);
34861
+ const [checks, setChecks] = useState34(void 0);
34862
+ useEffect32(() => {
34688
34863
  let active = true;
34689
34864
  setChecks(void 0);
34690
34865
  const timer = setTimeout(() => {
@@ -34776,17 +34951,17 @@ var init_AgentDetail = __esm({
34776
34951
  });
34777
34952
 
34778
34953
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
34779
- import { useEffect as useEffect32, useRef as useRef20, useState as useState34 } from "react";
34954
+ import { useEffect as useEffect33, useRef as useRef20, useState as useState35 } from "react";
34780
34955
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
34781
34956
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
34782
34957
  function AgentsScreen({ onDone }) {
34783
- const [config, setConfig] = useState34(null);
34784
- const [focus, setFocus] = useState34(0);
34785
- const [open, setOpen] = useState34(null);
34786
- const [notice, setNotice] = useState34(null);
34787
- const [saving, setSaving] = useState34(false);
34788
- const [loadError, setLoadError] = useState34(null);
34789
- const [checks, setChecks] = useState34({});
34958
+ const [config, setConfig] = useState35(null);
34959
+ const [focus, setFocus] = useState35(0);
34960
+ const [open, setOpen] = useState35(null);
34961
+ const [notice, setNotice] = useState35(null);
34962
+ const [saving, setSaving] = useState35(false);
34963
+ const [loadError, setLoadError] = useState35(null);
34964
+ const [checks, setChecks] = useState35({});
34790
34965
  const visit = useRef20({
34791
34966
  trail: createTrail(),
34792
34967
  before: void 0,
@@ -34800,7 +34975,7 @@ function AgentsScreen({ onDone }) {
34800
34975
  );
34801
34976
  }
34802
34977
  };
34803
- useEffect32(() => {
34978
+ useEffect33(() => {
34804
34979
  readAgentConfig().then((loaded) => {
34805
34980
  setConfig(loaded);
34806
34981
  inspectAll(loaded);
@@ -35026,7 +35201,7 @@ var init_project_store = __esm({
35026
35201
  });
35027
35202
 
35028
35203
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
35029
- import { useEffect as useEffect33, useRef as useRef21, useState as useState35 } from "react";
35204
+ import { useEffect as useEffect34, useRef as useRef21, useState as useState36 } from "react";
35030
35205
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
35031
35206
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
35032
35207
  function debugFields(config) {
@@ -35041,10 +35216,10 @@ function debugFields(config) {
35041
35216
  };
35042
35217
  }
35043
35218
  function ProjectScreen({ onDone }) {
35044
- const [config, setConfig] = useState35(null);
35045
- const [saving, setSaving] = useState35(false);
35046
- const [notice, setNotice] = useState35(null);
35047
- const [loadError, setLoadError] = useState35(null);
35219
+ const [config, setConfig] = useState36(null);
35220
+ const [saving, setSaving] = useState36(false);
35221
+ const [notice, setNotice] = useState36(null);
35222
+ const [loadError, setLoadError] = useState36(null);
35048
35223
  const visit = useRef21({
35049
35224
  trail: createTrail(),
35050
35225
  before: void 0,
@@ -35052,7 +35227,7 @@ function ProjectScreen({ onDone }) {
35052
35227
  error: ""
35053
35228
  }).current;
35054
35229
  const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
35055
- useEffect33(() => {
35230
+ useEffect34(() => {
35056
35231
  readCredentials().then((cfg) => {
35057
35232
  setConfig(cfg);
35058
35233
  visit.before = snapshotOf(cfg);
@@ -35173,12 +35348,12 @@ var init_ProjectScreen = __esm({
35173
35348
  });
35174
35349
 
35175
35350
  // packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
35176
- import { useState as useState36 } from "react";
35351
+ import { useState as useState37 } from "react";
35177
35352
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
35178
35353
  import { jsx as jsx63, jsxs as jsxs51 } from "react/jsx-runtime";
35179
35354
  function ConfigurationScreen({ onDone }) {
35180
- const [focus, setFocus] = useState36(0);
35181
- const [open, setOpen] = useState36(null);
35355
+ const [focus, setFocus] = useState37(0);
35356
+ const [open, setOpen] = useState37(null);
35182
35357
  const close = () => setOpen(null);
35183
35358
  useInput17((input, key) => {
35184
35359
  if (open) return;
@@ -35239,13 +35414,13 @@ var init_ConfigurationScreen = __esm({
35239
35414
  });
35240
35415
 
35241
35416
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
35242
- import { useEffect as useEffect34, useState as useState37 } from "react";
35417
+ import { useEffect as useEffect35, useState as useState38 } from "react";
35243
35418
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
35244
35419
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
35245
35420
  function OptInAnalyticsScreen({ onDone }) {
35246
- const [loading, setLoading] = useState37(true);
35247
- const [enabled, setEnabled] = useState37(true);
35248
- useEffect34(() => {
35421
+ const [loading, setLoading] = useState38(true);
35422
+ const [enabled, setEnabled] = useState38(true);
35423
+ useEffect35(() => {
35249
35424
  readAnalyticsSetting().then((setting) => {
35250
35425
  setEnabled(setting.enabled);
35251
35426
  setLoading(false);
@@ -35308,18 +35483,18 @@ var init_screen12 = __esm({
35308
35483
  });
35309
35484
 
35310
35485
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
35311
- import { useEffect as useEffect35, useRef as useRef22, useState as useState38 } from "react";
35486
+ import { useEffect as useEffect36, useRef as useRef22, useState as useState39 } from "react";
35312
35487
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
35313
35488
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
35314
35489
  function DebugModeScreen({ onDone }) {
35315
- const [setting, setSetting] = useState38(null);
35316
- const [focus, setFocus] = useState38("enabled");
35317
- const [pending, setPending] = useState38(
35490
+ const [setting, setSetting] = useState39(null);
35491
+ const [focus, setFocus] = useState39("enabled");
35492
+ const [pending, setPending] = useState39(
35318
35493
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
35319
35494
  );
35320
- const [notice, setNotice] = useState38(null);
35495
+ const [notice, setNotice] = useState39(null);
35321
35496
  const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
35322
- useEffect35(() => {
35497
+ useEffect36(() => {
35323
35498
  readDebugModeSetting().then((loaded) => {
35324
35499
  setSetting(loaded);
35325
35500
  setPending(loaded.retentionDays);
@@ -35460,21 +35635,21 @@ var app_exports = {};
35460
35635
  __export(app_exports, {
35461
35636
  runApp: () => runApp
35462
35637
  });
35463
- import { useEffect as useEffect36, useState as useState39 } from "react";
35638
+ import { useEffect as useEffect37, useState as useState40 } from "react";
35464
35639
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
35465
35640
  function App({ importOptions, inkClear }) {
35466
- const [screen, setScreen] = useState39("start");
35467
- const [importExitCode, setImportExitCode] = useState39();
35641
+ const [screen, setScreen] = useState40("start");
35642
+ const [importExitCode, setImportExitCode] = useState40();
35468
35643
  const showImportResult = importExitCode !== void 0;
35469
- const [target, setTarget] = useState39();
35470
- const [answers, setAnswers] = useState39({});
35644
+ const [target, setTarget] = useState40();
35645
+ const [answers, setAnswers] = useState40({});
35471
35646
  const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
35472
- const [extractionRun, setExtractionRun] = useState39();
35647
+ const [extractionRun, setExtractionRun] = useState40();
35473
35648
  const extraction = useExtraction(extractionRun?.input);
35474
- const [tokensOnlyRun, setTokensOnlyRun] = useState39();
35649
+ const [tokensOnlyRun, setTokensOnlyRun] = useState40();
35475
35650
  const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
35476
- const [tokenReview, setTokenReview] = useState39();
35477
- const [scopeRun, setScopeRun] = useState39();
35651
+ const [tokenReview, setTokenReview] = useState40();
35652
+ const [scopeRun, setScopeRun] = useState40();
35478
35653
  const scopeFlow = useScopeGateFlow(
35479
35654
  scopeRun && {
35480
35655
  sessionId: scopeRun.extraction.sessionId,
@@ -35489,12 +35664,12 @@ function App({ importOptions, inkClear }) {
35489
35664
  }
35490
35665
  }
35491
35666
  );
35492
- const [generationInput, setGenerationInput] = useState39();
35667
+ const [generationInput, setGenerationInput] = useState40();
35493
35668
  const generation = useGeneration(generationInput);
35494
- const [flowStart, setFlowStart] = useState39();
35669
+ const [flowStart, setFlowStart] = useState40();
35495
35670
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
35496
- const [importDefaults, setImportDefaults] = useState39();
35497
- useEffect36(() => {
35671
+ const [importDefaults, setImportDefaults] = useState40();
35672
+ useEffect37(() => {
35498
35673
  if (screen !== "import") {
35499
35674
  setImportDefaults(void 0);
35500
35675
  return;
@@ -35567,7 +35742,7 @@ function App({ importOptions, inkClear }) {
35567
35742
  }
35568
35743
  });
35569
35744
  };
35570
- useEffect36(() => {
35745
+ useEffect37(() => {
35571
35746
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
35572
35747
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
35573
35748
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -35589,12 +35764,12 @@ function App({ importOptions, inkClear }) {
35589
35764
  }
35590
35765
  });
35591
35766
  }, [tokensOnly, tokensOnlyRun]);
35592
- useEffect36(() => {
35767
+ useEffect37(() => {
35593
35768
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
35594
35769
  setExtractionRun(void 0);
35595
35770
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
35596
35771
  }, [extraction, extractionRun]);
35597
- useEffect36(() => {
35772
+ useEffect37(() => {
35598
35773
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
35599
35774
  const { extraction: produced, input, generatePromptPath } = scopeRun;
35600
35775
  setGenerationInput({
@@ -35612,7 +35787,7 @@ function App({ importOptions, inkClear }) {
35612
35787
  ...generatePromptPath ? { generatePromptPath } : {}
35613
35788
  });
35614
35789
  }, [scopeFlow, scopeRun, generationInput]);
35615
- useEffect36(() => {
35790
+ useEffect37(() => {
35616
35791
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
35617
35792
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
35618
35793
  inkClear();
@@ -35855,7 +36030,7 @@ var init_app = __esm({
35855
36030
  // packages/experience-design-system-cli/program.ts
35856
36031
  init_src3();
35857
36032
  import { readFileSync as readFileSync10 } from "node:fs";
35858
- import { join as join27 } from "node:path";
36033
+ import { join as join28 } from "node:path";
35859
36034
  import { Command } from "commander";
35860
36035
 
35861
36036
  // packages/experience-design-system-cli/src/commands/import-options.ts
@@ -35920,7 +36095,7 @@ init_analytics_store();
35920
36095
  init_package_root();
35921
36096
  var pkg = JSON.parse(
35922
36097
  readFileSync10(
35923
- join27(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
36098
+ join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
35924
36099
  "utf8"
35925
36100
  )
35926
36101
  );
@@ -35960,21 +36135,21 @@ function createProgram() {
35960
36135
  init_config();
35961
36136
  init_package_root();
35962
36137
  import { existsSync as existsSync12 } from "node:fs";
35963
- import { mkdir as mkdir10, readFile as readFile21, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
35964
- import { dirname as dirname18, join as join28 } from "node:path";
36138
+ import { mkdir as mkdir10, readFile as readFile22, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
36139
+ import { dirname as dirname19, join as join29 } from "node:path";
35965
36140
  var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
35966
36141
  async function readJson(path5) {
35967
36142
  try {
35968
- return JSON.parse(await readFile21(path5, "utf8"));
36143
+ return JSON.parse(await readFile22(path5, "utf8"));
35969
36144
  } catch {
35970
36145
  return void 0;
35971
36146
  }
35972
36147
  }
35973
36148
  async function migrateOldConfig() {
35974
36149
  try {
35975
- const oldCredentials = join28(oldConfigDir2(), "credentials.json");
35976
- const oldRuns = join28(oldConfigDir2(), "runs.json");
35977
- const oldDebugMode = join28(
36150
+ const oldCredentials = join29(oldConfigDir2(), "credentials.json");
36151
+ const oldRuns = join29(oldConfigDir2(), "runs.json");
36152
+ const oldDebugMode = join29(
35978
36153
  findPackageRoot(import.meta.url, PACKAGE_NAME3),
35979
36154
  ".contentful",
35980
36155
  "config",
@@ -35987,7 +36162,7 @@ async function migrateOldConfig() {
35987
36162
  if (Object.keys(migrated).length > 0) await updateSettings2({ ...migrated, ...await readSettings2() });
35988
36163
  if (existsSync12(oldRuns)) {
35989
36164
  if (!existsSync12(runsFilePath2())) {
35990
- await mkdir10(dirname18(runsFilePath2()), { recursive: true });
36165
+ await mkdir10(dirname19(runsFilePath2()), { recursive: true });
35991
36166
  await rename3(oldRuns, runsFilePath2());
35992
36167
  } else {
35993
36168
  await unlink(oldRuns);