@contentful/experience-design-system-cli 2.40.1-dev-build-54dd0c33.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
@@ -21077,6 +21077,45 @@ var init_FieldForm = __esm({
21077
21077
  }
21078
21078
  });
21079
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
+
21080
21119
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
21081
21120
  function credentialsPurpose(tokensOnly) {
21082
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";
@@ -21090,17 +21129,42 @@ function normalize(values) {
21090
21129
  host: toConfiguredHost2(values.host) ?? DEFAULT_CONFIGURED_HOST
21091
21130
  };
21092
21131
  }
21093
- function missingField(values) {
21094
- return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
21132
+ function missingFields(values) {
21133
+ return ["spaceId", "environmentId", "cmaToken"].filter((field) => values[field] === "");
21095
21134
  }
21096
21135
  function isUnchanged(current, initial) {
21097
21136
  return FIELDS.every((field) => current[field] === initial[field]);
21098
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
+ }
21099
21162
  var FIELDS;
21100
21163
  var init_logic8 = __esm({
21101
21164
  "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
21102
21165
  "use strict";
21103
21166
  init_src3();
21167
+ init_debug_trail();
21104
21168
  FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
21105
21169
  }
21106
21170
  });
@@ -21153,10 +21217,11 @@ var init_validate4 = __esm({
21153
21217
  });
21154
21218
 
21155
21219
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
21156
- import { useRef as useRef5, useState as useState9 } from "react";
21220
+ import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
21157
21221
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
21158
21222
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
21159
21223
  function CredentialsScreen({
21224
+ mode,
21160
21225
  onDone,
21161
21226
  onBack,
21162
21227
  initial = {},
@@ -21179,17 +21244,64 @@ function CredentialsScreen({
21179
21244
  const [focus, setFocus] = useState9(0);
21180
21245
  const [active, setActive] = useState9(0);
21181
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
+ };
21182
21277
  const submit = async () => {
21183
21278
  const credentials = normalize(values);
21184
- if (missingField(credentials)) {
21185
- 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
+ );
21186
21285
  return;
21187
21286
  }
21188
21287
  setValidating(true);
21189
21288
  const result = await validate3(credentials);
21190
21289
  setValidating(false);
21191
- if (result.ok) onDone({ skipped: false, credentials });
21192
- 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 });
21193
21305
  };
21194
21306
  const choose = (choice) => {
21195
21307
  if (choice === "continue") void submit();
@@ -21198,7 +21310,7 @@ function CredentialsScreen({
21198
21310
  setBeforeEdit(values);
21199
21311
  setActive(0);
21200
21312
  setEditing(true);
21201
- } else onBack();
21313
+ } else leave();
21202
21314
  };
