@contentful/experience-design-system-cli 2.37.1-dev-build-c24a406c.0 → 2.37.1-dev-build-76b10f7f.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-c24a406c.0",
3
+ "version": "2.37.1-dev-build-76b10f7f.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -5,22 +5,21 @@ 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 = 'inputs' | 'credentials' | 'component-extraction' | 'token-generation' | 'scope-gate' | 'generation' | 'review' | 'save-push';
8
+ export type ImportStepId = 'project' | 'token-file' | 'path-validation' | '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;
15
14
  }
16
15
  /**
17
16
  * The input screen to show: the first step of this mode whose answer is still missing, or 'credentials' once every
18
17
  * earlier one is answered. A mode never shows a screen it does not list, so skipping one needs no special case.
19
18
  */
20
- export declare function currentInputStep(target: ImportTarget, answers: InputAnswers): Extract<ImportStepId, 'inputs' | 'credentials'>;
19
+ export declare function currentInputStep(target: ImportTarget, answers: InputAnswers): Extract<ImportStepId, 'project' | 'token-file' | 'path-validation' | 'credentials'>;
21
20
  /**
22
21
  * What Back from `current` does: leave for the preflight when it is the first screen of the mode, otherwise clear the
23
- * previous step's answer so that screen shows again. The paths stay, so the screen is not empty when it comes back.
22
+ * previous step's answer so that screen shows again.
24
23
  */
25
24
  export declare function goBack(target: ImportTarget, current: ImportStepId, answers: InputAnswers): {
26
25
  to: 'preflight';
@@ -0,0 +1,11 @@
1
+ export declare const WELCOME_CONTROLS: readonly [{
2
+ readonly keys: "Enter";
3
+ readonly label: "Continue";
4
+ }, {
5
+ readonly keys: "Ctrl+D";
6
+ readonly label: "Clear";
7
+ }, {
8
+ readonly keys: "Esc";
9
+ readonly label: "Back";
10
+ }];
11
+ export declare function useWelcomeControls(onQuit: () => void): void;
@@ -0,0 +1,6 @@
1
+ interface QuitKey {
2
+ escape: boolean;
3
+ }
4
+ export declare function shouldQuit(key: QuitKey): boolean;
5
+ export declare function toProjectPath(value: string): string | null;
6
+ export {};
@@ -0,0 +1,8 @@
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 {};
@@ -0,0 +1,11 @@
1
+ export declare const TOKEN_INPUT_CONTROLS: readonly [{
2
+ readonly keys: "Enter";
3
+ readonly label: "Continue";
4
+ }, {
5
+ readonly keys: "Ctrl+D";
6
+ readonly label: "Clear";
7
+ }, {
8
+ readonly keys: "Esc";
9
+ readonly label: "Back";
10
+ }];
11
+ export declare function useTokenInputControls(onBack: () => void): void;
@@ -0,0 +1,6 @@
1
+ interface Key {
2
+ escape: boolean;
3
+ }
4
+ export declare function shouldGoBack(key: Key): boolean;
5
+ export declare function toTokenPath(value: string): string | null;
6
+ export {};
@@ -0,0 +1,8 @@
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 {};
@@ -0,0 +1,13 @@
1
+ import { type PathPhase } from './logic.js';
2
+ interface Control {
3
+ keys: string;
4
+ label: string;
5
+ }
6
+ interface PathValidationHandlers {
7
+ onConfirm: () => void;
8
+ onChangePath: () => void;
9
+ onBack: () => void;
10
+ }
11
+ export declare function controlsFor(phase: PathPhase): readonly Control[];
12
+ export declare function usePathValidationControls(phase: PathPhase, handlers: PathValidationHandlers): void;
13
+ export {};
@@ -1,2 +1,2 @@
1
- import type { ScanResult } from '../scan-logic.js';
1
+ import type { ScanResult } from '../logic.js';
2
2
  export declare function scanFiles(directory: string): ScanResult;
@@ -12,7 +12,9 @@ export type ScanResult = {
12
12
  ok: false;
13
13
  failure: ScanFailureCode;
14
14
  };
15
- interface SummaryRow {
15
+ export type PathPhase = 'scanning' | 'ready' | 'failed';
16
+ export type KeyAction = 'confirm' | 'change-path' | 'back';
17
+ export interface SummaryRow {
16
18
  label: string;
17
19
  count: number;
18
20
  tone: 'default' | 'accent' | 'muted';
@@ -26,6 +28,10 @@ export interface FailureMessage {
26
28
  headline: string;
27
29
  hints: string[];
28
30
  }
31
+ interface Key {
32
+ escape: boolean;
33
+ return: boolean;
34
+ }
29
35
  export declare function describeFailure(failure: ScanFailureCode, path: string): FailureMessage;
30
36
  /**
31
37
  * The scan result as rows and a warning. When the import does not generate tokens (components only), `.json` files are
@@ -34,4 +40,6 @@ export declare function describeFailure(failure: ScanFailureCode, path: string):
34
40
  export declare function summarize(counts: FileCounts, { hasTokens }?: {
35
41
  hasTokens?: boolean;
36
42
  }): Summary;
43
+ export declare function phaseOf(scan: ScanResult | undefined): PathPhase;
44
+ export declare function keyAction(phase: PathPhase, input: string, key: Key): KeyAction | undefined;
37
45
  export {};
@@ -0,0 +1,14 @@
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,4 +1,6 @@
1
1
  export { PreflightScreen } from './00-preflight/screen.js';
2
- export { InputsScreen } from './01-inputs/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';
3
5
  export { CredentialsScreen } from './04-credentials/screen.js';
4
6
  export { ExtractionScreen } from './06-extraction/screen.js';
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-c24a406c.0",
3
+ "version": "2.37.1-dev-build-76b10f7f.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-c24a406c.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-c24a406c.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-76b10f7f.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-76b10f7f.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",
@@ -1,12 +0,0 @@
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
- };
@@ -1,17 +0,0 @@
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,50 +0,0 @@
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 {};