@contentful/experience-design-system-cli 2.37.1-dev-build-c3291210.0 → 2.37.1-dev-build-bdf99669.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -2018,7 +2018,7 @@ var init_cache_keys = __esm({
2018
2018
 
2019
2019
  // packages/experience-design-system-cli/app.tsx
2020
2020
  import { join as join25 } from "node:path";
2021
- import { useEffect as useEffect28, useState as useState33 } from "react";
2021
+ import { useEffect as useEffect26, useState as useState33 } from "react";
2022
2022
 
2023
2023
  // packages/experience-design-system-cli/src/tui/home/home.tsx
2024
2024
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -2240,14 +2240,9 @@ function HomeScreen({ onNavigate }) {
2240
2240
  }
2241
2241
 
2242
2242
  // packages/experience-design-system-cli/src/tui/import/PageContainer.tsx
2243
- import { useEffect as useEffect3 } from "react";
2244
- import { Box as Box2, Text as Text3, useInput as useInput2, useStdout as useStdout2 } from "ink";
2243
+ import { Box as Box2, Text as Text3, useInput as useInput2 } from "ink";
2245
2244
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
2246
2245
  function ImportScreen({ exitCode, onDone }) {
2247
- const { stdout } = useStdout2();
2248
- useEffect3(() => {
2249
- stdout.write("\x1B[H\x1B[0J");
2250
- }, [stdout]);
2251
2246
  useInput2((input, key) => {
2252
2247
  if (key.return || key.escape || input === "q") {
2253
2248
  onDone();
@@ -2455,7 +2450,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
2455
2450
  }
2456
2451
 
2457
2452
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
2458
- import { useEffect as useEffect4, useMemo, useState as useState5 } from "react";
2453
+ import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
2459
2454
  import { Box as Box5, Text as Text6 } from "ink";
2460
2455
 
2461
2456
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
@@ -16616,7 +16611,7 @@ function PathValidationScreen({
16616
16611
  }) {
16617
16612
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
16618
16613
  const [scan, setScan] = useState5();
16619
- useEffect4(() => {
16614
+ useEffect3(() => {
16620
16615
  setScan(scanFiles(resolvedPath));
16621
16616
  }, [resolvedPath]);
16622
16617
  const phase = phaseOf(scan);
@@ -16984,10 +16979,10 @@ var PROGRESS_THEME = extendTheme(defaultTheme, {
16984
16979
  });
16985
16980
 
16986
16981
  // packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
16987
- import { useEffect as useEffect5, useState as useState7 } from "react";
16982
+ import { useEffect as useEffect4, useState as useState7 } from "react";
16988
16983
  function useElapsed() {
16989
16984
  const [seconds, setSeconds] = useState7(0);
16990
- useEffect5(() => {
16985
+ useEffect4(() => {
16991
16986
  const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
16992
16987
  return () => clearInterval(timer);
16993
16988
  }, []);
@@ -17225,7 +17220,7 @@ async function updateSettings2(patch) {
17225
17220
  }
17226
17221
 
17227
17222
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
17228
- import { useEffect as useEffect6, useRef as useRef2, useState as useState8 } from "react";
17223
+ import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
17229
17224
 
17230
17225
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
17231
17226
  import { mkdir as mkdir7 } from "node:fs/promises";
@@ -17484,7 +17479,7 @@ async function resolveSelectionPrompt(overrides) {
17484
17479
  function useExtraction(input) {
17485
17480
  const [state, setState] = useState8();
17486
17481
  const current = useRef2();
17487
- useEffect6(() => {
17482
+ useEffect5(() => {
17488
17483
  current.current = input;
17489
17484
  if (!input) {
17490
17485
  setState(void 0);
@@ -17514,7 +17509,7 @@ function useExtraction(input) {
17514
17509
  import { Box as Box20, Text as Text22 } from "ink";
17515
17510
 
17516
17511
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/panels/added-column.tsx
17517
- import React7 from "react";
17512
+ import React6 from "react";
17518
17513
  import { Box as Box11, Text as Text12 } from "ink";
17519
17514
  import figures from "figures";
17520
17515
 
@@ -17715,7 +17710,7 @@ function AddedColumn(props) {
17715
17710
  const aiFlagged = aiFlaggedByKey?.get(entry.name) === true;
17716
17711
  const showSeparator = firstNonCycleIdx > 0 && i === firstNonCycleIdx;
17717
17712
  const style = sideColumnLabelStyle({ isCycle: entry.isCycle, isSelected, focused });
17718
- return /* @__PURE__ */ jsxs11(React7.Fragment, { children: [
17713
+ return /* @__PURE__ */ jsxs11(React6.Fragment, { children: [
17719
17714
  showSeparator && /* @__PURE__ */ jsx14(Text12, { dimColor: true, children: "\u2500".repeat(Math.max(0, width - 2)) }),
17720
17715
  /* @__PURE__ */ jsxs11(Box11, { children: [
17721
17716
  isCursor ? /* @__PURE__ */ jsx14(Text12, { color: PALETTE2.info, bold: true, children: figures.pointer }) : /* @__PURE__ */ jsx14(Text12, { children: " " }),
@@ -18748,7 +18743,7 @@ function GroupedSidebar(props) {
18748
18743
  }
18749
18744
 
18750
18745
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/components/HelpOverlay.tsx
18751
- import React8 from "react";
18746
+ import React7 from "react";
18752
18747
  import { Box as Box18, Text as Text20 } from "ink";
18753
18748
 
18754
18749
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
@@ -18825,8 +18820,8 @@ function useImmediateInput(handler, enabled = true) {
18825
18820
  }
18826
18821
 
18827
18822
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
18828
- import { useStdout as useStdout3 } from "ink";
18829
- import { useEffect as useEffect7, useState as useState9 } from "react";
18823
+ import { useStdout as useStdout2 } from "ink";
18824
+ import { useEffect as useEffect6, useState as useState9 } from "react";
18830
18825
  function readTerminalSize(stdout) {
18831
18826
  return {
18832
18827
  columns: stdout?.columns ?? 80,
@@ -18834,9 +18829,9 @@ function readTerminalSize(stdout) {
18834
18829
  };
18835
18830
  }
18836
18831
  function useTerminalSize() {
18837
- const { stdout } = useStdout3();
18832
+ const { stdout } = useStdout2();
18838
18833
  const [size, setSize] = useState9(() => readTerminalSize(stdout));
18839
- useEffect7(() => {
18834
+ useEffect6(() => {
18840
18835
  const updateSize = () => setSize(readTerminalSize(stdout));
18841
18836
  stdout?.on("resize", updateSize);
18842
18837
  updateSize();
@@ -18870,7 +18865,7 @@ function HelpOverlay(props) {
18870
18865
  overflowY: "hidden",
18871
18866
  children: [
18872
18867
  /* @__PURE__ */ jsx22(Text20, { bold: true, children: "\u2500".repeat(titleRule) + " Help " + "\u2500".repeat(titleRule) }),
18873
- props.sections.map((section) => /* @__PURE__ */ jsxs19(React8.Fragment, { children: [
18868
+ props.sections.map((section) => /* @__PURE__ */ jsxs19(React7.Fragment, { children: [
18874
18869
  /* @__PURE__ */ jsx22(Text20, { children: " " }),
18875
18870
  /* @__PURE__ */ jsx22(Text20, { bold: true, children: section.title }),
18876
18871
  section.entries.map((entry) => /* @__PURE__ */ jsx22(Text20, { children: entry.keys ? " " + entry.keys.padEnd(16) + " " + entry.label : " " + entry.label }, entry.keys + entry.label))
@@ -19019,7 +19014,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
19019
19014
  }
19020
19015
 
19021
19016
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
19022
- import { useEffect as useEffect8, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
19017
+ import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
19023
19018
 
19024
19019
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/graph/search-neighborhood.ts
19025
19020
  function computeDirectNeighborhood(matches, graph) {
@@ -19703,7 +19698,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
19703
19698
  return seed;
19704
19699
  });
19705
19700
  const seededGroupsRef = useRef4(closures.size > 0 || cycleParticipants.size > 0);
19706
- useEffect8(() => {
19701
+ useEffect7(() => {
19707
19702
  if (seededGroupsRef.current) return;
19708
19703
  if (closures.size === 0 && cycleParticipants.size === 0) return;
19709
19704
  seededGroupsRef.current = true;
@@ -19793,7 +19788,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
19793
19788
  entryCount: 0
19794
19789
  });
19795
19790
  const panelLayout = useMemo2(() => computePanelLayout(visibleCount), [visibleCount]);
19796
- useEffect8(() => {
19791
+ useEffect7(() => {
19797
19792
  setNav((prev) => {
19798
19793
  const maxIdx = Math.max(0, visibleRows.length - 1);
19799
19794
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -20261,7 +20256,7 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
20261
20256
  }
20262
20257
 
20263
20258
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
20264
- import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef5, useState as useState13 } from "react";
20259
+ import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef5, useState as useState13 } from "react";
20265
20260
 
20266
20261
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
20267
20262
  async function checkGenerationCache(input) {
@@ -20310,7 +20305,7 @@ function useScopeGateFlow(input, deps = realDeps2) {
20310
20305
  const loaded = useMemo3(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
20311
20306
  const cacheCheck = useRef5(void 0);
20312
20307
  const [confirmed, setConfirmed] = useState13();
20313
- useEffect9(() => {
20308
+ useEffect8(() => {
20314
20309
  if (!input || !loaded?.ok || cacheCheck.current) return;
20315
20310
  cacheCheck.current = deps.checkCache(input.cache);
20316
20311
  }, [input, loaded]);
@@ -20381,7 +20376,7 @@ function GenerationScreen({
20381
20376
  }
20382
20377
 
20383
20378
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
20384
- import { useEffect as useEffect10, useRef as useRef6, useState as useState14 } from "react";
20379
+ import { useEffect as useEffect9, useRef as useRef6, useState as useState14 } from "react";
20385
20380
 
20386
20381
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
20387
20382
  import { resolve as resolve23 } from "node:path";
@@ -20547,7 +20542,7 @@ function applyProgressEvent2(event, previous, total) {
20547
20542
  function useGeneration(input) {
20548
20543
  const [state, setState] = useState14();
20549
20544
  const current = useRef6();
20550
- useEffect10(() => {
20545
+ useEffect9(() => {
20551
20546
  current.current = input;
20552
20547
  if (!input) {
20553
20548
  setState(void 0);
@@ -20593,7 +20588,6 @@ function buildFlowStart(input) {
20593
20588
  }
20594
20589
 
20595
20590
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
20596
- import { useEffect as useEffect21, useRef as useRef12 } from "react";
20597
20591
  import { Box as Box41 } from "ink";
20598
20592
 
20599
20593
  // packages/experience-design-system-types/dist/src/cdf/validate.js
@@ -20940,7 +20934,7 @@ function PreviewValidationErrorScreen({
20940
20934
  }
20941
20935
 
20942
20936
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
20943
- import { useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo4, useRef as useRef11, useState as useState22 } from "react";
20937
+ import { useCallback as useCallback5, useEffect as useEffect16, useMemo as useMemo4, useRef as useRef11, useState as useState22 } from "react";
20944
20938
  import figures7 from "figures";
20945
20939
 
20946
20940
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/theme.ts
@@ -21212,7 +21206,7 @@ function enumerateCycleBreaks(cycle, components) {
21212
21206
  import { Box as Box27, Text as Text30 } from "ink";
21213
21207
 
21214
21208
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
21215
- import React9, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
21209
+ import React8, { useEffect as useEffect10, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
21216
21210
  import figures5 from "figures";
21217
21211
  import { Box as Box21, measureElement, Text as Text23 } from "ink";
21218
21212
 
@@ -21923,9 +21917,9 @@ function FieldEditor({
21923
21917
  const [editorState, setEditorState] = useState15(initialState);
21924
21918
  const [parseErr] = useState15(parseError);
21925
21919
  const [listScrollStart, setListScrollStart] = useState15(0);
21926
- const initialFocusScrollApplied = React9.useRef(false);
21920
+ const initialFocusScrollApplied = React8.useRef(false);
21927
21921
  const [rowHeights, setRowHeights] = useState15({});
21928
- const rowMeasureRefs = React9.useRef(/* @__PURE__ */ new Map());
21922
+ const rowMeasureRefs = React8.useRef(/* @__PURE__ */ new Map());
21929
21923
  const initialFocus = (() => {
21930
21924
  if (initialFocusTarget?.kind === "description") {
21931
21925
  return {
@@ -22012,23 +22006,23 @@ function FieldEditor({
22012
22006
  const [showHelp, setShowHelp] = useState15(false);
22013
22007
  const props = editorState.props;
22014
22008
  const slots = editorState.slots;
22015
- const contentPropIndexes = React9.useMemo(
22009
+ const contentPropIndexes = React8.useMemo(
22016
22010
  () => props.flatMap((prop, index) => prop.category === "content" ? [index] : []),
22017
22011
  [props]
22018
22012
  );
22019
- const designPropIndexes = React9.useMemo(
22013
+ const designPropIndexes = React8.useMemo(
22020
22014
  () => props.flatMap((prop, index) => prop.category === "design" ? [index] : []),
22021
22015
  [props]
22022
22016
  );
22023
- const hiddenPropIndexes = React9.useMemo(
22017
+ const hiddenPropIndexes = React8.useMemo(
22024
22018
  () => showHiddenProps ? props.flatMap((prop, index) => prop.category === "state" || prop.category === "unattached" ? [index] : []) : [],
22025
22019
  [props, showHiddenProps]
22026
22020
  );
22027
- const visiblePropIndexes = React9.useMemo(
22021
+ const visiblePropIndexes = React8.useMemo(
22028
22022
  () => [...contentPropIndexes, ...designPropIndexes, ...hiddenPropIndexes],
22029
22023
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes]
22030
22024
  );
22031
- const propGroups = React9.useMemo(
22025
+ const propGroups = React8.useMemo(
22032
22026
  () => [
22033
22027
  {
22034
22028
  kind: "content",
@@ -22048,7 +22042,7 @@ function FieldEditor({
22048
22042
  ],
22049
22043
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes]
22050
22044
  );
22051
- const selectableRows = React9.useMemo(
22045
+ const selectableRows = React8.useMemo(
22052
22046
  () => [
22053
22047
  ...contentPropIndexes.map((idx) => ({ kind: "prop", idx })),
22054
22048
  ...designPropIndexes.map((idx) => ({ kind: "prop", idx })),
@@ -22058,7 +22052,7 @@ function FieldEditor({
22058
22052
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes, slots]
22059
22053
  );
22060
22054
  const visiblePropPosition = visiblePropIndexes.indexOf(propIdx);
22061
- const selectedSelectableIndex = React9.useMemo(
22055
+ const selectedSelectableIndex = React8.useMemo(
22062
22056
  () => selectableRows.findIndex(
22063
22057
  (row) => inSlots ? row.kind === "slot" && row.idx === slotIdx : row.kind === "prop" && row.idx === propIdx
22064
22058
  ),
@@ -22077,12 +22071,12 @@ function FieldEditor({
22077
22071
  }
22078
22072
  };
22079
22073
  const textEntryActive = focusLevel === "field" && editingField && activeField === "description" || focusLevel === "field" && editingField && activeField === "default" && (editorState.props[propIdx]?.type === "string" || editorState.props[propIdx]?.type === "token") || editingValue != null;
22080
- React9.useEffect(() => {
22074
+ React8.useEffect(() => {
22081
22075
  onTextEntryActiveChange?.(textEntryActive);
22082
22076
  }, [textEntryActive, onTextEntryActiveChange]);
22083
22077
  const currentProp = props[propIdx] ?? null;
22084
22078
  const currentSlot = slots[slotIdx] ?? null;
22085
- React9.useEffect(() => {
22079
+ React8.useEffect(() => {
22086
22080
  if (showHiddenProps || inSlots || inComponentDesc || visiblePropPosition >= 0) return;
22087
22081
  if (visiblePropIndexes.length > 0) {
22088
22082
  setPropIdx(visiblePropIndexes[0]);
@@ -22101,22 +22095,22 @@ function FieldEditor({
22101
22095
  setEditorState(next);
22102
22096
  onChange(serializeState(next, value));
22103
22097
  };
22104
- const canonicalize = React9.useCallback((json) => {
22098
+ const canonicalize = React8.useCallback((json) => {
22105
22099
  try {
22106
22100
  return JSON.stringify(JSON.parse(json));
22107
22101
  } catch {
22108
22102
  return `__unparseable__:${json}`;
22109
22103
  }
22110
22104
  }, []);
22111
- const initialStateRef = React9.useRef(initialState);
22105
+ const initialStateRef = React8.useRef(initialState);
22112
22106
  const baselineCanonical = canonicalize(serializeState(initialStateRef.current, value));
22113
22107
  const currentCanonical = canonicalize(serializeState(editorState, value));
22114
22108
  const isDirty = currentCanonical !== baselineCanonical;
22115
- React9.useEffect(() => {
22109
+ React8.useEffect(() => {
22116
22110
  onDirtyChange?.(isDirty);
22117
22111
  }, [isDirty, onDirtyChange]);
22118
- const lastDiscardTriggerRef = React9.useRef(discardTrigger);
22119
- React9.useEffect(() => {
22112
+ const lastDiscardTriggerRef = React8.useRef(discardTrigger);
22113
+ React8.useEffect(() => {
22120
22114
  if (discardTrigger === void 0) return;
22121
22115
  if (discardTrigger === lastDiscardTriggerRef.current) return;
22122
22116
  lastDiscardTriggerRef.current = discardTrigger;
@@ -22715,7 +22709,7 @@ function FieldEditor({
22715
22709
  }
22716
22710
  return Math.max(start + 1, end2);
22717
22711
  };
22718
- useEffect11(() => {
22712
+ useEffect10(() => {
22719
22713
  if (focusLevel === "field" || selectedRowIdx < 0) return;
22720
22714
  setListScrollStart((previous) => {
22721
22715
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -23773,7 +23767,7 @@ function finalizeReviewSession(extractSessionId, components) {
23773
23767
  }
23774
23768
 
23775
23769
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
23776
- import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef8, useState as useState17 } from "react";
23770
+ import { useCallback as useCallback2, useEffect as useEffect12, useRef as useRef8, useState as useState17 } from "react";
23777
23771
 
23778
23772
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
23779
23773
  var DEFAULT_MAX_DEPTH = 50;
@@ -23829,7 +23823,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
23829
23823
  }
23830
23824
 
23831
23825
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
23832
- import { useEffect as useEffect12, useRef as useRef7, useState as useState16 } from "react";
23826
+ import { useEffect as useEffect11, useRef as useRef7, useState as useState16 } from "react";
23833
23827
 
23834
23828
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
23835
23829
  var TimeoutError = class extends Error {
@@ -23981,7 +23975,7 @@ function useFinalizePreview(opts) {
23981
23975
  const [scrollOffset, setScrollOffset] = useState16(0);
23982
23976
  const generationRef = useRef7(0);
23983
23977
  const acceptedKey = [...acceptedKeys].sort().join("\0");
23984
- useEffect12(() => {
23978
+ useEffect11(() => {
23985
23979
  if (!open) {
23986
23980
  setStatus("idle");
23987
23981
  setRemoved([]);
@@ -24044,7 +24038,7 @@ function useReviewSession({
24044
24038
  }));
24045
24039
  return { result, catalog };
24046
24040
  }, [loadSession, tokensPath]);
24047
- useEffect13(() => {
24041
+ useEffect12(() => {
24048
24042
  let disposed = false;
24049
24043
  void (async () => {
24050
24044
  try {
@@ -24097,7 +24091,7 @@ function useReviewSession({
24097
24091
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
24098
24092
  const [reviewMetadata, setReviewMetadata] = useState17(null);
24099
24093
  const [componentRationale, setComponentRationale] = useState17(null);
24100
- useEffect13(() => {
24094
+ useEffect12(() => {
24101
24095
  const current = components[selectedIdx];
24102
24096
  if (!current) {
24103
24097
  setReviewMetadata(null);
@@ -24129,7 +24123,7 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
24129
24123
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
24130
24124
  const historyRef = useRef8(null);
24131
24125
  const historySeededRef = useRef8(false);
24132
- useEffect13(() => {
24126
+ useEffect12(() => {
24133
24127
  if (loading || historySeededRef.current) return;
24134
24128
  historySeededRef.current = true;
24135
24129
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -24180,7 +24174,7 @@ function useReviewFinalize({
24180
24174
  }
24181
24175
 
24182
24176
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
24183
- import { useEffect as useEffect14, useRef as useRef9, useState as useState18 } from "react";
24177
+ import { useEffect as useEffect13, useRef as useRef9, useState as useState18 } from "react";
24184
24178
 
24185
24179
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
24186
24180
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -24233,7 +24227,7 @@ function useReviewEditor({
24233
24227
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState18(/* @__PURE__ */ new Set());
24234
24228
  const tokenReviewSuggestedRef = useRef9(/* @__PURE__ */ new Map());
24235
24229
  const pendingGRef = useRef9(false);
24236
- useEffect14(() => {
24230
+ useEffect13(() => {
24237
24231
  setTokenReviewRow(0);
24238
24232
  setTokenReviewEditing(false);
24239
24233
  setTokenReviewEditCursor(0);
@@ -24637,7 +24631,7 @@ function handleJsonPanelInput(input, key, state) {
24637
24631
  }
24638
24632
 
24639
24633
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
24640
- import { useCallback as useCallback4, useEffect as useEffect16, useState as useState21 } from "react";
24634
+ import { useCallback as useCallback4, useEffect as useEffect15, useState as useState21 } from "react";
24641
24635
 
24642
24636
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
24643
24637
  function applyPreviewAnnotations(preview, localNames) {
@@ -24672,7 +24666,7 @@ function applyPreviewAnnotations(preview, localNames) {
24672
24666
  }
24673
24667
 
24674
24668
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
24675
- import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef10, useState as useState20 } from "react";
24669
+ import { useCallback as useCallback3, useEffect as useEffect14, useRef as useRef10, useState as useState20 } from "react";
24676
24670
  var DEFAULT_DEBOUNCE_MS = 500;
24677
24671
  function useLivePreview(opts) {
24678
24672
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
@@ -24683,14 +24677,14 @@ function useLivePreview(opts) {
24683
24677
  const latestRef = useRef10(0);
24684
24678
  const inflightRef = useRef10(0);
24685
24679
  const optsRef = useRef10(opts);
24686
- useEffect15(() => {
24680
+ useEffect14(() => {
24687
24681
  optsRef.current = opts;
24688
24682
  });
24689
24683
  const disabledRef = useRef10(disabled);
24690
- useEffect15(() => {
24684
+ useEffect14(() => {
24691
24685
  disabledRef.current = disabled;
24692
24686
  }, [disabled]);
24693
- useEffect15(() => {
24687
+ useEffect14(() => {
24694
24688
  return () => {
24695
24689
  if (timerRef.current) {
24696
24690
  clearTimeout(timerRef.current);
@@ -24804,13 +24798,13 @@ function useReviewPreview({
24804
24798
  deleteAllComponents
24805
24799
  });
24806
24800
  const [spinnerTick, setSpinnerTick] = useState21(0);
24807
- useEffect16(() => {
24801
+ useEffect15(() => {
24808
24802
  if (livePreviewHook.status !== "running") return;
24809
24803
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
24810
24804
  return () => clearInterval(id);
24811
24805
  }, [livePreviewHook.status]);
24812
24806
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
24813
- useEffect16(() => {
24807
+ useEffect15(() => {
24814
24808
  if (loading) return;
24815
24809
  if (!livePreview) return;
24816
24810
  if (components.length === 0) return;
@@ -25230,7 +25224,7 @@ function GenerateReviewStepView({
25230
25224
  [components]
25231
25225
  );
25232
25226
  const closures = useMemo4(() => computeAllClosures(componentGraph), [componentGraph]);
25233
- useEffect17(() => {
25227
+ useEffect16(() => {
25234
25228
  if (seededGroupsRef.current) return;
25235
25229
  if (closures.size === 0 && slotCycles.length === 0) return;
25236
25230
  seededGroupsRef.current = true;
@@ -25257,7 +25251,7 @@ function GenerateReviewStepView({
25257
25251
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
25258
25252
  }));
25259
25253
  }, [slotCycles, cycleView]);
25260
- useEffect17(() => {
25254
+ useEffect16(() => {
25261
25255
  const decision = computeAutoRejectDecision({
25262
25256
  loading,
25263
25257
  autoRejectFired: autoRejectFiredRef.current,
@@ -25301,7 +25295,7 @@ function GenerateReviewStepView({
25301
25295
  applySnapshot: applyHistorySnapshot
25302
25296
  });
25303
25297
  const autoRejectPushedRef = useRef11(false);
25304
- useEffect17(() => {
25298
+ useEffect16(() => {
25305
25299
  if (loading) return;
25306
25300
  if (!historySeededRef.current) return;
25307
25301
  if (!autoRejectFiredRef.current) return;
@@ -25385,7 +25379,7 @@ function GenerateReviewStepView({
25385
25379
  const panelHeight = leftPanelHeight + 2;
25386
25380
  const panelContentHeight = Math.max(1, panelHeight - 3);
25387
25381
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
25388
- useEffect17(() => {
25382
+ useEffect16(() => {
25389
25383
  if (selectableRowPositions.length === 0) return;
25390
25384
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
25391
25385
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -26345,10 +26339,10 @@ function normalizePath(input) {
26345
26339
  }
26346
26340
 
26347
26341
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
26348
- import { useEffect as useEffect18, useState as useState23 } from "react";
26342
+ import { useEffect as useEffect17, useState as useState23 } from "react";
26349
26343
  function useBlinkingCursor() {
26350
26344
  const [visible, setVisible] = useState23(true);
26351
- useEffect18(() => {
26345
+ useEffect17(() => {
26352
26346
  const interval = setInterval(() => setVisible((current) => !current), 500);
26353
26347
  return () => clearInterval(interval);
26354
26348
  }, []);
@@ -26456,12 +26450,12 @@ function StepHeader({ stepNumber, totalSteps, title }) {
26456
26450
  }
26457
26451
 
26458
26452
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
26459
- import { useEffect as useEffect19, useState as useState25 } from "react";
26453
+ import { useEffect as useEffect18, useState as useState25 } from "react";
26460
26454
  import { Spinner as Spinner2 } from "@inkjs/ui";
26461
26455
  import { jsx as jsx49 } from "react/jsx-runtime";
26462
26456
  function useTimedSpinner() {
26463
26457
  const [elapsedSeconds, setElapsedSeconds] = useState25(0);
26464
- useEffect19(() => {
26458
+ useEffect18(() => {
26465
26459
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
26466
26460
  return () => {
26467
26461
  clearInterval(timer);
@@ -26510,7 +26504,7 @@ function PushingStep({ stepNumber, totalSteps, progress }) {
26510
26504
  }
26511
26505
 
26512
26506
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
26513
- import { useEffect as useEffect20, useState as useState26, useMemo as useMemo5 } from "react";
26507
+ import { useEffect as useEffect19, useState as useState26, useMemo as useMemo5 } from "react";
26514
26508
  import { Box as Box40, Text as Text43 } from "ink";
26515
26509
 
26516
26510
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -26895,7 +26889,7 @@ function WizardPreviewStep({
26895
26889
  const activeLines = diffExpanded ? diffLines : summaryLines;
26896
26890
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
26897
26891
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
26898
- useEffect20(() => {
26892
+ useEffect19(() => {
26899
26893
  setScrollOffset((previous) => Math.min(previous, maxScroll));
26900
26894
  }, [maxScroll]);
26901
26895
  useImmediateInput((input, key) => {
@@ -26994,18 +26988,10 @@ function FlowScreen({
26994
26988
  controller,
26995
26989
  livePreview = true,
26996
26990
  generatePromptPath,
26997
- onExit,
26998
- onStepChange
26991
+ onExit
26999
26992
  }) {
27000
26993
  const totalSteps = totalStepsFor(state);
27001
26994
  const quit = () => onExit(0);
27002
- const previousStep = useRef12(state.step);
27003
- useEffect21(() => {
27004
- if (previousStep.current !== state.step) {
27005
- onStepChange?.();
27006
- previousStep.current = state.step;
27007
- }
27008
- }, [state.step, onStepChange]);
27009
26995
  const content = (() => {
27010
26996
  switch (state.step) {
27011
26997
  case "final-review":
@@ -27131,7 +27117,7 @@ function FlowScreen({
27131
27117
  }
27132
27118
 
27133
27119
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
27134
- import { useEffect as useEffect22, useRef as useRef13, useSyncExternalStore } from "react";
27120
+ import { useEffect as useEffect20, useRef as useRef12, useSyncExternalStore } from "react";
27135
27121
 
27136
27122
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
27137
27123
  import { appendFileSync, writeFileSync } from "node:fs";
@@ -27721,6 +27707,12 @@ function createFlowController(start, deps) {
27721
27707
  deps.log({ update: sanitizeForLog(patch) });
27722
27708
  } catch {
27723
27709
  }
27710
+ if (patch.step !== void 0 && patch.step !== state.step) {
27711
+ try {
27712
+ deps.beforeStepChange?.();
27713
+ } catch {
27714
+ }
27715
+ }
27724
27716
  state = { ...state, ...patch };
27725
27717
  for (const listener of listeners) listener();
27726
27718
  };
@@ -27858,28 +27850,32 @@ function createFlowController(start, deps) {
27858
27850
  }
27859
27851
 
27860
27852
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
27861
- function useFlow(start, deps = realFlowDeps) {
27862
- const controller = useRef13();
27853
+ function useFlow(start, options = {}) {
27854
+ const controller = useRef12();
27863
27855
  if (start && !controller.current) {
27864
27856
  try {
27865
27857
  startWizardLog();
27866
27858
  } catch {
27867
27859
  }
27868
- controller.current = createFlowController(start, deps());
27860
+ const flowDeps = (options.deps ?? realFlowDeps)();
27861
+ controller.current = createFlowController(start, {
27862
+ ...flowDeps,
27863
+ ...options.beforeStepChange ? { beforeStepChange: options.beforeStepChange } : {}
27864
+ });
27869
27865
  }
27870
27866
  const current = controller.current;
27871
27867
  const state = useSyncExternalStore(
27872
27868
  (listener) => current?.subscribe(listener) ?? (() => void 0),
27873
27869
  () => current?.getState()
27874
27870
  );
27875
- useEffect22(() => {
27871
+ useEffect20(() => {
27876
27872
  if (!start) controller.current = void 0;
27877
27873
  }, [start]);
27878
27874
  return current && state ? { controller: current, state } : void 0;
27879
27875
  }
27880
27876
 
27881
27877
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
27882
- import { useEffect as useEffect23, useState as useState27 } from "react";
27878
+ import { useEffect as useEffect21, useState as useState27 } from "react";
27883
27879
  import { Box as Box42, Text as Text44, useInput as useInput9 } from "ink";
27884
27880
 
27885
27881
  // packages/experience-design-system-cli/src/tui/debug-store.ts
@@ -28073,7 +28069,7 @@ function Section({ title, rows }) {
28073
28069
  }
28074
28070
  function HelpScreen({ onDone }) {
28075
28071
  const [info, setInfo] = useState27();
28076
- useEffect23(() => {
28072
+ useEffect21(() => {
28077
28073
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
28078
28074
  void readHelpInfo().then(setInfo);
28079
28075
  }, []);
@@ -28166,7 +28162,7 @@ function SettingsScreen({
28166
28162
  }
28167
28163
 
28168
28164
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
28169
- import { useEffect as useEffect24, useState as useState29 } from "react";
28165
+ import { useEffect as useEffect22, useState as useState29 } from "react";
28170
28166
  import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
28171
28167
  import TextInput4 from "ink-text-input";
28172
28168
 
@@ -28234,7 +28230,7 @@ function ConfigurationScreen({ onDone }) {
28234
28230
  const [lastSaved, setLastSaved] = useState29(null);
28235
28231
  const [editing, setEditing] = useState29(false);
28236
28232
  const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
28237
- useEffect24(() => {
28233
+ useEffect22(() => {
28238
28234
  readCredentials().then((cfg) => {
28239
28235
  setConfig(cfg);
28240
28236
  setStage("form");
@@ -28371,7 +28367,7 @@ function ConfigurationScreen({ onDone }) {
28371
28367
  }
28372
28368
 
28373
28369
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
28374
- import { useEffect as useEffect25, useState as useState30 } from "react";
28370
+ import { useEffect as useEffect23, useState as useState30 } from "react";
28375
28371
  import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
28376
28372
 
28377
28373
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -28394,7 +28390,7 @@ import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-
28394
28390
  function OptInAnalyticsScreen({ onDone }) {
28395
28391
  const [loading, setLoading] = useState30(true);
28396
28392
  const [enabled, setEnabled] = useState30(true);
28397
- useEffect25(() => {
28393
+ useEffect23(() => {
28398
28394
  readAnalyticsSetting().then((setting) => {
28399
28395
  setEnabled(setting.enabled);
28400
28396
  setLoading(false);
@@ -28448,13 +28444,13 @@ function OptInAnalyticsScreen({ onDone }) {
28448
28444
  }
28449
28445
 
28450
28446
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
28451
- import { useEffect as useEffect26, useState as useState31 } from "react";
28447
+ import { useEffect as useEffect24, useState as useState31 } from "react";
28452
28448
  import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
28453
28449
  import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
28454
28450
  var UPGRADE_COMMANDS = ["git pull", "pnpm install", "pnpm build"];
28455
28451
  function UpgradeScreen({ onDone }) {
28456
28452
  const [upgradeCheck, setUpgradeCheck] = useState31();
28457
- useEffect26(() => {
28453
+ useEffect24(() => {
28458
28454
  startDebugRun({
28459
28455
  flow: "upgrade",
28460
28456
  step: "01-upgrade",
@@ -28519,13 +28515,13 @@ function renderBody(upgradeCheck) {
28519
28515
  }
28520
28516
 
28521
28517
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
28522
- import { useEffect as useEffect27, useState as useState32 } from "react";
28518
+ import { useEffect as useEffect25, useState as useState32 } from "react";
28523
28519
  import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
28524
28520
  import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
28525
28521
  function DebugModeScreen({ onDone }) {
28526
28522
  const [loading, setLoading] = useState32(true);
28527
28523
  const [enabled, setEnabled] = useState32(true);
28528
- useEffect27(() => {
28524
+ useEffect25(() => {
28529
28525
  readDebugModeSetting().then((setting) => {
28530
28526
  setEnabled(setting.enabled);
28531
28527
  setLoading(false);
@@ -28603,9 +28599,9 @@ function App({ importOptions, inkClear }) {
28603
28599
  const [generationInput, setGenerationInput] = useState33();
28604
28600
  const generation = useGeneration(generationInput);
28605
28601
  const [flowStart, setFlowStart] = useState33();
28606
- const flow = useFlow(flowStart);
28602
+ const flow = useFlow(flowStart, { beforeStepChange: inkClear });
28607
28603
  const [importDefaults, setImportDefaults] = useState33();
28608
- useEffect28(() => {
28604
+ useEffect26(() => {
28609
28605
  if (screen !== "import") {
28610
28606
  setImportDefaults(void 0);
28611
28607
  return;
@@ -28663,12 +28659,12 @@ function App({ importOptions, inkClear }) {
28663
28659
  }
28664
28660
  });
28665
28661
  };
28666
- useEffect28(() => {
28662
+ useEffect26(() => {
28667
28663
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
28668
28664
  setExtractionRun(void 0);
28669
28665
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
28670
28666
  }, [extraction, extractionRun]);
28671
- useEffect28(() => {
28667
+ useEffect26(() => {
28672
28668
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
28673
28669
  const { extraction: produced, input, generatePromptPath } = scopeRun;
28674
28670
  setGenerationInput({
@@ -28686,7 +28682,7 @@ function App({ importOptions, inkClear }) {
28686
28682
  ...generatePromptPath ? { generatePromptPath } : {}
28687
28683
  });
28688
28684
  }, [scopeFlow, scopeRun, generationInput]);
28689
- useEffect28(() => {
28685
+ useEffect26(() => {
28690
28686
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
28691
28687
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
28692
28688
  inkClear();
@@ -28737,11 +28733,7 @@ function App({ importOptions, inkClear }) {
28737
28733
  state: flow.state,
28738
28734
  controller: flow.controller,
28739
28735
  generatePromptPath: flowStart.generatePromptPath,
28740
- onExit: (code) => {
28741
- inkClear();
28742
- setImportExitCode(code);
28743
- },
28744
- onStepChange: inkClear
28736
+ onExit: setImportExitCode
28745
28737
  }
28746
28738
  );
28747
28739
  }