@contentful/experience-design-system-cli 2.40.1-dev-build-35756f2e.0 → 2.40.1-dev-build-54dd0c33.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,26 +20521,70 @@ 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 { useState as useState6 } from "react";
20524
+ import { useEffect as useEffect6, useRef as useRef4, 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({ onConfirm, onBack, initialPath = "" }) {
20527
+ function TokenInputScreen({
20528
+ mode,
20529
+ onConfirm,
20530
+ onBack,
20531
+ initialPath = ""
20532
+ }) {
20528
20533
  const [tokenPath, setTokenPath] = useState6(initialPath);
20529
20534
  const [failure, setFailure] = useState6(null);
20530
- useTokenInputControls(onBack);
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);
20531
20553
  const change = (value) => {
20532
20554
  setTokenPath(value);
20533
20555
  setFailure(null);
20534
20556
  };
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
+ };
20535
20567
  const submit = (value) => {
20536
20568
  const rawPath = toTokenPath(value);
20537
20569
  if (!rawPath) {
20538
- setFailure({ error: "Enter the path to your token file." });
20570
+ reject("", { error: "Enter the path to your token file." });
20539
20571
  return;
20540
20572
  }
20541
20573
  const check = validateTokenPath(rawPath);
20542
- if (check.ok) onConfirm(check.path);
20543
- else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
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);
20544
20588
  };
