@contentful/experience-design-system-cli 2.42.1-dev-build-25400cd0.0 → 2.42.1-dev-build-2fb477e0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +426 -548
- package/dist/index.js +307 -447
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +1 -3
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +12 -2
- package/package.json +3 -3
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +0 -3
- package/dist/src/tui/support-bundle.d.ts +0 -23
- package/dist/src/tui/zip.d.ts +0 -7
package/dist/app.js
CHANGED
|
@@ -198,7 +198,6 @@ __export(debug_store_exports, {
|
|
|
198
198
|
currentSessionDir: () => currentSessionDir,
|
|
199
199
|
finishDebugRun: () => finishDebugRun,
|
|
200
200
|
setDebugRunProgress: () => setDebugRunProgress,
|
|
201
|
-
settleDebugLogs: () => settleDebugLogs,
|
|
202
201
|
startDebugRun: () => startDebugRun,
|
|
203
202
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
204
203
|
startImportRun: () => startImportRun
|
|
@@ -303,19 +302,7 @@ function startDebugRun({
|
|
|
303
302
|
function setDebugRunProgress(outputs) {
|
|
304
303
|
if (pendingRun) pendingRun.progress = outputs;
|
|
305
304
|
}
|
|
306
|
-
function
|
|
307
|
-
unsettled.add(work);
|
|
308
|
-
const forget = () => void unsettled.delete(work);
|
|
309
|
-
work.then(forget, forget);
|
|
310
|
-
return work;
|
|
311
|
-
}
|
|
312
|
-
async function settleDebugLogs() {
|
|
313
|
-
while (unsettled.size > 0) await Promise.allSettled([...unsettled]);
|
|
314
|
-
}
|
|
315
|
-
function finishDebugRun(args) {
|
|
316
|
-
return track(finishRun(args));
|
|
317
|
-
}
|
|
318
|
-
async function finishRun({
|
|
305
|
+
async function finishDebugRun({
|
|
319
306
|
outputs,
|
|
320
307
|
status,
|
|
321
308
|
exitMethod
|
|
@@ -398,7 +385,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
398
385
|
function handleCrash() {
|
|
399
386
|
return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
|
|
400
387
|
}
|
|
401
|
-
var pendingRun, sessionDir,
|
|
388
|
+
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
402
389
|
var init_debug_store = __esm({
|
|
403
390
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
404
391
|
"use strict";
|
|
@@ -428,7 +415,6 @@ var init_debug_store = __esm({
|
|
|
428
415
|
);
|
|
429
416
|
}
|
|
430
417
|
});
|
|
431
|
-
unsettled = /* @__PURE__ */ new Set();
|
|
432
418
|
WAITING_LIMIT = 50;
|
|
433
419
|
waiting = [];
|
|
434
420
|
process.once("uncaughtException", (err) => {
|
|
@@ -859,14 +845,14 @@ var init_parse_prompt_overrides = __esm({
|
|
|
859
845
|
});
|
|
860
846
|
|
|
861
847
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
|
|
862
|
-
import { readFile as
|
|
848
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
863
849
|
import { resolve as resolve3 } from "node:path";
|
|
864
850
|
async function resolvePromptOverride(override) {
|
|
865
851
|
if (override.kind === "text")
|
|
866
852
|
return override.value;
|
|
867
853
|
const abs = resolve3(override.value);
|
|
868
854
|
try {
|
|
869
|
-
return await
|
|
855
|
+
return await readFile2(abs, "utf8");
|
|
870
856
|
} catch {
|
|
871
857
|
throw new Error(`--prompt: could not read prompt file: ${abs}`);
|
|
872
858
|
}
|
|
@@ -2158,7 +2144,7 @@ var init_skill_files = __esm({
|
|
|
2158
2144
|
|
|
2159
2145
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
|
|
2160
2146
|
import { existsSync as existsSync3 } from "node:fs";
|
|
2161
|
-
import { dirname as dirname5, join as
|
|
2147
|
+
import { dirname as dirname5, join as join7, resolve as resolve4 } from "node:path";
|
|
2162
2148
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2163
2149
|
function resolveSkillPath(skill) {
|
|
2164
2150
|
if (!(skill in SKILL_FILES))
|
|
@@ -2166,11 +2152,11 @@ function resolveSkillPath(skill) {
|
|
|
2166
2152
|
const thisDir = dirname5(fileURLToPath2(import.meta.url));
|
|
2167
2153
|
let dir = thisDir;
|
|
2168
2154
|
for (; ; ) {
|
|
2169
|
-
const candidate =
|
|
2155
|
+
const candidate = join7(dir, "skills");
|
|
2170
2156
|
if (existsSync3(candidate)) {
|
|
2171
2157
|
const file = SKILL_FILES[skill];
|
|
2172
2158
|
const stepDir = file === "select-components.md" ? "selection" : "generation";
|
|
2173
|
-
return
|
|
2159
|
+
return join7(candidate, stepDir, file);
|
|
2174
2160
|
}
|
|
2175
2161
|
const parent = resolve4(dir, "..");
|
|
2176
2162
|
if (parent === dir) {
|
|
@@ -2187,20 +2173,20 @@ var init_resolve_skill_path = __esm({
|
|
|
2187
2173
|
});
|
|
2188
2174
|
|
|
2189
2175
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
|
|
2190
|
-
import { readFile as
|
|
2176
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
2191
2177
|
import { resolve as resolve5 } from "node:path";
|
|
2192
2178
|
async function readSkillFile(skill, override) {
|
|
2193
2179
|
if (override) {
|
|
2194
2180
|
const skillPath2 = resolve5(override);
|
|
2195
2181
|
try {
|
|
2196
|
-
return await
|
|
2182
|
+
return await readFile3(skillPath2, "utf8");
|
|
2197
2183
|
} catch {
|
|
2198
2184
|
throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
|
|
2199
2185
|
}
|
|
2200
2186
|
}
|
|
2201
2187
|
const skillPath = resolveSkillPath(skill);
|
|
2202
2188
|
try {
|
|
2203
|
-
return await
|
|
2189
|
+
return await readFile3(skillPath, "utf8");
|
|
2204
2190
|
} catch {
|
|
2205
2191
|
throw new Error(`skill file missing from package (expected at: ${skillPath})`);
|
|
2206
2192
|
}
|
|
@@ -2494,13 +2480,13 @@ __export(cache_keys_exports, {
|
|
|
2494
2480
|
hashPromptForSkill: () => hashPromptForSkill
|
|
2495
2481
|
});
|
|
2496
2482
|
import { createHash as createHash4 } from "node:crypto";
|
|
2497
|
-
import { readFile as
|
|
2483
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
2498
2484
|
import { resolve as resolve6 } from "node:path";
|
|
2499
2485
|
function hashContent(content) {
|
|
2500
2486
|
return createHash4("sha256").update(content).digest("hex");
|
|
2501
2487
|
}
|
|
2502
2488
|
async function hashFile(filePath) {
|
|
2503
|
-
const content = await
|
|
2489
|
+
const content = await readFile4(filePath, "utf8");
|
|
2504
2490
|
return hashContent(content);
|
|
2505
2491
|
}
|
|
2506
2492
|
async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
|
|
@@ -2516,7 +2502,7 @@ var init_cache_keys = __esm({
|
|
|
2516
2502
|
});
|
|
2517
2503
|
|
|
2518
2504
|
// packages/experience-design-system-cli/app.tsx
|
|
2519
|
-
import { useEffect as
|
|
2505
|
+
import { useEffect as useEffect36, useState as useState39 } from "react";
|
|
2520
2506
|
|
|
2521
2507
|
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
2522
2508
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -2724,7 +2710,7 @@ function ImportScreen({ exitCode, onDone }) {
|
|
|
2724
2710
|
}
|
|
2725
2711
|
|
|
2726
2712
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
2727
|
-
import { useEffect as
|
|
2713
|
+
import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
2728
2714
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
2729
2715
|
init_debug_store();
|
|
2730
2716
|
|
|
@@ -2836,110 +2822,6 @@ function usePreflightControls(handlers) {
|
|
|
2836
2822
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2837
2823
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
2838
2824
|
|
|
2839
|
-
// packages/experience-design-system-cli/src/tui/support-bundle.ts
|
|
2840
|
-
init_debug_store();
|
|
2841
|
-
import { readdir as readdir2, readFile as readFile2, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
2842
|
-
import { basename, join as join6, sep } from "node:path";
|
|
2843
|
-
|
|
2844
|
-
// packages/experience-design-system-cli/src/tui/zip.ts
|
|
2845
|
-
import { crc32, deflateRawSync } from "node:zlib";
|
|
2846
|
-
var LOCAL_HEADER = 67324752;
|
|
2847
|
-
var CENTRAL_HEADER = 33639248;
|
|
2848
|
-
var END_OF_ARCHIVE = 101010256;
|
|
2849
|
-
var VERSION2 = 20;
|
|
2850
|
-
var UTF8_NAMES = 2048;
|
|
2851
|
-
var DEFLATE = 8;
|
|
2852
|
-
function dosDateTime(date) {
|
|
2853
|
-
const year = Math.max(1980, date.getFullYear());
|
|
2854
|
-
return {
|
|
2855
|
-
day: year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate(),
|
|
2856
|
-
time: date.getHours() << 11 | date.getMinutes() << 5 | date.getSeconds() >> 1
|
|
2857
|
-
};
|
|
2858
|
-
}
|
|
2859
|
-
function createZip(entries) {
|
|
2860
|
-
const body = [];
|
|
2861
|
-
const directory = [];
|
|
2862
|
-
let offset = 0;
|
|
2863
|
-
for (const entry of entries) {
|
|
2864
|
-
const name = Buffer.from(entry.name, "utf8");
|
|
2865
|
-
const compressed = deflateRawSync(entry.data);
|
|
2866
|
-
const checksum = crc32(entry.data);
|
|
2867
|
-
const { day, time } = dosDateTime(entry.modified);
|
|
2868
|
-
const local = Buffer.alloc(30);
|
|
2869
|
-
local.writeUInt32LE(LOCAL_HEADER, 0);
|
|
2870
|
-
local.writeUInt16LE(VERSION2, 4);
|
|
2871
|
-
local.writeUInt16LE(UTF8_NAMES, 6);
|
|
2872
|
-
local.writeUInt16LE(DEFLATE, 8);
|
|
2873
|
-
local.writeUInt16LE(time, 10);
|
|
2874
|
-
local.writeUInt16LE(day, 12);
|
|
2875
|
-
local.writeUInt32LE(checksum, 14);
|
|
2876
|
-
local.writeUInt32LE(compressed.length, 18);
|
|
2877
|
-
local.writeUInt32LE(entry.data.length, 22);
|
|
2878
|
-
local.writeUInt16LE(name.length, 26);
|
|
2879
|
-
body.push(local, name, compressed);
|
|
2880
|
-
const central = Buffer.alloc(46);
|
|
2881
|
-
central.writeUInt32LE(CENTRAL_HEADER, 0);
|
|
2882
|
-
central.writeUInt16LE(VERSION2, 4);
|
|
2883
|
-
central.writeUInt16LE(VERSION2, 6);
|
|
2884
|
-
central.writeUInt16LE(UTF8_NAMES, 8);
|
|
2885
|
-
central.writeUInt16LE(DEFLATE, 10);
|
|
2886
|
-
central.writeUInt16LE(time, 12);
|
|
2887
|
-
central.writeUInt16LE(day, 14);
|
|
2888
|
-
central.writeUInt32LE(checksum, 16);
|
|
2889
|
-
central.writeUInt32LE(compressed.length, 20);
|
|
2890
|
-
central.writeUInt32LE(entry.data.length, 24);
|
|
2891
|
-
central.writeUInt16LE(name.length, 28);
|
|
2892
|
-
central.writeUInt32LE(offset, 42);
|
|
2893
|
-
directory.push(central, name);
|
|
2894
|
-
offset += local.length + name.length + compressed.length;
|
|
2895
|
-
}
|
|
2896
|
-
const directoryBytes = Buffer.concat(directory);
|
|
2897
|
-
const end = Buffer.alloc(22);
|
|
2898
|
-
end.writeUInt32LE(END_OF_ARCHIVE, 0);
|
|
2899
|
-
end.writeUInt16LE(entries.length, 8);
|
|
2900
|
-
end.writeUInt16LE(entries.length, 10);
|
|
2901
|
-
end.writeUInt32LE(directoryBytes.length, 12);
|
|
2902
|
-
end.writeUInt32LE(offset, 16);
|
|
2903
|
-
return Buffer.concat([...body, directoryBytes, end]);
|
|
2904
|
-
}
|
|
2905
|
-
|
|
2906
|
-
// packages/experience-design-system-cli/src/tui/support-bundle.ts
|
|
2907
|
-
async function bundleDebugLogs() {
|
|
2908
|
-
const session = currentSessionDir();
|
|
2909
|
-
const debugDir = currentDebugSessionDir();
|
|
2910
|
-
if (!session || !debugDir) return { status: "no-logs" };
|
|
2911
|
-
try {
|
|
2912
|
-
await settleDebugLogs();
|
|
2913
|
-
const logs = (await readdir2(debugDir, { recursive: true })).filter((file) => file.endsWith(".md")).sort();
|
|
2914
|
-
if (logs.length === 0) return { status: "no-logs" };
|
|
2915
|
-
const entries = await Promise.all(
|
|
2916
|
-
logs.map(async (file) => {
|
|
2917
|
-
const path6 = join6(debugDir, file);
|
|
2918
|
-
return { name: file.split(sep).join("/"), data: await readFile2(path6), modified: (await stat2(path6)).mtime };
|
|
2919
|
-
})
|
|
2920
|
-
);
|
|
2921
|
-
const path5 = join6(session, `${basename(session)}-debug-logs.zip`);
|
|
2922
|
-
await writeFile3(path5, createZip(entries), { mode: 384 });
|
|
2923
|
-
return { status: "created", path: path5, files: entries.length };
|
|
2924
|
-
} catch {
|
|
2925
|
-
return { status: "failed", folder: debugDir };
|
|
2926
|
-
}
|
|
2927
|
-
}
|
|
2928
|
-
function supportInstruction(bundle) {
|
|
2929
|
-
switch (bundle.status) {
|
|
2930
|
-
case "created":
|
|
2931
|
-
return `The import hit an error. We zipped up your debug logs, you can find the file here:
|
|
2932
|
-
${bundle.path}
|
|
2933
|
-
Send that zip file to Contentful support so they can look into it.`;
|
|
2934
|
-
case "no-logs":
|
|
2935
|
-
return "The import hit an error, but no debug logs were recorded. To get help, turn on Debug Mode in Settings, run the import again and send the zip file it saves to Contentful support.";
|
|
2936
|
-
case "failed":
|
|
2937
|
-
return `The import hit an error. We could not zip your debug logs, but you can find them here:
|
|
2938
|
-
${bundle.folder}
|
|
2939
|
-
Zip that folder and send it to Contentful support so they can look into it.`;
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
2825
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/controls.ts
|
|
2944
2826
|
import { useInput as useInput4 } from "ink";
|
|
2945
2827
|
|
|
@@ -2971,22 +2853,6 @@ function useErrorControls(handlers) {
|
|
|
2971
2853
|
});
|
|
2972
2854
|
}
|
|
2973
2855
|
|
|
2974
|
-
// packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
|
|
2975
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
2976
|
-
function useSupportBundle() {
|
|
2977
|
-
const [bundle, setBundle] = useState3();
|
|
2978
|
-
useEffect3(() => {
|
|
2979
|
-
let active = true;
|
|
2980
|
-
void bundleDebugLogs().then((result) => {
|
|
2981
|
-
if (active) setBundle(result);
|
|
2982
|
-
});
|
|
2983
|
-
return () => {
|
|
2984
|
-
active = false;
|
|
2985
|
-
};
|
|
2986
|
-
}, []);
|
|
2987
|
-
return bundle;
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
2856
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
2991
2857
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2992
2858
|
function ErrorStep({
|
|
@@ -2997,7 +2863,6 @@ function ErrorStep({
|
|
|
2997
2863
|
onAcknowledgeBreakingChanges
|
|
2998
2864
|
}) {
|
|
2999
2865
|
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
3000
|
-
const bundle = useSupportBundle();
|
|
3001
2866
|
const controls = errorControls({
|
|
3002
2867
|
canRetry: onRetryCredentials !== void 0,
|
|
3003
2868
|
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
@@ -3009,7 +2874,6 @@ function ErrorStep({
|
|
|
3009
2874
|
" failed"
|
|
3010
2875
|
] }),
|
|
3011
2876
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
3012
|
-
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
3013
2877
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
3014
2878
|
"[",
|
|
3015
2879
|
control.keys,
|
|
@@ -3226,10 +3090,10 @@ var PROGRESS_THEME = extendTheme(defaultTheme, {
|
|
|
3226
3090
|
});
|
|
3227
3091
|
|
|
3228
3092
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
3229
|
-
import { useEffect as
|
|
3093
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
3230
3094
|
function useElapsed() {
|
|
3231
|
-
const [seconds2, setSeconds] =
|
|
3232
|
-
|
|
3095
|
+
const [seconds2, setSeconds] = useState3(0);
|
|
3096
|
+
useEffect3(() => {
|
|
3233
3097
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
3234
3098
|
return () => clearInterval(timer);
|
|
3235
3099
|
}, []);
|
|
@@ -3285,9 +3149,9 @@ function RunningStep({
|
|
|
3285
3149
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3286
3150
|
var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
|
|
3287
3151
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
3288
|
-
const [focus, setFocus] =
|
|
3152
|
+
const [focus, setFocus] = useState4(0);
|
|
3289
3153
|
const viewed = useRef([optionAt(0)]).current;
|
|
3290
|
-
|
|
3154
|
+
useEffect4(() => {
|
|
3291
3155
|
startDebugRun({
|
|
3292
3156
|
flow: "import/preflight",
|
|
3293
3157
|
step: "00-preflight",
|
|
@@ -3330,7 +3194,7 @@ function PreflightScreen({ onChoose, onQuit }) {
|
|
|
3330
3194
|
}
|
|
3331
3195
|
|
|
3332
3196
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3333
|
-
import { useEffect as
|
|
3197
|
+
import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
|
|
3334
3198
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
3335
3199
|
init_debug_store();
|
|
3336
3200
|
|
|
@@ -3390,9 +3254,9 @@ function useWelcomeControls(onQuit) {
|
|
|
3390
3254
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
3391
3255
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3392
3256
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
3393
|
-
const [projectPath, setProjectPath] =
|
|
3257
|
+
const [projectPath, setProjectPath] = useState5(initialPath);
|
|
3394
3258
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
3395
|
-
|
|
3259
|
+
useEffect5(() => {
|
|
3396
3260
|
startDebugRun({
|
|
3397
3261
|
flow: "import/welcome",
|
|
3398
3262
|
step: "01-welcome",
|
|
@@ -3447,7 +3311,7 @@ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
|
3447
3311
|
}
|
|
3448
3312
|
|
|
3449
3313
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
3450
|
-
import { useEffect as
|
|
3314
|
+
import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
|
|
3451
3315
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
3452
3316
|
init_debug_store();
|
|
3453
3317
|
|
|
@@ -3523,10 +3387,10 @@ function TokenInputScreen({
|
|
|
3523
3387
|
onBack,
|
|
3524
3388
|
initialPath = ""
|
|
3525
3389
|
}) {
|
|
3526
|
-
const [tokenPath, setTokenPath] =
|
|
3527
|
-
const [failure, setFailure] =
|
|
3390
|
+
const [tokenPath, setTokenPath] = useState6(initialPath);
|
|
3391
|
+
const [failure, setFailure] = useState6(null);
|
|
3528
3392
|
const rejected = useRef4([]).current;
|
|
3529
|
-
|
|
3393
|
+
useEffect6(() => {
|
|
3530
3394
|
startDebugRun({
|
|
3531
3395
|
flow: "import/token-input",
|
|
3532
3396
|
step: "02-token-input",
|
|
@@ -3607,7 +3471,7 @@ function TokenInputScreen({
|
|
|
3607
3471
|
}
|
|
3608
3472
|
|
|
3609
3473
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
3610
|
-
import { useEffect as
|
|
3474
|
+
import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
|
|
3611
3475
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
3612
3476
|
init_debug_store();
|
|
3613
3477
|
|
|
@@ -3683,9 +3547,14 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
|
|
|
3683
3547
|
...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
|
|
3684
3548
|
};
|
|
3685
3549
|
}
|
|
3686
|
-
function
|
|
3550
|
+
function hasImportableFiles(counts, { hasTokens = true } = {}) {
|
|
3551
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
3552
|
+
return componentFiles > 0 || hasTokens && counts.json > 0;
|
|
3553
|
+
}
|
|
3554
|
+
function phaseOf(scan, { hasTokens = true } = {}) {
|
|
3687
3555
|
if (scan === void 0) return "scanning";
|
|
3688
|
-
|
|
3556
|
+
if (!scan.ok) return "failed";
|
|
3557
|
+
return hasImportableFiles(scan.counts, { hasTokens }) ? "ready" : "empty";
|
|
3689
3558
|
}
|
|
3690
3559
|
function keyAction(phase, input, key) {
|
|
3691
3560
|
if (key.escape) return "back";
|
|
@@ -3693,7 +3562,7 @@ function keyAction(phase, input, key) {
|
|
|
3693
3562
|
if (key.return) return "confirm";
|
|
3694
3563
|
if (input === "e") return "change-path";
|
|
3695
3564
|
}
|
|
3696
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
3565
|
+
if ((phase === "failed" || phase === "empty") && (key.return || input === "e")) return "change-path";
|
|
3697
3566
|
return void 0;
|
|
3698
3567
|
}
|
|
3699
3568
|
|
|
@@ -3705,6 +3574,10 @@ var CONTROLS = {
|
|
|
3705
3574
|
{ keys: "e", label: "Change path" },
|
|
3706
3575
|
{ keys: "Esc", label: "Back" }
|
|
3707
3576
|
],
|
|
3577
|
+
empty: [
|
|
3578
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
3579
|
+
{ keys: "Esc", label: "Back" }
|
|
3580
|
+
],
|
|
3708
3581
|
failed: [
|
|
3709
3582
|
{ keys: "Enter/e", label: "Try a different path" },
|
|
3710
3583
|
{ keys: "Esc", label: "Back" }
|
|
@@ -3725,16 +3598,16 @@ function usePathValidationControls(phase, handlers) {
|
|
|
3725
3598
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3726
3599
|
import { DatabaseSync } from "node:sqlite";
|
|
3727
3600
|
import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
3728
|
-
import { readFile as
|
|
3601
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
3729
3602
|
import { createHash as createHash5 } from "node:crypto";
|
|
3730
3603
|
|
|
3731
3604
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
3732
3605
|
import { homedir as homedir3 } from "node:os";
|
|
3733
|
-
import { dirname as dirname4, join as
|
|
3606
|
+
import { dirname as dirname4, join as join6 } from "node:path";
|
|
3734
3607
|
function configRoot2() {
|
|
3735
|
-
return process.env["EDS_HOME"] ||
|
|
3608
|
+
return process.env["EDS_HOME"] || join6(homedir3(), ".contentful", "experience-design-system-cli");
|
|
3736
3609
|
}
|
|
3737
|
-
var runsFilePath = () =>
|
|
3610
|
+
var runsFilePath = () => join6(configRoot2(), "state", "runs.json");
|
|
3738
3611
|
|
|
3739
3612
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3740
3613
|
import { dirname as dirname6, resolve as resolve7 } from "node:path";
|
|
@@ -5188,7 +5061,7 @@ async function resolveRelativeImport(specifier, fromDir) {
|
|
|
5188
5061
|
];
|
|
5189
5062
|
for (const candidate of candidates) {
|
|
5190
5063
|
try {
|
|
5191
|
-
await
|
|
5064
|
+
await readFile5(candidate, "utf8");
|
|
5192
5065
|
return candidate;
|
|
5193
5066
|
} catch {
|
|
5194
5067
|
}
|
|
@@ -5222,7 +5095,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
5222
5095
|
break;
|
|
5223
5096
|
let content;
|
|
5224
5097
|
try {
|
|
5225
|
-
content = await
|
|
5098
|
+
content = await readFile5(resolvedPath, "utf8");
|
|
5226
5099
|
} catch {
|
|
5227
5100
|
continue;
|
|
5228
5101
|
}
|
|
@@ -5261,7 +5134,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
|
|
|
5261
5134
|
let truncatedSiblingCount = 0;
|
|
5262
5135
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
5263
5136
|
try {
|
|
5264
|
-
const rawText = await
|
|
5137
|
+
const rawText = await readFile5(sourcePath, "utf8");
|
|
5265
5138
|
let siblingUsesNotShown;
|
|
5266
5139
|
let declaredTypeNames;
|
|
5267
5140
|
({
|
|
@@ -6023,7 +5896,7 @@ import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "t
|
|
|
6023
5896
|
|
|
6024
5897
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
6025
5898
|
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
|
|
6026
|
-
import { dirname as dirname7, join as
|
|
5899
|
+
import { dirname as dirname7, join as join8, resolve as resolve8 } from "node:path";
|
|
6027
5900
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
6028
5901
|
import ts from "typescript";
|
|
6029
5902
|
var packageRootByFilePathCache = /* @__PURE__ */ new Map();
|
|
@@ -6226,7 +6099,7 @@ function findNearestTsConfigPath(filePath) {
|
|
|
6226
6099
|
let currentDir = dirname7(filePath);
|
|
6227
6100
|
while (true) {
|
|
6228
6101
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
6229
|
-
const candidatePath =
|
|
6102
|
+
const candidatePath = join8(currentDir, candidateName);
|
|
6230
6103
|
if (existsSync4(candidatePath)) {
|
|
6231
6104
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
6232
6105
|
return candidatePath;
|
|
@@ -6283,10 +6156,10 @@ function resolveImportSourcePath(basePath) {
|
|
|
6283
6156
|
`${basePath}.tsx`,
|
|
6284
6157
|
`${basePath}.js`,
|
|
6285
6158
|
`${basePath}.jsx`,
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6159
|
+
join8(basePath, "index.ts"),
|
|
6160
|
+
join8(basePath, "index.tsx"),
|
|
6161
|
+
join8(basePath, "index.js"),
|
|
6162
|
+
join8(basePath, "index.jsx")
|
|
6290
6163
|
];
|
|
6291
6164
|
return candidates.find((candidatePath) => existsSync4(candidatePath));
|
|
6292
6165
|
}
|
|
@@ -6297,10 +6170,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
6297
6170
|
`${resolvedPath}.tsx`,
|
|
6298
6171
|
`${resolvedPath}.js`,
|
|
6299
6172
|
`${resolvedPath}.jsx`,
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6173
|
+
join8(resolvedPath, "index.ts"),
|
|
6174
|
+
join8(resolvedPath, "index.tsx"),
|
|
6175
|
+
join8(resolvedPath, "index.js"),
|
|
6176
|
+
join8(resolvedPath, "index.jsx")
|
|
6304
6177
|
];
|
|
6305
6178
|
for (const candidatePath of candidatePaths) {
|
|
6306
6179
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -6321,10 +6194,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6321
6194
|
if (!packageRootDir)
|
|
6322
6195
|
return void 0;
|
|
6323
6196
|
const preferredEntryPaths = [
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6197
|
+
join8(packageRootDir, "src/index.ts"),
|
|
6198
|
+
join8(packageRootDir, "src/index.tsx"),
|
|
6199
|
+
join8(packageRootDir, "index.ts"),
|
|
6200
|
+
join8(packageRootDir, "index.tsx")
|
|
6328
6201
|
];
|
|
6329
6202
|
for (const entryPath of preferredEntryPaths) {
|
|
6330
6203
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -6332,7 +6205,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
6332
6205
|
return entrySourceFile;
|
|
6333
6206
|
}
|
|
6334
6207
|
}
|
|
6335
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
6208
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join8(packageRootDir, "src"));
|
|
6336
6209
|
}
|
|
6337
6210
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
6338
6211
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -6341,7 +6214,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
6341
6214
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
6342
6215
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
6343
6216
|
}
|
|
6344
|
-
const packageJsonPath =
|
|
6217
|
+
const packageJsonPath = join8(packageRootDir, "package.json");
|
|
6345
6218
|
try {
|
|
6346
6219
|
const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
|
|
6347
6220
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
@@ -6358,7 +6231,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6358
6231
|
}
|
|
6359
6232
|
let currentDir = dirname7(filePath);
|
|
6360
6233
|
while (true) {
|
|
6361
|
-
if (existsSync4(
|
|
6234
|
+
if (existsSync4(join8(currentDir, "package.json"))) {
|
|
6362
6235
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
6363
6236
|
return currentDir;
|
|
6364
6237
|
}
|
|
@@ -6372,7 +6245,7 @@ function findNearestPackageRootDir(filePath) {
|
|
|
6372
6245
|
}
|
|
6373
6246
|
|
|
6374
6247
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
|
|
6375
|
-
import { readFile as
|
|
6248
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
6376
6249
|
async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
|
|
6377
6250
|
const warnings = [];
|
|
6378
6251
|
const items = [];
|
|
@@ -6384,7 +6257,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
|
|
|
6384
6257
|
if (!filePath)
|
|
6385
6258
|
break;
|
|
6386
6259
|
try {
|
|
6387
|
-
const source = await
|
|
6260
|
+
const source = await readFile6(filePath, "utf-8");
|
|
6388
6261
|
const outcome = await extractFile(filePath, source);
|
|
6389
6262
|
warnings.push(...outcome.warnings ?? []);
|
|
6390
6263
|
if (outcome.item)
|
|
@@ -9359,15 +9232,15 @@ function extractVueSlotsFromSetup(options) {
|
|
|
9359
9232
|
|
|
9360
9233
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
9361
9234
|
import os from "node:os";
|
|
9362
|
-
import { basename
|
|
9363
|
-
import { readFile as
|
|
9235
|
+
import { basename, dirname as dirname9, resolve as resolve10, join as join10 } from "node:path";
|
|
9236
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
9364
9237
|
import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
|
|
9365
9238
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
9366
9239
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
9367
9240
|
|
|
9368
9241
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
|
|
9369
9242
|
import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
|
|
9370
|
-
import { dirname as dirname8, join as
|
|
9243
|
+
import { dirname as dirname8, join as join9, resolve as resolve9 } from "node:path";
|
|
9371
9244
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
9372
9245
|
const basePath = resolve9(dirname8(importingFilePath), specifier);
|
|
9373
9246
|
const candidates = [
|
|
@@ -9376,10 +9249,10 @@ function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
|
9376
9249
|
`${basePath}.ts`,
|
|
9377
9250
|
`${basePath}.mjs`,
|
|
9378
9251
|
`${basePath}.cjs`,
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9252
|
+
join9(basePath, "index.js"),
|
|
9253
|
+
join9(basePath, "index.ts"),
|
|
9254
|
+
join9(basePath, "index.mjs"),
|
|
9255
|
+
join9(basePath, "index.cjs")
|
|
9383
9256
|
];
|
|
9384
9257
|
for (const candidate of candidates) {
|
|
9385
9258
|
if (existsSync5(candidate) && statSync2(candidate).isFile())
|
|
@@ -9454,11 +9327,11 @@ async function extractFromVueSFC(filePath, source) {
|
|
|
9454
9327
|
};
|
|
9455
9328
|
}
|
|
9456
9329
|
function getVueComponentName(filePath) {
|
|
9457
|
-
const fileName =
|
|
9330
|
+
const fileName = basename(filePath, ".vue");
|
|
9458
9331
|
if (fileName !== "index") {
|
|
9459
9332
|
return fileName;
|
|
9460
9333
|
}
|
|
9461
|
-
const parentDirName =
|
|
9334
|
+
const parentDirName = basename(dirname9(filePath));
|
|
9462
9335
|
return parentDirName || fileName;
|
|
9463
9336
|
}
|
|
9464
9337
|
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
@@ -9602,7 +9475,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
|
|
|
9602
9475
|
if (visitedImports.has(visitKey))
|
|
9603
9476
|
return [];
|
|
9604
9477
|
visitedImports.add(visitKey);
|
|
9605
|
-
const source = await
|
|
9478
|
+
const source = await readFile7(importedRef.filePath, "utf-8");
|
|
9606
9479
|
const project = new Project3({
|
|
9607
9480
|
compilerOptions: {
|
|
9608
9481
|
strict: false,
|
|
@@ -9630,11 +9503,11 @@ function findWorkspaceRoot(startDir) {
|
|
|
9630
9503
|
return workspaceRootCache.get(startDir);
|
|
9631
9504
|
let dir = startDir;
|
|
9632
9505
|
while (true) {
|
|
9633
|
-
const pkgJsonPath =
|
|
9506
|
+
const pkgJsonPath = join10(dir, "package.json");
|
|
9634
9507
|
if (existsSync6(pkgJsonPath)) {
|
|
9635
9508
|
try {
|
|
9636
9509
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9637
|
-
if (pkg.workspaces || existsSync6(
|
|
9510
|
+
if (pkg.workspaces || existsSync6(join10(dir, "pnpm-workspace.yaml"))) {
|
|
9638
9511
|
workspaceRootCache.set(startDir, dir);
|
|
9639
9512
|
return dir;
|
|
9640
9513
|
}
|
|
@@ -9655,7 +9528,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9655
9528
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
9656
9529
|
}
|
|
9657
9530
|
const packageMap = /* @__PURE__ */ new Map();
|
|
9658
|
-
const packagesDir =
|
|
9531
|
+
const packagesDir = join10(workspaceRoot, "packages");
|
|
9659
9532
|
if (!existsSync6(packagesDir)) {
|
|
9660
9533
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
9661
9534
|
return packageMap;
|
|
@@ -9669,7 +9542,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9669
9542
|
} catch {
|
|
9670
9543
|
return;
|
|
9671
9544
|
}
|
|
9672
|
-
const pkgJsonPath =
|
|
9545
|
+
const pkgJsonPath = join10(dir, "package.json");
|
|
9673
9546
|
if (existsSync6(pkgJsonPath)) {
|
|
9674
9547
|
try {
|
|
9675
9548
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
@@ -9682,10 +9555,10 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
9682
9555
|
for (const entry of entries) {
|
|
9683
9556
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
9684
9557
|
continue;
|
|
9685
|
-
const entryPath =
|
|
9558
|
+
const entryPath = join10(dir, entry);
|
|
9686
9559
|
try {
|
|
9687
|
-
const
|
|
9688
|
-
if (
|
|
9560
|
+
const stat5 = statSync3(entryPath);
|
|
9561
|
+
if (stat5.isDirectory()) {
|
|
9689
9562
|
scanDir(entryPath, depth + 1);
|
|
9690
9563
|
}
|
|
9691
9564
|
} catch {
|
|
@@ -9722,7 +9595,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9722
9595
|
const packageDir = packageDirs.get(packageName);
|
|
9723
9596
|
if (!packageDir)
|
|
9724
9597
|
return null;
|
|
9725
|
-
const pkgJsonPath =
|
|
9598
|
+
const pkgJsonPath = join10(packageDir, "package.json");
|
|
9726
9599
|
try {
|
|
9727
9600
|
const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
|
|
9728
9601
|
if (pkg.exports && subpath !== ".") {
|
|
@@ -9735,8 +9608,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
9735
9608
|
}
|
|
9736
9609
|
if (subpath !== ".") {
|
|
9737
9610
|
const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
|
|
9738
|
-
for (const base of [
|
|
9739
|
-
const subPkgPath =
|
|
9611
|
+
for (const base of [join10(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
9612
|
+
const subPkgPath = join10(base, "package.json");
|
|
9740
9613
|
if (existsSync6(subPkgPath)) {
|
|
9741
9614
|
try {
|
|
9742
9615
|
const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
|
|
@@ -9833,7 +9706,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
9833
9706
|
return [];
|
|
9834
9707
|
}
|
|
9835
9708
|
async function extractInheritedVueProps(filePath, visited) {
|
|
9836
|
-
const source = await
|
|
9709
|
+
const source = await readFile7(filePath, "utf-8");
|
|
9837
9710
|
const { descriptor } = parseSFC(source);
|
|
9838
9711
|
if (!descriptor.script) {
|
|
9839
9712
|
return [];
|
|
@@ -9951,7 +9824,7 @@ function mergeSlotsDedup(base, extra) {
|
|
|
9951
9824
|
|
|
9952
9825
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/astro/extract-astro-components.js
|
|
9953
9826
|
import os2 from "node:os";
|
|
9954
|
-
import { basename as
|
|
9827
|
+
import { basename as basename2 } from "node:path";
|
|
9955
9828
|
import { Project as Project4, Node as Node7 } from "ts-morph";
|
|
9956
9829
|
function extractAllowedValues3(typeText) {
|
|
9957
9830
|
const parts = typeText.split("|").map((p) => p.trim());
|
|
@@ -10130,7 +10003,7 @@ function mergeSlots(...slotGroups) {
|
|
|
10130
10003
|
return merged;
|
|
10131
10004
|
}
|
|
10132
10005
|
function extractFromAstroFile(filePath, source) {
|
|
10133
|
-
const name =
|
|
10006
|
+
const name = basename2(filePath, ".astro");
|
|
10134
10007
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
10135
10008
|
let frontmatter = "";
|
|
10136
10009
|
let template = source;
|
|
@@ -10166,7 +10039,7 @@ async function extractAstroComponents(filePaths, onProgress) {
|
|
|
10166
10039
|
}
|
|
10167
10040
|
|
|
10168
10041
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
10169
|
-
import { basename as
|
|
10042
|
+
import { basename as basename3, dirname as dirname10, join as join11, resolve as resolve11 } from "node:path";
|
|
10170
10043
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
10171
10044
|
function normalizeComponentName(input) {
|
|
10172
10045
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -10333,7 +10206,7 @@ function shouldPreferTagName(className, tagName) {
|
|
|
10333
10206
|
return false;
|
|
10334
10207
|
}
|
|
10335
10208
|
function getFileDerivedComponentName(sourceFile) {
|
|
10336
|
-
const baseName =
|
|
10209
|
+
const baseName = basename3(sourceFile.getFilePath()).replace(/\.[^.]+$/, "").replace(/\.component$/, "");
|
|
10337
10210
|
return kebabToPascal(baseName);
|
|
10338
10211
|
}
|
|
10339
10212
|
function chooseComponentName(classDecl, className, tagName) {
|
|
@@ -10821,14 +10694,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
10821
10694
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
10822
10695
|
return null;
|
|
10823
10696
|
}
|
|
10824
|
-
const packagesMarker = `${
|
|
10697
|
+
const packagesMarker = `${join11("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
10825
10698
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
10826
10699
|
if (markerIndex === -1) {
|
|
10827
10700
|
return null;
|
|
10828
10701
|
}
|
|
10829
10702
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
10830
10703
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
10831
|
-
return
|
|
10704
|
+
return join11(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
10832
10705
|
}
|
|
10833
10706
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
10834
10707
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -10981,7 +10854,7 @@ async function extractWebComponentDefinitions(filePaths) {
|
|
|
10981
10854
|
|
|
10982
10855
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
10983
10856
|
import os3 from "node:os";
|
|
10984
|
-
import { basename as
|
|
10857
|
+
import { basename as basename4, dirname as dirname11, resolve as resolve12, join as join12 } from "node:path";
|
|
10985
10858
|
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
10986
10859
|
import { createRequire } from "node:module";
|
|
10987
10860
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
@@ -11215,7 +11088,7 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
11215
11088
|
function findNearestTsconfig(startDir) {
|
|
11216
11089
|
let dir = startDir;
|
|
11217
11090
|
for (let i = 0; i < 16; i++) {
|
|
11218
|
-
const candidate =
|
|
11091
|
+
const candidate = join12(dir, "tsconfig.json");
|
|
11219
11092
|
if (existsSync7(candidate))
|
|
11220
11093
|
return candidate;
|
|
11221
11094
|
const parent = dirname11(dir);
|
|
@@ -11351,7 +11224,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11351
11224
|
const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
|
|
11352
11225
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
11353
11226
|
if (pkgRoot) {
|
|
11354
|
-
const pkgJsonPath =
|
|
11227
|
+
const pkgJsonPath = join12(pkgRoot, "package.json");
|
|
11355
11228
|
if (existsSync7(pkgJsonPath)) {
|
|
11356
11229
|
try {
|
|
11357
11230
|
const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
|
|
@@ -11372,7 +11245,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11372
11245
|
}
|
|
11373
11246
|
}
|
|
11374
11247
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
11375
|
-
const candidate =
|
|
11248
|
+
const candidate = join12(pkgRoot, entry);
|
|
11376
11249
|
if (existsSync7(candidate))
|
|
11377
11250
|
return candidate;
|
|
11378
11251
|
}
|
|
@@ -11390,9 +11263,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
11390
11263
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
11391
11264
|
let dir = seedDir;
|
|
11392
11265
|
for (let i = 0; i < 32; i++) {
|
|
11393
|
-
if (existsSync7(
|
|
11266
|
+
if (existsSync7(join12(dir, "package.json"))) {
|
|
11394
11267
|
try {
|
|
11395
|
-
const pkgRaw = readFileSync6(
|
|
11268
|
+
const pkgRaw = readFileSync6(join12(dir, "package.json"), "utf-8");
|
|
11396
11269
|
const pkg = JSON.parse(pkgRaw);
|
|
11397
11270
|
if (pkg.name === specifier)
|
|
11398
11271
|
return dir;
|
|
@@ -11532,12 +11405,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
11532
11405
|
}
|
|
11533
11406
|
var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
|
|
11534
11407
|
function getSvelteComponentName(filePath) {
|
|
11535
|
-
const file =
|
|
11536
|
-
const parentDir =
|
|
11408
|
+
const file = basename4(filePath, ".svelte");
|
|
11409
|
+
const parentDir = basename4(dirname11(filePath));
|
|
11537
11410
|
if (file === "index")
|
|
11538
11411
|
return toPascalCase(parentDir);
|
|
11539
11412
|
if (ANATOMY_FOLDERS.has(parentDir)) {
|
|
11540
|
-
const grandparent =
|
|
11413
|
+
const grandparent = basename4(dirname11(dirname11(filePath)));
|
|
11541
11414
|
if (grandparent && grandparent !== "." && grandparent !== "/") {
|
|
11542
11415
|
return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
|
|
11543
11416
|
}
|
|
@@ -12352,7 +12225,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
|
|
|
12352
12225
|
}
|
|
12353
12226
|
|
|
12354
12227
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
|
|
12355
|
-
import { readFile as
|
|
12228
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
12356
12229
|
import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
|
|
12357
12230
|
|
|
12358
12231
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
|
|
@@ -12758,14 +12631,14 @@ function countLines(text, offset) {
|
|
|
12758
12631
|
}
|
|
12759
12632
|
|
|
12760
12633
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
|
|
12761
|
-
import { readFile as
|
|
12634
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
12762
12635
|
async function resolveTemplateSource(meta) {
|
|
12763
12636
|
if (meta.inlineTemplate !== null)
|
|
12764
12637
|
return meta.inlineTemplate;
|
|
12765
12638
|
if (meta.templatePath === null)
|
|
12766
12639
|
return null;
|
|
12767
12640
|
try {
|
|
12768
|
-
return await
|
|
12641
|
+
return await readFile8(meta.templatePath, "utf8");
|
|
12769
12642
|
} catch {
|
|
12770
12643
|
return null;
|
|
12771
12644
|
}
|
|
@@ -12955,7 +12828,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
|
|
|
12955
12828
|
});
|
|
12956
12829
|
for (const filePath of filePaths) {
|
|
12957
12830
|
try {
|
|
12958
|
-
const source = await
|
|
12831
|
+
const source = await readFile9(filePath, "utf8");
|
|
12959
12832
|
const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
|
|
12960
12833
|
for (const cls of sourceFile.getClasses()) {
|
|
12961
12834
|
if (!hasComponentDecorator(cls))
|
|
@@ -13091,11 +12964,11 @@ function getPathPreferenceScore(filePath) {
|
|
|
13091
12964
|
const normalized = filePath.replace(/\\/g, "/");
|
|
13092
12965
|
const segments = normalized.split("/").filter(Boolean);
|
|
13093
12966
|
const filename = segments.at(-1) ?? "";
|
|
13094
|
-
const
|
|
12967
|
+
const basename7 = filename.replace(/\.[^.]+$/, "");
|
|
13095
12968
|
let score = 0;
|
|
13096
12969
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
13097
12970
|
score += 100;
|
|
13098
|
-
if (
|
|
12971
|
+
if (basename7 && segments.at(-2) === basename7)
|
|
13099
12972
|
score -= 10;
|
|
13100
12973
|
const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
|
|
13101
12974
|
score -= componentsSegmentCount * 8;
|
|
@@ -13544,15 +13417,15 @@ function applyCompositionEdges(components, edges) {
|
|
|
13544
13417
|
|
|
13545
13418
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
13546
13419
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
13547
|
-
import { dirname as dirname13, join as
|
|
13420
|
+
import { dirname as dirname13, join as join13, resolve as resolve14 } from "node:path";
|
|
13548
13421
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
13549
13422
|
function resolvePromptPath(fileName) {
|
|
13550
13423
|
const thisDir = dirname13(fileURLToPath3(import.meta.url));
|
|
13551
13424
|
let dir = thisDir;
|
|
13552
13425
|
for (; ; ) {
|
|
13553
|
-
const candidate =
|
|
13426
|
+
const candidate = join13(dir, "prompts");
|
|
13554
13427
|
if (existsSync8(candidate))
|
|
13555
|
-
return
|
|
13428
|
+
return join13(candidate, fileName);
|
|
13556
13429
|
const parent = resolve14(dir, "..");
|
|
13557
13430
|
if (parent === dir) {
|
|
13558
13431
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
@@ -14179,10 +14052,10 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
|
|
|
14179
14052
|
}
|
|
14180
14053
|
|
|
14181
14054
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
14182
|
-
import { access as access3, readFile as
|
|
14055
|
+
import { access as access3, readFile as readFile11 } from "node:fs/promises";
|
|
14183
14056
|
|
|
14184
14057
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
|
|
14185
|
-
import { access as access2, mkdir as mkdir3, readFile as
|
|
14058
|
+
import { access as access2, mkdir as mkdir3, readFile as readFile10, writeFile as writeFile3 } from "node:fs/promises";
|
|
14186
14059
|
|
|
14187
14060
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
14188
14061
|
import { resolve as resolve17 } from "node:path";
|
|
@@ -14201,11 +14074,11 @@ async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
|
|
|
14201
14074
|
await mkdir3(paths.sessionDir, { recursive: true });
|
|
14202
14075
|
try {
|
|
14203
14076
|
await access2(paths.statePath);
|
|
14204
|
-
const savedState = await
|
|
14077
|
+
const savedState = await readFile10(paths.statePath, "utf8");
|
|
14205
14078
|
return JSON.parse(savedState);
|
|
14206
14079
|
} catch {
|
|
14207
|
-
await
|
|
14208
|
-
await
|
|
14080
|
+
await writeFile3(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
|
|
14081
|
+
await writeFile3(paths.eventsPath, "", "utf8");
|
|
14209
14082
|
return initialSnapshot;
|
|
14210
14083
|
}
|
|
14211
14084
|
}
|
|
@@ -14220,9 +14093,9 @@ function getRefineArtifactsRoot() {
|
|
|
14220
14093
|
}
|
|
14221
14094
|
|
|
14222
14095
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
|
|
14223
|
-
import { writeFile as
|
|
14096
|
+
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
14224
14097
|
async function saveReviewState(statePath, session) {
|
|
14225
|
-
await
|
|
14098
|
+
await writeFile4(statePath, JSON.stringify(session, null, 2), "utf8");
|
|
14226
14099
|
}
|
|
14227
14100
|
|
|
14228
14101
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
|
|
@@ -14232,7 +14105,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14232
14105
|
let snapshot;
|
|
14233
14106
|
try {
|
|
14234
14107
|
await access3(paths.statePath);
|
|
14235
|
-
snapshot = JSON.parse(await
|
|
14108
|
+
snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
|
|
14236
14109
|
} catch {
|
|
14237
14110
|
snapshot = await loadAndValidateForReview(sessionId, void 0);
|
|
14238
14111
|
snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
|
|
@@ -14270,7 +14143,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
|
|
|
14270
14143
|
}
|
|
14271
14144
|
|
|
14272
14145
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
|
|
14273
|
-
import { readFile as
|
|
14146
|
+
import { readFile as readFile12 } from "node:fs/promises";
|
|
14274
14147
|
async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
14275
14148
|
if (names.length === 0)
|
|
14276
14149
|
return;
|
|
@@ -14286,7 +14159,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
|
|
|
14286
14159
|
const nameSet = new Set(names);
|
|
14287
14160
|
let snapshot;
|
|
14288
14161
|
try {
|
|
14289
|
-
snapshot = JSON.parse(await
|
|
14162
|
+
snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
|
|
14290
14163
|
} catch {
|
|
14291
14164
|
return;
|
|
14292
14165
|
}
|
|
@@ -14485,15 +14358,15 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
14485
14358
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
14486
14359
|
function collectFiles(root, options = {}) {
|
|
14487
14360
|
const resolved = path4.resolve(root);
|
|
14488
|
-
let
|
|
14361
|
+
let stat5;
|
|
14489
14362
|
try {
|
|
14490
|
-
|
|
14363
|
+
stat5 = statSync5(resolved);
|
|
14491
14364
|
} catch (err) {
|
|
14492
14365
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
14493
14366
|
}
|
|
14494
|
-
if (
|
|
14367
|
+
if (stat5.isFile())
|
|
14495
14368
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
14496
|
-
if (!
|
|
14369
|
+
if (!stat5.isDirectory())
|
|
14497
14370
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
14498
14371
|
const result = {
|
|
14499
14372
|
filePaths: [],
|
|
@@ -14543,7 +14416,7 @@ function generateUlid(now = Date.now()) {
|
|
|
14543
14416
|
}
|
|
14544
14417
|
|
|
14545
14418
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14546
|
-
import { readFile as
|
|
14419
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
14547
14420
|
|
|
14548
14421
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
|
|
14549
14422
|
function migrateRecord(rec) {
|
|
@@ -14562,7 +14435,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
|
|
|
14562
14435
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
|
|
14563
14436
|
async function readRunsFileMaybe() {
|
|
14564
14437
|
try {
|
|
14565
|
-
const raw = await
|
|
14438
|
+
const raw = await readFile13(runsFilePath(), "utf8");
|
|
14566
14439
|
const parsed = JSON.parse(raw);
|
|
14567
14440
|
if (!READABLE_VERSIONS.has(parsed.version)) {
|
|
14568
14441
|
throw new Error(`runs.json version mismatch: file is v${parsed.version}, this CLI expects v${RUNS_FILE_VERSION} (also reads: ${[...READABLE_VERSIONS].join(", ")}). Back up and remove the file to start fresh.`);
|
|
@@ -14578,13 +14451,13 @@ async function readRunsFileMaybe() {
|
|
|
14578
14451
|
}
|
|
14579
14452
|
|
|
14580
14453
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
14581
|
-
import { mkdir as mkdir4, rename as rename2, writeFile as
|
|
14454
|
+
import { mkdir as mkdir4, rename as rename2, writeFile as writeFile5 } from "node:fs/promises";
|
|
14582
14455
|
import { dirname as dirname15 } from "node:path";
|
|
14583
14456
|
async function writeRunsFileAtomic(file) {
|
|
14584
14457
|
await mkdir4(dirname15(runsFilePath()), { recursive: true });
|
|
14585
14458
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
14586
14459
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
14587
|
-
await
|
|
14460
|
+
await writeFile5(tmp, body, { mode: 384 });
|
|
14588
14461
|
await rename2(tmp, runsFilePath());
|
|
14589
14462
|
}
|
|
14590
14463
|
|
|
@@ -14621,7 +14494,7 @@ async function updateRun(id, patch) {
|
|
|
14621
14494
|
}
|
|
14622
14495
|
|
|
14623
14496
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
14624
|
-
import { readFile as
|
|
14497
|
+
import { readFile as readFile14, stat as stat2 } from "node:fs/promises";
|
|
14625
14498
|
import { resolve as resolve19 } from "node:path";
|
|
14626
14499
|
|
|
14627
14500
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
|
|
@@ -14649,7 +14522,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14649
14522
|
continue;
|
|
14650
14523
|
seen.add(abs);
|
|
14651
14524
|
try {
|
|
14652
|
-
const st = await
|
|
14525
|
+
const st = await stat2(abs);
|
|
14653
14526
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14654
14527
|
if (name)
|
|
14655
14528
|
entry.componentName = name;
|
|
@@ -14664,7 +14537,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14664
14537
|
const abs = resolve19(opts.rawTokensPath);
|
|
14665
14538
|
rawTokensPath = abs;
|
|
14666
14539
|
try {
|
|
14667
|
-
const [st, buf] = await Promise.all([
|
|
14540
|
+
const [st, buf] = await Promise.all([stat2(abs), readFile14(abs)]);
|
|
14668
14541
|
rawTokensMtime = st.mtime.toISOString();
|
|
14669
14542
|
rawTokensContentHash = sha256Hex(buf);
|
|
14670
14543
|
} catch {
|
|
@@ -14675,7 +14548,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14675
14548
|
|
|
14676
14549
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
14677
14550
|
import { access as access4 } from "node:fs/promises";
|
|
14678
|
-
import { join as
|
|
14551
|
+
import { join as join14 } from "node:path";
|
|
14679
14552
|
|
|
14680
14553
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
|
|
14681
14554
|
var SAVE_FILES = ["components.json", "tokens.json"];
|
|
@@ -14685,7 +14558,7 @@ async function listConflictingFiles(path5) {
|
|
|
14685
14558
|
const conflicts = [];
|
|
14686
14559
|
for (const name of SAVE_FILES) {
|
|
14687
14560
|
try {
|
|
14688
|
-
await access4(
|
|
14561
|
+
await access4(join14(path5, name));
|
|
14689
14562
|
conflicts.push(name);
|
|
14690
14563
|
} catch {
|
|
14691
14564
|
}
|
|
@@ -14699,7 +14572,7 @@ async function detectSaveConflict(path5) {
|
|
|
14699
14572
|
}
|
|
14700
14573
|
|
|
14701
14574
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
|
|
14702
|
-
import { join as
|
|
14575
|
+
import { join as join15 } from "node:path";
|
|
14703
14576
|
function pad2(n) {
|
|
14704
14577
|
return n < 10 ? `0${n}` : String(n);
|
|
14705
14578
|
}
|
|
@@ -14710,7 +14583,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
14710
14583
|
const hh = pad2(now.getHours());
|
|
14711
14584
|
const mm = pad2(now.getMinutes());
|
|
14712
14585
|
const ss = pad2(now.getSeconds());
|
|
14713
|
-
return
|
|
14586
|
+
return join15(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
14714
14587
|
}
|
|
14715
14588
|
|
|
14716
14589
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
|
|
@@ -14746,12 +14619,12 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
|
|
|
14746
14619
|
}
|
|
14747
14620
|
|
|
14748
14621
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
|
|
14749
|
-
import { readFile as
|
|
14622
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
14750
14623
|
async function loadAcceptedNames(sessionId) {
|
|
14751
14624
|
try {
|
|
14752
14625
|
const artifactsRoot = getRefineArtifactsRoot();
|
|
14753
14626
|
const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
|
|
14754
|
-
const raw = await
|
|
14627
|
+
const raw = await readFile15(paths.statePath, "utf8");
|
|
14755
14628
|
const snapshot = JSON.parse(raw);
|
|
14756
14629
|
const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
|
|
14757
14630
|
if (accepted.length === 0)
|
|
@@ -16077,11 +15950,11 @@ function formatApiError2(request) {
|
|
|
16077
15950
|
|
|
16078
15951
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
16079
15952
|
init_shared();
|
|
16080
|
-
import { readFile as
|
|
15953
|
+
import { readFile as readFile16, stat as stat4 } from "node:fs/promises";
|
|
16081
15954
|
|
|
16082
15955
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
16083
|
-
import { readdir as
|
|
16084
|
-
import { join as
|
|
15956
|
+
import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
|
|
15957
|
+
import { join as join16 } from "node:path";
|
|
16085
15958
|
var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
|
|
16086
15959
|
async function collectJsonFiles(dir) {
|
|
16087
15960
|
const results = [];
|
|
@@ -16091,17 +15964,17 @@ async function collectJsonFiles(dir) {
|
|
|
16091
15964
|
async function walk(current, results) {
|
|
16092
15965
|
let entries;
|
|
16093
15966
|
try {
|
|
16094
|
-
entries = await
|
|
15967
|
+
entries = await readdir2(current);
|
|
16095
15968
|
} catch {
|
|
16096
15969
|
return;
|
|
16097
15970
|
}
|
|
16098
15971
|
await Promise.all(entries.map(async (entry) => {
|
|
16099
15972
|
if (IGNORE_TOKEN_DIRS.has(entry))
|
|
16100
15973
|
return;
|
|
16101
|
-
const full =
|
|
15974
|
+
const full = join16(current, entry);
|
|
16102
15975
|
let s;
|
|
16103
15976
|
try {
|
|
16104
|
-
s = await
|
|
15977
|
+
s = await stat3(full);
|
|
16105
15978
|
} catch {
|
|
16106
15979
|
return;
|
|
16107
15980
|
}
|
|
@@ -16117,7 +15990,7 @@ async function walk(current, results) {
|
|
|
16117
15990
|
async function readTokensFromPath(flag, p) {
|
|
16118
15991
|
let s;
|
|
16119
15992
|
try {
|
|
16120
|
-
s = await
|
|
15993
|
+
s = await stat4(p);
|
|
16121
15994
|
} catch {
|
|
16122
15995
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16123
15996
|
}
|
|
@@ -16136,7 +16009,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16136
16009
|
const merged = {};
|
|
16137
16010
|
for (const file of files.sort()) {
|
|
16138
16011
|
try {
|
|
16139
|
-
const text = await
|
|
16012
|
+
const text = await readFile16(file, "utf8");
|
|
16140
16013
|
const parsed = JSON.parse(text);
|
|
16141
16014
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
16142
16015
|
Object.assign(merged, parsed);
|
|
@@ -16150,7 +16023,7 @@ async function readMergedFromDir(flag, dir) {
|
|
|
16150
16023
|
async function readSingleFile(flag, p) {
|
|
16151
16024
|
let text;
|
|
16152
16025
|
try {
|
|
16153
|
-
text = await
|
|
16026
|
+
text = await readFile16(p, "utf8");
|
|
16154
16027
|
} catch {
|
|
16155
16028
|
throw new Error(`file not found: ${p} (from ${flag})`);
|
|
16156
16029
|
}
|
|
@@ -16195,8 +16068,8 @@ function buildContentfulManagementClient(request) {
|
|
|
16195
16068
|
}
|
|
16196
16069
|
|
|
16197
16070
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
|
|
16198
|
-
import { writeFile as
|
|
16199
|
-
import { join as
|
|
16071
|
+
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
16072
|
+
import { join as join17 } from "node:path";
|
|
16200
16073
|
|
|
16201
16074
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
|
|
16202
16075
|
import { fetchAll } from "contentful-management";
|
|
@@ -16228,8 +16101,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16228
16101
|
spaceId: request.spaceId,
|
|
16229
16102
|
environmentId: request.environmentId
|
|
16230
16103
|
});
|
|
16231
|
-
const path5 =
|
|
16232
|
-
await
|
|
16104
|
+
const path5 = join17(request.outDir, ".existing-entities.json");
|
|
16105
|
+
await writeFile6(path5, JSON.stringify(entities, null, 2), "utf8");
|
|
16233
16106
|
return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
|
|
16234
16107
|
} catch (error) {
|
|
16235
16108
|
return {
|
|
@@ -16241,12 +16114,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
16241
16114
|
}
|
|
16242
16115
|
|
|
16243
16116
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
|
|
16244
|
-
import { readFile as
|
|
16117
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
16245
16118
|
async function readExistingContentfulEntitiesFromSession(request) {
|
|
16246
16119
|
if (!request.path)
|
|
16247
16120
|
return void 0;
|
|
16248
16121
|
try {
|
|
16249
|
-
const raw = await
|
|
16122
|
+
const raw = await readFile17(request.path, "utf8");
|
|
16250
16123
|
const parsed = JSON.parse(raw);
|
|
16251
16124
|
if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
|
|
16252
16125
|
return void 0;
|
|
@@ -17011,7 +16884,7 @@ function hasNoAuthoringSurface(component) {
|
|
|
17011
16884
|
}
|
|
17012
16885
|
|
|
17013
16886
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
|
|
17014
|
-
import { readFile as
|
|
16887
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
17015
16888
|
|
|
17016
16889
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
|
|
17017
16890
|
var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
|
|
@@ -17113,7 +16986,7 @@ function dedupeReasons(reasons) {
|
|
|
17113
16986
|
async function inspectComponentSource(component) {
|
|
17114
16987
|
let sourceText = "";
|
|
17115
16988
|
try {
|
|
17116
|
-
sourceText = await
|
|
16989
|
+
sourceText = await readFile18(component.source, "utf8");
|
|
17117
16990
|
} catch {
|
|
17118
16991
|
return {
|
|
17119
16992
|
wrapperConfidence: 0,
|
|
@@ -17552,7 +17425,7 @@ function resolveCompositionAgentName(flagValue) {
|
|
|
17552
17425
|
}
|
|
17553
17426
|
|
|
17554
17427
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
|
|
17555
|
-
import { readFile as
|
|
17428
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
17556
17429
|
async function readCandidateFiles(components, extraFiles = []) {
|
|
17557
17430
|
const paths = new Set(extraFiles);
|
|
17558
17431
|
for (const c2 of components) {
|
|
@@ -17562,7 +17435,7 @@ async function readCandidateFiles(components, extraFiles = []) {
|
|
|
17562
17435
|
const out = [];
|
|
17563
17436
|
await Promise.all([...paths].map(async (p) => {
|
|
17564
17437
|
try {
|
|
17565
|
-
const content = await
|
|
17438
|
+
const content = await readFile19(p, "utf8");
|
|
17566
17439
|
out.push({ path: p, content });
|
|
17567
17440
|
} catch {
|
|
17568
17441
|
}
|
|
@@ -17733,15 +17606,15 @@ init_build_prompt();
|
|
|
17733
17606
|
init_create_local_cli_agent_invoker();
|
|
17734
17607
|
init_invoke_agent_with_output();
|
|
17735
17608
|
init_parse_token_tool_calls();
|
|
17736
|
-
import { readFile as
|
|
17737
|
-
import { basename as
|
|
17609
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
17610
|
+
import { basename as basename5, resolve as pathResolve } from "node:path";
|
|
17738
17611
|
init_cache_keys();
|
|
17739
17612
|
init_parse_prompt_overrides();
|
|
17740
17613
|
init_resolve_prompt_override();
|
|
17741
17614
|
|
|
17742
17615
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
17743
|
-
import { mkdir as mkdir7, writeFile as
|
|
17744
|
-
import { join as
|
|
17616
|
+
import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
|
|
17617
|
+
import { join as join18 } from "node:path";
|
|
17745
17618
|
async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
17746
17619
|
onProgress?.({ kind: "writing-file" });
|
|
17747
17620
|
const result = getDtcgTokensForSession(db, sessionId);
|
|
@@ -17749,9 +17622,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
|
17749
17622
|
throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
|
|
17750
17623
|
}
|
|
17751
17624
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
17752
|
-
const tokensPath =
|
|
17625
|
+
const tokensPath = join18(outDir, "tokens.json");
|
|
17753
17626
|
await mkdir7(outDir, { recursive: true });
|
|
17754
|
-
await
|
|
17627
|
+
await writeFile7(tokensPath, `${JSON.stringify(tree, null, 2)}
|
|
17755
17628
|
`);
|
|
17756
17629
|
return { tokensPath, tokenCount: result.tokens.length };
|
|
17757
17630
|
}
|
|
@@ -17766,7 +17639,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17766
17639
|
throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
|
|
17767
17640
|
const tokensOverride = overridesMap.get("tokens");
|
|
17768
17641
|
const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
|
|
17769
|
-
const rawTokensInline = await
|
|
17642
|
+
const rawTokensInline = await readFile20(pathResolve(rawTokensPath), "utf8");
|
|
17770
17643
|
const tokenInputHash = hashTokenContent(rawTokensInline);
|
|
17771
17644
|
const db = openPipelineDb();
|
|
17772
17645
|
try {
|
|
@@ -17794,7 +17667,7 @@ async function runGenerateTokensSession(request) {
|
|
|
17794
17667
|
skill: "tokens",
|
|
17795
17668
|
mode: "autonomous",
|
|
17796
17669
|
rawTokensInline,
|
|
17797
|
-
rawTokensFilename:
|
|
17670
|
+
rawTokensFilename: basename5(pathResolve(rawTokensPath)),
|
|
17798
17671
|
outDir: process.cwd(),
|
|
17799
17672
|
...skillContentOverride ? { skillContentOverride } : skillPath ? { skillPathOverride: skillPath } : {}
|
|
17800
17673
|
});
|
|
@@ -18246,7 +18119,8 @@ function Failure({ scan, path: path5 }) {
|
|
|
18246
18119
|
function Summary({
|
|
18247
18120
|
scan,
|
|
18248
18121
|
path: path5,
|
|
18249
|
-
hasTokens
|
|
18122
|
+
hasTokens,
|
|
18123
|
+
empty
|
|
18250
18124
|
}) {
|
|
18251
18125
|
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
18252
18126
|
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", gap: 1, children: [
|
|
@@ -18255,7 +18129,11 @@ function Summary({
|
|
|
18255
18129
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: path5 })
|
|
18256
18130
|
] }),
|
|
18257
18131
|
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
18258
|
-
/* @__PURE__ */ jsxs12(Text12, { color: PALETTE.
|
|
18132
|
+
empty ? /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.muted, children: [
|
|
18133
|
+
"Found ",
|
|
18134
|
+
total,
|
|
18135
|
+
" files:"
|
|
18136
|
+
] }) : /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.success, children: [
|
|
18259
18137
|
"\u2713 Found ",
|
|
18260
18138
|
total,
|
|
18261
18139
|
" files:"
|
|
@@ -18266,7 +18144,7 @@ function Summary({
|
|
|
18266
18144
|
"\u26A0 ",
|
|
18267
18145
|
warning
|
|
18268
18146
|
] }),
|
|
18269
|
-
/* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
18147
|
+
!empty && /* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
18270
18148
|
] });
|
|
18271
18149
|
}
|
|
18272
18150
|
function PathValidationScreen({
|
|
@@ -18278,8 +18156,8 @@ function PathValidationScreen({
|
|
|
18278
18156
|
hasTokens = true
|
|
18279
18157
|
}) {
|
|
18280
18158
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
18281
|
-
const [scan, setScan] =
|
|
18282
|
-
|
|
18159
|
+
const [scan, setScan] = useState7();
|
|
18160
|
+
useEffect7(() => {
|
|
18283
18161
|
startDebugRun({
|
|
18284
18162
|
flow: "import/path-validation",
|
|
18285
18163
|
step: "03-path-validation",
|
|
@@ -18287,10 +18165,10 @@ function PathValidationScreen({
|
|
|
18287
18165
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
18288
18166
|
});
|
|
18289
18167
|
}, []);
|
|
18290
|
-
|
|
18168
|
+
useEffect7(() => {
|
|
18291
18169
|
setScan(scanFiles(resolvedPath));
|
|
18292
18170
|
}, [resolvedPath]);
|
|
18293
|
-
const phase = phaseOf(scan);
|
|
18171
|
+
const phase = phaseOf(scan, { hasTokens });
|
|
18294
18172
|
const finish = (outcome, exitMethod) => {
|
|
18295
18173
|
void finishDebugRun({
|
|
18296
18174
|
outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
|
|
@@ -18322,19 +18200,19 @@ function PathValidationScreen({
|
|
|
18322
18200
|
"..."
|
|
18323
18201
|
] }),
|
|
18324
18202
|
scan?.ok === false && /* @__PURE__ */ jsx13(Failure, { scan, path: resolvedPath }),
|
|
18325
|
-
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
18203
|
+
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens, empty: phase === "empty" }),
|
|
18326
18204
|
/* @__PURE__ */ jsx13(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx13(ControlHints, { hints: controlsFor(phase) }) })
|
|
18327
18205
|
] })
|
|
18328
18206
|
] });
|
|
18329
18207
|
}
|
|
18330
18208
|
|
|
18331
18209
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
18332
|
-
import { useEffect as
|
|
18210
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
|
|
18333
18211
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
18334
18212
|
init_debug_store();
|
|
18335
18213
|
|
|
18336
18214
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
18337
|
-
import { useState as
|
|
18215
|
+
import { useState as useState8 } from "react";
|
|
18338
18216
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
18339
18217
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
18340
18218
|
function formLabelWidth(rows) {
|
|
@@ -18370,9 +18248,9 @@ function FieldForm({
|
|
|
18370
18248
|
busy = false,
|
|
18371
18249
|
children
|
|
18372
18250
|
}) {
|
|
18373
|
-
const [active, setActive] =
|
|
18374
|
-
const [editing, setEditing] =
|
|
18375
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
18251
|
+
const [active, setActive] = useState8(0);
|
|
18252
|
+
const [editing, setEditing] = useState8(false);
|
|
18253
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
18376
18254
|
const rowCount = fields2.length + actions.length;
|
|
18377
18255
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
18378
18256
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -18649,16 +18527,16 @@ function CredentialsScreen({
|
|
|
18649
18527
|
host: initial.host ?? ""
|
|
18650
18528
|
})
|
|
18651
18529
|
).current;
|
|
18652
|
-
const [values, setValues] =
|
|
18653
|
-
const [notice, setNotice] =
|
|
18654
|
-
const [validating, setValidating] =
|
|
18530
|
+
const [values, setValues] = useState9(initialValues);
|
|
18531
|
+
const [notice, setNotice] = useState9(null);
|
|
18532
|
+
const [validating, setValidating] = useState9(false);
|
|
18655
18533
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
18656
|
-
const [editing, setEditing] =
|
|
18657
|
-
const [focus, setFocus] =
|
|
18658
|
-
const [active, setActive] =
|
|
18659
|
-
const [beforeEdit, setBeforeEdit] =
|
|
18534
|
+
const [editing, setEditing] = useState9(!prefilled);
|
|
18535
|
+
const [focus, setFocus] = useState9(0);
|
|
18536
|
+
const [active, setActive] = useState9(0);
|
|
18537
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
18660
18538
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
18661
|
-
|
|
18539
|
+
useEffect8(() => {
|
|
18662
18540
|
startDebugRun({
|
|
18663
18541
|
flow: "import/credentials",
|
|
18664
18542
|
step: "04-credentials",
|
|
@@ -18980,7 +18858,7 @@ function ExtractionScreen({ progress, agent, rowMs }) {
|
|
|
18980
18858
|
}
|
|
18981
18859
|
|
|
18982
18860
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
18983
|
-
import { useEffect as
|
|
18861
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState10 } from "react";
|
|
18984
18862
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
18985
18863
|
init_debug_store();
|
|
18986
18864
|
|
|
@@ -19045,8 +18923,8 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
|
19045
18923
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
19046
18924
|
const rows = loaded.ok ? loaded.rows : [];
|
|
19047
18925
|
const columns = useTerminalWidth();
|
|
19048
|
-
const [selected, setSelected] =
|
|
19049
|
-
|
|
18926
|
+
const [selected, setSelected] = useState10(0);
|
|
18927
|
+
useEffect9(() => {
|
|
19050
18928
|
startDebugRun({
|
|
19051
18929
|
flow: "import/token-review",
|
|
19052
18930
|
step: "05-token-review",
|
|
@@ -19135,21 +19013,21 @@ init_config();
|
|
|
19135
19013
|
|
|
19136
19014
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19137
19015
|
init_debug_store();
|
|
19138
|
-
import { useEffect as
|
|
19016
|
+
import { useEffect as useEffect10, useRef as useRef6, useState as useState11 } from "react";
|
|
19139
19017
|
|
|
19140
19018
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
19141
19019
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
19142
|
-
import { join as
|
|
19020
|
+
import { join as join20, resolve as resolve24 } from "node:path";
|
|
19143
19021
|
|
|
19144
19022
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
19145
19023
|
import { existsSync as existsSync10 } from "node:fs";
|
|
19146
|
-
import { dirname as dirname16, join as
|
|
19024
|
+
import { dirname as dirname16, join as join19, resolve as resolve22 } from "node:path";
|
|
19147
19025
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
19148
19026
|
function findSkillPath(fileName) {
|
|
19149
19027
|
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
19150
19028
|
let dir = thisDir;
|
|
19151
19029
|
for (; ; ) {
|
|
19152
|
-
const candidate =
|
|
19030
|
+
const candidate = join19(dir, "skills", fileName);
|
|
19153
19031
|
if (existsSync10(candidate)) return candidate;
|
|
19154
19032
|
const parent = resolve22(dir, "..");
|
|
19155
19033
|
if (parent === dir) {
|
|
@@ -19259,7 +19137,7 @@ var realDeps = {
|
|
|
19259
19137
|
var fail = (step, message) => ({ ok: false, step, message });
|
|
19260
19138
|
var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
|
|
19261
19139
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
19262
|
-
const outDir = input.outDir ??
|
|
19140
|
+
const outDir = input.outDir ?? join20(resolve24(input.projectPath), ".contentful");
|
|
19263
19141
|
let progress = initialProgress({
|
|
19264
19142
|
hasCredentials: input.credentials !== null,
|
|
19265
19143
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -19390,9 +19268,9 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
19390
19268
|
|
|
19391
19269
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
19392
19270
|
function useExtraction(input) {
|
|
19393
|
-
const [state2, setState] =
|
|
19271
|
+
const [state2, setState] = useState11();
|
|
19394
19272
|
const current = useRef6();
|
|
19395
|
-
|
|
19273
|
+
useEffect10(() => {
|
|
19396
19274
|
current.current = input;
|
|
19397
19275
|
if (!input) {
|
|
19398
19276
|
setState(void 0);
|
|
@@ -19435,7 +19313,7 @@ function useExtraction(input) {
|
|
|
19435
19313
|
}
|
|
19436
19314
|
|
|
19437
19315
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19438
|
-
import { useEffect as
|
|
19316
|
+
import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
|
|
19439
19317
|
|
|
19440
19318
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
|
|
19441
19319
|
var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
|
|
@@ -19468,9 +19346,9 @@ async function runTokensOnly(input, deps = realDeps2) {
|
|
|
19468
19346
|
|
|
19469
19347
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
19470
19348
|
function useTokensOnly(input) {
|
|
19471
|
-
const [state2, setState] =
|
|
19349
|
+
const [state2, setState] = useState12();
|
|
19472
19350
|
const current = useRef7();
|
|
19473
|
-
|
|
19351
|
+
useEffect11(() => {
|
|
19474
19352
|
current.current = input;
|
|
19475
19353
|
if (!input) {
|
|
19476
19354
|
setState(void 0);
|
|
@@ -19489,7 +19367,7 @@ function useTokensOnly(input) {
|
|
|
19489
19367
|
|
|
19490
19368
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
19491
19369
|
init_debug_store();
|
|
19492
|
-
import { useEffect as
|
|
19370
|
+
import { useEffect as useEffect14, useMemo as useMemo4 } from "react";
|
|
19493
19371
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
19494
19372
|
|
|
19495
19373
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/log.ts
|
|
@@ -19686,32 +19564,32 @@ function CounterStrip(props) {
|
|
|
19686
19564
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
19687
19565
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
19688
19566
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
19689
|
-
const
|
|
19567
|
+
const sep = condensed ? " | " : " ";
|
|
19690
19568
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
19691
19569
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19692
19570
|
labelGrp,
|
|
19693
19571
|
" "
|
|
19694
19572
|
] }),
|
|
19695
19573
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
19696
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19574
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
19697
19575
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19698
19576
|
labelAcc,
|
|
19699
19577
|
" "
|
|
19700
19578
|
] }),
|
|
19701
19579
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
19702
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19580
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
19703
19581
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19704
19582
|
labelRej,
|
|
19705
19583
|
" "
|
|
19706
19584
|
] }),
|
|
19707
19585
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
19708
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19586
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
19709
19587
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
19710
19588
|
labelUnd,
|
|
19711
19589
|
" "
|
|
19712
19590
|
] }),
|
|
19713
19591
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
19714
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
19592
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep })
|
|
19715
19593
|
] }) });
|
|
19716
19594
|
}
|
|
19717
19595
|
|
|
@@ -20702,7 +20580,7 @@ function useImmediateInput(handler, enabled = true) {
|
|
|
20702
20580
|
|
|
20703
20581
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
20704
20582
|
import { useStdout as useStdout2 } from "ink";
|
|
20705
|
-
import { useEffect as
|
|
20583
|
+
import { useEffect as useEffect12, useState as useState13 } from "react";
|
|
20706
20584
|
function readTerminalSize(stdout) {
|
|
20707
20585
|
return {
|
|
20708
20586
|
columns: stdout?.columns ?? 80,
|
|
@@ -20711,8 +20589,8 @@ function readTerminalSize(stdout) {
|
|
|
20711
20589
|
}
|
|
20712
20590
|
function useTerminalSize() {
|
|
20713
20591
|
const { stdout } = useStdout2();
|
|
20714
|
-
const [size, setSize] =
|
|
20715
|
-
|
|
20592
|
+
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
20593
|
+
useEffect12(() => {
|
|
20716
20594
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
20717
20595
|
stdout?.on("resize", updateSize);
|
|
20718
20596
|
updateSize();
|
|
@@ -20895,7 +20773,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
|
|
|
20895
20773
|
}
|
|
20896
20774
|
|
|
20897
20775
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
20898
|
-
import { useEffect as
|
|
20776
|
+
import { useEffect as useEffect13, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
|
|
20899
20777
|
|
|
20900
20778
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
|
|
20901
20779
|
var TWO_COLUMN_MIN_WIDTH = 100;
|
|
@@ -21347,15 +21225,15 @@ function resolveGroupRoot(key, closures, cycleSet) {
|
|
|
21347
21225
|
}
|
|
21348
21226
|
|
|
21349
21227
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
21350
|
-
import { useState as
|
|
21228
|
+
import { useState as useState14 } from "react";
|
|
21351
21229
|
function useSidebarSearchState() {
|
|
21352
|
-
const [searchOpen, setSearchOpen] =
|
|
21353
|
-
const [searchQuery, setSearchQuery] =
|
|
21354
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
21355
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
21356
|
-
const [columnOneView, setColumnOneView] =
|
|
21357
|
-
const [activeFilters, setActiveFilters] =
|
|
21358
|
-
const [showHelp, setShowHelp] =
|
|
21230
|
+
const [searchOpen, setSearchOpen] = useState14(false);
|
|
21231
|
+
const [searchQuery, setSearchQuery] = useState14("");
|
|
21232
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState14([]);
|
|
21233
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState14(null);
|
|
21234
|
+
const [columnOneView, setColumnOneView] = useState14("grouped");
|
|
21235
|
+
const [activeFilters, setActiveFilters] = useState14(/* @__PURE__ */ new Set());
|
|
21236
|
+
const [showHelp, setShowHelp] = useState14(false);
|
|
21359
21237
|
return {
|
|
21360
21238
|
searchOpen,
|
|
21361
21239
|
setSearchOpen,
|
|
@@ -21375,10 +21253,10 @@ function useSidebarSearchState() {
|
|
|
21375
21253
|
}
|
|
21376
21254
|
|
|
21377
21255
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
21378
|
-
import { useCallback, useState as
|
|
21256
|
+
import { useCallback, useState as useState15 } from "react";
|
|
21379
21257
|
function useOverlayPanel(opts) {
|
|
21380
21258
|
const { toggleKey, onClose } = opts;
|
|
21381
|
-
const [isOpen, setIsOpen] =
|
|
21259
|
+
const [isOpen, setIsOpen] = useState15(false);
|
|
21382
21260
|
const open = useCallback(() => {
|
|
21383
21261
|
setIsOpen(true);
|
|
21384
21262
|
}, []);
|
|
@@ -21592,16 +21470,16 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21592
21470
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
21593
21471
|
[totalWidth, tokenCount, tokensWidth]
|
|
21594
21472
|
);
|
|
21595
|
-
const [decisions, setDecisions] =
|
|
21596
|
-
const [nav, setNav] =
|
|
21597
|
-
const [focusedColumn, setFocusedColumn] =
|
|
21598
|
-
const [tokensCursor, setTokensCursor] =
|
|
21599
|
-
const [showDependencies, setShowDependencies] =
|
|
21600
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
21601
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
21473
|
+
const [decisions, setDecisions] = useState16(/* @__PURE__ */ new Map());
|
|
21474
|
+
const [nav, setNav] = useState16({ cursor: 0, scrollOffset: 0 });
|
|
21475
|
+
const [focusedColumn, setFocusedColumn] = useState16("main");
|
|
21476
|
+
const [tokensCursor, setTokensCursor] = useState16(0);
|
|
21477
|
+
const [showDependencies, setShowDependencies] = useState16(false);
|
|
21478
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState16(false);
|
|
21479
|
+
const [cyclesCursor, setCyclesCursor] = useState16(0);
|
|
21602
21480
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
21603
|
-
const [aiCursor, setAiCursor] =
|
|
21604
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
21481
|
+
const [aiCursor, setAiCursor] = useState16(0);
|
|
21482
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState16(null);
|
|
21605
21483
|
const search = useSidebarSearchState();
|
|
21606
21484
|
const {
|
|
21607
21485
|
searchOpen,
|
|
@@ -21626,13 +21504,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21626
21504
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
21627
21505
|
[slotCycles]
|
|
21628
21506
|
);
|
|
21629
|
-
const [expandedGroups, setExpandedGroups] =
|
|
21507
|
+
const [expandedGroups, setExpandedGroups] = useState16(() => {
|
|
21630
21508
|
const seed = new Set(closures.keys());
|
|
21631
21509
|
for (const p of cycleParticipants) seed.add(p);
|
|
21632
21510
|
return seed;
|
|
21633
21511
|
});
|
|
21634
21512
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
21635
|
-
|
|
21513
|
+
useEffect13(() => {
|
|
21636
21514
|
if (seededGroupsRef.current) return;
|
|
21637
21515
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
21638
21516
|
seededGroupsRef.current = true;
|
|
@@ -21723,7 +21601,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
21723
21601
|
entryCount: 0
|
|
21724
21602
|
});
|
|
21725
21603
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
21726
|
-
|
|
21604
|
+
useEffect13(() => {
|
|
21727
21605
|
setNav((prev) => {
|
|
21728
21606
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
21729
21607
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -22094,7 +21972,7 @@ function ScopeGateScreen({
|
|
|
22094
21972
|
return loaded?.ok ? loaded.rows : [];
|
|
22095
21973
|
}, [tokensPath]);
|
|
22096
21974
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
22097
|
-
|
|
21975
|
+
useEffect14(() => {
|
|
22098
21976
|
startDebugRun({
|
|
22099
21977
|
flow: "import/scope-gate",
|
|
22100
21978
|
step: "07-scope-gate",
|
|
@@ -22216,7 +22094,7 @@ function ScopeGateScreen({
|
|
|
22216
22094
|
|
|
22217
22095
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
22218
22096
|
init_debug_store();
|
|
22219
|
-
import { useEffect as
|
|
22097
|
+
import { useEffect as useEffect15, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
|
|
22220
22098
|
|
|
22221
22099
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
|
|
22222
22100
|
async function checkGenerationCache(input) {
|
|
@@ -22264,8 +22142,8 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22264
22142
|
const sessionId = input?.sessionId;
|
|
22265
22143
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
22266
22144
|
const cacheCheck = useRef10(void 0);
|
|
22267
|
-
const [confirmed, setConfirmed] =
|
|
22268
|
-
|
|
22145
|
+
const [confirmed, setConfirmed] = useState17();
|
|
22146
|
+
useEffect15(() => {
|
|
22269
22147
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
22270
22148
|
startDebugRun({
|
|
22271
22149
|
flow: "import/scope-gate",
|
|
@@ -22279,7 +22157,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
22279
22157
|
exitMethod: "discarded"
|
|
22280
22158
|
});
|
|
22281
22159
|
}, [sessionId, loaded]);
|
|
22282
|
-
|
|
22160
|
+
useEffect15(() => {
|
|
22283
22161
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
22284
22162
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
22285
22163
|
}, [input, loaded]);
|
|
@@ -22394,7 +22272,7 @@ function GenerationScreen({
|
|
|
22394
22272
|
|
|
22395
22273
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22396
22274
|
init_debug_store();
|
|
22397
|
-
import { useEffect as
|
|
22275
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState18 } from "react";
|
|
22398
22276
|
|
|
22399
22277
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
22400
22278
|
import { resolve as resolve25 } from "node:path";
|
|
@@ -22564,9 +22442,9 @@ function applyProgressEvent2(event, previous, total) {
|
|
|
22564
22442
|
|
|
22565
22443
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
22566
22444
|
function useGeneration(input) {
|
|
22567
|
-
const [state2, setState] =
|
|
22445
|
+
const [state2, setState] = useState18();
|
|
22568
22446
|
const current = useRef11();
|
|
22569
|
-
|
|
22447
|
+
useEffect16(() => {
|
|
22570
22448
|
current.current = input;
|
|
22571
22449
|
if (!input) {
|
|
22572
22450
|
setState(void 0);
|
|
@@ -22602,7 +22480,7 @@ function useGeneration(input) {
|
|
|
22602
22480
|
}
|
|
22603
22481
|
|
|
22604
22482
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
22605
|
-
import { join as
|
|
22483
|
+
import { join as join21 } from "node:path";
|
|
22606
22484
|
function buildFlowStart(input) {
|
|
22607
22485
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
22608
22486
|
const credentials = extraction.credentials ?? {
|
|
@@ -22615,7 +22493,7 @@ function buildFlowStart(input) {
|
|
|
22615
22493
|
handoff,
|
|
22616
22494
|
agent: extraction.agent,
|
|
22617
22495
|
projectPath: extraction.projectPath,
|
|
22618
|
-
outDir: extraction.projectPath ?
|
|
22496
|
+
outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
|
|
22619
22497
|
rawTokensPath: extraction.rawTokensPath,
|
|
22620
22498
|
credentials: {
|
|
22621
22499
|
spaceId: credentials.spaceId,
|
|
@@ -23141,7 +23019,7 @@ function PreviewValidationErrorScreen({
|
|
|
23141
23019
|
}
|
|
23142
23020
|
|
|
23143
23021
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
23144
|
-
import { useCallback as useCallback5, useEffect as
|
|
23022
|
+
import { useCallback as useCallback5, useEffect as useEffect24, useMemo as useMemo6, useRef as useRef17, useState as useState26 } from "react";
|
|
23145
23023
|
import figures8 from "figures";
|
|
23146
23024
|
|
|
23147
23025
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
|
|
@@ -23402,7 +23280,7 @@ function enumerateCycleBreaks(cycle, components) {
|
|
|
23402
23280
|
import { Box as Box32, Text as Text34 } from "ink";
|
|
23403
23281
|
|
|
23404
23282
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
23405
|
-
import React13, { useEffect as
|
|
23283
|
+
import React13, { useEffect as useEffect17, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
23406
23284
|
import figures6 from "figures";
|
|
23407
23285
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
23408
23286
|
|
|
@@ -24110,11 +23988,11 @@ function FieldEditor({
|
|
|
24110
23988
|
headerHeight = 2
|
|
24111
23989
|
}) {
|
|
24112
23990
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
24113
|
-
const [editorState, setEditorState] =
|
|
24114
|
-
const [parseErr] =
|
|
24115
|
-
const [listScrollStart, setListScrollStart] =
|
|
23991
|
+
const [editorState, setEditorState] = useState19(initialState);
|
|
23992
|
+
const [parseErr] = useState19(parseError);
|
|
23993
|
+
const [listScrollStart, setListScrollStart] = useState19(0);
|
|
24116
23994
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
24117
|
-
const [rowHeights, setRowHeights] =
|
|
23995
|
+
const [rowHeights, setRowHeights] = useState19({});
|
|
24118
23996
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
24119
23997
|
const initialFocus = (() => {
|
|
24120
23998
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -24182,25 +24060,25 @@ function FieldEditor({
|
|
|
24182
24060
|
textCursor: 0
|
|
24183
24061
|
};
|
|
24184
24062
|
})();
|
|
24185
|
-
const [focusLevel, setFocusLevel] =
|
|
24186
|
-
const [propIdx, setPropIdx] =
|
|
24187
|
-
const [slotIdx, setSlotIdx] =
|
|
24188
|
-
const [inSlots, setInSlots] =
|
|
24189
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
24190
|
-
const [activeField, setActiveField] =
|
|
24191
|
-
const [editingField, setEditingField] =
|
|
24192
|
-
const [textCursor, setTextCursor] =
|
|
24193
|
-
const [valueCursor, setValueCursor] =
|
|
24194
|
-
const [editingValue, setEditingValue] =
|
|
24195
|
-
const [valueText, setValueText] =
|
|
24196
|
-
const [pickerCursor, setPickerCursor] =
|
|
24197
|
-
const [validationError, setValidationError] =
|
|
24198
|
-
const [cursorVisible] =
|
|
24199
|
-
const [sourceOpen, setSourceOpen] =
|
|
24200
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
24201
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
24202
|
-
const [showHelp, setShowHelp] =
|
|
24203
|
-
const [pendingDelete, setPendingDelete] =
|
|
24063
|
+
const [focusLevel, setFocusLevel] = useState19(initialFocus.focusLevel);
|
|
24064
|
+
const [propIdx, setPropIdx] = useState19(initialFocus.propIdx);
|
|
24065
|
+
const [slotIdx, setSlotIdx] = useState19(initialFocus.slotIdx);
|
|
24066
|
+
const [inSlots, setInSlots] = useState19(initialFocus.inSlots);
|
|
24067
|
+
const [inComponentDesc, setInComponentDesc] = useState19(initialFocus.focusLevel === "componentDescription");
|
|
24068
|
+
const [activeField, setActiveField] = useState19(initialFocus.activeField);
|
|
24069
|
+
const [editingField, setEditingField] = useState19(false);
|
|
24070
|
+
const [textCursor, setTextCursor] = useState19(initialFocus.textCursor);
|
|
24071
|
+
const [valueCursor, setValueCursor] = useState19(0);
|
|
24072
|
+
const [editingValue, setEditingValue] = useState19(null);
|
|
24073
|
+
const [valueText, setValueText] = useState19("");
|
|
24074
|
+
const [pickerCursor, setPickerCursor] = useState19(0);
|
|
24075
|
+
const [validationError, setValidationError] = useState19(null);
|
|
24076
|
+
const [cursorVisible] = useState19(true);
|
|
24077
|
+
const [sourceOpen, setSourceOpen] = useState19(false);
|
|
24078
|
+
const [rationaleOpen, setRationaleOpen] = useState19(false);
|
|
24079
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
|
|
24080
|
+
const [showHelp, setShowHelp] = useState19(false);
|
|
24081
|
+
const [pendingDelete, setPendingDelete] = useState19(null);
|
|
24204
24082
|
const props = editorState.props;
|
|
24205
24083
|
const slots = editorState.slots;
|
|
24206
24084
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -24960,7 +24838,7 @@ function FieldEditor({
|
|
|
24960
24838
|
}
|
|
24961
24839
|
return Math.max(start + 1, end2);
|
|
24962
24840
|
};
|
|
24963
|
-
|
|
24841
|
+
useEffect17(() => {
|
|
24964
24842
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
24965
24843
|
setListScrollStart((previous) => {
|
|
24966
24844
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -26032,7 +25910,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
26032
25910
|
}
|
|
26033
25911
|
|
|
26034
25912
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
26035
|
-
import { useCallback as useCallback2, useEffect as
|
|
25913
|
+
import { useCallback as useCallback2, useEffect as useEffect19, useRef as useRef13, useState as useState21 } from "react";
|
|
26036
25914
|
|
|
26037
25915
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
|
|
26038
25916
|
var DEFAULT_MAX_DEPTH = 50;
|
|
@@ -26088,7 +25966,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
|
|
|
26088
25966
|
}
|
|
26089
25967
|
|
|
26090
25968
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
26091
|
-
import { useEffect as
|
|
25969
|
+
import { useEffect as useEffect18, useRef as useRef12, useState as useState20 } from "react";
|
|
26092
25970
|
|
|
26093
25971
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
|
|
26094
25972
|
var TimeoutError = class extends Error {
|
|
@@ -26243,12 +26121,12 @@ function useReviewFinalizePreview({
|
|
|
26243
26121
|
}
|
|
26244
26122
|
function useFinalizePreview(opts) {
|
|
26245
26123
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
26246
|
-
const [status, setStatus] =
|
|
26247
|
-
const [removed, setRemoved] =
|
|
26248
|
-
const [scrollOffset, setScrollOffset] =
|
|
26124
|
+
const [status, setStatus] = useState20("idle");
|
|
26125
|
+
const [removed, setRemoved] = useState20([]);
|
|
26126
|
+
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
26249
26127
|
const generationRef = useRef12(0);
|
|
26250
26128
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
26251
|
-
|
|
26129
|
+
useEffect18(() => {
|
|
26252
26130
|
if (!open) {
|
|
26253
26131
|
setStatus("idle");
|
|
26254
26132
|
setRemoved([]);
|
|
@@ -26298,10 +26176,10 @@ function useReviewSession({
|
|
|
26298
26176
|
tokensPath,
|
|
26299
26177
|
onExtraLoaded
|
|
26300
26178
|
}) {
|
|
26301
|
-
const [components, setComponents] =
|
|
26302
|
-
const [loading, setLoading] =
|
|
26303
|
-
const [loadError, setLoadError] =
|
|
26304
|
-
const [availableTokens, setAvailableTokens] =
|
|
26179
|
+
const [components, setComponents] = useState21([]);
|
|
26180
|
+
const [loading, setLoading] = useState21(true);
|
|
26181
|
+
const [loadError, setLoadError] = useState21(null);
|
|
26182
|
+
const [availableTokens, setAvailableTokens] = useState21([]);
|
|
26305
26183
|
const loadInitialState = useCallback2(async () => {
|
|
26306
26184
|
const result = loadSession();
|
|
26307
26185
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -26311,7 +26189,7 @@ function useReviewSession({
|
|
|
26311
26189
|
}));
|
|
26312
26190
|
return { result, catalog };
|
|
26313
26191
|
}, [loadSession, tokensPath]);
|
|
26314
|
-
|
|
26192
|
+
useEffect19(() => {
|
|
26315
26193
|
let disposed = false;
|
|
26316
26194
|
void (async () => {
|
|
26317
26195
|
try {
|
|
@@ -26362,9 +26240,9 @@ function useReviewSession({
|
|
|
26362
26240
|
};
|
|
26363
26241
|
}
|
|
26364
26242
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
26365
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
26366
|
-
const [componentRationale, setComponentRationale] =
|
|
26367
|
-
|
|
26243
|
+
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
26244
|
+
const [componentRationale, setComponentRationale] = useState21(null);
|
|
26245
|
+
useEffect19(() => {
|
|
26368
26246
|
const current = components[selectedIdx];
|
|
26369
26247
|
if (!current) {
|
|
26370
26248
|
setReviewMetadata(null);
|
|
@@ -26402,7 +26280,7 @@ function useReviewHistory({
|
|
|
26402
26280
|
}) {
|
|
26403
26281
|
const historyRef = useRef13(null);
|
|
26404
26282
|
const historySeededRef = useRef13(false);
|
|
26405
|
-
|
|
26283
|
+
useEffect19(() => {
|
|
26406
26284
|
if (loading || historySeededRef.current) return;
|
|
26407
26285
|
historySeededRef.current = true;
|
|
26408
26286
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -26458,7 +26336,7 @@ function useReviewFinalize({
|
|
|
26458
26336
|
}
|
|
26459
26337
|
|
|
26460
26338
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
26461
|
-
import { useEffect as
|
|
26339
|
+
import { useEffect as useEffect20, useRef as useRef14, useState as useState22 } from "react";
|
|
26462
26340
|
|
|
26463
26341
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
|
|
26464
26342
|
function collectTokenSuggestions(entry, availableTokens = []) {
|
|
@@ -26497,21 +26375,21 @@ function useReviewEditor({
|
|
|
26497
26375
|
onEditSaved,
|
|
26498
26376
|
onTokenSaved
|
|
26499
26377
|
}) {
|
|
26500
|
-
const [panelOpen, setPanelOpen] =
|
|
26501
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
26502
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
26503
|
-
const [textEntryActive, setTextEntryActive] =
|
|
26504
|
-
const [showJson, setShowJson] =
|
|
26505
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
26506
|
-
const [draftValue, setDraftValue] =
|
|
26507
|
-
const [saveError, setSaveError] =
|
|
26508
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
26509
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
26510
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
26511
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
26378
|
+
const [panelOpen, setPanelOpen] = useState22("none");
|
|
26379
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState22(0);
|
|
26380
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState22(0);
|
|
26381
|
+
const [textEntryActive, setTextEntryActive] = useState22(false);
|
|
26382
|
+
const [showJson, setShowJson] = useState22(false);
|
|
26383
|
+
const [showHiddenProps, setShowHiddenProps] = useState22(false);
|
|
26384
|
+
const [draftValue, setDraftValue] = useState22("");
|
|
26385
|
+
const [saveError, setSaveError] = useState22(null);
|
|
26386
|
+
const [tokenReviewRow, setTokenReviewRow] = useState22(0);
|
|
26387
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
|
|
26388
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
|
|
26389
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
26512
26390
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
26513
26391
|
const pendingGRef = useRef14(false);
|
|
26514
|
-
|
|
26392
|
+
useEffect20(() => {
|
|
26515
26393
|
setTokenReviewRow(0);
|
|
26516
26394
|
setTokenReviewEditing(false);
|
|
26517
26395
|
setTokenReviewEditCursor(0);
|
|
@@ -26624,12 +26502,12 @@ function useReviewEditor({
|
|
|
26624
26502
|
}
|
|
26625
26503
|
|
|
26626
26504
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
26627
|
-
import { useState as
|
|
26505
|
+
import { useState as useState23 } from "react";
|
|
26628
26506
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
26629
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
26630
|
-
const [showFinalize, setShowFinalize] =
|
|
26631
|
-
const [showQuit, setShowQuit] =
|
|
26632
|
-
const [finalizeError, setFinalizeError] =
|
|
26507
|
+
const [sidebarFocused, setSidebarFocused] = useState23(true);
|
|
26508
|
+
const [showFinalize, setShowFinalize] = useState23(false);
|
|
26509
|
+
const [showQuit, setShowQuit] = useState23(false);
|
|
26510
|
+
const [finalizeError, setFinalizeError] = useState23(initialFinalizeError);
|
|
26633
26511
|
return {
|
|
26634
26512
|
sidebarFocused,
|
|
26635
26513
|
setSidebarFocused,
|
|
@@ -26923,7 +26801,7 @@ function handleJsonPanelInput(input, key, state2) {
|
|
|
26923
26801
|
}
|
|
26924
26802
|
|
|
26925
26803
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
26926
|
-
import { useCallback as useCallback4, useEffect as
|
|
26804
|
+
import { useCallback as useCallback4, useEffect as useEffect22, useState as useState25 } from "react";
|
|
26927
26805
|
|
|
26928
26806
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
|
|
26929
26807
|
function applyPreviewAnnotations(preview, localNames) {
|
|
@@ -26958,25 +26836,25 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
26958
26836
|
}
|
|
26959
26837
|
|
|
26960
26838
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
26961
|
-
import { useCallback as useCallback3, useEffect as
|
|
26839
|
+
import { useCallback as useCallback3, useEffect as useEffect21, useRef as useRef15, useState as useState24 } from "react";
|
|
26962
26840
|
var DEFAULT_DEBOUNCE_MS = 500;
|
|
26963
26841
|
function useLivePreview(opts) {
|
|
26964
26842
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
26965
|
-
const [status, setStatus] =
|
|
26966
|
-
const [disabled, setDisabled] =
|
|
26843
|
+
const [status, setStatus] = useState24("idle");
|
|
26844
|
+
const [disabled, setDisabled] = useState24(false);
|
|
26967
26845
|
const timerRef = useRef15(null);
|
|
26968
26846
|
const generationRef = useRef15(0);
|
|
26969
26847
|
const latestRef = useRef15(0);
|
|
26970
26848
|
const inflightRef = useRef15(0);
|
|
26971
26849
|
const optsRef = useRef15(opts);
|
|
26972
|
-
|
|
26850
|
+
useEffect21(() => {
|
|
26973
26851
|
optsRef.current = opts;
|
|
26974
26852
|
});
|
|
26975
26853
|
const disabledRef = useRef15(disabled);
|
|
26976
|
-
|
|
26854
|
+
useEffect21(() => {
|
|
26977
26855
|
disabledRef.current = disabled;
|
|
26978
26856
|
}, [disabled]);
|
|
26979
|
-
|
|
26857
|
+
useEffect21(() => {
|
|
26980
26858
|
return () => {
|
|
26981
26859
|
if (timerRef.current) {
|
|
26982
26860
|
clearTimeout(timerRef.current);
|
|
@@ -27062,8 +26940,8 @@ function useReviewPreview({
|
|
|
27062
26940
|
deleteAllComponents,
|
|
27063
26941
|
onResult
|
|
27064
26942
|
}) {
|
|
27065
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
27066
|
-
const [removedComponents, setRemovedComponents] =
|
|
26943
|
+
const [previewAnnotations, setPreviewAnnotations] = useState25(/* @__PURE__ */ new Map());
|
|
26944
|
+
const [removedComponents, setRemovedComponents] = useState25([]);
|
|
27067
26945
|
const handleResult = useCallback4(
|
|
27068
26946
|
(response) => {
|
|
27069
26947
|
if (!response) return;
|
|
@@ -27089,14 +26967,14 @@ function useReviewPreview({
|
|
|
27089
26967
|
onResult: handleResult,
|
|
27090
26968
|
deleteAllComponents
|
|
27091
26969
|
});
|
|
27092
|
-
const [spinnerTick, setSpinnerTick] =
|
|
27093
|
-
|
|
26970
|
+
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
26971
|
+
useEffect22(() => {
|
|
27094
26972
|
if (livePreviewHook.status !== "running") return;
|
|
27095
26973
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
27096
26974
|
return () => clearInterval(id);
|
|
27097
26975
|
}, [livePreviewHook.status]);
|
|
27098
26976
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
27099
|
-
|
|
26977
|
+
useEffect22(() => {
|
|
27100
26978
|
if (loading) return;
|
|
27101
26979
|
if (!livePreview) return;
|
|
27102
26980
|
if (components.length === 0) return;
|
|
@@ -27107,7 +26985,7 @@ function useReviewPreview({
|
|
|
27107
26985
|
|
|
27108
26986
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
27109
26987
|
init_debug_store();
|
|
27110
|
-
import { useEffect as
|
|
26988
|
+
import { useEffect as useEffect23, useRef as useRef16 } from "react";
|
|
27111
26989
|
|
|
27112
26990
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-log.ts
|
|
27113
26991
|
var REVIEW_RUN = { flow: "import/review", step: "09-review", menuOption: "Review" };
|
|
@@ -27179,7 +27057,7 @@ function useReviewLog({
|
|
|
27179
27057
|
const started = useRef16(false);
|
|
27180
27058
|
const latest = useRef16(components);
|
|
27181
27059
|
latest.current = components;
|
|
27182
|
-
|
|
27060
|
+
useEffect23(() => {
|
|
27183
27061
|
if (loading || started.current) return;
|
|
27184
27062
|
started.current = true;
|
|
27185
27063
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -27194,7 +27072,7 @@ function useReviewLog({
|
|
|
27194
27072
|
trail.current = openReviewTrail(components, Date.now());
|
|
27195
27073
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
27196
27074
|
}, [loading, loadError, components]);
|
|
27197
|
-
|
|
27075
|
+
useEffect23(
|
|
27198
27076
|
() => () => {
|
|
27199
27077
|
const open = trail.current;
|
|
27200
27078
|
trail.current = void 0;
|
|
@@ -27471,7 +27349,7 @@ function GenerateReviewStepView({
|
|
|
27471
27349
|
initialFinalizeError = null
|
|
27472
27350
|
}) {
|
|
27473
27351
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
27474
|
-
const [slotCycles, setSlotCycles] =
|
|
27352
|
+
const [slotCycles, setSlotCycles] = useState26([]);
|
|
27475
27353
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
27476
27354
|
setSlotCycles(cycles ?? []);
|
|
27477
27355
|
}, []);
|
|
@@ -27504,7 +27382,7 @@ function GenerateReviewStepView({
|
|
|
27504
27382
|
onExtraLoaded: setLoadedSlotCycles
|
|
27505
27383
|
});
|
|
27506
27384
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
27507
|
-
const [nav, setNav] =
|
|
27385
|
+
const [nav, setNav] = useState26({
|
|
27508
27386
|
cursorRowIdx: 0,
|
|
27509
27387
|
sidebarScrollOffset: 0
|
|
27510
27388
|
});
|
|
@@ -27520,10 +27398,10 @@ function GenerateReviewStepView({
|
|
|
27520
27398
|
finalizeError,
|
|
27521
27399
|
setFinalizeError
|
|
27522
27400
|
} = reviewSurface;
|
|
27523
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
27401
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
27524
27402
|
const removedBannerDefaultedRef = useRef17(false);
|
|
27525
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
27526
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
27403
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
27404
|
+
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
27527
27405
|
const cyclePanel = useOverlayPanel({
|
|
27528
27406
|
toggleKey: "c",
|
|
27529
27407
|
onClose: () => {
|
|
@@ -27538,9 +27416,9 @@ function GenerateReviewStepView({
|
|
|
27538
27416
|
setBreakConfirm(false);
|
|
27539
27417
|
}
|
|
27540
27418
|
});
|
|
27541
|
-
const [breakCursor, setBreakCursor] =
|
|
27542
|
-
const [breakConfirm, setBreakConfirm] =
|
|
27543
|
-
const [expandedGroups, setExpandedGroups] =
|
|
27419
|
+
const [breakCursor, setBreakCursor] = useState26(0);
|
|
27420
|
+
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
27421
|
+
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
27544
27422
|
const seededGroupsRef = useRef17(false);
|
|
27545
27423
|
const {
|
|
27546
27424
|
searchOpen,
|
|
@@ -27559,14 +27437,14 @@ function GenerateReviewStepView({
|
|
|
27559
27437
|
setShowHelp
|
|
27560
27438
|
} = useSidebarSearchState();
|
|
27561
27439
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
27562
|
-
const [breakingChanges, setBreakingChanges] =
|
|
27563
|
-
const [breakingCursor, setBreakingCursor] =
|
|
27564
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
27565
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
27566
|
-
const [autoRejected, setAutoRejected] =
|
|
27567
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
27440
|
+
const [breakingChanges, setBreakingChanges] = useState26([]);
|
|
27441
|
+
const [breakingCursor, setBreakingCursor] = useState26(0);
|
|
27442
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState26(false);
|
|
27443
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
27444
|
+
const [autoRejected, setAutoRejected] = useState26([]);
|
|
27445
|
+
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
27568
27446
|
const autoRejectFiredRef = useRef17(false);
|
|
27569
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
27447
|
+
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
27570
27448
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
27571
27449
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
27572
27450
|
components,
|
|
@@ -27631,7 +27509,7 @@ function GenerateReviewStepView({
|
|
|
27631
27509
|
[components]
|
|
27632
27510
|
);
|
|
27633
27511
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
27634
|
-
|
|
27512
|
+
useEffect24(() => {
|
|
27635
27513
|
if (seededGroupsRef.current) return;
|
|
27636
27514
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
27637
27515
|
seededGroupsRef.current = true;
|
|
@@ -27658,7 +27536,7 @@ function GenerateReviewStepView({
|
|
|
27658
27536
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
27659
27537
|
}));
|
|
27660
27538
|
}, [slotCycles, cycleView]);
|
|
27661
|
-
|
|
27539
|
+
useEffect24(() => {
|
|
27662
27540
|
const decision = computeAutoRejectDecision({
|
|
27663
27541
|
loading,
|
|
27664
27542
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -27703,7 +27581,7 @@ function GenerateReviewStepView({
|
|
|
27703
27581
|
onAction: reviewLog.record
|
|
27704
27582
|
});
|
|
27705
27583
|
const autoRejectPushedRef = useRef17(false);
|
|
27706
|
-
|
|
27584
|
+
useEffect24(() => {
|
|
27707
27585
|
if (loading) return;
|
|
27708
27586
|
if (!historySeededRef.current) return;
|
|
27709
27587
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -27787,7 +27665,7 @@ function GenerateReviewStepView({
|
|
|
27787
27665
|
const panelHeight = leftPanelHeight + 2;
|
|
27788
27666
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
27789
27667
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
27790
|
-
|
|
27668
|
+
useEffect24(() => {
|
|
27791
27669
|
if (selectableRowPositions.length === 0) return;
|
|
27792
27670
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
27793
27671
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -28708,10 +28586,10 @@ function DoneStep({
|
|
|
28708
28586
|
}
|
|
28709
28587
|
|
|
28710
28588
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
28711
|
-
import { useState as
|
|
28589
|
+
import { useState as useState28 } from "react";
|
|
28712
28590
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
28713
28591
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
28714
|
-
import { dirname as dirname17, basename as
|
|
28592
|
+
import { dirname as dirname17, basename as basename6, join as join22 } from "node:path";
|
|
28715
28593
|
|
|
28716
28594
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
28717
28595
|
import { resolve as resolve26 } from "node:path";
|
|
@@ -28732,10 +28610,10 @@ function normalizePath(input) {
|
|
|
28732
28610
|
}
|
|
28733
28611
|
|
|
28734
28612
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
28735
|
-
import { useEffect as
|
|
28613
|
+
import { useEffect as useEffect25, useState as useState27 } from "react";
|
|
28736
28614
|
function useBlinkingCursor() {
|
|
28737
|
-
const [visible, setVisible] =
|
|
28738
|
-
|
|
28615
|
+
const [visible, setVisible] = useState27(true);
|
|
28616
|
+
useEffect25(() => {
|
|
28739
28617
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
28740
28618
|
return () => clearInterval(interval);
|
|
28741
28619
|
}, []);
|
|
@@ -28748,7 +28626,7 @@ function autocomplete(partial) {
|
|
|
28748
28626
|
if (!partial) return null;
|
|
28749
28627
|
const normalized = normalizePath(partial);
|
|
28750
28628
|
const dir = dirname17(normalized);
|
|
28751
|
-
const base =
|
|
28629
|
+
const base = basename6(normalized);
|
|
28752
28630
|
let entries;
|
|
28753
28631
|
try {
|
|
28754
28632
|
entries = readdirSync4(dir);
|
|
@@ -28757,13 +28635,13 @@ function autocomplete(partial) {
|
|
|
28757
28635
|
}
|
|
28758
28636
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
28759
28637
|
if (matches.length === 0) return null;
|
|
28760
|
-
if (matches.length === 1) return
|
|
28638
|
+
if (matches.length === 1) return join22(dir, matches[0]);
|
|
28761
28639
|
let prefix = matches[0];
|
|
28762
28640
|
for (const m of matches) {
|
|
28763
28641
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
28764
28642
|
if (!prefix) break;
|
|
28765
28643
|
}
|
|
28766
|
-
return prefix.length > base.length ?
|
|
28644
|
+
return prefix.length > base.length ? join22(dir, prefix) : null;
|
|
28767
28645
|
}
|
|
28768
28646
|
function PathPrompt({
|
|
28769
28647
|
defaultPath,
|
|
@@ -28772,7 +28650,7 @@ function PathPrompt({
|
|
|
28772
28650
|
label = "Save to",
|
|
28773
28651
|
summary
|
|
28774
28652
|
}) {
|
|
28775
|
-
const [input, setInput] =
|
|
28653
|
+
const [input, setInput] = useState28("");
|
|
28776
28654
|
const cursorVisible = useBlinkingCursor();
|
|
28777
28655
|
useImmediateInput((rawInput, key) => {
|
|
28778
28656
|
if (key.return) {
|
|
@@ -28851,12 +28729,12 @@ function countedThings({ components, tokens }, counts = {}) {
|
|
|
28851
28729
|
}
|
|
28852
28730
|
|
|
28853
28731
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
28854
|
-
import { useEffect as
|
|
28732
|
+
import { useEffect as useEffect26, useState as useState29 } from "react";
|
|
28855
28733
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
28856
28734
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
28857
28735
|
function useTimedSpinner() {
|
|
28858
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
28859
|
-
|
|
28736
|
+
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
28737
|
+
useEffect26(() => {
|
|
28860
28738
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
28861
28739
|
return () => {
|
|
28862
28740
|
clearInterval(timer);
|
|
@@ -28918,7 +28796,7 @@ function PushingStep({ progress, produced, counts }) {
|
|
|
28918
28796
|
}
|
|
28919
28797
|
|
|
28920
28798
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
28921
|
-
import { useEffect as
|
|
28799
|
+
import { useEffect as useEffect27, useState as useState30, useMemo as useMemo7 } from "react";
|
|
28922
28800
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
28923
28801
|
|
|
28924
28802
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
|
|
@@ -29297,8 +29175,8 @@ function WizardPreviewStep({
|
|
|
29297
29175
|
onQuit
|
|
29298
29176
|
}) {
|
|
29299
29177
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
29300
|
-
const [diffExpanded, setDiffExpanded] =
|
|
29301
|
-
const [scrollOffset, setScrollOffset] =
|
|
29178
|
+
const [diffExpanded, setDiffExpanded] = useState30(false);
|
|
29179
|
+
const [scrollOffset, setScrollOffset] = useState30(0);
|
|
29302
29180
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
29303
29181
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
29304
29182
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -29313,7 +29191,7 @@ function WizardPreviewStep({
|
|
|
29313
29191
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
29314
29192
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
29315
29193
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
29316
|
-
|
|
29194
|
+
useEffect27(() => {
|
|
29317
29195
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
29318
29196
|
}, [maxScroll]);
|
|
29319
29197
|
useImmediateInput((input, key) => {
|
|
@@ -29405,7 +29283,7 @@ function buildRunTeaserLine(runId) {
|
|
|
29405
29283
|
|
|
29406
29284
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
29407
29285
|
init_debug_store();
|
|
29408
|
-
import { useEffect as
|
|
29286
|
+
import { useEffect as useEffect28, useRef as useRef18 } from "react";
|
|
29409
29287
|
|
|
29410
29288
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/flow-log.ts
|
|
29411
29289
|
var FLOW_RUN = { flow: "import/publish", step: "10-publish", menuOption: "Publish" };
|
|
@@ -29560,7 +29438,7 @@ function flowFinish(trail, final, now) {
|
|
|
29560
29438
|
function useFlowLog(state2) {
|
|
29561
29439
|
const trail = useRef18(void 0);
|
|
29562
29440
|
const previous = useRef18(void 0);
|
|
29563
|
-
|
|
29441
|
+
useEffect28(() => {
|
|
29564
29442
|
const before = previous.current;
|
|
29565
29443
|
previous.current = state2;
|
|
29566
29444
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -29583,7 +29461,7 @@ function useFlowLog(state2) {
|
|
|
29583
29461
|
trail.current = open;
|
|
29584
29462
|
setDebugRunProgress(flowProgress(open, now));
|
|
29585
29463
|
}, [state2]);
|
|
29586
|
-
|
|
29464
|
+
useEffect28(
|
|
29587
29465
|
() => () => {
|
|
29588
29466
|
const open = trail.current;
|
|
29589
29467
|
trail.current = void 0;
|
|
@@ -29722,13 +29600,13 @@ function FlowScreen({
|
|
|
29722
29600
|
}
|
|
29723
29601
|
|
|
29724
29602
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
29725
|
-
import { useEffect as
|
|
29603
|
+
import { useEffect as useEffect29, useRef as useRef19, useSyncExternalStore } from "react";
|
|
29726
29604
|
|
|
29727
29605
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
29728
29606
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
29729
29607
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
29730
29608
|
import { tmpdir } from "node:os";
|
|
29731
|
-
import { join as
|
|
29609
|
+
import { join as join24, resolve as resolve27 } from "node:path";
|
|
29732
29610
|
|
|
29733
29611
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
29734
29612
|
function shouldBypassPreview(state2) {
|
|
@@ -30077,8 +29955,8 @@ function pushFailure(e, deps) {
|
|
|
30077
29955
|
}
|
|
30078
29956
|
|
|
30079
29957
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
30080
|
-
import { writeFile as
|
|
30081
|
-
import { join as
|
|
29958
|
+
import { writeFile as writeFile8 } from "node:fs/promises";
|
|
29959
|
+
import { join as join23 } from "node:path";
|
|
30082
29960
|
|
|
30083
29961
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
|
|
30084
29962
|
function nextStateAfterPrint(opts) {
|
|
@@ -30102,7 +29980,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
30102
29980
|
var realSaveDeps = () => ({
|
|
30103
29981
|
openDb: openPipelineDb,
|
|
30104
29982
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
30105
|
-
writeFile: (path5, contents) =>
|
|
29983
|
+
writeFile: (path5, contents) => writeFile8(path5, contents),
|
|
30106
29984
|
appendRun,
|
|
30107
29985
|
buildSourceFingerprint,
|
|
30108
29986
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -30110,7 +29988,7 @@ var realSaveDeps = () => ({
|
|
|
30110
29988
|
});
|
|
30111
29989
|
async function runPrintFiles(input, deps, onPatch) {
|
|
30112
29990
|
onPatch({ step: "printing" });
|
|
30113
|
-
const componentsPath =
|
|
29991
|
+
const componentsPath = join23(input.outDir, "components.json");
|
|
30114
29992
|
try {
|
|
30115
29993
|
const db = deps.openDb();
|
|
30116
29994
|
let components = [];
|
|
@@ -30195,7 +30073,7 @@ var EMPTY_PUSH_RESULT = {
|
|
|
30195
30073
|
};
|
|
30196
30074
|
|
|
30197
30075
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
30198
|
-
var WIZARD_LOG =
|
|
30076
|
+
var WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
|
|
30199
30077
|
function appendWizardLog(entry) {
|
|
30200
30078
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
30201
30079
|
}
|
|
@@ -30488,14 +30366,14 @@ function useFlow(start, options = {}) {
|
|
|
30488
30366
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
30489
30367
|
() => current?.getState()
|
|
30490
30368
|
);
|
|
30491
|
-
|
|
30369
|
+
useEffect29(() => {
|
|
30492
30370
|
if (!start) controller.current = void 0;
|
|
30493
30371
|
}, [start]);
|
|
30494
30372
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
30495
30373
|
}
|
|
30496
30374
|
|
|
30497
30375
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
30498
|
-
import { useEffect as
|
|
30376
|
+
import { useEffect as useEffect30, useState as useState31 } from "react";
|
|
30499
30377
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
30500
30378
|
init_debug_store();
|
|
30501
30379
|
|
|
@@ -30506,7 +30384,7 @@ init_debug_mode_store();
|
|
|
30506
30384
|
init_version();
|
|
30507
30385
|
|
|
30508
30386
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
30509
|
-
import { join as
|
|
30387
|
+
import { join as join25, resolve as resolve28 } from "node:path";
|
|
30510
30388
|
function describeFileLocations({
|
|
30511
30389
|
contentfulBaseDir,
|
|
30512
30390
|
debugModeEnabled,
|
|
@@ -30515,14 +30393,14 @@ function describeFileLocations({
|
|
|
30515
30393
|
if (!debugModeEnabled) {
|
|
30516
30394
|
return {
|
|
30517
30395
|
debugLogs: "none while Debug Mode is off",
|
|
30518
|
-
importFiles: `${
|
|
30396
|
+
importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
30519
30397
|
};
|
|
30520
30398
|
}
|
|
30521
30399
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
30522
|
-
const session = currentSessionDir2 ??
|
|
30400
|
+
const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
|
|
30523
30401
|
return {
|
|
30524
|
-
debugLogs:
|
|
30525
|
-
importFiles: `${
|
|
30402
|
+
debugLogs: join25(session, "debug"),
|
|
30403
|
+
importFiles: `${join25(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
30526
30404
|
};
|
|
30527
30405
|
}
|
|
30528
30406
|
|
|
@@ -30568,8 +30446,8 @@ function Section({ title, rows }) {
|
|
|
30568
30446
|
] });
|
|
30569
30447
|
}
|
|
30570
30448
|
function HelpScreen({ onDone }) {
|
|
30571
|
-
const [info, setInfo] =
|
|
30572
|
-
|
|
30449
|
+
const [info, setInfo] = useState31();
|
|
30450
|
+
useEffect30(() => {
|
|
30573
30451
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
30574
30452
|
void readHelpInfo().then(setInfo);
|
|
30575
30453
|
}, []);
|
|
@@ -30607,14 +30485,14 @@ function HelpScreen({ onDone }) {
|
|
|
30607
30485
|
}
|
|
30608
30486
|
|
|
30609
30487
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
30610
|
-
import { useState as
|
|
30488
|
+
import { useState as useState32 } from "react";
|
|
30611
30489
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
30612
30490
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
30613
30491
|
function SettingsScreen({
|
|
30614
30492
|
onNavigate,
|
|
30615
30493
|
onBack
|
|
30616
30494
|
}) {
|
|
30617
|
-
const [focusIdx, setFocusIdx] =
|
|
30495
|
+
const [focusIdx, setFocusIdx] = useState32(0);
|
|
30618
30496
|
const items = [
|
|
30619
30497
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
30620
30498
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -30662,11 +30540,11 @@ function SettingsScreen({
|
|
|
30662
30540
|
}
|
|
30663
30541
|
|
|
30664
30542
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
30665
|
-
import { useState as
|
|
30543
|
+
import { useState as useState36 } from "react";
|
|
30666
30544
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
30667
30545
|
|
|
30668
30546
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
30669
|
-
import { useEffect as
|
|
30547
|
+
import { useEffect as useEffect32, useRef as useRef20, useState as useState34 } from "react";
|
|
30670
30548
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
30671
30549
|
init_debug_store();
|
|
30672
30550
|
|
|
@@ -30962,7 +30840,7 @@ async function writeAgentConfig(config) {
|
|
|
30962
30840
|
}
|
|
30963
30841
|
|
|
30964
30842
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
30965
|
-
import { useEffect as
|
|
30843
|
+
import { useEffect as useEffect31, useState as useState33 } from "react";
|
|
30966
30844
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
30967
30845
|
|
|
30968
30846
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
|
|
@@ -31021,11 +30899,11 @@ function AgentDetail({
|
|
|
31021
30899
|
record: record3
|
|
31022
30900
|
}) {
|
|
31023
30901
|
const settings = config.agents[name];
|
|
31024
|
-
const [saving, setSaving] =
|
|
31025
|
-
const [testing, setTesting] =
|
|
31026
|
-
const [notice, setNotice] =
|
|
31027
|
-
const [checks, setChecks] =
|
|
31028
|
-
|
|
30902
|
+
const [saving, setSaving] = useState33(false);
|
|
30903
|
+
const [testing, setTesting] = useState33(false);
|
|
30904
|
+
const [notice, setNotice] = useState33(null);
|
|
30905
|
+
const [checks, setChecks] = useState33(void 0);
|
|
30906
|
+
useEffect31(() => {
|
|
31029
30907
|
let active = true;
|
|
31030
30908
|
setChecks(void 0);
|
|
31031
30909
|
const timer = setTimeout(() => {
|
|
@@ -31103,13 +30981,13 @@ import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-
|
|
|
31103
30981
|
var NAME_WIDTH = 16;
|
|
31104
30982
|
var PANEL_LABEL_WIDTH = "Command".length;
|
|
31105
30983
|
function AgentsScreen({ onDone }) {
|
|
31106
|
-
const [config, setConfig] =
|
|
31107
|
-
const [focus, setFocus] =
|
|
31108
|
-
const [open, setOpen] =
|
|
31109
|
-
const [notice, setNotice] =
|
|
31110
|
-
const [saving, setSaving] =
|
|
31111
|
-
const [loadError, setLoadError] =
|
|
31112
|
-
const [checks, setChecks] =
|
|
30984
|
+
const [config, setConfig] = useState34(null);
|
|
30985
|
+
const [focus, setFocus] = useState34(0);
|
|
30986
|
+
const [open, setOpen] = useState34(null);
|
|
30987
|
+
const [notice, setNotice] = useState34(null);
|
|
30988
|
+
const [saving, setSaving] = useState34(false);
|
|
30989
|
+
const [loadError, setLoadError] = useState34(null);
|
|
30990
|
+
const [checks, setChecks] = useState34({});
|
|
31113
30991
|
const visit = useRef20({
|
|
31114
30992
|
trail: createTrail(),
|
|
31115
30993
|
before: void 0,
|
|
@@ -31123,7 +31001,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31123
31001
|
);
|
|
31124
31002
|
}
|
|
31125
31003
|
};
|
|
31126
|
-
|
|
31004
|
+
useEffect32(() => {
|
|
31127
31005
|
readAgentConfig().then((loaded) => {
|
|
31128
31006
|
setConfig(loaded);
|
|
31129
31007
|
inspectAll(loaded);
|
|
@@ -31300,7 +31178,7 @@ function AgentsScreen({ onDone }) {
|
|
|
31300
31178
|
}
|
|
31301
31179
|
|
|
31302
31180
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
31303
|
-
import { useEffect as
|
|
31181
|
+
import { useEffect as useEffect33, useRef as useRef21, useState as useState35 } from "react";
|
|
31304
31182
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
31305
31183
|
init_debug_store();
|
|
31306
31184
|
|
|
@@ -31354,10 +31232,10 @@ function debugFields(config) {
|
|
|
31354
31232
|
var snapshotOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31355
31233
|
var valuesOf = (config) => Object.fromEntries(FIELDS3.map(({ key }) => [key, config[key] || ""]));
|
|
31356
31234
|
function ProjectScreen({ onDone }) {
|
|
31357
|
-
const [config, setConfig] =
|
|
31358
|
-
const [saving, setSaving] =
|
|
31359
|
-
const [notice, setNotice] =
|
|
31360
|
-
const [loadError, setLoadError] =
|
|
31235
|
+
const [config, setConfig] = useState35(null);
|
|
31236
|
+
const [saving, setSaving] = useState35(false);
|
|
31237
|
+
const [notice, setNotice] = useState35(null);
|
|
31238
|
+
const [loadError, setLoadError] = useState35(null);
|
|
31361
31239
|
const visit = useRef21({
|
|
31362
31240
|
trail: createTrail(),
|
|
31363
31241
|
before: void 0,
|
|
@@ -31365,7 +31243,7 @@ function ProjectScreen({ onDone }) {
|
|
|
31365
31243
|
error: ""
|
|
31366
31244
|
}).current;
|
|
31367
31245
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
31368
|
-
|
|
31246
|
+
useEffect33(() => {
|
|
31369
31247
|
readCredentials().then((cfg) => {
|
|
31370
31248
|
setConfig(cfg);
|
|
31371
31249
|
visit.before = snapshotOf(cfg);
|
|
@@ -31473,8 +31351,8 @@ var SECTIONS = [
|
|
|
31473
31351
|
{ id: "agents", label: "Agents", description: "Which coding agent the CLI uses, and each agent\u2019s settings" }
|
|
31474
31352
|
];
|
|
31475
31353
|
function ConfigurationScreen({ onDone }) {
|
|
31476
|
-
const [focus, setFocus] =
|
|
31477
|
-
const [open, setOpen] =
|
|
31354
|
+
const [focus, setFocus] = useState36(0);
|
|
31355
|
+
const [open, setOpen] = useState36(null);
|
|
31478
31356
|
const close = () => setOpen(null);
|
|
31479
31357
|
useInput17((input, key) => {
|
|
31480
31358
|
if (open) return;
|
|
@@ -31517,7 +31395,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
31517
31395
|
}
|
|
31518
31396
|
|
|
31519
31397
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
31520
|
-
import { useEffect as
|
|
31398
|
+
import { useEffect as useEffect34, useState as useState37 } from "react";
|
|
31521
31399
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
31522
31400
|
|
|
31523
31401
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
@@ -31539,9 +31417,9 @@ async function writeAnalyticsSetting(setting) {
|
|
|
31539
31417
|
init_debug_store();
|
|
31540
31418
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
31541
31419
|
function OptInAnalyticsScreen({ onDone }) {
|
|
31542
|
-
const [loading, setLoading] =
|
|
31543
|
-
const [enabled, setEnabled] =
|
|
31544
|
-
|
|
31420
|
+
const [loading, setLoading] = useState37(true);
|
|
31421
|
+
const [enabled, setEnabled] = useState37(true);
|
|
31422
|
+
useEffect34(() => {
|
|
31545
31423
|
readAnalyticsSetting().then((setting) => {
|
|
31546
31424
|
setEnabled(setting.enabled);
|
|
31547
31425
|
setLoading(false);
|
|
@@ -31595,7 +31473,7 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
31595
31473
|
}
|
|
31596
31474
|
|
|
31597
31475
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
31598
|
-
import { useEffect as
|
|
31476
|
+
import { useEffect as useEffect35, useRef as useRef22, useState as useState38 } from "react";
|
|
31599
31477
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
31600
31478
|
init_debug_mode_store();
|
|
31601
31479
|
init_debug_store();
|
|
@@ -31606,14 +31484,14 @@ var snapshotOf2 = (setting) => ({
|
|
|
31606
31484
|
retentionDays: String(setting.retentionDays)
|
|
31607
31485
|
});
|
|
31608
31486
|
function DebugModeScreen({ onDone }) {
|
|
31609
|
-
const [setting, setSetting] =
|
|
31610
|
-
const [focus, setFocus] =
|
|
31611
|
-
const [pending, setPending] =
|
|
31487
|
+
const [setting, setSetting] = useState38(null);
|
|
31488
|
+
const [focus, setFocus] = useState38("enabled");
|
|
31489
|
+
const [pending, setPending] = useState38(
|
|
31612
31490
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
31613
31491
|
);
|
|
31614
|
-
const [notice, setNotice] =
|
|
31492
|
+
const [notice, setNotice] = useState38(null);
|
|
31615
31493
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
31616
|
-
|
|
31494
|
+
useEffect35(() => {
|
|
31617
31495
|
readDebugModeSetting().then((loaded) => {
|
|
31618
31496
|
setSetting(loaded);
|
|
31619
31497
|
setPending(loaded.retentionDays);
|
|
@@ -31737,18 +31615,18 @@ function DebugModeScreen({ onDone }) {
|
|
|
31737
31615
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
31738
31616
|
var TOKENS_ONLY_HIDDEN_STEPS = ["extraction", "scope-gate"];
|
|
31739
31617
|
function App({ importOptions, inkClear }) {
|
|
31740
|
-
const [screen, setScreen] =
|
|
31741
|
-
const [importExitCode, setImportExitCode] =
|
|
31618
|
+
const [screen, setScreen] = useState39("start");
|
|
31619
|
+
const [importExitCode, setImportExitCode] = useState39();
|
|
31742
31620
|
const showImportResult = importExitCode !== void 0;
|
|
31743
|
-
const [target, setTarget] =
|
|
31744
|
-
const [answers, setAnswers] =
|
|
31621
|
+
const [target, setTarget] = useState39();
|
|
31622
|
+
const [answers, setAnswers] = useState39({});
|
|
31745
31623
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
31746
|
-
const [extractionRun, setExtractionRun] =
|
|
31624
|
+
const [extractionRun, setExtractionRun] = useState39();
|
|
31747
31625
|
const extraction = useExtraction(extractionRun?.input);
|
|
31748
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
31626
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState39();
|
|
31749
31627
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
31750
|
-
const [tokenReview, setTokenReview] =
|
|
31751
|
-
const [scopeRun, setScopeRun] =
|
|
31628
|
+
const [tokenReview, setTokenReview] = useState39();
|
|
31629
|
+
const [scopeRun, setScopeRun] = useState39();
|
|
31752
31630
|
const scopeFlow = useScopeGateFlow(
|
|
31753
31631
|
scopeRun && {
|
|
31754
31632
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -31763,12 +31641,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31763
31641
|
}
|
|
31764
31642
|
}
|
|
31765
31643
|
);
|
|
31766
|
-
const [generationInput, setGenerationInput] =
|
|
31644
|
+
const [generationInput, setGenerationInput] = useState39();
|
|
31767
31645
|
const generation = useGeneration(generationInput);
|
|
31768
|
-
const [flowStart, setFlowStart] =
|
|
31646
|
+
const [flowStart, setFlowStart] = useState39();
|
|
31769
31647
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
31770
|
-
const [importDefaults, setImportDefaults] =
|
|
31771
|
-
|
|
31648
|
+
const [importDefaults, setImportDefaults] = useState39();
|
|
31649
|
+
useEffect36(() => {
|
|
31772
31650
|
if (screen !== "import") {
|
|
31773
31651
|
setImportDefaults(void 0);
|
|
31774
31652
|
return;
|
|
@@ -31841,7 +31719,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31841
31719
|
}
|
|
31842
31720
|
});
|
|
31843
31721
|
};
|
|
31844
|
-
|
|
31722
|
+
useEffect36(() => {
|
|
31845
31723
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
31846
31724
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
31847
31725
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -31863,12 +31741,12 @@ function App({ importOptions, inkClear }) {
|
|
|
31863
31741
|
}
|
|
31864
31742
|
});
|
|
31865
31743
|
}, [tokensOnly, tokensOnlyRun]);
|
|
31866
|
-
|
|
31744
|
+
useEffect36(() => {
|
|
31867
31745
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
31868
31746
|
setExtractionRun(void 0);
|
|
31869
31747
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
31870
31748
|
}, [extraction, extractionRun]);
|
|
31871
|
-
|
|
31749
|
+
useEffect36(() => {
|
|
31872
31750
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
31873
31751
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31874
31752
|
setGenerationInput({
|
|
@@ -31886,7 +31764,7 @@ function App({ importOptions, inkClear }) {
|
|
|
31886
31764
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
31887
31765
|
});
|
|
31888
31766
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
31889
|
-
|
|
31767
|
+
useEffect36(() => {
|
|
31890
31768
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
31891
31769
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
31892
31770
|
inkClear();
|