@contentful/experience-design-system-cli 2.42.1-dev-build-9c1908dc.0 → 2.42.1-dev-build-c7f654e2.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 +599 -442
- package/dist/index.js +467 -292
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +3 -1
- package/dist/src/tui/import/shared/error-step/controls.d.ts +2 -0
- package/dist/src/tui/import/shared/error-step/logic.d.ts +2 -1
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +3 -0
- package/dist/src/tui/support-bundle.d.ts +25 -0
- package/dist/src/tui/zip.d.ts +7 -0
- package/package.json +3 -3
package/dist/app.js
CHANGED
|
@@ -198,6 +198,7 @@ __export(debug_store_exports, {
|
|
|
198
198
|
currentSessionDir: () => currentSessionDir,
|
|
199
199
|
finishDebugRun: () => finishDebugRun,
|
|
200
200
|
setDebugRunProgress: () => setDebugRunProgress,
|
|
201
|
+
settleDebugLogs: () => settleDebugLogs,
|
|
201
202
|
startDebugRun: () => startDebugRun,
|
|
202
203
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
203
204
|
startImportRun: () => startImportRun
|
|
@@ -302,7 +303,19 @@ function startDebugRun({
|
|
|
302
303
|
function setDebugRunProgress(outputs) {
|
|
303
304
|
if (pendingRun) pendingRun.progress = outputs;
|
|
304
305
|
}
|
|
305
|
-
|
|
306
|
+
function track(work) {
|
|
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({
|
|
306
319
|
outputs,
|
|
307
320
|
status,
|
|
308
321
|
exitMethod
|
|
@@ -385,7 +398,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
385
398
|
function handleCrash() {
|
|
386
399
|
return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
|
|
387
400
|
}
|
|
388
|
-
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
401
|
+
var pendingRun, sessionDir, unsettled, WAITING_LIMIT, waiting;
|
|
389
402
|
var init_debug_store = __esm({
|
|
390
403
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
391
404
|
"use strict";
|
|
@@ -415,6 +428,7 @@ var init_debug_store = __esm({
|
|
|
415
428
|
);
|
|
416
429
|
}
|
|
417
430
|
});
|
|
431
|
+
unsettled = /* @__PURE__ */ new Set();
|
|
418
432
|
WAITING_LIMIT = 50;
|
|
419
433
|
waiting = [];
|
|
420
434
|
process.once("uncaughtException", (err) => {
|
|
@@ -845,14 +859,14 @@ var init_parse_prompt_overrides = __esm({
|
|
|
845
859
|
});
|
|
846
860
|
|
|
847
861
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
|
|
848
|
-
import { readFile as
|
|
862
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
849
863
|
import { resolve as resolve3 } from "node:path";
|
|
850
864
|
async function resolvePromptOverride(override) {
|
|
851
865
|
if (override.kind === "text")
|
|
852
866
|
return override.value;
|
|
853
867
|
const abs = resolve3(override.value);
|
|
854
868
|
try {
|
|
855
|
-
return await
|
|
869
|
+
return await readFile3(abs, "utf8");
|
|
856
870
|
} catch {
|
|
857
871
|
throw new Error(`--prompt: could not read prompt file: ${abs}`);
|
|
858
872
|
}
|
|
@@ -1188,7 +1202,7 @@ var init_parse_map_token_prop_tool_calls = __esm({
|
|
|
1188
1202
|
});
|
|
1189
1203
|
|
|
1190
1204
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js
|
|
1191
|
-
import { spawn } from "node:child_process";
|
|
1205
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
1192
1206
|
function killProcessTree(pid, signal) {
|
|
1193
1207
|
try {
|
|
1194
1208
|
process.kill(-pid, signal);
|
|
@@ -1217,7 +1231,7 @@ async function runAgent(options) {
|
|
|
1217
1231
|
});
|
|
1218
1232
|
return new Promise((resolve29) => {
|
|
1219
1233
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
1220
|
-
const child =
|
|
1234
|
+
const child = spawn2(binary, args, {
|
|
1221
1235
|
stdio: ["pipe", "pipe", "pipe"],
|
|
1222
1236
|
detached: true,
|
|
1223
1237
|
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
@@ -1316,7 +1330,7 @@ var init_run_agent = __esm({
|
|
|
1316
1330
|
});
|
|
1317
1331
|
|
|
1318
1332
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/check-agent-auth.js
|
|
1319
|
-
import { spawn as
|
|
1333
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
1320
1334
|
async function checkAgentAuth(agent) {
|
|
1321
1335
|
const binary = resolveBinary(agent);
|
|
1322
1336
|
const binaryExists2 = await binaryIsOnPath(binary);
|
|
@@ -1325,7 +1339,7 @@ async function checkAgentAuth(agent) {
|
|
|
1325
1339
|
if (agent !== "claude")
|
|
1326
1340
|
return "ok";
|
|
1327
1341
|
return new Promise((resolve29) => {
|
|
1328
|
-
const child =
|
|
1342
|
+
const child = spawn3(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1329
1343
|
let stdout = "";
|
|
1330
1344
|
let done = false;
|
|
1331
1345
|
const timer = setTimeout(() => {
|
|
@@ -1362,7 +1376,7 @@ async function binaryIsOnPath(binary) {
|
|
|
1362
1376
|
return fs.access(binary).then(() => true, () => false);
|
|
1363
1377
|
}
|
|
1364
1378
|
return new Promise((resolve29) => {
|
|
1365
|
-
const child =
|
|
1379
|
+
const child = spawn3(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
1366
1380
|
child.on("close", (code) => resolve29(code === 0));
|
|
1367
1381
|
});
|
|
1368
1382
|
}
|
|
@@ -2144,19 +2158,19 @@ var init_skill_files = __esm({
|
|
|
2144
2158
|
|
|
2145
2159
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
|
|
2146
2160
|
import { existsSync as existsSync3 } from "node:fs";
|
|
2147
|
-
import { dirname as
|
|
2161
|
+
import { dirname as dirname6, join as join8, resolve as resolve4 } from "node:path";
|
|
2148
2162
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2149
2163
|
function resolveSkillPath(skill) {
|
|
2150
2164
|
if (!(skill in SKILL_FILES))
|
|
2151
2165
|
throw new Error(`Invalid skill: ${skill}`);
|
|
2152
|
-
const thisDir =
|
|
2166
|
+
const thisDir = dirname6(fileURLToPath2(import.meta.url));
|
|
2153
2167
|
let dir = thisDir;
|
|
2154
2168
|
for (; ; ) {
|
|
2155
|
-
const candidate =
|
|
2169
|
+
const candidate = join8(dir, "skills");
|
|
2156
2170
|
if (existsSync3(candidate)) {
|
|
2157
2171
|
const file = SKILL_FILES[skill];
|
|
2158
2172
|
const stepDir = file === "select-components.md" ? "selection" : "generation";
|
|
2159
|
-
return
|
|
2173
|
+
return join8(candidate, stepDir, file);
|
|
2160
2174
|
}
|
|
2161
2175
|
const parent = resolve4(dir, "..");
|
|
2162
2176
|
if (parent === dir) {
|
|
@@ -2173,20 +2187,20 @@ var init_resolve_skill_path = __esm({
|
|
|
2173
2187
|
});
|
|
2174
2188
|
|
|
2175
2189
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
|
|
2176
|
-
import { readFile as
|
|
2190
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
2177
2191
|
import { resolve as resolve5 } from "node:path";
|
|
2178
2192
|
async function readSkillFile(skill, override) {
|
|
2179
2193
|
if (override) {
|
|
2180
2194
|
const skillPath2 = resolve5(override);
|
|
2181
2195
|
try {
|
|
2182
|
-
return await
|
|
2196
|
+
return await readFile4(skillPath2, "utf8");
|
|
2183
2197
|
} catch {
|
|
2184
2198
|
throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
|
|
2185
2199
|
}
|
|
2186
2200
|
}
|
|
2187
2201
|
const skillPath = resolveSkillPath(skill);
|
|
2188
2202
|
try {
|
|
2189
|
-
return await
|
|
2203
|
+
return await readFile4(skillPath, "utf8");
|
|
2190
2204
|
} catch {
|
|
2191
2205
|
throw new Error(`skill file missing from package (expected at: ${skillPath})`);
|
|
2192
2206
|
}
|
|
@@ -2480,13 +2494,13 @@ __export(cache_keys_exports, {
|
|
|
2480
2494
|
hashPromptForSkill: () => hashPromptForSkill
|
|
2481
2495
|
});
|
|
2482
2496
|
import { createHash as createHash4 } from "node:crypto";
|
|
2483
|
-
import { readFile as
|
|
2497
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
2484
2498
|
import { resolve as resolve6 } from "node:path";
|
|
2485
2499
|
function hashContent(content) {
|
|
2486
2500
|
return createHash4("sha256").update(content).digest("hex");
|
|
2487
2501
|
}
|
|
2488
2502
|
async function hashFile(filePath) {
|
|
2489
|
-
const content = await
|
|
2503
|
+
const content = await readFile5(filePath, "utf8");
|
|
2490
2504
|
return hashContent(content);
|
|
2491
2505
|
}
|
|
2492
2506
|
async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
|
|
@@ -2502,7 +2516,7 @@ var init_cache_keys = __esm({
|
|
|
2502
2516
|
});
|
|
2503
2517
|
|
|
2504
2518
|
// packages/experience-design-system-cli/app.tsx
|
|
2505
|
-
import { useEffect as
|
|
2519
|
+
import { useEffect as useEffect37, useState as useState40 } from "react";
|
|
2506
2520
|
|
|
2507
2521
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
2508
2522
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -2710,7 +2724,7 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
2710
2724
|
}
|
|
2711
2725
|
|
|
2712
2726
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
2713
|
-
import { useEffect as
|
|
2727
|
+
import { useEffect as useEffect5, useRef, useState as useState5 } from "react";
|
|
2714
2728
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
2715
2729
|
init_debug_store();
|
|
2716
2730
|
|
|
@@ -2822,6 +2836,120 @@ function usePreflightControls(handlers) {
|
|
|
2822
2836
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2823
2837
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
2824
2838
|
|
|
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
|
+
|
|
2825
2953
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
|
|
2826
2954
|
import { useInput as useInput4 } from "ink";
|
|
2827
2955
|
|
|
@@ -2829,6 +2957,7 @@ import { useInput as useInput4 } from "ink";
|
|
|
2829
2957
|
function errorAction(input, key, available) {
|
|
2830
2958
|
if (key.return && available.canAcknowledge) return "acknowledge";
|
|
2831
2959
|
if (input === "r" && available.canRetry) return "retry";
|
|
2960
|
+
if (input === "o" && available.canOpen) return "open";
|
|
2832
2961
|
if (key.return || key.escape) return "exit";
|
|
2833
2962
|
return null;
|
|
2834
2963
|
}
|
|
@@ -2836,7 +2965,8 @@ function errorControls(available) {
|
|
|
2836
2965
|
return [
|
|
2837
2966
|
available.canAcknowledge ? { keys: "Enter", label: "Acknowledge and apply" } : { keys: "Enter", label: "Exit" },
|
|
2838
2967
|
...available.canAcknowledge ? [{ keys: "Esc", label: "Exit" }] : [],
|
|
2839
|
-
...available.canRetry ? [{ keys: "r", label: "Re-enter credentials" }] : []
|
|
2968
|
+
...available.canRetry ? [{ keys: "r", label: "Re-enter credentials" }] : [],
|
|
2969
|
+
...available.canOpen ? [{ keys: "o", label: "Show debug logs in file manager" }] : []
|
|
2840
2970
|
];
|
|
2841
2971
|
}
|
|
2842
2972
|
|
|
@@ -2845,14 +2975,32 @@ function useErrorControls(handlers) {
|
|
|
2845
2975
|
useInput4((input, key) => {
|
|
2846
2976
|
const action = errorAction(input, key, {
|
|
2847
2977
|
canRetry: handlers.onRetry !== void 0,
|
|
2848
|
-
canAcknowledge: handlers.onAcknowledge !== void 0
|
|
2978
|
+
canAcknowledge: handlers.onAcknowledge !== void 0,
|
|
2979
|
+
canOpen: handlers.onOpen !== void 0
|
|
2849
2980
|
});
|
|
2850
2981
|
if (action === "acknowledge") handlers.onAcknowledge?.();
|
|
2851
2982
|
else if (action === "retry") handlers.onRetry?.();
|
|
2983
|
+
else if (action === "open") handlers.onOpen?.();
|
|
2852
2984
|
else if (action === "exit") handlers.onExit();
|
|
2853
2985
|
});
|
|
2854
2986
|
}
|
|
2855
2987
|
|
|
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
|
+
|
|
2856
3004
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2857
3005
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2858
3006
|
function ErrorStep({
|
|
@@ -2862,10 +3010,18 @@ function ErrorStep({
|
|
|
2862
3010
|
onRetryCredentials,
|
|
2863
3011
|
onAcknowledgeBreakingChanges
|
|
2864
3012
|
}) {
|
|
2865
|
-
|
|
3013
|
+
const bundle = useSupportBundle();
|
|
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
|
+
});
|
|
2866
3021
|
const controls = errorControls({
|
|
2867
3022
|
canRetry: onRetryCredentials !== void 0,
|
|
2868
|
-
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
3023
|
+
canAcknowledge: onAcknowledgeBreakingChanges !== void 0,
|
|
3024
|
+
canOpen
|
|
2869
3025
|
});
|
|
2870
3026
|
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
2871
3027
|
/* @__PURE__ */ jsxs4(Text4, { bold: true, color: PALETTE.error, children: [
|
|
@@ -2874,6 +3030,7 @@ function ErrorStep({
|
|
|
2874
3030
|
" failed"
|
|
2875
3031
|
] }),
|
|
2876
3032
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
3033
|
+
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
2877
3034
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
2878
3035
|
"[",
|
|
2879
3036
|
control.keys,
|
|
@@ -3090,10 +3247,10 @@ var PROGRESS_THEME = extendTheme(defaultTheme, {
|
|
|
3090
3247
|
});
|
|
3091
3248
|
|
|
3092
3249
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
3093
|
-
import { useEffect as
|
|
3250
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
3094
3251
|
function useElapsed() {
|
|
3095
|
-
const [seconds2, setSeconds] =
|
|
3096
|
-
|
|
3252
|
+
const [seconds2, setSeconds] = useState4(0);
|
|
3253
|
+
useEffect4(() => {
|
|
3097
3254
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
3098
3255
|
return () => clearInterval(timer);
|
|
3099
3256
|
}, []);
|
|
@@ -3149,9 +3306,9 @@ function RunningStep({
|
|
|
3149
3306
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3150
3307
|
var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
|
|
3151
3308
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
3152
|
-
const [focus, setFocus] =
|
|
3309
|
+
const [focus, setFocus] = useState5(0);
|
|
3153
3310
|
const viewed = useRef([optionAt(0)]).current;
|
|
3154
|
-
|
|
3311
|
+
useEffect5(() => {
|
|
3155
3312
|
startDebugRun({
|
|
3156
3313
|
flow: "import/preflight",
|
|
3157
3314
|
step: "00-preflight",
|
|
@@ -3194,7 +3351,7 @@ function PreflightScreen({ onChoose, onQuit }) {
|
|
|
3194
3351
|
}
|
|
3195
3352
|
|
|
3196
3353
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3197
|
-
import { useEffect as
|
|
3354
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
3198
3355
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
3199
3356
|
init_debug_store();
|
|
3200
3357
|
|
|
@@ -3254,9 +3411,9 @@ function useWelcomeControls(onQuit) {
|
|
|
3254
3411
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3255
3412
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3256
3413
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
3257
|
-
const [projectPath, setProjectPath] =
|
|
3414
|
+
const [projectPath, setProjectPath] = useState6(initialPath);
|
|
3258
3415
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
3259
|
-
|
|
3416
|
+
useEffect6(() => {
|
|
3260
3417
|
startDebugRun({
|
|
3261
3418
|
flow: "import/welcome",
|
|
3262
3419
|
step: "01-welcome",
|
|
@@ -3311,7 +3468,7 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
3311
3468
|
}
|
|
3312
3469
|
|
|
3313
3470
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3314
|
-
import { useEffect as
|
|
3471
|
+
import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
|
|
3315
3472
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3316
3473
|
init_debug_store();
|
|
3317
3474
|
|
|
@@ -3387,10 +3544,10 @@ function TokenInputScreen({
|
|
|
3387
3544
|
onBack,
|
|
3388
3545
|
initialPath = ""
|
|
3389
3546
|
}) {
|
|
3390
|
-
const [tokenPath, setTokenPath] =
|
|
3391
|
-
const [failure, setFailure] =
|
|
3547
|
+
const [tokenPath, setTokenPath] = useState7(initialPath);
|
|
3548
|
+
const [failure, setFailure] = useState7(null);
|
|
3392
3549
|
const rejected = useRef4([]).current;
|
|
3393
|
-
|
|
3550
|
+
useEffect7(() => {
|
|
3394
3551
|
startDebugRun({
|
|
3395
3552
|
flow: "import/token-input",
|
|
3396
3553
|
step: "02-token-input",
|
|
@@ -3471,7 +3628,7 @@ function TokenInputScreen({
|
|
|
3471
3628
|
}
|
|
3472
3629
|
|
|
3473
3630
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
3474
|
-
import { useEffect as
|
|
3631
|
+
import { useEffect as useEffect8, useMemo, useState as useState8 } from "react";
|
|
3475
3632
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3476
3633
|
init_debug_store();
|
|
3477
3634
|
|
|
@@ -3589,19 +3746,19 @@ function usePathValidationControls(phase, handlers) {
|
|
|
3589
3746
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3590
3747
|
import { DatabaseSync } from "node:sqlite";
|
|
3591
3748
|
import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
3592
|
-
import { readFile as
|
|
3749
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
3593
3750
|
import { createHash as createHash5 } from "node:crypto";
|
|
3594
3751
|
|
|
3595
3752
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
3596
3753
|
import { homedir as homedir3 } from "node:os";
|
|
3597
|
-
import { dirname as
|
|
3754
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
3598
3755
|
function configRoot2() {
|
|
3599
|
-
return process.env["EDS_HOME"] ||
|
|
3756
|
+
return process.env["EDS_HOME"] || join7(homedir3(), ".contentful", "experience-design-system-cli");
|
|
3600
3757
|
}
|
|
3601
|
-
var runsFilePath = () =>
|
|
3758
|
+
var runsFilePath = () => join7(configRoot2(), "state", "runs.json");
|
|
3602
3759
|
|
|
3603
3760
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3604
|
-
import { dirname as
|
|
3761
|
+
import { dirname as dirname7, resolve as resolve7 } from "node:path";
|
|
3605
3762
|
|
|
3606
3763
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
|
|
3607
3764
|
var ELLIPSIS_MARKER = "/* \u2026 */";
|
|
@@ -4378,7 +4535,7 @@ function getPipelineDbPath() {
|
|
|
4378
4535
|
}
|
|
4379
4536
|
function openPipelineDb(dbPath) {
|
|
4380
4537
|
const path5 = dbPath ?? getPipelineDbPath();
|
|
4381
|
-
mkdirSync(
|
|
4538
|
+
mkdirSync(dirname7(path5), { recursive: true });
|
|
4382
4539
|
try {
|
|
4383
4540
|
const db = new DatabaseSync(path5);
|
|
4384
4541
|
db.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -5052,7 +5209,7 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
5052
5209
|
];
|
|
5053
5210
|
for (const candidate of candidates) {
|
|
5054
5211
|
try {
|
|
5055
|
-
await
|
|
5212
|
+
await readFile6(candidate, "utf8");
|
|
5056
5213
|
return candidate;
|
|
5057
5214
|
} catch {
|
|
5058
5215
|
}
|
|
@@ -5071,7 +5228,7 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
|
|
|
5071
5228
|
async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
|
|
5072
5229
|
const visited = /* @__PURE__ */ new Set([resolve7(sourcePath)]);
|
|
5073
5230
|
const discovered = [];
|
|
5074
|
-
let frontier = [{ text: sourceText, dir:
|
|
5231
|
+
let frontier = [{ text: sourceText, dir: dirname7(sourcePath) }];
|
|
5075
5232
|
for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
|
|
5076
5233
|
const nextFrontier = [];
|
|
5077
5234
|
for (const node of frontier) {
|
|
@@ -5086,12 +5243,12 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5086
5243
|
break;
|
|
5087
5244
|
let content;
|
|
5088
5245
|
try {
|
|
5089
|
-
content = await
|
|
5246
|
+
content = await readFile6(resolvedPath, "utf8");
|
|
5090
5247
|
} catch {
|
|
5091
5248
|
continue;
|
|
5092
5249
|
}
|
|
5093
5250
|
discovered.push({ path: resolvedPath, content });
|
|
5094
|
-
nextFrontier.push({ text: content, dir:
|
|
5251
|
+
nextFrontier.push({ text: content, dir: dirname7(resolvedPath) });
|
|
5095
5252
|
}
|
|
5096
5253
|
}
|
|
5097
5254
|
frontier = nextFrontier;
|
|
@@ -5125,7 +5282,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
5125
5282
|
let truncatedSiblingCount = 0;
|
|
5126
5283
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
5127
5284
|
try {
|
|
5128
|
-
const rawText = await
|
|
5285
|
+
const rawText = await readFile6(sourcePath, "utf8");
|
|
5129
5286
|
let siblingUsesNotShown;
|
|
5130
5287
|
let declaredTypeNames;
|
|
5131
5288
|
({
|
|
@@ -5887,7 +6044,7 @@ import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "t
|
|
|
5887
6044
|
|
|
5888
6045
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
5889
6046
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
5890
|
-
import { dirname as
|
|
6047
|
+
import { dirname as dirname8, join as join9, resolve as resolve8 } from "node:path";
|
|
5891
6048
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
5892
6049
|
import ts from "typescript";
|
|
5893
6050
|
var packageRootByFilePathCache = /* @__PURE__ */ new Map();
|
|
@@ -6087,16 +6244,16 @@ function findNearestTsConfigPath(filePath) {
|
|
|
6087
6244
|
if (nearestTsConfigPathCache.has(filePath)) {
|
|
6088
6245
|
return nearestTsConfigPathCache.get(filePath) ?? void 0;
|
|
6089
6246
|
}
|
|
6090
|
-
let currentDir =
|
|
6247
|
+
let currentDir = dirname8(filePath);
|
|
6091
6248
|
while (true) {
|
|
6092
6249
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
6093
|
-
const candidatePath =
|
|
6250
|
+
const candidatePath = join9(currentDir, candidateName);
|
|
6094
6251
|
if (existsSync4(candidatePath)) {
|
|
6095
6252
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
6096
6253
|
return candidatePath;
|
|
6097
6254
|
}
|
|
6098
6255
|
}
|
|
6099
|
-
const parentDir =
|
|
6256
|
+
const parentDir = dirname8(currentDir);
|
|
6100
6257
|
if (parentDir === currentDir) {
|
|
6101
6258
|
nearestTsConfigPathCache.set(filePath, null);
|
|
6102
6259
|
return void 0;
|
|
@@ -6113,13 +6270,13 @@ function getTsConfigPaths(tsConfigPath) {
|
|
|
6113
6270
|
tsConfigPathsCache.set(tsConfigPath, null);
|
|
6114
6271
|
return void 0;
|
|
6115
6272
|
}
|
|
6116
|
-
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys,
|
|
6273
|
+
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname8(tsConfigPath));
|
|
6117
6274
|
const paths = parsedConfig.options.paths;
|
|
6118
6275
|
if (!paths || Object.keys(paths).length === 0) {
|
|
6119
6276
|
tsConfigPathsCache.set(tsConfigPath, null);
|
|
6120
6277
|
return void 0;
|
|
6121
6278
|
}
|
|
6122
|
-
const baseUrl = parsedConfig.options.baseUrl ??
|
|
6279
|
+
const baseUrl = parsedConfig.options.baseUrl ?? dirname8(tsConfigPath);
|
|
6123
6280
|
const result = { baseUrl, paths };
|
|
6124
6281
|
tsConfigPathsCache.set(tsConfigPath, result);
|
|
6125
6282
|
return result;
|
|
@@ -6147,10 +6304,10 @@ function resolveImportSourcePath(basePath) {
|
|
|
6147
6304
|
`${basePath}.tsx`,
|
|
6148
6305
|
`${basePath}.js`,
|
|
6149
6306
|
`${basePath}.jsx`,
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6307
|
+
join9(basePath, "index.ts"),
|
|
6308
|
+
join9(basePath, "index.tsx"),
|
|
6309
|
+
join9(basePath, "index.js"),
|
|
6310
|
+
join9(basePath, "index.jsx")
|
|
6154
6311
|
];
|
|
6155
6312
|
return candidates.find((candidatePath) => existsSync4(candidatePath));
|
|
6156
6313
|
}
|
|
@@ -6161,10 +6318,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
6161
6318
|
`${resolvedPath}.tsx`,
|
|
6162
6319
|
`${resolvedPath}.js`,
|
|
6163
6320
|
`${resolvedPath}.jsx`,
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6321
|
+
join9(resolvedPath, "index.ts"),
|
|
6322
|
+
join9(resolvedPath, "index.tsx"),
|
|
6323
|
+
join9(resolvedPath, "index.js"),
|
|
6324
|
+
join9(resolvedPath, "index.jsx")
|
|
6168
6325
|
];
|
|
6169
6326
|
for (const candidatePath of candidatePaths) {
|
|
6170
6327
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -6185,10 +6342,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6185
6342
|
if (!packageRootDir)
|
|
6186
6343
|
return void 0;
|
|
6187
6344
|
const preferredEntryPaths = [
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6345
|
+
join9(packageRootDir, "src/index.ts"),
|
|
6346
|
+
join9(packageRootDir, "src/index.tsx"),
|
|
6347
|
+
join9(packageRootDir, "index.ts"),
|
|
6348
|
+
join9(packageRootDir, "index.tsx")
|
|
6192
6349
|
];
|
|
6193
6350
|
for (const entryPath of preferredEntryPaths) {
|
|
6194
6351
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -6196,7 +6353,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6196
6353
|
return entrySourceFile;
|
|
6197
6354
|
}
|
|
6198
6355
|
}
|
|
6199
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
6356
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join9(packageRootDir, "src"));
|
|
6200
6357
|
}
|
|
6201
6358
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
6202
6359
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -6205,7 +6362,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
6205
6362
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
6206
6363
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
6207
6364
|
}
|
|
6208
|
-
const packageJsonPath =
|
|
6365
|
+
const packageJsonPath = join9(packageRootDir, "package.json");
|
|
6209
6366
|
try {
|
|
6210
6367
|
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
|
|
6211
6368
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -6220,13 +6377,13 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6220
6377
|
if (packageRootByFilePathCache.has(filePath)) {
|
|
6221
6378
|
return packageRootByFilePathCache.get(filePath) ?? void 0;
|
|
6222
6379
|
}
|
|
6223
|
-
let currentDir =
|
|
6380
|
+
let currentDir = dirname8(filePath);
|
|
6224
6381
|
while (true) {
|
|
6225
|
-
if (existsSync4(
|
|
6382
|
+
if (existsSync4(join9(currentDir, "package.json"))) {
|
|
6226
6383
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
6227
6384
|
return currentDir;
|
|
6228
6385
|
}
|
|
6229
|
-
const parentDir =
|
|
6386
|
+
const parentDir = dirname8(currentDir);
|
|
6230
6387
|
if (parentDir === currentDir) {
|
|
6231
6388
|
packageRootByFilePathCache.set(filePath, null);
|
|
6232
6389
|
return void 0;
|
|
@@ -6236,7 +6393,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6236
6393
|
}
|
|
6237
6394
|
|
|
6238
6395
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
|
|
6239
|
-
import { readFile as
|
|
6396
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
6240
6397
|
async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
|
|
6241
6398
|
const warnings = [];
|
|
6242
6399
|
const items = [];
|
|
@@ -6248,7 +6405,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
|
|
|
6248
6405
|
if (!filePath)
|
|
6249
6406
|
break;
|
|
6250
6407
|
try {
|
|
6251
|
-
const source = await
|
|
6408
|
+
const source = await readFile7(filePath, "utf-8");
|
|
6252
6409
|
const outcome = await extractFile(filePath, source);
|
|
6253
6410
|
warnings.push(...outcome.warnings ?? []);
|
|
6254
6411
|
if (outcome.item)
|
|
@@ -9223,27 +9380,27 @@ function extractVueSlotsFromSetup(options) {
|
|
|
9223
9380
|
|
|
9224
9381
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
9225
9382
|
import os from "node:os";
|
|
9226
|
-
import { basename, dirname as
|
|
9227
|
-
import { readFile as
|
|
9383
|
+
import { basename as basename2, dirname as dirname10, resolve as resolve10, join as join11 } from "node:path";
|
|
9384
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
9228
9385
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
9229
9386
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
9230
9387
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
9231
9388
|
|
|
9232
9389
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
|
|
9233
9390
|
import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
|
|
9234
|
-
import { dirname as
|
|
9391
|
+
import { dirname as dirname9, join as join10, resolve as resolve9 } from "node:path";
|
|
9235
9392
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
9236
|
-
const basePath = resolve9(
|
|
9393
|
+
const basePath = resolve9(dirname9(importingFilePath), specifier);
|
|
9237
9394
|
const candidates = [
|
|
9238
9395
|
basePath,
|
|
9239
9396
|
`${basePath}.js`,
|
|
9240
9397
|
`${basePath}.ts`,
|
|
9241
9398
|
`${basePath}.mjs`,
|
|
9242
9399
|
`${basePath}.cjs`,
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9400
|
+
join10(basePath, "index.js"),
|
|
9401
|
+
join10(basePath, "index.ts"),
|
|
9402
|
+
join10(basePath, "index.mjs"),
|
|
9403
|
+
join10(basePath, "index.cjs")
|
|
9247
9404
|
];
|
|
9248
9405
|
for (const candidate of candidates) {
|
|
9249
9406
|
if (existsSync5(candidate) && statSync2(candidate).isFile())
|
|
@@ -9318,11 +9475,11 @@ async function extractFromVueSFC(filePath, source) {
|
|
|
9318
9475
|
};
|
|
9319
9476
|
}
|
|
9320
9477
|
function getVueComponentName(filePath) {
|
|
9321
|
-
const fileName =
|
|
9478
|
+
const fileName = basename2(filePath, ".vue");
|
|
9322
9479
|
if (fileName !== "index") {
|
|
9323
9480
|
return fileName;
|
|
9324
9481
|
}
|
|
9325
|
-
const parentDirName =
|
|
9482
|
+
const parentDirName = basename2(dirname10(filePath));
|
|
9326
9483
|
return parentDirName || fileName;
|
|
9327
9484
|
}
|
|
9328
9485
|
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
@@ -9466,7 +9623,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
|
|
|
9466
9623
|
if (visitedImports.has(visitKey))
|
|
9467
9624
|
return [];
|
|
9468
9625
|
visitedImports.add(visitKey);
|
|
9469
|
-
const source = await
|
|
9626
|
+
const source = await readFile8(importedRef.filePath, "utf-8");
|
|
9470
9627
|
const project = new Project3({
|
|
9471
9628
|
compilerOptions: {
|
|
9472
9629
|
strict: false,
|
|
@@ -9494,18 +9651,18 @@ function findWorkspaceRoot(startDir) {
|
|
|
9494
9651
|
return workspaceRootCache.get(startDir);
|
|
9495
9652
|
let dir = startDir;
|
|
9496
9653
|
while (true) {
|
|
9497
|
-
const pkgJsonPath =
|
|
9654
|
+
const pkgJsonPath = join11(dir, "package.json");
|
|
9498
9655
|
if (existsSync6(pkgJsonPath)) {
|
|
9499
9656
|
try {
|
|
9500
9657
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9501
|
-
if (pkg.workspaces || existsSync6(
|
|
9658
|
+
if (pkg.workspaces || existsSync6(join11(dir, "pnpm-workspace.yaml"))) {
|
|
9502
9659
|
workspaceRootCache.set(startDir, dir);
|
|
9503
9660
|
return dir;
|
|
9504
9661
|
}
|
|
9505
9662
|
} catch {
|
|
9506
9663
|
}
|
|
9507
9664
|
}
|
|
9508
|
-
const parent =
|
|
9665
|
+
const parent = dirname10(dir);
|
|
9509
9666
|
if (parent === dir) {
|
|
9510
9667
|
workspaceRootCache.set(startDir, null);
|
|
9511
9668
|
return null;
|
|
@@ -9519,7 +9676,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9519
9676
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
9520
9677
|
}
|
|
9521
9678
|
const packageMap = /* @__PURE__ */ new Map();
|
|
9522
|
-
const packagesDir =
|
|
9679
|
+
const packagesDir = join11(workspaceRoot, "packages");
|
|
9523
9680
|
if (!existsSync6(packagesDir)) {
|
|
9524
9681
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
9525
9682
|
return packageMap;
|
|
@@ -9533,7 +9690,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9533
9690
|
} catch {
|
|
9534
9691
|
return;
|
|
9535
9692
|
}
|
|
9536
|
-
const pkgJsonPath =
|
|
9693
|
+
const pkgJsonPath = join11(dir, "package.json");
|
|
9537
9694
|
if (existsSync6(pkgJsonPath)) {
|
|
9538
9695
|
try {
|
|
9539
9696
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
@@ -9546,10 +9703,10 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9546
9703
|
for (const entry of entries) {
|
|
9547
9704
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
9548
9705
|
continue;
|
|
9549
|
-
const entryPath =
|
|
9706
|
+
const entryPath = join11(dir, entry);
|
|
9550
9707
|
try {
|
|
9551
|
-
const
|
|
9552
|
-
if (
|
|
9708
|
+
const stat6 = statSync3(entryPath);
|
|
9709
|
+
if (stat6.isDirectory()) {
|
|
9553
9710
|
scanDir(entryPath, depth + 1);
|
|
9554
9711
|
}
|
|
9555
9712
|
} catch {
|
|
@@ -9561,7 +9718,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9561
9718
|
return packageMap;
|
|
9562
9719
|
}
|
|
9563
9720
|
function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
9564
|
-
const workspaceRoot = findWorkspaceRoot(
|
|
9721
|
+
const workspaceRoot = findWorkspaceRoot(dirname10(importingFilePath));
|
|
9565
9722
|
if (!workspaceRoot)
|
|
9566
9723
|
return null;
|
|
9567
9724
|
const packageDirs = getWorkspacePackageDirs(workspaceRoot);
|
|
@@ -9586,7 +9743,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9586
9743
|
const packageDir = packageDirs.get(packageName);
|
|
9587
9744
|
if (!packageDir)
|
|
9588
9745
|
return null;
|
|
9589
|
-
const pkgJsonPath =
|
|
9746
|
+
const pkgJsonPath = join11(packageDir, "package.json");
|
|
9590
9747
|
try {
|
|
9591
9748
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9592
9749
|
if (pkg.exports && subpath !== ".") {
|
|
@@ -9599,8 +9756,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9599
9756
|
}
|
|
9600
9757
|
if (subpath !== ".") {
|
|
9601
9758
|
const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
|
|
9602
|
-
for (const base of [
|
|
9603
|
-
const subPkgPath =
|
|
9759
|
+
for (const base of [join11(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
9760
|
+
const subPkgPath = join11(base, "package.json");
|
|
9604
9761
|
if (existsSync6(subPkgPath)) {
|
|
9605
9762
|
try {
|
|
9606
9763
|
const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
|
|
@@ -9653,7 +9810,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9653
9810
|
if (specifier.startsWith(".")) {
|
|
9654
9811
|
if (!specifier.endsWith(".vue"))
|
|
9655
9812
|
continue;
|
|
9656
|
-
localImports.set(defaultImport.getText(), resolve10(
|
|
9813
|
+
localImports.set(defaultImport.getText(), resolve10(dirname10(resolvedFilePath), specifier));
|
|
9657
9814
|
} else {
|
|
9658
9815
|
const resolvedVuePath = resolveWorkspaceVueImport(specifier, resolvedFilePath);
|
|
9659
9816
|
if (resolvedVuePath) {
|
|
@@ -9697,7 +9854,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9697
9854
|
return [];
|
|
9698
9855
|
}
|
|
9699
9856
|
async function extractInheritedVueProps(filePath, visited) {
|
|
9700
|
-
const source = await
|
|
9857
|
+
const source = await readFile8(filePath, "utf-8");
|
|
9701
9858
|
const { descriptor } = parseSFC(source);
|
|
9702
9859
|
if (!descriptor.script) {
|
|
9703
9860
|
return [];
|
|
@@ -9815,7 +9972,7 @@ function mergeSlotsDedup(base, extra) {
|
|
|
9815
9972
|
|
|
9816
9973
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/astro/extract-astro-components.js
|
|
9817
9974
|
import os2 from "node:os";
|
|
9818
|
-
import { basename as
|
|
9975
|
+
import { basename as basename3 } from "node:path";
|
|
9819
9976
|
import { Project as Project4, Node as Node7 } from "ts-morph";
|
|
9820
9977
|
function extractAllowedValues3(typeText) {
|
|
9821
9978
|
const parts = typeText.split("|").map((p) => p.trim());
|
|
@@ -9994,7 +10151,7 @@ function mergeSlots(...slotGroups) {
|
|
|
9994
10151
|
return merged;
|
|
9995
10152
|
}
|
|
9996
10153
|
function extractFromAstroFile(filePath, source) {
|
|
9997
|
-
const name =
|
|
10154
|
+
const name = basename3(filePath, ".astro");
|
|
9998
10155
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
9999
10156
|
let frontmatter = "";
|
|
10000
10157
|
let template = source;
|
|
@@ -10030,7 +10187,7 @@ async function extractAstroComponents(filePaths, onProgress) {
|
|
|
10030
10187
|
}
|
|
10031
10188
|
|
|
10032
10189
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
10033
|
-
import { basename as
|
|
10190
|
+
import { basename as basename4, dirname as dirname11, join as join12, resolve as resolve11 } from "node:path";
|
|
10034
10191
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
10035
10192
|
function normalizeComponentName(input) {
|
|
10036
10193
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -10197,7 +10354,7 @@ function shouldPreferTagName(className, tagName) {
|
|
|
10197
10354
|
return false;
|
|
10198
10355
|
}
|
|
10199
10356
|
function getFileDerivedComponentName(sourceFile) {
|
|
10200
|
-
const baseName =
|
|
10357
|
+
const baseName = basename4(sourceFile.getFilePath()).replace(/\.[^.]+$/, "").replace(/\.component$/, "");
|
|
10201
10358
|
return kebabToPascal(baseName);
|
|
10202
10359
|
}
|
|
10203
10360
|
function chooseComponentName(classDecl, className, tagName) {
|
|
@@ -10675,7 +10832,7 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
|
|
|
10675
10832
|
}
|
|
10676
10833
|
function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
10677
10834
|
if (specifier.startsWith(".")) {
|
|
10678
|
-
const resolvedPath = resolve11(
|
|
10835
|
+
const resolvedPath = resolve11(dirname11(fromFilePath), specifier);
|
|
10679
10836
|
if (resolvedPath.endsWith(".js")) {
|
|
10680
10837
|
return `${resolvedPath.slice(0, -3)}.ts`;
|
|
10681
10838
|
}
|
|
@@ -10685,14 +10842,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
10685
10842
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
10686
10843
|
return null;
|
|
10687
10844
|
}
|
|
10688
|
-
const packagesMarker = `${
|
|
10845
|
+
const packagesMarker = `${join12("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
10689
10846
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
10690
10847
|
if (markerIndex === -1) {
|
|
10691
10848
|
return null;
|
|
10692
10849
|
}
|
|
10693
10850
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
10694
10851
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
10695
|
-
return
|
|
10852
|
+
return join12(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
10696
10853
|
}
|
|
10697
10854
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
10698
10855
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -10845,7 +11002,7 @@ async function extractWebComponentDefinitions(filePaths) {
|
|
|
10845
11002
|
|
|
10846
11003
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
10847
11004
|
import os3 from "node:os";
|
|
10848
|
-
import { basename as
|
|
11005
|
+
import { basename as basename5, dirname as dirname12, resolve as resolve12, join as join13 } from "node:path";
|
|
10849
11006
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
10850
11007
|
import { createRequire } from "node:module";
|
|
10851
11008
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
@@ -11079,10 +11236,10 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
11079
11236
|
function findNearestTsconfig(startDir) {
|
|
11080
11237
|
let dir = startDir;
|
|
11081
11238
|
for (let i = 0; i < 16; i++) {
|
|
11082
|
-
const candidate =
|
|
11239
|
+
const candidate = join13(dir, "tsconfig.json");
|
|
11083
11240
|
if (existsSync7(candidate))
|
|
11084
11241
|
return candidate;
|
|
11085
|
-
const parent =
|
|
11242
|
+
const parent = dirname12(dir);
|
|
11086
11243
|
if (!parent || parent === dir)
|
|
11087
11244
|
return null;
|
|
11088
11245
|
dir = parent;
|
|
@@ -11212,10 +11369,10 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11212
11369
|
} catch {
|
|
11213
11370
|
resolvedJs = null;
|
|
11214
11371
|
}
|
|
11215
|
-
const seedDir = resolvedJs ?
|
|
11372
|
+
const seedDir = resolvedJs ? dirname12(resolvedJs) : dirname12(parentFile);
|
|
11216
11373
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
11217
11374
|
if (pkgRoot) {
|
|
11218
|
-
const pkgJsonPath =
|
|
11375
|
+
const pkgJsonPath = join13(pkgRoot, "package.json");
|
|
11219
11376
|
if (existsSync7(pkgJsonPath)) {
|
|
11220
11377
|
try {
|
|
11221
11378
|
const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
|
|
@@ -11236,7 +11393,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11236
11393
|
}
|
|
11237
11394
|
}
|
|
11238
11395
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
11239
|
-
const candidate =
|
|
11396
|
+
const candidate = join13(pkgRoot, entry);
|
|
11240
11397
|
if (existsSync7(candidate))
|
|
11241
11398
|
return candidate;
|
|
11242
11399
|
}
|
|
@@ -11254,9 +11411,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11254
11411
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
11255
11412
|
let dir = seedDir;
|
|
11256
11413
|
for (let i = 0; i < 32; i++) {
|
|
11257
|
-
if (existsSync7(
|
|
11414
|
+
if (existsSync7(join13(dir, "package.json"))) {
|
|
11258
11415
|
try {
|
|
11259
|
-
const pkgRaw = readFileSync6(
|
|
11416
|
+
const pkgRaw = readFileSync6(join13(dir, "package.json"), "utf-8");
|
|
11260
11417
|
const pkg = JSON.parse(pkgRaw);
|
|
11261
11418
|
if (pkg.name === specifier)
|
|
11262
11419
|
return dir;
|
|
@@ -11265,7 +11422,7 @@ function findPackageRootForSpecifier(seedDir, specifier) {
|
|
|
11265
11422
|
} catch {
|
|
11266
11423
|
}
|
|
11267
11424
|
}
|
|
11268
|
-
const parent =
|
|
11425
|
+
const parent = dirname12(dir);
|
|
11269
11426
|
if (!parent || parent === dir)
|
|
11270
11427
|
return null;
|
|
11271
11428
|
dir = parent;
|
|
@@ -11396,12 +11553,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11396
11553
|
}
|
|
11397
11554
|
var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
|
|
11398
11555
|
function getSvelteComponentName(filePath) {
|
|
11399
|
-
const file =
|
|
11400
|
-
const parentDir =
|
|
11556
|
+
const file = basename5(filePath, ".svelte");
|
|
11557
|
+
const parentDir = basename5(dirname12(filePath));
|
|
11401
11558
|
if (file === "index")
|
|
11402
11559
|
return toPascalCase(parentDir);
|
|
11403
11560
|
if (ANATOMY_FOLDERS.has(parentDir)) {
|
|
11404
|
-
const grandparent =
|
|
11561
|
+
const grandparent = basename5(dirname12(dirname12(filePath)));
|
|
11405
11562
|
if (grandparent && grandparent !== "." && grandparent !== "/") {
|
|
11406
11563
|
return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
|
|
11407
11564
|
}
|
|
@@ -12216,7 +12373,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
12216
12373
|
}
|
|
12217
12374
|
|
|
12218
12375
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12219
|
-
import { readFile as
|
|
12376
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
12220
12377
|
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
12221
12378
|
|
|
12222
12379
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
@@ -12530,7 +12687,7 @@ function extractProps2(cls, meta) {
|
|
|
12530
12687
|
}
|
|
12531
12688
|
|
|
12532
12689
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
|
|
12533
|
-
import { dirname as
|
|
12690
|
+
import { dirname as dirname13, resolve as resolve13 } from "node:path";
|
|
12534
12691
|
|
|
12535
12692
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
|
|
12536
12693
|
var SUFFIXES = ["Component", "Directive"];
|
|
@@ -12585,7 +12742,7 @@ function readComponentMetadata(cls, sourceFilePath) {
|
|
|
12585
12742
|
const inlineTemplate = readDecoratorString(obj, "template");
|
|
12586
12743
|
const templateUrlRel = readDecoratorString(obj, "templateUrl");
|
|
12587
12744
|
const inputsArray = readDecoratorStringArray(obj, "inputs");
|
|
12588
|
-
const templatePath = templateUrlRel ? resolve13(
|
|
12745
|
+
const templatePath = templateUrlRel ? resolve13(dirname13(sourceFilePath), templateUrlRel) : null;
|
|
12589
12746
|
const decorator = cls.getDecorator("Component");
|
|
12590
12747
|
const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
|
|
12591
12748
|
return {
|
|
@@ -12622,14 +12779,14 @@ function countLines(text, offset) {
|
|
|
12622
12779
|
}
|
|
12623
12780
|
|
|
12624
12781
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
12625
|
-
import { readFile as
|
|
12782
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
12626
12783
|
async function resolveTemplateSource(meta) {
|
|
12627
12784
|
if (meta.inlineTemplate !== null)
|
|
12628
12785
|
return meta.inlineTemplate;
|
|
12629
12786
|
if (meta.templatePath === null)
|
|
12630
12787
|
return null;
|
|
12631
12788
|
try {
|
|
12632
|
-
return await
|
|
12789
|
+
return await readFile9(meta.templatePath, "utf8");
|
|
12633
12790
|
} catch {
|
|
12634
12791
|
return null;
|
|
12635
12792
|
}
|
|
@@ -12819,7 +12976,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
|
12819
12976
|
});
|
|
12820
12977
|
for (const filePath of filePaths) {
|
|
12821
12978
|
try {
|
|
12822
|
-
const source = await
|
|
12979
|
+
const source = await readFile10(filePath, "utf8");
|
|
12823
12980
|
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12824
12981
|
for (const cls of sourceFile.getClasses()) {
|
|
12825
12982
|
if (!hasComponentDecorator(cls))
|
|
@@ -12955,11 +13112,11 @@ function getPathPreferenceScore(filePath) {
|
|
|
12955
13112
|
const normalized = filePath.replace(/\\/g, "/");
|
|
12956
13113
|
const segments = normalized.split("/").filter(Boolean);
|
|
12957
13114
|
const filename = segments.at(-1) ?? "";
|
|
12958
|
-
const
|
|
13115
|
+
const basename8 = filename.replace(/\.[^.]+$/, "");
|
|
12959
13116
|
let score = 0;
|
|
12960
13117
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
12961
13118
|
score += 100;
|
|
12962
|
-
if (
|
|
13119
|
+
if (basename8 && segments.at(-2) === basename8)
|
|
12963
13120
|
score -= 10;
|
|
12964
13121
|
const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
|
|
12965
13122
|
score -= componentsSegmentCount * 8;
|
|
@@ -13408,15 +13565,15 @@ function applyCompositionEdges(components, edges) {
|
|
|
13408
13565
|
|
|
13409
13566
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
13410
13567
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
13411
|
-
import { dirname as
|
|
13568
|
+
import { dirname as dirname14, join as join14, resolve as resolve14 } from "node:path";
|
|
13412
13569
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13413
13570
|
function resolvePromptPath(fileName) {
|
|
13414
|
-
const thisDir =
|
|
13571
|
+
const thisDir = dirname14(fileURLToPath3(import.meta.url));
|
|
13415
13572
|
let dir = thisDir;
|
|
13416
13573
|
for (; ; ) {
|
|
13417
|
-
const candidate =
|
|
13574
|
+
const candidate = join14(dir, "prompts");
|
|
13418
13575
|
if (existsSync8(candidate))
|
|
13419
|
-
return
|
|
13576
|
+
return join14(candidate, fileName);
|
|
13420
13577
|
const parent = resolve14(dir, "..");
|
|
13421
13578
|
if (parent === dir) {
|
|
13422
13579
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
@@ -13582,7 +13739,7 @@ ${fileDigest}`);
|
|
|
13582
13739
|
}
|
|
13583
13740
|
|
|
13584
13741
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
13585
|
-
import { dirname as
|
|
13742
|
+
import { dirname as dirname15 } from "node:path";
|
|
13586
13743
|
function kebabToPascal3(name) {
|
|
13587
13744
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
13588
13745
|
}
|
|
@@ -13646,8 +13803,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
13646
13803
|
for (const file of files) {
|
|
13647
13804
|
if (!file.path.endsWith("AGENTS.md"))
|
|
13648
13805
|
continue;
|
|
13649
|
-
const docDir =
|
|
13650
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
13806
|
+
const docDir = dirname15(file.path);
|
|
13807
|
+
const parent = components.find((c2) => c2.sourcePath && dirname15(c2.sourcePath) === docDir)?.name;
|
|
13651
13808
|
if (!parent || !componentNames.has(parent))
|
|
13652
13809
|
continue;
|
|
13653
13810
|
for (const line of file.content.split("\n")) {
|
|
@@ -14043,10 +14200,10 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
14043
14200
|
}
|
|
14044
14201
|
|
|
14045
14202
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
14046
|
-
import { access as access3, readFile as
|
|
14203
|
+
import { access as access3, readFile as readFile12 } from "node:fs/promises";
|
|
14047
14204
|
|
|
14048
14205
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
14049
|
-
import { access as access2, mkdir as mkdir3, readFile as
|
|
14206
|
+
import { access as access2, mkdir as mkdir3, readFile as readFile11, writeFile as writeFile4 } from "node:fs/promises";
|
|
14050
14207
|
|
|
14051
14208
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
14052
14209
|
import { resolve as resolve17 } from "node:path";
|
|
@@ -14065,11 +14222,11 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
14065
14222
|
await mkdir3(paths.sessionDir, { recursive: true });
|
|
14066
14223
|
try {
|
|
14067
14224
|
await access2(paths.statePath);
|
|
14068
|
-
const savedState = await
|
|
14225
|
+
const savedState = await readFile11(paths.statePath, "utf8");
|
|
14069
14226
|
return JSON.parse(savedState);
|
|
14070
14227
|
} catch {
|
|
14071
|
-
await
|
|
14072
|
-
await
|
|
14228
|
+
await writeFile4(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
14229
|
+
await writeFile4(paths.eventsPath, "", "utf8");
|
|
14073
14230
|
return initialSnapshot;
|
|
14074
14231
|
}
|
|
14075
14232
|
}
|
|
@@ -14084,9 +14241,9 @@ function getRefineArtifactsRoot() {
|
|
|
14084
14241
|
}
|
|
14085
14242
|
|
|
14086
14243
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
14087
|
-
import { writeFile as
|
|
14244
|
+
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
14088
14245
|
async function saveReviewState(statePath, session) {
|
|
14089
|
-
await
|
|
14246
|
+
await writeFile5(statePath, JSON.stringify(session, null, 2), "utf8");
|
|
14090
14247
|
}
|
|
14091
14248
|
|
|
14092
14249
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
@@ -14096,7 +14253,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14096
14253
|
let snapshot;
|
|
14097
14254
|
try {
|
|
14098
14255
|
await access3(paths.statePath);
|
|
14099
|
-
snapshot = JSON.parse(await
|
|
14256
|
+
snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
|
|
14100
14257
|
} catch {
|
|
14101
14258
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
14102
14259
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -14134,7 +14291,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14134
14291
|
}
|
|
14135
14292
|
|
|
14136
14293
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
14137
|
-
import { readFile as
|
|
14294
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
14138
14295
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
14139
14296
|
if (names.length === 0)
|
|
14140
14297
|
return;
|
|
@@ -14150,7 +14307,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
14150
14307
|
const nameSet = new Set(names);
|
|
14151
14308
|
let snapshot;
|
|
14152
14309
|
try {
|
|
14153
|
-
snapshot = JSON.parse(await
|
|
14310
|
+
snapshot = JSON.parse(await readFile13(paths.statePath, "utf8"));
|
|
14154
14311
|
} catch {
|
|
14155
14312
|
return;
|
|
14156
14313
|
}
|
|
@@ -14349,15 +14506,15 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
14349
14506
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
14350
14507
|
function collectFiles(root, options = {}) {
|
|
14351
14508
|
const resolved = path4.resolve(root);
|
|
14352
|
-
let
|
|
14509
|
+
let stat6;
|
|
14353
14510
|
try {
|
|
14354
|
-
|
|
14511
|
+
stat6 = statSync5(resolved);
|
|
14355
14512
|
} catch (err) {
|
|
14356
14513
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
14357
14514
|
}
|
|
14358
|
-
if (
|
|
14515
|
+
if (stat6.isFile())
|
|
14359
14516
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
14360
|
-
if (!
|
|
14517
|
+
if (!stat6.isDirectory())
|
|
14361
14518
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
14362
14519
|
const result = {
|
|
14363
14520
|
filePaths: [],
|
|
@@ -14407,7 +14564,7 @@ function generateUlid(now = Date.now()) {
|
|
|
14407
14564
|
}
|
|
14408
14565
|
|
|
14409
14566
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14410
|
-
import { readFile as
|
|
14567
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
14411
14568
|
|
|
14412
14569
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
14413
14570
|
function migrateRecord(rec) {
|
|
@@ -14426,7 +14583,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
14426
14583
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14427
14584
|
async function readRunsFileMaybe() {
|
|
14428
14585
|
try {
|
|
14429
|
-
const raw = await
|
|
14586
|
+
const raw = await readFile14(runsFilePath(), "utf8");
|
|
14430
14587
|
const parsed = JSON.parse(raw);
|
|
14431
14588
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
14432
14589
|
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.`);
|
|
@@ -14442,13 +14599,13 @@ async function readRunsFileMaybe() {
|
|
|
14442
14599
|
}
|
|
14443
14600
|
|
|
14444
14601
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
14445
|
-
import { mkdir as mkdir4, rename as rename2, writeFile as
|
|
14446
|
-
import { dirname as
|
|
14602
|
+
import { mkdir as mkdir4, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
14603
|
+
import { dirname as dirname16 } from "node:path";
|
|
14447
14604
|
async function writeRunsFileAtomic(file) {
|
|
14448
|
-
await mkdir4(
|
|
14605
|
+
await mkdir4(dirname16(runsFilePath()), { recursive: true });
|
|
14449
14606
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
14450
14607
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
14451
|
-
await
|
|
14608
|
+
await writeFile6(tmp, body, { mode: 384 });
|
|
14452
14609
|
await rename2(tmp, runsFilePath());
|
|
14453
14610
|
}
|
|
14454
14611
|
|
|
@@ -14485,7 +14642,7 @@ async function updateRun(id, patch) {
|
|
|
14485
14642
|
}
|
|
14486
14643
|
|
|
14487
14644
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14488
|
-
import { readFile as
|
|
14645
|
+
import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
|
|
14489
14646
|
import { resolve as resolve19 } from "node:path";
|
|
14490
14647
|
|
|
14491
14648
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
@@ -14513,7 +14670,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14513
14670
|
continue;
|
|
14514
14671
|
seen.add(abs);
|
|
14515
14672
|
try {
|
|
14516
|
-
const st = await
|
|
14673
|
+
const st = await stat3(abs);
|
|
14517
14674
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14518
14675
|
if (name)
|
|
14519
14676
|
entry.componentName = name;
|
|
@@ -14528,7 +14685,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14528
14685
|
const abs = resolve19(opts.rawTokensPath);
|
|
14529
14686
|
rawTokensPath = abs;
|
|
14530
14687
|
try {
|
|
14531
|
-
const [st, buf] = await Promise.all([
|
|
14688
|
+
const [st, buf] = await Promise.all([stat3(abs), readFile15(abs)]);
|
|
14532
14689
|
rawTokensMtime = st.mtime.toISOString();
|
|
14533
14690
|
rawTokensContentHash = sha256Hex(buf);
|
|
14534
14691
|
} catch {
|
|
@@ -14539,7 +14696,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14539
14696
|
|
|
14540
14697
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14541
14698
|
import { access as access4 } from "node:fs/promises";
|
|
14542
|
-
import { join as
|
|
14699
|
+
import { join as join15 } from "node:path";
|
|
14543
14700
|
|
|
14544
14701
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
|
|
14545
14702
|
var SAVE_FILES = ["components.json", "tokens.json"];
|
|
@@ -14549,7 +14706,7 @@ async function listConflictingFiles(path5) {
|
|
|
14549
14706
|
const conflicts = [];
|
|
14550
14707
|
for (const name of SAVE_FILES) {
|
|
14551
14708
|
try {
|
|
14552
|
-
await access4(
|
|
14709
|
+
await access4(join15(path5, name));
|
|
14553
14710
|
conflicts.push(name);
|
|
14554
14711
|
} catch {
|
|
14555
14712
|
}
|
|
@@ -14563,7 +14720,7 @@ async function detectSaveConflict(path5) {
|
|
|
14563
14720
|
}
|
|
14564
14721
|
|
|
14565
14722
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
|
|
14566
|
-
import { join as
|
|
14723
|
+
import { join as join16 } from "node:path";
|
|
14567
14724
|
function pad2(n) {
|
|
14568
14725
|
return n < 10 ? `0${n}` : String(n);
|
|
14569
14726
|
}
|
|
@@ -14574,7 +14731,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
14574
14731
|
const hh = pad2(now.getHours());
|
|
14575
14732
|
const mm = pad2(now.getMinutes());
|
|
14576
14733
|
const ss = pad2(now.getSeconds());
|
|
14577
|
-
return
|
|
14734
|
+
return join16(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
14578
14735
|
}
|
|
14579
14736
|
|
|
14580
14737
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
|
|
@@ -14610,12 +14767,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
14610
14767
|
}
|
|
14611
14768
|
|
|
14612
14769
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14613
|
-
import { readFile as
|
|
14770
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
14614
14771
|
async function loadAcceptedNames(sessionId) {
|
|
14615
14772
|
try {
|
|
14616
14773
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14617
14774
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14618
|
-
const raw = await
|
|
14775
|
+
const raw = await readFile16(paths.statePath, "utf8");
|
|
14619
14776
|
const snapshot = JSON.parse(raw);
|
|
14620
14777
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14621
14778
|
if (accepted.length === 0)
|
|
@@ -15941,11 +16098,11 @@ function formatApiError2(request) {
|
|
|
15941
16098
|
|
|
15942
16099
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
15943
16100
|
init_shared();
|
|
15944
|
-
import { readFile as
|
|
16101
|
+
import { readFile as readFile17, stat as stat5 } from "node:fs/promises";
|
|
15945
16102
|
|
|
15946
16103
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
15947
|
-
import { readdir as
|
|
15948
|
-
import { join as
|
|
16104
|
+
import { readdir as readdir3, stat as stat4 } from "node:fs/promises";
|
|
16105
|
+
import { join as join17 } from "node:path";
|
|
15949
16106
|
var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
|
|
15950
16107
|
async function collectJsonFiles(dir) {
|
|
15951
16108
|
const results = [];
|
|
@@ -15955,17 +16112,17 @@ async function collectJsonFiles(dir) {
|
|
|
15955
16112
|
async function walk(current, results) {
|
|
15956
16113
|
let entries;
|
|
15957
16114
|
try {
|
|
15958
|
-
entries = await
|
|
16115
|
+
entries = await readdir3(current);
|
|
15959
16116
|
} catch {
|
|
15960
16117
|
return;
|
|
15961
16118
|
}
|
|
15962
16119
|
await Promise.all(entries.map(async (entry) => {
|
|
15963
16120
|
if (IGNORE_TOKEN_DIRS.has(entry))
|
|
15964
16121
|
return;
|
|
15965
|
-
const full =
|
|
16122
|
+
const full = join17(current, entry);
|
|
15966
16123
|
let s;
|
|
15967
16124
|
try {
|
|
15968
|
-
s = await
|
|
16125
|
+
s = await stat4(full);
|
|
15969
16126
|
} catch {
|
|
15970
16127
|
return;
|
|
15971
16128
|
}
|
|
@@ -15981,7 +16138,7 @@ async function walk(current, results) {
|
|
|
15981
16138
|
async function readTokensFromPath(flag, p) {
|
|
15982
16139
|
let s;
|
|
15983
16140
|
try {
|
|
15984
|
-
s = await
|
|
16141
|
+
s = await stat5(p);
|
|
15985
16142
|
} catch {
|
|
15986
16143
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
15987
16144
|
}
|
|
@@ -16000,7 +16157,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16000
16157
|
const merged = {};
|
|
16001
16158
|
for (const file of files.sort()) {
|
|
16002
16159
|
try {
|
|
16003
|
-
const text = await
|
|
16160
|
+
const text = await readFile17(file, "utf8");
|
|
16004
16161
|
const parsed = JSON.parse(text);
|
|
16005
16162
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
16006
16163
|
Object.assign(merged, parsed);
|
|
@@ -16014,7 +16171,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16014
16171
|
async function readSingleFile(flag, p) {
|
|
16015
16172
|
let text;
|
|
16016
16173
|
try {
|
|
16017
|
-
text = await
|
|
16174
|
+
text = await readFile17(p, "utf8");
|
|
16018
16175
|
} catch {
|
|
16019
16176
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16020
16177
|
}
|
|
@@ -16059,8 +16216,8 @@ function buildContentfulManagementClient(request) {
|
|
|
16059
16216
|
}
|
|
16060
16217
|
|
|
16061
16218
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
|
|
16062
|
-
import { writeFile as
|
|
16063
|
-
import { join as
|
|
16219
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
16220
|
+
import { join as join18 } from "node:path";
|
|
16064
16221
|
|
|
16065
16222
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
|
|
16066
16223
|
import { fetchAll } from "contentful-management";
|
|
@@ -16092,8 +16249,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16092
16249
|
spaceId: request.spaceId,
|
|
16093
16250
|
environmentId: request.environmentId
|
|
16094
16251
|
});
|
|
16095
|
-
const path5 =
|
|
16096
|
-
await
|
|
16252
|
+
const path5 = join18(request.outDir, ".existing-entities.json");
|
|
16253
|
+
await writeFile7(path5, JSON.stringify(entities, null, 2), "utf8");
|
|
16097
16254
|
return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
|
|
16098
16255
|
} catch (error) {
|
|
16099
16256
|
return {
|
|
@@ -16105,12 +16262,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16105
16262
|
}
|
|
16106
16263
|
|
|
16107
16264
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
16108
|
-
import { readFile as
|
|
16265
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
16109
16266
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
16110
16267
|
if (!request.path)
|
|
16111
16268
|
return void 0;
|
|
16112
16269
|
try {
|
|
16113
|
-
const raw = await
|
|
16270
|
+
const raw = await readFile18(request.path, "utf8");
|
|
16114
16271
|
const parsed = JSON.parse(raw);
|
|
16115
16272
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
16116
16273
|
return void 0;
|
|
@@ -16875,7 +17032,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
16875
17032
|
}
|
|
16876
17033
|
|
|
16877
17034
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16878
|
-
import { readFile as
|
|
17035
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
16879
17036
|
|
|
16880
17037
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
16881
17038
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -16977,7 +17134,7 @@ function dedupeReasons(reasons) {
|
|
|
16977
17134
|
async function inspectComponentSource(component) {
|
|
16978
17135
|
let sourceText = "";
|
|
16979
17136
|
try {
|
|
16980
|
-
sourceText = await
|
|
17137
|
+
sourceText = await readFile19(component.source, "utf8");
|
|
16981
17138
|
} catch {
|
|
16982
17139
|
return {
|
|
16983
17140
|
wrapperConfidence: 0,
|
|
@@ -17416,7 +17573,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
17416
17573
|
}
|
|
17417
17574
|
|
|
17418
17575
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17419
|
-
import { readFile as
|
|
17576
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
17420
17577
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17421
17578
|
const paths = new Set(extraFiles);
|
|
17422
17579
|
for (const c2 of components) {
|
|
@@ -17426,7 +17583,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17426
17583
|
const out = [];
|
|
17427
17584
|
await Promise.all([...paths].map(async (p) => {
|
|
17428
17585
|
try {
|
|
17429
|
-
const content = await
|
|
17586
|
+
const content = await readFile20(p, "utf8");
|
|
17430
17587
|
out.push({ path: p, content });
|
|
17431
17588
|
} catch {
|
|
17432
17589
|
}
|
|
@@ -17597,15 +17754,15 @@ init_build_prompt();
|
|
|
17597
17754
|
init_create_local_cli_agent_invoker();
|
|
17598
17755
|
init_invoke_agent_with_output();
|
|
17599
17756
|
init_parse_token_tool_calls();
|
|
17600
|
-
import { readFile as
|
|
17601
|
-
import { basename as
|
|
17757
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
17758
|
+
import { basename as basename6, resolve as pathResolve } from "node:path";
|
|
17602
17759
|
init_cache_keys();
|
|
17603
17760
|
init_parse_prompt_overrides();
|
|
17604
17761
|
init_resolve_prompt_override();
|
|
17605
17762
|
|
|
17606
17763
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
17607
|
-
import { mkdir as mkdir7, writeFile as
|
|
17608
|
-
import { join as
|
|
17764
|
+
import { mkdir as mkdir7, writeFile as writeFile8 } from "node:fs/promises";
|
|
17765
|
+
import { join as join19 } from "node:path";
|
|
17609
17766
|
async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
17610
17767
|
onProgress?.({ kind: "writing-file" });
|
|
17611
17768
|
const result = getDtcgTokensForSession(db, sessionId);
|
|
@@ -17613,9 +17770,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
|
17613
17770
|
throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
|
|
17614
17771
|
}
|
|
17615
17772
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
17616
|
-
const tokensPath =
|
|
17773
|
+
const tokensPath = join19(outDir, "tokens.json");
|
|
17617
17774
|
await mkdir7(outDir, { recursive: true });
|
|
17618
|
-
await
|
|
17775
|
+
await writeFile8(tokensPath, `${JSON.stringify(tree, null, 2)}
|
|
17619
17776
|
`);
|
|
17620
17777
|
return { tokensPath, tokenCount: result.tokens.length };
|
|
17621
17778
|
}
|
|
@@ -17630,7 +17787,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17630
17787
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17631
17788
|
const tokensOverride = overridesMap.get("tokens");
|
|
17632
17789
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17633
|
-
const rawTokensInline = await
|
|
17790
|
+
const rawTokensInline = await readFile21(pathResolve(rawTokensPath), "utf8");
|
|
17634
17791
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17635
17792
|
const db = openPipelineDb();
|
|
17636
17793
|
try {
|
|
@@ -17658,7 +17815,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17658
17815
|
skill: "tokens",
|
|
17659
17816
|
mode: "autonomous",
|
|
17660
17817
|
rawTokensInline,
|
|
17661
|
-
rawTokensFilename:
|
|
17818
|
+
rawTokensFilename: basename6(pathResolve(rawTokensPath)),
|
|
17662
17819
|
outDir: process.cwd(),
|
|
17663
17820
|
...skillContentOverride ? { skillContentOverride } : skillPath ? { skillPathOverride: skillPath } : {}
|
|
17664
17821
|
});
|
|
@@ -18142,8 +18299,8 @@ function PathValidationScreen({
|
|
|
18142
18299
|
hasTokens = true
|
|
18143
18300
|
}) {
|
|
18144
18301
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
18145
|
-
const [scan, setScan] =
|
|
18146
|
-
|
|
18302
|
+
const [scan, setScan] = useState8();
|
|
18303
|
+
useEffect8(() => {
|
|
18147
18304
|
startDebugRun({
|
|
18148
18305
|
flow: "import/path-validation",
|
|
18149
18306
|
step: "03-path-validation",
|
|
@@ -18151,7 +18308,7 @@ function PathValidationScreen({
|
|
|
18151
18308
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
18152
18309
|
});
|
|
18153
18310
|
}, []);
|
|
18154
|
-
|
|
18311
|
+
useEffect8(() => {
|
|
18155
18312
|
setScan(scanFiles(resolvedPath));
|
|
18156
18313
|
}, [resolvedPath]);
|
|
18157
18314
|
const phase = phaseOf(scan);
|
|
@@ -18193,12 +18350,12 @@ function PathValidationScreen({
|
|
|
18193
18350
|
}
|
|
18194
18351
|
|
|
18195
18352
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
18196
|
-
import { useEffect as
|
|
18353
|
+
import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
|
|
18197
18354
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
18198
18355
|
init_debug_store();
|
|
18199
18356
|
|
|
18200
18357
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
18201
|
-
import { useState as
|
|
18358
|
+
import { useState as useState9 } from "react";
|
|
18202
18359
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
18203
18360
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
18204
18361
|
function formLabelWidth(rows) {
|
|
@@ -18234,9 +18391,9 @@ function FieldForm({
|
|
|
18234
18391
|
busy = false,
|
|
18235
18392
|
children
|
|
18236
18393
|
}) {
|
|
18237
|
-
const [active, setActive] =
|
|
18238
|
-
const [editing, setEditing] =
|
|
18239
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
18394
|
+
const [active, setActive] = useState9(0);
|
|
18395
|
+
const [editing, setEditing] = useState9(false);
|
|
18396
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
18240
18397
|
const rowCount = fields2.length + actions.length;
|
|
18241
18398
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
18242
18399
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -18513,16 +18670,16 @@ function CredentialsScreen({
|
|
|
18513
18670
|
host: initial.host ?? ""
|
|
18514
18671
|
})
|
|
18515
18672
|
).current;
|
|
18516
|
-
const [values, setValues] =
|
|
18517
|
-
const [notice, setNotice] =
|
|
18518
|
-
const [validating, setValidating] =
|
|
18673
|
+
const [values, setValues] = useState10(initialValues);
|
|
18674
|
+
const [notice, setNotice] = useState10(null);
|
|
18675
|
+
const [validating, setValidating] = useState10(false);
|
|
18519
18676
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18520
|
-
const [editing, setEditing] =
|
|
18521
|
-
const [focus, setFocus] =
|
|
18522
|
-
const [active, setActive] =
|
|
18523
|
-
const [beforeEdit, setBeforeEdit] =
|
|
18677
|
+
const [editing, setEditing] = useState10(!prefilled);
|
|
18678
|
+
const [focus, setFocus] = useState10(0);
|
|
18679
|
+
const [active, setActive] = useState10(0);
|
|
18680
|
+
const [beforeEdit, setBeforeEdit] = useState10(initialValues);
|
|
18524
18681
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
18525
|
-
|
|
18682
|
+
useEffect9(() => {
|
|
18526
18683
|
startDebugRun({
|
|
18527
18684
|
flow: "import/credentials",
|
|
18528
18685
|
step: "04-credentials",
|
|
@@ -18844,7 +19001,7 @@ function ExtractionScreen({ progress, agent, rowMs }) {
|
|
|
18844
19001
|
}
|
|
18845
19002
|
|
|
18846
19003
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
18847
|
-
import { useEffect as
|
|
19004
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState11 } from "react";
|
|
18848
19005
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
18849
19006
|
init_debug_store();
|
|
18850
19007
|
|
|
@@ -18909,8 +19066,8 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
18909
19066
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
18910
19067
|
const rows = loaded.ok ? loaded.rows : [];
|
|
18911
19068
|
const columns = useTerminalWidth();
|
|
18912
|
-
const [selected, setSelected] =
|
|
18913
|
-
|
|
19069
|
+
const [selected, setSelected] = useState11(0);
|
|
19070
|
+
useEffect10(() => {
|
|
18914
19071
|
startDebugRun({
|
|
18915
19072
|
flow: "import/token-review",
|
|
18916
19073
|
step: "05-token-review",
|
|
@@ -18999,21 +19156,21 @@ init_config();
|
|
|
18999
19156
|
|
|
19000
19157
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19001
19158
|
init_debug_store();
|
|
19002
|
-
import { useEffect as
|
|
19159
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState12 } from "react";
|
|
19003
19160
|
|
|
19004
19161
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
19005
19162
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
19006
|
-
import { join as
|
|
19163
|
+
import { join as join21, resolve as resolve24 } from "node:path";
|
|
19007
19164
|
|
|
19008
19165
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
19009
19166
|
import { existsSync as existsSync10 } from "node:fs";
|
|
19010
|
-
import { dirname as
|
|
19167
|
+
import { dirname as dirname17, join as join20, resolve as resolve22 } from "node:path";
|
|
19011
19168
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
19012
19169
|
function findSkillPath(fileName) {
|
|
19013
|
-
const thisDir =
|
|
19170
|
+
const thisDir = dirname17(fileURLToPath4(import.meta.url));
|
|
19014
19171
|
let dir = thisDir;
|
|
19015
19172
|
for (; ; ) {
|
|
19016
|
-
const candidate =
|
|
19173
|
+
const candidate = join20(dir, "skills", fileName);
|
|
19017
19174
|
if (existsSync10(candidate)) return candidate;
|
|
19018
19175
|
const parent = resolve22(dir, "..");
|
|
19019
19176
|
if (parent === dir) {
|
|
@@ -19123,7 +19280,7 @@ var realDeps = {
|
|
|
19123
19280
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
19124
19281
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
19125
19282
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
19126
|
-
const outDir = input.outDir ??
|
|
19283
|
+
const outDir = input.outDir ?? join21(resolve24(input.projectPath), ".contentful");
|
|
19127
19284
|
let progress = initialProgress({
|
|
19128
19285
|
hasCredentials: input.credentials !== null,
|
|
19129
19286
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -19254,9 +19411,9 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
19254
19411
|
|
|
19255
19412
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19256
19413
|
function useExtraction(input) {
|
|
19257
|
-
const [state2, setState] =
|
|
19414
|
+
const [state2, setState] = useState12();
|
|
19258
19415
|
const current = useRef6();
|
|
19259
|
-
|
|
19416
|
+
useEffect11(() => {
|
|
19260
19417
|
current.current = input;
|
|
19261
19418
|
if (!input) {
|
|
19262
19419
|
setState(void 0);
|
|
@@ -19299,7 +19456,7 @@ function useExtraction(input) {
|
|
|
19299
19456
|
}
|
|
19300
19457
|
|
|
19301
19458
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19302
|
-
import { useEffect as
|
|
19459
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
|
|
19303
19460
|
|
|
19304
19461
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
|
|
19305
19462
|
var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
|
|
@@ -19332,9 +19489,9 @@ async function runTokensOnly(input, deps = realDeps2) {
|
|
|
19332
19489
|
|
|
19333
19490
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19334
19491
|
function useTokensOnly(input) {
|
|
19335
|
-
const [state2, setState] =
|
|
19492
|
+
const [state2, setState] = useState13();
|
|
19336
19493
|
const current = useRef7();
|
|
19337
|
-
|
|
19494
|
+
useEffect12(() => {
|
|
19338
19495
|
current.current = input;
|
|
19339
19496
|
if (!input) {
|
|
19340
19497
|
setState(void 0);
|
|
@@ -19353,7 +19510,7 @@ function useTokensOnly(input) {
|
|
|
19353
19510
|
|
|
19354
19511
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
19355
19512
|
init_debug_store();
|
|
19356
|
-
import { useEffect as
|
|
19513
|
+
import { useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
19357
19514
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
19358
19515
|
|
|
19359
19516
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts
|
|
@@ -19550,32 +19707,32 @@ function CounterStrip(props) {
|
|
|
19550
19707
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
19551
19708
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
19552
19709
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
19553
|
-
const
|
|
19710
|
+
const sep2 = condensed ? " | " : " ";
|
|
19554
19711
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
19555
19712
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19556
19713
|
labelGrp,
|
|
19557
19714
|
" "
|
|
19558
19715
|
] }),
|
|
19559
19716
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
19560
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19717
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19561
19718
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19562
19719
|
labelAcc,
|
|
19563
19720
|
" "
|
|
19564
19721
|
] }),
|
|
19565
19722
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
19566
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19723
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19567
19724
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19568
19725
|
labelRej,
|
|
19569
19726
|
" "
|
|
19570
19727
|
] }),
|
|
19571
19728
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
19572
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19729
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19573
19730
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19574
19731
|
labelUnd,
|
|
19575
19732
|
" "
|
|
19576
19733
|
] }),
|
|
19577
19734
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
19578
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19735
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 })
|
|
19579
19736
|
] }) });
|
|
19580
19737
|
}
|
|
19581
19738
|
|
|
@@ -20566,7 +20723,7 @@ function useImmediateInput(handler, enabled = true) {
|
|
|
20566
20723
|
|
|
20567
20724
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
20568
20725
|
import { useStdout as useStdout2 } from "ink";
|
|
20569
|
-
import { useEffect as
|
|
20726
|
+
import { useEffect as useEffect13, useState as useState14 } from "react";
|
|
20570
20727
|
function readTerminalSize(stdout) {
|
|
20571
20728
|
return {
|
|
20572
20729
|
columns: stdout?.columns ?? 80,
|
|
@@ -20575,8 +20732,8 @@ function readTerminalSize(stdout) {
|
|
|
20575
20732
|
}
|
|
20576
20733
|
function useTerminalSize() {
|
|
20577
20734
|
const { stdout } = useStdout2();
|
|
20578
|
-
const [size, setSize] =
|
|
20579
|
-
|
|
20735
|
+
const [size, setSize] = useState14(() => readTerminalSize(stdout));
|
|
20736
|
+
useEffect13(() => {
|
|
20580
20737
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
20581
20738
|
stdout?.on("resize", updateSize);
|
|
20582
20739
|
updateSize();
|
|
@@ -20759,7 +20916,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
20759
20916
|
}
|
|
20760
20917
|
|
|
20761
20918
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
20762
|
-
import { useEffect as
|
|
20919
|
+
import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState17 } from "react";
|
|
20763
20920
|
|
|
20764
20921
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
|
|
20765
20922
|
var TWO_COLUMN_MIN_WIDTH = 100;
|
|
@@ -21211,15 +21368,15 @@ function resolveGroupRoot(key, closures, cycleSet) {
|
|
|
21211
21368
|
}
|
|
21212
21369
|
|
|
21213
21370
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
21214
|
-
import { useState as
|
|
21371
|
+
import { useState as useState15 } from "react";
|
|
21215
21372
|
function useSidebarSearchState() {
|
|
21216
|
-
const [searchOpen, setSearchOpen] =
|
|
21217
|
-
const [searchQuery, setSearchQuery] =
|
|
21218
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
21219
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
21220
|
-
const [columnOneView, setColumnOneView] =
|
|
21221
|
-
const [activeFilters, setActiveFilters] =
|
|
21222
|
-
const [showHelp, setShowHelp] =
|
|
21373
|
+
const [searchOpen, setSearchOpen] = useState15(false);
|
|
21374
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
21375
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState15([]);
|
|
21376
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState15(null);
|
|
21377
|
+
const [columnOneView, setColumnOneView] = useState15("grouped");
|
|
21378
|
+
const [activeFilters, setActiveFilters] = useState15(/* @__PURE__ */ new Set());
|
|
21379
|
+
const [showHelp, setShowHelp] = useState15(false);
|
|
21223
21380
|
return {
|
|
21224
21381
|
searchOpen,
|
|
21225
21382
|
setSearchOpen,
|
|
@@ -21239,10 +21396,10 @@ function useSidebarSearchState() {
|
|
|
21239
21396
|
}
|
|
21240
21397
|
|
|
21241
21398
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
21242
|
-
import { useCallback, useState as
|
|
21399
|
+
import { useCallback, useState as useState16 } from "react";
|
|
21243
21400
|
function useOverlayPanel(opts) {
|
|
21244
21401
|
const { toggleKey, onClose } = opts;
|
|
21245
|
-
const [isOpen, setIsOpen] =
|
|
21402
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
21246
21403
|
const open = useCallback(() => {
|
|
21247
21404
|
setIsOpen(true);
|
|
21248
21405
|
}, []);
|
|
@@ -21456,16 +21613,16 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21456
21613
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
21457
21614
|
[totalWidth, tokenCount, tokensWidth]
|
|
21458
21615
|
);
|
|
21459
|
-
const [decisions, setDecisions] =
|
|
21460
|
-
const [nav, setNav] =
|
|
21461
|
-
const [focusedColumn, setFocusedColumn] =
|
|
21462
|
-
const [tokensCursor, setTokensCursor] =
|
|
21463
|
-
const [showDependencies, setShowDependencies] =
|
|
21464
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
21465
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
21616
|
+
const [decisions, setDecisions] = useState17(/* @__PURE__ */ new Map());
|
|
21617
|
+
const [nav, setNav] = useState17({ cursor: 0, scrollOffset: 0 });
|
|
21618
|
+
const [focusedColumn, setFocusedColumn] = useState17("main");
|
|
21619
|
+
const [tokensCursor, setTokensCursor] = useState17(0);
|
|
21620
|
+
const [showDependencies, setShowDependencies] = useState17(false);
|
|
21621
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState17(false);
|
|
21622
|
+
const [cyclesCursor, setCyclesCursor] = useState17(0);
|
|
21466
21623
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
21467
|
-
const [aiCursor, setAiCursor] =
|
|
21468
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
21624
|
+
const [aiCursor, setAiCursor] = useState17(0);
|
|
21625
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState17(null);
|
|
21469
21626
|
const search = useSidebarSearchState();
|
|
21470
21627
|
const {
|
|
21471
21628
|
searchOpen,
|
|
@@ -21490,13 +21647,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21490
21647
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
21491
21648
|
[slotCycles]
|
|
21492
21649
|
);
|
|
21493
|
-
const [expandedGroups, setExpandedGroups] =
|
|
21650
|
+
const [expandedGroups, setExpandedGroups] = useState17(() => {
|
|
21494
21651
|
const seed = new Set(closures.keys());
|
|
21495
21652
|
for (const p of cycleParticipants) seed.add(p);
|
|
21496
21653
|
return seed;
|
|
21497
21654
|
});
|
|
21498
21655
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
21499
|
-
|
|
21656
|
+
useEffect14(() => {
|
|
21500
21657
|
if (seededGroupsRef.current) return;
|
|
21501
21658
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
21502
21659
|
seededGroupsRef.current = true;
|
|
@@ -21587,7 +21744,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21587
21744
|
entryCount: 0
|
|
21588
21745
|
});
|
|
21589
21746
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
21590
|
-
|
|
21747
|
+
useEffect14(() => {
|
|
21591
21748
|
setNav((prev) => {
|
|
21592
21749
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
21593
21750
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -21958,7 +22115,7 @@ function ScopeGateScreen({
|
|
|
21958
22115
|
return loaded?.ok ? loaded.rows : [];
|
|
21959
22116
|
}, [tokensPath]);
|
|
21960
22117
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
21961
|
-
|
|
22118
|
+
useEffect15(() => {
|
|
21962
22119
|
startDebugRun({
|
|
21963
22120
|
flow: "import/scope-gate",
|
|
21964
22121
|
step: "07-scope-gate",
|
|
@@ -22080,7 +22237,7 @@ function ScopeGateScreen({
|
|
|
22080
22237
|
|
|
22081
22238
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
22082
22239
|
init_debug_store();
|
|
22083
|
-
import { useEffect as
|
|
22240
|
+
import { useEffect as useEffect16, useMemo as useMemo5, useRef as useRef10, useState as useState18 } from "react";
|
|
22084
22241
|
|
|
22085
22242
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
|
|
22086
22243
|
async function checkGenerationCache(input) {
|
|
@@ -22128,8 +22285,8 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22128
22285
|
const sessionId = input?.sessionId;
|
|
22129
22286
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
22130
22287
|
const cacheCheck = useRef10(void 0);
|
|
22131
|
-
const [confirmed, setConfirmed] =
|
|
22132
|
-
|
|
22288
|
+
const [confirmed, setConfirmed] = useState18();
|
|
22289
|
+
useEffect16(() => {
|
|
22133
22290
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
22134
22291
|
startDebugRun({
|
|
22135
22292
|
flow: "import/scope-gate",
|
|
@@ -22143,7 +22300,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22143
22300
|
exitMethod: "discarded"
|
|
22144
22301
|
});
|
|
22145
22302
|
}, [sessionId, loaded]);
|
|
22146
|
-
|
|
22303
|
+
useEffect16(() => {
|
|
22147
22304
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
22148
22305
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
22149
22306
|
}, [input, loaded]);
|
|
@@ -22258,7 +22415,7 @@ function GenerationScreen({
|
|
|
22258
22415
|
|
|
22259
22416
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22260
22417
|
init_debug_store();
|
|
22261
|
-
import { useEffect as
|
|
22418
|
+
import { useEffect as useEffect17, useRef as useRef11, useState as useState19 } from "react";
|
|
22262
22419
|
|
|
22263
22420
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
22264
22421
|
import { resolve as resolve25 } from "node:path";
|
|
@@ -22428,9 +22585,9 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
22428
22585
|
|
|
22429
22586
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22430
22587
|
function useGeneration(input) {
|
|
22431
|
-
const [state2, setState] =
|
|
22588
|
+
const [state2, setState] = useState19();
|
|
22432
22589
|
const current = useRef11();
|
|
22433
|
-
|
|
22590
|
+
useEffect17(() => {
|
|
22434
22591
|
current.current = input;
|
|
22435
22592
|
if (!input) {
|
|
22436
22593
|
setState(void 0);
|
|
@@ -22466,7 +22623,7 @@ function useGeneration(input) {
|
|
|
22466
22623
|
}
|
|
22467
22624
|
|
|
22468
22625
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
22469
|
-
import { join as
|
|
22626
|
+
import { join as join22 } from "node:path";
|
|
22470
22627
|
function buildFlowStart(input) {
|
|
22471
22628
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
22472
22629
|
const credentials = extraction.credentials ?? {
|
|
@@ -22479,7 +22636,7 @@ function buildFlowStart(input) {
|
|
|
22479
22636
|
handoff,
|
|
22480
22637
|
agent: extraction.agent,
|
|
22481
22638
|
projectPath: extraction.projectPath,
|
|
22482
|
-
outDir: extraction.projectPath ?
|
|
22639
|
+
outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
|
|
22483
22640
|
rawTokensPath: extraction.rawTokensPath,
|
|
22484
22641
|
credentials: {
|
|
22485
22642
|
spaceId: credentials.spaceId,
|
|
@@ -23005,7 +23162,7 @@ function PreviewValidationErrorScreen({
|
|
|
23005
23162
|
}
|
|
23006
23163
|
|
|
23007
23164
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
23008
|
-
import { useCallback as useCallback5, useEffect as
|
|
23165
|
+
import { useCallback as useCallback5, useEffect as useEffect25, useMemo as useMemo6, useRef as useRef17, useState as useState27 } from "react";
|
|
23009
23166
|
import figures8 from "figures";
|
|
23010
23167
|
|
|
23011
23168
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
|
|
@@ -23266,7 +23423,7 @@ function enumerateCycleBreaks(cycle, components) {
|
|
|
23266
23423
|
import { Box as Box32, Text as Text34 } from "ink";
|
|
23267
23424
|
|
|
23268
23425
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
23269
|
-
import React13, { useEffect as
|
|
23426
|
+
import React13, { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState20 } from "react";
|
|
23270
23427
|
import figures6 from "figures";
|
|
23271
23428
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
23272
23429
|
|
|
@@ -23974,11 +24131,11 @@ function FieldEditor({
|
|
|
23974
24131
|
headerHeight = 2
|
|
23975
24132
|
}) {
|
|
23976
24133
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
23977
|
-
const [editorState, setEditorState] =
|
|
23978
|
-
const [parseErr] =
|
|
23979
|
-
const [listScrollStart, setListScrollStart] =
|
|
24134
|
+
const [editorState, setEditorState] = useState20(initialState);
|
|
24135
|
+
const [parseErr] = useState20(parseError);
|
|
24136
|
+
const [listScrollStart, setListScrollStart] = useState20(0);
|
|
23980
24137
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
23981
|
-
const [rowHeights, setRowHeights] =
|
|
24138
|
+
const [rowHeights, setRowHeights] = useState20({});
|
|
23982
24139
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
23983
24140
|
const initialFocus = (() => {
|
|
23984
24141
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -24046,25 +24203,25 @@ function FieldEditor({
|
|
|
24046
24203
|
textCursor: 0
|
|
24047
24204
|
};
|
|
24048
24205
|
})();
|
|
24049
|
-
const [focusLevel, setFocusLevel] =
|
|
24050
|
-
const [propIdx, setPropIdx] =
|
|
24051
|
-
const [slotIdx, setSlotIdx] =
|
|
24052
|
-
const [inSlots, setInSlots] =
|
|
24053
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
24054
|
-
const [activeField, setActiveField] =
|
|
24055
|
-
const [editingField, setEditingField] =
|
|
24056
|
-
const [textCursor, setTextCursor] =
|
|
24057
|
-
const [valueCursor, setValueCursor] =
|
|
24058
|
-
const [editingValue, setEditingValue] =
|
|
24059
|
-
const [valueText, setValueText] =
|
|
24060
|
-
const [pickerCursor, setPickerCursor] =
|
|
24061
|
-
const [validationError, setValidationError] =
|
|
24062
|
-
const [cursorVisible] =
|
|
24063
|
-
const [sourceOpen, setSourceOpen] =
|
|
24064
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
24065
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
24066
|
-
const [showHelp, setShowHelp] =
|
|
24067
|
-
const [pendingDelete, setPendingDelete] =
|
|
24206
|
+
const [focusLevel, setFocusLevel] = useState20(initialFocus.focusLevel);
|
|
24207
|
+
const [propIdx, setPropIdx] = useState20(initialFocus.propIdx);
|
|
24208
|
+
const [slotIdx, setSlotIdx] = useState20(initialFocus.slotIdx);
|
|
24209
|
+
const [inSlots, setInSlots] = useState20(initialFocus.inSlots);
|
|
24210
|
+
const [inComponentDesc, setInComponentDesc] = useState20(initialFocus.focusLevel === "componentDescription");
|
|
24211
|
+
const [activeField, setActiveField] = useState20(initialFocus.activeField);
|
|
24212
|
+
const [editingField, setEditingField] = useState20(false);
|
|
24213
|
+
const [textCursor, setTextCursor] = useState20(initialFocus.textCursor);
|
|
24214
|
+
const [valueCursor, setValueCursor] = useState20(0);
|
|
24215
|
+
const [editingValue, setEditingValue] = useState20(null);
|
|
24216
|
+
const [valueText, setValueText] = useState20("");
|
|
24217
|
+
const [pickerCursor, setPickerCursor] = useState20(0);
|
|
24218
|
+
const [validationError, setValidationError] = useState20(null);
|
|
24219
|
+
const [cursorVisible] = useState20(true);
|
|
24220
|
+
const [sourceOpen, setSourceOpen] = useState20(false);
|
|
24221
|
+
const [rationaleOpen, setRationaleOpen] = useState20(false);
|
|
24222
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState20(0);
|
|
24223
|
+
const [showHelp, setShowHelp] = useState20(false);
|
|
24224
|
+
const [pendingDelete, setPendingDelete] = useState20(null);
|
|
24068
24225
|
const props = editorState.props;
|
|
24069
24226
|
const slots = editorState.slots;
|
|
24070
24227
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -24824,7 +24981,7 @@ function FieldEditor({
|
|
|
24824
24981
|
}
|
|
24825
24982
|
return Math.max(start + 1, end2);
|
|
24826
24983
|
};
|
|
24827
|
-
|
|
24984
|
+
useEffect18(() => {
|
|
24828
24985
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
24829
24986
|
setListScrollStart((previous) => {
|
|
24830
24987
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -25896,7 +26053,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25896
26053
|
}
|
|
25897
26054
|
|
|
25898
26055
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
25899
|
-
import { useCallback as useCallback2, useEffect as
|
|
26056
|
+
import { useCallback as useCallback2, useEffect as useEffect20, useRef as useRef13, useState as useState22 } from "react";
|
|
25900
26057
|
|
|
25901
26058
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
|
|
25902
26059
|
var DEFAULT_MAX_DEPTH = 50;
|
|
@@ -25952,7 +26109,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
|
|
|
25952
26109
|
}
|
|
25953
26110
|
|
|
25954
26111
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
25955
|
-
import { useEffect as
|
|
26112
|
+
import { useEffect as useEffect19, useRef as useRef12, useState as useState21 } from "react";
|
|
25956
26113
|
|
|
25957
26114
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
|
|
25958
26115
|
var TimeoutError = class extends Error {
|
|
@@ -26107,12 +26264,12 @@ function useReviewFinalizePreview({
|
|
|
26107
26264
|
}
|
|
26108
26265
|
function useFinalizePreview(opts) {
|
|
26109
26266
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
26110
|
-
const [status, setStatus] =
|
|
26111
|
-
const [removed, setRemoved] =
|
|
26112
|
-
const [scrollOffset, setScrollOffset] =
|
|
26267
|
+
const [status, setStatus] = useState21("idle");
|
|
26268
|
+
const [removed, setRemoved] = useState21([]);
|
|
26269
|
+
const [scrollOffset, setScrollOffset] = useState21(0);
|
|
26113
26270
|
const generationRef = useRef12(0);
|
|
26114
26271
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
26115
|
-
|
|
26272
|
+
useEffect19(() => {
|
|
26116
26273
|
if (!open) {
|
|
26117
26274
|
setStatus("idle");
|
|
26118
26275
|
setRemoved([]);
|
|
@@ -26162,10 +26319,10 @@ function useReviewSession({
|
|
|
26162
26319
|
tokensPath,
|
|
26163
26320
|
onExtraLoaded
|
|
26164
26321
|
}) {
|
|
26165
|
-
const [components, setComponents] =
|
|
26166
|
-
const [loading, setLoading] =
|
|
26167
|
-
const [loadError, setLoadError] =
|
|
26168
|
-
const [availableTokens, setAvailableTokens] =
|
|
26322
|
+
const [components, setComponents] = useState22([]);
|
|
26323
|
+
const [loading, setLoading] = useState22(true);
|
|
26324
|
+
const [loadError, setLoadError] = useState22(null);
|
|
26325
|
+
const [availableTokens, setAvailableTokens] = useState22([]);
|
|
26169
26326
|
const loadInitialState = useCallback2(async () => {
|
|
26170
26327
|
const result = loadSession();
|
|
26171
26328
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -26175,7 +26332,7 @@ function useReviewSession({
|
|
|
26175
26332
|
}));
|
|
26176
26333
|
return { result, catalog };
|
|
26177
26334
|
}, [loadSession, tokensPath]);
|
|
26178
|
-
|
|
26335
|
+
useEffect20(() => {
|
|
26179
26336
|
let disposed = false;
|
|
26180
26337
|
void (async () => {
|
|
26181
26338
|
try {
|
|
@@ -26226,9 +26383,9 @@ function useReviewSession({
|
|
|
26226
26383
|
};
|
|
26227
26384
|
}
|
|
26228
26385
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
26229
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
26230
|
-
const [componentRationale, setComponentRationale] =
|
|
26231
|
-
|
|
26386
|
+
const [reviewMetadata, setReviewMetadata] = useState22(null);
|
|
26387
|
+
const [componentRationale, setComponentRationale] = useState22(null);
|
|
26388
|
+
useEffect20(() => {
|
|
26232
26389
|
const current = components[selectedIdx];
|
|
26233
26390
|
if (!current) {
|
|
26234
26391
|
setReviewMetadata(null);
|
|
@@ -26266,7 +26423,7 @@ function useReviewHistory({
|
|
|
26266
26423
|
}) {
|
|
26267
26424
|
const historyRef = useRef13(null);
|
|
26268
26425
|
const historySeededRef = useRef13(false);
|
|
26269
|
-
|
|
26426
|
+
useEffect20(() => {
|
|
26270
26427
|
if (loading || historySeededRef.current) return;
|
|
26271
26428
|
historySeededRef.current = true;
|
|
26272
26429
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -26322,7 +26479,7 @@ function useReviewFinalize({
|
|
|
26322
26479
|
}
|
|
26323
26480
|
|
|
26324
26481
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
26325
|
-
import { useEffect as
|
|
26482
|
+
import { useEffect as useEffect21, useRef as useRef14, useState as useState23 } from "react";
|
|
26326
26483
|
|
|
26327
26484
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
|
|
26328
26485
|
function collectTokenSuggestions(entry, availableTokens = []) {
|
|
@@ -26361,21 +26518,21 @@ function useReviewEditor({
|
|
|
26361
26518
|
onEditSaved,
|
|
26362
26519
|
onTokenSaved
|
|
26363
26520
|
}) {
|
|
26364
|
-
const [panelOpen, setPanelOpen] =
|
|
26365
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
26366
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
26367
|
-
const [textEntryActive, setTextEntryActive] =
|
|
26368
|
-
const [showJson, setShowJson] =
|
|
26369
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
26370
|
-
const [draftValue, setDraftValue] =
|
|
26371
|
-
const [saveError, setSaveError] =
|
|
26372
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
26373
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
26374
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
26375
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
26521
|
+
const [panelOpen, setPanelOpen] = useState23("none");
|
|
26522
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState23(0);
|
|
26523
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState23(0);
|
|
26524
|
+
const [textEntryActive, setTextEntryActive] = useState23(false);
|
|
26525
|
+
const [showJson, setShowJson] = useState23(false);
|
|
26526
|
+
const [showHiddenProps, setShowHiddenProps] = useState23(false);
|
|
26527
|
+
const [draftValue, setDraftValue] = useState23("");
|
|
26528
|
+
const [saveError, setSaveError] = useState23(null);
|
|
26529
|
+
const [tokenReviewRow, setTokenReviewRow] = useState23(0);
|
|
26530
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState23(false);
|
|
26531
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState23(0);
|
|
26532
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState23(/* @__PURE__ */ new Set());
|
|
26376
26533
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
26377
26534
|
const pendingGRef = useRef14(false);
|
|
26378
|
-
|
|
26535
|
+
useEffect21(() => {
|
|
26379
26536
|
setTokenReviewRow(0);
|
|
26380
26537
|
setTokenReviewEditing(false);
|
|
26381
26538
|
setTokenReviewEditCursor(0);
|
|
@@ -26488,12 +26645,12 @@ function useReviewEditor({
|
|
|
26488
26645
|
}
|
|
26489
26646
|
|
|
26490
26647
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
26491
|
-
import { useState as
|
|
26648
|
+
import { useState as useState24 } from "react";
|
|
26492
26649
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
26493
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
26494
|
-
const [showFinalize, setShowFinalize] =
|
|
26495
|
-
const [showQuit, setShowQuit] =
|
|
26496
|
-
const [finalizeError, setFinalizeError] =
|
|
26650
|
+
const [sidebarFocused, setSidebarFocused] = useState24(true);
|
|
26651
|
+
const [showFinalize, setShowFinalize] = useState24(false);
|
|
26652
|
+
const [showQuit, setShowQuit] = useState24(false);
|
|
26653
|
+
const [finalizeError, setFinalizeError] = useState24(initialFinalizeError);
|
|
26497
26654
|
return {
|
|
26498
26655
|
sidebarFocused,
|
|
26499
26656
|
setSidebarFocused,
|
|
@@ -26787,7 +26944,7 @@ function handleJsonPanelInput(input, key, state2) {
|
|
|
26787
26944
|
}
|
|
26788
26945
|
|
|
26789
26946
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
26790
|
-
import { useCallback as useCallback4, useEffect as
|
|
26947
|
+
import { useCallback as useCallback4, useEffect as useEffect23, useState as useState26 } from "react";
|
|
26791
26948
|
|
|
26792
26949
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
|
|
26793
26950
|
function applyPreviewAnnotations(preview, localNames) {
|
|
@@ -26822,25 +26979,25 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26822
26979
|
}
|
|
26823
26980
|
|
|
26824
26981
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
26825
|
-
import { useCallback as useCallback3, useEffect as
|
|
26982
|
+
import { useCallback as useCallback3, useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
|
|
26826
26983
|
var DEFAULT_DEBOUNCE_MS = 500;
|
|
26827
26984
|
function useLivePreview(opts) {
|
|
26828
26985
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
26829
|
-
const [status, setStatus] =
|
|
26830
|
-
const [disabled, setDisabled] =
|
|
26986
|
+
const [status, setStatus] = useState25("idle");
|
|
26987
|
+
const [disabled, setDisabled] = useState25(false);
|
|
26831
26988
|
const timerRef = useRef15(null);
|
|
26832
26989
|
const generationRef = useRef15(0);
|
|
26833
26990
|
const latestRef = useRef15(0);
|
|
26834
26991
|
const inflightRef = useRef15(0);
|
|
26835
26992
|
const optsRef = useRef15(opts);
|
|
26836
|
-
|
|
26993
|
+
useEffect22(() => {
|
|
26837
26994
|
optsRef.current = opts;
|
|
26838
26995
|
});
|
|
26839
26996
|
const disabledRef = useRef15(disabled);
|
|
26840
|
-
|
|
26997
|
+
useEffect22(() => {
|
|
26841
26998
|
disabledRef.current = disabled;
|
|
26842
26999
|
}, [disabled]);
|
|
26843
|
-
|
|
27000
|
+
useEffect22(() => {
|
|
26844
27001
|
return () => {
|
|
26845
27002
|
if (timerRef.current) {
|
|
26846
27003
|
clearTimeout(timerRef.current);
|
|
@@ -26926,8 +27083,8 @@ function useReviewPreview({
|
|
|
26926
27083
|
deleteAllComponents,
|
|
26927
27084
|
onResult
|
|
26928
27085
|
}) {
|
|
26929
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
26930
|
-
const [removedComponents, setRemovedComponents] =
|
|
27086
|
+
const [previewAnnotations, setPreviewAnnotations] = useState26(/* @__PURE__ */ new Map());
|
|
27087
|
+
const [removedComponents, setRemovedComponents] = useState26([]);
|
|
26931
27088
|
const handleResult = useCallback4(
|
|
26932
27089
|
(response) => {
|
|
26933
27090
|
if (!response) return;
|
|
@@ -26953,14 +27110,14 @@ function useReviewPreview({
|
|
|
26953
27110
|
onResult: handleResult,
|
|
26954
27111
|
deleteAllComponents
|
|
26955
27112
|
});
|
|
26956
|
-
const [spinnerTick, setSpinnerTick] =
|
|
26957
|
-
|
|
27113
|
+
const [spinnerTick, setSpinnerTick] = useState26(0);
|
|
27114
|
+
useEffect23(() => {
|
|
26958
27115
|
if (livePreviewHook.status !== "running") return;
|
|
26959
27116
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
26960
27117
|
return () => clearInterval(id);
|
|
26961
27118
|
}, [livePreviewHook.status]);
|
|
26962
27119
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
26963
|
-
|
|
27120
|
+
useEffect23(() => {
|
|
26964
27121
|
if (loading) return;
|
|
26965
27122
|
if (!livePreview) return;
|
|
26966
27123
|
if (components.length === 0) return;
|
|
@@ -26971,7 +27128,7 @@ function useReviewPreview({
|
|
|
26971
27128
|
|
|
26972
27129
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
26973
27130
|
init_debug_store();
|
|
26974
|
-
import { useEffect as
|
|
27131
|
+
import { useEffect as useEffect24, useRef as useRef16 } from "react";
|
|
26975
27132
|
|
|
26976
27133
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
|
|
26977
27134
|
var REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
|
|
@@ -27043,7 +27200,7 @@ function useReviewLog({
|
|
|
27043
27200
|
const started = useRef16(false);
|
|
27044
27201
|
const latest = useRef16(components);
|
|
27045
27202
|
latest.current = components;
|
|
27046
|
-
|
|
27203
|
+
useEffect24(() => {
|
|
27047
27204
|
if (loading || started.current) return;
|
|
27048
27205
|
started.current = true;
|
|
27049
27206
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -27058,7 +27215,7 @@ function useReviewLog({
|
|
|
27058
27215
|
trail.current = openReviewTrail(components, Date.now());
|
|
27059
27216
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
27060
27217
|
}, [loading, loadError, components]);
|
|
27061
|
-
|
|
27218
|
+
useEffect24(
|
|
27062
27219
|
() => () => {
|
|
27063
27220
|
const open = trail.current;
|
|
27064
27221
|
trail.current = void 0;
|
|
@@ -27335,7 +27492,7 @@ function GenerateReviewStepView({
|
|
|
27335
27492
|
initialFinalizeError = null
|
|
27336
27493
|
}) {
|
|
27337
27494
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
27338
|
-
const [slotCycles, setSlotCycles] =
|
|
27495
|
+
const [slotCycles, setSlotCycles] = useState27([]);
|
|
27339
27496
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
27340
27497
|
setSlotCycles(cycles ?? []);
|
|
27341
27498
|
}, []);
|
|
@@ -27368,7 +27525,7 @@ function GenerateReviewStepView({
|
|
|
27368
27525
|
onExtraLoaded: setLoadedSlotCycles
|
|
27369
27526
|
});
|
|
27370
27527
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
27371
|
-
const [nav, setNav] =
|
|
27528
|
+
const [nav, setNav] = useState27({
|
|
27372
27529
|
cursorRowIdx: 0,
|
|
27373
27530
|
sidebarScrollOffset: 0
|
|
27374
27531
|
});
|
|
@@ -27384,10 +27541,10 @@ function GenerateReviewStepView({
|
|
|
27384
27541
|
finalizeError,
|
|
27385
27542
|
setFinalizeError
|
|
27386
27543
|
} = reviewSurface;
|
|
27387
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
27544
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState27(false);
|
|
27388
27545
|
const removedBannerDefaultedRef = useRef17(false);
|
|
27389
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
27390
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
27546
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState27(0);
|
|
27547
|
+
const [cyclesCursor, setCyclesCursor] = useState27(0);
|
|
27391
27548
|
const cyclePanel = useOverlayPanel({
|
|
27392
27549
|
toggleKey: "c",
|
|
27393
27550
|
onClose: () => {
|
|
@@ -27402,9 +27559,9 @@ function GenerateReviewStepView({
|
|
|
27402
27559
|
setBreakConfirm(false);
|
|
27403
27560
|
}
|
|
27404
27561
|
});
|
|
27405
|
-
const [breakCursor, setBreakCursor] =
|
|
27406
|
-
const [breakConfirm, setBreakConfirm] =
|
|
27407
|
-
const [expandedGroups, setExpandedGroups] =
|
|
27562
|
+
const [breakCursor, setBreakCursor] = useState27(0);
|
|
27563
|
+
const [breakConfirm, setBreakConfirm] = useState27(false);
|
|
27564
|
+
const [expandedGroups, setExpandedGroups] = useState27(/* @__PURE__ */ new Set());
|
|
27408
27565
|
const seededGroupsRef = useRef17(false);
|
|
27409
27566
|
const {
|
|
27410
27567
|
searchOpen,
|
|
@@ -27423,14 +27580,14 @@ function GenerateReviewStepView({
|
|
|
27423
27580
|
setShowHelp
|
|
27424
27581
|
} = useSidebarSearchState();
|
|
27425
27582
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
27426
|
-
const [breakingChanges, setBreakingChanges] =
|
|
27427
|
-
const [breakingCursor, setBreakingCursor] =
|
|
27428
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
27429
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
27430
|
-
const [autoRejected, setAutoRejected] =
|
|
27431
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
27583
|
+
const [breakingChanges, setBreakingChanges] = useState27([]);
|
|
27584
|
+
const [breakingCursor, setBreakingCursor] = useState27(0);
|
|
27585
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState27(false);
|
|
27586
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState27(null);
|
|
27587
|
+
const [autoRejected, setAutoRejected] = useState27([]);
|
|
27588
|
+
const [undoSnapshot, setUndoSnapshot] = useState27(null);
|
|
27432
27589
|
const autoRejectFiredRef = useRef17(false);
|
|
27433
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
27590
|
+
const [showReloadDialog, setShowReloadDialog] = useState27(false);
|
|
27434
27591
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
27435
27592
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
27436
27593
|
components,
|
|
@@ -27495,7 +27652,7 @@ function GenerateReviewStepView({
|
|
|
27495
27652
|
[components]
|
|
27496
27653
|
);
|
|
27497
27654
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
27498
|
-
|
|
27655
|
+
useEffect25(() => {
|
|
27499
27656
|
if (seededGroupsRef.current) return;
|
|
27500
27657
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
27501
27658
|
seededGroupsRef.current = true;
|
|
@@ -27522,7 +27679,7 @@ function GenerateReviewStepView({
|
|
|
27522
27679
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
27523
27680
|
}));
|
|
27524
27681
|
}, [slotCycles, cycleView]);
|
|
27525
|
-
|
|
27682
|
+
useEffect25(() => {
|
|
27526
27683
|
const decision = computeAutoRejectDecision({
|
|
27527
27684
|
loading,
|
|
27528
27685
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -27567,7 +27724,7 @@ function GenerateReviewStepView({
|
|
|
27567
27724
|
onAction: reviewLog.record
|
|
27568
27725
|
});
|
|
27569
27726
|
const autoRejectPushedRef = useRef17(false);
|
|
27570
|
-
|
|
27727
|
+
useEffect25(() => {
|
|
27571
27728
|
if (loading) return;
|
|
27572
27729
|
if (!historySeededRef.current) return;
|
|
27573
27730
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -27651,7 +27808,7 @@ function GenerateReviewStepView({
|
|
|
27651
27808
|
const panelHeight = leftPanelHeight + 2;
|
|
27652
27809
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
27653
27810
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
27654
|
-
|
|
27811
|
+
useEffect25(() => {
|
|
27655
27812
|
if (selectableRowPositions.length === 0) return;
|
|
27656
27813
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
27657
27814
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -28572,10 +28729,10 @@ function DoneStep({
|
|
|
28572
28729
|
}
|
|
28573
28730
|
|
|
28574
28731
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
28575
|
-
import { useState as
|
|
28732
|
+
import { useState as useState29 } from "react";
|
|
28576
28733
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
28577
28734
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
28578
|
-
import { dirname as
|
|
28735
|
+
import { dirname as dirname18, basename as basename7, join as join23 } from "node:path";
|
|
28579
28736
|
|
|
28580
28737
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
28581
28738
|
import { resolve as resolve26 } from "node:path";
|
|
@@ -28596,10 +28753,10 @@ function normalizePath(input) {
|
|
|
28596
28753
|
}
|
|
28597
28754
|
|
|
28598
28755
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
28599
|
-
import { useEffect as
|
|
28756
|
+
import { useEffect as useEffect26, useState as useState28 } from "react";
|
|
28600
28757
|
function useBlinkingCursor() {
|
|
28601
|
-
const [visible, setVisible] =
|
|
28602
|
-
|
|
28758
|
+
const [visible, setVisible] = useState28(true);
|
|
28759
|
+
useEffect26(() => {
|
|
28603
28760
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
28604
28761
|
return () => clearInterval(interval);
|
|
28605
28762
|
}, []);
|
|
@@ -28611,8 +28768,8 @@ import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
|
28611
28768
|
function autocomplete(partial) {
|
|
28612
28769
|
if (!partial) return null;
|
|
28613
28770
|
const normalized = normalizePath(partial);
|
|
28614
|
-
const dir =
|
|
28615
|
-
const base =
|
|
28771
|
+
const dir = dirname18(normalized);
|
|
28772
|
+
const base = basename7(normalized);
|
|
28616
28773
|
let entries;
|
|
28617
28774
|
try {
|
|
28618
28775
|
entries = readdirSync4(dir);
|
|
@@ -28621,13 +28778,13 @@ function autocomplete(partial) {
|
|
|
28621
28778
|
}
|
|
28622
28779
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
28623
28780
|
if (matches.length === 0) return null;
|
|
28624
|
-
if (matches.length === 1) return
|
|
28781
|
+
if (matches.length === 1) return join23(dir, matches[0]);
|
|
28625
28782
|
let prefix = matches[0];
|
|
28626
28783
|
for (const m of matches) {
|
|
28627
28784
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
28628
28785
|
if (!prefix) break;
|
|
28629
28786
|
}
|
|
28630
|
-
return prefix.length > base.length ?
|
|
28787
|
+
return prefix.length > base.length ? join23(dir, prefix) : null;
|
|
28631
28788
|
}
|
|
28632
28789
|
function PathPrompt({
|
|
28633
28790
|
defaultPath,
|
|
@@ -28636,7 +28793,7 @@ function PathPrompt({
|
|
|
28636
28793
|
label = "Save to",
|
|
28637
28794
|
summary
|
|
28638
28795
|
}) {
|
|
28639
|
-
const [input, setInput] =
|
|
28796
|
+
const [input, setInput] = useState29("");
|
|
28640
28797
|
const cursorVisible = useBlinkingCursor();
|
|
28641
28798
|
useImmediateInput((rawInput, key) => {
|
|
28642
28799
|
if (key.return) {
|
|
@@ -28715,12 +28872,12 @@ function countedThings({ components, tokens }, counts = {}) {
|
|
|
28715
28872
|
}
|
|
28716
28873
|
|
|
28717
28874
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
28718
|
-
import { useEffect as
|
|
28875
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
28719
28876
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
28720
28877
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
28721
28878
|
function useTimedSpinner() {
|
|
28722
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
28723
|
-
|
|
28879
|
+
const [elapsedSeconds, setElapsedSeconds] = useState30(0);
|
|
28880
|
+
useEffect27(() => {
|
|
28724
28881
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
28725
28882
|
return () => {
|
|
28726
28883
|
clearInterval(timer);
|
|
@@ -28782,7 +28939,7 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28782
28939
|
}
|
|
28783
28940
|
|
|
28784
28941
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
28785
|
-
import { useEffect as
|
|
28942
|
+
import { useEffect as useEffect28, useState as useState31, useMemo as useMemo7 } from "react";
|
|
28786
28943
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
28787
28944
|
|
|
28788
28945
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
|
|
@@ -29161,8 +29318,8 @@ function WizardPreviewStep({
|
|
|
29161
29318
|
onQuit
|
|
29162
29319
|
}) {
|
|
29163
29320
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
29164
|
-
const [diffExpanded, setDiffExpanded] =
|
|
29165
|
-
const [scrollOffset, setScrollOffset] =
|
|
29321
|
+
const [diffExpanded, setDiffExpanded] = useState31(false);
|
|
29322
|
+
const [scrollOffset, setScrollOffset] = useState31(0);
|
|
29166
29323
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
29167
29324
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
29168
29325
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -29177,7 +29334,7 @@ function WizardPreviewStep({
|
|
|
29177
29334
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
29178
29335
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
29179
29336
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
29180
|
-
|
|
29337
|
+
useEffect28(() => {
|
|
29181
29338
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
29182
29339
|
}, [maxScroll]);
|
|
29183
29340
|
useImmediateInput((input, key) => {
|
|
@@ -29269,7 +29426,7 @@ function buildRunTeaserLine(runId) {
|
|
|
29269
29426
|
|
|
29270
29427
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
29271
29428
|
init_debug_store();
|
|
29272
|
-
import { useEffect as
|
|
29429
|
+
import { useEffect as useEffect29, useRef as useRef18 } from "react";
|
|
29273
29430
|
|
|
29274
29431
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
29275
29432
|
var FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
@@ -29424,7 +29581,7 @@ function flowFinish(trail, final, now) {
|
|
|
29424
29581
|
function useFlowLog(state2) {
|
|
29425
29582
|
const trail = useRef18(void 0);
|
|
29426
29583
|
const previous = useRef18(void 0);
|
|
29427
|
-
|
|
29584
|
+
useEffect29(() => {
|
|
29428
29585
|
const before = previous.current;
|
|
29429
29586
|
previous.current = state2;
|
|
29430
29587
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -29447,7 +29604,7 @@ function useFlowLog(state2) {
|
|
|
29447
29604
|
trail.current = open;
|
|
29448
29605
|
setDebugRunProgress(flowProgress(open, now));
|
|
29449
29606
|
}, [state2]);
|
|
29450
|
-
|
|
29607
|
+
useEffect29(
|
|
29451
29608
|
() => () => {
|
|
29452
29609
|
const open = trail.current;
|
|
29453
29610
|
trail.current = void 0;
|
|
@@ -29586,13 +29743,13 @@ function FlowScreen({
|
|
|
29586
29743
|
}
|
|
29587
29744
|
|
|
29588
29745
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
29589
|
-
import { useEffect as
|
|
29746
|
+
import { useEffect as useEffect30, useRef as useRef19, useSyncExternalStore } from "react";
|
|
29590
29747
|
|
|
29591
29748
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
29592
29749
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
29593
29750
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
29594
29751
|
import { tmpdir } from "node:os";
|
|
29595
|
-
import { join as
|
|
29752
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
29596
29753
|
|
|
29597
29754
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
29598
29755
|
function shouldBypassPreview(state2) {
|
|
@@ -29941,8 +30098,8 @@ function pushFailure(e, deps) {
|
|
|
29941
30098
|
}
|
|
29942
30099
|
|
|
29943
30100
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
29944
|
-
import { writeFile as
|
|
29945
|
-
import { join as
|
|
30101
|
+
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
30102
|
+
import { join as join24 } from "node:path";
|
|
29946
30103
|
|
|
29947
30104
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
|
|
29948
30105
|
function nextStateAfterPrint(opts) {
|
|
@@ -29966,7 +30123,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
29966
30123
|
var realSaveDeps = () => ({
|
|
29967
30124
|
openDb: openPipelineDb,
|
|
29968
30125
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
29969
|
-
writeFile: (path5, contents) =>
|
|
30126
|
+
writeFile: (path5, contents) => writeFile9(path5, contents),
|
|
29970
30127
|
appendRun,
|
|
29971
30128
|
buildSourceFingerprint,
|
|
29972
30129
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -29974,7 +30131,7 @@ var realSaveDeps = () => ({
|
|
|
29974
30131
|
});
|
|
29975
30132
|
async function runPrintFiles(input, deps, onPatch) {
|
|
29976
30133
|
onPatch({ step: "printing" });
|
|
29977
|
-
const componentsPath =
|
|
30134
|
+
const componentsPath = join24(input.outDir, "components.json");
|
|
29978
30135
|
try {
|
|
29979
30136
|
const db = deps.openDb();
|
|
29980
30137
|
let components = [];
|
|
@@ -30059,7 +30216,7 @@ var EMPTY_PUSH_RESULT = {
|
|
|
30059
30216
|
};
|
|
30060
30217
|
|
|
30061
30218
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
30062
|
-
var WIZARD_LOG =
|
|
30219
|
+
var WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
30063
30220
|
function appendWizardLog(entry) {
|
|
30064
30221
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
30065
30222
|
}
|
|
@@ -30352,14 +30509,14 @@ function useFlow(start, options = {}) {
|
|
|
30352
30509
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
30353
30510
|
() => current?.getState()
|
|
30354
30511
|
);
|
|
30355
|
-
|
|
30512
|
+
useEffect30(() => {
|
|
30356
30513
|
if (!start) controller.current = void 0;
|
|
30357
30514
|
}, [start]);
|
|
30358
30515
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
30359
30516
|
}
|
|
30360
30517
|
|
|
30361
30518
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
30362
|
-
import { useEffect as
|
|
30519
|
+
import { useEffect as useEffect31, useState as useState32 } from "react";
|
|
30363
30520
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
30364
30521
|
init_debug_store();
|
|
30365
30522
|
|
|
@@ -30370,7 +30527,7 @@ init_debug_mode_store();
|
|
|
30370
30527
|
init_version();
|
|
30371
30528
|
|
|
30372
30529
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
30373
|
-
import { join as
|
|
30530
|
+
import { join as join26, resolve as resolve28 } from "node:path";
|
|
30374
30531
|
function describeFileLocations({
|
|
30375
30532
|
contentfulBaseDir,
|
|
30376
30533
|
debugModeEnabled,
|
|
@@ -30379,14 +30536,14 @@ function describeFileLocations({
|
|
|
30379
30536
|
if (!debugModeEnabled) {
|
|
30380
30537
|
return {
|
|
30381
30538
|
debugLogs: "none while Debug Mode is off",
|
|
30382
|
-
importFiles: `${
|
|
30539
|
+
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
30383
30540
|
};
|
|
30384
30541
|
}
|
|
30385
30542
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
30386
|
-
const session = currentSessionDir2 ??
|
|
30543
|
+
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
30387
30544
|
return {
|
|
30388
|
-
debugLogs:
|
|
30389
|
-
importFiles: `${
|
|
30545
|
+
debugLogs: join26(session, "debug"),
|
|
30546
|
+
importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
30390
30547
|
};
|
|
30391
30548
|
}
|
|
30392
30549
|
|
|
@@ -30432,8 +30589,8 @@ function Section({ title, rows }) {
|
|
|
30432
30589
|
] });
|
|
30433
30590
|
}
|
|
30434
30591
|
function HelpScreen({ onDone }) {
|
|
30435
|
-
const [info, setInfo] =
|
|
30436
|
-
|
|
30592
|
+
const [info, setInfo] = useState32();
|
|
30593
|
+
useEffect31(() => {
|
|
30437
30594
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
30438
30595
|
void readHelpInfo().then(setInfo);
|
|
30439
30596
|
}, []);
|
|
@@ -30471,14 +30628,14 @@ function HelpScreen({ onDone }) {
|
|
|
30471
30628
|
}
|
|
30472
30629
|
|
|
30473
30630
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
30474
|
-
import { useState as
|
|
30631
|
+
import { useState as useState33 } from "react";
|
|
30475
30632
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
30476
30633
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
30477
30634
|
function SettingsScreen({
|
|
30478
30635
|
onNavigate,
|
|
30479
30636
|
onBack
|
|
30480
30637
|
}) {
|
|
30481
|
-
const [focusIdx, setFocusIdx] =
|
|
30638
|
+
const [focusIdx, setFocusIdx] = useState33(0);
|
|
30482
30639
|
const items = [
|
|
30483
30640
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
30484
30641
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -30526,11 +30683,11 @@ function SettingsScreen({
|
|
|
30526
30683
|
}
|
|
30527
30684
|
|
|
30528
30685
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
30529
|
-
import { useState as
|
|
30686
|
+
import { useState as useState37 } from "react";
|
|
30530
30687
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
30531
30688
|
|
|
30532
30689
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
30533
|
-
import { useEffect as
|
|
30690
|
+
import { useEffect as useEffect33, useRef as useRef20, useState as useState35 } from "react";
|
|
30534
30691
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
30535
30692
|
init_debug_store();
|
|
30536
30693
|
|
|
@@ -30826,7 +30983,7 @@ async function writeAgentConfig(config) {
|
|
|
30826
30983
|
}
|
|
30827
30984
|
|
|
30828
30985
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30829
|
-
import { useEffect as
|
|
30986
|
+
import { useEffect as useEffect32, useState as useState34 } from "react";
|
|
30830
30987
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
30831
30988
|
|
|
30832
30989
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
@@ -30885,11 +31042,11 @@ function AgentDetail({
|
|
|
30885
31042
|
record: record3
|
|
30886
31043
|
}) {
|
|
30887
31044
|
const settings = config.agents[name];
|
|
30888
|
-
const [saving, setSaving] =
|
|
30889
|
-
const [testing, setTesting] =
|
|
30890
|
-
const [notice, setNotice] =
|
|
30891
|
-
const [checks, setChecks] =
|
|
30892
|
-
|
|
31045
|
+
const [saving, setSaving] = useState34(false);
|
|
31046
|
+
const [testing, setTesting] = useState34(false);
|
|
31047
|
+
const [notice, setNotice] = useState34(null);
|
|
31048
|
+
const [checks, setChecks] = useState34(void 0);
|
|
31049
|
+
useEffect32(() => {
|
|
30893
31050
|
let active = true;
|
|
30894
31051
|
setChecks(void 0);
|
|
30895
31052
|
const timer = setTimeout(() => {
|
|
@@ -30967,13 +31124,13 @@ import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-
|
|
|
30967
31124
|
var NAME_WIDTH = 16;
|
|
30968
31125
|
var PANEL_LABEL_WIDTH = "Command".length;
|
|
30969
31126
|
function AgentsScreen({ onDone }) {
|
|
30970
|
-
const [config, setConfig] =
|
|
30971
|
-
const [focus, setFocus] =
|
|
30972
|
-
const [open, setOpen] =
|
|
30973
|
-
const [notice, setNotice] =
|
|
30974
|
-
const [saving, setSaving] =
|
|
30975
|
-
const [loadError, setLoadError] =
|
|
30976
|
-
const [checks, setChecks] =
|
|
31127
|
+
const [config, setConfig] = useState35(null);
|
|
31128
|
+
const [focus, setFocus] = useState35(0);
|
|
31129
|
+
const [open, setOpen] = useState35(null);
|
|
31130
|
+
const [notice, setNotice] = useState35(null);
|
|
31131
|
+
const [saving, setSaving] = useState35(false);
|
|
31132
|
+
const [loadError, setLoadError] = useState35(null);
|
|
31133
|
+
const [checks, setChecks] = useState35({});
|
|
30977
31134
|
const visit = useRef20({
|
|
30978
31135
|
trail: createTrail(),
|
|
30979
31136
|
before: void 0,
|
|
@@ -30987,7 +31144,7 @@ function AgentsScreen({ onDone }) {
|
|
|
30987
31144
|
);
|
|
30988
31145
|
}
|
|
30989
31146
|
};
|
|
30990
|
-
|
|
31147
|
+
useEffect33(() => {
|
|
30991
31148
|
readAgentConfig().then((loaded) => {
|
|
30992
31149
|
setConfig(loaded);
|
|
30993
31150
|
inspectAll(loaded);
|
|
@@ -31164,7 +31321,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31164
31321
|
}
|
|
31165
31322
|
|
|
31166
31323
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
31167
|
-
import { useEffect as
|
|
31324
|
+
import { useEffect as useEffect34, useRef as useRef21, useState as useState36 } from "react";
|
|
31168
31325
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
31169
31326
|
init_debug_store();
|
|
31170
31327
|
|
|
@@ -31218,10 +31375,10 @@ function debugFields(config) {
|
|
|
31218
31375
|
var snapshotOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31219
31376
|
var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31220
31377
|
function ProjectScreen({ onDone }) {
|
|
31221
|
-
const [config, setConfig] =
|
|
31222
|
-
const [saving, setSaving] =
|
|
31223
|
-
const [notice, setNotice] =
|
|
31224
|
-
const [loadError, setLoadError] =
|
|
31378
|
+
const [config, setConfig] = useState36(null);
|
|
31379
|
+
const [saving, setSaving] = useState36(false);
|
|
31380
|
+
const [notice, setNotice] = useState36(null);
|
|
31381
|
+
const [loadError, setLoadError] = useState36(null);
|
|
31225
31382
|
const visit = useRef21({
|
|
31226
31383
|
trail: createTrail(),
|
|
31227
31384
|
before: void 0,
|
|
@@ -31229,7 +31386,7 @@ function ProjectScreen({ onDone }) {
|
|
|
31229
31386
|
error: ""
|
|
31230
31387
|
}).current;
|
|
31231
31388
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
31232
|
-
|
|
31389
|
+
useEffect34(() => {
|
|
31233
31390
|
readCredentials().then((cfg) => {
|
|
31234
31391
|
setConfig(cfg);
|
|
31235
31392
|
visit.before = snapshotOf(cfg);
|
|
@@ -31337,8 +31494,8 @@ var SECTIONS = [
|
|
|
31337
31494
|
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
31338
31495
|
];
|
|
31339
31496
|
function ConfigurationScreen({ onDone }) {
|
|
31340
|
-
const [focus, setFocus] =
|
|
31341
|
-
const [open, setOpen] =
|
|
31497
|
+
const [focus, setFocus] = useState37(0);
|
|
31498
|
+
const [open, setOpen] = useState37(null);
|
|
31342
31499
|
const close = () => setOpen(null);
|
|
31343
31500
|
useInput17((input, key) => {
|
|
31344
31501
|
if (open) return;
|
|
@@ -31381,7 +31538,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
31381
31538
|
}
|
|
31382
31539
|
|
|
31383
31540
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
31384
|
-
import { useEffect as
|
|
31541
|
+
import { useEffect as useEffect35, useState as useState38 } from "react";
|
|
31385
31542
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
31386
31543
|
|
|
31387
31544
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
@@ -31403,9 +31560,9 @@ async function writeAnalyticsSetting(setting) {
|
|
|
31403
31560
|
init_debug_store();
|
|
31404
31561
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
31405
31562
|
function OptInAnalyticsScreen({ onDone }) {
|
|
31406
|
-
const [loading, setLoading] =
|
|
31407
|
-
const [enabled, setEnabled] =
|
|
31408
|
-
|
|
31563
|
+
const [loading, setLoading] = useState38(true);
|
|
31564
|
+
const [enabled, setEnabled] = useState38(true);
|
|
31565
|
+
useEffect35(() => {
|
|
31409
31566
|
readAnalyticsSetting().then((setting) => {
|
|
31410
31567
|
setEnabled(setting.enabled);
|
|
31411
31568
|
setLoading(false);
|
|
@@ -31459,7 +31616,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
31459
31616
|
}
|
|
31460
31617
|
|
|
31461
31618
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
31462
|
-
import { useEffect as
|
|
31619
|
+
import { useEffect as useEffect36, useRef as useRef22, useState as useState39 } from "react";
|
|
31463
31620
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
31464
31621
|
init_debug_mode_store();
|
|
31465
31622
|
init_debug_store();
|
|
@@ -31470,14 +31627,14 @@ var snapshotOf2 = (setting) => ({
|
|
|
31470
31627
|
retentionDays: String(setting.retentionDays)
|
|
31471
31628
|
});
|
|
31472
31629
|
function DebugModeScreen({ onDone }) {
|
|
31473
|
-
const [setting, setSetting] =
|
|
31474
|
-
const [focus, setFocus] =
|
|
31475
|
-
const [pending, setPending] =
|
|
31630
|
+
const [setting, setSetting] = useState39(null);
|
|
31631
|
+
const [focus, setFocus] = useState39("enabled");
|
|
31632
|
+
const [pending, setPending] = useState39(
|
|
31476
31633
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
31477
31634
|
);
|
|
31478
|
-
const [notice, setNotice] =
|
|
31635
|
+
const [notice, setNotice] = useState39(null);
|
|
31479
31636
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
31480
|
-
|
|
31637
|
+
useEffect36(() => {
|
|
31481
31638
|
readDebugModeSetting().then((loaded) => {
|
|
31482
31639
|
setSetting(loaded);
|
|
31483
31640
|
setPending(loaded.retentionDays);
|
|
@@ -31601,18 +31758,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
31601
31758
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
31602
31759
|
var TOKENS_ONLY_HIDDEN_STEPS = ["extraction", "scope-gate"];
|
|
31603
31760
|
function App({ importOptions, inkClear }) {
|
|
31604
|
-
const [screen, setScreen] =
|
|
31605
|
-
const [importExitCode, setImportExitCode] =
|
|
31761
|
+
const [screen, setScreen] = useState40("start");
|
|
31762
|
+
const [importExitCode, setImportExitCode] = useState40();
|
|
31606
31763
|
const showImportResult = importExitCode !== void 0;
|
|
31607
|
-
const [target, setTarget] =
|
|
31608
|
-
const [answers, setAnswers] =
|
|
31764
|
+
const [target, setTarget] = useState40();
|
|
31765
|
+
const [answers, setAnswers] = useState40({});
|
|
31609
31766
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
31610
|
-
const [extractionRun, setExtractionRun] =
|
|
31767
|
+
const [extractionRun, setExtractionRun] = useState40();
|
|
31611
31768
|
const extraction = useExtraction(extractionRun?.input);
|
|
31612
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
31769
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState40();
|
|
31613
31770
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
31614
|
-
const [tokenReview, setTokenReview] =
|
|
31615
|
-
const [scopeRun, setScopeRun] =
|
|
31771
|
+
const [tokenReview, setTokenReview] = useState40();
|
|
31772
|
+
const [scopeRun, setScopeRun] = useState40();
|
|
31616
31773
|
const scopeFlow = useScopeGateFlow(
|
|
31617
31774
|
scopeRun && {
|
|
31618
31775
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -31627,12 +31784,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31627
31784
|
}
|
|
31628
31785
|
}
|
|
31629
31786
|
);
|
|
31630
|
-
const [generationInput, setGenerationInput] =
|
|
31787
|
+
const [generationInput, setGenerationInput] = useState40();
|
|
31631
31788
|
const generation = useGeneration(generationInput);
|
|
31632
|
-
const [flowStart, setFlowStart] =
|
|
31789
|
+
const [flowStart, setFlowStart] = useState40();
|
|
31633
31790
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
31634
|
-
const [importDefaults, setImportDefaults] =
|
|
31635
|
-
|
|
31791
|
+
const [importDefaults, setImportDefaults] = useState40();
|
|
31792
|
+
useEffect37(() => {
|
|
31636
31793
|
if (screen !== "import") {
|
|
31637
31794
|
setImportDefaults(void 0);
|
|
31638
31795
|
return;
|
|
@@ -31705,7 +31862,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31705
31862
|
}
|
|
31706
31863
|
});
|
|
31707
31864
|
};
|
|
31708
|
-
|
|
31865
|
+
useEffect37(() => {
|
|
31709
31866
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
31710
31867
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
31711
31868
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -31727,12 +31884,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31727
31884
|
}
|
|
31728
31885
|
});
|
|
31729
31886
|
}, [tokensOnly, tokensOnlyRun]);
|
|
31730
|
-
|
|
31887
|
+
useEffect37(() => {
|
|
31731
31888
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
31732
31889
|
setExtractionRun(void 0);
|
|
31733
31890
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
31734
31891
|
}, [extraction, extractionRun]);
|
|
31735
|
-
|
|
31892
|
+
useEffect37(() => {
|
|
31736
31893
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
31737
31894
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31738
31895
|
setGenerationInput({
|
|
@@ -31750,7 +31907,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31750
31907
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
31751
31908
|
});
|
|
31752
31909
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
31753
|
-
|
|
31910
|
+
useEffect37(() => {
|
|
31754
31911
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
31755
31912
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31756
31913
|
inkClear();
|