@contentful/experience-design-system-cli 2.40.1-dev-build-b9f92429.0 → 2.40.1-dev-build-54dd0c33.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
@@ -3437,6 +3437,7 @@ function TokenInputScreen({
3437
3437
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
3438
3438
  import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
3439
3439
  import { Box as Box12, Text as Text12 } from "ink";
3440
+ init_debug_store();
3440
3441
 
3441
3442
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
3442
3443
  import { useInput as useInput9 } from "ink";
@@ -3497,6 +3498,19 @@ function summarize(counts, { hasTokens = true } = {}) {
3497
3498
  warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
3498
3499
  };
3499
3500
  }
3501
+ function scanReport(scan, path5, { hasTokens = true } = {}) {
3502
+ if (scan === void 0) return { scan: "unfinished" };
3503
+ if (!scan.ok) return { scan: "failed", failure: scan.failure, error: describeFailure(scan.failure, path5).headline };
3504
+ const { total, warning } = summarize(scan.counts, { hasTokens });
3505
+ const { total: _total, ...byType } = scan.counts;
3506
+ return {
3507
+ scan: "ok",
3508
+ files_found: total,
3509
+ counts: Object.fromEntries(Object.entries(byType).filter(([, count]) => count > 0)),
3510
+ ...warning ? { warning } : {},
3511
+ ...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
3512
+ };
3513
+ }
3500
3514
  function phaseOf(scan) {
3501
3515
  if (scan === void 0) return "scanning";
3502
3516
  return scan.ok ? "ready" : "failed";
@@ -18084,6 +18098,7 @@ function Summary({
18084
18098
  ] });
18085
18099
  }
