@contentful/experience-design-system-cli 2.42.1-dev-build-2fb477e0.0 → 2.42.1-dev-build-c1f0c828.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 +540 -404
- package/dist/index.js +439 -285
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +3 -1
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +3 -0
- package/dist/src/tui/support-bundle.d.ts +23 -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
|
}
|
|
@@ -2144,7 +2158,7 @@ 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 dirname5, join as
|
|
2161
|
+
import { dirname as dirname5, 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))
|
|
@@ -2152,11 +2166,11 @@ function resolveSkillPath(skill) {
|
|
|
2152
2166
|
const thisDir = dirname5(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,110 @@ 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 { readdir as readdir2, readFile as readFile2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
2842
|
+
import { basename, join as join6, sep } from "node:path";
|
|
2843
|
+
|
|
2844
|
+
// packages/experience-design-system-cli/src/tui/zip.ts
|
|
2845
|
+
import { crc32, deflateRawSync } from "node:zlib";
|
|
2846
|
+
var LOCAL_HEADER = 67324752;
|
|
2847
|
+
var CENTRAL_HEADER = 33639248;
|
|
2848
|
+
var END_OF_ARCHIVE = 101010256;
|
|
2849
|
+
var VERSION2 = 20;
|
|
2850
|
+
var UTF8_NAMES = 2048;
|
|
2851
|
+
var DEFLATE = 8;
|
|
2852
|
+
function dosDateTime(date) {
|
|
2853
|
+
const year = Math.max(1980, date.getFullYear());
|
|
2854
|
+
return {
|
|
2855
|
+
day: year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate(),
|
|
2856
|
+
time: date.getHours() << 11 | date.getMinutes() << 5 | date.getSeconds() >> 1
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
function createZip(entries) {
|
|
2860
|
+
const body = [];
|
|
2861
|
+
const directory = [];
|
|
2862
|
+
let offset = 0;
|
|
2863
|
+
for (const entry of entries) {
|
|
2864
|
+
const name = Buffer.from(entry.name, "utf8");
|
|
2865
|
+
const compressed = deflateRawSync(entry.data);
|
|
2866
|
+
const checksum = crc32(entry.data);
|
|
2867
|
+
const { day, time } = dosDateTime(entry.modified);
|
|
2868
|
+
const local = Buffer.alloc(30);
|
|
2869
|
+
local.writeUInt32LE(LOCAL_HEADER, 0);
|
|
2870
|
+
local.writeUInt16LE(VERSION2, 4);
|
|
2871
|
+
local.writeUInt16LE(UTF8_NAMES, 6);
|
|
2872
|
+
local.writeUInt16LE(DEFLATE, 8);
|
|
2873
|
+
local.writeUInt16LE(time, 10);
|
|
2874
|
+
local.writeUInt16LE(day, 12);
|
|
2875
|
+
local.writeUInt32LE(checksum, 14);
|
|
2876
|
+
local.writeUInt32LE(compressed.length, 18);
|
|
2877
|
+
local.writeUInt32LE(entry.data.length, 22);
|
|
2878
|
+
local.writeUInt16LE(name.length, 26);
|
|
2879
|
+
body.push(local, name, compressed);
|
|
2880
|
+
const central = Buffer.alloc(46);
|
|
2881
|
+
central.writeUInt32LE(CENTRAL_HEADER, 0);
|
|
2882
|
+
central.writeUInt16LE(VERSION2, 4);
|
|
2883
|
+
central.writeUInt16LE(VERSION2, 6);
|
|
2884
|
+
central.writeUInt16LE(UTF8_NAMES, 8);
|
|
2885
|
+
central.writeUInt16LE(DEFLATE, 10);
|
|
2886
|
+
central.writeUInt16LE(time, 12);
|
|
2887
|
+
central.writeUInt16LE(day, 14);
|
|
2888
|
+
central.writeUInt32LE(checksum, 16);
|
|
2889
|
+
central.writeUInt32LE(compressed.length, 20);
|
|
2890
|
+
central.writeUInt32LE(entry.data.length, 24);
|
|
2891
|
+
central.writeUInt16LE(name.length, 28);
|
|
2892
|
+
central.writeUInt32LE(offset, 42);
|
|
2893
|
+
directory.push(central, name);
|
|
2894
|
+
offset += local.length + name.length + compressed.length;
|
|
2895
|
+
}
|
|
2896
|
+
const directoryBytes = Buffer.concat(directory);
|
|
2897
|
+
const end = Buffer.alloc(22);
|
|
2898
|
+
end.writeUInt32LE(END_OF_ARCHIVE, 0);
|
|
2899
|
+
end.writeUInt16LE(entries.length, 8);
|
|
2900
|
+
end.writeUInt16LE(entries.length, 10);
|
|
2901
|
+
end.writeUInt32LE(directoryBytes.length, 12);
|
|
2902
|
+
end.writeUInt32LE(offset, 16);
|
|
2903
|
+
return Buffer.concat([...body, directoryBytes, end]);
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
// packages/experience-design-system-cli/src/tui/support-bundle.ts
|
|
2907
|
+
async function bundleDebugLogs() {
|
|
2908
|
+
const session = currentSessionDir();
|
|
2909
|
+
const debugDir = currentDebugSessionDir();
|
|
2910
|
+
if (!session || !debugDir) return { status: "no-logs" };
|
|
2911
|
+
try {
|
|
2912
|
+
await settleDebugLogs();
|
|
2913
|
+
const logs = (await readdir2(debugDir, { recursive: true })).filter((file) => file.endsWith(".md")).sort();
|
|
2914
|
+
if (logs.length === 0) return { status: "no-logs" };
|
|
2915
|
+
const entries = await Promise.all(
|
|
2916
|
+
logs.map(async (file) => {
|
|
2917
|
+
const path6 = join6(debugDir, file);
|
|
2918
|
+
return { name: file.split(sep).join("/"), data: await readFile2(path6), modified: (await stat2(path6)).mtime };
|
|
2919
|
+
})
|
|
2920
|
+
);
|
|
2921
|
+
const path5 = join6(session, `${basename(session)}-debug-logs.zip`);
|
|
2922
|
+
await writeFile3(path5, createZip(entries), { mode: 384 });
|
|
2923
|
+
return { status: "created", path: path5, files: entries.length };
|
|
2924
|
+
} catch {
|
|
2925
|
+
return { status: "failed", folder: debugDir };
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
function supportInstruction(bundle) {
|
|
2929
|
+
switch (bundle.status) {
|
|
2930
|
+
case "created":
|
|
2931
|
+
return `The import hit an error. We zipped up your debug logs, you can find the file here:
|
|
2932
|
+
${bundle.path}
|
|
2933
|
+
Send that zip file to Contentful support so they can look into it.`;
|
|
2934
|
+
case "no-logs":
|
|
2935
|
+
return "The import hit an error, but 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.";
|
|
2936
|
+
case "failed":
|
|
2937
|
+
return `The import hit an error. We could not zip your debug logs, but you can find them here:
|
|
2938
|
+
${bundle.folder}
|
|
2939
|
+
Zip that folder and send it to Contentful support so they can look into it.`;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
|
|
2825
2943
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
|
|
2826
2944
|
import { useInput as useInput4 } from "ink";
|
|
2827
2945
|
|
|
@@ -2853,6 +2971,22 @@ function useErrorControls(handlers) {
|
|
|
2853
2971
|
});
|
|
2854
2972
|
}
|
|
2855
2973
|
|
|
2974
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
|
|
2975
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
2976
|
+
function useSupportBundle() {
|
|
2977
|
+
const [bundle, setBundle] = useState3();
|
|
2978
|
+
useEffect3(() => {
|
|
2979
|
+
let active = true;
|
|
2980
|
+
void bundleDebugLogs().then((result) => {
|
|
2981
|
+
if (active) setBundle(result);
|
|
2982
|
+
});
|
|
2983
|
+
return () => {
|
|
2984
|
+
active = false;
|
|
2985
|
+
};
|
|
2986
|
+
}, []);
|
|
2987
|
+
return bundle;
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2856
2990
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2857
2991
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2858
2992
|
function ErrorStep({
|
|
@@ -2863,6 +2997,7 @@ function ErrorStep({
|
|
|
2863
2997
|
onAcknowledgeBreakingChanges
|
|
2864
2998
|
}) {
|
|
2865
2999
|
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
3000
|
+
const bundle = useSupportBundle();
|
|
2866
3001
|
const controls = errorControls({
|
|
2867
3002
|
canRetry: onRetryCredentials !== void 0,
|
|
2868
3003
|
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
@@ -2874,6 +3009,7 @@ function ErrorStep({
|
|
|
2874
3009
|
" failed"
|
|
2875
3010
|
] }),
|
|
2876
3011
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
3012
|
+
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
2877
3013
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
2878
3014
|
"[",
|
|
2879
3015
|
control.keys,
|
|
@@ -3090,10 +3226,10 @@ var PROGRESS_THEME = extendTheme(defaultTheme, {
|
|
|
3090
3226
|
});
|
|
3091
3227
|
|
|
3092
3228
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
3093
|
-
import { useEffect as
|
|
3229
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
3094
3230
|
function useElapsed() {
|
|
3095
|
-
const [seconds2, setSeconds] =
|
|
3096
|
-
|
|
3231
|
+
const [seconds2, setSeconds] = useState4(0);
|
|
3232
|
+
useEffect4(() => {
|
|
3097
3233
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
3098
3234
|
return () => clearInterval(timer);
|
|
3099
3235
|
}, []);
|
|
@@ -3149,9 +3285,9 @@ function RunningStep({
|
|
|
3149
3285
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3150
3286
|
var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
|
|
3151
3287
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
3152
|
-
const [focus, setFocus] =
|
|
3288
|
+
const [focus, setFocus] = useState5(0);
|
|
3153
3289
|
const viewed = useRef([optionAt(0)]).current;
|
|
3154
|
-
|
|
3290
|
+
useEffect5(() => {
|
|
3155
3291
|
startDebugRun({
|
|
3156
3292
|
flow: "import/preflight",
|
|
3157
3293
|
step: "00-preflight",
|
|
@@ -3194,7 +3330,7 @@ function PreflightScreen({ onChoose, onQuit }) {
|
|
|
3194
3330
|
}
|
|
3195
3331
|
|
|
3196
3332
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3197
|
-
import { useEffect as
|
|
3333
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
3198
3334
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
3199
3335
|
init_debug_store();
|
|
3200
3336
|
|
|
@@ -3254,9 +3390,9 @@ function useWelcomeControls(onQuit) {
|
|
|
3254
3390
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3255
3391
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3256
3392
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
3257
|
-
const [projectPath, setProjectPath] =
|
|
3393
|
+
const [projectPath, setProjectPath] = useState6(initialPath);
|
|
3258
3394
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
3259
|
-
|
|
3395
|
+
useEffect6(() => {
|
|
3260
3396
|
startDebugRun({
|
|
3261
3397
|
flow: "import/welcome",
|
|
3262
3398
|
step: "01-welcome",
|
|
@@ -3311,7 +3447,7 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
3311
3447
|
}
|
|
3312
3448
|
|
|
3313
3449
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3314
|
-
import { useEffect as
|
|
3450
|
+
import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
|
|
3315
3451
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3316
3452
|
init_debug_store();
|
|
3317
3453
|
|
|
@@ -3387,10 +3523,10 @@ function TokenInputScreen({
|
|
|
3387
3523
|
onBack,
|
|
3388
3524
|
initialPath = ""
|
|
3389
3525
|
}) {
|
|
3390
|
-
const [tokenPath, setTokenPath] =
|
|
3391
|
-
const [failure, setFailure] =
|
|
3526
|
+
const [tokenPath, setTokenPath] = useState7(initialPath);
|
|
3527
|
+
const [failure, setFailure] = useState7(null);
|
|
3392
3528
|
const rejected = useRef4([]).current;
|
|
3393
|
-
|
|
3529
|
+
useEffect7(() => {
|
|
3394
3530
|
startDebugRun({
|
|
3395
3531
|
flow: "import/token-input",
|
|
3396
3532
|
step: "02-token-input",
|
|
@@ -3471,7 +3607,7 @@ function TokenInputScreen({
|
|
|
3471
3607
|
}
|
|
3472
3608
|
|
|
3473
3609
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
3474
|
-
import { useEffect as
|
|
3610
|
+
import { useEffect as useEffect8, useMemo, useState as useState8 } from "react";
|
|
3475
3611
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3476
3612
|
init_debug_store();
|
|
3477
3613
|
|
|
@@ -3598,16 +3734,16 @@ function usePathValidationControls(phase, handlers) {
|
|
|
3598
3734
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3599
3735
|
import { DatabaseSync } from "node:sqlite";
|
|
3600
3736
|
import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
3601
|
-
import { readFile as
|
|
3737
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
3602
3738
|
import { createHash as createHash5 } from "node:crypto";
|
|
3603
3739
|
|
|
3604
3740
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
3605
3741
|
import { homedir as homedir3 } from "node:os";
|
|
3606
|
-
import { dirname as dirname4, join as
|
|
3742
|
+
import { dirname as dirname4, join as join7 } from "node:path";
|
|
3607
3743
|
function configRoot2() {
|
|
3608
|
-
return process.env["EDS_HOME"] ||
|
|
3744
|
+
return process.env["EDS_HOME"] || join7(homedir3(), ".contentful", "experience-design-system-cli");
|
|
3609
3745
|
}
|
|
3610
|
-
var runsFilePath = () =>
|
|
3746
|
+
var runsFilePath = () => join7(configRoot2(), "state", "runs.json");
|
|
3611
3747
|
|
|
3612
3748
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3613
3749
|
import { dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
@@ -5061,7 +5197,7 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
5061
5197
|
];
|
|
5062
5198
|
for (const candidate of candidates) {
|
|
5063
5199
|
try {
|
|
5064
|
-
await
|
|
5200
|
+
await readFile6(candidate, "utf8");
|
|
5065
5201
|
return candidate;
|
|
5066
5202
|
} catch {
|
|
5067
5203
|
}
|
|
@@ -5095,7 +5231,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5095
5231
|
break;
|
|
5096
5232
|
let content;
|
|
5097
5233
|
try {
|
|
5098
|
-
content = await
|
|
5234
|
+
content = await readFile6(resolvedPath, "utf8");
|
|
5099
5235
|
} catch {
|
|
5100
5236
|
continue;
|
|
5101
5237
|
}
|
|
@@ -5134,7 +5270,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
5134
5270
|
let truncatedSiblingCount = 0;
|
|
5135
5271
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
5136
5272
|
try {
|
|
5137
|
-
const rawText = await
|
|
5273
|
+
const rawText = await readFile6(sourcePath, "utf8");
|
|
5138
5274
|
let siblingUsesNotShown;
|
|
5139
5275
|
let declaredTypeNames;
|
|
5140
5276
|
({
|
|
@@ -5896,7 +6032,7 @@ import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "t
|
|
|
5896
6032
|
|
|
5897
6033
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
5898
6034
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
5899
|
-
import { dirname as dirname7, join as
|
|
6035
|
+
import { dirname as dirname7, join as join9, resolve as resolve8 } from "node:path";
|
|
5900
6036
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
5901
6037
|
import ts from "typescript";
|
|
5902
6038
|
var packageRootByFilePathCache = /* @__PURE__ */ new Map();
|
|
@@ -6099,7 +6235,7 @@ function findNearestTsConfigPath(filePath) {
|
|
|
6099
6235
|
let currentDir = dirname7(filePath);
|
|
6100
6236
|
while (true) {
|
|
6101
6237
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
6102
|
-
const candidatePath =
|
|
6238
|
+
const candidatePath = join9(currentDir, candidateName);
|
|
6103
6239
|
if (existsSync4(candidatePath)) {
|
|
6104
6240
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
6105
6241
|
return candidatePath;
|
|
@@ -6156,10 +6292,10 @@ function resolveImportSourcePath(basePath) {
|
|
|
6156
6292
|
`${basePath}.tsx`,
|
|
6157
6293
|
`${basePath}.js`,
|
|
6158
6294
|
`${basePath}.jsx`,
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6295
|
+
join9(basePath, "index.ts"),
|
|
6296
|
+
join9(basePath, "index.tsx"),
|
|
6297
|
+
join9(basePath, "index.js"),
|
|
6298
|
+
join9(basePath, "index.jsx")
|
|
6163
6299
|
];
|
|
6164
6300
|
return candidates.find((candidatePath) => existsSync4(candidatePath));
|
|
6165
6301
|
}
|
|
@@ -6170,10 +6306,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
6170
6306
|
`${resolvedPath}.tsx`,
|
|
6171
6307
|
`${resolvedPath}.js`,
|
|
6172
6308
|
`${resolvedPath}.jsx`,
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6309
|
+
join9(resolvedPath, "index.ts"),
|
|
6310
|
+
join9(resolvedPath, "index.tsx"),
|
|
6311
|
+
join9(resolvedPath, "index.js"),
|
|
6312
|
+
join9(resolvedPath, "index.jsx")
|
|
6177
6313
|
];
|
|
6178
6314
|
for (const candidatePath of candidatePaths) {
|
|
6179
6315
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -6194,10 +6330,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6194
6330
|
if (!packageRootDir)
|
|
6195
6331
|
return void 0;
|
|
6196
6332
|
const preferredEntryPaths = [
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6333
|
+
join9(packageRootDir, "src/index.ts"),
|
|
6334
|
+
join9(packageRootDir, "src/index.tsx"),
|
|
6335
|
+
join9(packageRootDir, "index.ts"),
|
|
6336
|
+
join9(packageRootDir, "index.tsx")
|
|
6201
6337
|
];
|
|
6202
6338
|
for (const entryPath of preferredEntryPaths) {
|
|
6203
6339
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -6205,7 +6341,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6205
6341
|
return entrySourceFile;
|
|
6206
6342
|
}
|
|
6207
6343
|
}
|
|
6208
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
6344
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join9(packageRootDir, "src"));
|
|
6209
6345
|
}
|
|
6210
6346
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
6211
6347
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -6214,7 +6350,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
6214
6350
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
6215
6351
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
6216
6352
|
}
|
|
6217
|
-
const packageJsonPath =
|
|
6353
|
+
const packageJsonPath = join9(packageRootDir, "package.json");
|
|
6218
6354
|
try {
|
|
6219
6355
|
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
|
|
6220
6356
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -6231,7 +6367,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6231
6367
|
}
|
|
6232
6368
|
let currentDir = dirname7(filePath);
|
|
6233
6369
|
while (true) {
|
|
6234
|
-
if (existsSync4(
|
|
6370
|
+
if (existsSync4(join9(currentDir, "package.json"))) {
|
|
6235
6371
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
6236
6372
|
return currentDir;
|
|
6237
6373
|
}
|
|
@@ -6245,7 +6381,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6245
6381
|
}
|
|
6246
6382
|
|
|
6247
6383
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
|
|
6248
|
-
import { readFile as
|
|
6384
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
6249
6385
|
async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
|
|
6250
6386
|
const warnings = [];
|
|
6251
6387
|
const items = [];
|
|
@@ -6257,7 +6393,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
|
|
|
6257
6393
|
if (!filePath)
|
|
6258
6394
|
break;
|
|
6259
6395
|
try {
|
|
6260
|
-
const source = await
|
|
6396
|
+
const source = await readFile7(filePath, "utf-8");
|
|
6261
6397
|
const outcome = await extractFile(filePath, source);
|
|
6262
6398
|
warnings.push(...outcome.warnings ?? []);
|
|
6263
6399
|
if (outcome.item)
|
|
@@ -9232,15 +9368,15 @@ function extractVueSlotsFromSetup(options) {
|
|
|
9232
9368
|
|
|
9233
9369
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
9234
9370
|
import os from "node:os";
|
|
9235
|
-
import { basename, dirname as dirname9, resolve as resolve10, join as
|
|
9236
|
-
import { readFile as
|
|
9371
|
+
import { basename as basename2, dirname as dirname9, resolve as resolve10, join as join11 } from "node:path";
|
|
9372
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
9237
9373
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
9238
9374
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
9239
9375
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
9240
9376
|
|
|
9241
9377
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
|
|
9242
9378
|
import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
|
|
9243
|
-
import { dirname as dirname8, join as
|
|
9379
|
+
import { dirname as dirname8, join as join10, resolve as resolve9 } from "node:path";
|
|
9244
9380
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
9245
9381
|
const basePath = resolve9(dirname8(importingFilePath), specifier);
|
|
9246
9382
|
const candidates = [
|
|
@@ -9249,10 +9385,10 @@ function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
|
9249
9385
|
`${basePath}.ts`,
|
|
9250
9386
|
`${basePath}.mjs`,
|
|
9251
9387
|
`${basePath}.cjs`,
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9388
|
+
join10(basePath, "index.js"),
|
|
9389
|
+
join10(basePath, "index.ts"),
|
|
9390
|
+
join10(basePath, "index.mjs"),
|
|
9391
|
+
join10(basePath, "index.cjs")
|
|
9256
9392
|
];
|
|
9257
9393
|
for (const candidate of candidates) {
|
|
9258
9394
|
if (existsSync5(candidate) && statSync2(candidate).isFile())
|
|
@@ -9327,11 +9463,11 @@ async function extractFromVueSFC(filePath, source) {
|
|
|
9327
9463
|
};
|
|
9328
9464
|
}
|
|
9329
9465
|
function getVueComponentName(filePath) {
|
|
9330
|
-
const fileName =
|
|
9466
|
+
const fileName = basename2(filePath, ".vue");
|
|
9331
9467
|
if (fileName !== "index") {
|
|
9332
9468
|
return fileName;
|
|
9333
9469
|
}
|
|
9334
|
-
const parentDirName =
|
|
9470
|
+
const parentDirName = basename2(dirname9(filePath));
|
|
9335
9471
|
return parentDirName || fileName;
|
|
9336
9472
|
}
|
|
9337
9473
|
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
@@ -9475,7 +9611,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
|
|
|
9475
9611
|
if (visitedImports.has(visitKey))
|
|
9476
9612
|
return [];
|
|
9477
9613
|
visitedImports.add(visitKey);
|
|
9478
|
-
const source = await
|
|
9614
|
+
const source = await readFile8(importedRef.filePath, "utf-8");
|
|
9479
9615
|
const project = new Project3({
|
|
9480
9616
|
compilerOptions: {
|
|
9481
9617
|
strict: false,
|
|
@@ -9503,11 +9639,11 @@ function findWorkspaceRoot(startDir) {
|
|
|
9503
9639
|
return workspaceRootCache.get(startDir);
|
|
9504
9640
|
let dir = startDir;
|
|
9505
9641
|
while (true) {
|
|
9506
|
-
const pkgJsonPath =
|
|
9642
|
+
const pkgJsonPath = join11(dir, "package.json");
|
|
9507
9643
|
if (existsSync6(pkgJsonPath)) {
|
|
9508
9644
|
try {
|
|
9509
9645
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9510
|
-
if (pkg.workspaces || existsSync6(
|
|
9646
|
+
if (pkg.workspaces || existsSync6(join11(dir, "pnpm-workspace.yaml"))) {
|
|
9511
9647
|
workspaceRootCache.set(startDir, dir);
|
|
9512
9648
|
return dir;
|
|
9513
9649
|
}
|
|
@@ -9528,7 +9664,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9528
9664
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
9529
9665
|
}
|
|
9530
9666
|
const packageMap = /* @__PURE__ */ new Map();
|
|
9531
|
-
const packagesDir =
|
|
9667
|
+
const packagesDir = join11(workspaceRoot, "packages");
|
|
9532
9668
|
if (!existsSync6(packagesDir)) {
|
|
9533
9669
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
9534
9670
|
return packageMap;
|
|
@@ -9542,7 +9678,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9542
9678
|
} catch {
|
|
9543
9679
|
return;
|
|
9544
9680
|
}
|
|
9545
|
-
const pkgJsonPath =
|
|
9681
|
+
const pkgJsonPath = join11(dir, "package.json");
|
|
9546
9682
|
if (existsSync6(pkgJsonPath)) {
|
|
9547
9683
|
try {
|
|
9548
9684
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
@@ -9555,10 +9691,10 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9555
9691
|
for (const entry of entries) {
|
|
9556
9692
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
9557
9693
|
continue;
|
|
9558
|
-
const entryPath =
|
|
9694
|
+
const entryPath = join11(dir, entry);
|
|
9559
9695
|
try {
|
|
9560
|
-
const
|
|
9561
|
-
if (
|
|
9696
|
+
const stat6 = statSync3(entryPath);
|
|
9697
|
+
if (stat6.isDirectory()) {
|
|
9562
9698
|
scanDir(entryPath, depth + 1);
|
|
9563
9699
|
}
|
|
9564
9700
|
} catch {
|
|
@@ -9595,7 +9731,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9595
9731
|
const packageDir = packageDirs.get(packageName);
|
|
9596
9732
|
if (!packageDir)
|
|
9597
9733
|
return null;
|
|
9598
|
-
const pkgJsonPath =
|
|
9734
|
+
const pkgJsonPath = join11(packageDir, "package.json");
|
|
9599
9735
|
try {
|
|
9600
9736
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9601
9737
|
if (pkg.exports && subpath !== ".") {
|
|
@@ -9608,8 +9744,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9608
9744
|
}
|
|
9609
9745
|
if (subpath !== ".") {
|
|
9610
9746
|
const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
|
|
9611
|
-
for (const base of [
|
|
9612
|
-
const subPkgPath =
|
|
9747
|
+
for (const base of [join11(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
9748
|
+
const subPkgPath = join11(base, "package.json");
|
|
9613
9749
|
if (existsSync6(subPkgPath)) {
|
|
9614
9750
|
try {
|
|
9615
9751
|
const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
|
|
@@ -9706,7 +9842,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9706
9842
|
return [];
|
|
9707
9843
|
}
|
|
9708
9844
|
async function extractInheritedVueProps(filePath, visited) {
|
|
9709
|
-
const source = await
|
|
9845
|
+
const source = await readFile8(filePath, "utf-8");
|
|
9710
9846
|
const { descriptor } = parseSFC(source);
|
|
9711
9847
|
if (!descriptor.script) {
|
|
9712
9848
|
return [];
|
|
@@ -9824,7 +9960,7 @@ function mergeSlotsDedup(base, extra) {
|
|
|
9824
9960
|
|
|
9825
9961
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/astro/extract-astro-components.js
|
|
9826
9962
|
import os2 from "node:os";
|
|
9827
|
-
import { basename as
|
|
9963
|
+
import { basename as basename3 } from "node:path";
|
|
9828
9964
|
import { Project as Project4, Node as Node7 } from "ts-morph";
|
|
9829
9965
|
function extractAllowedValues3(typeText) {
|
|
9830
9966
|
const parts = typeText.split("|").map((p) => p.trim());
|
|
@@ -10003,7 +10139,7 @@ function mergeSlots(...slotGroups) {
|
|
|
10003
10139
|
return merged;
|
|
10004
10140
|
}
|
|
10005
10141
|
function extractFromAstroFile(filePath, source) {
|
|
10006
|
-
const name =
|
|
10142
|
+
const name = basename3(filePath, ".astro");
|
|
10007
10143
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
10008
10144
|
let frontmatter = "";
|
|
10009
10145
|
let template = source;
|
|
@@ -10039,7 +10175,7 @@ async function extractAstroComponents(filePaths, onProgress) {
|
|
|
10039
10175
|
}
|
|
10040
10176
|
|
|
10041
10177
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
10042
|
-
import { basename as
|
|
10178
|
+
import { basename as basename4, dirname as dirname10, join as join12, resolve as resolve11 } from "node:path";
|
|
10043
10179
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
10044
10180
|
function normalizeComponentName(input) {
|
|
10045
10181
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -10206,7 +10342,7 @@ function shouldPreferTagName(className, tagName) {
|
|
|
10206
10342
|
return false;
|
|
10207
10343
|
}
|
|
10208
10344
|
function getFileDerivedComponentName(sourceFile) {
|
|
10209
|
-
const baseName =
|
|
10345
|
+
const baseName = basename4(sourceFile.getFilePath()).replace(/\.[^.]+$/, "").replace(/\.component$/, "");
|
|
10210
10346
|
return kebabToPascal(baseName);
|
|
10211
10347
|
}
|
|
10212
10348
|
function chooseComponentName(classDecl, className, tagName) {
|
|
@@ -10694,14 +10830,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
10694
10830
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
10695
10831
|
return null;
|
|
10696
10832
|
}
|
|
10697
|
-
const packagesMarker = `${
|
|
10833
|
+
const packagesMarker = `${join12("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
10698
10834
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
10699
10835
|
if (markerIndex === -1) {
|
|
10700
10836
|
return null;
|
|
10701
10837
|
}
|
|
10702
10838
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
10703
10839
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
10704
|
-
return
|
|
10840
|
+
return join12(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
10705
10841
|
}
|
|
10706
10842
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
10707
10843
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -10854,7 +10990,7 @@ async function extractWebComponentDefinitions(filePaths) {
|
|
|
10854
10990
|
|
|
10855
10991
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
10856
10992
|
import os3 from "node:os";
|
|
10857
|
-
import { basename as
|
|
10993
|
+
import { basename as basename5, dirname as dirname11, resolve as resolve12, join as join13 } from "node:path";
|
|
10858
10994
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
10859
10995
|
import { createRequire } from "node:module";
|
|
10860
10996
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
@@ -11088,7 +11224,7 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
11088
11224
|
function findNearestTsconfig(startDir) {
|
|
11089
11225
|
let dir = startDir;
|
|
11090
11226
|
for (let i = 0; i < 16; i++) {
|
|
11091
|
-
const candidate =
|
|
11227
|
+
const candidate = join13(dir, "tsconfig.json");
|
|
11092
11228
|
if (existsSync7(candidate))
|
|
11093
11229
|
return candidate;
|
|
11094
11230
|
const parent = dirname11(dir);
|
|
@@ -11224,7 +11360,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11224
11360
|
const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
|
|
11225
11361
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
11226
11362
|
if (pkgRoot) {
|
|
11227
|
-
const pkgJsonPath =
|
|
11363
|
+
const pkgJsonPath = join13(pkgRoot, "package.json");
|
|
11228
11364
|
if (existsSync7(pkgJsonPath)) {
|
|
11229
11365
|
try {
|
|
11230
11366
|
const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
|
|
@@ -11245,7 +11381,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11245
11381
|
}
|
|
11246
11382
|
}
|
|
11247
11383
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
11248
|
-
const candidate =
|
|
11384
|
+
const candidate = join13(pkgRoot, entry);
|
|
11249
11385
|
if (existsSync7(candidate))
|
|
11250
11386
|
return candidate;
|
|
11251
11387
|
}
|
|
@@ -11263,9 +11399,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11263
11399
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
11264
11400
|
let dir = seedDir;
|
|
11265
11401
|
for (let i = 0; i < 32; i++) {
|
|
11266
|
-
if (existsSync7(
|
|
11402
|
+
if (existsSync7(join13(dir, "package.json"))) {
|
|
11267
11403
|
try {
|
|
11268
|
-
const pkgRaw = readFileSync6(
|
|
11404
|
+
const pkgRaw = readFileSync6(join13(dir, "package.json"), "utf-8");
|
|
11269
11405
|
const pkg = JSON.parse(pkgRaw);
|
|
11270
11406
|
if (pkg.name === specifier)
|
|
11271
11407
|
return dir;
|
|
@@ -11405,12 +11541,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11405
11541
|
}
|
|
11406
11542
|
var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
|
|
11407
11543
|
function getSvelteComponentName(filePath) {
|
|
11408
|
-
const file =
|
|
11409
|
-
const parentDir =
|
|
11544
|
+
const file = basename5(filePath, ".svelte");
|
|
11545
|
+
const parentDir = basename5(dirname11(filePath));
|
|
11410
11546
|
if (file === "index")
|
|
11411
11547
|
return toPascalCase(parentDir);
|
|
11412
11548
|
if (ANATOMY_FOLDERS.has(parentDir)) {
|
|
11413
|
-
const grandparent =
|
|
11549
|
+
const grandparent = basename5(dirname11(dirname11(filePath)));
|
|
11414
11550
|
if (grandparent && grandparent !== "." && grandparent !== "/") {
|
|
11415
11551
|
return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
|
|
11416
11552
|
}
|
|
@@ -12225,7 +12361,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
12225
12361
|
}
|
|
12226
12362
|
|
|
12227
12363
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12228
|
-
import { readFile as
|
|
12364
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
12229
12365
|
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
12230
12366
|
|
|
12231
12367
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
@@ -12631,14 +12767,14 @@ function countLines(text, offset) {
|
|
|
12631
12767
|
}
|
|
12632
12768
|
|
|
12633
12769
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
12634
|
-
import { readFile as
|
|
12770
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
12635
12771
|
async function resolveTemplateSource(meta) {
|
|
12636
12772
|
if (meta.inlineTemplate !== null)
|
|
12637
12773
|
return meta.inlineTemplate;
|
|
12638
12774
|
if (meta.templatePath === null)
|
|
12639
12775
|
return null;
|
|
12640
12776
|
try {
|
|
12641
|
-
return await
|
|
12777
|
+
return await readFile9(meta.templatePath, "utf8");
|
|
12642
12778
|
} catch {
|
|
12643
12779
|
return null;
|
|
12644
12780
|
}
|
|
@@ -12828,7 +12964,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
|
12828
12964
|
});
|
|
12829
12965
|
for (const filePath of filePaths) {
|
|
12830
12966
|
try {
|
|
12831
|
-
const source = await
|
|
12967
|
+
const source = await readFile10(filePath, "utf8");
|
|
12832
12968
|
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12833
12969
|
for (const cls of sourceFile.getClasses()) {
|
|
12834
12970
|
if (!hasComponentDecorator(cls))
|
|
@@ -12964,11 +13100,11 @@ function getPathPreferenceScore(filePath) {
|
|
|
12964
13100
|
const normalized = filePath.replace(/\\/g, "/");
|
|
12965
13101
|
const segments = normalized.split("/").filter(Boolean);
|
|
12966
13102
|
const filename = segments.at(-1) ?? "";
|
|
12967
|
-
const
|
|
13103
|
+
const basename8 = filename.replace(/\.[^.]+$/, "");
|
|
12968
13104
|
let score = 0;
|
|
12969
13105
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
12970
13106
|
score += 100;
|
|
12971
|
-
if (
|
|
13107
|
+
if (basename8 && segments.at(-2) === basename8)
|
|
12972
13108
|
score -= 10;
|
|
12973
13109
|
const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
|
|
12974
13110
|
score -= componentsSegmentCount * 8;
|
|
@@ -13417,15 +13553,15 @@ function applyCompositionEdges(components, edges) {
|
|
|
13417
13553
|
|
|
13418
13554
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
13419
13555
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
13420
|
-
import { dirname as dirname13, join as
|
|
13556
|
+
import { dirname as dirname13, join as join14, resolve as resolve14 } from "node:path";
|
|
13421
13557
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13422
13558
|
function resolvePromptPath(fileName) {
|
|
13423
13559
|
const thisDir = dirname13(fileURLToPath3(import.meta.url));
|
|
13424
13560
|
let dir = thisDir;
|
|
13425
13561
|
for (; ; ) {
|
|
13426
|
-
const candidate =
|
|
13562
|
+
const candidate = join14(dir, "prompts");
|
|
13427
13563
|
if (existsSync8(candidate))
|
|
13428
|
-
return
|
|
13564
|
+
return join14(candidate, fileName);
|
|
13429
13565
|
const parent = resolve14(dir, "..");
|
|
13430
13566
|
if (parent === dir) {
|
|
13431
13567
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
@@ -14052,10 +14188,10 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
14052
14188
|
}
|
|
14053
14189
|
|
|
14054
14190
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
14055
|
-
import { access as access3, readFile as
|
|
14191
|
+
import { access as access3, readFile as readFile12 } from "node:fs/promises";
|
|
14056
14192
|
|
|
14057
14193
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
14058
|
-
import { access as access2, mkdir as mkdir3, readFile as
|
|
14194
|
+
import { access as access2, mkdir as mkdir3, readFile as readFile11, writeFile as writeFile4 } from "node:fs/promises";
|
|
14059
14195
|
|
|
14060
14196
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
14061
14197
|
import { resolve as resolve17 } from "node:path";
|
|
@@ -14074,11 +14210,11 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
14074
14210
|
await mkdir3(paths.sessionDir, { recursive: true });
|
|
14075
14211
|
try {
|
|
14076
14212
|
await access2(paths.statePath);
|
|
14077
|
-
const savedState = await
|
|
14213
|
+
const savedState = await readFile11(paths.statePath, "utf8");
|
|
14078
14214
|
return JSON.parse(savedState);
|
|
14079
14215
|
} catch {
|
|
14080
|
-
await
|
|
14081
|
-
await
|
|
14216
|
+
await writeFile4(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
14217
|
+
await writeFile4(paths.eventsPath, "", "utf8");
|
|
14082
14218
|
return initialSnapshot;
|
|
14083
14219
|
}
|
|
14084
14220
|
}
|
|
@@ -14093,9 +14229,9 @@ function getRefineArtifactsRoot() {
|
|
|
14093
14229
|
}
|
|
14094
14230
|
|
|
14095
14231
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
14096
|
-
import { writeFile as
|
|
14232
|
+
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
14097
14233
|
async function saveReviewState(statePath, session) {
|
|
14098
|
-
await
|
|
14234
|
+
await writeFile5(statePath, JSON.stringify(session, null, 2), "utf8");
|
|
14099
14235
|
}
|
|
14100
14236
|
|
|
14101
14237
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
@@ -14105,7 +14241,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14105
14241
|
let snapshot;
|
|
14106
14242
|
try {
|
|
14107
14243
|
await access3(paths.statePath);
|
|
14108
|
-
snapshot = JSON.parse(await
|
|
14244
|
+
snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
|
|
14109
14245
|
} catch {
|
|
14110
14246
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
14111
14247
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -14143,7 +14279,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14143
14279
|
}
|
|
14144
14280
|
|
|
14145
14281
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
14146
|
-
import { readFile as
|
|
14282
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
14147
14283
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
14148
14284
|
if (names.length === 0)
|
|
14149
14285
|
return;
|
|
@@ -14159,7 +14295,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
14159
14295
|
const nameSet = new Set(names);
|
|
14160
14296
|
let snapshot;
|
|
14161
14297
|
try {
|
|
14162
|
-
snapshot = JSON.parse(await
|
|
14298
|
+
snapshot = JSON.parse(await readFile13(paths.statePath, "utf8"));
|
|
14163
14299
|
} catch {
|
|
14164
14300
|
return;
|
|
14165
14301
|
}
|
|
@@ -14358,15 +14494,15 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
14358
14494
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
14359
14495
|
function collectFiles(root, options = {}) {
|
|
14360
14496
|
const resolved = path4.resolve(root);
|
|
14361
|
-
let
|
|
14497
|
+
let stat6;
|
|
14362
14498
|
try {
|
|
14363
|
-
|
|
14499
|
+
stat6 = statSync5(resolved);
|
|
14364
14500
|
} catch (err) {
|
|
14365
14501
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
14366
14502
|
}
|
|
14367
|
-
if (
|
|
14503
|
+
if (stat6.isFile())
|
|
14368
14504
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
14369
|
-
if (!
|
|
14505
|
+
if (!stat6.isDirectory())
|
|
14370
14506
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
14371
14507
|
const result = {
|
|
14372
14508
|
filePaths: [],
|
|
@@ -14416,7 +14552,7 @@ function generateUlid(now = Date.now()) {
|
|
|
14416
14552
|
}
|
|
14417
14553
|
|
|
14418
14554
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14419
|
-
import { readFile as
|
|
14555
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
14420
14556
|
|
|
14421
14557
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
14422
14558
|
function migrateRecord(rec) {
|
|
@@ -14435,7 +14571,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
14435
14571
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14436
14572
|
async function readRunsFileMaybe() {
|
|
14437
14573
|
try {
|
|
14438
|
-
const raw = await
|
|
14574
|
+
const raw = await readFile14(runsFilePath(), "utf8");
|
|
14439
14575
|
const parsed = JSON.parse(raw);
|
|
14440
14576
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
14441
14577
|
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.`);
|
|
@@ -14451,13 +14587,13 @@ async function readRunsFileMaybe() {
|
|
|
14451
14587
|
}
|
|
14452
14588
|
|
|
14453
14589
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
14454
|
-
import { mkdir as mkdir4, rename as rename2, writeFile as
|
|
14590
|
+
import { mkdir as mkdir4, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
14455
14591
|
import { dirname as dirname15 } from "node:path";
|
|
14456
14592
|
async function writeRunsFileAtomic(file) {
|
|
14457
14593
|
await mkdir4(dirname15(runsFilePath()), { recursive: true });
|
|
14458
14594
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
14459
14595
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
14460
|
-
await
|
|
14596
|
+
await writeFile6(tmp, body, { mode: 384 });
|
|
14461
14597
|
await rename2(tmp, runsFilePath());
|
|
14462
14598
|
}
|
|
14463
14599
|
|
|
@@ -14494,7 +14630,7 @@ async function updateRun(id, patch) {
|
|
|
14494
14630
|
}
|
|
14495
14631
|
|
|
14496
14632
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14497
|
-
import { readFile as
|
|
14633
|
+
import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
|
|
14498
14634
|
import { resolve as resolve19 } from "node:path";
|
|
14499
14635
|
|
|
14500
14636
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
@@ -14522,7 +14658,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14522
14658
|
continue;
|
|
14523
14659
|
seen.add(abs);
|
|
14524
14660
|
try {
|
|
14525
|
-
const st = await
|
|
14661
|
+
const st = await stat3(abs);
|
|
14526
14662
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14527
14663
|
if (name)
|
|
14528
14664
|
entry.componentName = name;
|
|
@@ -14537,7 +14673,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14537
14673
|
const abs = resolve19(opts.rawTokensPath);
|
|
14538
14674
|
rawTokensPath = abs;
|
|
14539
14675
|
try {
|
|
14540
|
-
const [st, buf] = await Promise.all([
|
|
14676
|
+
const [st, buf] = await Promise.all([stat3(abs), readFile15(abs)]);
|
|
14541
14677
|
rawTokensMtime = st.mtime.toISOString();
|
|
14542
14678
|
rawTokensContentHash = sha256Hex(buf);
|
|
14543
14679
|
} catch {
|
|
@@ -14548,7 +14684,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14548
14684
|
|
|
14549
14685
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14550
14686
|
import { access as access4 } from "node:fs/promises";
|
|
14551
|
-
import { join as
|
|
14687
|
+
import { join as join15 } from "node:path";
|
|
14552
14688
|
|
|
14553
14689
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
|
|
14554
14690
|
var SAVE_FILES = ["components.json", "tokens.json"];
|
|
@@ -14558,7 +14694,7 @@ async function listConflictingFiles(path5) {
|
|
|
14558
14694
|
const conflicts = [];
|
|
14559
14695
|
for (const name of SAVE_FILES) {
|
|
14560
14696
|
try {
|
|
14561
|
-
await access4(
|
|
14697
|
+
await access4(join15(path5, name));
|
|
14562
14698
|
conflicts.push(name);
|
|
14563
14699
|
} catch {
|
|
14564
14700
|
}
|
|
@@ -14572,7 +14708,7 @@ async function detectSaveConflict(path5) {
|
|
|
14572
14708
|
}
|
|
14573
14709
|
|
|
14574
14710
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
|
|
14575
|
-
import { join as
|
|
14711
|
+
import { join as join16 } from "node:path";
|
|
14576
14712
|
function pad2(n) {
|
|
14577
14713
|
return n < 10 ? `0${n}` : String(n);
|
|
14578
14714
|
}
|
|
@@ -14583,7 +14719,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
14583
14719
|
const hh = pad2(now.getHours());
|
|
14584
14720
|
const mm = pad2(now.getMinutes());
|
|
14585
14721
|
const ss = pad2(now.getSeconds());
|
|
14586
|
-
return
|
|
14722
|
+
return join16(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
14587
14723
|
}
|
|
14588
14724
|
|
|
14589
14725
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
|
|
@@ -14619,12 +14755,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
14619
14755
|
}
|
|
14620
14756
|
|
|
14621
14757
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14622
|
-
import { readFile as
|
|
14758
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
14623
14759
|
async function loadAcceptedNames(sessionId) {
|
|
14624
14760
|
try {
|
|
14625
14761
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14626
14762
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14627
|
-
const raw = await
|
|
14763
|
+
const raw = await readFile16(paths.statePath, "utf8");
|
|
14628
14764
|
const snapshot = JSON.parse(raw);
|
|
14629
14765
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14630
14766
|
if (accepted.length === 0)
|
|
@@ -15950,11 +16086,11 @@ function formatApiError2(request) {
|
|
|
15950
16086
|
|
|
15951
16087
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
15952
16088
|
init_shared();
|
|
15953
|
-
import { readFile as
|
|
16089
|
+
import { readFile as readFile17, stat as stat5 } from "node:fs/promises";
|
|
15954
16090
|
|
|
15955
16091
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
15956
|
-
import { readdir as
|
|
15957
|
-
import { join as
|
|
16092
|
+
import { readdir as readdir3, stat as stat4 } from "node:fs/promises";
|
|
16093
|
+
import { join as join17 } from "node:path";
|
|
15958
16094
|
var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
|
|
15959
16095
|
async function collectJsonFiles(dir) {
|
|
15960
16096
|
const results = [];
|
|
@@ -15964,17 +16100,17 @@ async function collectJsonFiles(dir) {
|
|
|
15964
16100
|
async function walk(current, results) {
|
|
15965
16101
|
let entries;
|
|
15966
16102
|
try {
|
|
15967
|
-
entries = await
|
|
16103
|
+
entries = await readdir3(current);
|
|
15968
16104
|
} catch {
|
|
15969
16105
|
return;
|
|
15970
16106
|
}
|
|
15971
16107
|
await Promise.all(entries.map(async (entry) => {
|
|
15972
16108
|
if (IGNORE_TOKEN_DIRS.has(entry))
|
|
15973
16109
|
return;
|
|
15974
|
-
const full =
|
|
16110
|
+
const full = join17(current, entry);
|
|
15975
16111
|
let s;
|
|
15976
16112
|
try {
|
|
15977
|
-
s = await
|
|
16113
|
+
s = await stat4(full);
|
|
15978
16114
|
} catch {
|
|
15979
16115
|
return;
|
|
15980
16116
|
}
|
|
@@ -15990,7 +16126,7 @@ async function walk(current, results) {
|
|
|
15990
16126
|
async function readTokensFromPath(flag, p) {
|
|
15991
16127
|
let s;
|
|
15992
16128
|
try {
|
|
15993
|
-
s = await
|
|
16129
|
+
s = await stat5(p);
|
|
15994
16130
|
} catch {
|
|
15995
16131
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
15996
16132
|
}
|
|
@@ -16009,7 +16145,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16009
16145
|
const merged = {};
|
|
16010
16146
|
for (const file of files.sort()) {
|
|
16011
16147
|
try {
|
|
16012
|
-
const text = await
|
|
16148
|
+
const text = await readFile17(file, "utf8");
|
|
16013
16149
|
const parsed = JSON.parse(text);
|
|
16014
16150
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
16015
16151
|
Object.assign(merged, parsed);
|
|
@@ -16023,7 +16159,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16023
16159
|
async function readSingleFile(flag, p) {
|
|
16024
16160
|
let text;
|
|
16025
16161
|
try {
|
|
16026
|
-
text = await
|
|
16162
|
+
text = await readFile17(p, "utf8");
|
|
16027
16163
|
} catch {
|
|
16028
16164
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16029
16165
|
}
|
|
@@ -16068,8 +16204,8 @@ function buildContentfulManagementClient(request) {
|
|
|
16068
16204
|
}
|
|
16069
16205
|
|
|
16070
16206
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
|
|
16071
|
-
import { writeFile as
|
|
16072
|
-
import { join as
|
|
16207
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
16208
|
+
import { join as join18 } from "node:path";
|
|
16073
16209
|
|
|
16074
16210
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
|
|
16075
16211
|
import { fetchAll } from "contentful-management";
|
|
@@ -16101,8 +16237,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16101
16237
|
spaceId: request.spaceId,
|
|
16102
16238
|
environmentId: request.environmentId
|
|
16103
16239
|
});
|
|
16104
|
-
const path5 =
|
|
16105
|
-
await
|
|
16240
|
+
const path5 = join18(request.outDir, ".existing-entities.json");
|
|
16241
|
+
await writeFile7(path5, JSON.stringify(entities, null, 2), "utf8");
|
|
16106
16242
|
return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
|
|
16107
16243
|
} catch (error) {
|
|
16108
16244
|
return {
|
|
@@ -16114,12 +16250,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16114
16250
|
}
|
|
16115
16251
|
|
|
16116
16252
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
16117
|
-
import { readFile as
|
|
16253
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
16118
16254
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
16119
16255
|
if (!request.path)
|
|
16120
16256
|
return void 0;
|
|
16121
16257
|
try {
|
|
16122
|
-
const raw = await
|
|
16258
|
+
const raw = await readFile18(request.path, "utf8");
|
|
16123
16259
|
const parsed = JSON.parse(raw);
|
|
16124
16260
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
16125
16261
|
return void 0;
|
|
@@ -16884,7 +17020,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
16884
17020
|
}
|
|
16885
17021
|
|
|
16886
17022
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16887
|
-
import { readFile as
|
|
17023
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
16888
17024
|
|
|
16889
17025
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
16890
17026
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -16986,7 +17122,7 @@ function dedupeReasons(reasons) {
|
|
|
16986
17122
|
async function inspectComponentSource(component) {
|
|
16987
17123
|
let sourceText = "";
|
|
16988
17124
|
try {
|
|
16989
|
-
sourceText = await
|
|
17125
|
+
sourceText = await readFile19(component.source, "utf8");
|
|
16990
17126
|
} catch {
|
|
16991
17127
|
return {
|
|
16992
17128
|
wrapperConfidence: 0,
|
|
@@ -17425,7 +17561,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
17425
17561
|
}
|
|
17426
17562
|
|
|
17427
17563
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17428
|
-
import { readFile as
|
|
17564
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
17429
17565
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17430
17566
|
const paths = new Set(extraFiles);
|
|
17431
17567
|
for (const c2 of components) {
|
|
@@ -17435,7 +17571,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17435
17571
|
const out = [];
|
|
17436
17572
|
await Promise.all([...paths].map(async (p) => {
|
|
17437
17573
|
try {
|
|
17438
|
-
const content = await
|
|
17574
|
+
const content = await readFile20(p, "utf8");
|
|
17439
17575
|
out.push({ path: p, content });
|
|
17440
17576
|
} catch {
|
|
17441
17577
|
}
|
|
@@ -17606,15 +17742,15 @@ init_build_prompt();
|
|
|
17606
17742
|
init_create_local_cli_agent_invoker();
|
|
17607
17743
|
init_invoke_agent_with_output();
|
|
17608
17744
|
init_parse_token_tool_calls();
|
|
17609
|
-
import { readFile as
|
|
17610
|
-
import { basename as
|
|
17745
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
17746
|
+
import { basename as basename6, resolve as pathResolve } from "node:path";
|
|
17611
17747
|
init_cache_keys();
|
|
17612
17748
|
init_parse_prompt_overrides();
|
|
17613
17749
|
init_resolve_prompt_override();
|
|
17614
17750
|
|
|
17615
17751
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
17616
|
-
import { mkdir as mkdir7, writeFile as
|
|
17617
|
-
import { join as
|
|
17752
|
+
import { mkdir as mkdir7, writeFile as writeFile8 } from "node:fs/promises";
|
|
17753
|
+
import { join as join19 } from "node:path";
|
|
17618
17754
|
async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
17619
17755
|
onProgress?.({ kind: "writing-file" });
|
|
17620
17756
|
const result = getDtcgTokensForSession(db, sessionId);
|
|
@@ -17622,9 +17758,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
|
17622
17758
|
throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
|
|
17623
17759
|
}
|
|
17624
17760
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
17625
|
-
const tokensPath =
|
|
17761
|
+
const tokensPath = join19(outDir, "tokens.json");
|
|
17626
17762
|
await mkdir7(outDir, { recursive: true });
|
|
17627
|
-
await
|
|
17763
|
+
await writeFile8(tokensPath, `${JSON.stringify(tree, null, 2)}
|
|
17628
17764
|
`);
|
|
17629
17765
|
return { tokensPath, tokenCount: result.tokens.length };
|
|
17630
17766
|
}
|
|
@@ -17639,7 +17775,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17639
17775
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17640
17776
|
const tokensOverride = overridesMap.get("tokens");
|
|
17641
17777
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17642
|
-
const rawTokensInline = await
|
|
17778
|
+
const rawTokensInline = await readFile21(pathResolve(rawTokensPath), "utf8");
|
|
17643
17779
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17644
17780
|
const db = openPipelineDb();
|
|
17645
17781
|
try {
|
|
@@ -17667,7 +17803,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17667
17803
|
skill: "tokens",
|
|
17668
17804
|
mode: "autonomous",
|
|
17669
17805
|
rawTokensInline,
|
|
17670
|
-
rawTokensFilename:
|
|
17806
|
+
rawTokensFilename: basename6(pathResolve(rawTokensPath)),
|
|
17671
17807
|
outDir: process.cwd(),
|
|
17672
17808
|
...skillContentOverride ? { skillContentOverride } : skillPath ? { skillPathOverride: skillPath } : {}
|
|
17673
17809
|
});
|
|
@@ -18156,8 +18292,8 @@ function PathValidationScreen({
|
|
|
18156
18292
|
hasTokens = true
|
|
18157
18293
|
}) {
|
|
18158
18294
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
18159
|
-
const [scan, setScan] =
|
|
18160
|
-
|
|
18295
|
+
const [scan, setScan] = useState8();
|
|
18296
|
+
useEffect8(() => {
|
|
18161
18297
|
startDebugRun({
|
|
18162
18298
|
flow: "import/path-validation",
|
|
18163
18299
|
step: "03-path-validation",
|
|
@@ -18165,7 +18301,7 @@ function PathValidationScreen({
|
|
|
18165
18301
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
18166
18302
|
});
|
|
18167
18303
|
}, []);
|
|
18168
|
-
|
|
18304
|
+
useEffect8(() => {
|
|
18169
18305
|
setScan(scanFiles(resolvedPath));
|
|
18170
18306
|
}, [resolvedPath]);
|
|
18171
18307
|
const phase = phaseOf(scan, { hasTokens });
|
|
@@ -18207,12 +18343,12 @@ function PathValidationScreen({
|
|
|
18207
18343
|
}
|
|
18208
18344
|
|
|
18209
18345
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
18210
|
-
import { useEffect as
|
|
18346
|
+
import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
|
|
18211
18347
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
18212
18348
|
init_debug_store();
|
|
18213
18349
|
|
|
18214
18350
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
18215
|
-
import { useState as
|
|
18351
|
+
import { useState as useState9 } from "react";
|
|
18216
18352
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
18217
18353
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
18218
18354
|
function formLabelWidth(rows) {
|
|
@@ -18248,9 +18384,9 @@ function FieldForm({
|
|
|
18248
18384
|
busy = false,
|
|
18249
18385
|
children
|
|
18250
18386
|
}) {
|
|
18251
|
-
const [active, setActive] =
|
|
18252
|
-
const [editing, setEditing] =
|
|
18253
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
18387
|
+
const [active, setActive] = useState9(0);
|
|
18388
|
+
const [editing, setEditing] = useState9(false);
|
|
18389
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
18254
18390
|
const rowCount = fields2.length + actions.length;
|
|
18255
18391
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
18256
18392
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -18527,16 +18663,16 @@ function CredentialsScreen({
|
|
|
18527
18663
|
host: initial.host ?? ""
|
|
18528
18664
|
})
|
|
18529
18665
|
).current;
|
|
18530
|
-
const [values, setValues] =
|
|
18531
|
-
const [notice, setNotice] =
|
|
18532
|
-
const [validating, setValidating] =
|
|
18666
|
+
const [values, setValues] = useState10(initialValues);
|
|
18667
|
+
const [notice, setNotice] = useState10(null);
|
|
18668
|
+
const [validating, setValidating] = useState10(false);
|
|
18533
18669
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18534
|
-
const [editing, setEditing] =
|
|
18535
|
-
const [focus, setFocus] =
|
|
18536
|
-
const [active, setActive] =
|
|
18537
|
-
const [beforeEdit, setBeforeEdit] =
|
|
18670
|
+
const [editing, setEditing] = useState10(!prefilled);
|
|
18671
|
+
const [focus, setFocus] = useState10(0);
|
|
18672
|
+
const [active, setActive] = useState10(0);
|
|
18673
|
+
const [beforeEdit, setBeforeEdit] = useState10(initialValues);
|
|
18538
18674
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
18539
|
-
|
|
18675
|
+
useEffect9(() => {
|
|
18540
18676
|
startDebugRun({
|
|
18541
18677
|
flow: "import/credentials",
|
|
18542
18678
|
step: "04-credentials",
|
|
@@ -18858,7 +18994,7 @@ function ExtractionScreen({ progress, agent, rowMs }) {
|
|
|
18858
18994
|
}
|
|
18859
18995
|
|
|
18860
18996
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
18861
|
-
import { useEffect as
|
|
18997
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState11 } from "react";
|
|
18862
18998
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
18863
18999
|
init_debug_store();
|
|
18864
19000
|
|
|
@@ -18923,8 +19059,8 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
18923
19059
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
18924
19060
|
const rows = loaded.ok ? loaded.rows : [];
|
|
18925
19061
|
const columns = useTerminalWidth();
|
|
18926
|
-
const [selected, setSelected] =
|
|
18927
|
-
|
|
19062
|
+
const [selected, setSelected] = useState11(0);
|
|
19063
|
+
useEffect10(() => {
|
|
18928
19064
|
startDebugRun({
|
|
18929
19065
|
flow: "import/token-review",
|
|
18930
19066
|
step: "05-token-review",
|
|
@@ -19013,21 +19149,21 @@ init_config();
|
|
|
19013
19149
|
|
|
19014
19150
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19015
19151
|
init_debug_store();
|
|
19016
|
-
import { useEffect as
|
|
19152
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState12 } from "react";
|
|
19017
19153
|
|
|
19018
19154
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
19019
19155
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
19020
|
-
import { join as
|
|
19156
|
+
import { join as join21, resolve as resolve24 } from "node:path";
|
|
19021
19157
|
|
|
19022
19158
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
19023
19159
|
import { existsSync as existsSync10 } from "node:fs";
|
|
19024
|
-
import { dirname as dirname16, join as
|
|
19160
|
+
import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
|
|
19025
19161
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
19026
19162
|
function findSkillPath(fileName) {
|
|
19027
19163
|
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
19028
19164
|
let dir = thisDir;
|
|
19029
19165
|
for (; ; ) {
|
|
19030
|
-
const candidate =
|
|
19166
|
+
const candidate = join20(dir, "skills", fileName);
|
|
19031
19167
|
if (existsSync10(candidate)) return candidate;
|
|
19032
19168
|
const parent = resolve22(dir, "..");
|
|
19033
19169
|
if (parent === dir) {
|
|
@@ -19137,7 +19273,7 @@ var realDeps = {
|
|
|
19137
19273
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
19138
19274
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
19139
19275
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
19140
|
-
const outDir = input.outDir ??
|
|
19276
|
+
const outDir = input.outDir ?? join21(resolve24(input.projectPath), ".contentful");
|
|
19141
19277
|
let progress = initialProgress({
|
|
19142
19278
|
hasCredentials: input.credentials !== null,
|
|
19143
19279
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -19268,9 +19404,9 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
19268
19404
|
|
|
19269
19405
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19270
19406
|
function useExtraction(input) {
|
|
19271
|
-
const [state2, setState] =
|
|
19407
|
+
const [state2, setState] = useState12();
|
|
19272
19408
|
const current = useRef6();
|
|
19273
|
-
|
|
19409
|
+
useEffect11(() => {
|
|
19274
19410
|
current.current = input;
|
|
19275
19411
|
if (!input) {
|
|
19276
19412
|
setState(void 0);
|
|
@@ -19313,7 +19449,7 @@ function useExtraction(input) {
|
|
|
19313
19449
|
}
|
|
19314
19450
|
|
|
19315
19451
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19316
|
-
import { useEffect as
|
|
19452
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
|
|
19317
19453
|
|
|
19318
19454
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
|
|
19319
19455
|
var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
|
|
@@ -19346,9 +19482,9 @@ async function runTokensOnly(input, deps = realDeps2) {
|
|
|
19346
19482
|
|
|
19347
19483
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19348
19484
|
function useTokensOnly(input) {
|
|
19349
|
-
const [state2, setState] =
|
|
19485
|
+
const [state2, setState] = useState13();
|
|
19350
19486
|
const current = useRef7();
|
|
19351
|
-
|
|
19487
|
+
useEffect12(() => {
|
|
19352
19488
|
current.current = input;
|
|
19353
19489
|
if (!input) {
|
|
19354
19490
|
setState(void 0);
|
|
@@ -19367,7 +19503,7 @@ function useTokensOnly(input) {
|
|
|
19367
19503
|
|
|
19368
19504
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
19369
19505
|
init_debug_store();
|
|
19370
|
-
import { useEffect as
|
|
19506
|
+
import { useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
19371
19507
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
19372
19508
|
|
|
19373
19509
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts
|
|
@@ -19564,32 +19700,32 @@ function CounterStrip(props) {
|
|
|
19564
19700
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
19565
19701
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
19566
19702
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
19567
|
-
const
|
|
19703
|
+
const sep2 = condensed ? " | " : " ";
|
|
19568
19704
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
19569
19705
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19570
19706
|
labelGrp,
|
|
19571
19707
|
" "
|
|
19572
19708
|
] }),
|
|
19573
19709
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
19574
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19710
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19575
19711
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19576
19712
|
labelAcc,
|
|
19577
19713
|
" "
|
|
19578
19714
|
] }),
|
|
19579
19715
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
19580
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19716
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19581
19717
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19582
19718
|
labelRej,
|
|
19583
19719
|
" "
|
|
19584
19720
|
] }),
|
|
19585
19721
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
19586
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19722
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19587
19723
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19588
19724
|
labelUnd,
|
|
19589
19725
|
" "
|
|
19590
19726
|
] }),
|
|
19591
19727
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
19592
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19728
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 })
|
|
19593
19729
|
] }) });
|
|
19594
19730
|
}
|
|
19595
19731
|
|
|
@@ -20580,7 +20716,7 @@ function useImmediateInput(handler, enabled = true) {
|
|
|
20580
20716
|
|
|
20581
20717
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
20582
20718
|
import { useStdout as useStdout2 } from "ink";
|
|
20583
|
-
import { useEffect as
|
|
20719
|
+
import { useEffect as useEffect13, useState as useState14 } from "react";
|
|
20584
20720
|
function readTerminalSize(stdout) {
|
|
20585
20721
|
return {
|
|
20586
20722
|
columns: stdout?.columns ?? 80,
|
|
@@ -20589,8 +20725,8 @@ function readTerminalSize(stdout) {
|
|
|
20589
20725
|
}
|
|
20590
20726
|
function useTerminalSize() {
|
|
20591
20727
|
const { stdout } = useStdout2();
|
|
20592
|
-
const [size, setSize] =
|
|
20593
|
-
|
|
20728
|
+
const [size, setSize] = useState14(() => readTerminalSize(stdout));
|
|
20729
|
+
useEffect13(() => {
|
|
20594
20730
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
20595
20731
|
stdout?.on("resize", updateSize);
|
|
20596
20732
|
updateSize();
|
|
@@ -20773,7 +20909,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
20773
20909
|
}
|
|
20774
20910
|
|
|
20775
20911
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
20776
|
-
import { useEffect as
|
|
20912
|
+
import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState17 } from "react";
|
|
20777
20913
|
|
|
20778
20914
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
|
|
20779
20915
|
var TWO_COLUMN_MIN_WIDTH = 100;
|
|
@@ -21225,15 +21361,15 @@ function resolveGroupRoot(key, closures, cycleSet) {
|
|
|
21225
21361
|
}
|
|
21226
21362
|
|
|
21227
21363
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
21228
|
-
import { useState as
|
|
21364
|
+
import { useState as useState15 } from "react";
|
|
21229
21365
|
function useSidebarSearchState() {
|
|
21230
|
-
const [searchOpen, setSearchOpen] =
|
|
21231
|
-
const [searchQuery, setSearchQuery] =
|
|
21232
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
21233
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
21234
|
-
const [columnOneView, setColumnOneView] =
|
|
21235
|
-
const [activeFilters, setActiveFilters] =
|
|
21236
|
-
const [showHelp, setShowHelp] =
|
|
21366
|
+
const [searchOpen, setSearchOpen] = useState15(false);
|
|
21367
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
21368
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState15([]);
|
|
21369
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState15(null);
|
|
21370
|
+
const [columnOneView, setColumnOneView] = useState15("grouped");
|
|
21371
|
+
const [activeFilters, setActiveFilters] = useState15(/* @__PURE__ */ new Set());
|
|
21372
|
+
const [showHelp, setShowHelp] = useState15(false);
|
|
21237
21373
|
return {
|
|
21238
21374
|
searchOpen,
|
|
21239
21375
|
setSearchOpen,
|
|
@@ -21253,10 +21389,10 @@ function useSidebarSearchState() {
|
|
|
21253
21389
|
}
|
|
21254
21390
|
|
|
21255
21391
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
21256
|
-
import { useCallback, useState as
|
|
21392
|
+
import { useCallback, useState as useState16 } from "react";
|
|
21257
21393
|
function useOverlayPanel(opts) {
|
|
21258
21394
|
const { toggleKey, onClose } = opts;
|
|
21259
|
-
const [isOpen, setIsOpen] =
|
|
21395
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
21260
21396
|
const open = useCallback(() => {
|
|
21261
21397
|
setIsOpen(true);
|
|
21262
21398
|
}, []);
|
|
@@ -21470,16 +21606,16 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21470
21606
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
21471
21607
|
[totalWidth, tokenCount, tokensWidth]
|
|
21472
21608
|
);
|
|
21473
|
-
const [decisions, setDecisions] =
|
|
21474
|
-
const [nav, setNav] =
|
|
21475
|
-
const [focusedColumn, setFocusedColumn] =
|
|
21476
|
-
const [tokensCursor, setTokensCursor] =
|
|
21477
|
-
const [showDependencies, setShowDependencies] =
|
|
21478
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
21479
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
21609
|
+
const [decisions, setDecisions] = useState17(/* @__PURE__ */ new Map());
|
|
21610
|
+
const [nav, setNav] = useState17({ cursor: 0, scrollOffset: 0 });
|
|
21611
|
+
const [focusedColumn, setFocusedColumn] = useState17("main");
|
|
21612
|
+
const [tokensCursor, setTokensCursor] = useState17(0);
|
|
21613
|
+
const [showDependencies, setShowDependencies] = useState17(false);
|
|
21614
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState17(false);
|
|
21615
|
+
const [cyclesCursor, setCyclesCursor] = useState17(0);
|
|
21480
21616
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
21481
|
-
const [aiCursor, setAiCursor] =
|
|
21482
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
21617
|
+
const [aiCursor, setAiCursor] = useState17(0);
|
|
21618
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState17(null);
|
|
21483
21619
|
const search = useSidebarSearchState();
|
|
21484
21620
|
const {
|
|
21485
21621
|
searchOpen,
|
|
@@ -21504,13 +21640,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21504
21640
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
21505
21641
|
[slotCycles]
|
|
21506
21642
|
);
|
|
21507
|
-
const [expandedGroups, setExpandedGroups] =
|
|
21643
|
+
const [expandedGroups, setExpandedGroups] = useState17(() => {
|
|
21508
21644
|
const seed = new Set(closures.keys());
|
|
21509
21645
|
for (const p of cycleParticipants) seed.add(p);
|
|
21510
21646
|
return seed;
|
|
21511
21647
|
});
|
|
21512
21648
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
21513
|
-
|
|
21649
|
+
useEffect14(() => {
|
|
21514
21650
|
if (seededGroupsRef.current) return;
|
|
21515
21651
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
21516
21652
|
seededGroupsRef.current = true;
|
|
@@ -21601,7 +21737,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21601
21737
|
entryCount: 0
|
|
21602
21738
|
});
|
|
21603
21739
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
21604
|
-
|
|
21740
|
+
useEffect14(() => {
|
|
21605
21741
|
setNav((prev) => {
|
|
21606
21742
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
21607
21743
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -21972,7 +22108,7 @@ function ScopeGateScreen({
|
|
|
21972
22108
|
return loaded?.ok ? loaded.rows : [];
|
|
21973
22109
|
}, [tokensPath]);
|
|
21974
22110
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
21975
|
-
|
|
22111
|
+
useEffect15(() => {
|
|
21976
22112
|
startDebugRun({
|
|
21977
22113
|
flow: "import/scope-gate",
|
|
21978
22114
|
step: "07-scope-gate",
|
|
@@ -22094,7 +22230,7 @@ function ScopeGateScreen({
|
|
|
22094
22230
|
|
|
22095
22231
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
22096
22232
|
init_debug_store();
|
|
22097
|
-
import { useEffect as
|
|
22233
|
+
import { useEffect as useEffect16, useMemo as useMemo5, useRef as useRef10, useState as useState18 } from "react";
|
|
22098
22234
|
|
|
22099
22235
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
|
|
22100
22236
|
async function checkGenerationCache(input) {
|
|
@@ -22142,8 +22278,8 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22142
22278
|
const sessionId = input?.sessionId;
|
|
22143
22279
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
22144
22280
|
const cacheCheck = useRef10(void 0);
|
|
22145
|
-
const [confirmed, setConfirmed] =
|
|
22146
|
-
|
|
22281
|
+
const [confirmed, setConfirmed] = useState18();
|
|
22282
|
+
useEffect16(() => {
|
|
22147
22283
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
22148
22284
|
startDebugRun({
|
|
22149
22285
|
flow: "import/scope-gate",
|
|
@@ -22157,7 +22293,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22157
22293
|
exitMethod: "discarded"
|
|
22158
22294
|
});
|
|
22159
22295
|
}, [sessionId, loaded]);
|
|
22160
|
-
|
|
22296
|
+
useEffect16(() => {
|
|
22161
22297
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
22162
22298
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
22163
22299
|
}, [input, loaded]);
|
|
@@ -22272,7 +22408,7 @@ function GenerationScreen({
|
|
|
22272
22408
|
|
|
22273
22409
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22274
22410
|
init_debug_store();
|
|
22275
|
-
import { useEffect as
|
|
22411
|
+
import { useEffect as useEffect17, useRef as useRef11, useState as useState19 } from "react";
|
|
22276
22412
|
|
|
22277
22413
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
22278
22414
|
import { resolve as resolve25 } from "node:path";
|
|
@@ -22442,9 +22578,9 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
22442
22578
|
|
|
22443
22579
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22444
22580
|
function useGeneration(input) {
|
|
22445
|
-
const [state2, setState] =
|
|
22581
|
+
const [state2, setState] = useState19();
|
|
22446
22582
|
const current = useRef11();
|
|
22447
|
-
|
|
22583
|
+
useEffect17(() => {
|
|
22448
22584
|
current.current = input;
|
|
22449
22585
|
if (!input) {
|
|
22450
22586
|
setState(void 0);
|
|
@@ -22480,7 +22616,7 @@ function useGeneration(input) {
|
|
|
22480
22616
|
}
|
|
22481
22617
|
|
|
22482
22618
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
22483
|
-
import { join as
|
|
22619
|
+
import { join as join22 } from "node:path";
|
|
22484
22620
|
function buildFlowStart(input) {
|
|
22485
22621
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
22486
22622
|
const credentials = extraction.credentials ?? {
|
|
@@ -22493,7 +22629,7 @@ function buildFlowStart(input) {
|
|
|
22493
22629
|
handoff,
|
|
22494
22630
|
agent: extraction.agent,
|
|
22495
22631
|
projectPath: extraction.projectPath,
|
|
22496
|
-
outDir: extraction.projectPath ?
|
|
22632
|
+
outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
|
|
22497
22633
|
rawTokensPath: extraction.rawTokensPath,
|
|
22498
22634
|
credentials: {
|
|
22499
22635
|
spaceId: credentials.spaceId,
|
|
@@ -23019,7 +23155,7 @@ function PreviewValidationErrorScreen({
|
|
|
23019
23155
|
}
|
|
23020
23156
|
|
|
23021
23157
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
23022
|
-
import { useCallback as useCallback5, useEffect as
|
|
23158
|
+
import { useCallback as useCallback5, useEffect as useEffect25, useMemo as useMemo6, useRef as useRef17, useState as useState27 } from "react";
|
|
23023
23159
|
import figures8 from "figures";
|
|
23024
23160
|
|
|
23025
23161
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
|
|
@@ -23280,7 +23416,7 @@ function enumerateCycleBreaks(cycle, components) {
|
|
|
23280
23416
|
import { Box as Box32, Text as Text34 } from "ink";
|
|
23281
23417
|
|
|
23282
23418
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
23283
|
-
import React13, { useEffect as
|
|
23419
|
+
import React13, { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState20 } from "react";
|
|
23284
23420
|
import figures6 from "figures";
|
|
23285
23421
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
23286
23422
|
|
|
@@ -23988,11 +24124,11 @@ function FieldEditor({
|
|
|
23988
24124
|
headerHeight = 2
|
|
23989
24125
|
}) {
|
|
23990
24126
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
23991
|
-
const [editorState, setEditorState] =
|
|
23992
|
-
const [parseErr] =
|
|
23993
|
-
const [listScrollStart, setListScrollStart] =
|
|
24127
|
+
const [editorState, setEditorState] = useState20(initialState);
|
|
24128
|
+
const [parseErr] = useState20(parseError);
|
|
24129
|
+
const [listScrollStart, setListScrollStart] = useState20(0);
|
|
23994
24130
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
23995
|
-
const [rowHeights, setRowHeights] =
|
|
24131
|
+
const [rowHeights, setRowHeights] = useState20({});
|
|
23996
24132
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
23997
24133
|
const initialFocus = (() => {
|
|
23998
24134
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -24060,25 +24196,25 @@ function FieldEditor({
|
|
|
24060
24196
|
textCursor: 0
|
|
24061
24197
|
};
|
|
24062
24198
|
})();
|
|
24063
|
-
const [focusLevel, setFocusLevel] =
|
|
24064
|
-
const [propIdx, setPropIdx] =
|
|
24065
|
-
const [slotIdx, setSlotIdx] =
|
|
24066
|
-
const [inSlots, setInSlots] =
|
|
24067
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
24068
|
-
const [activeField, setActiveField] =
|
|
24069
|
-
const [editingField, setEditingField] =
|
|
24070
|
-
const [textCursor, setTextCursor] =
|
|
24071
|
-
const [valueCursor, setValueCursor] =
|
|
24072
|
-
const [editingValue, setEditingValue] =
|
|
24073
|
-
const [valueText, setValueText] =
|
|
24074
|
-
const [pickerCursor, setPickerCursor] =
|
|
24075
|
-
const [validationError, setValidationError] =
|
|
24076
|
-
const [cursorVisible] =
|
|
24077
|
-
const [sourceOpen, setSourceOpen] =
|
|
24078
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
24079
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
24080
|
-
const [showHelp, setShowHelp] =
|
|
24081
|
-
const [pendingDelete, setPendingDelete] =
|
|
24199
|
+
const [focusLevel, setFocusLevel] = useState20(initialFocus.focusLevel);
|
|
24200
|
+
const [propIdx, setPropIdx] = useState20(initialFocus.propIdx);
|
|
24201
|
+
const [slotIdx, setSlotIdx] = useState20(initialFocus.slotIdx);
|
|
24202
|
+
const [inSlots, setInSlots] = useState20(initialFocus.inSlots);
|
|
24203
|
+
const [inComponentDesc, setInComponentDesc] = useState20(initialFocus.focusLevel === "componentDescription");
|
|
24204
|
+
const [activeField, setActiveField] = useState20(initialFocus.activeField);
|
|
24205
|
+
const [editingField, setEditingField] = useState20(false);
|
|
24206
|
+
const [textCursor, setTextCursor] = useState20(initialFocus.textCursor);
|
|
24207
|
+
const [valueCursor, setValueCursor] = useState20(0);
|
|
24208
|
+
const [editingValue, setEditingValue] = useState20(null);
|
|
24209
|
+
const [valueText, setValueText] = useState20("");
|
|
24210
|
+
const [pickerCursor, setPickerCursor] = useState20(0);
|
|
24211
|
+
const [validationError, setValidationError] = useState20(null);
|
|
24212
|
+
const [cursorVisible] = useState20(true);
|
|
24213
|
+
const [sourceOpen, setSourceOpen] = useState20(false);
|
|
24214
|
+
const [rationaleOpen, setRationaleOpen] = useState20(false);
|
|
24215
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState20(0);
|
|
24216
|
+
const [showHelp, setShowHelp] = useState20(false);
|
|
24217
|
+
const [pendingDelete, setPendingDelete] = useState20(null);
|
|
24082
24218
|
const props = editorState.props;
|
|
24083
24219
|
const slots = editorState.slots;
|
|
24084
24220
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -24838,7 +24974,7 @@ function FieldEditor({
|
|
|
24838
24974
|
}
|
|
24839
24975
|
return Math.max(start + 1, end2);
|
|
24840
24976
|
};
|
|
24841
|
-
|
|
24977
|
+
useEffect18(() => {
|
|
24842
24978
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
24843
24979
|
setListScrollStart((previous) => {
|
|
24844
24980
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -25910,7 +26046,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25910
26046
|
}
|
|
25911
26047
|
|
|
25912
26048
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
25913
|
-
import { useCallback as useCallback2, useEffect as
|
|
26049
|
+
import { useCallback as useCallback2, useEffect as useEffect20, useRef as useRef13, useState as useState22 } from "react";
|
|
25914
26050
|
|
|
25915
26051
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
|
|
25916
26052
|
var DEFAULT_MAX_DEPTH = 50;
|
|
@@ -25966,7 +26102,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
|
|
|
25966
26102
|
}
|
|
25967
26103
|
|
|
25968
26104
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
25969
|
-
import { useEffect as
|
|
26105
|
+
import { useEffect as useEffect19, useRef as useRef12, useState as useState21 } from "react";
|
|
25970
26106
|
|
|
25971
26107
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
|
|
25972
26108
|
var TimeoutError = class extends Error {
|
|
@@ -26121,12 +26257,12 @@ function useReviewFinalizePreview({
|
|
|
26121
26257
|
}
|
|
26122
26258
|
function useFinalizePreview(opts) {
|
|
26123
26259
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
26124
|
-
const [status, setStatus] =
|
|
26125
|
-
const [removed, setRemoved] =
|
|
26126
|
-
const [scrollOffset, setScrollOffset] =
|
|
26260
|
+
const [status, setStatus] = useState21("idle");
|
|
26261
|
+
const [removed, setRemoved] = useState21([]);
|
|
26262
|
+
const [scrollOffset, setScrollOffset] = useState21(0);
|
|
26127
26263
|
const generationRef = useRef12(0);
|
|
26128
26264
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
26129
|
-
|
|
26265
|
+
useEffect19(() => {
|
|
26130
26266
|
if (!open) {
|
|
26131
26267
|
setStatus("idle");
|
|
26132
26268
|
setRemoved([]);
|
|
@@ -26176,10 +26312,10 @@ function useReviewSession({
|
|
|
26176
26312
|
tokensPath,
|
|
26177
26313
|
onExtraLoaded
|
|
26178
26314
|
}) {
|
|
26179
|
-
const [components, setComponents] =
|
|
26180
|
-
const [loading, setLoading] =
|
|
26181
|
-
const [loadError, setLoadError] =
|
|
26182
|
-
const [availableTokens, setAvailableTokens] =
|
|
26315
|
+
const [components, setComponents] = useState22([]);
|
|
26316
|
+
const [loading, setLoading] = useState22(true);
|
|
26317
|
+
const [loadError, setLoadError] = useState22(null);
|
|
26318
|
+
const [availableTokens, setAvailableTokens] = useState22([]);
|
|
26183
26319
|
const loadInitialState = useCallback2(async () => {
|
|
26184
26320
|
const result = loadSession();
|
|
26185
26321
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -26189,7 +26325,7 @@ function useReviewSession({
|
|
|
26189
26325
|
}));
|
|
26190
26326
|
return { result, catalog };
|
|
26191
26327
|
}, [loadSession, tokensPath]);
|
|
26192
|
-
|
|
26328
|
+
useEffect20(() => {
|
|
26193
26329
|
let disposed = false;
|
|
26194
26330
|
void (async () => {
|
|
26195
26331
|
try {
|
|
@@ -26240,9 +26376,9 @@ function useReviewSession({
|
|
|
26240
26376
|
};
|
|
26241
26377
|
}
|
|
26242
26378
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
26243
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
26244
|
-
const [componentRationale, setComponentRationale] =
|
|
26245
|
-
|
|
26379
|
+
const [reviewMetadata, setReviewMetadata] = useState22(null);
|
|
26380
|
+
const [componentRationale, setComponentRationale] = useState22(null);
|
|
26381
|
+
useEffect20(() => {
|
|
26246
26382
|
const current = components[selectedIdx];
|
|
26247
26383
|
if (!current) {
|
|
26248
26384
|
setReviewMetadata(null);
|
|
@@ -26280,7 +26416,7 @@ function useReviewHistory({
|
|
|
26280
26416
|
}) {
|
|
26281
26417
|
const historyRef = useRef13(null);
|
|
26282
26418
|
const historySeededRef = useRef13(false);
|
|
26283
|
-
|
|
26419
|
+
useEffect20(() => {
|
|
26284
26420
|
if (loading || historySeededRef.current) return;
|
|
26285
26421
|
historySeededRef.current = true;
|
|
26286
26422
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -26336,7 +26472,7 @@ function useReviewFinalize({
|
|
|
26336
26472
|
}
|
|
26337
26473
|
|
|
26338
26474
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
26339
|
-
import { useEffect as
|
|
26475
|
+
import { useEffect as useEffect21, useRef as useRef14, useState as useState23 } from "react";
|
|
26340
26476
|
|
|
26341
26477
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
|
|
26342
26478
|
function collectTokenSuggestions(entry, availableTokens = []) {
|
|
@@ -26375,21 +26511,21 @@ function useReviewEditor({
|
|
|
26375
26511
|
onEditSaved,
|
|
26376
26512
|
onTokenSaved
|
|
26377
26513
|
}) {
|
|
26378
|
-
const [panelOpen, setPanelOpen] =
|
|
26379
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
26380
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
26381
|
-
const [textEntryActive, setTextEntryActive] =
|
|
26382
|
-
const [showJson, setShowJson] =
|
|
26383
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
26384
|
-
const [draftValue, setDraftValue] =
|
|
26385
|
-
const [saveError, setSaveError] =
|
|
26386
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
26387
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
26388
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
26389
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
26514
|
+
const [panelOpen, setPanelOpen] = useState23("none");
|
|
26515
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState23(0);
|
|
26516
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState23(0);
|
|
26517
|
+
const [textEntryActive, setTextEntryActive] = useState23(false);
|
|
26518
|
+
const [showJson, setShowJson] = useState23(false);
|
|
26519
|
+
const [showHiddenProps, setShowHiddenProps] = useState23(false);
|
|
26520
|
+
const [draftValue, setDraftValue] = useState23("");
|
|
26521
|
+
const [saveError, setSaveError] = useState23(null);
|
|
26522
|
+
const [tokenReviewRow, setTokenReviewRow] = useState23(0);
|
|
26523
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState23(false);
|
|
26524
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState23(0);
|
|
26525
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState23(/* @__PURE__ */ new Set());
|
|
26390
26526
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
26391
26527
|
const pendingGRef = useRef14(false);
|
|
26392
|
-
|
|
26528
|
+
useEffect21(() => {
|
|
26393
26529
|
setTokenReviewRow(0);
|
|
26394
26530
|
setTokenReviewEditing(false);
|
|
26395
26531
|
setTokenReviewEditCursor(0);
|
|
@@ -26502,12 +26638,12 @@ function useReviewEditor({
|
|
|
26502
26638
|
}
|
|
26503
26639
|
|
|
26504
26640
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
26505
|
-
import { useState as
|
|
26641
|
+
import { useState as useState24 } from "react";
|
|
26506
26642
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
26507
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
26508
|
-
const [showFinalize, setShowFinalize] =
|
|
26509
|
-
const [showQuit, setShowQuit] =
|
|
26510
|
-
const [finalizeError, setFinalizeError] =
|
|
26643
|
+
const [sidebarFocused, setSidebarFocused] = useState24(true);
|
|
26644
|
+
const [showFinalize, setShowFinalize] = useState24(false);
|
|
26645
|
+
const [showQuit, setShowQuit] = useState24(false);
|
|
26646
|
+
const [finalizeError, setFinalizeError] = useState24(initialFinalizeError);
|
|
26511
26647
|
return {
|
|
26512
26648
|
sidebarFocused,
|
|
26513
26649
|
setSidebarFocused,
|
|
@@ -26801,7 +26937,7 @@ function handleJsonPanelInput(input, key, state2) {
|
|
|
26801
26937
|
}
|
|
26802
26938
|
|
|
26803
26939
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
26804
|
-
import { useCallback as useCallback4, useEffect as
|
|
26940
|
+
import { useCallback as useCallback4, useEffect as useEffect23, useState as useState26 } from "react";
|
|
26805
26941
|
|
|
26806
26942
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
|
|
26807
26943
|
function applyPreviewAnnotations(preview, localNames) {
|
|
@@ -26836,25 +26972,25 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26836
26972
|
}
|
|
26837
26973
|
|
|
26838
26974
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
26839
|
-
import { useCallback as useCallback3, useEffect as
|
|
26975
|
+
import { useCallback as useCallback3, useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
|
|
26840
26976
|
var DEFAULT_DEBOUNCE_MS = 500;
|
|
26841
26977
|
function useLivePreview(opts) {
|
|
26842
26978
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
26843
|
-
const [status, setStatus] =
|
|
26844
|
-
const [disabled, setDisabled] =
|
|
26979
|
+
const [status, setStatus] = useState25("idle");
|
|
26980
|
+
const [disabled, setDisabled] = useState25(false);
|
|
26845
26981
|
const timerRef = useRef15(null);
|
|
26846
26982
|
const generationRef = useRef15(0);
|
|
26847
26983
|
const latestRef = useRef15(0);
|
|
26848
26984
|
const inflightRef = useRef15(0);
|
|
26849
26985
|
const optsRef = useRef15(opts);
|
|
26850
|
-
|
|
26986
|
+
useEffect22(() => {
|
|
26851
26987
|
optsRef.current = opts;
|
|
26852
26988
|
});
|
|
26853
26989
|
const disabledRef = useRef15(disabled);
|
|
26854
|
-
|
|
26990
|
+
useEffect22(() => {
|
|
26855
26991
|
disabledRef.current = disabled;
|
|
26856
26992
|
}, [disabled]);
|
|
26857
|
-
|
|
26993
|
+
useEffect22(() => {
|
|
26858
26994
|
return () => {
|
|
26859
26995
|
if (timerRef.current) {
|
|
26860
26996
|
clearTimeout(timerRef.current);
|
|
@@ -26940,8 +27076,8 @@ function useReviewPreview({
|
|
|
26940
27076
|
deleteAllComponents,
|
|
26941
27077
|
onResult
|
|
26942
27078
|
}) {
|
|
26943
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
26944
|
-
const [removedComponents, setRemovedComponents] =
|
|
27079
|
+
const [previewAnnotations, setPreviewAnnotations] = useState26(/* @__PURE__ */ new Map());
|
|
27080
|
+
const [removedComponents, setRemovedComponents] = useState26([]);
|
|
26945
27081
|
const handleResult = useCallback4(
|
|
26946
27082
|
(response) => {
|
|
26947
27083
|
if (!response) return;
|
|
@@ -26967,14 +27103,14 @@ function useReviewPreview({
|
|
|
26967
27103
|
onResult: handleResult,
|
|
26968
27104
|
deleteAllComponents
|
|
26969
27105
|
});
|
|
26970
|
-
const [spinnerTick, setSpinnerTick] =
|
|
26971
|
-
|
|
27106
|
+
const [spinnerTick, setSpinnerTick] = useState26(0);
|
|
27107
|
+
useEffect23(() => {
|
|
26972
27108
|
if (livePreviewHook.status !== "running") return;
|
|
26973
27109
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
26974
27110
|
return () => clearInterval(id);
|
|
26975
27111
|
}, [livePreviewHook.status]);
|
|
26976
27112
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
26977
|
-
|
|
27113
|
+
useEffect23(() => {
|
|
26978
27114
|
if (loading) return;
|
|
26979
27115
|
if (!livePreview) return;
|
|
26980
27116
|
if (components.length === 0) return;
|
|
@@ -26985,7 +27121,7 @@ function useReviewPreview({
|
|
|
26985
27121
|
|
|
26986
27122
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
26987
27123
|
init_debug_store();
|
|
26988
|
-
import { useEffect as
|
|
27124
|
+
import { useEffect as useEffect24, useRef as useRef16 } from "react";
|
|
26989
27125
|
|
|
26990
27126
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
|
|
26991
27127
|
var REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
|
|
@@ -27057,7 +27193,7 @@ function useReviewLog({
|
|
|
27057
27193
|
const started = useRef16(false);
|
|
27058
27194
|
const latest = useRef16(components);
|
|
27059
27195
|
latest.current = components;
|
|
27060
|
-
|
|
27196
|
+
useEffect24(() => {
|
|
27061
27197
|
if (loading || started.current) return;
|
|
27062
27198
|
started.current = true;
|
|
27063
27199
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -27072,7 +27208,7 @@ function useReviewLog({
|
|
|
27072
27208
|
trail.current = openReviewTrail(components, Date.now());
|
|
27073
27209
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
27074
27210
|
}, [loading, loadError, components]);
|
|
27075
|
-
|
|
27211
|
+
useEffect24(
|
|
27076
27212
|
() => () => {
|
|
27077
27213
|
const open = trail.current;
|
|
27078
27214
|
trail.current = void 0;
|
|
@@ -27349,7 +27485,7 @@ function GenerateReviewStepView({
|
|
|
27349
27485
|
initialFinalizeError = null
|
|
27350
27486
|
}) {
|
|
27351
27487
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
27352
|
-
const [slotCycles, setSlotCycles] =
|
|
27488
|
+
const [slotCycles, setSlotCycles] = useState27([]);
|
|
27353
27489
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
27354
27490
|
setSlotCycles(cycles ?? []);
|
|
27355
27491
|
}, []);
|
|
@@ -27382,7 +27518,7 @@ function GenerateReviewStepView({
|
|
|
27382
27518
|
onExtraLoaded: setLoadedSlotCycles
|
|
27383
27519
|
});
|
|
27384
27520
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
27385
|
-
const [nav, setNav] =
|
|
27521
|
+
const [nav, setNav] = useState27({
|
|
27386
27522
|
cursorRowIdx: 0,
|
|
27387
27523
|
sidebarScrollOffset: 0
|
|
27388
27524
|
});
|
|
@@ -27398,10 +27534,10 @@ function GenerateReviewStepView({
|
|
|
27398
27534
|
finalizeError,
|
|
27399
27535
|
setFinalizeError
|
|
27400
27536
|
} = reviewSurface;
|
|
27401
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
27537
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState27(false);
|
|
27402
27538
|
const removedBannerDefaultedRef = useRef17(false);
|
|
27403
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
27404
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
27539
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState27(0);
|
|
27540
|
+
const [cyclesCursor, setCyclesCursor] = useState27(0);
|
|
27405
27541
|
const cyclePanel = useOverlayPanel({
|
|
27406
27542
|
toggleKey: "c",
|
|
27407
27543
|
onClose: () => {
|
|
@@ -27416,9 +27552,9 @@ function GenerateReviewStepView({
|
|
|
27416
27552
|
setBreakConfirm(false);
|
|
27417
27553
|
}
|
|
27418
27554
|
});
|
|
27419
|
-
const [breakCursor, setBreakCursor] =
|
|
27420
|
-
const [breakConfirm, setBreakConfirm] =
|
|
27421
|
-
const [expandedGroups, setExpandedGroups] =
|
|
27555
|
+
const [breakCursor, setBreakCursor] = useState27(0);
|
|
27556
|
+
const [breakConfirm, setBreakConfirm] = useState27(false);
|
|
27557
|
+
const [expandedGroups, setExpandedGroups] = useState27(/* @__PURE__ */ new Set());
|
|
27422
27558
|
const seededGroupsRef = useRef17(false);
|
|
27423
27559
|
const {
|
|
27424
27560
|
searchOpen,
|
|
@@ -27437,14 +27573,14 @@ function GenerateReviewStepView({
|
|
|
27437
27573
|
setShowHelp
|
|
27438
27574
|
} = useSidebarSearchState();
|
|
27439
27575
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
27440
|
-
const [breakingChanges, setBreakingChanges] =
|
|
27441
|
-
const [breakingCursor, setBreakingCursor] =
|
|
27442
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
27443
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
27444
|
-
const [autoRejected, setAutoRejected] =
|
|
27445
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
27576
|
+
const [breakingChanges, setBreakingChanges] = useState27([]);
|
|
27577
|
+
const [breakingCursor, setBreakingCursor] = useState27(0);
|
|
27578
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState27(false);
|
|
27579
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState27(null);
|
|
27580
|
+
const [autoRejected, setAutoRejected] = useState27([]);
|
|
27581
|
+
const [undoSnapshot, setUndoSnapshot] = useState27(null);
|
|
27446
27582
|
const autoRejectFiredRef = useRef17(false);
|
|
27447
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
27583
|
+
const [showReloadDialog, setShowReloadDialog] = useState27(false);
|
|
27448
27584
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
27449
27585
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
27450
27586
|
components,
|
|
@@ -27509,7 +27645,7 @@ function GenerateReviewStepView({
|
|
|
27509
27645
|
[components]
|
|
27510
27646
|
);
|
|
27511
27647
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
27512
|
-
|
|
27648
|
+
useEffect25(() => {
|
|
27513
27649
|
if (seededGroupsRef.current) return;
|
|
27514
27650
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
27515
27651
|
seededGroupsRef.current = true;
|
|
@@ -27536,7 +27672,7 @@ function GenerateReviewStepView({
|
|
|
27536
27672
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
27537
27673
|
}));
|
|
27538
27674
|
}, [slotCycles, cycleView]);
|
|
27539
|
-
|
|
27675
|
+
useEffect25(() => {
|
|
27540
27676
|
const decision = computeAutoRejectDecision({
|
|
27541
27677
|
loading,
|
|
27542
27678
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -27581,7 +27717,7 @@ function GenerateReviewStepView({
|
|
|
27581
27717
|
onAction: reviewLog.record
|
|
27582
27718
|
});
|
|
27583
27719
|
const autoRejectPushedRef = useRef17(false);
|
|
27584
|
-
|
|
27720
|
+
useEffect25(() => {
|
|
27585
27721
|
if (loading) return;
|
|
27586
27722
|
if (!historySeededRef.current) return;
|
|
27587
27723
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -27665,7 +27801,7 @@ function GenerateReviewStepView({
|
|
|
27665
27801
|
const panelHeight = leftPanelHeight + 2;
|
|
27666
27802
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
27667
27803
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
27668
|
-
|
|
27804
|
+
useEffect25(() => {
|
|
27669
27805
|
if (selectableRowPositions.length === 0) return;
|
|
27670
27806
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
27671
27807
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -28586,10 +28722,10 @@ function DoneStep({
|
|
|
28586
28722
|
}
|
|
28587
28723
|
|
|
28588
28724
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
28589
|
-
import { useState as
|
|
28725
|
+
import { useState as useState29 } from "react";
|
|
28590
28726
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
28591
28727
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
28592
|
-
import { dirname as dirname17, basename as
|
|
28728
|
+
import { dirname as dirname17, basename as basename7, join as join23 } from "node:path";
|
|
28593
28729
|
|
|
28594
28730
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
28595
28731
|
import { resolve as resolve26 } from "node:path";
|
|
@@ -28610,10 +28746,10 @@ function normalizePath(input) {
|
|
|
28610
28746
|
}
|
|
28611
28747
|
|
|
28612
28748
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
28613
|
-
import { useEffect as
|
|
28749
|
+
import { useEffect as useEffect26, useState as useState28 } from "react";
|
|
28614
28750
|
function useBlinkingCursor() {
|
|
28615
|
-
const [visible, setVisible] =
|
|
28616
|
-
|
|
28751
|
+
const [visible, setVisible] = useState28(true);
|
|
28752
|
+
useEffect26(() => {
|
|
28617
28753
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
28618
28754
|
return () => clearInterval(interval);
|
|
28619
28755
|
}, []);
|
|
@@ -28626,7 +28762,7 @@ function autocomplete(partial) {
|
|
|
28626
28762
|
if (!partial) return null;
|
|
28627
28763
|
const normalized = normalizePath(partial);
|
|
28628
28764
|
const dir = dirname17(normalized);
|
|
28629
|
-
const base =
|
|
28765
|
+
const base = basename7(normalized);
|
|
28630
28766
|
let entries;
|
|
28631
28767
|
try {
|
|
28632
28768
|
entries = readdirSync4(dir);
|
|
@@ -28635,13 +28771,13 @@ function autocomplete(partial) {
|
|
|
28635
28771
|
}
|
|
28636
28772
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
28637
28773
|
if (matches.length === 0) return null;
|
|
28638
|
-
if (matches.length === 1) return
|
|
28774
|
+
if (matches.length === 1) return join23(dir, matches[0]);
|
|
28639
28775
|
let prefix = matches[0];
|
|
28640
28776
|
for (const m of matches) {
|
|
28641
28777
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
28642
28778
|
if (!prefix) break;
|
|
28643
28779
|
}
|
|
28644
|
-
return prefix.length > base.length ?
|
|
28780
|
+
return prefix.length > base.length ? join23(dir, prefix) : null;
|
|
28645
28781
|
}
|
|
28646
28782
|
function PathPrompt({
|
|
28647
28783
|
defaultPath,
|
|
@@ -28650,7 +28786,7 @@ function PathPrompt({
|
|
|
28650
28786
|
label = "Save to",
|
|
28651
28787
|
summary
|
|
28652
28788
|
}) {
|
|
28653
|
-
const [input, setInput] =
|
|
28789
|
+
const [input, setInput] = useState29("");
|
|
28654
28790
|
const cursorVisible = useBlinkingCursor();
|
|
28655
28791
|
useImmediateInput((rawInput, key) => {
|
|
28656
28792
|
if (key.return) {
|
|
@@ -28729,12 +28865,12 @@ function countedThings({ components, tokens }, counts = {}) {
|
|
|
28729
28865
|
}
|
|
28730
28866
|
|
|
28731
28867
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
28732
|
-
import { useEffect as
|
|
28868
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
28733
28869
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
28734
28870
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
28735
28871
|
function useTimedSpinner() {
|
|
28736
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
28737
|
-
|
|
28872
|
+
const [elapsedSeconds, setElapsedSeconds] = useState30(0);
|
|
28873
|
+
useEffect27(() => {
|
|
28738
28874
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
28739
28875
|
return () => {
|
|
28740
28876
|
clearInterval(timer);
|
|
@@ -28796,7 +28932,7 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28796
28932
|
}
|
|
28797
28933
|
|
|
28798
28934
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
28799
|
-
import { useEffect as
|
|
28935
|
+
import { useEffect as useEffect28, useState as useState31, useMemo as useMemo7 } from "react";
|
|
28800
28936
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
28801
28937
|
|
|
28802
28938
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
|
|
@@ -29175,8 +29311,8 @@ function WizardPreviewStep({
|
|
|
29175
29311
|
onQuit
|
|
29176
29312
|
}) {
|
|
29177
29313
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
29178
|
-
const [diffExpanded, setDiffExpanded] =
|
|
29179
|
-
const [scrollOffset, setScrollOffset] =
|
|
29314
|
+
const [diffExpanded, setDiffExpanded] = useState31(false);
|
|
29315
|
+
const [scrollOffset, setScrollOffset] = useState31(0);
|
|
29180
29316
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
29181
29317
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
29182
29318
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -29191,7 +29327,7 @@ function WizardPreviewStep({
|
|
|
29191
29327
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
29192
29328
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
29193
29329
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
29194
|
-
|
|
29330
|
+
useEffect28(() => {
|
|
29195
29331
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
29196
29332
|
}, [maxScroll]);
|
|
29197
29333
|
useImmediateInput((input, key) => {
|
|
@@ -29283,7 +29419,7 @@ function buildRunTeaserLine(runId) {
|
|
|
29283
29419
|
|
|
29284
29420
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
29285
29421
|
init_debug_store();
|
|
29286
|
-
import { useEffect as
|
|
29422
|
+
import { useEffect as useEffect29, useRef as useRef18 } from "react";
|
|
29287
29423
|
|
|
29288
29424
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
29289
29425
|
var FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
@@ -29438,7 +29574,7 @@ function flowFinish(trail, final, now) {
|
|
|
29438
29574
|
function useFlowLog(state2) {
|
|
29439
29575
|
const trail = useRef18(void 0);
|
|
29440
29576
|
const previous = useRef18(void 0);
|
|
29441
|
-
|
|
29577
|
+
useEffect29(() => {
|
|
29442
29578
|
const before = previous.current;
|
|
29443
29579
|
previous.current = state2;
|
|
29444
29580
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -29461,7 +29597,7 @@ function useFlowLog(state2) {
|
|
|
29461
29597
|
trail.current = open;
|
|
29462
29598
|
setDebugRunProgress(flowProgress(open, now));
|
|
29463
29599
|
}, [state2]);
|
|
29464
|
-
|
|
29600
|
+
useEffect29(
|
|
29465
29601
|
() => () => {
|
|
29466
29602
|
const open = trail.current;
|
|
29467
29603
|
trail.current = void 0;
|
|
@@ -29600,13 +29736,13 @@ function FlowScreen({
|
|
|
29600
29736
|
}
|
|
29601
29737
|
|
|
29602
29738
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
29603
|
-
import { useEffect as
|
|
29739
|
+
import { useEffect as useEffect30, useRef as useRef19, useSyncExternalStore } from "react";
|
|
29604
29740
|
|
|
29605
29741
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
29606
29742
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
29607
29743
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
29608
29744
|
import { tmpdir } from "node:os";
|
|
29609
|
-
import { join as
|
|
29745
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
29610
29746
|
|
|
29611
29747
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
29612
29748
|
function shouldBypassPreview(state2) {
|
|
@@ -29955,8 +30091,8 @@ function pushFailure(e, deps) {
|
|
|
29955
30091
|
}
|
|
29956
30092
|
|
|
29957
30093
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
29958
|
-
import { writeFile as
|
|
29959
|
-
import { join as
|
|
30094
|
+
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
30095
|
+
import { join as join24 } from "node:path";
|
|
29960
30096
|
|
|
29961
30097
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
|
|
29962
30098
|
function nextStateAfterPrint(opts) {
|
|
@@ -29980,7 +30116,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
29980
30116
|
var realSaveDeps = () => ({
|
|
29981
30117
|
openDb: openPipelineDb,
|
|
29982
30118
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
29983
|
-
writeFile: (path5, contents) =>
|
|
30119
|
+
writeFile: (path5, contents) => writeFile9(path5, contents),
|
|
29984
30120
|
appendRun,
|
|
29985
30121
|
buildSourceFingerprint,
|
|
29986
30122
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -29988,7 +30124,7 @@ var realSaveDeps = () => ({
|
|
|
29988
30124
|
});
|
|
29989
30125
|
async function runPrintFiles(input, deps, onPatch) {
|
|
29990
30126
|
onPatch({ step: "printing" });
|
|
29991
|
-
const componentsPath =
|
|
30127
|
+
const componentsPath = join24(input.outDir, "components.json");
|
|
29992
30128
|
try {
|
|
29993
30129
|
const db = deps.openDb();
|
|
29994
30130
|
let components = [];
|
|
@@ -30073,7 +30209,7 @@ var EMPTY_PUSH_RESULT = {
|
|
|
30073
30209
|
};
|
|
30074
30210
|
|
|
30075
30211
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
30076
|
-
var WIZARD_LOG =
|
|
30212
|
+
var WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
30077
30213
|
function appendWizardLog(entry) {
|
|
30078
30214
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
30079
30215
|
}
|
|
@@ -30366,14 +30502,14 @@ function useFlow(start, options = {}) {
|
|
|
30366
30502
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
30367
30503
|
() => current?.getState()
|
|
30368
30504
|
);
|
|
30369
|
-
|
|
30505
|
+
useEffect30(() => {
|
|
30370
30506
|
if (!start) controller.current = void 0;
|
|
30371
30507
|
}, [start]);
|
|
30372
30508
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
30373
30509
|
}
|
|
30374
30510
|
|
|
30375
30511
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
30376
|
-
import { useEffect as
|
|
30512
|
+
import { useEffect as useEffect31, useState as useState32 } from "react";
|
|
30377
30513
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
30378
30514
|
init_debug_store();
|
|
30379
30515
|
|
|
@@ -30384,7 +30520,7 @@ init_debug_mode_store();
|
|
|
30384
30520
|
init_version();
|
|
30385
30521
|
|
|
30386
30522
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
30387
|
-
import { join as
|
|
30523
|
+
import { join as join26, resolve as resolve28 } from "node:path";
|
|
30388
30524
|
function describeFileLocations({
|
|
30389
30525
|
contentfulBaseDir,
|
|
30390
30526
|
debugModeEnabled,
|
|
@@ -30393,14 +30529,14 @@ function describeFileLocations({
|
|
|
30393
30529
|
if (!debugModeEnabled) {
|
|
30394
30530
|
return {
|
|
30395
30531
|
debugLogs: "none while Debug Mode is off",
|
|
30396
|
-
importFiles: `${
|
|
30532
|
+
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
30397
30533
|
};
|
|
30398
30534
|
}
|
|
30399
30535
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
30400
|
-
const session = currentSessionDir2 ??
|
|
30536
|
+
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
30401
30537
|
return {
|
|
30402
|
-
debugLogs:
|
|
30403
|
-
importFiles: `${
|
|
30538
|
+
debugLogs: join26(session, "debug"),
|
|
30539
|
+
importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
30404
30540
|
};
|
|
30405
30541
|
}
|
|
30406
30542
|
|
|
@@ -30446,8 +30582,8 @@ function Section({ title, rows }) {
|
|
|
30446
30582
|
] });
|
|
30447
30583
|
}
|
|
30448
30584
|
function HelpScreen({ onDone }) {
|
|
30449
|
-
const [info, setInfo] =
|
|
30450
|
-
|
|
30585
|
+
const [info, setInfo] = useState32();
|
|
30586
|
+
useEffect31(() => {
|
|
30451
30587
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
30452
30588
|
void readHelpInfo().then(setInfo);
|
|
30453
30589
|
}, []);
|
|
@@ -30485,14 +30621,14 @@ function HelpScreen({ onDone }) {
|
|
|
30485
30621
|
}
|
|
30486
30622
|
|
|
30487
30623
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
30488
|
-
import { useState as
|
|
30624
|
+
import { useState as useState33 } from "react";
|
|
30489
30625
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
30490
30626
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
30491
30627
|
function SettingsScreen({
|
|
30492
30628
|
onNavigate,
|
|
30493
30629
|
onBack
|
|
30494
30630
|
}) {
|
|
30495
|
-
const [focusIdx, setFocusIdx] =
|
|
30631
|
+
const [focusIdx, setFocusIdx] = useState33(0);
|
|
30496
30632
|
const items = [
|
|
30497
30633
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
30498
30634
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -30540,11 +30676,11 @@ function SettingsScreen({
|
|
|
30540
30676
|
}
|
|
30541
30677
|
|
|
30542
30678
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
30543
|
-
import { useState as
|
|
30679
|
+
import { useState as useState37 } from "react";
|
|
30544
30680
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
30545
30681
|
|
|
30546
30682
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
30547
|
-
import { useEffect as
|
|
30683
|
+
import { useEffect as useEffect33, useRef as useRef20, useState as useState35 } from "react";
|
|
30548
30684
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
30549
30685
|
init_debug_store();
|
|
30550
30686
|
|
|
@@ -30840,7 +30976,7 @@ async function writeAgentConfig(config) {
|
|
|
30840
30976
|
}
|
|
30841
30977
|
|
|
30842
30978
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30843
|
-
import { useEffect as
|
|
30979
|
+
import { useEffect as useEffect32, useState as useState34 } from "react";
|
|
30844
30980
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
30845
30981
|
|
|
30846
30982
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
@@ -30899,11 +31035,11 @@ function AgentDetail({
|
|
|
30899
31035
|
record: record3
|
|
30900
31036
|
}) {
|
|
30901
31037
|
const settings = config.agents[name];
|
|
30902
|
-
const [saving, setSaving] =
|
|
30903
|
-
const [testing, setTesting] =
|
|
30904
|
-
const [notice, setNotice] =
|
|
30905
|
-
const [checks, setChecks] =
|
|
30906
|
-
|
|
31038
|
+
const [saving, setSaving] = useState34(false);
|
|
31039
|
+
const [testing, setTesting] = useState34(false);
|
|
31040
|
+
const [notice, setNotice] = useState34(null);
|
|
31041
|
+
const [checks, setChecks] = useState34(void 0);
|
|
31042
|
+
useEffect32(() => {
|
|
30907
31043
|
let active = true;
|
|
30908
31044
|
setChecks(void 0);
|
|
30909
31045
|
const timer = setTimeout(() => {
|
|
@@ -30981,13 +31117,13 @@ import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-
|
|
|
30981
31117
|
var NAME_WIDTH = 16;
|
|
30982
31118
|
var PANEL_LABEL_WIDTH = "Command".length;
|
|
30983
31119
|
function AgentsScreen({ onDone }) {
|
|
30984
|
-
const [config, setConfig] =
|
|
30985
|
-
const [focus, setFocus] =
|
|
30986
|
-
const [open, setOpen] =
|
|
30987
|
-
const [notice, setNotice] =
|
|
30988
|
-
const [saving, setSaving] =
|
|
30989
|
-
const [loadError, setLoadError] =
|
|
30990
|
-
const [checks, setChecks] =
|
|
31120
|
+
const [config, setConfig] = useState35(null);
|
|
31121
|
+
const [focus, setFocus] = useState35(0);
|
|
31122
|
+
const [open, setOpen] = useState35(null);
|
|
31123
|
+
const [notice, setNotice] = useState35(null);
|
|
31124
|
+
const [saving, setSaving] = useState35(false);
|
|
31125
|
+
const [loadError, setLoadError] = useState35(null);
|
|
31126
|
+
const [checks, setChecks] = useState35({});
|
|
30991
31127
|
const visit = useRef20({
|
|
30992
31128
|
trail: createTrail(),
|
|
30993
31129
|
before: void 0,
|
|
@@ -31001,7 +31137,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31001
31137
|
);
|
|
31002
31138
|
}
|
|
31003
31139
|
};
|
|
31004
|
-
|
|
31140
|
+
useEffect33(() => {
|
|
31005
31141
|
readAgentConfig().then((loaded) => {
|
|
31006
31142
|
setConfig(loaded);
|
|
31007
31143
|
inspectAll(loaded);
|
|
@@ -31178,7 +31314,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31178
31314
|
}
|
|
31179
31315
|
|
|
31180
31316
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
31181
|
-
import { useEffect as
|
|
31317
|
+
import { useEffect as useEffect34, useRef as useRef21, useState as useState36 } from "react";
|
|
31182
31318
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
31183
31319
|
init_debug_store();
|
|
31184
31320
|
|
|
@@ -31232,10 +31368,10 @@ function debugFields(config) {
|
|
|
31232
31368
|
var snapshotOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31233
31369
|
var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31234
31370
|
function ProjectScreen({ onDone }) {
|
|
31235
|
-
const [config, setConfig] =
|
|
31236
|
-
const [saving, setSaving] =
|
|
31237
|
-
const [notice, setNotice] =
|
|
31238
|
-
const [loadError, setLoadError] =
|
|
31371
|
+
const [config, setConfig] = useState36(null);
|
|
31372
|
+
const [saving, setSaving] = useState36(false);
|
|
31373
|
+
const [notice, setNotice] = useState36(null);
|
|
31374
|
+
const [loadError, setLoadError] = useState36(null);
|
|
31239
31375
|
const visit = useRef21({
|
|
31240
31376
|
trail: createTrail(),
|
|
31241
31377
|
before: void 0,
|
|
@@ -31243,7 +31379,7 @@ function ProjectScreen({ onDone }) {
|
|
|
31243
31379
|
error: ""
|
|
31244
31380
|
}).current;
|
|
31245
31381
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
31246
|
-
|
|
31382
|
+
useEffect34(() => {
|
|
31247
31383
|
readCredentials().then((cfg) => {
|
|
31248
31384
|
setConfig(cfg);
|
|
31249
31385
|
visit.before = snapshotOf(cfg);
|
|
@@ -31351,8 +31487,8 @@ var SECTIONS = [
|
|
|
31351
31487
|
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
31352
31488
|
];
|
|
31353
31489
|
function ConfigurationScreen({ onDone }) {
|
|
31354
|
-
const [focus, setFocus] =
|
|
31355
|
-
const [open, setOpen] =
|
|
31490
|
+
const [focus, setFocus] = useState37(0);
|
|
31491
|
+
const [open, setOpen] = useState37(null);
|
|
31356
31492
|
const close = () => setOpen(null);
|
|
31357
31493
|
useInput17((input, key) => {
|
|
31358
31494
|
if (open) return;
|
|
@@ -31395,7 +31531,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
31395
31531
|
}
|
|
31396
31532
|
|
|
31397
31533
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
31398
|
-
import { useEffect as
|
|
31534
|
+
import { useEffect as useEffect35, useState as useState38 } from "react";
|
|
31399
31535
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
31400
31536
|
|
|
31401
31537
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
@@ -31417,9 +31553,9 @@ async function writeAnalyticsSetting(setting) {
|
|
|
31417
31553
|
init_debug_store();
|
|
31418
31554
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
31419
31555
|
function OptInAnalyticsScreen({ onDone }) {
|
|
31420
|
-
const [loading, setLoading] =
|
|
31421
|
-
const [enabled, setEnabled] =
|
|
31422
|
-
|
|
31556
|
+
const [loading, setLoading] = useState38(true);
|
|
31557
|
+
const [enabled, setEnabled] = useState38(true);
|
|
31558
|
+
useEffect35(() => {
|
|
31423
31559
|
readAnalyticsSetting().then((setting) => {
|
|
31424
31560
|
setEnabled(setting.enabled);
|
|
31425
31561
|
setLoading(false);
|
|
@@ -31473,7 +31609,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
31473
31609
|
}
|
|
31474
31610
|
|
|
31475
31611
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
31476
|
-
import { useEffect as
|
|
31612
|
+
import { useEffect as useEffect36, useRef as useRef22, useState as useState39 } from "react";
|
|
31477
31613
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
31478
31614
|
init_debug_mode_store();
|
|
31479
31615
|
init_debug_store();
|
|
@@ -31484,14 +31620,14 @@ var snapshotOf2 = (setting) => ({
|
|
|
31484
31620
|
retentionDays: String(setting.retentionDays)
|
|
31485
31621
|
});
|
|
31486
31622
|
function DebugModeScreen({ onDone }) {
|
|
31487
|
-
const [setting, setSetting] =
|
|
31488
|
-
const [focus, setFocus] =
|
|
31489
|
-
const [pending, setPending] =
|
|
31623
|
+
const [setting, setSetting] = useState39(null);
|
|
31624
|
+
const [focus, setFocus] = useState39("enabled");
|
|
31625
|
+
const [pending, setPending] = useState39(
|
|
31490
31626
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
31491
31627
|
);
|
|
31492
|
-
const [notice, setNotice] =
|
|
31628
|
+
const [notice, setNotice] = useState39(null);
|
|
31493
31629
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
31494
|
-
|
|
31630
|
+
useEffect36(() => {
|
|
31495
31631
|
readDebugModeSetting().then((loaded) => {
|
|
31496
31632
|
setSetting(loaded);
|
|
31497
31633
|
setPending(loaded.retentionDays);
|
|
@@ -31615,18 +31751,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
31615
31751
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
31616
31752
|
var TOKENS_ONLY_HIDDEN_STEPS = ["extraction", "scope-gate"];
|
|
31617
31753
|
function App({ importOptions, inkClear }) {
|
|
31618
|
-
const [screen, setScreen] =
|
|
31619
|
-
const [importExitCode, setImportExitCode] =
|
|
31754
|
+
const [screen, setScreen] = useState40("start");
|
|
31755
|
+
const [importExitCode, setImportExitCode] = useState40();
|
|
31620
31756
|
const showImportResult = importExitCode !== void 0;
|
|
31621
|
-
const [target, setTarget] =
|
|
31622
|
-
const [answers, setAnswers] =
|
|
31757
|
+
const [target, setTarget] = useState40();
|
|
31758
|
+
const [answers, setAnswers] = useState40({});
|
|
31623
31759
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
31624
|
-
const [extractionRun, setExtractionRun] =
|
|
31760
|
+
const [extractionRun, setExtractionRun] = useState40();
|
|
31625
31761
|
const extraction = useExtraction(extractionRun?.input);
|
|
31626
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
31762
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState40();
|
|
31627
31763
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
31628
|
-
const [tokenReview, setTokenReview] =
|
|
31629
|
-
const [scopeRun, setScopeRun] =
|
|
31764
|
+
const [tokenReview, setTokenReview] = useState40();
|
|
31765
|
+
const [scopeRun, setScopeRun] = useState40();
|
|
31630
31766
|
const scopeFlow = useScopeGateFlow(
|
|
31631
31767
|
scopeRun && {
|
|
31632
31768
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -31641,12 +31777,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31641
31777
|
}
|
|
31642
31778
|
}
|
|
31643
31779
|
);
|
|
31644
|
-
const [generationInput, setGenerationInput] =
|
|
31780
|
+
const [generationInput, setGenerationInput] = useState40();
|
|
31645
31781
|
const generation = useGeneration(generationInput);
|
|
31646
|
-
const [flowStart, setFlowStart] =
|
|
31782
|
+
const [flowStart, setFlowStart] = useState40();
|
|
31647
31783
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
31648
|
-
const [importDefaults, setImportDefaults] =
|
|
31649
|
-
|
|
31784
|
+
const [importDefaults, setImportDefaults] = useState40();
|
|
31785
|
+
useEffect37(() => {
|
|
31650
31786
|
if (screen !== "import") {
|
|
31651
31787
|
setImportDefaults(void 0);
|
|
31652
31788
|
return;
|
|
@@ -31719,7 +31855,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31719
31855
|
}
|
|
31720
31856
|
});
|
|
31721
31857
|
};
|
|
31722
|
-
|
|
31858
|
+
useEffect37(() => {
|
|
31723
31859
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
31724
31860
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
31725
31861
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -31741,12 +31877,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31741
31877
|
}
|
|
31742
31878
|
});
|
|
31743
31879
|
}, [tokensOnly, tokensOnlyRun]);
|
|
31744
|
-
|
|
31880
|
+
useEffect37(() => {
|
|
31745
31881
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
31746
31882
|
setExtractionRun(void 0);
|
|
31747
31883
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
31748
31884
|
}, [extraction, extractionRun]);
|
|
31749
|
-
|
|
31885
|
+
useEffect37(() => {
|
|
31750
31886
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
31751
31887
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31752
31888
|
setGenerationInput({
|
|
@@ -31764,7 +31900,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31764
31900
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
31765
31901
|
});
|
|
31766
31902
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
31767
|
-
|
|
31903
|
+
useEffect37(() => {
|
|
31768
31904
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
31769
31905
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31770
31906
|
inkClear();
|