@contentful/experience-design-system-cli 2.40.1-dev-build-b9f92429.0 → 2.40.1-dev-build-35756f2e.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
@@ -20521,70 +20521,26 @@ var init_validate_path = __esm({
20521
20521
  });
20522
20522
 
20523
20523
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
20524
- import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
20524
+ import { useState as useState6 } from "react";
20525
20525
  import { Box as Box11, Text as Text11 } from "ink";
20526
20526
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
20527
- function TokenInputScreen({
20528
- mode,
20529
- onConfirm,
20530
- onBack,
20531
- initialPath = ""
20532
- }) {
20527
+ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
20533
20528
  const [tokenPath, setTokenPath] = useState6(initialPath);
20534
20529
  const [failure, setFailure] = useState6(null);
20535
- const rejected = useRef4([]).current;
20536
- useEffect6(() => {
20537
- startDebugRun({
20538
- flow: "import/token-input",
20539
- step: "02-token-input",
20540
- menuOption: "Token input",
20541
- inputs: { import_mode: mode, initial_path: initialPath }
20542
- });
20543
- }, []);
20544
- const back = () => {
20545
- void finishDebugRun({
20546
- outputs: { token_path: null, rejected_attempts: rejected, ...failure ? { error: failure.error } : {} },
20547
- status: failure ? "error" : "success",
20548
- exitMethod: "discarded"
20549
- });
20550
- onBack();
20551
- };
20552
- useTokenInputControls(back);
20530
+ useTokenInputControls(onBack);
20553
20531
  const change = (value) => {
20554
20532
  setTokenPath(value);
20555
20533
  setFailure(null);
20556
20534
  };
20557
- const reject = (entered, rejection) => {
20558
- if (rejected.length < MAX_LOGGED_ATTEMPTS) {
20559
- rejected.push({
20560
- entered,
20561
- error: rejection.error,
20562
- ...rejection.resolvedPath ? { resolved_path: rejection.resolvedPath } : {}
20563
- });
20564
- }
20565
- setFailure(rejection);
20566
- };
20567
20535
  const submit = (value) => {
20568
20536
  const rawPath = toTokenPath(value);
20569
20537
  if (!rawPath) {
20570
- reject("", { error: "Enter the path to your token file." });
20538
+ setFailure({ error: "Enter the path to your token file." });
20571
20539
  return;
20572
20540
  }
20573
20541
  const check = validateTokenPath(rawPath);
20574
- if (!check.ok) {
20575
- reject(rawPath, { error: check.error, resolvedPath: check.resolvedPath });
20576
- return;
20577
- }
20578
- void finishDebugRun({
20579
- outputs: {
20580
- token_path: check.path,
20581
- changed_from_initial: rawPath !== initialPath.trim(),
20582
- rejected_attempts: rejected
20583
- },
20584
- status: "success",
20585
- exitMethod: "saved"
20586
- });
20587
- onConfirm(check.path);
20542
+ if (check.ok) onConfirm(check.path);
20543
+ else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
20588
20544
  };
20589
20545
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
20590
20546
  /* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
@@ -20612,19 +20568,16 @@ function TokenInputScreen({
20612
20568
  ] })
20613
20569
  ] });
20614
20570
  }
20615
- var MAX_LOGGED_ATTEMPTS;
20616
20571
  var init_screen3 = __esm({
20617
20572
  "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
20618
20573
  "use strict";
20619
20574
  init_theme();
20620
- init_debug_store();
20621
20575
  init_ClearableTextInput();
20622
20576
  init_controls5();
20623
20577
  init_logic6();
20624
20578
  init_validate_path();
20625
20579
  init_ControlHints();
20626
20580
  init_StepHeader();
20627
- MAX_LOGGED_ATTEMPTS = 10;
20628
20581
  }
20629
20582
  });
20630
20583
 
@@ -20672,6 +20625,19 @@ function summarize(counts, { hasTokens = true } = {}) {
20672
20625
  warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
20673
20626
  };
20674
20627
  }
20628
+ function scanReport(scan, path5, { hasTokens = true } = {}) {
20629
+ if (scan === void 0) return { scan: "unfinished" };
20630
+ if (!scan.ok) return { scan: "failed", failure: scan.failure, error: describeFailure(scan.failure, path5).headline };
20631
+ const { total, warning } = summarize(scan.counts, { hasTokens });
20632
+ const { total: _total, ...byType } = scan.counts;
20633
+ return {
20634
+ scan: "ok",
20635
+ files_found: total,
20636
+ counts: Object.fromEntries(Object.entries(byType).filter(([, count]) => count > 0)),
20637
+ ...warning ? { warning } : {},
20638
+ ...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
20639
+ };
20640
+ }
20675
20641
  function phaseOf(scan) {
20676
20642
  if (scan === void 0) return "scanning";
20677
20643
  return scan.ok ? "ready" : "failed";
@@ -20762,7 +20728,7 @@ var init_scan_files = __esm({
20762
20728
  });
20763
20729
 
20764
20730
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
20765
- import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
20731
+ import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
20766
20732
  import { Box as Box12, Text as Text12 } from "ink";
20767
20733
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
20768
20734
  function Row({ row }) {
@@ -20810,6 +20776,7 @@ function Summary({
20810
20776
  ] });
20811
20777
  }
20812
20778
  function PathValidationScreen({
20779
+ mode,
20813
20780
  projectPath,
20814
20781
  onConfirm,
20815
20782
  onChangePath,
@@ -20818,16 +20785,39 @@ function PathValidationScreen({
20818
20785
  }) {
20819
20786
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20820
20787
  const [scan, setScan] = useState7();
20821
- useEffect7(() => {
20788
+ useEffect6(() => {
20789
+ startDebugRun({
20790
+ flow: "import/path-validation",
20791
+ step: "03-path-validation",
20792
+ menuOption: "Path validation",
20793
+ inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
20794
+ });
20795
+ }, []);
20796
+ useEffect6(() => {
20822
20797
  setScan(scanFiles(resolvedPath));
20823
20798
  }, [resolvedPath]);
20824
20799
  const phase = phaseOf(scan);
20800
+ const finish = (outcome, exitMethod) => {
20801
+ void finishDebugRun({
20802
+ outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
20803
+ status: scan?.ok === false ? "error" : "success",
20804
+ exitMethod
20805
+ });
20806
+ };
20825
20807
  usePathValidationControls(phase, {
20826
20808
  onConfirm: () => {
20827
- if (scan?.ok) onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
20809
+ if (!scan?.ok) return;
20810
+ finish("continued", "saved");
20811
+ onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
20828
20812
  },
20829
- onChangePath,
20830
- onBack
20813
+ onChangePath: () => {
20814
+ finish("changed-path", "discarded");
20815
+ onChangePath();
20816
+ },
20817
+ onBack: () => {
20818
+ finish("back", "discarded");
20819
+ onBack();
20820
+ }
20831
20821
  });
20832
20822
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
20833
20823
  /* @__PURE__ */ jsx13(StepHeader, { step: "setup" }),
@@ -20847,6 +20837,7 @@ var init_screen4 = __esm({
20847
20837
  "packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx"() {
20848
20838
  "use strict";
20849
20839
  init_theme();
20840
+ init_debug_store();
20850
20841
  init_resolve_user_path();
20851
20842
  init_controls6();
20852
20843
  init_scan_files();
@@ -21115,7 +21106,7 @@ var init_validate4 = __esm({
21115
21106
  });
21116
21107
 
21117
21108
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21118
- import { useRef as useRef5, useState as useState9 } from "react";
21109
+ import { useRef as useRef4, useState as useState9 } from "react";
21119
21110
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21120
21111
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21121
21112
  function CredentialsScreen({
@@ -21125,7 +21116,7 @@ function CredentialsScreen({
21125
21116
  validate: validate3 = validateCredentials,
21126
21117
  tokensOnly = false
21127
21118
  }) {
21128
- const initialValues = useRef5(
21119
+ const initialValues = useRef4(
21129
21120
  normalize({
21130
21121
  spaceId: initial.spaceId ?? "",
21131
21122
  environmentId: initial.environmentId || "master",
@@ -21845,11 +21836,11 @@ var init_run = __esm({
21845
21836
  });
21846
21837
 
21847
21838
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21848
- import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
21839
+ import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
21849
21840
  function useExtraction(input) {
21850
21841
  const [state2, setState] = useState11();
21851
- const current = useRef6();
21852
- useEffect8(() => {
21842
+ const current = useRef5();
21843
+ useEffect7(() => {
21853
21844
  current.current = input;
21854
21845
  if (!input) {
21855
21846
  setState(void 0);
@@ -21920,11 +21911,11 @@ var init_run_tokens_only = __esm({
21920
21911
  });
21921
21912
 
21922
21913
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
21923
- import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
21914
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
21924
21915
  function useTokensOnly(input) {
21925
21916
  const [state2, setState] = useState12();
21926
- const current = useRef7();
21927
- useEffect9(() => {
21917
+ const current = useRef6();
21918
+ useEffect8(() => {
21928
21919
  current.current = input;
21929
21920
  if (!input) {
21930
21921
  setState(void 0);
@@ -23121,7 +23112,7 @@ var init_GroupedSidebar = __esm({
23121
23112
  });
23122
23113
 
23123
23114
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
23124
- import { useLayoutEffect, useRef as useRef8 } from "react";
23115
+ import { useLayoutEffect, useRef as useRef7 } from "react";
23125
23116
  import { useStdin } from "ink";
23126
23117
  function parseInput(data) {
23127
23118
  const isShiftTab = data === "\x1B[Z";
@@ -23183,7 +23174,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
23183
23174
  }
23184
23175
  function useImmediateInput(handler, enabled = true) {
23185
23176
  const { stdin, setRawMode } = useStdin();
23186
- const handlerRef = useRef8(handler);
23177
+ const handlerRef = useRef7(handler);
23187
23178
  handlerRef.current = handler;
23188
23179
  useLayoutEffect(() => {
23189
23180
  if (!enabled) return;
@@ -23201,7 +23192,7 @@ var init_useImmediateInput = __esm({
23201
23192
 
23202
23193
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23203
23194
  import { useStdout as useStdout2 } from "ink";
23204
- import { useEffect as useEffect10, useState as useState13 } from "react";
23195
+ import { useEffect as useEffect9, useState as useState13 } from "react";
23205
23196
  function readTerminalSize(stdout) {
23206
23197
  return {
23207
23198
  columns: stdout?.columns ?? 80,
@@ -23211,7 +23202,7 @@ function readTerminalSize(stdout) {
23211
23202
  function useTerminalSize() {
23212
23203
  const { stdout } = useStdout2();
23213
23204
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
23214
- useEffect10(() => {
23205
+ useEffect9(() => {
23215
23206
  const updateSize = () => setSize(readTerminalSize(stdout));
23216
23207
  stdout?.on("resize", updateSize);
23217
23208
  updateSize();
@@ -24213,7 +24204,7 @@ var init_state = __esm({
24213
24204
  });
24214
24205
 
24215
24206
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24216
- import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24207
+ import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
24217
24208
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24218
24209
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24219
24210
  const columnPlan = useMemo3(
@@ -24259,8 +24250,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24259
24250
  for (const p of cycleParticipants) seed.add(p);
24260
24251
  return seed;
24261
24252
  });
24262
- const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24263
- useEffect11(() => {
24253
+ const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
24254
+ useEffect10(() => {
24264
24255
  if (seededGroupsRef.current) return;
24265
24256
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24266
24257
  seededGroupsRef.current = true;
@@ -24351,7 +24342,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24351
24342
  entryCount: 0
24352
24343
  });
24353
24344
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24354
- useEffect11(() => {
24345
+ useEffect10(() => {
24355
24346
  setNav((prev) => {
24356
24347
  const maxIdx = Math.max(0, visibleRows.length - 1);
24357
24348
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24924,13 +24915,13 @@ var init_load2 = __esm({
24924
24915
  });
24925
24916
 
24926
24917
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24927
- import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
24918
+ import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
24928
24919
  function useScopeGateFlow(input, deps = realDeps3) {
24929
24920
  const sessionId = input?.sessionId;
24930
24921
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24931
- const cacheCheck = useRef10(void 0);
24922
+ const cacheCheck = useRef9(void 0);
24932
24923
  const [confirmed, setConfirmed] = useState17();
24933
- useEffect12(() => {
24924
+ useEffect11(() => {
24934
24925
  if (!input || !loaded?.ok || cacheCheck.current) return;
24935
24926
  cacheCheck.current = deps.checkCache(input.cache);
24936
24927
  }, [input, loaded]);
@@ -25201,11 +25192,11 @@ var init_run2 = __esm({
25201
25192
  });
25202
25193
 
25203
25194
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25204
- import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
25195
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
25205
25196
  function useGeneration(input) {
25206
25197
  const [state2, setState] = useState18();
25207
- const current = useRef11();
25208
- useEffect13(() => {
25198
+ const current = useRef10();
25199
+ useEffect12(() => {
25209
25200
  current.current = input;
25210
25201
  if (!input) {
25211
25202
  setState(void 0);
@@ -26192,7 +26183,7 @@ var init_scroll_offset = __esm({
26192
26183
  });
26193
26184
 
26194
26185
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26195
- import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26186
+ import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26196
26187
  import figures6 from "figures";
26197
26188
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26198
26189
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27719,7 +27710,7 @@ function FieldEditor({
27719
27710
  }
27720
27711
  return Math.max(start + 1, end2);
27721
27712
  };
27722
- useEffect14(() => {
27713
+ useEffect13(() => {
27723
27714
  if (focusLevel === "field" || selectedRowIdx < 0) return;
27724
27715
  setListScrollStart((previous) => {
27725
27716
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29114,7 +29105,7 @@ var init_FinalizeDialog = __esm({
29114
29105
  });
29115
29106
 
29116
29107
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29117
- import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
29108
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
29118
29109
  function useReviewFinalizePreview({
29119
29110
  components,
29120
29111
  ...options
@@ -29129,9 +29120,9 @@ function useFinalizePreview(opts) {
29129
29120
  const [status, setStatus] = useState20("idle");
29130
29121
  const [removed, setRemoved] = useState20([]);
29131
29122
  const [scrollOffset, setScrollOffset] = useState20(0);
29132
- const generationRef = useRef12(0);
29123
+ const generationRef = useRef11(0);
29133
29124
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29134
- useEffect15(() => {
29125
+ useEffect14(() => {
29135
29126
  if (!open) {
29136
29127
  setStatus("idle");
29137
29128
  setRemoved([]);
@@ -29183,7 +29174,7 @@ var init_use_finalize_preview = __esm({
29183
29174
  });
29184
29175
 
29185
29176
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29186
- import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
29177
+ import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
29187
29178
  function useReviewSession({
29188
29179
  loadSession,
29189
29180
  tokensPath,
@@ -29202,7 +29193,7 @@ function useReviewSession({
29202
29193
  }));
29203
29194
  return { result, catalog };
29204
29195
  }, [loadSession, tokensPath]);
29205
- useEffect16(() => {
29196
+ useEffect15(() => {
29206
29197
  let disposed = false;
29207
29198
  void (async () => {
29208
29199
  try {
@@ -29255,7 +29246,7 @@ function useReviewSession({
29255
29246
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29256
29247
  const [reviewMetadata, setReviewMetadata] = useState21(null);
29257
29248
  const [componentRationale, setComponentRationale] = useState21(null);
29258
- useEffect16(() => {
29249
+ useEffect15(() => {
29259
29250
  const current = components[selectedIdx];
29260
29251
  if (!current) {
29261
29252
  setReviewMetadata(null);
@@ -29285,9 +29276,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29285
29276
  return { reviewMetadata, componentRationale };
29286
29277
  }
29287
29278
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29288
- const historyRef = useRef13(null);
29289
- const historySeededRef = useRef13(false);
29290
- useEffect16(() => {
29279
+ const historyRef = useRef12(null);
29280
+ const historySeededRef = useRef12(false);
29281
+ useEffect15(() => {
29291
29282
  if (loading || historySeededRef.current) return;
29292
29283
  historySeededRef.current = true;
29293
29284
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29369,7 +29360,7 @@ var init_token_suggestions = __esm({
29369
29360
  });
29370
29361
 
29371
29362
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29372
- import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
29363
+ import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
29373
29364
  function parseReviewEntry(draftValue) {
29374
29365
  const parsed = JSON.parse(draftValue);
29375
29366
  const keys = Object.keys(parsed);
@@ -29401,9 +29392,9 @@ function useReviewEditor({
29401
29392
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
29402
29393
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
29403
29394
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
29404
- const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29405
- const pendingGRef = useRef14(false);
29406
- useEffect17(() => {
29395
+ const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
29396
+ const pendingGRef = useRef13(false);
29397
+ useEffect16(() => {
29407
29398
  setTokenReviewRow(0);
29408
29399
  setTokenReviewEditing(false);
29409
29400
  setTokenReviewEditCursor(0);
@@ -29885,24 +29876,24 @@ var init_preview_annotations = __esm({
29885
29876
  });
29886
29877
 
29887
29878
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
29888
- import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
29879
+ import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
29889
29880
  function useLivePreview(opts) {
29890
29881
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
29891
29882
  const [status, setStatus] = useState24("idle");
29892
29883
  const [disabled, setDisabled] = useState24(false);
29893
- const timerRef = useRef15(null);
29894
- const generationRef = useRef15(0);
29895
- const latestRef = useRef15(0);
29896
- const inflightRef = useRef15(0);
29897
- const optsRef = useRef15(opts);
29898
- useEffect18(() => {
29884
+ const timerRef = useRef14(null);
29885
+ const generationRef = useRef14(0);
29886
+ const latestRef = useRef14(0);
29887
+ const inflightRef = useRef14(0);
29888
+ const optsRef = useRef14(opts);
29889
+ useEffect17(() => {
29899
29890
  optsRef.current = opts;
29900
29891
  });
29901
- const disabledRef = useRef15(disabled);
29902
- useEffect18(() => {
29892
+ const disabledRef = useRef14(disabled);
29893
+ useEffect17(() => {
29903
29894
  disabledRef.current = disabled;
29904
29895
  }, [disabled]);
29905
- useEffect18(() => {
29896
+ useEffect17(() => {
29906
29897
  return () => {
29907
29898
  if (timerRef.current) {
29908
29899
  clearTimeout(timerRef.current);
@@ -29983,7 +29974,7 @@ var init_use_live_preview = __esm({
29983
29974
  });
29984
29975
 
29985
29976
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
29986
- import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
29977
+ import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
29987
29978
  function useReviewPreview({
29988
29979
  components,
29989
29980
  loading,
@@ -30025,13 +30016,13 @@ function useReviewPreview({
30025
30016
  deleteAllComponents
30026
30017
  });
30027
30018
  const [spinnerTick, setSpinnerTick] = useState25(0);
30028
- useEffect19(() => {
30019
+ useEffect18(() => {
30029
30020
  if (livePreviewHook.status !== "running") return;
30030
30021
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
30031
30022
  return () => clearInterval(id);
30032
30023
  }, [livePreviewHook.status]);
30033
30024
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
30034
- useEffect19(() => {
30025
+ useEffect18(() => {
30035
30026
  if (loading) return;
30036
30027
  if (!livePreview) return;
30037
30028
  if (components.length === 0) return;
@@ -30088,7 +30079,7 @@ var init_LivePreviewSummary = __esm({
30088
30079
  });
30089
30080
 
30090
30081
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30091
- import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30082
+ import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
30092
30083
  import figures8 from "figures";
30093
30084
  import { Box as Box38, Text as Text40 } from "ink";
30094
30085
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30302,7 +30293,7 @@ function GenerateReviewStepView({
30302
30293
  setFinalizeError
30303
30294
  } = reviewSurface;
30304
30295
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
30305
- const removedBannerDefaultedRef = useRef16(false);
30296
+ const removedBannerDefaultedRef = useRef15(false);
30306
30297
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30307
30298
  const [cyclesCursor, setCyclesCursor] = useState26(0);
30308
30299
  const cyclePanel = useOverlayPanel({
@@ -30322,7 +30313,7 @@ function GenerateReviewStepView({
30322
30313
  const [breakCursor, setBreakCursor] = useState26(0);
30323
30314
  const [breakConfirm, setBreakConfirm] = useState26(false);
30324
30315
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
30325
- const seededGroupsRef = useRef16(false);
30316
+ const seededGroupsRef = useRef15(false);
30326
30317
  const {
30327
30318
  searchOpen,
30328
30319
  setSearchOpen,
@@ -30346,7 +30337,7 @@ function GenerateReviewStepView({
30346
30337
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30347
30338
  const [autoRejected, setAutoRejected] = useState26([]);
30348
30339
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
30349
- const autoRejectFiredRef = useRef16(false);
30340
+ const autoRejectFiredRef = useRef15(false);
30350
30341
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
30351
30342
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30352
30343
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -30409,7 +30400,7 @@ function GenerateReviewStepView({
30409
30400
  [components]
30410
30401
  );
30411
30402
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30412
- useEffect20(() => {
30403
+ useEffect19(() => {
30413
30404
  if (seededGroupsRef.current) return;
30414
30405
  if (closures.size === 0 && slotCycles.length === 0) return;
30415
30406
  seededGroupsRef.current = true;
@@ -30436,7 +30427,7 @@ function GenerateReviewStepView({
30436
30427
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30437
30428
  }));
30438
30429
  }, [slotCycles, cycleView]);
30439
- useEffect20(() => {
30430
+ useEffect19(() => {
30440
30431
  const decision = computeAutoRejectDecision({
30441
30432
  loading,
30442
30433
  autoRejectFired: autoRejectFiredRef.current,
@@ -30479,8 +30470,8 @@ function GenerateReviewStepView({
30479
30470
  }),
30480
30471
  applySnapshot: applyHistorySnapshot
30481
30472
  });
30482
- const autoRejectPushedRef = useRef16(false);
30483
- useEffect20(() => {
30473
+ const autoRejectPushedRef = useRef15(false);
30474
+ useEffect19(() => {
30484
30475
  if (loading) return;
30485
30476
  if (!historySeededRef.current) return;
30486
30477
  if (!autoRejectFiredRef.current) return;
@@ -30564,7 +30555,7 @@ function GenerateReviewStepView({
30564
30555
  const panelHeight = leftPanelHeight + 2;
30565
30556
  const panelContentHeight = Math.max(1, panelHeight - 3);
30566
30557
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30567
- useEffect20(() => {
30558
+ useEffect19(() => {
30568
30559
  if (selectableRowPositions.length === 0) return;
30569
30560
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30570
30561
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31646,10 +31637,10 @@ var init_path_utils = __esm({
31646
31637
  });
31647
31638
 
31648
31639
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
31649
- import { useEffect as useEffect21, useState as useState27 } from "react";
31640
+ import { useEffect as useEffect20, useState as useState27 } from "react";
31650
31641
  function useBlinkingCursor() {
31651
31642
  const [visible, setVisible] = useState27(true);
31652
- useEffect21(() => {
31643
+ useEffect20(() => {
31653
31644
  const interval = setInterval(() => setVisible((current) => !current), 500);
31654
31645
  return () => clearInterval(interval);
31655
31646
  }, []);
@@ -31786,12 +31777,12 @@ var init_produced = __esm({
31786
31777
  });
31787
31778
 
31788
31779
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
31789
- import { useEffect as useEffect22, useState as useState29 } from "react";
31780
+ import { useEffect as useEffect21, useState as useState29 } from "react";
31790
31781
  import { Spinner as Spinner2 } from "@inkjs/ui";
31791
31782
  import { jsx as jsx53 } from "react/jsx-runtime";
31792
31783
  function useTimedSpinner() {
31793
31784
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
31794
- useEffect22(() => {
31785
+ useEffect21(() => {
31795
31786
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
31796
31787
  return () => {
31797
31788
  clearInterval(timer);
@@ -32060,7 +32051,7 @@ var init_preview_confirmation_input = __esm({
32060
32051
  });
32061
32052
 
32062
32053
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32063
- import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
32054
+ import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
32064
32055
  import { Box as Box44, Text as Text46 } from "ink";
32065
32056
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32066
32057
  function buildPreviewSummaryLines(preview) {
@@ -32270,7 +32261,7 @@ function WizardPreviewStep({
32270
32261
  const activeLines = diffExpanded ? diffLines : summaryLines;
32271
32262
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32272
32263
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32273
- useEffect23(() => {
32264
+ useEffect22(() => {
32274
32265
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32275
32266
  }, [maxScroll]);
32276
32267
  useImmediateInput((input, key) => {
@@ -33318,9 +33309,9 @@ var init_controller = __esm({
33318
33309
  });
33319
33310
 
33320
33311
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33321
- import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
33312
+ import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
33322
33313
  function useFlow(start, options = {}) {
33323
- const controller = useRef17();
33314
+ const controller = useRef16();
33324
33315
  if (start && !controller.current) {
33325
33316
  try {
33326
33317
  startWizardLog();
@@ -33337,7 +33328,7 @@ function useFlow(start, options = {}) {
33337
33328
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33338
33329
  () => current?.getState()
33339
33330
  );
33340
- useEffect24(() => {
33331
+ useEffect23(() => {
33341
33332
  if (!start) controller.current = void 0;
33342
33333
  }, [start]);
33343
33334
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33416,7 +33407,7 @@ var init_help_info = __esm({
33416
33407
  });
33417
33408
 
33418
33409
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33419
- import { useEffect as useEffect25, useState as useState31 } from "react";
33410
+ import { useEffect as useEffect24, useState as useState31 } from "react";
33420
33411
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33421
33412
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33422
33413
  function Section({ title, rows }) {
@@ -33430,7 +33421,7 @@ function Section({ title, rows }) {
33430
33421
  }
33431
33422
  function HelpScreen({ onDone }) {
33432
33423
  const [info, setInfo] = useState31();
33433
- useEffect25(() => {
33424
+ useEffect24(() => {
33434
33425
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
33435
33426
  void readHelpInfo().then(setInfo);
33436
33427
  }, []);
@@ -33851,7 +33842,7 @@ var init_AgentStatusBadge = __esm({
33851
33842
  });
33852
33843
 
33853
33844
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
33854
- import { useEffect as useEffect26, useState as useState33 } from "react";
33845
+ import { useEffect as useEffect25, useState as useState33 } from "react";
33855
33846
  import { Box as Box48, Text as Text50 } from "ink";
33856
33847
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
33857
33848
  function StatusHeading() {
@@ -33872,7 +33863,7 @@ function AgentDetail({
33872
33863
  const [testing, setTesting] = useState33(false);
33873
33864
  const [notice, setNotice] = useState33(null);
33874
33865
  const [checks, setChecks] = useState33(void 0);
33875
- useEffect26(() => {
33866
+ useEffect25(() => {
33876
33867
  let active = true;
33877
33868
  setChecks(void 0);
33878
33869
  const timer = setTimeout(() => {
@@ -33964,7 +33955,7 @@ var init_AgentDetail = __esm({
33964
33955
  });
33965
33956
 
33966
33957
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
33967
- import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
33958
+ import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
33968
33959
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
33969
33960
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
33970
33961
  function AgentsScreen({ onDone }) {
@@ -33975,7 +33966,7 @@ function AgentsScreen({ onDone }) {
33975
33966
  const [saving, setSaving] = useState34(false);
33976
33967
  const [loadError, setLoadError] = useState34(null);
33977
33968
  const [checks, setChecks] = useState34({});
33978
- const visit = useRef18({
33969
+ const visit = useRef17({
33979
33970
  trail: createTrail(),
33980
33971
  before: void 0,
33981
33972
  environment: void 0,
@@ -33988,7 +33979,7 @@ function AgentsScreen({ onDone }) {
33988
33979
  );
33989
33980
  }
33990
33981
  };
33991
- useEffect27(() => {
33982
+ useEffect26(() => {
33992
33983
  readAgentConfig().then((loaded) => {
33993
33984
  setConfig(loaded);
33994
33985
  inspectAll(loaded);
@@ -34214,7 +34205,7 @@ var init_project_store = __esm({
34214
34205
  });
34215
34206
 
34216
34207
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34217
- import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
34208
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
34218
34209
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34219
34210
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34220
34211
  function debugFields(config) {
@@ -34233,14 +34224,14 @@ function ProjectScreen({ onDone }) {
34233
34224
  const [saving, setSaving] = useState35(false);
34234
34225
  const [notice, setNotice] = useState35(null);
34235
34226
  const [loadError, setLoadError] = useState35(null);
34236
- const visit = useRef19({
34227
+ const visit = useRef18({
34237
34228
  trail: createTrail(),
34238
34229
  before: void 0,
34239
34230
  persisted: void 0,
34240
34231
  error: ""
34241
34232
  }).current;
34242
34233
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34243
- useEffect28(() => {
34234
+ useEffect27(() => {
34244
34235
  readCredentials().then((cfg) => {
34245
34236
  setConfig(cfg);
34246
34237
  visit.before = snapshotOf(cfg);
@@ -34427,13 +34418,13 @@ var init_ConfigurationScreen = __esm({
34427
34418
  });
34428
34419
 
34429
34420
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34430
- import { useEffect as useEffect29, useState as useState37 } from "react";
34421
+ import { useEffect as useEffect28, useState as useState37 } from "react";
34431
34422
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34432
34423
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34433
34424
  function OptInAnalyticsScreen({ onDone }) {
34434
34425
  const [loading, setLoading] = useState37(true);
34435
34426
  const [enabled, setEnabled] = useState37(true);
34436
- useEffect29(() => {
34427
+ useEffect28(() => {
34437
34428
  readAnalyticsSetting().then((setting) => {
34438
34429
  setEnabled(setting.enabled);
34439
34430
  setLoading(false);
@@ -34496,7 +34487,7 @@ var init_screen12 = __esm({
34496
34487
  });
34497
34488
 
34498
34489
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34499
- import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
34490
+ import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
34500
34491
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
34501
34492
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
34502
34493
  function DebugModeScreen({ onDone }) {
@@ -34506,8 +34497,8 @@ function DebugModeScreen({ onDone }) {
34506
34497
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
34507
34498
  );
34508
34499
  const [notice, setNotice] = useState38(null);
34509
- const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
34510
- useEffect30(() => {
34500
+ const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
34501
+ useEffect29(() => {
34511
34502
  readDebugModeSetting().then((loaded) => {
34512
34503
  setSetting(loaded);
34513
34504
  setPending(loaded.retentionDays);
@@ -34648,7 +34639,7 @@ var app_exports = {};
34648
34639
  __export(app_exports, {
34649
34640
  runApp: () => runApp
34650
34641
  });
34651
- import { useEffect as useEffect31, useState as useState39 } from "react";
34642
+ import { useEffect as useEffect30, useState as useState39 } from "react";
34652
34643
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
34653
34644
  function App({ importOptions, inkClear }) {
34654
34645
  const [screen, setScreen] = useState39("start");
@@ -34682,7 +34673,7 @@ function App({ importOptions, inkClear }) {
34682
34673
  const [flowStart, setFlowStart] = useState39();
34683
34674
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34684
34675
  const [importDefaults, setImportDefaults] = useState39();
34685
- useEffect31(() => {
34676
+ useEffect30(() => {
34686
34677
  if (screen !== "import") {
34687
34678
  setImportDefaults(void 0);
34688
34679
  return;
@@ -34755,7 +34746,7 @@ function App({ importOptions, inkClear }) {
34755
34746
  }
34756
34747
  });
34757
34748
  };
34758
- useEffect31(() => {
34749
+ useEffect30(() => {
34759
34750
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
34760
34751
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
34761
34752
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -34777,12 +34768,12 @@ function App({ importOptions, inkClear }) {
34777
34768
  }
34778
34769
  });
34779
34770
  }, [tokensOnly, tokensOnlyRun]);
34780
- useEffect31(() => {
34771
+ useEffect30(() => {
34781
34772
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34782
34773
  setExtractionRun(void 0);
34783
34774
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34784
34775
  }, [extraction, extractionRun]);
34785
- useEffect31(() => {
34776
+ useEffect30(() => {
34786
34777
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34787
34778
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34788
34779
  setGenerationInput({
@@ -34800,7 +34791,7 @@ function App({ importOptions, inkClear }) {
34800
34791
  ...generatePromptPath ? { generatePromptPath } : {}
34801
34792
  });
34802
34793
  }, [scopeFlow, scopeRun, generationInput]);
34803
- useEffect31(() => {
34794
+ useEffect30(() => {
34804
34795
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34805
34796
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
34806
34797
  inkClear();
@@ -34893,7 +34884,6 @@ function App({ importOptions, inkClear }) {
34893
34884
  return /* @__PURE__ */ jsx66(
34894
34885
  TokenInputScreen,
34895
34886
  {
34896
- mode: target,
34897
34887
  initialPath: importDefaults.tokenFile,
34898
34888
  onConfirm: (tokensPath) => answer({ tokensPath }),
34899
34889
  onBack: () => goBackFrom("token-file")
@@ -34903,6 +34893,7 @@ function App({ importOptions, inkClear }) {
34903
34893
  return /* @__PURE__ */ jsx66(
34904
34894
  PathValidationScreen,
34905
34895
  {
34896
+ mode: target,
34906
34897
  projectPath: answers.projectPath ?? "",
34907
34898
  hasTokens: target !== "components",
34908
34899
  onConfirm: ({ filePaths }) => answer({ scannedFiles: filePaths }),