@contentful/experience-design-system-cli 2.43.1-dev-build-30e824d7.0 → 2.43.1-dev-build-1205d418.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
@@ -18336,6 +18336,40 @@ function useTokenInputControls(onBack) {
18336
18336
  });
18337
18337
  }
18338
18338
 
18339
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/log.ts
18340
+ function tokenInputLog({
18341
+ mode,
18342
+ tokenPath,
18343
+ enteredPath,
18344
+ initialPath,
18345
+ rejected,
18346
+ emptySubmits,
18347
+ endedOnError
18348
+ }) {
18349
+ const kept = tokenPath !== null && initialPath.trim() !== "" && enteredPath === initialPath.trim();
18350
+ const source = tokenPath === null ? null : kept ? "prefilled" : "typed";
18351
+ const summary = [
18352
+ `Import mode: ${importModeLabel(mode)}`,
18353
+ tokenPath === null ? "Token file: none (went back)" : `Token file: ${tokenPath}`,
18354
+ ...source ? [`Path source: ${source === "prefilled" ? "pre-filled, kept as is" : "typed by the user"}`] : [],
18355
+ `Rejected paths: ${rejected.length}`,
18356
+ ...rejected.map((attempt) => ` "${attempt.entered}" \u2192 ${attempt.error}`),
18357
+ `Empty submits: ${emptySubmits}`,
18358
+ ...endedOnError ? [`Went back while this error was showing: ${endedOnError}`] : []
18359
+ ];
18360
+ return {
18361
+ summary,
18362
+ data: {
18363
+ import_mode: mode,
18364
+ token_path: tokenPath,
18365
+ path_source: source,
18366
+ rejected_attempts: rejected,
18367
+ empty_submits: emptySubmits,
18368
+ ...endedOnError ? { error: endedOnError } : {}
18369
+ }
18370
+ };
18371
+ }
18372
+
18339
18373
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
18340
18374
  import { statSync as statSync5 } from "node:fs";
18341
18375
 
