@contentful/experience-design-system-cli 2.40.1-dev-build-08f065f9.0 → 2.40.1-dev-build-35756f2e.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
@@ -3391,6 +3391,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3391
3391
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
3392
3392
  import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
3393
3393
  import { Box as Box12, Text as Text12 } from "ink";
3394
+ init_debug_store();
3394
3395
 
3395
3396
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
3396
3397
  import { useInput as useInput9 } from "ink";
@@ -3451,6 +3452,19 @@ function summarize(counts, { hasTokens = true } = {}) {
3451
3452
  warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
3452
3453
  };
3453
3454
  }
3455
+ function scanReport(scan, path5, { hasTokens = true } = {}) {
3456
+ if (scan === void 0) return { scan: "unfinished" };
3457
+ if (!scan.ok) return { scan: "failed", failure: scan.failure, error: describeFailure(scan.failure, path5).headline };
3458
+ const { total, warning } = summarize(scan.counts, { hasTokens });
3459
+ const { total: _total, ...byType } = scan.counts;
3460
+ return {
3461
+ scan: "ok",
3462
+ files_found: total,
3463
+ counts: Object.fromEntries(Object.entries(byType).filter(([, count]) => count > 0)),
3464
+ ...warning ? { warning } : {},
3465
+ ...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
3466
+ };
3467
+ }
3454
3468
  function phaseOf(scan) {
3455
3469
  if (scan === void 0) return "scanning";
3456
3470
  return scan.ok ? "ready" : "failed";
@@ -18038,6 +18052,7 @@ function Summary({
18038
18052
  ] });
18039
18053
  }
