@contentful/experience-design-system-cli 2.41.1-dev-build-bf9d918c.0 → 2.41.1-dev-build-3a724687.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 +154 -619
- package/dist/index.js +172 -650
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +0 -2
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +1 -23
- package/dist/src/tui/import/steps/04-credentials/screen.d.ts +1 -4
- package/dist/src/tui/import/steps/06-extraction/logic.d.ts +1 -14
- package/dist/src/tui/import/steps/08-generation/logic.d.ts +1 -8
- package/dist/src/tui/settings/configuration/agents/agent-debug.d.ts +1 -1
- package/package.json +3 -3
- package/dist/src/tui/import/steps/07-scope-gate/log.d.ts +0 -8
- package/dist/src/tui/import/steps/10-flow/flow/flow-log.d.ts +0 -48
- package/dist/src/tui/import/steps/10-flow/flow/use-flow-log.d.ts +0 -7
- /package/dist/src/tui/{shared → settings/shared}/debug-trail.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1986,9 +1986,12 @@ 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", minLength: 1 },
|
|
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"] },
|
|
1992
1995
|
additionalProperties: false
|
|
1993
1996
|
},
|
|
1994
1997
|
slot: {
|
|
@@ -14471,11 +14474,19 @@ var init_src = __esm({
|
|
|
14471
14474
|
}
|
|
14472
14475
|
});
|
|
14473
14476
|
|
|
14477
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/token-kinds/repair-token-kinds.js
|
|
14478
|
+
var init_repair_token_kinds = __esm({
|
|
14479
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/token-kinds/repair-token-kinds.js"() {
|
|
14480
|
+
"use strict";
|
|
14481
|
+
}
|
|
14482
|
+
});
|
|
14483
|
+
|
|
14474
14484
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/services/run-cdf-generation-service.js
|
|
14475
14485
|
var init_run_cdf_generation_service = __esm({
|
|
14476
14486
|
"packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/services/run-cdf-generation-service.js"() {
|
|
14477
14487
|
"use strict";
|
|
14478
14488
|
init_agents();
|
|
14489
|
+
init_repair_token_kinds();
|
|
14479
14490
|
}
|
|
14480
14491
|
});
|
|
14481
14492
|
|
|
@@ -15180,8 +15191,8 @@ function retryAfterMs(response) {
|
|
|
15180
15191
|
const value = response.headers?.get("retry-after")?.trim();
|
|
15181
15192
|
if (!value)
|
|
15182
15193
|
return void 0;
|
|
15183
|
-
const
|
|
15184
|
-
const delayMs = Number.isFinite(
|
|
15194
|
+
const seconds = Number(value);
|
|
15195
|
+
const delayMs = Number.isFinite(seconds) ? seconds * 1e3 : Date.parse(value) - Date.now();
|
|
15185
15196
|
if (!Number.isFinite(delayMs) || delayMs < 0 || delayMs > MAX_RETRY_AFTER_MS)
|
|
15186
15197
|
return void 0;
|
|
15187
15198
|
return Math.round(delayMs);
|
|
@@ -18053,10 +18064,10 @@ var init_read_candidate_files = __esm({
|
|
|
18053
18064
|
async function selectCompositionPromptFiles(components, sourceFiles) {
|
|
18054
18065
|
const allFiles = await readCandidateFiles(components, sourceFiles);
|
|
18055
18066
|
const selectedCandidates = selectCandidateFiles(allFiles).map((c2) => ({ path: c2.path, content: c2.content }));
|
|
18056
|
-
const
|
|
18057
|
-
const promptFiles =
|
|
18067
|
+
const capped = capCandidatesToPromptBudget(selectedCandidates);
|
|
18068
|
+
const promptFiles = capped.kept;
|
|
18058
18069
|
const runtimeFiles = allFiles.map((c2) => ({ path: c2.path, content: c2.content }));
|
|
18059
|
-
const droppedWarning =
|
|
18070
|
+
const droppedWarning = capped.dropped.length > 0 ? `composition \u2014 ${capped.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;
|
|
18060
18071
|
return { promptFiles, runtimeFiles, droppedWarning };
|
|
18061
18072
|
}
|
|
18062
18073
|
var init_select_composition_prompt_files = __esm({
|
|
@@ -19497,7 +19508,6 @@ __export(debug_store_exports, {
|
|
|
19497
19508
|
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
19498
19509
|
currentSessionDir: () => currentSessionDir,
|
|
19499
19510
|
finishDebugRun: () => finishDebugRun,
|
|
19500
|
-
setDebugRunProgress: () => setDebugRunProgress,
|
|
19501
19511
|
startDebugRun: () => startDebugRun,
|
|
19502
19512
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
19503
19513
|
startImportRun: () => startImportRun
|
|
@@ -19593,15 +19603,11 @@ function startDebugRun({
|
|
|
19593
19603
|
const runId = generateRunId();
|
|
19594
19604
|
const startedAt = Date.now();
|
|
19595
19605
|
const redactedInputs = redact(inputs);
|
|
19596
|
-
|
|
19597
|
-
|
|
19598
|
-
|
|
19599
|
-
if (!enabled && pendingRun === run) pendingRun = void 0;
|
|
19606
|
+
isDebugModeEnabled().then((enabled) => {
|
|
19607
|
+
if (!enabled) return;
|
|
19608
|
+
pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
|
|
19600
19609
|
});
|
|
19601
19610
|
}
|
|
19602
|
-
function setDebugRunProgress(outputs) {
|
|
19603
|
-
if (pendingRun) pendingRun.progress = outputs;
|
|
19604
|
-
}
|
|
19605
19611
|
async function finishDebugRun({
|
|
19606
19612
|
outputs,
|
|
19607
19613
|
status,
|
|
@@ -19610,10 +19616,9 @@ async function finishDebugRun({
|
|
|
19610
19616
|
const run = pendingRun;
|
|
19611
19617
|
if (!run) return;
|
|
19612
19618
|
pendingRun = void 0;
|
|
19613
|
-
if (!await isDebugModeEnabled()) return;
|
|
19614
19619
|
const durationMs = Date.now() - run.startedAt;
|
|
19615
19620
|
const log = {
|
|
19616
|
-
flow:
|
|
19621
|
+
flow: run.flow,
|
|
19617
19622
|
menuOption: run.menuOption,
|
|
19618
19623
|
content: renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs })
|
|
19619
19624
|
};
|
|
@@ -19624,9 +19629,6 @@ async function finishDebugRun({
|
|
|
19624
19629
|
}
|
|
19625
19630
|
await writeLog(root, log);
|
|
19626
19631
|
}
|
|
19627
|
-
function logFolder(flow, step) {
|
|
19628
|
-
return flow.startsWith("import/") && /^\d+-/.test(step) ? `import/${step}` : flow;
|
|
19629
|
-
}
|
|
19630
19632
|
async function writeLog(root, log) {
|
|
19631
19633
|
const dir = join19(root, ...log.flow.split("/"));
|
|
19632
19634
|
await mkdir7(dir, { recursive: true });
|
|
@@ -19683,7 +19685,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
19683
19685
|
`;
|
|
19684
19686
|
}
|
|
19685
19687
|
function handleCrash() {
|
|
19686
|
-
return finishDebugRun({ outputs:
|
|
19688
|
+
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
19687
19689
|
}
|
|
19688
19690
|
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
19689
19691
|
var init_debug_store = __esm({
|
|
@@ -19727,17 +19729,11 @@ var init_debug_store = __esm({
|
|
|
19727
19729
|
throw reason;
|
|
19728
19730
|
});
|
|
19729
19731
|
});
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
["SIGHUP", 129]
|
|
19734
|
-
]) {
|
|
19735
|
-
process.once(signal, () => {
|
|
19736
|
-
void handleCrash().finally(() => {
|
|
19737
|
-
process.exit(exitCode);
|
|
19738
|
-
});
|
|
19732
|
+
process.once("SIGINT", () => {
|
|
19733
|
+
void handleCrash().finally(() => {
|
|
19734
|
+
process.exit(130);
|
|
19739
19735
|
});
|
|
19740
|
-
}
|
|
19736
|
+
});
|
|
19741
19737
|
}
|
|
19742
19738
|
});
|
|
19743
19739
|
|
|
@@ -20141,8 +20137,8 @@ function progressPercent(progress) {
|
|
|
20141
20137
|
}
|
|
20142
20138
|
function formatElapsed(totalSeconds) {
|
|
20143
20139
|
const minutes = Math.floor(totalSeconds / 60);
|
|
20144
|
-
const
|
|
20145
|
-
return minutes > 0 ? `${minutes}m ${
|
|
20140
|
+
const seconds = totalSeconds % 60;
|
|
20141
|
+
return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
|
|
20146
20142
|
}
|
|
20147
20143
|
var init_logic4 = __esm({
|
|
20148
20144
|
"packages/experience-design-system-cli/src/tui/import/shared/running-step/logic.ts"() {
|
|
@@ -20172,12 +20168,12 @@ var init_theme2 = __esm({
|
|
|
20172
20168
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
20173
20169
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
20174
20170
|
function useElapsed() {
|
|
20175
|
-
const [
|
|
20171
|
+
const [seconds, setSeconds] = useState3(0);
|
|
20176
20172
|
useEffect3(() => {
|
|
20177
20173
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
20178
20174
|
return () => clearInterval(timer);
|
|
20179
20175
|
}, []);
|
|
20180
|
-
return formatElapsed(
|
|
20176
|
+
return formatElapsed(seconds);
|
|
20181
20177
|
}
|
|
20182
20178
|
var init_use_elapsed = __esm({
|
|
20183
20179
|
"packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts"() {
|
|
@@ -21092,45 +21088,6 @@ var init_FieldForm = __esm({
|
|
|
21092
21088
|
}
|
|
21093
21089
|
});
|
|
21094
21090
|
|
|
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
|
-
|
|
21134
21091
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
21135
21092
|
function credentialsPurpose(tokensOnly) {
|
|
21136
21093
|
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";
|
|
@@ -21144,42 +21101,17 @@ function normalize(values) {
|
|
|
21144
21101
|
host: toConfiguredHost2(values.host) ?? DEFAULT_CONFIGURED_HOST
|
|
21145
21102
|
};
|
|
21146
21103
|
}
|
|
21147
|
-
function
|
|
21148
|
-
return
|
|
21104
|
+
function missingField(values) {
|
|
21105
|
+
return values.spaceId === "" || values.environmentId === "" || values.cmaToken === "";
|
|
21149
21106
|
}
|
|
21150
21107
|
function isUnchanged(current, initial) {
|
|
21151
21108
|
return FIELDS.every((field) => current[field] === initial[field]);
|
|
21152
21109
|
}
|
|
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
|
-
}
|
|
21177
21110
|
var FIELDS;
|
|
21178
21111
|
var init_logic8 = __esm({
|
|
21179
21112
|
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts"() {
|
|
21180
21113
|
"use strict";
|
|
21181
21114
|
init_src3();
|
|
21182
|
-
init_debug_trail();
|
|
21183
21115
|
FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
21184
21116
|
}
|
|
21185
21117
|
});
|
|
@@ -21232,11 +21164,10 @@ var init_validate4 = __esm({
|
|
|
21232
21164
|
});
|
|
21233
21165
|
|
|
21234
21166
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
21235
|
-
import {
|
|
21167
|
+
import { useRef as useRef5, useState as useState9 } from "react";
|
|
21236
21168
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
21237
21169
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21238
21170
|
function CredentialsScreen({
|
|
21239
|
-
mode,
|
|
21240
21171
|
onDone,
|
|
21241
21172
|
onBack,
|
|
21242
21173
|
initial = {},
|
|
@@ -21259,64 +21190,17 @@ function CredentialsScreen({
|
|
|
21259
21190
|
const [focus, setFocus] = useState9(0);
|
|
21260
21191
|
const [active, setActive] = useState9(0);
|
|
21261
21192
|
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
|
-
};
|
|
21292
21193
|
const submit = async () => {
|
|
21293
21194
|
const credentials = normalize(values);
|
|
21294
|
-
|
|
21295
|
-
|
|
21296
|
-
reject(
|
|
21297
|
-
rejectedAttempt(`Missing required fields: ${missing.join(", ")}`, credentials),
|
|
21298
|
-
"Space ID, environment and CMA token are all required."
|
|
21299
|
-
);
|
|
21195
|
+
if (missingField(credentials)) {
|
|
21196
|
+
setNotice({ kind: "error", text: "Space ID, environment and CMA token are all required." });
|
|
21300
21197
|
return;
|
|
21301
21198
|
}
|
|
21302
21199
|
setValidating(true);
|
|
21303
21200
|
const result = await validate3(credentials);
|
|
21304
21201
|
setValidating(false);
|
|
21305
|
-
if (
|
|
21306
|
-
|
|
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 });
|
|
21202
|
+
if (result.ok) onDone({ skipped: false, credentials });
|
|
21203
|
+
else setNotice({ kind: "error", text: result.error });
|
|
21320
21204
|
};
|
|
21321
21205
|
const choose = (choice) => {
|
|
21322
21206
|
if (choice === "continue") void submit();
|
|
@@ -21325,7 +21209,7 @@ function CredentialsScreen({
|
|
|
21325
21209
|
setBeforeEdit(values);
|
|
21326
21210
|
setActive(0);
|
|
21327
21211
|
setEditing(true);
|
|
21328
|
-
} else
|
|
21212
|
+
} else onBack();
|
|
21329
21213
|
};
|
|
21330
21214
|
const stopEditing = () => {
|
|
21331
21215
|
setEditing(false);
|
|
@@ -21335,7 +21219,7 @@ function CredentialsScreen({
|
|
|
21335
21219
|
if (validating) return;
|
|
21336
21220
|
if (editing) {
|
|
21337
21221
|
if (key.escape) {
|
|
21338
|
-
if (!prefilled)
|
|
21222
|
+
if (!prefilled) onBack();
|
|
21339
21223
|
else {
|
|
21340
21224
|
setValues(beforeEdit);
|
|
21341
21225
|
setNotice(null);
|
|
@@ -21441,12 +21325,11 @@ function CredentialsScreen({
|
|
|
21441
21325
|
] })
|
|
21442
21326
|
] });
|
|
21443
21327
|
}
|
|
21444
|
-
var FIELDS2, MENU
|
|
21328
|
+
var FIELDS2, MENU;
|
|
21445
21329
|
var init_screen5 = __esm({
|
|
21446
21330
|
"packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx"() {
|
|
21447
21331
|
"use strict";
|
|
21448
21332
|
init_theme();
|
|
21449
|
-
init_debug_store();
|
|
21450
21333
|
init_FieldForm();
|
|
21451
21334
|
init_ClearableTextInput();
|
|
21452
21335
|
init_ControlHints();
|
|
@@ -21463,52 +21346,10 @@ var init_screen5 = __esm({
|
|
|
21463
21346
|
{ choice: "continue", label: "Continue", description: "Check the credentials and go on" },
|
|
21464
21347
|
{ choice: "edit", label: "Edit", description: "Change the credentials" }
|
|
21465
21348
|
];
|
|
21466
|
-
MAX_LOGGED_ATTEMPTS2 = 10;
|
|
21467
21349
|
}
|
|
21468
21350
|
});
|
|
21469
21351
|
|
|
21470
21352
|
// 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
|
-
}
|
|
21512
21353
|
function initialProgress(input) {
|
|
21513
21354
|
return {
|
|
21514
21355
|
scan: null,
|
|
@@ -21592,7 +21433,6 @@ var init_logic9 = __esm({
|
|
|
21592
21433
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/logic.ts"() {
|
|
21593
21434
|
"use strict";
|
|
21594
21435
|
init_src3();
|
|
21595
|
-
init_debug_trail();
|
|
21596
21436
|
}
|
|
21597
21437
|
});
|
|
21598
21438
|
|
|
@@ -21680,7 +21520,7 @@ var init_load = __esm({
|
|
|
21680
21520
|
});
|
|
21681
21521
|
|
|
21682
21522
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
21683
|
-
import {
|
|
21523
|
+
import { useMemo as useMemo2, useState as useState10 } from "react";
|
|
21684
21524
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
21685
21525
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21686
21526
|
function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
@@ -21688,31 +21528,12 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
21688
21528
|
const rows = loaded.ok ? loaded.rows : [];
|
|
21689
21529
|
const columns = useTerminalWidth();
|
|
21690
21530
|
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
|
-
};
|
|
21706
21531
|
const move = (to) => setSelected(Math.max(0, Math.min(to, rows.length - 1)));
|
|
21707
21532
|
const { start, end } = computeColumnWindow(rows.length, selected, VISIBLE_ROWS);
|
|
21708
21533
|
useInput12((_input, key) => {
|
|
21709
|
-
if (key.return)
|
|
21710
|
-
|
|
21711
|
-
|
|
21712
|
-
} else if (key.escape) {
|
|
21713
|
-
finish("back");
|
|
21714
|
-
onQuit();
|
|
21715
|
-
} else if (key.upArrow) move(selected - 1);
|
|
21534
|
+
if (key.return) onContinue();
|
|
21535
|
+
else if (key.escape) onQuit();
|
|
21536
|
+
else if (key.upArrow) move(selected - 1);
|
|
21716
21537
|
else if (key.downArrow) move(selected + 1);
|
|
21717
21538
|
else if (key.pageUp) move(selected - VISIBLE_ROWS);
|
|
21718
21539
|
else if (key.pageDown) move(selected + VISIBLE_ROWS);
|
|
@@ -21776,7 +21597,6 @@ var init_screen7 = __esm({
|
|
|
21776
21597
|
"packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx"() {
|
|
21777
21598
|
"use strict";
|
|
21778
21599
|
init_theme();
|
|
21779
|
-
init_debug_store();
|
|
21780
21600
|
init_ControlHints();
|
|
21781
21601
|
init_StepHeader();
|
|
21782
21602
|
init_use_terminal_width();
|
|
@@ -21802,7 +21622,7 @@ var init_steps = __esm({
|
|
|
21802
21622
|
});
|
|
21803
21623
|
|
|
21804
21624
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21805
|
-
import { existsSync as
|
|
21625
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
21806
21626
|
import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
|
|
21807
21627
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21808
21628
|
function findSkillPath(fileName) {
|
|
@@ -21810,7 +21630,7 @@ function findSkillPath(fileName) {
|
|
|
21810
21630
|
let dir = thisDir;
|
|
21811
21631
|
for (; ; ) {
|
|
21812
21632
|
const candidate = join20(dir, "skills", fileName);
|
|
21813
|
-
if (
|
|
21633
|
+
if (existsSync10(candidate)) return candidate;
|
|
21814
21634
|
const parent = resolve22(dir, "..");
|
|
21815
21635
|
if (parent === dir) {
|
|
21816
21636
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
@@ -22074,11 +21894,11 @@ var init_run = __esm({
|
|
|
22074
21894
|
});
|
|
22075
21895
|
|
|
22076
21896
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
22077
|
-
import { useEffect as
|
|
21897
|
+
import { useEffect as useEffect8, useRef as useRef6, useState as useState11 } from "react";
|
|
22078
21898
|
function useExtraction(input) {
|
|
22079
21899
|
const [state2, setState] = useState11();
|
|
22080
21900
|
const current = useRef6();
|
|
22081
|
-
|
|
21901
|
+
useEffect8(() => {
|
|
22082
21902
|
current.current = input;
|
|
22083
21903
|
if (!input) {
|
|
22084
21904
|
setState(void 0);
|
|
@@ -22091,23 +21911,10 @@ function useExtraction(input) {
|
|
|
22091
21911
|
hasRawTokens: input.rawTokensPath !== ""
|
|
22092
21912
|
})
|
|
22093
21913
|
});
|
|
22094
|
-
let lastProgress;
|
|
22095
|
-
startDebugRun({
|
|
22096
|
-
flow: "import/extraction",
|
|
22097
|
-
step: "06-extraction",
|
|
22098
|
-
menuOption: "Extraction",
|
|
22099
|
-
inputs: extractionLogInputs(input)
|
|
22100
|
-
});
|
|
22101
21914
|
void runExtraction(input, (progress) => {
|
|
22102
|
-
lastProgress = progress;
|
|
22103
21915
|
if (current.current === input) setState({ status: "running", progress });
|
|
22104
21916
|
}).then((result) => {
|
|
22105
|
-
if (current.current
|
|
22106
|
-
void finishDebugRun({
|
|
22107
|
-
...extractionLogOutputs(result, lastProgress, input.credentials?.cmaToken ?? ""),
|
|
22108
|
-
exitMethod: result.ok ? "saved" : "discarded"
|
|
22109
|
-
});
|
|
22110
|
-
setState({ status: "done", result });
|
|
21917
|
+
if (current.current === input) setState({ status: "done", result });
|
|
22111
21918
|
});
|
|
22112
21919
|
return () => {
|
|
22113
21920
|
if (current.current === input) current.current = void 0;
|
|
@@ -22118,7 +21925,6 @@ function useExtraction(input) {
|
|
|
22118
21925
|
var init_use_extraction = __esm({
|
|
22119
21926
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts"() {
|
|
22120
21927
|
"use strict";
|
|
22121
|
-
init_debug_store();
|
|
22122
21928
|
init_logic9();
|
|
22123
21929
|
init_run();
|
|
22124
21930
|
}
|
|
@@ -22163,11 +21969,11 @@ var init_run_tokens_only = __esm({
|
|
|
22163
21969
|
});
|
|
22164
21970
|
|
|
22165
21971
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
22166
|
-
import { useEffect as
|
|
21972
|
+
import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
|
|
22167
21973
|
function useTokensOnly(input) {
|
|
22168
21974
|
const [state2, setState] = useState12();
|
|
22169
21975
|
const current = useRef7();
|
|
22170
|
-
|
|
21976
|
+
useEffect9(() => {
|
|
22171
21977
|
current.current = input;
|
|
22172
21978
|
if (!input) {
|
|
22173
21979
|
setState(void 0);
|
|
@@ -22190,39 +21996,6 @@ var init_use_tokens_only = __esm({
|
|
|
22190
21996
|
}
|
|
22191
21997
|
});
|
|
22192
21998
|
|
|
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
|
-
|
|
22226
21999
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/components/windowed-panel.tsx
|
|
22227
22000
|
import { Box as Box16, Text as Text16 } from "ink";
|
|
22228
22001
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -23477,7 +23250,7 @@ var init_useImmediateInput = __esm({
|
|
|
23477
23250
|
|
|
23478
23251
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
23479
23252
|
import { useStdout as useStdout2 } from "ink";
|
|
23480
|
-
import { useEffect as
|
|
23253
|
+
import { useEffect as useEffect10, useState as useState13 } from "react";
|
|
23481
23254
|
function readTerminalSize(stdout) {
|
|
23482
23255
|
return {
|
|
23483
23256
|
columns: stdout?.columns ?? 80,
|
|
@@ -23487,7 +23260,7 @@ function readTerminalSize(stdout) {
|
|
|
23487
23260
|
function useTerminalSize() {
|
|
23488
23261
|
const { stdout } = useStdout2();
|
|
23489
23262
|
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
23490
|
-
|
|
23263
|
+
useEffect10(() => {
|
|
23491
23264
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
23492
23265
|
stdout?.on("resize", updateSize);
|
|
23493
23266
|
updateSize();
|
|
@@ -24489,7 +24262,7 @@ var init_state = __esm({
|
|
|
24489
24262
|
});
|
|
24490
24263
|
|
|
24491
24264
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
24492
|
-
import { useEffect as
|
|
24265
|
+
import { useEffect as useEffect11, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
|
|
24493
24266
|
function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
|
|
24494
24267
|
const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
|
|
24495
24268
|
const columnPlan = useMemo3(
|
|
@@ -24536,7 +24309,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24536
24309
|
return seed;
|
|
24537
24310
|
});
|
|
24538
24311
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
24539
|
-
|
|
24312
|
+
useEffect11(() => {
|
|
24540
24313
|
if (seededGroupsRef.current) return;
|
|
24541
24314
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
24542
24315
|
seededGroupsRef.current = true;
|
|
@@ -24627,7 +24400,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24627
24400
|
entryCount: 0
|
|
24628
24401
|
});
|
|
24629
24402
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
24630
|
-
|
|
24403
|
+
useEffect11(() => {
|
|
24631
24404
|
setNav((prev) => {
|
|
24632
24405
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
24633
24406
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -24972,59 +24745,27 @@ var init_use_scope_gate = __esm({
|
|
|
24972
24745
|
});
|
|
24973
24746
|
|
|
24974
24747
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
24975
|
-
import {
|
|
24748
|
+
import { useMemo as useMemo4 } from "react";
|
|
24976
24749
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
24977
24750
|
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24978
24751
|
function ScopeGateScreen(props) {
|
|
24979
|
-
if (props.components.length === 0)
|
|
24752
|
+
if (props.components.length === 0) {
|
|
24753
|
+
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." }) });
|
|
24754
|
+
}
|
|
24980
24755
|
return /* @__PURE__ */ jsx29(ScopeGateView, { ...props });
|
|
24981
24756
|
}
|
|
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
|
-
}
|
|
24998
24757
|
function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
|
|
24999
24758
|
const tokens = useMemo4(() => {
|
|
25000
24759
|
const loaded = tokensPath ? loadTokenRows(tokensPath) : void 0;
|
|
25001
24760
|
return loaded?.ok ? loaded.rows : [];
|
|
25002
24761
|
}, [tokensPath]);
|
|
25003
24762
|
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
|
-
}, []);
|
|
25012
24763
|
const gate = useScopeGate({
|
|
25013
24764
|
components,
|
|
25014
24765
|
tokenCount: tokens.length,
|
|
25015
24766
|
tokensWidth: longest.path + longest.value + 10,
|
|
25016
|
-
onConfirm
|
|
25017
|
-
|
|
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
|
-
}
|
|
24767
|
+
onConfirm,
|
|
24768
|
+
onQuit
|
|
25028
24769
|
});
|
|
25029
24770
|
const { search, graph, columnPlan, panelLayout, counters } = gate;
|
|
25030
24771
|
if (gate.showHelp) {
|
|
@@ -25124,9 +24865,7 @@ var HELP_SECTIONS;
|
|
|
25124
24865
|
var init_screen8 = __esm({
|
|
25125
24866
|
"packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx"() {
|
|
25126
24867
|
"use strict";
|
|
25127
|
-
init_debug_store();
|
|
25128
24868
|
init_StepHeader();
|
|
25129
|
-
init_log();
|
|
25130
24869
|
init_tokens_column();
|
|
25131
24870
|
init_load();
|
|
25132
24871
|
init_logic10();
|
|
@@ -25234,27 +24973,13 @@ var init_load2 = __esm({
|
|
|
25234
24973
|
});
|
|
25235
24974
|
|
|
25236
24975
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
25237
|
-
import { useEffect as
|
|
24976
|
+
import { useEffect as useEffect12, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
|
|
25238
24977
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
25239
24978
|
const sessionId = input?.sessionId;
|
|
25240
24979
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
25241
24980
|
const cacheCheck = useRef10(void 0);
|
|
25242
24981
|
const [confirmed, setConfirmed] = useState17();
|
|
25243
|
-
|
|
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(() => {
|
|
24982
|
+
useEffect12(() => {
|
|
25258
24983
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
25259
24984
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
25260
24985
|
}, [input, loaded]);
|
|
@@ -25268,7 +24993,6 @@ var realDeps3;
|
|
|
25268
24993
|
var init_use_scope_gate_flow = __esm({
|
|
25269
24994
|
"packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts"() {
|
|
25270
24995
|
"use strict";
|
|
25271
|
-
init_debug_store();
|
|
25272
24996
|
init_cache_check();
|
|
25273
24997
|
init_load2();
|
|
25274
24998
|
realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
|
|
@@ -25276,41 +25000,6 @@ var init_use_scope_gate_flow = __esm({
|
|
|
25276
25000
|
});
|
|
25277
25001
|
|
|
25278
25002
|
// 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
|
-
}
|
|
25314
25003
|
function initialProgress2() {
|
|
25315
25004
|
return { components: null, mapTokens: "idle", mapTokensEligible: null };
|
|
25316
25005
|
}
|
|
@@ -25561,34 +25250,21 @@ var init_run2 = __esm({
|
|
|
25561
25250
|
});
|
|
25562
25251
|
|
|
25563
25252
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
25564
|
-
import { useEffect as
|
|
25253
|
+
import { useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
|
|
25565
25254
|
function useGeneration(input) {
|
|
25566
25255
|
const [state2, setState] = useState18();
|
|
25567
25256
|
const current = useRef11();
|
|
25568
|
-
|
|
25257
|
+
useEffect13(() => {
|
|
25569
25258
|
current.current = input;
|
|
25570
25259
|
if (!input) {
|
|
25571
25260
|
setState(void 0);
|
|
25572
25261
|
return;
|
|
25573
25262
|
}
|
|
25574
25263
|
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
|
-
});
|
|
25582
25264
|
void runGeneration(input, (progress) => {
|
|
25583
|
-
lastProgress = progress;
|
|
25584
25265
|
if (current.current === input) setState({ status: "running", progress });
|
|
25585
25266
|
}).then((result) => {
|
|
25586
|
-
if (current.current
|
|
25587
|
-
void finishDebugRun({
|
|
25588
|
-
...generationLogOutputs(result, lastProgress),
|
|
25589
|
-
exitMethod: result.ok ? "saved" : "discarded"
|
|
25590
|
-
});
|
|
25591
|
-
setState({ status: "done", result });
|
|
25267
|
+
if (current.current === input) setState({ status: "done", result });
|
|
25592
25268
|
});
|
|
25593
25269
|
return () => {
|
|
25594
25270
|
if (current.current === input) current.current = void 0;
|
|
@@ -25599,7 +25275,6 @@ function useGeneration(input) {
|
|
|
25599
25275
|
var init_use_generation = __esm({
|
|
25600
25276
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts"() {
|
|
25601
25277
|
"use strict";
|
|
25602
|
-
init_debug_store();
|
|
25603
25278
|
init_logic11();
|
|
25604
25279
|
init_run2();
|
|
25605
25280
|
}
|
|
@@ -25729,9 +25404,12 @@ var init_schema2 = __esm({
|
|
|
25729
25404
|
$required: { type: "boolean" },
|
|
25730
25405
|
$default: {},
|
|
25731
25406
|
$values: { type: "array", items: { type: "string" } },
|
|
25732
|
-
"$token.kind": { type: "string" },
|
|
25407
|
+
"$token.kind": { type: "string", minLength: 1 },
|
|
25733
25408
|
"$token.allowed": { type: "array", items: { type: "string" } }
|
|
25734
25409
|
},
|
|
25410
|
+
// The API rejects a token property that does not say which kind of token it takes.
|
|
25411
|
+
if: { type: "object", properties: { $type: { const: "token" } }, required: ["$type"] },
|
|
25412
|
+
then: { type: "object", required: ["$token.kind"] },
|
|
25735
25413
|
additionalProperties: false
|
|
25736
25414
|
},
|
|
25737
25415
|
slot: {
|
|
@@ -26566,7 +26244,7 @@ var init_scroll_offset = __esm({
|
|
|
26566
26244
|
});
|
|
26567
26245
|
|
|
26568
26246
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26569
|
-
import React13, { useEffect as
|
|
26247
|
+
import React13, { useEffect as useEffect14, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
26570
26248
|
import figures6 from "figures";
|
|
26571
26249
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26572
26250
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -28093,7 +27771,7 @@ function FieldEditor({
|
|
|
28093
27771
|
}
|
|
28094
27772
|
return Math.max(start + 1, end2);
|
|
28095
27773
|
};
|
|
28096
|
-
|
|
27774
|
+
useEffect14(() => {
|
|
28097
27775
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
28098
27776
|
setListScrollStart((previous) => {
|
|
28099
27777
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -29488,7 +29166,7 @@ var init_FinalizeDialog = __esm({
|
|
|
29488
29166
|
});
|
|
29489
29167
|
|
|
29490
29168
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
29491
|
-
import { useEffect as
|
|
29169
|
+
import { useEffect as useEffect15, useRef as useRef12, useState as useState20 } from "react";
|
|
29492
29170
|
function useReviewFinalizePreview({
|
|
29493
29171
|
components,
|
|
29494
29172
|
...options
|
|
@@ -29505,7 +29183,7 @@ function useFinalizePreview(opts) {
|
|
|
29505
29183
|
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
29506
29184
|
const generationRef = useRef12(0);
|
|
29507
29185
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
29508
|
-
|
|
29186
|
+
useEffect15(() => {
|
|
29509
29187
|
if (!open) {
|
|
29510
29188
|
setStatus("idle");
|
|
29511
29189
|
setRemoved([]);
|
|
@@ -29557,7 +29235,7 @@ var init_use_finalize_preview = __esm({
|
|
|
29557
29235
|
});
|
|
29558
29236
|
|
|
29559
29237
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
29560
|
-
import { useCallback as useCallback2, useEffect as
|
|
29238
|
+
import { useCallback as useCallback2, useEffect as useEffect16, useRef as useRef13, useState as useState21 } from "react";
|
|
29561
29239
|
function useReviewSession({
|
|
29562
29240
|
loadSession,
|
|
29563
29241
|
tokensPath,
|
|
@@ -29576,7 +29254,7 @@ function useReviewSession({
|
|
|
29576
29254
|
}));
|
|
29577
29255
|
return { result, catalog };
|
|
29578
29256
|
}, [loadSession, tokensPath]);
|
|
29579
|
-
|
|
29257
|
+
useEffect16(() => {
|
|
29580
29258
|
let disposed = false;
|
|
29581
29259
|
void (async () => {
|
|
29582
29260
|
try {
|
|
@@ -29629,7 +29307,7 @@ function useReviewSession({
|
|
|
29629
29307
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29630
29308
|
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
29631
29309
|
const [componentRationale, setComponentRationale] = useState21(null);
|
|
29632
|
-
|
|
29310
|
+
useEffect16(() => {
|
|
29633
29311
|
const current = components[selectedIdx];
|
|
29634
29312
|
if (!current) {
|
|
29635
29313
|
setReviewMetadata(null);
|
|
@@ -29661,7 +29339,7 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
|
29661
29339
|
function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
|
|
29662
29340
|
const historyRef = useRef13(null);
|
|
29663
29341
|
const historySeededRef = useRef13(false);
|
|
29664
|
-
|
|
29342
|
+
useEffect16(() => {
|
|
29665
29343
|
if (loading || historySeededRef.current) return;
|
|
29666
29344
|
historySeededRef.current = true;
|
|
29667
29345
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -29743,7 +29421,7 @@ var init_token_suggestions = __esm({
|
|
|
29743
29421
|
});
|
|
29744
29422
|
|
|
29745
29423
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
29746
|
-
import { useEffect as
|
|
29424
|
+
import { useEffect as useEffect17, useRef as useRef14, useState as useState22 } from "react";
|
|
29747
29425
|
function parseReviewEntry(draftValue) {
|
|
29748
29426
|
const parsed = JSON.parse(draftValue);
|
|
29749
29427
|
const keys = Object.keys(parsed);
|
|
@@ -29777,7 +29455,7 @@ function useReviewEditor({
|
|
|
29777
29455
|
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
29778
29456
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
29779
29457
|
const pendingGRef = useRef14(false);
|
|
29780
|
-
|
|
29458
|
+
useEffect17(() => {
|
|
29781
29459
|
setTokenReviewRow(0);
|
|
29782
29460
|
setTokenReviewEditing(false);
|
|
29783
29461
|
setTokenReviewEditCursor(0);
|
|
@@ -30259,7 +29937,7 @@ var init_preview_annotations = __esm({
|
|
|
30259
29937
|
});
|
|
30260
29938
|
|
|
30261
29939
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
30262
|
-
import { useCallback as useCallback3, useEffect as
|
|
29940
|
+
import { useCallback as useCallback3, useEffect as useEffect18, useRef as useRef15, useState as useState24 } from "react";
|
|
30263
29941
|
function useLivePreview(opts) {
|
|
30264
29942
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
30265
29943
|
const [status, setStatus] = useState24("idle");
|
|
@@ -30269,14 +29947,14 @@ function useLivePreview(opts) {
|
|
|
30269
29947
|
const latestRef = useRef15(0);
|
|
30270
29948
|
const inflightRef = useRef15(0);
|
|
30271
29949
|
const optsRef = useRef15(opts);
|
|
30272
|
-
|
|
29950
|
+
useEffect18(() => {
|
|
30273
29951
|
optsRef.current = opts;
|
|
30274
29952
|
});
|
|
30275
29953
|
const disabledRef = useRef15(disabled);
|
|
30276
|
-
|
|
29954
|
+
useEffect18(() => {
|
|
30277
29955
|
disabledRef.current = disabled;
|
|
30278
29956
|
}, [disabled]);
|
|
30279
|
-
|
|
29957
|
+
useEffect18(() => {
|
|
30280
29958
|
return () => {
|
|
30281
29959
|
if (timerRef.current) {
|
|
30282
29960
|
clearTimeout(timerRef.current);
|
|
@@ -30357,7 +30035,7 @@ var init_use_live_preview = __esm({
|
|
|
30357
30035
|
});
|
|
30358
30036
|
|
|
30359
30037
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
30360
|
-
import { useCallback as useCallback4, useEffect as
|
|
30038
|
+
import { useCallback as useCallback4, useEffect as useEffect19, useState as useState25 } from "react";
|
|
30361
30039
|
function useReviewPreview({
|
|
30362
30040
|
components,
|
|
30363
30041
|
loading,
|
|
@@ -30399,13 +30077,13 @@ function useReviewPreview({
|
|
|
30399
30077
|
deleteAllComponents
|
|
30400
30078
|
});
|
|
30401
30079
|
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
30402
|
-
|
|
30080
|
+
useEffect19(() => {
|
|
30403
30081
|
if (livePreviewHook.status !== "running") return;
|
|
30404
30082
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
30405
30083
|
return () => clearInterval(id);
|
|
30406
30084
|
}, [livePreviewHook.status]);
|
|
30407
30085
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
30408
|
-
|
|
30086
|
+
useEffect19(() => {
|
|
30409
30087
|
if (loading) return;
|
|
30410
30088
|
if (!livePreview) return;
|
|
30411
30089
|
if (components.length === 0) return;
|
|
@@ -30462,7 +30140,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
30462
30140
|
});
|
|
30463
30141
|
|
|
30464
30142
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
30465
|
-
import { useCallback as useCallback5, useEffect as
|
|
30143
|
+
import { useCallback as useCallback5, useEffect as useEffect20, useMemo as useMemo6, useRef as useRef16, useState as useState26 } from "react";
|
|
30466
30144
|
import figures8 from "figures";
|
|
30467
30145
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
30468
30146
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -30783,7 +30461,7 @@ function GenerateReviewStepView({
|
|
|
30783
30461
|
[components]
|
|
30784
30462
|
);
|
|
30785
30463
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
30786
|
-
|
|
30464
|
+
useEffect20(() => {
|
|
30787
30465
|
if (seededGroupsRef.current) return;
|
|
30788
30466
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
30789
30467
|
seededGroupsRef.current = true;
|
|
@@ -30810,7 +30488,7 @@ function GenerateReviewStepView({
|
|
|
30810
30488
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
30811
30489
|
}));
|
|
30812
30490
|
}, [slotCycles, cycleView]);
|
|
30813
|
-
|
|
30491
|
+
useEffect20(() => {
|
|
30814
30492
|
const decision = computeAutoRejectDecision({
|
|
30815
30493
|
loading,
|
|
30816
30494
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -30854,7 +30532,7 @@ function GenerateReviewStepView({
|
|
|
30854
30532
|
applySnapshot: applyHistorySnapshot
|
|
30855
30533
|
});
|
|
30856
30534
|
const autoRejectPushedRef = useRef16(false);
|
|
30857
|
-
|
|
30535
|
+
useEffect20(() => {
|
|
30858
30536
|
if (loading) return;
|
|
30859
30537
|
if (!historySeededRef.current) return;
|
|
30860
30538
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -30938,7 +30616,7 @@ function GenerateReviewStepView({
|
|
|
30938
30616
|
const panelHeight = leftPanelHeight + 2;
|
|
30939
30617
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
30940
30618
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
30941
|
-
|
|
30619
|
+
useEffect20(() => {
|
|
30942
30620
|
if (selectableRowPositions.length === 0) return;
|
|
30943
30621
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
30944
30622
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -32020,10 +31698,10 @@ var init_path_utils = __esm({
|
|
|
32020
31698
|
});
|
|
32021
31699
|
|
|
32022
31700
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
32023
|
-
import { useEffect as
|
|
31701
|
+
import { useEffect as useEffect21, useState as useState27 } from "react";
|
|
32024
31702
|
function useBlinkingCursor() {
|
|
32025
31703
|
const [visible, setVisible] = useState27(true);
|
|
32026
|
-
|
|
31704
|
+
useEffect21(() => {
|
|
32027
31705
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
32028
31706
|
return () => clearInterval(interval);
|
|
32029
31707
|
}, []);
|
|
@@ -32160,12 +31838,12 @@ var init_produced = __esm({
|
|
|
32160
31838
|
});
|
|
32161
31839
|
|
|
32162
31840
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
32163
|
-
import { useEffect as
|
|
31841
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
32164
31842
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
32165
31843
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
32166
31844
|
function useTimedSpinner() {
|
|
32167
31845
|
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
32168
|
-
|
|
31846
|
+
useEffect22(() => {
|
|
32169
31847
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
32170
31848
|
return () => {
|
|
32171
31849
|
clearInterval(timer);
|
|
@@ -32434,7 +32112,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
32434
32112
|
});
|
|
32435
32113
|
|
|
32436
32114
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
32437
|
-
import { useEffect as
|
|
32115
|
+
import { useEffect as useEffect23, useState as useState30, useMemo as useMemo7 } from "react";
|
|
32438
32116
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
32439
32117
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
32440
32118
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -32644,7 +32322,7 @@ function WizardPreviewStep({
|
|
|
32644
32322
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
32645
32323
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
32646
32324
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
32647
|
-
|
|
32325
|
+
useEffect23(() => {
|
|
32648
32326
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
32649
32327
|
}, [maxScroll]);
|
|
32650
32328
|
useImmediateInput((input, key) => {
|
|
@@ -32754,200 +32432,6 @@ var init_run_teaser = __esm({
|
|
|
32754
32432
|
}
|
|
32755
32433
|
});
|
|
32756
32434
|
|
|
32757
|
-
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
32758
|
-
function previewSummary(preview) {
|
|
32759
|
-
const counts = (group) => ({
|
|
32760
|
-
new: group.new.length,
|
|
32761
|
-
changed: group.changed.length,
|
|
32762
|
-
removed: group.removed.length
|
|
32763
|
-
});
|
|
32764
|
-
return {
|
|
32765
|
-
components: counts(preview.components),
|
|
32766
|
-
tokens: counts(preview.tokens),
|
|
32767
|
-
breaking_components: preview.components.changed.filter(
|
|
32768
|
-
(entry) => entry.changeClassification?.classification === "breaking"
|
|
32769
|
-
).length
|
|
32770
|
-
};
|
|
32771
|
-
}
|
|
32772
|
-
function pushSummary(result, state2) {
|
|
32773
|
-
const failures = result.failures ?? [];
|
|
32774
|
-
return {
|
|
32775
|
-
component_types: result.componentTypes,
|
|
32776
|
-
design_tokens: result.designTokens,
|
|
32777
|
-
...result.summary ? { summary: result.summary } : {},
|
|
32778
|
-
...failures.length > 0 ? {
|
|
32779
|
-
failure_count: failures.length,
|
|
32780
|
-
failures: failures.slice(0, MAX_LOGGED).map((failure) => ({
|
|
32781
|
-
entity_type: failure.entityType,
|
|
32782
|
-
entity_id: failure.entityId,
|
|
32783
|
-
message: scrub(failure.message, state2)
|
|
32784
|
-
}))
|
|
32785
|
-
} : {}
|
|
32786
|
-
};
|
|
32787
|
-
}
|
|
32788
|
-
function flowContext(state2) {
|
|
32789
|
-
return {
|
|
32790
|
-
agent: state2.agent,
|
|
32791
|
-
space_id: state2.spaceId,
|
|
32792
|
-
environment_id: state2.environmentId,
|
|
32793
|
-
host: state2.host,
|
|
32794
|
-
credentials_skipped: state2.credentialsSkipped,
|
|
32795
|
-
components_generated: state2.generatedCount,
|
|
32796
|
-
components_accepted: state2.generatedAcceptedCount,
|
|
32797
|
-
tokens: state2.tokenCount,
|
|
32798
|
-
cma_token: state2.cmaToken
|
|
32799
|
-
};
|
|
32800
|
-
}
|
|
32801
|
-
function arrive(trail, state2) {
|
|
32802
|
-
const next = { ...trail, at: state2.step };
|
|
32803
|
-
if (state2.step === "error") {
|
|
32804
|
-
next.failure = { step: state2.errorStep, message: scrub(state2.errorMessage, state2) };
|
|
32805
|
-
}
|
|
32806
|
-
if (state2.step === "preview-validation-error") {
|
|
32807
|
-
next.validation = {
|
|
32808
|
-
count: state2.previewValidationErrors.length,
|
|
32809
|
-
errors: state2.previewValidationErrors.slice(0, MAX_LOGGED).map((error) => ({
|
|
32810
|
-
component: error.componentName,
|
|
32811
|
-
path: error.path,
|
|
32812
|
-
message: scrub(error.message, state2)
|
|
32813
|
-
})),
|
|
32814
|
-
missing_names: state2.previewValidationMissingNames.slice(0, MAX_LOGGED * 2)
|
|
32815
|
-
};
|
|
32816
|
-
}
|
|
32817
|
-
return next;
|
|
32818
|
-
}
|
|
32819
|
-
function openTrail(state2, now) {
|
|
32820
|
-
return arrive({ startedAt: now, stageStartedAt: now, at: state2.step, stages: [], edits: 0 }, state2);
|
|
32821
|
-
}
|
|
32822
|
-
function advance(trail, from, to, now) {
|
|
32823
|
-
const next = { ...trail, stages: [...trail.stages], stageStartedAt: now };
|
|
32824
|
-
const failed = to.step === "error" || to.step === "preview-validation-error" || from.step === "pushing" && pushHasFailures(to.pushResult);
|
|
32825
|
-
if (WORK.includes(from.step)) {
|
|
32826
|
-
next.stages.push(`${LABELS[from.step]}: ${failed ? "failed" : "ok"} (${seconds(now - trail.stageStartedAt)}s)`);
|
|
32827
|
-
}
|
|
32828
|
-
if (from.step === "previewing" && to.serverPreview) next.preview = previewSummary(to.serverPreview);
|
|
32829
|
-
if (from.step === "pushing") {
|
|
32830
|
-
next.push = pushSummary(to.pushResult, to);
|
|
32831
|
-
next.pushFailed = pushHasFailures(to.pushResult);
|
|
32832
|
-
}
|
|
32833
|
-
if (from.step === "printing" && !failed) next.saved = { path: to.componentsPath, run_id: to.lastRunId };
|
|
32834
|
-
if (from.step === "preview-gate" && to.step === "final-review") next.edits += 1;
|
|
32835
|
-
return arrive(next, to);
|
|
32836
|
-
}
|
|
32837
|
-
function render(trail, now, outcome) {
|
|
32838
|
-
return {
|
|
32839
|
-
outcome,
|
|
32840
|
-
total_seconds: seconds(now - trail.startedAt),
|
|
32841
|
-
stages: trail.stages,
|
|
32842
|
-
...trail.preview ? { preview: trail.preview } : {},
|
|
32843
|
-
...trail.edits > 0 ? { edited_definitions_after_preview: trail.edits } : {},
|
|
32844
|
-
...trail.push ? { push: trail.push } : {},
|
|
32845
|
-
...trail.saved ? { saved: trail.saved } : {},
|
|
32846
|
-
...trail.failure ? { error: trail.failure } : {},
|
|
32847
|
-
...trail.validation ? { preview_validation: trail.validation } : {}
|
|
32848
|
-
};
|
|
32849
|
-
}
|
|
32850
|
-
function flowProgress(trail, now) {
|
|
32851
|
-
return render(trail, now, `interrupted at ${LABELS[trail.at]}`);
|
|
32852
|
-
}
|
|
32853
|
-
function flowFinish(trail, final, now) {
|
|
32854
|
-
if (!final) {
|
|
32855
|
-
const midWork = WORK.includes(trail.at);
|
|
32856
|
-
const outcome2 = `left the import ${midWork ? "while" : "at"} ${LABELS[trail.at]}${midWork ? " was running" : ""}`;
|
|
32857
|
-
return { outputs: render(trail, now, outcome2), status: midWork ? "error" : "success", exitMethod: "discarded" };
|
|
32858
|
-
}
|
|
32859
|
-
let outcome;
|
|
32860
|
-
let failed = true;
|
|
32861
|
-
if (trail.validation) {
|
|
32862
|
-
outcome = `blocked by ${String(trail.validation["count"])} preview validation error(s)`;
|
|
32863
|
-
} else if (trail.failure) {
|
|
32864
|
-
outcome = `failed at ${trail.failure.step}: ${trail.failure.message.slice(0, MAX_OUTCOME)}`;
|
|
32865
|
-
} else if (trail.pushFailed) {
|
|
32866
|
-
outcome = "pushed, but some entities failed";
|
|
32867
|
-
} else {
|
|
32868
|
-
failed = false;
|
|
32869
|
-
outcome = final.credentialsSkipped ? "saved without pushing (credentials skipped)" : "published";
|
|
32870
|
-
}
|
|
32871
|
-
return {
|
|
32872
|
-
outputs: render(trail, now, outcome),
|
|
32873
|
-
status: failed ? "error" : "success",
|
|
32874
|
-
exitMethod: failed ? "discarded" : "saved"
|
|
32875
|
-
};
|
|
32876
|
-
}
|
|
32877
|
-
var FLOW_RUN, LABELS, WORK, FINISHED, MAX_LOGGED, MAX_OUTCOME, scrub, seconds, pushHasFailures, isFlowFinished;
|
|
32878
|
-
var init_flow_log = __esm({
|
|
32879
|
-
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts"() {
|
|
32880
|
-
"use strict";
|
|
32881
|
-
init_debug_trail();
|
|
32882
|
-
FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
32883
|
-
LABELS = {
|
|
32884
|
-
"final-review": "Final review",
|
|
32885
|
-
"path-prompt": "Save path",
|
|
32886
|
-
printing: "Save files",
|
|
32887
|
-
previewing: "Preview",
|
|
32888
|
-
"preview-gate": "Preview confirmation",
|
|
32889
|
-
pushing: "Push",
|
|
32890
|
-
"print-gate": "Files saved",
|
|
32891
|
-
done: "Done",
|
|
32892
|
-
error: "Error",
|
|
32893
|
-
"preview-validation-error": "Preview validation"
|
|
32894
|
-
};
|
|
32895
|
-
WORK = ["printing", "previewing", "pushing"];
|
|
32896
|
-
FINISHED = ["done", "error", "preview-validation-error"];
|
|
32897
|
-
MAX_LOGGED = 10;
|
|
32898
|
-
MAX_OUTCOME = 200;
|
|
32899
|
-
scrub = (text, state2) => scrubError(text, [state2.cmaToken]);
|
|
32900
|
-
seconds = (ms) => Math.round(ms / 100) / 10;
|
|
32901
|
-
pushHasFailures = (result) => result.componentTypes.failed + result.designTokens.failed > 0 || (result.failures?.length ?? 0) > 0 || (result.summary?.failed ?? 0) > 0;
|
|
32902
|
-
isFlowFinished = (step) => FINISHED.includes(step);
|
|
32903
|
-
}
|
|
32904
|
-
});
|
|
32905
|
-
|
|
32906
|
-
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
32907
|
-
import { useEffect as useEffect27, useRef as useRef17 } from "react";
|
|
32908
|
-
function useFlowLog(state2) {
|
|
32909
|
-
const trail = useRef17(void 0);
|
|
32910
|
-
const previous = useRef17(void 0);
|
|
32911
|
-
useEffect27(() => {
|
|
32912
|
-
const before = previous.current;
|
|
32913
|
-
previous.current = state2;
|
|
32914
|
-
const moved = before !== void 0 && before.step !== state2.step;
|
|
32915
|
-
const now = Date.now();
|
|
32916
|
-
let open = trail.current;
|
|
32917
|
-
if (!open) {
|
|
32918
|
-
if (state2.step === "final-review" || before && !moved) return;
|
|
32919
|
-
open = openTrail(state2, now);
|
|
32920
|
-
startDebugRun({ ...FLOW_RUN, inputs: flowContext(state2) });
|
|
32921
|
-
} else if (before && moved) {
|
|
32922
|
-
open = advance(open, before, state2, now);
|
|
32923
|
-
} else {
|
|
32924
|
-
return;
|
|
32925
|
-
}
|
|
32926
|
-
if (isFlowFinished(state2.step)) {
|
|
32927
|
-
trail.current = void 0;
|
|
32928
|
-
void finishDebugRun(flowFinish(open, state2, now));
|
|
32929
|
-
return;
|
|
32930
|
-
}
|
|
32931
|
-
trail.current = open;
|
|
32932
|
-
setDebugRunProgress(flowProgress(open, now));
|
|
32933
|
-
}, [state2]);
|
|
32934
|
-
useEffect27(
|
|
32935
|
-
() => () => {
|
|
32936
|
-
const open = trail.current;
|
|
32937
|
-
trail.current = void 0;
|
|
32938
|
-
if (open) void finishDebugRun(flowFinish(open, void 0, Date.now()));
|
|
32939
|
-
},
|
|
32940
|
-
[]
|
|
32941
|
-
);
|
|
32942
|
-
}
|
|
32943
|
-
var init_use_flow_log = __esm({
|
|
32944
|
-
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts"() {
|
|
32945
|
-
"use strict";
|
|
32946
|
-
init_debug_store();
|
|
32947
|
-
init_flow_log();
|
|
32948
|
-
}
|
|
32949
|
-
});
|
|
32950
|
-
|
|
32951
32435
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
32952
32436
|
import { Box as Box45 } from "ink";
|
|
32953
32437
|
import { jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -32962,7 +32446,6 @@ function FlowScreen({
|
|
|
32962
32446
|
generatePromptPath,
|
|
32963
32447
|
onExit
|
|
32964
32448
|
}) {
|
|
32965
|
-
useFlowLog(state2);
|
|
32966
32449
|
const produced = producedOf(state2);
|
|
32967
32450
|
const counts = { components: state2.generatedAcceptedCount, tokens: state2.tokenCount };
|
|
32968
32451
|
const things = countedThings(produced, counts);
|
|
@@ -33090,7 +32573,6 @@ var init_screen11 = __esm({
|
|
|
33090
32573
|
init_WizardPreviewStep();
|
|
33091
32574
|
init_produced();
|
|
33092
32575
|
init_run_teaser();
|
|
33093
|
-
init_use_flow_log();
|
|
33094
32576
|
}
|
|
33095
32577
|
});
|
|
33096
32578
|
|
|
@@ -33483,7 +32965,8 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
33483
32965
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
33484
32966
|
const validation = validateCDF2(cdf);
|
|
33485
32967
|
if (!validation.valid) {
|
|
33486
|
-
|
|
32968
|
+
const errors = validation.errors.filter((error) => error.message !== 'must match "then" schema');
|
|
32969
|
+
throw new Error(`generated CDF failed validation: ${errors.map(describeCdfError).join("; ")}`);
|
|
33487
32970
|
}
|
|
33488
32971
|
return cdf;
|
|
33489
32972
|
}
|
|
@@ -33562,7 +33045,7 @@ async function recordRun(input, deps) {
|
|
|
33562
33045
|
return null;
|
|
33563
33046
|
}
|
|
33564
33047
|
}
|
|
33565
|
-
var SAVE_CONFIRMATION_DELAY_MS, realSaveDeps;
|
|
33048
|
+
var SAVE_CONFIRMATION_DELAY_MS, describeCdfError, realSaveDeps;
|
|
33566
33049
|
var init_save = __esm({
|
|
33567
33050
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts"() {
|
|
33568
33051
|
"use strict";
|
|
@@ -33570,6 +33053,7 @@ var init_save = __esm({
|
|
|
33570
33053
|
init_src4();
|
|
33571
33054
|
init_run_print_files_helpers();
|
|
33572
33055
|
SAVE_CONFIRMATION_DELAY_MS = 1e3;
|
|
33056
|
+
describeCdfError = (error) => `${error.path.replace(/^\//, "").replace("/$properties/", ".").replaceAll("/", ".")}: ${error.message}`;
|
|
33573
33057
|
realSaveDeps = () => ({
|
|
33574
33058
|
openDb: openPipelineDb,
|
|
33575
33059
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
@@ -33888,9 +33372,9 @@ var init_controller = __esm({
|
|
|
33888
33372
|
});
|
|
33889
33373
|
|
|
33890
33374
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
33891
|
-
import { useEffect as
|
|
33375
|
+
import { useEffect as useEffect24, useRef as useRef17, useSyncExternalStore } from "react";
|
|
33892
33376
|
function useFlow(start, options = {}) {
|
|
33893
|
-
const controller =
|
|
33377
|
+
const controller = useRef17();
|
|
33894
33378
|
if (start && !controller.current) {
|
|
33895
33379
|
try {
|
|
33896
33380
|
startWizardLog();
|
|
@@ -33907,7 +33391,7 @@ function useFlow(start, options = {}) {
|
|
|
33907
33391
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
33908
33392
|
() => current?.getState()
|
|
33909
33393
|
);
|
|
33910
|
-
|
|
33394
|
+
useEffect24(() => {
|
|
33911
33395
|
if (!start) controller.current = void 0;
|
|
33912
33396
|
}, [start]);
|
|
33913
33397
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
@@ -33986,7 +33470,7 @@ var init_help_info = __esm({
|
|
|
33986
33470
|
});
|
|
33987
33471
|
|
|
33988
33472
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
33989
|
-
import { useEffect as
|
|
33473
|
+
import { useEffect as useEffect25, useState as useState31 } from "react";
|
|
33990
33474
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
33991
33475
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33992
33476
|
function Section({ title, rows }) {
|
|
@@ -34000,7 +33484,7 @@ function Section({ title, rows }) {
|
|
|
34000
33484
|
}
|
|
34001
33485
|
function HelpScreen({ onDone }) {
|
|
34002
33486
|
const [info, setInfo] = useState31();
|
|
34003
|
-
|
|
33487
|
+
useEffect25(() => {
|
|
34004
33488
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
34005
33489
|
void readHelpInfo().then(setInfo);
|
|
34006
33490
|
}, []);
|
|
@@ -34108,6 +33592,45 @@ var init_PageContainer3 = __esm({
|
|
|
34108
33592
|
}
|
|
34109
33593
|
});
|
|
34110
33594
|
|
|
33595
|
+
// packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts
|
|
33596
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
33597
|
+
function diffSnapshots(before, after) {
|
|
33598
|
+
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
33599
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
33600
|
+
return { changed: changed_fields.length > 0, changed_fields };
|
|
33601
|
+
}
|
|
33602
|
+
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
33603
|
+
const actions = [];
|
|
33604
|
+
return {
|
|
33605
|
+
record(action) {
|
|
33606
|
+
actions.push(action);
|
|
33607
|
+
if (actions.length > limit) actions.shift();
|
|
33608
|
+
},
|
|
33609
|
+
entries: () => [...actions]
|
|
33610
|
+
};
|
|
33611
|
+
}
|
|
33612
|
+
function scrubError(error, secrets) {
|
|
33613
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
33614
|
+
for (const secret of secrets) {
|
|
33615
|
+
if (secret.length < MIN_SECRET_LENGTH) continue;
|
|
33616
|
+
for (const form of /* @__PURE__ */ new Set([secret, encodeURIComponent(secret)])) message = message.split(form).join("[redacted]");
|
|
33617
|
+
}
|
|
33618
|
+
return message;
|
|
33619
|
+
}
|
|
33620
|
+
function describeSettingsFile() {
|
|
33621
|
+
const path5 = configFilePath2();
|
|
33622
|
+
return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync11(path5) };
|
|
33623
|
+
}
|
|
33624
|
+
var DEFAULT_TRAIL_LIMIT, MIN_SECRET_LENGTH;
|
|
33625
|
+
var init_debug_trail = __esm({
|
|
33626
|
+
"packages/experience-design-system-cli/src/tui/settings/shared/debug-trail.ts"() {
|
|
33627
|
+
"use strict";
|
|
33628
|
+
init_config();
|
|
33629
|
+
DEFAULT_TRAIL_LIMIT = 30;
|
|
33630
|
+
MIN_SECRET_LENGTH = 6;
|
|
33631
|
+
}
|
|
33632
|
+
});
|
|
33633
|
+
|
|
34111
33634
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
34112
33635
|
import { execFile as execFile2 } from "node:child_process";
|
|
34113
33636
|
import { access as access5, constants } from "node:fs/promises";
|
|
@@ -34173,7 +33696,7 @@ async function testAgent(name, binary, model) {
|
|
|
34173
33696
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
34174
33697
|
})
|
|
34175
33698
|
);
|
|
34176
|
-
const
|
|
33699
|
+
const seconds = ((Date.now() - started) / 1e3).toFixed(1);
|
|
34177
33700
|
if (result.timedOut) {
|
|
34178
33701
|
return [...checks, { ...fail3("prompt", `no answer within ${PROMPT_TIMEOUT_MS / 1e3}s`), timedOut: true }];
|
|
34179
33702
|
}
|
|
@@ -34181,7 +33704,7 @@ async function testAgent(name, binary, model) {
|
|
|
34181
33704
|
const reason = result.stderr.trim().split("\n").pop()?.slice(0, 160) || `exited with code ${result.exitCode}`;
|
|
34182
33705
|
return [...checks, fail3("prompt", reason)];
|
|
34183
33706
|
}
|
|
34184
|
-
return [...checks, pass("prompt", `answered in ${
|
|
33707
|
+
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
34185
33708
|
}
|
|
34186
33709
|
function statusFromChecks(name, checks, savedBinary) {
|
|
34187
33710
|
if (checks.length === 0) return "checking";
|
|
@@ -34382,7 +33905,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
34382
33905
|
});
|
|
34383
33906
|
|
|
34384
33907
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
34385
|
-
import { useEffect as
|
|
33908
|
+
import { useEffect as useEffect26, useState as useState33 } from "react";
|
|
34386
33909
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
34387
33910
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
34388
33911
|
function StatusHeading() {
|
|
@@ -34403,7 +33926,7 @@ function AgentDetail({
|
|
|
34403
33926
|
const [testing, setTesting] = useState33(false);
|
|
34404
33927
|
const [notice, setNotice] = useState33(null);
|
|
34405
33928
|
const [checks, setChecks] = useState33(void 0);
|
|
34406
|
-
|
|
33929
|
+
useEffect26(() => {
|
|
34407
33930
|
let active = true;
|
|
34408
33931
|
setChecks(void 0);
|
|
34409
33932
|
const timer = setTimeout(() => {
|
|
@@ -34495,7 +34018,7 @@ var init_AgentDetail = __esm({
|
|
|
34495
34018
|
});
|
|
34496
34019
|
|
|
34497
34020
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
34498
|
-
import { useEffect as
|
|
34021
|
+
import { useEffect as useEffect27, useRef as useRef18, useState as useState34 } from "react";
|
|
34499
34022
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
34500
34023
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
34501
34024
|
function AgentsScreen({ onDone }) {
|
|
@@ -34506,7 +34029,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34506
34029
|
const [saving, setSaving] = useState34(false);
|
|
34507
34030
|
const [loadError, setLoadError] = useState34(null);
|
|
34508
34031
|
const [checks, setChecks] = useState34({});
|
|
34509
|
-
const visit =
|
|
34032
|
+
const visit = useRef18({
|
|
34510
34033
|
trail: createTrail(),
|
|
34511
34034
|
before: void 0,
|
|
34512
34035
|
environment: void 0,
|
|
@@ -34519,7 +34042,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34519
34042
|
);
|
|
34520
34043
|
}
|
|
34521
34044
|
};
|
|
34522
|
-
|
|
34045
|
+
useEffect27(() => {
|
|
34523
34046
|
readAgentConfig().then((loaded) => {
|
|
34524
34047
|
setConfig(loaded);
|
|
34525
34048
|
inspectAll(loaded);
|
|
@@ -34745,7 +34268,7 @@ var init_project_store = __esm({
|
|
|
34745
34268
|
});
|
|
34746
34269
|
|
|
34747
34270
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
34748
|
-
import { useEffect as
|
|
34271
|
+
import { useEffect as useEffect28, useRef as useRef19, useState as useState35 } from "react";
|
|
34749
34272
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
34750
34273
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
34751
34274
|
function debugFields(config) {
|
|
@@ -34764,14 +34287,14 @@ function ProjectScreen({ onDone }) {
|
|
|
34764
34287
|
const [saving, setSaving] = useState35(false);
|
|
34765
34288
|
const [notice, setNotice] = useState35(null);
|
|
34766
34289
|
const [loadError, setLoadError] = useState35(null);
|
|
34767
|
-
const visit =
|
|
34290
|
+
const visit = useRef19({
|
|
34768
34291
|
trail: createTrail(),
|
|
34769
34292
|
before: void 0,
|
|
34770
34293
|
persisted: void 0,
|
|
34771
34294
|
error: ""
|
|
34772
34295
|
}).current;
|
|
34773
|
-
const
|
|
34774
|
-
|
|
34296
|
+
const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
34297
|
+
useEffect28(() => {
|
|
34775
34298
|
readCredentials().then((cfg) => {
|
|
34776
34299
|
setConfig(cfg);
|
|
34777
34300
|
visit.before = snapshotOf(cfg);
|
|
@@ -34838,7 +34361,7 @@ function ProjectScreen({ onDone }) {
|
|
|
34838
34361
|
if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
|
|
34839
34362
|
setNotice({ kind: "success", text: "Project settings saved" });
|
|
34840
34363
|
}).catch((err) => {
|
|
34841
|
-
visit.error =
|
|
34364
|
+
visit.error = scrub(err);
|
|
34842
34365
|
visit.trail.record("save failed");
|
|
34843
34366
|
setNotice({ kind: "error", text: err instanceof Error ? err.message : "Failed to save" });
|
|
34844
34367
|
}).finally(() => setSaving(false));
|
|
@@ -34958,13 +34481,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
34958
34481
|
});
|
|
34959
34482
|
|
|
34960
34483
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
34961
|
-
import { useEffect as
|
|
34484
|
+
import { useEffect as useEffect29, useState as useState37 } from "react";
|
|
34962
34485
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
34963
34486
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
34964
34487
|
function OptInAnalyticsScreen({ onDone }) {
|
|
34965
34488
|
const [loading, setLoading] = useState37(true);
|
|
34966
34489
|
const [enabled, setEnabled] = useState37(true);
|
|
34967
|
-
|
|
34490
|
+
useEffect29(() => {
|
|
34968
34491
|
readAnalyticsSetting().then((setting) => {
|
|
34969
34492
|
setEnabled(setting.enabled);
|
|
34970
34493
|
setLoading(false);
|
|
@@ -35027,7 +34550,7 @@ var init_screen12 = __esm({
|
|
|
35027
34550
|
});
|
|
35028
34551
|
|
|
35029
34552
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
35030
|
-
import { useEffect as
|
|
34553
|
+
import { useEffect as useEffect30, useRef as useRef20, useState as useState38 } from "react";
|
|
35031
34554
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
35032
34555
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
35033
34556
|
function DebugModeScreen({ onDone }) {
|
|
@@ -35037,8 +34560,8 @@ function DebugModeScreen({ onDone }) {
|
|
|
35037
34560
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
35038
34561
|
);
|
|
35039
34562
|
const [notice, setNotice] = useState38(null);
|
|
35040
|
-
const visit =
|
|
35041
|
-
|
|
34563
|
+
const visit = useRef20({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
34564
|
+
useEffect30(() => {
|
|
35042
34565
|
readDebugModeSetting().then((loaded) => {
|
|
35043
34566
|
setSetting(loaded);
|
|
35044
34567
|
setPending(loaded.retentionDays);
|
|
@@ -35179,7 +34702,7 @@ var app_exports = {};
|
|
|
35179
34702
|
__export(app_exports, {
|
|
35180
34703
|
runApp: () => runApp
|
|
35181
34704
|
});
|
|
35182
|
-
import { useEffect as
|
|
34705
|
+
import { useEffect as useEffect31, useState as useState39 } from "react";
|
|
35183
34706
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
35184
34707
|
function App({ importOptions, inkClear }) {
|
|
35185
34708
|
const [screen, setScreen] = useState39("start");
|
|
@@ -35213,7 +34736,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35213
34736
|
const [flowStart, setFlowStart] = useState39();
|
|
35214
34737
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
35215
34738
|
const [importDefaults, setImportDefaults] = useState39();
|
|
35216
|
-
|
|
34739
|
+
useEffect31(() => {
|
|
35217
34740
|
if (screen !== "import") {
|
|
35218
34741
|
setImportDefaults(void 0);
|
|
35219
34742
|
return;
|
|
@@ -35286,7 +34809,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35286
34809
|
}
|
|
35287
34810
|
});
|
|
35288
34811
|
};
|
|
35289
|
-
|
|
34812
|
+
useEffect31(() => {
|
|
35290
34813
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
35291
34814
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
35292
34815
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -35308,12 +34831,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35308
34831
|
}
|
|
35309
34832
|
});
|
|
35310
34833
|
}, [tokensOnly, tokensOnlyRun]);
|
|
35311
|
-
|
|
34834
|
+
useEffect31(() => {
|
|
35312
34835
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
35313
34836
|
setExtractionRun(void 0);
|
|
35314
34837
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
35315
34838
|
}, [extraction, extractionRun]);
|
|
35316
|
-
|
|
34839
|
+
useEffect31(() => {
|
|
35317
34840
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
35318
34841
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35319
34842
|
setGenerationInput({
|
|
@@ -35331,7 +34854,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35331
34854
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
35332
34855
|
});
|
|
35333
34856
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
35334
|
-
|
|
34857
|
+
useEffect31(() => {
|
|
35335
34858
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
35336
34859
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35337
34860
|
inkClear();
|
|
@@ -35500,7 +35023,6 @@ function App({ importOptions, inkClear }) {
|
|
|
35500
35023
|
return /* @__PURE__ */ jsx66(
|
|
35501
35024
|
CredentialsScreen,
|
|
35502
35025
|
{
|
|
35503
|
-
mode: target,
|
|
35504
35026
|
initial: importDefaults.credentials,
|
|
35505
35027
|
tokensOnly: target === "tokens",
|
|
35506
35028
|
onBack: () => goBackFrom("credentials"),
|
|
@@ -35638,9 +35160,9 @@ var pkg = JSON.parse(
|
|
|
35638
35160
|
function createProgram() {
|
|
35639
35161
|
const program = new Command().name("experiences").description("Contentful Experiences design system import CLI").version(pkg.version, "--version", "Print version number");
|
|
35640
35162
|
registerImportCommand(program, async (options) => {
|
|
35641
|
-
const { render
|
|
35163
|
+
const { render } = await import("ink");
|
|
35642
35164
|
const { runApp: runApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|
|
35643
|
-
await runApp2(
|
|
35165
|
+
await runApp2(render, options);
|
|
35644
35166
|
});
|
|
35645
35167
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
35646
35168
|
const chain = [];
|