@contentful/experience-design-system-cli 2.37.1-dev-build-04aa2aa0.0 → 2.37.1-dev-build-758ea601.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.
Files changed (35) hide show
  1. package/dist/app.js +1868 -1705
  2. package/dist/index.js +1989 -1817
  3. package/dist/package.json +1 -1
  4. package/dist/src/tui/control-hints.d.ts +7 -0
  5. package/dist/src/tui/import/shared/gate-step/gate-step.d.ts +1 -3
  6. package/dist/src/tui/import/shared/running-step/logic.d.ts +1 -0
  7. package/dist/src/tui/import/shared/running-step/running-step.d.ts +4 -3
  8. package/dist/src/tui/import/steps/00-preflight/controls.d.ts +17 -0
  9. package/dist/src/tui/import/steps/00-preflight/logic.d.ts +43 -0
  10. package/dist/src/tui/import/steps/00-preflight/screen.d.ts +8 -0
  11. package/dist/src/tui/import/steps/01-welcome/controls.d.ts +1 -1
  12. package/dist/src/tui/import/steps/01-welcome/logic.d.ts +8 -0
  13. package/dist/src/tui/import/steps/01-welcome/screen.d.ts +3 -1
  14. package/dist/src/tui/import/steps/05-token-reuse/logic.d.ts +0 -7
  15. package/dist/src/tui/import/steps/06-extraction/logic.d.ts +13 -0
  16. package/dist/src/tui/import/steps/06-extraction/run-tokens-only.d.ts +31 -0
  17. package/dist/src/tui/import/steps/06-extraction/screen.d.ts +3 -1
  18. package/dist/src/tui/import/steps/06-extraction/use-tokens-only.d.ts +12 -0
  19. package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/LegendEntry.d.ts +2 -0
  20. package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/windowed-panel.d.ts +0 -4
  21. package/dist/src/tui/import/steps/07-scope-gate/sidebar/theme.d.ts +8 -0
  22. package/dist/src/tui/import/steps/08-generation/screen.d.ts +3 -1
  23. package/dist/src/tui/import/steps/10-flow/components/StepHeader.d.ts +8 -0
  24. package/dist/src/tui/import/steps/10-flow/flow/build-flow-start.d.ts +1 -0
  25. package/dist/src/tui/import/steps/10-flow/flow/controller.d.ts +7 -0
  26. package/dist/src/tui/import/steps/10-flow/screens/PushingStep.d.ts +3 -1
  27. package/dist/src/tui/import/steps/10-flow/screens/WizardPreviewStep.d.ts +3 -1
  28. package/dist/src/tui/import/steps/10-flow/support/preview-diff.d.ts +1 -1
  29. package/dist/src/tui/import/steps/index.d.ts +1 -1
  30. package/dist/src/tui/theme.d.ts +0 -2
  31. package/package.json +3 -3
  32. package/dist/src/tui/import/steps/05-token-reuse/screen.d.ts +0 -10
  33. package/dist/src/tui/shared/components/ControlHints.d.ts +0 -9
  34. package/dist/src/tui/shared/components/StepHeader.d.ts +0 -26
  35. /package/dist/src/tui/{shared/components/ClearableTextInput.d.ts → ClearableTextInput.d.ts} +0 -0
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-04aa2aa0.0",
3
+ "version": "2.37.1-dev-build-758ea601.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare function ControlHints({ hints }: {
3
+ hints: readonly {
4
+ keys: string;
5
+ label: string;
6
+ }[];
7
+ }): React.ReactElement;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { type StepHeaderProps } from '@tui/shared/components/StepHeader.js';
3
2
  interface GateStepProps {
4
3
  message: string;
5
4
  onContinue: () => void;
@@ -10,7 +9,6 @@ interface GateStepProps {
10
9
  skipLabel?: string;
11
10
  onSkip?: () => void;
12
11
  intent?: 'success' | 'error';
13
- step?: StepHeaderProps['step'];
14
12
  }
15
- export declare function GateStep({ message, onContinue, onQuit, summary, context, continueLabel, skipLabel, onSkip, intent, step, }: GateStepProps): React.ReactElement;
13
+ export declare function GateStep({ message, onContinue, onQuit, summary, context, continueLabel, skipLabel, onSkip, intent, }: GateStepProps): React.ReactElement;
16
14
  export {};
@@ -9,3 +9,4 @@ export interface RunningLine {
9
9
  }
10
10
  export declare function progressPercent(progress: Progress): number;
11
11
  export declare function formatElapsed(totalSeconds: number): string;
12
+ export declare function stepLabel(stepNumber: number, totalSteps: number, title: string): string;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { type RunningLine } from './logic.js';
3
- import type { ImportStepId } from '@tui/shared/components/StepHeader.js';
4
3
  interface RunningStepProps {
5
- step: ImportStepId;
4
+ stepNumber: number;
5
+ totalSteps: number;
6
+ title: string;
6
7
  description: string;
7
8
  lines?: readonly RunningLine[];
8
9
  }
9
- export declare function RunningStep({ step, description, lines, }: RunningStepProps): React.ReactElement;
10
+ export declare function RunningStep({ stepNumber, totalSteps, title, description, lines, }: RunningStepProps): React.ReactElement;
10
11
  export {};
@@ -0,0 +1,17 @@
1
+ import { type ImportTarget } from './logic.js';
2
+ export declare const PREFLIGHT_CONTROLS: readonly [{
3
+ readonly keys: "↑/↓";
4
+ readonly label: "Choose";
5
+ }, {
6
+ readonly keys: "Enter";
7
+ readonly label: "Continue";
8
+ }, {
9
+ readonly keys: "Esc";
10
+ readonly label: "Back to menu";
11
+ }];
12
+ export declare function usePreflightControls(handlers: {
13
+ focus: number;
14
+ onFocus: (focus: number) => void;
15
+ onChoose: (target: ImportTarget) => void;
16
+ onQuit: () => void;
17
+ }): void;
@@ -0,0 +1,43 @@
1
+ export type ImportTarget = 'both' | 'tokens' | 'components';
2
+ export declare const IMPORT_TARGET_OPTIONS: ReadonlyArray<{
3
+ target: ImportTarget;
4
+ label: string;
5
+ }>;
6
+ export type ImportStepId = 'project' | 'token-file' | 'path-validation' | 'credentials' | 'component-extraction' | 'token-generation' | 'scope-gate' | 'generation' | 'review' | 'save-push';
7
+ export declare function stepsFor(target: ImportTarget): readonly ImportStepId[];
8
+ export interface InputAnswers {
9
+ projectPath?: string;
10
+ tokensPath?: string;
11
+ scannedFiles?: string[];
12
+ }
13
+ /**
14
+ * The input screen to show: the first step of this mode whose answer is still missing, or 'credentials' once every
15
+ * earlier one is answered. A mode never shows a screen it does not list, so skipping one needs no special case.
16
+ */
17
+ export declare function currentInputStep(target: ImportTarget, answers: InputAnswers): Extract<ImportStepId, 'project' | 'token-file' | 'path-validation' | 'credentials'>;
18
+ /**
19
+ * What Back from `current` does: leave for the preflight when it is the first screen of the mode, otherwise clear the
20
+ * previous step's answer so that screen shows again.
21
+ */
22
+ export declare function goBack(target: ImportTarget, current: ImportStepId, answers: InputAnswers): {
23
+ to: 'preflight';
24
+ } | {
25
+ to: 'step';
26
+ answers: InputAnswers;
27
+ };
28
+ /**
29
+ * Where a run writes its files when it has no project to put them in: the Root Project Directory setting if there is
30
+ * one, otherwise the folder the token file is in. Components runs always have a project and use it.
31
+ */
32
+ export declare function runBaseDir(input: {
33
+ projectPath?: string;
34
+ tokensPath?: string;
35
+ configuredBaseDir?: string;
36
+ }): string;
37
+ interface FocusKey {
38
+ upArrow: boolean;
39
+ downArrow: boolean;
40
+ }
41
+ /** The option focused after a key: arrows move through the list and wrap around. */
42
+ export declare function moveFocus(focus: number, key: FocusKey, count: number): number;
43
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { type ImportTarget } from './logic.js';
3
+ interface PreflightScreenProps {
4
+ onChoose: (target: ImportTarget) => void;
5
+ onQuit: () => void;
6
+ }
7
+ export declare function PreflightScreen({ onChoose, onQuit }: PreflightScreenProps): React.ReactElement;
8
+ export {};
@@ -6,6 +6,6 @@ export declare const WELCOME_CONTROLS: readonly [{
6
6
  readonly label: "Clear";
7
7
  }, {
8
8
  readonly keys: "Esc";
9
- readonly label: "Back to menu";
9
+ readonly label: "Back";
10
10
  }];
11
11
  export declare function useWelcomeControls(onQuit: () => void): void;
@@ -1,6 +1,14 @@
1
+ import type { ImportTarget } from '../00-preflight/logic.js';
1
2
  interface QuitKey {
2
3
  escape: boolean;
3
4
  }
5
+ interface OverviewStep {
6
+ description: string;
7
+ /** Whether the step uses the user's local AI agent. */
8
+ ai: boolean;
9
+ }
10
+ /** The steps the user is about to go through, as the welcome screen lists them, for what they chose to generate. */
11
+ export declare function overviewFor(target: ImportTarget): readonly OverviewStep[];
4
12
  export declare function shouldQuit(key: QuitKey): boolean;
5
13
  export declare function toProjectPath(value: string): string | null;
6
14
  export {};
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
+ import type { ImportTarget } from '../00-preflight/logic.js';
2
3
  interface WelcomeScreenProps {
4
+ target: ImportTarget;
3
5
  onContinue: (projectPath: string) => void;
4
6
  onQuit: () => void;
5
7
  initialPath?: string;
6
8
  }
7
- export declare function WelcomeScreen({ onContinue, onQuit, initialPath }: WelcomeScreenProps): React.ReactElement;
9
+ export declare function WelcomeScreen({ target, onContinue, onQuit, initialPath, }: WelcomeScreenProps): React.ReactElement;
8
10
  export {};
@@ -13,10 +13,3 @@ interface InspectInput {
13
13
  cache: boolean;
14
14
  }
15
15
  export declare function inspectTokens({ rawTokensPath, contentfulDir, cache }: InspectInput): Promise<TokensState>;
16
- export declare function gateText({ tokensPath, sourceChanged }: {
17
- tokensPath: string;
18
- sourceChanged: boolean;
19
- }): {
20
- summary: string;
21
- context?: string;
22
- };
@@ -20,6 +20,19 @@ export declare function progressRows(progress: ExtractionProgress, agent: string
20
20
  }>;
21
21
  /** True when every job is already done, so the screen would only flash. The wizard shows nothing in this case. */
22
22
  export declare function isFullCacheHit(progress: ExtractionProgress): boolean;
23
+ /**
24
+ * The wizard's step counts: three fixed steps, one more when there is a token stage, two more when components are
25
+ * imported, and one more when the tokens can be mapped (not known yet at this stage, so it adds nothing here).
26
+ * Extraction is step 2 when there is a token stage, otherwise step 1.
27
+ */
28
+ export declare function stepNumbers(input: {
29
+ hasRawTokens: boolean;
30
+ skipComponents?: boolean;
31
+ mapTokensEligible?: boolean | null;
32
+ }): {
33
+ stepNumber: number;
34
+ totalSteps: number;
35
+ };
23
36
  export declare function noComponentsMessage(projectPath: string): string;
24
37
  export declare function agentAuthMessage(agent: string, status: 'not-found' | 'unauthenticated'): string;
25
38
  /**
@@ -0,0 +1,31 @@
1
+ import { checkAgentAuth, runGenerateTokensSession } from '@contentful/experience-design-system-backend-pipeline';
2
+ export interface TokensOnlyInput {
3
+ rawTokensPath: string;
4
+ /** Where tokens.json is written: this import run's folder. */
5
+ outDir: string;
6
+ agent: string;
7
+ agentModel?: string;
8
+ promptOverrides: string[];
9
+ noCache: boolean;
10
+ }
11
+ export type TokensOnlyResult = {
12
+ ok: true;
13
+ tokensPath: string;
14
+ tokenSessionId: string | null;
15
+ tokenCount: number;
16
+ } | {
17
+ ok: false;
18
+ step: 'generate tokens' | `${string} auth check`;
19
+ message: string;
20
+ };
21
+ /** The outside world the stage talks to, so it can be tested without an agent. */
22
+ export interface TokensOnlyDeps {
23
+ checkAgentAuth: typeof checkAgentAuth;
24
+ runGenerateTokensSession: typeof runGenerateTokensSession;
25
+ }
26
+ /**
27
+ * The extraction stage for an import that only generates tokens: the same auth check and token generation the full stage
28
+ * runs, without scanning components, composing them or selecting. The full stage fails when it finds no components, so it
29
+ * cannot be used for this.
30
+ */
31
+ export declare function runTokensOnly(input: TokensOnlyInput, deps?: TokensOnlyDeps): Promise<TokensOnlyResult>;
@@ -3,6 +3,8 @@ import type { ExtractionProgress } from './types.js';
3
3
  interface ExtractionScreenProps {
4
4
  progress: ExtractionProgress;
5
5
  agent: string;
6
+ stepNumber: number;
7
+ totalSteps: number;
6
8
  }
