@contentful/experience-design-system-cli 2.40.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
@@ -20366,15 +20366,49 @@ var init_controls4 = __esm({
20366
20366
  });
20367
20367
 
20368
20368
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
20369
- import { useState as useState5 } from "react";
20369
+ import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
20370
20370
  import { Box as Box10, Text as Text10 } from "ink";
20371
20371
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
20372
- function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
20372
+ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
20373
20373
  const [projectPath, setProjectPath] = useState5(initialPath);
20374
- useWelcomeControls(onQuit);
20374
+ const visit = useRef3({ emptySubmits: 0 }).current;
20375
+ useEffect5(() => {
20376
+ startDebugRun({
20377
+ flow: "import/welcome",
20378
+ step: "01-welcome",
20379
+ menuOption: "Welcome",
20380
+ inputs: { import_mode: mode, initial_path: initialPath }
20381
+ });
20382
+ }, []);
20383
+ const quit = () => {
20384
+ void finishDebugRun({
20385
+ outputs: {
20386
+ project_path: null,
20387
+ typed_something: toProjectPath(projectPath) !== null,
20388
+ empty_submits: visit.emptySubmits
20389
+ },
20390
+ status: "success",
20391
+ exitMethod: "discarded"
20392
+ });
20393
+ onQuit();
20394
+ };
20395
+ useWelcomeControls(quit);
20375
20396
  const submit = (value) => {
20376
20397
  const path5 = toProjectPath(value);
20377
- if (path5) onContinue(path5);
20398
+ if (!path5) {
20399
+ visit.emptySubmits += 1;
20400
+ return;
20401
+ }
20402
+ void finishDebugRun({
20403
+ outputs: {
20404
+ project_path: path5,
20405
+ changed_from_initial: path5 !== initialPath.trim(),
20406
+ empty_submits: visit.emptySubmits
20407
+ },
20408
+ status: "success",
20409
+ exitMethod: "saved"
20410
+ });
20411
+ onContinue(path5);
20378
20412
  };
20379
20413
  return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
20380
20414
  /* @__PURE__ */ jsx11(StepHeader, { step: "setup" }),
