@contentful/experience-design-system-cli 2.37.1-dev-build-2aacedbd.0 → 2.37.1-dev-build-c24a406c.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-2aacedbd.0",
3
+ "version": "2.37.1-dev-build-c24a406c.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -5,21 +5,22 @@ export declare const IMPORT_TARGET_OPTIONS: ReadonlyArray<{
5
5
  label: string;
6
6
  }>;
7
7
  export declare function overviewFor(target: ImportTarget): readonly OverviewStep[];
8
- export type ImportStepId = 'project' | 'token-file' | 'path-validation' | 'credentials' | 'component-extraction' | 'token-generation' | 'scope-gate' | 'generation' | 'review' | 'save-push';
8
+ export type ImportStepId = 'inputs' | 'credentials' | 'component-extraction' | 'token-generation' | 'scope-gate' | 'generation' | 'review' | 'save-push';
9
9
  export declare function stepsFor(target: ImportTarget): readonly ImportStepId[];
10
10
  export interface InputAnswers {
11
11
  projectPath?: string;
12
12
  tokensPath?: string;
13
13
  scannedFiles?: string[];
14
+ confirmed?: boolean;
14
15
  }
15
16
  /**
16
17
  * The input screen to show: the first step of this mode whose answer is still missing, or 'credentials' once every
17
18
  * earlier one is answered. A mode never shows a screen it does not list, so skipping one needs no special case.
18
19
  */
19
- export declare function currentInputStep(target: ImportTarget, answers: InputAnswers): Extract<ImportStepId, 'project' | 'token-file' | 'path-validation' | 'credentials'>;
20
+ export declare function currentInputStep(target: ImportTarget, answers: InputAnswers): Extract<ImportStepId, 'inputs' | 'credentials'>;
20
21
  /**
21
22
  * What Back from `current` does: leave for the preflight when it is the first screen of the mode, otherwise clear the
22
- * previous step's answer so that screen shows again.
23
+ * previous step's answer so that screen shows again. The paths stay, so the screen is not empty when it comes back.
23
24
  */