7
- export declare function ExtractionScreen({ progress, agent }: ExtractionScreenProps): React.ReactElement;
9
+ export declare function ExtractionScreen({ progress, agent, stepNumber, totalSteps, }: ExtractionScreenProps): React.ReactElement;
8
10
  export {};
@@ -0,0 +1,12 @@
1
+ import { type TokensOnlyInput, type TokensOnlyResult } from './run-tokens-only.js';
2
+ export type TokensOnlyState = {
3
+ status: 'running';
4
+ } | {
5
+ status: 'done';
6
+ result: TokensOnlyResult;
7
+ };
8
+ /**
9
+ * Runs the tokens-only stage once for the given input. Passing nothing leaves it idle. A run that finishes after the
10
+ * input changed or the screen went away is ignored.
11
+ */
12
+ export declare function useTokensOnly(input: TokensOnlyInput | undefined): TokensOnlyState | undefined;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function legendEntry(keyBracket: string, label: string, active?: boolean): React.ReactElement;
@@ -25,10 +25,6 @@ export interface FixedPanelProps {
25
25
  export declare function FixedPanel({ width, height, minHeight, focused, borderStyle, borderColor, paddingLeft, clipOverflow, children, }: FixedPanelProps): ReactElement;
26
26
  /** Shared frame for panels whose viewport must not change with their contents. */
27
27
  export declare function WindowedPanel({ width, height, title, focused, children }: WindowedPanelProps): ReactElement;
28
- export declare function WindowFooter({ above, below }: {
29
- above: number;
30
- below: number;
31
- }): ReactElement;
32
28
  export declare function WindowIndicator({ direction, count }: {
33
29
  direction: WindowDirection;
34
30
  count: number;
@@ -0,0 +1,8 @@
1
+ export declare const PALETTE: {
2
+ readonly info: "#40a0ff" | "#0059c8";
3
+ readonly success: "#5DB057" | "#006D23";
4
+ readonly error: "#ff707d" | "#bd002a";
5
+ readonly warning: "#FFC835" | "#CC4500";
6
+ readonly muted: "#aec1cc" | "#5A657C";
7
+ readonly border: "#aec1cc" | "#5A657C";
8
+ };
@@ -5,6 +5,8 @@ interface GenerationScreenProps {
5
5
  agent: string;
6
6
  acceptedCount: number;
7
7
  hasTokens: boolean;
8
+ stepNumber: number;
9
+ totalSteps: number;
8
10
  }
9
- export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens, }: GenerationScreenProps): React.ReactElement;
11
+ export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens, stepNumber, totalSteps, }: GenerationScreenProps): React.ReactElement;
10
12
  export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ type StepHeaderProps = {
3
+ stepNumber: number;
4
+ totalSteps: number;
5
+ title: string;
6
+ };
7
+ export declare function StepHeader({ stepNumber, totalSteps, title }: StepHeaderProps): React.ReactElement;
8
+ export {};
@@ -17,5 +17,6 @@ export declare function buildFlowStart(input: {
17
17
  handoff: ImportHandoff;
18
18
  saved?: SavedCredentials;
19
19
  generatePromptPath?: string;
20
+ tokensOnly?: FlowStart['tokensOnly'];
20
21
  }): FlowStart;
