@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/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
 
3395
3441
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
@@ -18046,7 +18092,7 @@ function PathValidationScreen({
18046
18092
  }) {
18047
18093
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
18048
18094
  const [scan, setScan] = useState7();
18049
- useEffect6(() => {
18095
+ useEffect7(() => {
18050
18096
  setScan(scanFiles(resolvedPath));
18051
18097
  }, [resolvedPath]);
18052
18098
  const phase = phaseOf(scan);
@@ -18073,7 +18119,7 @@ function PathValidationScreen({
18073
18119
  }
18074
18120
 
18075
18121
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
18076
- import { useRef as useRef4, useState as useState9 } from "react";
18122
+ import { useRef as useRef5, useState as useState9 } from "react";
18077
18123
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
18078
18124
 
18079
18125
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
@@ -18325,7 +18371,7 @@ function CredentialsScreen({
18325
18371
  validate: validate3 = validateCredentials,
18326
18372
  tokensOnly = false
18327
18373
  }) {
18328
- const initialValues = useRef4(
18374
+ const initialValues = useRef5(
18329
18375
  normalize({
18330
18376
  spaceId: initial.spaceId ?? "",
18331
18377
  environmentId: initial.environmentId || "master",
@@ -18706,7 +18752,7 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
18706
18752
  init_config();
18707
18753
 
18708
18754
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18709
- import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
18755
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
18710
18756
 
18711
18757
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
18712
18758
  import { mkdir as mkdir8 } from "node:fs/promises";
@@ -18962,8 +19008,8 @@ async function resolveSelectionPrompt(overrides) {
18962
19008
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18963
19009
  function useExtraction(input) {
18964
19010
  const [state2, setState] = useState11();
18965
- const current = useRef5();
18966
- useEffect7(() => {
19011
+ const current = useRef6();
19012
+ useEffect8(() => {
18967
19013
  current.current = input;
18968
19014
  if (!input) {
18969
19015
  setState(void 0);
@@ -18989,7 +19035,7 @@ function useExtraction(input) {
18989
19035
  }
18990
19036
 
18991
19037
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18992
- import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
19038
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
18993
19039
 
18994
19040
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
18995
19041
  var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
@@ -19023,8 +19069,8 @@ async function runTokensOnly(input, deps = realDeps2) {
19023
19069
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
19024
19070
  function useTokensOnly(input) {
19025
19071
  const [state2, setState] = useState12();
19026
- const current = useRef6();
19027
- useEffect8(() => {
19072
+ const current = useRef7();
19073
+ useEffect9(() => {
19028
19074
  current.current = input;
19029
19075
  if (!input) {
19030
19076
  setState(void 0);
@@ -20154,7 +20200,7 @@ import React11 from "react";
20154
20200
  import { Box as Box23, Text as Text24 } from "ink";
20155
20201
 
20156
20202
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
20157
- import { useLayoutEffect, useRef as useRef7 } from "react";
20203
+ import { useLayoutEffect, useRef as useRef8 } from "react";
20158
20204
  import { useStdin } from "ink";
20159
20205
  function parseInput(data) {
20160
20206
  const isShiftTab = data === "\x1B[Z";
@@ -20217,7 +20263,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
20217
20263
  }
20218
20264
  function useImmediateInput(handler, enabled = true) {
20219
20265
  const { stdin, setRawMode } = useStdin();
20220
- const handlerRef = useRef7(handler);
20266
+ const handlerRef = useRef8(handler);
20221
20267
  handlerRef.current = handler;
20222
20268
  useLayoutEffect(() => {
20223
20269
  if (!enabled) return;
@@ -20228,7 +20274,7 @@ function useImmediateInput(handler, enabled = true) {
20228
20274
 
20229
20275
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
20230
20276
  import { useStdout as useStdout2 } from "ink";
20231
- import { useEffect as useEffect9, useState as useState13 } from "react";
20277
+ import { useEffect as useEffect10, useState as useState13 } from "react";
20232
20278
  function readTerminalSize(stdout) {
20233
20279
  return {
20234
20280
  columns: stdout?.columns ?? 80,
@@ -20238,7 +20284,7 @@ function readTerminalSize(stdout) {
20238
20284
  function useTerminalSize() {
20239
20285
  const { stdout } = useStdout2();
20240
20286
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
20241
- useEffect9(() => {
20287
+ useEffect10(() => {
20242
20288
  const updateSize = () => setSize(readTerminalSize(stdout));
20243
20289
  stdout?.on("resize", updateSize);
20244
20290
  updateSize();
@@ -20421,7 +20467,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
20421
20467
  }
20422
20468
 
20423
20469
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
20424
- import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
20470
+ import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
20425
20471
 
20426
20472
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
20427
20473
  var TWO_COLUMN_MIN_WIDTH = 100;
@@ -21157,8 +21203,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21157
21203
  for (const p of cycleParticipants) seed.add(p);
21158
21204
  return seed;
21159
21205
  });
21160
- const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
21161
- useEffect10(() => {
21206
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
21207
+ useEffect11(() => {
21162
21208
  if (seededGroupsRef.current) return;
21163
21209
  if (closures.size === 0 && cycleParticipants.size === 0) return;
21164
21210
  seededGroupsRef.current = true;
@@ -21249,7 +21295,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21249
21295
  entryCount: 0
21250
21296
  });
21251
21297
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
21252
- useEffect10(() => {
21298
+ useEffect11(() => {
21253
21299
  setNav((prev) => {
21254
21300
  const maxIdx = Math.max(0, visibleRows.length - 1);
21255
21301
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -21724,7 +21770,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
21724
21770
  }
21725
21771
 
21726
21772
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
21727
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
21773
+ import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
21728
21774
 
21729
21775
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
21730
21776
  async function checkGenerationCache(input) {
@@ -21771,9 +21817,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
21771
21817
  function useScopeGateFlow(input, deps = realDeps3) {
21772
21818
  const sessionId = input?.sessionId;
21773
21819
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
21774
- const cacheCheck = useRef9(void 0);
21820
+ const cacheCheck = useRef10(void 0);
21775
21821
  const [confirmed, setConfirmed] = useState17();
21776
- useEffect11(() => {
21822
+ useEffect12(() => {
21777
21823
  if (!input || !loaded?.ok || cacheCheck.current) return;
21778
21824
  cacheCheck.current = deps.checkCache(input.cache);
21779
21825
  }, [input, loaded]);
@@ -21840,7 +21886,7 @@ function GenerationScreen({
21840
21886
  }
21841
21887
 
21842
21888
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21843
- import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
21889
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
21844
21890
 
21845
21891
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
21846
21892
  import { resolve as resolve25 } from "node:path";
@@ -22005,8 +22051,8 @@ function applyProgressEvent2(event, previous, total) {
22005
22051
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
22006
22052
  function useGeneration(input) {
22007
22053
  const [state2, setState] = useState18();
22008
- const current = useRef10();
22009
- useEffect12(() => {
22054
+ const current = useRef11();
22055
+ useEffect13(() => {
22010
22056
  current.current = input;
22011
22057
  if (!input) {
22012
22058
  setState(void 0);
@@ -22487,7 +22533,7 @@ function PreviewValidationErrorScreen({
22487
22533
  }
22488
22534
 
22489
22535
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
22490
- import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
22536
+ import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
22491
22537
  import figures8 from "figures";
22492
22538
 
22493
22539
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
@@ -22748,7 +22794,7 @@ function enumerateCycleBreaks(cycle, components) {
22748
22794
  import { Box as Box32, Text as Text34 } from "ink";
22749
22795
 
22750
22796
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
22751
- import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22797
+ import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22752
22798
  import figures6 from "figures";
22753
22799
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
22754
22800
 
@@ -24306,7 +24352,7 @@ function FieldEditor({
24306
24352
  }
24307
24353
  return Math.max(start + 1, end2);
24308
24354
  };
24309
- useEffect13(() => {
24355
+ useEffect14(() => {
24310
24356
  if (focusLevel === "field" || selectedRowIdx < 0) return;
24311
24357
  setListScrollStart((previous) => {
24312
24358
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -25378,7 +25424,7 @@ function finalizeReviewSession(extractSessionId, components) {
25378
25424
  }
25379
25425
 
25380
25426
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
25381
- import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
25427
+ import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
25382
25428
 
25383
25429
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
25384
25430
  var DEFAULT_MAX_DEPTH = 50;
@@ -25434,7 +25480,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
25434
25480
  }
25435
25481
 
25436
25482
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
25437
- import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
25483
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
25438
25484
 
25439
25485
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
25440
25486
  var TimeoutError = class extends Error {
@@ -25592,9 +25638,9 @@ function useFinalizePreview(opts) {
25592
25638
  const [status, setStatus] = useState20("idle");
25593
25639
  const [removed, setRemoved] = useState20([]);
25594
25640
  const [scrollOffset, setScrollOffset] = useState20(0);
25595
- const generationRef = useRef11(0);
25641
+ const generationRef = useRef12(0);
25596
25642
  const acceptedKey = [...acceptedKeys].sort().join("\0");
25597
- useEffect14(() => {
25643
+ useEffect15(() => {
25598
25644
  if (!open) {
25599
25645
  setStatus("idle");
25600
25646
  setRemoved([]);
@@ -25657,7 +25703,7 @@ function useReviewSession({
25657
25703
  }));
25658
25704
  return { result, catalog };
25659
25705
  }, [loadSession, tokensPath]);
25660
- useEffect15(() => {
25706
+ useEffect16(() => {
25661
25707
  let disposed = false;
25662
25708
  void (async () => {
25663
25709
  try {
@@ -25710,7 +25756,7 @@ function useReviewSession({
25710
25756
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25711
25757
  const [reviewMetadata, setReviewMetadata] = useState21(null);
25712
25758
  const [componentRationale, setComponentRationale] = useState21(null);
25713
- useEffect15(() => {
25759
+ useEffect16(() => {
25714
25760
  const current = components[selectedIdx];
25715
25761
  if (!current) {
25716
25762
  setReviewMetadata(null);
@@ -25740,9 +25786,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25740
25786
  return { reviewMetadata, componentRationale };
25741
25787
  }
25742
25788
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
25743
- const historyRef = useRef12(null);
25744
- const historySeededRef = useRef12(false);
25745
- useEffect15(() => {
25789
+ const historyRef = useRef13(null);
25790
+ const historySeededRef = useRef13(false);
25791
+ useEffect16(() => {
25746
25792
  if (loading || historySeededRef.current) return;
25747
25793
  historySeededRef.current = true;
25748
25794
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -25793,7 +25839,7 @@ function useReviewFinalize({
25793
25839
  }
25794
25840
 
25795
25841
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
25796
- import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
25842
+ import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
25797
25843
 
25798
25844
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
25799
25845
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -25844,9 +25890,9 @@ function useReviewEditor({
25844
25890
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
25845
25891
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
25846
25892
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
25847
- const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
25848
- const pendingGRef = useRef13(false);
25849
- useEffect16(() => {
25893
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
25894
+ const pendingGRef = useRef14(false);
25895
+ useEffect17(() => {
25850
25896
  setTokenReviewRow(0);
25851
25897
  setTokenReviewEditing(false);
25852
25898
  setTokenReviewEditCursor(0);
@@ -26258,7 +26304,7 @@ function handleJsonPanelInput(input, key, state2) {
26258
26304
  }
26259
26305
 
26260
26306
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
26261
- import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
26307
+ import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
26262
26308
 
26263
26309
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
26264
26310
  function applyPreviewAnnotations(preview, localNames) {
@@ -26293,25 +26339,25 @@ function applyPreviewAnnotations(preview, localNames) {
26293
26339
  }
26294
26340
 
26295
26341
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
26296
- import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
26342
+ import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
26297
26343
  var DEFAULT_DEBOUNCE_MS = 500;
26298
26344
  function useLivePreview(opts) {
26299
26345
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
26300
26346
  const [status, setStatus] = useState24("idle");
26301
26347
  const [disabled, setDisabled] = useState24(false);
26302
- const timerRef = useRef14(null);
26303
- const generationRef = useRef14(0);
26304
- const latestRef = useRef14(0);
26305
- const inflightRef = useRef14(0);
26306
- const optsRef = useRef14(opts);
26307
- useEffect17(() => {
26348
+ const timerRef = useRef15(null);
26349
+ const generationRef = useRef15(0);
26350
+ const latestRef = useRef15(0);
26351
+ const inflightRef = useRef15(0);
26352
+ const optsRef = useRef15(opts);
26353
+ useEffect18(() => {
26308
26354
  optsRef.current = opts;
26309
26355
  });
26310
- const disabledRef = useRef14(disabled);
26311
- useEffect17(() => {
26356
+ const disabledRef = useRef15(disabled);
26357
+ useEffect18(() => {
26312
26358
  disabledRef.current = disabled;
26313
26359
  }, [disabled]);
26314
- useEffect17(() => {
26360
+ useEffect18(() => {
26315
26361
  return () => {
26316
26362
  if (timerRef.current) {
26317
26363
  clearTimeout(timerRef.current);
@@ -26425,13 +26471,13 @@ function useReviewPreview({
26425
26471
  deleteAllComponents
26426
26472
  });
26427
26473
  const [spinnerTick, setSpinnerTick] = useState25(0);
26428
- useEffect18(() => {
26474
+ useEffect19(() => {
26429
26475
  if (livePreviewHook.status !== "running") return;
26430
26476
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
26431
26477
  return () => clearInterval(id);
26432
26478
  }, [livePreviewHook.status]);
26433
26479
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
26434
- useEffect18(() => {
26480
+ useEffect19(() => {
26435
26481
  if (loading) return;
26436
26482
  if (!livePreview) return;
26437
26483
  if (components.length === 0) return;
@@ -26744,7 +26790,7 @@ function GenerateReviewStepView({
26744
26790
  setFinalizeError
26745
26791
  } = reviewSurface;
26746
26792
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
26747
- const removedBannerDefaultedRef = useRef15(false);
26793
+ const removedBannerDefaultedRef = useRef16(false);
26748
26794
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
26749
26795
  const [cyclesCursor, setCyclesCursor] = useState26(0);
26750
26796
  const cyclePanel = useOverlayPanel({
@@ -26764,7 +26810,7 @@ function GenerateReviewStepView({
26764
26810
  const [breakCursor, setBreakCursor] = useState26(0);
26765
26811
  const [breakConfirm, setBreakConfirm] = useState26(false);
26766
26812
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
26767
- const seededGroupsRef = useRef15(false);
26813
+ const seededGroupsRef = useRef16(false);
26768
26814
  const {
26769
26815
  searchOpen,
26770
26816
  setSearchOpen,
@@ -26788,7 +26834,7 @@ function GenerateReviewStepView({
26788
26834
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
26789
26835
  const [autoRejected, setAutoRejected] = useState26([]);
26790
26836
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
26791
- const autoRejectFiredRef = useRef15(false);
26837
+ const autoRejectFiredRef = useRef16(false);
26792
26838
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
26793
26839
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
26794
26840
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -26851,7 +26897,7 @@ function GenerateReviewStepView({
26851
26897
  [components]
26852
26898
  );
26853
26899
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
26854
- useEffect19(() => {
26900
+ useEffect20(() => {
26855
26901
  if (seededGroupsRef.current) return;
26856
26902
  if (closures.size === 0 && slotCycles.length === 0) return;
26857
26903
  seededGroupsRef.current = true;
@@ -26878,7 +26924,7 @@ function GenerateReviewStepView({
26878
26924
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
26879
26925
  }));
26880
26926
  }, [slotCycles, cycleView]);
26881
- useEffect19(() => {
26927
+ useEffect20(() => {
26882
26928
  const decision = computeAutoRejectDecision({
26883
26929
  loading,
26884
26930
  autoRejectFired: autoRejectFiredRef.current,
@@ -26921,8 +26967,8 @@ function GenerateReviewStepView({
26921
26967
  }),
26922
26968
  applySnapshot: applyHistorySnapshot
26923
26969
  });
26924
- const autoRejectPushedRef = useRef15(false);
26925
- useEffect19(() => {
26970
+ const autoRejectPushedRef = useRef16(false);
26971
+ useEffect20(() => {
26926
26972
  if (loading) return;
26927
26973
  if (!historySeededRef.current) return;
26928
26974
  if (!autoRejectFiredRef.current) return;
@@ -27006,7 +27052,7 @@ function GenerateReviewStepView({
27006
27052
  const panelHeight = leftPanelHeight + 2;
27007
27053
  const panelContentHeight = Math.max(1, panelHeight - 3);
27008
27054
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
27009
- useEffect19(() => {
27055
+ useEffect20(() => {
27010
27056
  if (selectableRowPositions.length === 0) return;
27011
27057
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
27012
27058
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -27951,10 +27997,10 @@ function normalizePath(input) {
27951
27997
  }
27952
27998
 
27953
27999
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
27954
- import { useEffect as useEffect20, useState as useState27 } from "react";
28000
+ import { useEffect as useEffect21, useState as useState27 } from "react";
27955
28001
  function useBlinkingCursor() {
27956
28002
  const [visible, setVisible] = useState27(true);
27957
- useEffect20(() => {
28003
+ useEffect21(() => {
27958
28004
  const interval = setInterval(() => setVisible((current) => !current), 500);
27959
28005
  return () => clearInterval(interval);
27960
28006
  }, []);
@@ -28070,12 +28116,12 @@ function countedThings({ components, tokens }, counts = {}) {
28070
28116
  }
28071
28117
 
28072
28118
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
28073
- import { useEffect as useEffect21, useState as useState29 } from "react";
28119
+ import { useEffect as useEffect22, useState as useState29 } from "react";
28074
28120
  import { Spinner as Spinner2 } from "@inkjs/ui";
28075
28121
  import { jsx as jsx53 } from "react/jsx-runtime";
28076
28122
  function useTimedSpinner() {
28077
28123
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
28078
- useEffect21(() => {
28124
+ useEffect22(() => {
28079
28125
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
28080
28126
  return () => {
28081
28127
  clearInterval(timer);
@@ -28133,7 +28179,7 @@ function PushingStep({ progress, produced, counts }) {
28133
28179
  }
28134
28180
 
28135
28181
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
28136
- import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
28182
+ import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
28137
28183
  import { Box as Box44, Text as Text46 } from "ink";
28138
28184
 
28139
28185
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -28528,7 +28574,7 @@ function WizardPreviewStep({
28528
28574
  const activeLines = diffExpanded ? diffLines : summaryLines;
28529
28575
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
28530
28576
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
28531
- useEffect22(() => {
28577
+ useEffect23(() => {
28532
28578
  setScrollOffset((previous) => Math.min(previous, maxScroll));
28533
28579
  }, [maxScroll]);
28534
28580
  useImmediateInput((input, key) => {
@@ -28746,7 +28792,7 @@ function FlowScreen({
28746
28792
  }
28747
28793
 
28748
28794
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
28749
- import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
28795
+ import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
28750
28796
 
28751
28797
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28752
28798
  import { appendFileSync, writeFileSync } from "node:fs";
@@ -29488,7 +29534,7 @@ function createFlowController(start, deps) {
29488
29534
 
29489
29535
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
29490
29536
  function useFlow(start, options = {}) {
29491
- const controller = useRef16();
29537
+ const controller = useRef17();
29492
29538
  if (start && !controller.current) {
29493
29539
  try {
29494
29540
  startWizardLog();
@@ -29505,14 +29551,14 @@ function useFlow(start, options = {}) {
29505
29551
  (listener) => current?.subscribe(listener) ?? (() => void 0),
29506
29552
  () => current?.getState()
29507
29553
  );
29508
- useEffect23(() => {
29554
+ useEffect24(() => {
29509
29555
  if (!start) controller.current = void 0;
29510
29556
  }, [start]);
29511
29557
  return current && state2 ? { controller: current, state: state2 } : void 0;
29512
29558
  }
29513
29559
 
29514
29560
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
29515
- import { useEffect as useEffect24, useState as useState31 } from "react";
29561
+ import { useEffect as useEffect25, useState as useState31 } from "react";
29516
29562
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
29517
29563
  init_debug_store();
29518
29564
 
@@ -29586,7 +29632,7 @@ function Section({ title, rows }) {
29586
29632
  }
29587
29633
  function HelpScreen({ onDone }) {
29588
29634
  const [info, setInfo] = useState31();
29589
- useEffect24(() => {
29635
+ useEffect25(() => {
29590
29636
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
29591
29637
  void readHelpInfo().then(setInfo);
29592
29638
  }, []);
@@ -29683,7 +29729,7 @@ import { useState as useState36 } from "react";
29683
29729
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
29684
29730
 
29685
29731
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
29686
- import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
29732
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
29687
29733
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
29688
29734
  init_debug_store();
29689
29735
 
@@ -30012,7 +30058,7 @@ async function writeAgentConfig(config) {
30012
30058
  }
30013
30059
 
30014
30060
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
30015
- import { useEffect as useEffect25, useState as useState33 } from "react";
30061
+ import { useEffect as useEffect26, useState as useState33 } from "react";
30016
30062
  import { Box as Box48, Text as Text50 } from "ink";
30017
30063
 
30018
30064
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
@@ -30075,7 +30121,7 @@ function AgentDetail({
30075
30121
  const [testing, setTesting] = useState33(false);
30076
30122
  const [notice, setNotice] = useState33(null);
30077
30123
  const [checks, setChecks] = useState33(void 0);
30078
- useEffect25(() => {
30124
+ useEffect26(() => {
30079
30125
  let active = true;
30080
30126
  setChecks(void 0);
30081
30127
  const timer = setTimeout(() => {
@@ -30160,7 +30206,7 @@ function AgentsScreen({ onDone }) {
30160
30206
  const [saving, setSaving] = useState34(false);
30161
30207
  const [loadError, setLoadError] = useState34(null);
30162
30208
  const [checks, setChecks] = useState34({});
30163
- const visit = useRef17({
30209
+ const visit = useRef18({
30164
30210
  trail: createTrail(),
30165
30211
  before: void 0,
30166
30212
  environment: void 0,
@@ -30173,7 +30219,7 @@ function AgentsScreen({ onDone }) {
30173
30219
  );
30174
30220
  }
30175
30221
  };
30176
- useEffect26(() => {
30222
+ useEffect27(() => {
30177
30223
  readAgentConfig().then((loaded) => {
30178
30224
  setConfig(loaded);
30179
30225
  inspectAll(loaded);
@@ -30350,7 +30396,7 @@ function AgentsScreen({ onDone }) {
30350
30396
  }
30351
30397
 
30352
30398
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
30353
- import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
30399
+ import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
30354
30400
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
30355
30401
  init_debug_store();
30356
30402
 
@@ -30408,14 +30454,14 @@ function ProjectScreen({ onDone }) {
30408
30454
  const [saving, setSaving] = useState35(false);
30409
30455
  const [notice, setNotice] = useState35(null);
30410
30456
  const [loadError, setLoadError] = useState35(null);
30411
- const visit = useRef18({
30457
+ const visit = useRef19({
30412
30458
  trail: createTrail(),
30413
30459
  before: void 0,
30414
30460
  persisted: void 0,
30415
30461
  error: ""
30416
30462
  }).current;
30417
30463
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
30418
- useEffect27(() => {
30464
+ useEffect28(() => {
30419
30465
  readCredentials().then((cfg) => {
30420
30466
  setConfig(cfg);
30421
30467
  visit.before = snapshotOf(cfg);
@@ -30567,7 +30613,7 @@ function ConfigurationScreen({ onDone }) {
30567
30613
  }
30568
30614
 
30569
30615
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
30570
- import { useEffect as useEffect28, useState as useState37 } from "react";
30616
+ import { useEffect as useEffect29, useState as useState37 } from "react";
30571
30617
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
30572
30618
 
30573
30619
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -30591,7 +30637,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
30591
30637
  function OptInAnalyticsScreen({ onDone }) {
30592
30638
  const [loading, setLoading] = useState37(true);
30593
30639
  const [enabled, setEnabled] = useState37(true);
30594
- useEffect28(() => {
30640
+ useEffect29(() => {
30595
30641
  readAnalyticsSetting().then((setting) => {
30596
30642
  setEnabled(setting.enabled);
30597
30643
  setLoading(false);
@@ -30645,7 +30691,7 @@ function OptInAnalyticsScreen({ onDone }) {
30645
30691
  }
30646
30692
 
30647
30693
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
30648
- import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
30694
+ import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
30649
30695
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
30650
30696
  init_debug_mode_store();
30651
30697
  init_debug_store();
@@ -30662,8 +30708,8 @@ function DebugModeScreen({ onDone }) {
30662
30708
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
30663
30709
  );
30664
30710
  const [notice, setNotice] = useState38(null);
30665
- const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
30666
- useEffect29(() => {
30711
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
30712
+ useEffect30(() => {
30667
30713
  readDebugModeSetting().then((loaded) => {
30668
30714
  setSetting(loaded);
30669
30715
  setPending(loaded.retentionDays);
@@ -30818,7 +30864,7 @@ function App({ importOptions, inkClear }) {
30818
30864
  const [flowStart, setFlowStart] = useState39();
30819
30865
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
30820
30866
  const [importDefaults, setImportDefaults] = useState39();
30821
- useEffect30(() => {
30867
+ useEffect31(() => {
30822
30868
  if (screen !== "import") {
30823
30869
  setImportDefaults(void 0);
30824
30870
  return;
@@ -30891,7 +30937,7 @@ function App({ importOptions, inkClear }) {
30891
30937
  }
30892
30938
  });
30893
30939
  };
30894
- useEffect30(() => {
30940
+ useEffect31(() => {
30895
30941
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
30896
30942
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
30897
30943
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -30913,12 +30959,12 @@ function App({ importOptions, inkClear }) {
30913
30959
  }
30914
30960
  });
30915
30961
  }, [tokensOnly, tokensOnlyRun]);
30916
- useEffect30(() => {
30962
+ useEffect31(() => {
30917
30963
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
30918
30964
  setExtractionRun(void 0);
30919
30965
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
30920
30966
  }, [extraction, extractionRun]);
30921
- useEffect30(() => {
30967
+ useEffect31(() => {
30922
30968
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
30923
30969
  const { extraction: produced, input, generatePromptPath } = scopeRun;
30924
30970
  setGenerationInput({
@@ -30936,7 +30982,7 @@ function App({ importOptions, inkClear }) {
30936
30982
  ...generatePromptPath ? { generatePromptPath } : {}
30937
30983
  });
30938
30984
  }, [scopeFlow, scopeRun, generationInput]);
30939
- useEffect30(() => {
30985
+ useEffect31(() => {
30940
30986
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
30941
30987
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
30942
30988
  inkClear();
@@ -31029,6 +31075,7 @@ function App({ importOptions, inkClear }) {
31029
31075
  return /* @__PURE__ */ jsx66(
31030
31076
  TokenInputScreen,
31031
31077
  {
31078
+ mode: target,
31032
31079
  initialPath: importDefaults.tokenFile,
31033
31080
  onConfirm: (tokensPath) => answer({ tokensPath }),
31034
31081
  onBack: () => goBackFrom("token-file")