@contentful/experience-design-system-cli 2.38.0 → 2.38.1-dev-build-6d903339.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.d.ts +3 -6
- package/dist/app.js +28155 -642
- package/dist/index.js +32060 -421
- package/dist/package.json +8 -3
- package/dist/src/commands/import-options.d.ts +12 -0
- package/dist/src/commands/import.d.ts +2 -1
- package/dist/src/tui/home/home.theme.d.ts +1 -2
- package/dist/src/tui/import/resolve-user-path.d.ts +1 -0
- package/dist/src/tui/import/shared/error-step/controls.d.ts +7 -0
- package/{legacy/dist/src/import/tui/steps/ErrorStep.d.ts → dist/src/tui/import/shared/error-step/error-step.d.ts} +2 -2
- package/dist/src/tui/import/shared/error-step/logic.d.ts +15 -0
- package/dist/src/tui/import/shared/gate-step/controls.d.ts +8 -0
- package/dist/src/tui/import/shared/gate-step/gate-step.d.ts +14 -0
- package/dist/src/tui/import/shared/gate-step/logic.d.ts +11 -0
- package/dist/src/tui/import/shared/index.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/logic.d.ts +12 -0
- package/dist/src/tui/import/shared/running-step/running-step.d.ts +11 -0
- package/dist/src/tui/import/shared/running-step/theme.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/use-elapsed.d.ts +1 -0
- package/dist/src/tui/import/steps/03-path-validation/controls.d.ts +13 -0
- package/dist/src/tui/import/steps/03-path-validation/helpers/scan-files.d.ts +10 -0
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +43 -0
- package/dist/src/tui/import/steps/03-path-validation/screen.d.ts +12 -0
- package/dist/src/tui/import/steps/04-credentials/controls.d.ts +21 -0
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +15 -0
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +17 -0
- package/dist/src/tui/import/steps/04-credentials/validate.d.ts +8 -0
- package/dist/src/tui/import/steps/05-token-reuse/logic.d.ts +21 -0
- package/dist/src/tui/import/steps/05-token-reuse/screen.d.ts +10 -0
- package/dist/src/tui/import/steps/06-extraction/find-skill-path.d.ts +1 -0
- package/dist/src/tui/import/steps/06-extraction/logic.d.ts +48 -0
- package/dist/src/tui/import/steps/06-extraction/run.d.ts +26 -0
- package/dist/src/tui/import/steps/06-extraction/screen.d.ts +10 -0
- package/dist/src/tui/import/steps/06-extraction/selection.d.ts +18 -0
- package/dist/src/tui/import/steps/06-extraction/types.d.ts +46 -0
- package/dist/src/tui/import/steps/06-extraction/use-extraction.d.ts +14 -0
- package/dist/src/tui/import/steps/07-scope-gate/cache-check.d.ts +17 -0
- package/{legacy/dist/src/import/tui/scope-gate-columns.d.ts → dist/src/tui/import/steps/07-scope-gate/columns.d.ts} +22 -2
- package/dist/src/tui/import/steps/07-scope-gate/graph/composite-closure.d.ts +26 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/cycle-detection.d.ts +27 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/fuzzy-search.d.ts +3 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/index.d.ts +33 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/lineage.d.ts +29 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/search-neighborhood.d.ts +3 -0
- package/dist/src/tui/import/steps/07-scope-gate/graph/slot-graph.d.ts +11 -0
- package/dist/src/tui/import/steps/07-scope-gate/keymap.d.ts +84 -0
- package/dist/src/tui/import/steps/07-scope-gate/load.d.ts +8 -0
- package/dist/src/tui/import/steps/07-scope-gate/panels/added-column.d.ts +15 -0
- package/dist/src/tui/import/steps/07-scope-gate/panels/cycles-panel.d.ts +8 -0
- package/dist/src/tui/import/steps/07-scope-gate/panels/reject-prompt.d.ts +5 -0
- package/dist/src/tui/import/steps/07-scope-gate/screen.d.ts +9 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GotoBanner.d.ts +32 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GroupedSidebar.d.ts +93 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/HelpOverlay.d.ts +21 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/badge.d.ts +13 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/windowed-panel.d.ts +31 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/group-collapse.d.ts +1 -1
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.d.ts +6 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.d.ts +19 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/sidebar-help.d.ts +1 -1
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/sidebar-navigation.d.ts +2 -2
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/theme.d.ts +8 -0
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/types.d.ts +7 -0
- package/dist/src/tui/import/steps/07-scope-gate/state.d.ts +19 -0
- package/dist/src/tui/import/steps/07-scope-gate/types.d.ts +24 -0
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.d.ts +27 -0
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate.d.ts +76 -0
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +27 -0
- package/dist/src/tui/import/steps/08-generation/map-tokens.d.ts +14 -0
- package/dist/src/tui/import/steps/08-generation/run.d.ts +22 -0
- package/dist/src/tui/import/steps/08-generation/save-decisions.d.ts +8 -0
- package/dist/src/tui/import/steps/08-generation/screen.d.ts +12 -0
- package/dist/src/tui/import/steps/08-generation/types.d.ts +47 -0
- package/dist/src/tui/import/steps/08-generation/use-generation.d.ts +14 -0
- package/dist/src/tui/import/steps/09-review/components/ComponentRationalePanel.d.ts +10 -0
- package/dist/src/tui/import/steps/09-review/components/FieldEditor.d.ts +67 -0
- package/dist/src/tui/import/steps/09-review/components/FinalizeDialog.d.ts +22 -0
- package/dist/src/tui/import/steps/09-review/components/HighlightedLine.d.ts +9 -0
- package/dist/src/tui/import/steps/09-review/components/JsonPanel.d.ts +11 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/LivePreviewSummary.d.ts +2 -2
- package/dist/src/tui/import/steps/09-review/components/QuitDialog.d.ts +8 -0
- package/dist/src/tui/import/steps/09-review/components/RationaleLine.d.ts +21 -0
- package/dist/src/tui/import/steps/09-review/components/RationalePanel.d.ts +15 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewComponentPanel.d.ts +3 -3
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewDetailsEditor.d.ts +3 -3
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewDialogs.d.ts +2 -2
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/components/ReviewStatus.d.ts +1 -1
- package/dist/src/tui/import/steps/09-review/components/ScrollablePanel.d.ts +14 -0
- package/dist/src/tui/import/steps/09-review/components/TokenReviewPanel.d.ts +30 -0
- package/dist/src/tui/import/steps/09-review/components/removed-components-text.d.ts +7 -0
- package/dist/src/tui/import/steps/09-review/components/wrap-text.d.ts +1 -0
- package/{legacy/dist/src/import/tui/steps/GenerateReviewStep.d.ts → dist/src/tui/import/steps/09-review/generate-review-step.d.ts} +1 -1
- package/{legacy/dist/src/import → dist/src/tui/import/steps/09-review/graph}/cycle-auto-reject.d.ts +1 -1
- package/{legacy/dist/src/analyze → dist/src/tui/import/steps/09-review/graph}/cycle-view.d.ts +2 -2
- package/dist/src/tui/import/steps/09-review/graph/issue-inheritance.d.ts +8 -0
- package/dist/src/tui/import/steps/09-review/graph/selection-cascade.d.ts +3 -0
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/enumerate-cycle-breaks.d.ts +1 -1
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review}/history.d.ts +1 -1
- package/dist/src/tui/import/steps/09-review/preview-annotations.d.ts +26 -0
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review}/review-details-panel.d.ts +2 -2
- package/{legacy/dist/src/import/tui/hooks → dist/src/tui/import/steps/09-review}/review-input.d.ts +2 -2
- package/{legacy/dist/src/import/tui/runLivePreview.d.ts → dist/src/tui/import/steps/09-review/run-live-preview.d.ts} +2 -3
- package/dist/src/tui/import/steps/09-review/scroll-offset.d.ts +30 -0
- package/dist/src/tui/import/steps/09-review/session.d.ts +26 -0
- package/dist/src/tui/import/steps/09-review/theme.d.ts +9 -0
- package/dist/src/tui/import/steps/09-review/token-suggestions.d.ts +8 -0
- package/dist/src/tui/import/steps/09-review/types.d.ts +19 -0
- package/{legacy/dist/src/import/tui/hooks/useReviewEditor.d.ts → dist/src/tui/import/steps/09-review/use-review-editor.d.ts} +1 -3
- package/{legacy/dist/src/import/tui/hooks/useReviewPreview.d.ts → dist/src/tui/import/steps/09-review/use-review-preview.d.ts} +2 -2
- package/{legacy/dist/src/import/tui/hooks/useReviewSession.d.ts → dist/src/tui/import/steps/09-review/use-review-session.d.ts} +5 -35
- package/dist/src/tui/import/steps/10-flow/flow/build-flow-start.d.ts +21 -0
- package/dist/src/tui/import/steps/10-flow/flow/controller.d.ts +65 -0
- package/dist/src/tui/import/steps/10-flow/flow/preview.d.ts +56 -0
- package/dist/src/tui/import/steps/10-flow/flow/push.d.ts +43 -0
- package/dist/src/tui/import/steps/10-flow/flow/save.d.ts +50 -0
- package/dist/src/tui/import/steps/10-flow/flow/screen.d.ts +17 -0
- package/dist/src/tui/import/steps/10-flow/flow/types.d.ts +71 -0
- package/dist/src/tui/import/steps/10-flow/flow/use-flow.d.ts +9 -0
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/PushingStep.d.ts +1 -1
- package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/WizardPreviewStep.d.ts +0 -1
- package/dist/src/tui/import/steps/10-flow/support/contentful-urls.d.ts +15 -0
- package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/wizard-state-transitions.d.ts +0 -13
- package/dist/src/tui/import/steps/10-flow/theme.d.ts +13 -0
- package/dist/src/tui/import/steps/index.d.ts +4 -0
- package/dist/src/tui/import/steps/preview-validation-error/logic.d.ts +12 -0
- package/dist/src/tui/import/steps/preview-validation-error/screen.d.ts +11 -0
- package/dist/src/tui/user-agent.d.ts +5 -0
- package/legacy/dist/package.json +4 -1
- package/legacy/dist/src/analyze/select/tui/components/ScrollablePanel.d.ts +2 -2
- package/legacy/dist/src/analyze/select/tui/theme.d.ts +1 -1
- package/legacy/dist/src/index.js +15073 -23076
- package/legacy/package.json +8 -3
- package/package.json +8 -3
- package/skills/generate-components.md +612 -0
- package/skills/generate-tokens.md +194 -0
- package/skills/map-tokens.md +102 -0
- package/skills/select-components.md +235 -0
- package/dist/src/tui/import/spawn-v1-import.d.ts +0 -29
- package/dist/src/tui/import/terminal-input.d.ts +0 -2
- package/legacy/dist/src/import/agent-model-resolve.d.ts +0 -27
- package/legacy/dist/src/import/command.d.ts +0 -2
- package/legacy/dist/src/import/composition-options.d.ts +0 -7
- package/legacy/dist/src/import/tui/WizardApp.d.ts +0 -67
- package/legacy/dist/src/import/tui/run-selection-agent.d.ts +0 -9
- package/legacy/dist/src/import/tui/runScopeGate.d.ts +0 -12
- package/legacy/dist/src/import/tui/spawn-generate.d.ts +0 -33
- package/legacy/dist/src/import/tui/steps/CredentialsStep.d.ts +0 -43
- package/legacy/dist/src/import/tui/steps/GateStep.d.ts +0 -15
- package/legacy/dist/src/import/tui/steps/PathValidationStep.d.ts +0 -10
- package/legacy/dist/src/import/tui/steps/PreviewValidationErrorStep.d.ts +0 -11
- package/legacy/dist/src/import/tui/steps/RunningStep.d.ts +0 -32
- package/legacy/dist/src/import/tui/steps/ScopeGateStep.d.ts +0 -48
- package/legacy/dist/src/import/tui/steps/TokenInputStep.d.ts +0 -8
- package/legacy/dist/src/import/tui/steps/WelcomeStep.d.ts +0 -7
- package/legacy/dist/src/import/tui/wizard-422-helpers.d.ts +0 -48
- package/legacy/dist/src/import/tui/wizard-generate-progress.d.ts +0 -21
- /package/{legacy/dist/src/analyze → dist/src/tui/import/steps/07-scope-gate/graph}/scope-gate-cascade.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/ai-flag.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/autocomplete.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/CompactControlBar.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/CounterStrip.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/LegendEntry.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/components/SearchMatchSummary.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/hooks/sidebar-search-state.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/hooks/useOverlayPanel.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/lineage-layout.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/sidebar-input.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/07-scope-gate/sidebar}/step-filters.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/auto-reject-decision.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review/helpers}/breaking-change-format.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review/helpers}/cycle-panel-scroll.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/09-review/helpers}/sidebar-width.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/09-review}/review-json-panel.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/useFinalizePreview.d.ts → dist/src/tui/import/steps/09-review/use-finalize-preview.d.ts} +0 -0
- /package/{legacy/dist/src/import/tui/useLivePreview.d.ts → dist/src/tui/import/steps/09-review/use-live-preview.d.ts} +0 -0
- /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
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/components}/CustomPromptBanner.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow}/components/SpaceEnvironment.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow}/components/StepHeader.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/screens}/DoneStep.d.ts +0 -0
- /package/{legacy/dist/src/runs/path-prompt.d.ts → dist/src/tui/import/steps/10-flow/screens/PathPrompt.d.ts} +0 -0
- /package/{legacy/dist/src/import → dist/src/tui/import/steps/10-flow/support}/path-utils.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/preview-confirmation-input.d.ts +0 -0
- /package/{legacy/dist/src/import/tui/steps → dist/src/tui/import/steps/10-flow/support}/preview-diff.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/push-progress.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/run-print-files-helpers.d.ts +0 -0
- /package/{legacy/dist/src/import/tui → dist/src/tui/import/steps/10-flow/support}/run-teaser.d.ts +0 -0
- /package/{legacy/dist/src/tui → dist/src/tui/import/steps/10-flow/support}/use-blinking-cursor.d.ts +0 -0
- /package/{legacy/dist/src/tui → dist/src/tui/import/steps/10-flow/support}/use-timed-spinner.d.ts +0 -0
|
@@ -29,9 +29,8 @@ export type RunLivePreviewOptions = {
|
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Pure async helper used by `useLivePreview` to re-fire `previewImport` after a
|
|
32
|
-
* FieldEditor save in the wizard's final-review step.
|
|
33
|
-
*
|
|
34
|
-
* React state.
|
|
32
|
+
* FieldEditor save in the wizard's final-review step. A side-effect-bearing
|
|
33
|
+
* pure orchestrator that owns no React state.
|
|
35
34
|
*
|
|
36
35
|
* Skips silently (returns `{ response: null }`) when any of `spaceId`,
|
|
37
36
|
* `environmentId`, or `cmaToken` is missing — live preview is an enhancement
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helper for computing the next scroll offset when the operator presses
|
|
3
|
+
* a navigation key inside a scrollable TUI panel (JSON view, rationale view,
|
|
4
|
+
* etc.). Extracted as a shared module so multiple panels can reuse the same
|
|
5
|
+
* scroll bindings without duplicating logic.
|
|
6
|
+
*
|
|
7
|
+
* Returns the new offset, or `null` if the input doesn't match any scroll
|
|
8
|
+
* binding (caller should NOT update state in that case).
|
|
9
|
+
*
|
|
10
|
+
* Supported bindings:
|
|
11
|
+
* - downArrow → +1 line
|
|
12
|
+
* - upArrow → -1 line
|
|
13
|
+
* - Ctrl+d → +half-page (floor(panelHeight / 2))
|
|
14
|
+
* - Ctrl+u → -half-page
|
|
15
|
+
* - PageDown → +panelHeight
|
|
16
|
+
* - PageUp → -panelHeight
|
|
17
|
+
* - G → jump to maxOffset
|
|
18
|
+
*
|
|
19
|
+
* `j`/`k` are intentionally not handled here because they are field-navigation
|
|
20
|
+
* keys in the editor. `g` (single-tap) and `gg` (double-tap → jump to 0) are handled separately
|
|
21
|
+
* by the caller via a pending-flag ref, since they need transient state.
|
|
22
|
+
*/
|
|
23
|
+
export type ScrollKeyState = {
|
|
24
|
+
upArrow?: boolean;
|
|
25
|
+
downArrow?: boolean;
|
|
26
|
+
pageUp?: boolean;
|
|
27
|
+
pageDown?: boolean;
|
|
28
|
+
ctrl?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function computeNextScrollOffset(current: number, input: string, key: ScrollKeyState, totalLines: number, panelHeight: number): number | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { HistorySnapshot } from './history.js';
|
|
3
|
+
import type { CdfReviewEntry, ReviewComponentStatus, TokenReviewToken } from './types.js';
|
|
4
|
+
export type ReviewSessionLoadResult<TExtra = undefined> = {
|
|
5
|
+
entries: CdfReviewEntry[];
|
|
6
|
+
tokens: TokenReviewToken[];
|
|
7
|
+
error: string | null;
|
|
8
|
+
extra?: TExtra;
|
|
9
|
+
};
|
|
10
|
+
export type ReviewSessionLoaderOptions<TExtra = undefined> = {
|
|
11
|
+
extractSessionId: string;
|
|
12
|
+
tokenSessionId?: string | null;
|
|
13
|
+
loadExtra?: (db: DatabaseSync, sessionId: string) => TExtra;
|
|
14
|
+
sortEntries: (entries: CdfReviewEntry[], extra: TExtra | undefined) => CdfReviewEntry[];
|
|
15
|
+
};
|
|
16
|
+
export declare function loadReviewSessionState<TExtra = undefined>({ extractSessionId, tokenSessionId, loadExtra, sortEntries, }: ReviewSessionLoaderOptions<TExtra>): ReviewSessionLoadResult<TExtra>;
|
|
17
|
+
export declare function createReviewHistorySnapshot(components: CdfReviewEntry[], options?: {
|
|
18
|
+
autoRejected?: readonly string[];
|
|
19
|
+
undoSnapshot?: ReadonlyMap<string, ReviewComponentStatus> | null;
|
|
20
|
+
}): HistorySnapshot;
|
|
21
|
+
export type ReviewFinalizeCounts = {
|
|
22
|
+
accepted: number;
|
|
23
|
+
rejected: number;
|
|
24
|
+
unresolved: number;
|
|
25
|
+
};
|
|
26
|
+
export declare function finalizeReviewSession(extractSessionId: string, components: CdfReviewEntry[]): ReviewFinalizeCounts;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
import type { TokenPropSuggestion, TokenReviewToken } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Design-token props on `entry` with a declared token kind. `paths` is the
|
|
5
|
+
* full compatible token universe when a token catalog is available; `allowed`
|
|
6
|
+
* remains the current subset.
|
|
7
|
+
*/
|
|
8
|
+
export declare function collectTokenSuggestions(entry: CDFComponentEntry, availableTokens?: TokenReviewToken[]): TokenPropSuggestion[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
export type ReviewComponentStatus = 'needs-review' | 'reviewed' | 'accepted' | 'rejected';
|
|
3
|
+
export type CdfReviewEntry = {
|
|
4
|
+
key: string;
|
|
5
|
+
entry: CDFComponentEntry;
|
|
6
|
+
status: ReviewComponentStatus;
|
|
7
|
+
};
|
|
8
|
+
export type ReviewPanel = 'none' | 'prop-rationale' | 'component-rationale' | 'source' | 'token-review';
|
|
9
|
+
export type TokenReviewToken = {
|
|
10
|
+
path: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
};
|
|
13
|
+
export type TokenPropSuggestion = {
|
|
14
|
+
propName: string;
|
|
15
|
+
paths: string[];
|
|
16
|
+
suggested: string[];
|
|
17
|
+
allowed: string[];
|
|
18
|
+
};
|
|
19
|
+
export type PreviewAnnotation = 'new' | 'changed' | 'removed' | 'breaking';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import type { CdfReviewEntry } from './useReviewSession.js';
|
|
4
|
-
export type ReviewPanel = 'none' | 'prop-rationale' | 'component-rationale' | 'source' | 'token-review';
|
|
2
|
+
import type { CdfReviewEntry, ReviewPanel, TokenPropSuggestion, TokenReviewToken } from './types.js';
|
|
5
3
|
type UseReviewEditorOptions = {
|
|
6
4
|
components: CdfReviewEntry[];
|
|
7
5
|
selectedIdx: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentTypeSummary, ServerPreviewResponse } from '@contentful/experience-design-system-types';
|
|
2
|
-
import type { PreviewAnnotation } from '
|
|
3
|
-
import { type UseLivePreviewReturn } from '
|
|
2
|
+
import type { PreviewAnnotation } from './types.js';
|
|
3
|
+
import { type UseLivePreviewReturn } from './use-live-preview.js';
|
|
4
4
|
export type UseReviewPreviewOptions = {
|
|
5
5
|
components: ReadonlyArray<{
|
|
6
6
|
key: string;
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
1
|
import { type Dispatch, type SetStateAction } from 'react';
|
|
3
|
-
import type
|
|
4
|
-
import { type
|
|
5
|
-
import { type
|
|
6
|
-
import type {
|
|
7
|
-
import { type HistorySnapshot } from '../history.js';
|
|
8
|
-
export type CdfReviewEntry = {
|
|
9
|
-
key: string;
|
|
10
|
-
entry: CDFComponentEntry;
|
|
11
|
-
status: ReviewComponentStatus;
|
|
12
|
-
};
|
|
13
|
-
export type ReviewSessionLoadResult<TExtra = undefined> = {
|
|
14
|
-
entries: CdfReviewEntry[];
|
|
15
|
-
tokens: TokenReviewToken[];
|
|
16
|
-
error: string | null;
|
|
17
|
-
extra?: TExtra;
|
|
18
|
-
};
|
|
19
|
-
export type ReviewSessionLoaderOptions<TExtra = undefined> = {
|
|
20
|
-
extractSessionId: string;
|
|
21
|
-
tokenSessionId?: string | null;
|
|
22
|
-
loadExtra?: (db: DatabaseSync, sessionId: string) => TExtra;
|
|
23
|
-
sortEntries: (entries: CdfReviewEntry[], extra: TExtra | undefined) => CdfReviewEntry[];
|
|
24
|
-
};
|
|
25
|
-
export declare function loadReviewSessionState<TExtra = undefined>({ extractSessionId, tokenSessionId, loadExtra, sortEntries, }: ReviewSessionLoaderOptions<TExtra>): ReviewSessionLoadResult<TExtra>;
|
|
2
|
+
import { type ComponentRationale, type ComponentReviewMetadata } from '@contentful/experience-design-system-backend-pipeline';
|
|
3
|
+
import { type HistorySnapshot } from './history.js';
|
|
4
|
+
import { type ReviewSessionLoadResult } from './session.js';
|
|
5
|
+
import type { CdfReviewEntry, TokenReviewToken } from './types.js';
|
|
26
6
|
type UseReviewSessionOptions<TExtra> = {
|
|
27
7
|
loadSession: () => ReviewSessionLoadResult<TExtra>;
|
|
28
8
|
tokensPath?: string;
|
|
@@ -46,10 +26,6 @@ export declare function useReviewMetadata({ components, selectedIdx, extractSess
|
|
|
46
26
|
reviewMetadata: ComponentReviewMetadata | null;
|
|
47
27
|
componentRationale: ComponentRationale | null;
|
|
48
28
|
};
|
|
49
|
-
export declare function createReviewHistorySnapshot(components: CdfReviewEntry[], options?: {
|
|
50
|
-
autoRejected?: readonly string[];
|
|
51
|
-
undoSnapshot?: ReadonlyMap<string, ReviewComponentStatus> | null;
|
|
52
|
-
}): HistorySnapshot;
|
|
53
29
|
type UseReviewHistoryOptions = {
|
|
54
30
|
loading: boolean;
|
|
55
31
|
components: CdfReviewEntry[];
|
|
@@ -65,12 +41,6 @@ export declare function useReviewHistory({ loading, components, createSnapshot,
|
|
|
65
41
|
handleRedo: () => void;
|
|
66
42
|
resetHistory: (snapshot: HistorySnapshot) => void;
|
|
67
43
|
};
|
|
68
|
-
export type ReviewFinalizeCounts = {
|
|
69
|
-
accepted: number;
|
|
70
|
-
rejected: number;
|
|
71
|
-
unresolved: number;
|
|
72
|
-
};
|
|
73
|
-
export declare function finalizeReviewSession(extractSessionId: string, components: CdfReviewEntry[]): ReviewFinalizeCounts;
|
|
74
44
|
export type UseReviewFinalizeOptions = {
|
|
75
45
|
showFinalize: boolean;
|
|
76
46
|
extractSessionId: string;
|
|
@@ -89,7 +59,7 @@ export type UseReviewFinalizeOptions = {
|
|
|
89
59
|
* final counts back to the wizard.
|
|
90
60
|
*/
|
|
91
61
|
export declare function useReviewFinalize({ showFinalize, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, components, onFinalize, }: UseReviewFinalizeOptions): {
|
|
92
|
-
finalizePreview: import("
|
|
62
|
+
finalizePreview: import("./use-finalize-preview.js").UseFinalizePreviewReturn;
|
|
93
63
|
handleFinalizeConfirm: () => void;
|
|
94
64
|
};
|
|
95
65
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ImportHandoff } from '@contentful/experience-design-system-types/handoff';
|
|
2
|
+
import type { ExtractionInput } from '../../06-extraction/types.js';
|
|
3
|
+
import type { FlowStart } from './controller.js';
|
|
4
|
+
interface SavedCredentials {
|
|
5
|
+
spaceId?: string;
|
|
6
|
+
environmentId?: string;
|
|
7
|
+
cmaToken?: string;
|
|
8
|
+
host?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What the flow starts from. The credentials are the ones the user confirmed. When they skipped validation there are none
|
|
12
|
+
* to use, so the saved ones stand in, which is what the wizard did: it always read them from the store. The review's
|
|
13
|
+
* live preview and the push use them.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildFlowStart(input: {
|
|
16
|
+
extraction: ExtractionInput;
|
|
17
|
+
handoff: ImportHandoff;
|
|
18
|
+
saved?: SavedCredentials;
|
|
19
|
+
generatePromptPath?: string;
|
|
20
|
+
}): FlowStart;
|
|
21
|
+
export {};
|
|
@@ -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;
|
|
@@ -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
|
+
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { WelcomeScreen } from './01-welcome/screen.js';
|
|
2
2
|
export { TokenInputScreen } from './02-token-input/screen.js';
|
|
3
|
+
export { PathValidationScreen } from './03-path-validation/screen.js';
|
|
4
|
+
export { CredentialsScreen } from './04-credentials/screen.js';
|
|
5
|
+
export { TokenReuseScreen } from './05-token-reuse/screen.js';
|
|
6
|
+
export { ExtractionScreen } from './06-extraction/screen.js';
|
|
@@ -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 {};
|