21
22
  export {};
@@ -17,6 +17,13 @@ export interface FlowStart {
17
17
  cmaToken: string;
18
18
  host: string;
19
19
  };
20
+ /** Set when the import only generates tokens: there is no extraction or generation, so the flow starts at saving. */
21
+ tokensOnly?: {
22
+ tokensPath: string;
23
+ tokenSessionId: string | null;
24
+ tokenCount: number;
25
+ outDir: string;
26
+ };
20
27
  /** A custom prompt for `generate components`, shown as a warning above every step. */
21
28
  generatePromptPath?: string;
22
29
  }
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { PushProgress } from '../support/push-progress.js';
3
3
  type PushingStepProps = {
4
+ stepNumber: number;
5
+ totalSteps: number;
4
6
  progress: PushProgress;
5
7
  };
6
- export declare function PushingStep({ progress }: PushingStepProps): React.ReactElement;
8
+ export declare function PushingStep({ stepNumber, totalSteps, progress }: PushingStepProps): React.ReactElement;
7
9
  export {};
@@ -4,9 +4,11 @@ type WizardPreviewStepProps = {
4
4
  preview: ServerPreviewResponse;
5
5
  spaceId: string;
6
6
  environmentId: string;
7
+ stepNumber: number;
8
+ totalSteps: number;
7
9
  onConfirm: (acknowledge: boolean) => void;
8
10
  onEdit?: () => void;
9
11
  onQuit: () => void;
10
12
  };
