@contentful/experience-design-system-cli 2.40.1-dev-build-08f065f9.0 → 2.40.1-dev-build-b9f92429.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
 
@@ -20715,7 +20762,7 @@ var init_scan_files = __esm({
20715
20762
  });
20716
20763
 
20717
20764
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
20718
- import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
20765
+ import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
20719
20766
  import { Box as Box12, Text as Text12 } from "ink";
20720
20767
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
20721
20768
  function Row({ row }) {
@@ -20771,7 +20818,7 @@ function PathValidationScreen({
20771
20818
  }) {
20772
20819
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20773
20820
  const [scan, setScan] = useState7();
20774
- useEffect6(() => {
20821
+ useEffect7(() => {
20775
20822
  setScan(scanFiles(resolvedPath));
20776
20823
  }, [resolvedPath]);
20777
20824
  const phase = phaseOf(scan);
@@ -21068,7 +21115,7 @@ var init_validate4 = __esm({
21068
21115
  });
21069
21116
 
21070
21117
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21071
- import { useRef as useRef4, useState as useState9 } from "react";
21118
+ import { useRef as useRef5, useState as useState9 } from "react";
21072
21119
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21073
21120
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21074
21121
  function CredentialsScreen({
@@ -21078,7 +21125,7 @@ function CredentialsScreen({
21078
21125
  validate: validate3 = validateCredentials,
21079
21126
  tokensOnly = false
21080
21127
  }) {
21081
- const initialValues = useRef4(
21128
+ const initialValues = useRef5(
21082
21129
  normalize({
21083
21130
  spaceId: initial.spaceId ?? "",
21084
21131
  environmentId: initial.environmentId || "master",
@@ -21798,11 +21845,11 @@ var init_run = __esm({
21798
21845
  });
21799
21846
 
21800
21847
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21801
- import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
21848
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
21802
21849
  function useExtraction(input) {
21803
21850
  const [state2, setState] = useState11();
21804
- const current = useRef5();
21805
- useEffect7(() => {
21851
+ const current = useRef6();
21852
+ useEffect8(() => {
21806
21853
  current.current = input;
21807
21854
  if (!input) {
21808
21855
  setState(void 0);
@@ -21873,11 +21920,11 @@ var init_run_tokens_only = __esm({
21873
21920
  });
21874
21921
 
21875
21922
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
21876
- import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
21923
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
21877
21924
  function useTokensOnly(input) {
21878
21925
  const [state2, setState] = useState12();
21879
- const current = useRef6();
21880
- useEffect8(() => {
21926
+ const current = useRef7();
21927
+ useEffect9(() => {
21881
21928
  current.current = input;
21882
21929
  if (!input) {
21883
21930
  setState(void 0);
@@ -23074,7 +23121,7 @@ var init_GroupedSidebar = __esm({
23074
23121
  });
23075
23122
 
23076
23123
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
23077
- import { useLayoutEffect, useRef as useRef7 } from "react";
23124
+ import { useLayoutEffect, useRef as useRef8 } from "react";
23078
23125
  import { useStdin } from "ink";
23079
23126
  function parseInput(data) {
23080
23127
  const isShiftTab = data === "\x1B[Z";
@@ -23136,7 +23183,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
23136
23183
  }
23137
23184
  function useImmediateInput(handler, enabled = true) {
23138
23185
  const { stdin, setRawMode } = useStdin();
23139
- const handlerRef = useRef7(handler);
23186
+ const handlerRef = useRef8(handler);
23140
23187
  handlerRef.current = handler;
23141
23188
  useLayoutEffect(() => {
23142
23189
  if (!enabled) return;
@@ -23154,7 +23201,7 @@ var init_useImmediateInput = __esm({
23154
23201
 
23155
23202
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23156
23203
  import { useStdout as useStdout2 } from "ink";
23157
- import { useEffect as useEffect9, useState as useState13 } from "react";
23204
+ import { useEffect as useEffect10, useState as useState13 } from "react";
23158
23205
  function readTerminalSize(stdout) {
23159
23206
  return {
23160
23207
  columns: stdout?.columns ?? 80,
@@ -23164,7 +23211,7 @@ function readTerminalSize(stdout) {
23164
23211
  function useTerminalSize() {
23165
23212
  const { stdout } = useStdout2();
23166
23213
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
23167
- useEffect9(() => {
23214
+ useEffect10(() => {
23168
23215
  const updateSize = () => setSize(readTerminalSize(stdout));
23169
23216
  stdout?.on("resize", updateSize);
23170
23217
  updateSize();
@@ -24166,7 +24213,7 @@ var init_state = __esm({
24166
24213
  });
24167
24214
 
24168
24215
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24169
- import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
24216
+ import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24170
24217
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24171
24218
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24172
24219
  const columnPlan = useMemo3(
@@ -24212,8 +24259,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24212
24259
  for (const p of cycleParticipants) seed.add(p);
24213
24260
  return seed;
24214
24261
  });
24215
- const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
24216
- useEffect10(() => {
24262
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24263
+ useEffect11(() => {
24217
24264
  if (seededGroupsRef.current) return;
24218
24265
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24219
24266
  seededGroupsRef.current = true;
@@ -24304,7 +24351,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24304
24351
  entryCount: 0
24305
24352
  });
24306
24353
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24307
- useEffect10(() => {
24354
+ useEffect11(() => {
24308
24355
  setNav((prev) => {
24309
24356
  const maxIdx = Math.max(0, visibleRows.length - 1);
24310
24357
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24877,13 +24924,13 @@ var init_load2 = __esm({
24877
24924
  });
24878
24925
 
24879
24926
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24880
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
24927
+ import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
24881
24928
  function useScopeGateFlow(input, deps = realDeps3) {
24882
24929
  const sessionId = input?.sessionId;
24883
24930
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24884
- const cacheCheck = useRef9(void 0);
24931
+ const cacheCheck = useRef10(void 0);
24885
24932
  const [confirmed, setConfirmed] = useState17();
24886
- useEffect11(() => {
24933
+ useEffect12(() => {
24887
24934
  if (!input || !loaded?.ok || cacheCheck.current) return;
24888
24935
  cacheCheck.current = deps.checkCache(input.cache);
24889
24936
  }, [input, loaded]);
@@ -25154,11 +25201,11 @@ var init_run2 = __esm({
25154
25201
  });
25155
25202
 
25156
25203
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25157
- import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
25204
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
25158
25205
  function useGeneration(input) {
25159
25206
  const [state2, setState] = useState18();
25160
- const current = useRef10();
25161
- useEffect12(() => {
25207
+ const current = useRef11();
25208
+ useEffect13(() => {
25162
25209
  current.current = input;
25163
25210
  if (!input) {
25164
25211
  setState(void 0);
@@ -26145,7 +26192,7 @@ var init_scroll_offset = __esm({
26145
26192
  });
26146
26193
 
26147
26194
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26148
- import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26195
+ import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26149
26196
  import figures6 from "figures";
26150
26197
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26151
26198
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27672,7 +27719,7 @@ function FieldEditor({
27672
27719
  }
27673
27720
  return Math.max(start + 1, end2);
27674
27721
  };
27675
- useEffect13(() => {
27722
+ useEffect14(() => {
27676
27723
  if (focusLevel === "field" || selectedRowIdx < 0) return;
27677
27724
  setListScrollStart((previous) => {
27678
27725
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29067,7 +29114,7 @@ var init_FinalizeDialog = __esm({
29067
29114
  });
29068
29115
 
29069
29116
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29070
- import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
29117
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
29071
29118
  function useReviewFinalizePreview({
29072
29119
  components,
29073
29120
  ...options
@@ -29082,9 +29129,9 @@ function useFinalizePreview(opts) {
29082
29129
  const [status, setStatus] = useState20("idle");
29083
29130
  const [removed, setRemoved] = useState20([]);
29084
29131
  const [scrollOffset, setScrollOffset] = useState20(0);
29085
- const generationRef = useRef11(0);
29132
+ const generationRef = useRef12(0);
29086
29133
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29087
- useEffect14(() => {
29134
+ useEffect15(() => {
29088
29135
  if (!open) {
29089
29136
  setStatus("idle");
29090
29137
  setRemoved([]);
@@ -29136,7 +29183,7 @@ var init_use_finalize_preview = __esm({
29136
29183
  });
29137
29184
 
29138
29185
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29139
- import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
29186
+ import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
29140
29187
  function useReviewSession({
29141
29188
  loadSession,
29142
29189
  tokensPath,
@@ -29155,7 +29202,7 @@ function useReviewSession({
29155
29202
  }));
29156
29203
  return { result, catalog };
29157
29204
  }, [loadSession, tokensPath]);
29158
- useEffect15(() => {
29205
+ useEffect16(() => {
29159
29206
  let disposed = false;
29160
29207
  void (async () => {
29161
29208
  try {
@@ -29208,7 +29255,7 @@ function useReviewSession({
29208
29255
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29209
29256
  const [reviewMetadata, setReviewMetadata] = useState21(null);
29210
29257
  const [componentRationale, setComponentRationale] = useState21(null);
29211
- useEffect15(() => {
29258
+ useEffect16(() => {
29212
29259
  const current = components[selectedIdx];
29213
29260
  if (!current) {
29214
29261
  setReviewMetadata(null);
@@ -29238,9 +29285,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29238
29285
  return { reviewMetadata, componentRationale };
29239
29286
  }
29240
29287
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29241
- const historyRef = useRef12(null);
29242
- const historySeededRef = useRef12(false);
29243
- useEffect15(() => {
29288
+ const historyRef = useRef13(null);
29289
+ const historySeededRef = useRef13(false);
29290
+ useEffect16(() => {
29244
29291
  if (loading || historySeededRef.current) return;
29245
29292
  historySeededRef.current = true;
29246
29293
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29322,7 +29369,7 @@ var init_token_suggestions = __esm({
29322
29369
  });
29323
29370
 
29324
29371
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29325
- import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
29372
+ import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
29326
29373
  function parseReviewEntry(draftValue) {
29327
29374
  const parsed = JSON.parse(draftValue);
29328
29375
  const keys = Object.keys(parsed);
@@ -29354,9 +29401,9 @@ function useReviewEditor({
29354
29401
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
29355
29402
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
29356
29403
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
29357
- const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
29358
- const pendingGRef = useRef13(false);
29359
- useEffect16(() => {
29404
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29405
+ const pendingGRef = useRef14(false);
29406
+ useEffect17(() => {
29360
29407
  setTokenReviewRow(0);
29361
29408
  setTokenReviewEditing(false);
29362
29409
  setTokenReviewEditCursor(0);
@@ -29838,24 +29885,24 @@ var init_preview_annotations = __esm({
29838
29885
  });
29839
29886
 
29840
29887
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
29841
- import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
29888
+ import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
29842
29889
  function useLivePreview(opts) {
29843
29890
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
29844
29891
  const [status, setStatus] = useState24("idle");
29845
29892
  const [disabled, setDisabled] = useState24(false);
29846
- const timerRef = useRef14(null);
29847
- const generationRef = useRef14(0);
29848
- const latestRef = useRef14(0);
29849
- const inflightRef = useRef14(0);
29850
- const optsRef = useRef14(opts);
29851
- useEffect17(() => {
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(() => {
29852
29899
  optsRef.current = opts;
29853
29900
  });
29854
- const disabledRef = useRef14(disabled);
29855
- useEffect17(() => {
29901
+ const disabledRef = useRef15(disabled);
29902
+ useEffect18(() => {
29856
29903
  disabledRef.current = disabled;
29857
29904
  }, [disabled]);
29858
- useEffect17(() => {
29905
+ useEffect18(() => {
29859
29906
  return () => {
29860
29907
  if (timerRef.current) {
29861
29908
  clearTimeout(timerRef.current);
@@ -29936,7 +29983,7 @@ var init_use_live_preview = __esm({
29936
29983
  });
29937
29984
 
29938
29985
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
29939
- import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
29986
+ import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
29940
29987
  function useReviewPreview({
29941
29988
  components,
29942
29989
  loading,
@@ -29978,13 +30025,13 @@ function useReviewPreview({
29978
30025
  deleteAllComponents
29979
30026
  });
29980
30027
  const [spinnerTick, setSpinnerTick] = useState25(0);
29981
- useEffect18(() => {
30028
+ useEffect19(() => {
29982
30029
  if (livePreviewHook.status !== "running") return;
29983
30030
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
29984
30031
  return () => clearInterval(id);
29985
30032
  }, [livePreviewHook.status]);
29986
30033
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
29987
- useEffect18(() => {
30034
+ useEffect19(() => {
29988
30035
  if (loading) return;
29989
30036
  if (!livePreview) return;
29990
30037
  if (components.length === 0) return;
@@ -30041,7 +30088,7 @@ var init_LivePreviewSummary = __esm({
30041
30088
  });
30042
30089
 
30043
30090
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30044
- import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
30091
+ import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30045
30092
  import figures8 from "figures";
30046
30093
  import { Box as Box38, Text as Text40 } from "ink";
30047
30094
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30255,7 +30302,7 @@ function GenerateReviewStepView({
30255
30302
  setFinalizeError
30256
30303
  } = reviewSurface;
30257
30304
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
30258
- const removedBannerDefaultedRef = useRef15(false);
30305
+ const removedBannerDefaultedRef = useRef16(false);
30259
30306
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30260
30307
  const [cyclesCursor, setCyclesCursor] = useState26(0);
30261
30308
  const cyclePanel = useOverlayPanel({
@@ -30275,7 +30322,7 @@ function GenerateReviewStepView({
30275
30322
  const [breakCursor, setBreakCursor] = useState26(0);
30276
30323
  const [breakConfirm, setBreakConfirm] = useState26(false);
30277
30324
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
30278
- const seededGroupsRef = useRef15(false);
30325
+ const seededGroupsRef = useRef16(false);
30279
30326
  const {
30280
30327
  searchOpen,
30281
30328
  setSearchOpen,
@@ -30299,7 +30346,7 @@ function GenerateReviewStepView({
30299
30346
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30300
30347
  const [autoRejected, setAutoRejected] = useState26([]);
30301
30348
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
30302
- const autoRejectFiredRef = useRef15(false);
30349
+ const autoRejectFiredRef = useRef16(false);
30303
30350
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
30304
30351
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30305
30352
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -30362,7 +30409,7 @@ function GenerateReviewStepView({
30362
30409
  [components]
30363
30410
  );
30364
30411
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30365
- useEffect19(() => {
30412
+ useEffect20(() => {
30366
30413
  if (seededGroupsRef.current) return;
30367
30414
  if (closures.size === 0 && slotCycles.length === 0) return;
30368
30415
  seededGroupsRef.current = true;
@@ -30389,7 +30436,7 @@ function GenerateReviewStepView({
30389
30436
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30390
30437
  }));
30391
30438
  }, [slotCycles, cycleView]);
30392
- useEffect19(() => {
30439
+ useEffect20(() => {
30393
30440
  const decision = computeAutoRejectDecision({
30394
30441
  loading,
30395
30442
  autoRejectFired: autoRejectFiredRef.current,
@@ -30432,8 +30479,8 @@ function GenerateReviewStepView({
30432
30479
  }),
30433
30480
  applySnapshot: applyHistorySnapshot
30434
30481
  });
30435
- const autoRejectPushedRef = useRef15(false);
30436
- useEffect19(() => {
30482
+ const autoRejectPushedRef = useRef16(false);
30483
+ useEffect20(() => {
30437
30484
  if (loading) return;
30438
30485
  if (!historySeededRef.current) return;
30439
30486
  if (!autoRejectFiredRef.current) return;
@@ -30517,7 +30564,7 @@ function GenerateReviewStepView({
30517
30564
  const panelHeight = leftPanelHeight + 2;
30518
30565
  const panelContentHeight = Math.max(1, panelHeight - 3);
30519
30566
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30520
- useEffect19(() => {
30567
+ useEffect20(() => {
30521
30568
  if (selectableRowPositions.length === 0) return;
30522
30569
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30523
30570
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31599,10 +31646,10 @@ var init_path_utils = __esm({
31599
31646
  });
31600
31647
 
31601
31648
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
31602
- import { useEffect as useEffect20, useState as useState27 } from "react";
31649
+ import { useEffect as useEffect21, useState as useState27 } from "react";
31603
31650
  function useBlinkingCursor() {
31604
31651
  const [visible, setVisible] = useState27(true);
31605
- useEffect20(() => {
31652
+ useEffect21(() => {
31606
31653
  const interval = setInterval(() => setVisible((current) => !current), 500);
31607
31654
  return () => clearInterval(interval);
31608
31655
  }, []);
@@ -31739,12 +31786,12 @@ var init_produced = __esm({
31739
31786
  });
31740
31787
 
31741
31788
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
31742
- import { useEffect as useEffect21, useState as useState29 } from "react";
31789
+ import { useEffect as useEffect22, useState as useState29 } from "react";
31743
31790
  import { Spinner as Spinner2 } from "@inkjs/ui";
31744
31791
  import { jsx as jsx53 } from "react/jsx-runtime";
31745
31792
  function useTimedSpinner() {
31746
31793
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
31747
- useEffect21(() => {
31794
+ useEffect22(() => {
31748
31795
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
31749
31796
  return () => {
31750
31797
  clearInterval(timer);
@@ -32013,7 +32060,7 @@ var init_preview_confirmation_input = __esm({
32013
32060
  });
32014
32061
 
32015
32062
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32016
- import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
32063
+ import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
32017
32064
  import { Box as Box44, Text as Text46 } from "ink";
32018
32065
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32019
32066
  function buildPreviewSummaryLines(preview) {
@@ -32223,7 +32270,7 @@ function WizardPreviewStep({
32223
32270
  const activeLines = diffExpanded ? diffLines : summaryLines;
32224
32271
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32225
32272
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32226
- useEffect22(() => {
32273
+ useEffect23(() => {
32227
32274
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32228
32275
  }, [maxScroll]);
32229
32276
  useImmediateInput((input, key) => {
@@ -33271,9 +33318,9 @@ var init_controller = __esm({
33271
33318
  });
33272
33319
 
33273
33320
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33274
- import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
33321
+ import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
33275
33322
  function useFlow(start, options = {}) {
33276
- const controller = useRef16();
33323
+ const controller = useRef17();
33277
33324
  if (start && !controller.current) {
33278
33325
  try {
33279
33326
  startWizardLog();
@@ -33290,7 +33337,7 @@ function useFlow(start, options = {}) {
33290
33337
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33291
33338
  () => current?.getState()
33292
33339
  );
33293
- useEffect23(() => {
33340
+ useEffect24(() => {
33294
33341
  if (!start) controller.current = void 0;
33295
33342
  }, [start]);
33296
33343
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33369,7 +33416,7 @@ var init_help_info = __esm({
33369
33416
  });
33370
33417
 
33371
33418
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33372
- import { useEffect as useEffect24, useState as useState31 } from "react";
33419
+ import { useEffect as useEffect25, useState as useState31 } from "react";
33373
33420
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33374
33421
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33375
33422
  function Section({ title, rows }) {
@@ -33383,7 +33430,7 @@ function Section({ title, rows }) {
33383
33430
  }
33384
33431
  function HelpScreen({ onDone }) {
33385
33432
  const [info, setInfo] = useState31();
33386
- useEffect24(() => {
33433
+ useEffect25(() => {
33387
33434
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
33388
33435
  void readHelpInfo().then(setInfo);
33389
33436
  }, []);
@@ -33804,7 +33851,7 @@ var init_AgentStatusBadge = __esm({
33804
33851
  });
33805
33852
 
33806
33853
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
33807
- import { useEffect as useEffect25, useState as useState33 } from "react";
33854
+ import { useEffect as useEffect26, useState as useState33 } from "react";
33808
33855
  import { Box as Box48, Text as Text50 } from "ink";
33809
33856
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
33810
33857
  function StatusHeading() {
@@ -33825,7 +33872,7 @@ function AgentDetail({
33825
33872
  const [testing, setTesting] = useState33(false);
33826
33873
  const [notice, setNotice] = useState33(null);
33827
33874
  const [checks, setChecks] = useState33(void 0);
33828
- useEffect25(() => {
33875
+ useEffect26(() => {
33829
33876
  let active = true;
33830
33877
  setChecks(void 0);
33831
33878
  const timer = setTimeout(() => {
@@ -33917,7 +33964,7 @@ var init_AgentDetail = __esm({
33917
33964
  });
33918
33965
 
33919
33966
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
33920
- import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
33967
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
33921
33968
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
33922
33969
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
33923
33970
  function AgentsScreen({ onDone }) {
@@ -33928,7 +33975,7 @@ function AgentsScreen({ onDone }) {
33928
33975
  const [saving, setSaving] = useState34(false);
33929
33976
  const [loadError, setLoadError] = useState34(null);
33930
33977
  const [checks, setChecks] = useState34({});
33931
- const visit = useRef17({
33978
+ const visit = useRef18({
33932
33979
  trail: createTrail(),
33933
33980
  before: void 0,
33934
33981
  environment: void 0,
@@ -33941,7 +33988,7 @@ function AgentsScreen({ onDone }) {
33941
33988
  );
33942
33989
  }
33943
33990
  };
33944
- useEffect26(() => {
33991
+ useEffect27(() => {
33945
33992
  readAgentConfig().then((loaded) => {
33946
33993
  setConfig(loaded);
33947
33994
  inspectAll(loaded);
@@ -34167,7 +34214,7 @@ var init_project_store = __esm({
34167
34214
  });
34168
34215
 
34169
34216
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34170
- import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
34217
+ import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
34171
34218
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34172
34219
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34173
34220
  function debugFields(config) {
@@ -34186,14 +34233,14 @@ function ProjectScreen({ onDone }) {
34186
34233
  const [saving, setSaving] = useState35(false);
34187
34234
  const [notice, setNotice] = useState35(null);
34188
34235
  const [loadError, setLoadError] = useState35(null);
34189
- const visit = useRef18({
34236
+ const visit = useRef19({
34190
34237
  trail: createTrail(),
34191
34238
  before: void 0,
34192
34239
  persisted: void 0,
34193
34240
  error: ""
34194
34241
  }).current;
34195
34242
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34196
- useEffect27(() => {
34243
+ useEffect28(() => {
34197
34244
  readCredentials().then((cfg) => {
34198
34245
  setConfig(cfg);
34199
34246
  visit.before = snapshotOf(cfg);
@@ -34380,13 +34427,13 @@ var init_ConfigurationScreen = __esm({
34380
34427
  });
34381
34428
 
34382
34429
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34383
- import { useEffect as useEffect28, useState as useState37 } from "react";
34430
+ import { useEffect as useEffect29, useState as useState37 } from "react";
34384
34431
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34385
34432
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34386
34433
  function OptInAnalyticsScreen({ onDone }) {
34387
34434
  const [loading, setLoading] = useState37(true);
34388
34435
  const [enabled, setEnabled] = useState37(true);
34389
- useEffect28(() => {
34436
+ useEffect29(() => {
34390
34437
  readAnalyticsSetting().then((setting) => {
34391
34438
  setEnabled(setting.enabled);
34392
34439
  setLoading(false);
@@ -34449,7 +34496,7 @@ var init_screen12 = __esm({
34449
34496
  });
34450
34497
 
34451
34498
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34452
- import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
34499
+ import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
34453
34500
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
34454
34501
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
34455
34502
  function DebugModeScreen({ onDone }) {
@@ -34459,8 +34506,8 @@ function DebugModeScreen({ onDone }) {
34459
34506
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
34460
34507
  );
34461
34508
  const [notice, setNotice] = useState38(null);
34462
- const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
34463
- useEffect29(() => {
34509
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
34510
+ useEffect30(() => {
34464
34511
  readDebugModeSetting().then((loaded) => {
34465
34512
  setSetting(loaded);
34466
34513
  setPending(loaded.retentionDays);
@@ -34601,7 +34648,7 @@ var app_exports = {};
34601
34648
  __export(app_exports, {
34602
34649
  runApp: () => runApp
34603
34650
  });
34604
- import { useEffect as useEffect30, useState as useState39 } from "react";
34651
+ import { useEffect as useEffect31, useState as useState39 } from "react";
34605
34652
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
34606
34653
  function App({ importOptions, inkClear }) {
34607
34654
  const [screen, setScreen] = useState39("start");
@@ -34635,7 +34682,7 @@ function App({ importOptions, inkClear }) {
34635
34682
  const [flowStart, setFlowStart] = useState39();
34636
34683
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34637
34684
  const [importDefaults, setImportDefaults] = useState39();
34638
- useEffect30(() => {
34685
+ useEffect31(() => {
34639
34686
  if (screen !== "import") {
34640
34687
  setImportDefaults(void 0);
34641
34688
  return;
@@ -34708,7 +34755,7 @@ function App({ importOptions, inkClear }) {
34708
34755
  }
34709
34756
  });
34710
34757
  };
34711
- useEffect30(() => {
34758
+ useEffect31(() => {
34712
34759
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
34713
34760
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
34714
34761
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -34730,12 +34777,12 @@ function App({ importOptions, inkClear }) {
34730
34777
  }
34731
34778
  });
34732
34779
  }, [tokensOnly, tokensOnlyRun]);
34733
- useEffect30(() => {
34780
+ useEffect31(() => {
34734
34781
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34735
34782
  setExtractionRun(void 0);
34736
34783
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34737
34784
  }, [extraction, extractionRun]);
34738
- useEffect30(() => {
34785
+ useEffect31(() => {
34739
34786
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34740
34787
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34741
34788
  setGenerationInput({
@@ -34753,7 +34800,7 @@ function App({ importOptions, inkClear }) {
34753
34800
  ...generatePromptPath ? { generatePromptPath } : {}
34754
34801
  });
34755
34802
  }, [scopeFlow, scopeRun, generationInput]);
34756
- useEffect30(() => {
34803
+ useEffect31(() => {
34757
34804
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34758
34805
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
34759
34806
  inkClear();
@@ -34846,6 +34893,7 @@ function App({ importOptions, inkClear }) {
34846
34893
  return /* @__PURE__ */ jsx66(
34847
34894
  TokenInputScreen,
34848
34895
  {
34896
+ mode: target,
34849
34897
  initialPath: importDefaults.tokenFile,
34850
34898
  onConfirm: (tokensPath) => answer({ tokensPath }),
34851
34899
  onBack: () => goBackFrom("token-file")