@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/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 useEffect29, 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";
@@ -3158,8 +3158,9 @@ function PreflightScreen({ onChoose, onQuit }) {
3158
3158
  }
3159
3159
 
3160
3160
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
3161
- import { useState as useState5 } from "react";
3161
+ import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
3162
3162
  import { Box as Box10, Text as Text10 } from "ink";
3163
+ init_debug_store();
3163
3164
 
3164
3165
  // packages/experience-design-system-cli/src/tui/shared/components/ClearableTextInput.tsx
3165
3166
  import { useRef as useRef2 } from "react";
@@ -3216,12 +3217,46 @@ function useWelcomeControls(onQuit) {
3216
3217
 
3217
3218
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
3218
3219
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3219
- function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
3220
+ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
3220
3221
  const [projectPath, setProjectPath] = useState5(initialPath);
3221
- useWelcomeControls(onQuit);
3222
+ const visit = useRef3({ emptySubmits: 0 }).current;
3223
+ useEffect5(() => {
3224
+ startDebugRun({
3225
+ flow: "import/welcome",
3226
+ step: "01-welcome",
3227
+ menuOption: "Welcome",
3228
+ inputs: { import_mode: mode, initial_path: initialPath }
3229
+ });
3230
+ }, []);
3231
+ const quit = () => {
3232
+ void finishDebugRun({
3233
+ outputs: {
3234
+ project_path: null,
3235
+ typed_something: toProjectPath(projectPath) !== null,
3236
+ empty_submits: visit.emptySubmits
3237
+ },
3238
+ status: "success",
3239
+ exitMethod: "discarded"
3240
+ });
3241
+ onQuit();
3242
+ };
3243
+ useWelcomeControls(quit);
3222
3244
  const submit = (value) => {
3223
3245
  const path5 = toProjectPath(value);
3224
- if (path5) onContinue(path5);
3246
+ if (!path5) {
3247
+ visit.emptySubmits += 1;
3248
+ return;
3249
+ }
3250
+ void finishDebugRun({
3251
+ outputs: {
3252
+ project_path: path5,
3253
+ changed_from_initial: path5 !== initialPath.trim(),
3254
+ empty_submits: visit.emptySubmits
3255
+ },
3256
+ status: "success",
3257
+ exitMethod: "saved"
3258
+ });
3259
+ onContinue(path5);
3225
3260
  };
3226
3261
  return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
3227
3262
  /* @__PURE__ */ jsx11(StepHeader, { step: "setup" }),
@@ -3240,8 +3275,9 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
3240
3275
  }
3241
3276
 
3242
3277
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
3243
- import { useState as useState6 } from "react";
3278
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
3244
3279
  import { Box as Box11, Text as Text11 } from "ink";
3280
+ init_debug_store();
3245
3281
 
3246
3282
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
3247
3283
  import { useInput as useInput8 } from "ink";
@@ -3308,23 +3344,68 @@ function validateTokenPath(rawPath) {
3308
3344
 
3309
3345
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
3310
3346
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
3311
- function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3347
+ var MAX_LOGGED_ATTEMPTS = 10;
3348
+ function TokenInputScreen({
3349
+ mode,
3350
+ onConfirm,
3351
+ onBack,
3352
+ initialPath = ""
3353
+ }) {
3312
3354
  const [tokenPath, setTokenPath] = useState6(initialPath);
3313
3355
  const [failure, setFailure] = useState6(null);
3314
- 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);
3315
3374
  const change = (value) => {
3316
3375
  setTokenPath(value);
3317
3376
  setFailure(null);
3318
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
+ };
3319
3388
  const submit = (value) => {
3320
3389
  const rawPath = toTokenPath(value);
3321
3390
  if (!rawPath) {
3322
- setFailure({ error: "Enter the path to your token file." });
3391
+ reject("", { error: "Enter the path to your token file." });
3323
3392
  return;
3324
3393
  }
3325
3394
  const check = validateTokenPath(rawPath);
3326
- if (check.ok) onConfirm(check.path);
3327
- 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);
3328
3409
  };