11
- export declare function WizardPreviewStep({ preview, spaceId, environmentId, onConfirm, onEdit, onQuit, }: WizardPreviewStepProps): React.ReactElement;
13
+ export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, onConfirm, onEdit, onQuit, }: WizardPreviewStepProps): React.ReactElement;
12
14
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { ChangeClassification, ComponentTypeSummary } from '@contentful/experience-design-system-types';
2
2
  export interface PropertyDiffLine {
3
3
  key: string;
4
- color: string;
4
+ color: 'green' | 'red' | 'yellow';
5
5
  text: string;
6
6
  }
7
7
  export declare function computeComponentDiffLines(current: ComponentTypeSummary, proposed: Record<string, unknown>, changeClassification?: ChangeClassification): PropertyDiffLine[];
@@ -1,6 +1,6 @@
1
+ export { PreflightScreen } from './00-preflight/screen.js';
1
2
  export { WelcomeScreen } from './01-welcome/screen.js';
2
3
  export { TokenInputScreen } from './02-token-input/screen.js';
3
4
  export { PathValidationScreen } from './03-path-validation/screen.js';
4
5
  export { CredentialsScreen } from './04-credentials/screen.js';
5
- export { TokenReuseScreen } from './05-token-reuse/screen.js';
6
6
  export { ExtractionScreen } from './06-extraction/screen.js';