20545
20589
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
20546
20590
  /* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
@@ -20568,16 +20612,19 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
20568
20612
  ] })
20569
20613
  ] });
20570
20614
  }
20615
+ var MAX_LOGGED_ATTEMPTS;
20571
20616
  var init_screen3 = __esm({
20572
20617
  "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
20573
20618
  "use strict";
20574
20619
  init_theme();
20620
+ init_debug_store();
20575
20621
  init_ClearableTextInput();
20576
20622
  init_controls5();
20577
20623
  init_logic6();
20578
20624
  init_validate_path();
20579
20625
  init_ControlHints();
20580
20626
  init_StepHeader();
20627
+ MAX_LOGGED_ATTEMPTS = 10;
20581
20628
  }
20582
20629
  });
20583
20630
 
@@ -20728,7 +20775,7 @@ var init_scan_files = __esm({
20728
20775
  });
20729
20776
 
20730
20777
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
20731
- import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
20778
+ import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
20732
20779
  import { Box as Box12, Text as Text12 } from "ink";
20733
20780
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
20734
20781
  function Row({ row }) {
@@ -20785,7 +20832,7 @@ function PathValidationScreen({
20785
20832
  }) {
20786
20833
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20787
20834
  const [scan, setScan] = useState7();
20788
- useEffect6(() => {
20835
+ useEffect7(() => {
20789
20836
  startDebugRun({
20790
20837
  flow: "import/path-validation",
20791
20838
  step: "03-path-validation",
@@ -20793,7 +20840,7 @@ function PathValidationScreen({
20793
20840
  inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
20794
20841
  });
20795
20842
  }, []);
20796
- useEffect6(() => {
20843
+ useEffect7(() => {
20797
20844
  setScan(scanFiles(resolvedPath));
20798
20845
  }, [resolvedPath]);
20799
20846
  const phase = phaseOf(scan);
@@ -21106,7 +21153,7 @@ var init_validate4 = __esm({
21106
21153
  });
21107
21154
 
21108
21155
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21109
- import { useRef as useRef4, useState as useState9 } from "react";
21156
+ import { useRef as useRef5, useState as useState9 } from "react";
21110
21157
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21111
21158
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21112
21159
  function CredentialsScreen({
@@ -21116,7 +21163,7 @@ function CredentialsScreen({
21116
21163
  validate: validate3 = validateCredentials,
21117
21164
  tokensOnly = false
21118
21165
  }) {
21119
- const initialValues = useRef4(
21166
+ const initialValues = useRef5(
21120
21167
  normalize({
21121
21168
  spaceId: initial.spaceId ?? "",
21122
21169
  environmentId: initial.environmentId || "master",
@@ -21836,11 +21883,11 @@ var init_run = __esm({
21836
21883
  });
21837
21884
 
21838
21885
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21839
- import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
21886
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
21840
21887
  function useExtraction(input) {
21841
21888
  const [state2, setState] = useState11();
21842
- const current = useRef5();
21843
- useEffect7(() => {
21889
+ const current = useRef6();
21890
+ useEffect8(() => {
21844
21891
  current.current = input;
21845
21892
  if (!input) {
21846
21893
  setState(void 0);
@@ -21911,11 +21958,11 @@ var init_run_tokens_only = __esm({
21911
21958
  });
21912
21959
 
21913
21960
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
21914
- import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
21961
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
21915
21962
  function useTokensOnly(input) {
21916
21963
  const [state2, setState] = useState12();
21917
- const current = useRef6();
21918
- useEffect8(() => {
21964
+ const current = useRef7();
21965
+ useEffect9(() => {
21919
21966
  current.current = input;
21920
21967
  if (!input) {
21921
21968
  setState(void 0);
@@ -23112,7 +23159,7 @@ var init_GroupedSidebar = __esm({
23112
23159
  });
23113
23160
 
23114
23161
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
23115
- import { useLayoutEffect, useRef as useRef7 } from "react";
23162
+ import { useLayoutEffect, useRef as useRef8 } from "react";
23116
23163
  import { useStdin } from "ink";
23117
23164
  function parseInput(data) {
23118
23165
  const isShiftTab = data === "\x1B[Z";
@@ -23174,7 +23221,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
23174
23221
  }
23175
23222
  function useImmediateInput(handler, enabled = true) {
23176
23223
  const { stdin, setRawMode } = useStdin();
23177
- const handlerRef = useRef7(handler);
23224
+ const handlerRef = useRef8(handler);
23178
23225
  handlerRef.current = handler;
23179
23226
  useLayoutEffect(() => {
23180
23227
  if (!enabled) return;
@@ -23192,7 +23239,7 @@ var init_useImmediateInput = __esm({
23192
23239
 
23193
23240
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23194
23241
  import { useStdout as useStdout2 } from "ink";
23195
- import { useEffect as useEffect9, useState as useState13 } from "react";
23242
+ import { useEffect as useEffect10, useState as useState13 } from "react";
23196
23243
  function readTerminalSize(stdout) {
23197
23244
  return {
23198
23245
  columns: stdout?.columns ?? 80,
@@ -23202,7 +23249,7 @@ function readTerminalSize(stdout) {
23202
23249
  function useTerminalSize() {
23203
23250
  const { stdout } = useStdout2();
23204
23251
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
23205
- useEffect9(() => {
23252
+ useEffect10(() => {
23206
23253
  const updateSize = () => setSize(readTerminalSize(stdout));
23207
23254
  stdout?.on("resize", updateSize);
23208
23255
  updateSize();
@@ -24204,7 +24251,7 @@ var init_state = __esm({
24204
24251
  });
24205
24252
 
24206
24253
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24207
- import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
24254
+ import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24208
24255
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24209
24256
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24210
24257
  const columnPlan = useMemo3(
@@ -24250,8 +24297,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24250
24297
  for (const p of cycleParticipants) seed.add(p);
24251
24298
  return seed;
24252
24299
  });
24253
- const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
24254
- useEffect10(() => {
24300
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24301
+ useEffect11(() => {
24255
24302
  if (seededGroupsRef.current) return;
24256
24303
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24257
24304
  seededGroupsRef.current = true;
@@ -24342,7 +24389,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24342
24389
  entryCount: 0
24343
24390
  });
24344
24391
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24345
- useEffect10(() => {
24392
+ useEffect11(() => {
24346
24393
  setNav((prev) => {
24347
24394
  const maxIdx = Math.max(0, visibleRows.length - 1);
24348
24395
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24915,13 +24962,13 @@ var init_load2 = __esm({
24915
24962
  });
24916
24963
 
24917
24964
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24918
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
24965
+ import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
24919
24966
  function useScopeGateFlow(input, deps = realDeps3) {
24920
24967
  const sessionId = input?.sessionId;
24921
24968
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24922
- const cacheCheck = useRef9(void 0);
24969
+ const cacheCheck = useRef10(void 0);
24923
24970
  const [confirmed, setConfirmed] = useState17();
24924
- useEffect11(() => {
24971
+ useEffect12(() => {
24925
24972
  if (!input || !loaded?.ok || cacheCheck.current) return;
24926
24973
  cacheCheck.current = deps.checkCache(input.cache);
24927
24974
  }, [input, loaded]);
@@ -25192,11 +25239,11 @@ var init_run2 = __esm({
25192
25239
  });
25193
25240
 
25194
25241
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25195
- import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
25242
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
25196
25243
  function useGeneration(input) {
25197
25244
  const [state2, setState] = useState18();
25198
- const current = useRef10();
25199
- useEffect12(() => {
25245
+ const current = useRef11();
25246
+ useEffect13(() => {
25200
25247
  current.current = input;
25201
25248
  if (!input) {
25202
25249
  setState(void 0);
@@ -26183,7 +26230,7 @@ var init_scroll_offset = __esm({
26183
26230
  });
26184
26231
 
26185
26232
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26186
- import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26233
+ import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26187
26234
  import figures6 from "figures";
26188
26235
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26189
26236
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27710,7 +27757,7 @@ function FieldEditor({
27710
27757
  }
27711
27758
  return Math.max(start + 1, end2);
27712
27759
  };
27713
- useEffect13(() => {
27760
+ useEffect14(() => {
27714
27761
  if (focusLevel === "field" || selectedRowIdx < 0) return;
27715
27762
  setListScrollStart((previous) => {
27716
27763
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29105,7 +29152,7 @@ var init_FinalizeDialog = __esm({
29105
29152
  });
29106
29153
 
29107
29154
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29108
- import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
29155
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
29109
29156
  function useReviewFinalizePreview({
29110
29157
  components,
29111
29158
  ...options
@@ -29120,9 +29167,9 @@ function useFinalizePreview(opts) {
29120
29167
  const [status, setStatus] = useState20("idle");
29121
29168
  const [removed, setRemoved] = useState20([]);
29122
29169
  const [scrollOffset, setScrollOffset] = useState20(0);
29123
- const generationRef = useRef11(0);
29170
+ const generationRef = useRef12(0);
29124
29171
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29125
- useEffect14(() => {
29172
+ useEffect15(() => {
29126
29173
  if (!open) {
29127
29174
  setStatus("idle");
29128
29175
  setRemoved([]);
@@ -29174,7 +29221,7 @@ var init_use_finalize_preview = __esm({
29174
29221
  });
29175
29222
 
29176
29223
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29177
- import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
29224
+ import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
29178
29225
  function useReviewSession({
29179
29226
  loadSession,
29180
29227
  tokensPath,
@@ -29193,7 +29240,7 @@ function useReviewSession({
29193
29240
  }));
29194
29241
  return { result, catalog };
29195
29242
  }, [loadSession, tokensPath]);
29196
- useEffect15(() => {
29243
+ useEffect16(() => {
29197
29244
  let disposed = false;
29198
29245
  void (async () => {
29199
29246
  try {
@@ -29246,7 +29293,7 @@ function useReviewSession({
29246
29293
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29247
29294
  const [reviewMetadata, setReviewMetadata] = useState21(null);
29248
29295
  const [componentRationale, setComponentRationale] = useState21(null);
29249
- useEffect15(() => {
29296
+ useEffect16(() => {
29250
29297
  const current = components[selectedIdx];
29251
29298
  if (!current) {
29252
29299
  setReviewMetadata(null);
@@ -29276,9 +29323,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29276
29323
  return { reviewMetadata, componentRationale };
29277
29324
  }
29278
29325
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29279
- const historyRef = useRef12(null);
29280
- const historySeededRef = useRef12(false);
29281
- useEffect15(() => {
29326
+ const historyRef = useRef13(null);
29327
+ const historySeededRef = useRef13(false);
29328
+ useEffect16(() => {
29282
29329
  if (loading || historySeededRef.current) return;
29283
29330
  historySeededRef.current = true;
29284
29331
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29360,7 +29407,7 @@ var init_token_suggestions = __esm({
29360
29407
  });
29361
29408
 
29362
29409
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29363
- import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
29410
+ import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
29364
29411
  function parseReviewEntry(draftValue) {
29365
29412
  const parsed = JSON.parse(draftValue);
29366
29413
  const keys = Object.keys(parsed);
@@ -29392,9 +29439,9 @@ function useReviewEditor({
29392
29439
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
29393
29440
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
29394
29441
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
29395
- const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
29396
- const pendingGRef = useRef13(false);
29397
- useEffect16(() => {
29442
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29443
+ const pendingGRef = useRef14(false);
29444
+ useEffect17(() => {
29398
29445
  setTokenReviewRow(0);
29399
29446
  setTokenReviewEditing(false);
29400
29447
  setTokenReviewEditCursor(0);
@@ -29876,24 +29923,24 @@ var init_preview_annotations = __esm({
29876
29923
  });
29877
29924
 
29878
29925
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
29879
- import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
29926
+ import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
29880
29927
  function useLivePreview(opts) {
29881
29928
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
29882
29929
  const [status, setStatus] = useState24("idle");
29883
29930
  const [disabled, setDisabled] = useState24(false);
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(() => {
29931
+ const timerRef = useRef15(null);
29932
+ const generationRef = useRef15(0);
29933
+ const latestRef = useRef15(0);
29934
+ const inflightRef = useRef15(0);
29935
+ const optsRef = useRef15(opts);
29936
+ useEffect18(() => {
29890
29937
  optsRef.current = opts;
29891
29938
  });
29892
- const disabledRef = useRef14(disabled);
29893
- useEffect17(() => {
29939
+ const disabledRef = useRef15(disabled);
29940
+ useEffect18(() => {
29894
29941
  disabledRef.current = disabled;
29895
29942
  }, [disabled]);
29896
- useEffect17(() => {
29943
+ useEffect18(() => {
29897
29944
  return () => {
29898
29945
  if (timerRef.current) {
29899
29946
  clearTimeout(timerRef.current);
@@ -29974,7 +30021,7 @@ var init_use_live_preview = __esm({
29974
30021
  });
29975
30022
 
29976
30023
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
29977
- import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
30024
+ import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
29978
30025
  function useReviewPreview({
29979
30026
  components,
29980
30027
  loading,
@@ -30016,13 +30063,13 @@ function useReviewPreview({
30016
30063
  deleteAllComponents
30017
30064
  });
30018
30065
  const [spinnerTick, setSpinnerTick] = useState25(0);
30019
- useEffect18(() => {
30066
+ useEffect19(() => {
30020
30067
  if (livePreviewHook.status !== "running") return;
30021
30068
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
30022
30069
  return () => clearInterval(id);
30023
30070
  }, [livePreviewHook.status]);
30024
30071
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
30025
- useEffect18(() => {
30072
+ useEffect19(() => {
30026
30073
  if (loading) return;
30027
30074
  if (!livePreview) return;
30028
30075
  if (components.length === 0) return;
@@ -30079,7 +30126,7 @@ var init_LivePreviewSummary = __esm({
30079
30126
  });
30080
30127
 
30081
30128
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30082
- import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
30129
+ import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30083
30130
  import figures8 from "figures";
30084
30131
  import { Box as Box38, Text as Text40 } from "ink";
30085
30132
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30293,7 +30340,7 @@ function GenerateReviewStepView({
30293
30340
  setFinalizeError
30294
30341
  } = reviewSurface;
30295
30342
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
30296
- const removedBannerDefaultedRef = useRef15(false);
30343
+ const removedBannerDefaultedRef = useRef16(false);
30297
30344
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30298
30345
  const [cyclesCursor, setCyclesCursor] = useState26(0);
30299
30346
  const cyclePanel = useOverlayPanel({
@@ -30313,7 +30360,7 @@ function GenerateReviewStepView({
30313
30360
  const [breakCursor, setBreakCursor] = useState26(0);
30314
30361
  const [breakConfirm, setBreakConfirm] = useState26(false);
30315
30362
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
30316
- const seededGroupsRef = useRef15(false);
30363
+ const seededGroupsRef = useRef16(false);
30317
30364
  const {
30318
30365
  searchOpen,
30319
30366
  setSearchOpen,
@@ -30337,7 +30384,7 @@ function GenerateReviewStepView({
30337
30384
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30338
30385
  const [autoRejected, setAutoRejected] = useState26([]);
30339
30386
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
30340
- const autoRejectFiredRef = useRef15(false);
30387
+ const autoRejectFiredRef = useRef16(false);
30341
30388
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
30342
30389
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30343
30390
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -30400,7 +30447,7 @@ function GenerateReviewStepView({
30400
30447
  [components]
30401
30448
  );
30402
30449
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30403
- useEffect19(() => {
30450
+ useEffect20(() => {
30404
30451
  if (seededGroupsRef.current) return;
30405
30452
  if (closures.size === 0 && slotCycles.length === 0) return;
30406
30453
  seededGroupsRef.current = true;
@@ -30427,7 +30474,7 @@ function GenerateReviewStepView({
30427
30474
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30428
30475
  }));
30429
30476
  }, [slotCycles, cycleView]);
30430
- useEffect19(() => {
30477
+ useEffect20(() => {
30431
30478
  const decision = computeAutoRejectDecision({
30432
30479
  loading,
30433
30480
  autoRejectFired: autoRejectFiredRef.current,
@@ -30470,8 +30517,8 @@ function GenerateReviewStepView({
30470
30517
  }),
30471
30518
  applySnapshot: applyHistorySnapshot
30472
30519
  });
30473
- const autoRejectPushedRef = useRef15(false);
30474
- useEffect19(() => {
30520
+ const autoRejectPushedRef = useRef16(false);
30521
+ useEffect20(() => {
30475
30522
  if (loading) return;
30476
30523
  if (!historySeededRef.current) return;
30477
30524
  if (!autoRejectFiredRef.current) return;
@@ -30555,7 +30602,7 @@ function GenerateReviewStepView({
30555
30602
  const panelHeight = leftPanelHeight + 2;
30556
30603
  const panelContentHeight = Math.max(1, panelHeight - 3);
30557
30604
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30558
- useEffect19(() => {
30605
+ useEffect20(() => {
30559
30606
  if (selectableRowPositions.length === 0) return;
30560
30607
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30561
30608
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31637,10 +31684,10 @@ var init_path_utils = __esm({
31637
31684
  });
31638
31685
 
31639
31686
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
31640
- import { useEffect as useEffect20, useState as useState27 } from "react";
31687
+ import { useEffect as useEffect21, useState as useState27 } from "react";
31641
31688
  function useBlinkingCursor() {
31642
31689
  const [visible, setVisible] = useState27(true);
31643
- useEffect20(() => {
31690
+ useEffect21(() => {
31644
31691
  const interval = setInterval(() => setVisible((current) => !current), 500);
31645
31692
  return () => clearInterval(interval);
31646
31693
  }, []);
@@ -31777,12 +31824,12 @@ var init_produced = __esm({
31777
31824
  });
31778
31825
 
31779
31826
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
31780
- import { useEffect as useEffect21, useState as useState29 } from "react";
31827
+ import { useEffect as useEffect22, useState as useState29 } from "react";
31781
31828
  import { Spinner as Spinner2 } from "@inkjs/ui";
31782
31829
  import { jsx as jsx53 } from "react/jsx-runtime";
31783
31830
  function useTimedSpinner() {
31784
31831
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
31785
- useEffect21(() => {
31832
+ useEffect22(() => {
31786
31833
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
31787
31834
  return () => {
31788
31835
  clearInterval(timer);
@@ -32051,7 +32098,7 @@ var init_preview_confirmation_input = __esm({
32051
32098
  });
32052
32099
 
32053
32100
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32054
- import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
32101
+ import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
32055
32102
  import { Box as Box44, Text as Text46 } from "ink";
32056
32103
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32057
32104
  function buildPreviewSummaryLines(preview) {
@@ -32261,7 +32308,7 @@ function WizardPreviewStep({
32261
32308
  const activeLines = diffExpanded ? diffLines : summaryLines;
32262
32309
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32263
32310
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32264
- useEffect22(() => {
32311
+ useEffect23(() => {
32265
32312
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32266
32313
  }, [maxScroll]);
32267
32314
  useImmediateInput((input, key) => {
@@ -33309,9 +33356,9 @@ var init_controller = __esm({
33309
33356
  });
33310
33357
 
33311
33358
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33312
- import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
33359
+ import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
33313
33360
  function useFlow(start, options = {}) {
33314
- const controller = useRef16();
33361
+ const controller = useRef17();
33315
33362
  if (start && !controller.current) {
33316
33363
  try {
33317
33364
  startWizardLog();
@@ -33328,7 +33375,7 @@ function useFlow(start, options = {}) {
33328
33375
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33329
33376
  () => current?.getState()
33330
33377
  );
33331
- useEffect23(() => {
33378
+ useEffect24(() => {
33332
33379
  if (!start) controller.current = void 0;
33333
33380
  }, [start]);
33334
33381
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33407,7 +33454,7 @@ var init_help_info = __esm({
33407
33454
  });
33408
33455
 
33409
33456
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33410
- import { useEffect as useEffect24, useState as useState31 } from "react";
33457
+ import { useEffect as useEffect25, useState as useState31 } from "react";
33411
33458
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33412
33459
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33413
33460
  function Section({ title, rows }) {
@@ -33421,7 +33468,7 @@ function Section({ title, rows }) {
33421
33468
  }
33422
33469
  function HelpScreen({ onDone }) {
33423
33470
  const [info, setInfo] = useState31();
33424
- useEffect24(() => {
33471
+ useEffect25(() => {
33425
33472
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
33426
33473
  void readHelpInfo().then(setInfo);
33427
33474
  }, []);
@@ -33842,7 +33889,7 @@ var init_AgentStatusBadge = __esm({
33842
33889
  });
33843
33890
 
33844
33891
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
33845
- import { useEffect as useEffect25, useState as useState33 } from "react";
33892
+ import { useEffect as useEffect26, useState as useState33 } from "react";
33846
33893
  import { Box as Box48, Text as Text50 } from "ink";
33847
33894
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
33848
33895
  function StatusHeading() {
@@ -33863,7 +33910,7 @@ function AgentDetail({
33863
33910
  const [testing, setTesting] = useState33(false);
33864
33911
  const [notice, setNotice] = useState33(null);
33865
33912
  const [checks, setChecks] = useState33(void 0);
33866
- useEffect25(() => {
33913
+ useEffect26(() => {
33867
33914
  let active = true;
33868
33915
  setChecks(void 0);
33869
33916
  const timer = setTimeout(() => {
@@ -33955,7 +34002,7 @@ var init_AgentDetail = __esm({
33955
34002
  });
33956
34003
 
33957
34004
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
33958
- import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
34005
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
33959
34006
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
33960
34007
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
33961
34008
  function AgentsScreen({ onDone }) {
@@ -33966,7 +34013,7 @@ function AgentsScreen({ onDone }) {
33966
34013
  const [saving, setSaving] = useState34(false);
33967
34014
  const [loadError, setLoadError] = useState34(null);
33968
34015
  const [checks, setChecks] = useState34({});
33969
- const visit = useRef17({
34016
+ const visit = useRef18({
33970
34017
  trail: createTrail(),
33971
34018
  before: void 0,
33972
34019
  environment: void 0,
@@ -33979,7 +34026,7 @@ function AgentsScreen({ onDone }) {
33979
34026
  );
33980
34027
  }
33981
34028
  };
33982
- useEffect26(() => {
34029
+ useEffect27(() => {
33983
34030
  readAgentConfig().then((loaded) => {
33984
34031
  setConfig(loaded);
33985
34032
  inspectAll(loaded);
@@ -34205,7 +34252,7 @@ var init_project_store = __esm({
34205
34252
  });
34206
34253
 
34207
34254
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34208
- import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
34255
+ import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
34209
34256
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34210
34257
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34211
34258
  function debugFields(config) {
@@ -34224,14 +34271,14 @@ function ProjectScreen({ onDone }) {
34224
34271
  const [saving, setSaving] = useState35(false);
34225
34272
  const [notice, setNotice] = useState35(null);
34226
34273
  const [loadError, setLoadError] = useState35(null);
34227
- const visit = useRef18({
34274
+ const visit = useRef19({
34228
34275
  trail: createTrail(),
34229
34276
  before: void 0,
34230
34277
  persisted: void 0,
34231
34278
  error: ""
34232
34279
  }).current;
34233
34280
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34234
- useEffect27(() => {
34281
+ useEffect28(() => {
34235
34282
  readCredentials().then((cfg) => {
34236
34283
  setConfig(cfg);
34237
34284
  visit.before = snapshotOf(cfg);
@@ -34418,13 +34465,13 @@ var init_ConfigurationScreen = __esm({
34418
34465
  });
34419
34466
 
34420
34467
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34421
- import { useEffect as useEffect28, useState as useState37 } from "react";
34468
+ import { useEffect as useEffect29, useState as useState37 } from "react";
34422
34469
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34423
34470
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34424
34471
  function OptInAnalyticsScreen({ onDone }) {
34425
34472
  const [loading, setLoading] = useState37(true);
34426
34473
  const [enabled, setEnabled] = useState37(true);
34427
- useEffect28(() => {
34474
+ useEffect29(() => {
34428
34475
  readAnalyticsSetting().then((setting) => {
34429
34476
  setEnabled(setting.enabled);
34430
34477
  setLoading(false);
@@ -34487,7 +34534,7 @@ var init_screen12 = __esm({
34487
34534
  });
34488
34535
 
34489
34536
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34490
- import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
34537
+ import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
34491
34538
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
34492
34539
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
34493
34540
  function DebugModeScreen({ onDone }) {
@@ -34497,8 +34544,8 @@ function DebugModeScreen({ onDone }) {
34497
34544
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
34498
34545
  );
34499
34546
  const [notice, setNotice] = useState38(null);
34500
- const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
34501
- useEffect29(() => {
34547
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
34548
+ useEffect30(() => {
34502
34549
  readDebugModeSetting().then((loaded) => {
34503
34550
  setSetting(loaded);
34504
34551
  setPending(loaded.retentionDays);
@@ -34639,7 +34686,7 @@ var app_exports = {};
34639
34686
  __export(app_exports, {
34640
34687
  runApp: () => runApp
34641
34688
  });
34642
- import { useEffect as useEffect30, useState as useState39 } from "react";
34689
+ import { useEffect as useEffect31, useState as useState39 } from "react";
34643
34690
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
34644
34691
  function App({ importOptions, inkClear }) {
34645
34692
  const [screen, setScreen] = useState39("start");
@@ -34673,7 +34720,7 @@ function App({ importOptions, inkClear }) {
34673
34720
  const [flowStart, setFlowStart] = useState39();
34674
34721
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34675
34722
  const [importDefaults, setImportDefaults] = useState39();
34676
- useEffect30(() => {
34723
+ useEffect31(() => {
34677
34724
  if (screen !== "import") {
34678
34725
  setImportDefaults(void 0);
34679
34726
  return;
@@ -34746,7 +34793,7 @@ function App({ importOptions, inkClear }) {
34746
34793
  }
34747
34794
  });
34748
34795
  };
34749
- useEffect30(() => {
34796
+ useEffect31(() => {
34750
34797
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
34751
34798
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
34752
34799
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -34768,12 +34815,12 @@ function App({ importOptions, inkClear }) {
34768
34815
  }
34769
34816
  });
34770
34817
  }, [tokensOnly, tokensOnlyRun]);
34771
- useEffect30(() => {
34818
+ useEffect31(() => {
34772
34819
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34773
34820
  setExtractionRun(void 0);
34774
34821
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34775
34822
  }, [extraction, extractionRun]);
34776
- useEffect30(() => {
34823
+ useEffect31(() => {
34777
34824
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34778
34825
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34779
34826
  setGenerationInput({
@@ -34791,7 +34838,7 @@ function App({ importOptions, inkClear }) {
34791
34838
  ...generatePromptPath ? { generatePromptPath } : {}
34792
34839
  });
34793
34840
  }, [scopeFlow, scopeRun, generationInput]);
34794
- useEffect30(() => {
34841
+ useEffect31(() => {
34795
34842
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34796
34843
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
34797
34844
  inkClear();
@@ -34884,6 +34931,7 @@ function App({ importOptions, inkClear }) {
34884
34931
  return /* @__PURE__ */ jsx66(
34885
34932
  TokenInputScreen,
34886
34933
  {
34934
+ mode: target,
34887
34935
  initialPath: importDefaults.tokenFile,
34888
34936
  onConfirm: (tokensPath) => answer({ tokensPath }),
34889
34937
  onBack: () => goBackFrom("token-file")