@contentful/experience-design-system-cli 2.40.1-dev-build-35756f2e.0 → 2.40.1-dev-build-58bdf9b8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20521,26 +20521,70 @@ var init_validate_path = __esm({
20521
20521
  });
20522
20522
 
20523
20523
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
20524
- import { useState as useState6 } from "react";
20524
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
20525
20525
  import { Box as Box11, Text as Text11 } from "ink";
20526
20526
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
20527
- function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
20527
+ function TokenInputScreen({
20528
+ mode,
20529
+ onConfirm,
20530
+ onBack,
20531
+ initialPath = ""
20532
+ }) {
20528
20533
  const [tokenPath, setTokenPath] = useState6(initialPath);
20529
20534
  const [failure, setFailure] = useState6(null);
20530
- useTokenInputControls(onBack);
20535
+ const rejected = useRef4([]).current;
20536
+ useEffect6(() => {
20537
+ startDebugRun({
20538
+ flow: "import/token-input",
20539
+ step: "02-token-input",
20540
+ menuOption: "Token input",
20541
+ inputs: { import_mode: mode, initial_path: initialPath }
20542
+ });
20543
+ }, []);
20544
+ const back = () => {
20545
+ void finishDebugRun({
20546
+ outputs: { token_path: null, rejected_attempts: rejected, ...failure ? { error: failure.error } : {} },
20547
+ status: failure ? "error" : "success",
20548
+ exitMethod: "discarded"
20549
+ });
20550
+ onBack();
20551
+ };
20552
+ useTokenInputControls(back);
20531
20553
  const change = (value) => {
20532
20554
  setTokenPath(value);
20533
20555
  setFailure(null);
20534
20556
  };
20557
+ const reject = (entered, rejection) => {
20558
+ if (rejected.length < MAX_LOGGED_ATTEMPTS) {
20559
+ rejected.push({
20560
+ entered,
20561
+ error: rejection.error,
20562
+ ...rejection.resolvedPath ? { resolved_path: rejection.resolvedPath } : {}
20563
+ });
20564
+ }
20565
+ setFailure(rejection);
20566
+ };
20535
20567
  const submit = (value) => {
20536
20568
  const rawPath = toTokenPath(value);
20537
20569
  if (!rawPath) {
20538
- setFailure({ error: "Enter the path to your token file." });
20570
+ reject("", { error: "Enter the path to your token file." });
20539
20571
  return;
20540
20572
  }
20541
20573
  const check = validateTokenPath(rawPath);
20542
- if (check.ok) onConfirm(check.path);
20543
- else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
20574
+ if (!check.ok) {
20575
+ reject(rawPath, { error: check.error, resolvedPath: check.resolvedPath });
20576
+ return;
20577
+ }
20578
+ void finishDebugRun({
20579
+ outputs: {
20580
+ token_path: check.path,
20581
+ changed_from_initial: rawPath !== initialPath.trim(),
20582
+ rejected_attempts: rejected
20583
+ },
20584
+ status: "success",
20585
+ exitMethod: "saved"
20586
+ });
20587
+ onConfirm(check.path);
20544
20588
  };
20545
20589
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
20546
20590
  /* @__PURE__ */ jsx12(StepHeader, { step: "setup" }),
@@ -20568,16 +20612,19 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
20568
20612
  ] })
20569
20613
  ] });
20570
20614
  }
20615
+ var MAX_LOGGED_ATTEMPTS;
20571
20616
  var init_screen3 = __esm({
20572
20617
  "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
20573
20618
  "use strict";
20574
20619
  init_theme();
20620
+ init_debug_store();
20575
20621
  init_ClearableTextInput();
20576
20622
  init_controls5();
20577
20623
  init_logic6();
20578
20624
  init_validate_path();
20579
20625
  init_ControlHints();
20580
20626
  init_StepHeader();
20627
+ MAX_LOGGED_ATTEMPTS = 10;
20581
20628
  }
20582
20629
  });
20583
20630
 
@@ -20728,7 +20775,7 @@ var init_scan_files = __esm({
20728
20775
  });
20729
20776
 
20730
20777
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
20731
- import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
20778
+ import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
20732
20779
  import { Box as Box12, Text as Text12 } from "ink";
20733
20780
  import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
