@contentful/experience-design-system-cli 2.37.1-dev-build-12711902.0 → 2.37.1-dev-build-aa3ffe6f.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 (105) hide show
  1. package/dist/app.d.ts +2 -6
  2. package/dist/app.js +8553 -449
  3. package/dist/index.js +8968 -477
  4. package/dist/package.json +1 -1
  5. package/dist/src/commands/import-options.d.ts +0 -1
  6. package/dist/src/tui/import/steps/07-scope-gate/graph/cycle-detection.d.ts +5 -0
  7. package/dist/src/tui/import/steps/09-review/components/ComponentRationalePanel.d.ts +10 -0
  8. package/dist/src/tui/import/steps/09-review/components/FieldEditor.d.ts +67 -0
  9. package/dist/src/tui/import/steps/09-review/components/FinalizeDialog.d.ts +22 -0
  10. package/dist/src/tui/import/steps/09-review/components/HighlightedLine.d.ts +9 -0
  11. package/dist/src/tui/import/steps/09-review/components/JsonPanel.d.ts +11 -0
  12. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/LivePreviewSummary.d.ts +2 -2
  13. package/dist/src/tui/import/steps/09-review/components/QuitDialog.d.ts +8 -0
  14. package/dist/src/tui/import/steps/09-review/components/RationaleLine.d.ts +21 -0
  15. package/dist/src/tui/import/steps/09-review/components/RationalePanel.d.ts +15 -0
  16. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewComponentPanel.d.ts +3 -3
  17. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewDetailsEditor.d.ts +3 -3
  18. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewDialogs.d.ts +2 -2
  19. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewStatus.d.ts +1 -1
  20. package/dist/src/tui/import/steps/09-review/components/ScrollablePanel.d.ts +14 -0
  21. package/dist/src/tui/import/steps/09-review/components/TokenReviewPanel.d.ts +30 -0
  22. package/dist/src/tui/import/steps/09-review/components/removed-components-text.d.ts +7 -0
  23. package/dist/src/tui/import/steps/09-review/components/wrap-text.d.ts +1 -0
  24. package/{legacy/dist/src/import/tui/steps/GenerateReviewStep.d.ts → dist/src/tui/import/steps/09-review/generate-review-step.d.ts} +1 -1
  25. package/{legacy/dist/src/import → dist/src/tui/import/steps/09-review/graph}/cycle-auto-reject.d.ts +1 -1
  26. package/{legacy/dist/src/analyze → dist/src/tui/import/steps/09-review/graph}/cycle-view.d.ts +2 -2
  27. package/dist/src/tui/import/steps/09-review/graph/issue-inheritance.d.ts +8 -0
  28. package/dist/src/tui/import/steps/09-review/graph/selection-cascade.d.ts +3 -0
  29. package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/enumerate-cycle-breaks.d.ts +1 -1
  30. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/history.d.ts +1 -1
  31. package/dist/src/tui/import/steps/09-review/preview-annotations.d.ts +26 -0
  32. package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review}/review-details-panel.d.ts +2 -2
  33. package/{legacy/dist/src/import/tui/hooks → dist/src/tui/import/steps/09-review}/review-input.d.ts +2 -2
  34. package/dist/src/tui/import/steps/09-review/scroll-offset.d.ts +30 -0
  35. package/dist/src/tui/import/steps/09-review/session.d.ts +26 -0
  36. package/dist/src/tui/import/steps/09-review/theme.d.ts +9 -0
  37. package/dist/src/tui/import/steps/09-review/token-suggestions.d.ts +8 -0
  38. package/dist/src/tui/import/steps/09-review/types.d.ts +19 -0
  39. package/{legacy/dist/src/import/tui/hooks/useReviewEditor.d.ts → dist/src/tui/import/steps/09-review/use-review-editor.d.ts} +1 -3
  40. package/{legacy/dist/src/import/tui/hooks/useReviewPreview.d.ts → dist/src/tui/import/steps/09-review/use-review-preview.d.ts} +2 -2
  41. package/{legacy/dist/src/import/tui/hooks/useReviewSession.d.ts → dist/src/tui/import/steps/09-review/use-review-session.d.ts} +5 -35
  42. package/dist/src/tui/import/steps/10-flow/flow/build-flow-start.d.ts +21 -0
  43. package/dist/src/tui/import/steps/10-flow/flow/controller.d.ts +65 -0
  44. package/dist/src/tui/import/steps/10-flow/flow/preview.d.ts +56 -0
  45. package/dist/src/tui/import/steps/10-flow/flow/push.d.ts +43 -0
  46. package/dist/src/tui/import/steps/10-flow/flow/save.d.ts +50 -0
  47. package/dist/src/tui/import/steps/10-flow/flow/screen.d.ts +17 -0
  48. package/dist/src/tui/import/steps/10-flow/flow/types.d.ts +71 -0
  49. package/dist/src/tui/import/steps/10-flow/flow/use-flow.d.ts +9 -0
  50. package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/PushingStep.d.ts +1 -1
  51. package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/WizardPreviewStep.d.ts +0 -1
  52. package/dist/src/tui/import/steps/10-flow/support/contentful-urls.d.ts +15 -0
  53. package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/wizard-state-transitions.d.ts +0 -13
  54. package/dist/src/tui/import/steps/10-flow/theme.d.ts +13 -0
  55. package/dist/src/tui/import/steps/preview-validation-error/logic.d.ts +12 -0
  56. package/dist/src/tui/import/steps/preview-validation-error/screen.d.ts +11 -0
  57. package/legacy/dist/src/index.js +8572 -18583
  58. package/legacy/package.json +1 -1
  59. package/package.json +4 -4
  60. package/dist/src/tui/import/spawn-v1-import.d.ts +0 -36
  61. package/dist/src/tui/import/terminal-input.d.ts +0 -2
  62. package/legacy/dist/src/import/agent-model-resolve.d.ts +0 -27
  63. package/legacy/dist/src/import/command.d.ts +0 -2
  64. package/legacy/dist/src/import/composition-options.d.ts +0 -7
  65. package/legacy/dist/src/import/tui/WizardApp.d.ts +0 -24
  66. package/legacy/dist/src/import/tui/autocomplete.d.ts +0 -5
  67. package/legacy/dist/src/import/tui/components/CompactControlBar.d.ts +0 -4
  68. package/legacy/dist/src/import/tui/components/LegendEntry.d.ts +0 -2
  69. package/legacy/dist/src/import/tui/components/SearchMatchSummary.d.ts +0 -11
  70. package/legacy/dist/src/import/tui/group-collapse.d.ts +0 -2
  71. package/legacy/dist/src/import/tui/handoff.d.ts +0 -36
  72. package/legacy/dist/src/import/tui/hooks/sidebar-search-state.d.ts +0 -17
  73. package/legacy/dist/src/import/tui/hooks/useOverlayPanel.d.ts +0 -13
  74. package/legacy/dist/src/import/tui/lineage-layout.d.ts +0 -68
  75. package/legacy/dist/src/import/tui/sidebar-help.d.ts +0 -2
  76. package/legacy/dist/src/import/tui/sidebar-input.d.ts +0 -13
  77. package/legacy/dist/src/import/tui/sidebar-navigation.d.ts +0 -18
  78. package/legacy/dist/src/import/tui/step-filters.d.ts +0 -19
  79. package/legacy/dist/src/import/tui/steps/ErrorStep.d.ts +0 -10
  80. package/legacy/dist/src/import/tui/steps/GateStep.d.ts +0 -15
  81. package/legacy/dist/src/import/tui/steps/PreviewValidationErrorStep.d.ts +0 -11
  82. package/legacy/dist/src/import/tui/steps/RunningStep.d.ts +0 -32
  83. package/legacy/dist/src/import/tui/wizard-422-helpers.d.ts +0 -48
  84. /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/auto-reject-decision.d.ts +0 -0
  85. /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/breaking-change-format.d.ts +0 -0
  86. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review/helpers}/cycle-panel-scroll.d.ts +0 -0
  87. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review/helpers}/sidebar-width.d.ts +0 -0
  88. /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review}/review-json-panel.d.ts +0 -0
  89. /package/{legacy/dist/src/import/tui/runLivePreview.d.ts → dist/src/tui/import/steps/09-review/run-live-preview.d.ts} +0 -0
  90. /package/{legacy/dist/src/import/tui/useFinalizePreview.d.ts → dist/src/tui/import/steps/09-review/use-finalize-preview.d.ts} +0 -0
  91. /package/{legacy/dist/src/import/tui/useLivePreview.d.ts → dist/src/tui/import/steps/09-review/use-live-preview.d.ts} +0 -0
  92. /package/{legacy/dist/src/import/tui/hooks/useReviewSurfaceState.d.ts → dist/src/tui/import/steps/09-review/use-review-surface-state.d.ts} +0 -0
  93. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/components}/CustomPromptBanner.d.ts +0 -0
  94. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow}/components/SpaceEnvironment.d.ts +0 -0
  95. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow}/components/StepHeader.d.ts +0 -0
  96. /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/DoneStep.d.ts +0 -0
  97. /package/{legacy/dist/src/runs/path-prompt.d.ts → dist/src/tui/import/steps/10-flow/screens/PathPrompt.d.ts} +0 -0
  98. /package/{legacy/dist/src/import → dist/src/tui/import/steps/10-flow/support}/path-utils.d.ts +0 -0
  99. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/preview-confirmation-input.d.ts +0 -0
  100. /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/support}/preview-diff.d.ts +0 -0
  101. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/push-progress.d.ts +0 -0
  102. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/run-print-files-helpers.d.ts +0 -0
  103. /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/run-teaser.d.ts +0 -0
  104. /package/{legacy/dist/src/tui → dist/src/tui/import/steps/10-flow/support}/use-blinking-cursor.d.ts +0 -0
  105. /package/{legacy/dist/src/tui → dist/src/tui/import/steps/10-flow/support}/use-timed-spinner.d.ts +0 -0