@@ -5,7 +5,6 @@ export declare const PALETTE: {
5
5
  readonly muted: "#aec1cc";
6
6
  readonly border: "#aec1cc";
7
7
  readonly accent: "#40a0ff";
8
- readonly onAccent: "#111B2B";
9
8
  readonly error: "#ff707d";
10
9
  readonly success: "#5DB057";
11
10
  readonly warning: "#FFC835";
@@ -14,7 +13,6 @@ export declare const PALETTE: {
14
13
  readonly muted: "#5A657C";
15
14
  readonly border: "#5A657C";
16
15
  readonly accent: "#0059c8";
17
- readonly onAccent: "#FFFFFF";
18
16
  readonly error: "#bd002a";
19
17
  readonly success: "#006D23";
20
18
  readonly warning: "#CC4500";
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-04aa2aa0.0",
3
+ "version": "2.37.1-dev-build-758ea601.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-04aa2aa0.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-04aa2aa0.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-758ea601.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-758ea601.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- interface TokenReuseScreenProps {
3
- tokensPath: string;
4
- sourceChanged: boolean;
5
- onReuse: () => void;
6
- onRegenerate: () => void;
7
- onQuit: () => void;
8
- }
9
- export declare function TokenReuseScreen({ tokensPath, sourceChanged, onReuse, onRegenerate, onQuit, }: TokenReuseScreenProps): React.ReactElement;
10
- export {};
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export interface ControlHint {
3
- keys: string;
4
- label: string;
5
- active?: boolean;
6
- }
7
- export declare function ControlHints({ hints }: {
8
- hints: readonly ControlHint[];
9
- }): React.ReactElement;
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- declare const IMPORT_STEPS: readonly [{
3
- readonly id: "setup";
4
- readonly label: "Setup";
5
- }, {
6
- readonly id: "extraction";
7
- readonly label: "Extract";
8
- }, {
9
- readonly id: "scope-gate";
10
- readonly label: "Select";
11
- }, {
12
- readonly id: "generation";
13
- readonly label: "Generate";
14
- }, {
15
- readonly id: "review";
16
- readonly label: "Review";
17
- }, {
18
- readonly id: "push";
19
- readonly label: "Push";
20
- }];
21
- export type ImportStepId = (typeof IMPORT_STEPS)[number]['id'];
22
- export interface StepHeaderProps {
23
- step: ImportStepId | 'done';
24
- }
25
- export declare function StepHeader({ step }: StepHeaderProps): React.ReactElement;
26
- export {};