20734
20781
  function Row({ row }) {
@@ -20785,7 +20832,7 @@ function PathValidationScreen({
20785
20832
  }) {
20786
20833
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20787
20834
  const [scan, setScan] = useState7();
20788
- useEffect6(() => {
20835
+ useEffect7(() => {
20789
20836
  startDebugRun({
20790
20837
  flow: "import/path-validation",
20791
20838
  step: "03-path-validation",
@@ -20793,7 +20840,7 @@ function PathValidationScreen({
20793
20840
  inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
20794
20841
  });
20795
20842
  }, []);
20796
- useEffect6(() => {
20843
+ useEffect7(() => {
20797
20844
  setScan(scanFiles(resolvedPath));
20798
20845
  }, [resolvedPath]);
20799
20846
  const phase = phaseOf(scan);
@@ -21030,6 +21077,45 @@ var init_FieldForm = __esm({
21030
21077
  }
21031
21078
  });
21032
21079
 
21080
+ // packages/experience-design-system-cli/src/tui/shared/debug-trail.ts
21081
+ import { existsSync as existsSync10 } from "node:fs";
21082
+ function diffSnapshots(before, after) {
21083
+ const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
21084
+ const changed_fields = names.filter((name) => before[name] !== after[name]);
21085
+ return { changed: changed_fields.length > 0, changed_fields };
21086
+ }
21087
+ function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
21088
+ const actions = [];
21089
+ return {
21090
+ record(action) {
21091
+ actions.push(action);
21092
+ if (actions.length > limit) actions.shift();
21093
+ },
21094
+ entries: () => [...actions]
21095
+ };
21096
+ }
21097
+ function scrubError(error, secrets) {
21098
+ let message = error instanceof Error ? error.message : String(error);
21099
+ for (const secret of secrets) {
21100
+ if (secret.length < MIN_SECRET_LENGTH) continue;
21101
+ for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
21102
+ }
21103
+ return message;
21104
+ }
21105
+ function describeSettingsFile() {
21106
+ const path5 = configFilePath2();
21107
+ return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
21108
+ }
21109
+ var DEFAULT_TRAIL_LIMIT, MIN_SECRET_LENGTH;
21110
+ var init_debug_trail = __esm({
21111
+ "packages/experience-design-system-cli/src/tui/shared/debug-trail.ts"() {
21112
+ "use strict";
21113
+ init_config();
21114
+ DEFAULT_TRAIL_LIMIT = 30;
21115
+ MIN_SECRET_LENGTH = 6;
21116
+ }
21117
+ });
21118
+
21033
21119
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
21034
21120
  function credentialsPurpose(tokensOnly) {
21035
21121
  const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
@@ -21043,17 +21129,42 @@ function normalize(values) {
21043
21129
  host: toConfiguredHost2(values.host) ?? DEFAULT_CONFIGURED_HOST
21044
21130
  };
21045
21131
  }
21046
- function missingField(values) {
21047
- return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
21132
+ function missingFields(values) {
21133
+ return ["spaceId", "environmentId", "cmaToken"].filter((field) => values[field] === "");
21048
21134
  }
21049
21135
  function isUnchanged(current, initial) {
21050
21136
  return FIELDS.every((field) => current[field] === initial[field]);
21051
21137
  }
21138
+ function rejectedAttempt(reason, credentials) {
21139
+ return { host: credentials.host, reason: scrubError(reason, [credentials.cmaToken]) };
21140
+ }
21141
+ function credentialsLog(credentials) {
21142
+ return {
21143
+ space_id: credentials.spaceId,
21144
+ environment_id: credentials.environmentId,
21145
+ host: credentials.host,
21146
+ cma_token: credentials.cmaToken
21147
+ };
21148
+ }
21149
+ function credentialsOutputs({
21150
+ outcome,
21151
+ credentials,
21152
+ initial,
21153
+ attempts
21154
+ }) {
21155
+ return {
21156
+ outcome,
21157
+ ...credentialsLog(credentials),
21158
+ changed_fields: diffSnapshots(initial, credentials).changed_fields,
21159
+ rejected_attempts: attempts
21160
+ };
21161
+ }
21052
21162
  var FIELDS;
21053
21163
  var init_logic8 = __esm({
21054
21164
  "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
21055
21165
  "use strict";
21056
21166
  init_src3();
21167
+ init_debug_trail();
21057
21168
  FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
21058
21169
  }
21059
21170
  });
@@ -21106,17 +21217,18 @@ var init_validate4 = __esm({
21106
21217
  });
21107
21218
 
21108
21219
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21109
- import { useRef as useRef4, useState as useState9 } from "react";
21220
+ import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
21110
21221
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21111
21222
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21112
21223
  function CredentialsScreen({
21224
+ mode,
21113
21225
  onDone,
21114
21226
  onBack,
21115
21227
  initial = {},
21116
21228
  validate: validate3 = validateCredentials,
21117
21229
  tokensOnly = false
21118
21230
  }) {
21119
- const initialValues = useRef4(
21231
+ const initialValues = useRef5(
21120
21232
  normalize({
21121
21233
  spaceId: initial.spaceId ?? "",
21122
21234
  environmentId: initial.environmentId || "master",
@@ -21132,17 +21244,64 @@ function CredentialsScreen({
21132
21244
  const [focus, setFocus] = useState9(0);
21133
21245
  const [active, setActive] = useState9(0);
21134
21246
  const [beforeEdit, setBeforeEdit] = useState9(initialValues);
21247
+ const visit = useRef5({ attempts: [], lastReason: "" }).current;
21248
+ useEffect8(() => {
21249
+ startDebugRun({
21250
+ flow: "import/credentials",
21251
+ step: "04-credentials",
21252
+ menuOption: "Credentials",
21253
+ inputs: { import_mode: mode, prefilled, ...credentialsLog(initialValues) }
21254
+ });
21255
+ }, []);
21256
+ const reject = (attempt, text) => {
21257
+ if (visit.attempts.length < MAX_LOGGED_ATTEMPTS2) visit.attempts.push(attempt);
21258
+ visit.lastReason = attempt.reason;
21259
+ setNotice({ kind: "error", text });
21260
+ };
21261
+ const leave = () => {
21262
+ void finishDebugRun({
21263
+ outputs: {
21264
+ ...credentialsOutputs({
21265
+ outcome: "back",
21266
+ credentials: normalize(values),
21267
+ initial: initialValues,
21268
+ attempts: visit.attempts
21269
+ }),
21270
+ ...notice ? { error: visit.lastReason } : {}
21271
+ },
21272
+ status: notice ? "error" : "success",
21273
+ exitMethod: "discarded"
21274
+ });
21275
+ onBack();
21276
+ };
21135
21277
  const submit = async () => {
21136
21278
  const credentials = normalize(values);
21137
- if (missingField(credentials)) {
21138
- setNotice({ kind: "error", text: "Space ID, environment and CMA token are all required." });
21279
+ const missing = missingFields(credentials);
21280
+ if (missing.length > 0) {
21281
+ reject(
21282
+ rejectedAttempt(`Missing required fields: ${missing.join(", ")}`, credentials),
21283
+ "Space ID, environment and CMA token are all required."
21284
+ );
21139
21285
  return;
21140
21286
  }
21141
21287
  setValidating(true);
21142
21288
  const result = await validate3(credentials);
21143
21289
  setValidating(false);
21144
- if (result.ok) onDone({ skipped: false, credentials });
21145
- else setNotice({ kind: "error", text: result.error });
21290
+ if (!result.ok) {
21291
+ reject(rejectedAttempt(result.error, credentials), result.error);
21292
+ return;
21293
+ }
21294
+ void finishDebugRun({
21295
+ outputs: credentialsOutputs({
21296
+ outcome: "validated",
21297
+ credentials,
21298
+ initial: initialValues,
21299
+ attempts: visit.attempts
21300
+ }),
21301
+ status: "success",
21302
+ exitMethod: "saved"
21303
+ });
21304
+ onDone({ skipped: false, credentials });
21146
21305
  };
21147
21306
  const choose = (choice) => {
21148
21307
  if (choice === "continue") void submit();
@@ -21151,7 +21310,7 @@ function CredentialsScreen({
21151
21310
  setBeforeEdit(values);
21152
21311
  setActive(0);
21153
21312
  setEditing(true);
21154
- } else onBack();
21313
+ } else leave();
21155
21314
  };
21156
21315
  const stopEditing = () => {
21157
21316
  setEditing(false);
@@ -21161,7 +21320,7 @@ function CredentialsScreen({
21161
21320
  if (validating) return;
21162
21321
  if (editing) {
21163
21322
  if (key.escape) {
21164
- if (!prefilled) onBack();
21323
+ if (!prefilled) leave();
21165
21324
  else {
21166
21325
  setValues(beforeEdit);
21167
21326
  setNotice(null);
@@ -21267,11 +21426,12 @@ function CredentialsScreen({
21267
21426
  ] })
21268
21427
  ] });
21269
21428
  }
21270
- var FIELDS2, MENU;
21429
+ var FIELDS2, MENU, MAX_LOGGED_ATTEMPTS2;
21271
21430
  var init_screen5 = __esm({
21272
21431
  "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
21273
21432
  "use strict";
21274
21433
  init_theme();
21434
+ init_debug_store();
21275
21435
  init_FieldForm();
21276
21436
  init_ClearableTextInput();
21277
21437
  init_ControlHints();
@@ -21288,6 +21448,7 @@ var init_screen5 = __esm({
21288
21448
  { choice: "continue", label: "Continue", description: "Check the credentials and go on" },
21289
21449
  { choice: "edit", label: "Edit", description: "Change the credentials" }
21290
21450
  ];
21451
+ MAX_LOGGED_ATTEMPTS2 = 10;
21291
21452
  }
21292
21453
  });
21293
21454
 
@@ -21564,7 +21725,7 @@ var init_steps = __esm({
21564
21725
  });
21565
21726
 
21566
21727
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
21567
- import { existsSync as existsSync10 } from "node:fs";
21728
+ import { existsSync as existsSync11 } from "node:fs";
21568
21729
  import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
21569
21730
  import { fileURLToPath as fileURLToPath4 } from "node:url";
21570
21731
  function findSkillPath(fileName) {
@@ -21572,7 +21733,7 @@ function findSkillPath(fileName) {
21572
21733
  let dir = thisDir;
21573
21734
  for (; ; ) {
21574
21735
  const candidate = join20(dir, "skills", fileName);
21575
- if (existsSync10(candidate)) return candidate;
21736
+ if (existsSync11(candidate)) return candidate;
21576
21737
  const parent = resolve22(dir, "..");
21577
21738
  if (parent === dir) {
21578
21739
  throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
@@ -21836,11 +21997,11 @@ var init_run = __esm({
21836
21997
  });
21837
21998
 
21838
21999
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21839
- import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
22000
+ import { useEffect as useEffect9, useRef as useRef6, useState as useState11 } from "react";
21840
22001
  function useExtraction(input) {
21841
22002
  const [state2, setState] = useState11();
21842
- const current = useRef5();
21843
- useEffect7(() => {
22003
+ const current = useRef6();
22004
+ useEffect9(() => {
21844
22005
  current.current = input;
21845
22006
  if (!input) {
21846
22007
  setState(void 0);
@@ -21911,11 +22072,11 @@ var init_run_tokens_only = __esm({
21911
22072
  });
21912
22073
 
21913
22074
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
21914
- import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
22075
+ import { useEffect as useEffect10, useRef as useRef7, useState as useState12 } from "react";
21915
22076
  function useTokensOnly(input) {
21916
22077
  const [state2, setState] = useState12();
21917
- const current = useRef6();
21918
- useEffect8(() => {
22078
+ const current = useRef7();
22079
+ useEffect10(() => {
21919
22080
  current.current = input;
21920
22081
  if (!input) {
21921
22082
  setState(void 0);
@@ -23112,7 +23273,7 @@ var init_GroupedSidebar = __esm({
23112
23273
  });
23113
23274
 
23114
23275
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
23115
- import { useLayoutEffect, useRef as useRef7 } from "react";
23276
+ import { useLayoutEffect, useRef as useRef8 } from "react";
23116
23277
  import { useStdin } from "ink";
23117
23278
  function parseInput(data) {
23118
23279
  const isShiftTab = data === "\x1B[Z";
@@ -23174,7 +23335,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
23174
23335
  }
23175
23336
  function useImmediateInput(handler, enabled = true) {
23176
23337
  const { stdin, setRawMode } = useStdin();
23177
- const handlerRef = useRef7(handler);
23338
+ const handlerRef = useRef8(handler);
23178
23339
  handlerRef.current = handler;
23179
23340
  useLayoutEffect(() => {
23180
23341
  if (!enabled) return;
@@ -23192,7 +23353,7 @@ var init_useImmediateInput = __esm({
23192
23353
 
23193
23354
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23194
23355
  import { useStdout as useStdout2 } from "ink";
23195
- import { useEffect as useEffect9, useState as useState13 } from "react";
23356
+ import { useEffect as useEffect11, useState as useState13 } from "react";
23196
23357
  function readTerminalSize(stdout) {
23197
23358
  return {
23198
23359
  columns: stdout?.columns ?? 80,
@@ -23202,7 +23363,7 @@ function readTerminalSize(stdout) {
23202
23363
  function useTerminalSize() {
23203
23364
  const { stdout } = useStdout2();
23204
23365
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
23205
- useEffect9(() => {
23366
+ useEffect11(() => {
23206
23367
  const updateSize = () => setSize(readTerminalSize(stdout));
23207
23368
  stdout?.on("resize", updateSize);
23208
23369
  updateSize();
@@ -24204,7 +24365,7 @@ var init_state = __esm({
24204
24365
  });
24205
24366
 
24206
24367
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24207
- import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
24368
+ import { useEffect as useEffect12, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24208
24369
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24209
24370
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24210
24371
  const columnPlan = useMemo3(
@@ -24250,8 +24411,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24250
24411
  for (const p of cycleParticipants) seed.add(p);
24251
24412
  return seed;
24252
24413
  });
24253
- const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
24254
- useEffect10(() => {
24414
+ const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24415
+ useEffect12(() => {
24255
24416
  if (seededGroupsRef.current) return;
24256
24417
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24257
24418
  seededGroupsRef.current = true;
@@ -24342,7 +24503,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24342
24503
  entryCount: 0
24343
24504
  });
24344
24505
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24345
- useEffect10(() => {
24506
+ useEffect12(() => {
24346
24507
  setNav((prev) => {
24347
24508
  const maxIdx = Math.max(0, visibleRows.length - 1);
24348
24509
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24915,13 +25076,13 @@ var init_load2 = __esm({
24915
25076
  });
24916
25077
 
24917
25078
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24918
- import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
25079
+ import { useEffect as useEffect13, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
24919
25080
  function useScopeGateFlow(input, deps = realDeps3) {
24920
25081
  const sessionId = input?.sessionId;
24921
25082
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24922
- const cacheCheck = useRef9(void 0);
25083
+ const cacheCheck = useRef10(void 0);
24923
25084
  const [confirmed, setConfirmed] = useState17();
24924
- useEffect11(() => {
25085
+ useEffect13(() => {
24925
25086
  if (!input || !loaded?.ok || cacheCheck.current) return;
24926
25087
  cacheCheck.current = deps.checkCache(input.cache);
24927
25088
  }, [input, loaded]);
@@ -25192,11 +25353,11 @@ var init_run2 = __esm({
25192
25353
  });
25193
25354
 
25194
25355
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25195
- import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
25356
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState18 } from "react";
25196
25357
  function useGeneration(input) {
25197
25358
  const [state2, setState] = useState18();
25198
- const current = useRef10();
25199
- useEffect12(() => {
25359
+ const current = useRef11();
25360
+ useEffect14(() => {
25200
25361
  current.current = input;
25201
25362
  if (!input) {
25202
25363
  setState(void 0);
@@ -26183,7 +26344,7 @@ var init_scroll_offset = __esm({
26183
26344
  });
26184
26345
 
26185
26346
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26186
- import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26347
+ import React13, { useEffect as useEffect15, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26187
26348
  import figures6 from "figures";
26188
26349
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26189
26350
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27710,7 +27871,7 @@ function FieldEditor({
27710
27871
  }
27711
27872
  return Math.max(start + 1, end2);
27712
27873
  };
27713
- useEffect13(() => {
27874
+ useEffect15(() => {
27714
27875
  if (focusLevel === "field" || selectedRowIdx < 0) return;
27715
27876
  setListScrollStart((previous) => {
27716
27877
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29105,7 +29266,7 @@ var init_FinalizeDialog = __esm({
29105
29266
  });
29106
29267
 
29107
29268
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29108
- import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
29269
+ import { useEffect as useEffect16, useRef as useRef12, useState as useState20 } from "react";
29109
29270
  function useReviewFinalizePreview({
29110
29271
  components,
29111
29272
  ...options
@@ -29120,9 +29281,9 @@ function useFinalizePreview(opts) {
29120
29281
  const [status, setStatus] = useState20("idle");
29121
29282
  const [removed, setRemoved] = useState20([]);
29122
29283
  const [scrollOffset, setScrollOffset] = useState20(0);
29123
- const generationRef = useRef11(0);
29284
+ const generationRef = useRef12(0);
29124
29285
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29125
- useEffect14(() => {
29286
+ useEffect16(() => {
29126
29287
  if (!open) {
29127
29288
  setStatus("idle");
29128
29289
  setRemoved([]);
@@ -29174,7 +29335,7 @@ var init_use_finalize_preview = __esm({
29174
29335
  });
29175
29336
 
29176
29337
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29177
- import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
29338
+ import { useCallback as useCallback2, useEffect as useEffect17, useRef as useRef13, useState as useState21 } from "react";
29178
29339
  function useReviewSession({
29179
29340
  loadSession,
29180
29341
  tokensPath,
@@ -29193,7 +29354,7 @@ function useReviewSession({
29193
29354
  }));
29194
29355
  return { result, catalog };
29195
29356
  }, [loadSession, tokensPath]);
29196
- useEffect15(() => {
29357
+ useEffect17(() => {
29197
29358
  let disposed = false;
29198
29359
  void (async () => {
29199
29360
  try {
@@ -29246,7 +29407,7 @@ function useReviewSession({
29246
29407
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29247
29408
  const [reviewMetadata, setReviewMetadata] = useState21(null);
29248
29409
  const [componentRationale, setComponentRationale] = useState21(null);
29249
- useEffect15(() => {
29410
+ useEffect17(() => {
29250
29411
  const current = components[selectedIdx];
29251
29412
  if (!current) {
29252
29413
  setReviewMetadata(null);
@@ -29276,9 +29437,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29276
29437
  return { reviewMetadata, componentRationale };
29277
29438
  }
29278
29439
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29279
- const historyRef = useRef12(null);
29280
- const historySeededRef = useRef12(false);
29281
- useEffect15(() => {
29440
+ const historyRef = useRef13(null);
29441
+ const historySeededRef = useRef13(false);
29442
+ useEffect17(() => {
29282
29443
  if (loading || historySeededRef.current) return;
29283
29444
  historySeededRef.current = true;
29284
29445
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29360,7 +29521,7 @@ var init_token_suggestions = __esm({
29360
29521
  });
29361
29522
 
29362
29523
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29363
- import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
29524
+ import { useEffect as useEffect18, useRef as useRef14, useState as useState22 } from "react";
29364
29525
  function parseReviewEntry(draftValue) {
29365
29526
  const parsed = JSON.parse(draftValue);
29366
29527
  const keys = Object.keys(parsed);
@@ -29392,9 +29553,9 @@ function useReviewEditor({
29392
29553
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
29393
29554
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
29394
29555
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
29395
- const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
29396
- const pendingGRef = useRef13(false);
29397
- useEffect16(() => {
29556
+ const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29557
+ const pendingGRef = useRef14(false);
29558
+ useEffect18(() => {
29398
29559
  setTokenReviewRow(0);
29399
29560
  setTokenReviewEditing(false);
29400
29561
  setTokenReviewEditCursor(0);
@@ -29876,24 +30037,24 @@ var init_preview_annotations = __esm({
29876
30037
  });
29877
30038
 
29878
30039
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
29879
- import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
30040
+ import { useCallback as useCallback3, useEffect as useEffect19, useRef as useRef15, useState as useState24 } from "react";
29880
30041
  function useLivePreview(opts) {
29881
30042
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
29882
30043
  const [status, setStatus] = useState24("idle");
29883
30044
  const [disabled, setDisabled] = useState24(false);
29884
- const timerRef = useRef14(null);
29885
- const generationRef = useRef14(0);
29886
- const latestRef = useRef14(0);
29887
- const inflightRef = useRef14(0);
29888
- const optsRef = useRef14(opts);
29889
- useEffect17(() => {
30045
+ const timerRef = useRef15(null);
30046
+ const generationRef = useRef15(0);
30047
+ const latestRef = useRef15(0);
30048
+ const inflightRef = useRef15(0);
30049
+ const optsRef = useRef15(opts);
30050
+ useEffect19(() => {
29890
30051
  optsRef.current = opts;
29891
30052
  });
29892
- const disabledRef = useRef14(disabled);
29893
- useEffect17(() => {
30053
+ const disabledRef = useRef15(disabled);
30054
+ useEffect19(() => {
29894
30055
  disabledRef.current = disabled;
29895
30056
  }, [disabled]);
29896
- useEffect17(() => {
30057
+ useEffect19(() => {
29897
30058
  return () => {
29898
30059
  if (timerRef.current) {
29899
30060
  clearTimeout(timerRef.current);
@@ -29974,7 +30135,7 @@ var init_use_live_preview = __esm({
29974
30135
  });
29975
30136
 
29976
30137
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
29977
- import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
30138
+ import { useCallback as useCallback4, useEffect as useEffect20, useState as useState25 } from "react";
29978
30139
  function useReviewPreview({
29979
30140
  components,
29980
30141
  loading,
@@ -30016,13 +30177,13 @@ function useReviewPreview({
30016
30177
  deleteAllComponents
30017
30178
  });
30018
30179
  const [spinnerTick, setSpinnerTick] = useState25(0);
30019
- useEffect18(() => {
30180
+ useEffect20(() => {
30020
30181
  if (livePreviewHook.status !== "running") return;
30021
30182
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
30022
30183
  return () => clearInterval(id);
30023
30184
  }, [livePreviewHook.status]);
30024
30185
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
30025
- useEffect18(() => {
30186
+ useEffect20(() => {
30026
30187
  if (loading) return;
30027
30188
  if (!livePreview) return;
30028
30189
  if (components.length === 0) return;
@@ -30079,7 +30240,7 @@ var init_LivePreviewSummary = __esm({
30079
30240
  });
30080
30241
 
30081
30242
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30082
- import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
30243
+ import { useCallback as useCallback5, useEffect as useEffect21, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30083
30244
  import figures8 from "figures";
30084
30245
  import { Box as Box38, Text as Text40 } from "ink";
30085
30246
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30293,7 +30454,7 @@ function GenerateReviewStepView({
30293
30454
  setFinalizeError
30294
30455
  } = reviewSurface;
30295
30456
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
30296
- const removedBannerDefaultedRef = useRef15(false);
30457
+ const removedBannerDefaultedRef = useRef16(false);
30297
30458
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
30298
30459
  const [cyclesCursor, setCyclesCursor] = useState26(0);
30299
30460
  const cyclePanel = useOverlayPanel({
@@ -30313,7 +30474,7 @@ function GenerateReviewStepView({
30313
30474
  const [breakCursor, setBreakCursor] = useState26(0);
30314
30475
  const [breakConfirm, setBreakConfirm] = useState26(false);
30315
30476
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
30316
- const seededGroupsRef = useRef15(false);
30477
+ const seededGroupsRef = useRef16(false);
30317
30478
  const {
30318
30479
  searchOpen,
30319
30480
  setSearchOpen,
@@ -30337,7 +30498,7 @@ function GenerateReviewStepView({
30337
30498
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
30338
30499
  const [autoRejected, setAutoRejected] = useState26([]);
30339
30500
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
30340
- const autoRejectFiredRef = useRef15(false);
30501
+ const autoRejectFiredRef = useRef16(false);
30341
30502
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
30342
30503
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
30343
30504
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -30400,7 +30561,7 @@ function GenerateReviewStepView({
30400
30561
  [components]
30401
30562
  );
30402
30563
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30403
- useEffect19(() => {
30564
+ useEffect21(() => {
30404
30565
  if (seededGroupsRef.current) return;
30405
30566
  if (closures.size === 0 && slotCycles.length === 0) return;
30406
30567
  seededGroupsRef.current = true;
@@ -30427,7 +30588,7 @@ function GenerateReviewStepView({
30427
30588
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30428
30589
  }));
30429
30590
  }, [slotCycles, cycleView]);
30430
- useEffect19(() => {
30591
+ useEffect21(() => {
30431
30592
  const decision = computeAutoRejectDecision({
30432
30593
  loading,
30433
30594
  autoRejectFired: autoRejectFiredRef.current,
@@ -30470,8 +30631,8 @@ function GenerateReviewStepView({
30470
30631
  }),
30471
30632
  applySnapshot: applyHistorySnapshot
30472
30633
  });
30473
- const autoRejectPushedRef = useRef15(false);
30474
- useEffect19(() => {
30634
+ const autoRejectPushedRef = useRef16(false);
30635
+ useEffect21(() => {
30475
30636
  if (loading) return;
30476
30637
  if (!historySeededRef.current) return;
30477
30638
  if (!autoRejectFiredRef.current) return;
@@ -30555,7 +30716,7 @@ function GenerateReviewStepView({
30555
30716
  const panelHeight = leftPanelHeight + 2;
30556
30717
  const panelContentHeight = Math.max(1, panelHeight - 3);
30557
30718
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30558
- useEffect19(() => {
30719
+ useEffect21(() => {
30559
30720
  if (selectableRowPositions.length === 0) return;
30560
30721
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30561
30722
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31637,10 +31798,10 @@ var init_path_utils = __esm({
31637
31798
  });
31638
31799
 
31639
31800
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
31640
- import { useEffect as useEffect20, useState as useState27 } from "react";
31801
+ import { useEffect as useEffect22, useState as useState27 } from "react";
31641
31802
  function useBlinkingCursor() {
31642
31803
  const [visible, setVisible] = useState27(true);
31643
- useEffect20(() => {
31804
+ useEffect22(() => {
31644
31805
  const interval = setInterval(() => setVisible((current) => !current), 500);
31645
31806
  return () => clearInterval(interval);
31646
31807
  }, []);
@@ -31777,12 +31938,12 @@ var init_produced = __esm({
31777
31938
  });
31778
31939
 
31779
31940
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
31780
- import { useEffect as useEffect21, useState as useState29 } from "react";
31941
+ import { useEffect as useEffect23, useState as useState29 } from "react";
31781
31942
  import { Spinner as Spinner2 } from "@inkjs/ui";
31782
31943
  import { jsx as jsx53 } from "react/jsx-runtime";
31783
31944
  function useTimedSpinner() {
31784
31945
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
31785
- useEffect21(() => {
31946
+ useEffect23(() => {
31786
31947
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
31787
31948
  return () => {
31788
31949
  clearInterval(timer);
@@ -32051,7 +32212,7 @@ var init_preview_confirmation_input = __esm({
32051
32212
  });
32052
32213
 
32053
32214
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32054
- import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
32215
+ import { useEffect as useEffect24, useState as useState30, useMemo as useMemo7 } from "react";
32055
32216
  import { Box as Box44, Text as Text46 } from "ink";
32056
32217
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32057
32218
  function buildPreviewSummaryLines(preview) {
@@ -32261,7 +32422,7 @@ function WizardPreviewStep({
32261
32422
  const activeLines = diffExpanded ? diffLines : summaryLines;
32262
32423
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32263
32424
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32264
- useEffect22(() => {
32425
+ useEffect24(() => {
32265
32426
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32266
32427
  }, [maxScroll]);
32267
32428
  useImmediateInput((input, key) => {
@@ -33309,9 +33470,9 @@ var init_controller = __esm({
33309
33470
  });
33310
33471
 
33311
33472
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33312
- import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
33473
+ import { useEffect as useEffect25, useRef as useRef17, useSyncExternalStore } from "react";
33313
33474
  function useFlow(start, options = {}) {
33314
- const controller = useRef16();
33475
+ const controller = useRef17();
33315
33476
  if (start && !controller.current) {
33316
33477
  try {
33317
33478
  startWizardLog();
@@ -33328,7 +33489,7 @@ function useFlow(start, options = {}) {
33328
33489
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33329
33490
  () => current?.getState()
33330
33491
  );
33331
- useEffect23(() => {
33492
+ useEffect25(() => {
33332
33493
  if (!start) controller.current = void 0;
33333
33494
  }, [start]);
33334
33495
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33407,7 +33568,7 @@ var init_help_info = __esm({
33407
33568
  });
33408
33569
 
33409
33570
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33410
- import { useEffect as useEffect24, useState as useState31 } from "react";
33571
+ import { useEffect as useEffect26, useState as useState31 } from "react";
33411
33572
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33412
33573
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33413
33574
  function Section({ title, rows }) {
@@ -33421,7 +33582,7 @@ function Section({ title, rows }) {
33421
33582
  }
33422
33583
  function HelpScreen({ onDone }) {
33423
33584
  const [info, setInfo] = useState31();
33424
- useEffect24(() => {
33585
+ useEffect26(() => {
33425
33586
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
33426
33587
  void readHelpInfo().then(setInfo);
33427
33588
  }, []);
@@ -33529,45 +33690,6 @@ var init_PageContainer3 = __esm({
33529
33690
  }
33530
33691
  });
33531
33692
 
33532
- // packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts
33533
- import { existsSync as existsSync11 } from "node:fs";
33534
- function diffSnapshots(before, after) {
33535
- const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
33536
- const changed_fields = names.filter((name) => before[name] !== after[name]);
33537
- return { changed: changed_fields.length > 0, changed_fields };
33538
- }
33539
- function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
33540
- const actions = [];
33541
- return {
33542
- record(action) {
33543
- actions.push(action);
33544
- if (actions.length > limit) actions.shift();
33545
- },
33546
- entries: () => [...actions]
33547
- };
33548
- }
33549
- function scrubError(error, secrets) {
33550
- let message = error instanceof Error ? error.message : String(error);
33551
- for (const secret of secrets) {
33552
- if (secret.length < MIN_SECRET_LENGTH) continue;
33553
- for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
33554
- }
33555
- return message;
33556
- }
33557
- function describeSettingsFile() {
33558
- const path5 = configFilePath2();
33559
- return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync11(path5) };
33560
- }
33561
- var DEFAULT_TRAIL_LIMIT, MIN_SECRET_LENGTH;
33562
- var init_debug_trail = __esm({
33563
- "packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts"() {
33564
- "use strict";
33565
- init_config();
33566
- DEFAULT_TRAIL_LIMIT = 30;
33567
- MIN_SECRET_LENGTH = 6;
33568
- }
33569
- });
33570
-
33571
33693
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
33572
33694
  import { execFile as execFile2 } from "node:child_process";
33573
33695
  import { access as access5, constants } from "node:fs/promises";
@@ -33842,7 +33964,7 @@ var init_AgentStatusBadge = __esm({
33842
33964
  });
33843
33965
 
33844
33966
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
33845
- import { useEffect as useEffect25, useState as useState33 } from "react";
33967
+ import { useEffect as useEffect27, useState as useState33 } from "react";
33846
33968
  import { Box as Box48, Text as Text50 } from "ink";
33847
33969
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
33848
33970
  function StatusHeading() {
@@ -33863,7 +33985,7 @@ function AgentDetail({
33863
33985
  const [testing, setTesting] = useState33(false);
33864
33986
  const [notice, setNotice] = useState33(null);
33865
33987
  const [checks, setChecks] = useState33(void 0);
33866
- useEffect25(() => {
33988
+ useEffect27(() => {
33867
33989
  let active = true;
33868
33990
  setChecks(void 0);
33869
33991
  const timer = setTimeout(() => {
@@ -33955,7 +34077,7 @@ var init_AgentDetail = __esm({
33955
34077
  });
33956
34078
 
33957
34079
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
33958
- import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
34080
+ import { useEffect as useEffect28, useRef as useRef18, useState as useState34 } from "react";
33959
34081
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
33960
34082
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
33961
34083
  function AgentsScreen({ onDone }) {
@@ -33966,7 +34088,7 @@ function AgentsScreen({ onDone }) {
33966
34088
  const [saving, setSaving] = useState34(false);
33967
34089
  const [loadError, setLoadError] = useState34(null);
33968
34090
  const [checks, setChecks] = useState34({});
33969
- const visit = useRef17({
34091
+ const visit = useRef18({
33970
34092
  trail: createTrail(),
33971
34093
  before: void 0,
33972
34094
  environment: void 0,
@@ -33979,7 +34101,7 @@ function AgentsScreen({ onDone }) {
33979
34101
  );
33980
34102
  }
33981
34103
  };
33982
- useEffect26(() => {
34104
+ useEffect28(() => {
33983
34105
  readAgentConfig().then((loaded) => {
33984
34106
  setConfig(loaded);
33985
34107
  inspectAll(loaded);
@@ -34205,7 +34327,7 @@ var init_project_store = __esm({
34205
34327
  });
34206
34328
 
34207
34329
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34208
- import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
34330
+ import { useEffect as useEffect29, useRef as useRef19, useState as useState35 } from "react";
34209
34331
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34210
34332
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34211
34333
  function debugFields(config) {
@@ -34224,14 +34346,14 @@ function ProjectScreen({ onDone }) {
34224
34346
  const [saving, setSaving] = useState35(false);
34225
34347
  const [notice, setNotice] = useState35(null);
34226
34348
  const [loadError, setLoadError] = useState35(null);
34227
- const visit = useRef18({
34349
+ const visit = useRef19({
34228
34350
  trail: createTrail(),
34229
34351
  before: void 0,
34230
34352
  persisted: void 0,
34231
34353
  error: ""
34232
34354
  }).current;
34233
34355
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34234
- useEffect27(() => {
34356
+ useEffect29(() => {
34235
34357
  readCredentials().then((cfg) => {
34236
34358
  setConfig(cfg);
34237
34359
  visit.before = snapshotOf(cfg);
@@ -34418,13 +34540,13 @@ var init_ConfigurationScreen = __esm({
34418
34540
  });
34419
34541
 
34420
34542
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34421
- import { useEffect as useEffect28, useState as useState37 } from "react";
34543
+ import { useEffect as useEffect30, useState as useState37 } from "react";
34422
34544
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34423
34545
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34424
34546
  function OptInAnalyticsScreen({ onDone }) {
34425
34547
  const [loading, setLoading] = useState37(true);
34426
34548
  const [enabled, setEnabled] = useState37(true);
34427
- useEffect28(() => {
34549
+ useEffect30(() => {
34428
34550
  readAnalyticsSetting().then((setting) => {
34429
34551
  setEnabled(setting.enabled);
34430
34552
  setLoading(false);
@@ -34487,7 +34609,7 @@ var init_screen12 = __esm({
34487
34609
  });
34488
34610
 
34489
34611
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34490
- import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
34612
+ import { useEffect as useEffect31, useRef as useRef20, useState as useState38 } from "react";
34491
34613
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
34492
34614
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
34493
34615
  function DebugModeScreen({ onDone }) {
@@ -34497,8 +34619,8 @@ function DebugModeScreen({ onDone }) {
34497
34619
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
34498
34620
  );
34499
34621
  const [notice, setNotice] = useState38(null);
34500
- const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
34501
- useEffect29(() => {
34622
+ const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
34623
+ useEffect31(() => {
34502
34624
  readDebugModeSetting().then((loaded) => {
34503
34625
  setSetting(loaded);
34504
34626
  setPending(loaded.retentionDays);
@@ -34639,7 +34761,7 @@ var app_exports = {};
34639
34761
  __export(app_exports, {
34640
34762
  runApp: () => runApp
34641
34763
  });
34642
- import { useEffect as useEffect30, useState as useState39 } from "react";
34764
+ import { useEffect as useEffect32, useState as useState39 } from "react";
34643
34765
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
34644
34766
  function App({ importOptions, inkClear }) {
34645
34767
  const [screen, setScreen] = useState39("start");
@@ -34673,7 +34795,7 @@ function App({ importOptions, inkClear }) {
34673
34795
  const [flowStart, setFlowStart] = useState39();
34674
34796
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34675
34797
  const [importDefaults, setImportDefaults] = useState39();
34676
- useEffect30(() => {
34798
+ useEffect32(() => {
34677
34799
  if (screen !== "import") {
34678
34800
  setImportDefaults(void 0);
34679
34801
  return;
@@ -34746,7 +34868,7 @@ function App({ importOptions, inkClear }) {
34746
34868
  }
34747
34869
  });
34748
34870
  };
34749
- useEffect30(() => {
34871
+ useEffect32(() => {
34750
34872
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
34751
34873
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
34752
34874
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -34768,12 +34890,12 @@ function App({ importOptions, inkClear }) {
34768
34890
  }
34769
34891
  });
34770
34892
  }, [tokensOnly, tokensOnlyRun]);
34771
- useEffect30(() => {
34893
+ useEffect32(() => {
34772
34894
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34773
34895
  setExtractionRun(void 0);
34774
34896
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34775
34897
  }, [extraction, extractionRun]);
34776
- useEffect30(() => {
34898
+ useEffect32(() => {
34777
34899
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34778
34900
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34779
34901
  setGenerationInput({
@@ -34791,7 +34913,7 @@ function App({ importOptions, inkClear }) {
34791
34913
  ...generatePromptPath ? { generatePromptPath } : {}
34792
34914
  });
34793
34915
  }, [scopeFlow, scopeRun, generationInput]);
34794
- useEffect30(() => {
34916
+ useEffect32(() => {
34795
34917
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34796
34918
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
34797
34919
  inkClear();
@@ -34884,6 +35006,7 @@ function App({ importOptions, inkClear }) {
34884
35006
  return /* @__PURE__ */ jsx66(
34885
35007
  TokenInputScreen,
34886
35008
  {
35009
+ mode: target,
34887
35010
  initialPath: importDefaults.tokenFile,
34888
35011
  onConfirm: (tokensPath) => answer({ tokensPath }),
34889
35012
  onBack: () => goBackFrom("token-file")
@@ -34959,6 +35082,7 @@ function App({ importOptions, inkClear }) {
34959
35082
  return /* @__PURE__ */ jsx66(
34960
35083
  CredentialsScreen,
34961
35084
  {
35085
+ mode: target,
34962
35086
  initial: importDefaults.credentials,
34963
35087
  tokensOnly: target === "tokens",
34964
35088
  onBack: () => goBackFrom("credentials"),