21203
21315
  const stopEditing = () => {
21204
21316
  setEditing(false);
@@ -21208,7 +21320,7 @@ function CredentialsScreen({
21208
21320
  if (validating) return;
21209
21321
  if (editing) {
21210
21322
  if (key.escape) {
21211
- if (!prefilled) onBack();
21323
+ if (!prefilled) leave();
21212
21324
  else {
21213
21325
  setValues(beforeEdit);
21214
21326
  setNotice(null);
@@ -21314,11 +21426,12 @@ function CredentialsScreen({
21314
21426
  ] })
21315
21427
  ] });
21316
21428
  }
21317
- var FIELDS2, MENU;
21429
+ var FIELDS2, MENU, MAX_LOGGED_ATTEMPTS2;
21318
21430
  var init_screen5 = __esm({
21319
21431
  "packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
21320
21432
  "use strict";
21321
21433
  init_theme();
21434
+ init_debug_store();
21322
21435
  init_FieldForm();
21323
21436
  init_ClearableTextInput();
21324
21437
  init_ControlHints();
@@ -21335,6 +21448,7 @@ var init_screen5 = __esm({
21335
21448
  { choice: "continue", label: "Continue", description: "Check the credentials and go on" },
21336
21449
  { choice: "edit", label: "Edit", description: "Change the credentials" }
21337
21450
  ];
21451
+ MAX_LOGGED_ATTEMPTS2 = 10;
21338
21452
  }
21339
21453
  });
21340
21454
 
@@ -21611,7 +21725,7 @@ var init_steps = __esm({
21611
21725
  });
21612
21726
 
21613
21727
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
21614
- import { existsSync as existsSync10 } from "node:fs";
21728
+ import { existsSync as existsSync11 } from "node:fs";
21615
21729
  import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
21616
21730
  import { fileURLToPath as fileURLToPath4 } from "node:url";
21617
21731
  function findSkillPath(fileName) {
@@ -21619,7 +21733,7 @@ function findSkillPath(fileName) {
21619
21733
  let dir = thisDir;
21620
21734
  for (; ; ) {
21621
21735
  const candidate = join20(dir, "skills", fileName);
21622
- if (existsSync10(candidate)) return candidate;
21736
+ if (existsSync11(candidate)) return candidate;
21623
21737
  const parent = resolve22(dir, "..");
21624
21738
  if (parent === dir) {
21625
21739
  throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
@@ -21883,11 +21997,11 @@ var init_run = __esm({
21883
21997
  });
21884
21998
 
21885
21999
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
21886
- import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
22000
+ import { useEffect as useEffect9, useRef as useRef6, useState as useState11 } from "react";
21887
22001
  function useExtraction(input) {
21888
22002
  const [state2, setState] = useState11();
21889
22003
  const current = useRef6();
21890
- useEffect8(() => {
22004
+ useEffect9(() => {
21891
22005
  current.current = input;
21892
22006
  if (!input) {
21893
22007
  setState(void 0);
@@ -21958,11 +22072,11 @@ var init_run_tokens_only = __esm({
21958
22072
  });
21959
22073
 
21960
22074
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
21961
- import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
22075
+ import { useEffect as useEffect10, useRef as useRef7, useState as useState12 } from "react";
21962
22076
  function useTokensOnly(input) {
21963
22077
  const [state2, setState] = useState12();
21964
22078
  const current = useRef7();
21965
- useEffect9(() => {
22079
+ useEffect10(() => {
21966
22080
  current.current = input;
21967
22081
  if (!input) {
21968
22082
  setState(void 0);
@@ -23239,7 +23353,7 @@ var init_useImmediateInput = __esm({
23239
23353
 
23240
23354
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
23241
23355
  import { useStdout as useStdout2 } from "ink";
23242
- import { useEffect as useEffect10, useState as useState13 } from "react";
23356
+ import { useEffect as useEffect11, useState as useState13 } from "react";
23243
23357
  function readTerminalSize(stdout) {
23244
23358
  return {
23245
23359
  columns: stdout?.columns ?? 80,
@@ -23249,7 +23363,7 @@ function readTerminalSize(stdout) {
23249
23363
  function useTerminalSize() {
23250
23364
  const { stdout } = useStdout2();
23251
23365
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
23252
- useEffect10(() => {
23366
+ useEffect11(() => {
23253
23367
  const updateSize = () => setSize(readTerminalSize(stdout));
23254
23368
  stdout?.on("resize", updateSize);
23255
23369
  updateSize();
@@ -24251,7 +24365,7 @@ var init_state = __esm({
24251
24365
  });
24252
24366
 
24253
24367
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
24254
- import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24368
+ import { useEffect as useEffect12, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
24255
24369
  function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
24256
24370
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
24257
24371
  const columnPlan = useMemo3(
@@ -24298,7 +24412,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24298
24412
  return seed;
24299
24413
  });
24300
24414
  const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
24301
- useEffect11(() => {
24415
+ useEffect12(() => {
24302
24416
  if (seededGroupsRef.current) return;
24303
24417
  if (closures.size === 0 && cycleParticipants.size === 0) return;
24304
24418
  seededGroupsRef.current = true;
@@ -24389,7 +24503,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
24389
24503
  entryCount: 0
24390
24504
  });
24391
24505
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
24392
- useEffect11(() => {
24506
+ useEffect12(() => {
24393
24507
  setNav((prev) => {
24394
24508
  const maxIdx = Math.max(0, visibleRows.length - 1);
24395
24509
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -24962,13 +25076,13 @@ var init_load2 = __esm({
24962
25076
  });
24963
25077
 
24964
25078
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
24965
- import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
25079
+ import { useEffect as useEffect13, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
24966
25080
  function useScopeGateFlow(input, deps = realDeps3) {
24967
25081
  const sessionId = input?.sessionId;
24968
25082
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
24969
25083
  const cacheCheck = useRef10(void 0);
24970
25084
  const [confirmed, setConfirmed] = useState17();
24971
- useEffect12(() => {
25085
+ useEffect13(() => {
24972
25086
  if (!input || !loaded?.ok || cacheCheck.current) return;
24973
25087
  cacheCheck.current = deps.checkCache(input.cache);
24974
25088
  }, [input, loaded]);
@@ -25239,11 +25353,11 @@ var init_run2 = __esm({
25239
25353
  });
25240
25354
 
25241
25355
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
25242
- import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
25356
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState18 } from "react";
25243
25357
  function useGeneration(input) {
25244
25358
  const [state2, setState] = useState18();
25245
25359
  const current = useRef11();
25246
- useEffect13(() => {
25360
+ useEffect14(() => {
25247
25361
  current.current = input;
25248
25362
  if (!input) {
25249
25363
  setState(void 0);
@@ -26230,7 +26344,7 @@ var init_scroll_offset = __esm({
26230
26344
  });
26231
26345
 
26232
26346
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
26233
- import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26347
+ import React13, { useEffect as useEffect15, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
26234
26348
  import figures6 from "figures";
26235
26349
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
26236
26350
  import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -27757,7 +27871,7 @@ function FieldEditor({
27757
27871
  }
27758
27872
  return Math.max(start + 1, end2);
27759
27873
  };
27760
- useEffect14(() => {
27874
+ useEffect15(() => {
27761
27875
  if (focusLevel === "field" || selectedRowIdx < 0) return;
27762
27876
  setListScrollStart((previous) => {
27763
27877
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -29152,7 +29266,7 @@ var init_FinalizeDialog = __esm({
29152
29266
  });
29153
29267
 
29154
29268
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
29155
- import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
29269
+ import { useEffect as useEffect16, useRef as useRef12, useState as useState20 } from "react";
29156
29270
  function useReviewFinalizePreview({
29157
29271
  components,
29158
29272
  ...options
@@ -29169,7 +29283,7 @@ function useFinalizePreview(opts) {
29169
29283
  const [scrollOffset, setScrollOffset] = useState20(0);
29170
29284
  const generationRef = useRef12(0);
29171
29285
  const acceptedKey = [...acceptedKeys].sort().join("\0");
29172
- useEffect15(() => {
29286
+ useEffect16(() => {
29173
29287
  if (!open) {
29174
29288
  setStatus("idle");
29175
29289
  setRemoved([]);
@@ -29221,7 +29335,7 @@ var init_use_finalize_preview = __esm({
29221
29335
  });
29222
29336
 
29223
29337
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
29224
- import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
29338
+ import { useCallback as useCallback2, useEffect as useEffect17, useRef as useRef13, useState as useState21 } from "react";
29225
29339
  function useReviewSession({
29226
29340
  loadSession,
29227
29341
  tokensPath,
@@ -29240,7 +29354,7 @@ function useReviewSession({
29240
29354
  }));
29241
29355
  return { result, catalog };
29242
29356
  }, [loadSession, tokensPath]);
29243
- useEffect16(() => {
29357
+ useEffect17(() => {
29244
29358
  let disposed = false;
29245
29359
  void (async () => {
29246
29360
  try {
@@ -29293,7 +29407,7 @@ function useReviewSession({
29293
29407
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29294
29408
  const [reviewMetadata, setReviewMetadata] = useState21(null);
29295
29409
  const [componentRationale, setComponentRationale] = useState21(null);
29296
- useEffect16(() => {
29410
+ useEffect17(() => {
29297
29411
  const current = components[selectedIdx];
29298
29412
  if (!current) {
29299
29413
  setReviewMetadata(null);
@@ -29325,7 +29439,7 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
29325
29439
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
29326
29440
  const historyRef = useRef13(null);
29327
29441
  const historySeededRef = useRef13(false);
29328
- useEffect16(() => {
29442
+ useEffect17(() => {
29329
29443
  if (loading || historySeededRef.current) return;
29330
29444
  historySeededRef.current = true;
29331
29445
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -29407,7 +29521,7 @@ var init_token_suggestions = __esm({
29407
29521
  });
29408
29522
 
29409
29523
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
29410
- import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
29524
+ import { useEffect as useEffect18, useRef as useRef14, useState as useState22 } from "react";
29411
29525
  function parseReviewEntry(draftValue) {
29412
29526
  const parsed = JSON.parse(draftValue);
29413
29527
  const keys = Object.keys(parsed);
@@ -29441,7 +29555,7 @@ function useReviewEditor({
29441
29555
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
29442
29556
  const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
29443
29557
  const pendingGRef = useRef14(false);
29444
- useEffect17(() => {
29558
+ useEffect18(() => {
29445
29559
  setTokenReviewRow(0);
29446
29560
  setTokenReviewEditing(false);
29447
29561
  setTokenReviewEditCursor(0);
@@ -29923,7 +30037,7 @@ var init_preview_annotations = __esm({
29923
30037
  });
29924
30038
 
29925
30039
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
29926
- import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
30040
+ import { useCallback as useCallback3, useEffect as useEffect19, useRef as useRef15, useState as useState24 } from "react";
29927
30041
  function useLivePreview(opts) {
29928
30042
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
29929
30043
  const [status, setStatus] = useState24("idle");
@@ -29933,14 +30047,14 @@ function useLivePreview(opts) {
29933
30047
  const latestRef = useRef15(0);
29934
30048
  const inflightRef = useRef15(0);
29935
30049
  const optsRef = useRef15(opts);
29936
- useEffect18(() => {
30050
+ useEffect19(() => {
29937
30051
  optsRef.current = opts;
29938
30052
  });
29939
30053
  const disabledRef = useRef15(disabled);
29940
- useEffect18(() => {
30054
+ useEffect19(() => {
29941
30055
  disabledRef.current = disabled;
29942
30056
  }, [disabled]);
29943
- useEffect18(() => {
30057
+ useEffect19(() => {
29944
30058
  return () => {
29945
30059
  if (timerRef.current) {
29946
30060
  clearTimeout(timerRef.current);
@@ -30021,7 +30135,7 @@ var init_use_live_preview = __esm({
30021
30135
  });
30022
30136
 
30023
30137
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
30024
- import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
30138
+ import { useCallback as useCallback4, useEffect as useEffect20, useState as useState25 } from "react";
30025
30139
  function useReviewPreview({
30026
30140
  components,
30027
30141
  loading,
@@ -30063,13 +30177,13 @@ function useReviewPreview({
30063
30177
  deleteAllComponents
30064
30178
  });
30065
30179
  const [spinnerTick, setSpinnerTick] = useState25(0);
30066
- useEffect19(() => {
30180
+ useEffect20(() => {
30067
30181
  if (livePreviewHook.status !== "running") return;
30068
30182
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
30069
30183
  return () => clearInterval(id);
30070
30184
  }, [livePreviewHook.status]);
30071
30185
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
30072
- useEffect19(() => {
30186
+ useEffect20(() => {
30073
30187
  if (loading) return;
30074
30188
  if (!livePreview) return;
30075
30189
  if (components.length === 0) return;
@@ -30126,7 +30240,7 @@ var init_LivePreviewSummary = __esm({
30126
30240
  });
30127
30241
 
30128
30242
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
30129
- import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30243
+ import { useCallback as useCallback5, useEffect as useEffect21, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
30130
30244
  import figures8 from "figures";
30131
30245
  import { Box as Box38, Text as Text40 } from "ink";
30132
30246
  import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
@@ -30447,7 +30561,7 @@ function GenerateReviewStepView({
30447
30561
  [components]
30448
30562
  );
30449
30563
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
30450
- useEffect20(() => {
30564
+ useEffect21(() => {
30451
30565
  if (seededGroupsRef.current) return;
30452
30566
  if (closures.size === 0 && slotCycles.length === 0) return;
30453
30567
  seededGroupsRef.current = true;
@@ -30474,7 +30588,7 @@ function GenerateReviewStepView({
30474
30588
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
30475
30589
  }));
30476
30590
  }, [slotCycles, cycleView]);
30477
- useEffect20(() => {
30591
+ useEffect21(() => {
30478
30592
  const decision = computeAutoRejectDecision({
30479
30593
  loading,
30480
30594
  autoRejectFired: autoRejectFiredRef.current,
@@ -30518,7 +30632,7 @@ function GenerateReviewStepView({
30518
30632
  applySnapshot: applyHistorySnapshot
30519
30633
  });
30520
30634
  const autoRejectPushedRef = useRef16(false);
30521
- useEffect20(() => {
30635
+ useEffect21(() => {
30522
30636
  if (loading) return;
30523
30637
  if (!historySeededRef.current) return;
30524
30638
  if (!autoRejectFiredRef.current) return;
@@ -30602,7 +30716,7 @@ function GenerateReviewStepView({
30602
30716
  const panelHeight = leftPanelHeight + 2;
30603
30717
  const panelContentHeight = Math.max(1, panelHeight - 3);
30604
30718
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
30605
- useEffect20(() => {
30719
+ useEffect21(() => {
30606
30720
  if (selectableRowPositions.length === 0) return;
30607
30721
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
30608
30722
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -31684,10 +31798,10 @@ var init_path_utils = __esm({
31684
31798
  });
31685
31799
 
31686
31800
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
31687
- import { useEffect as useEffect21, useState as useState27 } from "react";
31801
+ import { useEffect as useEffect22, useState as useState27 } from "react";
31688
31802
  function useBlinkingCursor() {
31689
31803
  const [visible, setVisible] = useState27(true);
31690
- useEffect21(() => {
31804
+ useEffect22(() => {
31691
31805
  const interval = setInterval(() => setVisible((current) => !current), 500);
31692
31806
  return () => clearInterval(interval);
31693
31807
  }, []);
@@ -31824,12 +31938,12 @@ var init_produced = __esm({
31824
31938
  });
31825
31939
 
31826
31940
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
31827
- import { useEffect as useEffect22, useState as useState29 } from "react";
31941
+ import { useEffect as useEffect23, useState as useState29 } from "react";
31828
31942
  import { Spinner as Spinner2 } from "@inkjs/ui";
31829
31943
  import { jsx as jsx53 } from "react/jsx-runtime";
31830
31944
  function useTimedSpinner() {
31831
31945
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
31832
- useEffect22(() => {
31946
+ useEffect23(() => {
31833
31947
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
31834
31948
  return () => {
31835
31949
  clearInterval(timer);
@@ -32098,7 +32212,7 @@ var init_preview_confirmation_input = __esm({
32098
32212
  });
32099
32213
 
32100
32214
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
32101
- import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
32215
+ import { useEffect as useEffect24, useState as useState30, useMemo as useMemo7 } from "react";
32102
32216
  import { Box as Box44, Text as Text46 } from "ink";
32103
32217
  import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32104
32218
  function buildPreviewSummaryLines(preview) {
@@ -32308,7 +32422,7 @@ function WizardPreviewStep({
32308
32422
  const activeLines = diffExpanded ? diffLines : summaryLines;
32309
32423
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
32310
32424
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
32311
- useEffect23(() => {
32425
+ useEffect24(() => {
32312
32426
  setScrollOffset((previous) => Math.min(previous, maxScroll));
32313
32427
  }, [maxScroll]);
32314
32428
  useImmediateInput((input, key) => {
@@ -33356,7 +33470,7 @@ var init_controller = __esm({
33356
33470
  });
33357
33471
 
33358
33472
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
33359
- import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
33473
+ import { useEffect as useEffect25, useRef as useRef17, useSyncExternalStore } from "react";
33360
33474
  function useFlow(start, options = {}) {
33361
33475
  const controller = useRef17();
33362
33476
  if (start && !controller.current) {
@@ -33375,7 +33489,7 @@ function useFlow(start, options = {}) {
33375
33489
  (listener) => current?.subscribe(listener) ?? (() => void 0),
33376
33490
  () => current?.getState()
33377
33491
  );
33378
- useEffect24(() => {
33492
+ useEffect25(() => {
33379
33493
  if (!start) controller.current = void 0;
33380
33494
  }, [start]);
33381
33495
  return current && state2 ? { controller: current, state: state2 } : void 0;
@@ -33454,7 +33568,7 @@ var init_help_info = __esm({
33454
33568
  });
33455
33569
 
33456
33570
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
33457
- import { useEffect as useEffect25, useState as useState31 } from "react";
33571
+ import { useEffect as useEffect26, useState as useState31 } from "react";
33458
33572
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
33459
33573
  import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
33460
33574
  function Section({ title, rows }) {
@@ -33468,7 +33582,7 @@ function Section({ title, rows }) {
33468
33582
  }
33469
33583
  function HelpScreen({ onDone }) {
33470
33584
  const [info, setInfo] = useState31();
33471
- useEffect25(() => {
33585
+ useEffect26(() => {
33472
33586
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
33473
33587
  void readHelpInfo().then(setInfo);
33474
33588
  }, []);
@@ -33576,45 +33690,6 @@ var init_PageContainer3 = __esm({
33576
33690
  }
33577
33691
  });
33578
33692
 
33579
- // packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts
33580
- import { existsSync as existsSync11 } from "node:fs";
33581
- function diffSnapshots(before, after) {
33582
- const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
33583
- const changed_fields = names.filter((name) => before[name] !== after[name]);
33584
- return { changed: changed_fields.length > 0, changed_fields };
33585
- }
33586
- function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
33587
- const actions = [];
33588
- return {
33589
- record(action) {
33590
- actions.push(action);
33591
- if (actions.length > limit) actions.shift();
33592
- },
33593
- entries: () => [...actions]
33594
- };
33595
- }
33596
- function scrubError(error, secrets) {
33597
- let message = error instanceof Error ? error.message : String(error);
33598
- for (const secret of secrets) {
33599
- if (secret.length < MIN_SECRET_LENGTH) continue;
33600
- for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
33601
- }
33602
- return message;
33603
- }
33604
- function describeSettingsFile() {
33605
- const path5 = configFilePath2();
33606
- return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync11(path5) };
33607
- }
33608
- var DEFAULT_TRAIL_LIMIT, MIN_SECRET_LENGTH;
33609
- var init_debug_trail = __esm({
33610
- "packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts"() {
33611
- "use strict";
33612
- init_config();
33613
- DEFAULT_TRAIL_LIMIT = 30;
33614
- MIN_SECRET_LENGTH = 6;
33615
- }
33616
- });
33617
-
33618
33693
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
33619
33694
  import { execFile as execFile2 } from "node:child_process";
33620
33695
  import { access as access5, constants } from "node:fs/promises";
@@ -33889,7 +33964,7 @@ var init_AgentStatusBadge = __esm({
33889
33964
  });
33890
33965
 
33891
33966
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
33892
- import { useEffect as useEffect26, useState as useState33 } from "react";
33967
+ import { useEffect as useEffect27, useState as useState33 } from "react";
33893
33968
  import { Box as Box48, Text as Text50 } from "ink";
33894
33969
  import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
33895
33970
  function StatusHeading() {
@@ -33910,7 +33985,7 @@ function AgentDetail({
33910
33985
  const [testing, setTesting] = useState33(false);
33911
33986
  const [notice, setNotice] = useState33(null);
33912
33987
  const [checks, setChecks] = useState33(void 0);
33913
- useEffect26(() => {
33988
+ useEffect27(() => {
33914
33989
  let active = true;
33915
33990
  setChecks(void 0);
33916
33991
  const timer = setTimeout(() => {
@@ -34002,7 +34077,7 @@ var init_AgentDetail = __esm({
34002
34077
  });
34003
34078
 
34004
34079
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
34005
- import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
34080
+ import { useEffect as useEffect28, useRef as useRef18, useState as useState34 } from "react";
34006
34081
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
34007
34082
  import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
34008
34083
  function AgentsScreen({ onDone }) {
@@ -34026,7 +34101,7 @@ function AgentsScreen({ onDone }) {
34026
34101
  );
34027
34102
  }
34028
34103
  };
34029
- useEffect27(() => {
34104
+ useEffect28(() => {
34030
34105
  readAgentConfig().then((loaded) => {
34031
34106
  setConfig(loaded);
34032
34107
  inspectAll(loaded);
@@ -34252,7 +34327,7 @@ var init_project_store = __esm({
34252
34327
  });
34253
34328
 
34254
34329
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
34255
- import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
34330
+ import { useEffect as useEffect29, useRef as useRef19, useState as useState35 } from "react";
34256
34331
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
34257
34332
  import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
34258
34333
  function debugFields(config) {
@@ -34278,7 +34353,7 @@ function ProjectScreen({ onDone }) {
34278
34353
  error: ""
34279
34354
  }).current;
34280
34355
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
34281
- useEffect28(() => {
34356
+ useEffect29(() => {
34282
34357
  readCredentials().then((cfg) => {
34283
34358
  setConfig(cfg);
34284
34359
  visit.before = snapshotOf(cfg);
@@ -34465,13 +34540,13 @@ var init_ConfigurationScreen = __esm({
34465
34540
  });
34466
34541
 
34467
34542
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
34468
- import { useEffect as useEffect29, useState as useState37 } from "react";
34543
+ import { useEffect as useEffect30, useState as useState37 } from "react";
34469
34544
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
34470
34545
  import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
34471
34546
  function OptInAnalyticsScreen({ onDone }) {
34472
34547
  const [loading, setLoading] = useState37(true);
34473
34548
  const [enabled, setEnabled] = useState37(true);
34474
- useEffect29(() => {
34549
+ useEffect30(() => {
34475
34550
  readAnalyticsSetting().then((setting) => {
34476
34551
  setEnabled(setting.enabled);
34477
34552
  setLoading(false);
@@ -34534,7 +34609,7 @@ var init_screen12 = __esm({
34534
34609
  });
34535
34610
 
34536
34611
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
34537
- import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
34612
+ import { useEffect as useEffect31, useRef as useRef20, useState as useState38 } from "react";
34538
34613
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
34539
34614
  import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
34540
34615
  function DebugModeScreen({ onDone }) {
@@ -34545,7 +34620,7 @@ function DebugModeScreen({ onDone }) {
34545
34620
  );
34546
34621
  const [notice, setNotice] = useState38(null);
34547
34622
  const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
34548
- useEffect30(() => {
34623
+ useEffect31(() => {
34549
34624
  readDebugModeSetting().then((loaded) => {
34550
34625
  setSetting(loaded);
34551
34626
  setPending(loaded.retentionDays);
@@ -34686,7 +34761,7 @@ var app_exports = {};
34686
34761
  __export(app_exports, {
34687
34762
  runApp: () => runApp
34688
34763
  });
34689
- import { useEffect as useEffect31, useState as useState39 } from "react";
34764
+ import { useEffect as useEffect32, useState as useState39 } from "react";
34690
34765
  import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
34691
34766
  function App({ importOptions, inkClear }) {
34692
34767
  const [screen, setScreen] = useState39("start");
@@ -34720,7 +34795,7 @@ function App({ importOptions, inkClear }) {
34720
34795
  const [flowStart, setFlowStart] = useState39();
34721
34796
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
34722
34797
  const [importDefaults, setImportDefaults] = useState39();
34723
- useEffect31(() => {
34798
+ useEffect32(() => {
34724
34799
  if (screen !== "import") {
34725
34800
  setImportDefaults(void 0);
34726
34801
  return;
@@ -34793,7 +34868,7 @@ function App({ importOptions, inkClear }) {
34793
34868
  }
34794
34869
  });
34795
34870
  };
34796
- useEffect31(() => {
34871
+ useEffect32(() => {
34797
34872
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
34798
34873
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
34799
34874
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -34815,12 +34890,12 @@ function App({ importOptions, inkClear }) {
34815
34890
  }
34816
34891
  });
34817
34892
  }, [tokensOnly, tokensOnlyRun]);
34818
- useEffect31(() => {
34893
+ useEffect32(() => {
34819
34894
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
34820
34895
  setExtractionRun(void 0);
34821
34896
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
34822
34897
  }, [extraction, extractionRun]);
34823
- useEffect31(() => {
34898
+ useEffect32(() => {
34824
34899
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
34825
34900
  const { extraction: produced, input, generatePromptPath } = scopeRun;
34826
34901
  setGenerationInput({
@@ -34838,7 +34913,7 @@ function App({ importOptions, inkClear }) {
34838
34913
  ...generatePromptPath ? { generatePromptPath } : {}
34839
34914
  });
34840
34915
  }, [scopeFlow, scopeRun, generationInput]);
34841
- useEffect31(() => {
34916
+ useEffect32(() => {
34842
34917
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
34843
34918
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
34844
34919
  inkClear();
@@ -35007,6 +35082,7 @@ function App({ importOptions, inkClear }) {
35007
35082
  return /* @__PURE__ */ jsx66(
35008
35083
  CredentialsScreen,
35009
35084
  {
35085
+ mode: target,
35010
35086
  initial: importDefaults.credentials,
35011
35087
  tokensOnly: target === "tokens",
35012
35088
  onBack: () => goBackFrom("credentials"),