@contentful/experience-design-system-cli 2.18.1-dev-build-0f85b83.0 → 2.18.1-dev-build-eb63588.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/README.md +1 -2
- package/dist/package.json +2 -2
- package/dist/src/analyze/command.js +3 -3
- package/dist/src/analyze/composition/parse-map-edges.d.ts +1 -1
- package/dist/src/analyze/select/tui/App.js +1 -4
- package/dist/src/analyze/select-agent/command.js +6 -5
- package/dist/src/apply/api-client.d.ts +2 -5
- package/dist/src/apply/api-client.js +4 -7
- package/dist/src/apply/command.js +10 -27
- package/dist/src/apply/preview-utils.d.ts +1 -5
- package/dist/src/apply/preview-utils.js +1 -5
- package/dist/src/apply/tui/ServerApplyView.d.ts +3 -6
- package/dist/src/apply/tui/ServerApplyView.js +6 -15
- package/dist/src/apply/tui/ServerPreviewView.d.ts +1 -2
- package/dist/src/apply/tui/ServerPreviewView.js +3 -3
- package/dist/src/generate/command.d.ts +0 -6
- package/dist/src/generate/command.js +7 -17
- package/dist/src/import/command.js +1 -6
- package/dist/src/import/orchestrator.d.ts +0 -1
- package/dist/src/import/orchestrator.js +0 -2
- package/dist/src/import/tui/WizardApp.d.ts +1 -2
- package/dist/src/import/tui/WizardApp.js +9 -9
- package/dist/src/import/tui/final-review-host.d.ts +1 -2
- package/dist/src/import/tui/final-review-host.js +2 -2
- package/dist/src/import/tui/runLivePreview.d.ts +0 -3
- package/dist/src/import/tui/runLivePreview.js +1 -4
- package/dist/src/import/tui/steps/GenerateReviewStep.d.ts +1 -2
- package/dist/src/import/tui/steps/GenerateReviewStep.js +3 -3
- package/dist/src/import/tui/steps/WizardPreviewStep.d.ts +2 -6
- package/dist/src/import/tui/steps/WizardPreviewStep.js +3 -12
- package/dist/src/import/tui/useFinalizePreview.d.ts +0 -2
- package/dist/src/import/tui/useFinalizePreview.js +0 -0
- package/dist/src/import/tui/useLivePreview.d.ts +0 -2
- package/dist/src/import/tui/useLivePreview.js +0 -1
- package/dist/src/lib/agent-model-options.js +1 -1
- package/dist/src/lib/command-options.d.ts +0 -1
- package/dist/src/lib/command-options.js +0 -3
- package/dist/src/runs/modify-launcher.d.ts +0 -2
- package/dist/src/runs/modify-launcher.js +0 -2
- package/dist/src/runs/push-helpers.d.ts +0 -1
- package/dist/src/runs/push-helpers.js +0 -3
- package/dist/src/runs/replay-helpers.d.ts +0 -4
- package/dist/src/runs/replay-helpers.js +0 -3
- package/dist/src/session/cache-keys.d.ts +1 -1
- package/dist/src/session/cache-keys.js +1 -1
- package/dist/src/session/db.d.ts +1 -1
- package/dist/src/session/db.js +1 -1
- package/package.json +5 -5
- package/dist/src/generate/agent-runner.d.ts +0 -125
- package/dist/src/generate/agent-runner.js +0 -427
- package/dist/src/generate/progress.d.ts +0 -9
- package/dist/src/generate/progress.js +0 -11
- package/dist/src/generate/prompt-builder.d.ts +0 -26
- package/dist/src/generate/prompt-builder.js +0 -213
- package/dist/src/lib/agent-names.d.ts +0 -4
- package/dist/src/lib/agent-names.js +0 -5
- package/skills/generate-components.md +0 -427
- package/skills/generate-tokens.md +0 -194
- package/skills/select-components.md +0 -224
|
@@ -50,7 +50,7 @@ import { mergeAiDecisions } from './merge-ai-decisions.js';
|
|
|
50
50
|
import { FinalReviewHost } from './final-review-host.js';
|
|
51
51
|
import { runScopeGate } from './runScopeGate.js';
|
|
52
52
|
import { buildAutoFilterErrorTail } from './auto-filter-error.js';
|
|
53
|
-
import { checkAgentAuth } from '
|
|
53
|
+
import { checkAgentAuth } from '@contentful/experience-design-system-generation';
|
|
54
54
|
import { normalizePath } from '../path-utils.js';
|
|
55
55
|
import { DEFAULT_CONFIGURED_HOST, toConfiguredHost } from '../../host-utils.js';
|
|
56
56
|
import { writeExperiencesCredentials } from '../../credentials-store.js';
|
|
@@ -138,7 +138,7 @@ function logStep(entry) {
|
|
|
138
138
|
appendFileSync(WIZARD_LOG, line);
|
|
139
139
|
getDebugLogger().event('wizard', 'step', entry);
|
|
140
140
|
}
|
|
141
|
-
export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master', initialCmaToken = '', initialHost, initialAgent, initialModel, initialProjectPath, host, autoAcceptScope = false, autoRejectCycles = false, compositionMode = 'atomic', compositionMap, compositionAgent = false, compositionAgentMode, compositionRefresh = false, generateMap, promptOverrides, noCache = false, autoFilter = true, livePreview = true, noPush = false, noSave = false, outDirOverride, onConflictMode, selectPromptPath, generatePromptPath, seedExtractSessionId, seedGenerateSessionId, seedTokenSessionId, seedTokensPath, initialStep, initialRawTokensPath, initialRuns, onRunPicked,
|
|
141
|
+
export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master', initialCmaToken = '', initialHost, initialAgent, initialModel, initialProjectPath, host, autoAcceptScope = false, autoRejectCycles = false, compositionMode = 'atomic', compositionMap, compositionAgent = false, compositionAgentMode, compositionRefresh = false, generateMap, promptOverrides, noCache = false, autoFilter = true, livePreview = true, noPush = false, noSave = false, outDirOverride, onConflictMode, selectPromptPath, generatePromptPath, seedExtractSessionId, seedGenerateSessionId, seedTokenSessionId, seedTokensPath, initialStep, initialRawTokensPath, initialRuns, onRunPicked, } = {}) {
|
|
142
142
|
const defaultConfiguredHost = toConfiguredHost(host || process.env['EDS_HOST']) ?? DEFAULT_CONFIGURED_HOST;
|
|
143
143
|
const resolveWizardHost = (hostValue) => hostValue || defaultConfiguredHost;
|
|
144
144
|
const { stdout } = useStdout();
|
|
@@ -826,7 +826,7 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
826
826
|
tokens = await readTokensFromPath('tokens', tokensPath);
|
|
827
827
|
}
|
|
828
828
|
let manifest = buildManifest(components, tokens, { deleteAllComponents: allowEmptyDeleteAllRef.current });
|
|
829
|
-
let preview = await client.previewImport(manifest
|
|
829
|
+
let preview = await client.previewImport(manifest);
|
|
830
830
|
if (extractSessionId) {
|
|
831
831
|
let needsRepreview = false;
|
|
832
832
|
const db = openPipelineDb();
|
|
@@ -848,7 +848,7 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
848
848
|
if (needsRepreview) {
|
|
849
849
|
components = loadCDFComponents(db, extractSessionId);
|
|
850
850
|
manifest = buildManifest(components, tokens, { deleteAllComponents: allowEmptyDeleteAllRef.current });
|
|
851
|
-
preview = await client.previewImport(manifest
|
|
851
|
+
preview = await client.previewImport(manifest);
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
finally {
|
|
@@ -942,7 +942,7 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
944
|
};
|
|
945
|
-
const runPush = async (manifest, spaceId, environmentId, cmaToken, host, acknowledgeBreakingChanges,
|
|
945
|
+
const runPush = async (manifest, spaceId, environmentId, cmaToken, host, acknowledgeBreakingChanges, preview) => {
|
|
946
946
|
if (shouldRefusePush(state)) {
|
|
947
947
|
update(buildSkippedPushTransition());
|
|
948
948
|
return;
|
|
@@ -982,7 +982,7 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
982
982
|
environmentId,
|
|
983
983
|
host: resolvedHost,
|
|
984
984
|
});
|
|
985
|
-
let operation = await client.applyImport(manifest,
|
|
985
|
+
let operation = await client.applyImport(manifest, acknowledgeBreakingChanges);
|
|
986
986
|
try {
|
|
987
987
|
logStep({
|
|
988
988
|
applyResponse: {
|
|
@@ -1433,7 +1433,7 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
1433
1433
|
return (_jsx(RunningStep, { stepNumber: stepNum, totalSteps: totalSteps, title: "Generating definitions", description: `${formatAcceptanceSummary({ accepted: state.acceptedCount, autoRejected: state.autoRejectedCount })} ${state.agent} is mapping your TypeScript types to Contentful's CDF format.${hasTokens ? ' Using your design tokens for prop resolution.' : ''}`, detail: progressDetail }));
|
|
1434
1434
|
}
|
|
1435
1435
|
case 'final-review': {
|
|
1436
|
-
return (_jsx(FinalReviewHost, { extractSessionId: state.extractSessionId, generatedCount: state.generatedCount, autoAccept: autoAcceptScope, compositionMode: compositionMode, livePreview: livePreview, spaceId: state.spaceId, environmentId: state.environmentId, cmaToken: state.cmaToken, host: state.host, tokensPath: state.tokensPath, initialFinalizeError: state.finalizeErrorBanner,
|
|
1436
|
+
return (_jsx(FinalReviewHost, { extractSessionId: state.extractSessionId, generatedCount: state.generatedCount, autoAccept: autoAcceptScope, compositionMode: compositionMode, livePreview: livePreview, spaceId: state.spaceId, environmentId: state.environmentId, cmaToken: state.cmaToken, host: state.host, tokensPath: state.tokensPath, initialFinalizeError: state.finalizeErrorBanner, onFinalize: (accepted, rejected, unresolved) => {
|
|
1437
1437
|
process.stderr.write(`Accepted: ${accepted} Rejected: ${rejected} Unresolved: ${unresolved}\n`);
|
|
1438
1438
|
let acceptedCount = accepted;
|
|
1439
1439
|
const detectAcceptedCycles = () => {
|
|
@@ -1601,8 +1601,8 @@ export function WizardApp({ initialSpaceId = '', initialEnvironmentId = 'master'
|
|
|
1601
1601
|
// present-but-empty (only $schema), so editing would dead-end on the
|
|
1602
1602
|
// "No generated definitions found" screen.
|
|
1603
1603
|
const editableComponentCount = Object.keys(state.manifest?.componentsManifest ?? {}).filter((k) => k !== '$schema').length;
|
|
1604
|
-
return (_jsx(WizardPreviewStep, { preview: state.serverPreview, spaceId: state.spaceId, environmentId: state.environmentId, stepNumber: totalSteps, totalSteps: totalSteps,
|
|
1605
|
-
void runPush(state.manifest, state.spaceId, state.environmentId, state.cmaToken, state.host, acknowledge,
|
|
1604
|
+
return (_jsx(WizardPreviewStep, { preview: state.serverPreview, spaceId: state.spaceId, environmentId: state.environmentId, stepNumber: totalSteps, totalSteps: totalSteps, onConfirm: (acknowledge) => {
|
|
1605
|
+
void runPush(state.manifest, state.spaceId, state.environmentId, state.cmaToken, state.host, acknowledge, state.serverPreview);
|
|
1606
1606
|
}, ...(editableComponentCount > 0 ? { onEdit: () => void runEditFromPreview() } : {}), onSaveFiles: () => {
|
|
1607
1607
|
void startSaveFlow();
|
|
1608
1608
|
}, onQuit: () => process.exit(0) }));
|
|
@@ -14,6 +14,5 @@ export type FinalReviewHostProps = {
|
|
|
14
14
|
host?: string;
|
|
15
15
|
tokensPath?: string;
|
|
16
16
|
initialFinalizeError?: string | null;
|
|
17
|
-
allowDeletions?: boolean;
|
|
18
17
|
};
|
|
19
|
-
export declare function FinalReviewHost({ extractSessionId, generatedCount, autoAccept, compositionMode, onFinalize, onQuit, livePreview, spaceId, environmentId, cmaToken, host, tokensPath, initialFinalizeError,
|
|
18
|
+
export declare function FinalReviewHost({ extractSessionId, generatedCount, autoAccept, compositionMode, onFinalize, onQuit, livePreview, spaceId, environmentId, cmaToken, host, tokensPath, initialFinalizeError, }: FinalReviewHostProps): React.ReactElement;
|
|
@@ -4,7 +4,7 @@ import { PALETTE } from '../../analyze/select/tui/theme.js';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { GenerateReviewStep } from './steps/GenerateReviewStep.js';
|
|
6
6
|
import { AtomicGenerateReviewStep } from './steps/AtomicGenerateReviewStep.js';
|
|
7
|
-
export function FinalReviewHost({ extractSessionId, generatedCount, autoAccept, compositionMode = 'atomic', onFinalize, onQuit, livePreview, spaceId, environmentId, cmaToken, host, tokensPath, initialFinalizeError,
|
|
7
|
+
export function FinalReviewHost({ extractSessionId, generatedCount, autoAccept, compositionMode = 'atomic', onFinalize, onQuit, livePreview, spaceId, environmentId, cmaToken, host, tokensPath, initialFinalizeError, }) {
|
|
8
8
|
if (!extractSessionId) {
|
|
9
9
|
return (_jsx(Box, { paddingX: 2, paddingY: 1, children: _jsx(Text, { color: PALETTE.error, children: "Error: no session ID \u2014 cannot load generated definitions." }) }));
|
|
10
10
|
}
|
|
@@ -15,7 +15,7 @@ export function FinalReviewHost({ extractSessionId, generatedCount, autoAccept,
|
|
|
15
15
|
// passes projectSlotGraph to FieldEditor and never walks closures/cycles, so
|
|
16
16
|
// slot-composition editing and every hierarchy affordance stay absent.
|
|
17
17
|
const StepComponent = compositionMode === 'atomic' ? AtomicGenerateReviewStep : GenerateReviewStep;
|
|
18
|
-
return (_jsx(StepComponent, { extractSessionId: extractSessionId, onFinalize: onFinalize, onQuit: onQuit, livePreview: livePreview, spaceId: spaceId, environmentId: environmentId, cmaToken: cmaToken, host: host, tokensPath: tokensPath, initialFinalizeError: initialFinalizeError
|
|
18
|
+
return (_jsx(StepComponent, { extractSessionId: extractSessionId, onFinalize: onFinalize, onQuit: onQuit, livePreview: livePreview, spaceId: spaceId, environmentId: environmentId, cmaToken: cmaToken, host: host, tokensPath: tokensPath, initialFinalizeError: initialFinalizeError }));
|
|
19
19
|
}
|
|
20
20
|
function FinalReviewAutoAccept({ generatedCount, onFinalize, }) {
|
|
21
21
|
React.useEffect(() => {
|
|
@@ -26,9 +26,6 @@ export type RunLivePreviewOptions = {
|
|
|
26
26
|
* full delete. Lets the Finalize dialog show exactly what the accepted push
|
|
27
27
|
* would delete, independent of the session's on-disk generated rows. */
|
|
28
28
|
acceptedKeys?: ReadonlySet<string>;
|
|
29
|
-
/** Forwarded verbatim to `previewImport`. Governs whether the response
|
|
30
|
-
* includes removed entities or a suppressed-count summary instead. */
|
|
31
|
-
allowDeletions?: boolean;
|
|
32
29
|
};
|
|
33
30
|
/**
|
|
34
31
|
* Pure async helper used by `useLivePreview` to re-fire `previewImport` after a
|
|
@@ -60,10 +60,7 @@ export async function runLivePreview(opts) {
|
|
|
60
60
|
timeoutHandle = setTimeout(() => reject(new TimeoutError()), timeoutMs);
|
|
61
61
|
});
|
|
62
62
|
try {
|
|
63
|
-
const response = (await Promise.race([
|
|
64
|
-
client.previewImport(manifest, opts.allowDeletions === true),
|
|
65
|
-
timeoutPromise,
|
|
66
|
-
]));
|
|
63
|
+
const response = (await Promise.race([client.previewImport(manifest), timeoutPromise]));
|
|
67
64
|
if (process.env['EDS_VERBOSE']) {
|
|
68
65
|
const durationMs = Date.now() - startedAt;
|
|
69
66
|
try {
|
|
@@ -11,7 +11,6 @@ type GenerateReviewStepProps = {
|
|
|
11
11
|
host?: string;
|
|
12
12
|
tokensPath?: string;
|
|
13
13
|
initialFinalizeError?: string | null;
|
|
14
|
-
allowDeletions?: boolean;
|
|
15
14
|
};
|
|
16
15
|
export declare function sortComponentsForSidebar<T extends {
|
|
17
16
|
key: string;
|
|
@@ -34,4 +33,4 @@ export interface BreakingRow {
|
|
|
34
33
|
}
|
|
35
34
|
export declare function buildBreakingRows(breakingChanges: BreakingComponent[]): BreakingRow[];
|
|
36
35
|
export declare function deriveBreakingChanges(response: ServerPreviewResponse): BreakingComponent[];
|
|
37
|
-
export declare function GenerateReviewStep({ extractSessionId, onFinalize, onQuit, livePreview, spaceId, environmentId, cmaToken, host, tokensPath, initialFinalizeError,
|
|
36
|
+
export declare function GenerateReviewStep({ extractSessionId, onFinalize, onQuit, livePreview, spaceId, environmentId, cmaToken, host, tokensPath, initialFinalizeError, }: GenerateReviewStepProps): React.ReactElement;
|
|
@@ -174,7 +174,7 @@ export function deriveBreakingChanges(response) {
|
|
|
174
174
|
}
|
|
175
175
|
return out;
|
|
176
176
|
}
|
|
177
|
-
export function GenerateReviewStep({ extractSessionId, onFinalize, onQuit, livePreview = true, spaceId = '', environmentId = '', cmaToken = '', host = '', tokensPath = '', initialFinalizeError = null,
|
|
177
|
+
export function GenerateReviewStep({ extractSessionId, onFinalize, onQuit, livePreview = true, spaceId = '', environmentId = '', cmaToken = '', host = '', tokensPath = '', initialFinalizeError = null, }) {
|
|
178
178
|
const { stdout } = useStdout();
|
|
179
179
|
const terminalWidth = stdout?.columns ?? 80;
|
|
180
180
|
const [components, setComponents] = useState([]);
|
|
@@ -271,8 +271,9 @@ export function GenerateReviewStep({ extractSessionId, onFinalize, onQuit, liveP
|
|
|
271
271
|
cmaToken,
|
|
272
272
|
host,
|
|
273
273
|
onResult: handleLivePreviewResult,
|
|
274
|
+
// With nothing accepted, preview the delete-all diff so the review UI shows
|
|
275
|
+
// which existing components a push would remove (instead of an empty preview).
|
|
274
276
|
deleteAllComponents: acceptedCountForPreview === 0,
|
|
275
|
-
allowDeletions,
|
|
276
277
|
});
|
|
277
278
|
const SPINNER_FRAMES = '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏';
|
|
278
279
|
const [spinnerTick, setSpinnerTick] = useState(0);
|
|
@@ -351,7 +352,6 @@ export function GenerateReviewStep({ extractSessionId, onFinalize, onQuit, liveP
|
|
|
351
352
|
cmaToken,
|
|
352
353
|
host,
|
|
353
354
|
acceptedKeys: new Set(components.filter((c) => c.status === 'accepted').map((c) => c.key)),
|
|
354
|
-
allowDeletions,
|
|
355
355
|
});
|
|
356
356
|
const handleFinalizeConfirm = () => {
|
|
357
357
|
const acceptedCount = components.filter((c) => c.status === 'accepted').length;
|
|
@@ -12,14 +12,10 @@ type WizardPreviewStepProps = {
|
|
|
12
12
|
environmentId: string;
|
|
13
13
|
stepNumber: number;
|
|
14
14
|
totalSteps: number;
|
|
15
|
-
|
|
16
|
-
* `false`, the server never returned removed entities, so there is
|
|
17
|
-
* nothing to render item-by-item or toggle over. */
|
|
18
|
-
allowDeletions?: boolean;
|
|
19
|
-
onConfirm: (acknowledge: boolean, allowDeletions: boolean) => void;
|
|
15
|
+
onConfirm: (acknowledge: boolean) => void;
|
|
20
16
|
onEdit?: () => void;
|
|
21
17
|
onSaveFiles?: () => void;
|
|
22
18
|
onQuit: () => void;
|
|
23
19
|
};
|
|
24
|
-
export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps,
|
|
20
|
+
export declare function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, onConfirm, onEdit, onSaveFiles, onQuit, }: WizardPreviewStepProps): React.ReactElement;
|
|
25
21
|
export {};
|
|
@@ -89,14 +89,10 @@ export function buildPreviewDiffLines(preview) {
|
|
|
89
89
|
}
|
|
90
90
|
return lines;
|
|
91
91
|
}
|
|
92
|
-
export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps,
|
|
92
|
+
export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber, totalSteps, onConfirm, onEdit, onSaveFiles, onQuit, }) {
|
|
93
93
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
94
94
|
const [diffExpanded, setDiffExpanded] = useState(false);
|
|
95
95
|
const [scrollOffset, setScrollOffset] = useState(0);
|
|
96
|
-
// Local state exists only to let the user opt OUT of a deletion the fetch
|
|
97
|
-
// already surfaced — it can never turn true when the fetch used false,
|
|
98
|
-
// because there's nothing in `preview` to reveal in that case.
|
|
99
|
-
const [allowDeletions, setAllowDeletions] = useState(fetchedAllowDeletions);
|
|
100
96
|
const { stdout } = useStdout();
|
|
101
97
|
const terminalRows = stdout?.rows ?? 40;
|
|
102
98
|
const viewportHeight = Math.max(terminalRows - 14, 10);
|
|
@@ -109,14 +105,9 @@ export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber,
|
|
|
109
105
|
}));
|
|
110
106
|
}, [diffExpanded, preview]);
|
|
111
107
|
const maxScroll = Math.max(0, allDiffLines.length - viewportHeight);
|
|
112
|
-
const removedCount = preview.components.removed.length + preview.tokens.removed.length;
|
|
113
108
|
useImmediateInput((input, key) => {
|
|
114
109
|
if (key.return) {
|
|
115
|
-
onConfirm(breakingWithImpact
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if ((input === 'x' || input === 'X') && fetchedAllowDeletions && removedCount > 0) {
|
|
119
|
-
setAllowDeletions((prev) => !prev);
|
|
110
|
+
onConfirm(breakingWithImpact);
|
|
120
111
|
return;
|
|
121
112
|
}
|
|
122
113
|
if (input === 'd' || input === 'D') {
|
|
@@ -165,5 +156,5 @@ export function WizardPreviewStep({ preview, spaceId, environmentId, stepNumber,
|
|
|
165
156
|
})] })), components.changed.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.warning, children: " \uFF5E" }), _jsxs(Text, { children: [components.changed.length, " will be updated"] })] }), components.changed.map((item, i) => {
|
|
166
157
|
const isBreaking = item.changeClassification?.classification === 'breaking';
|
|
167
158
|
return (_jsxs(Text, { color: isBreaking ? PALETTE.error : PALETTE.warning, children: [' ', isBreaking ? '⚠' : '~', " ", item.current.name] }, `chg-${i}`));
|
|
168
|
-
})] })), components.removed.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color:
|
|
159
|
+
})] })), components.removed.length > 0 && (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.error, children: " \u2717" }), _jsxs(Text, { children: [components.removed.length, " will be removed"] })] }), components.removed.map((item, i) => (_jsxs(Text, { color: PALETTE.error, children: [' ', "\u2717 ", item.name] }, `rm-${i}`)))] })), components.unchanged.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { dimColor: true, children: " \u00B7" }), _jsxs(Text, { dimColor: true, children: [components.unchanged.length, " unchanged"] })] }))] })), hasTokens && (_jsxs(Box, { flexDirection: "column", gap: 0, children: [_jsx(Box, { gap: 1, marginTop: 1, children: _jsx(Text, { bold: true, dimColor: true, children: "Design Tokens" }) }), tokens.new.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.success, children: " \uFF0B" }), _jsxs(Text, { children: [tokens.new.length, " will be created"] })] })), tokens.changed.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.warning, children: " \uFF5E" }), _jsxs(Text, { children: [tokens.changed.length, " will be updated"] })] })), tokens.removed.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: PALETTE.error, children: " \u2717" }), _jsxs(Text, { children: [tokens.removed.length, " will be removed"] })] })), tokens.unchanged.length > 0 && (_jsxs(Box, { gap: 1, children: [_jsx(Text, { dimColor: true, children: " \u00B7" }), _jsxs(Text, { dimColor: true, children: [tokens.unchanged.length, " unchanged"] })] }))] })), diffExpanded && allDiffLines.length > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { dimColor: true, children: '─'.repeat(40) }), _jsxs(Text, { dimColor: true, children: [' ', "Diff (", allDiffLines.length, " lines) \u2014 line ", scrollOffset + 1, "\u2013", Math.min(scrollOffset + viewportHeight, allDiffLines.length), " of ", allDiffLines.length] }), _jsx(Box, { flexDirection: "column", children: allDiffLines.slice(scrollOffset, scrollOffset + viewportHeight).map((line) => (_jsx(Box, { children: line.element }, line.key))) }), maxScroll > 0 && _jsx(Text, { dimColor: true, children: " \u2195 j/k to scroll, f/b to page" })] }))] })) : (_jsx(Text, { dimColor: true, children: "Nothing to push \u2014 everything is already up to date." })), _jsxs(Box, { gap: 1, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "Space:" }), _jsx(Text, { children: spaceId }), _jsx(Text, { dimColor: true, children: "/" }), _jsx(Text, { dimColor: true, children: "Environment:" }), _jsx(Text, { children: environmentId })] }), breakingWithImpact && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: PALETTE.error, bold: true, children: "\u26A0 Breaking changes will affect downstream entities. Press Enter to acknowledge and apply." }) })), _jsxs(Box, { gap: 3, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "[Enter] Push to Contentful" }), _jsxs(Text, { dimColor: true, children: ["[d] ", diffExpanded ? 'Hide' : 'Show', " diff"] }), diffExpanded && _jsx(Text, { dimColor: true, children: "[j/k] Scroll [f/b] Page" }), onEdit && _jsx(Text, { dimColor: true, children: "[e] Edit definitions" }), onSaveFiles && _jsx(Text, { dimColor: true, children: "[s] Save files instead" }), _jsx(Text, { dimColor: true, children: "[q] Cancel" })] })] }));
|
|
169
160
|
}
|
|
@@ -11,8 +11,6 @@ export type UseFinalizePreviewOptions = {
|
|
|
11
11
|
host: string;
|
|
12
12
|
/** Component keys the operator has accepted; drives the scoped preview. */
|
|
13
13
|
acceptedKeys: ReadonlySet<string>;
|
|
14
|
-
/** Forwarded verbatim to `runLivePreview`/`previewImport`. */
|
|
15
|
-
allowDeletions?: boolean;
|
|
16
14
|
};
|
|
17
15
|
export type UseFinalizePreviewReturn = {
|
|
18
16
|
status: FinalizePreviewStatus;
|
|
Binary file
|
|
@@ -12,8 +12,6 @@ export type UseLivePreviewOptions = {
|
|
|
12
12
|
/** Preview an empty-but-present manifest (delete-all diff) when nothing is
|
|
13
13
|
* accepted, so the final-review UI can show what a push would delete. */
|
|
14
14
|
deleteAllComponents?: boolean;
|
|
15
|
-
/** Forwarded verbatim to `runLivePreview`/`previewImport`. */
|
|
16
|
-
allowDeletions?: boolean;
|
|
17
15
|
};
|
|
18
16
|
export type LivePreviewStatus = 'idle' | 'running';
|
|
19
17
|
export type UseLivePreviewReturn = {
|
|
@@ -82,7 +82,6 @@ export function useLivePreview(opts) {
|
|
|
82
82
|
host: current.host,
|
|
83
83
|
generation,
|
|
84
84
|
deleteAllComponents: current.deleteAllComponents === true,
|
|
85
|
-
allowDeletions: current.allowDeletions === true,
|
|
86
85
|
});
|
|
87
86
|
// Discard stale responses (generation tag).
|
|
88
87
|
if (result.generation !== latestRef.current)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AGENT_NAMES } from '
|
|
1
|
+
import { AGENT_NAMES } from '@contentful/experience-design-system-generation';
|
|
2
2
|
export const AGENT_DESCRIPTION = `Agent to use: ${AGENT_NAMES.join(', ')} (defaults to value saved by experiences setup)`;
|
|
3
3
|
export const MODEL_DESCRIPTION = 'Model to use (defaults to a lightweight per-agent model; override with EDS_AGENT_MODEL_<AGENT>)';
|
|
4
4
|
/**
|
|
@@ -3,4 +3,3 @@ export declare function addArtifactInputOptions(cmd: Command): Command;
|
|
|
3
3
|
export declare function addContentfulTargetOptions(cmd: Command): Command;
|
|
4
4
|
export declare function addCompositionOptions(cmd: Command): Command;
|
|
5
5
|
export declare function addSelectionOptions(cmd: Command): Command;
|
|
6
|
-
export declare function addAllowDeletionsOption(cmd: Command): Command;
|
|
@@ -25,6 +25,3 @@ export function addSelectionOptions(cmd) {
|
|
|
25
25
|
.option('--select <pattern>', 'Select entities by ID pattern (repeatable)', collectOptionValue, [])
|
|
26
26
|
.option('--deselect <pattern>', 'Deselect entities by ID pattern (repeatable)', collectOptionValue, []);
|
|
27
27
|
}
|
|
28
|
-
export function addAllowDeletionsOption(cmd) {
|
|
29
|
-
return cmd.option('--allow-deletions', 'Allow the push to delete remote ComponentTypes/DesignTokens missing from the manifest (default: skip them)');
|
|
30
|
-
}
|
|
@@ -26,7 +26,5 @@ export type ModifyLauncherInput = {
|
|
|
26
26
|
initialHost?: string;
|
|
27
27
|
/** Pre-fill CMA token (from credentials.json / env). */
|
|
28
28
|
initialCmaToken?: string;
|
|
29
|
-
/** From `--allow-deletions` flag. Forwarded to wizard's push step. */
|
|
30
|
-
allowDeletions?: boolean;
|
|
31
29
|
};
|
|
32
30
|
export declare function launchModifyWizard(input: ModifyLauncherInput): Promise<void>;
|
|
@@ -35,8 +35,6 @@ export async function launchModifyWizard(input) {
|
|
|
35
35
|
props.initialHost = input.initialHost;
|
|
36
36
|
if (input.initialCmaToken)
|
|
37
37
|
props.initialCmaToken = input.initialCmaToken;
|
|
38
|
-
if (input.allowDeletions !== undefined)
|
|
39
|
-
props.allowDeletions = input.allowDeletions;
|
|
40
38
|
const { waitUntilExit } = render(createElement(WizardApp, props));
|
|
41
39
|
await waitUntilExit();
|
|
42
40
|
}
|
|
@@ -16,8 +16,6 @@ export type ReplayRunOptions = {
|
|
|
16
16
|
interactive?: boolean;
|
|
17
17
|
/** When true, bypass the source/saved-file staleness check. */
|
|
18
18
|
force?: boolean;
|
|
19
|
-
/** From `--allow-deletions` flag. Forwarded verbatim to the pushed session's apply request. */
|
|
20
|
-
allowDeletions?: boolean;
|
|
21
19
|
/**
|
|
22
20
|
* Test seam: replace the interactive prompt with a deterministic resolver.
|
|
23
21
|
* The CLI surface never sets this; only used by tests.
|
|
@@ -59,8 +57,6 @@ export type ModifyRunOptions = {
|
|
|
59
57
|
outDir?: string;
|
|
60
58
|
/** When true, bypass the source/saved-file staleness check. */
|
|
61
59
|
force?: boolean;
|
|
62
|
-
/** From `--allow-deletions` flag. Forwarded through the modify wizard's push step. */
|
|
63
|
-
allowDeletions?: boolean;
|
|
64
60
|
};
|
|
65
61
|
/**
|
|
66
62
|
* Re-open the wizard with a prior run's extract/generate session pre-populated
|
|
@@ -83,7 +83,6 @@ export async function replayRun(opts) {
|
|
|
83
83
|
environmentId,
|
|
84
84
|
cmaToken,
|
|
85
85
|
...(host ? { host } : {}),
|
|
86
|
-
...(opts.allowDeletions ? { allowDeletions: true } : {}),
|
|
87
86
|
});
|
|
88
87
|
if (!result.ok) {
|
|
89
88
|
throw new Error(result.error);
|
|
@@ -99,7 +98,6 @@ export async function replayRun(opts) {
|
|
|
99
98
|
environmentId,
|
|
100
99
|
cmaToken,
|
|
101
100
|
...(host ? { host } : {}),
|
|
102
|
-
...(opts.allowDeletions ? { allowDeletions: true } : {}),
|
|
103
101
|
});
|
|
104
102
|
if (!tokenResult.ok) {
|
|
105
103
|
throw new Error(tokenResult.error);
|
|
@@ -159,6 +157,5 @@ export async function modifyRun(opts) {
|
|
|
159
157
|
...(mergedEnvironmentId ? { initialEnvironmentId: mergedEnvironmentId } : {}),
|
|
160
158
|
...(mergedHost ? { initialHost: mergedHost } : {}),
|
|
161
159
|
...(mergedCmaToken ? { initialCmaToken: mergedCmaToken } : {}),
|
|
162
|
-
...(opts.allowDeletions !== undefined ? { allowDeletions: opts.allowDeletions } : {}),
|
|
163
160
|
});
|
|
164
161
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Skill } from '
|
|
1
|
+
import { type Skill } from '@contentful/experience-design-system-generation';
|
|
2
2
|
/** sha256 hex of a string. Stable across runs. */
|
|
3
3
|
export declare function hashContent(content: string): string;
|
|
4
4
|
/** sha256 hex of a file's UTF-8 content. */
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { createHash } from 'node:crypto';
|
|
11
11
|
import { readFile } from 'node:fs/promises';
|
|
12
12
|
import { resolve } from 'node:path';
|
|
13
|
-
import { resolveSkillPath } from '
|
|
13
|
+
import { resolveSkillPath } from '@contentful/experience-design-system-generation';
|
|
14
14
|
/** sha256 hex of a string. Stable across runs. */
|
|
15
15
|
export function hashContent(content) {
|
|
16
16
|
return createHash('sha256').update(content).digest('hex');
|
package/dist/src/session/db.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DatabaseSync } from 'node:sqlite';
|
|
2
2
|
import type { RawComponentDefinition } from '../types.js';
|
|
3
3
|
import type { CDFComponentEntry, DTCGTokenEntry, DTCGTokenGroup } from '@contentful/experience-design-system-types';
|
|
4
|
-
import type { ToolCall, TokenToolCall } from '
|
|
4
|
+
import type { ToolCall, TokenToolCall } from '@contentful/experience-design-system-generation';
|
|
5
5
|
import type { ComponentTypeSummary } from '@contentful/experience-design-system-types';
|
|
6
6
|
import type { SlotCycle, SlotEdge } from '../analyze/cycle-detection.js';
|
|
7
7
|
export type StepStatus = 'pending' | 'complete' | 'failed' | 'interrupted';
|
package/dist/src/session/db.js
CHANGED
|
@@ -1433,7 +1433,7 @@ export async function getCliCacheVersion() {
|
|
|
1433
1433
|
return _cliCacheVersionCache;
|
|
1434
1434
|
try {
|
|
1435
1435
|
const { hashContent } = await import('./cache-keys.js');
|
|
1436
|
-
const { resolveSkillPath } = await import('
|
|
1436
|
+
const { resolveSkillPath } = await import('@contentful/experience-design-system-generation');
|
|
1437
1437
|
const skills = ['components', 'tokens', 'select'];
|
|
1438
1438
|
const parts = [];
|
|
1439
1439
|
for (const s of skills) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.18.1-dev-build-
|
|
3
|
+
"version": "2.18.1-dev-build-eb63588.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"bin/",
|
|
27
27
|
"dist/",
|
|
28
|
-
"skills/",
|
|
29
28
|
"prompts/"
|
|
30
29
|
],
|
|
31
30
|
"dependencies": {
|
|
@@ -34,9 +33,10 @@
|
|
|
34
33
|
"react": "^18.3.1",
|
|
35
34
|
"react-devtools-core": "^4.19.1",
|
|
36
35
|
"react-dom": "^18.3.1",
|
|
37
|
-
"@contentful/experience-design-system-client": "2.18.1-dev-build-
|
|
38
|
-
"@contentful/experience-design-system-
|
|
39
|
-
"@contentful/experience-design-system-
|
|
36
|
+
"@contentful/experience-design-system-client": "2.18.1-dev-build-eb63588.0",
|
|
37
|
+
"@contentful/experience-design-system-extraction": "2.18.1-dev-build-eb63588.0",
|
|
38
|
+
"@contentful/experience-design-system-generation": "2.18.1-dev-build-eb63588.0",
|
|
39
|
+
"@contentful/experience-design-system-types": "2.18.1-dev-build-eb63588.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@tsconfig/node24": "^24.0.3",
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import type { AgentName } from '../lib/agent-names.js';
|
|
2
|
-
export { AGENT_NAMES, isAgentName, type AgentName } from '../lib/agent-names.js';
|
|
3
|
-
export interface AgentRunResult {
|
|
4
|
-
exitCode: number;
|
|
5
|
-
stdout: string;
|
|
6
|
-
stderr: string;
|
|
7
|
-
timedOut: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface ClassifyPropCall {
|
|
10
|
-
tool: 'classify_prop';
|
|
11
|
-
prop: string;
|
|
12
|
-
cdf_type: string;
|
|
13
|
-
cdf_category: 'content' | 'design' | 'state';
|
|
14
|
-
values?: string[];
|
|
15
|
-
token_kind?: string;
|
|
16
|
-
required?: boolean;
|
|
17
|
-
description?: string;
|
|
18
|
-
default?: string | boolean;
|
|
19
|
-
/** Internal LLM rationale; not customer-facing. Persisted to raw_props.rationale. */
|
|
20
|
-
reason?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface ExcludePropCall {
|
|
23
|
-
tool: 'exclude_prop';
|
|
24
|
-
prop: string;
|
|
25
|
-
reason: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ClassifyComponentCall {
|
|
28
|
-
tool: 'classify_component';
|
|
29
|
-
description?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Component-level rationale strings. Surfaced by the `I` ComponentRationalePanel.
|
|
32
|
-
* Each field is optional; missing fields leave existing DB values untouched
|
|
33
|
-
* (sparse update semantics in applyToolCalls).
|
|
34
|
-
*/
|
|
35
|
-
rationale?: {
|
|
36
|
-
description?: string;
|
|
37
|
-
props?: string;
|
|
38
|
-
slots?: string;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export interface ClassifySlotCall {
|
|
42
|
-
tool: 'classify_slot';
|
|
43
|
-
slot: string;
|
|
44
|
-
required?: boolean;
|
|
45
|
-
allowed_components?: string[];
|
|
46
|
-
description?: string;
|
|
47
|
-
/** Per-slot rationale; persisted to raw_slots.rationale. */
|
|
48
|
-
rationale?: string;
|
|
49
|
-
}
|
|
50
|
-
export type ToolCall = ClassifyPropCall | ExcludePropCall | ClassifyComponentCall | ClassifySlotCall;
|
|
51
|
-
export interface SelectComponentCall {
|
|
52
|
-
tool: 'select_component';
|
|
53
|
-
name: string;
|
|
54
|
-
reason?: string;
|
|
55
|
-
confidence?: number;
|
|
56
|
-
}
|
|
57
|
-
export interface RejectComponentCall {
|
|
58
|
-
tool: 'reject_component';
|
|
59
|
-
name: string;
|
|
60
|
-
reason?: string;
|
|
61
|
-
confidence?: number;
|
|
62
|
-
}
|
|
63
|
-
export type SelectToolCall = SelectComponentCall | RejectComponentCall;
|
|
64
|
-
export interface ParsedSelectToolCalls {
|
|
65
|
-
calls: SelectToolCall[];
|
|
66
|
-
warnings: string[];
|
|
67
|
-
}
|
|
68
|
-
export declare function parseSelectToolCallLines(stdout: string): ParsedSelectToolCalls;
|
|
69
|
-
export interface SetTokenCall {
|
|
70
|
-
tool: 'set_token';
|
|
71
|
-
path: string;
|
|
72
|
-
type: string;
|
|
73
|
-
value: unknown;
|
|
74
|
-
description?: string;
|
|
75
|
-
}
|
|
76
|
-
export interface SetGroupCall {
|
|
77
|
-
tool: 'set_group';
|
|
78
|
-
path: string;
|
|
79
|
-
description?: string;
|
|
80
|
-
}
|
|
81
|
-
export type TokenToolCall = SetTokenCall | SetGroupCall;
|
|
82
|
-
export interface ParsedTokenToolCalls {
|
|
83
|
-
calls: TokenToolCall[];
|
|
84
|
-
warnings: string[];
|
|
85
|
-
}
|
|
86
|
-
export interface ParsedToolCalls {
|
|
87
|
-
calls: ToolCall[];
|
|
88
|
-
warnings: string[];
|
|
89
|
-
}
|
|
90
|
-
export declare function parseToolCallLines(stdout: string): ParsedToolCalls;
|
|
91
|
-
export declare function parseTokenToolCallLines(stdout: string): ParsedTokenToolCalls;
|
|
92
|
-
export declare function resolveBinary(agent: AgentName): string;
|
|
93
|
-
/**
|
|
94
|
-
* Resolve the model for an agent. Explicit flag/creds value wins, then a
|
|
95
|
-
* per-agent `EDS_AGENT_MODEL_<AGENT>` env override (mirrors the
|
|
96
|
-
* `EDS_AGENT_BINARY_<AGENT>` pattern), otherwise the lightweight default for
|
|
97
|
-
* that agent.
|
|
98
|
-
*/
|
|
99
|
-
export declare function resolveAgentModel(agent: AgentName, explicit?: string): string;
|
|
100
|
-
export declare function buildArgs(agent: AgentName, prompt: string, model?: string, promptViaStdin?: boolean): string[];
|
|
101
|
-
export declare function runAgent(options: {
|
|
102
|
-
agent: AgentName;
|
|
103
|
-
prompt: string;
|
|
104
|
-
interactive: boolean;
|
|
105
|
-
timeoutMs: number;
|
|
106
|
-
model?: string;
|
|
107
|
-
onOutput?: (chunk: string) => void;
|
|
108
|
-
/**
|
|
109
|
-
* Deliver the prompt on stdin instead of as an argv positional. Required for
|
|
110
|
-
* large prompts (e.g. the composition resolver inlining candidate files),
|
|
111
|
-
* which overflow ARG_MAX when passed as an argument. Non-interactive only.
|
|
112
|
-
*/
|
|
113
|
-
promptViaStdin?: boolean;
|
|
114
|
-
}): Promise<AgentRunResult>;
|
|
115
|
-
export type AgentAuthStatus = 'ok' | 'unauthenticated' | 'not-found';
|
|
116
|
-
export declare function checkAgentAuth(agent: AgentName): Promise<AgentAuthStatus>;
|
|
117
|
-
/**
|
|
118
|
-
* Build a diagnostic string from a failed agent run, surfacing the agent's own
|
|
119
|
-
* stderr (or stdout, when stderr is empty) so callers never emit a context-free
|
|
120
|
-
* "agent failed". Callers only invoke this on a failed run: either a non-zero
|
|
121
|
-
* exit, or a zero exit that produced no tool calls. A non-zero exit is reported
|
|
122
|
-
* as such; a zero exit is therefore the "produced no tool calls" case.
|
|
123
|
-
*/
|
|
124
|
-
export declare function describeAgentFailure(result: AgentRunResult, maxDetail?: number): string;
|
|
125
|
-
export declare function extractSentinelOutput(stdout: string): string | null | 'multiple';
|