@contentful/experience-design-system-cli 2.42.1-dev-build-9c1908dc.0 → 2.42.1-dev-build-9a3d743e.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 +538 -404
- package/dist/index.js +437 -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,108 @@ 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 `Debug logs saved to ${bundle.path}
|
|
2932
|
+
Send this file to Contentful support so they can look into it.`;
|
|
2933
|
+
case "no-logs":
|
|
2934
|
+
return "No debug logs were recorded. To get help, turn on Debug Mode in Settings, run the import again and send the zip file it saves to Contentful support.";
|
|
2935
|
+
case "failed":
|
|
2936
|
+
return `Your debug logs are in ${bundle.folder}
|
|
2937
|
+
Zip that folder and send it to Contentful support so they can look into it.`;
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2825
2941
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
|
|
2826
2942
|
import { useInput as useInput4 } from "ink";
|
|
2827
2943
|
|
|
@@ -2853,6 +2969,22 @@ function useErrorControls(handlers) {
|
|
|
2853
2969
|
});
|
|
2854
2970
|
}
|
|
2855
2971
|
|
|
2972
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
|
|
2973
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
2974
|
+
function useSupportBundle() {
|
|
2975
|
+
const [bundle, setBundle] = useState3();
|
|
2976
|
+
useEffect3(() => {
|
|
2977
|
+
let active = true;
|
|
2978
|
+
void bundleDebugLogs().then((result) => {
|
|
2979
|
+
if (active) setBundle(result);
|
|
2980
|
+
});
|
|
2981
|
+
return () => {
|
|
2982
|
+
active = false;
|
|
2983
|
+
};
|
|
2984
|
+
}, []);
|
|
2985
|
+
return bundle;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2856
2988
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2857
2989
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2858
2990
|
function ErrorStep({
|
|
@@ -2863,6 +2995,7 @@ function ErrorStep({
|
|
|
2863
2995
|
onAcknowledgeBreakingChanges
|
|
2864
2996
|
}) {
|
|
2865
2997
|
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
2998
|
+
const bundle = useSupportBundle();
|
|
2866
2999
|
const controls = errorControls({
|
|
2867
3000
|
canRetry: onRetryCredentials !== void 0,
|
|
2868
3001
|
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
@@ -2874,6 +3007,7 @@ function ErrorStep({
|
|
|
2874
3007
|
" failed"
|
|
2875
3008
|
] }),
|
|
2876
3009
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
3010
|
+
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
2877
3011
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
2878
3012
|
"[",
|
|
2879
3013
|
control.keys,
|
|
@@ -3090,10 +3224,10 @@ var PROGRESS_THEME = extendTheme(defaultTheme, {
|
|
|
3090
3224
|
});
|
|
3091
3225
|
|
|
3092
3226
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
3093
|
-
import { useEffect as
|
|
3227
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
3094
3228
|
function useElapsed() {
|
|
3095
|
-
const [seconds2, setSeconds] =
|
|
3096
|
-
|
|
3229
|
+
const [seconds2, setSeconds] = useState4(0);
|
|
3230
|
+
useEffect4(() => {
|
|
3097
3231
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
3098
3232
|
return () => clearInterval(timer);
|
|
3099
3233
|
}, []);
|
|
@@ -3149,9 +3283,9 @@ function RunningStep({
|
|
|
3149
3283
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3150
3284
|
var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
|
|
3151
3285
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
3152
|
-
const [focus, setFocus] =
|
|
3286
|
+
const [focus, setFocus] = useState5(0);
|
|
3153
3287
|
const viewed = useRef([optionAt(0)]).current;
|
|
3154
|
-
|
|
3288
|
+
useEffect5(() => {
|
|
3155
3289
|
startDebugRun({
|
|
3156
3290
|
flow: "import/preflight",
|
|
3157
3291
|
step: "00-preflight",
|
|
@@ -3194,7 +3328,7 @@ function PreflightScreen({ onChoose, onQuit }) {
|
|
|
3194
3328
|
}
|
|
3195
3329
|
|
|
3196
3330
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3197
|
-
import { useEffect as
|
|
3331
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
3198
3332
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
3199
3333
|
init_debug_store();
|
|
3200
3334
|
|
|
@@ -3254,9 +3388,9 @@ function useWelcomeControls(onQuit) {
|
|
|
3254
3388
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3255
3389
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3256
3390
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
3257
|
-
const [projectPath, setProjectPath] =
|
|
3391
|
+
const [projectPath, setProjectPath] = useState6(initialPath);
|
|
3258
3392
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
3259
|
-
|
|
3393
|
+
useEffect6(() => {
|
|
3260
3394
|
startDebugRun({
|
|
3261
3395
|
flow: "import/welcome",
|
|
3262
3396
|
step: "01-welcome",
|
|
@@ -3311,7 +3445,7 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
3311
3445
|
}
|
|
3312
3446
|
|
|
3313
3447
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3314
|
-
import { useEffect as
|
|
3448
|
+
import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
|
|
3315
3449
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3316
3450
|
init_debug_store();
|
|
3317
3451
|
|
|
@@ -3387,10 +3521,10 @@ function TokenInputScreen({
|
|
|
3387
3521
|
onBack,
|
|
3388
3522
|
initialPath = ""
|
|
3389
3523
|
}) {
|
|
3390
|
-
const [tokenPath, setTokenPath] =
|
|
3391
|
-
const [failure, setFailure] =
|
|
3524
|
+
const [tokenPath, setTokenPath] = useState7(initialPath);
|
|
3525
|
+
const [failure, setFailure] = useState7(null);
|
|
3392
3526
|
const rejected = useRef4([]).current;
|
|
3393
|
-
|
|
3527
|
+
useEffect7(() => {
|
|
3394
3528
|
startDebugRun({
|
|
3395
3529
|
flow: "import/token-input",
|
|
3396
3530
|
step: "02-token-input",
|
|
@@ -3471,7 +3605,7 @@ function TokenInputScreen({
|
|
|
3471
3605
|
}
|
|
3472
3606
|
|
|
3473
3607
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
3474
|
-
import { useEffect as
|
|
3608
|
+
import { useEffect as useEffect8, useMemo, useState as useState8 } from "react";
|
|
3475
3609
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3476
3610
|
init_debug_store();
|
|
3477
3611
|
|
|
@@ -3589,16 +3723,16 @@ function usePathValidationControls(phase, handlers) {
|
|
|
3589
3723
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3590
3724
|
import { DatabaseSync } from "node:sqlite";
|
|
3591
3725
|
import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
3592
|
-
import { readFile as
|
|
3726
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
3593
3727
|
import { createHash as createHash5 } from "node:crypto";
|
|
3594
3728
|
|
|
3595
3729
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
3596
3730
|
import { homedir as homedir3 } from "node:os";
|
|
3597
|
-
import { dirname as dirname4, join as
|
|
3731
|
+
import { dirname as dirname4, join as join7 } from "node:path";
|
|
3598
3732
|
function configRoot2() {
|
|
3599
|
-
return process.env["EDS_HOME"] ||
|
|
3733
|
+
return process.env["EDS_HOME"] || join7(homedir3(), ".contentful", "experience-design-system-cli");
|
|
3600
3734
|
}
|
|
3601
|
-
var runsFilePath = () =>
|
|
3735
|
+
var runsFilePath = () => join7(configRoot2(), "state", "runs.json");
|
|
3602
3736
|
|
|
3603
3737
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3604
3738
|
import { dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
@@ -5052,7 +5186,7 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
5052
5186
|
];
|
|
5053
5187
|
for (const candidate of candidates) {
|
|
5054
5188
|
try {
|
|
5055
|
-
await
|
|
5189
|
+
await readFile6(candidate, "utf8");
|
|
5056
5190
|
return candidate;
|
|
5057
5191
|
} catch {
|
|
5058
5192
|
}
|
|
@@ -5086,7 +5220,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5086
5220
|
break;
|
|
5087
5221
|
let content;
|
|
5088
5222
|
try {
|
|
5089
|
-
content = await
|
|
5223
|
+
content = await readFile6(resolvedPath, "utf8");
|
|
5090
5224
|
} catch {
|
|
5091
5225
|
continue;
|
|
5092
5226
|
}
|
|
@@ -5125,7 +5259,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
5125
5259
|
let truncatedSiblingCount = 0;
|
|
5126
5260
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
5127
5261
|
try {
|
|
5128
|
-
const rawText = await
|
|
5262
|
+
const rawText = await readFile6(sourcePath, "utf8");
|
|
5129
5263
|
let siblingUsesNotShown;
|
|
5130
5264
|
let declaredTypeNames;
|
|
5131
5265
|
({
|
|
@@ -5887,7 +6021,7 @@ import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "t
|
|
|
5887
6021
|
|
|
5888
6022
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
5889
6023
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
5890
|
-
import { dirname as dirname7, join as
|
|
6024
|
+
import { dirname as dirname7, join as join9, resolve as resolve8 } from "node:path";
|
|
5891
6025
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
5892
6026
|
import ts from "typescript";
|
|
5893
6027
|
var packageRootByFilePathCache = /* @__PURE__ */ new Map();
|
|
@@ -6090,7 +6224,7 @@ function findNearestTsConfigPath(filePath) {
|
|
|
6090
6224
|
let currentDir = dirname7(filePath);
|
|
6091
6225
|
while (true) {
|
|
6092
6226
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
6093
|
-
const candidatePath =
|
|
6227
|
+
const candidatePath = join9(currentDir, candidateName);
|
|
6094
6228
|
if (existsSync4(candidatePath)) {
|
|
6095
6229
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
6096
6230
|
return candidatePath;
|
|
@@ -6147,10 +6281,10 @@ function resolveImportSourcePath(basePath) {
|
|
|
6147
6281
|
`${basePath}.tsx`,
|
|
6148
6282
|
`${basePath}.js`,
|
|
6149
6283
|
`${basePath}.jsx`,
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6284
|
+
join9(basePath, "index.ts"),
|
|
6285
|
+
join9(basePath, "index.tsx"),
|
|
6286
|
+
join9(basePath, "index.js"),
|
|
6287
|
+
join9(basePath, "index.jsx")
|
|
6154
6288
|
];
|
|
6155
6289
|
return candidates.find((candidatePath) => existsSync4(candidatePath));
|
|
6156
6290
|
}
|
|
@@ -6161,10 +6295,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
6161
6295
|
`${resolvedPath}.tsx`,
|
|
6162
6296
|
`${resolvedPath}.js`,
|
|
6163
6297
|
`${resolvedPath}.jsx`,
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6298
|
+
join9(resolvedPath, "index.ts"),
|
|
6299
|
+
join9(resolvedPath, "index.tsx"),
|
|
6300
|
+
join9(resolvedPath, "index.js"),
|
|
6301
|
+
join9(resolvedPath, "index.jsx")
|
|
6168
6302
|
];
|
|
6169
6303
|
for (const candidatePath of candidatePaths) {
|
|
6170
6304
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -6185,10 +6319,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6185
6319
|
if (!packageRootDir)
|
|
6186
6320
|
return void 0;
|
|
6187
6321
|
const preferredEntryPaths = [
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6322
|
+
join9(packageRootDir, "src/index.ts"),
|
|
6323
|
+
join9(packageRootDir, "src/index.tsx"),
|
|
6324
|
+
join9(packageRootDir, "index.ts"),
|
|
6325
|
+
join9(packageRootDir, "index.tsx")
|
|
6192
6326
|
];
|
|
6193
6327
|
for (const entryPath of preferredEntryPaths) {
|
|
6194
6328
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -6196,7 +6330,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6196
6330
|
return entrySourceFile;
|
|
6197
6331
|
}
|
|
6198
6332
|
}
|
|
6199
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
6333
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join9(packageRootDir, "src"));
|
|
6200
6334
|
}
|
|
6201
6335
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
6202
6336
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -6205,7 +6339,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
6205
6339
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
6206
6340
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
6207
6341
|
}
|
|
6208
|
-
const packageJsonPath =
|
|
6342
|
+
const packageJsonPath = join9(packageRootDir, "package.json");
|
|
6209
6343
|
try {
|
|
6210
6344
|
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
|
|
6211
6345
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -6222,7 +6356,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6222
6356
|
}
|
|
6223
6357
|
let currentDir = dirname7(filePath);
|
|
6224
6358
|
while (true) {
|
|
6225
|
-
if (existsSync4(
|
|
6359
|
+
if (existsSync4(join9(currentDir, "package.json"))) {
|
|
6226
6360
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
6227
6361
|
return currentDir;
|
|
6228
6362
|
}
|
|
@@ -6236,7 +6370,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6236
6370
|
}
|
|
6237
6371
|
|
|
6238
6372
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
|
|
6239
|
-
import { readFile as
|
|
6373
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
6240
6374
|
async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
|
|
6241
6375
|
const warnings = [];
|
|
6242
6376
|
const items = [];
|
|
@@ -6248,7 +6382,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
|
|
|
6248
6382
|
if (!filePath)
|
|
6249
6383
|
break;
|
|
6250
6384
|
try {
|
|
6251
|
-
const source = await
|
|
6385
|
+
const source = await readFile7(filePath, "utf-8");
|
|
6252
6386
|
const outcome = await extractFile(filePath, source);
|
|
6253
6387
|
warnings.push(...outcome.warnings ?? []);
|
|
6254
6388
|
if (outcome.item)
|
|
@@ -9223,15 +9357,15 @@ function extractVueSlotsFromSetup(options) {
|
|
|
9223
9357
|
|
|
9224
9358
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
9225
9359
|
import os from "node:os";
|
|
9226
|
-
import { basename, dirname as dirname9, resolve as resolve10, join as
|
|
9227
|
-
import { readFile as
|
|
9360
|
+
import { basename as basename2, dirname as dirname9, resolve as resolve10, join as join11 } from "node:path";
|
|
9361
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
9228
9362
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
9229
9363
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
9230
9364
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
9231
9365
|
|
|
9232
9366
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
|
|
9233
9367
|
import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
|
|
9234
|
-
import { dirname as dirname8, join as
|
|
9368
|
+
import { dirname as dirname8, join as join10, resolve as resolve9 } from "node:path";
|
|
9235
9369
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
9236
9370
|
const basePath = resolve9(dirname8(importingFilePath), specifier);
|
|
9237
9371
|
const candidates = [
|
|
@@ -9240,10 +9374,10 @@ function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
|
9240
9374
|
`${basePath}.ts`,
|
|
9241
9375
|
`${basePath}.mjs`,
|
|
9242
9376
|
`${basePath}.cjs`,
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9377
|
+
join10(basePath, "index.js"),
|
|
9378
|
+
join10(basePath, "index.ts"),
|
|
9379
|
+
join10(basePath, "index.mjs"),
|
|
9380
|
+
join10(basePath, "index.cjs")
|
|
9247
9381
|
];
|
|
9248
9382
|
for (const candidate of candidates) {
|
|
9249
9383
|
if (existsSync5(candidate) && statSync2(candidate).isFile())
|
|
@@ -9318,11 +9452,11 @@ async function extractFromVueSFC(filePath, source) {
|
|
|
9318
9452
|
};
|
|
9319
9453
|
}
|
|
9320
9454
|
function getVueComponentName(filePath) {
|
|
9321
|
-
const fileName =
|
|
9455
|
+
const fileName = basename2(filePath, ".vue");
|
|
9322
9456
|
if (fileName !== "index") {
|
|
9323
9457
|
return fileName;
|
|
9324
9458
|
}
|
|
9325
|
-
const parentDirName =
|
|
9459
|
+
const parentDirName = basename2(dirname9(filePath));
|
|
9326
9460
|
return parentDirName || fileName;
|
|
9327
9461
|
}
|
|
9328
9462
|
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
@@ -9466,7 +9600,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
|
|
|
9466
9600
|
if (visitedImports.has(visitKey))
|
|
9467
9601
|
return [];
|
|
9468
9602
|
visitedImports.add(visitKey);
|
|
9469
|
-
const source = await
|
|
9603
|
+
const source = await readFile8(importedRef.filePath, "utf-8");
|
|
9470
9604
|
const project = new Project3({
|
|
9471
9605
|
compilerOptions: {
|
|
9472
9606
|
strict: false,
|
|
@@ -9494,11 +9628,11 @@ function findWorkspaceRoot(startDir) {
|
|
|
9494
9628
|
return workspaceRootCache.get(startDir);
|
|
9495
9629
|
let dir = startDir;
|
|
9496
9630
|
while (true) {
|
|
9497
|
-
const pkgJsonPath =
|
|
9631
|
+
const pkgJsonPath = join11(dir, "package.json");
|
|
9498
9632
|
if (existsSync6(pkgJsonPath)) {
|
|
9499
9633
|
try {
|
|
9500
9634
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9501
|
-
if (pkg.workspaces || existsSync6(
|
|
9635
|
+
if (pkg.workspaces || existsSync6(join11(dir, "pnpm-workspace.yaml"))) {
|
|
9502
9636
|
workspaceRootCache.set(startDir, dir);
|
|
9503
9637
|
return dir;
|
|
9504
9638
|
}
|
|
@@ -9519,7 +9653,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9519
9653
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
9520
9654
|
}
|
|
9521
9655
|
const packageMap = /* @__PURE__ */ new Map();
|
|
9522
|
-
const packagesDir =
|
|
9656
|
+
const packagesDir = join11(workspaceRoot, "packages");
|
|
9523
9657
|
if (!existsSync6(packagesDir)) {
|
|
9524
9658
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
9525
9659
|
return packageMap;
|
|
@@ -9533,7 +9667,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9533
9667
|
} catch {
|
|
9534
9668
|
return;
|
|
9535
9669
|
}
|
|
9536
|
-
const pkgJsonPath =
|
|
9670
|
+
const pkgJsonPath = join11(dir, "package.json");
|
|
9537
9671
|
if (existsSync6(pkgJsonPath)) {
|
|
9538
9672
|
try {
|
|
9539
9673
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
@@ -9546,10 +9680,10 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9546
9680
|
for (const entry of entries) {
|
|
9547
9681
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
9548
9682
|
continue;
|
|
9549
|
-
const entryPath =
|
|
9683
|
+
const entryPath = join11(dir, entry);
|
|
9550
9684
|
try {
|
|
9551
|
-
const
|
|
9552
|
-
if (
|
|
9685
|
+
const stat6 = statSync3(entryPath);
|
|
9686
|
+
if (stat6.isDirectory()) {
|
|
9553
9687
|
scanDir(entryPath, depth + 1);
|
|
9554
9688
|
}
|
|
9555
9689
|
} catch {
|
|
@@ -9586,7 +9720,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9586
9720
|
const packageDir = packageDirs.get(packageName);
|
|
9587
9721
|
if (!packageDir)
|
|
9588
9722
|
return null;
|
|
9589
|
-
const pkgJsonPath =
|
|
9723
|
+
const pkgJsonPath = join11(packageDir, "package.json");
|
|
9590
9724
|
try {
|
|
9591
9725
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9592
9726
|
if (pkg.exports && subpath !== ".") {
|
|
@@ -9599,8 +9733,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9599
9733
|
}
|
|
9600
9734
|
if (subpath !== ".") {
|
|
9601
9735
|
const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
|
|
9602
|
-
for (const base of [
|
|
9603
|
-
const subPkgPath =
|
|
9736
|
+
for (const base of [join11(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
9737
|
+
const subPkgPath = join11(base, "package.json");
|
|
9604
9738
|
if (existsSync6(subPkgPath)) {
|
|
9605
9739
|
try {
|
|
9606
9740
|
const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
|
|
@@ -9697,7 +9831,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9697
9831
|
return [];
|
|
9698
9832
|
}
|
|
9699
9833
|
async function extractInheritedVueProps(filePath, visited) {
|
|
9700
|
-
const source = await
|
|
9834
|
+
const source = await readFile8(filePath, "utf-8");
|
|
9701
9835
|
const { descriptor } = parseSFC(source);
|
|
9702
9836
|
if (!descriptor.script) {
|
|
9703
9837
|
return [];
|
|
@@ -9815,7 +9949,7 @@ function mergeSlotsDedup(base, extra) {
|
|
|
9815
9949
|
|
|
9816
9950
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/astro/extract-astro-components.js
|
|
9817
9951
|
import os2 from "node:os";
|
|
9818
|
-
import { basename as
|
|
9952
|
+
import { basename as basename3 } from "node:path";
|
|
9819
9953
|
import { Project as Project4, Node as Node7 } from "ts-morph";
|
|
9820
9954
|
function extractAllowedValues3(typeText) {
|
|
9821
9955
|
const parts = typeText.split("|").map((p) => p.trim());
|
|
@@ -9994,7 +10128,7 @@ function mergeSlots(...slotGroups) {
|
|
|
9994
10128
|
return merged;
|
|
9995
10129
|
}
|
|
9996
10130
|
function extractFromAstroFile(filePath, source) {
|
|
9997
|
-
const name =
|
|
10131
|
+
const name = basename3(filePath, ".astro");
|
|
9998
10132
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
9999
10133
|
let frontmatter = "";
|
|
10000
10134
|
let template = source;
|
|
@@ -10030,7 +10164,7 @@ async function extractAstroComponents(filePaths, onProgress) {
|
|
|
10030
10164
|
}
|
|
10031
10165
|
|
|
10032
10166
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
10033
|
-
import { basename as
|
|
10167
|
+
import { basename as basename4, dirname as dirname10, join as join12, resolve as resolve11 } from "node:path";
|
|
10034
10168
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
10035
10169
|
function normalizeComponentName(input) {
|
|
10036
10170
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -10197,7 +10331,7 @@ function shouldPreferTagName(className, tagName) {
|
|
|
10197
10331
|
return false;
|
|
10198
10332
|
}
|
|
10199
10333
|
function getFileDerivedComponentName(sourceFile) {
|
|
10200
|
-
const baseName =
|
|
10334
|
+
const baseName = basename4(sourceFile.getFilePath()).replace(/\.[^.]+$/, "").replace(/\.component$/, "");
|
|
10201
10335
|
return kebabToPascal(baseName);
|
|
10202
10336
|
}
|
|
10203
10337
|
function chooseComponentName(classDecl, className, tagName) {
|
|
@@ -10685,14 +10819,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
10685
10819
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
10686
10820
|
return null;
|
|
10687
10821
|
}
|
|
10688
|
-
const packagesMarker = `${
|
|
10822
|
+
const packagesMarker = `${join12("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
10689
10823
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
10690
10824
|
if (markerIndex === -1) {
|
|
10691
10825
|
return null;
|
|
10692
10826
|
}
|
|
10693
10827
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
10694
10828
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
10695
|
-
return
|
|
10829
|
+
return join12(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
10696
10830
|
}
|
|
10697
10831
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
10698
10832
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -10845,7 +10979,7 @@ async function extractWebComponentDefinitions(filePaths) {
|
|
|
10845
10979
|
|
|
10846
10980
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
10847
10981
|
import os3 from "node:os";
|
|
10848
|
-
import { basename as
|
|
10982
|
+
import { basename as basename5, dirname as dirname11, resolve as resolve12, join as join13 } from "node:path";
|
|
10849
10983
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
10850
10984
|
import { createRequire } from "node:module";
|
|
10851
10985
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
@@ -11079,7 +11213,7 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
11079
11213
|
function findNearestTsconfig(startDir) {
|
|
11080
11214
|
let dir = startDir;
|
|
11081
11215
|
for (let i = 0; i < 16; i++) {
|
|
11082
|
-
const candidate =
|
|
11216
|
+
const candidate = join13(dir, "tsconfig.json");
|
|
11083
11217
|
if (existsSync7(candidate))
|
|
11084
11218
|
return candidate;
|
|
11085
11219
|
const parent = dirname11(dir);
|
|
@@ -11215,7 +11349,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11215
11349
|
const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
|
|
11216
11350
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
11217
11351
|
if (pkgRoot) {
|
|
11218
|
-
const pkgJsonPath =
|
|
11352
|
+
const pkgJsonPath = join13(pkgRoot, "package.json");
|
|
11219
11353
|
if (existsSync7(pkgJsonPath)) {
|
|
11220
11354
|
try {
|
|
11221
11355
|
const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
|
|
@@ -11236,7 +11370,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11236
11370
|
}
|
|
11237
11371
|
}
|
|
11238
11372
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
11239
|
-
const candidate =
|
|
11373
|
+
const candidate = join13(pkgRoot, entry);
|
|
11240
11374
|
if (existsSync7(candidate))
|
|
11241
11375
|
return candidate;
|
|
11242
11376
|
}
|
|
@@ -11254,9 +11388,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11254
11388
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
11255
11389
|
let dir = seedDir;
|
|
11256
11390
|
for (let i = 0; i < 32; i++) {
|
|
11257
|
-
if (existsSync7(
|
|
11391
|
+
if (existsSync7(join13(dir, "package.json"))) {
|
|
11258
11392
|
try {
|
|
11259
|
-
const pkgRaw = readFileSync6(
|
|
11393
|
+
const pkgRaw = readFileSync6(join13(dir, "package.json"), "utf-8");
|
|
11260
11394
|
const pkg = JSON.parse(pkgRaw);
|
|
11261
11395
|
if (pkg.name === specifier)
|
|
11262
11396
|
return dir;
|
|
@@ -11396,12 +11530,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11396
11530
|
}
|
|
11397
11531
|
var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
|
|
11398
11532
|
function getSvelteComponentName(filePath) {
|
|
11399
|
-
const file =
|
|
11400
|
-
const parentDir =
|
|
11533
|
+
const file = basename5(filePath, ".svelte");
|
|
11534
|
+
const parentDir = basename5(dirname11(filePath));
|
|
11401
11535
|
if (file === "index")
|
|
11402
11536
|
return toPascalCase(parentDir);
|
|
11403
11537
|
if (ANATOMY_FOLDERS.has(parentDir)) {
|
|
11404
|
-
const grandparent =
|
|
11538
|
+
const grandparent = basename5(dirname11(dirname11(filePath)));
|
|
11405
11539
|
if (grandparent && grandparent !== "." && grandparent !== "/") {
|
|
11406
11540
|
return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
|
|
11407
11541
|
}
|
|
@@ -12216,7 +12350,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
12216
12350
|
}
|
|
12217
12351
|
|
|
12218
12352
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12219
|
-
import { readFile as
|
|
12353
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
12220
12354
|
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
12221
12355
|
|
|
12222
12356
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
@@ -12622,14 +12756,14 @@ function countLines(text, offset) {
|
|
|
12622
12756
|
}
|
|
12623
12757
|
|
|
12624
12758
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
12625
|
-
import { readFile as
|
|
12759
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
12626
12760
|
async function resolveTemplateSource(meta) {
|
|
12627
12761
|
if (meta.inlineTemplate !== null)
|
|
12628
12762
|
return meta.inlineTemplate;
|
|
12629
12763
|
if (meta.templatePath === null)
|
|
12630
12764
|
return null;
|
|
12631
12765
|
try {
|
|
12632
|
-
return await
|
|
12766
|
+
return await readFile9(meta.templatePath, "utf8");
|
|
12633
12767
|
} catch {
|
|
12634
12768
|
return null;
|
|
12635
12769
|
}
|
|
@@ -12819,7 +12953,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
|
12819
12953
|
});
|
|
12820
12954
|
for (const filePath of filePaths) {
|
|
12821
12955
|
try {
|
|
12822
|
-
const source = await
|
|
12956
|
+
const source = await readFile10(filePath, "utf8");
|
|
12823
12957
|
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12824
12958
|
for (const cls of sourceFile.getClasses()) {
|
|
12825
12959
|
if (!hasComponentDecorator(cls))
|
|
@@ -12955,11 +13089,11 @@ function getPathPreferenceScore(filePath) {
|
|
|
12955
13089
|
const normalized = filePath.replace(/\\/g, "/");
|
|
12956
13090
|
const segments = normalized.split("/").filter(Boolean);
|
|
12957
13091
|
const filename = segments.at(-1) ?? "";
|
|
12958
|
-
const
|
|
13092
|
+
const basename8 = filename.replace(/\.[^.]+$/, "");
|
|
12959
13093
|
let score = 0;
|
|
12960
13094
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
12961
13095
|
score += 100;
|
|
12962
|
-
if (
|
|
13096
|
+
if (basename8 && segments.at(-2) === basename8)
|
|
12963
13097
|
score -= 10;
|
|
12964
13098
|
const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
|
|
12965
13099
|
score -= componentsSegmentCount * 8;
|
|
@@ -13408,15 +13542,15 @@ function applyCompositionEdges(components, edges) {
|
|
|
13408
13542
|
|
|
13409
13543
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
13410
13544
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
13411
|
-
import { dirname as dirname13, join as
|
|
13545
|
+
import { dirname as dirname13, join as join14, resolve as resolve14 } from "node:path";
|
|
13412
13546
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13413
13547
|
function resolvePromptPath(fileName) {
|
|
13414
13548
|
const thisDir = dirname13(fileURLToPath3(import.meta.url));
|
|
13415
13549
|
let dir = thisDir;
|
|
13416
13550
|
for (; ; ) {
|
|
13417
|
-
const candidate =
|
|
13551
|
+
const candidate = join14(dir, "prompts");
|
|
13418
13552
|
if (existsSync8(candidate))
|
|
13419
|
-
return
|
|
13553
|
+
return join14(candidate, fileName);
|
|
13420
13554
|
const parent = resolve14(dir, "..");
|
|
13421
13555
|
if (parent === dir) {
|
|
13422
13556
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
@@ -14043,10 +14177,10 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
14043
14177
|
}
|
|
14044
14178
|
|
|
14045
14179
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
14046
|
-
import { access as access3, readFile as
|
|
14180
|
+
import { access as access3, readFile as readFile12 } from "node:fs/promises";
|
|
14047
14181
|
|
|
14048
14182
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
14049
|
-
import { access as access2, mkdir as mkdir3, readFile as
|
|
14183
|
+
import { access as access2, mkdir as mkdir3, readFile as readFile11, writeFile as writeFile4 } from "node:fs/promises";
|
|
14050
14184
|
|
|
14051
14185
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
14052
14186
|
import { resolve as resolve17 } from "node:path";
|
|
@@ -14065,11 +14199,11 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
14065
14199
|
await mkdir3(paths.sessionDir, { recursive: true });
|
|
14066
14200
|
try {
|
|
14067
14201
|
await access2(paths.statePath);
|
|
14068
|
-
const savedState = await
|
|
14202
|
+
const savedState = await readFile11(paths.statePath, "utf8");
|
|
14069
14203
|
return JSON.parse(savedState);
|
|
14070
14204
|
} catch {
|
|
14071
|
-
await
|
|
14072
|
-
await
|
|
14205
|
+
await writeFile4(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
14206
|
+
await writeFile4(paths.eventsPath, "", "utf8");
|
|
14073
14207
|
return initialSnapshot;
|
|
14074
14208
|
}
|
|
14075
14209
|
}
|
|
@@ -14084,9 +14218,9 @@ function getRefineArtifactsRoot() {
|
|
|
14084
14218
|
}
|
|
14085
14219
|
|
|
14086
14220
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
14087
|
-
import { writeFile as
|
|
14221
|
+
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
14088
14222
|
async function saveReviewState(statePath, session) {
|
|
14089
|
-
await
|
|
14223
|
+
await writeFile5(statePath, JSON.stringify(session, null, 2), "utf8");
|
|
14090
14224
|
}
|
|
14091
14225
|
|
|
14092
14226
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
@@ -14096,7 +14230,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14096
14230
|
let snapshot;
|
|
14097
14231
|
try {
|
|
14098
14232
|
await access3(paths.statePath);
|
|
14099
|
-
snapshot = JSON.parse(await
|
|
14233
|
+
snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
|
|
14100
14234
|
} catch {
|
|
14101
14235
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
14102
14236
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -14134,7 +14268,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14134
14268
|
}
|
|
14135
14269
|
|
|
14136
14270
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
14137
|
-
import { readFile as
|
|
14271
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
14138
14272
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
14139
14273
|
if (names.length === 0)
|
|
14140
14274
|
return;
|
|
@@ -14150,7 +14284,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
14150
14284
|
const nameSet = new Set(names);
|
|
14151
14285
|
let snapshot;
|
|
14152
14286
|
try {
|
|
14153
|
-
snapshot = JSON.parse(await
|
|
14287
|
+
snapshot = JSON.parse(await readFile13(paths.statePath, "utf8"));
|
|
14154
14288
|
} catch {
|
|
14155
14289
|
return;
|
|
14156
14290
|
}
|
|
@@ -14349,15 +14483,15 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
14349
14483
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
14350
14484
|
function collectFiles(root, options = {}) {
|
|
14351
14485
|
const resolved = path4.resolve(root);
|
|
14352
|
-
let
|
|
14486
|
+
let stat6;
|
|
14353
14487
|
try {
|
|
14354
|
-
|
|
14488
|
+
stat6 = statSync5(resolved);
|
|
14355
14489
|
} catch (err) {
|
|
14356
14490
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
14357
14491
|
}
|
|
14358
|
-
if (
|
|
14492
|
+
if (stat6.isFile())
|
|
14359
14493
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
14360
|
-
if (!
|
|
14494
|
+
if (!stat6.isDirectory())
|
|
14361
14495
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
14362
14496
|
const result = {
|
|
14363
14497
|
filePaths: [],
|
|
@@ -14407,7 +14541,7 @@ function generateUlid(now = Date.now()) {
|
|
|
14407
14541
|
}
|
|
14408
14542
|
|
|
14409
14543
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14410
|
-
import { readFile as
|
|
14544
|
+
import { readFile as readFile14 } from "node:fs/promises";
|
|
14411
14545
|
|
|
14412
14546
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
14413
14547
|
function migrateRecord(rec) {
|
|
@@ -14426,7 +14560,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
14426
14560
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14427
14561
|
async function readRunsFileMaybe() {
|
|
14428
14562
|
try {
|
|
14429
|
-
const raw = await
|
|
14563
|
+
const raw = await readFile14(runsFilePath(), "utf8");
|
|
14430
14564
|
const parsed = JSON.parse(raw);
|
|
14431
14565
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
14432
14566
|
throw new Error(`runs.json version mismatch: file is v${parsed.version}, this CLI expects v${RUNS_FILE_VERSION} (also reads: ${[...READABLE_VERSIONS].join(", ")}). Back up and remove the file to start fresh.`);
|
|
@@ -14442,13 +14576,13 @@ async function readRunsFileMaybe() {
|
|
|
14442
14576
|
}
|
|
14443
14577
|
|
|
14444
14578
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
14445
|
-
import { mkdir as mkdir4, rename as rename2, writeFile as
|
|
14579
|
+
import { mkdir as mkdir4, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
14446
14580
|
import { dirname as dirname15 } from "node:path";
|
|
14447
14581
|
async function writeRunsFileAtomic(file) {
|
|
14448
14582
|
await mkdir4(dirname15(runsFilePath()), { recursive: true });
|
|
14449
14583
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
14450
14584
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
14451
|
-
await
|
|
14585
|
+
await writeFile6(tmp, body, { mode: 384 });
|
|
14452
14586
|
await rename2(tmp, runsFilePath());
|
|
14453
14587
|
}
|
|
14454
14588
|
|
|
@@ -14485,7 +14619,7 @@ async function updateRun(id, patch) {
|
|
|
14485
14619
|
}
|
|
14486
14620
|
|
|
14487
14621
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14488
|
-
import { readFile as
|
|
14622
|
+
import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
|
|
14489
14623
|
import { resolve as resolve19 } from "node:path";
|
|
14490
14624
|
|
|
14491
14625
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
@@ -14513,7 +14647,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14513
14647
|
continue;
|
|
14514
14648
|
seen.add(abs);
|
|
14515
14649
|
try {
|
|
14516
|
-
const st = await
|
|
14650
|
+
const st = await stat3(abs);
|
|
14517
14651
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14518
14652
|
if (name)
|
|
14519
14653
|
entry.componentName = name;
|
|
@@ -14528,7 +14662,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14528
14662
|
const abs = resolve19(opts.rawTokensPath);
|
|
14529
14663
|
rawTokensPath = abs;
|
|
14530
14664
|
try {
|
|
14531
|
-
const [st, buf] = await Promise.all([
|
|
14665
|
+
const [st, buf] = await Promise.all([stat3(abs), readFile15(abs)]);
|
|
14532
14666
|
rawTokensMtime = st.mtime.toISOString();
|
|
14533
14667
|
rawTokensContentHash = sha256Hex(buf);
|
|
14534
14668
|
} catch {
|
|
@@ -14539,7 +14673,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14539
14673
|
|
|
14540
14674
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14541
14675
|
import { access as access4 } from "node:fs/promises";
|
|
14542
|
-
import { join as
|
|
14676
|
+
import { join as join15 } from "node:path";
|
|
14543
14677
|
|
|
14544
14678
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
|
|
14545
14679
|
var SAVE_FILES = ["components.json", "tokens.json"];
|
|
@@ -14549,7 +14683,7 @@ async function listConflictingFiles(path5) {
|
|
|
14549
14683
|
const conflicts = [];
|
|
14550
14684
|
for (const name of SAVE_FILES) {
|
|
14551
14685
|
try {
|
|
14552
|
-
await access4(
|
|
14686
|
+
await access4(join15(path5, name));
|
|
14553
14687
|
conflicts.push(name);
|
|
14554
14688
|
} catch {
|
|
14555
14689
|
}
|
|
@@ -14563,7 +14697,7 @@ async function detectSaveConflict(path5) {
|
|
|
14563
14697
|
}
|
|
14564
14698
|
|
|
14565
14699
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
|
|
14566
|
-
import { join as
|
|
14700
|
+
import { join as join16 } from "node:path";
|
|
14567
14701
|
function pad2(n) {
|
|
14568
14702
|
return n < 10 ? `0${n}` : String(n);
|
|
14569
14703
|
}
|
|
@@ -14574,7 +14708,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
14574
14708
|
const hh = pad2(now.getHours());
|
|
14575
14709
|
const mm = pad2(now.getMinutes());
|
|
14576
14710
|
const ss = pad2(now.getSeconds());
|
|
14577
|
-
return
|
|
14711
|
+
return join16(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
14578
14712
|
}
|
|
14579
14713
|
|
|
14580
14714
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
|
|
@@ -14610,12 +14744,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
14610
14744
|
}
|
|
14611
14745
|
|
|
14612
14746
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14613
|
-
import { readFile as
|
|
14747
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
14614
14748
|
async function loadAcceptedNames(sessionId) {
|
|
14615
14749
|
try {
|
|
14616
14750
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14617
14751
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14618
|
-
const raw = await
|
|
14752
|
+
const raw = await readFile16(paths.statePath, "utf8");
|
|
14619
14753
|
const snapshot = JSON.parse(raw);
|
|
14620
14754
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14621
14755
|
if (accepted.length === 0)
|
|
@@ -15941,11 +16075,11 @@ function formatApiError2(request) {
|
|
|
15941
16075
|
|
|
15942
16076
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
15943
16077
|
init_shared();
|
|
15944
|
-
import { readFile as
|
|
16078
|
+
import { readFile as readFile17, stat as stat5 } from "node:fs/promises";
|
|
15945
16079
|
|
|
15946
16080
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
15947
|
-
import { readdir as
|
|
15948
|
-
import { join as
|
|
16081
|
+
import { readdir as readdir3, stat as stat4 } from "node:fs/promises";
|
|
16082
|
+
import { join as join17 } from "node:path";
|
|
15949
16083
|
var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
|
|
15950
16084
|
async function collectJsonFiles(dir) {
|
|
15951
16085
|
const results = [];
|
|
@@ -15955,17 +16089,17 @@ async function collectJsonFiles(dir) {
|
|
|
15955
16089
|
async function walk(current, results) {
|
|
15956
16090
|
let entries;
|
|
15957
16091
|
try {
|
|
15958
|
-
entries = await
|
|
16092
|
+
entries = await readdir3(current);
|
|
15959
16093
|
} catch {
|
|
15960
16094
|
return;
|
|
15961
16095
|
}
|
|
15962
16096
|
await Promise.all(entries.map(async (entry) => {
|
|
15963
16097
|
if (IGNORE_TOKEN_DIRS.has(entry))
|
|
15964
16098
|
return;
|
|
15965
|
-
const full =
|
|
16099
|
+
const full = join17(current, entry);
|
|
15966
16100
|
let s;
|
|
15967
16101
|
try {
|
|
15968
|
-
s = await
|
|
16102
|
+
s = await stat4(full);
|
|
15969
16103
|
} catch {
|
|
15970
16104
|
return;
|
|
15971
16105
|
}
|
|
@@ -15981,7 +16115,7 @@ async function walk(current, results) {
|
|
|
15981
16115
|
async function readTokensFromPath(flag, p) {
|
|
15982
16116
|
let s;
|
|
15983
16117
|
try {
|
|
15984
|
-
s = await
|
|
16118
|
+
s = await stat5(p);
|
|
15985
16119
|
} catch {
|
|
15986
16120
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
15987
16121
|
}
|
|
@@ -16000,7 +16134,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16000
16134
|
const merged = {};
|
|
16001
16135
|
for (const file of files.sort()) {
|
|
16002
16136
|
try {
|
|
16003
|
-
const text = await
|
|
16137
|
+
const text = await readFile17(file, "utf8");
|
|
16004
16138
|
const parsed = JSON.parse(text);
|
|
16005
16139
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
16006
16140
|
Object.assign(merged, parsed);
|
|
@@ -16014,7 +16148,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16014
16148
|
async function readSingleFile(flag, p) {
|
|
16015
16149
|
let text;
|
|
16016
16150
|
try {
|
|
16017
|
-
text = await
|
|
16151
|
+
text = await readFile17(p, "utf8");
|
|
16018
16152
|
} catch {
|
|
16019
16153
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16020
16154
|
}
|
|
@@ -16059,8 +16193,8 @@ function buildContentfulManagementClient(request) {
|
|
|
16059
16193
|
}
|
|
16060
16194
|
|
|
16061
16195
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
|
|
16062
|
-
import { writeFile as
|
|
16063
|
-
import { join as
|
|
16196
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
16197
|
+
import { join as join18 } from "node:path";
|
|
16064
16198
|
|
|
16065
16199
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
|
|
16066
16200
|
import { fetchAll } from "contentful-management";
|
|
@@ -16092,8 +16226,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16092
16226
|
spaceId: request.spaceId,
|
|
16093
16227
|
environmentId: request.environmentId
|
|
16094
16228
|
});
|
|
16095
|
-
const path5 =
|
|
16096
|
-
await
|
|
16229
|
+
const path5 = join18(request.outDir, ".existing-entities.json");
|
|
16230
|
+
await writeFile7(path5, JSON.stringify(entities, null, 2), "utf8");
|
|
16097
16231
|
return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
|
|
16098
16232
|
} catch (error) {
|
|
16099
16233
|
return {
|
|
@@ -16105,12 +16239,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16105
16239
|
}
|
|
16106
16240
|
|
|
16107
16241
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
16108
|
-
import { readFile as
|
|
16242
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
16109
16243
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
16110
16244
|
if (!request.path)
|
|
16111
16245
|
return void 0;
|
|
16112
16246
|
try {
|
|
16113
|
-
const raw = await
|
|
16247
|
+
const raw = await readFile18(request.path, "utf8");
|
|
16114
16248
|
const parsed = JSON.parse(raw);
|
|
16115
16249
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
16116
16250
|
return void 0;
|
|
@@ -16875,7 +17009,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
16875
17009
|
}
|
|
16876
17010
|
|
|
16877
17011
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
16878
|
-
import { readFile as
|
|
17012
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
16879
17013
|
|
|
16880
17014
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
16881
17015
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -16977,7 +17111,7 @@ function dedupeReasons(reasons) {
|
|
|
16977
17111
|
async function inspectComponentSource(component) {
|
|
16978
17112
|
let sourceText = "";
|
|
16979
17113
|
try {
|
|
16980
|
-
sourceText = await
|
|
17114
|
+
sourceText = await readFile19(component.source, "utf8");
|
|
16981
17115
|
} catch {
|
|
16982
17116
|
return {
|
|
16983
17117
|
wrapperConfidence: 0,
|
|
@@ -17416,7 +17550,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
17416
17550
|
}
|
|
17417
17551
|
|
|
17418
17552
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17419
|
-
import { readFile as
|
|
17553
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
17420
17554
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17421
17555
|
const paths = new Set(extraFiles);
|
|
17422
17556
|
for (const c2 of components) {
|
|
@@ -17426,7 +17560,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17426
17560
|
const out = [];
|
|
17427
17561
|
await Promise.all([...paths].map(async (p) => {
|
|
17428
17562
|
try {
|
|
17429
|
-
const content = await
|
|
17563
|
+
const content = await readFile20(p, "utf8");
|
|
17430
17564
|
out.push({ path: p, content });
|
|
17431
17565
|
} catch {
|
|
17432
17566
|
}
|
|
@@ -17597,15 +17731,15 @@ init_build_prompt();
|
|
|
17597
17731
|
init_create_local_cli_agent_invoker();
|
|
17598
17732
|
init_invoke_agent_with_output();
|
|
17599
17733
|
init_parse_token_tool_calls();
|
|
17600
|
-
import { readFile as
|
|
17601
|
-
import { basename as
|
|
17734
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
17735
|
+
import { basename as basename6, resolve as pathResolve } from "node:path";
|
|
17602
17736
|
init_cache_keys();
|
|
17603
17737
|
init_parse_prompt_overrides();
|
|
17604
17738
|
init_resolve_prompt_override();
|
|
17605
17739
|
|
|
17606
17740
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
17607
|
-
import { mkdir as mkdir7, writeFile as
|
|
17608
|
-
import { join as
|
|
17741
|
+
import { mkdir as mkdir7, writeFile as writeFile8 } from "node:fs/promises";
|
|
17742
|
+
import { join as join19 } from "node:path";
|
|
17609
17743
|
async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
17610
17744
|
onProgress?.({ kind: "writing-file" });
|
|
17611
17745
|
const result = getDtcgTokensForSession(db, sessionId);
|
|
@@ -17613,9 +17747,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
|
17613
17747
|
throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
|
|
17614
17748
|
}
|
|
17615
17749
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
17616
|
-
const tokensPath =
|
|
17750
|
+
const tokensPath = join19(outDir, "tokens.json");
|
|
17617
17751
|
await mkdir7(outDir, { recursive: true });
|
|
17618
|
-
await
|
|
17752
|
+
await writeFile8(tokensPath, `${JSON.stringify(tree, null, 2)}
|
|
17619
17753
|
`);
|
|
17620
17754
|
return { tokensPath, tokenCount: result.tokens.length };
|
|
17621
17755
|
}
|
|
@@ -17630,7 +17764,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17630
17764
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17631
17765
|
const tokensOverride = overridesMap.get("tokens");
|
|
17632
17766
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17633
|
-
const rawTokensInline = await
|
|
17767
|
+
const rawTokensInline = await readFile21(pathResolve(rawTokensPath), "utf8");
|
|
17634
17768
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17635
17769
|
const db = openPipelineDb();
|
|
17636
17770
|
try {
|
|
@@ -17658,7 +17792,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17658
17792
|
skill: "tokens",
|
|
17659
17793
|
mode: "autonomous",
|
|
17660
17794
|
rawTokensInline,
|
|
17661
|
-
rawTokensFilename:
|
|
17795
|
+
rawTokensFilename: basename6(pathResolve(rawTokensPath)),
|
|
17662
17796
|
outDir: process.cwd(),
|
|
17663
17797
|
...skillContentOverride ? { skillContentOverride } : skillPath ? { skillPathOverride: skillPath } : {}
|
|
17664
17798
|
});
|
|
@@ -18142,8 +18276,8 @@ function PathValidationScreen({
|
|
|
18142
18276
|
hasTokens = true
|
|
18143
18277
|
}) {
|
|
18144
18278
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
18145
|
-
const [scan, setScan] =
|
|
18146
|
-
|
|
18279
|
+
const [scan, setScan] = useState8();
|
|
18280
|
+
useEffect8(() => {
|
|
18147
18281
|
startDebugRun({
|
|
18148
18282
|
flow: "import/path-validation",
|
|
18149
18283
|
step: "03-path-validation",
|
|
@@ -18151,7 +18285,7 @@ function PathValidationScreen({
|
|
|
18151
18285
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
18152
18286
|
});
|
|
18153
18287
|
}, []);
|
|
18154
|
-
|
|
18288
|
+
useEffect8(() => {
|
|
18155
18289
|
setScan(scanFiles(resolvedPath));
|
|
18156
18290
|
}, [resolvedPath]);
|
|
18157
18291
|
const phase = phaseOf(scan);
|
|
@@ -18193,12 +18327,12 @@ function PathValidationScreen({
|
|
|
18193
18327
|
}
|
|
18194
18328
|
|
|
18195
18329
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
18196
|
-
import { useEffect as
|
|
18330
|
+
import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
|
|
18197
18331
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
18198
18332
|
init_debug_store();
|
|
18199
18333
|
|
|
18200
18334
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
18201
|
-
import { useState as
|
|
18335
|
+
import { useState as useState9 } from "react";
|
|
18202
18336
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
18203
18337
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
18204
18338
|
function formLabelWidth(rows) {
|
|
@@ -18234,9 +18368,9 @@ function FieldForm({
|
|
|
18234
18368
|
busy = false,
|
|
18235
18369
|
children
|
|
18236
18370
|
}) {
|
|
18237
|
-
const [active, setActive] =
|
|
18238
|
-
const [editing, setEditing] =
|
|
18239
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
18371
|
+
const [active, setActive] = useState9(0);
|
|
18372
|
+
const [editing, setEditing] = useState9(false);
|
|
18373
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
18240
18374
|
const rowCount = fields2.length + actions.length;
|
|
18241
18375
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
18242
18376
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -18513,16 +18647,16 @@ function CredentialsScreen({
|
|
|
18513
18647
|
host: initial.host ?? ""
|
|
18514
18648
|
})
|
|
18515
18649
|
).current;
|
|
18516
|
-
const [values, setValues] =
|
|
18517
|
-
const [notice, setNotice] =
|
|
18518
|
-
const [validating, setValidating] =
|
|
18650
|
+
const [values, setValues] = useState10(initialValues);
|
|
18651
|
+
const [notice, setNotice] = useState10(null);
|
|
18652
|
+
const [validating, setValidating] = useState10(false);
|
|
18519
18653
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18520
|
-
const [editing, setEditing] =
|
|
18521
|
-
const [focus, setFocus] =
|
|
18522
|
-
const [active, setActive] =
|
|
18523
|
-
const [beforeEdit, setBeforeEdit] =
|
|
18654
|
+
const [editing, setEditing] = useState10(!prefilled);
|
|
18655
|
+
const [focus, setFocus] = useState10(0);
|
|
18656
|
+
const [active, setActive] = useState10(0);
|
|
18657
|
+
const [beforeEdit, setBeforeEdit] = useState10(initialValues);
|
|
18524
18658
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
18525
|
-
|
|
18659
|
+
useEffect9(() => {
|
|
18526
18660
|
startDebugRun({
|
|
18527
18661
|
flow: "import/credentials",
|
|
18528
18662
|
step: "04-credentials",
|
|
@@ -18844,7 +18978,7 @@ function ExtractionScreen({ progress, agent, rowMs }) {
|
|
|
18844
18978
|
}
|
|
18845
18979
|
|
|
18846
18980
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
18847
|
-
import { useEffect as
|
|
18981
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState11 } from "react";
|
|
18848
18982
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
18849
18983
|
init_debug_store();
|
|
18850
18984
|
|
|
@@ -18909,8 +19043,8 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
18909
19043
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
18910
19044
|
const rows = loaded.ok ? loaded.rows : [];
|
|
18911
19045
|
const columns = useTerminalWidth();
|
|
18912
|
-
const [selected, setSelected] =
|
|
18913
|
-
|
|
19046
|
+
const [selected, setSelected] = useState11(0);
|
|
19047
|
+
useEffect10(() => {
|
|
18914
19048
|
startDebugRun({
|
|
18915
19049
|
flow: "import/token-review",
|
|
18916
19050
|
step: "05-token-review",
|
|
@@ -18999,21 +19133,21 @@ init_config();
|
|
|
18999
19133
|
|
|
19000
19134
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19001
19135
|
init_debug_store();
|
|
19002
|
-
import { useEffect as
|
|
19136
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState12 } from "react";
|
|
19003
19137
|
|
|
19004
19138
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
19005
19139
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
19006
|
-
import { join as
|
|
19140
|
+
import { join as join21, resolve as resolve24 } from "node:path";
|
|
19007
19141
|
|
|
19008
19142
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
19009
19143
|
import { existsSync as existsSync10 } from "node:fs";
|
|
19010
|
-
import { dirname as dirname16, join as
|
|
19144
|
+
import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
|
|
19011
19145
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
19012
19146
|
function findSkillPath(fileName) {
|
|
19013
19147
|
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
19014
19148
|
let dir = thisDir;
|
|
19015
19149
|
for (; ; ) {
|
|
19016
|
-
const candidate =
|
|
19150
|
+
const candidate = join20(dir, "skills", fileName);
|
|
19017
19151
|
if (existsSync10(candidate)) return candidate;
|
|
19018
19152
|
const parent = resolve22(dir, "..");
|
|
19019
19153
|
if (parent === dir) {
|
|
@@ -19123,7 +19257,7 @@ var realDeps = {
|
|
|
19123
19257
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
19124
19258
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
19125
19259
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
19126
|
-
const outDir = input.outDir ??
|
|
19260
|
+
const outDir = input.outDir ?? join21(resolve24(input.projectPath), ".contentful");
|
|
19127
19261
|
let progress = initialProgress({
|
|
19128
19262
|
hasCredentials: input.credentials !== null,
|
|
19129
19263
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -19254,9 +19388,9 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
19254
19388
|
|
|
19255
19389
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19256
19390
|
function useExtraction(input) {
|
|
19257
|
-
const [state2, setState] =
|
|
19391
|
+
const [state2, setState] = useState12();
|
|
19258
19392
|
const current = useRef6();
|
|
19259
|
-
|
|
19393
|
+
useEffect11(() => {
|
|
19260
19394
|
current.current = input;
|
|
19261
19395
|
if (!input) {
|
|
19262
19396
|
setState(void 0);
|
|
@@ -19299,7 +19433,7 @@ function useExtraction(input) {
|
|
|
19299
19433
|
}
|
|
19300
19434
|
|
|
19301
19435
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19302
|
-
import { useEffect as
|
|
19436
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
|
|
19303
19437
|
|
|
19304
19438
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
|
|
19305
19439
|
var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
|
|
@@ -19332,9 +19466,9 @@ async function runTokensOnly(input, deps = realDeps2) {
|
|
|
19332
19466
|
|
|
19333
19467
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19334
19468
|
function useTokensOnly(input) {
|
|
19335
|
-
const [state2, setState] =
|
|
19469
|
+
const [state2, setState] = useState13();
|
|
19336
19470
|
const current = useRef7();
|
|
19337
|
-
|
|
19471
|
+
useEffect12(() => {
|
|
19338
19472
|
current.current = input;
|
|
19339
19473
|
if (!input) {
|
|
19340
19474
|
setState(void 0);
|
|
@@ -19353,7 +19487,7 @@ function useTokensOnly(input) {
|
|
|
19353
19487
|
|
|
19354
19488
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
19355
19489
|
init_debug_store();
|
|
19356
|
-
import { useEffect as
|
|
19490
|
+
import { useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
19357
19491
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
19358
19492
|
|
|
19359
19493
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts
|
|
@@ -19550,32 +19684,32 @@ function CounterStrip(props) {
|
|
|
19550
19684
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
19551
19685
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
19552
19686
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
19553
|
-
const
|
|
19687
|
+
const sep2 = condensed ? " | " : " ";
|
|
19554
19688
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
19555
19689
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19556
19690
|
labelGrp,
|
|
19557
19691
|
" "
|
|
19558
19692
|
] }),
|
|
19559
19693
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
19560
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19694
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19561
19695
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19562
19696
|
labelAcc,
|
|
19563
19697
|
" "
|
|
19564
19698
|
] }),
|
|
19565
19699
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
19566
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19700
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19567
19701
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19568
19702
|
labelRej,
|
|
19569
19703
|
" "
|
|
19570
19704
|
] }),
|
|
19571
19705
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
19572
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19706
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
19573
19707
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19574
19708
|
labelUnd,
|
|
19575
19709
|
" "
|
|
19576
19710
|
] }),
|
|
19577
19711
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
19578
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19712
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 })
|
|
19579
19713
|
] }) });
|
|
19580
19714
|
}
|
|
19581
19715
|
|
|
@@ -20566,7 +20700,7 @@ function useImmediateInput(handler, enabled = true) {
|
|
|
20566
20700
|
|
|
20567
20701
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
20568
20702
|
import { useStdout as useStdout2 } from "ink";
|
|
20569
|
-
import { useEffect as
|
|
20703
|
+
import { useEffect as useEffect13, useState as useState14 } from "react";
|
|
20570
20704
|
function readTerminalSize(stdout) {
|
|
20571
20705
|
return {
|
|
20572
20706
|
columns: stdout?.columns ?? 80,
|
|
@@ -20575,8 +20709,8 @@ function readTerminalSize(stdout) {
|
|
|
20575
20709
|
}
|
|
20576
20710
|
function useTerminalSize() {
|
|
20577
20711
|
const { stdout } = useStdout2();
|
|
20578
|
-
const [size, setSize] =
|
|
20579
|
-
|
|
20712
|
+
const [size, setSize] = useState14(() => readTerminalSize(stdout));
|
|
20713
|
+
useEffect13(() => {
|
|
20580
20714
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
20581
20715
|
stdout?.on("resize", updateSize);
|
|
20582
20716
|
updateSize();
|
|
@@ -20759,7 +20893,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
20759
20893
|
}
|
|
20760
20894
|
|
|
20761
20895
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
20762
|
-
import { useEffect as
|
|
20896
|
+
import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState17 } from "react";
|
|
20763
20897
|
|
|
20764
20898
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
|
|
20765
20899
|
var TWO_COLUMN_MIN_WIDTH = 100;
|
|
@@ -21211,15 +21345,15 @@ function resolveGroupRoot(key, closures, cycleSet) {
|
|
|
21211
21345
|
}
|
|
21212
21346
|
|
|
21213
21347
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
21214
|
-
import { useState as
|
|
21348
|
+
import { useState as useState15 } from "react";
|
|
21215
21349
|
function useSidebarSearchState() {
|
|
21216
|
-
const [searchOpen, setSearchOpen] =
|
|
21217
|
-
const [searchQuery, setSearchQuery] =
|
|
21218
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
21219
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
21220
|
-
const [columnOneView, setColumnOneView] =
|
|
21221
|
-
const [activeFilters, setActiveFilters] =
|
|
21222
|
-
const [showHelp, setShowHelp] =
|
|
21350
|
+
const [searchOpen, setSearchOpen] = useState15(false);
|
|
21351
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
21352
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState15([]);
|
|
21353
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState15(null);
|
|
21354
|
+
const [columnOneView, setColumnOneView] = useState15("grouped");
|
|
21355
|
+
const [activeFilters, setActiveFilters] = useState15(/* @__PURE__ */ new Set());
|
|
21356
|
+
const [showHelp, setShowHelp] = useState15(false);
|
|
21223
21357
|
return {
|
|
21224
21358
|
searchOpen,
|
|
21225
21359
|
setSearchOpen,
|
|
@@ -21239,10 +21373,10 @@ function useSidebarSearchState() {
|
|
|
21239
21373
|
}
|
|
21240
21374
|
|
|
21241
21375
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
21242
|
-
import { useCallback, useState as
|
|
21376
|
+
import { useCallback, useState as useState16 } from "react";
|
|
21243
21377
|
function useOverlayPanel(opts) {
|
|
21244
21378
|
const { toggleKey, onClose } = opts;
|
|
21245
|
-
const [isOpen, setIsOpen] =
|
|
21379
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
21246
21380
|
const open = useCallback(() => {
|
|
21247
21381
|
setIsOpen(true);
|
|
21248
21382
|
}, []);
|
|
@@ -21456,16 +21590,16 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21456
21590
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
21457
21591
|
[totalWidth, tokenCount, tokensWidth]
|
|
21458
21592
|
);
|
|
21459
|
-
const [decisions, setDecisions] =
|
|
21460
|
-
const [nav, setNav] =
|
|
21461
|
-
const [focusedColumn, setFocusedColumn] =
|
|
21462
|
-
const [tokensCursor, setTokensCursor] =
|
|
21463
|
-
const [showDependencies, setShowDependencies] =
|
|
21464
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
21465
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
21593
|
+
const [decisions, setDecisions] = useState17(/* @__PURE__ */ new Map());
|
|
21594
|
+
const [nav, setNav] = useState17({ cursor: 0, scrollOffset: 0 });
|
|
21595
|
+
const [focusedColumn, setFocusedColumn] = useState17("main");
|
|
21596
|
+
const [tokensCursor, setTokensCursor] = useState17(0);
|
|
21597
|
+
const [showDependencies, setShowDependencies] = useState17(false);
|
|
21598
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState17(false);
|
|
21599
|
+
const [cyclesCursor, setCyclesCursor] = useState17(0);
|
|
21466
21600
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
21467
|
-
const [aiCursor, setAiCursor] =
|
|
21468
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
21601
|
+
const [aiCursor, setAiCursor] = useState17(0);
|
|
21602
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState17(null);
|
|
21469
21603
|
const search = useSidebarSearchState();
|
|
21470
21604
|
const {
|
|
21471
21605
|
searchOpen,
|
|
@@ -21490,13 +21624,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21490
21624
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
21491
21625
|
[slotCycles]
|
|
21492
21626
|
);
|
|
21493
|
-
const [expandedGroups, setExpandedGroups] =
|
|
21627
|
+
const [expandedGroups, setExpandedGroups] = useState17(() => {
|
|
21494
21628
|
const seed = new Set(closures.keys());
|
|
21495
21629
|
for (const p of cycleParticipants) seed.add(p);
|
|
21496
21630
|
return seed;
|
|
21497
21631
|
});
|
|
21498
21632
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
21499
|
-
|
|
21633
|
+
useEffect14(() => {
|
|
21500
21634
|
if (seededGroupsRef.current) return;
|
|
21501
21635
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
21502
21636
|
seededGroupsRef.current = true;
|
|
@@ -21587,7 +21721,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21587
21721
|
entryCount: 0
|
|
21588
21722
|
});
|
|
21589
21723
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
21590
|
-
|
|
21724
|
+
useEffect14(() => {
|
|
21591
21725
|
setNav((prev) => {
|
|
21592
21726
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
21593
21727
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -21958,7 +22092,7 @@ function ScopeGateScreen({
|
|
|
21958
22092
|
return loaded?.ok ? loaded.rows : [];
|
|
21959
22093
|
}, [tokensPath]);
|
|
21960
22094
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
21961
|
-
|
|
22095
|
+
useEffect15(() => {
|
|
21962
22096
|
startDebugRun({
|
|
21963
22097
|
flow: "import/scope-gate",
|
|
21964
22098
|
step: "07-scope-gate",
|
|
@@ -22080,7 +22214,7 @@ function ScopeGateScreen({
|
|
|
22080
22214
|
|
|
22081
22215
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
22082
22216
|
init_debug_store();
|
|
22083
|
-
import { useEffect as
|
|
22217
|
+
import { useEffect as useEffect16, useMemo as useMemo5, useRef as useRef10, useState as useState18 } from "react";
|
|
22084
22218
|
|
|
22085
22219
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
|
|
22086
22220
|
async function checkGenerationCache(input) {
|
|
@@ -22128,8 +22262,8 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22128
22262
|
const sessionId = input?.sessionId;
|
|
22129
22263
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
22130
22264
|
const cacheCheck = useRef10(void 0);
|
|
22131
|
-
const [confirmed, setConfirmed] =
|
|
22132
|
-
|
|
22265
|
+
const [confirmed, setConfirmed] = useState18();
|
|
22266
|
+
useEffect16(() => {
|
|
22133
22267
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
22134
22268
|
startDebugRun({
|
|
22135
22269
|
flow: "import/scope-gate",
|
|
@@ -22143,7 +22277,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22143
22277
|
exitMethod: "discarded"
|
|
22144
22278
|
});
|
|
22145
22279
|
}, [sessionId, loaded]);
|
|
22146
|
-
|
|
22280
|
+
useEffect16(() => {
|
|
22147
22281
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
22148
22282
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
22149
22283
|
}, [input, loaded]);
|
|
@@ -22258,7 +22392,7 @@ function GenerationScreen({
|
|
|
22258
22392
|
|
|
22259
22393
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22260
22394
|
init_debug_store();
|
|
22261
|
-
import { useEffect as
|
|
22395
|
+
import { useEffect as useEffect17, useRef as useRef11, useState as useState19 } from "react";
|
|
22262
22396
|
|
|
22263
22397
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
22264
22398
|
import { resolve as resolve25 } from "node:path";
|
|
@@ -22428,9 +22562,9 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
22428
22562
|
|
|
22429
22563
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22430
22564
|
function useGeneration(input) {
|
|
22431
|
-
const [state2, setState] =
|
|
22565
|
+
const [state2, setState] = useState19();
|
|
22432
22566
|
const current = useRef11();
|
|
22433
|
-
|
|
22567
|
+
useEffect17(() => {
|
|
22434
22568
|
current.current = input;
|
|
22435
22569
|
if (!input) {
|
|
22436
22570
|
setState(void 0);
|
|
@@ -22466,7 +22600,7 @@ function useGeneration(input) {
|
|
|
22466
22600
|
}
|
|
22467
22601
|
|
|
22468
22602
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
22469
|
-
import { join as
|
|
22603
|
+
import { join as join22 } from "node:path";
|
|
22470
22604
|
function buildFlowStart(input) {
|
|
22471
22605
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
22472
22606
|
const credentials = extraction.credentials ?? {
|
|
@@ -22479,7 +22613,7 @@ function buildFlowStart(input) {
|
|
|
22479
22613
|
handoff,
|
|
22480
22614
|
agent: extraction.agent,
|
|
22481
22615
|
projectPath: extraction.projectPath,
|
|
22482
|
-
outDir: extraction.projectPath ?
|
|
22616
|
+
outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
|
|
22483
22617
|
rawTokensPath: extraction.rawTokensPath,
|
|
22484
22618
|
credentials: {
|
|
22485
22619
|
spaceId: credentials.spaceId,
|
|
@@ -23005,7 +23139,7 @@ function PreviewValidationErrorScreen({
|
|
|
23005
23139
|
}
|
|
23006
23140
|
|
|
23007
23141
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
23008
|
-
import { useCallback as useCallback5, useEffect as
|
|
23142
|
+
import { useCallback as useCallback5, useEffect as useEffect25, useMemo as useMemo6, useRef as useRef17, useState as useState27 } from "react";
|
|
23009
23143
|
import figures8 from "figures";
|
|
23010
23144
|
|
|
23011
23145
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
|
|
@@ -23266,7 +23400,7 @@ function enumerateCycleBreaks(cycle, components) {
|
|
|
23266
23400
|
import { Box as Box32, Text as Text34 } from "ink";
|
|
23267
23401
|
|
|
23268
23402
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
23269
|
-
import React13, { useEffect as
|
|
23403
|
+
import React13, { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState20 } from "react";
|
|
23270
23404
|
import figures6 from "figures";
|
|
23271
23405
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
23272
23406
|
|
|
@@ -23974,11 +24108,11 @@ function FieldEditor({
|
|
|
23974
24108
|
headerHeight = 2
|
|
23975
24109
|
}) {
|
|
23976
24110
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
23977
|
-
const [editorState, setEditorState] =
|
|
23978
|
-
const [parseErr] =
|
|
23979
|
-
const [listScrollStart, setListScrollStart] =
|
|
24111
|
+
const [editorState, setEditorState] = useState20(initialState);
|
|
24112
|
+
const [parseErr] = useState20(parseError);
|
|
24113
|
+
const [listScrollStart, setListScrollStart] = useState20(0);
|
|
23980
24114
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
23981
|
-
const [rowHeights, setRowHeights] =
|
|
24115
|
+
const [rowHeights, setRowHeights] = useState20({});
|
|
23982
24116
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
23983
24117
|
const initialFocus = (() => {
|
|
23984
24118
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -24046,25 +24180,25 @@ function FieldEditor({
|
|
|
24046
24180
|
textCursor: 0
|
|
24047
24181
|
};
|
|
24048
24182
|
})();
|
|
24049
|
-
const [focusLevel, setFocusLevel] =
|
|
24050
|
-
const [propIdx, setPropIdx] =
|
|
24051
|
-
const [slotIdx, setSlotIdx] =
|
|
24052
|
-
const [inSlots, setInSlots] =
|
|
24053
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
24054
|
-
const [activeField, setActiveField] =
|
|
24055
|
-
const [editingField, setEditingField] =
|
|
24056
|
-
const [textCursor, setTextCursor] =
|
|
24057
|
-
const [valueCursor, setValueCursor] =
|
|
24058
|
-
const [editingValue, setEditingValue] =
|
|
24059
|
-
const [valueText, setValueText] =
|
|
24060
|
-
const [pickerCursor, setPickerCursor] =
|
|
24061
|
-
const [validationError, setValidationError] =
|
|
24062
|
-
const [cursorVisible] =
|
|
24063
|
-
const [sourceOpen, setSourceOpen] =
|
|
24064
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
24065
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
24066
|
-
const [showHelp, setShowHelp] =
|
|
24067
|
-
const [pendingDelete, setPendingDelete] =
|
|
24183
|
+
const [focusLevel, setFocusLevel] = useState20(initialFocus.focusLevel);
|
|
24184
|
+
const [propIdx, setPropIdx] = useState20(initialFocus.propIdx);
|
|
24185
|
+
const [slotIdx, setSlotIdx] = useState20(initialFocus.slotIdx);
|
|
24186
|
+
const [inSlots, setInSlots] = useState20(initialFocus.inSlots);
|
|
24187
|
+
const [inComponentDesc, setInComponentDesc] = useState20(initialFocus.focusLevel === "componentDescription");
|
|
24188
|
+
const [activeField, setActiveField] = useState20(initialFocus.activeField);
|
|
24189
|
+
const [editingField, setEditingField] = useState20(false);
|
|
24190
|
+
const [textCursor, setTextCursor] = useState20(initialFocus.textCursor);
|
|
24191
|
+
const [valueCursor, setValueCursor] = useState20(0);
|
|
24192
|
+
const [editingValue, setEditingValue] = useState20(null);
|
|
24193
|
+
const [valueText, setValueText] = useState20("");
|
|
24194
|
+
const [pickerCursor, setPickerCursor] = useState20(0);
|
|
24195
|
+
const [validationError, setValidationError] = useState20(null);
|
|
24196
|
+
const [cursorVisible] = useState20(true);
|
|
24197
|
+
const [sourceOpen, setSourceOpen] = useState20(false);
|
|
24198
|
+
const [rationaleOpen, setRationaleOpen] = useState20(false);
|
|
24199
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState20(0);
|
|
24200
|
+
const [showHelp, setShowHelp] = useState20(false);
|
|
24201
|
+
const [pendingDelete, setPendingDelete] = useState20(null);
|
|
24068
24202
|
const props = editorState.props;
|
|
24069
24203
|
const slots = editorState.slots;
|
|
24070
24204
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -24824,7 +24958,7 @@ function FieldEditor({
|
|
|
24824
24958
|
}
|
|
24825
24959
|
return Math.max(start + 1, end2);
|
|
24826
24960
|
};
|
|
24827
|
-
|
|
24961
|
+
useEffect18(() => {
|
|
24828
24962
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
24829
24963
|
setListScrollStart((previous) => {
|
|
24830
24964
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -25896,7 +26030,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
25896
26030
|
}
|
|
25897
26031
|
|
|
25898
26032
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
25899
|
-
import { useCallback as useCallback2, useEffect as
|
|
26033
|
+
import { useCallback as useCallback2, useEffect as useEffect20, useRef as useRef13, useState as useState22 } from "react";
|
|
25900
26034
|
|
|
25901
26035
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
|
|
25902
26036
|
var DEFAULT_MAX_DEPTH = 50;
|
|
@@ -25952,7 +26086,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
|
|
|
25952
26086
|
}
|
|
25953
26087
|
|
|
25954
26088
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
25955
|
-
import { useEffect as
|
|
26089
|
+
import { useEffect as useEffect19, useRef as useRef12, useState as useState21 } from "react";
|
|
25956
26090
|
|
|
25957
26091
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
|
|
25958
26092
|
var TimeoutError = class extends Error {
|
|
@@ -26107,12 +26241,12 @@ function useReviewFinalizePreview({
|
|
|
26107
26241
|
}
|
|
26108
26242
|
function useFinalizePreview(opts) {
|
|
26109
26243
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
26110
|
-
const [status, setStatus] =
|
|
26111
|
-
const [removed, setRemoved] =
|
|
26112
|
-
const [scrollOffset, setScrollOffset] =
|
|
26244
|
+
const [status, setStatus] = useState21("idle");
|
|
26245
|
+
const [removed, setRemoved] = useState21([]);
|
|
26246
|
+
const [scrollOffset, setScrollOffset] = useState21(0);
|
|
26113
26247
|
const generationRef = useRef12(0);
|
|
26114
26248
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
26115
|
-
|
|
26249
|
+
useEffect19(() => {
|
|
26116
26250
|
if (!open) {
|
|
26117
26251
|
setStatus("idle");
|
|
26118
26252
|
setRemoved([]);
|
|
@@ -26162,10 +26296,10 @@ function useReviewSession({
|
|
|
26162
26296
|
tokensPath,
|
|
26163
26297
|
onExtraLoaded
|
|
26164
26298
|
}) {
|
|
26165
|
-
const [components, setComponents] =
|
|
26166
|
-
const [loading, setLoading] =
|
|
26167
|
-
const [loadError, setLoadError] =
|
|
26168
|
-
const [availableTokens, setAvailableTokens] =
|
|
26299
|
+
const [components, setComponents] = useState22([]);
|
|
26300
|
+
const [loading, setLoading] = useState22(true);
|
|
26301
|
+
const [loadError, setLoadError] = useState22(null);
|
|
26302
|
+
const [availableTokens, setAvailableTokens] = useState22([]);
|
|
26169
26303
|
const loadInitialState = useCallback2(async () => {
|
|
26170
26304
|
const result = loadSession();
|
|
26171
26305
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -26175,7 +26309,7 @@ function useReviewSession({
|
|
|
26175
26309
|
}));
|
|
26176
26310
|
return { result, catalog };
|
|
26177
26311
|
}, [loadSession, tokensPath]);
|
|
26178
|
-
|
|
26312
|
+
useEffect20(() => {
|
|
26179
26313
|
let disposed = false;
|
|
26180
26314
|
void (async () => {
|
|
26181
26315
|
try {
|
|
@@ -26226,9 +26360,9 @@ function useReviewSession({
|
|
|
26226
26360
|
};
|
|
26227
26361
|
}
|
|
26228
26362
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
26229
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
26230
|
-
const [componentRationale, setComponentRationale] =
|
|
26231
|
-
|
|
26363
|
+
const [reviewMetadata, setReviewMetadata] = useState22(null);
|
|
26364
|
+
const [componentRationale, setComponentRationale] = useState22(null);
|
|
26365
|
+
useEffect20(() => {
|
|
26232
26366
|
const current = components[selectedIdx];
|
|
26233
26367
|
if (!current) {
|
|
26234
26368
|
setReviewMetadata(null);
|
|
@@ -26266,7 +26400,7 @@ function useReviewHistory({
|
|
|
26266
26400
|
}) {
|
|
26267
26401
|
const historyRef = useRef13(null);
|
|
26268
26402
|
const historySeededRef = useRef13(false);
|
|
26269
|
-
|
|
26403
|
+
useEffect20(() => {
|
|
26270
26404
|
if (loading || historySeededRef.current) return;
|
|
26271
26405
|
historySeededRef.current = true;
|
|
26272
26406
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -26322,7 +26456,7 @@ function useReviewFinalize({
|
|
|
26322
26456
|
}
|
|
26323
26457
|
|
|
26324
26458
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
26325
|
-
import { useEffect as
|
|
26459
|
+
import { useEffect as useEffect21, useRef as useRef14, useState as useState23 } from "react";
|
|
26326
26460
|
|
|
26327
26461
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
|
|
26328
26462
|
function collectTokenSuggestions(entry, availableTokens = []) {
|
|
@@ -26361,21 +26495,21 @@ function useReviewEditor({
|
|
|
26361
26495
|
onEditSaved,
|
|
26362
26496
|
onTokenSaved
|
|
26363
26497
|
}) {
|
|
26364
|
-
const [panelOpen, setPanelOpen] =
|
|
26365
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
26366
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
26367
|
-
const [textEntryActive, setTextEntryActive] =
|
|
26368
|
-
const [showJson, setShowJson] =
|
|
26369
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
26370
|
-
const [draftValue, setDraftValue] =
|
|
26371
|
-
const [saveError, setSaveError] =
|
|
26372
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
26373
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
26374
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
26375
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
26498
|
+
const [panelOpen, setPanelOpen] = useState23("none");
|
|
26499
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState23(0);
|
|
26500
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState23(0);
|
|
26501
|
+
const [textEntryActive, setTextEntryActive] = useState23(false);
|
|
26502
|
+
const [showJson, setShowJson] = useState23(false);
|
|
26503
|
+
const [showHiddenProps, setShowHiddenProps] = useState23(false);
|
|
26504
|
+
const [draftValue, setDraftValue] = useState23("");
|
|
26505
|
+
const [saveError, setSaveError] = useState23(null);
|
|
26506
|
+
const [tokenReviewRow, setTokenReviewRow] = useState23(0);
|
|
26507
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState23(false);
|
|
26508
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState23(0);
|
|
26509
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState23(/* @__PURE__ */ new Set());
|
|
26376
26510
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
26377
26511
|
const pendingGRef = useRef14(false);
|
|
26378
|
-
|
|
26512
|
+
useEffect21(() => {
|
|
26379
26513
|
setTokenReviewRow(0);
|
|
26380
26514
|
setTokenReviewEditing(false);
|
|
26381
26515
|
setTokenReviewEditCursor(0);
|
|
@@ -26488,12 +26622,12 @@ function useReviewEditor({
|
|
|
26488
26622
|
}
|
|
26489
26623
|
|
|
26490
26624
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
26491
|
-
import { useState as
|
|
26625
|
+
import { useState as useState24 } from "react";
|
|
26492
26626
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
26493
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
26494
|
-
const [showFinalize, setShowFinalize] =
|
|
26495
|
-
const [showQuit, setShowQuit] =
|
|
26496
|
-
const [finalizeError, setFinalizeError] =
|
|
26627
|
+
const [sidebarFocused, setSidebarFocused] = useState24(true);
|
|
26628
|
+
const [showFinalize, setShowFinalize] = useState24(false);
|
|
26629
|
+
const [showQuit, setShowQuit] = useState24(false);
|
|
26630
|
+
const [finalizeError, setFinalizeError] = useState24(initialFinalizeError);
|
|
26497
26631
|
return {
|
|
26498
26632
|
sidebarFocused,
|
|
26499
26633
|
setSidebarFocused,
|
|
@@ -26787,7 +26921,7 @@ function handleJsonPanelInput(input, key, state2) {
|
|
|
26787
26921
|
}
|
|
26788
26922
|
|
|
26789
26923
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
26790
|
-
import { useCallback as useCallback4, useEffect as
|
|
26924
|
+
import { useCallback as useCallback4, useEffect as useEffect23, useState as useState26 } from "react";
|
|
26791
26925
|
|
|
26792
26926
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
|
|
26793
26927
|
function applyPreviewAnnotations(preview, localNames) {
|
|
@@ -26822,25 +26956,25 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26822
26956
|
}
|
|
26823
26957
|
|
|
26824
26958
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
26825
|
-
import { useCallback as useCallback3, useEffect as
|
|
26959
|
+
import { useCallback as useCallback3, useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
|
|
26826
26960
|
var DEFAULT_DEBOUNCE_MS = 500;
|
|
26827
26961
|
function useLivePreview(opts) {
|
|
26828
26962
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
26829
|
-
const [status, setStatus] =
|
|
26830
|
-
const [disabled, setDisabled] =
|
|
26963
|
+
const [status, setStatus] = useState25("idle");
|
|
26964
|
+
const [disabled, setDisabled] = useState25(false);
|
|
26831
26965
|
const timerRef = useRef15(null);
|
|
26832
26966
|
const generationRef = useRef15(0);
|
|
26833
26967
|
const latestRef = useRef15(0);
|
|
26834
26968
|
const inflightRef = useRef15(0);
|
|
26835
26969
|
const optsRef = useRef15(opts);
|
|
26836
|
-
|
|
26970
|
+
useEffect22(() => {
|
|
26837
26971
|
optsRef.current = opts;
|
|
26838
26972
|
});
|
|
26839
26973
|
const disabledRef = useRef15(disabled);
|
|
26840
|
-
|
|
26974
|
+
useEffect22(() => {
|
|
26841
26975
|
disabledRef.current = disabled;
|
|
26842
26976
|
}, [disabled]);
|
|
26843
|
-
|
|
26977
|
+
useEffect22(() => {
|
|
26844
26978
|
return () => {
|
|
26845
26979
|
if (timerRef.current) {
|
|
26846
26980
|
clearTimeout(timerRef.current);
|
|
@@ -26926,8 +27060,8 @@ function useReviewPreview({
|
|
|
26926
27060
|
deleteAllComponents,
|
|
26927
27061
|
onResult
|
|
26928
27062
|
}) {
|
|
26929
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
26930
|
-
const [removedComponents, setRemovedComponents] =
|
|
27063
|
+
const [previewAnnotations, setPreviewAnnotations] = useState26(/* @__PURE__ */ new Map());
|
|
27064
|
+
const [removedComponents, setRemovedComponents] = useState26([]);
|
|
26931
27065
|
const handleResult = useCallback4(
|
|
26932
27066
|
(response) => {
|
|
26933
27067
|
if (!response) return;
|
|
@@ -26953,14 +27087,14 @@ function useReviewPreview({
|
|
|
26953
27087
|
onResult: handleResult,
|
|
26954
27088
|
deleteAllComponents
|
|
26955
27089
|
});
|
|
26956
|
-
const [spinnerTick, setSpinnerTick] =
|
|
26957
|
-
|
|
27090
|
+
const [spinnerTick, setSpinnerTick] = useState26(0);
|
|
27091
|
+
useEffect23(() => {
|
|
26958
27092
|
if (livePreviewHook.status !== "running") return;
|
|
26959
27093
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
26960
27094
|
return () => clearInterval(id);
|
|
26961
27095
|
}, [livePreviewHook.status]);
|
|
26962
27096
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
26963
|
-
|
|
27097
|
+
useEffect23(() => {
|
|
26964
27098
|
if (loading) return;
|
|
26965
27099
|
if (!livePreview) return;
|
|
26966
27100
|
if (components.length === 0) return;
|
|
@@ -26971,7 +27105,7 @@ function useReviewPreview({
|
|
|
26971
27105
|
|
|
26972
27106
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
26973
27107
|
init_debug_store();
|
|
26974
|
-
import { useEffect as
|
|
27108
|
+
import { useEffect as useEffect24, useRef as useRef16 } from "react";
|
|
26975
27109
|
|
|
26976
27110
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
|
|
26977
27111
|
var REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
|
|
@@ -27043,7 +27177,7 @@ function useReviewLog({
|
|
|
27043
27177
|
const started = useRef16(false);
|
|
27044
27178
|
const latest = useRef16(components);
|
|
27045
27179
|
latest.current = components;
|
|
27046
|
-
|
|
27180
|
+
useEffect24(() => {
|
|
27047
27181
|
if (loading || started.current) return;
|
|
27048
27182
|
started.current = true;
|
|
27049
27183
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -27058,7 +27192,7 @@ function useReviewLog({
|
|
|
27058
27192
|
trail.current = openReviewTrail(components, Date.now());
|
|
27059
27193
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
27060
27194
|
}, [loading, loadError, components]);
|
|
27061
|
-
|
|
27195
|
+
useEffect24(
|
|
27062
27196
|
() => () => {
|
|
27063
27197
|
const open = trail.current;
|
|
27064
27198
|
trail.current = void 0;
|
|
@@ -27335,7 +27469,7 @@ function GenerateReviewStepView({
|
|
|
27335
27469
|
initialFinalizeError = null
|
|
27336
27470
|
}) {
|
|
27337
27471
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
27338
|
-
const [slotCycles, setSlotCycles] =
|
|
27472
|
+
const [slotCycles, setSlotCycles] = useState27([]);
|
|
27339
27473
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
27340
27474
|
setSlotCycles(cycles ?? []);
|
|
27341
27475
|
}, []);
|
|
@@ -27368,7 +27502,7 @@ function GenerateReviewStepView({
|
|
|
27368
27502
|
onExtraLoaded: setLoadedSlotCycles
|
|
27369
27503
|
});
|
|
27370
27504
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
27371
|
-
const [nav, setNav] =
|
|
27505
|
+
const [nav, setNav] = useState27({
|
|
27372
27506
|
cursorRowIdx: 0,
|
|
27373
27507
|
sidebarScrollOffset: 0
|
|
27374
27508
|
});
|
|
@@ -27384,10 +27518,10 @@ function GenerateReviewStepView({
|
|
|
27384
27518
|
finalizeError,
|
|
27385
27519
|
setFinalizeError
|
|
27386
27520
|
} = reviewSurface;
|
|
27387
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
27521
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState27(false);
|
|
27388
27522
|
const removedBannerDefaultedRef = useRef17(false);
|
|
27389
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
27390
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
27523
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState27(0);
|
|
27524
|
+
const [cyclesCursor, setCyclesCursor] = useState27(0);
|
|
27391
27525
|
const cyclePanel = useOverlayPanel({
|
|
27392
27526
|
toggleKey: "c",
|
|
27393
27527
|
onClose: () => {
|
|
@@ -27402,9 +27536,9 @@ function GenerateReviewStepView({
|
|
|
27402
27536
|
setBreakConfirm(false);
|
|
27403
27537
|
}
|
|
27404
27538
|
});
|
|
27405
|
-
const [breakCursor, setBreakCursor] =
|
|
27406
|
-
const [breakConfirm, setBreakConfirm] =
|
|
27407
|
-
const [expandedGroups, setExpandedGroups] =
|
|
27539
|
+
const [breakCursor, setBreakCursor] = useState27(0);
|
|
27540
|
+
const [breakConfirm, setBreakConfirm] = useState27(false);
|
|
27541
|
+
const [expandedGroups, setExpandedGroups] = useState27(/* @__PURE__ */ new Set());
|
|
27408
27542
|
const seededGroupsRef = useRef17(false);
|
|
27409
27543
|
const {
|
|
27410
27544
|
searchOpen,
|
|
@@ -27423,14 +27557,14 @@ function GenerateReviewStepView({
|
|
|
27423
27557
|
setShowHelp
|
|
27424
27558
|
} = useSidebarSearchState();
|
|
27425
27559
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
27426
|
-
const [breakingChanges, setBreakingChanges] =
|
|
27427
|
-
const [breakingCursor, setBreakingCursor] =
|
|
27428
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
27429
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
27430
|
-
const [autoRejected, setAutoRejected] =
|
|
27431
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
27560
|
+
const [breakingChanges, setBreakingChanges] = useState27([]);
|
|
27561
|
+
const [breakingCursor, setBreakingCursor] = useState27(0);
|
|
27562
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState27(false);
|
|
27563
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState27(null);
|
|
27564
|
+
const [autoRejected, setAutoRejected] = useState27([]);
|
|
27565
|
+
const [undoSnapshot, setUndoSnapshot] = useState27(null);
|
|
27432
27566
|
const autoRejectFiredRef = useRef17(false);
|
|
27433
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
27567
|
+
const [showReloadDialog, setShowReloadDialog] = useState27(false);
|
|
27434
27568
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
27435
27569
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
27436
27570
|
components,
|
|
@@ -27495,7 +27629,7 @@ function GenerateReviewStepView({
|
|
|
27495
27629
|
[components]
|
|
27496
27630
|
);
|
|
27497
27631
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
27498
|
-
|
|
27632
|
+
useEffect25(() => {
|
|
27499
27633
|
if (seededGroupsRef.current) return;
|
|
27500
27634
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
27501
27635
|
seededGroupsRef.current = true;
|
|
@@ -27522,7 +27656,7 @@ function GenerateReviewStepView({
|
|
|
27522
27656
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
27523
27657
|
}));
|
|
27524
27658
|
}, [slotCycles, cycleView]);
|
|
27525
|
-
|
|
27659
|
+
useEffect25(() => {
|
|
27526
27660
|
const decision = computeAutoRejectDecision({
|
|
27527
27661
|
loading,
|
|
27528
27662
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -27567,7 +27701,7 @@ function GenerateReviewStepView({
|
|
|
27567
27701
|
onAction: reviewLog.record
|
|
27568
27702
|
});
|
|
27569
27703
|
const autoRejectPushedRef = useRef17(false);
|
|
27570
|
-
|
|
27704
|
+
useEffect25(() => {
|
|
27571
27705
|
if (loading) return;
|
|
27572
27706
|
if (!historySeededRef.current) return;
|
|
27573
27707
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -27651,7 +27785,7 @@ function GenerateReviewStepView({
|
|
|
27651
27785
|
const panelHeight = leftPanelHeight + 2;
|
|
27652
27786
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
27653
27787
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
27654
|
-
|
|
27788
|
+
useEffect25(() => {
|
|
27655
27789
|
if (selectableRowPositions.length === 0) return;
|
|
27656
27790
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
27657
27791
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -28572,10 +28706,10 @@ function DoneStep({
|
|
|
28572
28706
|
}
|
|
28573
28707
|
|
|
28574
28708
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
28575
|
-
import { useState as
|
|
28709
|
+
import { useState as useState29 } from "react";
|
|
28576
28710
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
28577
28711
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
28578
|
-
import { dirname as dirname17, basename as
|
|
28712
|
+
import { dirname as dirname17, basename as basename7, join as join23 } from "node:path";
|
|
28579
28713
|
|
|
28580
28714
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
28581
28715
|
import { resolve as resolve26 } from "node:path";
|
|
@@ -28596,10 +28730,10 @@ function normalizePath(input) {
|
|
|
28596
28730
|
}
|
|
28597
28731
|
|
|
28598
28732
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
28599
|
-
import { useEffect as
|
|
28733
|
+
import { useEffect as useEffect26, useState as useState28 } from "react";
|
|
28600
28734
|
function useBlinkingCursor() {
|
|
28601
|
-
const [visible, setVisible] =
|
|
28602
|
-
|
|
28735
|
+
const [visible, setVisible] = useState28(true);
|
|
28736
|
+
useEffect26(() => {
|
|
28603
28737
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
28604
28738
|
return () => clearInterval(interval);
|
|
28605
28739
|
}, []);
|
|
@@ -28612,7 +28746,7 @@ function autocomplete(partial) {
|
|
|
28612
28746
|
if (!partial) return null;
|
|
28613
28747
|
const normalized = normalizePath(partial);
|
|
28614
28748
|
const dir = dirname17(normalized);
|
|
28615
|
-
const base =
|
|
28749
|
+
const base = basename7(normalized);
|
|
28616
28750
|
let entries;
|
|
28617
28751
|
try {
|
|
28618
28752
|
entries = readdirSync4(dir);
|
|
@@ -28621,13 +28755,13 @@ function autocomplete(partial) {
|
|
|
28621
28755
|
}
|
|
28622
28756
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
28623
28757
|
if (matches.length === 0) return null;
|
|
28624
|
-
if (matches.length === 1) return
|
|
28758
|
+
if (matches.length === 1) return join23(dir, matches[0]);
|
|
28625
28759
|
let prefix = matches[0];
|
|
28626
28760
|
for (const m of matches) {
|
|
28627
28761
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
28628
28762
|
if (!prefix) break;
|
|
28629
28763
|
}
|
|
28630
|
-
return prefix.length > base.length ?
|
|
28764
|
+
return prefix.length > base.length ? join23(dir, prefix) : null;
|
|
28631
28765
|
}
|
|
28632
28766
|
function PathPrompt({
|
|
28633
28767
|
defaultPath,
|
|
@@ -28636,7 +28770,7 @@ function PathPrompt({
|
|
|
28636
28770
|
label = "Save to",
|
|
28637
28771
|
summary
|
|
28638
28772
|
}) {
|
|
28639
|
-
const [input, setInput] =
|
|
28773
|
+
const [input, setInput] = useState29("");
|
|
28640
28774
|
const cursorVisible = useBlinkingCursor();
|
|
28641
28775
|
useImmediateInput((rawInput, key) => {
|
|
28642
28776
|
if (key.return) {
|
|
@@ -28715,12 +28849,12 @@ function countedThings({ components, tokens }, counts = {}) {
|
|
|
28715
28849
|
}
|
|
28716
28850
|
|
|
28717
28851
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
28718
|
-
import { useEffect as
|
|
28852
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
28719
28853
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
28720
28854
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
28721
28855
|
function useTimedSpinner() {
|
|
28722
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
28723
|
-
|
|
28856
|
+
const [elapsedSeconds, setElapsedSeconds] = useState30(0);
|
|
28857
|
+
useEffect27(() => {
|
|
28724
28858
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
28725
28859
|
return () => {
|
|
28726
28860
|
clearInterval(timer);
|
|
@@ -28782,7 +28916,7 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28782
28916
|
}
|
|
28783
28917
|
|
|
28784
28918
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
28785
|
-
import { useEffect as
|
|
28919
|
+
import { useEffect as useEffect28, useState as useState31, useMemo as useMemo7 } from "react";
|
|
28786
28920
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
28787
28921
|
|
|
28788
28922
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
|
|
@@ -29161,8 +29295,8 @@ function WizardPreviewStep({
|
|
|
29161
29295
|
onQuit
|
|
29162
29296
|
}) {
|
|
29163
29297
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
29164
|
-
const [diffExpanded, setDiffExpanded] =
|
|
29165
|
-
const [scrollOffset, setScrollOffset] =
|
|
29298
|
+
const [diffExpanded, setDiffExpanded] = useState31(false);
|
|
29299
|
+
const [scrollOffset, setScrollOffset] = useState31(0);
|
|
29166
29300
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
29167
29301
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
29168
29302
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -29177,7 +29311,7 @@ function WizardPreviewStep({
|
|
|
29177
29311
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
29178
29312
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
29179
29313
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
29180
|
-
|
|
29314
|
+
useEffect28(() => {
|
|
29181
29315
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
29182
29316
|
}, [maxScroll]);
|
|
29183
29317
|
useImmediateInput((input, key) => {
|
|
@@ -29269,7 +29403,7 @@ function buildRunTeaserLine(runId) {
|
|
|
29269
29403
|
|
|
29270
29404
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
29271
29405
|
init_debug_store();
|
|
29272
|
-
import { useEffect as
|
|
29406
|
+
import { useEffect as useEffect29, useRef as useRef18 } from "react";
|
|
29273
29407
|
|
|
29274
29408
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
29275
29409
|
var FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
@@ -29424,7 +29558,7 @@ function flowFinish(trail, final, now) {
|
|
|
29424
29558
|
function useFlowLog(state2) {
|
|
29425
29559
|
const trail = useRef18(void 0);
|
|
29426
29560
|
const previous = useRef18(void 0);
|
|
29427
|
-
|
|
29561
|
+
useEffect29(() => {
|
|
29428
29562
|
const before = previous.current;
|
|
29429
29563
|
previous.current = state2;
|
|
29430
29564
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -29447,7 +29581,7 @@ function useFlowLog(state2) {
|
|
|
29447
29581
|
trail.current = open;
|
|
29448
29582
|
setDebugRunProgress(flowProgress(open, now));
|
|
29449
29583
|
}, [state2]);
|
|
29450
|
-
|
|
29584
|
+
useEffect29(
|
|
29451
29585
|
() => () => {
|
|
29452
29586
|
const open = trail.current;
|
|
29453
29587
|
trail.current = void 0;
|
|
@@ -29586,13 +29720,13 @@ function FlowScreen({
|
|
|
29586
29720
|
}
|
|
29587
29721
|
|
|
29588
29722
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
29589
|
-
import { useEffect as
|
|
29723
|
+
import { useEffect as useEffect30, useRef as useRef19, useSyncExternalStore } from "react";
|
|
29590
29724
|
|
|
29591
29725
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
29592
29726
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
29593
29727
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
29594
29728
|
import { tmpdir } from "node:os";
|
|
29595
|
-
import { join as
|
|
29729
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
29596
29730
|
|
|
29597
29731
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
29598
29732
|
function shouldBypassPreview(state2) {
|
|
@@ -29941,8 +30075,8 @@ function pushFailure(e, deps) {
|
|
|
29941
30075
|
}
|
|
29942
30076
|
|
|
29943
30077
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
29944
|
-
import { writeFile as
|
|
29945
|
-
import { join as
|
|
30078
|
+
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
30079
|
+
import { join as join24 } from "node:path";
|
|
29946
30080
|
|
|
29947
30081
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
|
|
29948
30082
|
function nextStateAfterPrint(opts) {
|
|
@@ -29966,7 +30100,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
29966
30100
|
var realSaveDeps = () => ({
|
|
29967
30101
|
openDb: openPipelineDb,
|
|
29968
30102
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
29969
|
-
writeFile: (path5, contents) =>
|
|
30103
|
+
writeFile: (path5, contents) => writeFile9(path5, contents),
|
|
29970
30104
|
appendRun,
|
|
29971
30105
|
buildSourceFingerprint,
|
|
29972
30106
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -29974,7 +30108,7 @@ var realSaveDeps = () => ({
|
|
|
29974
30108
|
});
|
|
29975
30109
|
async function runPrintFiles(input, deps, onPatch) {
|
|
29976
30110
|
onPatch({ step: "printing" });
|
|
29977
|
-
const componentsPath =
|
|
30111
|
+
const componentsPath = join24(input.outDir, "components.json");
|
|
29978
30112
|
try {
|
|
29979
30113
|
const db = deps.openDb();
|
|
29980
30114
|
let components = [];
|
|
@@ -30059,7 +30193,7 @@ var EMPTY_PUSH_RESULT = {
|
|
|
30059
30193
|
};
|
|
30060
30194
|
|
|
30061
30195
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
30062
|
-
var WIZARD_LOG =
|
|
30196
|
+
var WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
30063
30197
|
function appendWizardLog(entry) {
|
|
30064
30198
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
30065
30199
|
}
|
|
@@ -30352,14 +30486,14 @@ function useFlow(start, options = {}) {
|
|
|
30352
30486
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
30353
30487
|
() => current?.getState()
|
|
30354
30488
|
);
|
|
30355
|
-
|
|
30489
|
+
useEffect30(() => {
|
|
30356
30490
|
if (!start) controller.current = void 0;
|
|
30357
30491
|
}, [start]);
|
|
30358
30492
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
30359
30493
|
}
|
|
30360
30494
|
|
|
30361
30495
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
30362
|
-
import { useEffect as
|
|
30496
|
+
import { useEffect as useEffect31, useState as useState32 } from "react";
|
|
30363
30497
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
30364
30498
|
init_debug_store();
|
|
30365
30499
|
|
|
@@ -30370,7 +30504,7 @@ init_debug_mode_store();
|
|
|
30370
30504
|
init_version();
|
|
30371
30505
|
|
|
30372
30506
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
30373
|
-
import { join as
|
|
30507
|
+
import { join as join26, resolve as resolve28 } from "node:path";
|
|
30374
30508
|
function describeFileLocations({
|
|
30375
30509
|
contentfulBaseDir,
|
|
30376
30510
|
debugModeEnabled,
|
|
@@ -30379,14 +30513,14 @@ function describeFileLocations({
|
|
|
30379
30513
|
if (!debugModeEnabled) {
|
|
30380
30514
|
return {
|
|
30381
30515
|
debugLogs: "none while Debug Mode is off",
|
|
30382
|
-
importFiles: `${
|
|
30516
|
+
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
30383
30517
|
};
|
|
30384
30518
|
}
|
|
30385
30519
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
30386
|
-
const session = currentSessionDir2 ??
|
|
30520
|
+
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
30387
30521
|
return {
|
|
30388
|
-
debugLogs:
|
|
30389
|
-
importFiles: `${
|
|
30522
|
+
debugLogs: join26(session, "debug"),
|
|
30523
|
+
importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
30390
30524
|
};
|
|
30391
30525
|
}
|
|
30392
30526
|
|
|
@@ -30432,8 +30566,8 @@ function Section({ title, rows }) {
|
|
|
30432
30566
|
] });
|
|
30433
30567
|
}
|
|
30434
30568
|
function HelpScreen({ onDone }) {
|
|
30435
|
-
const [info, setInfo] =
|
|
30436
|
-
|
|
30569
|
+
const [info, setInfo] = useState32();
|
|
30570
|
+
useEffect31(() => {
|
|
30437
30571
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
30438
30572
|
void readHelpInfo().then(setInfo);
|
|
30439
30573
|
}, []);
|
|
@@ -30471,14 +30605,14 @@ function HelpScreen({ onDone }) {
|
|
|
30471
30605
|
}
|
|
30472
30606
|
|
|
30473
30607
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
30474
|
-
import { useState as
|
|
30608
|
+
import { useState as useState33 } from "react";
|
|
30475
30609
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
30476
30610
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
30477
30611
|
function SettingsScreen({
|
|
30478
30612
|
onNavigate,
|
|
30479
30613
|
onBack
|
|
30480
30614
|
}) {
|
|
30481
|
-
const [focusIdx, setFocusIdx] =
|
|
30615
|
+
const [focusIdx, setFocusIdx] = useState33(0);
|
|
30482
30616
|
const items = [
|
|
30483
30617
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
30484
30618
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -30526,11 +30660,11 @@ function SettingsScreen({
|
|
|
30526
30660
|
}
|
|
30527
30661
|
|
|
30528
30662
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
30529
|
-
import { useState as
|
|
30663
|
+
import { useState as useState37 } from "react";
|
|
30530
30664
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
30531
30665
|
|
|
30532
30666
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
30533
|
-
import { useEffect as
|
|
30667
|
+
import { useEffect as useEffect33, useRef as useRef20, useState as useState35 } from "react";
|
|
30534
30668
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
30535
30669
|
init_debug_store();
|
|
30536
30670
|
|
|
@@ -30826,7 +30960,7 @@ async function writeAgentConfig(config) {
|
|
|
30826
30960
|
}
|
|
30827
30961
|
|
|
30828
30962
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30829
|
-
import { useEffect as
|
|
30963
|
+
import { useEffect as useEffect32, useState as useState34 } from "react";
|
|
30830
30964
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
30831
30965
|
|
|
30832
30966
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
@@ -30885,11 +31019,11 @@ function AgentDetail({
|
|
|
30885
31019
|
record: record3
|
|
30886
31020
|
}) {
|
|
30887
31021
|
const settings = config.agents[name];
|
|
30888
|
-
const [saving, setSaving] =
|
|
30889
|
-
const [testing, setTesting] =
|
|
30890
|
-
const [notice, setNotice] =
|
|
30891
|
-
const [checks, setChecks] =
|
|
30892
|
-
|
|
31022
|
+
const [saving, setSaving] = useState34(false);
|
|
31023
|
+
const [testing, setTesting] = useState34(false);
|
|
31024
|
+
const [notice, setNotice] = useState34(null);
|
|
31025
|
+
const [checks, setChecks] = useState34(void 0);
|
|
31026
|
+
useEffect32(() => {
|
|
30893
31027
|
let active = true;
|
|
30894
31028
|
setChecks(void 0);
|
|
30895
31029
|
const timer = setTimeout(() => {
|
|
@@ -30967,13 +31101,13 @@ import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-
|
|
|
30967
31101
|
var NAME_WIDTH = 16;
|
|
30968
31102
|
var PANEL_LABEL_WIDTH = "Command".length;
|
|
30969
31103
|
function AgentsScreen({ onDone }) {
|
|
30970
|
-
const [config, setConfig] =
|
|
30971
|
-
const [focus, setFocus] =
|
|
30972
|
-
const [open, setOpen] =
|
|
30973
|
-
const [notice, setNotice] =
|
|
30974
|
-
const [saving, setSaving] =
|
|
30975
|
-
const [loadError, setLoadError] =
|
|
30976
|
-
const [checks, setChecks] =
|
|
31104
|
+
const [config, setConfig] = useState35(null);
|
|
31105
|
+
const [focus, setFocus] = useState35(0);
|
|
31106
|
+
const [open, setOpen] = useState35(null);
|
|
31107
|
+
const [notice, setNotice] = useState35(null);
|
|
31108
|
+
const [saving, setSaving] = useState35(false);
|
|
31109
|
+
const [loadError, setLoadError] = useState35(null);
|
|
31110
|
+
const [checks, setChecks] = useState35({});
|
|
30977
31111
|
const visit = useRef20({
|
|
30978
31112
|
trail: createTrail(),
|
|
30979
31113
|
before: void 0,
|
|
@@ -30987,7 +31121,7 @@ function AgentsScreen({ onDone }) {
|
|
|
30987
31121
|
);
|
|
30988
31122
|
}
|
|
30989
31123
|
};
|
|
30990
|
-
|
|
31124
|
+
useEffect33(() => {
|
|
30991
31125
|
readAgentConfig().then((loaded) => {
|
|
30992
31126
|
setConfig(loaded);
|
|
30993
31127
|
inspectAll(loaded);
|
|
@@ -31164,7 +31298,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31164
31298
|
}
|
|
31165
31299
|
|
|
31166
31300
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
31167
|
-
import { useEffect as
|
|
31301
|
+
import { useEffect as useEffect34, useRef as useRef21, useState as useState36 } from "react";
|
|
31168
31302
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
31169
31303
|
init_debug_store();
|
|
31170
31304
|
|
|
@@ -31218,10 +31352,10 @@ function debugFields(config) {
|
|
|
31218
31352
|
var snapshotOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31219
31353
|
var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31220
31354
|
function ProjectScreen({ onDone }) {
|
|
31221
|
-
const [config, setConfig] =
|
|
31222
|
-
const [saving, setSaving] =
|
|
31223
|
-
const [notice, setNotice] =
|
|
31224
|
-
const [loadError, setLoadError] =
|
|
31355
|
+
const [config, setConfig] = useState36(null);
|
|
31356
|
+
const [saving, setSaving] = useState36(false);
|
|
31357
|
+
const [notice, setNotice] = useState36(null);
|
|
31358
|
+
const [loadError, setLoadError] = useState36(null);
|
|
31225
31359
|
const visit = useRef21({
|
|
31226
31360
|
trail: createTrail(),
|
|
31227
31361
|
before: void 0,
|
|
@@ -31229,7 +31363,7 @@ function ProjectScreen({ onDone }) {
|
|
|
31229
31363
|
error: ""
|
|
31230
31364
|
}).current;
|
|
31231
31365
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
31232
|
-
|
|
31366
|
+
useEffect34(() => {
|
|
31233
31367
|
readCredentials().then((cfg) => {
|
|
31234
31368
|
setConfig(cfg);
|
|
31235
31369
|
visit.before = snapshotOf(cfg);
|
|
@@ -31337,8 +31471,8 @@ var SECTIONS = [
|
|
|
31337
31471
|
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
31338
31472
|
];
|
|
31339
31473
|
function ConfigurationScreen({ onDone }) {
|
|
31340
|
-
const [focus, setFocus] =
|
|
31341
|
-
const [open, setOpen] =
|
|
31474
|
+
const [focus, setFocus] = useState37(0);
|
|
31475
|
+
const [open, setOpen] = useState37(null);
|
|
31342
31476
|
const close = () => setOpen(null);
|
|
31343
31477
|
useInput17((input, key) => {
|
|
31344
31478
|
if (open) return;
|
|
@@ -31381,7 +31515,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
31381
31515
|
}
|
|
31382
31516
|
|
|
31383
31517
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
31384
|
-
import { useEffect as
|
|
31518
|
+
import { useEffect as useEffect35, useState as useState38 } from "react";
|
|
31385
31519
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
31386
31520
|
|
|
31387
31521
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
@@ -31403,9 +31537,9 @@ async function writeAnalyticsSetting(setting) {
|
|
|
31403
31537
|
init_debug_store();
|
|
31404
31538
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
31405
31539
|
function OptInAnalyticsScreen({ onDone }) {
|
|
31406
|
-
const [loading, setLoading] =
|
|
31407
|
-
const [enabled, setEnabled] =
|
|
31408
|
-
|
|
31540
|
+
const [loading, setLoading] = useState38(true);
|
|
31541
|
+
const [enabled, setEnabled] = useState38(true);
|
|
31542
|
+
useEffect35(() => {
|
|
31409
31543
|
readAnalyticsSetting().then((setting) => {
|
|
31410
31544
|
setEnabled(setting.enabled);
|
|
31411
31545
|
setLoading(false);
|
|
@@ -31459,7 +31593,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
31459
31593
|
}
|
|
31460
31594
|
|
|
31461
31595
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
31462
|
-
import { useEffect as
|
|
31596
|
+
import { useEffect as useEffect36, useRef as useRef22, useState as useState39 } from "react";
|
|
31463
31597
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
31464
31598
|
init_debug_mode_store();
|
|
31465
31599
|
init_debug_store();
|
|
@@ -31470,14 +31604,14 @@ var snapshotOf2 = (setting) => ({
|
|
|
31470
31604
|
retentionDays: String(setting.retentionDays)
|
|
31471
31605
|
});
|
|
31472
31606
|
function DebugModeScreen({ onDone }) {
|
|
31473
|
-
const [setting, setSetting] =
|
|
31474
|
-
const [focus, setFocus] =
|
|
31475
|
-
const [pending, setPending] =
|
|
31607
|
+
const [setting, setSetting] = useState39(null);
|
|
31608
|
+
const [focus, setFocus] = useState39("enabled");
|
|
31609
|
+
const [pending, setPending] = useState39(
|
|
31476
31610
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
31477
31611
|
);
|
|
31478
|
-
const [notice, setNotice] =
|
|
31612
|
+
const [notice, setNotice] = useState39(null);
|
|
31479
31613
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
31480
|
-
|
|
31614
|
+
useEffect36(() => {
|
|
31481
31615
|
readDebugModeSetting().then((loaded) => {
|
|
31482
31616
|
setSetting(loaded);
|
|
31483
31617
|
setPending(loaded.retentionDays);
|
|
@@ -31601,18 +31735,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
31601
31735
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
31602
31736
|
var TOKENS_ONLY_HIDDEN_STEPS = ["extraction", "scope-gate"];
|
|
31603
31737
|
function App({ importOptions, inkClear }) {
|
|
31604
|
-
const [screen, setScreen] =
|
|
31605
|
-
const [importExitCode, setImportExitCode] =
|
|
31738
|
+
const [screen, setScreen] = useState40("start");
|
|
31739
|
+
const [importExitCode, setImportExitCode] = useState40();
|
|
31606
31740
|
const showImportResult = importExitCode !== void 0;
|
|
31607
|
-
const [target, setTarget] =
|
|
31608
|
-
const [answers, setAnswers] =
|
|
31741
|
+
const [target, setTarget] = useState40();
|
|
31742
|
+
const [answers, setAnswers] = useState40({});
|
|
31609
31743
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
31610
|
-
const [extractionRun, setExtractionRun] =
|
|
31744
|
+
const [extractionRun, setExtractionRun] = useState40();
|
|
31611
31745
|
const extraction = useExtraction(extractionRun?.input);
|
|
31612
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
31746
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState40();
|
|
31613
31747
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
31614
|
-
const [tokenReview, setTokenReview] =
|
|
31615
|
-
const [scopeRun, setScopeRun] =
|
|
31748
|
+
const [tokenReview, setTokenReview] = useState40();
|
|
31749
|
+
const [scopeRun, setScopeRun] = useState40();
|
|
31616
31750
|
const scopeFlow = useScopeGateFlow(
|
|
31617
31751
|
scopeRun && {
|
|
31618
31752
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -31627,12 +31761,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31627
31761
|
}
|
|
31628
31762
|
}
|
|
31629
31763
|
);
|
|
31630
|
-
const [generationInput, setGenerationInput] =
|
|
31764
|
+
const [generationInput, setGenerationInput] = useState40();
|
|
31631
31765
|
const generation = useGeneration(generationInput);
|
|
31632
|
-
const [flowStart, setFlowStart] =
|
|
31766
|
+
const [flowStart, setFlowStart] = useState40();
|
|
31633
31767
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
31634
|
-
const [importDefaults, setImportDefaults] =
|
|
31635
|
-
|
|
31768
|
+
const [importDefaults, setImportDefaults] = useState40();
|
|
31769
|
+
useEffect37(() => {
|
|
31636
31770
|
if (screen !== "import") {
|
|
31637
31771
|
setImportDefaults(void 0);
|
|
31638
31772
|
return;
|
|
@@ -31705,7 +31839,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31705
31839
|
}
|
|
31706
31840
|
});
|
|
31707
31841
|
};
|
|
31708
|
-
|
|
31842
|
+
useEffect37(() => {
|
|
31709
31843
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
31710
31844
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
31711
31845
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -31727,12 +31861,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31727
31861
|
}
|
|
31728
31862
|
});
|
|
31729
31863
|
}, [tokensOnly, tokensOnlyRun]);
|
|
31730
|
-
|
|
31864
|
+
useEffect37(() => {
|
|
31731
31865
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
31732
31866
|
setExtractionRun(void 0);
|
|
31733
31867
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
31734
31868
|
}, [extraction, extractionRun]);
|
|
31735
|
-
|
|
31869
|
+
useEffect37(() => {
|
|
31736
31870
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
31737
31871
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31738
31872
|
setGenerationInput({
|
|
@@ -31750,7 +31884,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31750
31884
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
31751
31885
|
});
|
|
31752
31886
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
31753
|
-
|
|
31887
|
+
useEffect37(() => {
|
|
31754
31888
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
31755
31889
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31756
31890
|
inkClear();
|