@contentful/experience-design-system-cli 2.42.1-dev-build-774b3e20.0 → 2.42.1-dev-build-f69db6bf.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 +29 -90
- package/dist/index.js +29 -95
- package/dist/package.json +1 -1
- package/dist/src/tui/import/shared/running-step/logic.d.ts +0 -16
- package/dist/src/tui/import/steps/06-extraction/logic.d.ts +5 -6
- package/dist/src/tui/import/steps/06-extraction/screen.d.ts +1 -3
- package/dist/src/tui/import/steps/06-extraction/use-extraction.d.ts +0 -1
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +8 -3
- package/dist/src/tui/import/steps/08-generation/screen.d.ts +1 -3
- package/dist/src/tui/import/steps/08-generation/types.d.ts +1 -5
- package/dist/src/tui/import/steps/08-generation/use-generation.d.ts +0 -1
- package/dist/src/tui/import/steps/10-flow/support/push-progress.d.ts +0 -1
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -3054,19 +3054,6 @@ import { Box as Box8, Text as Text8 } from "ink";
|
|
|
3054
3054
|
import { ProgressBar, Spinner, ThemeProvider } from "@inkjs/ui";
|
|
3055
3055
|
|
|
3056
3056
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/logic.ts
|
|
3057
|
-
function lineState(line) {
|
|
3058
|
-
if (line.state) return line.state;
|
|
3059
|
-
return line.complete ? "done" : "running";
|
|
3060
|
-
}
|
|
3061
|
-
function formatDuration(ms) {
|
|
3062
|
-
return ms < 1e3 ? "<1s" : formatElapsed(Math.round(ms / 1e3));
|
|
3063
|
-
}
|
|
3064
|
-
function trackFinished(previous, rows, elapsedMs) {
|
|
3065
|
-
return rows.map((row, index) => previous[index] ?? (lineState(row) === "running" ? void 0 : elapsedMs));
|
|
3066
|
-
}
|
|
3067
|
-
function withTimes(rows, rowMs) {
|
|
3068
|
-
return rows.map((row, index) => rowMs[index] === void 0 ? row : { ...row, ms: rowMs[index] });
|
|
3069
|
-
}
|
|
3070
3057
|
function progressPercent(progress) {
|
|
3071
3058
|
if (progress.total <= 0) return 0;
|
|
3072
3059
|
return Math.min(100, Math.max(0, Math.round(progress.done / progress.total * 100)));
|
|
@@ -3102,9 +3089,6 @@ function useElapsed() {
|
|
|
3102
3089
|
|
|
3103
3090
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx
|
|
3104
3091
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3105
|
-
var STATE_ICON = { done: "\u2713", warning: "!", failed: "\u2717" };
|
|
3106
|
-
var STATE_COLOR = { done: PALETTE.success, warning: PALETTE.warning, failed: PALETTE.error };
|
|
3107
|
-
var textColor = (state2) => state2 === "warning" || state2 === "failed" ? STATE_COLOR[state2] : PALETTE.muted;
|
|
3108
3092
|
function Line({ line }) {
|
|
3109
3093
|
if (line.progress) {
|
|
3110
3094
|
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", gap: 1, children: [
|
|
@@ -3116,14 +3100,12 @@ function Line({ line }) {
|
|
|
3116
3100
|
line.progress.total
|
|
3117
3101
|
] })
|
|
3118
3102
|
] }),
|
|
3119
|
-
/* @__PURE__ */ jsx8(Text8, { color:
|
|
3103
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: line.text })
|
|
3120
3104
|
] });
|
|
3121
3105
|
}
|
|
3122
|
-
const state2 = lineState(line);
|
|
3123
3106
|
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
3124
|
-
|
|
3125
|
-
/* @__PURE__ */ jsx8(Text8, { color:
|
|
3126
|
-
line.ms !== void 0 && /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: formatDuration(line.ms) })
|
|
3107
|
+
line.complete ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.success, children: "\u2713" }) : /* @__PURE__ */ jsx8(Spinner, {}),
|
|
3108
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: line.text })
|
|
3127
3109
|
] });
|
|
3128
3110
|
}
|
|
3129
3111
|
function RunningStep({
|
|
@@ -18769,7 +18751,7 @@ function plural(count, noun) {
|
|
|
18769
18751
|
function compositionDone(progress) {
|
|
18770
18752
|
return progress.composition === "done" || progress.composition === "cache-hit";
|
|
18771
18753
|
}
|
|
18772
|
-
function progressRows(progress, agent
|
|
18754
|
+
function progressRows(progress, agent) {
|
|
18773
18755
|
const { scan, composition, selection, existingEntities, tokens } = progress;
|
|
18774
18756
|
const scanned = scan?.scanned ?? 0;
|
|
18775
18757
|
const scanComplete = (scan?.total ?? 0) > 0;
|
|
@@ -18790,20 +18772,16 @@ function progressRows(progress, agent, rowMs = []) {
|
|
|
18790
18772
|
if (existingEntities !== "idle") {
|
|
18791
18773
|
rows.push({
|
|
18792
18774
|
text: existingEntities === "running" ? "Fetching existing components and tokens..." : existingEntities === "complete" ? "Existing components and tokens ready" : "Existing entities unavailable; continuing without them",
|
|
18793
|
-
complete: existingEntities !== "running"
|
|
18794
|
-
// The import carries on without them, so this is not shown as a success.
|
|
18795
|
-
...existingEntities === "failed" ? { state: "warning" } : {}
|
|
18775
|
+
complete: existingEntities !== "running"
|
|
18796
18776
|
});
|
|
18797
18777
|
}
|
|
18798
18778
|
if (tokens !== "idle") {
|
|
18799
18779
|
rows.push({
|
|
18800
18780
|
text: tokens === "complete" ? "Token definitions ready" : tokens === "failed" ? "Token definition generation failed" : `Generating token definitions via ${agent}...`,
|
|
18801
|
-
complete: tokens === "complete"
|
|
18802
|
-
// A failed job is not still running.
|
|
18803
|
-
...tokens === "failed" ? { state: "failed" } : {}
|
|
18781
|
+
complete: tokens === "complete"
|
|
18804
18782
|
});
|
|
18805
18783
|
}
|
|
18806
|
-
return
|
|
18784
|
+
return rows;
|
|
18807
18785
|
}
|
|
18808
18786
|
function noComponentsMessage(projectPath) {
|
|
18809
18787
|
return `No components found in ${projectPath}.
|
|
@@ -18832,13 +18810,13 @@ function resolveAgentChoice(flag, stored) {
|
|
|
18832
18810
|
|
|
18833
18811
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/screen.tsx
|
|
18834
18812
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
18835
|
-
function ExtractionScreen({ progress, agent
|
|
18813
|
+
function ExtractionScreen({ progress, agent }) {
|
|
18836
18814
|
return /* @__PURE__ */ jsx16(
|
|
18837
18815
|
RunningStep,
|
|
18838
18816
|
{
|
|
18839
18817
|
step: "extraction",
|
|
18840
18818
|
description: "Extracting context from your source files.",
|
|
18841
|
-
lines: progressRows(progress, agent
|
|
18819
|
+
lines: progressRows(progress, agent)
|
|
18842
18820
|
}
|
|
18843
18821
|
);
|
|
18844
18822
|
}
|
|
@@ -19267,12 +19245,9 @@ function useExtraction(input) {
|
|
|
19267
19245
|
progress: initialProgress({
|
|
19268
19246
|
hasCredentials: input.credentials !== null,
|
|
19269
19247
|
hasRawTokens: input.rawTokensPath !== ""
|
|
19270
|
-
})
|
|
19271
|
-
rowMs: []
|
|
19248
|
+
})
|
|
19272
19249
|
});
|
|
19273
19250
|
let lastProgress;
|
|
19274
|
-
const startedAt = Date.now();
|
|
19275
|
-
let rowMs = [];
|
|
19276
19251
|
startDebugRun({
|
|
19277
19252
|
flow: "import/extraction",
|
|
19278
19253
|
step: "06-extraction",
|
|
@@ -19281,8 +19256,7 @@ function useExtraction(input) {
|
|
|
19281
19256
|
});
|
|
19282
19257
|
void runExtraction(input, (progress) => {
|
|
19283
19258
|
lastProgress = progress;
|
|
19284
|
-
|
|
19285
|
-
if (current.current === input) setState({ status: "running", progress, rowMs });
|
|
19259
|
+
if (current.current === input) setState({ status: "running", progress });
|
|
19286
19260
|
}).then((result) => {
|
|
19287
19261
|
if (current.current !== input) return;
|
|
19288
19262
|
void finishDebugRun({
|
|
@@ -22207,34 +22181,23 @@ function describeGeneration(input) {
|
|
|
22207
22181
|
return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
|
|
22208
22182
|
${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
|
|
22209
22183
|
}
|
|
22210
|
-
function
|
|
22211
|
-
if (!components) return { text: `Starting up ${name}...`, complete: false };
|
|
22212
|
-
const { done, total, current, failed } = components;
|
|
22213
|
-
if (total > 0 && done >= total) {
|
|
22214
|
-
return failed > 0 ? {
|
|
22215
|
-
text: `Generated ${total - failed} of ${total} components, ${failed} failed`,
|
|
22216
|
-
complete: false,
|
|
22217
|
-
state: "failed"
|
|
22218
|
-
} : { text: `Generated ${total} component${total === 1 ? "" : "s"}`, complete: true };
|
|
22219
|
-
}
|
|
22220
|
-
return {
|
|
22221
|
-
text: failed > 0 ? `${current} (${failed} failed so far)` : current,
|
|
22222
|
-
complete: false,
|
|
22223
|
-
progress: { done, total },
|
|
22224
|
-
...failed > 0 ? { state: "warning" } : {}
|
|
22225
|
-
};
|
|
22226
|
-
}
|
|
22227
|
-
function progressRows2(progress, agent, rowMs = []) {
|
|
22184
|
+
function progressRows2(progress, agent) {
|
|
22228
22185
|
const name = capitalize(agent);
|
|
22229
22186
|
const { components, mapTokens } = progress;
|
|
22230
|
-
const rows = [
|
|
22187
|
+
const rows = [
|
|
22188
|
+
{
|
|
22189
|
+
text: components ? components.current : `Starting up ${name}...`,
|
|
22190
|
+
complete: false,
|
|
22191
|
+
...components ? { progress: { done: components.done, total: components.total } } : {}
|
|
22192
|
+
}
|
|
22193
|
+
];
|
|
22231
22194
|
if (mapTokens !== "idle") {
|
|
22232
22195
|
rows.push({
|
|
22233
22196
|
text: mapTokens === "running" ? `Mapping token restrictions via ${name}...` : "Token restrictions ready",
|
|
22234
22197
|
complete: mapTokens === "complete"
|
|
22235
22198
|
});
|
|
22236
22199
|
}
|
|
22237
|
-
return
|
|
22200
|
+
return rows;
|
|
22238
22201
|
}
|
|
22239
22202
|
|
|
22240
22203
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/screen.tsx
|
|
@@ -22243,15 +22206,14 @@ function GenerationScreen({
|
|
|
22243
22206
|
progress,
|
|
22244
22207
|
agent,
|
|
22245
22208
|
acceptedCount,
|
|
22246
|
-
hasTokens
|
|
22247
|
-
rowMs
|
|
22209
|
+
hasTokens
|
|
22248
22210
|
}) {
|
|
22249
22211
|
return /* @__PURE__ */ jsx30(
|
|
22250
22212
|
RunningStep,
|
|
22251
22213
|
{
|
|
22252
22214
|
step: "generation",
|
|
22253
22215
|
description: describeGeneration({ acceptedCount, agent, hasTokens }),
|
|
22254
|
-
lines: progressRows2(progress, agent
|
|
22216
|
+
lines: progressRows2(progress, agent)
|
|
22255
22217
|
}
|
|
22256
22218
|
);
|
|
22257
22219
|
}
|
|
@@ -22411,17 +22373,11 @@ function appendGeneratePromptOverride(input) {
|
|
|
22411
22373
|
return [...input.promptOverrides, `generate=${input.generatePromptPath}`];
|
|
22412
22374
|
}
|
|
22413
22375
|
function applyProgressEvent2(event, previous, total) {
|
|
22414
|
-
const failed = previous?.failed ?? 0;
|
|
22415
22376
|
if (event.kind === "component:started") {
|
|
22416
|
-
return { done: previous?.done ?? 0, total: event.total || total, current: event.name
|
|
22377
|
+
return { done: previous?.done ?? 0, total: event.total || total, current: event.name };
|
|
22417
22378
|
}
|
|
22418
22379
|
if (event.kind === "component:completed" || event.kind === "component:failed" || event.kind === "component:cached") {
|
|
22419
|
-
return {
|
|
22420
|
-
done: (previous?.done ?? 0) + 1,
|
|
22421
|
-
total: event.total || total,
|
|
22422
|
-
current: event.name,
|
|
22423
|
-
failed: failed + (event.kind === "component:failed" ? 1 : 0)
|
|
22424
|
-
};
|
|
22380
|
+
return { done: (previous?.done ?? 0) + 1, total: event.total || total, current: event.name };
|
|
22425
22381
|
}
|
|
22426
22382
|
return previous;
|
|
22427
22383
|
}
|
|
@@ -22436,10 +22392,8 @@ function useGeneration(input) {
|
|
|
22436
22392
|
setState(void 0);
|
|
22437
22393
|
return;
|
|
22438
22394
|
}
|
|
22439
|
-
setState({ status: "running", progress: initialProgress2()
|
|
22395
|
+
setState({ status: "running", progress: initialProgress2() });
|
|
22440
22396
|
let lastProgress;
|
|
22441
|
-
const startedAt = Date.now();
|
|
22442
|
-
let rowMs = [];
|
|
22443
22397
|
startDebugRun({
|
|
22444
22398
|
flow: "import/generation",
|
|
22445
22399
|
step: "08-generation",
|
|
@@ -22448,8 +22402,7 @@ function useGeneration(input) {
|
|
|
22448
22402
|
});
|
|
22449
22403
|
void runGeneration(input, (progress) => {
|
|
22450
22404
|
lastProgress = progress;
|
|
22451
|
-
|
|
22452
|
-
if (current.current === input) setState({ status: "running", progress, rowMs });
|
|
22405
|
+
if (current.current === input) setState({ status: "running", progress });
|
|
22453
22406
|
}).then((result) => {
|
|
22454
22407
|
if (current.current !== input) return;
|
|
22455
22408
|
void finishDebugRun({
|
|
@@ -28763,10 +28716,6 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28763
28716
|
"/",
|
|
28764
28717
|
progress.total,
|
|
28765
28718
|
" entities"
|
|
28766
|
-
] }),
|
|
28767
|
-
progress.failed > 0 && /* @__PURE__ */ jsxs43(Text45, { color: PALETTE.error, children: [
|
|
28768
|
-
progress.failed,
|
|
28769
|
-
" failed"
|
|
28770
28719
|
] })
|
|
28771
28720
|
] }) }),
|
|
28772
28721
|
showCurrent && /* @__PURE__ */ jsxs43(Box43, { gap: 1, children: [
|
|
@@ -29833,9 +29782,7 @@ async function runPush(input, deps, onPatch) {
|
|
|
29833
29782
|
const items = op.items ?? [];
|
|
29834
29783
|
const lastDone = items.length > 0 ? items[items.length - 1] : null;
|
|
29835
29784
|
const current = lastDone && lastDone.status === "succeeded" ? lastDone.id : null;
|
|
29836
|
-
onPatch({
|
|
29837
|
-
pushProgress: { kind: "progress", processed: done, total: summary.total, failed: summary.failed, current }
|
|
29838
|
-
});
|
|
29785
|
+
onPatch({ pushProgress: { kind: "progress", processed: done, total: summary.total, current } });
|
|
29839
29786
|
}
|
|
29840
29787
|
safeLog(deps, { pollTick: { attempt: pollCount, status: op.sys.status, summary: op.summary } });
|
|
29841
29788
|
}
|
|
@@ -31881,14 +31828,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31881
31828
|
return /* @__PURE__ */ jsx66(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
31882
31829
|
}
|
|
31883
31830
|
if (extraction?.status === "running") {
|
|
31884
|
-
return /* @__PURE__ */ jsx66(
|
|
31885
|
-
ExtractionScreen,
|
|
31886
|
-
{
|
|
31887
|
-
progress: extraction.progress,
|
|
31888
|
-
agent: extractionRun.input.agent,
|
|
31889
|
-
rowMs: extraction.rowMs
|
|
31890
|
-
}
|
|
31891
|
-
);
|
|
31831
|
+
return /* @__PURE__ */ jsx66(ExtractionScreen, { progress: extraction.progress, agent: extractionRun.input.agent });
|
|
31892
31832
|
}
|
|
31893
31833
|
return /* @__PURE__ */ jsx66(Fragment22, {});
|
|
31894
31834
|
}
|
|
@@ -31917,8 +31857,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31917
31857
|
progress: generation.progress,
|
|
31918
31858
|
agent: scopeRun.input.agent,
|
|
31919
31859
|
acceptedCount: scopeFlow.decisions.accepted.length,
|
|
31920
|
-
hasTokens: scopeRun.extraction.tokensPath !== ""
|
|
31921
|
-
rowMs: generation.rowMs
|
|
31860
|
+
hasTokens: scopeRun.extraction.tokensPath !== ""
|
|
31922
31861
|
}
|
|
31923
31862
|
);
|
|
31924
31863
|
}
|
package/dist/index.js
CHANGED
|
@@ -20138,19 +20138,6 @@ var init_overview_box = __esm({
|
|
|
20138
20138
|
});
|
|
20139
20139
|
|
|
20140
20140
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/logic.ts
|
|
20141
|
-
function lineState(line) {
|
|
20142
|
-
if (line.state) return line.state;
|
|
20143
|
-
return line.complete ? "done" : "running";
|
|
20144
|
-
}
|
|
20145
|
-
function formatDuration(ms) {
|
|
20146
|
-
return ms < 1e3 ? "<1s" : formatElapsed(Math.round(ms / 1e3));
|
|
20147
|
-
}
|
|
20148
|
-
function trackFinished(previous, rows, elapsedMs) {
|
|
20149
|
-
return rows.map((row, index) => previous[index] ?? (lineState(row) === "running" ? void 0 : elapsedMs));
|
|
20150
|
-
}
|
|
20151
|
-
function withTimes(rows, rowMs) {
|
|
20152
|
-
return rows.map((row, index) => rowMs[index] === void 0 ? row : { ...row, ms: rowMs[index] });
|
|
20153
|
-
}
|
|
20154
20141
|
function progressPercent(progress) {
|
|
20155
20142
|
if (progress.total <= 0) return 0;
|
|
20156
20143
|
return Math.min(100, Math.max(0, Math.round(progress.done / progress.total * 100)));
|
|
@@ -20217,14 +20204,12 @@ function Line({ line }) {
|
|
|
20217
20204
|
line.progress.total
|
|
20218
20205
|
] })
|
|
20219
20206
|
] }),
|
|
20220
|
-
/* @__PURE__ */ jsx8(Text8, { color:
|
|
20207
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: line.text })
|
|
20221
20208
|
] });
|
|
20222
20209
|
}
|
|
20223
|
-
const state2 = lineState(line);
|
|
20224
20210
|
return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
|
|
20225
|
-
|
|
20226
|
-
/* @__PURE__ */ jsx8(Text8, { color:
|
|
20227
|
-
line.ms !== void 0 && /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: formatDuration(line.ms) })
|
|
20211
|
+
line.complete ? /* @__PURE__ */ jsx8(Text8, { color: PALETTE.success, children: "\u2713" }) : /* @__PURE__ */ jsx8(Spinner, {}),
|
|
20212
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: line.text })
|
|
20228
20213
|
] });
|
|
20229
20214
|
}
|
|
20230
20215
|
function RunningStep({
|
|
@@ -20245,7 +20230,6 @@ function RunningStep({
|
|
|
20245
20230
|
] })
|
|
20246
20231
|
] });
|
|
20247
20232
|
}
|
|
20248
|
-
var STATE_ICON, STATE_COLOR, textColor;
|
|
20249
20233
|
var init_running_step = __esm({
|
|
20250
20234
|
"packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx"() {
|
|
20251
20235
|
"use strict";
|
|
@@ -20254,9 +20238,6 @@ var init_running_step = __esm({
|
|
|
20254
20238
|
init_theme2();
|
|
20255
20239
|
init_StepHeader();
|
|
20256
20240
|
init_use_elapsed();
|
|
20257
|
-
STATE_ICON = { done: "\u2713", warning: "!", failed: "\u2717" };
|
|
20258
|
-
STATE_COLOR = { done: PALETTE.success, warning: PALETTE.warning, failed: PALETTE.error };
|
|
20259
|
-
textColor = (state2) => state2 === "warning" || state2 === "failed" ? STATE_COLOR[state2] : PALETTE.muted;
|
|
20260
20241
|
}
|
|
20261
20242
|
});
|
|
20262
20243
|
|
|
@@ -21554,7 +21535,7 @@ function plural(count, noun) {
|
|
|
21554
21535
|
function compositionDone(progress) {
|
|
21555
21536
|
return progress.composition === "done" || progress.composition === "cache-hit";
|
|
21556
21537
|
}
|
|
21557
|
-
function progressRows(progress, agent
|
|
21538
|
+
function progressRows(progress, agent) {
|
|
21558
21539
|
const { scan, composition, selection, existingEntities, tokens } = progress;
|
|
21559
21540
|
const scanned = scan?.scanned ?? 0;
|
|
21560
21541
|
const scanComplete = (scan?.total ?? 0) > 0;
|
|
@@ -21575,20 +21556,16 @@ function progressRows(progress, agent, rowMs = []) {
|
|
|
21575
21556
|
if (existingEntities !== "idle") {
|
|
21576
21557
|
rows.push({
|
|
21577
21558
|
text: existingEntities === "running" ? "Fetching existing components and tokens..." : existingEntities === "complete" ? "Existing components and tokens ready" : "Existing entities unavailable; continuing without them",
|
|
21578
|
-
complete: existingEntities !== "running"
|
|
21579
|
-
// The import carries on without them, so this is not shown as a success.
|
|
21580
|
-
...existingEntities === "failed" ? { state: "warning" } : {}
|
|
21559
|
+
complete: existingEntities !== "running"
|
|
21581
21560
|
});
|
|
21582
21561
|
}
|
|
21583
21562
|
if (tokens !== "idle") {
|
|
21584
21563
|
rows.push({
|
|
21585
21564
|
text: tokens === "complete" ? "Token definitions ready" : tokens === "failed" ? "Token definition generation failed" : `Generating token definitions via ${agent}...`,
|
|
21586
|
-
complete: tokens === "complete"
|
|
21587
|
-
// A failed job is not still running.
|
|
21588
|
-
...tokens === "failed" ? { state: "failed" } : {}
|
|
21565
|
+
complete: tokens === "complete"
|
|
21589
21566
|
});
|
|
21590
21567
|
}
|
|
21591
|
-
return
|
|
21568
|
+
return rows;
|
|
21592
21569
|
}
|
|
21593
21570
|
function noComponentsMessage(projectPath) {
|
|
21594
21571
|
return `No components found in ${projectPath}.
|
|
@@ -21619,19 +21596,18 @@ var init_logic9 = __esm({
|
|
|
21619
21596
|
"use strict";
|
|
21620
21597
|
init_src3();
|
|
21621
21598
|
init_debug_trail();
|
|
21622
|
-
init_logic4();
|
|
21623
21599
|
}
|
|
21624
21600
|
});
|
|
21625
21601
|
|
|
21626
21602
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/screen.tsx
|
|
21627
21603
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
21628
|
-
function ExtractionScreen({ progress, agent
|
|
21604
|
+
function ExtractionScreen({ progress, agent }) {
|
|
21629
21605
|
return /* @__PURE__ */ jsx16(
|
|
21630
21606
|
RunningStep,
|
|
21631
21607
|
{
|
|
21632
21608
|
step: "extraction",
|
|
21633
21609
|
description: "Extracting context from your source files.",
|
|
21634
|
-
lines: progressRows(progress, agent
|
|
21610
|
+
lines: progressRows(progress, agent)
|
|
21635
21611
|
}
|
|
21636
21612
|
);
|
|
21637
21613
|
}
|
|
@@ -22116,12 +22092,9 @@ function useExtraction(input) {
|
|
|
22116
22092
|
progress: initialProgress({
|
|
22117
22093
|
hasCredentials: input.credentials !== null,
|
|
22118
22094
|
hasRawTokens: input.rawTokensPath !== ""
|
|
22119
|
-
})
|
|
22120
|
-
rowMs: []
|
|
22095
|
+
})
|
|
22121
22096
|
});
|
|
22122
22097
|
let lastProgress;
|
|
22123
|
-
const startedAt = Date.now();
|
|
22124
|
-
let rowMs = [];
|
|
22125
22098
|
startDebugRun({
|
|
22126
22099
|
flow: "import/extraction",
|
|
22127
22100
|
step: "06-extraction",
|
|
@@ -22130,8 +22103,7 @@ function useExtraction(input) {
|
|
|
22130
22103
|
});
|
|
22131
22104
|
void runExtraction(input, (progress) => {
|
|
22132
22105
|
lastProgress = progress;
|
|
22133
|
-
|
|
22134
|
-
if (current.current === input) setState({ status: "running", progress, rowMs });
|
|
22106
|
+
if (current.current === input) setState({ status: "running", progress });
|
|
22135
22107
|
}).then((result) => {
|
|
22136
22108
|
if (current.current !== input) return;
|
|
22137
22109
|
void finishDebugRun({
|
|
@@ -22150,7 +22122,6 @@ var init_use_extraction = __esm({
|
|
|
22150
22122
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts"() {
|
|
22151
22123
|
"use strict";
|
|
22152
22124
|
init_debug_store();
|
|
22153
|
-
init_logic4();
|
|
22154
22125
|
init_logic9();
|
|
22155
22126
|
init_run();
|
|
22156
22127
|
}
|
|
@@ -25344,40 +25315,28 @@ function describeGeneration(input) {
|
|
|
25344
25315
|
return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
|
|
25345
25316
|
${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
|
|
25346
25317
|
}
|
|
25347
|
-
function
|
|
25348
|
-
if (!components) return { text: `Starting up ${name}...`, complete: false };
|
|
25349
|
-
const { done, total, current, failed } = components;
|
|
25350
|
-
if (total > 0 && done >= total) {
|
|
25351
|
-
return failed > 0 ? {
|
|
25352
|
-
text: `Generated ${total - failed} of ${total} components, ${failed} failed`,
|
|
25353
|
-
complete: false,
|
|
25354
|
-
state: "failed"
|
|
25355
|
-
} : { text: `Generated ${total} component${total === 1 ? "" : "s"}`, complete: true };
|
|
25356
|
-
}
|
|
25357
|
-
return {
|
|
25358
|
-
text: failed > 0 ? `${current} (${failed} failed so far)` : current,
|
|
25359
|
-
complete: false,
|
|
25360
|
-
progress: { done, total },
|
|
25361
|
-
...failed > 0 ? { state: "warning" } : {}
|
|
25362
|
-
};
|
|
25363
|
-
}
|
|
25364
|
-
function progressRows2(progress, agent, rowMs = []) {
|
|
25318
|
+
function progressRows2(progress, agent) {
|
|
25365
25319
|
const name = capitalize(agent);
|
|
25366
25320
|
const { components, mapTokens } = progress;
|
|
25367
|
-
const rows = [
|
|
25321
|
+
const rows = [
|
|
25322
|
+
{
|
|
25323
|
+
text: components ? components.current : `Starting up ${name}...`,
|
|
25324
|
+
complete: false,
|
|
25325
|
+
...components ? { progress: { done: components.done, total: components.total } } : {}
|
|
25326
|
+
}
|
|
25327
|
+
];
|
|
25368
25328
|
if (mapTokens !== "idle") {
|
|
25369
25329
|
rows.push({
|
|
25370
25330
|
text: mapTokens === "running" ? `Mapping token restrictions via ${name}...` : "Token restrictions ready",
|
|
25371
25331
|
complete: mapTokens === "complete"
|
|
25372
25332
|
});
|
|
25373
25333
|
}
|
|
25374
|
-
return
|
|
25334
|
+
return rows;
|
|
25375
25335
|
}
|
|
25376
25336
|
var capitalize;
|
|
25377
25337
|
var init_logic11 = __esm({
|
|
25378
25338
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/logic.ts"() {
|
|
25379
25339
|
"use strict";
|
|
25380
|
-
init_logic4();
|
|
25381
25340
|
capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
|
|
25382
25341
|
}
|
|
25383
25342
|
});
|
|
@@ -25388,15 +25347,14 @@ function GenerationScreen({
|
|
|
25388
25347
|
progress,
|
|
25389
25348
|
agent,
|
|
25390
25349
|
acceptedCount,
|
|
25391
|
-
hasTokens
|
|
25392
|
-
rowMs
|
|
25350
|
+
hasTokens
|
|
25393
25351
|
}) {
|
|
25394
25352
|
return /* @__PURE__ */ jsx30(
|
|
25395
25353
|
RunningStep,
|
|
25396
25354
|
{
|
|
25397
25355
|
step: "generation",
|
|
25398
25356
|
description: describeGeneration({ acceptedCount, agent, hasTokens }),
|
|
25399
|
-
lines: progressRows2(progress, agent
|
|
25357
|
+
lines: progressRows2(progress, agent)
|
|
25400
25358
|
}
|
|
25401
25359
|
);
|
|
25402
25360
|
}
|
|
@@ -25559,17 +25517,11 @@ function appendGeneratePromptOverride(input) {
|
|
|
25559
25517
|
return [...input.promptOverrides, `generate=${input.generatePromptPath}`];
|
|
25560
25518
|
}
|
|
25561
25519
|
function applyProgressEvent2(event, previous, total) {
|
|
25562
|
-
const failed = previous?.failed ?? 0;
|
|
25563
25520
|
if (event.kind === "component:started") {
|
|
25564
|
-
return { done: previous?.done ?? 0, total: event.total || total, current: event.name
|
|
25521
|
+
return { done: previous?.done ?? 0, total: event.total || total, current: event.name };
|
|
25565
25522
|
}
|
|
25566
25523
|
if (event.kind === "component:completed" || event.kind === "component:failed" || event.kind === "component:cached") {
|
|
25567
|
-
return {
|
|
25568
|
-
done: (previous?.done ?? 0) + 1,
|
|
25569
|
-
total: event.total || total,
|
|
25570
|
-
current: event.name,
|
|
25571
|
-
failed: failed + (event.kind === "component:failed" ? 1 : 0)
|
|
25572
|
-
};
|
|
25524
|
+
return { done: (previous?.done ?? 0) + 1, total: event.total || total, current: event.name };
|
|
25573
25525
|
}
|
|
25574
25526
|
return previous;
|
|
25575
25527
|
}
|
|
@@ -25607,10 +25559,8 @@ function useGeneration(input) {
|
|
|
25607
25559
|
setState(void 0);
|
|
25608
25560
|
return;
|
|
25609
25561
|
}
|
|
25610
|
-
setState({ status: "running", progress: initialProgress2()
|
|
25562
|
+
setState({ status: "running", progress: initialProgress2() });
|
|
25611
25563
|
let lastProgress;
|
|
25612
|
-
const startedAt = Date.now();
|
|
25613
|
-
let rowMs = [];
|
|
25614
25564
|
startDebugRun({
|
|
25615
25565
|
flow: "import/generation",
|
|
25616
25566
|
step: "08-generation",
|
|
@@ -25619,8 +25569,7 @@ function useGeneration(input) {
|
|
|
25619
25569
|
});
|
|
25620
25570
|
void runGeneration(input, (progress) => {
|
|
25621
25571
|
lastProgress = progress;
|
|
25622
|
-
|
|
25623
|
-
if (current.current === input) setState({ status: "running", progress, rowMs });
|
|
25572
|
+
if (current.current === input) setState({ status: "running", progress });
|
|
25624
25573
|
}).then((result) => {
|
|
25625
25574
|
if (current.current !== input) return;
|
|
25626
25575
|
void finishDebugRun({
|
|
@@ -25639,7 +25588,6 @@ var init_use_generation = __esm({
|
|
|
25639
25588
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts"() {
|
|
25640
25589
|
"use strict";
|
|
25641
25590
|
init_debug_store();
|
|
25642
|
-
init_logic4();
|
|
25643
25591
|
init_logic11();
|
|
25644
25592
|
init_run2();
|
|
25645
25593
|
}
|
|
@@ -32478,10 +32426,6 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
32478
32426
|
"/",
|
|
32479
32427
|
progress.total,
|
|
32480
32428
|
" entities"
|
|
32481
|
-
] }),
|
|
32482
|
-
progress.failed > 0 && /* @__PURE__ */ jsxs43(Text45, { color: PALETTE.error, children: [
|
|
32483
|
-
progress.failed,
|
|
32484
|
-
" failed"
|
|
32485
32429
|
] })
|
|
32486
32430
|
] }) }),
|
|
32487
32431
|
showCurrent && /* @__PURE__ */ jsxs43(Box43, { gap: 1, children: [
|
|
@@ -33610,9 +33554,7 @@ async function runPush(input, deps, onPatch) {
|
|
|
33610
33554
|
const items = op.items ?? [];
|
|
33611
33555
|
const lastDone = items.length > 0 ? items[items.length - 1] : null;
|
|
33612
33556
|
const current = lastDone && lastDone.status === "succeeded" ? lastDone.id : null;
|
|
33613
|
-
onPatch({
|
|
33614
|
-
pushProgress: { kind: "progress", processed: done, total: summary.total, failed: summary.failed, current }
|
|
33615
|
-
});
|
|
33557
|
+
onPatch({ pushProgress: { kind: "progress", processed: done, total: summary.total, current } });
|
|
33616
33558
|
}
|
|
33617
33559
|
safeLog(deps, { pollTick: { attempt: pollCount, status: op.sys.status, summary: op.summary } });
|
|
33618
33560
|
}
|
|
@@ -35743,14 +35685,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35743
35685
|
return /* @__PURE__ */ jsx66(ErrorStep, { stepName: extraction.result.step, message: extraction.result.message, onExit: leaveImport });
|
|
35744
35686
|
}
|
|
35745
35687
|
if (extraction?.status === "running") {
|
|
35746
|
-
return /* @__PURE__ */ jsx66(
|
|
35747
|
-
ExtractionScreen,
|
|
35748
|
-
{
|
|
35749
|
-
progress: extraction.progress,
|
|
35750
|
-
agent: extractionRun.input.agent,
|
|
35751
|
-
rowMs: extraction.rowMs
|
|
35752
|
-
}
|
|
35753
|
-
);
|
|
35688
|
+
return /* @__PURE__ */ jsx66(ExtractionScreen, { progress: extraction.progress, agent: extractionRun.input.agent });
|
|
35754
35689
|
}
|
|
35755
35690
|
return /* @__PURE__ */ jsx66(Fragment22, {});
|
|
35756
35691
|
}
|
|
@@ -35779,8 +35714,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35779
35714
|
progress: generation.progress,
|
|
35780
35715
|
agent: scopeRun.input.agent,
|
|
35781
35716
|
acceptedCount: scopeFlow.decisions.accepted.length,
|
|
35782
|
-
hasTokens: scopeRun.extraction.tokensPath !== ""
|
|
35783
|
-
rowMs: generation.rowMs
|
|
35717
|
+
hasTokens: scopeRun.extraction.tokensPath !== ""
|
|
35784
35718
|
}
|
|
35785
35719
|
);
|
|
35786
35720
|
}
|
package/dist/package.json
CHANGED
|
@@ -5,23 +5,7 @@ export interface Progress {
|
|
|
5
5
|
export interface RunningLine {
|
|
6
6
|
text: string;
|
|
7
7
|
complete?: boolean;
|
|
8
|
-
/** Set for a row that ended badly. A warning carries on without it; a failure does not. Otherwise `complete` decides. */
|
|
9
|
-
state?: 'warning' | 'failed';
|
|
10
8
|
progress?: Progress;
|
|
11
|
-
/** How long the row took, once it has finished. */
|
|
12
|
-
ms?: number;
|
|
13
9
|
}
|
|
14
|
-
export type LineState = 'running' | 'done' | 'warning' | 'failed';
|
|
15
|
-
/** What a row looks like. A row that ended badly is never shown as running or as done. */
|
|
16
|
-
export declare function lineState(line: RunningLine): LineState;
|
|
17
|
-
export declare function formatDuration(ms: number): string;
|
|
18
|
-
/**
|
|
19
|
-
* How long each row took, by position, for the rows that have finished. A row's time is how long the run had been going
|
|
20
|
-
* when it was first seen finished, and it does not change after that. Rows keep their position for the whole run, so a row
|
|
21
|
-
* that appears later is added at the end.
|
|
22
|
-
*/
|
|
23
|
-
export declare function trackFinished(previous: ReadonlyArray<number | undefined>, rows: readonly RunningLine[], elapsedMs: number): Array<number | undefined>;
|
|
24
|
-
/** The rows with the time each finished row took, by position. */
|
|
25
|
-
export declare function withTimes(rows: RunningLine[], rowMs: ReadonlyArray<number | undefined>): RunningLine[];
|
|
26
10
|
export declare function progressPercent(progress: Progress): number;
|
|
27
11
|
export declare function formatElapsed(totalSeconds: number): string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtractAndComposeProgress } from '@contentful/experience-design-system-backend-pipeline';
|
|
2
|
-
import { type RunningLine } from '../../shared/running-step/logic.js';
|
|
3
2
|
import type { ExtractionInput, ExtractionProgress, ExtractionResult } from './types.js';
|
|
4
3
|
/** Structured progress events emitted by the orchestrator (extraction + composition). */
|
|
5
4
|
export type ProgressEvent = ExtractAndComposeProgress;
|
|
@@ -25,11 +24,11 @@ export declare function initialProgress(input: {
|
|
|
25
24
|
hasRawTokens: boolean;
|
|
26
25
|
}): ExtractionProgress;
|
|
27
26
|
export declare function applyProgressEvent(progress: ExtractionProgress, event: ProgressEvent): ExtractionProgress;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
/** The rows the screen shows, in the order the wizard showed them. Rows that do not apply are left out. */
|
|
28
|
+
export declare function progressRows(progress: ExtractionProgress, agent: string): Array<{
|
|
29
|
+
text: string;
|
|
30
|
+
complete: boolean;
|
|
31
|
+
}>;
|
|
33
32
|
/** True when every job is already done, so the screen would only flash. The wizard shows nothing in this case. */
|
|
34
33
|
export declare function isFullCacheHit(progress: ExtractionProgress): boolean;
|
|
35
34
|
export declare function noComponentsMessage(projectPath: string): string;
|
|
@@ -3,8 +3,6 @@ import type { ExtractionProgress } from './types.js';
|
|
|
3
3
|
interface ExtractionScreenProps {
|
|
4
4
|
progress: ExtractionProgress;
|
|
5
5
|
agent: string;
|
|
6
|
-
/** How long each finished row took, by position. */
|
|
7
|
-
rowMs?: ReadonlyArray<number | undefined>;
|
|
8
6
|
}
|
|
9
|
-
export declare function ExtractionScreen({ progress, agent
|
|
7
|
+
export declare function ExtractionScreen({ progress, agent }: ExtractionScreenProps): React.ReactElement;
|
|
10
8
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type RunningLine } from '../../shared/running-step/logic.js';
|
|
2
1
|
import type { GenerationInput, GenerationProgress, GenerationResult } from './types.js';
|
|
3
2
|
/** What the debug log says the stage started with. The counts are logged, not the lists of names. */
|
|
4
3
|
export declare function generationLogInputs(input: GenerationInput): Record<string, unknown>;
|
|
@@ -21,5 +20,11 @@ export declare function describeGeneration(input: {
|
|
|
21
20
|
agent: string;
|
|
22
21
|
hasTokens: boolean;
|
|
23
22
|
}): string;
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
export declare function progressRows(progress: GenerationProgress, agent: string): Array<{
|
|
24
|
+
text: string;
|
|
25
|
+
complete: boolean;
|
|
26
|
+
progress?: {
|
|
27
|
+
done: number;
|
|
28
|
+
total: number;
|
|
29
|
+
};
|
|
30
|
+
}>;
|
|
@@ -5,8 +5,6 @@ interface GenerationScreenProps {
|
|
|
5
5
|
agent: string;
|
|
6
6
|
acceptedCount: number;
|
|
7
7
|
hasTokens: boolean;
|
|
8
|
-
/** How long each finished row took, by position. */
|
|
9
|
-
rowMs?: ReadonlyArray<number | undefined>;
|
|
10
8
|
}
|
|
11
|
-
export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens,
|
|
9
|
+
export declare function GenerationScreen({ progress, agent, acceptedCount, hasTokens, }: GenerationScreenProps): React.ReactElement;
|
|
12
10
|
export {};
|
|
@@ -26,15 +26,11 @@ export interface GenerationInput {
|
|
|
26
26
|
}
|
|
27
27
|
/** One line per thing the screen shows, in the order it shows them. */
|
|
28
28
|
export interface GenerationProgress {
|
|
29
|
-
/**
|
|
30
|
-
* Components finished, out of the total, and the one being worked on. `failed` counts the finished ones that failed: the
|
|
31
|
-
* run carries on through the rest and only fails at the end. Null until the first progress line.
|
|
32
|
-
*/
|
|
29
|
+
/** Components finished, out of the total, and the one being worked on. Null until the first progress line. */
|
|
33
30
|
components: {
|
|
34
31
|
done: number;
|
|
35
32
|
total: number;
|
|
36
33
|
current: string;
|
|
37
|
-
failed: number;
|
|
38
34
|
} | null;
|
|
39
35
|
mapTokens: 'idle' | 'running' | 'complete';
|
|
40
36
|
/** Whether token mapping will run at all; unknown until the generated components have been looked at. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.42.1-dev-build-
|
|
3
|
+
"version": "2.42.1-dev-build-f69db6bf.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"ts-morph": "^27.0.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"zod": "^4.6.5",
|
|
48
|
-
"@contentful/experience-design-system-types": "2.42.1-dev-build-
|
|
48
|
+
"@contentful/experience-design-system-types": "2.42.1-dev-build-f69db6bf.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"ink-testing-library": "^4.0.0",
|
|
60
60
|
"typescript-eslint": "^8.67.0",
|
|
61
61
|
"vitest": "^4.0.16",
|
|
62
|
-
"@contentful/experience-design-system-backend-pipeline": "2.42.1-dev-build-
|
|
62
|
+
"@contentful/experience-design-system-backend-pipeline": "2.42.1-dev-build-f69db6bf.0"
|
|
63
63
|
},
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|