@@ -18387,20 +18421,29 @@ function TokenInputScreen({
18387
18421
  const [tokenPath, setTokenPath] = useState7(initialPath);
18388
18422
  const [failure, setFailure] = useState7(null);
18389
18423
  const rejected = useRef4([]).current;
18424
+ const visit = useRef4({ emptySubmits: 0 }).current;
18390
18425
  useEffect7(() => {
18391
- startDebugRun({
18392
- flow: "import/token-input",
18393
- step: "02-token-input",
18394
- menuOption: "Token input",
18395
- inputs: { import_mode: mode, initial_path: initialPath }
18396
- });
18426
+ startDebugRun({ flow: "import/token-input", step: "02-token-input", menuOption: "Token input" });
18397
18427
  }, []);
18398
- const back = () => {
18428
+ const finish = (tokenPath2, enteredPath, endedOnError) => {
18429
+ const { summary, data } = tokenInputLog({
18430
+ mode,
18431
+ tokenPath: tokenPath2,
18432
+ enteredPath,
18433
+ initialPath,
18434
+ rejected,
18435
+ emptySubmits: visit.emptySubmits,
18436
+ endedOnError
18437
+ });
18399
18438
  void finishDebugRun({
18400
- outputs: { token_path: null, rejected_attempts: rejected, ...failure ? { error: failure.error } : {} },
18401
- status: failure ? "error" : "success",
18402
- exitMethod: "discarded"
18439
+ summary,
18440
+ outputs: data,
18441
+ status: endedOnError ? "error" : "success",
18442
+ exitMethod: tokenPath2 ? "saved" : "discarded"
18403
18443
  });
18444
+ };
18445
+ const back = () => {
18446
+ finish(null, tokenPath, failure?.error);
18404
18447
  onBack();
18405
18448
  };
18406
18449
  useTokenInputControls(back);
@@ -18421,7 +18464,8 @@ function TokenInputScreen({
18421
18464
  const submit = (value) => {
18422
18465
  const rawPath = toTokenPath(value);
18423
18466
  if (!rawPath) {
18424
- reject("", { error: "Enter the path to your token file." });
18467
+ visit.emptySubmits += 1;
18468
+ setFailure({ error: "Enter the path to your token file." });
18425
18469
  return;
18426
18470
  }
18427
18471
  const check = validateTokenPath(rawPath);
@@ -18429,15 +18473,7 @@ function TokenInputScreen({
18429
18473
  reject(rawPath, { error: check.error, resolvedPath: check.resolvedPath });
18430
18474
  return;
18431
18475
  }
18432
- void finishDebugRun({
18433
- outputs: {
18434
- token_path: check.path,
18435
- changed_from_initial: rawPath !== initialPath.trim(),
18436
- rejected_attempts: rejected
18437
- },
18438
- status: "success",
18439
- exitMethod: "saved"
18440
- });
18476
+ finish(check.path, rawPath);
18441
18477
  onConfirm(check.path);
18442
18478
  };
18443
18479
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
package/dist/index.js CHANGED
@@ -21014,6 +21014,46 @@ var init_controls5 = __esm({
21014
21014
  }
21015
21015
  });
21016
21016
 
21017
+ // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/log.ts
21018
+ function tokenInputLog({
21019
+ mode,
21020
+ tokenPath,
21021
+ enteredPath,
21022
+ initialPath,
21023
+ rejected,
21024
+ emptySubmits,
21025
+ endedOnError
21026
+ }) {
21027
+ const kept = tokenPath !== null && initialPath.trim() !== "" && enteredPath === initialPath.trim();
21028
+ const source = tokenPath === null ? null : kept ? "prefilled" : "typed";
21029
+ const summary = [
21030
+ `Import mode: ${importModeLabel(mode)}`,
21031
+ tokenPath === null ? "Token file: none (went back)" : `Token file: ${tokenPath}`,
21032
+ ...source ? [`Path source: ${source === "prefilled" ? "pre-filled, kept as is" : "typed by the user"}`] : [],
21033
+ `Rejected paths: ${rejected.length}`,
21034
+ ...rejected.map((attempt) => ` "${attempt.entered}" \u2192 ${attempt.error}`),
21035
+ `Empty submits: ${emptySubmits}`,
21036
+ ...endedOnError ? [`Went back while this error was showing: ${endedOnError}`] : []
21037
+ ];
21038
+ return {
21039
+ summary,
21040
+ data: {
21041
+ import_mode: mode,
21042
+ token_path: tokenPath,
21043
+ path_source: source,
21044
+ rejected_attempts: rejected,
21045
+ empty_submits: emptySubmits,
21046
+ ...endedOnError ? { error: endedOnError } : {}
21047
+ }
21048
+ };
21049
+ }
21050
+ var init_log3 = __esm({
21051
+ "packages/experience-design-system-cli/src/tui/import/steps/02-token-input/log.ts"() {
21052
+ "use strict";
21053
+ init_logic();
21054
+ }
21055
+ });
21056
+
21017
21057
  // packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
21018
21058
  import { homedir as homedir3 } from "node:os";
21019
21059
  import { resolve as resolve21 } from "node:path";
@@ -21075,20 +21115,29 @@ function TokenInputScreen({
21075
21115
  const [tokenPath, setTokenPath] = useState7(initialPath);
21076
21116
  const [failure, setFailure] = useState7(null);
21077
21117
  const rejected = useRef4([]).current;
21118
+ const visit = useRef4({ emptySubmits: 0 }).current;
21078
21119
  useEffect7(() => {
21079
- startDebugRun({
21080
- flow: "import/token-input",
21081
- step: "02-token-input",
21082
- menuOption: "Token input",
21083
- inputs: { import_mode: mode, initial_path: initialPath }
21084
- });
21120
+ startDebugRun({ flow: "import/token-input", step: "02-token-input", menuOption: "Token input" });
21085
21121
  }, []);
21086
- const back = () => {
21122
+ const finish = (tokenPath2, enteredPath, endedOnError) => {
21123
+ const { summary, data } = tokenInputLog({
21124
+ mode,
21125
+ tokenPath: tokenPath2,
21126
+ enteredPath,
21127
+ initialPath,
21128
+ rejected,
21129
+ emptySubmits: visit.emptySubmits,
21130
+ endedOnError
21131
+ });
21087
21132
  void finishDebugRun({
21088
- outputs: { token_path: null, rejected_attempts: rejected, ...failure ? { error: failure.error } : {} },
21089
- status: failure ? "error" : "success",
21090
- exitMethod: "discarded"
21133
+ summary,
21134
+ outputs: data,
21135
+ status: endedOnError ? "error" : "success",
21136
+ exitMethod: tokenPath2 ? "saved" : "discarded"
21091
21137
  });
21138
+ };
21139
+ const back = () => {
21140
+ finish(null, tokenPath, failure?.error);
21092
21141
  onBack();
21093
21142
  };
21094
21143
  useTokenInputControls(back);
@@ -21109,7 +21158,8 @@ function TokenInputScreen({
21109
21158
  const submit = (value) => {
21110
21159
  const rawPath = toTokenPath(value);
21111
21160
  if (!rawPath) {
21112
- reject("", { error: "Enter the path to your token file." });
21161
+ visit.emptySubmits += 1;
21162
+ setFailure({ error: "Enter the path to your token file." });
21113
21163
  return;
21114
21164
  }
21115
21165
  const check = validateTokenPath(rawPath);
@@ -21117,15 +21167,7 @@ function TokenInputScreen({
21117
21167
  reject(rawPath, { error: check.error, resolvedPath: check.resolvedPath });
21118
21168
  return;
21119
21169
  }
21120
- void finishDebugRun({
21121
- outputs: {
21122
- token_path: check.path,
21123
- changed_from_initial: rawPath !== initialPath.trim(),
21124
- rejected_attempts: rejected
21125
- },
21126
- status: "success",
21127
- exitMethod: "saved"
21128
- });
21170
+ finish(check.path, rawPath);
21129
21171
  onConfirm(check.path);
21130
21172
  };
21131
21173
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
@@ -21162,6 +21204,7 @@ var init_screen3 = __esm({
21162
21204
  init_debug_store();
21163
21205
  init_ClearableTextInput();
21164
21206
  init_controls5();
21207
+ init_log3();
21165
21208
  init_logic6();
21166
21209
  init_validate_path();
21167
21210
  init_ControlHints();
@@ -22763,7 +22806,7 @@ function scopeGateLogOutputs(components, decisions) {
22763
22806
  };
22764
22807
  }
22765
22808
  var MAX_NAMES, capped;
22766
- var init_log3 = __esm({
22809
+ var init_log4 = __esm({
22767
22810
  "packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts"() {
22768
22811
  "use strict";
22769
22812
  MAX_NAMES = 20;
@@ -25662,7 +25705,7 @@ var init_screen8 = __esm({
25662
25705
  "use strict";
25663
25706
  init_debug_store();
25664
25707
  init_StepHeader();
25665
- init_log3();
25708
+ init_log4();
25666
25709
  init_tokens_column();
25667
25710
  init_load();
25668
25711
  init_logic10();
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.43.1-dev-build-30e824d7.0",
3
+ "version": "2.43.1-dev-build-1205d418.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,24 @@
1
+ import { type ImportTarget } from '../00-preflight/logic.js';
2
+ /** A path that was turned down, as typed, with the reason the user was shown. */
3
+ export type RejectedAttempt = {
4
+ entered: string;
5
+ error: string;
6
+ resolved_path?: string;
7
+ };
8
+ /** The log's two sections: `summary` for a person, `data` for AI, both carrying the same facts. */
9
+ export declare function tokenInputLog({ mode, tokenPath, enteredPath, initialPath, rejected, emptySubmits, endedOnError, }: {
10
+ mode: ImportTarget;
11
+ /** The token file the user continued with, or null when they went back. */
12
+ tokenPath: string | null;
13
+ /** What they typed to get there, before it was resolved. */
14
+ enteredPath: string;
15
+ initialPath: string;
16
+ rejected: readonly RejectedAttempt[];
17
+ /** How many times Enter was pressed on an empty field. Counted apart from the rejected paths. */
18
+ emptySubmits: number;
19
+ /** The error still showing when the user went back, if there was one. */
20
+ endedOnError: string | undefined;
21
+ }): {
22
+ summary: string[];
23
+ data: Record<string, unknown>;
24
+ };
@@ -31,7 +31,7 @@ export declare function useScopeGate({ components, tokenCount, tokensWidth, onCo
31
31
  emptyMessage: string | undefined;
32
32
  safeCursor: number;
33
33
  scrollOffset: number;
34
- selectionStateByKey: Map<string, "accepted" | "rejected" | "undecided">;
34
+ selectionStateByKey: Map<string, "rejected" | "accepted" | "undecided">;
35
35
  aiFlaggedByKey: Map<string, boolean>;
36
36
  dimPredicate: ((componentKey: string) => boolean) | undefined;
37
37
  columnOneView: "flat" | "grouped";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.43.1-dev-build-30e824d7.0",
3
+ "version": "2.43.1-dev-build-1205d418.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-types": "2.43.1-dev-build-30e824d7.0"
48
+ "@contentful/experience-design-system-types": "2.43.1-dev-build-1205d418.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@tsconfig/node24": "^24.0.4",
@@ -59,7 +59,7 @@
59
59
  "ink-testing-library": "^4.0.0",
60
60
  "typescript-eslint": "^8.67.0",
61
61
  "vitest": "^4.0.16",
62
- "@contentful/experience-design-system-backend-pipeline": "2.43.1-dev-build-30e824d7.0"
62
+ "@contentful/experience-design-system-backend-pipeline": "2.43.1-dev-build-1205d418.0"
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",