18040
18054
  function PathValidationScreen({
18055
+ mode,
18041
18056
  projectPath,
18042
18057
  onConfirm,
18043
18058
  onChangePath,
@@ -18046,16 +18061,39 @@ function PathValidationScreen({
18046
18061
  }) {
18047
18062
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
18048
18063
  const [scan, setScan] = useState7();
18064
+ useEffect6(() => {
18065
+ startDebugRun({
18066
+ flow: "import/path-validation",
18067
+ step: "03-path-validation",
18068
+ menuOption: "Path validation",
18069
+ inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
18070
+ });
18071
+ }, []);
18049
18072
  useEffect6(() => {
18050
18073
  setScan(scanFiles(resolvedPath));
18051
18074
  }, [resolvedPath]);
18052
18075
  const phase = phaseOf(scan);
18076
+ const finish = (outcome, exitMethod) => {
18077
+ void finishDebugRun({
18078
+ outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
18079
+ status: scan?.ok === false ? "error" : "success",
18080
+ exitMethod
18081
+ });
18082
+ };
18053
18083
  usePathValidationControls(phase, {
18054
18084
  onConfirm: () => {
18055
- if (scan?.ok) onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
18085
+ if (!scan?.ok) return;
18086
+ finish("continued", "saved");
18087
+ onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
18056
18088
  },
18057
- onChangePath,
18058
- onBack
18089
+ onChangePath: () => {
18090
+ finish("changed-path", "discarded");
18091
+ onChangePath();
18092
+ },
18093
+ onBack: () => {
18094
+ finish("back", "discarded");
18095
+ onBack();
18096
+ }
18059
18097
  });
18060
18098
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
18061
18099
  /* @__PURE__ */ jsx13(StepHeader, { step: "setup" }),
@@ -31038,6 +31076,7 @@ function App({ importOptions, inkClear }) {
31038
31076
  return /* @__PURE__ */ jsx66(
31039
31077
  PathValidationScreen,
31040
31078
  {
31079
+ mode: target,
31041
31080
  projectPath: answers.projectPath ?? "",
31042
31081
  hasTokens: target !== "components",
31043
31082
  onConfirm: ({ filePaths }) => answer({ scannedFiles: filePaths }),
package/dist/index.js CHANGED
@@ -20625,6 +20625,19 @@ function summarize(counts, { hasTokens = true } = {}) {
20625
20625
  warning: hasTokens ? "No component or token files found. Try a different path." : "No component files found. Try a different path."
20626
20626
  };
20627
20627
  }
20628
+ function scanReport(scan, path5, { hasTokens = true } = {}) {
20629
+ if (scan === void 0) return { scan: "unfinished" };
20630
+ if (!scan.ok) return { scan: "failed", failure: scan.failure, error: describeFailure(scan.failure, path5).headline };
20631
+ const { total, warning } = summarize(scan.counts, { hasTokens });
20632
+ const { total: _total, ...byType } = scan.counts;
20633
+ return {
20634
+ scan: "ok",
20635
+ files_found: total,
20636
+ counts: Object.fromEntries(Object.entries(byType).filter(([, count]) => count > 0)),
20637
+ ...warning ? { warning } : {},
20638
+ ...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
20639
+ };
20640
+ }
20628
20641
  function phaseOf(scan) {
20629
20642
  if (scan === void 0) return "scanning";
20630
20643
  return scan.ok ? "ready" : "failed";
@@ -20763,6 +20776,7 @@ function Summary({
20763
20776
  ] });
20764
20777
  }
20765
20778
  function PathValidationScreen({
20779
+ mode,
20766
20780
  projectPath,
20767
20781
  onConfirm,
20768
20782
  onChangePath,
@@ -20771,16 +20785,39 @@ function PathValidationScreen({
20771
20785
  }) {
20772
20786
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
20773
20787
  const [scan, setScan] = useState7();
20788
+ useEffect6(() => {
20789
+ startDebugRun({
20790
+ flow: "import/path-validation",
20791
+ step: "03-path-validation",
20792
+ menuOption: "Path validation",
20793
+ inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
20794
+ });
20795
+ }, []);
20774
20796
  useEffect6(() => {
20775
20797
  setScan(scanFiles(resolvedPath));
20776
20798
  }, [resolvedPath]);
20777
20799
  const phase = phaseOf(scan);
20800
+ const finish = (outcome, exitMethod) => {
20801
+ void finishDebugRun({
20802
+ outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
20803
+ status: scan?.ok === false ? "error" : "success",
20804
+ exitMethod
20805
+ });
20806
+ };
20778
20807
  usePathValidationControls(phase, {
20779
20808
  onConfirm: () => {
20780
- if (scan?.ok) onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
20809
+ if (!scan?.ok) return;
20810
+ finish("continued", "saved");
20811
+ onConfirm({ projectPath: resolvedPath, filePaths: scan.filePaths });
20812
+ },
20813
+ onChangePath: () => {
20814
+ finish("changed-path", "discarded");
20815
+ onChangePath();
20781
20816
  },
20782
- onChangePath,
20783
- onBack
20817
+ onBack: () => {
20818
+ finish("back", "discarded");
20819
+ onBack();
20820
+ }
20784
20821
  });
20785
20822
  return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
20786
20823
  /* @__PURE__ */ jsx13(StepHeader, { step: "setup" }),
@@ -20800,6 +20837,7 @@ var init_screen4 = __esm({
20800
20837
  "packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx"() {
20801
20838
  "use strict";
20802
20839
  init_theme();
20840
+ init_debug_store();
20803
20841
  init_resolve_user_path();
20804
20842
  init_controls6();
20805
20843
  init_scan_files();
@@ -34855,6 +34893,7 @@ function App({ importOptions, inkClear }) {
34855
34893
  return /* @__PURE__ */ jsx66(
34856
34894
  PathValidationScreen,
34857
34895
  {
34896
+ mode: target,
34858
34897
  projectPath: answers.projectPath ?? "",
34859
34898
  hasTokens: target !== "components",
34860
34899
  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-08f065f9.0",
3
+ "version": "2.40.1-dev-build-35756f2e.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-08f065f9.0",
3
+ "version": "2.40.1-dev-build-35756f2e.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-08f065f9.0"
48
+ "@contentful/experience-design-system-types": "2.40.1-dev-build-35756f2e.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-08f065f9.0"
62
+ "@contentful/experience-design-system-backend-pipeline": "2.40.1-dev-build-35756f2e.0"
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",