@contentful/experience-design-system-cli 2.42.1-dev-build-c7f654e2.0 → 2.42.1-dev-build-2fb477e0.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 +464 -607
- package/dist/index.js +314 -475
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +1 -3
- package/dist/src/tui/import/shared/error-step/controls.d.ts +0 -2
- package/dist/src/tui/import/shared/error-step/logic.d.ts +1 -2
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +12 -2
- package/package.json +3 -3
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +0 -3
- package/dist/src/tui/support-bundle.d.ts +0 -25
- package/dist/src/tui/zip.d.ts +0 -7
package/dist/app.js
CHANGED
|
@@ -198,7 +198,6 @@ __export(debug_store_exports, {
|
|
|
198
198
|
currentSessionDir: () => currentSessionDir,
|
|
199
199
|
finishDebugRun: () => finishDebugRun,
|
|
200
200
|
setDebugRunProgress: () => setDebugRunProgress,
|
|
201
|
-
settleDebugLogs: () => settleDebugLogs,
|
|
202
201
|
startDebugRun: () => startDebugRun,
|
|
203
202
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
204
203
|
startImportRun: () => startImportRun
|
|
@@ -303,19 +302,7 @@ function startDebugRun({
|
|
|
303
302
|
function setDebugRunProgress(outputs) {
|
|
304
303
|
if (pendingRun) pendingRun.progress = outputs;
|
|
305
304
|
}
|
|
306
|
-
function
|
|
307
|
-
unsettled.add(work);
|
|
308
|
-
const forget = () => void unsettled.delete(work);
|
|
309
|
-
work.then(forget, forget);
|
|
310
|
-
return work;
|
|
311
|
-
}
|
|
312
|
-
async function settleDebugLogs() {
|
|
313
|
-
while (unsettled.size > 0) await Promise.allSettled([...unsettled]);
|
|
314
|
-
}
|
|
315
|
-
function finishDebugRun(args) {
|
|
316
|
-
return track(finishRun(args));
|
|
317
|
-
}
|
|
318
|
-
async function finishRun({
|
|
305
|
+
async function finishDebugRun({
|
|
319
306
|
outputs,
|
|
320
307
|
status,
|
|
321
308
|
exitMethod
|
|
@@ -398,7 +385,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
398
385
|
function handleCrash() {
|
|
399
386
|
return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
|
|
400
387
|
}
|
|
401
|
-
var pendingRun, sessionDir,
|
|
388
|
+
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
402
389
|
var init_debug_store = __esm({
|
|
403
390
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
404
391
|
"use strict";
|
|
@@ -428,7 +415,6 @@ var init_debug_store = __esm({
|
|
|
428
415
|
);
|
|
429
416
|
}
|
|
430
417
|
});
|
|
431
|
-
unsettled = /* @__PURE__ */ new Set();
|
|
432
418
|
WAITING_LIMIT = 50;
|
|
433
419
|
waiting = [];
|
|
434
420
|
process.once("uncaughtException", (err) => {
|
|
@@ -859,14 +845,14 @@ var init_parse_prompt_overrides = __esm({
|
|
|
859
845
|
});
|
|
860
846
|
|
|
861
847
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
|
|
862
|
-
import { readFile as
|
|
848
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
863
849
|
import { resolve as resolve3 } from "node:path";
|
|
864
850
|
async function resolvePromptOverride(override) {
|
|
865
851
|
if (override.kind === "text")
|
|
866
852
|
return override.value;
|
|
867
853
|
const abs = resolve3(override.value);
|
|
868
854
|
try {
|
|
869
|
-
return await
|
|
855
|
+
return await readFile2(abs, "utf8");
|
|
870
856
|
} catch {
|
|
871
857
|
throw new Error(`--prompt: could not read prompt file: ${abs}`);
|
|
872
858
|
}
|
|
@@ -1202,7 +1188,7 @@ var init_parse_map_token_prop_tool_calls = __esm({
|
|
|
1202
1188
|
});
|
|
1203
1189
|
|
|
1204
1190
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js
|
|
1205
|
-
import { spawn
|
|
1191
|
+
import { spawn } from "node:child_process";
|
|
1206
1192
|
function killProcessTree(pid, signal) {
|
|
1207
1193
|
try {
|
|
1208
1194
|
process.kill(-pid, signal);
|
|
@@ -1231,7 +1217,7 @@ async function runAgent(options) {
|
|
|
1231
1217
|
});
|
|
1232
1218
|
return new Promise((resolve29) => {
|
|
1233
1219
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1234
|
-
const child =
|
|
1220
|
+
const child = spawn(binary, args, {
|
|
1235
1221
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1236
1222
|
detached: true,
|
|
1237
1223
|
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
@@ -1330,7 +1316,7 @@ var init_run_agent = __esm({
|
|
|
1330
1316
|
});
|
|
1331
1317
|
|
|
1332
1318
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/check-agent-auth.js
|
|
1333
|
-
import { spawn as
|
|
1319
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
1334
1320
|
async function checkAgentAuth(agent) {
|
|
1335
1321
|
const binary = resolveBinary(agent);
|
|
1336
1322
|
const binaryExists2 = await binaryIsOnPath(binary);
|
|
@@ -1339,7 +1325,7 @@ async function checkAgentAuth(agent) {
|
|
|
1339
1325
|
if (agent !== "claude")
|
|
1340
1326
|
return "ok";
|
|
1341
1327
|
return new Promise((resolve29) => {
|
|
1342
|
-
const child =
|
|
1328
|
+
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1343
1329
|
let stdout = "";
|
|
1344
1330
|
let done = false;
|
|
1345
1331
|
const timer = setTimeout(() => {
|
|
@@ -1376,7 +1362,7 @@ async function binaryIsOnPath(binary) {
|
|
|
1376
1362
|
return fs.access(binary).then(() => true, () => false);
|
|
1377
1363
|
}
|
|
1378
1364
|
return new Promise((resolve29) => {
|
|
1379
|
-
const child =
|
|
1365
|
+
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1380
1366
|
child.on("close", (code) => resolve29(code === 0));
|
|
1381
1367
|
});
|
|
1382
1368
|
}
|
|
@@ -2158,19 +2144,19 @@ var init_skill_files = __esm({
|
|
|
2158
2144
|
|
|
2159
2145
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
|
|
2160
2146
|
import { existsSync as existsSync3 } from "node:fs";
|
|
2161
|
-
import { dirname as
|
|
2147
|
+
import { dirname as dirname5, join as join7, resolve as resolve4 } from "node:path";
|
|
2162
2148
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2163
2149
|
function resolveSkillPath(skill) {
|
|
2164
2150
|
if (!(skill in SKILL_FILES))
|
|
2165
2151
|
throw new Error(`Invalid skill: ${skill}`);
|
|
2166
|
-
const thisDir =
|
|
2152
|
+
const thisDir = dirname5(fileURLToPath2(import.meta.url));
|
|
2167
2153
|
let dir = thisDir;
|
|
2168
2154
|
for (; ; ) {
|
|
2169
|
-
const candidate =
|
|
2155
|
+
const candidate = join7(dir, "skills");
|
|
2170
2156
|
if (existsSync3(candidate)) {
|
|
2171
2157
|
const file = SKILL_FILES[skill];
|
|
2172
2158
|
const stepDir = file === "select-components.md" ? "selection" : "generation";
|
|
2173
|
-
return
|
|
2159
|
+
return join7(candidate, stepDir, file);
|
|
2174
2160
|
}
|
|
2175
2161
|
const parent = resolve4(dir, "..");
|
|
2176
2162
|
if (parent === dir) {
|
|
@@ -2187,20 +2173,20 @@ var init_resolve_skill_path = __esm({
|
|
|
2187
2173
|
});
|
|
2188
2174
|
|
|
2189
2175
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
|
|
2190
|
-
import { readFile as
|
|
2176
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
2191
2177
|
import { resolve as resolve5 } from "node:path";
|
|
2192
2178
|
async function readSkillFile(skill, override) {
|
|
2193
2179
|
if (override) {
|
|
2194
2180
|
const skillPath2 = resolve5(override);
|
|
2195
2181
|
try {
|
|
2196
|
-
return await
|
|
2182
|
+
return await readFile3(skillPath2, "utf8");
|
|
2197
2183
|
} catch {
|
|
2198
2184
|
throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
|
|
2199
2185
|
}
|
|
2200
2186
|
}
|
|
2201
2187
|
const skillPath = resolveSkillPath(skill);
|
|
2202
2188
|
try {
|
|
2203
|
-
return await
|
|
2189
|
+
return await readFile3(skillPath, "utf8");
|
|
2204
2190
|
} catch {
|
|
2205
2191
|
throw new Error(`skill file missing from package (expected at: ${skillPath})`);
|
|
2206
2192
|
}
|
|
@@ -2494,13 +2480,13 @@ __export(cache_keys_exports, {
|
|
|
2494
2480
|
hashPromptForSkill: () => hashPromptForSkill
|
|
2495
2481
|
});
|
|
2496
2482
|
import { createHash as createHash4 } from "node:crypto";
|
|
2497
|
-
import { readFile as
|
|
2483
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
2498
2484
|
import { resolve as resolve6 } from "node:path";
|
|
2499
2485
|
function hashContent(content) {
|
|
2500
2486
|
return createHash4("sha256").update(content).digest("hex");
|
|
2501
2487
|
}
|
|
2502
2488
|
async function hashFile(filePath) {
|
|
2503
|
-
const content = await
|
|
2489
|
+
const content = await readFile4(filePath, "utf8");
|
|
2504
2490
|
return hashContent(content);
|
|
2505
2491
|
}
|
|
2506
2492
|
async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
|
|
@@ -2516,7 +2502,7 @@ var init_cache_keys = __esm({
|
|
|
2516
2502
|
});
|
|
2517
2503
|
|
|
2518
2504
|
// packages/experience-design-system-cli/app.tsx
|
|
2519
|
-
import { useEffect as
|
|
2505
|
+
import { useEffect as useEffect36, useState as useState39 } from "react";
|
|
2520
2506
|
|
|
2521
2507
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
2522
2508
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -2724,7 +2710,7 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
2724
2710
|
}
|
|
2725
2711
|
|
|
2726
2712
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
2727
|
-
import { useEffect as
|
|
2713
|
+
import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
2728
2714
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
2729
2715
|
init_debug_store();
|
|
2730
2716
|
|
|
@@ -2836,120 +2822,6 @@ function usePreflightControls(handlers) {
|
|
|
2836
2822
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2837
2823
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
2838
2824
|
|
|
2839
|
-
// packages/experience-design-system-cli/src/tui/support-bundle.ts
|
|
2840
|
-
init_debug_store();
|
|
2841
|
-
import { spawn } from "node:child_process";
|
|
2842
|
-
import { readdir as readdir2, readFile as readFile2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
2843
|
-
import { basename, dirname as dirname4, join as join6, sep } from "node:path";
|
|
2844
|
-
|
|
2845
|
-
// packages/experience-design-system-cli/src/tui/zip.ts
|
|
2846
|
-
import { crc32, deflateRawSync } from "node:zlib";
|
|
2847
|
-
var LOCAL_HEADER = 67324752;
|
|
2848
|
-
var CENTRAL_HEADER = 33639248;
|
|
2849
|
-
var END_OF_ARCHIVE = 101010256;
|
|
2850
|
-
var VERSION2 = 20;
|
|
2851
|
-
var UTF8_NAMES = 2048;
|
|
2852
|
-
var DEFLATE = 8;
|
|
2853
|
-
function dosDateTime(date) {
|
|
2854
|
-
const year = Math.max(1980, date.getFullYear());
|
|
2855
|
-
return {
|
|
2856
|
-
day: year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate(),
|
|
2857
|
-
time: date.getHours() << 11 | date.getMinutes() << 5 | date.getSeconds() >> 1
|
|
2858
|
-
};
|
|
2859
|
-
}
|
|
2860
|
-
function createZip(entries) {
|
|
2861
|
-
const body = [];
|
|
2862
|
-
const directory = [];
|
|
2863
|
-
let offset = 0;
|
|
2864
|
-
for (const entry of entries) {
|
|
2865
|
-
const name = Buffer.from(entry.name, "utf8");
|
|
2866
|
-
const compressed = deflateRawSync(entry.data);
|
|
2867
|
-
const checksum = crc32(entry.data);
|
|
2868
|
-
const { day, time } = dosDateTime(entry.modified);
|
|
2869
|
-
const local = Buffer.alloc(30);
|
|
2870
|
-
local.writeUInt32LE(LOCAL_HEADER, 0);
|
|
2871
|
-
local.writeUInt16LE(VERSION2, 4);
|
|
2872
|
-
local.writeUInt16LE(UTF8_NAMES, 6);
|
|
2873
|
-
local.writeUInt16LE(DEFLATE, 8);
|
|
2874
|
-
local.writeUInt16LE(time, 10);
|
|
2875
|
-
local.writeUInt16LE(day, 12);
|
|
2876
|
-
local.writeUInt32LE(checksum, 14);
|
|
2877
|
-
local.writeUInt32LE(compressed.length, 18);
|
|
2878
|
-
local.writeUInt32LE(entry.data.length, 22);
|
|
2879
|
-
local.writeUInt16LE(name.length, 26);
|
|
2880
|
-
body.push(local, name, compressed);
|
|
2881
|
-
const central = Buffer.alloc(46);
|
|
2882
|
-
central.writeUInt32LE(CENTRAL_HEADER, 0);
|
|
2883
|
-
central.writeUInt16LE(VERSION2, 4);
|
|
2884
|
-
central.writeUInt16LE(VERSION2, 6);
|
|
2885
|
-
central.writeUInt16LE(UTF8_NAMES, 8);
|
|
2886
|
-
central.writeUInt16LE(DEFLATE, 10);
|
|
2887
|
-
central.writeUInt16LE(time, 12);
|
|
2888
|
-
central.writeUInt16LE(day, 14);
|
|
2889
|
-
central.writeUInt32LE(checksum, 16);
|
|
2890
|
-
central.writeUInt32LE(compressed.length, 20);
|
|
2891
|
-
central.writeUInt32LE(entry.data.length, 24);
|
|
2892
|
-
central.writeUInt16LE(name.length, 28);
|
|
2893
|
-
central.writeUInt32LE(offset, 42);
|
|
2894
|
-
directory.push(central, name);
|
|
2895
|
-
offset += local.length + name.length + compressed.length;
|
|
2896
|
-
}
|
|
2897
|
-
const directoryBytes = Buffer.concat(directory);
|
|
2898
|
-
const end = Buffer.alloc(22);
|
|
2899
|
-
end.writeUInt32LE(END_OF_ARCHIVE, 0);
|
|
2900
|
-
end.writeUInt16LE(entries.length, 8);
|
|
2901
|
-
end.writeUInt16LE(entries.length, 10);
|
|
2902
|
-
end.writeUInt32LE(directoryBytes.length, 12);
|
|
2903
|
-
end.writeUInt32LE(offset, 16);
|
|
2904
|
-
return Buffer.concat([...body, directoryBytes, end]);
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
// packages/experience-design-system-cli/src/tui/support-bundle.ts
|
|
2908
|
-
async function bundleDebugLogs() {
|
|
2909
|
-
const session = currentSessionDir();
|
|
2910
|
-
const debugDir = currentDebugSessionDir();
|
|
2911
|
-
if (!session || !debugDir) return { status: "no-logs" };
|
|
2912
|
-
try {
|
|
2913
|
-
await settleDebugLogs();
|
|
2914
|
-
const logs = (await readdir2(debugDir, { recursive: true })).filter((file) => file.endsWith(".md")).sort();
|
|
2915
|
-
if (logs.length === 0) return { status: "no-logs" };
|
|
2916
|
-
const entries = await Promise.all(
|
|
2917
|
-
logs.map(async (file) => {
|
|
2918
|
-
const path6 = join6(debugDir, file);
|
|
2919
|
-
return { name: file.split(sep).join("/"), data: await readFile2(path6), modified: (await stat2(path6)).mtime };
|
|
2920
|
-
})
|
|
2921
|
-
);
|
|
2922
|
-
const path5 = join6(session, `${basename(session)}-debug-logs.zip`);
|
|
2923
|
-
await writeFile3(path5, createZip(entries), { mode: 384 });
|
|
2924
|
-
return { status: "created", path: path5, files: entries.length };
|
|
2925
|
-
} catch {
|
|
2926
|
-
return { status: "failed", folder: debugDir };
|
|
2927
|
-
}
|
|
2928
|
-
}
|
|
2929
|
-
function openSupportBundle(bundle) {
|
|
2930
|
-
if (bundle.status === "no-logs") return;
|
|
2931
|
-
const target = bundle.status === "created" ? bundle.path : bundle.folder;
|
|
2932
|
-
const command = process.platform === "darwin" ? { file: "open", args: bundle.status === "created" ? ["-R", target] : [target] } : process.platform === "win32" ? { file: "explorer.exe", args: bundle.status === "created" ? [`/select,${target}`] : [target] } : { file: "xdg-open", args: [bundle.status === "created" ? dirname4(target) : target] };
|
|
2933
|
-
try {
|
|
2934
|
-
const child = spawn(command.file, command.args, { stdio: "ignore", detached: true });
|
|
2935
|
-
child.on("error", () => void 0);
|
|
2936
|
-
child.unref();
|
|
2937
|
-
} catch {
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
function supportInstruction(bundle) {
|
|
2941
|
-
switch (bundle.status) {
|
|
2942
|
-
case "created":
|
|
2943
|
-
return `Debug logs saved to ${bundle.path}
|
|
2944
|
-
Send this file to Contentful support so they can look into it.`;
|
|
2945
|
-
case "no-logs":
|
|
2946
|
-
return "No debug logs were recorded. To get help, turn on Debug Mode in Settings, run the import again and send the zip file it saves to Contentful support.";
|
|
2947
|
-
case "failed":
|
|
2948
|
-
return `Your debug logs are in ${bundle.folder}
|
|
2949
|
-
Zip that folder and send it to Contentful support so they can look into it.`;
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
|
|
2953
2825
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
|
|
2954
2826
|
import { useInput as useInput4 } from "ink";
|
|
2955
2827
|
|
|
@@ -2957,7 +2829,6 @@ import { useInput as useInput4 } from "ink";
|
|
|
2957
2829
|
function errorAction(input, key, available) {
|
|
2958
2830
|
if (key.return && available.canAcknowledge) return "acknowledge";
|
|
2959
2831
|
if (input === "r" && available.canRetry) return "retry";
|
|
2960
|
-
if (input === "o" && available.canOpen) return "open";
|
|
2961
2832
|
if (key.return || key.escape) return "exit";
|
|
2962
2833
|
return null;
|
|
2963
2834
|
}
|
|
@@ -2965,8 +2836,7 @@ function errorControls(available) {
|
|
|
2965
2836
|
return [
|
|
2966
2837
|
available.canAcknowledge ? { keys: "Enter", label: "Acknowledge and apply" } : { keys: "Enter", label: "Exit" },
|
|
2967
2838
|
...available.canAcknowledge ? [{ keys: "Esc", label: "Exit" }] : [],
|
|
2968
|
-
...available.canRetry ? [{ keys: "r", label: "Re-enter credentials" }] : []
|
|
2969
|
-
...available.canOpen ? [{ keys: "o", label: "Show debug logs in file manager" }] : []
|
|
2839
|
+
...available.canRetry ? [{ keys: "r", label: "Re-enter credentials" }] : []
|
|
2970
2840
|
];
|
|
2971
2841
|
}
|
|
2972
2842
|
|
|
@@ -2975,32 +2845,14 @@ function useErrorControls(handlers) {
|
|
|
2975
2845
|
useInput4((input, key) => {
|
|
2976
2846
|
const action = errorAction(input, key, {
|
|
2977
2847
|
canRetry: handlers.onRetry !== void 0,
|
|
2978
|
-
canAcknowledge: handlers.onAcknowledge !== void 0
|
|
2979
|
-
canOpen: handlers.onOpen !== void 0
|
|
2848
|
+
canAcknowledge: handlers.onAcknowledge !== void 0
|
|
2980
2849
|
});
|
|
2981
2850
|
if (action === "acknowledge") handlers.onAcknowledge?.();
|
|
2982
2851
|
else if (action === "retry") handlers.onRetry?.();
|
|
2983
|
-
else if (action === "open") handlers.onOpen?.();
|
|
2984
2852
|
else if (action === "exit") handlers.onExit();
|
|
2985
2853
|
});
|
|
2986
2854
|
}
|
|
2987
2855
|
|
|
2988
|
-
// packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
|
|
2989
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
2990
|
-
function useSupportBundle() {
|
|
2991
|
-
const [bundle, setBundle] = useState3();
|
|
2992
|
-
useEffect3(() => {
|
|
2993
|
-
let active = true;
|
|
2994
|
-
void bundleDebugLogs().then((result) => {
|
|
2995
|
-
if (active) setBundle(result);
|
|
2996
|
-
});
|
|
2997
|
-
return () => {
|
|
2998
|
-
active = false;
|
|
2999
|
-
};
|
|
3000
|
-
}, []);
|
|
3001
|
-
return bundle;
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
2856
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
3005
2857
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3006
2858
|
function ErrorStep({
|
|
@@ -3010,18 +2862,10 @@ function ErrorStep({
|
|
|
3010
2862
|
onRetryCredentials,
|
|
3011
2863
|
onAcknowledgeBreakingChanges
|
|
3012
2864
|
}) {
|
|
3013
|
-
|
|
3014
|
-
const canOpen = bundle !== void 0 && bundle.status !== "no-logs";
|
|
3015
|
-
useErrorControls({
|
|
3016
|
-
onExit,
|
|
3017
|
-
onRetry: onRetryCredentials,
|
|
3018
|
-
onAcknowledge: onAcknowledgeBreakingChanges,
|
|
3019
|
-
onOpen: canOpen ? () => openSupportBundle(bundle) : void 0
|
|
3020
|
-
});
|
|
2865
|
+
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
3021
2866
|
const controls = errorControls({
|
|
3022
2867
|
canRetry: onRetryCredentials !== void 0,
|
|
3023
|
-
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
3024
|
-
canOpen
|
|
2868
|
+
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
3025
2869
|
});
|
|
3026
2870
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
3027
2871
|
/* @__PURE__ */ jsxs4(Text4, { bold: true, color: PALETTE.error, children: [
|
|
@@ -3030,7 +2874,6 @@ function ErrorStep({
|
|
|
3030
2874
|
" failed"
|
|
3031
2875
|
] }),
|
|
3032
2876
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
3033
|
-
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
3034
2877
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
3035
2878
|
"[",
|
|
3036
2879
|
control.keys,
|
|
@@ -3247,10 +3090,10 @@ var PROGRESS_THEME = extendTheme(defaultTheme, {
|
|
|
3247
3090
|
});
|
|
3248
3091
|
|
|
3249
3092
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
3250
|
-
import { useEffect as
|
|
3093
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
3251
3094
|
function useElapsed() {
|
|
3252
|
-
const [seconds2, setSeconds] =
|
|
3253
|
-
|
|
3095
|
+
const [seconds2, setSeconds] = useState3(0);
|
|
3096
|
+
useEffect3(() => {
|
|
3254
3097
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
3255
3098
|
return () => clearInterval(timer);
|
|
3256
3099
|
}, []);
|
|
@@ -3306,9 +3149,9 @@ function RunningStep({
|
|
|
3306
3149
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3307
3150
|
var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
|
|
3308
3151
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
3309
|
-
const [focus, setFocus] =
|
|
3152
|
+
const [focus, setFocus] = useState4(0);
|
|
3310
3153
|
const viewed = useRef([optionAt(0)]).current;
|
|
3311
|
-
|
|
3154
|
+
useEffect4(() => {
|
|
3312
3155
|
startDebugRun({
|
|
3313
3156
|
flow: "import/preflight",
|
|
3314
3157
|
step: "00-preflight",
|
|
@@ -3351,7 +3194,7 @@ function PreflightScreen({ onChoose, onQuit }) {
|
|
|
3351
3194
|
}
|
|
3352
3195
|
|
|
3353
3196
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3354
|
-
import { useEffect as
|
|
3197
|
+
import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
|
|
3355
3198
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
3356
3199
|
init_debug_store();
|
|
3357
3200
|
|
|
@@ -3411,9 +3254,9 @@ function useWelcomeControls(onQuit) {
|
|
|
3411
3254
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3412
3255
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3413
3256
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
3414
|
-
const [projectPath, setProjectPath] =
|
|
3257
|
+
const [projectPath, setProjectPath] = useState5(initialPath);
|
|
3415
3258
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
3416
|
-
|
|
3259
|
+
useEffect5(() => {
|
|
3417
3260
|
startDebugRun({
|
|
3418
3261
|
flow: "import/welcome",
|
|
3419
3262
|
step: "01-welcome",
|
|
@@ -3468,7 +3311,7 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
3468
3311
|
}
|
|
3469
3312
|
|
|
3470
3313
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3471
|
-
import { useEffect as
|
|
3314
|
+
import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
|
|
3472
3315
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3473
3316
|
init_debug_store();
|
|
3474
3317
|
|
|
@@ -3544,10 +3387,10 @@ function TokenInputScreen({
|
|
|
3544
3387
|
onBack,
|
|
3545
3388
|
initialPath = ""
|
|
3546
3389
|
}) {
|
|
3547
|
-
const [tokenPath, setTokenPath] =
|
|
3548
|
-
const [failure, setFailure] =
|
|
3390
|
+
const [tokenPath, setTokenPath] = useState6(initialPath);
|
|
3391
|
+
const [failure, setFailure] = useState6(null);
|
|
3549
3392
|
const rejected = useRef4([]).current;
|
|
3550
|
-
|
|
3393
|
+
useEffect6(() => {
|
|
3551
3394
|
startDebugRun({
|
|
3552
3395
|
flow: "import/token-input",
|
|
3553
3396
|
step: "02-token-input",
|
|
@@ -3628,7 +3471,7 @@ function TokenInputScreen({
|
|
|
3628
3471
|
}
|
|
3629
3472
|
|
|
3630
3473
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
3631
|
-
import { useEffect as
|
|
3474
|
+
import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
|
|
3632
3475
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3633
3476
|
init_debug_store();
|
|
3634
3477
|
|
|
@@ -3704,9 +3547,14 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
|
|
|
3704
3547
|
...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
|
|
3705
3548
|
};
|
|
3706
3549
|
}
|
|
3707
|
-
function
|
|
3550
|
+
function hasImportableFiles(counts, { hasTokens = true } = {}) {
|
|
3551
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
3552
|
+
return componentFiles > 0 || hasTokens && counts.json > 0;
|
|
3553
|
+
}
|
|
3554
|
+
function phaseOf(scan, { hasTokens = true } = {}) {
|
|
3708
3555
|
if (scan === void 0) return "scanning";
|
|
3709
|
-
|
|
3556
|
+
if (!scan.ok) return "failed";
|
|
3557
|
+
return hasImportableFiles(scan.counts, { hasTokens }) ? "ready" : "empty";
|
|
3710
3558
|
}
|
|
3711
3559
|
function keyAction(phase, input, key) {
|
|
3712
3560
|
if (key.escape) return "back";
|
|
@@ -3714,7 +3562,7 @@ function keyAction(phase, input, key) {
|
|
|
3714
3562
|
if (key.return) return "confirm";
|
|
3715
3563
|
if (input === "e") return "change-path";
|
|
3716
3564
|
}
|
|
3717
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
3565
|
+
if ((phase === "failed" || phase === "empty") && (key.return || input === "e")) return "change-path";
|
|
3718
3566
|
return void 0;
|
|
3719
3567
|
}
|
|
3720
3568
|
|
|
@@ -3726,6 +3574,10 @@ var CONTROLS = {
|
|
|
3726
3574
|
{ keys: "e", label: "Change path" },
|
|
3727
3575
|
{ keys: "Esc", label: "Back" }
|
|
3728
3576
|
],
|
|
3577
|
+
empty: [
|
|
3578
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
3579
|
+
{ keys: "Esc", label: "Back" }
|
|
3580
|
+
],
|
|
3729
3581
|
failed: [
|
|
3730
3582
|
{ keys: "Enter/e", label: "Try a different path" },
|
|
3731
3583
|
{ keys: "Esc", label: "Back" }
|
|
@@ -3746,19 +3598,19 @@ function usePathValidationControls(phase, handlers) {
|
|
|
3746
3598
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3747
3599
|
import { DatabaseSync } from "node:sqlite";
|
|
3748
3600
|
import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
3749
|
-
import { readFile as
|
|
3601
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
3750
3602
|
import { createHash as createHash5 } from "node:crypto";
|
|
3751
3603
|
|
|
3752
3604
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
3753
3605
|
import { homedir as homedir3 } from "node:os";
|
|
3754
|
-
import { dirname as
|
|
3606
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
3755
3607
|
function configRoot2() {
|
|
3756
|
-
return process.env["EDS_HOME"] ||
|
|
3608
|
+
return process.env["EDS_HOME"] || join6(homedir3(), ".contentful", "experience-design-system-cli");
|
|
3757
3609
|
}
|
|
3758
|
-
var runsFilePath = () =>
|
|
3610
|
+
var runsFilePath = () => join6(configRoot2(), "state", "runs.json");
|
|
3759
3611
|
|
|
3760
3612
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3761
|
-
import { dirname as
|
|
3613
|
+
import { dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
3762
3614
|
|
|
3763
3615
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
|
|
3764
3616
|
var ELLIPSIS_MARKER = "/* \u2026 */";
|
|
@@ -4535,7 +4387,7 @@ function getPipelineDbPath() {
|
|
|
4535
4387
|
}
|
|
4536
4388
|
function openPipelineDb(dbPath) {
|
|
4537
4389
|
const path5 = dbPath ?? getPipelineDbPath();
|
|
4538
|
-
mkdirSync(
|
|
4390
|
+
mkdirSync(dirname6(path5), { recursive: true });
|
|
4539
4391
|
try {
|
|
4540
4392
|
const db = new DatabaseSync(path5);
|
|
4541
4393
|
db.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -5209,7 +5061,7 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
5209
5061
|
];
|
|
5210
5062
|
for (const candidate of candidates) {
|
|
5211
5063
|
try {
|
|
5212
|
-
await
|
|
5064
|
+
await readFile5(candidate, "utf8");
|
|
5213
5065
|
return candidate;
|
|
5214
5066
|
} catch {
|
|
5215
5067
|
}
|
|
@@ -5228,7 +5080,7 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
|
|
|
5228
5080
|
async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
|
|
5229
5081
|
const visited = /* @__PURE__ */ new Set([resolve7(sourcePath)]);
|
|
5230
5082
|
const discovered = [];
|
|
5231
|
-
let frontier = [{ text: sourceText, dir:
|
|
5083
|
+
let frontier = [{ text: sourceText, dir: dirname6(sourcePath) }];
|
|
5232
5084
|
for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
|
|
5233
5085
|
const nextFrontier = [];
|
|
5234
5086
|
for (const node of frontier) {
|
|
@@ -5243,12 +5095,12 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5243
5095
|
break;
|
|
5244
5096
|
let content;
|
|
5245
5097
|
try {
|
|
5246
|
-
content = await
|
|
5098
|
+
content = await readFile5(resolvedPath, "utf8");
|
|
5247
5099
|
} catch {
|
|
5248
5100
|
continue;
|
|
5249
5101
|
}
|
|
5250
5102
|
discovered.push({ path: resolvedPath, content });
|
|
5251
|
-
nextFrontier.push({ text: content, dir:
|
|
5103
|
+
nextFrontier.push({ text: content, dir: dirname6(resolvedPath) });
|
|
5252
5104
|
}
|
|
5253
5105
|
}
|
|
5254
5106
|
frontier = nextFrontier;
|
|
@@ -5282,7 +5134,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
5282
5134
|
let truncatedSiblingCount = 0;
|
|
5283
5135
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
5284
5136
|
try {
|
|
5285
|
-
const rawText = await
|
|
5137
|
+
const rawText = await readFile5(sourcePath, "utf8");
|
|
5286
5138
|
let siblingUsesNotShown;
|
|
5287
5139
|
let declaredTypeNames;
|
|
5288
5140
|
({
|
|
@@ -6044,7 +5896,7 @@ import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "t
|
|
|
6044
5896
|
|
|
6045
5897
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
6046
5898
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
6047
|
-
import { dirname as
|
|
5899
|
+
import { dirname as dirname7, join as join8, resolve as resolve8 } from "node:path";
|
|
6048
5900
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
6049
5901
|
import ts from "typescript";
|
|
6050
5902
|
var packageRootByFilePathCache = /* @__PURE__ */ new Map();
|
|
@@ -6244,16 +6096,16 @@ function findNearestTsConfigPath(filePath) {
|
|
|
6244
6096
|
if (nearestTsConfigPathCache.has(filePath)) {
|
|
6245
6097
|
return nearestTsConfigPathCache.get(filePath) ?? void 0;
|
|
6246
6098
|
}
|
|
6247
|
-
let currentDir =
|
|
6099
|
+
let currentDir = dirname7(filePath);
|
|
6248
6100
|
while (true) {
|
|
6249
6101
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
6250
|
-
const candidatePath =
|
|
6102
|
+
const candidatePath = join8(currentDir, candidateName);
|
|
6251
6103
|
if (existsSync4(candidatePath)) {
|
|
6252
6104
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
6253
6105
|
return candidatePath;
|
|
6254
6106
|
}
|
|
6255
6107
|
}
|
|
6256
|
-
const parentDir =
|
|
6108
|
+
const parentDir = dirname7(currentDir);
|
|
6257
6109
|
if (parentDir === currentDir) {
|
|
6258
6110
|
nearestTsConfigPathCache.set(filePath, null);
|
|
6259
6111
|
return void 0;
|
|
@@ -6270,13 +6122,13 @@ function getTsConfigPaths(tsConfigPath) {
|
|
|
6270
6122
|
tsConfigPathsCache.set(tsConfigPath, null);
|
|
6271
6123
|
return void 0;
|
|
6272
6124
|
}
|
|
6273
|
-
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys,
|
|
6125
|
+
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname7(tsConfigPath));
|
|
6274
6126
|
const paths = parsedConfig.options.paths;
|
|
6275
6127
|
if (!paths || Object.keys(paths).length === 0) {
|
|
6276
6128
|
tsConfigPathsCache.set(tsConfigPath, null);
|
|
6277
6129
|
return void 0;
|
|
6278
6130
|
}
|
|
6279
|
-
const baseUrl = parsedConfig.options.baseUrl ??
|
|
6131
|
+
const baseUrl = parsedConfig.options.baseUrl ?? dirname7(tsConfigPath);
|
|
6280
6132
|
const result = { baseUrl, paths };
|
|
6281
6133
|
tsConfigPathsCache.set(tsConfigPath, result);
|
|
6282
6134
|
return result;
|
|
@@ -6304,10 +6156,10 @@ function resolveImportSourcePath(basePath) {
|
|
|
6304
6156
|
`${basePath}.tsx`,
|
|
6305
6157
|
`${basePath}.js`,
|
|
6306
6158
|
`${basePath}.jsx`,
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6159
|
+
join8(basePath, "index.ts"),
|
|
6160
|
+
join8(basePath, "index.tsx"),
|
|
6161
|
+
join8(basePath, "index.js"),
|
|
6162
|
+
join8(basePath, "index.jsx")
|
|
6311
6163
|
];
|
|
6312
6164
|
return candidates.find((candidatePath) => existsSync4(candidatePath));
|
|
6313
6165
|
}
|
|
@@ -6318,10 +6170,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
6318
6170
|
`${resolvedPath}.tsx`,
|
|
6319
6171
|
`${resolvedPath}.js`,
|
|
6320
6172
|
`${resolvedPath}.jsx`,
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6173
|
+
join8(resolvedPath, "index.ts"),
|
|
6174
|
+
join8(resolvedPath, "index.tsx"),
|
|
6175
|
+
join8(resolvedPath, "index.js"),
|
|
6176
|
+
join8(resolvedPath, "index.jsx")
|
|
6325
6177
|
];
|
|
6326
6178
|
for (const candidatePath of candidatePaths) {
|
|
6327
6179
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -6342,10 +6194,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6342
6194
|
if (!packageRootDir)
|
|
6343
6195
|
return void 0;
|
|
6344
6196
|
const preferredEntryPaths = [
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6197
|
+
join8(packageRootDir, "src/index.ts"),
|
|
6198
|
+
join8(packageRootDir, "src/index.tsx"),
|
|
6199
|
+
join8(packageRootDir, "index.ts"),
|
|
6200
|
+
join8(packageRootDir, "index.tsx")
|
|
6349
6201
|
];
|
|
6350
6202
|
for (const entryPath of preferredEntryPaths) {
|
|
6351
6203
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -6353,7 +6205,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6353
6205
|
return entrySourceFile;
|
|
6354
6206
|
}
|
|
6355
6207
|
}
|
|
6356
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
6208
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join8(packageRootDir, "src"));
|
|
6357
6209
|
}
|
|
6358
6210
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
6359
6211
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -6362,7 +6214,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
6362
6214
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
6363
6215
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
6364
6216
|
}
|
|
6365
|
-
const packageJsonPath =
|
|
6217
|
+
const packageJsonPath = join8(packageRootDir, "package.json");
|
|
6366
6218
|
try {
|
|
6367
6219
|
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
|
|
6368
6220
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -6377,13 +6229,13 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6377
6229
|
if (packageRootByFilePathCache.has(filePath)) {
|
|
6378
6230
|
return packageRootByFilePathCache.get(filePath) ?? void 0;
|
|
6379
6231
|
}
|
|
6380
|
-
let currentDir =
|
|
6232
|
+
let currentDir = dirname7(filePath);
|
|
6381
6233
|
while (true) {
|
|
6382
|
-
if (existsSync4(
|
|
6234
|
+
if (existsSync4(join8(currentDir, "package.json"))) {
|
|
6383
6235
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
6384
6236
|
return currentDir;
|
|
6385
6237
|
}
|
|
6386
|
-
const parentDir =
|
|
6238
|
+
const parentDir = dirname7(currentDir);
|
|
6387
6239
|
if (parentDir === currentDir) {
|
|
6388
6240
|
packageRootByFilePathCache.set(filePath, null);
|
|
6389
6241
|
return void 0;
|
|
@@ -6393,7 +6245,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6393
6245
|
}
|
|
6394
6246
|
|
|
6395
6247
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
|
|
6396
|
-
import { readFile as
|
|
6248
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
6397
6249
|
async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
|
|
6398
6250
|
const warnings = [];
|
|
6399
6251
|
const items = [];
|
|
@@ -6405,7 +6257,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
|
|
|
6405
6257
|
if (!filePath)
|
|
6406
6258
|
break;
|
|
6407
6259
|
try {
|
|
6408
|
-
const source = await
|
|
6260
|
+
const source = await readFile6(filePath, "utf-8");
|
|
6409
6261
|
const outcome = await extractFile(filePath, source);
|
|
6410
6262
|
warnings.push(...outcome.warnings ?? []);
|
|
6411
6263
|
if (outcome.item)
|
|
@@ -9380,27 +9232,27 @@ function extractVueSlotsFromSetup(options) {
|
|
|
9380
9232
|
|
|
9381
9233
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
9382
9234
|
import os from "node:os";
|
|
9383
|
-
import { basename
|
|
9384
|
-
import { readFile as
|
|
9235
|
+
import { basename, dirname as dirname9, resolve as resolve10, join as join10 } from "node:path";
|
|
9236
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
9385
9237
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
9386
9238
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
9387
9239
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
9388
9240
|
|
|
9389
9241
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
|
|
9390
9242
|
import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
|
|
9391
|
-
import { dirname as
|
|
9243
|
+
import { dirname as dirname8, join as join9, resolve as resolve9 } from "node:path";
|
|
9392
9244
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
9393
|
-
const basePath = resolve9(
|
|
9245
|
+
const basePath = resolve9(dirname8(importingFilePath), specifier);
|
|
9394
9246
|
const candidates = [
|
|
9395
9247
|
basePath,
|
|
9396
9248
|
`${basePath}.js`,
|
|
9397
9249
|
`${basePath}.ts`,
|
|
9398
9250
|
`${basePath}.mjs`,
|
|
9399
9251
|
`${basePath}.cjs`,
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9252
|
+
join9(basePath, "index.js"),
|
|
9253
|
+
join9(basePath, "index.ts"),
|
|
9254
|
+
join9(basePath, "index.mjs"),
|
|
9255
|
+
join9(basePath, "index.cjs")
|
|
9404
9256
|
];
|
|
9405
9257
|
for (const candidate of candidates) {
|
|
9406
9258
|
if (existsSync5(candidate) && statSync2(candidate).isFile())
|
|
@@ -9475,11 +9327,11 @@ async function extractFromVueSFC(filePath, source) {
|
|
|
9475
9327
|
};
|
|
9476
9328
|
}
|
|
9477
9329
|
function getVueComponentName(filePath) {
|
|
9478
|
-
const fileName =
|
|
9330
|
+
const fileName = basename(filePath, ".vue");
|
|
9479
9331
|
if (fileName !== "index") {
|
|
9480
9332
|
return fileName;
|
|
9481
9333
|
}
|
|
9482
|
-
const parentDirName =
|
|
9334
|
+
const parentDirName = basename(dirname9(filePath));
|
|
9483
9335
|
return parentDirName || fileName;
|
|
9484
9336
|
}
|
|
9485
9337
|
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
@@ -9623,7 +9475,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
|
|
|
9623
9475
|
if (visitedImports.has(visitKey))
|
|
9624
9476
|
return [];
|
|
9625
9477
|
visitedImports.add(visitKey);
|
|
9626
|
-
const source = await
|
|
9478
|
+
const source = await readFile7(importedRef.filePath, "utf-8");
|
|
9627
9479
|
const project = new Project3({
|
|
9628
9480
|
compilerOptions: {
|
|
9629
9481
|
strict: false,
|
|
@@ -9651,18 +9503,18 @@ function findWorkspaceRoot(startDir) {
|
|
|
9651
9503
|
return workspaceRootCache.get(startDir);
|
|
9652
9504
|
let dir = startDir;
|
|
9653
9505
|
while (true) {
|
|
9654
|
-
const pkgJsonPath =
|
|
9506
|
+
const pkgJsonPath = join10(dir, "package.json");
|
|
9655
9507
|
if (existsSync6(pkgJsonPath)) {
|
|
9656
9508
|
try {
|
|
9657
9509
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9658
|
-
if (pkg.workspaces || existsSync6(
|
|
9510
|
+
if (pkg.workspaces || existsSync6(join10(dir, "pnpm-workspace.yaml"))) {
|
|
9659
9511
|
workspaceRootCache.set(startDir, dir);
|
|
9660
9512
|
return dir;
|
|
9661
9513
|
}
|
|
9662
9514
|
} catch {
|
|
9663
9515
|
}
|
|
9664
9516
|
}
|
|
9665
|
-
const parent =
|
|
9517
|
+
const parent = dirname9(dir);
|
|
9666
9518
|
if (parent === dir) {
|
|
9667
9519
|
workspaceRootCache.set(startDir, null);
|
|
9668
9520
|
return null;
|
|
@@ -9676,7 +9528,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9676
9528
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
9677
9529
|
}
|
|
9678
9530
|
const packageMap = /* @__PURE__ */ new Map();
|
|
9679
|
-
const packagesDir =
|
|
9531
|
+
const packagesDir = join10(workspaceRoot, "packages");
|
|
9680
9532
|
if (!existsSync6(packagesDir)) {
|
|
9681
9533
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
9682
9534
|
return packageMap;
|
|
@@ -9690,7 +9542,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9690
9542
|
} catch {
|
|
9691
9543
|
return;
|
|
9692
9544
|
}
|
|
9693
|
-
const pkgJsonPath =
|
|
9545
|
+
const pkgJsonPath = join10(dir, "package.json");
|
|
9694
9546
|
if (existsSync6(pkgJsonPath)) {
|
|
9695
9547
|
try {
|
|
9696
9548
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
@@ -9703,10 +9555,10 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9703
9555
|
for (const entry of entries) {
|
|
9704
9556
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
9705
9557
|
continue;
|
|
9706
|
-
const entryPath =
|
|
9558
|
+
const entryPath = join10(dir, entry);
|
|
9707
9559
|
try {
|
|
9708
|
-
const
|
|
9709
|
-
if (
|
|
9560
|
+
const stat5 = statSync3(entryPath);
|
|
9561
|
+
if (stat5.isDirectory()) {
|
|
9710
9562
|
scanDir(entryPath, depth + 1);
|
|
9711
9563
|
}
|
|
9712
9564
|
} catch {
|
|
@@ -9718,7 +9570,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9718
9570
|
return packageMap;
|
|
9719
9571
|
}
|
|
9720
9572
|
function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
9721
|
-
const workspaceRoot = findWorkspaceRoot(
|
|
9573
|
+
const workspaceRoot = findWorkspaceRoot(dirname9(importingFilePath));
|
|
9722
9574
|
if (!workspaceRoot)
|
|
9723
9575
|
return null;
|
|
9724
9576
|
const packageDirs = getWorkspacePackageDirs(workspaceRoot);
|
|
@@ -9743,7 +9595,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9743
9595
|
const packageDir = packageDirs.get(packageName);
|
|
9744
9596
|
if (!packageDir)
|
|
9745
9597
|
return null;
|
|
9746
|
-
const pkgJsonPath =
|
|
9598
|
+
const pkgJsonPath = join10(packageDir, "package.json");
|
|
9747
9599
|
try {
|
|
9748
9600
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9749
9601
|
if (pkg.exports && subpath !== ".") {
|
|
@@ -9756,8 +9608,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9756
9608
|
}
|
|
9757
9609
|
if (subpath !== ".") {
|
|
9758
9610
|
const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
|
|
9759
|
-
for (const base of [
|
|
9760
|
-
const subPkgPath =
|
|
9611
|
+
for (const base of [join10(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
9612
|
+
const subPkgPath = join10(base, "package.json");
|
|
9761
9613
|
if (existsSync6(subPkgPath)) {
|
|
9762
9614
|
try {
|
|
9763
9615
|
const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
|
|
@@ -9810,7 +9662,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9810
9662
|
if (specifier.startsWith(".")) {
|
|
9811
9663
|
if (!specifier.endsWith(".vue"))
|
|
9812
9664
|
continue;
|
|
9813
|
-
localImports.set(defaultImport.getText(), resolve10(
|
|
9665
|
+
localImports.set(defaultImport.getText(), resolve10(dirname9(resolvedFilePath), specifier));
|
|
9814
9666
|
} else {
|
|
9815
9667
|
const resolvedVuePath = resolveWorkspaceVueImport(specifier, resolvedFilePath);
|
|
9816
9668
|
if (resolvedVuePath) {
|
|
@@ -9854,7 +9706,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9854
9706
|
return [];
|
|
9855
9707
|
}
|
|
9856
9708
|
async function extractInheritedVueProps(filePath, visited) {
|
|
9857
|
-
const source = await
|
|
9709
|
+
const source = await readFile7(filePath, "utf-8");
|
|
9858
9710
|
const { descriptor } = parseSFC(source);
|
|
9859
9711
|
if (!descriptor.script) {
|
|
9860
9712
|
return [];
|
|
@@ -9972,7 +9824,7 @@ function mergeSlotsDedup(base, extra) {
|
|
|
9972
9824
|
|
|
9973
9825
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/astro/extract-astro-components.js
|
|
9974
9826
|
import os2 from "node:os";
|
|
9975
|
-
import { basename as
|
|
9827
|
+
import { basename as basename2 } from "node:path";
|
|
9976
9828
|
import { Project as Project4, Node as Node7 } from "ts-morph";
|
|
9977
9829
|
function extractAllowedValues3(typeText) {
|
|
9978
9830
|
const parts = typeText.split("|").map((p) => p.trim());
|
|
@@ -10151,7 +10003,7 @@ function mergeSlots(...slotGroups) {
|
|
|
10151
10003
|
return merged;
|
|
10152
10004
|
}
|
|
10153
10005
|
function extractFromAstroFile(filePath, source) {
|
|
10154
|
-
const name =
|
|
10006
|
+
const name = basename2(filePath, ".astro");
|
|
10155
10007
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
10156
10008
|
let frontmatter = "";
|
|
10157
10009
|
let template = source;
|
|
@@ -10187,7 +10039,7 @@ async function extractAstroComponents(filePaths, onProgress) {
|
|
|
10187
10039
|
}
|
|
10188
10040
|
|
|
10189
10041
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
10190
|
-
import { basename as
|
|
10042
|
+
import { basename as basename3, dirname as dirname10, join as join11, resolve as resolve11 } from "node:path";
|
|
10191
10043
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
10192
10044
|
function normalizeComponentName(input) {
|
|
10193
10045
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -10354,7 +10206,7 @@ function shouldPreferTagName(className, tagName) {
|
|
|
10354
10206
|
return false;
|
|
10355
10207
|
}
|
|
10356
10208
|
function getFileDerivedComponentName(sourceFile) {
|
|
10357
|
-
const baseName =
|
|
10209
|
+
const baseName = basename3(sourceFile.getFilePath()).replace(/\.[^.]+$/, "").replace(/\.component$/, "");
|
|
10358
10210
|
return kebabToPascal(baseName);
|
|
10359
10211
|
}
|
|
10360
10212
|
function chooseComponentName(classDecl, className, tagName) {
|
|
@@ -10832,7 +10684,7 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
|
|
|
10832
10684
|
}
|
|
10833
10685
|
function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
10834
10686
|
if (specifier.startsWith(".")) {
|
|
10835
|
-
const resolvedPath = resolve11(
|
|
10687
|
+
const resolvedPath = resolve11(dirname10(fromFilePath), specifier);
|
|
10836
10688
|
if (resolvedPath.endsWith(".js")) {
|
|
10837
10689
|
return `${resolvedPath.slice(0, -3)}.ts`;
|
|
10838
10690
|
}
|
|
@@ -10842,14 +10694,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
10842
10694
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
10843
10695
|
return null;
|
|
10844
10696
|
}
|
|
10845
|
-
const packagesMarker = `${
|
|
10697
|
+
const packagesMarker = `${join11("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
10846
10698
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
10847
10699
|
if (markerIndex === -1) {
|
|
10848
10700
|
return null;
|
|
10849
10701
|
}
|
|
10850
10702
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
10851
10703
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
10852
|
-
return
|
|
10704
|
+
return join11(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
10853
10705
|
}
|
|
10854
10706
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
10855
10707
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -11002,7 +10854,7 @@ async function extractWebComponentDefinitions(filePaths) {
|
|
|
11002
10854
|
|
|
11003
10855
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
11004
10856
|
import os3 from "node:os";
|
|
11005
|
-
import { basename as
|
|
10857
|
+
import { basename as basename4, dirname as dirname11, resolve as resolve12, join as join12 } from "node:path";
|
|
11006
10858
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
11007
10859
|
import { createRequire } from "node:module";
|
|
11008
10860
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
@@ -11236,10 +11088,10 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
11236
11088
|
function findNearestTsconfig(startDir) {
|
|
11237
11089
|
let dir = startDir;
|
|
11238
11090
|
for (let i = 0; i < 16; i++) {
|
|
11239
|
-
const candidate =
|
|
11091
|
+
const candidate = join12(dir, "tsconfig.json");
|
|
11240
11092
|
if (existsSync7(candidate))
|
|
11241
11093
|
return candidate;
|
|
11242
|
-
const parent =
|
|
11094
|
+
const parent = dirname11(dir);
|
|
11243
11095
|
if (!parent || parent === dir)
|
|
11244
11096
|
return null;
|
|
11245
11097
|
dir = parent;
|
|
@@ -11369,10 +11221,10 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11369
11221
|
} catch {
|
|
11370
11222
|
resolvedJs = null;
|
|
11371
11223
|
}
|
|
11372
|
-
const seedDir = resolvedJs ?
|
|
11224
|
+
const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
|
|
11373
11225
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
11374
11226
|
if (pkgRoot) {
|
|
11375
|
-
const pkgJsonPath =
|
|
11227
|
+
const pkgJsonPath = join12(pkgRoot, "package.json");
|
|
11376
11228
|
if (existsSync7(pkgJsonPath)) {
|
|
11377
11229
|
try {
|
|
11378
11230
|
const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
|
|
@@ -11393,7 +11245,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11393
11245
|
}
|
|
11394
11246
|
}
|
|
11395
11247
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
11396
|
-
const candidate =
|
|
11248
|
+
const candidate = join12(pkgRoot, entry);
|
|
11397
11249
|
if (existsSync7(candidate))
|
|
11398
11250
|
return candidate;
|
|
11399
11251
|
}
|
|
@@ -11411,9 +11263,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11411
11263
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
11412
11264
|
let dir = seedDir;
|
|
11413
11265
|
for (let i = 0; i < 32; i++) {
|
|
11414
|
-
if (existsSync7(
|
|
11266
|
+
if (existsSync7(join12(dir, "package.json"))) {
|
|
11415
11267
|
try {
|
|
11416
|
-
const pkgRaw = readFileSync6(
|
|
11268
|
+
const pkgRaw = readFileSync6(join12(dir, "package.json"), "utf-8");
|
|
11417
11269
|
const pkg = JSON.parse(pkgRaw);
|
|
11418
11270
|
if (pkg.name === specifier)
|
|
11419
11271
|
return dir;
|
|
@@ -11422,7 +11274,7 @@ function findPackageRootForSpecifier(seedDir, specifier) {
|
|
|
11422
11274
|
} catch {
|
|
11423
11275
|
}
|
|
11424
11276
|
}
|
|
11425
|
-
const parent =
|
|
11277
|
+
const parent = dirname11(dir);
|
|
11426
11278
|
if (!parent || parent === dir)
|
|
11427
11279
|
return null;
|
|
11428
11280
|
dir = parent;
|
|
@@ -11553,12 +11405,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11553
11405
|
}
|
|
11554
11406
|
var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
|
|
11555
11407
|
function getSvelteComponentName(filePath) {
|
|
11556
|
-
const file =
|
|
11557
|
-
const parentDir =
|
|
11408
|
+
const file = basename4(filePath, ".svelte");
|
|
11409
|
+
const parentDir = basename4(dirname11(filePath));
|
|
11558
11410
|
if (file === "index")
|
|
11559
11411
|
return toPascalCase(parentDir);
|
|
11560
11412
|
if (ANATOMY_FOLDERS.has(parentDir)) {
|
|
11561
|
-
const grandparent =
|
|
11413
|
+
const grandparent = basename4(dirname11(dirname11(filePath)));
|
|
11562
11414
|
if (grandparent && grandparent !== "." && grandparent !== "/") {
|
|
11563
11415
|
return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
|
|
11564
11416
|
}
|
|
@@ -12373,7 +12225,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
12373
12225
|
}
|
|
12374
12226
|
|
|
12375
12227
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12376
|
-
import { readFile as
|
|
12228
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
12377
12229
|
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
12378
12230
|
|
|
12379
12231
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
@@ -12687,7 +12539,7 @@ function extractProps2(cls, meta) {
|
|
|
12687
12539
|
}
|
|
12688
12540
|
|
|
12689
12541
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
12690
|
-
import { dirname as
|
|
12542
|
+
import { dirname as dirname12, resolve as resolve13 } from "node:path";
|
|
12691
12543
|
|
|
12692
12544
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
|
|
12693
12545
|
var SUFFIXES = ["Component", "Directive"];
|
|
@@ -12742,7 +12594,7 @@ function readComponentMetadata(cls, sourceFilePath) {
|
|
|
12742
12594
|
const inlineTemplate = readDecoratorString(obj, "template");
|
|
12743
12595
|
const templateUrlRel = readDecoratorString(obj, "templateUrl");
|
|
12744
12596
|
const inputsArray = readDecoratorStringArray(obj, "inputs");
|
|
12745
|
-
const templatePath = templateUrlRel ? resolve13(
|
|
12597
|
+
const templatePath = templateUrlRel ? resolve13(dirname12(sourceFilePath), templateUrlRel) : null;
|
|
12746
12598
|
const decorator = cls.getDecorator("Component");
|
|
12747
12599
|
const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
|
|
12748
12600
|
return {
|
|
@@ -12779,14 +12631,14 @@ function countLines(text, offset) {
|
|
|
12779
12631
|
}
|
|
12780
12632
|
|
|
12781
12633
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
12782
|
-
import { readFile as
|
|
12634
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
12783
12635
|
async function resolveTemplateSource(meta) {
|
|
12784
12636
|
if (meta.inlineTemplate !== null)
|
|
12785
12637
|
return meta.inlineTemplate;
|
|
12786
12638
|
if (meta.templatePath === null)
|
|
12787
12639
|
return null;
|
|
12788
12640
|
try {
|
|
12789
|
-
return await
|
|
12641
|
+
return await readFile8(meta.templatePath, "utf8");
|
|
12790
12642
|
} catch {
|
|
12791
12643
|
return null;
|
|
12792
12644
|
}
|
|
@@ -12976,7 +12828,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
|
12976
12828
|
});
|
|
12977
12829
|
for (const filePath of filePaths) {
|
|
12978
12830
|
try {
|
|
12979
|
-
const source = await
|
|
12831
|
+
const source = await readFile9(filePath, "utf8");
|
|
12980
12832
|
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12981
12833
|
for (const cls of sourceFile.getClasses()) {
|
|
12982
12834
|
if (!hasComponentDecorator(cls))
|
|
@@ -13112,11 +12964,11 @@ function getPathPreferenceScore(filePath) {
|
|
|
13112
12964
|
const normalized = filePath.replace(/\\/g, "/");
|
|
13113
12965
|
const segments = normalized.split("/").filter(Boolean);
|
|
13114
12966
|
const filename = segments.at(-1) ?? "";
|
|
13115
|
-
const
|
|
12967
|
+
const basename7 = filename.replace(/\.[^.]+$/, "");
|
|
13116
12968
|
let score = 0;
|
|
13117
12969
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
13118
12970
|
score += 100;
|
|
13119
|
-
if (
|
|
12971
|
+
if (basename7 && segments.at(-2) === basename7)
|
|
13120
12972
|
score -= 10;
|
|
13121
12973
|
const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
|
|
13122
12974
|
score -= componentsSegmentCount * 8;
|
|
@@ -13565,15 +13417,15 @@ function applyCompositionEdges(components, edges) {
|
|
|
13565
13417
|
|
|
13566
13418
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
13567
13419
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
13568
|
-
import { dirname as
|
|
13420
|
+
import { dirname as dirname13, join as join13, resolve as resolve14 } from "node:path";
|
|
13569
13421
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13570
13422
|
function resolvePromptPath(fileName) {
|
|
13571
|
-
const thisDir =
|
|
13423
|
+
const thisDir = dirname13(fileURLToPath3(import.meta.url));
|
|
13572
13424
|
let dir = thisDir;
|
|
13573
13425
|
for (; ; ) {
|
|
13574
|
-
const candidate =
|
|
13426
|
+
const candidate = join13(dir, "prompts");
|
|
13575
13427
|
if (existsSync8(candidate))
|
|
13576
|
-
return
|
|
13428
|
+
return join13(candidate, fileName);
|
|
13577
13429
|
const parent = resolve14(dir, "..");
|
|
13578
13430
|
if (parent === dir) {
|
|
13579
13431
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
@@ -13739,7 +13591,7 @@ ${fileDigest}`);
|
|
|
13739
13591
|
}
|
|
13740
13592
|
|
|
13741
13593
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
13742
|
-
import { dirname as
|
|
13594
|
+
import { dirname as dirname14 } from "node:path";
|
|
13743
13595
|
function kebabToPascal3(name) {
|
|
13744
13596
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
13745
13597
|
}
|
|
@@ -13803,8 +13655,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
13803
13655
|
for (const file of files) {
|
|
13804
13656
|
if (!file.path.endsWith("AGENTS.md"))
|
|
13805
13657
|
continue;
|
|
13806
|
-
const docDir =
|
|
13807
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
13658
|
+
const docDir = dirname14(file.path);
|
|
13659
|
+
const parent = components.find((c2) => c2.sourcePath && dirname14(c2.sourcePath) === docDir)?.name;
|
|
13808
13660
|
if (!parent || !componentNames.has(parent))
|
|
13809
13661
|
continue;
|
|
13810
13662
|
for (const line of file.content.split("\n")) {
|
|
@@ -14200,10 +14052,10 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
14200
14052
|
}
|
|
14201
14053
|
|
|
14202
14054
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
14203
|
-
import { access as access3, readFile as
|
|
14055
|
+
import { access as access3, readFile as readFile11 } from "node:fs/promises";
|
|
14204
14056
|
|
|
14205
14057
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
14206
|
-
import { access as access2, mkdir as mkdir3, readFile as
|
|
14058
|
+
import { access as access2, mkdir as mkdir3, readFile as readFile10, writeFile as writeFile3 } from "node:fs/promises";
|
|
14207
14059
|
|
|
14208
14060
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
14209
14061
|
import { resolve as resolve17 } from "node:path";
|
|
@@ -14222,11 +14074,11 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
14222
14074
|
await mkdir3(paths.sessionDir, { recursive: true });
|
|
14223
14075
|
try {
|
|
14224
14076
|
await access2(paths.statePath);
|
|
14225
|
-
const savedState = await
|
|
14077
|
+
const savedState = await readFile10(paths.statePath, "utf8");
|
|
14226
14078
|
return JSON.parse(savedState);
|
|
14227
14079
|
} catch {
|
|
14228
|
-
await
|
|
14229
|
-
await
|
|
14080
|
+
await writeFile3(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
14081
|
+
await writeFile3(paths.eventsPath, "", "utf8");
|
|
14230
14082
|
return initialSnapshot;
|
|
14231
14083
|
}
|
|
14232
14084
|
}
|
|
@@ -14241,9 +14093,9 @@ function getRefineArtifactsRoot() {
|
|
|
14241
14093
|
}
|
|
14242
14094
|
|
|
14243
14095
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
14244
|
-
import { writeFile as
|
|
14096
|
+
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
14245
14097
|
async function saveReviewState(statePath, session) {
|
|
14246
|
-
await
|
|
14098
|
+
await writeFile4(statePath, JSON.stringify(session, null, 2), "utf8");
|
|
14247
14099
|
}
|
|
14248
14100
|
|
|
14249
14101
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
@@ -14253,7 +14105,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14253
14105
|
let snapshot;
|
|
14254
14106
|
try {
|
|
14255
14107
|
await access3(paths.statePath);
|
|
14256
|
-
snapshot = JSON.parse(await
|
|
14108
|
+
snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
|
|
14257
14109
|
} catch {
|
|
14258
14110
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
14259
14111
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -14291,7 +14143,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14291
14143
|
}
|
|
14292
14144
|
|
|
14293
14145
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
14294
|
-
import { readFile as
|
|
14146
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
14295
14147
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
14296
14148
|
if (names.length === 0)
|
|
14297
14149
|
return;
|
|
@@ -14307,7 +14159,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
14307
14159
|
const nameSet = new Set(names);
|
|
14308
14160
|
let snapshot;
|
|
14309
14161
|
try {
|
|
14310
|
-
snapshot = JSON.parse(await
|
|
14162
|
+
snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
|
|
14311
14163
|
} catch {
|
|
14312
14164
|
return;
|
|
14313
14165
|
}
|
|
@@ -14506,15 +14358,15 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
14506
14358
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
14507
14359
|
function collectFiles(root, options = {}) {
|
|
14508
14360
|
const resolved = path4.resolve(root);
|
|
14509
|
-
let
|
|
14361
|
+
let stat5;
|
|
14510
14362
|
try {
|
|
14511
|
-
|
|
14363
|
+
stat5 = statSync5(resolved);
|
|
14512
14364
|
} catch (err) {
|
|
14513
14365
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
14514
14366
|
}
|
|
14515
|
-
if (
|
|
14367
|
+
if (stat5.isFile())
|
|
14516
14368
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
14517
|
-
if (!
|
|
14369
|
+
if (!stat5.isDirectory())
|
|
14518
14370
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
14519
14371
|
const result = {
|
|
14520
14372
|
filePaths: [],
|
|
@@ -14564,7 +14416,7 @@ function generateUlid(now = Date.now()) {
|
|
|
14564
14416
|
}
|
|
14565
14417
|
|
|
14566
14418
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14567
|
-
import { readFile as
|
|
14419
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
14568
14420
|
|
|
14569
14421
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
14570
14422
|
function migrateRecord(rec) {
|
|
@@ -14583,7 +14435,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
14583
14435
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14584
14436
|
async function readRunsFileMaybe() {
|
|
14585
14437
|
try {
|
|
14586
|
-
const raw = await
|
|
14438
|
+
const raw = await readFile13(runsFilePath(), "utf8");
|
|
14587
14439
|
const parsed = JSON.parse(raw);
|
|
14588
14440
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
14589
14441
|
throw new Error(`runs.json version mismatch: file is v${parsed.version}, this CLI expects v${RUNS_FILE_VERSION} (also reads: ${[...READABLE_VERSIONS].join(", ")}). Back up and remove the file to start fresh.`);
|
|
@@ -14599,13 +14451,13 @@ async function readRunsFileMaybe() {
|
|
|
14599
14451
|
}
|
|
14600
14452
|
|
|
14601
14453
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
14602
|
-
import { mkdir as mkdir4, rename as rename2, writeFile as
|
|
14603
|
-
import { dirname as
|
|
14454
|
+
import { mkdir as mkdir4, rename as rename2, writeFile as writeFile5 } from "node:fs/promises";
|
|
14455
|
+
import { dirname as dirname15 } from "node:path";
|
|
14604
14456
|
async function writeRunsFileAtomic(file) {
|
|
14605
|
-
await mkdir4(
|
|
14457
|
+
await mkdir4(dirname15(runsFilePath()), { recursive: true });
|
|
14606
14458
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
14607
14459
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
14608
|
-
await
|
|
14460
|
+
await writeFile5(tmp, body, { mode: 384 });
|
|
14609
14461
|
await rename2(tmp, runsFilePath());
|
|
14610
14462
|
}
|
|
14611
14463
|
|
|
@@ -14642,7 +14494,7 @@ async function updateRun(id, patch) {
|
|
|
14642
14494
|
}
|
|
14643
14495
|
|
|
14644
14496
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14645
|
-
import { readFile as
|
|
14497
|
+
import { readFile as readFile14, stat as stat2 } from "node:fs/promises";
|
|
14646
14498
|
import { resolve as resolve19 } from "node:path";
|
|
14647
14499
|
|
|
14648
14500
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
@@ -14670,7 +14522,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14670
14522
|
continue;
|
|
14671
14523
|
seen.add(abs);
|
|
14672
14524
|
try {
|
|
14673
|
-
const st = await
|
|
14525
|
+
const st = await stat2(abs);
|
|
14674
14526
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14675
14527
|
if (name)
|
|
14676
14528
|
entry.componentName = name;
|
|
@@ -14685,7 +14537,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14685
14537
|
const abs = resolve19(opts.rawTokensPath);
|
|
14686
14538
|
rawTokensPath = abs;
|
|
14687
14539
|
try {
|
|
14688
|
-
const [st, buf] = await Promise.all([
|
|
14540
|
+
const [st, buf] = await Promise.all([stat2(abs), readFile14(abs)]);
|
|
14689
14541
|
rawTokensMtime = st.mtime.toISOString();
|
|
14690
14542
|
rawTokensContentHash = sha256Hex(buf);
|
|
14691
14543
|
} catch {
|
|
@@ -14696,7 +14548,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14696
14548
|
|
|
14697
14549
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14698
14550
|
import { access as access4 } from "node:fs/promises";
|
|
14699
|
-
import { join as
|
|
14551
|
+
import { join as join14 } from "node:path";
|
|
14700
14552
|
|
|
14701
14553
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
|
|
14702
14554
|
var SAVE_FILES = ["components.json", "tokens.json"];
|
|
@@ -14706,7 +14558,7 @@ async function listConflictingFiles(path5) {
|
|
|
14706
14558
|
const conflicts = [];
|
|
14707
14559
|
for (const name of SAVE_FILES) {
|
|
14708
14560
|
try {
|
|
14709
|
-
await access4(
|
|
14561
|
+
await access4(join14(path5, name));
|
|
14710
14562
|
conflicts.push(name);
|
|
14711
14563
|
} catch {
|
|
14712
14564
|
}
|
|
@@ -14720,7 +14572,7 @@ async function detectSaveConflict(path5) {
|
|
|
14720
14572
|
}
|
|
14721
14573
|
|
|
14722
14574
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
|
|
14723
|
-
import { join as
|
|
14575
|
+
import { join as join15 } from "node:path";
|
|
14724
14576
|
function pad2(n) {
|
|
14725
14577
|
return n < 10 ? `0${n}` : String(n);
|
|
14726
14578
|
}
|
|
@@ -14731,7 +14583,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
14731
14583
|
const hh = pad2(now.getHours());
|
|
14732
14584
|
const mm = pad2(now.getMinutes());
|
|
14733
14585
|
const ss = pad2(now.getSeconds());
|
|
14734
|
-
return
|
|
14586
|
+
return join15(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
14735
14587
|
}
|
|
14736
14588
|
|
|
14737
14589
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
|
|
@@ -14767,12 +14619,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
14767
14619
|
}
|
|
14768
14620
|
|
|
14769
14621
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14770
|
-
import { readFile as
|
|
14622
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
14771
14623
|
async function loadAcceptedNames(sessionId) {
|
|
14772
14624
|
try {
|
|
14773
14625
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14774
14626
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14775
|
-
const raw = await
|
|
14627
|
+
const raw = await readFile15(paths.statePath, "utf8");
|
|
14776
14628
|
const snapshot = JSON.parse(raw);
|
|
14777
14629
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14778
14630
|
if (accepted.length === 0)
|
|
@@ -16098,11 +15950,11 @@ function formatApiError2(request) {
|
|
|
16098
15950
|
|
|
16099
15951
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
16100
15952
|
init_shared();
|
|
16101
|
-
import { readFile as
|
|
15953
|
+
import { readFile as readFile16, stat as stat4 } from "node:fs/promises";
|
|
16102
15954
|
|
|
16103
15955
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
16104
|
-
import { readdir as
|
|
16105
|
-
import { join as
|
|
15956
|
+
import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
|
|
15957
|
+
import { join as join16 } from "node:path";
|
|
16106
15958
|
var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
|
|
16107
15959
|
async function collectJsonFiles(dir) {
|
|
16108
15960
|
const results = [];
|
|
@@ -16112,17 +15964,17 @@ async function collectJsonFiles(dir) {
|
|
|
16112
15964
|
async function walk(current, results) {
|
|
16113
15965
|
let entries;
|
|
16114
15966
|
try {
|
|
16115
|
-
entries = await
|
|
15967
|
+
entries = await readdir2(current);
|
|
16116
15968
|
} catch {
|
|
16117
15969
|
return;
|
|
16118
15970
|
}
|
|
16119
15971
|
await Promise.all(entries.map(async (entry) => {
|
|
16120
15972
|
if (IGNORE_TOKEN_DIRS.has(entry))
|
|
16121
15973
|
return;
|
|
16122
|
-
const full =
|
|
15974
|
+
const full = join16(current, entry);
|
|
16123
15975
|
let s;
|
|
16124
15976
|
try {
|
|
16125
|
-
s = await
|
|
15977
|
+
s = await stat3(full);
|
|
16126
15978
|
} catch {
|
|
16127
15979
|
return;
|
|
16128
15980
|
}
|
|
@@ -16138,7 +15990,7 @@ async function walk(current, results) {
|
|
|
16138
15990
|
async function readTokensFromPath(flag, p) {
|
|
16139
15991
|
let s;
|
|
16140
15992
|
try {
|
|
16141
|
-
s = await
|
|
15993
|
+
s = await stat4(p);
|
|
16142
15994
|
} catch {
|
|
16143
15995
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16144
15996
|
}
|
|
@@ -16157,7 +16009,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16157
16009
|
const merged = {};
|
|
16158
16010
|
for (const file of files.sort()) {
|
|
16159
16011
|
try {
|
|
16160
|
-
const text = await
|
|
16012
|
+
const text = await readFile16(file, "utf8");
|
|
16161
16013
|
const parsed = JSON.parse(text);
|
|
16162
16014
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
16163
16015
|
Object.assign(merged, parsed);
|
|
@@ -16171,7 +16023,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16171
16023
|
async function readSingleFile(flag, p) {
|
|
16172
16024
|
let text;
|
|
16173
16025
|
try {
|
|
16174
|
-
text = await
|
|
16026
|
+
text = await readFile16(p, "utf8");
|
|
16175
16027
|
} catch {
|
|
16176
16028
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16177
16029
|
}
|
|
@@ -16216,8 +16068,8 @@ function buildContentfulManagementClient(request) {
|
|
|
16216
16068
|
}
|
|
16217
16069
|
|
|
16218
16070
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
|
|
16219
|
-
import { writeFile as
|
|
16220
|
-
import { join as
|
|
16071
|
+
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
16072
|
+
import { join as join17 } from "node:path";
|
|
16221
16073
|
|
|
16222
16074
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
|
|
16223
16075
|
import { fetchAll } from "contentful-management";
|
|
@@ -16249,8 +16101,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16249
16101
|
spaceId: request.spaceId,
|
|
16250
16102
|
environmentId: request.environmentId
|
|
16251
16103
|
});
|
|
16252
|
-
const path5 =
|
|
16253
|
-
await
|
|
16104
|
+
const path5 = join17(request.outDir, ".existing-entities.json");
|
|
16105
|
+
await writeFile6(path5, JSON.stringify(entities, null, 2), "utf8");
|
|
16254
16106
|
return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
|
|
16255
16107
|
} catch (error) {
|
|
16256
16108
|
return {
|
|
@@ -16262,12 +16114,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16262
16114
|
}
|
|
16263
16115
|
|
|
16264
16116
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
16265
|
-
import { readFile as
|
|
16117
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
16266
16118
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
16267
16119
|
if (!request.path)
|
|
16268
16120
|
return void 0;
|
|
16269
16121
|
try {
|
|
16270
|
-
const raw = await
|
|
16122
|
+
const raw = await readFile17(request.path, "utf8");
|
|
16271
16123
|
const parsed = JSON.parse(raw);
|
|
16272
16124
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
16273
16125
|
return void 0;
|
|
@@ -17032,7 +16884,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
17032
16884
|
}
|
|
17033
16885
|
|
|
17034
16886
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
17035
|
-
import { readFile as
|
|
16887
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
17036
16888
|
|
|
17037
16889
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
17038
16890
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -17134,7 +16986,7 @@ function dedupeReasons(reasons) {
|
|
|
17134
16986
|
async function inspectComponentSource(component) {
|
|
17135
16987
|
let sourceText = "";
|
|
17136
16988
|
try {
|
|
17137
|
-
sourceText = await
|
|
16989
|
+
sourceText = await readFile18(component.source, "utf8");
|
|
17138
16990
|
} catch {
|
|
17139
16991
|
return {
|
|
17140
16992
|
wrapperConfidence: 0,
|
|
@@ -17573,7 +17425,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
17573
17425
|
}
|
|
17574
17426
|
|
|
17575
17427
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17576
|
-
import { readFile as
|
|
17428
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
17577
17429
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17578
17430
|
const paths = new Set(extraFiles);
|
|
17579
17431
|
for (const c2 of components) {
|
|
@@ -17583,7 +17435,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17583
17435
|
const out = [];
|
|
17584
17436
|
await Promise.all([...paths].map(async (p) => {
|
|
17585
17437
|
try {
|
|
17586
|
-
const content = await
|
|
17438
|
+
const content = await readFile19(p, "utf8");
|
|
17587
17439
|
out.push({ path: p, content });
|
|
17588
17440
|
} catch {
|
|
17589
17441
|
}
|
|
@@ -17754,15 +17606,15 @@ init_build_prompt();
|
|
|
17754
17606
|
init_create_local_cli_agent_invoker();
|
|
17755
17607
|
init_invoke_agent_with_output();
|
|
17756
17608
|
init_parse_token_tool_calls();
|
|
17757
|
-
import { readFile as
|
|
17758
|
-
import { basename as
|
|
17609
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
17610
|
+
import { basename as basename5, resolve as pathResolve } from "node:path";
|
|
17759
17611
|
init_cache_keys();
|
|
17760
17612
|
init_parse_prompt_overrides();
|
|
17761
17613
|
init_resolve_prompt_override();
|
|
17762
17614
|
|
|
17763
17615
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
17764
|
-
import { mkdir as mkdir7, writeFile as
|
|
17765
|
-
import { join as
|
|
17616
|
+
import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
|
|
17617
|
+
import { join as join18 } from "node:path";
|
|
17766
17618
|
async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
17767
17619
|
onProgress?.({ kind: "writing-file" });
|
|
17768
17620
|
const result = getDtcgTokensForSession(db, sessionId);
|
|
@@ -17770,9 +17622,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
|
17770
17622
|
throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
|
|
17771
17623
|
}
|
|
17772
17624
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
17773
|
-
const tokensPath =
|
|
17625
|
+
const tokensPath = join18(outDir, "tokens.json");
|
|
17774
17626
|
await mkdir7(outDir, { recursive: true });
|
|
17775
|
-
await
|
|
17627
|
+
await writeFile7(tokensPath, `${JSON.stringify(tree, null, 2)}
|
|
17776
17628
|
`);
|
|
17777
17629
|
return { tokensPath, tokenCount: result.tokens.length };
|
|
17778
17630
|
}
|
|
@@ -17787,7 +17639,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17787
17639
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17788
17640
|
const tokensOverride = overridesMap.get("tokens");
|
|
17789
17641
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17790
|
-
const rawTokensInline = await
|
|
17642
|
+
const rawTokensInline = await readFile20(pathResolve(rawTokensPath), "utf8");
|
|
17791
17643
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17792
17644
|
const db = openPipelineDb();
|
|
17793
17645
|
try {
|
|
@@ -17815,7 +17667,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17815
17667
|
skill: "tokens",
|
|
17816
17668
|
mode: "autonomous",
|
|
17817
17669
|
rawTokensInline,
|
|
17818
|
-
rawTokensFilename:
|
|
17670
|
+
rawTokensFilename: basename5(pathResolve(rawTokensPath)),
|
|
17819
17671
|
outDir: process.cwd(),
|
|
17820
17672
|
...skillContentOverride ? { skillContentOverride } : skillPath ? { skillPathOverride: skillPath } : {}
|
|
17821
17673
|
});
|
|
@@ -18267,7 +18119,8 @@ function Failure({ scan, path: path5 }) {
|
|
|
18267
18119
|
function Summary({
|
|
18268
18120
|
scan,
|
|
18269
18121
|
path: path5,
|
|
18270
|
-
hasTokens
|
|
18122
|
+
hasTokens,
|
|
18123
|
+
empty
|
|
18271
18124
|
}) {
|
|
18272
18125
|
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
18273
18126
|
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", gap: 1, children: [
|
|
@@ -18276,7 +18129,11 @@ function Summary({
|
|
|
18276
18129
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: path5 })
|
|
18277
18130
|
] }),
|
|
18278
18131
|
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
18279
|
-
/* @__PURE__ */ jsxs12(Text12, { color: PALETTE.
|
|
18132
|
+
empty ? /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.muted, children: [
|
|
18133
|
+
"Found ",
|
|
18134
|
+
total,
|
|
18135
|
+
" files:"
|
|
18136
|
+
] }) : /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.success, children: [
|
|
18280
18137
|
"\u2713 Found ",
|
|
18281
18138
|
total,
|
|
18282
18139
|
" files:"
|
|
@@ -18287,7 +18144,7 @@ function Summary({
|
|
|
18287
18144
|
"\u26A0 ",
|
|
18288
18145
|
warning
|
|
18289
18146
|
] }),
|
|
18290
|
-
/* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
18147
|
+
!empty && /* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
18291
18148
|
] });
|
|
18292
18149
|
}
|
|
18293
18150
|
function PathValidationScreen({
|
|
@@ -18299,8 +18156,8 @@ function PathValidationScreen({
|
|
|
18299
18156
|
hasTokens = true
|
|
18300
18157
|
}) {
|
|
18301
18158
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
18302
|
-
const [scan, setScan] =
|
|
18303
|
-
|
|
18159
|
+
const [scan, setScan] = useState7();
|
|
18160
|
+
useEffect7(() => {
|
|
18304
18161
|
startDebugRun({
|
|
18305
18162
|
flow: "import/path-validation",
|
|
18306
18163
|
step: "03-path-validation",
|
|
@@ -18308,10 +18165,10 @@ function PathValidationScreen({
|
|
|
18308
18165
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
18309
18166
|
});
|
|
18310
18167
|
}, []);
|
|
18311
|
-
|
|
18168
|
+
useEffect7(() => {
|
|
18312
18169
|
setScan(scanFiles(resolvedPath));
|
|
18313
18170
|
}, [resolvedPath]);
|
|
18314
|
-
const phase = phaseOf(scan);
|
|
18171
|
+
const phase = phaseOf(scan, { hasTokens });
|
|
18315
18172
|
const finish = (outcome, exitMethod) => {
|
|
18316
18173
|
void finishDebugRun({
|
|
18317
18174
|
outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
|
|
@@ -18343,19 +18200,19 @@ function PathValidationScreen({
|
|
|
18343
18200
|
"..."
|
|
18344
18201
|
] }),
|
|
18345
18202
|
scan?.ok === false && /* @__PURE__ */ jsx13(Failure, { scan, path: resolvedPath }),
|
|
18346
|
-
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
18203
|
+
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens, empty: phase === "empty" }),
|
|
18347
18204
|
/* @__PURE__ */ jsx13(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx13(ControlHints, { hints: controlsFor(phase) }) })
|
|
18348
18205
|
] })
|
|
18349
18206
|
] });
|
|
18350
18207
|
}
|
|
18351
18208
|
|
|
18352
18209
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
18353
|
-
import { useEffect as
|
|
18210
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
|
|
18354
18211
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
18355
18212
|
init_debug_store();
|
|
18356
18213
|
|
|
18357
18214
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
18358
|
-
import { useState as
|
|
18215
|
+
import { useState as useState8 } from "react";
|
|
18359
18216
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
18360
18217
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
18361
18218
|
function formLabelWidth(rows) {
|
|
@@ -18391,9 +18248,9 @@ function FieldForm({
|
|
|
18391
18248
|
busy = false,
|
|
18392
18249
|
children
|
|
18393
18250
|
}) {
|
|
18394
|
-
const [active, setActive] =
|
|
18395
|
-
const [editing, setEditing] =
|
|
18396
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
18251
|
+
const [active, setActive] = useState8(0);
|
|
18252
|
+
const [editing, setEditing] = useState8(false);
|
|
18253
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
18397
18254
|
const rowCount = fields2.length + actions.length;
|
|
18398
18255
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
18399
18256
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -18670,16 +18527,16 @@ function CredentialsScreen({
|
|
|
18670
18527
|
host: initial.host ?? ""
|
|
18671
18528
|
})
|
|
18672
18529
|
).current;
|
|
18673
|
-
const [values, setValues] =
|
|
18674
|
-
const [notice, setNotice] =
|
|
18675
|
-
const [validating, setValidating] =
|
|
18530
|
+
const [values, setValues] = useState9(initialValues);
|
|
18531
|
+
const [notice, setNotice] = useState9(null);
|
|
18532
|
+
const [validating, setValidating] = useState9(false);
|
|
18676
18533
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18677
|
-
const [editing, setEditing] =
|
|
18678
|
-
const [focus, setFocus] =
|
|
18679
|
-
const [active, setActive] =
|
|
18680
|
-
const [beforeEdit, setBeforeEdit] =
|
|
18534
|
+
const [editing, setEditing] = useState9(!prefilled);
|
|
18535
|
+
const [focus, setFocus] = useState9(0);
|
|
18536
|
+
const [active, setActive] = useState9(0);
|
|
18537
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
18681
18538
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
18682
|
-
|
|
18539
|
+
useEffect8(() => {
|
|
18683
18540
|
startDebugRun({
|
|
18684
18541
|
flow: "import/credentials",
|
|
18685
18542
|
step: "04-credentials",
|
|
@@ -19001,7 +18858,7 @@ function ExtractionScreen({ progress, agent, rowMs }) {
|
|
|
19001
18858
|
}
|
|
19002
18859
|
|
|
19003
18860
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
19004
|
-
import { useEffect as
|
|
18861
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState10 } from "react";
|
|
19005
18862
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
19006
18863
|
init_debug_store();
|
|
19007
18864
|
|
|
@@ -19066,8 +18923,8 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
19066
18923
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
19067
18924
|
const rows = loaded.ok ? loaded.rows : [];
|
|
19068
18925
|
const columns = useTerminalWidth();
|
|
19069
|
-
const [selected, setSelected] =
|
|
19070
|
-
|
|
18926
|
+
const [selected, setSelected] = useState10(0);
|
|
18927
|
+
useEffect9(() => {
|
|
19071
18928
|
startDebugRun({
|
|
19072
18929
|
flow: "import/token-review",
|
|
19073
18930
|
step: "05-token-review",
|
|
@@ -19156,21 +19013,21 @@ init_config();
|
|
|
19156
19013
|
|
|
19157
19014
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19158
19015
|
init_debug_store();
|
|
19159
|
-
import { useEffect as
|
|
19016
|
+
import { useEffect as useEffect10, useRef as useRef6, useState as useState11 } from "react";
|
|
19160
19017
|
|
|
19161
19018
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
19162
19019
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
19163
|
-
import { join as
|
|
19020
|
+
import { join as join20, resolve as resolve24 } from "node:path";
|
|
19164
19021
|
|
|
19165
19022
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
19166
19023
|
import { existsSync as existsSync10 } from "node:fs";
|
|
19167
|
-
import { dirname as
|
|
19024
|
+
import { dirname as dirname16, join as join19, resolve as resolve22 } from "node:path";
|
|
19168
19025
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
19169
19026
|
function findSkillPath(fileName) {
|
|
19170
|
-
const thisDir =
|
|
19027
|
+
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
19171
19028
|
let dir = thisDir;
|
|
19172
19029
|
for (; ; ) {
|
|
19173
|
-
const candidate =
|
|
19030
|
+
const candidate = join19(dir, "skills", fileName);
|
|
19174
19031
|
if (existsSync10(candidate)) return candidate;
|
|
19175
19032
|
const parent = resolve22(dir, "..");
|
|
19176
19033
|
if (parent === dir) {
|
|
@@ -19280,7 +19137,7 @@ var realDeps = {
|
|
|
19280
19137
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
19281
19138
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
19282
19139
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
19283
|
-
const outDir = input.outDir ??
|
|
19140
|
+
const outDir = input.outDir ?? join20(resolve24(input.projectPath), ".contentful");
|
|
19284
19141
|
let progress = initialProgress({
|
|
19285
19142
|
hasCredentials: input.credentials !== null,
|
|
19286
19143
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -19411,9 +19268,9 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
19411
19268
|
|
|
19412
19269
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19413
19270
|
function useExtraction(input) {
|
|
19414
|
-
const [state2, setState] =
|
|
19271
|
+
const [state2, setState] = useState11();
|
|
19415
19272
|
const current = useRef6();
|
|
19416
|
-
|
|
19273
|
+
useEffect10(() => {
|
|
19417
19274
|
current.current = input;
|
|
19418
19275
|
if (!input) {
|
|
19419
19276
|
setState(void 0);
|
|
@@ -19456,7 +19313,7 @@ function useExtraction(input) {
|
|
|
19456
19313
|
}
|
|
19457
19314
|
|
|
19458
19315
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19459
|
-
import { useEffect as
|
|
19316
|
+
import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
|
|
19460
19317
|
|
|
19461
19318
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
|
|
19462
19319
|
var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
|
|
@@ -19489,9 +19346,9 @@ async function runTokensOnly(input, deps = realDeps2) {
|
|
|
19489
19346
|
|
|
19490
19347
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19491
19348
|
function useTokensOnly(input) {
|
|
19492
|
-
const [state2, setState] =
|
|
19349
|
+
const [state2, setState] = useState12();
|
|
19493
19350
|
const current = useRef7();
|
|
19494
|
-
|
|
19351
|
+
useEffect11(() => {
|
|
19495
19352
|
current.current = input;
|
|
19496
19353
|
if (!input) {
|
|
19497
19354
|
setState(void 0);
|
|
@@ -19510,7 +19367,7 @@ function useTokensOnly(input) {
|
|
|
19510
19367
|
|
|
19511
19368
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
19512
19369
|
init_debug_store();
|
|
19513
|
-
import { useEffect as
|
|
19370
|
+
import { useEffect as useEffect14, useMemo as useMemo4 } from "react";
|
|
19514
19371
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
19515
19372
|
|
|
19516
19373
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts
|
|
@@ -19707,32 +19564,32 @@ function CounterStrip(props) {
|
|
|
19707
19564
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
19708
19565
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
19709
19566
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
19710
|
-
const
|
|
19567
|
+
const sep = condensed ? " | " : " ";
|
|
19711
19568
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
19712
19569
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19713
19570
|
labelGrp,
|
|
19714
19571
|
" "
|
|
19715
19572
|
] }),
|
|
19716
19573
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
19717
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19574
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
19718
19575
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19719
19576
|
labelAcc,
|
|
19720
19577
|
" "
|
|
19721
19578
|
] }),
|
|
19722
19579
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
19723
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19580
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
19724
19581
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19725
19582
|
labelRej,
|
|
19726
19583
|
" "
|
|
19727
19584
|
] }),
|
|
19728
19585
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
19729
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19586
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
19730
19587
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19731
19588
|
labelUnd,
|
|
19732
19589
|
" "
|
|
19733
19590
|
] }),
|
|
19734
19591
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
19735
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19592
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep })
|
|
19736
19593
|
] }) });
|
|
19737
19594
|
}
|
|
19738
19595
|
|
|
@@ -20723,7 +20580,7 @@ function useImmediateInput(handler, enabled = true) {
|
|
|
20723
20580
|
|
|
20724
20581
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
20725
20582
|
import { useStdout as useStdout2 } from "ink";
|
|
20726
|
-
import { useEffect as
|
|
20583
|
+
import { useEffect as useEffect12, useState as useState13 } from "react";
|
|
20727
20584
|
function readTerminalSize(stdout) {
|
|
20728
20585
|
return {
|
|
20729
20586
|
columns: stdout?.columns ?? 80,
|
|
@@ -20732,8 +20589,8 @@ function readTerminalSize(stdout) {
|
|
|
20732
20589
|
}
|
|
20733
20590
|
function useTerminalSize() {
|
|
20734
20591
|
const { stdout } = useStdout2();
|
|
20735
|
-
const [size, setSize] =
|
|
20736
|
-
|
|
20592
|
+
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
20593
|
+
useEffect12(() => {
|
|
20737
20594
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
20738
20595
|
stdout?.on("resize", updateSize);
|
|
20739
20596
|
updateSize();
|
|
@@ -20916,7 +20773,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
20916
20773
|
}
|
|
20917
20774
|
|
|
20918
20775
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
20919
|
-
import { useEffect as
|
|
20776
|
+
import { useEffect as useEffect13, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
|
|
20920
20777
|
|
|
20921
20778
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
|
|
20922
20779
|
var TWO_COLUMN_MIN_WIDTH = 100;
|
|
@@ -21368,15 +21225,15 @@ function resolveGroupRoot(key, closures, cycleSet) {
|
|
|
21368
21225
|
}
|
|
21369
21226
|
|
|
21370
21227
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
21371
|
-
import { useState as
|
|
21228
|
+
import { useState as useState14 } from "react";
|
|
21372
21229
|
function useSidebarSearchState() {
|
|
21373
|
-
const [searchOpen, setSearchOpen] =
|
|
21374
|
-
const [searchQuery, setSearchQuery] =
|
|
21375
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
21376
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
21377
|
-
const [columnOneView, setColumnOneView] =
|
|
21378
|
-
const [activeFilters, setActiveFilters] =
|
|
21379
|
-
const [showHelp, setShowHelp] =
|
|
21230
|
+
const [searchOpen, setSearchOpen] = useState14(false);
|
|
21231
|
+
const [searchQuery, setSearchQuery] = useState14("");
|
|
21232
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState14([]);
|
|
21233
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState14(null);
|
|
21234
|
+
const [columnOneView, setColumnOneView] = useState14("grouped");
|
|
21235
|
+
const [activeFilters, setActiveFilters] = useState14(/* @__PURE__ */ new Set());
|
|
21236
|
+
const [showHelp, setShowHelp] = useState14(false);
|
|
21380
21237
|
return {
|
|
21381
21238
|
searchOpen,
|
|
21382
21239
|
setSearchOpen,
|
|
@@ -21396,10 +21253,10 @@ function useSidebarSearchState() {
|
|
|
21396
21253
|
}
|
|
21397
21254
|
|
|
21398
21255
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
21399
|
-
import { useCallback, useState as
|
|
21256
|
+
import { useCallback, useState as useState15 } from "react";
|
|
21400
21257
|
function useOverlayPanel(opts) {
|
|
21401
21258
|
const { toggleKey, onClose } = opts;
|
|
21402
|
-
const [isOpen, setIsOpen] =
|
|
21259
|
+
const [isOpen, setIsOpen] = useState15(false);
|
|
21403
21260
|
const open = useCallback(() => {
|
|
21404
21261
|
setIsOpen(true);
|
|
21405
21262
|
}, []);
|
|
@@ -21613,16 +21470,16 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21613
21470
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
21614
21471
|
[totalWidth, tokenCount, tokensWidth]
|
|
21615
21472
|
);
|
|
21616
|
-
const [decisions, setDecisions] =
|
|
21617
|
-
const [nav, setNav] =
|
|
21618
|
-
const [focusedColumn, setFocusedColumn] =
|
|
21619
|
-
const [tokensCursor, setTokensCursor] =
|
|
21620
|
-
const [showDependencies, setShowDependencies] =
|
|
21621
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
21622
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
21473
|
+
const [decisions, setDecisions] = useState16(/* @__PURE__ */ new Map());
|
|
21474
|
+
const [nav, setNav] = useState16({ cursor: 0, scrollOffset: 0 });
|
|
21475
|
+
const [focusedColumn, setFocusedColumn] = useState16("main");
|
|
21476
|
+
const [tokensCursor, setTokensCursor] = useState16(0);
|
|
21477
|
+
const [showDependencies, setShowDependencies] = useState16(false);
|
|
21478
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState16(false);
|
|
21479
|
+
const [cyclesCursor, setCyclesCursor] = useState16(0);
|
|
21623
21480
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
21624
|
-
const [aiCursor, setAiCursor] =
|
|
21625
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
21481
|
+
const [aiCursor, setAiCursor] = useState16(0);
|
|
21482
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState16(null);
|
|
21626
21483
|
const search = useSidebarSearchState();
|
|
21627
21484
|
const {
|
|
21628
21485
|
searchOpen,
|
|
@@ -21647,13 +21504,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21647
21504
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
21648
21505
|
[slotCycles]
|
|
21649
21506
|
);
|
|
21650
|
-
const [expandedGroups, setExpandedGroups] =
|
|
21507
|
+
const [expandedGroups, setExpandedGroups] = useState16(() => {
|
|
21651
21508
|
const seed = new Set(closures.keys());
|
|
21652
21509
|
for (const p of cycleParticipants) seed.add(p);
|
|
21653
21510
|
return seed;
|
|
21654
21511
|
});
|
|
21655
21512
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
21656
|
-
|
|
21513
|
+
useEffect13(() => {
|
|
21657
21514
|
if (seededGroupsRef.current) return;
|
|
21658
21515
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
21659
21516
|
seededGroupsRef.current = true;
|
|
@@ -21744,7 +21601,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21744
21601
|
entryCount: 0
|
|
21745
21602
|
});
|
|
21746
21603
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
21747
|
-
|
|
21604
|
+
useEffect13(() => {
|
|
21748
21605
|
setNav((prev) => {
|
|
21749
21606
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
21750
21607
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -22115,7 +21972,7 @@ function ScopeGateScreen({
|
|
|
22115
21972
|
return loaded?.ok ? loaded.rows : [];
|
|
22116
21973
|
}, [tokensPath]);
|
|
22117
21974
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
22118
|
-
|
|
21975
|
+
useEffect14(() => {
|
|
22119
21976
|
startDebugRun({
|
|
22120
21977
|
flow: "import/scope-gate",
|
|
22121
21978
|
step: "07-scope-gate",
|
|
@@ -22237,7 +22094,7 @@ function ScopeGateScreen({
|
|
|
22237
22094
|
|
|
22238
22095
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
22239
22096
|
init_debug_store();
|
|
22240
|
-
import { useEffect as
|
|
22097
|
+
import { useEffect as useEffect15, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
|
|
22241
22098
|
|
|
22242
22099
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
|
|
22243
22100
|
async function checkGenerationCache(input) {
|
|
@@ -22285,8 +22142,8 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22285
22142
|
const sessionId = input?.sessionId;
|
|
22286
22143
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
22287
22144
|
const cacheCheck = useRef10(void 0);
|
|
22288
|
-
const [confirmed, setConfirmed] =
|
|
22289
|
-
|
|
22145
|
+
const [confirmed, setConfirmed] = useState17();
|
|
22146
|
+
useEffect15(() => {
|
|
22290
22147
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
22291
22148
|
startDebugRun({
|
|
22292
22149
|
flow: "import/scope-gate",
|
|
@@ -22300,7 +22157,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22300
22157
|
exitMethod: "discarded"
|
|
22301
22158
|
});
|
|
22302
22159
|
}, [sessionId, loaded]);
|
|
22303
|
-
|
|
22160
|
+
useEffect15(() => {
|
|
22304
22161
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
22305
22162
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
22306
22163
|
}, [input, loaded]);
|
|
@@ -22415,7 +22272,7 @@ function GenerationScreen({
|
|
|
22415
22272
|
|
|
22416
22273
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22417
22274
|
init_debug_store();
|
|
22418
|
-
import { useEffect as
|
|
22275
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState18 } from "react";
|
|
22419
22276
|
|
|
22420
22277
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
22421
22278
|
import { resolve as resolve25 } from "node:path";
|
|
@@ -22585,9 +22442,9 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
22585
22442
|
|
|
22586
22443
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22587
22444
|
function useGeneration(input) {
|
|
22588
|
-
const [state2, setState] =
|
|
22445
|
+
const [state2, setState] = useState18();
|
|
22589
22446
|
const current = useRef11();
|
|
22590
|
-
|
|
22447
|
+
useEffect16(() => {
|
|
22591
22448
|
current.current = input;
|
|
22592
22449
|
if (!input) {
|
|
22593
22450
|
setState(void 0);
|
|
@@ -22623,7 +22480,7 @@ function useGeneration(input) {
|
|
|
22623
22480
|
}
|
|
22624
22481
|
|
|
22625
22482
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
22626
|
-
import { join as
|
|
22483
|
+
import { join as join21 } from "node:path";
|
|
22627
22484
|
function buildFlowStart(input) {
|
|
22628
22485
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
22629
22486
|
const credentials = extraction.credentials ?? {
|
|
@@ -22636,7 +22493,7 @@ function buildFlowStart(input) {
|
|
|
22636
22493
|
handoff,
|
|
22637
22494
|
agent: extraction.agent,
|
|
22638
22495
|
projectPath: extraction.projectPath,
|
|
22639
|
-
outDir: extraction.projectPath ?
|
|
22496
|
+
outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
|
|
22640
22497
|
rawTokensPath: extraction.rawTokensPath,
|
|
22641
22498
|
credentials: {
|
|
22642
22499
|
spaceId: credentials.spaceId,
|
|
@@ -23162,7 +23019,7 @@ function PreviewValidationErrorScreen({
|
|
|
23162
23019
|
}
|
|
23163
23020
|
|
|
23164
23021
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
23165
|
-
import { useCallback as useCallback5, useEffect as
|
|
23022
|
+
import { useCallback as useCallback5, useEffect as useEffect24, useMemo as useMemo6, useRef as useRef17, useState as useState26 } from "react";
|
|
23166
23023
|
import figures8 from "figures";
|
|
23167
23024
|
|
|
23168
23025
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
|
|
@@ -23423,7 +23280,7 @@ function enumerateCycleBreaks(cycle, components) {
|
|
|
23423
23280
|
import { Box as Box32, Text as Text34 } from "ink";
|
|
23424
23281
|
|
|
23425
23282
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
23426
|
-
import React13, { useEffect as
|
|
23283
|
+
import React13, { useEffect as useEffect17, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
23427
23284
|
import figures6 from "figures";
|
|
23428
23285
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
23429
23286
|
|
|
@@ -24131,11 +23988,11 @@ function FieldEditor({
|
|
|
24131
23988
|
headerHeight = 2
|
|
24132
23989
|
}) {
|
|
24133
23990
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
24134
|
-
const [editorState, setEditorState] =
|
|
24135
|
-
const [parseErr] =
|
|
24136
|
-
const [listScrollStart, setListScrollStart] =
|
|
23991
|
+
const [editorState, setEditorState] = useState19(initialState);
|
|
23992
|
+
const [parseErr] = useState19(parseError);
|
|
23993
|
+
const [listScrollStart, setListScrollStart] = useState19(0);
|
|
24137
23994
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
24138
|
-
const [rowHeights, setRowHeights] =
|
|
23995
|
+
const [rowHeights, setRowHeights] = useState19({});
|
|
24139
23996
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
24140
23997
|
const initialFocus = (() => {
|
|
24141
23998
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -24203,25 +24060,25 @@ function FieldEditor({
|
|
|
24203
24060
|
textCursor: 0
|
|
24204
24061
|
};
|
|
24205
24062
|
})();
|
|
24206
|
-
const [focusLevel, setFocusLevel] =
|
|
24207
|
-
const [propIdx, setPropIdx] =
|
|
24208
|
-
const [slotIdx, setSlotIdx] =
|
|
24209
|
-
const [inSlots, setInSlots] =
|
|
24210
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
24211
|
-
const [activeField, setActiveField] =
|
|
24212
|
-
const [editingField, setEditingField] =
|
|
24213
|
-
const [textCursor, setTextCursor] =
|
|
24214
|
-
const [valueCursor, setValueCursor] =
|
|
24215
|
-
const [editingValue, setEditingValue] =
|
|
24216
|
-
const [valueText, setValueText] =
|
|
24217
|
-
const [pickerCursor, setPickerCursor] =
|
|
24218
|
-
const [validationError, setValidationError] =
|
|
24219
|
-
const [cursorVisible] =
|
|
24220
|
-
const [sourceOpen, setSourceOpen] =
|
|
24221
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
24222
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
24223
|
-
const [showHelp, setShowHelp] =
|
|
24224
|
-
const [pendingDelete, setPendingDelete] =
|
|
24063
|
+
const [focusLevel, setFocusLevel] = useState19(initialFocus.focusLevel);
|
|
24064
|
+
const [propIdx, setPropIdx] = useState19(initialFocus.propIdx);
|
|
24065
|
+
const [slotIdx, setSlotIdx] = useState19(initialFocus.slotIdx);
|
|
24066
|
+
const [inSlots, setInSlots] = useState19(initialFocus.inSlots);
|
|
24067
|
+
const [inComponentDesc, setInComponentDesc] = useState19(initialFocus.focusLevel === "componentDescription");
|
|
24068
|
+
const [activeField, setActiveField] = useState19(initialFocus.activeField);
|
|
24069
|
+
const [editingField, setEditingField] = useState19(false);
|
|
24070
|
+
const [textCursor, setTextCursor] = useState19(initialFocus.textCursor);
|
|
24071
|
+
const [valueCursor, setValueCursor] = useState19(0);
|
|
24072
|
+
const [editingValue, setEditingValue] = useState19(null);
|
|
24073
|
+
const [valueText, setValueText] = useState19("");
|
|
24074
|
+
const [pickerCursor, setPickerCursor] = useState19(0);
|
|
24075
|
+
const [validationError, setValidationError] = useState19(null);
|
|
24076
|
+
const [cursorVisible] = useState19(true);
|
|
24077
|
+
const [sourceOpen, setSourceOpen] = useState19(false);
|
|
24078
|
+
const [rationaleOpen, setRationaleOpen] = useState19(false);
|
|
24079
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
|
|
24080
|
+
const [showHelp, setShowHelp] = useState19(false);
|
|
24081
|
+
const [pendingDelete, setPendingDelete] = useState19(null);
|
|
24225
24082
|
const props = editorState.props;
|
|
24226
24083
|
const slots = editorState.slots;
|
|
24227
24084
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -24981,7 +24838,7 @@ function FieldEditor({
|
|
|
24981
24838
|
}
|
|
24982
24839
|
return Math.max(start + 1, end2);
|
|
24983
24840
|
};
|
|
24984
|
-
|
|
24841
|
+
useEffect17(() => {
|
|
24985
24842
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
24986
24843
|
setListScrollStart((previous) => {
|
|
24987
24844
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -26053,7 +25910,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
26053
25910
|
}
|
|
26054
25911
|
|
|
26055
25912
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
26056
|
-
import { useCallback as useCallback2, useEffect as
|
|
25913
|
+
import { useCallback as useCallback2, useEffect as useEffect19, useRef as useRef13, useState as useState21 } from "react";
|
|
26057
25914
|
|
|
26058
25915
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
|
|
26059
25916
|
var DEFAULT_MAX_DEPTH = 50;
|
|
@@ -26109,7 +25966,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
|
|
|
26109
25966
|
}
|
|
26110
25967
|
|
|
26111
25968
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
26112
|
-
import { useEffect as
|
|
25969
|
+
import { useEffect as useEffect18, useRef as useRef12, useState as useState20 } from "react";
|
|
26113
25970
|
|
|
26114
25971
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
|
|
26115
25972
|
var TimeoutError = class extends Error {
|
|
@@ -26264,12 +26121,12 @@ function useReviewFinalizePreview({
|
|
|
26264
26121
|
}
|
|
26265
26122
|
function useFinalizePreview(opts) {
|
|
26266
26123
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
26267
|
-
const [status, setStatus] =
|
|
26268
|
-
const [removed, setRemoved] =
|
|
26269
|
-
const [scrollOffset, setScrollOffset] =
|
|
26124
|
+
const [status, setStatus] = useState20("idle");
|
|
26125
|
+
const [removed, setRemoved] = useState20([]);
|
|
26126
|
+
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
26270
26127
|
const generationRef = useRef12(0);
|
|
26271
26128
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
26272
|
-
|
|
26129
|
+
useEffect18(() => {
|
|
26273
26130
|
if (!open) {
|
|
26274
26131
|
setStatus("idle");
|
|
26275
26132
|
setRemoved([]);
|
|
@@ -26319,10 +26176,10 @@ function useReviewSession({
|
|
|
26319
26176
|
tokensPath,
|
|
26320
26177
|
onExtraLoaded
|
|
26321
26178
|
}) {
|
|
26322
|
-
const [components, setComponents] =
|
|
26323
|
-
const [loading, setLoading] =
|
|
26324
|
-
const [loadError, setLoadError] =
|
|
26325
|
-
const [availableTokens, setAvailableTokens] =
|
|
26179
|
+
const [components, setComponents] = useState21([]);
|
|
26180
|
+
const [loading, setLoading] = useState21(true);
|
|
26181
|
+
const [loadError, setLoadError] = useState21(null);
|
|
26182
|
+
const [availableTokens, setAvailableTokens] = useState21([]);
|
|
26326
26183
|
const loadInitialState = useCallback2(async () => {
|
|
26327
26184
|
const result = loadSession();
|
|
26328
26185
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -26332,7 +26189,7 @@ function useReviewSession({
|
|
|
26332
26189
|
}));
|
|
26333
26190
|
return { result, catalog };
|
|
26334
26191
|
}, [loadSession, tokensPath]);
|
|
26335
|
-
|
|
26192
|
+
useEffect19(() => {
|
|
26336
26193
|
let disposed = false;
|
|
26337
26194
|
void (async () => {
|
|
26338
26195
|
try {
|
|
@@ -26383,9 +26240,9 @@ function useReviewSession({
|
|
|
26383
26240
|
};
|
|
26384
26241
|
}
|
|
26385
26242
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
26386
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
26387
|
-
const [componentRationale, setComponentRationale] =
|
|
26388
|
-
|
|
26243
|
+
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
26244
|
+
const [componentRationale, setComponentRationale] = useState21(null);
|
|
26245
|
+
useEffect19(() => {
|
|
26389
26246
|
const current = components[selectedIdx];
|
|
26390
26247
|
if (!current) {
|
|
26391
26248
|
setReviewMetadata(null);
|
|
@@ -26423,7 +26280,7 @@ function useReviewHistory({
|
|
|
26423
26280
|
}) {
|
|
26424
26281
|
const historyRef = useRef13(null);
|
|
26425
26282
|
const historySeededRef = useRef13(false);
|
|
26426
|
-
|
|
26283
|
+
useEffect19(() => {
|
|
26427
26284
|
if (loading || historySeededRef.current) return;
|
|
26428
26285
|
historySeededRef.current = true;
|
|
26429
26286
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -26479,7 +26336,7 @@ function useReviewFinalize({
|
|
|
26479
26336
|
}
|
|
26480
26337
|
|
|
26481
26338
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
26482
|
-
import { useEffect as
|
|
26339
|
+
import { useEffect as useEffect20, useRef as useRef14, useState as useState22 } from "react";
|
|
26483
26340
|
|
|
26484
26341
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
|
|
26485
26342
|
function collectTokenSuggestions(entry, availableTokens = []) {
|
|
@@ -26518,21 +26375,21 @@ function useReviewEditor({
|
|
|
26518
26375
|
onEditSaved,
|
|
26519
26376
|
onTokenSaved
|
|
26520
26377
|
}) {
|
|
26521
|
-
const [panelOpen, setPanelOpen] =
|
|
26522
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
26523
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
26524
|
-
const [textEntryActive, setTextEntryActive] =
|
|
26525
|
-
const [showJson, setShowJson] =
|
|
26526
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
26527
|
-
const [draftValue, setDraftValue] =
|
|
26528
|
-
const [saveError, setSaveError] =
|
|
26529
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
26530
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
26531
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
26532
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
26378
|
+
const [panelOpen, setPanelOpen] = useState22("none");
|
|
26379
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState22(0);
|
|
26380
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState22(0);
|
|
26381
|
+
const [textEntryActive, setTextEntryActive] = useState22(false);
|
|
26382
|
+
const [showJson, setShowJson] = useState22(false);
|
|
26383
|
+
const [showHiddenProps, setShowHiddenProps] = useState22(false);
|
|
26384
|
+
const [draftValue, setDraftValue] = useState22("");
|
|
26385
|
+
const [saveError, setSaveError] = useState22(null);
|
|
26386
|
+
const [tokenReviewRow, setTokenReviewRow] = useState22(0);
|
|
26387
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
|
|
26388
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
|
|
26389
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
26533
26390
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
26534
26391
|
const pendingGRef = useRef14(false);
|
|
26535
|
-
|
|
26392
|
+
useEffect20(() => {
|
|
26536
26393
|
setTokenReviewRow(0);
|
|
26537
26394
|
setTokenReviewEditing(false);
|
|
26538
26395
|
setTokenReviewEditCursor(0);
|
|
@@ -26645,12 +26502,12 @@ function useReviewEditor({
|
|
|
26645
26502
|
}
|
|
26646
26503
|
|
|
26647
26504
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
26648
|
-
import { useState as
|
|
26505
|
+
import { useState as useState23 } from "react";
|
|
26649
26506
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
26650
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
26651
|
-
const [showFinalize, setShowFinalize] =
|
|
26652
|
-
const [showQuit, setShowQuit] =
|
|
26653
|
-
const [finalizeError, setFinalizeError] =
|
|
26507
|
+
const [sidebarFocused, setSidebarFocused] = useState23(true);
|
|
26508
|
+
const [showFinalize, setShowFinalize] = useState23(false);
|
|
26509
|
+
const [showQuit, setShowQuit] = useState23(false);
|
|
26510
|
+
const [finalizeError, setFinalizeError] = useState23(initialFinalizeError);
|
|
26654
26511
|
return {
|
|
26655
26512
|
sidebarFocused,
|
|
26656
26513
|
setSidebarFocused,
|
|
@@ -26944,7 +26801,7 @@ function handleJsonPanelInput(input, key, state2) {
|
|
|
26944
26801
|
}
|
|
26945
26802
|
|
|
26946
26803
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
26947
|
-
import { useCallback as useCallback4, useEffect as
|
|
26804
|
+
import { useCallback as useCallback4, useEffect as useEffect22, useState as useState25 } from "react";
|
|
26948
26805
|
|
|
26949
26806
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
|
|
26950
26807
|
function applyPreviewAnnotations(preview, localNames) {
|
|
@@ -26979,25 +26836,25 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26979
26836
|
}
|
|
26980
26837
|
|
|
26981
26838
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
26982
|
-
import { useCallback as useCallback3, useEffect as
|
|
26839
|
+
import { useCallback as useCallback3, useEffect as useEffect21, useRef as useRef15, useState as useState24 } from "react";
|
|
26983
26840
|
var DEFAULT_DEBOUNCE_MS = 500;
|
|
26984
26841
|
function useLivePreview(opts) {
|
|
26985
26842
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
26986
|
-
const [status, setStatus] =
|
|
26987
|
-
const [disabled, setDisabled] =
|
|
26843
|
+
const [status, setStatus] = useState24("idle");
|
|
26844
|
+
const [disabled, setDisabled] = useState24(false);
|
|
26988
26845
|
const timerRef = useRef15(null);
|
|
26989
26846
|
const generationRef = useRef15(0);
|
|
26990
26847
|
const latestRef = useRef15(0);
|
|
26991
26848
|
const inflightRef = useRef15(0);
|
|
26992
26849
|
const optsRef = useRef15(opts);
|
|
26993
|
-
|
|
26850
|
+
useEffect21(() => {
|
|
26994
26851
|
optsRef.current = opts;
|
|
26995
26852
|
});
|
|
26996
26853
|
const disabledRef = useRef15(disabled);
|
|
26997
|
-
|
|
26854
|
+
useEffect21(() => {
|
|
26998
26855
|
disabledRef.current = disabled;
|
|
26999
26856
|
}, [disabled]);
|
|
27000
|
-
|
|
26857
|
+
useEffect21(() => {
|
|
27001
26858
|
return () => {
|
|
27002
26859
|
if (timerRef.current) {
|
|
27003
26860
|
clearTimeout(timerRef.current);
|
|
@@ -27083,8 +26940,8 @@ function useReviewPreview({
|
|
|
27083
26940
|
deleteAllComponents,
|
|
27084
26941
|
onResult
|
|
27085
26942
|
}) {
|
|
27086
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
27087
|
-
const [removedComponents, setRemovedComponents] =
|
|
26943
|
+
const [previewAnnotations, setPreviewAnnotations] = useState25(/* @__PURE__ */ new Map());
|
|
26944
|
+
const [removedComponents, setRemovedComponents] = useState25([]);
|
|
27088
26945
|
const handleResult = useCallback4(
|
|
27089
26946
|
(response) => {
|
|
27090
26947
|
if (!response) return;
|
|
@@ -27110,14 +26967,14 @@ function useReviewPreview({
|
|
|
27110
26967
|
onResult: handleResult,
|
|
27111
26968
|
deleteAllComponents
|
|
27112
26969
|
});
|
|
27113
|
-
const [spinnerTick, setSpinnerTick] =
|
|
27114
|
-
|
|
26970
|
+
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
26971
|
+
useEffect22(() => {
|
|
27115
26972
|
if (livePreviewHook.status !== "running") return;
|
|
27116
26973
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
27117
26974
|
return () => clearInterval(id);
|
|
27118
26975
|
}, [livePreviewHook.status]);
|
|
27119
26976
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
27120
|
-
|
|
26977
|
+
useEffect22(() => {
|
|
27121
26978
|
if (loading) return;
|
|
27122
26979
|
if (!livePreview) return;
|
|
27123
26980
|
if (components.length === 0) return;
|
|
@@ -27128,7 +26985,7 @@ function useReviewPreview({
|
|
|
27128
26985
|
|
|
27129
26986
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
27130
26987
|
init_debug_store();
|
|
27131
|
-
import { useEffect as
|
|
26988
|
+
import { useEffect as useEffect23, useRef as useRef16 } from "react";
|
|
27132
26989
|
|
|
27133
26990
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
|
|
27134
26991
|
var REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
|
|
@@ -27200,7 +27057,7 @@ function useReviewLog({
|
|
|
27200
27057
|
const started = useRef16(false);
|
|
27201
27058
|
const latest = useRef16(components);
|
|
27202
27059
|
latest.current = components;
|
|
27203
|
-
|
|
27060
|
+
useEffect23(() => {
|
|
27204
27061
|
if (loading || started.current) return;
|
|
27205
27062
|
started.current = true;
|
|
27206
27063
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -27215,7 +27072,7 @@ function useReviewLog({
|
|
|
27215
27072
|
trail.current = openReviewTrail(components, Date.now());
|
|
27216
27073
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
27217
27074
|
}, [loading, loadError, components]);
|
|
27218
|
-
|
|
27075
|
+
useEffect23(
|
|
27219
27076
|
() => () => {
|
|
27220
27077
|
const open = trail.current;
|
|
27221
27078
|
trail.current = void 0;
|
|
@@ -27492,7 +27349,7 @@ function GenerateReviewStepView({
|
|
|
27492
27349
|
initialFinalizeError = null
|
|
27493
27350
|
}) {
|
|
27494
27351
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
27495
|
-
const [slotCycles, setSlotCycles] =
|
|
27352
|
+
const [slotCycles, setSlotCycles] = useState26([]);
|
|
27496
27353
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
27497
27354
|
setSlotCycles(cycles ?? []);
|
|
27498
27355
|
}, []);
|
|
@@ -27525,7 +27382,7 @@ function GenerateReviewStepView({
|
|
|
27525
27382
|
onExtraLoaded: setLoadedSlotCycles
|
|
27526
27383
|
});
|
|
27527
27384
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
27528
|
-
const [nav, setNav] =
|
|
27385
|
+
const [nav, setNav] = useState26({
|
|
27529
27386
|
cursorRowIdx: 0,
|
|
27530
27387
|
sidebarScrollOffset: 0
|
|
27531
27388
|
});
|
|
@@ -27541,10 +27398,10 @@ function GenerateReviewStepView({
|
|
|
27541
27398
|
finalizeError,
|
|
27542
27399
|
setFinalizeError
|
|
27543
27400
|
} = reviewSurface;
|
|
27544
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
27401
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
27545
27402
|
const removedBannerDefaultedRef = useRef17(false);
|
|
27546
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
27547
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
27403
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
27404
|
+
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
27548
27405
|
const cyclePanel = useOverlayPanel({
|
|
27549
27406
|
toggleKey: "c",
|
|
27550
27407
|
onClose: () => {
|
|
@@ -27559,9 +27416,9 @@ function GenerateReviewStepView({
|
|
|
27559
27416
|
setBreakConfirm(false);
|
|
27560
27417
|
}
|
|
27561
27418
|
});
|
|
27562
|
-
const [breakCursor, setBreakCursor] =
|
|
27563
|
-
const [breakConfirm, setBreakConfirm] =
|
|
27564
|
-
const [expandedGroups, setExpandedGroups] =
|
|
27419
|
+
const [breakCursor, setBreakCursor] = useState26(0);
|
|
27420
|
+
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
27421
|
+
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
27565
27422
|
const seededGroupsRef = useRef17(false);
|
|
27566
27423
|
const {
|
|
27567
27424
|
searchOpen,
|
|
@@ -27580,14 +27437,14 @@ function GenerateReviewStepView({
|
|
|
27580
27437
|
setShowHelp
|
|
27581
27438
|
} = useSidebarSearchState();
|
|
27582
27439
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
27583
|
-
const [breakingChanges, setBreakingChanges] =
|
|
27584
|
-
const [breakingCursor, setBreakingCursor] =
|
|
27585
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
27586
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
27587
|
-
const [autoRejected, setAutoRejected] =
|
|
27588
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
27440
|
+
const [breakingChanges, setBreakingChanges] = useState26([]);
|
|
27441
|
+
const [breakingCursor, setBreakingCursor] = useState26(0);
|
|
27442
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState26(false);
|
|
27443
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
27444
|
+
const [autoRejected, setAutoRejected] = useState26([]);
|
|
27445
|
+
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
27589
27446
|
const autoRejectFiredRef = useRef17(false);
|
|
27590
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
27447
|
+
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
27591
27448
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
27592
27449
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
27593
27450
|
components,
|
|
@@ -27652,7 +27509,7 @@ function GenerateReviewStepView({
|
|
|
27652
27509
|
[components]
|
|
27653
27510
|
);
|
|
27654
27511
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
27655
|
-
|
|
27512
|
+
useEffect24(() => {
|
|
27656
27513
|
if (seededGroupsRef.current) return;
|
|
27657
27514
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
27658
27515
|
seededGroupsRef.current = true;
|
|
@@ -27679,7 +27536,7 @@ function GenerateReviewStepView({
|
|
|
27679
27536
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
27680
27537
|
}));
|
|
27681
27538
|
}, [slotCycles, cycleView]);
|
|
27682
|
-
|
|
27539
|
+
useEffect24(() => {
|
|
27683
27540
|
const decision = computeAutoRejectDecision({
|
|
27684
27541
|
loading,
|
|
27685
27542
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -27724,7 +27581,7 @@ function GenerateReviewStepView({
|
|
|
27724
27581
|
onAction: reviewLog.record
|
|
27725
27582
|
});
|
|
27726
27583
|
const autoRejectPushedRef = useRef17(false);
|
|
27727
|
-
|
|
27584
|
+
useEffect24(() => {
|
|
27728
27585
|
if (loading) return;
|
|
27729
27586
|
if (!historySeededRef.current) return;
|
|
27730
27587
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -27808,7 +27665,7 @@ function GenerateReviewStepView({
|
|
|
27808
27665
|
const panelHeight = leftPanelHeight + 2;
|
|
27809
27666
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
27810
27667
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
27811
|
-
|
|
27668
|
+
useEffect24(() => {
|
|
27812
27669
|
if (selectableRowPositions.length === 0) return;
|
|
27813
27670
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
27814
27671
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -28729,10 +28586,10 @@ function DoneStep({
|
|
|
28729
28586
|
}
|
|
28730
28587
|
|
|
28731
28588
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
28732
|
-
import { useState as
|
|
28589
|
+
import { useState as useState28 } from "react";
|
|
28733
28590
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
28734
28591
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
28735
|
-
import { dirname as
|
|
28592
|
+
import { dirname as dirname17, basename as basename6, join as join22 } from "node:path";
|
|
28736
28593
|
|
|
28737
28594
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
28738
28595
|
import { resolve as resolve26 } from "node:path";
|
|
@@ -28753,10 +28610,10 @@ function normalizePath(input) {
|
|
|
28753
28610
|
}
|
|
28754
28611
|
|
|
28755
28612
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
28756
|
-
import { useEffect as
|
|
28613
|
+
import { useEffect as useEffect25, useState as useState27 } from "react";
|
|
28757
28614
|
function useBlinkingCursor() {
|
|
28758
|
-
const [visible, setVisible] =
|
|
28759
|
-
|
|
28615
|
+
const [visible, setVisible] = useState27(true);
|
|
28616
|
+
useEffect25(() => {
|
|
28760
28617
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
28761
28618
|
return () => clearInterval(interval);
|
|
28762
28619
|
}, []);
|
|
@@ -28768,8 +28625,8 @@ import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
|
28768
28625
|
function autocomplete(partial) {
|
|
28769
28626
|
if (!partial) return null;
|
|
28770
28627
|
const normalized = normalizePath(partial);
|
|
28771
|
-
const dir =
|
|
28772
|
-
const base =
|
|
28628
|
+
const dir = dirname17(normalized);
|
|
28629
|
+
const base = basename6(normalized);
|
|
28773
28630
|
let entries;
|
|
28774
28631
|
try {
|
|
28775
28632
|
entries = readdirSync4(dir);
|
|
@@ -28778,13 +28635,13 @@ function autocomplete(partial) {
|
|
|
28778
28635
|
}
|
|
28779
28636
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
28780
28637
|
if (matches.length === 0) return null;
|
|
28781
|
-
if (matches.length === 1) return
|
|
28638
|
+
if (matches.length === 1) return join22(dir, matches[0]);
|
|
28782
28639
|
let prefix = matches[0];
|
|
28783
28640
|
for (const m of matches) {
|
|
28784
28641
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
28785
28642
|
if (!prefix) break;
|
|
28786
28643
|
}
|
|
28787
|
-
return prefix.length > base.length ?
|
|
28644
|
+
return prefix.length > base.length ? join22(dir, prefix) : null;
|
|
28788
28645
|
}
|
|
28789
28646
|
function PathPrompt({
|
|
28790
28647
|
defaultPath,
|
|
@@ -28793,7 +28650,7 @@ function PathPrompt({
|
|
|
28793
28650
|
label = "Save to",
|
|
28794
28651
|
summary
|
|
28795
28652
|
}) {
|
|
28796
|
-
const [input, setInput] =
|
|
28653
|
+
const [input, setInput] = useState28("");
|
|
28797
28654
|
const cursorVisible = useBlinkingCursor();
|
|
28798
28655
|
useImmediateInput((rawInput, key) => {
|
|
28799
28656
|
if (key.return) {
|
|
@@ -28872,12 +28729,12 @@ function countedThings({ components, tokens }, counts = {}) {
|
|
|
28872
28729
|
}
|
|
28873
28730
|
|
|
28874
28731
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
28875
|
-
import { useEffect as
|
|
28732
|
+
import { useEffect as useEffect26, useState as useState29 } from "react";
|
|
28876
28733
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
28877
28734
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
28878
28735
|
function useTimedSpinner() {
|
|
28879
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
28880
|
-
|
|
28736
|
+
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
28737
|
+
useEffect26(() => {
|
|
28881
28738
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
28882
28739
|
return () => {
|
|
28883
28740
|
clearInterval(timer);
|
|
@@ -28939,7 +28796,7 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28939
28796
|
}
|
|
28940
28797
|
|
|
28941
28798
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
28942
|
-
import { useEffect as
|
|
28799
|
+
import { useEffect as useEffect27, useState as useState30, useMemo as useMemo7 } from "react";
|
|
28943
28800
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
28944
28801
|
|
|
28945
28802
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
|
|
@@ -29318,8 +29175,8 @@ function WizardPreviewStep({
|
|
|
29318
29175
|
onQuit
|
|
29319
29176
|
}) {
|
|
29320
29177
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
29321
|
-
const [diffExpanded, setDiffExpanded] =
|
|
29322
|
-
const [scrollOffset, setScrollOffset] =
|
|
29178
|
+
const [diffExpanded, setDiffExpanded] = useState30(false);
|
|
29179
|
+
const [scrollOffset, setScrollOffset] = useState30(0);
|
|
29323
29180
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
29324
29181
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
29325
29182
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -29334,7 +29191,7 @@ function WizardPreviewStep({
|
|
|
29334
29191
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
29335
29192
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
29336
29193
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
29337
|
-
|
|
29194
|
+
useEffect27(() => {
|
|
29338
29195
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
29339
29196
|
}, [maxScroll]);
|
|
29340
29197
|
useImmediateInput((input, key) => {
|
|
@@ -29426,7 +29283,7 @@ function buildRunTeaserLine(runId) {
|
|
|
29426
29283
|
|
|
29427
29284
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
29428
29285
|
init_debug_store();
|
|
29429
|
-
import { useEffect as
|
|
29286
|
+
import { useEffect as useEffect28, useRef as useRef18 } from "react";
|
|
29430
29287
|
|
|
29431
29288
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
29432
29289
|
var FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
@@ -29581,7 +29438,7 @@ function flowFinish(trail, final, now) {
|
|
|
29581
29438
|
function useFlowLog(state2) {
|
|
29582
29439
|
const trail = useRef18(void 0);
|
|
29583
29440
|
const previous = useRef18(void 0);
|
|
29584
|
-
|
|
29441
|
+
useEffect28(() => {
|
|
29585
29442
|
const before = previous.current;
|
|
29586
29443
|
previous.current = state2;
|
|
29587
29444
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -29604,7 +29461,7 @@ function useFlowLog(state2) {
|
|
|
29604
29461
|
trail.current = open;
|
|
29605
29462
|
setDebugRunProgress(flowProgress(open, now));
|
|
29606
29463
|
}, [state2]);
|
|
29607
|
-
|
|
29464
|
+
useEffect28(
|
|
29608
29465
|
() => () => {
|
|
29609
29466
|
const open = trail.current;
|
|
29610
29467
|
trail.current = void 0;
|
|
@@ -29743,13 +29600,13 @@ function FlowScreen({
|
|
|
29743
29600
|
}
|
|
29744
29601
|
|
|
29745
29602
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
29746
|
-
import { useEffect as
|
|
29603
|
+
import { useEffect as useEffect29, useRef as useRef19, useSyncExternalStore } from "react";
|
|
29747
29604
|
|
|
29748
29605
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
29749
29606
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
29750
29607
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
29751
29608
|
import { tmpdir } from "node:os";
|
|
29752
|
-
import { join as
|
|
29609
|
+
import { join as join24, resolve as resolve27 } from "node:path";
|
|
29753
29610
|
|
|
29754
29611
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
29755
29612
|
function shouldBypassPreview(state2) {
|
|
@@ -30098,8 +29955,8 @@ function pushFailure(e, deps) {
|
|
|
30098
29955
|
}
|
|
30099
29956
|
|
|
30100
29957
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
30101
|
-
import { writeFile as
|
|
30102
|
-
import { join as
|
|
29958
|
+
import { writeFile as writeFile8 } from "node:fs/promises";
|
|
29959
|
+
import { join as join23 } from "node:path";
|
|
30103
29960
|
|
|
30104
29961
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
|
|
30105
29962
|
function nextStateAfterPrint(opts) {
|
|
@@ -30123,7 +29980,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
30123
29980
|
var realSaveDeps = () => ({
|
|
30124
29981
|
openDb: openPipelineDb,
|
|
30125
29982
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
30126
|
-
writeFile: (path5, contents) =>
|
|
29983
|
+
writeFile: (path5, contents) => writeFile8(path5, contents),
|
|
30127
29984
|
appendRun,
|
|
30128
29985
|
buildSourceFingerprint,
|
|
30129
29986
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -30131,7 +29988,7 @@ var realSaveDeps = () => ({
|
|
|
30131
29988
|
});
|
|
30132
29989
|
async function runPrintFiles(input, deps, onPatch) {
|
|
30133
29990
|
onPatch({ step: "printing" });
|
|
30134
|
-
const componentsPath =
|
|
29991
|
+
const componentsPath = join23(input.outDir, "components.json");
|
|
30135
29992
|
try {
|
|
30136
29993
|
const db = deps.openDb();
|
|
30137
29994
|
let components = [];
|
|
@@ -30216,7 +30073,7 @@ var EMPTY_PUSH_RESULT = {
|
|
|
30216
30073
|
};
|
|
30217
30074
|
|
|
30218
30075
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
30219
|
-
var WIZARD_LOG =
|
|
30076
|
+
var WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
|
|
30220
30077
|
function appendWizardLog(entry) {
|
|
30221
30078
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
30222
30079
|
}
|
|
@@ -30509,14 +30366,14 @@ function useFlow(start, options = {}) {
|
|
|
30509
30366
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
30510
30367
|
() => current?.getState()
|
|
30511
30368
|
);
|
|
30512
|
-
|
|
30369
|
+
useEffect29(() => {
|
|
30513
30370
|
if (!start) controller.current = void 0;
|
|
30514
30371
|
}, [start]);
|
|
30515
30372
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
30516
30373
|
}
|
|
30517
30374
|
|
|
30518
30375
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
30519
|
-
import { useEffect as
|
|
30376
|
+
import { useEffect as useEffect30, useState as useState31 } from "react";
|
|
30520
30377
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
30521
30378
|
init_debug_store();
|
|
30522
30379
|
|
|
@@ -30527,7 +30384,7 @@ init_debug_mode_store();
|
|
|
30527
30384
|
init_version();
|
|
30528
30385
|
|
|
30529
30386
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
30530
|
-
import { join as
|
|
30387
|
+
import { join as join25, resolve as resolve28 } from "node:path";
|
|
30531
30388
|
function describeFileLocations({
|
|
30532
30389
|
contentfulBaseDir,
|
|
30533
30390
|
debugModeEnabled,
|
|
@@ -30536,14 +30393,14 @@ function describeFileLocations({
|
|
|
30536
30393
|
if (!debugModeEnabled) {
|
|
30537
30394
|
return {
|
|
30538
30395
|
debugLogs: "none while Debug Mode is off",
|
|
30539
|
-
importFiles: `${
|
|
30396
|
+
importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
30540
30397
|
};
|
|
30541
30398
|
}
|
|
30542
30399
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
30543
|
-
const session = currentSessionDir2 ??
|
|
30400
|
+
const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
|
|
30544
30401
|
return {
|
|
30545
|
-
debugLogs:
|
|
30546
|
-
importFiles: `${
|
|
30402
|
+
debugLogs: join25(session, "debug"),
|
|
30403
|
+
importFiles: `${join25(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
30547
30404
|
};
|
|
30548
30405
|
}
|
|
30549
30406
|
|
|
@@ -30589,8 +30446,8 @@ function Section({ title, rows }) {
|
|
|
30589
30446
|
] });
|
|
30590
30447
|
}
|
|
30591
30448
|
function HelpScreen({ onDone }) {
|
|
30592
|
-
const [info, setInfo] =
|
|
30593
|
-
|
|
30449
|
+
const [info, setInfo] = useState31();
|
|
30450
|
+
useEffect30(() => {
|
|
30594
30451
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
30595
30452
|
void readHelpInfo().then(setInfo);
|
|
30596
30453
|
}, []);
|
|
@@ -30628,14 +30485,14 @@ function HelpScreen({ onDone }) {
|
|
|
30628
30485
|
}
|
|
30629
30486
|
|
|
30630
30487
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
30631
|
-
import { useState as
|
|
30488
|
+
import { useState as useState32 } from "react";
|
|
30632
30489
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
30633
30490
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
30634
30491
|
function SettingsScreen({
|
|
30635
30492
|
onNavigate,
|
|
30636
30493
|
onBack
|
|
30637
30494
|
}) {
|
|
30638
|
-
const [focusIdx, setFocusIdx] =
|
|
30495
|
+
const [focusIdx, setFocusIdx] = useState32(0);
|
|
30639
30496
|
const items = [
|
|
30640
30497
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
30641
30498
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -30683,11 +30540,11 @@ function SettingsScreen({
|
|
|
30683
30540
|
}
|
|
30684
30541
|
|
|
30685
30542
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
30686
|
-
import { useState as
|
|
30543
|
+
import { useState as useState36 } from "react";
|
|
30687
30544
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
30688
30545
|
|
|
30689
30546
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
30690
|
-
import { useEffect as
|
|
30547
|
+
import { useEffect as useEffect32, useRef as useRef20, useState as useState34 } from "react";
|
|
30691
30548
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
30692
30549
|
init_debug_store();
|
|
30693
30550
|
|
|
@@ -30983,7 +30840,7 @@ async function writeAgentConfig(config) {
|
|
|
30983
30840
|
}
|
|
30984
30841
|
|
|
30985
30842
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30986
|
-
import { useEffect as
|
|
30843
|
+
import { useEffect as useEffect31, useState as useState33 } from "react";
|
|
30987
30844
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
30988
30845
|
|
|
30989
30846
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
@@ -31042,11 +30899,11 @@ function AgentDetail({
|
|
|
31042
30899
|
record: record3
|
|
31043
30900
|
}) {
|
|
31044
30901
|
const settings = config.agents[name];
|
|
31045
|
-
const [saving, setSaving] =
|
|
31046
|
-
const [testing, setTesting] =
|
|
31047
|
-
const [notice, setNotice] =
|
|
31048
|
-
const [checks, setChecks] =
|
|
31049
|
-
|
|
30902
|
+
const [saving, setSaving] = useState33(false);
|
|
30903
|
+
const [testing, setTesting] = useState33(false);
|
|
30904
|
+
const [notice, setNotice] = useState33(null);
|
|
30905
|
+
const [checks, setChecks] = useState33(void 0);
|
|
30906
|
+
useEffect31(() => {
|
|
31050
30907
|
let active = true;
|
|
31051
30908
|
setChecks(void 0);
|
|
31052
30909
|
const timer = setTimeout(() => {
|
|
@@ -31124,13 +30981,13 @@ import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-
|
|
|
31124
30981
|
var NAME_WIDTH = 16;
|
|
31125
30982
|
var PANEL_LABEL_WIDTH = "Command".length;
|
|
31126
30983
|
function AgentsScreen({ onDone }) {
|
|
31127
|
-
const [config, setConfig] =
|
|
31128
|
-
const [focus, setFocus] =
|
|
31129
|
-
const [open, setOpen] =
|
|
31130
|
-
const [notice, setNotice] =
|
|
31131
|
-
const [saving, setSaving] =
|
|
31132
|
-
const [loadError, setLoadError] =
|
|
31133
|
-
const [checks, setChecks] =
|
|
30984
|
+
const [config, setConfig] = useState34(null);
|
|
30985
|
+
const [focus, setFocus] = useState34(0);
|
|
30986
|
+
const [open, setOpen] = useState34(null);
|
|
30987
|
+
const [notice, setNotice] = useState34(null);
|
|
30988
|
+
const [saving, setSaving] = useState34(false);
|
|
30989
|
+
const [loadError, setLoadError] = useState34(null);
|
|
30990
|
+
const [checks, setChecks] = useState34({});
|
|
31134
30991
|
const visit = useRef20({
|
|
31135
30992
|
trail: createTrail(),
|
|
31136
30993
|
before: void 0,
|
|
@@ -31144,7 +31001,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31144
31001
|
);
|
|
31145
31002
|
}
|
|
31146
31003
|
};
|
|
31147
|
-
|
|
31004
|
+
useEffect32(() => {
|
|
31148
31005
|
readAgentConfig().then((loaded) => {
|
|
31149
31006
|
setConfig(loaded);
|
|
31150
31007
|
inspectAll(loaded);
|
|
@@ -31321,7 +31178,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31321
31178
|
}
|
|
31322
31179
|
|
|
31323
31180
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
31324
|
-
import { useEffect as
|
|
31181
|
+
import { useEffect as useEffect33, useRef as useRef21, useState as useState35 } from "react";
|
|
31325
31182
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
31326
31183
|
init_debug_store();
|
|
31327
31184
|
|
|
@@ -31375,10 +31232,10 @@ function debugFields(config) {
|
|
|
31375
31232
|
var snapshotOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31376
31233
|
var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31377
31234
|
function ProjectScreen({ onDone }) {
|
|
31378
|
-
const [config, setConfig] =
|
|
31379
|
-
const [saving, setSaving] =
|
|
31380
|
-
const [notice, setNotice] =
|
|
31381
|
-
const [loadError, setLoadError] =
|
|
31235
|
+
const [config, setConfig] = useState35(null);
|
|
31236
|
+
const [saving, setSaving] = useState35(false);
|
|
31237
|
+
const [notice, setNotice] = useState35(null);
|
|
31238
|
+
const [loadError, setLoadError] = useState35(null);
|
|
31382
31239
|
const visit = useRef21({
|
|
31383
31240
|
trail: createTrail(),
|
|
31384
31241
|
before: void 0,
|
|
@@ -31386,7 +31243,7 @@ function ProjectScreen({ onDone }) {
|
|
|
31386
31243
|
error: ""
|
|
31387
31244
|
}).current;
|
|
31388
31245
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
31389
|
-
|
|
31246
|
+
useEffect33(() => {
|
|
31390
31247
|
readCredentials().then((cfg) => {
|
|
31391
31248
|
setConfig(cfg);
|
|
31392
31249
|
visit.before = snapshotOf(cfg);
|
|
@@ -31494,8 +31351,8 @@ var SECTIONS = [
|
|
|
31494
31351
|
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
31495
31352
|
];
|
|
31496
31353
|
function ConfigurationScreen({ onDone }) {
|
|
31497
|
-
const [focus, setFocus] =
|
|
31498
|
-
const [open, setOpen] =
|
|
31354
|
+
const [focus, setFocus] = useState36(0);
|
|
31355
|
+
const [open, setOpen] = useState36(null);
|
|
31499
31356
|
const close = () => setOpen(null);
|
|
31500
31357
|
useInput17((input, key) => {
|
|
31501
31358
|
if (open) return;
|
|
@@ -31538,7 +31395,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
31538
31395
|
}
|
|
31539
31396
|
|
|
31540
31397
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
31541
|
-
import { useEffect as
|
|
31398
|
+
import { useEffect as useEffect34, useState as useState37 } from "react";
|
|
31542
31399
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
31543
31400
|
|
|
31544
31401
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
@@ -31560,9 +31417,9 @@ async function writeAnalyticsSetting(setting) {
|
|
|
31560
31417
|
init_debug_store();
|
|
31561
31418
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
31562
31419
|
function OptInAnalyticsScreen({ onDone }) {
|
|
31563
|
-
const [loading, setLoading] =
|
|
31564
|
-
const [enabled, setEnabled] =
|
|
31565
|
-
|
|
31420
|
+
const [loading, setLoading] = useState37(true);
|
|
31421
|
+
const [enabled, setEnabled] = useState37(true);
|
|
31422
|
+
useEffect34(() => {
|
|
31566
31423
|
readAnalyticsSetting().then((setting) => {
|
|
31567
31424
|
setEnabled(setting.enabled);
|
|
31568
31425
|
setLoading(false);
|
|
@@ -31616,7 +31473,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
31616
31473
|
}
|
|
31617
31474
|
|
|
31618
31475
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
31619
|
-
import { useEffect as
|
|
31476
|
+
import { useEffect as useEffect35, useRef as useRef22, useState as useState38 } from "react";
|
|
31620
31477
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
31621
31478
|
init_debug_mode_store();
|
|
31622
31479
|
init_debug_store();
|
|
@@ -31627,14 +31484,14 @@ var snapshotOf2 = (setting) => ({
|
|
|
31627
31484
|
retentionDays: String(setting.retentionDays)
|
|
31628
31485
|
});
|
|
31629
31486
|
function DebugModeScreen({ onDone }) {
|
|
31630
|
-
const [setting, setSetting] =
|
|
31631
|
-
const [focus, setFocus] =
|
|
31632
|
-
const [pending, setPending] =
|
|
31487
|
+
const [setting, setSetting] = useState38(null);
|
|
31488
|
+
const [focus, setFocus] = useState38("enabled");
|
|
31489
|
+
const [pending, setPending] = useState38(
|
|
31633
31490
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
31634
31491
|
);
|
|
31635
|
-
const [notice, setNotice] =
|
|
31492
|
+
const [notice, setNotice] = useState38(null);
|
|
31636
31493
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
31637
|
-
|
|
31494
|
+
useEffect35(() => {
|
|
31638
31495
|
readDebugModeSetting().then((loaded) => {
|
|
31639
31496
|
setSetting(loaded);
|
|
31640
31497
|
setPending(loaded.retentionDays);
|
|
@@ -31758,18 +31615,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
31758
31615
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
31759
31616
|
var TOKENS_ONLY_HIDDEN_STEPS = ["extraction", "scope-gate"];
|
|
31760
31617
|
function App({ importOptions, inkClear }) {
|
|
31761
|
-
const [screen, setScreen] =
|
|
31762
|
-
const [importExitCode, setImportExitCode] =
|
|
31618
|
+
const [screen, setScreen] = useState39("start");
|
|
31619
|
+
const [importExitCode, setImportExitCode] = useState39();
|
|
31763
31620
|
const showImportResult = importExitCode !== void 0;
|
|
31764
|
-
const [target, setTarget] =
|
|
31765
|
-
const [answers, setAnswers] =
|
|
31621
|
+
const [target, setTarget] = useState39();
|
|
31622
|
+
const [answers, setAnswers] = useState39({});
|
|
31766
31623
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
31767
|
-
const [extractionRun, setExtractionRun] =
|
|
31624
|
+
const [extractionRun, setExtractionRun] = useState39();
|
|
31768
31625
|
const extraction = useExtraction(extractionRun?.input);
|
|
31769
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
31626
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState39();
|
|
31770
31627
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
31771
|
-
const [tokenReview, setTokenReview] =
|
|
31772
|
-
const [scopeRun, setScopeRun] =
|
|
31628
|
+
const [tokenReview, setTokenReview] = useState39();
|
|
31629
|
+
const [scopeRun, setScopeRun] = useState39();
|
|
31773
31630
|
const scopeFlow = useScopeGateFlow(
|
|
31774
31631
|
scopeRun && {
|
|
31775
31632
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -31784,12 +31641,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31784
31641
|
}
|
|
31785
31642
|
}
|
|
31786
31643
|
);
|
|
31787
|
-
const [generationInput, setGenerationInput] =
|
|
31644
|
+
const [generationInput, setGenerationInput] = useState39();
|
|
31788
31645
|
const generation = useGeneration(generationInput);
|
|
31789
|
-
const [flowStart, setFlowStart] =
|
|
31646
|
+
const [flowStart, setFlowStart] = useState39();
|
|
31790
31647
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
31791
|
-
const [importDefaults, setImportDefaults] =
|
|
31792
|
-
|
|
31648
|
+
const [importDefaults, setImportDefaults] = useState39();
|
|
31649
|
+
useEffect36(() => {
|
|
31793
31650
|
if (screen !== "import") {
|
|
31794
31651
|
setImportDefaults(void 0);
|
|
31795
31652
|
return;
|
|
@@ -31862,7 +31719,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31862
31719
|
}
|
|
31863
31720
|
});
|
|
31864
31721
|
};
|
|
31865
|
-
|
|
31722
|
+
useEffect36(() => {
|
|
31866
31723
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
31867
31724
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
31868
31725
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -31884,12 +31741,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31884
31741
|
}
|
|
31885
31742
|
});
|
|
31886
31743
|
}, [tokensOnly, tokensOnlyRun]);
|
|
31887
|
-
|
|
31744
|
+
useEffect36(() => {
|
|
31888
31745
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
31889
31746
|
setExtractionRun(void 0);
|
|
31890
31747
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
31891
31748
|
}, [extraction, extractionRun]);
|
|
31892
|
-
|
|
31749
|
+
useEffect36(() => {
|
|
31893
31750
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
31894
31751
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31895
31752
|
setGenerationInput({
|
|
@@ -31907,7 +31764,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31907
31764
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
31908
31765
|
});
|
|
31909
31766
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
31910
|
-
|
|
31767
|
+
useEffect36(() => {
|
|
31911
31768
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
31912
31769
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31913
31770
|
inkClear();
|