18086
18100
  function PathValidationScreen({
18101
+ mode,
18087
18102
  projectPath,
18088
18103
  onConfirm,
18089
18104
  onChangePath,
@@ -18092,16 +18107,39 @@ function PathValidationScreen({
18092
18107
  }) {
18093
18108
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
18094
18109
  const [scan, setScan] = useState7();
18110
+ useEffect7(() => {
18111
+ startDebugRun({
18112
+ flow: "import/path-validation",
18113
+ step: "03-path-validation",
18114
+ menuOption: "Path validation",
18115
+ inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
18116
+ });
18117
+ }, []);
18095
18118
  useEffect7(() => {
18096
18119
  setScan(scanFiles(resolvedPath));
18097
18120
  }, [resolvedPath]);
18098
18121
  const phase = phaseOf(scan);
18122
+ const finish = (outcome, exitMethod) => {
18123
+ void finishDebugRun({
18124
+ outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
18125
+ status: scan?.ok === false ? "error" : "success",
18126
+ exitMethod
18127
+ });
18128
+ };
18099
18129
  usePathValidationControls(phase, {
18100
18130
  onConfirm: () => {
18101
- if (scan?.ok) onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
18131
+ if (!scan?.ok) return;
18132
+ finish("continued", "saved");
18133
+ onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
18102
18134
  },
18103
- onChangePath,
18104
- onBack
18135
+ onChangePath: () => {
18136
+ finish("changed-path", "discarded");
18137
+ onChangePath();
18138
+ },
18139
+ onBack: () => {
18140
+ finish("back", "discarded");
18141
+ onBack();
18142
+ }
18105
18143
  });
18106
18144
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
18107
18145
  /* @__PURE__ */ jsx13(StepHeader, { step: "setup" }),
@@ -31085,6 +31123,7 @@ function App({ importOptions, inkClear }) {
31085
31123
  return /* @__PURE__ */ jsx66(
31086
31124
  PathValidationScreen,
31087
31125
  {
31126
+ mode: target,
31088
31127
  projectPath: answers.projectPath ?? "",
31089
31128
  hasTokens: target !== "components",
31090
31129
  onConfirm: ({ filePaths }) => answer({ scannedFiles: filePaths }),
package/dist/index.js CHANGED
@@ -20672,6 +20672,19 @@ function summarize(counts, { hasTokens = true } = {}) {
20672
20672
  warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
20673
20673
  };
20674
20674
  }
20675
+ function scanReport(scan, path5, { hasTokens = true } = {}) {
20676
+ if (scan === void 0) return { scan: "unfinished" };
20677
+ if (!scan.ok) return { scan: "failed", failure: scan.failure, error: describeFailure(scan.failure, path5).headline };
20678
+ const { total, warning } = summarize(scan.counts, { hasTokens });
20679
+ const { total: _total, ...byType } = scan.counts;
20680
+ return {
20681
+ scan: "ok",
20682
+ files_found: total,
20683
+ counts: Object.fromEntries(Object.entries(byType).filter(([, count]) => count > 0)),
20684
+ ...warning ? { warning } : {},
20685
+ ...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
20686
+ };
20687
+ }
20675
20688
  function phaseOf(scan) {
20676
20689
  if (scan === void 0) return "scanning";
20677
20690
  return scan.ok ? "ready" : "failed";
@@ -20810,6 +20823,7 @@ function Summary({
20810
20823
  ] });
20811
20824
  }
20812
20825
  function PathValidationScreen({
20826
+ mode,
20813
20827
  projectPath,
20814
20828
  onConfirm,
20815
20829
  onChangePath,
@@ -20818,16 +20832,39 @@ function PathValidationScreen({
20818
20832
  }) {
20819
20833
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20820
20834
  const [scan, setScan] = useState7();
20835
+ useEffect7(() => {
20836
+ startDebugRun({
20837
+ flow: "import/path-validation",
20838
+ step: "03-path-validation",
20839
+ menuOption: "Path validation",
20840
+ inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
20841
+ });
20842
+ }, []);
20821
20843
  useEffect7(() => {
20822
20844
  setScan(scanFiles(resolvedPath));
20823
20845
  }, [resolvedPath]);
20824
20846
  const phase = phaseOf(scan);
20847
+ const finish = (outcome, exitMethod) => {
20848
+ void finishDebugRun({
20849
+ outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
20850
+ status: scan?.ok === false ? "error" : "success",
20851
+ exitMethod
20852
+ });
20853
+ };
20825
20854
  usePathValidationControls(phase, {
20826
20855
  onConfirm: () => {
20827
- if (scan?.ok) onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
20856
+ if (!scan?.ok) return;
20857
+ finish("continued", "saved");
20858
+ onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
20859
+ },
20860
+ onChangePath: () => {
20861
+ finish("changed-path", "discarded");
20862
+ onChangePath();
20828
20863
  },
20829
- onChangePath,
20830
- onBack
20864
+ onBack: () => {
20865
+ finish("back", "discarded");
20866
+ onBack();
20867
+ }
20831
20868
  });
20832
20869
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
20833
20870
  /* @__PURE__ */ jsx13(StepHeader, { step: "setup" }),
@@ -20847,6 +20884,7 @@ var init_screen4 = __esm({
20847
20884
  "packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx"() {
20848
20885
  "use strict";
20849
20886
  init_theme();
20887
+ init_debug_store();
20850
20888
  init_resolve_user_path();
20851
20889
  init_controls6();
20852
20890
  init_scan_files();
@@ -34903,6 +34941,7 @@ function App({ importOptions, inkClear }) {
34903
34941
  return /* @__PURE__ */ jsx66(
34904
34942
  PathValidationScreen,
34905
34943
  {
34944
+ mode: target,
34906
34945
  projectPath: answers.projectPath ?? "",
34907
34946
  hasTokens: target !== "components",
34908
34947
  onConfirm: ({ filePaths }) => answer({ scannedFiles: filePaths }),
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.40.1-dev-build-b9f92429.0",
3
+ "version": "2.40.1-dev-build-54dd0c33.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,6 +40,14 @@ export declare function describeFailure(failure: ScanFailureCode, path: string):
40
40
  export declare function summarize(counts: FileCounts, { hasTokens }?: {
41
41
  hasTokens?: boolean;
42
42
  }): Summary;
43
+ /**
44
+ * What the debug log says about a scan: the counts and warnings when it worked, or the failure and the message the user
45
+ * saw when it did not. File paths are left out, since a project can have thousands; the counts are what show whether
46
+ * the scan found the components.
47
+ */
48
+ export declare function scanReport(scan: ScanResult | undefined, path: string, { hasTokens }?: {
49
+ hasTokens?: boolean;
50
+ }): Record<string, unknown>;
43
51
  export declare function phaseOf(scan: ScanResult | undefined): PathPhase;
44
52
  export declare function keyAction(phase: PathPhase, input: string, key: Key): KeyAction | undefined;
45
53
  export {};
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
+ import type { ImportTarget } from '../00-preflight/logic.js';
2
3
  interface PathValidationScreenProps {
4
+ /** What the user chose to import at Preflight; it decides which steps run, so every log notes it. */
5
+ mode: ImportTarget;
3
6
  projectPath: string;
4
7
  onConfirm: (result: {
5
8
  projectPath: string;
@@ -10,5 +13,5 @@ interface PathValidationScreenProps {
10
13
  /** False when the import does not generate tokens, so `.json` files are not described as design tokens. */
11
14
  hasTokens?: boolean;
12
15
  }
13
- export declare function PathValidationScreen({ projectPath, onConfirm, onChangePath, onBack, hasTokens, }: PathValidationScreenProps): React.ReactElement;
16
+ export declare function PathValidationScreen({ mode, projectPath, onConfirm, onChangePath, onBack, hasTokens, }: PathValidationScreenProps): React.ReactElement;
14
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.40.1-dev-build-b9f92429.0",
3
+ "version": "2.40.1-dev-build-54dd0c33.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.40.1-dev-build-b9f92429.0"
48
+ "@contentful/experience-design-system-types": "2.40.1-dev-build-54dd0c33.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.40.1-dev-build-b9f92429.0"
62
+ "@contentful/experience-design-system-backend-pipeline": "2.40.1-dev-build-54dd0c33.0"
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",