@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/app.js CHANGED
@@ -2484,7 +2484,7 @@ var init_cache_keys = __esm({
2484
2484
  });
2485
2485
 
2486
2486
  // packages/experience-design-system-cli/app.tsx
2487
- import { useEffect as useEffect30, useState as useState39 } from "react";
2487
+ import { useEffect as useEffect31, useState as useState39 } from "react";
2488
2488
 
2489
2489
  // packages/experience-design-system-cli/src/tui/home/home.tsx
2490
2490
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -3275,8 +3275,9 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
3275
3275
  }
3276
3276
 
3277
3277
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
3278
- import { useState as useState6 } from "react";
3278
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
3279
3279
  import { Box as Box11, Text as Text11 } from "ink";
3280
+ init_debug_store();
3280
3281
 
3281
3282
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
3282
3283
  import { useInput as useInput8 } from "ink";
@@ -3343,23 +3344,68 @@ function validateTokenPath(rawPath) {
3343
3344
 
3344
3345
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
3345
3346
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
3346
- function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3347
+ var MAX_LOGGED_ATTEMPTS = 10;
3348
+ function TokenInputScreen({
3349
+ mode,
3350
+ onConfirm,
3351
+ onBack,
3352
+ initialPath = ""
3353
+ }) {
3347
3354
  const [tokenPath, setTokenPath] = useState6(initialPath);
3348
3355
  const [failure, setFailure] = useState6(null);
3349
- useTokenInputControls(onBack);
3356
+ const rejected = useRef4([]).current;
3357
+ useEffect6(() => {
3358
+ startDebugRun({
3359
+ flow: "import/token-input",
3360
+ step: "02-token-input",
3361
+ menuOption: "Token input",
3362
+ inputs: { import_mode: mode, initial_path: initialPath }
3363
+ });
3364
+ }, []);
3365
+ const back = () => {
3366
+ void finishDebugRun({
3367
+ outputs: { token_path: null, rejected_attempts: rejected, ...failure ? { error: failure.error } : {} },
3368
+ status: failure ? "error" : "success",
3369
+ exitMethod: "discarded"
3370
+ });
3371
+ onBack();
3372
+ };
3373
+ useTokenInputControls(back);
3350
3374
  const change = (value) => {
3351
3375
  setTokenPath(value);
3352
3376
  setFailure(null);
3353
3377
  };
3378
+ const reject = (entered, rejection) => {
3379
+ if (rejected.length < MAX_LOGGED_ATTEMPTS) {
3380
+ rejected.push({
3381
+ entered,
3382
+ error: rejection.error,
3383
+ ...rejection.resolvedPath ? { resolved_path: rejection.resolvedPath } : {}
3384
+ });
3385
+ }
3386
+ setFailure(rejection);
3387
+ };
3354
3388
  const submit = (value) => {
3355
3389
  const rawPath = toTokenPath(value);
3356
3390
  if (!rawPath) {
3357
- setFailure({ error: "Enter the path to your token file." });
3391
+ reject("", { error: "Enter the path to your token file." });
3358
3392
  return;
3359
3393
  }
3360
3394
  const check = validateTokenPath(rawPath);
3361
- if (check.ok) onConfirm(check.path);
3362
- else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
3395
+ if (!check.ok) {
3396
+ reject(rawPath, { error: check.error, resolvedPath: check.resolvedPath });
3397
+ return;
3398
+ }
3399
+ void finishDebugRun({
3400
+ outputs: {
3401
+ token_path: check.path,
3402
+ changed_from_initial: rawPath !== initialPath.trim(),
3403
+ rejected_attempts: rejected
3404
+ },
3405
+ status: "success",
3406
+ exitMethod: "saved"
3407
+ });
3408
+ onConfirm(check.path);
3363
3409
  };
3364
3410
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
3365
3411
  /* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
@@ -3389,7 +3435,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3389
3435
  }
3390
3436
 
3391
3437
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
3392
- import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
3438
+ import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
3393
3439
  import { Box as Box12, Text as Text12 } from "ink";
3394
3440
  init_debug_store();
3395
3441
 
@@ -18061,7 +18107,7 @@ function PathValidationScreen({
18061
18107
  }) {
18062
18108
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
18063
18109
  const [scan, setScan] = useState7();
18064
- useEffect6(() => {
18110
+ useEffect7(() => {
18065
18111
  startDebugRun({
18066
18112
  flow: "import/path-validation",
18067
18113
  step: "03-path-validation",
@@ -18069,7 +18115,7 @@ function PathValidationScreen({
18069
18115
  inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
18070
18116
  });
18071
18117
  }, []);
18072
- useEffect6(() => {
18118
+ useEffect7(() => {
18073
18119
  setScan(scanFiles(resolvedPath));
18074
18120
  }, [resolvedPath]);
18075
18121
  const phase = phaseOf(scan);
@@ -18111,7 +18157,7 @@ function PathValidationScreen({
18111
18157
  }
18112
18158
 
18113
18159
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
18114
- import { useRef as useRef4, useState as useState9 } from "react";
18160
+ import { useRef as useRef5, useState as useState9 } from "react";
18115
18161
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
18116
18162
 
18117
18163
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
@@ -18363,7 +18409,7 @@ function CredentialsScreen({
18363
18409
  validate: validate3 = validateCredentials,
18364
18410
  tokensOnly = false
18365
18411
  }) {
18366
- const initialValues = useRef4(
18412
+ const initialValues = useRef5(
18367
18413
  normalize({
18368
18414
  spaceId: initial.spaceId ?? "",
18369
18415
  environmentId: initial.environmentId || "master",
@@ -18744,7 +18790,7 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
18744
18790
  init_config();
18745
18791
 
18746
18792
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18747
- import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
18793
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
18748
18794
 
18749
18795
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
18750
18796
  import { mkdir as mkdir8 } from "node:fs/promises";
@@ -19000,8 +19046,8 @@ async function resolveSelectionPrompt(overrides) {
19000
19046
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
19001
19047
  function useExtraction(input) {
19002
19048
  const [state2, setState] = useState11();
19003
- const current = useRef5();
19004
- useEffect7(() => {
19049
+ const current = useRef6();
19050
+ useEffect8(() => {
19005
19051
  current.current = input;
19006
19052
  if (!input) {
19007
19053
  setState(void 0);
@@ -19027,7 +19073,7 @@ function useExtraction(input) {
19027
19073
  }
19028
19074
 
19029
19075
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
19030
- import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
19076
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
19031
19077
 
19032
19078
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
19033
19079
  var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
@@ -19061,8 +19107,8 @@ async function runTokensOnly(input, deps = realDeps2) {
19061
19107
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
19062
19108
  function useTokensOnly(input) {
19063
19109
  const [state2, setState] = useState12();
19064
- const current = useRef6();
19065
- useEffect8(() => {
19110
+ const current = useRef7();
19111
+ useEffect9(() => {
19066
19112
  current.current = input;
19067
19113
  if (!input) {
19068
19114
  setState(void 0);
@@ -20192,7 +20238,7 @@ import React11 from "react";
20192
20238
  import { Box as Box23, Text as Text24 } from "ink";
20193
20239
 
20194
20240
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
20195
- import { useLayoutEffect, useRef as useRef7 } from "react";
20241
+ import { useLayoutEffect, useRef as useRef8 } from "react";
20196
20242
  import { useStdin } from "ink";
20197
20243
  function parseInput(data) {
20198
20244
  const isShiftTab = data === "\x1B[Z";
@@ -20255,7 +20301,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
20255
20301
  }
20256
20302
  function useImmediateInput(handler, enabled = true) {
20257
20303
  const { stdin, setRawMode } = useStdin();
20258
- const handlerRef = useRef7(handler);
20304
+ const handlerRef = useRef8(handler);
20259
20305
  handlerRef.current = handler;
20260
20306
  useLayoutEffect(() => {
20261
20307
  if (!enabled) return;
@@ -20266,7 +20312,7 @@ function useImmediateInput(handler, enabled = true) {
20266
20312
 
20267
20313
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
20268
20314
  import { useStdout as useStdout2 } from "ink";
20269
- import { useEffect as useEffect9, useState as useState13 } from "react";
20315
+ import { useEffect as useEffect10, useState as useState13 } from "react";
20270
20316
  function readTerminalSize(stdout) {
20271
20317
  return {
20272
20318
  columns: stdout?.columns ?? 80,
@@ -20276,7 +20322,7 @@ function readTerminalSize(stdout) {
20276
20322
  function useTerminalSize() {
20277
20323
  const { stdout } = useStdout2();
20278
20324
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
20279
- useEffect9(() => {
20325
+ useEffect10(() => {
20280
20326
  const updateSize = () => setSize(readTerminalSize(stdout));
20281
20327
  stdout?.on("resize", updateSize);
20282
20328
  updateSize();
@@ -20459,7 +20505,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
20459
20505
  }
20460
20506
 
20461
20507
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
20462
- import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
20508
+ import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
20463
20509
 
20464
20510
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
20465
20511
  var TWO_COLUMN_MIN_WIDTH = 100;
@@ -21195,8 +21241,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21195
21241
  for (const p of cycleParticipants) seed.add(p);
21196
21242
  return seed;
21197
21243
  });
21198
- const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
21199
- useEffect10(() => {
21244
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
21245
+ useEffect11(() => {
21200
21246
  if (seededGroupsRef.current) return;
21201
21247
  if (closures.size === 0 && cycleParticipants.size === 0) return;
21202
21248
  seededGroupsRef.current = true;
@@ -21287,7 +21333,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21287
21333
  entryCount: 0
21288
21334
  });
21289
21335
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
21290
- useEffect10(() => {
21336
+ useEffect11(() => {
21291
21337
  setNav((prev) => {
21292
21338
  const maxIdx = Math.max(0, visibleRows.length - 1);
21293
21339
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -21762,7 +21808,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
21762
21808
  }
21763
21809
 
21764
21810
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
21765
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
21811
+ import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
21766
21812
 
21767
21813
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
21768
21814
  async function checkGenerationCache(input) {
@@ -21809,9 +21855,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
21809
21855
  function useScopeGateFlow(input, deps = realDeps3) {
21810
21856
  const sessionId = input?.sessionId;
21811
21857
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
21812
- const cacheCheck = useRef9(void 0);
21858
+ const cacheCheck = useRef10(void 0);
21813
21859
  const [confirmed, setConfirmed] = useState17();
21814
- useEffect11(() => {
21860
+ useEffect12(() => {
21815
21861
  if (!input || !loaded?.ok || cacheCheck.current) return;
21816
21862
  cacheCheck.current = deps.checkCache(input.cache);
21817
21863
  }, [input, loaded]);
@@ -21878,7 +21924,7 @@ function GenerationScreen({
21878
21924
  }
21879
21925
 
21880
21926
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21881
- import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
21927
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
21882
21928
 
21883
21929
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
21884
21930
  import { resolve as resolve25 } from "node:path";
@@ -22043,8 +22089,8 @@ function applyProgressEvent2(event, previous, total) {
22043
22089
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
22044
22090
  function useGeneration(input) {
22045
22091
  const [state2, setState] = useState18();
22046
- const current = useRef10();
22047
- useEffect12(() => {
22092
+ const current = useRef11();
22093
+ useEffect13(() => {
22048
22094
  current.current = input;
22049
22095
  if (!input) {
22050
22096
  setState(void 0);
@@ -22525,7 +22571,7 @@ function PreviewValidationErrorScreen({
22525
22571
  }
22526
22572
 
22527
22573
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
22528
- import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
22574
+ import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
22529
22575
  import figures8 from "figures";
22530
22576
 
22531
22577
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
@@ -22786,7 +22832,7 @@ function enumerateCycleBreaks(cycle, components) {
22786
22832
  import { Box as Box32, Text as Text34 } from "ink";
22787
22833
 
22788
22834
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
22789
- import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22835
+ import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22790
22836
  import figures6 from "figures";
22791
22837
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
22792
22838
 
@@ -24344,7 +24390,7 @@ function FieldEditor({
24344
24390
  }
24345
24391
  return Math.max(start + 1, end2);
24346
24392
  };
24347
- useEffect13(() => {
24393
+ useEffect14(() => {
24348
24394
  if (focusLevel === "field" || selectedRowIdx < 0) return;
24349
24395
  setListScrollStart((previous) => {
24350
24396
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -25416,7 +25462,7 @@ function finalizeReviewSession(extractSessionId, components) {
25416
25462
  }
25417
25463
 
25418
25464
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
25419
- import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
25465
+ import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
25420
25466
 
25421
25467
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
25422
25468
  var DEFAULT_MAX_DEPTH = 50;
@@ -25472,7 +25518,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
25472
25518
  }
25473
25519
 
25474
25520
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
25475
- import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
25521
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
25476
25522
 
25477
25523
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
25478
25524
  var TimeoutError = class extends Error {
@@ -25630,9 +25676,9 @@ function useFinalizePreview(opts) {
25630
25676
  const [status, setStatus] = useState20("idle");
25631
25677
  const [removed, setRemoved] = useState20([]);
25632
25678
  const [scrollOffset, setScrollOffset] = useState20(0);
25633
- const generationRef = useRef11(0);
25679
+ const generationRef = useRef12(0);
25634
25680
  const acceptedKey = [...acceptedKeys].sort().join("\0");
25635
- useEffect14(() => {
25681
+ useEffect15(() => {
25636
25682
  if (!open) {
25637
25683
  setStatus("idle");
25638
25684
  setRemoved([]);
@@ -25695,7 +25741,7 @@ function useReviewSession({
25695
25741
  }));
25696
25742
  return { result, catalog };
25697
25743
  }, [loadSession, tokensPath]);
25698
- useEffect15(() => {
25744
+ useEffect16(() => {
25699
25745
  let disposed = false;
25700
25746
  void (async () => {
25701
25747
  try {
@@ -25748,7 +25794,7 @@ function useReviewSession({
25748
25794
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25749
25795
  const [reviewMetadata, setReviewMetadata] = useState21(null);
25750
25796
  const [componentRationale, setComponentRationale] = useState21(null);
25751
- useEffect15(() => {
25797
+ useEffect16(() => {
25752
25798
  const current = components[selectedIdx];
25753
25799
  if (!current) {
25754
25800
  setReviewMetadata(null);
@@ -25778,9 +25824,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25778
25824
  return { reviewMetadata, componentRationale };
25779
25825
  }
25780
25826
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
25781
- const historyRef = useRef12(null);
25782
- const historySeededRef = useRef12(false);
25783
- useEffect15(() => {
25827
+ const historyRef = useRef13(null);
25828
+ const historySeededRef = useRef13(false);
25829
+ useEffect16(() => {
25784
25830
  if (loading || historySeededRef.current) return;
25785
25831
  historySeededRef.current = true;
25786
25832
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -25831,7 +25877,7 @@ function useReviewFinalize({
25831
25877
  }
25832
25878
 
25833
25879
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
25834
- import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
25880
+ import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
25835
25881
 
25836
25882
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
25837
25883
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -25882,9 +25928,9 @@ function useReviewEditor({
25882
25928
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
25883
25929
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
25884
25930
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
25885
- const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
25886
- const pendingGRef = useRef13(false);
25887
- useEffect16(() => {
25931
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
25932
+ const pendingGRef = useRef14(false);
25933
+ useEffect17(() => {
25888
25934
  setTokenReviewRow(0);
25889
25935
  setTokenReviewEditing(false);
25890
25936
  setTokenReviewEditCursor(0);
@@ -26296,7 +26342,7 @@ function handleJsonPanelInput(input, key, state2) {
26296
26342
  }
26297
26343
 
26298
26344
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
26299
- import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
26345
+ import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
26300
26346
 
26301
26347
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
26302
26348
  function applyPreviewAnnotations(preview, localNames) {
@@ -26331,25 +26377,25 @@ function applyPreviewAnnotations(preview, localNames) {
26331
26377
  }
26332
26378
 
26333
26379
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
26334
- import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
26380
+ import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
26335
26381
  var DEFAULT_DEBOUNCE_MS = 500;
26336
26382
  function useLivePreview(opts) {
26337
26383
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
26338
26384
  const [status, setStatus] = useState24("idle");
26339
26385
  const [disabled, setDisabled] = useState24(false);
26340
- const timerRef = useRef14(null);
26341
- const generationRef = useRef14(0);
26342
- const latestRef = useRef14(0);
26343
- const inflightRef = useRef14(0);
26344
- const optsRef = useRef14(opts);
26345
- useEffect17(() => {
26386
+ const timerRef = useRef15(null);
26387
+ const generationRef = useRef15(0);
26388
+ const latestRef = useRef15(0);
26389
+ const inflightRef = useRef15(0);
26390
+ const optsRef = useRef15(opts);
26391
+ useEffect18(() => {
26346
26392
  optsRef.current = opts;
26347
26393
  });
26348
- const disabledRef = useRef14(disabled);
26349
- useEffect17(() => {
26394
+ const disabledRef = useRef15(disabled);
26395
+ useEffect18(() => {
26350
26396
  disabledRef.current = disabled;
26351
26397
  }, [disabled]);
26352
- useEffect17(() => {
26398
+ useEffect18(() => {
26353
26399
  return () => {
26354
26400
  if (timerRef.current) {
26355
26401
  clearTimeout(timerRef.current);
@@ -26463,13 +26509,13 @@ function useReviewPreview({
26463
26509
  deleteAllComponents
26464
26510
  });
26465
26511
  const [spinnerTick, setSpinnerTick] = useState25(0);
26466
- useEffect18(() => {
26512
+ useEffect19(() => {
26467
26513
  if (livePreviewHook.status !== "running") return;
26468
26514
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
26469
26515
  return () => clearInterval(id);
26470
26516
  }, [livePreviewHook.status]);
26471
26517
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
26472
- useEffect18(() => {
26518
+ useEffect19(() => {
26473
26519
  if (loading) return;
26474
26520
  if (!livePreview) return;
26475
26521
  if (components.length === 0) return;
@@ -26782,7 +26828,7 @@ function GenerateReviewStepView({
26782
26828
  setFinalizeError
26783
26829
  } = reviewSurface;
26784
26830
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
26785
- const removedBannerDefaultedRef = useRef15(false);
26831
+ const removedBannerDefaultedRef = useRef16(false);
26786
26832
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
26787
26833
  const [cyclesCursor, setCyclesCursor] = useState26(0);
26788
26834
  const cyclePanel = useOverlayPanel({
@@ -26802,7 +26848,7 @@ function GenerateReviewStepView({
26802
26848
  const [breakCursor, setBreakCursor] = useState26(0);
26803
26849
  const [breakConfirm, setBreakConfirm] = useState26(false);
26804
26850
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
26805
- const seededGroupsRef = useRef15(false);
26851
+ const seededGroupsRef = useRef16(false);
26806
26852
  const {
26807
26853
  searchOpen,
26808
26854
  setSearchOpen,
@@ -26826,7 +26872,7 @@ function GenerateReviewStepView({
26826
26872
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
26827
26873
  const [autoRejected, setAutoRejected] = useState26([]);
26828
26874
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
26829
- const autoRejectFiredRef = useRef15(false);
26875
+ const autoRejectFiredRef = useRef16(false);
26830
26876
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
26831
26877
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
26832
26878
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -26889,7 +26935,7 @@ function GenerateReviewStepView({
26889
26935
  [components]
26890
26936
  );
26891
26937
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
26892
- useEffect19(() => {
26938
+ useEffect20(() => {
26893
26939
  if (seededGroupsRef.current) return;
26894
26940
  if (closures.size === 0 && slotCycles.length === 0) return;
26895
26941
  seededGroupsRef.current = true;
@@ -26916,7 +26962,7 @@ function GenerateReviewStepView({
26916
26962
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
26917
26963
  }));
26918
26964
  }, [slotCycles, cycleView]);
26919
- useEffect19(() => {
26965
+ useEffect20(() => {
26920
26966
  const decision = computeAutoRejectDecision({
26921
26967
  loading,
26922
26968
  autoRejectFired: autoRejectFiredRef.current,
@@ -26959,8 +27005,8 @@ function GenerateReviewStepView({
26959
27005
  }),
26960
27006
  applySnapshot: applyHistorySnapshot
26961
27007
  });
26962
- const autoRejectPushedRef = useRef15(false);
26963
- useEffect19(() => {
27008
+ const autoRejectPushedRef = useRef16(false);
27009
+ useEffect20(() => {
26964
27010
  if (loading) return;
26965
27011
  if (!historySeededRef.current) return;
26966
27012
  if (!autoRejectFiredRef.current) return;
@@ -27044,7 +27090,7 @@ function GenerateReviewStepView({
27044
27090
  const panelHeight = leftPanelHeight + 2;
27045
27091
  const panelContentHeight = Math.max(1, panelHeight - 3);
27046
27092
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
27047
- useEffect19(() => {
27093
+ useEffect20(() => {
27048
27094
  if (selectableRowPositions.length === 0) return;
27049
27095
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
27050
27096
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -27989,10 +28035,10 @@ function normalizePath(input) {
27989
28035
  }
27990
28036
 
27991
28037
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
27992
- import { useEffect as useEffect20, useState as useState27 } from "react";
28038
+ import { useEffect as useEffect21, useState as useState27 } from "react";
27993
28039
  function useBlinkingCursor() {
27994
28040
  const [visible, setVisible] = useState27(true);
27995
- useEffect20(() => {
28041
+ useEffect21(() => {
27996
28042
  const interval = setInterval(() => setVisible((current) => !current), 500);
27997
28043
  return () => clearInterval(interval);
27998
28044
  }, []);
@@ -28108,12 +28154,12 @@ function countedThings({ components, tokens }, counts = {}) {
28108
28154
  }
28109
28155
 
28110
28156
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
28111
- import { useEffect as useEffect21, useState as useState29 } from "react";
28157
+ import { useEffect as useEffect22, useState as useState29 } from "react";
28112
28158
  import { Spinner as Spinner2 } from "@inkjs/ui";
28113
28159
  import { jsx as jsx53 } from "react/jsx-runtime";
28114
28160
  function useTimedSpinner() {
28115
28161
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
28116
- useEffect21(() => {
28162
+ useEffect22(() => {
28117
28163
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
28118
28164
  return () => {
28119
28165
  clearInterval(timer);
@@ -28171,7 +28217,7 @@ function PushingStep({ progress, produced, counts }) {
28171
28217
  }
28172
28218
 
28173
28219
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
28174
- import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
28220
+ import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
28175
28221
  import { Box as Box44, Text as Text46 } from "ink";
28176
28222
 
28177
28223
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -28566,7 +28612,7 @@ function WizardPreviewStep({
28566
28612
  const activeLines = diffExpanded ? diffLines : summaryLines;
28567
28613
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
28568
28614
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
28569
- useEffect22(() => {
28615
+ useEffect23(() => {
28570
28616
  setScrollOffset((previous) => Math.min(previous, maxScroll));
28571
28617
  }, [maxScroll]);
28572
28618
  useImmediateInput((input, key) => {
@@ -28784,7 +28830,7 @@ function FlowScreen({
28784
28830
  }
28785
28831
 
28786
28832
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
28787
- import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
28833
+ import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
28788
28834
 
28789
28835
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28790
28836
  import { appendFileSync, writeFileSync } from "node:fs";
@@ -29526,7 +29572,7 @@ function createFlowController(start, deps) {
29526
29572
 
29527
29573
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
29528
29574
  function useFlow(start, options = {}) {
29529
- const controller = useRef16();
29575
+ const controller = useRef17();
29530
29576
  if (start && !controller.current) {
29531
29577
  try {
29532
29578
  startWizardLog();
@@ -29543,14 +29589,14 @@ function useFlow(start, options = {}) {
29543
29589
  (listener) => current?.subscribe(listener) ?? (() => void 0),
29544
29590
  () => current?.getState()
29545
29591
  );
29546
- useEffect23(() => {
29592
+ useEffect24(() => {
29547
29593
  if (!start) controller.current = void 0;
29548
29594
  }, [start]);
29549
29595
  return current && state2 ? { controller: current, state: state2 } : void 0;
29550
29596
  }
29551
29597
 
29552
29598
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
29553
- import { useEffect as useEffect24, useState as useState31 } from "react";
29599
+ import { useEffect as useEffect25, useState as useState31 } from "react";
29554
29600
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
29555
29601
  init_debug_store();
29556
29602
 
@@ -29624,7 +29670,7 @@ function Section({ title, rows }) {
29624
29670
  }
29625
29671
  function HelpScreen({ onDone }) {
29626
29672
  const [info, setInfo] = useState31();
29627
- useEffect24(() => {
29673
+ useEffect25(() => {
29628
29674
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
29629
29675
  void readHelpInfo().then(setInfo);
29630
29676
  }, []);
@@ -29721,7 +29767,7 @@ import { useState as useState36 } from "react";
29721
29767
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
29722
29768
 
29723
29769
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
29724
- import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
29770
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
29725
29771
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
29726
29772
  init_debug_store();
29727
29773
 
@@ -30050,7 +30096,7 @@ async function writeAgentConfig(config) {
30050
30096
  }
30051
30097
 
30052
30098
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
30053
- import { useEffect as useEffect25, useState as useState33 } from "react";
30099
+ import { useEffect as useEffect26, useState as useState33 } from "react";
30054
30100
  import { Box as Box48, Text as Text50 } from "ink";
30055
30101
 
30056
30102
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
@@ -30113,7 +30159,7 @@ function AgentDetail({
30113
30159
  const [testing, setTesting] = useState33(false);
30114
30160
  const [notice, setNotice] = useState33(null);
30115
30161
  const [checks, setChecks] = useState33(void 0);
30116
- useEffect25(() => {
30162
+ useEffect26(() => {
30117
30163
  let active = true;
30118
30164
  setChecks(void 0);
30119
30165
  const timer = setTimeout(() => {
@@ -30198,7 +30244,7 @@ function AgentsScreen({ onDone }) {
30198
30244
  const [saving, setSaving] = useState34(false);
30199
30245
  const [loadError, setLoadError] = useState34(null);
30200
30246
  const [checks, setChecks] = useState34({});
30201
- const visit = useRef17({
30247
+ const visit = useRef18({
30202
30248
  trail: createTrail(),
30203
30249
  before: void 0,
30204
30250
  environment: void 0,
@@ -30211,7 +30257,7 @@ function AgentsScreen({ onDone }) {
30211
30257
  );
30212
30258
  }
30213
30259
  };
30214
- useEffect26(() => {
30260
+ useEffect27(() => {
30215
30261
  readAgentConfig().then((loaded) => {
30216
30262
  setConfig(loaded);
30217
30263
  inspectAll(loaded);
@@ -30388,7 +30434,7 @@ function AgentsScreen({ onDone }) {
30388
30434
  }
30389
30435
 
30390
30436
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
30391
- import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
30437
+ import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
30392
30438
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
30393
30439
  init_debug_store();
30394
30440
 
@@ -30446,14 +30492,14 @@ function ProjectScreen({ onDone }) {
30446
30492
  const [saving, setSaving] = useState35(false);
30447
30493
  const [notice, setNotice] = useState35(null);
30448
30494
  const [loadError, setLoadError] = useState35(null);
30449
- const visit = useRef18({
30495
+ const visit = useRef19({
30450
30496
  trail: createTrail(),
30451
30497
  before: void 0,
30452
30498
  persisted: void 0,
30453
30499
  error: ""
30454
30500
  }).current;
30455
30501
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
30456
- useEffect27(() => {
30502
+ useEffect28(() => {
30457
30503
  readCredentials().then((cfg) => {
30458
30504
  setConfig(cfg);
30459
30505
  visit.before = snapshotOf(cfg);
@@ -30605,7 +30651,7 @@ function ConfigurationScreen({ onDone }) {
30605
30651
  }
30606
30652
 
30607
30653
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
30608
- import { useEffect as useEffect28, useState as useState37 } from "react";
30654
+ import { useEffect as useEffect29, useState as useState37 } from "react";
30609
30655
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
30610
30656
 
30611
30657
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -30629,7 +30675,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
30629
30675
  function OptInAnalyticsScreen({ onDone }) {
30630
30676
  const [loading, setLoading] = useState37(true);
30631
30677
  const [enabled, setEnabled] = useState37(true);
30632
- useEffect28(() => {
30678
+ useEffect29(() => {
30633
30679
  readAnalyticsSetting().then((setting) => {
30634
30680
  setEnabled(setting.enabled);
30635
30681
  setLoading(false);
@@ -30683,7 +30729,7 @@ function OptInAnalyticsScreen({ onDone }) {
30683
30729
  }
30684
30730
 
30685
30731
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
30686
- import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
30732
+ import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
30687
30733
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
30688
30734
  init_debug_mode_store();
30689
30735
  init_debug_store();
@@ -30700,8 +30746,8 @@ function DebugModeScreen({ onDone }) {
30700
30746
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
30701
30747
  );
30702
30748
  const [notice, setNotice] = useState38(null);
30703
- const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
30704
- useEffect29(() => {
30749
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
30750
+ useEffect30(() => {
30705
30751
  readDebugModeSetting().then((loaded) => {
30706
30752
  setSetting(loaded);
30707
30753
  setPending(loaded.retentionDays);
@@ -30856,7 +30902,7 @@ function App({ importOptions, inkClear }) {
30856
30902
  const [flowStart, setFlowStart] = useState39();
30857
30903
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
30858
30904
  const [importDefaults, setImportDefaults] = useState39();
30859
- useEffect30(() => {
30905
+ useEffect31(() => {
30860
30906
  if (screen !== "import") {
30861
30907
  setImportDefaults(void 0);
30862
30908
  return;
@@ -30929,7 +30975,7 @@ function App({ importOptions, inkClear }) {
30929
30975
  }
30930
30976
  });
30931
30977
  };
30932
- useEffect30(() => {
30978
+ useEffect31(() => {
30933
30979
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
30934
30980
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
30935
30981
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -30951,12 +30997,12 @@ function App({ importOptions, inkClear }) {
30951
30997
  }
30952
30998
  });
30953
30999
  }, [tokensOnly, tokensOnlyRun]);
30954
- useEffect30(() => {
31000
+ useEffect31(() => {
30955
31001
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
30956
31002
  setExtractionRun(void 0);
30957
31003
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
30958
31004
  }, [extraction, extractionRun]);
30959
- useEffect30(() => {
31005
+ useEffect31(() => {
30960
31006
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
30961
31007
  const { extraction: produced, input, generatePromptPath } = scopeRun;
30962
31008
  setGenerationInput({
@@ -30974,7 +31020,7 @@ function App({ importOptions, inkClear }) {
30974
31020
  ...generatePromptPath ? { generatePromptPath } : {}
30975
31021
  });
30976
31022
  }, [scopeFlow, scopeRun, generationInput]);
30977
- useEffect30(() => {
31023
+ useEffect31(() => {
30978
31024
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
30979
31025
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
30980
31026
  inkClear();
@@ -31067,6 +31113,7 @@ function App({ importOptions, inkClear }) {
31067
31113
  return /* @__PURE__ */ jsx66(
31068
31114
  TokenInputScreen,
31069
31115
  {
31116
+ mode: target,
31070
31117
  initialPath: importDefaults.tokenFile,
31071
31118
  onConfirm: (tokensPath) => answer({ tokensPath }),
31072
31119
  onBack: () => goBackFrom("token-file")