3329
3410
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
3330
3411
  /* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
@@ -3354,7 +3435,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3354
3435
  }
3355
3436
 
3356
3437
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
3357
- import { useEffect as useEffect5, useMemo, useState as useState7 } from "react";
3438
+ import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
3358
3439
  import { Box as Box12, Text as Text12 } from "ink";
3359
3440
 
3360
3441
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
@@ -18011,7 +18092,7 @@ function PathValidationScreen({
18011
18092
  }) {
18012
18093
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
18013
18094
  const [scan, setScan] = useState7();
18014
- useEffect5(() => {
18095
+ useEffect7(() => {
18015
18096
  setScan(scanFiles(resolvedPath));
18016
18097
  }, [resolvedPath]);
18017
18098
  const phase = phaseOf(scan);
@@ -18038,7 +18119,7 @@ function PathValidationScreen({
18038
18119
  }
18039
18120
 
18040
18121
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
18041
- import { useRef as useRef3, useState as useState9 } from "react";
18122
+ import { useRef as useRef5, useState as useState9 } from "react";
18042
18123
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
18043
18124
 
18044
18125
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
@@ -18290,7 +18371,7 @@ function CredentialsScreen({
18290
18371
  validate: validate3 = validateCredentials,
18291
18372
  tokensOnly = false
18292
18373
  }) {
18293
- const initialValues = useRef3(
18374
+ const initialValues = useRef5(
18294
18375
  normalize({
18295
18376
  spaceId: initial.spaceId ?? "",
18296
18377
  environmentId: initial.environmentId || "master",
@@ -18671,7 +18752,7 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
18671
18752
  init_config();
18672
18753
 
18673
18754
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18674
- import { useEffect as useEffect6, useRef as useRef4, useState as useState11 } from "react";
18755
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
18675
18756
 
18676
18757
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
18677
18758
  import { mkdir as mkdir8 } from "node:fs/promises";
@@ -18927,8 +19008,8 @@ async function resolveSelectionPrompt(overrides) {
18927
19008
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18928
19009
  function useExtraction(input) {
18929
19010
  const [state2, setState] = useState11();
18930
- const current = useRef4();
18931
- useEffect6(() => {
19011
+ const current = useRef6();
19012
+ useEffect8(() => {
18932
19013
  current.current = input;
18933
19014
  if (!input) {
18934
19015
  setState(void 0);
@@ -18954,7 +19035,7 @@ function useExtraction(input) {
18954
19035
  }
18955
19036
 
18956
19037
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18957
- import { useEffect as useEffect7, useRef as useRef5, useState as useState12 } from "react";
19038
+ import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
18958
19039
 
18959
19040
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
18960
19041
  var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
@@ -18988,8 +19069,8 @@ async function runTokensOnly(input, deps = realDeps2) {
18988
19069
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18989
19070
  function useTokensOnly(input) {
18990
19071
  const [state2, setState] = useState12();
18991
- const current = useRef5();
18992
- useEffect7(() => {
19072
+ const current = useRef7();
19073
+ useEffect9(() => {
18993
19074
  current.current = input;
18994
19075
  if (!input) {
18995
19076
  setState(void 0);
@@ -20119,7 +20200,7 @@ import React11 from "react";
20119
20200
  import { Box as Box23, Text as Text24 } from "ink";
20120
20201
 
20121
20202
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
20122
- import { useLayoutEffect, useRef as useRef6 } from "react";
20203
+ import { useLayoutEffect, useRef as useRef8 } from "react";
20123
20204
  import { useStdin } from "ink";
20124
20205
  function parseInput(data) {
20125
20206
  const isShiftTab = data === "\x1B[Z";
@@ -20182,7 +20263,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
20182
20263
  }
20183
20264
  function useImmediateInput(handler, enabled = true) {
20184
20265
  const { stdin, setRawMode } = useStdin();
20185
- const handlerRef = useRef6(handler);
20266
+ const handlerRef = useRef8(handler);
20186
20267
  handlerRef.current = handler;
20187
20268
  useLayoutEffect(() => {
20188
20269
  if (!enabled) return;
@@ -20193,7 +20274,7 @@ function useImmediateInput(handler, enabled = true) {
20193
20274
 
20194
20275
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
20195
20276
  import { useStdout as useStdout2 } from "ink";
20196
- import { useEffect as useEffect8, useState as useState13 } from "react";
20277
+ import { useEffect as useEffect10, useState as useState13 } from "react";
20197
20278
  function readTerminalSize(stdout) {
20198
20279
  return {
20199
20280
  columns: stdout?.columns ?? 80,
@@ -20203,7 +20284,7 @@ function readTerminalSize(stdout) {
20203
20284
  function useTerminalSize() {
20204
20285
  const { stdout } = useStdout2();
20205
20286
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
20206
- useEffect8(() => {
20287
+ useEffect10(() => {
20207
20288
  const updateSize = () => setSize(readTerminalSize(stdout));
20208
20289
  stdout?.on("resize", updateSize);
20209
20290
  updateSize();
@@ -20386,7 +20467,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
20386
20467
  }
20387
20468
 
20388
20469
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
20389
- import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef7, useState as useState16 } from "react";
20470
+ import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
20390
20471
 
20391
20472
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
20392
20473
  var TWO_COLUMN_MIN_WIDTH = 100;
@@ -21122,8 +21203,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21122
21203
  for (const p of cycleParticipants) seed.add(p);
21123
21204
  return seed;
21124
21205
  });
21125
- const seededGroupsRef = useRef7(closures.size > 0 || cycleParticipants.size > 0);
21126
- useEffect9(() => {
21206
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
21207
+ useEffect11(() => {
21127
21208
  if (seededGroupsRef.current) return;
21128
21209
  if (closures.size === 0 && cycleParticipants.size === 0) return;
21129
21210
  seededGroupsRef.current = true;
@@ -21214,7 +21295,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21214
21295
  entryCount: 0
21215
21296
  });
21216
21297
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
21217
- useEffect9(() => {
21298
+ useEffect11(() => {
21218
21299
  setNav((prev) => {
21219
21300
  const maxIdx = Math.max(0, visibleRows.length - 1);
21220
21301
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -21689,7 +21770,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
21689
21770
  }
21690
21771
 
21691
21772
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
21692
- import { useEffect as useEffect10, useMemo as useMemo5, useRef as useRef8, useState as useState17 } from "react";
21773
+ import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
21693
21774
 
21694
21775
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
21695
21776
  async function checkGenerationCache(input) {
@@ -21736,9 +21817,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
21736
21817
  function useScopeGateFlow(input, deps = realDeps3) {
21737
21818
  const sessionId = input?.sessionId;
21738
21819
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
21739
- const cacheCheck = useRef8(void 0);
21820
+ const cacheCheck = useRef10(void 0);
21740
21821
  const [confirmed, setConfirmed] = useState17();
21741
- useEffect10(() => {
21822
+ useEffect12(() => {
21742
21823
  if (!input || !loaded?.ok || cacheCheck.current) return;
21743
21824
  cacheCheck.current = deps.checkCache(input.cache);
21744
21825
  }, [input, loaded]);
@@ -21805,7 +21886,7 @@ function GenerationScreen({
21805
21886
  }
21806
21887
 
21807
21888
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21808
- import { useEffect as useEffect11, useRef as useRef9, useState as useState18 } from "react";
21889
+ import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
21809
21890
 
21810
21891
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
21811
21892
  import { resolve as resolve25 } from "node:path";
@@ -21970,8 +22051,8 @@ function applyProgressEvent2(event, previous, total) {
21970
22051
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21971
22052
  function useGeneration(input) {
21972
22053
  const [state2, setState] = useState18();
21973
- const current = useRef9();
21974
- useEffect11(() => {
22054
+ const current = useRef11();
22055
+ useEffect13(() => {
21975
22056
  current.current = input;
21976
22057
  if (!input) {
21977
22058
  setState(void 0);
@@ -22452,7 +22533,7 @@ function PreviewValidationErrorScreen({
22452
22533
  }
22453
22534
 
22454
22535
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
22455
- import { useCallback as useCallback5, useEffect as useEffect18, useMemo as useMemo6, useRef as useRef14, useState as useState26 } from "react";
22536
+ import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
22456
22537
  import figures8 from "figures";
22457
22538
 
22458
22539
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
@@ -22713,7 +22794,7 @@ function enumerateCycleBreaks(cycle, components) {
22713
22794
  import { Box as Box32, Text as Text34 } from "ink";
22714
22795
 
22715
22796
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
22716
- import React13, { useEffect as useEffect12, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22797
+ import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22717
22798
  import figures6 from "figures";
22718
22799
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
22719
22800
 
@@ -24271,7 +24352,7 @@ function FieldEditor({
24271
24352
  }
24272
24353
  return Math.max(start + 1, end2);
24273
24354
  };
24274
- useEffect12(() => {
24355
+ useEffect14(() => {
24275
24356
  if (focusLevel === "field" || selectedRowIdx < 0) return;
24276
24357
  setListScrollStart((previous) => {
24277
24358
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -25343,7 +25424,7 @@ function finalizeReviewSession(extractSessionId, components) {
25343
25424
  }
25344
25425
 
25345
25426
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
25346
- import { useCallback as useCallback2, useEffect as useEffect14, useRef as useRef11, useState as useState21 } from "react";
25427
+ import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
25347
25428
 
25348
25429
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
25349
25430
  var DEFAULT_MAX_DEPTH = 50;
@@ -25399,7 +25480,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
25399
25480
  }
25400
25481
 
25401
25482
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
25402
- import { useEffect as useEffect13, useRef as useRef10, useState as useState20 } from "react";
25483
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
25403
25484
 
25404
25485
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
25405
25486
  var TimeoutError = class extends Error {
@@ -25557,9 +25638,9 @@ function useFinalizePreview(opts) {
25557
25638
  const [status, setStatus] = useState20("idle");
25558
25639
  const [removed, setRemoved] = useState20([]);
25559
25640
  const [scrollOffset, setScrollOffset] = useState20(0);
25560
- const generationRef = useRef10(0);
25641
+ const generationRef = useRef12(0);
25561
25642
  const acceptedKey = [...acceptedKeys].sort().join("\0");
25562
- useEffect13(() => {
25643
+ useEffect15(() => {
25563
25644
  if (!open) {
25564
25645
  setStatus("idle");
25565
25646
  setRemoved([]);
@@ -25622,7 +25703,7 @@ function useReviewSession({
25622
25703
  }));
25623
25704
  return { result, catalog };
25624
25705
  }, [loadSession, tokensPath]);
25625
- useEffect14(() => {
25706
+ useEffect16(() => {
25626
25707
  let disposed = false;
25627
25708
  void (async () => {
25628
25709
  try {
@@ -25675,7 +25756,7 @@ function useReviewSession({
25675
25756
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25676
25757
  const [reviewMetadata, setReviewMetadata] = useState21(null);
25677
25758
  const [componentRationale, setComponentRationale] = useState21(null);
25678
- useEffect14(() => {
25759
+ useEffect16(() => {
25679
25760
  const current = components[selectedIdx];
25680
25761
  if (!current) {
25681
25762
  setReviewMetadata(null);
@@ -25705,9 +25786,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25705
25786
  return { reviewMetadata, componentRationale };
25706
25787
  }
25707
25788
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
25708
- const historyRef = useRef11(null);
25709
- const historySeededRef = useRef11(false);
25710
- useEffect14(() => {
25789
+ const historyRef = useRef13(null);
25790
+ const historySeededRef = useRef13(false);
25791
+ useEffect16(() => {
25711
25792
  if (loading || historySeededRef.current) return;
25712
25793
  historySeededRef.current = true;
25713
25794
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -25758,7 +25839,7 @@ function useReviewFinalize({
25758
25839
  }
25759
25840
 
25760
25841
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
25761
- import { useEffect as useEffect15, useRef as useRef12, useState as useState22 } from "react";
25842
+ import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
25762
25843
 
25763
25844
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
25764
25845
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -25809,9 +25890,9 @@ function useReviewEditor({
25809
25890
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
25810
25891
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
25811
25892
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
25812
- const tokenReviewSuggestedRef = useRef12(/* @__PURE__ */ new Map());
25813
- const pendingGRef = useRef12(false);
25814
- useEffect15(() => {
25893
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
25894
+ const pendingGRef = useRef14(false);
25895
+ useEffect17(() => {
25815
25896
  setTokenReviewRow(0);
25816
25897
  setTokenReviewEditing(false);
25817
25898
  setTokenReviewEditCursor(0);
@@ -26223,7 +26304,7 @@ function handleJsonPanelInput(input, key, state2) {
26223
26304
  }
26224
26305
 
26225
26306
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
26226
- import { useCallback as useCallback4, useEffect as useEffect17, useState as useState25 } from "react";
26307
+ import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
26227
26308
 
26228
26309
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
26229
26310
  function applyPreviewAnnotations(preview, localNames) {
@@ -26258,25 +26339,25 @@ function applyPreviewAnnotations(preview, localNames) {
26258
26339
  }
26259
26340
 
26260
26341
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
26261
- import { useCallback as useCallback3, useEffect as useEffect16, useRef as useRef13, useState as useState24 } from "react";
26342
+ import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
26262
26343
  var DEFAULT_DEBOUNCE_MS = 500;
26263
26344
  function useLivePreview(opts) {
26264
26345
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
26265
26346
  const [status, setStatus] = useState24("idle");
26266
26347
  const [disabled, setDisabled] = useState24(false);
26267
- const timerRef = useRef13(null);
26268
- const generationRef = useRef13(0);
26269
- const latestRef = useRef13(0);
26270
- const inflightRef = useRef13(0);
26271
- const optsRef = useRef13(opts);
26272
- useEffect16(() => {
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(() => {
26273
26354
  optsRef.current = opts;
26274
26355
  });
26275
- const disabledRef = useRef13(disabled);
26276
- useEffect16(() => {
26356
+ const disabledRef = useRef15(disabled);
26357
+ useEffect18(() => {
26277
26358
  disabledRef.current = disabled;
26278
26359
  }, [disabled]);
26279
- useEffect16(() => {
26360
+ useEffect18(() => {
26280
26361
  return () => {
26281
26362
  if (timerRef.current) {
26282
26363
  clearTimeout(timerRef.current);
@@ -26390,13 +26471,13 @@ function useReviewPreview({
26390
26471
  deleteAllComponents
26391
26472
  });
26392
26473
  const [spinnerTick, setSpinnerTick] = useState25(0);
26393
- useEffect17(() => {
26474
+ useEffect19(() => {
26394
26475
  if (livePreviewHook.status !== "running") return;
26395
26476
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
26396
26477
  return () => clearInterval(id);
26397
26478
  }, [livePreviewHook.status]);
26398
26479
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
26399
- useEffect17(() => {
26480
+ useEffect19(() => {
26400
26481
  if (loading) return;
26401
26482
  if (!livePreview) return;
26402
26483
  if (components.length === 0) return;
@@ -26709,7 +26790,7 @@ function GenerateReviewStepView({
26709
26790
  setFinalizeError
26710
26791
  } = reviewSurface;
26711
26792
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
26712
- const removedBannerDefaultedRef = useRef14(false);
26793
+ const removedBannerDefaultedRef = useRef16(false);
26713
26794
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
26714
26795
  const [cyclesCursor, setCyclesCursor] = useState26(0);
26715
26796
  const cyclePanel = useOverlayPanel({
@@ -26729,7 +26810,7 @@ function GenerateReviewStepView({
26729
26810
  const [breakCursor, setBreakCursor] = useState26(0);
26730
26811
  const [breakConfirm, setBreakConfirm] = useState26(false);
26731
26812
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
26732
- const seededGroupsRef = useRef14(false);
26813
+ const seededGroupsRef = useRef16(false);
26733
26814
  const {
26734
26815
  searchOpen,
26735
26816
  setSearchOpen,
@@ -26753,7 +26834,7 @@ function GenerateReviewStepView({
26753
26834
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
26754
26835
  const [autoRejected, setAutoRejected] = useState26([]);
26755
26836
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
26756
- const autoRejectFiredRef = useRef14(false);
26837
+ const autoRejectFiredRef = useRef16(false);
26757
26838
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
26758
26839
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
26759
26840
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -26816,7 +26897,7 @@ function GenerateReviewStepView({
26816
26897
  [components]
26817
26898
  );
26818
26899
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
26819
- useEffect18(() => {
26900
+ useEffect20(() => {
26820
26901
  if (seededGroupsRef.current) return;
26821
26902
  if (closures.size === 0 && slotCycles.length === 0) return;
26822
26903
  seededGroupsRef.current = true;
@@ -26843,7 +26924,7 @@ function GenerateReviewStepView({
26843
26924
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
26844
26925
  }));
26845
26926
  }, [slotCycles, cycleView]);
26846
- useEffect18(() => {
26927
+ useEffect20(() => {
26847
26928
  const decision = computeAutoRejectDecision({
26848
26929
  loading,
26849
26930
  autoRejectFired: autoRejectFiredRef.current,
@@ -26886,8 +26967,8 @@ function GenerateReviewStepView({
26886
26967
  }),
26887
26968
  applySnapshot: applyHistorySnapshot
26888
26969
  });
26889
- const autoRejectPushedRef = useRef14(false);
26890
- useEffect18(() => {
26970
+ const autoRejectPushedRef = useRef16(false);
26971
+ useEffect20(() => {
26891
26972
  if (loading) return;
26892
26973
  if (!historySeededRef.current) return;
26893
26974
  if (!autoRejectFiredRef.current) return;
@@ -26971,7 +27052,7 @@ function GenerateReviewStepView({
26971
27052
  const panelHeight = leftPanelHeight + 2;
26972
27053
  const panelContentHeight = Math.max(1, panelHeight - 3);
26973
27054
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
26974
- useEffect18(() => {
27055
+ useEffect20(() => {
26975
27056
  if (selectableRowPositions.length === 0) return;
26976
27057
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
26977
27058
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -27916,10 +27997,10 @@ function normalizePath(input) {
27916
27997
  }
27917
27998
 
27918
27999
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
27919
- import { useEffect as useEffect19, useState as useState27 } from "react";
28000
+ import { useEffect as useEffect21, useState as useState27 } from "react";
27920
28001
  function useBlinkingCursor() {
27921
28002
  const [visible, setVisible] = useState27(true);
27922
- useEffect19(() => {
28003
+ useEffect21(() => {
27923
28004
  const interval = setInterval(() => setVisible((current) => !current), 500);
27924
28005
  return () => clearInterval(interval);
27925
28006
  }, []);
@@ -28035,12 +28116,12 @@ function countedThings({ components, tokens }, counts = {}) {
28035
28116
  }
28036
28117
 
28037
28118
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
28038
- import { useEffect as useEffect20, useState as useState29 } from "react";
28119
+ import { useEffect as useEffect22, useState as useState29 } from "react";
28039
28120
  import { Spinner as Spinner2 } from "@inkjs/ui";
28040
28121
  import { jsx as jsx53 } from "react/jsx-runtime";
28041
28122
  function useTimedSpinner() {
28042
28123
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
28043
- useEffect20(() => {
28124
+ useEffect22(() => {
28044
28125
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
28045
28126
  return () => {
28046
28127
  clearInterval(timer);
@@ -28098,7 +28179,7 @@ function PushingStep({ progress, produced, counts }) {
28098
28179
  }
28099
28180
 
28100
28181
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
28101
- import { useEffect as useEffect21, useState as useState30, useMemo as useMemo7 } from "react";
28182
+ import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
28102
28183
  import { Box as Box44, Text as Text46 } from "ink";
28103
28184
 
28104
28185
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -28493,7 +28574,7 @@ function WizardPreviewStep({
28493
28574
  const activeLines = diffExpanded ? diffLines : summaryLines;
28494
28575
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
28495
28576
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
28496
- useEffect21(() => {
28577
+ useEffect23(() => {
28497
28578
  setScrollOffset((previous) => Math.min(previous, maxScroll));
28498
28579
  }, [maxScroll]);
28499
28580
  useImmediateInput((input, key) => {
@@ -28711,7 +28792,7 @@ function FlowScreen({
28711
28792
  }
28712
28793
 
28713
28794
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
28714
- import { useEffect as useEffect22, useRef as useRef15, useSyncExternalStore } from "react";
28795
+ import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
28715
28796
 
28716
28797
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28717
28798
  import { appendFileSync, writeFileSync } from "node:fs";
@@ -29453,7 +29534,7 @@ function createFlowController(start, deps) {
29453
29534
 
29454
29535
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
29455
29536
  function useFlow(start, options = {}) {
29456
- const controller = useRef15();
29537
+ const controller = useRef17();
29457
29538
  if (start && !controller.current) {
29458
29539
  try {
29459
29540
  startWizardLog();
@@ -29470,14 +29551,14 @@ function useFlow(start, options = {}) {
29470
29551
  (listener) => current?.subscribe(listener) ?? (() => void 0),
29471
29552
  () => current?.getState()
29472
29553
  );
29473
- useEffect22(() => {
29554
+ useEffect24(() => {
29474
29555
  if (!start) controller.current = void 0;
29475
29556
  }, [start]);
29476
29557
  return current && state2 ? { controller: current, state: state2 } : void 0;
29477
29558
  }
29478
29559
 
29479
29560
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
29480
- import { useEffect as useEffect23, useState as useState31 } from "react";
29561
+ import { useEffect as useEffect25, useState as useState31 } from "react";
29481
29562
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
29482
29563
  init_debug_store();
29483
29564
 
@@ -29551,7 +29632,7 @@ function Section({ title, rows }) {
29551
29632
  }
29552
29633
  function HelpScreen({ onDone }) {
29553
29634
  const [info, setInfo] = useState31();
29554
- useEffect23(() => {
29635
+ useEffect25(() => {
29555
29636
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
29556
29637
  void readHelpInfo().then(setInfo);
29557
29638
  }, []);
@@ -29648,7 +29729,7 @@ import { useState as useState36 } from "react";
29648
29729
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
29649
29730
 
29650
29731
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
29651
- import { useEffect as useEffect25, useRef as useRef16, useState as useState34 } from "react";
29732
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
29652
29733
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
29653
29734
  init_debug_store();
29654
29735
 
@@ -29977,7 +30058,7 @@ async function writeAgentConfig(config) {
29977
30058
  }
29978
30059
 
29979
30060
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
29980
- import { useEffect as useEffect24, useState as useState33 } from "react";
30061
+ import { useEffect as useEffect26, useState as useState33 } from "react";
29981
30062
  import { Box as Box48, Text as Text50 } from "ink";
29982
30063
 
29983
30064
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
@@ -30040,7 +30121,7 @@ function AgentDetail({
30040
30121
  const [testing, setTesting] = useState33(false);
30041
30122
  const [notice, setNotice] = useState33(null);
30042
30123
  const [checks, setChecks] = useState33(void 0);
30043
- useEffect24(() => {
30124
+ useEffect26(() => {
30044
30125
  let active = true;
30045
30126
  setChecks(void 0);
30046
30127
  const timer = setTimeout(() => {
@@ -30125,7 +30206,7 @@ function AgentsScreen({ onDone }) {
30125
30206
  const [saving, setSaving] = useState34(false);
30126
30207
  const [loadError, setLoadError] = useState34(null);
30127
30208
  const [checks, setChecks] = useState34({});
30128
- const visit = useRef16({
30209
+ const visit = useRef18({
30129
30210
  trail: createTrail(),
30130
30211
  before: void 0,
30131
30212
  environment: void 0,
@@ -30138,7 +30219,7 @@ function AgentsScreen({ onDone }) {
30138
30219
  );
30139
30220
  }
30140
30221
  };
30141
- useEffect25(() => {
30222
+ useEffect27(() => {
30142
30223
  readAgentConfig().then((loaded) => {
30143
30224
  setConfig(loaded);
30144
30225
  inspectAll(loaded);
@@ -30315,7 +30396,7 @@ function AgentsScreen({ onDone }) {
30315
30396
  }
30316
30397
 
30317
30398
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
30318
- import { useEffect as useEffect26, useRef as useRef17, useState as useState35 } from "react";
30399
+ import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
30319
30400
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
30320
30401
  init_debug_store();
30321
30402
 
@@ -30373,14 +30454,14 @@ function ProjectScreen({ onDone }) {
30373
30454
  const [saving, setSaving] = useState35(false);
30374
30455
  const [notice, setNotice] = useState35(null);
30375
30456
  const [loadError, setLoadError] = useState35(null);
30376
- const visit = useRef17({
30457
+ const visit = useRef19({
30377
30458
  trail: createTrail(),
30378
30459
  before: void 0,
30379
30460
  persisted: void 0,
30380
30461
  error: ""
30381
30462
  }).current;
30382
30463
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
30383
- useEffect26(() => {
30464
+ useEffect28(() => {
30384
30465
  readCredentials().then((cfg) => {
30385
30466
  setConfig(cfg);
30386
30467
  visit.before = snapshotOf(cfg);
@@ -30532,7 +30613,7 @@ function ConfigurationScreen({ onDone }) {
30532
30613
  }
30533
30614
 
30534
30615
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
30535
- import { useEffect as useEffect27, useState as useState37 } from "react";
30616
+ import { useEffect as useEffect29, useState as useState37 } from "react";
30536
30617
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
30537
30618
 
30538
30619
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -30556,7 +30637,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
30556
30637
  function OptInAnalyticsScreen({ onDone }) {
30557
30638
  const [loading, setLoading] = useState37(true);
30558
30639
  const [enabled, setEnabled] = useState37(true);
30559
- useEffect27(() => {
30640
+ useEffect29(() => {
30560
30641
  readAnalyticsSetting().then((setting) => {
30561
30642
  setEnabled(setting.enabled);
30562
30643
  setLoading(false);
@@ -30610,7 +30691,7 @@ function OptInAnalyticsScreen({ onDone }) {
30610
30691
  }
30611
30692
 
30612
30693
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
30613
- import { useEffect as useEffect28, useRef as useRef18, useState as useState38 } from "react";
30694
+ import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
30614
30695
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
30615
30696
  init_debug_mode_store();
30616
30697
  init_debug_store();
@@ -30627,8 +30708,8 @@ function DebugModeScreen({ onDone }) {
30627
30708
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
30628
30709
  );
30629
30710
  const [notice, setNotice] = useState38(null);
30630
- const visit = useRef18({ trail: createTrail(), before: void 0, error: "" }).current;
30631
- useEffect28(() => {
30711
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
30712
+ useEffect30(() => {
30632
30713
  readDebugModeSetting().then((loaded) => {
30633
30714
  setSetting(loaded);
30634
30715
  setPending(loaded.retentionDays);
@@ -30783,7 +30864,7 @@ function App({ importOptions, inkClear }) {
30783
30864
  const [flowStart, setFlowStart] = useState39();
30784
30865
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
30785
30866
  const [importDefaults, setImportDefaults] = useState39();
30786
- useEffect29(() => {
30867
+ useEffect31(() => {
30787
30868
  if (screen !== "import") {
30788
30869
  setImportDefaults(void 0);
30789
30870
  return;
@@ -30856,7 +30937,7 @@ function App({ importOptions, inkClear }) {
30856
30937
  }
30857
30938
  });
30858
30939
  };
30859
- useEffect29(() => {
30940
+ useEffect31(() => {
30860
30941
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
30861
30942
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
30862
30943
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -30878,12 +30959,12 @@ function App({ importOptions, inkClear }) {
30878
30959
  }
30879
30960
  });
30880
30961
  }, [tokensOnly, tokensOnlyRun]);
30881
- useEffect29(() => {
30962
+ useEffect31(() => {
30882
30963
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
30883
30964
  setExtractionRun(void 0);
30884
30965
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
30885
30966
  }, [extraction, extractionRun]);
30886
- useEffect29(() => {
30967
+ useEffect31(() => {
30887
30968
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
30888
30969
  const { extraction: produced, input, generatePromptPath } = scopeRun;
30889
30970
  setGenerationInput({
@@ -30901,7 +30982,7 @@ function App({ importOptions, inkClear }) {
30901
30982
  ...generatePromptPath ? { generatePromptPath } : {}
30902
30983
  });
30903
30984
  }, [scopeFlow, scopeRun, generationInput]);
30904
- useEffect29(() => {
30985
+ useEffect31(() => {
30905
30986
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
30906
30987
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
30907
30988
  inkClear();
@@ -30984,6 +31065,7 @@ function App({ importOptions, inkClear }) {
30984
31065
  return /* @__PURE__ */ jsx66(
30985
31066
  WelcomeScreen,
30986
31067
  {
31068
+ mode: target,
30987
31069
  onContinue: (projectPath) => answer({ projectPath }),
30988
31070
  onQuit: () => goBackFrom("project"),
30989
31071
  initialPath: importDefaults.componentDir
@@ -30993,6 +31075,7 @@ function App({ importOptions, inkClear }) {
30993
31075
  return /* @__PURE__ */ jsx66(
30994
31076
  TokenInputScreen,
30995
31077
  {
31078
+ mode: target,
30996
31079
  initialPath: importDefaults.tokenFile,
30997
31080
  onConfirm: (tokensPath) => answer({ tokensPath }),
30998
31081
  onBack: () => goBackFrom("token-file")