@@ -20395,6 +20429,7 @@ var init_screen2 = __esm({
20395
20429
  "packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx"() {
20396
20430
  "use strict";
20397
20431
  init_theme();
20432
+ init_debug_store();
20398
20433
  init_ClearableTextInput();
20399
20434
  init_controls4();
20400
20435
  init_logic5();
@@ -20486,26 +20521,70 @@ var init_validate_path = __esm({
20486
20521
  });
20487
20522
 
20488
20523
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
20489
- import { useState as useState6 } from "react";
20524
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
20490
20525
  import { Box as Box11, Text as Text11 } from "ink";
20491
20526
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
20492
- function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
20527
+ function TokenInputScreen({
20528
+ mode,
20529
+ onConfirm,
20530
+ onBack,
20531
+ initialPath = ""
20532
+ }) {
20493
20533
  const [tokenPath, setTokenPath] = useState6(initialPath);
20494
20534
  const [failure, setFailure] = useState6(null);
20495
- 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);
20496
20553
  const change = (value) => {
20497
20554
  setTokenPath(value);
20498
20555
  setFailure(null);
20499
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
+ };
20500
20567
  const submit = (value) => {
20501
20568
  const rawPath = toTokenPath(value);
20502
20569
  if (!rawPath) {
20503
- setFailure({ error: "Enter the path to your token file." });
20570
+ reject("", { error: "Enter the path to your token file." });
20504
20571
  return;
20505
20572
  }
20506
20573
  const check = validateTokenPath(rawPath);
20507
- if (check.ok) onConfirm(check.path);
20508
- 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);
20509
20588
  };
20510
20589
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
20511
20590
  /* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
@@ -20533,16 +20612,19 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
20533
20612
  ] })
20534
20613
  ] });
20535
20614
  }
20615
+ var MAX_LOGGED_ATTEMPTS;
20536
20616
  var init_screen3 = __esm({
20537
20617
  "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
20538
20618
  "use strict";
20539
20619
  init_theme();
20620
+ init_debug_store();
20540
20621
  init_ClearableTextInput();
20541
20622
  init_controls5();
20542
20623
  init_logic6();
20543
20624
  init_validate_path();
20544
20625
  init_ControlHints();
20545
20626
  init_StepHeader();
20627
+ MAX_LOGGED_ATTEMPTS = 10;
20546
20628
  }
20547
20629
  });
20548
20630
 
@@ -20680,7 +20762,7 @@ var init_scan_files = __esm({
20680
20762
  });
20681
20763
 
20682
20764
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
20683
- import { useEffect as useEffect5, useMemo, useState as useState7 } from "react";
20765
+ import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
20684
20766
  import { Box as Box12, Text as Text12 } from "ink";
20685
20767
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
20686
20768
  function Row({ row }) {
@@ -20736,7 +20818,7 @@ function PathValidationScreen({
20736
20818
  }) {
20737
20819
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20738
20820
  const [scan, setScan] = useState7();
20739
- useEffect5(() => {
20821
+ useEffect7(() => {
20740
20822
  setScan(scanFiles(resolvedPath));
20741
20823
  }, [resolvedPath]);
20742
20824
  const phase = phaseOf(scan);
@@ -21033,7 +21115,7 @@ var init_validate4 = __esm({
21033
21115
  });
21034
21116
 
21035
21117
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21036
- import { useRef as useRef3, useState as useState9 } from "react";
21118
+ import { useRef as useRef5, useState as useState9 } from "react";
21037
21119
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21038
21120
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21039
21121
  function CredentialsScreen({
@@ -21043,7 +21125,7 @@ function CredentialsScreen({
21043
21125
  validate: validate3 = validateCredentials,
21044
21126
  tokensOnly = false
21045
21127
  }) {
21046
- const initialValues = useRef3(
21128
+ const initialValues = useRef5(
21047
21129
  normalize({
21048
21130
  spaceId: initial.spaceId ?? "",
21049
21131
  environmentId: initial.environmentId || "master",
@@ -21763,11 +21845,11 @@ var init_run = __esm({
21763
21845
  });
21764
21846
 
21765
21847
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21766
- import { useEffect as useEffect6, useRef as useRef4, useState as useState11 } from "react";
21848
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
21767
21849
  function useExtraction(input) {
21768
21850
  const [state2, setState] = useState11();
21769
- const current = useRef4();
21770
- useEffect6(() => {
21851
+ const current = useRef6();
21852
+ useEffect8(() => {
21771
21853
  current.current = input;
21772
21854
  if (!input) {
21773
21855
  setState(void 0);
@@ -21838,11 +21920,11 @@ var init_run_tokens_only = __esm({
21838
21920
  });
21839
21921
 
21840
21922
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
21841
- import { useEffect as useEffect7, useRef as useRef5, useState as useState12 } from "react";
21923
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
21842
21924
  function useTokensOnly(input) {
21843
21925
  const [state2, setState] = useState12();
21844
- const current = useRef5();
21845
- useEffect7(() => {
21926
+ const current = useRef7();
21927
+ useEffect9(() => {
21846
21928
  current.current = input;
21847
21929
  if (!input) {
21848
21930
  setState(void 0);
@@ -23039,7 +23121,7 @@ var init_GroupedSidebar = __esm({
23039
23121
  });
23040
23122
 
23041
23123
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
23042
- import { useLayoutEffect, useRef as useRef6 } from "react";
23124
+ import { useLayoutEffect, useRef as useRef8 } from "react";
23043
23125
  import { useStdin } from "ink";
23044
23126
  function parseInput(data) {
23045
23127
  const isShiftTab = data === "\x1B[Z";
@@ -23101,7 +23183,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
23101
23183
  }
23102
23184
  function useImmediateInput(handler, enabled = true) {
23103
23185
  const { stdin, setRawMode } = useStdin();
23104
- const handlerRef = useRef6(handler);
23186
+ const handlerRef = useRef8(handler);
23105
23187
  handlerRef.current = handler;
23106
23188
  useLayoutEffect(() => {
23107
23189
  if (!enabled) return;
@@ -23119,7 +23201,7 @@ var init_useImmediateInput = __esm({
23119
23201
 
23120
23202
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23121
23203
  import { useStdout as useStdout2 } from "ink";
23122
- import { useEffect as useEffect8, useState as useState13 } from "react";
23204
+ import { useEffect as useEffect10, useState as useState13 } from "react";
23123
23205
  function readTerminalSize(stdout) {
23124
23206
  return {
23125
23207
  columns: stdout?.columns ?? 80,
@@ -23129,7 +23211,7 @@ function readTerminalSize(stdout) {
23129
23211
  function useTerminalSize() {
23130
23212
  const { stdout } = useStdout2();
23131
23213
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
23132
- useEffect8(() => {
23214
+ useEffect10(() => {
23133
23215
  const updateSize = () => setSize(readTerminalSize(stdout));
23134
23216
  stdout?.on("resize", updateSize);
23135
23217
  updateSize();
@@ -24131,7 +24213,7 @@ var init_state = __esm({
24131
24213
  });
24132
24214
 
24133
24215
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24134
- import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef7, useState as useState16 } from "react";
24216
+ import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24135
24217
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24136
24218
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24137
24219
  const columnPlan = useMemo3(
@@ -24177,8 +24259,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24177
24259
  for (const p of cycleParticipants) seed.add(p);
24178
24260
  return seed;
24179
24261
  });
24180
- const seededGroupsRef = useRef7(closures.size > 0 || cycleParticipants.size > 0);
24181
- useEffect9(() => {
24262
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24263
+ useEffect11(() => {
24182
24264
  if (seededGroupsRef.current) return;
24183
24265
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24184
24266
  seededGroupsRef.current = true;
@@ -24269,7 +24351,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24269
24351
  entryCount: 0
24270
24352
  });
24271
24353
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24272
- useEffect9(() => {
24354
+ useEffect11(() => {
24273
24355
  setNav((prev) => {
24274
24356
  const maxIdx = Math.max(0, visibleRows.length - 1);
24275
24357
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24842,13 +24924,13 @@ var init_load2 = __esm({
24842
24924
  });
24843
24925
 
24844
24926
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24845
- import { useEffect as useEffect10, useMemo as useMemo5, useRef as useRef8, useState as useState17 } from "react";
24927
+ import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
24846
24928
  function useScopeGateFlow(input, deps = realDeps3) {
24847
24929
  const sessionId = input?.sessionId;
24848
24930
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24849
- const cacheCheck = useRef8(void 0);
24931
+ const cacheCheck = useRef10(void 0);
24850
24932
  const [confirmed, setConfirmed] = useState17();
24851
- useEffect10(() => {
24933
+ useEffect12(() => {
24852
24934
  if (!input || !loaded?.ok || cacheCheck.current) return;
24853
24935
  cacheCheck.current = deps.checkCache(input.cache);
24854
24936
  }, [input, loaded]);
@@ -25119,11 +25201,11 @@ var init_run2 = __esm({
25119
25201
  });
25120
25202
 
25121
25203
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25122
- import { useEffect as useEffect11, useRef as useRef9, useState as useState18 } from "react";
25204
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
25123
25205
  function useGeneration(input) {
25124
25206
  const [state2, setState] = useState18();
25125
- const current = useRef9();
25126
- useEffect11(() => {
25207
+ const current = useRef11();
25208
+ useEffect13(() => {
25127
25209
  current.current = input;
25128
25210
  if (!input) {
25129
25211
  setState(void 0);
@@ -26110,7 +26192,7 @@ var init_scroll_offset = __esm({
26110
26192
  });
26111
26193
 
26112
26194
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26113
- import React13, { useEffect as useEffect12, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26195
+ import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26114
26196
  import figures6 from "figures";
26115
26197
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26116
26198
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27637,7 +27719,7 @@ function FieldEditor({
27637
27719
  }
27638
27720
  return Math.max(start + 1, end2);
27639
27721
  };
27640
- useEffect12(() => {
27722
+ useEffect14(() => {
27641
27723
  if (focusLevel === "field" || selectedRowIdx < 0) return;
27642
27724
  setListScrollStart((previous) => {
27643
27725
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29032,7 +29114,7 @@ var init_FinalizeDialog = __esm({
29032
29114
  });
29033
29115
 
29034
29116
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29035
- import { useEffect as useEffect13, useRef as useRef10, useState as useState20 } from "react";
29117
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
29036
29118
  function useReviewFinalizePreview({
29037
29119
  components,
29038
29120
  ...options
@@ -29047,9 +29129,9 @@ function useFinalizePreview(opts) {
29047
29129
  const [status, setStatus] = useState20("idle");
29048
29130
  const [removed, setRemoved] = useState20([]);
29049
29131
  const [scrollOffset, setScrollOffset] = useState20(0);
29050
- const generationRef = useRef10(0);
29132
+ const generationRef = useRef12(0);
29051
29133
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29052
- useEffect13(() => {
29134
+ useEffect15(() => {
29053
29135
  if (!open) {
29054
29136
  setStatus("idle");
29055
29137
  setRemoved([]);
@@ -29101,7 +29183,7 @@ var init_use_finalize_preview = __esm({
29101
29183
  });
29102
29184
 
29103
29185
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29104
- import { useCallback as useCallback2, useEffect as useEffect14, useRef as useRef11, useState as useState21 } from "react";
29186
+ import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
29105
29187
  function useReviewSession({
29106
29188
  loadSession,
29107
29189
  tokensPath,
@@ -29120,7 +29202,7 @@ function useReviewSession({
29120
29202
  }));
29121
29203
  return { result, catalog };
29122
29204
  }, [loadSession, tokensPath]);
29123
- useEffect14(() => {
29205
+ useEffect16(() => {
29124
29206
  let disposed = false;
29125
29207
  void (async () => {
29126
29208
  try {
@@ -29173,7 +29255,7 @@ function useReviewSession({
29173
29255
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29174
29256
  const [reviewMetadata, setReviewMetadata] = useState21(null);
29175
29257
  const [componentRationale, setComponentRationale] = useState21(null);
29176
- useEffect14(() => {
29258
+ useEffect16(() => {
29177
29259
  const current = components[selectedIdx];
29178
29260
  if (!current) {
29179
29261
  setReviewMetadata(null);
@@ -29203,9 +29285,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29203
29285
  return { reviewMetadata, componentRationale };
29204
29286
  }
29205
29287
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29206
- const historyRef = useRef11(null);
29207
- const historySeededRef = useRef11(false);
29208
- useEffect14(() => {
29288
+ const historyRef = useRef13(null);
29289
+ const historySeededRef = useRef13(false);
29290
+ useEffect16(() => {
29209
29291
  if (loading || historySeededRef.current) return;
29210
29292
  historySeededRef.current = true;
29211
29293
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29287,7 +29369,7 @@ var init_token_suggestions = __esm({
29287
29369
  });
29288
29370
 
29289
29371
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29290
- import { useEffect as useEffect15, useRef as useRef12, useState as useState22 } from "react";
29372
+ import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
29291
29373
  function parseReviewEntry(draftValue) {
29292
29374
  const parsed = JSON.parse(draftValue);
29293
29375
  const keys = Object.keys(parsed);
@@ -29319,9 +29401,9 @@ function useReviewEditor({
29319
29401
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
29320
29402
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
29321
29403
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
29322
- const tokenReviewSuggestedRef = useRef12(/* @__PURE__ */ new Map());
29323
- const pendingGRef = useRef12(false);
29324
- useEffect15(() => {
29404
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29405
+ const pendingGRef = useRef14(false);
29406
+ useEffect17(() => {
29325
29407
  setTokenReviewRow(0);
29326
29408
  setTokenReviewEditing(false);
29327
29409
  setTokenReviewEditCursor(0);
@@ -29803,24 +29885,24 @@ var init_preview_annotations = __esm({
29803
29885
  });
29804
29886
 
29805
29887
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
29806
- import { useCallback as useCallback3, useEffect as useEffect16, useRef as useRef13, useState as useState24 } from "react";
29888
+ import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
29807
29889
  function useLivePreview(opts) {
29808
29890
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
29809
29891
  const [status, setStatus] = useState24("idle");
29810
29892
  const [disabled, setDisabled] = useState24(false);
29811
- const timerRef = useRef13(null);
29812
- const generationRef = useRef13(0);
29813
- const latestRef = useRef13(0);
29814
- const inflightRef = useRef13(0);
29815
- const optsRef = useRef13(opts);
29816
- useEffect16(() => {
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(() => {
29817
29899
  optsRef.current = opts;
29818
29900
  });
29819
- const disabledRef = useRef13(disabled);
29820
- useEffect16(() => {
29901
+ const disabledRef = useRef15(disabled);
29902
+ useEffect18(() => {
29821
29903
  disabledRef.current = disabled;
29822
29904
  }, [disabled]);
29823
- useEffect16(() => {
29905
+ useEffect18(() => {
29824
29906
  return () => {
29825
29907
  if (timerRef.current) {
29826
29908
  clearTimeout(timerRef.current);
@@ -29901,7 +29983,7 @@ var init_use_live_preview = __esm({
29901
29983
  });
29902
29984
 
29903
29985
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
29904
- import { useCallback as useCallback4, useEffect as useEffect17, useState as useState25 } from "react";
29986
+ import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
29905
29987
  function useReviewPreview({
29906
29988
  components,
29907
29989
  loading,
@@ -29943,13 +30025,13 @@ function useReviewPreview({
29943
30025
  deleteAllComponents
29944
30026
  });
29945
30027
  const [spinnerTick, setSpinnerTick] = useState25(0);
29946
- useEffect17(() => {
30028
+ useEffect19(() => {
29947
30029
  if (livePreviewHook.status !== "running") return;
29948
30030
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
29949
30031
  return () => clearInterval(id);
29950
30032
  }, [livePreviewHook.status]);
29951
30033
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
29952
- useEffect17(() => {
30034
+ useEffect19(() => {
29953
30035
  if (loading) return;
29954
30036
  if (!livePreview) return;
29955
30037
  if (components.length === 0) return;
@@ -30006,7 +30088,7 @@ var init_LivePreviewSummary = __esm({
30006
30088
  });
30007
30089
 
30008
30090
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30009
- import { useCallback as useCallback5, useEffect as useEffect18, useMemo as useMemo6, useRef as useRef14, useState as useState26 } from "react";
30091
+ import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30010
30092
  import figures8 from "figures";
30011
30093
  import { Box as Box38, Text as Text40 } from "ink";
30012
30094
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30220,7 +30302,7 @@ function GenerateReviewStepView({
30220
30302
  setFinalizeError
30221
30303
  } = reviewSurface;
30222
30304
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
30223
- const removedBannerDefaultedRef = useRef14(false);
30305
+ const removedBannerDefaultedRef = useRef16(false);
30224
30306
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30225
30307
  const [cyclesCursor, setCyclesCursor] = useState26(0);
30226
30308
  const cyclePanel = useOverlayPanel({
@@ -30240,7 +30322,7 @@ function GenerateReviewStepView({
30240
30322
  const [breakCursor, setBreakCursor] = useState26(0);
30241
30323
  const [breakConfirm, setBreakConfirm] = useState26(false);
30242
30324
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
30243
- const seededGroupsRef = useRef14(false);
30325
+ const seededGroupsRef = useRef16(false);
30244
30326
  const {
30245
30327
  searchOpen,
30246
30328
  setSearchOpen,
@@ -30264,7 +30346,7 @@ function GenerateReviewStepView({
30264
30346
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30265
30347
  const [autoRejected, setAutoRejected] = useState26([]);
30266
30348
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
30267
- const autoRejectFiredRef = useRef14(false);
30349
+ const autoRejectFiredRef = useRef16(false);
30268
30350
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
30269
30351
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30270
30352
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -30327,7 +30409,7 @@ function GenerateReviewStepView({
30327
30409
  [components]
30328
30410
  );
30329
30411
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30330
- useEffect18(() => {
30412
+ useEffect20(() => {
30331
30413
  if (seededGroupsRef.current) return;
30332
30414
  if (closures.size === 0 && slotCycles.length === 0) return;
30333
30415
  seededGroupsRef.current = true;
@@ -30354,7 +30436,7 @@ function GenerateReviewStepView({
30354
30436
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30355
30437
  }));
30356
30438
  }, [slotCycles, cycleView]);
30357
- useEffect18(() => {
30439
+ useEffect20(() => {
30358
30440
  const decision = computeAutoRejectDecision({
30359
30441
  loading,
30360
30442
  autoRejectFired: autoRejectFiredRef.current,
@@ -30397,8 +30479,8 @@ function GenerateReviewStepView({
30397
30479
  }),
30398
30480
  applySnapshot: applyHistorySnapshot
30399
30481
  });
30400
- const autoRejectPushedRef = useRef14(false);
30401
- useEffect18(() => {
30482
+ const autoRejectPushedRef = useRef16(false);
30483
+ useEffect20(() => {
30402
30484
  if (loading) return;
30403
30485
  if (!historySeededRef.current) return;
30404
30486
  if (!autoRejectFiredRef.current) return;
@@ -30482,7 +30564,7 @@ function GenerateReviewStepView({
30482
30564
  const panelHeight = leftPanelHeight + 2;
30483
30565
  const panelContentHeight = Math.max(1, panelHeight - 3);
30484
30566
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30485
- useEffect18(() => {
30567
+ useEffect20(() => {
30486
30568
  if (selectableRowPositions.length === 0) return;
30487
30569
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30488
30570
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31564,10 +31646,10 @@ var init_path_utils = __esm({
31564
31646
  });
31565
31647
 
31566
31648
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
31567
- import { useEffect as useEffect19, useState as useState27 } from "react";
31649
+ import { useEffect as useEffect21, useState as useState27 } from "react";
31568
31650
  function useBlinkingCursor() {
31569
31651
  const [visible, setVisible] = useState27(true);
31570
- useEffect19(() => {
31652
+ useEffect21(() => {
31571
31653
  const interval = setInterval(() => setVisible((current) => !current), 500);
31572
31654
  return () => clearInterval(interval);
31573
31655
  }, []);
@@ -31704,12 +31786,12 @@ var init_produced = __esm({
31704
31786
  });
31705
31787
 
31706
31788
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
31707
- import { useEffect as useEffect20, useState as useState29 } from "react";
31789
+ import { useEffect as useEffect22, useState as useState29 } from "react";
31708
31790
  import { Spinner as Spinner2 } from "@inkjs/ui";
31709
31791
  import { jsx as jsx53 } from "react/jsx-runtime";
31710
31792
  function useTimedSpinner() {
31711
31793
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
31712
- useEffect20(() => {
31794
+ useEffect22(() => {
31713
31795
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
31714
31796
  return () => {
31715
31797
  clearInterval(timer);
@@ -31978,7 +32060,7 @@ var init_preview_confirmation_input = __esm({
31978
32060
  });
31979
32061
 
31980
32062
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
31981
- import { useEffect as useEffect21, useState as useState30, useMemo as useMemo7 } from "react";
32063
+ import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
31982
32064
  import { Box as Box44, Text as Text46 } from "ink";
31983
32065
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
31984
32066
  function buildPreviewSummaryLines(preview) {
@@ -32188,7 +32270,7 @@ function WizardPreviewStep({
32188
32270
  const activeLines = diffExpanded ? diffLines : summaryLines;
32189
32271
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32190
32272
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32191
- useEffect21(() => {
32273
+ useEffect23(() => {
32192
32274
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32193
32275
  }, [maxScroll]);
32194
32276
  useImmediateInput((input, key) => {
@@ -33236,9 +33318,9 @@ var init_controller = __esm({
33236
33318
  });
33237
33319
 
33238
33320
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33239
- import { useEffect as useEffect22, useRef as useRef15, useSyncExternalStore } from "react";
33321
+ import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
33240
33322
  function useFlow(start, options = {}) {
33241
- const controller = useRef15();
33323
+ const controller = useRef17();
33242
33324
  if (start && !controller.current) {
33243
33325
  try {
33244
33326
  startWizardLog();
@@ -33255,7 +33337,7 @@ function useFlow(start, options = {}) {
33255
33337
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33256
33338
  () => current?.getState()
33257
33339
  );
33258
- useEffect22(() => {
33340
+ useEffect24(() => {
33259
33341
  if (!start) controller.current = void 0;
33260
33342
  }, [start]);
33261
33343
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33334,7 +33416,7 @@ var init_help_info = __esm({
33334
33416
  });
33335
33417
 
33336
33418
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33337
- import { useEffect as useEffect23, useState as useState31 } from "react";
33419
+ import { useEffect as useEffect25, useState as useState31 } from "react";
33338
33420
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33339
33421
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33340
33422
  function Section({ title, rows }) {
@@ -33348,7 +33430,7 @@ function Section({ title, rows }) {
33348
33430
  }
33349
33431
  function HelpScreen({ onDone }) {
33350
33432
  const [info, setInfo] = useState31();
33351
- useEffect23(() => {
33433
+ useEffect25(() => {
33352
33434
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
33353
33435
  void readHelpInfo().then(setInfo);
33354
33436
  }, []);
@@ -33769,7 +33851,7 @@ var init_AgentStatusBadge = __esm({
33769
33851
  });
33770
33852
 
33771
33853
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
33772
- import { useEffect as useEffect24, useState as useState33 } from "react";
33854
+ import { useEffect as useEffect26, useState as useState33 } from "react";
33773
33855
  import { Box as Box48, Text as Text50 } from "ink";
33774
33856
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
33775
33857
  function StatusHeading() {
@@ -33790,7 +33872,7 @@ function AgentDetail({
33790
33872
  const [testing, setTesting] = useState33(false);
33791
33873
  const [notice, setNotice] = useState33(null);
33792
33874
  const [checks, setChecks] = useState33(void 0);
33793
- useEffect24(() => {
33875
+ useEffect26(() => {
33794
33876
  let active = true;
33795
33877
  setChecks(void 0);
33796
33878
  const timer = setTimeout(() => {
@@ -33882,7 +33964,7 @@ var init_AgentDetail = __esm({
33882
33964
  });
33883
33965
 
33884
33966
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
33885
- import { useEffect as useEffect25, useRef as useRef16, useState as useState34 } from "react";
33967
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
33886
33968
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
33887
33969
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
33888
33970
  function AgentsScreen({ onDone }) {
@@ -33893,7 +33975,7 @@ function AgentsScreen({ onDone }) {
33893
33975
  const [saving, setSaving] = useState34(false);
33894
33976
  const [loadError, setLoadError] = useState34(null);
33895
33977
  const [checks, setChecks] = useState34({});
33896
- const visit = useRef16({
33978
+ const visit = useRef18({
33897
33979
  trail: createTrail(),
33898
33980
  before: void 0,
33899
33981
  environment: void 0,
@@ -33906,7 +33988,7 @@ function AgentsScreen({ onDone }) {
33906
33988
  );
33907
33989
  }
33908
33990
  };
33909
- useEffect25(() => {
33991
+ useEffect27(() => {
33910
33992
  readAgentConfig().then((loaded) => {
33911
33993
  setConfig(loaded);
33912
33994
  inspectAll(loaded);
@@ -34132,7 +34214,7 @@ var init_project_store = __esm({
34132
34214
  });
34133
34215
 
34134
34216
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34135
- import { useEffect as useEffect26, useRef as useRef17, useState as useState35 } from "react";
34217
+ import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
34136
34218
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34137
34219
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34138
34220
  function debugFields(config) {
@@ -34151,14 +34233,14 @@ function ProjectScreen({ onDone }) {
34151
34233
  const [saving, setSaving] = useState35(false);
34152
34234
  const [notice, setNotice] = useState35(null);
34153
34235
  const [loadError, setLoadError] = useState35(null);
34154
- const visit = useRef17({
34236
+ const visit = useRef19({
34155
34237
  trail: createTrail(),
34156
34238
  before: void 0,
34157
34239
  persisted: void 0,
34158
34240
  error: ""
34159
34241
  }).current;
34160
34242
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34161
- useEffect26(() => {
34243
+ useEffect28(() => {
34162
34244
  readCredentials().then((cfg) => {
34163
34245
  setConfig(cfg);
34164
34246
  visit.before = snapshotOf(cfg);
@@ -34345,13 +34427,13 @@ var init_ConfigurationScreen = __esm({
34345
34427
  });
34346
34428
 
34347
34429
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34348
- import { useEffect as useEffect27, useState as useState37 } from "react";
34430
+ import { useEffect as useEffect29, useState as useState37 } from "react";
34349
34431
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34350
34432
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34351
34433
  function OptInAnalyticsScreen({ onDone }) {
34352
34434
  const [loading, setLoading] = useState37(true);
34353
34435
  const [enabled, setEnabled] = useState37(true);
34354
- useEffect27(() => {
34436
+ useEffect29(() => {
34355
34437
  readAnalyticsSetting().then((setting) => {
34356
34438
  setEnabled(setting.enabled);
34357
34439
  setLoading(false);
@@ -34414,7 +34496,7 @@ var init_screen12 = __esm({
34414
34496
  });
34415
34497
 
34416
34498
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34417
- import { useEffect as useEffect28, useRef as useRef18, useState as useState38 } from "react";
34499
+ import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
34418
34500
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
34419
34501
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
34420
34502
  function DebugModeScreen({ onDone }) {
@@ -34424,8 +34506,8 @@ function DebugModeScreen({ onDone }) {
34424
34506
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
34425
34507
  );
34426
34508
  const [notice, setNotice] = useState38(null);
34427
- const visit = useRef18({ trail: createTrail(), before: void 0, error: "" }).current;
34428
- useEffect28(() => {
34509
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
34510
+ useEffect30(() => {
34429
34511
  readDebugModeSetting().then((loaded) => {
34430
34512
  setSetting(loaded);
34431
34513
  setPending(loaded.retentionDays);
@@ -34566,7 +34648,7 @@ var app_exports = {};
34566
34648
  __export(app_exports, {
34567
34649
  runApp: () => runApp
34568
34650
  });
34569
- import { useEffect as useEffect29, useState as useState39 } from "react";
34651
+ import { useEffect as useEffect31, useState as useState39 } from "react";
34570
34652
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
34571
34653
  function App({ importOptions, inkClear }) {
34572
34654
  const [screen, setScreen] = useState39("start");
@@ -34600,7 +34682,7 @@ function App({ importOptions, inkClear }) {
34600
34682
  const [flowStart, setFlowStart] = useState39();
34601
34683
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34602
34684
  const [importDefaults, setImportDefaults] = useState39();
34603
- useEffect29(() => {
34685
+ useEffect31(() => {
34604
34686
  if (screen !== "import") {
34605
34687
  setImportDefaults(void 0);
34606
34688
  return;
@@ -34673,7 +34755,7 @@ function App({ importOptions, inkClear }) {
34673
34755
  }
34674
34756
  });
34675
34757
  };
34676
- useEffect29(() => {
34758
+ useEffect31(() => {
34677
34759
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
34678
34760
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
34679
34761
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -34695,12 +34777,12 @@ function App({ importOptions, inkClear }) {
34695
34777
  }
34696
34778
  });
34697
34779
  }, [tokensOnly, tokensOnlyRun]);
34698
- useEffect29(() => {
34780
+ useEffect31(() => {
34699
34781
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34700
34782
  setExtractionRun(void 0);
34701
34783
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34702
34784
  }, [extraction, extractionRun]);
34703
- useEffect29(() => {
34785
+ useEffect31(() => {
34704
34786
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34705
34787
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34706
34788
  setGenerationInput({
@@ -34718,7 +34800,7 @@ function App({ importOptions, inkClear }) {
34718
34800
  ...generatePromptPath ? { generatePromptPath } : {}
34719
34801
  });
34720
34802
  }, [scopeFlow, scopeRun, generationInput]);
34721
- useEffect29(() => {
34803
+ useEffect31(() => {
34722
34804
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34723
34805
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
34724
34806
  inkClear();
@@ -34801,6 +34883,7 @@ function App({ importOptions, inkClear }) {
34801
34883
  return /* @__PURE__ */ jsx66(
34802
34884
  WelcomeScreen,
34803
34885
  {
34886
+ mode: target,
34804
34887
  onContinue: (projectPath) => answer({ projectPath }),
34805
34888
  onQuit: () => goBackFrom("project"),
34806
34889
  initialPath: importDefaults.componentDir
@@ -34810,6 +34893,7 @@ function App({ importOptions, inkClear }) {
34810
34893
  return /* @__PURE__ */ jsx66(
34811
34894
  TokenInputScreen,
34812
34895
  {
34896
+ mode: target,
34813
34897
  initialPath: importDefaults.tokenFile,
34814
34898
  onConfirm: (tokensPath) => answer({ tokensPath }),
34815
34899
  onBack: () => goBackFrom("token-file")