@contentful/experience-design-system-cli 2.41.1-dev-build-699ca2d9.0 → 2.41.1-dev-build-06624ee7.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 +767 -240
- package/dist/index.js +810 -258
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +2 -0
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +23 -1
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +4 -1
- package/dist/src/tui/import/steps/06-extraction/logic.d.ts +14 -1
- package/dist/src/tui/import/steps/07-scope-gate/log.d.ts +8 -0
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +8 -1
- package/dist/src/tui/import/steps/09-review/review-log.d.ts +31 -0
- package/dist/src/tui/import/steps/09-review/use-review-log.d.ts +20 -0
- package/dist/src/tui/import/steps/09-review/use-review-session.d.ts +3 -1
- package/dist/src/tui/import/steps/10-flow/flow/flow-log.d.ts +46 -0
- package/dist/src/tui/import/steps/10-flow/flow/use-flow-log.d.ts +7 -0
- package/dist/src/tui/settings/configuration/agents/agent-debug.d.ts +1 -1
- package/package.json +3 -3
- /package/dist/src/tui/{settings/shared → shared}/debug-trail.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1986,12 +1986,9 @@ var init_schema = __esm({
|
|
|
1986
1986
|
$required: { type: "boolean" },
|
|
1987
1987
|
$default: {},
|
|
1988
1988
|
$values: { type: "array", items: { type: "string" } },
|
|
1989
|
-
"$token.kind": { type: "string"
|
|
1989
|
+
"$token.kind": { type: "string" },
|
|
1990
1990
|
"$token.allowed": { type: "array", items: { type: "string" } }
|
|
1991
1991
|
},
|
|
1992
|
-
// The API rejects a token property that does not say which kind of token it takes.
|
|
1993
|
-
if: { type: "object", properties: { $type: { const: "token" } }, required: ["$type"] },
|
|
1994
|
-
then: { type: "object", required: ["$token.kind"] },
|
|
1995
1992
|
additionalProperties: false
|
|
1996
1993
|
},
|
|
1997
1994
|
slot: {
|
|
@@ -15183,8 +15180,8 @@ function retryAfterMs(response) {
|
|
|
15183
15180
|
const value = response.headers?.get("retry-after")?.trim();
|
|
15184
15181
|
if (!value)
|
|
15185
15182
|
return void 0;
|
|
15186
|
-
const
|
|
15187
|
-
const delayMs = Number.isFinite(
|
|
15183
|
+
const seconds2 = Number(value);
|
|
15184
|
+
const delayMs = Number.isFinite(seconds2) ? seconds2 * 1e3 : Date.parse(value) - Date.now();
|
|
15188
15185
|
if (!Number.isFinite(delayMs) || delayMs < 0 || delayMs > MAX_RETRY_AFTER_MS)
|
|
15189
15186
|
return void 0;
|
|
15190
15187
|
return Math.round(delayMs);
|
|
@@ -18056,10 +18053,10 @@ var init_read_candidate_files = __esm({
|
|
|
18056
18053
|
async function selectCompositionPromptFiles(components, sourceFiles) {
|
|
18057
18054
|
const allFiles = await readCandidateFiles(components, sourceFiles);
|
|
18058
18055
|
const selectedCandidates = selectCandidateFiles(allFiles).map((c2) => ({ path: c2.path, content: c2.content }));
|
|
18059
|
-
const
|
|
18060
|
-
const promptFiles =
|
|
18056
|
+
const capped3 = capCandidatesToPromptBudget(selectedCandidates);
|
|
18057
|
+
const promptFiles = capped3.kept;
|
|
18061
18058
|
const runtimeFiles = allFiles.map((c2) => ({ path: c2.path, content: c2.content }));
|
|
18062
|
-
const droppedWarning =
|
|
18059
|
+
const droppedWarning = capped3.dropped.length > 0 ? `composition \u2014 ${capped3.dropped.length} candidate file(s) omitted from the agent prompt to fit the context budget; resolution runs on the ${promptFiles.length} highest-value files.` : void 0;
|
|
18063
18060
|
return { promptFiles, runtimeFiles, droppedWarning };
|
|
18064
18061
|
}
|
|
18065
18062
|
var init_select_composition_prompt_files = __esm({
|
|
@@ -19500,6 +19497,7 @@ __export(debug_store_exports, {
|
|
|
19500
19497
|
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
19501
19498
|
currentSessionDir: () => currentSessionDir,
|
|
19502
19499
|
finishDebugRun: () => finishDebugRun,
|
|
19500
|
+
setDebugRunProgress: () => setDebugRunProgress,
|
|
19503
19501
|
startDebugRun: () => startDebugRun,
|
|
19504
19502
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
19505
19503
|
startImportRun: () => startImportRun
|
|
@@ -19595,11 +19593,15 @@ function startDebugRun({
|
|
|
19595
19593
|
const runId = generateRunId();
|
|
19596
19594
|
const startedAt = Date.now();
|
|
19597
19595
|
const redactedInputs = redact(inputs);
|
|
19598
|
-
|
|
19599
|
-
|
|
19600
|
-
|
|
19596
|
+
const run = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
|
|
19597
|
+
pendingRun = run;
|
|
19598
|
+
void isDebugModeEnabled().then((enabled) => {
|
|
19599
|
+
if (!enabled && pendingRun === run) pendingRun = void 0;
|
|
19601
19600
|
});
|
|
19602
19601
|
}
|
|
19602
|
+
function setDebugRunProgress(outputs) {
|
|
19603
|
+
if (pendingRun) pendingRun.progress = outputs;
|
|
19604
|
+
}
|
|
19603
19605
|
async function finishDebugRun({
|
|
19604
19606
|
outputs,
|
|
19605
19607
|
status,
|
|
@@ -19608,9 +19610,10 @@ async function finishDebugRun({
|
|
|
19608
19610
|
const run = pendingRun;
|
|
19609
19611
|
if (!run) return;
|
|
19610
19612
|
pendingRun = void 0;
|
|
19613
|
+
if (!await isDebugModeEnabled()) return;
|
|
19611
19614
|
const durationMs = Date.now() - run.startedAt;
|
|
19612
19615
|
const log = {
|
|
19613
|
-
flow: run.flow,
|
|
19616
|
+
flow: logFolder(run.flow, run.step),
|
|
19614
19617
|
menuOption: run.menuOption,
|
|
19615
19618
|
content: renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs })
|
|
19616
19619
|
};
|
|
@@ -19621,6 +19624,9 @@ async function finishDebugRun({
|
|
|
19621
19624
|
}
|
|
19622
19625
|
await writeLog(root, log);
|
|
19623
19626
|
}
|
|
19627
|
+
function logFolder(flow, step) {
|
|
19628
|
+
return flow.startsWith("import/") && /^\d+-/.test(step) ? `import/${step}` : flow;
|
|
19629
|
+
}
|
|
19624
19630
|
async function writeLog(root, log) {
|
|
19625
19631
|
const dir = join19(root, ...log.flow.split("/"));
|
|
19626
19632
|
await mkdir7(dir, { recursive: true });
|
|
@@ -19677,7 +19683,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
19677
19683
|
`;
|
|
19678
19684
|
}
|
|
19679
19685
|
function handleCrash() {
|
|
19680
|
-
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
19686
|
+
return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
|
|
19681
19687
|
}
|
|
19682
19688
|
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
19683
19689
|
var init_debug_store = __esm({
|
|
@@ -19721,11 +19727,17 @@ var init_debug_store = __esm({
|
|
|
19721
19727
|
throw reason;
|
|
19722
19728
|
});
|
|
19723
19729
|
});
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
|
|
19730
|
+
for (const [signal, exitCode] of [
|
|
19731
|
+
["SIGINT", 130],
|
|
19732
|
+
["SIGTERM", 143],
|
|
19733
|
+
["SIGHUP", 129]
|
|
19734
|
+
]) {
|
|
19735
|
+
process.once(signal, () => {
|
|
19736
|
+
void handleCrash().finally(() => {
|
|
19737
|
+
process.exit(exitCode);
|
|
19738
|
+
});
|
|
19727
19739
|
});
|
|
19728
|
-
}
|
|
19740
|
+
}
|
|
19729
19741
|
}
|
|
19730
19742
|
});
|
|
19731
19743
|
|
|
@@ -20129,8 +20141,8 @@ function progressPercent(progress) {
|
|
|
20129
20141
|
}
|
|
20130
20142
|
function formatElapsed(totalSeconds) {
|
|
20131
20143
|
const minutes = Math.floor(totalSeconds / 60);
|
|
20132
|
-
const
|
|
20133
|
-
return minutes > 0 ? `${minutes}m ${
|
|
20144
|
+
const seconds2 = totalSeconds % 60;
|
|
20145
|
+
return minutes > 0 ? `${minutes}m ${seconds2}s` : `${seconds2}s`;
|
|
20134
20146
|
}
|
|
20135
20147
|
var init_logic4 = __esm({
|
|
20136
20148
|
"packages/experience-design-system-cli/src/tui/import/shared/running-step/logic.ts"() {
|
|
@@ -20160,12 +20172,12 @@ var init_theme2 = __esm({
|
|
|
20160
20172
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
20161
20173
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
20162
20174
|
function useElapsed() {
|
|
20163
|
-
const [
|
|
20175
|
+
const [seconds2, setSeconds] = useState3(0);
|
|
20164
20176
|
useEffect3(() => {
|
|
20165
20177
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
20166
20178
|
return () => clearInterval(timer);
|
|
20167
20179
|
}, []);
|
|
20168
|
-
return formatElapsed(
|
|
20180
|
+
return formatElapsed(seconds2);
|
|
20169
20181
|
}
|
|
20170
20182
|
var init_use_elapsed = __esm({
|
|
20171
20183
|
"packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts"() {
|
|
@@ -21080,6 +21092,45 @@ var init_FieldForm = __esm({
|
|
|
21080
21092
|
}
|
|
21081
21093
|
});
|
|
21082
21094
|
|
|
21095
|
+
// packages/experience-design-system-cli/src/tui/shared/debug-trail.ts
|
|
21096
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
21097
|
+
function diffSnapshots(before, after) {
|
|
21098
|
+
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
21099
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
21100
|
+
return { changed: changed_fields.length > 0, changed_fields };
|
|
21101
|
+
}
|
|
21102
|
+
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
21103
|
+
const actions = [];
|
|
21104
|
+
return {
|
|
21105
|
+
record(action) {
|
|
21106
|
+
actions.push(action);
|
|
21107
|
+
if (actions.length > limit) actions.shift();
|
|
21108
|
+
},
|
|
21109
|
+
entries: () => [...actions]
|
|
21110
|
+
};
|
|
21111
|
+
}
|
|
21112
|
+
function scrubError(error, secrets) {
|
|
21113
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
21114
|
+
for (const secret of secrets) {
|
|
21115
|
+
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
21116
|
+
for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
|
|
21117
|
+
}
|
|
21118
|
+
return message;
|
|
21119
|
+
}
|
|
21120
|
+
function describeSettingsFile() {
|
|
21121
|
+
const path5 = configFilePath2();
|
|
21122
|
+
return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
|
|
21123
|
+
}
|
|
21124
|
+
var DEFAULT_TRAIL_LIMIT, MIN_SECRET_LENGTH;
|
|
21125
|
+
var init_debug_trail = __esm({
|
|
21126
|
+
"packages/experience-design-system-cli/src/tui/shared/debug-trail.ts"() {
|
|
21127
|
+
"use strict";
|
|
21128
|
+
init_config();
|
|
21129
|
+
DEFAULT_TRAIL_LIMIT = 30;
|
|
21130
|
+
MIN_SECRET_LENGTH = 6;
|
|
21131
|
+
}
|
|
21132
|
+
});
|
|
21133
|
+
|
|
21083
21134
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
21084
21135
|
function credentialsPurpose(tokensOnly) {
|
|
21085
21136
|
const use = tokensOnly ? "We use it to push your design tokens" : "We use it to check what components already exist and to push your import";
|
|
@@ -21093,17 +21144,42 @@ function normalize(values) {
|
|
|
21093
21144
|
host: toConfiguredHost2(values.host) ?? DEFAULT_CONFIGURED_HOST
|
|
21094
21145
|
};
|
|
21095
21146
|
}
|
|
21096
|
-
function
|
|
21097
|
-
return
|
|
21147
|
+
function missingFields(values) {
|
|
21148
|
+
return ["spaceId", "environmentId", "cmaToken"].filter((field) => values[field] === "");
|
|
21098
21149
|
}
|
|
21099
21150
|
function isUnchanged(current, initial) {
|
|
21100
21151
|
return FIELDS.every((field) => current[field] === initial[field]);
|
|
21101
21152
|
}
|
|
21153
|
+
function rejectedAttempt(reason, credentials) {
|
|
21154
|
+
return { host: credentials.host, reason: scrubError(reason, [credentials.cmaToken]) };
|
|
21155
|
+
}
|
|
21156
|
+
function credentialsLog(credentials) {
|
|
21157
|
+
return {
|
|
21158
|
+
space_id: credentials.spaceId,
|
|
21159
|
+
environment_id: credentials.environmentId,
|
|
21160
|
+
host: credentials.host,
|
|
21161
|
+
cma_token: credentials.cmaToken
|
|
21162
|
+
};
|
|
21163
|
+
}
|
|
21164
|
+
function credentialsOutputs({
|
|
21165
|
+
outcome,
|
|
21166
|
+
credentials,
|
|
21167
|
+
initial,
|
|
21168
|
+
attempts
|
|
21169
|
+
}) {
|
|
21170
|
+
return {
|
|
21171
|
+
outcome,
|
|
21172
|
+
...credentialsLog(credentials),
|
|
21173
|
+
changed_fields: diffSnapshots(initial, credentials).changed_fields,
|
|
21174
|
+
rejected_attempts: attempts
|
|
21175
|
+
};
|
|
21176
|
+
}
|
|
21102
21177
|
var FIELDS;
|
|
21103
21178
|
var init_logic8 = __esm({
|
|
21104
21179
|
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
|
|
21105
21180
|
"use strict";
|
|
21106
21181
|
init_src3();
|
|
21182
|
+
init_debug_trail();
|
|
21107
21183
|
FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
21108
21184
|
}
|
|
21109
21185
|
});
|
|
@@ -21156,10 +21232,11 @@ var init_validate4 = __esm({
|
|
|
21156
21232
|
});
|
|
21157
21233
|
|
|
21158
21234
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
21159
|
-
import { useRef as useRef5, useState as useState9 } from "react";
|
|
21235
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
|
|
21160
21236
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
21161
21237
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21162
21238
|
function CredentialsScreen({
|
|
21239
|
+
mode,
|
|
21163
21240
|
onDone,
|
|
21164
21241
|
onBack,
|
|
21165
21242
|
initial = {},
|
|
@@ -21182,17 +21259,64 @@ function CredentialsScreen({
|
|
|
21182
21259
|
const [focus, setFocus] = useState9(0);
|
|
21183
21260
|
const [active, setActive] = useState9(0);
|
|
21184
21261
|
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
21262
|
+
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
21263
|
+
useEffect8(() => {
|
|
21264
|
+
startDebugRun({
|
|
21265
|
+
flow: "import/credentials",
|
|
21266
|
+
step: "04-credentials",
|
|
21267
|
+
menuOption: "Credentials",
|
|
21268
|
+
inputs: { import_mode: mode, prefilled, ...credentialsLog(initialValues) }
|
|
21269
|
+
});
|
|
21270
|
+
}, []);
|
|
21271
|
+
const reject = (attempt, text) => {
|
|
21272
|
+
if (visit.attempts.length < MAX_LOGGED_ATTEMPTS2) visit.attempts.push(attempt);
|
|
21273
|
+
visit.lastReason = attempt.reason;
|
|
21274
|
+
setNotice({ kind: "error", text });
|
|
21275
|
+
};
|
|
21276
|
+
const leave = () => {
|
|
21277
|
+
void finishDebugRun({
|
|
21278
|
+
outputs: {
|
|
21279
|
+
...credentialsOutputs({
|
|
21280
|
+
outcome: "back",
|
|
21281
|
+
credentials: normalize(values),
|
|
21282
|
+
initial: initialValues,
|
|
21283
|
+
attempts: visit.attempts
|
|
21284
|
+
}),
|
|
21285
|
+
...notice ? { error: visit.lastReason } : {}
|
|
21286
|
+
},
|
|
21287
|
+
status: notice ? "error" : "success",
|
|
21288
|
+
exitMethod: "discarded"
|
|
21289
|
+
});
|
|
21290
|
+
onBack();
|
|
21291
|
+
};
|
|
21185
21292
|
const submit = async () => {
|
|
21186
21293
|
const credentials = normalize(values);
|
|
21187
|
-
|
|
21188
|
-
|
|
21294
|
+
const missing = missingFields(credentials);
|
|
21295
|
+
if (missing.length > 0) {
|
|
21296
|
+
reject(
|
|
21297
|
+
rejectedAttempt(`Missing required fields: ${missing.join(", ")}`, credentials),
|
|
21298
|
+
"Space ID, environment and CMA token are all required."
|
|
21299
|
+
);
|
|
21189
21300
|
return;
|
|
21190
21301
|
}
|
|
21191
21302
|
setValidating(true);
|
|
21192
21303
|
const result = await validate3(credentials);
|
|
21193
21304
|
setValidating(false);
|
|
21194
|
-
if (result.ok)
|
|
21195
|
-
|
|
21305
|
+
if (!result.ok) {
|
|
21306
|
+
reject(rejectedAttempt(result.error, credentials), result.error);
|
|
21307
|
+
return;
|
|
21308
|
+
}
|
|
21309
|
+
void finishDebugRun({
|
|
21310
|
+
outputs: credentialsOutputs({
|
|
21311
|
+
outcome: "validated",
|
|
21312
|
+
credentials,
|
|
21313
|
+
initial: initialValues,
|
|
21314
|
+
attempts: visit.attempts
|
|
21315
|
+
}),
|
|
21316
|
+
status: "success",
|
|
21317
|
+
exitMethod: "saved"
|
|
21318
|
+
});
|
|
21319
|
+
onDone({ skipped: false, credentials });
|
|
21196
21320
|
};
|
|
21197
21321
|
const choose = (choice) => {
|
|
21198
21322
|
if (choice === "continue") void submit();
|
|
@@ -21201,7 +21325,7 @@ function CredentialsScreen({
|
|
|
21201
21325
|
setBeforeEdit(values);
|
|
21202
21326
|
setActive(0);
|
|
21203
21327
|
setEditing(true);
|
|
21204
|
-
} else
|
|
21328
|
+
} else leave();
|
|
21205
21329
|
};
|
|
21206
21330
|
const stopEditing = () => {
|
|
21207
21331
|
setEditing(false);
|
|
@@ -21211,7 +21335,7 @@ function CredentialsScreen({
|
|
|
21211
21335
|
if (validating) return;
|
|
21212
21336
|
if (editing) {
|
|
21213
21337
|
if (key.escape) {
|
|
21214
|
-
if (!prefilled)
|
|
21338
|
+
if (!prefilled) leave();
|
|
21215
21339
|
else {
|
|
21216
21340
|
setValues(beforeEdit);
|
|
21217
21341
|
setNotice(null);
|
|
@@ -21317,11 +21441,12 @@ function CredentialsScreen({
|
|
|
21317
21441
|
] })
|
|
21318
21442
|
] });
|
|
21319
21443
|
}
|
|
21320
|
-
var FIELDS2, MENU;
|
|
21444
|
+
var FIELDS2, MENU, MAX_LOGGED_ATTEMPTS2;
|
|
21321
21445
|
var init_screen5 = __esm({
|
|
21322
21446
|
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
|
|
21323
21447
|
"use strict";
|
|
21324
21448
|
init_theme();
|
|
21449
|
+
init_debug_store();
|
|
21325
21450
|
init_FieldForm();
|
|
21326
21451
|
init_ClearableTextInput();
|
|
21327
21452
|
init_ControlHints();
|
|
@@ -21338,10 +21463,52 @@ var init_screen5 = __esm({
|
|
|
21338
21463
|
{ choice: "continue", label: "Continue", description: "Check the credentials and go on" },
|
|
21339
21464
|
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
21340
21465
|
];
|
|
21466
|
+
MAX_LOGGED_ATTEMPTS2 = 10;
|
|
21341
21467
|
}
|
|
21342
21468
|
});
|
|
21343
21469
|
|
|
21344
21470
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts
|
|
21471
|
+
function extractionLogInputs(input) {
|
|
21472
|
+
const { credentials } = input;
|
|
21473
|
+
return {
|
|
21474
|
+
project_path: input.projectPath,
|
|
21475
|
+
out_dir: input.outDir ?? "",
|
|
21476
|
+
files_to_scan: input.filePaths.length,
|
|
21477
|
+
raw_tokens_path: input.rawTokensPath,
|
|
21478
|
+
agent: input.agent,
|
|
21479
|
+
agent_model: input.agentModel ?? "",
|
|
21480
|
+
prompt_overrides: input.promptOverrides,
|
|
21481
|
+
cache: !input.noCache,
|
|
21482
|
+
has_credentials: credentials !== null,
|
|
21483
|
+
space_id: credentials?.spaceId ?? "",
|
|
21484
|
+
environment_id: credentials?.environmentId ?? "",
|
|
21485
|
+
host: credentials?.host ?? "",
|
|
21486
|
+
cma_token: credentials?.cmaToken ?? ""
|
|
21487
|
+
};
|
|
21488
|
+
}
|
|
21489
|
+
function extractionLogOutputs(result, progress, cmaToken) {
|
|
21490
|
+
const last = progress ? { final_progress: progress } : {};
|
|
21491
|
+
if (!result.ok) {
|
|
21492
|
+
return {
|
|
21493
|
+
outputs: { result: "failed", failed_step: result.step, error: scrubError(result.message, [cmaToken]), ...last },
|
|
21494
|
+
status: "error"
|
|
21495
|
+
};
|
|
21496
|
+
}
|
|
21497
|
+
const { extraction } = result;
|
|
21498
|
+
return {
|
|
21499
|
+
outputs: {
|
|
21500
|
+
result: "done",
|
|
21501
|
+
session_id: extraction.sessionId,
|
|
21502
|
+
out_dir: extraction.outDir,
|
|
21503
|
+
tokens_path: extraction.tokensPath,
|
|
21504
|
+
token_count: extraction.tokenCount,
|
|
21505
|
+
existing_entities_status: extraction.existingEntitiesStatus,
|
|
21506
|
+
composition_phase: extraction.compositionPhase,
|
|
21507
|
+
...last
|
|
21508
|
+
},
|
|
21509
|
+
status: "success"
|
|
21510
|
+
};
|
|
21511
|
+
}
|
|
21345
21512
|
function initialProgress(input) {
|
|
21346
21513
|
return {
|
|
21347
21514
|
scan: null,
|
|
@@ -21425,6 +21592,7 @@ var init_logic9 = __esm({
|
|
|
21425
21592
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts"() {
|
|
21426
21593
|
"use strict";
|
|
21427
21594
|
init_src3();
|
|
21595
|
+
init_debug_trail();
|
|
21428
21596
|
}
|
|
21429
21597
|
});
|
|
21430
21598
|
|
|
@@ -21512,7 +21680,7 @@ var init_load = __esm({
|
|
|
21512
21680
|
});
|
|
21513
21681
|
|
|
21514
21682
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
21515
|
-
import { useMemo as useMemo2, useState as useState10 } from "react";
|
|
21683
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState10 } from "react";
|
|
21516
21684
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
21517
21685
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21518
21686
|
function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
@@ -21520,12 +21688,31 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
21520
21688
|
const rows = loaded.ok ? loaded.rows : [];
|
|
21521
21689
|
const columns = useTerminalWidth();
|
|
21522
21690
|
const [selected, setSelected] = useState10(0);
|
|
21691
|
+
useEffect9(() => {
|
|
21692
|
+
startDebugRun({
|
|
21693
|
+
flow: "import/token-review",
|
|
21694
|
+
step: "05-token-review",
|
|
21695
|
+
menuOption: "Token review",
|
|
21696
|
+
inputs: { import_mode: "tokens", tokens_path: tokensPath }
|
|
21697
|
+
});
|
|
21698
|
+
}, []);
|
|
21699
|
+
const finish = (outcome) => {
|
|
21700
|
+
void finishDebugRun({
|
|
21701
|
+
outputs: { outcome, ...loaded.ok ? { tokens: rows.length } : { load_error: loaded.message } },
|
|
21702
|
+
status: loaded.ok ? "success" : "error",
|
|
21703
|
+
exitMethod: outcome === "continued" ? "saved" : "discarded"
|
|
21704
|
+
});
|
|
21705
|
+
};
|
|
21523
21706
|
const move = (to) => setSelected(Math.max(0, Math.min(to, rows.length - 1)));
|
|
21524
21707
|
const { start, end } = computeColumnWindow(rows.length, selected, VISIBLE_ROWS);
|
|
21525
21708
|
useInput12((_input, key) => {
|
|
21526
|
-
if (key.return)
|
|
21527
|
-
|
|
21528
|
-
|
|
21709
|
+
if (key.return) {
|
|
21710
|
+
finish("continued");
|
|
21711
|
+
onContinue();
|
|
21712
|
+
} else if (key.escape) {
|
|
21713
|
+
finish("back");
|
|
21714
|
+
onQuit();
|
|
21715
|
+
} else if (key.upArrow) move(selected - 1);
|
|
21529
21716
|
else if (key.downArrow) move(selected + 1);
|
|
21530
21717
|
else if (key.pageUp) move(selected - VISIBLE_ROWS);
|
|
21531
21718
|
else if (key.pageDown) move(selected + VISIBLE_ROWS);
|
|
@@ -21589,6 +21776,7 @@ var init_screen7 = __esm({
|
|
|
21589
21776
|
"packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx"() {
|
|
21590
21777
|
"use strict";
|
|
21591
21778
|
init_theme();
|
|
21779
|
+
init_debug_store();
|
|
21592
21780
|
init_ControlHints();
|
|
21593
21781
|
init_StepHeader();
|
|
21594
21782
|
init_use_terminal_width();
|
|
@@ -21614,7 +21802,7 @@ var init_steps = __esm({
|
|
|
21614
21802
|
});
|
|
21615
21803
|
|
|
21616
21804
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21617
|
-
import { existsSync as
|
|
21805
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
21618
21806
|
import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
|
|
21619
21807
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21620
21808
|
function findSkillPath(fileName) {
|
|
@@ -21622,7 +21810,7 @@ function findSkillPath(fileName) {
|
|
|
21622
21810
|
let dir = thisDir;
|
|
21623
21811
|
for (; ; ) {
|
|
21624
21812
|
const candidate = join20(dir, "skills", fileName);
|
|
21625
|
-
if (
|
|
21813
|
+
if (existsSync11(candidate)) return candidate;
|
|
21626
21814
|
const parent = resolve22(dir, "..");
|
|
21627
21815
|
if (parent === dir) {
|
|
21628
21816
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
@@ -21886,11 +22074,11 @@ var init_run = __esm({
|
|
|
21886
22074
|
});
|
|
21887
22075
|
|
|
21888
22076
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
21889
|
-
import { useEffect as
|
|
22077
|
+
import { useEffect as useEffect10, useRef as useRef6, useState as useState11 } from "react";
|
|
21890
22078
|
function useExtraction(input) {
|
|
21891
22079
|
const [state2, setState] = useState11();
|
|
21892
22080
|
const current = useRef6();
|
|
21893
|
-
|
|
22081
|
+
useEffect10(() => {
|
|
21894
22082
|
current.current = input;
|
|
21895
22083
|
if (!input) {
|
|
21896
22084
|
setState(void 0);
|
|
@@ -21903,10 +22091,23 @@ function useExtraction(input) {
|
|
|
21903
22091
|
hasRawTokens: input.rawTokensPath !== ""
|
|
21904
22092
|
})
|
|
21905
22093
|
});
|
|
22094
|
+
let lastProgress;
|
|
22095
|
+
startDebugRun({
|
|
22096
|
+
flow: "import/extraction",
|
|
22097
|
+
step: "06-extraction",
|
|
22098
|
+
menuOption: "Extraction",
|
|
22099
|
+
inputs: extractionLogInputs(input)
|
|
22100
|
+
});
|
|
21906
22101
|
void runExtraction(input, (progress) => {
|
|
22102
|
+
lastProgress = progress;
|
|
21907
22103
|
if (current.current === input) setState({ status: "running", progress });
|
|
21908
22104
|
}).then((result) => {
|
|
21909
|
-
if (current.current
|
|
22105
|
+
if (current.current !== input) return;
|
|
22106
|
+
void finishDebugRun({
|
|
22107
|
+
...extractionLogOutputs(result, lastProgress, input.credentials?.cmaToken ?? ""),
|
|
22108
|
+
exitMethod: result.ok ? "saved" : "discarded"
|
|
22109
|
+
});
|
|
22110
|
+
setState({ status: "done", result });
|
|
21910
22111
|
});
|
|
21911
22112
|
return () => {
|
|
21912
22113
|
if (current.current === input) current.current = void 0;
|
|
@@ -21917,6 +22118,7 @@ function useExtraction(input) {
|
|
|
21917
22118
|
var init_use_extraction = __esm({
|
|
21918
22119
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts"() {
|
|
21919
22120
|
"use strict";
|
|
22121
|
+
init_debug_store();
|
|
21920
22122
|
init_logic9();
|
|
21921
22123
|
init_run();
|
|
21922
22124
|
}
|
|
@@ -21961,11 +22163,11 @@ var init_run_tokens_only = __esm({
|
|
|
21961
22163
|
});
|
|
21962
22164
|
|
|
21963
22165
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
21964
|
-
import { useEffect as
|
|
22166
|
+
import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
|
|
21965
22167
|
function useTokensOnly(input) {
|
|
21966
22168
|
const [state2, setState] = useState12();
|
|
21967
22169
|
const current = useRef7();
|
|
21968
|
-
|
|
22170
|
+
useEffect11(() => {
|
|
21969
22171
|
current.current = input;
|
|
21970
22172
|
if (!input) {
|
|
21971
22173
|
setState(void 0);
|
|
@@ -21988,6 +22190,39 @@ var init_use_tokens_only = __esm({
|
|
|
21988
22190
|
}
|
|
21989
22191
|
});
|
|
21990
22192
|
|
|
22193
|
+
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts
|
|
22194
|
+
function scopeGateLogInputs(components, tokenCount) {
|
|
22195
|
+
const ai = { accepted: 0, rejected: 0, failed: 0, none: 0 };
|
|
22196
|
+
for (const component of components) ai[component.aiDecision ?? "none"] += 1;
|
|
22197
|
+
return {
|
|
22198
|
+
components_found: components.length,
|
|
22199
|
+
ai_suggestions: ai,
|
|
22200
|
+
needs_review: components.filter((component) => component.needsReview === true).length,
|
|
22201
|
+
tokens: tokenCount
|
|
22202
|
+
};
|
|
22203
|
+
}
|
|
22204
|
+
function scopeGateLogOutputs(components, decisions) {
|
|
22205
|
+
const suggested = new Map(components.map((component) => [component.name, component.aiDecision]));
|
|
22206
|
+
return {
|
|
22207
|
+
outcome: "continued",
|
|
22208
|
+
accepted: new Set(decisions.accepted).size,
|
|
22209
|
+
rejected: new Set(decisions.rejected).size,
|
|
22210
|
+
accepted_although_ai_rejected: capped(decisions.accepted.filter((name) => suggested.get(name) === "rejected")),
|
|
22211
|
+
not_accepted_although_ai_accepted: capped(decisions.rejected.filter((name) => suggested.get(name) === "accepted"))
|
|
22212
|
+
};
|
|
22213
|
+
}
|
|
22214
|
+
var MAX_NAMES, capped;
|
|
22215
|
+
var init_log = __esm({
|
|
22216
|
+
"packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts"() {
|
|
22217
|
+
"use strict";
|
|
22218
|
+
MAX_NAMES = 20;
|
|
22219
|
+
capped = (names) => {
|
|
22220
|
+
const unique = [...new Set(names)];
|
|
22221
|
+
return { count: unique.length, names: unique.slice(0, MAX_NAMES) };
|
|
22222
|
+
};
|
|
22223
|
+
}
|
|
22224
|
+
});
|
|
22225
|
+
|
|
21991
22226
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/components/windowed-panel.tsx
|
|
21992
22227
|
import { Box as Box16, Text as Text16 } from "ink";
|
|
21993
22228
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -23242,7 +23477,7 @@ var init_useImmediateInput = __esm({
|
|
|
23242
23477
|
|
|
23243
23478
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
23244
23479
|
import { useStdout as useStdout2 } from "ink";
|
|
23245
|
-
import { useEffect as
|
|
23480
|
+
import { useEffect as useEffect12, useState as useState13 } from "react";
|
|
23246
23481
|
function readTerminalSize(stdout) {
|
|
23247
23482
|
return {
|
|
23248
23483
|
columns: stdout?.columns ?? 80,
|
|
@@ -23252,7 +23487,7 @@ function readTerminalSize(stdout) {
|
|
|
23252
23487
|
function useTerminalSize() {
|
|
23253
23488
|
const { stdout } = useStdout2();
|
|
23254
23489
|
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
23255
|
-
|
|
23490
|
+
useEffect12(() => {
|
|
23256
23491
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
23257
23492
|
stdout?.on("resize", updateSize);
|
|
23258
23493
|
updateSize();
|
|
@@ -24254,7 +24489,7 @@ var init_state = __esm({
|
|
|
24254
24489
|
});
|
|
24255
24490
|
|
|
24256
24491
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
24257
|
-
import { useEffect as
|
|
24492
|
+
import { useEffect as useEffect13, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
|
|
24258
24493
|
function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
|
|
24259
24494
|
const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
|
|
24260
24495
|
const columnPlan = useMemo3(
|
|
@@ -24301,7 +24536,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24301
24536
|
return seed;
|
|
24302
24537
|
});
|
|
24303
24538
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
24304
|
-
|
|
24539
|
+
useEffect13(() => {
|
|
24305
24540
|
if (seededGroupsRef.current) return;
|
|
24306
24541
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
24307
24542
|
seededGroupsRef.current = true;
|
|
@@ -24392,7 +24627,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24392
24627
|
entryCount: 0
|
|
24393
24628
|
});
|
|
24394
24629
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
24395
|
-
|
|
24630
|
+
useEffect13(() => {
|
|
24396
24631
|
setNav((prev) => {
|
|
24397
24632
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
24398
24633
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -24737,27 +24972,59 @@ var init_use_scope_gate = __esm({
|
|
|
24737
24972
|
});
|
|
24738
24973
|
|
|
24739
24974
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
24740
|
-
import { useMemo as useMemo4 } from "react";
|
|
24975
|
+
import { useEffect as useEffect14, useMemo as useMemo4 } from "react";
|
|
24741
24976
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
24742
24977
|
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24743
24978
|
function ScopeGateScreen(props) {
|
|
24744
|
-
if (props.components.length === 0) {
|
|
24745
|
-
return /* @__PURE__ */ jsx29(Box25, { paddingX: 2, paddingY: 1, children: /* @__PURE__ */ jsx29(Text26, { color: PALETTE.error, children: "Error: no components found for this session \u2014 please re-run analyze extract." }) });
|
|
24746
|
-
}
|
|
24979
|
+
if (props.components.length === 0) return /* @__PURE__ */ jsx29(NoComponents, {});
|
|
24747
24980
|
return /* @__PURE__ */ jsx29(ScopeGateView, { ...props });
|
|
24748
24981
|
}
|
|
24982
|
+
function NoComponents() {
|
|
24983
|
+
useEffect14(() => {
|
|
24984
|
+
startDebugRun({
|
|
24985
|
+
flow: "import/scope-gate",
|
|
24986
|
+
step: "07-scope-gate",
|
|
24987
|
+
menuOption: "Scope gate",
|
|
24988
|
+
inputs: scopeGateLogInputs([], 0)
|
|
24989
|
+
});
|
|
24990
|
+
void finishDebugRun({
|
|
24991
|
+
outputs: { outcome: "nothing to decide", error: "No components were found for this session." },
|
|
24992
|
+
status: "error",
|
|
24993
|
+
exitMethod: "discarded"
|
|
24994
|
+
});
|
|
24995
|
+
}, []);
|
|
24996
|
+
return /* @__PURE__ */ jsx29(Box25, { paddingX: 2, paddingY: 1, children: /* @__PURE__ */ jsx29(Text26, { color: PALETTE.error, children: "Error: no components found for this session \u2014 please re-run analyze extract." }) });
|
|
24997
|
+
}
|
|
24749
24998
|
function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
|
|
24750
24999
|
const tokens = useMemo4(() => {
|
|
24751
25000
|
const loaded = tokensPath ? loadTokenRows(tokensPath) : void 0;
|
|
24752
25001
|
return loaded?.ok ? loaded.rows : [];
|
|
24753
25002
|
}, [tokensPath]);
|
|
24754
25003
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
25004
|
+
useEffect14(() => {
|
|
25005
|
+
startDebugRun({
|
|
25006
|
+
flow: "import/scope-gate",
|
|
25007
|
+
step: "07-scope-gate",
|
|
25008
|
+
menuOption: "Scope gate",
|
|
25009
|
+
inputs: scopeGateLogInputs(components, tokens.length)
|
|
25010
|
+
});
|
|
25011
|
+
}, []);
|
|
24755
25012
|
const gate = useScopeGate({
|
|
24756
25013
|
components,
|
|
24757
25014
|
tokenCount: tokens.length,
|
|
24758
25015
|
tokensWidth: longest.path + longest.value + 10,
|
|
24759
|
-
onConfirm
|
|
24760
|
-
|
|
25016
|
+
onConfirm: (decisions) => {
|
|
25017
|
+
void finishDebugRun({
|
|
25018
|
+
outputs: scopeGateLogOutputs(components, decisions),
|
|
25019
|
+
status: "success",
|
|
25020
|
+
exitMethod: "saved"
|
|
25021
|
+
});
|
|
25022
|
+
onConfirm(decisions);
|
|
25023
|
+
},
|
|
25024
|
+
onQuit: () => {
|
|
25025
|
+
void finishDebugRun({ outputs: { outcome: "quit" }, status: "success", exitMethod: "discarded" });
|
|
25026
|
+
onQuit();
|
|
25027
|
+
}
|
|
24761
25028
|
});
|
|
24762
25029
|
const { search, graph, columnPlan, panelLayout, counters } = gate;
|
|
24763
25030
|
if (gate.showHelp) {
|
|
@@ -24857,7 +25124,9 @@ var HELP_SECTIONS;
|
|
|
24857
25124
|
var init_screen8 = __esm({
|
|
24858
25125
|
"packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx"() {
|
|
24859
25126
|
"use strict";
|
|
25127
|
+
init_debug_store();
|
|
24860
25128
|
init_StepHeader();
|
|
25129
|
+
init_log();
|
|
24861
25130
|
init_tokens_column();
|
|
24862
25131
|
init_load();
|
|
24863
25132
|
init_logic10();
|
|
@@ -24965,13 +25234,27 @@ var init_load2 = __esm({
|
|
|
24965
25234
|
});
|
|
24966
25235
|
|
|
24967
25236
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
24968
|
-
import { useEffect as
|
|
25237
|
+
import { useEffect as useEffect15, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
|
|
24969
25238
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
24970
25239
|
const sessionId = input?.sessionId;
|
|
24971
25240
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
24972
25241
|
const cacheCheck = useRef10(void 0);
|
|
24973
25242
|
const [confirmed, setConfirmed] = useState17();
|
|
24974
|
-
|
|
25243
|
+
useEffect15(() => {
|
|
25244
|
+
if (!sessionId || !loaded || loaded.ok) return;
|
|
25245
|
+
startDebugRun({
|
|
25246
|
+
flow: "import/scope-gate",
|
|
25247
|
+
step: "07-scope-gate",
|
|
25248
|
+
menuOption: "Scope gate",
|
|
25249
|
+
inputs: { session_id: sessionId }
|
|
25250
|
+
});
|
|
25251
|
+
void finishDebugRun({
|
|
25252
|
+
outputs: { outcome: "could not load the components", error: loaded.message },
|
|
25253
|
+
status: "error",
|
|
25254
|
+
exitMethod: "discarded"
|
|
25255
|
+
});
|
|
25256
|
+
}, [sessionId, loaded]);
|
|
25257
|
+
useEffect15(() => {
|
|
24975
25258
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
24976
25259
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
24977
25260
|
}, [input, loaded]);
|
|
@@ -24985,6 +25268,7 @@ var realDeps3;
|
|
|
24985
25268
|
var init_use_scope_gate_flow = __esm({
|
|
24986
25269
|
"packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts"() {
|
|
24987
25270
|
"use strict";
|
|
25271
|
+
init_debug_store();
|
|
24988
25272
|
init_cache_check();
|
|
24989
25273
|
init_load2();
|
|
24990
25274
|
realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
|
|
@@ -24992,6 +25276,41 @@ var init_use_scope_gate_flow = __esm({
|
|
|
24992
25276
|
});
|
|
24993
25277
|
|
|
24994
25278
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/logic.ts
|
|
25279
|
+
function generationLogInputs(input) {
|
|
25280
|
+
return {
|
|
25281
|
+
session_id: input.sessionId,
|
|
25282
|
+
accepted: input.decisions.accepted.length,
|
|
25283
|
+
rejected: input.decisions.rejected.length,
|
|
25284
|
+
tokens_path: input.tokensPath,
|
|
25285
|
+
token_session_id: input.tokenSessionId,
|
|
25286
|
+
existing_entities_path: input.existingEntitiesPath,
|
|
25287
|
+
agent: input.agent,
|
|
25288
|
+
agent_model: input.agentModel ?? "",
|
|
25289
|
+
prompt_overrides: input.promptOverrides,
|
|
25290
|
+
generate_prompt_path: input.generatePromptPath ?? "",
|
|
25291
|
+
cache: !input.noCache,
|
|
25292
|
+
has_tokens: input.hasTokens
|
|
25293
|
+
};
|
|
25294
|
+
}
|
|
25295
|
+
function generationLogOutputs(result, progress) {
|
|
25296
|
+
const last = progress ? { final_progress: progress } : {};
|
|
25297
|
+
if (!result.ok) {
|
|
25298
|
+
return { outputs: { result: "failed", failed_step: result.step, error: result.message, ...last }, status: "error" };
|
|
25299
|
+
}
|
|
25300
|
+
const { generation } = result;
|
|
25301
|
+
return {
|
|
25302
|
+
outputs: generation.route === "review" ? {
|
|
25303
|
+
result: "done",
|
|
25304
|
+
route: generation.route,
|
|
25305
|
+
session_id: generation.sessionId,
|
|
25306
|
+
accepted: generation.acceptedCount,
|
|
25307
|
+
generated: generation.generatedCount,
|
|
25308
|
+
map_tokens_eligible: generation.mapTokensEligible,
|
|
25309
|
+
...last
|
|
25310
|
+
} : { result: "done", route: generation.route, accepted: generation.acceptedCount, ...last },
|
|
25311
|
+
status: "success"
|
|
25312
|
+
};
|
|
25313
|
+
}
|
|
24995
25314
|
function initialProgress2() {
|
|
24996
25315
|
return { components: null, mapTokens: "idle", mapTokensEligible: null };
|
|
24997
25316
|
}
|
|
@@ -25242,21 +25561,34 @@ var init_run2 = __esm({
|
|
|
25242
25561
|
});
|
|
25243
25562
|
|
|
25244
25563
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
25245
|
-
import { useEffect as
|
|
25564
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState18 } from "react";
|
|
25246
25565
|
function useGeneration(input) {
|
|
25247
25566
|
const [state2, setState] = useState18();
|
|
25248
25567
|
const current = useRef11();
|
|
25249
|
-
|
|
25568
|
+
useEffect16(() => {
|
|
25250
25569
|
current.current = input;
|
|
25251
25570
|
if (!input) {
|
|
25252
25571
|
setState(void 0);
|
|
25253
25572
|
return;
|
|
25254
25573
|
}
|
|
25255
25574
|
setState({ status: "running", progress: initialProgress2() });
|
|
25575
|
+
let lastProgress;
|
|
25576
|
+
startDebugRun({
|
|
25577
|
+
flow: "import/generation",
|
|
25578
|
+
step: "08-generation",
|
|
25579
|
+
menuOption: "Generation",
|
|
25580
|
+
inputs: generationLogInputs(input)
|
|
25581
|
+
});
|
|
25256
25582
|
void runGeneration(input, (progress) => {
|
|
25583
|
+
lastProgress = progress;
|
|
25257
25584
|
if (current.current === input) setState({ status: "running", progress });
|
|
25258
25585
|
}).then((result) => {
|
|
25259
|
-
if (current.current
|
|
25586
|
+
if (current.current !== input) return;
|
|
25587
|
+
void finishDebugRun({
|
|
25588
|
+
...generationLogOutputs(result, lastProgress),
|
|
25589
|
+
exitMethod: result.ok ? "saved" : "discarded"
|
|
25590
|
+
});
|
|
25591
|
+
setState({ status: "done", result });
|
|
25260
25592
|
});
|
|
25261
25593
|
return () => {
|
|
25262
25594
|
if (current.current === input) current.current = void 0;
|
|
@@ -25267,6 +25599,7 @@ function useGeneration(input) {
|
|
|
25267
25599
|
var init_use_generation = __esm({
|
|
25268
25600
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts"() {
|
|
25269
25601
|
"use strict";
|
|
25602
|
+
init_debug_store();
|
|
25270
25603
|
init_logic11();
|
|
25271
25604
|
init_run2();
|
|
25272
25605
|
}
|
|
@@ -25396,12 +25729,9 @@ var init_schema2 = __esm({
|
|
|
25396
25729
|
$required: { type: "boolean" },
|
|
25397
25730
|
$default: {},
|
|
25398
25731
|
$values: { type: "array", items: { type: "string" } },
|
|
25399
|
-
"$token.kind": { type: "string"
|
|
25732
|
+
"$token.kind": { type: "string" },
|
|
25400
25733
|
"$token.allowed": { type: "array", items: { type: "string" } }
|
|
25401
25734
|
},
|
|
25402
|
-
// The API rejects a token property that does not say which kind of token it takes.
|
|
25403
|
-
if: { type: "object", properties: { $type: { const: "token" } }, required: ["$type"] },
|
|
25404
|
-
then: { type: "object", required: ["$token.kind"] },
|
|
25405
25735
|
additionalProperties: false
|
|
25406
25736
|
},
|
|
25407
25737
|
slot: {
|
|
@@ -25460,40 +25790,14 @@ function parseCDFComponents(obj, prefix = "") {
|
|
|
25460
25790
|
}
|
|
25461
25791
|
return { components, tokens };
|
|
25462
25792
|
}
|
|
25463
|
-
function entryValidator(name) {
|
|
25464
|
-
const check = ajv2.getSchema(`${CDF_SCHEMA_URL2}#/definitions/${name}`);
|
|
25465
|
-
if (!check)
|
|
25466
|
-
throw new Error(`the CDF schema has no "${name}" definition`);
|
|
25467
|
-
return check;
|
|
25468
|
-
}
|
|
25469
|
-
function toValidationErrors(errors, prefix = "") {
|
|
25470
|
-
return (errors ?? []).filter((err) => err.keyword !== "if").map((err) => ({
|
|
25471
|
-
path: `${prefix}${err.instancePath}` || "/",
|
|
25472
|
-
message: err.message ?? "Unknown validation error",
|
|
25473
|
-
expected: err.params ? JSON.stringify(err.params) : void 0
|
|
25474
|
-
}));
|
|
25475
|
-
}
|
|
25476
|
-
function entryErrors(node, prefix) {
|
|
25477
|
-
const errors = [];
|
|
25478
|
-
for (const [key, value] of Object.entries(node)) {
|
|
25479
|
-
if (key.startsWith("$") || typeof value !== "object" || value === null)
|
|
25480
|
-
continue;
|
|
25481
|
-
const path5 = `${prefix}/${key}`;
|
|
25482
|
-
const type = value["$type"];
|
|
25483
|
-
const check = type === "component" ? validateComponentEntry : TOKEN_TYPE_SET3.has(type) ? validateTokenEntry : void 0;
|
|
25484
|
-
if (!check) {
|
|
25485
|
-
errors.push(...entryErrors(value, path5));
|
|
25486
|
-
} else if (!check(value)) {
|
|
25487
|
-
errors.push(...toValidationErrors(check.errors, path5));
|
|
25488
|
-
}
|
|
25489
|
-
}
|
|
25490
|
-
return errors;
|
|
25491
|
-
}
|
|
25492
25793
|
function validateCDF2(input) {
|
|
25493
25794
|
const valid = validate2(input);
|
|
25494
25795
|
if (!valid) {
|
|
25495
|
-
const
|
|
25496
|
-
|
|
25796
|
+
const errors = (validate2.errors ?? []).map((err) => ({
|
|
25797
|
+
path: err.instancePath || "/",
|
|
25798
|
+
message: err.message ?? "Unknown validation error",
|
|
25799
|
+
expected: err.params ? JSON.stringify(err.params) : void 0
|
|
25800
|
+
}));
|
|
25497
25801
|
return { valid: false, errors, components: [], tokens: [] };
|
|
25498
25802
|
}
|
|
25499
25803
|
const file = input;
|
|
@@ -25515,7 +25819,7 @@ function validateCDF2(input) {
|
|
|
25515
25819
|
const { components, tokens } = parseCDFComponents(file);
|
|
25516
25820
|
return { valid: true, errors: [], components, tokens };
|
|
25517
25821
|
}
|
|
25518
|
-
var ajv2, validate2, TOKEN_TYPE_SET3
|
|
25822
|
+
var ajv2, validate2, TOKEN_TYPE_SET3;
|
|
25519
25823
|
var init_validate5 = __esm({
|
|
25520
25824
|
"packages/experience-design-system-types/dist/src/cdf/validate.js"() {
|
|
25521
25825
|
"use strict";
|
|
@@ -25524,8 +25828,6 @@ var init_validate5 = __esm({
|
|
|
25524
25828
|
ajv2 = new Ajv2({ allErrors: true });
|
|
25525
25829
|
validate2 = ajv2.compile(cdfJsonSchema2);
|
|
25526
25830
|
TOKEN_TYPE_SET3 = new Set(DESIGN_TOKEN_TYPES2);
|
|
25527
|
-
validateComponentEntry = entryValidator("component");
|
|
25528
|
-
validateTokenEntry = entryValidator("token");
|
|
25529
25831
|
}
|
|
25530
25832
|
});
|
|
25531
25833
|
|
|
@@ -25566,51 +25868,6 @@ var init_types7 = __esm({
|
|
|
25566
25868
|
}
|
|
25567
25869
|
});
|
|
25568
25870
|
|
|
25569
|
-
// packages/experience-design-system-types/dist/src/cdf/repair-token-kinds.js
|
|
25570
|
-
function inferTokenKind(propName, prop, tokens) {
|
|
25571
|
-
const bound = typeof prop.$default === "string" ? tokens.find(({ path: path5 }) => path5 === prop.$default) : void 0;
|
|
25572
|
-
if (bound)
|
|
25573
|
-
return bound.entry.$type;
|
|
25574
|
-
const name = propName.toLowerCase();
|
|
25575
|
-
const kinds = new Set(tokens.filter(({ path: path5 }) => path5.toLowerCase().split(".").includes(name)).map(({ entry }) => entry.$type));
|
|
25576
|
-
return kinds.size === 1 ? [...kinds][0] : void 0;
|
|
25577
|
-
}
|
|
25578
|
-
function withoutWarning(prop) {
|
|
25579
|
-
if (prop.$description === void 0)
|
|
25580
|
-
return prop;
|
|
25581
|
-
const description = prop.$description.replace(UNRESOLVED_WARNING, "").trim();
|
|
25582
|
-
const { $description: _stale, ...rest } = prop;
|
|
25583
|
-
return description ? { ...rest, $description: description } : rest;
|
|
25584
|
-
}
|
|
25585
|
-
function repairTokenKinds(entry, componentKey, tokens, note) {
|
|
25586
|
-
const properties = { ...entry.$properties };
|
|
25587
|
-
let repaired = false;
|
|
25588
|
-
for (const [name, prop] of Object.entries(entry.$properties)) {
|
|
25589
|
-
if (prop.$type !== "token" || prop["$token.kind"])
|
|
25590
|
-
continue;
|
|
25591
|
-
repaired = true;
|
|
25592
|
-
const kind = inferTokenKind(name, prop, tokens);
|
|
25593
|
-
if (kind) {
|
|
25594
|
-
properties[name] = { ...withoutWarning(prop), "$token.kind": kind };
|
|
25595
|
-
note?.(`${componentKey}.${name} had no token kind, so "${kind}" was taken from the token file`);
|
|
25596
|
-
} else {
|
|
25597
|
-
const plain = { ...withoutWarning(prop), $type: "string" };
|
|
25598
|
-
delete plain["$token.allowed"];
|
|
25599
|
-
delete plain.$default;
|
|
25600
|
-
properties[name] = plain;
|
|
25601
|
-
note?.(`${componentKey}.${name} had no token kind and none could be told, so it was saved as a string property`);
|
|
25602
|
-
}
|
|
25603
|
-
}
|
|
25604
|
-
return repaired ? { ...entry, $properties: properties } : entry;
|
|
25605
|
-
}
|
|
25606
|
-
var UNRESOLVED_WARNING;
|
|
25607
|
-
var init_repair_token_kinds = __esm({
|
|
25608
|
-
"packages/experience-design-system-types/dist/src/cdf/repair-token-kinds.js"() {
|
|
25609
|
-
"use strict";
|
|
25610
|
-
UNRESOLVED_WARNING = /\s*WARNING: token_kind unknown[^\n]*/;
|
|
25611
|
-
}
|
|
25612
|
-
});
|
|
25613
|
-
|
|
25614
25871
|
// packages/experience-design-system-types/dist/src/cdf/build.js
|
|
25615
25872
|
function stripUnsupportedSlotFields(entry) {
|
|
25616
25873
|
if (!entry.$slots)
|
|
@@ -25646,7 +25903,7 @@ function buildCDF2(components, tokens, opts = {}) {
|
|
|
25646
25903
|
return void 0;
|
|
25647
25904
|
const doc = { $schema: CDF_SCHEMA_URL2 };
|
|
25648
25905
|
for (const { key, entry } of components) {
|
|
25649
|
-
setAtPath(doc, key, stripUnsupportedSlotFields(
|
|
25906
|
+
setAtPath(doc, key, stripUnsupportedSlotFields(entry));
|
|
25650
25907
|
}
|
|
25651
25908
|
for (const { path: path5, entry } of resolveTokenPathCollisions(tokens)) {
|
|
25652
25909
|
setAtPath(doc, path5, entry);
|
|
@@ -25688,7 +25945,6 @@ var COLLISION_LEAF_KEY;
|
|
|
25688
25945
|
var init_build2 = __esm({
|
|
25689
25946
|
"packages/experience-design-system-types/dist/src/cdf/build.js"() {
|
|
25690
25947
|
"use strict";
|
|
25691
|
-
init_repair_token_kinds();
|
|
25692
25948
|
init_schema2();
|
|
25693
25949
|
COLLISION_LEAF_KEY = "default";
|
|
25694
25950
|
}
|
|
@@ -26310,7 +26566,7 @@ var init_scroll_offset = __esm({
|
|
|
26310
26566
|
});
|
|
26311
26567
|
|
|
26312
26568
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26313
|
-
import React13, { useEffect as
|
|
26569
|
+
import React13, { useEffect as useEffect17, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
26314
26570
|
import figures6 from "figures";
|
|
26315
26571
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26316
26572
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -27837,7 +28093,7 @@ function FieldEditor({
|
|
|
27837
28093
|
}
|
|
27838
28094
|
return Math.max(start + 1, end2);
|
|
27839
28095
|
};
|
|
27840
|
-
|
|
28096
|
+
useEffect17(() => {
|
|
27841
28097
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
27842
28098
|
setListScrollStart((previous) => {
|
|
27843
28099
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -29232,7 +29488,7 @@ var init_FinalizeDialog = __esm({
|
|
|
29232
29488
|
});
|
|
29233
29489
|
|
|
29234
29490
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
29235
|
-
import { useEffect as
|
|
29491
|
+
import { useEffect as useEffect18, useRef as useRef12, useState as useState20 } from "react";
|
|
29236
29492
|
function useReviewFinalizePreview({
|
|
29237
29493
|
components,
|
|
29238
29494
|
...options
|
|
@@ -29249,7 +29505,7 @@ function useFinalizePreview(opts) {
|
|
|
29249
29505
|
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
29250
29506
|
const generationRef = useRef12(0);
|
|
29251
29507
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
29252
|
-
|
|
29508
|
+
useEffect18(() => {
|
|
29253
29509
|
if (!open) {
|
|
29254
29510
|
setStatus("idle");
|
|
29255
29511
|
setRemoved([]);
|
|
@@ -29301,7 +29557,7 @@ var init_use_finalize_preview = __esm({
|
|
|
29301
29557
|
});
|
|
29302
29558
|
|
|
29303
29559
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
29304
|
-
import { useCallback as useCallback2, useEffect as
|
|
29560
|
+
import { useCallback as useCallback2, useEffect as useEffect19, useRef as useRef13, useState as useState21 } from "react";
|
|
29305
29561
|
function useReviewSession({
|
|
29306
29562
|
loadSession,
|
|
29307
29563
|
tokensPath,
|
|
@@ -29320,7 +29576,7 @@ function useReviewSession({
|
|
|
29320
29576
|
}));
|
|
29321
29577
|
return { result, catalog };
|
|
29322
29578
|
}, [loadSession, tokensPath]);
|
|
29323
|
-
|
|
29579
|
+
useEffect19(() => {
|
|
29324
29580
|
let disposed = false;
|
|
29325
29581
|
void (async () => {
|
|
29326
29582
|
try {
|
|
@@ -29373,7 +29629,7 @@ function useReviewSession({
|
|
|
29373
29629
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29374
29630
|
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
29375
29631
|
const [componentRationale, setComponentRationale] = useState21(null);
|
|
29376
|
-
|
|
29632
|
+
useEffect19(() => {
|
|
29377
29633
|
const current = components[selectedIdx];
|
|
29378
29634
|
if (!current) {
|
|
29379
29635
|
setReviewMetadata(null);
|
|
@@ -29402,10 +29658,16 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
|
29402
29658
|
}, [components, extractSessionId, selectedIdx]);
|
|
29403
29659
|
return { reviewMetadata, componentRationale };
|
|
29404
29660
|
}
|
|
29405
|
-
function useReviewHistory({
|
|
29661
|
+
function useReviewHistory({
|
|
29662
|
+
loading,
|
|
29663
|
+
components,
|
|
29664
|
+
createSnapshot,
|
|
29665
|
+
applySnapshot,
|
|
29666
|
+
onAction
|
|
29667
|
+
}) {
|
|
29406
29668
|
const historyRef = useRef13(null);
|
|
29407
29669
|
const historySeededRef = useRef13(false);
|
|
29408
|
-
|
|
29670
|
+
useEffect19(() => {
|
|
29409
29671
|
if (loading || historySeededRef.current) return;
|
|
29410
29672
|
historySeededRef.current = true;
|
|
29411
29673
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -29413,14 +29675,19 @@ function useReviewHistory({ loading, components, createSnapshot, applySnapshot }
|
|
|
29413
29675
|
const pushHistorySnapshot = (entries, label) => {
|
|
29414
29676
|
if (!historyRef.current) return;
|
|
29415
29677
|
historyRef.current.push(createSnapshot(entries), label);
|
|
29678
|
+
onAction?.(label);
|
|
29416
29679
|
};
|
|
29417
29680
|
const handleUndo = () => {
|
|
29418
29681
|
const snapshot = historyRef.current?.undo();
|
|
29419
|
-
if (snapshot)
|
|
29682
|
+
if (!snapshot) return;
|
|
29683
|
+
applySnapshot(snapshot);
|
|
29684
|
+
onAction?.("undo");
|
|
29420
29685
|
};
|
|
29421
29686
|
const handleRedo = () => {
|
|
29422
29687
|
const snapshot = historyRef.current?.redo();
|
|
29423
|
-
if (snapshot)
|
|
29688
|
+
if (!snapshot) return;
|
|
29689
|
+
applySnapshot(snapshot);
|
|
29690
|
+
onAction?.("redo");
|
|
29424
29691
|
};
|
|
29425
29692
|
const resetHistory = (snapshot) => {
|
|
29426
29693
|
historyRef.current?.reset(snapshot);
|
|
@@ -29487,7 +29754,7 @@ var init_token_suggestions = __esm({
|
|
|
29487
29754
|
});
|
|
29488
29755
|
|
|
29489
29756
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
29490
|
-
import { useEffect as
|
|
29757
|
+
import { useEffect as useEffect20, useRef as useRef14, useState as useState22 } from "react";
|
|
29491
29758
|
function parseReviewEntry(draftValue) {
|
|
29492
29759
|
const parsed = JSON.parse(draftValue);
|
|
29493
29760
|
const keys = Object.keys(parsed);
|
|
@@ -29521,7 +29788,7 @@ function useReviewEditor({
|
|
|
29521
29788
|
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
29522
29789
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
29523
29790
|
const pendingGRef = useRef14(false);
|
|
29524
|
-
|
|
29791
|
+
useEffect20(() => {
|
|
29525
29792
|
setTokenReviewRow(0);
|
|
29526
29793
|
setTokenReviewEditing(false);
|
|
29527
29794
|
setTokenReviewEditCursor(0);
|
|
@@ -30003,7 +30270,7 @@ var init_preview_annotations = __esm({
|
|
|
30003
30270
|
});
|
|
30004
30271
|
|
|
30005
30272
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
30006
|
-
import { useCallback as useCallback3, useEffect as
|
|
30273
|
+
import { useCallback as useCallback3, useEffect as useEffect21, useRef as useRef15, useState as useState24 } from "react";
|
|
30007
30274
|
function useLivePreview(opts) {
|
|
30008
30275
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
30009
30276
|
const [status, setStatus] = useState24("idle");
|
|
@@ -30013,14 +30280,14 @@ function useLivePreview(opts) {
|
|
|
30013
30280
|
const latestRef = useRef15(0);
|
|
30014
30281
|
const inflightRef = useRef15(0);
|
|
30015
30282
|
const optsRef = useRef15(opts);
|
|
30016
|
-
|
|
30283
|
+
useEffect21(() => {
|
|
30017
30284
|
optsRef.current = opts;
|
|
30018
30285
|
});
|
|
30019
30286
|
const disabledRef = useRef15(disabled);
|
|
30020
|
-
|
|
30287
|
+
useEffect21(() => {
|
|
30021
30288
|
disabledRef.current = disabled;
|
|
30022
30289
|
}, [disabled]);
|
|
30023
|
-
|
|
30290
|
+
useEffect21(() => {
|
|
30024
30291
|
return () => {
|
|
30025
30292
|
if (timerRef.current) {
|
|
30026
30293
|
clearTimeout(timerRef.current);
|
|
@@ -30101,7 +30368,7 @@ var init_use_live_preview = __esm({
|
|
|
30101
30368
|
});
|
|
30102
30369
|
|
|
30103
30370
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
30104
|
-
import { useCallback as useCallback4, useEffect as
|
|
30371
|
+
import { useCallback as useCallback4, useEffect as useEffect22, useState as useState25 } from "react";
|
|
30105
30372
|
function useReviewPreview({
|
|
30106
30373
|
components,
|
|
30107
30374
|
loading,
|
|
@@ -30143,13 +30410,13 @@ function useReviewPreview({
|
|
|
30143
30410
|
deleteAllComponents
|
|
30144
30411
|
});
|
|
30145
30412
|
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
30146
|
-
|
|
30413
|
+
useEffect22(() => {
|
|
30147
30414
|
if (livePreviewHook.status !== "running") return;
|
|
30148
30415
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
30149
30416
|
return () => clearInterval(id);
|
|
30150
30417
|
}, [livePreviewHook.status]);
|
|
30151
30418
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
30152
|
-
|
|
30419
|
+
useEffect22(() => {
|
|
30153
30420
|
if (loading) return;
|
|
30154
30421
|
if (!livePreview) return;
|
|
30155
30422
|
if (components.length === 0) return;
|
|
@@ -30167,6 +30434,127 @@ var init_use_review_preview = __esm({
|
|
|
30167
30434
|
}
|
|
30168
30435
|
});
|
|
30169
30436
|
|
|
30437
|
+
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
|
|
30438
|
+
function reviewInputs(components) {
|
|
30439
|
+
return { components: components.length, by_status: countStatuses(components) };
|
|
30440
|
+
}
|
|
30441
|
+
function openReviewTrail(components, now) {
|
|
30442
|
+
return {
|
|
30443
|
+
startedAt: now,
|
|
30444
|
+
start: new Map(components.map((component) => [component.key, component.status])),
|
|
30445
|
+
actions: [],
|
|
30446
|
+
kinds: {}
|
|
30447
|
+
};
|
|
30448
|
+
}
|
|
30449
|
+
function recordReviewAction(trail, label) {
|
|
30450
|
+
const kind = label.split(":")[0] ?? label;
|
|
30451
|
+
trail.kinds[kind] = (trail.kinds[kind] ?? 0) + 1;
|
|
30452
|
+
if (trail.actions.length < MAX_ACTIONS) trail.actions.push(label);
|
|
30453
|
+
}
|
|
30454
|
+
function render(trail, components, now, outcome) {
|
|
30455
|
+
const acceptedByUser = [];
|
|
30456
|
+
const rejectedByUser = [];
|
|
30457
|
+
for (const { key, status } of components) {
|
|
30458
|
+
const was = trail.start.get(key);
|
|
30459
|
+
if (was === status) continue;
|
|
30460
|
+
if (status === "accepted") acceptedByUser.push(key);
|
|
30461
|
+
if (status === "rejected") rejectedByUser.push(key);
|
|
30462
|
+
}
|
|
30463
|
+
const total = Object.values(trail.kinds).reduce((sum, count) => sum + count, 0);
|
|
30464
|
+
return {
|
|
30465
|
+
outcome,
|
|
30466
|
+
seconds: Math.round((now - trail.startedAt) / 100) / 10,
|
|
30467
|
+
edits: { total, by_kind: trail.kinds, in_order: trail.actions },
|
|
30468
|
+
now: countStatuses(components),
|
|
30469
|
+
accepted_by_user: capped2(acceptedByUser),
|
|
30470
|
+
rejected_by_user: capped2(rejectedByUser)
|
|
30471
|
+
};
|
|
30472
|
+
}
|
|
30473
|
+
function reviewProgress(trail, components, now) {
|
|
30474
|
+
return render(trail, components, now, "interrupted");
|
|
30475
|
+
}
|
|
30476
|
+
function reviewFinish(trail, components, now, final) {
|
|
30477
|
+
const outcome = final ? `finalized: ${final.accepted} accepted, ${final.rejected} rejected, ${final.unresolved} unresolved` : "left the review without finishing";
|
|
30478
|
+
return {
|
|
30479
|
+
outputs: render(trail, components, now, outcome),
|
|
30480
|
+
status: "success",
|
|
30481
|
+
exitMethod: final ? "saved" : "discarded"
|
|
30482
|
+
};
|
|
30483
|
+
}
|
|
30484
|
+
var REVIEW_RUN, MAX_ACTIONS, MAX_NAMES2, countStatuses, capped2;
|
|
30485
|
+
var init_review_log = __esm({
|
|
30486
|
+
"packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts"() {
|
|
30487
|
+
"use strict";
|
|
30488
|
+
REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
|
|
30489
|
+
MAX_ACTIONS = 30;
|
|
30490
|
+
MAX_NAMES2 = 20;
|
|
30491
|
+
countStatuses = (components) => {
|
|
30492
|
+
const counts = {};
|
|
30493
|
+
for (const { status } of components) counts[status] = (counts[status] ?? 0) + 1;
|
|
30494
|
+
return counts;
|
|
30495
|
+
};
|
|
30496
|
+
capped2 = (keys) => ({
|
|
30497
|
+
count: keys.length,
|
|
30498
|
+
keys: keys.slice(0, MAX_NAMES2)
|
|
30499
|
+
});
|
|
30500
|
+
}
|
|
30501
|
+
});
|
|
30502
|
+
|
|
30503
|
+
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
30504
|
+
import { useEffect as useEffect23, useRef as useRef16 } from "react";
|
|
30505
|
+
function useReviewLog({
|
|
30506
|
+
loading,
|
|
30507
|
+
loadError,
|
|
30508
|
+
components
|
|
30509
|
+
}) {
|
|
30510
|
+
const trail = useRef16(void 0);
|
|
30511
|
+
const started = useRef16(false);
|
|
30512
|
+
const latest = useRef16(components);
|
|
30513
|
+
latest.current = components;
|
|
30514
|
+
useEffect23(() => {
|
|
30515
|
+
if (loading || started.current) return;
|
|
30516
|
+
started.current = true;
|
|
30517
|
+
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
30518
|
+
if (loadError) {
|
|
30519
|
+
void finishDebugRun({
|
|
30520
|
+
outputs: { outcome: "could not load the components", error: loadError },
|
|
30521
|
+
status: "error",
|
|
30522
|
+
exitMethod: "discarded"
|
|
30523
|
+
});
|
|
30524
|
+
return;
|
|
30525
|
+
}
|
|
30526
|
+
trail.current = openReviewTrail(components, Date.now());
|
|
30527
|
+
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
30528
|
+
}, [loading, loadError, components]);
|
|
30529
|
+
useEffect23(
|
|
30530
|
+
() => () => {
|
|
30531
|
+
const open = trail.current;
|
|
30532
|
+
trail.current = void 0;
|
|
30533
|
+
if (open) void finishDebugRun(reviewFinish(open, latest.current, Date.now(), void 0));
|
|
30534
|
+
},
|
|
30535
|
+
[]
|
|
30536
|
+
);
|
|
30537
|
+
return {
|
|
30538
|
+
record: (label) => {
|
|
30539
|
+
if (!trail.current) return;
|
|
30540
|
+
recordReviewAction(trail.current, label);
|
|
30541
|
+
setDebugRunProgress(reviewProgress(trail.current, latest.current, Date.now()));
|
|
30542
|
+
},
|
|
30543
|
+
finish: (counts) => {
|
|
30544
|
+
const open = trail.current;
|
|
30545
|
+
trail.current = void 0;
|
|
30546
|
+
if (open) void finishDebugRun(reviewFinish(open, latest.current, Date.now(), counts));
|
|
30547
|
+
}
|
|
30548
|
+
};
|
|
30549
|
+
}
|
|
30550
|
+
var init_use_review_log = __esm({
|
|
30551
|
+
"packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts"() {
|
|
30552
|
+
"use strict";
|
|
30553
|
+
init_debug_store();
|
|
30554
|
+
init_review_log();
|
|
30555
|
+
}
|
|
30556
|
+
});
|
|
30557
|
+
|
|
30170
30558
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/LivePreviewSummary.tsx
|
|
30171
30559
|
import { Box as Box37, Text as Text39 } from "ink";
|
|
30172
30560
|
import { jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
@@ -30206,7 +30594,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
30206
30594
|
});
|
|
30207
30595
|
|
|
30208
30596
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
30209
|
-
import { useCallback as useCallback5, useEffect as
|
|
30597
|
+
import { useCallback as useCallback5, useEffect as useEffect24, useMemo as useMemo6, useRef as useRef17, useState as useState26 } from "react";
|
|
30210
30598
|
import figures8 from "figures";
|
|
30211
30599
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
30212
30600
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -30403,6 +30791,7 @@ function GenerateReviewStepView({
|
|
|
30403
30791
|
tokensPath,
|
|
30404
30792
|
onExtraLoaded: setLoadedSlotCycles
|
|
30405
30793
|
});
|
|
30794
|
+
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
30406
30795
|
const [nav, setNav] = useState26({
|
|
30407
30796
|
cursorRowIdx: 0,
|
|
30408
30797
|
sidebarScrollOffset: 0
|
|
@@ -30420,7 +30809,7 @@ function GenerateReviewStepView({
|
|
|
30420
30809
|
setFinalizeError
|
|
30421
30810
|
} = reviewSurface;
|
|
30422
30811
|
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
30423
|
-
const removedBannerDefaultedRef =
|
|
30812
|
+
const removedBannerDefaultedRef = useRef17(false);
|
|
30424
30813
|
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
30425
30814
|
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
30426
30815
|
const cyclePanel = useOverlayPanel({
|
|
@@ -30440,7 +30829,7 @@ function GenerateReviewStepView({
|
|
|
30440
30829
|
const [breakCursor, setBreakCursor] = useState26(0);
|
|
30441
30830
|
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
30442
30831
|
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
30443
|
-
const seededGroupsRef =
|
|
30832
|
+
const seededGroupsRef = useRef17(false);
|
|
30444
30833
|
const {
|
|
30445
30834
|
searchOpen,
|
|
30446
30835
|
setSearchOpen,
|
|
@@ -30464,7 +30853,7 @@ function GenerateReviewStepView({
|
|
|
30464
30853
|
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
30465
30854
|
const [autoRejected, setAutoRejected] = useState26([]);
|
|
30466
30855
|
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
30467
|
-
const autoRejectFiredRef =
|
|
30856
|
+
const autoRejectFiredRef = useRef17(false);
|
|
30468
30857
|
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
30469
30858
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
30470
30859
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
@@ -30496,7 +30885,10 @@ function GenerateReviewStepView({
|
|
|
30496
30885
|
cmaToken,
|
|
30497
30886
|
host,
|
|
30498
30887
|
components,
|
|
30499
|
-
onFinalize
|
|
30888
|
+
onFinalize: (accepted, rejected, unresolved) => {
|
|
30889
|
+
reviewLog.finish({ accepted, rejected, unresolved });
|
|
30890
|
+
onFinalize(accepted, rejected, unresolved);
|
|
30891
|
+
}
|
|
30500
30892
|
});
|
|
30501
30893
|
const recomputeCycles = (currentComponents) => {
|
|
30502
30894
|
try {
|
|
@@ -30527,7 +30919,7 @@ function GenerateReviewStepView({
|
|
|
30527
30919
|
[components]
|
|
30528
30920
|
);
|
|
30529
30921
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
30530
|
-
|
|
30922
|
+
useEffect24(() => {
|
|
30531
30923
|
if (seededGroupsRef.current) return;
|
|
30532
30924
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
30533
30925
|
seededGroupsRef.current = true;
|
|
@@ -30554,7 +30946,7 @@ function GenerateReviewStepView({
|
|
|
30554
30946
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
30555
30947
|
}));
|
|
30556
30948
|
}, [slotCycles, cycleView]);
|
|
30557
|
-
|
|
30949
|
+
useEffect24(() => {
|
|
30558
30950
|
const decision = computeAutoRejectDecision({
|
|
30559
30951
|
loading,
|
|
30560
30952
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -30595,10 +30987,11 @@ function GenerateReviewStepView({
|
|
|
30595
30987
|
autoRejected,
|
|
30596
30988
|
undoSnapshot
|
|
30597
30989
|
}),
|
|
30598
|
-
applySnapshot: applyHistorySnapshot
|
|
30990
|
+
applySnapshot: applyHistorySnapshot,
|
|
30991
|
+
onAction: reviewLog.record
|
|
30599
30992
|
});
|
|
30600
|
-
const autoRejectPushedRef =
|
|
30601
|
-
|
|
30993
|
+
const autoRejectPushedRef = useRef17(false);
|
|
30994
|
+
useEffect24(() => {
|
|
30602
30995
|
if (loading) return;
|
|
30603
30996
|
if (!historySeededRef.current) return;
|
|
30604
30997
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -30682,7 +31075,7 @@ function GenerateReviewStepView({
|
|
|
30682
31075
|
const panelHeight = leftPanelHeight + 2;
|
|
30683
31076
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
30684
31077
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
30685
|
-
|
|
31078
|
+
useEffect24(() => {
|
|
30686
31079
|
if (selectableRowPositions.length === 0) return;
|
|
30687
31080
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
30688
31081
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -31511,6 +31904,7 @@ var init_generate_review_step = __esm({
|
|
|
31511
31904
|
init_ReviewDialogs();
|
|
31512
31905
|
init_review_input();
|
|
31513
31906
|
init_use_review_preview();
|
|
31907
|
+
init_use_review_log();
|
|
31514
31908
|
init_LivePreviewSummary();
|
|
31515
31909
|
HELP_SECTIONS2 = [
|
|
31516
31910
|
{
|
|
@@ -31764,10 +32158,10 @@ var init_path_utils = __esm({
|
|
|
31764
32158
|
});
|
|
31765
32159
|
|
|
31766
32160
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
31767
|
-
import { useEffect as
|
|
32161
|
+
import { useEffect as useEffect25, useState as useState27 } from "react";
|
|
31768
32162
|
function useBlinkingCursor() {
|
|
31769
32163
|
const [visible, setVisible] = useState27(true);
|
|
31770
|
-
|
|
32164
|
+
useEffect25(() => {
|
|
31771
32165
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
31772
32166
|
return () => clearInterval(interval);
|
|
31773
32167
|
}, []);
|
|
@@ -31904,12 +32298,12 @@ var init_produced = __esm({
|
|
|
31904
32298
|
});
|
|
31905
32299
|
|
|
31906
32300
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
31907
|
-
import { useEffect as
|
|
32301
|
+
import { useEffect as useEffect26, useState as useState29 } from "react";
|
|
31908
32302
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
31909
32303
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
31910
32304
|
function useTimedSpinner() {
|
|
31911
32305
|
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
31912
|
-
|
|
32306
|
+
useEffect26(() => {
|
|
31913
32307
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
31914
32308
|
return () => {
|
|
31915
32309
|
clearInterval(timer);
|
|
@@ -32178,7 +32572,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
32178
32572
|
});
|
|
32179
32573
|
|
|
32180
32574
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
32181
|
-
import { useEffect as
|
|
32575
|
+
import { useEffect as useEffect27, useState as useState30, useMemo as useMemo7 } from "react";
|
|
32182
32576
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
32183
32577
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
32184
32578
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -32388,7 +32782,7 @@ function WizardPreviewStep({
|
|
|
32388
32782
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
32389
32783
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
32390
32784
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
32391
|
-
|
|
32785
|
+
useEffect27(() => {
|
|
32392
32786
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
32393
32787
|
}, [maxScroll]);
|
|
32394
32788
|
useImmediateInput((input, key) => {
|
|
@@ -32498,6 +32892,205 @@ var init_run_teaser = __esm({
|
|
|
32498
32892
|
}
|
|
32499
32893
|
});
|
|
32500
32894
|
|
|
32895
|
+
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
32896
|
+
function previewSummary(preview) {
|
|
32897
|
+
const counts = (group) => ({
|
|
32898
|
+
new: group.new.length,
|
|
32899
|
+
changed: group.changed.length,
|
|
32900
|
+
removed: group.removed.length
|
|
32901
|
+
});
|
|
32902
|
+
return {
|
|
32903
|
+
components: counts(preview.components),
|
|
32904
|
+
tokens: counts(preview.tokens),
|
|
32905
|
+
breaking_components: preview.components.changed.filter(
|
|
32906
|
+
(entry) => entry.changeClassification?.classification === "breaking"
|
|
32907
|
+
).length
|
|
32908
|
+
};
|
|
32909
|
+
}
|
|
32910
|
+
function pushSummary(result, state2) {
|
|
32911
|
+
const failures = result.failures ?? [];
|
|
32912
|
+
return {
|
|
32913
|
+
component_types: result.componentTypes,
|
|
32914
|
+
design_tokens: result.designTokens,
|
|
32915
|
+
...result.summary ? { summary: result.summary } : {},
|
|
32916
|
+
...failures.length > 0 ? {
|
|
32917
|
+
failure_count: failures.length,
|
|
32918
|
+
failures: failures.slice(0, MAX_LOGGED).map((failure) => ({
|
|
32919
|
+
entity_type: failure.entityType,
|
|
32920
|
+
entity_id: failure.entityId,
|
|
32921
|
+
message: scrub(failure.message, state2)
|
|
32922
|
+
}))
|
|
32923
|
+
} : {}
|
|
32924
|
+
};
|
|
32925
|
+
}
|
|
32926
|
+
function flowContext(state2) {
|
|
32927
|
+
return {
|
|
32928
|
+
agent: state2.agent,
|
|
32929
|
+
space_id: state2.spaceId,
|
|
32930
|
+
environment_id: state2.environmentId,
|
|
32931
|
+
host: state2.host,
|
|
32932
|
+
credentials_skipped: state2.credentialsSkipped,
|
|
32933
|
+
components_generated: state2.generatedCount,
|
|
32934
|
+
components_accepted: state2.generatedAcceptedCount,
|
|
32935
|
+
tokens: state2.tokenCount,
|
|
32936
|
+
cma_token: state2.cmaToken
|
|
32937
|
+
};
|
|
32938
|
+
}
|
|
32939
|
+
function arrive(trail, state2) {
|
|
32940
|
+
const next = { ...trail, at: state2.step };
|
|
32941
|
+
if (state2.step === "error") {
|
|
32942
|
+
next.failure = { step: state2.errorStep, message: scrub(state2.errorMessage, state2) };
|
|
32943
|
+
}
|
|
32944
|
+
if (state2.step === "preview-validation-error") {
|
|
32945
|
+
next.validation = {
|
|
32946
|
+
count: state2.previewValidationErrors.length,
|
|
32947
|
+
errors: state2.previewValidationErrors.slice(0, MAX_LOGGED).map((error) => ({
|
|
32948
|
+
component: error.componentName,
|
|
32949
|
+
path: error.path,
|
|
32950
|
+
message: scrub(error.message, state2)
|
|
32951
|
+
})),
|
|
32952
|
+
missing_names: state2.previewValidationMissingNames.slice(0, MAX_LOGGED * 2)
|
|
32953
|
+
};
|
|
32954
|
+
}
|
|
32955
|
+
return next;
|
|
32956
|
+
}
|
|
32957
|
+
function openTrail(state2, now) {
|
|
32958
|
+
return arrive({ startedAt: now, stageStartedAt: now, at: state2.step, stages: [] }, state2);
|
|
32959
|
+
}
|
|
32960
|
+
function advance(trail, from, to, now) {
|
|
32961
|
+
const next = { ...trail, stages: [...trail.stages], stageStartedAt: now };
|
|
32962
|
+
const failed = to.step === "error" || to.step === "preview-validation-error" || from.step === "pushing" && pushHasFailures(to.pushResult);
|
|
32963
|
+
if (WORK.includes(from.step)) {
|
|
32964
|
+
next.stages.push(`${LABELS[from.step]}: ${failed ? "failed" : "ok"} (${seconds(now - trail.stageStartedAt)}s)`);
|
|
32965
|
+
}
|
|
32966
|
+
if (from.step === "previewing" && to.serverPreview) next.preview = previewSummary(to.serverPreview);
|
|
32967
|
+
if (from.step === "pushing") {
|
|
32968
|
+
next.push = pushSummary(to.pushResult, to);
|
|
32969
|
+
next.pushFailed = pushHasFailures(to.pushResult);
|
|
32970
|
+
}
|
|
32971
|
+
if (from.step === "printing" && !failed) next.saved = { path: to.componentsPath, run_id: to.lastRunId };
|
|
32972
|
+
return arrive(next, to);
|
|
32973
|
+
}
|
|
32974
|
+
function render2(trail, now, outcome) {
|
|
32975
|
+
return {
|
|
32976
|
+
outcome,
|
|
32977
|
+
total_seconds: seconds(now - trail.startedAt),
|
|
32978
|
+
stages: trail.stages,
|
|
32979
|
+
...trail.preview ? { preview: trail.preview } : {},
|
|
32980
|
+
...trail.push ? { push: trail.push } : {},
|
|
32981
|
+
...trail.saved ? { saved: trail.saved } : {},
|
|
32982
|
+
...trail.failure ? { error: trail.failure } : {},
|
|
32983
|
+
...trail.validation ? { preview_validation: trail.validation } : {}
|
|
32984
|
+
};
|
|
32985
|
+
}
|
|
32986
|
+
function flowProgress(trail, now) {
|
|
32987
|
+
return render2(trail, now, `interrupted at ${LABELS[trail.at]}`);
|
|
32988
|
+
}
|
|
32989
|
+
function flowFinish(trail, final, now) {
|
|
32990
|
+
if (!final) {
|
|
32991
|
+
const midWork = WORK.includes(trail.at);
|
|
32992
|
+
const outcome2 = `left the import ${midWork ? "while" : "at"} ${LABELS[trail.at]}${midWork ? " was running" : ""}`;
|
|
32993
|
+
return { outputs: render2(trail, now, outcome2), status: midWork ? "error" : "success", exitMethod: "discarded" };
|
|
32994
|
+
}
|
|
32995
|
+
if (final.step === "final-review") {
|
|
32996
|
+
return {
|
|
32997
|
+
outputs: render2(trail, now, "went back to edit the definitions"),
|
|
32998
|
+
status: "success",
|
|
32999
|
+
exitMethod: "discarded"
|
|
33000
|
+
};
|
|
33001
|
+
}
|
|
33002
|
+
let outcome;
|
|
33003
|
+
let failed = true;
|
|
33004
|
+
if (trail.validation) {
|
|
33005
|
+
outcome = `blocked by ${String(trail.validation["count"])} preview validation error(s)`;
|
|
33006
|
+
} else if (trail.failure) {
|
|
33007
|
+
outcome = `failed at ${trail.failure.step}: ${trail.failure.message.slice(0, MAX_OUTCOME)}`;
|
|
33008
|
+
} else if (trail.pushFailed) {
|
|
33009
|
+
outcome = "pushed, but some entities failed";
|
|
33010
|
+
} else {
|
|
33011
|
+
failed = false;
|
|
33012
|
+
outcome = final.credentialsSkipped ? "saved without pushing (credentials skipped)" : "published";
|
|
33013
|
+
}
|
|
33014
|
+
return {
|
|
33015
|
+
outputs: render2(trail, now, outcome),
|
|
33016
|
+
status: failed ? "error" : "success",
|
|
33017
|
+
exitMethod: failed ? "discarded" : "saved"
|
|
33018
|
+
};
|
|
33019
|
+
}
|
|
33020
|
+
var FLOW_RUN, LABELS, WORK, FINISHED, MAX_LOGGED, MAX_OUTCOME, scrub, seconds, pushHasFailures, isFlowFinished;
|
|
33021
|
+
var init_flow_log = __esm({
|
|
33022
|
+
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts"() {
|
|
33023
|
+
"use strict";
|
|
33024
|
+
init_debug_trail();
|
|
33025
|
+
FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
33026
|
+
LABELS = {
|
|
33027
|
+
"final-review": "Final review",
|
|
33028
|
+
"path-prompt": "Save path",
|
|
33029
|
+
printing: "Save files",
|
|
33030
|
+
previewing: "Preview",
|
|
33031
|
+
"preview-gate": "Preview confirmation",
|
|
33032
|
+
pushing: "Push",
|
|
33033
|
+
"print-gate": "Files saved",
|
|
33034
|
+
done: "Done",
|
|
33035
|
+
error: "Error",
|
|
33036
|
+
"preview-validation-error": "Preview validation"
|
|
33037
|
+
};
|
|
33038
|
+
WORK = ["printing", "previewing", "pushing"];
|
|
33039
|
+
FINISHED = ["done", "error", "preview-validation-error", "final-review"];
|
|
33040
|
+
MAX_LOGGED = 10;
|
|
33041
|
+
MAX_OUTCOME = 200;
|
|
33042
|
+
scrub = (text, state2) => scrubError(text, [state2.cmaToken]);
|
|
33043
|
+
seconds = (ms) => Math.round(ms / 100) / 10;
|
|
33044
|
+
pushHasFailures = (result) => result.componentTypes.failed + result.designTokens.failed > 0 || (result.failures?.length ?? 0) > 0 || (result.summary?.failed ?? 0) > 0;
|
|
33045
|
+
isFlowFinished = (step) => FINISHED.includes(step);
|
|
33046
|
+
}
|
|
33047
|
+
});
|
|
33048
|
+
|
|
33049
|
+
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
33050
|
+
import { useEffect as useEffect28, useRef as useRef18 } from "react";
|
|
33051
|
+
function useFlowLog(state2) {
|
|
33052
|
+
const trail = useRef18(void 0);
|
|
33053
|
+
const previous = useRef18(void 0);
|
|
33054
|
+
useEffect28(() => {
|
|
33055
|
+
const before = previous.current;
|
|
33056
|
+
previous.current = state2;
|
|
33057
|
+
const moved = before !== void 0 && before.step !== state2.step;
|
|
33058
|
+
const now = Date.now();
|
|
33059
|
+
let open = trail.current;
|
|
33060
|
+
if (!open) {
|
|
33061
|
+
if (state2.step === "final-review" || before && !moved) return;
|
|
33062
|
+
open = openTrail(state2, now);
|
|
33063
|
+
startDebugRun({ ...FLOW_RUN, inputs: flowContext(state2) });
|
|
33064
|
+
} else if (before && moved) {
|
|
33065
|
+
open = advance(open, before, state2, now);
|
|
33066
|
+
} else {
|
|
33067
|
+
return;
|
|
33068
|
+
}
|
|
33069
|
+
if (isFlowFinished(state2.step)) {
|
|
33070
|
+
trail.current = void 0;
|
|
33071
|
+
void finishDebugRun(flowFinish(open, state2, now));
|
|
33072
|
+
return;
|
|
33073
|
+
}
|
|
33074
|
+
trail.current = open;
|
|
33075
|
+
setDebugRunProgress(flowProgress(open, now));
|
|
33076
|
+
}, [state2]);
|
|
33077
|
+
useEffect28(
|
|
33078
|
+
() => () => {
|
|
33079
|
+
const open = trail.current;
|
|
33080
|
+
trail.current = void 0;
|
|
33081
|
+
if (open) void finishDebugRun(flowFinish(open, void 0, Date.now()));
|
|
33082
|
+
},
|
|
33083
|
+
[]
|
|
33084
|
+
);
|
|
33085
|
+
}
|
|
33086
|
+
var init_use_flow_log = __esm({
|
|
33087
|
+
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts"() {
|
|
33088
|
+
"use strict";
|
|
33089
|
+
init_debug_store();
|
|
33090
|
+
init_flow_log();
|
|
33091
|
+
}
|
|
33092
|
+
});
|
|
33093
|
+
|
|
32501
33094
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
32502
33095
|
import { Box as Box45 } from "ink";
|
|
32503
33096
|
import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -32512,6 +33105,7 @@ function FlowScreen({
|
|
|
32512
33105
|
generatePromptPath,
|
|
32513
33106
|
onExit
|
|
32514
33107
|
}) {
|
|
33108
|
+
useFlowLog(state2);
|
|
32515
33109
|
const produced = producedOf(state2);
|
|
32516
33110
|
const counts = { components: state2.generatedAcceptedCount, tokens: state2.tokenCount };
|
|
32517
33111
|
const things = countedThings(produced, counts);
|
|
@@ -32639,6 +33233,7 @@ var init_screen11 = __esm({
|
|
|
32639
33233
|
init_WizardPreviewStep();
|
|
32640
33234
|
init_produced();
|
|
32641
33235
|
init_run_teaser();
|
|
33236
|
+
init_use_flow_log();
|
|
32642
33237
|
}
|
|
32643
33238
|
});
|
|
32644
33239
|
|
|
@@ -33031,7 +33626,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
33031
33626
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
33032
33627
|
const validation = validateCDF2(cdf);
|
|
33033
33628
|
if (!validation.valid) {
|
|
33034
|
-
throw new Error(`generated CDF failed validation: ${validation.errors.map(
|
|
33629
|
+
throw new Error(`generated CDF failed validation: ${validation.errors.map((error) => error.message).join(", ")}`);
|
|
33035
33630
|
}
|
|
33036
33631
|
return cdf;
|
|
33037
33632
|
}
|
|
@@ -33049,11 +33644,7 @@ async function runPrintFiles(input, deps, onPatch) {
|
|
|
33049
33644
|
db.close();
|
|
33050
33645
|
}
|
|
33051
33646
|
if (!input.tokenSessionId && input.tokensPath) tokens = await deps.readTokens(input.tokensPath);
|
|
33052
|
-
const cdf = buildSavedCDF(components, tokens, {
|
|
33053
|
-
deleteAll: input.allowEmpty,
|
|
33054
|
-
onRepair: (message) => deps.warn(`${message}
|
|
33055
|
-
`)
|
|
33056
|
-
});
|
|
33647
|
+
const cdf = buildSavedCDF(components, tokens, { deleteAll: input.allowEmpty });
|
|
33057
33648
|
await deps.writeFile(componentsPath, `${JSON.stringify(cdf, null, 2)}
|
|
33058
33649
|
`);
|
|
33059
33650
|
deps.warn(
|
|
@@ -33114,7 +33705,7 @@ async function recordRun(input, deps) {
|
|
|
33114
33705
|
return null;
|
|
33115
33706
|
}
|
|
33116
33707
|
}
|
|
33117
|
-
var SAVE_CONFIRMATION_DELAY_MS,
|
|
33708
|
+
var SAVE_CONFIRMATION_DELAY_MS, realSaveDeps;
|
|
33118
33709
|
var init_save = __esm({
|
|
33119
33710
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts"() {
|
|
33120
33711
|
"use strict";
|
|
@@ -33122,7 +33713,6 @@ var init_save = __esm({
|
|
|
33122
33713
|
init_src4();
|
|
33123
33714
|
init_run_print_files_helpers();
|
|
33124
33715
|
SAVE_CONFIRMATION_DELAY_MS = 1e3;
|
|
33125
|
-
describeCdfError = (error) => `${error.path.replace(/^\//, "").replace("/$properties/", ".").replaceAll("/", ".")}: ${error.message}`;
|
|
33126
33716
|
realSaveDeps = () => ({
|
|
33127
33717
|
openDb: openPipelineDb,
|
|
33128
33718
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
@@ -33441,9 +34031,9 @@ var init_controller = __esm({
|
|
|
33441
34031
|
});
|
|
33442
34032
|
|
|
33443
34033
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
33444
|
-
import { useEffect as
|
|
34034
|
+
import { useEffect as useEffect29, useRef as useRef19, useSyncExternalStore } from "react";
|
|
33445
34035
|
function useFlow(start, options = {}) {
|
|
33446
|
-
const controller =
|
|
34036
|
+
const controller = useRef19();
|
|
33447
34037
|
if (start && !controller.current) {
|
|
33448
34038
|
try {
|
|
33449
34039
|
startWizardLog();
|
|
@@ -33460,7 +34050,7 @@ function useFlow(start, options = {}) {
|
|
|
33460
34050
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
33461
34051
|
() => current?.getState()
|
|
33462
34052
|
);
|
|
33463
|
-
|
|
34053
|
+
useEffect29(() => {
|
|
33464
34054
|
if (!start) controller.current = void 0;
|
|
33465
34055
|
}, [start]);
|
|
33466
34056
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
@@ -33539,7 +34129,7 @@ var init_help_info = __esm({
|
|
|
33539
34129
|
});
|
|
33540
34130
|
|
|
33541
34131
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
33542
|
-
import { useEffect as
|
|
34132
|
+
import { useEffect as useEffect30, useState as useState31 } from "react";
|
|
33543
34133
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
33544
34134
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33545
34135
|
function Section({ title, rows }) {
|
|
@@ -33553,7 +34143,7 @@ function Section({ title, rows }) {
|
|
|
33553
34143
|
}
|
|
33554
34144
|
function HelpScreen({ onDone }) {
|
|
33555
34145
|
const [info, setInfo] = useState31();
|
|
33556
|
-
|
|
34146
|
+
useEffect30(() => {
|
|
33557
34147
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
33558
34148
|
void readHelpInfo().then(setInfo);
|
|
33559
34149
|
}, []);
|
|
@@ -33661,45 +34251,6 @@ var init_PageContainer3 = __esm({
|
|
|
33661
34251
|
}
|
|
33662
34252
|
});
|
|
33663
34253
|
|
|
33664
|
-
// packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts
|
|
33665
|
-
import { existsSync as existsSync11 } from "node:fs";
|
|
33666
|
-
function diffSnapshots(before, after) {
|
|
33667
|
-
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
33668
|
-
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
33669
|
-
return { changed: changed_fields.length > 0, changed_fields };
|
|
33670
|
-
}
|
|
33671
|
-
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
33672
|
-
const actions = [];
|
|
33673
|
-
return {
|
|
33674
|
-
record(action) {
|
|
33675
|
-
actions.push(action);
|
|
33676
|
-
if (actions.length > limit) actions.shift();
|
|
33677
|
-
},
|
|
33678
|
-
entries: () => [...actions]
|
|
33679
|
-
};
|
|
33680
|
-
}
|
|
33681
|
-
function scrubError(error, secrets) {
|
|
33682
|
-
let message = error instanceof Error ? error.message : String(error);
|
|
33683
|
-
for (const secret of secrets) {
|
|
33684
|
-
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
33685
|
-
for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
|
|
33686
|
-
}
|
|
33687
|
-
return message;
|
|
33688
|
-
}
|
|
33689
|
-
function describeSettingsFile() {
|
|
33690
|
-
const path5 = configFilePath2();
|
|
33691
|
-
return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync11(path5) };
|
|
33692
|
-
}
|
|
33693
|
-
var DEFAULT_TRAIL_LIMIT, MIN_SECRET_LENGTH;
|
|
33694
|
-
var init_debug_trail = __esm({
|
|
33695
|
-
"packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts"() {
|
|
33696
|
-
"use strict";
|
|
33697
|
-
init_config();
|
|
33698
|
-
DEFAULT_TRAIL_LIMIT = 30;
|
|
33699
|
-
MIN_SECRET_LENGTH = 6;
|
|
33700
|
-
}
|
|
33701
|
-
});
|
|
33702
|
-
|
|
33703
34254
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
33704
34255
|
import { execFile as execFile2 } from "node:child_process";
|
|
33705
34256
|
import { access as access5, constants } from "node:fs/promises";
|
|
@@ -33765,7 +34316,7 @@ async function testAgent(name, binary, model) {
|
|
|
33765
34316
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
33766
34317
|
})
|
|
33767
34318
|
);
|
|
33768
|
-
const
|
|
34319
|
+
const seconds2 = ((Date.now() - started) / 1e3).toFixed(1);
|
|
33769
34320
|
if (result.timedOut) {
|
|
33770
34321
|
return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
33771
34322
|
}
|
|
@@ -33773,7 +34324,7 @@ async function testAgent(name, binary, model) {
|
|
|
33773
34324
|
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
33774
34325
|
return [...checks, fail3("prompt", reason)];
|
|
33775
34326
|
}
|
|
33776
|
-
return [...checks, pass("prompt", `answered in ${
|
|
34327
|
+
return [...checks, pass("prompt", `answered in ${seconds2}s`)];
|
|
33777
34328
|
}
|
|
33778
34329
|
function statusFromChecks(name, checks, savedBinary) {
|
|
33779
34330
|
if (checks.length === 0) return "checking";
|
|
@@ -33974,7 +34525,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
33974
34525
|
});
|
|
33975
34526
|
|
|
33976
34527
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
33977
|
-
import { useEffect as
|
|
34528
|
+
import { useEffect as useEffect31, useState as useState33 } from "react";
|
|
33978
34529
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
33979
34530
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33980
34531
|
function StatusHeading() {
|
|
@@ -33995,7 +34546,7 @@ function AgentDetail({
|
|
|
33995
34546
|
const [testing, setTesting] = useState33(false);
|
|
33996
34547
|
const [notice, setNotice] = useState33(null);
|
|
33997
34548
|
const [checks, setChecks] = useState33(void 0);
|
|
33998
|
-
|
|
34549
|
+
useEffect31(() => {
|
|
33999
34550
|
let active = true;
|
|
34000
34551
|
setChecks(void 0);
|
|
34001
34552
|
const timer = setTimeout(() => {
|
|
@@ -34087,7 +34638,7 @@ var init_AgentDetail = __esm({
|
|
|
34087
34638
|
});
|
|
34088
34639
|
|
|
34089
34640
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
34090
|
-
import { useEffect as
|
|
34641
|
+
import { useEffect as useEffect32, useRef as useRef20, useState as useState34 } from "react";
|
|
34091
34642
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
34092
34643
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
34093
34644
|
function AgentsScreen({ onDone }) {
|
|
@@ -34098,7 +34649,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34098
34649
|
const [saving, setSaving] = useState34(false);
|
|
34099
34650
|
const [loadError, setLoadError] = useState34(null);
|
|
34100
34651
|
const [checks, setChecks] = useState34({});
|
|
34101
|
-
const visit =
|
|
34652
|
+
const visit = useRef20({
|
|
34102
34653
|
trail: createTrail(),
|
|
34103
34654
|
before: void 0,
|
|
34104
34655
|
environment: void 0,
|
|
@@ -34111,7 +34662,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34111
34662
|
);
|
|
34112
34663
|
}
|
|
34113
34664
|
};
|
|
34114
|
-
|
|
34665
|
+
useEffect32(() => {
|
|
34115
34666
|
readAgentConfig().then((loaded) => {
|
|
34116
34667
|
setConfig(loaded);
|
|
34117
34668
|
inspectAll(loaded);
|
|
@@ -34337,7 +34888,7 @@ var init_project_store = __esm({
|
|
|
34337
34888
|
});
|
|
34338
34889
|
|
|
34339
34890
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
34340
|
-
import { useEffect as
|
|
34891
|
+
import { useEffect as useEffect33, useRef as useRef21, useState as useState35 } from "react";
|
|
34341
34892
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
34342
34893
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
34343
34894
|
function debugFields(config) {
|
|
@@ -34356,14 +34907,14 @@ function ProjectScreen({ onDone }) {
|
|
|
34356
34907
|
const [saving, setSaving] = useState35(false);
|
|
34357
34908
|
const [notice, setNotice] = useState35(null);
|
|
34358
34909
|
const [loadError, setLoadError] = useState35(null);
|
|
34359
|
-
const visit =
|
|
34910
|
+
const visit = useRef21({
|
|
34360
34911
|
trail: createTrail(),
|
|
34361
34912
|
before: void 0,
|
|
34362
34913
|
persisted: void 0,
|
|
34363
34914
|
error: ""
|
|
34364
34915
|
}).current;
|
|
34365
|
-
const
|
|
34366
|
-
|
|
34916
|
+
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
34917
|
+
useEffect33(() => {
|
|
34367
34918
|
readCredentials().then((cfg) => {
|
|
34368
34919
|
setConfig(cfg);
|
|
34369
34920
|
visit.before = snapshotOf(cfg);
|
|
@@ -34430,7 +34981,7 @@ function ProjectScreen({ onDone }) {
|
|
|
34430
34981
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
34431
34982
|
setNotice({ kind: "success", text: "Project settings saved" });
|
|
34432
34983
|
}).catch((err) => {
|
|
34433
|
-
visit.error =
|
|
34984
|
+
visit.error = scrub2(err);
|
|
34434
34985
|
visit.trail.record("save failed");
|
|
34435
34986
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
34436
34987
|
}).finally(() => setSaving(false));
|
|
@@ -34550,13 +35101,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
34550
35101
|
});
|
|
34551
35102
|
|
|
34552
35103
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
34553
|
-
import { useEffect as
|
|
35104
|
+
import { useEffect as useEffect34, useState as useState37 } from "react";
|
|
34554
35105
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
34555
35106
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
34556
35107
|
function OptInAnalyticsScreen({ onDone }) {
|
|
34557
35108
|
const [loading, setLoading] = useState37(true);
|
|
34558
35109
|
const [enabled, setEnabled] = useState37(true);
|
|
34559
|
-
|
|
35110
|
+
useEffect34(() => {
|
|
34560
35111
|
readAnalyticsSetting().then((setting) => {
|
|
34561
35112
|
setEnabled(setting.enabled);
|
|
34562
35113
|
setLoading(false);
|
|
@@ -34619,7 +35170,7 @@ var init_screen12 = __esm({
|
|
|
34619
35170
|
});
|
|
34620
35171
|
|
|
34621
35172
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
34622
|
-
import { useEffect as
|
|
35173
|
+
import { useEffect as useEffect35, useRef as useRef22, useState as useState38 } from "react";
|
|
34623
35174
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
34624
35175
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
34625
35176
|
function DebugModeScreen({ onDone }) {
|
|
@@ -34629,8 +35180,8 @@ function DebugModeScreen({ onDone }) {
|
|
|
34629
35180
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
34630
35181
|
);
|
|
34631
35182
|
const [notice, setNotice] = useState38(null);
|
|
34632
|
-
const visit =
|
|
34633
|
-
|
|
35183
|
+
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
35184
|
+
useEffect35(() => {
|
|
34634
35185
|
readDebugModeSetting().then((loaded) => {
|
|
34635
35186
|
setSetting(loaded);
|
|
34636
35187
|
setPending(loaded.retentionDays);
|
|
@@ -34771,7 +35322,7 @@ var app_exports = {};
|
|
|
34771
35322
|
__export(app_exports, {
|
|
34772
35323
|
runApp: () => runApp
|
|
34773
35324
|
});
|
|
34774
|
-
import { useEffect as
|
|
35325
|
+
import { useEffect as useEffect36, useState as useState39 } from "react";
|
|
34775
35326
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
34776
35327
|
function App({ importOptions, inkClear }) {
|
|
34777
35328
|
const [screen, setScreen] = useState39("start");
|
|
@@ -34805,7 +35356,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34805
35356
|
const [flowStart, setFlowStart] = useState39();
|
|
34806
35357
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
34807
35358
|
const [importDefaults, setImportDefaults] = useState39();
|
|
34808
|
-
|
|
35359
|
+
useEffect36(() => {
|
|
34809
35360
|
if (screen !== "import") {
|
|
34810
35361
|
setImportDefaults(void 0);
|
|
34811
35362
|
return;
|
|
@@ -34878,7 +35429,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34878
35429
|
}
|
|
34879
35430
|
});
|
|
34880
35431
|
};
|
|
34881
|
-
|
|
35432
|
+
useEffect36(() => {
|
|
34882
35433
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
34883
35434
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
34884
35435
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -34900,12 +35451,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34900
35451
|
}
|
|
34901
35452
|
});
|
|
34902
35453
|
}, [tokensOnly, tokensOnlyRun]);
|
|
34903
|
-
|
|
35454
|
+
useEffect36(() => {
|
|
34904
35455
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
34905
35456
|
setExtractionRun(void 0);
|
|
34906
35457
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
34907
35458
|
}, [extraction, extractionRun]);
|
|
34908
|
-
|
|
35459
|
+
useEffect36(() => {
|
|
34909
35460
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
34910
35461
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34911
35462
|
setGenerationInput({
|
|
@@ -34923,7 +35474,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34923
35474
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
34924
35475
|
});
|
|
34925
35476
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
34926
|
-
|
|
35477
|
+
useEffect36(() => {
|
|
34927
35478
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
34928
35479
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34929
35480
|
inkClear();
|
|
@@ -35092,6 +35643,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35092
35643
|
return /* @__PURE__ */ jsx66(
|
|
35093
35644
|
CredentialsScreen,
|
|
35094
35645
|
{
|
|
35646
|
+
mode: target,
|
|
35095
35647
|
initial: importDefaults.credentials,
|
|
35096
35648
|
tokensOnly: target === "tokens",
|
|
35097
35649
|
onBack: () => goBackFrom("credentials"),
|
|
@@ -35229,9 +35781,9 @@ var pkg = JSON.parse(
|
|
|
35229
35781
|
function createProgram() {
|
|
35230
35782
|
const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
|
|
35231
35783
|
registerImportCommand(program, async (options) => {
|
|
35232
|
-
const { render } = await import("ink");
|
|
35784
|
+
const { render: render3 } = await import("ink");
|
|
35233
35785
|
const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|
|
35234
|
-
await runApp2(
|
|
35786
|
+
await runApp2(render3, options);
|
|
35235
35787
|
});
|
|
35236
35788
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
35237
35789
|
const chain = [];
|