24
25
  export declare function goBack(target: ImportTarget, current: ImportStepId, answers: InputAnswers): {
25
26
  to: 'preflight';
@@ -1,2 +1,2 @@
1
- import type { ScanResult } from '../logic.js';
1
+ import type { ScanResult } from '../scan-logic.js';
2
2
  export declare function scanFiles(directory: string): ScanResult;
@@ -0,0 +1,12 @@
1
+ import type { ImportTarget } from '../00-preflight/logic.js';
2
+ import { type FileCounts } from './scan-logic.js';
3
+ export type InputField = 'projectPath' | 'tokensPath';
4
+ export type InputValues = Record<InputField, string>;
5
+ /** The paths a mode asks for. A mode never shows the one it does not use. */
6
+ export declare function fieldsFor(target: ImportTarget): readonly InputField[];
7
+ export declare function trimmed(value: string): string | null;
8
+ /** The scan as one line, such as "167 files: 6 .tsx files · 100 .json files (design tokens)", and the warning if any. */
9
+ export declare function describeScan(counts: FileCounts, hasTokens: boolean): {
10
+ line: string;
11
+ warning?: string;
12
+ };
@@ -12,8 +12,7 @@ export type ScanResult = {
12
12
  ok: false;
13
13
  failure: ScanFailureCode;
14
14
  };
15
- export type PathPhase = 'scanning' | 'ready' | 'failed';
16
- export interface SummaryRow {
15
+ interface SummaryRow {
17
16
  label: string;
18
17
  count: number;
19
18
  tone: 'default' | 'accent' | 'muted';
@@ -35,5 +34,4 @@ export declare function describeFailure(failure: ScanFailureCode, path: string):
35
34
  export declare function summarize(counts: FileCounts, { hasTokens }?: {
36
35
  hasTokens?: boolean;
37
36
  }): Summary;
38
- export declare function phaseOf(scan: ScanResult | undefined): PathPhase;
39
37
  export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { ImportTarget } from '../00-preflight/logic.js';
3
+ import { type InputValues } from './logic.js';
4
+ interface InputsResult {
5
+ projectPath?: string;
6
+ tokensPath?: string;
7
+ scannedFiles?: string[];
8
+ }
9
+ interface InputsScreenProps {
10
+ target: ImportTarget;
11
+ /** What an earlier visit or the saved settings already hold. */
12
+ initial?: Partial<InputValues>;
13
+ onConfirm: (result: InputsResult) => void;
14
+ onBack: () => void;
15
+ }
16
+ export declare function InputsScreen({ target, initial, onConfirm, onBack }: InputsScreenProps): React.ReactElement;
17
+ export {};
@@ -1,6 +1,4 @@
1
1
  export { PreflightScreen } from './00-preflight/screen.js';
2
- export { WelcomeScreen } from './01-welcome/screen.js';
3
- export { TokenInputScreen } from './02-token-input/screen.js';
4
- export { PathValidationScreen } from './03-path-validation/screen.js';
2
+ export { InputsScreen } from './01-inputs/screen.js';
5
3
  export { CredentialsScreen } from './04-credentials/screen.js';
6
4
  export { ExtractionScreen } from './06-extraction/screen.js';
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ export interface SetupMenuItem<C extends string> {
3
+ /** `edit` is reserved: choosing it turns the rows below into inputs. */
4
+ choice: C;
5
+ label: string;
6
+ /** What choosing it does, shown dimmed after the label. */
7
+ description: string;
8
+ }
9
+ export interface SetupField<K extends string> {
10
+ key: K;
11
+ label: string;
12
+ /** Shows dots instead of the value, for secrets. */
13
+ masked?: boolean;
14
+ /** Shown dimmed in the value's place while it is empty. */
15
+ hint?: string;
16
+ /** What is known about the value, such as the result of checking it. Shown under the row. */
17
+ note?: React.ReactNode;
18
+ }
19
+ interface SetupFormProps<K extends string, C extends string> {
20
+ title: string;
21
+ subtitle?: string;
22
+ menu: readonly SetupMenuItem<C>[];
23
+ /** The heading over the values, which sit under a divider and are not part of the menu. */
24
+ dataTitle: string;
25
+ fields: readonly SetupField<K>[];
26
+ values: Record<K, string>;
27
+ /** Called on every keystroke while a field is open. */
28
+ onChange: (key: K, value: string) => void;
29
+ /** Called when the last field is done, so the caller can check what was entered. */
30
+ onCommit: () => void;
31
+ /** Called when editing is cancelled with Esc, so the caller can put the earlier values back. */
32
+ onCancel: () => void;
33
+ onEditStart?: () => void;
34
+ onChoose: (choice: Exclude<C, 'edit'>) => void;
35
+ /** What Esc does from the menu. */
36
+ onEscape: () => void;
37
+ /** Opens with the fields already editable, for a step with nothing to review yet. */
38
+ initialEditing?: boolean;
39
+ /** Ignores keys while something is in flight. */
40
+ busy?: boolean;
41
+ /** Shown under the values, for read-only content that belongs to the same screen. */
42
+ children?: React.ReactNode;
43
+ }
44
+ /**
45
+ * The layout the setup steps share. A menu of actions sits on top and the values sit below a divider. `Edit` does not
46
+ * change screens: the same rows become inputs where they are, the menu stays put (dimmed), and finishing the last field
47
+ * puts the cursor back on the first menu item.
48
+ */
49
+ export declare function SetupForm<K extends string, C extends string>({ title, subtitle, menu, dataTitle, fields, values, onChange, onCommit, onCancel, onEditStart, onChoose, onEscape, initialEditing, busy, children, }: SetupFormProps<K, C>): React.ReactElement;
50
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-2aacedbd.0",
3
+ "version": "2.37.1-dev-build-c24a406c.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,8 +45,8 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-2aacedbd.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-2aacedbd.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-c24a406c.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-c24a406c.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",
@@ -1 +0,0 @@
1
- export declare function toProjectPath(value: string): string | null;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface WelcomeScreenProps {
3
- onContinue: (projectPath: string) => void;
4
- onQuit: () => void;
5
- initialPath?: string;
6
- }
7
- export declare function WelcomeScreen({ onContinue, onQuit, initialPath }: WelcomeScreenProps): React.ReactElement;
8
- export {};
@@ -1 +0,0 @@
1
- export declare function toTokenPath(value: string): string | null;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface TokenInputScreenProps {
3
- onConfirm: (tokensPath: string) => void;
4
- onBack: () => void;
5
- initialPath?: string;
6
- }
7
- export declare function TokenInputScreen({ onConfirm, onBack, initialPath }: TokenInputScreenProps): React.ReactElement;
8
- export {};
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- interface PathValidationScreenProps {
3
- projectPath: string;
4
- onConfirm: (result: {
5
- projectPath: string;
6
- filePaths: string[];
7
- }) => void;
8
- onChangePath: () => void;
9
- onBack: () => void;
10
- /** False when the import does not generate tokens, so `.json` files are not described as design tokens. */
11
- hasTokens?: boolean;
12
- }
13
- export declare function PathValidationScreen({ projectPath, onConfirm, onChangePath, onBack, hasTokens, }: PathValidationScreenProps): React.ReactElement;
14
- export {};
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- export interface MenuItem<C extends string> {
3
- choice: C;
4
- label: string;
5
- /** What choosing it does, shown dimmed after the label. */
6
- description: string;
7
- }
8
- interface MenuRow {
9
- label: string;
10
- /** Shown bold; an empty value shows "(empty)". */
11
- value: string;
12
- }
13
- interface MenuScreenProps<C extends string> {
14
- title: string;
15
- subtitle?: string;
16
- menu: readonly MenuItem<C>[];
17
- /** Read-only values shown under the menu, lined up with it. */
18
- rows?: readonly MenuRow[];
19
- onChoose: (choice: C) => void;
20
- /** What Esc does. */
21
- onEscape: () => void;
22
- /** The heading over the read-only part, which sits under a divider and is never focusable. */
23
- dataTitle?: string;
24
- /** Ignores keys while something is in flight. */
25
- busy?: boolean;
26
- /** Shown after the rows, for read-only content that belongs to the same screen. */
27
- children?: React.ReactNode;
28
- }
29
- /**
30
- * The layout the setup steps share: a title, a menu of actions on top, the read-only data below it and the key hints.
31
- * Values are never edited here; an `Edit` item opens the step's own input instead.
32
- */
33
- export declare function MenuScreen<C extends string>({ title, subtitle, menu, rows, onChoose, onEscape, dataTitle, busy, children, }: MenuScreenProps<C>): React.ReactElement;
34
- export {};
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- type PathCheck = {
3
- ok: true;
4
- path: string;
5
- } | {
6
- ok: false;
7
- error: string;
8
- resolvedPath?: string;
9
- };
10
- interface PathStepScreenProps {
11
- title: string;
12
- subtitle: string;
13
- /** The label of the read-only value and of the input, such as "Project path". */
14
- label: string;
15
- initialPath?: string;
16
- /** Trims the typed value; null when nothing was entered. */
17
- toPath: (value: string) => string | null;
18
- /** Runs when Continue is chosen. Its path is handed on; its error is shown under the path. */
19
- check: (path: string) => PathCheck;
20
- onContinue: (path: string) => void;
21
- onBack: () => void;
22
- }
23
- /**
24
- * A step that asks for one path. A path that is already known opens read-only with the menu above it, like the
25
- * credentials step; with none yet it opens straight in the input. `Edit` opens the input and Enter returns to the menu.
26
- */
27
- export declare function PathStepScreen({ title, subtitle, label, initialPath, toPath, check, onContinue, onBack, }: PathStepScreenProps): React.ReactElement;
28
- export {};