@contentful/experience-design-system-cli 2.37.1-dev-build-444a2d6a.0 → 2.37.1-dev-build-04545499.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.js +973 -290
- package/dist/index.js +1014 -306
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/07-scope-gate/sidebar/components/GroupedSidebar.d.ts +0 -5
- package/dist/src/tui/import/steps/07-scope-gate/state.d.ts +2 -3
- package/dist/src/tui/import/steps/07-scope-gate/types.d.ts +0 -7
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.d.ts +2 -6
- package/dist/src/tui/import/steps/07-scope-gate/use-scope-gate.d.ts +1 -2
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +44 -0
- package/dist/src/tui/import/steps/08-generation/map-tokens.d.ts +14 -0
- package/dist/src/tui/import/steps/08-generation/processes.d.ts +42 -0
- package/dist/src/tui/import/steps/08-generation/run.d.ts +26 -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/legacy/dist/src/analyze/select/tui/components/GroupedSidebar.d.ts +0 -2
- package/legacy/dist/src/import/tui/WizardApp.d.ts +1 -36
- package/legacy/dist/src/import/tui/handoff.d.ts +10 -13
- package/legacy/dist/src/import/tui/runLivePreview.d.ts +2 -3
- package/legacy/dist/src/index.js +55 -908
- package/legacy/dist/src/session/db.d.ts +0 -11
- package/legacy/package.json +1 -1
- package/package.json +4 -4
- package/legacy/dist/src/import/tui/runScopeGate.d.ts +0 -14
- package/legacy/dist/src/import/tui/spawn-generate.d.ts +0 -33
- package/legacy/dist/src/import/tui/wizard-generate-progress.d.ts +0 -21
package/dist/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
3
3
|
import { type ComponentGraphNode, type NodeStatus } from '../../graph/composite-closure.js';
|
|
4
|
-
import type { ParentChildEdge } from '../../types.js';
|
|
5
4
|
import type { PreviewAnnotation, RenderStatus } from '../types.js';
|
|
6
5
|
export interface GroupedSidebarItem {
|
|
7
6
|
key: string;
|
|
@@ -28,8 +27,6 @@ export interface GroupedSidebarProps {
|
|
|
28
27
|
alwaysExpanded?: boolean;
|
|
29
28
|
showFlatTier?: boolean;
|
|
30
29
|
selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
|
|
31
|
-
/** Slot edges the user removed; their nested rows render unchecked. */
|
|
32
|
-
excludedSlotEdges?: ParentChildEdge[];
|
|
33
30
|
aiFlaggedByKey?: Map<string, boolean>;
|
|
34
31
|
dimPredicate?: (componentKey: string) => boolean;
|
|
35
32
|
viewMode?: 'grouped' | 'flat';
|
|
@@ -48,8 +45,6 @@ export interface VisibleRow {
|
|
|
48
45
|
cycleChild?: boolean;
|
|
49
46
|
itemIdx: number;
|
|
50
47
|
rootName?: string;
|
|
51
|
-
/** The parent whose slot the nested row sits in. */
|
|
52
|
-
parentName?: string;
|
|
53
48
|
}
|
|
54
49
|
export declare function buildVisibleRows(props: {
|
|
55
50
|
items: GroupedSidebarItem[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ScopeGraph } from './graph/index.js';
|
|
2
|
-
import type { Decision,
|
|
2
|
+
import type { Decision, ScopeComponent, ScopeDecisions } from './types.js';
|
|
3
3
|
export type DecisionState = Map<string, Decision>;
|
|
4
4
|
export type DecisionAction = {
|
|
5
5
|
type: 'accept';
|
|
@@ -15,6 +15,5 @@ export type DecisionAction = {
|
|
|
15
15
|
export declare function reduceDecisions(state: DecisionState, action: DecisionAction, components: ScopeComponent[], graph: ScopeGraph): DecisionState;
|
|
16
16
|
/** Whether rejecting `name` touches 2 or more other components, so the screen has to ask first. */
|
|
17
17
|
export declare function rejectNeedsConfirmation(graph: ScopeGraph, name: string, state: DecisionState): boolean;
|
|
18
|
-
export declare function withEdgeExcluded(edges: ParentChildEdge[], edge: ParentChildEdge, excluded: boolean): ParentChildEdge[];
|
|
19
18
|
/** Everything not accepted counts as rejected, as legacy's `partition` did. */
|
|
20
|
-
export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState
|
|
19
|
+
export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState): ScopeDecisions;
|
|
@@ -10,17 +10,10 @@ export type ScopeComponent = Omit<ScopeComponentRow, 'aiDecision' | 'aiReason' |
|
|
|
10
10
|
slots?: ScopeComponentRow['slots'];
|
|
11
11
|
};
|
|
12
12
|
export type Decision = 'accepted' | 'rejected' | 'undecided';
|
|
13
|
-
/** One slot edge: `parent` allows `child` in a slot. */
|
|
14
|
-
export interface ParentChildEdge {
|
|
15
|
-
parent: string;
|
|
16
|
-
child: string;
|
|
17
|
-
}
|
|
18
13
|
/** What the user confirmed. Becomes `ImportHandoff.scope`; the legacy wizard saves it and starts generation. */
|
|
19
14
|
export interface ScopeDecisions {
|
|
20
15
|
accepted: string[];
|
|
21
16
|
rejected: string[];
|
|
22
|
-
/** Slot edges removed at the gate. The child keeps its own decision. */
|
|
23
|
-
excludedSlotEdges: ParentChildEdge[];
|
|
24
17
|
}
|
|
25
18
|
export type ScopeGateLoad = {
|
|
26
19
|
ok: true;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ScopeHandoff } from '@contentful/experience-design-system-types/handoff';
|
|
2
1
|
import { type CacheCheckInput } from './cache-check.js';
|
|
3
2
|
import { loadScopeGate } from './load.js';
|
|
4
3
|
import type { ScopeDecisions, ScopeGateLoad } from './types.js';
|
|
@@ -11,13 +10,10 @@ export type ScopeGateFlow = {
|
|
|
11
10
|
ok: true;
|
|
12
11
|
}>;
|
|
13
12
|
confirm: (decisions: ScopeDecisions) => void;
|
|
14
|
-
}
|
|
15
|
-
/** Confirmed before the cache check finished. */
|
|
16
|
-
| {
|
|
17
|
-
status: 'preparing';
|
|
18
13
|
} | {
|
|
19
14
|
status: 'confirmed';
|
|
20
|
-
|
|
15
|
+
decisions: ScopeDecisions;
|
|
16
|
+
cachedNames: Promise<string[]>;
|
|
21
17
|
};
|
|
22
18
|
interface Deps {
|
|
23
19
|
load: typeof loadScopeGate;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ScopeComponent, ScopeDecisions } from './types.js';
|
|
2
2
|
interface UseScopeGateOptions {
|
|
3
3
|
components: ScopeComponent[];
|
|
4
4
|
onConfirm: (decisions: ScopeDecisions) => void;
|
|
@@ -20,7 +20,6 @@ export declare function useScopeGate({ components, onConfirm, onQuit }: UseScope
|
|
|
20
20
|
panelLayout: import("./columns.js").ScopeGatePanelLayout;
|
|
21
21
|
visibleCount: number;
|
|
22
22
|
panelMaxRows: number;
|
|
23
|
-
excludedEdges: ParentChildEdge[];
|
|
24
23
|
groupedItems: import("./graph/index.js").SidebarItem[];
|
|
25
24
|
graph: import("./graph/index.js").ScopeGraph;
|
|
26
25
|
hasGroupRoots: boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { GenerationProgress } from './types.js';
|
|
2
|
+
export declare function initialProgress(): GenerationProgress;
|
|
3
|
+
/**
|
|
4
|
+
* Folds a chunk of `__generate components` stderr into the progress. Two line shapes carry it:
|
|
5
|
+
* 1. `progress=generate:<done>/<total>:<name>`, emitted when a component finishes. `done` is the count of finished
|
|
6
|
+
* components and never goes down.
|
|
7
|
+
* 2. `[<index>/<total>] <name>`, emitted when a component starts (and again on a retry). With more than one worker its
|
|
8
|
+
* index is the worker's starting position, not a count of completions, so it must only change `current`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyGenerateStderr(chunk: string, previous: GenerationProgress['components']): GenerationProgress['components'];
|
|
11
|
+
/** The session, the component count and the renamed-slot count from the command's output. */
|
|
12
|
+
export declare function parseGenerateResult(output: {
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
}, fallbackCount: number): {
|
|
16
|
+
generateSessionId: string | null;
|
|
17
|
+
generatedCount: number;
|
|
18
|
+
renamedSlotsCount: number;
|
|
19
|
+
};
|
|
20
|
+
/** Token mapping runs only when there is something to map and tokens to map it from. */
|
|
21
|
+
export declare function shouldRunMapTokens(counts: {
|
|
22
|
+
mappablePropCount: number;
|
|
23
|
+
rawTokenCount: number;
|
|
24
|
+
}): boolean;
|
|
25
|
+
/** "5 components accepted." or, with some left out, "5 components accepted, 2 excluded due to validation errors." */
|
|
26
|
+
export declare function formatAcceptanceSummary(counts: {
|
|
27
|
+
accepted: number;
|
|
28
|
+
autoRejected: number;
|
|
29
|
+
}): string;
|
|
30
|
+
/** The screen's description: what was accepted, what is happening to it, and whether the tokens are used. */
|
|
31
|
+
export declare function describeGeneration(input: {
|
|
32
|
+
acceptedCount: number;
|
|
33
|
+
agent: string;
|
|
34
|
+
hasTokens: boolean;
|
|
35
|
+
}): string;
|
|
36
|
+
/** The rows the generating screen shows for this progress. */
|
|
37
|
+
export declare function progressRows(progress: GenerationProgress, agent: string): Array<{
|
|
38
|
+
text: string;
|
|
39
|
+
complete: boolean;
|
|
40
|
+
progress?: {
|
|
41
|
+
done: number;
|
|
42
|
+
total: number;
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GenerationInput } from './types.js';
|
|
2
|
+
export interface MapTokensPlan {
|
|
3
|
+
/** False when there is nothing to map, in which case the command is not run. */
|
|
4
|
+
eligible: boolean;
|
|
5
|
+
mappablePropCount: number;
|
|
6
|
+
rawTokenCount: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Prepares the generated session for token mapping and says whether it is worth running. The map tokens command works
|
|
10
|
+
* on one session, so the token universe is copied into the generated one: from the token session when extraction made
|
|
11
|
+
* one, or restored from the saved tokens.json when an existing catalog was reused (there is no token session then).
|
|
12
|
+
* Then it counts the design props that are tokens and the raw tokens. Reads and writes the pipeline database.
|
|
13
|
+
*/
|
|
14
|
+
export declare function prepareMapTokens(input: Pick<GenerationInput, 'tokenSessionId' | 'tokensPath'>, generatedSessionId: string): Promise<MapTokensPlan>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface GenerateCommand {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
tokensPath: string;
|
|
4
|
+
agent: string;
|
|
5
|
+
agentModel?: string;
|
|
6
|
+
promptOverrides: string[];
|
|
7
|
+
generatePromptPath?: string;
|
|
8
|
+
noCache: boolean;
|
|
9
|
+
existingEntitiesPath: string | null;
|
|
10
|
+
/** Accepted components the cache already holds, so the command skips them. */
|
|
11
|
+
cachedComponents: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface MapTokensCommand {
|
|
14
|
+
sessionId: string;
|
|
15
|
+
agent: string;
|
|
16
|
+
agentModel?: string;
|
|
17
|
+
promptOverrides: string[];
|
|
18
|
+
noCache: boolean;
|
|
19
|
+
existingEntitiesPath: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface SpawnedResult {
|
|
22
|
+
exitCode: number;
|
|
23
|
+
stdout: string;
|
|
24
|
+
stderr: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* `__generate components …`, in the order the wizard builds the arguments. The cache was already restored by the check
|
|
28
|
+
* that ran while the scope gate was open, so `--restore-cache` is not passed here; what the cache holds goes in
|
|
29
|
+
* `--cached-components` instead.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildGenerateArgs(cliPath: string, command: GenerateCommand): string[];
|
|
32
|
+
/** `map tokens …`, in the order the wizard builds the arguments. */
|
|
33
|
+
export declare function buildMapTokensArgs(command: MapTokensCommand): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Runs `__generate components`, delivering stderr as it arrives. Resolves on close, not exit, so the child's stdio and
|
|
36
|
+
* any file handles it inherited (the pipeline database's WAL and SHM files) are released before anything else touches
|
|
37
|
+
* the database.
|
|
38
|
+
*/
|
|
39
|
+
export declare function spawnGenerate(command: GenerateCommand, handlers: {
|
|
40
|
+
onStderr: (chunk: string) => void;
|
|
41
|
+
}): Promise<SpawnedResult>;
|
|
42
|
+
export declare function runMapTokens(command: MapTokensCommand): Promise<SpawnedResult>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { checkAgentAuth } from '@contentful/experience-design-system-generation';
|
|
2
|
+
import { type CacheCheckInput } from '../07-scope-gate/cache-check.js';
|
|
3
|
+
import { prepareMapTokens } from './map-tokens.js';
|
|
4
|
+
import { runMapTokens, spawnGenerate } from './processes.js';
|
|
5
|
+
import { saveDecisions } from './save-decisions.js';
|
|
6
|
+
import type { GenerationInput, GenerationProgress, GenerationResult } from './types.js';
|
|
7
|
+
/** The outside world the stage talks to, so the order of events can be tested without a database, an agent or a CLI. */
|
|
8
|
+
export interface GenerationDeps {
|
|
9
|
+
checkAgentAuth: typeof checkAgentAuth;
|
|
10
|
+
saveDecisions: typeof saveDecisions;
|
|
11
|
+
checkCache: (input: CacheCheckInput) => Promise<string[]>;
|
|
12
|
+
spawnGenerate: typeof spawnGenerate;
|
|
13
|
+
prepareMapTokens: typeof prepareMapTokens;
|
|
14
|
+
runMapTokens: typeof runMapTokens;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The whole stage, in the order the wizard ran it:
|
|
18
|
+
* 1. Wait for the cache check that ran while the scope gate was open, then save the decisions. Both write to the
|
|
19
|
+
* pipeline database and the cache has to be restored first. With nothing accepted the stage ends here, as the wizard's did.
|
|
20
|
+
* 2. If every accepted component is in the cache, take them all from it. Otherwise look at the cache again, because the
|
|
21
|
+
* earlier answer was read before the decisions were saved, and generate only what is still missing.
|
|
22
|
+
* 3. Map tokens onto the generated session. Skipped when there is nothing to map.
|
|
23
|
+
* A failed token mapping after a successful generation is an error to show. It neither retries nor throws away what was
|
|
24
|
+
* generated.
|
|
25
|
+
*/
|
|
26
|
+
export declare function runGeneration(input: GenerationInput, onProgress: (progress: GenerationProgress) => void, deps?: GenerationDeps): Promise<GenerationResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GenerationInput } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Applies the scope decisions to the session and writes the review snapshot that `generate components` reads to leave
|
|
4
|
+
* out rejected components. Without the snapshot the generator would process rejected components anyway.
|
|
5
|
+
* Uses `applyScopeDecisions` and `writeScopeDecisionsSnapshot` from backend-pipeline, which are identical to legacy's.
|
|
6
|
+
* Both write to the pipeline database, so this runs only after the cache check has finished restoring into it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function saveDecisions(input: Pick<GenerationInput, 'sessionId' | 'decisions'>): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GenerationProgress } from './types.js';
|
|
3
|
+
interface GenerationScreenProps {
|
|
4
|
+
progress: GenerationProgress;
|
|
5
|
+
agent: string;
|
|
6
|
+
acceptedCount: number;
|
|
7
|
+
hasTokens: boolean;
|
|
8
|
+
stepNumber: number;
|
|
9
|
+
totalSteps: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens, stepNumber, totalSteps, }: GenerationScreenProps): React.ReactElement;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { GenerationHandoff } from '@contentful/experience-design-system-types/handoff';
|
|
2
|
+
export interface GenerationInput {
|
|
3
|
+
/** The extraction session the scope was decided on. */
|
|
4
|
+
sessionId: string;
|
|
5
|
+
decisions: {
|
|
6
|
+
accepted: string[];
|
|
7
|
+
rejected: string[];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The cache check that ran while the scope gate was open, which restores cached definitions into the pipeline
|
|
11
|
+
* database. The stage waits for it before saving the decisions, since both write to that database.
|
|
12
|
+
*/
|
|
13
|
+
cachedNames: Promise<string[]>;
|
|
14
|
+
tokensPath: string;
|
|
15
|
+
/** The token session extraction recorded, or null when an existing tokens.json was reused. */
|
|
16
|
+
tokenSessionId: string | null;
|
|
17
|
+
existingEntitiesPath: string | null;
|
|
18
|
+
agent: string;
|
|
19
|
+
agentModel?: string;
|
|
20
|
+
promptOverrides: string[];
|
|
21
|
+
/** A custom prompt for `generate components`, saved in the config. Passed to the command as it is. */
|
|
22
|
+
generatePromptPath?: string;
|
|
23
|
+
noCache: boolean;
|
|
24
|
+
/** Whether a token catalog is in use. It changes the wording of the screen, not what runs. */
|
|
25
|
+
hasTokens: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** One line per thing the screen shows, in the order it shows them. */
|
|
28
|
+
export interface GenerationProgress {
|
|
29
|
+
/** Components finished, out of the total, and the one being worked on. Null until the first progress line. */
|
|
30
|
+
components: {
|
|
31
|
+
done: number;
|
|
32
|
+
total: number;
|
|
33
|
+
current: string;
|
|
34
|
+
} | null;
|
|
35
|
+
mapTokens: 'idle' | 'running' | 'complete';
|
|
36
|
+
/** Whether token mapping will run at all; unknown until the generated components have been looked at. */
|
|
37
|
+
mapTokensEligible: boolean | null;
|
|
38
|
+
}
|
|
39
|
+
export type GenerationStepName = 'save decisions' | 'generate components' | 'map tokens' | `${string} auth check`;
|
|
40
|
+
export type GenerationResult = {
|
|
41
|
+
ok: true;
|
|
42
|
+
generation: GenerationHandoff;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
step: GenerationStepName;
|
|
46
|
+
message: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GenerationInput, GenerationProgress, GenerationResult } from './types.js';
|
|
2
|
+
export type GenerationState = {
|
|
3
|
+
status: 'running';
|
|
4
|
+
progress: GenerationProgress;
|
|
5
|
+
} | {
|
|
6
|
+
status: 'done';
|
|
7
|
+
result: GenerationResult;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Runs the generation stage once for the given input and reports its progress. Passing a different input starts a new
|
|
11
|
+
* run; passing nothing leaves the stage idle. A run that finishes after the input changed or the screen went away is
|
|
12
|
+
* ignored.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useGeneration(input: GenerationInput | undefined): GenerationState | undefined;
|
|
@@ -46,8 +46,6 @@ export interface VisibleRow {
|
|
|
46
46
|
cycleChild?: boolean;
|
|
47
47
|
itemIdx: number;
|
|
48
48
|
rootName?: string;
|
|
49
|
-
/** The parent whose slot the nested row sits in. */
|
|
50
|
-
parentName?: string;
|
|
51
49
|
}
|
|
52
50
|
export declare function buildVisibleRows(props: {
|
|
53
51
|
items: GroupedSidebarItem[];
|
|
@@ -1,42 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CDFDocument, CDFComponentEntry, DTCGTokenEntry } from '@contentful/experience-design-system-types';
|
|
3
|
-
import { type AgentAuthStatus } from '@contentful/experience-design-system-generation';
|
|
4
|
-
export declare function buildGenerateComponentsArgs(opts: {
|
|
5
|
-
sessionId: string;
|
|
6
|
-
tokensPath?: string;
|
|
7
|
-
agent: string;
|
|
8
|
-
model?: string;
|
|
9
|
-
bedrock?: boolean;
|
|
10
|
-
noCache?: boolean;
|
|
11
|
-
generatePromptPath?: string;
|
|
12
|
-
promptOverrides?: string[];
|
|
13
|
-
existingEntitiesPath?: string;
|
|
14
|
-
restoreCache?: boolean;
|
|
15
|
-
cachedComponents?: string[];
|
|
16
|
-
}): string[];
|
|
17
|
-
export declare function buildMapTokensArgs(opts: {
|
|
18
|
-
sessionId: string;
|
|
19
|
-
agent: string;
|
|
20
|
-
model?: string;
|
|
21
|
-
noCache?: boolean;
|
|
22
|
-
skipAgent?: boolean;
|
|
23
|
-
promptOverrides?: string[];
|
|
24
|
-
existingEntitiesPath?: string;
|
|
25
|
-
}): string[];
|
|
26
|
-
export declare function shouldRunMapTokens(opts: {
|
|
27
|
-
mappablePropCount: number;
|
|
28
|
-
rawTokenCount: number;
|
|
29
|
-
}): boolean;
|
|
30
3
|
export declare function buildSavedCDF(components: Array<{
|
|
31
4
|
key: string;
|
|
32
5
|
entry: CDFComponentEntry;
|
|
33
6
|
}>, tokens: DTCGTokenEntry[], opts?: {
|
|
34
7
|
deleteAll?: boolean;
|
|
35
8
|
}): CDFDocument;
|
|
36
|
-
export declare function formatAcceptanceSummary(opts: {
|
|
37
|
-
accepted: number;
|
|
38
|
-
autoRejected: number;
|
|
39
|
-
}): string;
|
|
40
9
|
export declare function parsePrintTokensCount(stdout: string): number;
|
|
41
10
|
export type WizardAppProps = {
|
|
42
11
|
initialSpaceId?: string;
|
|
@@ -48,12 +17,8 @@ export type WizardAppProps = {
|
|
|
48
17
|
bedrock?: boolean;
|
|
49
18
|
initialProjectPath?: string;
|
|
50
19
|
host?: string;
|
|
51
|
-
promptOverrides?: string[];
|
|
52
|
-
noCache?: boolean;
|
|
53
20
|
livePreview?: boolean;
|
|
54
21
|
generatePromptPath?: string;
|
|
55
|
-
skipMapTokens?: boolean;
|
|
56
22
|
initialRawTokensPath?: string;
|
|
57
|
-
initialAgentAuth?: Promise<AgentAuthStatus>;
|
|
58
23
|
};
|
|
59
|
-
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host,
|
|
24
|
+
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, livePreview, generatePromptPath, initialRawTokensPath, }?: WizardAppProps): React.ReactElement;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type ImportHandoff } from '@contentful/experience-design-system-types/handoff';
|
|
2
|
-
import type { ParentChildEdge } from '../../session/db.js';
|
|
3
2
|
/** The wizard state the early stages produce. Every field is one the stage used to write. */
|
|
4
3
|
export interface HandoffState {
|
|
5
4
|
credentialsSkipped: boolean;
|
|
@@ -13,24 +12,22 @@ export interface HandoffState {
|
|
|
13
12
|
selectionAgentStatus?: 'complete';
|
|
14
13
|
existingEntitiesStatus?: 'idle' | 'complete' | 'failed';
|
|
15
14
|
existingEntitiesPath?: string | null;
|
|
15
|
+
acceptedCount?: number;
|
|
16
|
+
autoRejectedCount?: number;
|
|
17
|
+
generateSessionId?: string;
|
|
18
|
+
generatedCount?: number;
|
|
19
|
+
mapTokensEligible?: boolean;
|
|
20
|
+
mapTokensStatus?: 'complete';
|
|
16
21
|
}
|
|
17
|
-
/**
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
accepted: string[];
|
|
21
|
-
rejected: string[];
|
|
22
|
-
excludedSlotEdges: ParentChildEdge[];
|
|
23
|
-
};
|
|
24
|
-
/** Components the cache check (finished and restored before the wizard started) found already generated. */
|
|
25
|
-
cachedNames: string[];
|
|
26
|
-
}
|
|
27
|
-
export declare function scopeFromHandoff(handoff: ImportHandoff): HandoffScope | null;
|
|
22
|
+
/** Where the wizard goes first: the review screen with the generated definitions, or straight to saving and pushing. */
|
|
23
|
+
export type StartRoute = 'review' | 'push';
|
|
24
|
+
export declare function routeFromHandoff(handoff: ImportHandoff): StartRoute | null;
|
|
28
25
|
export declare function stateFromHandoff(handoff: ImportHandoff): HandoffState;
|
|
29
26
|
export type StartFromHandoff = {
|
|
30
27
|
ok: true;
|
|
31
28
|
handoff: ImportHandoff;
|
|
32
29
|
state: HandoffState;
|
|
33
|
-
|
|
30
|
+
route: StartRoute | null;
|
|
34
31
|
} | {
|
|
35
32
|
ok: false;
|
|
36
33
|
error: string;
|
|
@@ -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
|