@@ -0,0 +1,65 @@
1
+ import { type PreviewValidationError } from '@contentful/experience-design-system-backend-pipeline';
2
+ import type { ImportHandoff } from '@contentful/experience-design-system-types/handoff';
3
+ import { type PreviewDeps } from './preview.js';
4
+ import { type PushDeps } from './push.js';
5
+ import { type SaveDeps } from './save.js';
6
+ import { type FlowPatch, type FlowState } from './types.js';
7
+ /** What the flow starts from: what the earlier stages produced, and the user's saved settings. */
8
+ export interface FlowStart {
9
+ handoff: ImportHandoff;
10
+ agent: string;
11
+ projectPath: string;
12
+ /** Where the files are saved by default. */
13
+ outDir: string;
14
+ rawTokensPath: string;
15
+ credentials: {
16
+ spaceId: string;
17
+ environmentId: string;
18
+ cmaToken: string;
19
+ host: string;
20
+ };
21
+ /** A custom prompt for `generate components`, shown as a warning above every step. */
22
+ generatePromptPath?: string;
23
+ }
24
+ /** The outside world the flow talks to besides the preview, push and save steps. */
25
+ export interface FlowDeps {
26
+ preview: PreviewDeps;
27
+ push: PushDeps;
28
+ save: SaveDeps;
29
+ /** Reads the accepted components, for the cycle check at finalize. */
30
+ loadAcceptedComponents: (sessionId: string) => Array<{
31
+ key: string;
32
+ entry: unknown;
33
+ }>;
34
+ mkdir: (path: string) => Promise<void>;
35
+ detectSaveConflict: (path: string) => Promise<boolean>;
36
+ buildTimestampedSubdir: (path: string) => string;
37
+ rejectComponentsByName: (sessionId: string, names: string[]) => Promise<unknown>;
38
+ /** Writes one line of the wizard's step log. */
39
+ log: (entry: Record<string, unknown>) => void;
40
+ stderr: (text: string) => void;
41
+ }
42
+ export declare function startWizardLog(): void;
43
+ export declare function realFlowDeps(): FlowDeps;
44
+ /** The state the flow begins in, from what the earlier stages handed over. */
45
+ export declare function initialFlowState(start: FlowStart): FlowState;
46
+ /** What the log gets: the state change without the token, the document, or the whole of a large server response. */
47
+ export declare function sanitizeForLog(partial: FlowPatch): Record<string, unknown>;
48
+ /** The names of the components the errors are about, once each. */
49
+ export declare function namesToSkip(errors: readonly PreviewValidationError[]): string[];
50
+ export interface FlowController {
51
+ getState(): FlowState;
52
+ subscribe(listener: () => void): () => void;
53
+ finalize(accepted: number, rejected: number, unresolved: number): void;
54
+ submitPath(path: string): Promise<void>;
55
+ confirmPreview(acknowledgeBreakingChanges: boolean): void;
56
+ acknowledgeBreakingChanges(): void;
57
+ editDefinitions(): void;
58
+ skipValidationErrors(): Promise<void>;
59
+ }
60
+ /**
61
+ * The wizard's state machine, taken out of the screen so each transition can be tested without a terminal. It holds the
62
+ * state, applies the patches the steps return, and decides what runs next. It never exits the process: leaving is the
63
+ * screen's decision.
64
+ */
65
+ export declare function createFlowController(start: FlowStart, deps: FlowDeps): FlowController;
@@ -0,0 +1,56 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ import { ApiError, patchReviewStateWithValidationErrors, type PreviewValidationError } from '@contentful/experience-design-system-backend-pipeline';
3
+ import { type CDFDocument, type DTCGTokenEntry, type ServerPreviewResponse } from '@contentful/experience-design-system-types';
4
+ import type { FlowPatch, FlowState } from './types.js';
5
+ type PreviewClient = {
6
+ previewImport(cdf: CDFDocument): Promise<ServerPreviewResponse>;
7
+ };
8
+ /** The outside world `runPreview` talks to, so each branch can be tested without a database or a network. */
9
+ export interface PreviewDeps {
10
+ createClient: (options: {
11
+ cmaToken: string;
12
+ spaceId: string;
13
+ environmentId: string;
14
+ host: string;
15
+ }) => PreviewClient;
16
+ openDb: () => DatabaseSync;
17
+ readTokens: (path: string) => Promise<DTCGTokenEntry[]>;
18
+ patchReviewState: typeof patchReviewStateWithValidationErrors;
19
+ verboseErrors: boolean;
20
+ }
21
+ export declare const realPreviewDeps: () => PreviewDeps;
22
+ export interface RunPreviewInput {
23
+ state: Pick<FlowState, 'credentialsSkipped'>;
24
+ extractSessionId: string | null;
25
+ tokensPath: string;
26
+ spaceId: string;
27
+ environmentId: string;
28
+ cmaToken: string;
29
+ host: string;
30
+ /** Set when nothing was accepted, so the document is present but empty and the server shows what would be deleted. */
31
+ deleteAll: boolean;
32
+ }
33
+ /** What to do with a 422 from the preview: show the components that failed, or fall through to the generic error. */
34
+ type Preview422Outcome = {
35
+ kind: 'validation-error';
36
+ errors: PreviewValidationError[];
37
+ missingNames: string[];
38
+ } | {
39
+ kind: 'unparseable';
40
+ message: string;
41
+ } | {
42
+ kind: 'not-422';
43
+ };
44
+ export declare function handlePreview422(err: ApiError, extractSessionId: string | null, patchFn: PreviewDeps['patchReviewState']): Promise<Preview422Outcome>;
45
+ /** The patch to spread into any update that leaves the validation error step, so stale errors do not linger. */
46
+ export declare function clearedValidationErrorState(): Pick<FlowState, 'previewValidationErrors' | 'previewValidationMissingNames'>;
47
+ /**
48
+ * Loads what would be pushed and asks the server what that would change. Returns the patch the wizard applied: the
49
+ * preview gate, a terminal "done" when nothing would change, the validation error step for a 422, or an error.
50
+ *
51
+ * It also repairs two things the server's answer can reveal: components it says would be removed that are in fact local
52
+ * (the review dropped their CDF), and defaults it would change. Both are re-seeded from the response, and the preview is
53
+ * taken again.
54
+ */
55
+ export declare function runPreview(input: RunPreviewInput, deps: PreviewDeps): Promise<FlowPatch>;
56
+ export {};
@@ -0,0 +1,43 @@
1
+ import { updateRun } from '@contentful/experience-design-system-backend-pipeline';
2
+ import { type ApplyOperationResponse, type CDFDocument, type ServerPreviewResponse } from '@contentful/experience-design-system-types';
3
+ import type { FlowPatch, FlowState } from './types.js';
4
+ type PushClient = {
5
+ applyImport(cdf: CDFDocument, options: {
6
+ acknowledgeBreakingChanges: boolean;
7
+ }): Promise<ApplyOperationResponse>;
8
+ pollOperation(operationId: string, options: {
9
+ onProgress?: (operation: ApplyOperationResponse) => void;
10
+ }): Promise<ApplyOperationResponse>;
11
+ };
12
+ /** The outside world `runPush` talks to, so each branch can be tested without a network or a run history. */
13
+ export interface PushDeps {
14
+ createClient: (options: {
15
+ cmaToken: string;
16
+ spaceId: string;
17
+ environmentId: string;
18
+ host: string;
19
+ }) => PushClient;
20
+ updateRun: typeof updateRun;
21
+ /** Where the wizard's step log goes. A log that cannot be written is reported on stderr and never stops the push. */
22
+ log: (entry: Record<string, unknown>) => void;
23
+ warn: (message: string) => void;
24
+ verboseErrors: boolean;
25
+ }
26
+ export declare const realPushDeps: (log: PushDeps["log"]) => PushDeps;
27
+ export interface RunPushInput {
28
+ state: Pick<FlowState, 'credentialsSkipped' | 'lastRunId'>;
29
+ cdf: CDFDocument;
30
+ spaceId: string;
31
+ environmentId: string;
32
+ cmaToken: string;
33
+ host: string;
34
+ acknowledgeBreakingChanges: boolean;
35
+ preview?: ServerPreviewResponse | null;
36
+ }
37
+ /**
38
+ * Pushes the previewed document: the checks that refuse a push that cannot work, then the apply, polling its progress,
39
+ * and the result as the counts the done screen shows. `onPatch` receives the progress while it polls; the returned patch
40
+ * is where the flow ends up.
41
+ */
42
+ export declare function runPush(input: RunPushInput, deps: PushDeps, onPatch: (patch: FlowPatch) => void): Promise<FlowPatch>;
43
+ export {};
@@ -0,0 +1,50 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ import { appendRun, buildSourceFingerprint } from '@contentful/experience-design-system-backend-pipeline';
3
+ import { type CDFComponentEntry, type CDFDocument, type DTCGTokenEntry } from '@contentful/experience-design-system-types';
4
+ import type { FlowPatch, FlowState } from './types.js';
5
+ /** How long the confirmation of a written file stays up before the flow moves on to the preview. */
6
+ export declare const SAVE_CONFIRMATION_DELAY_MS = 1000;
7
+ /** The document written to `components.json`: the components and tokens as one schema-valid CDF. */
8
+ export declare function buildSavedCDF(components: Array<{
9
+ key: string;
10
+ entry: CDFComponentEntry;
11
+ }>, tokens: DTCGTokenEntry[], opts?: {
12
+ deleteAll?: boolean;
13
+ }): CDFDocument;
14
+ /** The outside world saving talks to, so each branch can be tested without a disk, a database or a clock. */
15
+ export interface SaveDeps {
16
+ openDb: () => DatabaseSync;
17
+ readTokens: (path: string) => Promise<DTCGTokenEntry[]>;
18
+ writeFile: (path: string, contents: string) => Promise<void>;
19
+ appendRun: typeof appendRun;
20
+ buildSourceFingerprint: typeof buildSourceFingerprint;
21
+ sleep: (ms: number) => Promise<void>;
22
+ warn: (message: string) => void;
23
+ }
24
+ export declare const realSaveDeps: () => SaveDeps;
25
+ export interface WriteFilesInput {
26
+ extractSessionId: string | null;
27
+ outDir: string;
28
+ tokenSessionId?: string | null;
29
+ tokensPath?: string;
30
+ skipGate?: boolean;
31
+ allowEmpty?: boolean;
32
+ }
33
+ /**
34
+ * Writes `components.json` to `outDir`. Returns the patch for the step after (the print gate, or nothing when the save
35
+ * is part of a push and goes straight on), or an error patch when the document could not be built or written.
36
+ * `onPatch` receives the "printing" step while it works.
37
+ */
38
+ export declare function runPrintFiles(input: WriteFilesInput, deps: SaveDeps, onPatch: (patch: FlowPatch) => void): Promise<{
39
+ ok: true;
40
+ patch: FlowPatch;
41
+ } | {
42
+ ok: false;
43
+ patch: FlowPatch;
44
+ }>;
45
+ export interface RecordRunInput {
46
+ state: Pick<FlowState, 'extractSessionId' | 'rawTokensPath' | 'projectPath' | 'generatedAcceptedCount' | 'generatedCount' | 'tokenCount' | 'tokenSessionId' | 'tokensPath' | 'agent' | 'generateSessionId'>;
47
+ savePath: string;
48
+ }
49
+ /** Records the run, so it can be found and pushed later. A run that cannot be recorded is warned about, never fatal. */
50
+ export declare function recordRun(input: RecordRunInput, deps: SaveDeps): Promise<string | null>;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { FlowController } from './controller.js';
3
+ import type { FlowState } from './types.js';
4
+ interface FlowScreenProps {
5
+ state: FlowState;
6
+ controller: FlowController;
7
+ livePreview?: boolean;
8
+ generatePromptPath?: string;
9
+ /** Leaves the import with the exit code the wizard would have exited with. */
10
+ onExit: (exitCode: number) => void;
11
+ }
12
+ /** How many steps the import has, as the wizard counted them. */
13
+ export declare function totalStepsFor(state: Pick<FlowState, 'tokensPath' | 'rawTokensPath' | 'mapTokensEligible'>): number;
14
+ /** Whether the preview gate offers "[e] Edit definitions": only when the document has components to edit. */
15
+ export declare function canEditFromPreview(cdf: FlowState['cdf']): boolean;
16
+ export declare function FlowScreen({ state, controller, livePreview, generatePromptPath, onExit, }: FlowScreenProps): React.ReactElement;
17
+ export {};
@@ -0,0 +1,71 @@
1
+ import type { CDFDocument, ServerPreviewResponse } from '@contentful/experience-design-system-types';
2
+ import type { PreviewValidationError } from '@contentful/experience-design-system-backend-pipeline';
3
+ import type { PushProgress } from '../support/push-progress.js';
4
+ /**
5
+ * The steps of the import after the review, as the wizard had them. The ones that came before (credentials, extraction,
6
+ * the scope gate, generation) are v2 stages of their own now.
7
+ */
8
+ type FlowStep = 'final-review' | 'previewing' | 'preview-gate' | 'pushing' | 'path-prompt' | 'printing' | 'print-gate' | 'done' | 'error' | 'preview-validation-error';
9
+ export type PushResult = {
10
+ componentTypes: {
11
+ created: number;
12
+ updated: number;
13
+ removed: number;
14
+ failed: number;
15
+ };
16
+ designTokens: {
17
+ created: number;
18
+ updated: number;
19
+ removed: number;
20
+ failed: number;
21
+ };
22
+ summary?: {
23
+ total: number;
24
+ succeeded: number;
25
+ failed: number;
26
+ };
27
+ failures?: Array<{
28
+ entityType: string;
29
+ entityId: string;
30
+ message: string;
31
+ }>;
32
+ };
33
+ /** Everything the flow keeps between steps. The same fields the wizard kept, minus those only the early stages used. */
34
+ export type FlowState = {
35
+ step: FlowStep;
36
+ agent: string;
37
+ projectPath: string;
38
+ outDir: string;
39
+ rawTokensPath: string;
40
+ tokensPath: string;
41
+ tokenSessionId: string | null;
42
+ tokenCount: number;
43
+ extractSessionId: string | null;
44
+ generateSessionId: string | null;
45
+ generatedCount: number;
46
+ generatedAcceptedCount: number;
47
+ componentsPath: string;
48
+ spaceId: string;
49
+ environmentId: string;
50
+ cmaToken: string;
51
+ host: string;
52
+ serverPreview: ServerPreviewResponse | null;
53
+ cdf: CDFDocument | null;
54
+ pushProgress: PushProgress;
55
+ pushResult: PushResult;
56
+ errorStep: string;
57
+ errorMessage: string;
58
+ errorAllowCredentialRetry: boolean;
59
+ errorAllowBreakingChangeAcknowledgment: boolean;
60
+ previewValidationErrors: PreviewValidationError[];
61
+ previewValidationMissingNames: string[];
62
+ mapTokensEligible: boolean | null;
63
+ credentialsSkipped: boolean;
64
+ lastRunId: string | null;
65
+ finalizeErrorBanner: string | null;
66
+ finalReviewPassed: boolean;
67
+ };
68
+ /** A change to the state. The steps of the flow return these instead of changing the state themselves. */
69
+ export type FlowPatch = Partial<FlowState>;
70
+ export declare const EMPTY_PUSH_RESULT: PushResult;
71
+ export {};
@@ -0,0 +1,9 @@
1
+ import { type FlowController, type FlowDeps, type FlowStart } from './controller.js';
2
+ /**
3
+ * The flow for a start, once. `start` is undefined until the generation stage has finished, so the hook can be called
4
+ * unconditionally; the step log is started with the controller, as the wizard started it with its first render.
5
+ */
6
+ export declare function useFlow(start: FlowStart | undefined, deps?: () => FlowDeps): {
7
+ controller: FlowController;
8
+ state: ReturnType<FlowController['getState']>;
9
+ } | undefined;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { PushProgress } from '../push-progress.js';
2
+ import type { PushProgress } from '../support/push-progress.js';
3
3
  type PushingStepProps = {
4
4
  stepNumber: number;
5
5
  totalSteps: number;
@@ -6,7 +6,6 @@ export interface PreviewDiffLine {
6
6
  text: string;
7
7
  }
8
8
  export declare function buildPreviewSummaryLines(preview: ServerPreviewResponse): PreviewDiffLine[];
9
- export declare function buildPreviewDiffLines(preview: ServerPreviewResponse): PreviewDiffLine[];
10
9
  type WizardPreviewStepProps = {
11
10
  preview: ServerPreviewResponse;
12
11
  spaceId: string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shared Contentful webapp URL builders.
3
+ *
4
+ * This module centralizes the formatter so the wizard and `apply` emit
5
+ * the same URL shape.
6
+ */
7
+ type PostPushView = 'components' | 'design_tokens';
8
+ export interface BuildPostPushUrlInput {
9
+ host: string;
10
+ spaceId: string;
11
+ environmentId: string;
12
+ view?: PostPushView;
13
+ }
14
+ export declare function buildPostPushUrl({ host, spaceId, environmentId, view }: BuildPostPushUrlInput): string;
15
+ export {};
@@ -1,16 +1,3 @@
1
- export declare function shouldGenerateAfterScopeGate(opts: {
2
- acceptedCount: number;
3
- }): boolean;
4
- export declare function shouldGenerateAfterCredentialsValidated(opts: {
5
- acceptedCount: number;
6
- }): boolean;
7
- export declare function shouldSkipFinalReviewAfterCredentials(state: {
8
- generateSessionId: string | null;
9
- finalReviewPassed: boolean;
10
- }): boolean;
11
- export declare function resolveNoCacheForGenerate(opts: {
12
- cliNoCache: boolean;
13
- }): boolean;
14
1
  export declare function shouldBypassPreview(state: {
15
2
  credentialsSkipped: boolean;
16
3
  }): boolean;
@@ -0,0 +1,13 @@
1
+ export declare const PALETTE: {
2
+ readonly link: "#58A6FF";
3
+ readonly info: "#1773EB";
4
+ readonly success: "#00C459";
5
+ readonly error: "#E44F20";
6
+ readonly warning: "#FFDA00";
7
+ readonly muted: "#8B8D91";
8
+ readonly border: "#C4D1DE";
9
+ readonly inverse: "#FFFFFF";
10
+ };
11
+ export declare const INK_UI_THEME: {
12
+ components: Record<string, import("@inkjs/ui").ComponentTheme>;
13
+ };
@@ -0,0 +1,12 @@
1
+ export interface PreviewValidationError {
2
+ componentName: string;
3
+ path: string;
4
+ message: string;
5
+ }
6
+ export declare function failedComponentNames(errors: readonly PreviewValidationError[]): string[];
7
+ export declare function matchedComponentNames(errors: readonly PreviewValidationError[], missingNames: readonly string[]): string[];
8
+ export declare function formatErrorLine(error: PreviewValidationError): string;
9
+ export declare function formatErrorLines(errors: readonly PreviewValidationError[]): string;
10
+ export declare function missingNote(missingNames: readonly string[]): string;
11
+ export declare function contextText(errors: readonly PreviewValidationError[], missingNames: readonly string[]): string;
12
+ export declare function skipLabel(matchedNames: readonly string[]): string;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type PreviewValidationError } from './logic.js';
3
+ interface PreviewValidationErrorScreenProps {
4
+ errors: readonly PreviewValidationError[];
5
+ missingNames: readonly string[];
6
+ onEdit: () => void;
7
+ onSkip: () => void;
8
+ onQuit: () => void;
9
+ }
10
+ export declare function PreviewValidationErrorScreen({ errors, missingNames, onEdit, onSkip, onQuit, }: PreviewValidationErrorScreenProps): React.ReactElement;
11
+ export {};