@contentful/experience-design-system-cli 2.42.1-dev-build-9c1908dc.0 → 2.42.1-dev-build-9a3d743e.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +538 -404
- package/dist/index.js +437 -285
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +3 -1
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +3 -0
- package/dist/src/tui/support-bundle.d.ts +23 -0
- package/dist/src/tui/zip.d.ts +7 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8318,8 +8318,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
8318
8318
|
continue;
|
|
8319
8319
|
const entryPath = join5(dir, entry);
|
|
8320
8320
|
try {
|
|
8321
|
-
const
|
|
8322
|
-
if (
|
|
8321
|
+
const stat6 = statSync2(entryPath);
|
|
8322
|
+
if (stat6.isDirectory()) {
|
|
8323
8323
|
scanDir(entryPath, depth + 1);
|
|
8324
8324
|
}
|
|
8325
8325
|
} catch {
|
|
@@ -11834,11 +11834,11 @@ function getPathPreferenceScore(filePath) {
|
|
|
11834
11834
|
const normalized = filePath.replace(/\\/g, "/");
|
|
11835
11835
|
const segments = normalized.split("/").filter(Boolean);
|
|
11836
11836
|
const filename = segments.at(-1) ?? "";
|
|
11837
|
-
const
|
|
11837
|
+
const basename8 = filename.replace(/\.[^.]+$/, "");
|
|
11838
11838
|
let score = 0;
|
|
11839
11839
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
11840
11840
|
score += 100;
|
|
11841
|
-
if (
|
|
11841
|
+
if (basename8 && segments.at(-2) === basename8)
|
|
11842
11842
|
score -= 10;
|
|
11843
11843
|
const componentsSegmentCount = segments.filter((segment) => segment === "components").length;
|
|
11844
11844
|
score -= componentsSegmentCount * 8;
|
|
@@ -13785,15 +13785,15 @@ import { statSync as statSync4 } from "node:fs";
|
|
|
13785
13785
|
import path4 from "node:path";
|
|
13786
13786
|
function collectFiles(root, options = {}) {
|
|
13787
13787
|
const resolved = path4.resolve(root);
|
|
13788
|
-
let
|
|
13788
|
+
let stat6;
|
|
13789
13789
|
try {
|
|
13790
|
-
|
|
13790
|
+
stat6 = statSync4(resolved);
|
|
13791
13791
|
} catch (err) {
|
|
13792
13792
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
13793
13793
|
}
|
|
13794
|
-
if (
|
|
13794
|
+
if (stat6.isFile())
|
|
13795
13795
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
13796
|
-
if (!
|
|
13796
|
+
if (!stat6.isDirectory())
|
|
13797
13797
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
13798
13798
|
const result = {
|
|
13799
13799
|
filePaths: [],
|
|
@@ -19501,6 +19501,7 @@ __export(debug_store_exports, {
|
|
|
19501
19501
|
currentSessionDir: () => currentSessionDir,
|
|
19502
19502
|
finishDebugRun: () => finishDebugRun,
|
|
19503
19503
|
setDebugRunProgress: () => setDebugRunProgress,
|
|
19504
|
+
settleDebugLogs: () => settleDebugLogs,
|
|
19504
19505
|
startDebugRun: () => startDebugRun,
|
|
19505
19506
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
19506
19507
|
startImportRun: () => startImportRun
|
|
@@ -19605,7 +19606,19 @@ function startDebugRun({
|
|
|
19605
19606
|
function setDebugRunProgress(outputs) {
|
|
19606
19607
|
if (pendingRun) pendingRun.progress = outputs;
|
|
19607
19608
|
}
|
|
19608
|
-
|
|
19609
|
+
function track(work) {
|
|
19610
|
+
unsettled.add(work);
|
|
19611
|
+
const forget = () => void unsettled.delete(work);
|
|
19612
|
+
work.then(forget, forget);
|
|
19613
|
+
return work;
|
|
19614
|
+
}
|
|
19615
|
+
async function settleDebugLogs() {
|
|
19616
|
+
while (unsettled.size > 0) await Promise.allSettled([...unsettled]);
|
|
19617
|
+
}
|
|
19618
|
+
function finishDebugRun(args) {
|
|
19619
|
+
return track(finishRun(args));
|
|
19620
|
+
}
|
|
19621
|
+
async function finishRun({
|
|
19609
19622
|
outputs,
|
|
19610
19623
|
status,
|
|
19611
19624
|
exitMethod
|
|
@@ -19688,7 +19701,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
19688
19701
|
function handleCrash() {
|
|
19689
19702
|
return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
|
|
19690
19703
|
}
|
|
19691
|
-
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
19704
|
+
var pendingRun, sessionDir, unsettled, WAITING_LIMIT, waiting;
|
|
19692
19705
|
var init_debug_store = __esm({
|
|
19693
19706
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
19694
19707
|
"use strict";
|
|
@@ -19718,6 +19731,7 @@ var init_debug_store = __esm({
|
|
|
19718
19731
|
);
|
|
19719
19732
|
}
|
|
19720
19733
|
});
|
|
19734
|
+
unsettled = /* @__PURE__ */ new Set();
|
|
19721
19735
|
WAITING_LIMIT = 50;
|
|
19722
19736
|
waiting = [];
|
|
19723
19737
|
process.once("uncaughtException", (err) => {
|
|
@@ -19860,6 +19874,118 @@ var init_controls = __esm({
|
|
|
19860
19874
|
}
|
|
19861
19875
|
});
|
|
19862
19876
|
|
|
19877
|
+
// packages/experience-design-system-cli/src/tui/zip.ts
|
|
19878
|
+
import { crc32, deflateRawSync } from "node:zlib";
|
|
19879
|
+
function dosDateTime(date) {
|
|
19880
|
+
const year = Math.max(1980, date.getFullYear());
|
|
19881
|
+
return {
|
|
19882
|
+
day: year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate(),
|
|
19883
|
+
time: date.getHours() << 11 | date.getMinutes() << 5 | date.getSeconds() >> 1
|
|
19884
|
+
};
|
|
19885
|
+
}
|
|
19886
|
+
function createZip(entries) {
|
|
19887
|
+
const body = [];
|
|
19888
|
+
const directory = [];
|
|
19889
|
+
let offset = 0;
|
|
19890
|
+
for (const entry of entries) {
|
|
19891
|
+
const name = Buffer.from(entry.name, "utf8");
|
|
19892
|
+
const compressed = deflateRawSync(entry.data);
|
|
19893
|
+
const checksum = crc32(entry.data);
|
|
19894
|
+
const { day, time } = dosDateTime(entry.modified);
|
|
19895
|
+
const local = Buffer.alloc(30);
|
|
19896
|
+
local.writeUInt32LE(LOCAL_HEADER, 0);
|
|
19897
|
+
local.writeUInt16LE(VERSION2, 4);
|
|
19898
|
+
local.writeUInt16LE(UTF8_NAMES, 6);
|
|
19899
|
+
local.writeUInt16LE(DEFLATE, 8);
|
|
19900
|
+
local.writeUInt16LE(time, 10);
|
|
19901
|
+
local.writeUInt16LE(day, 12);
|
|
19902
|
+
local.writeUInt32LE(checksum, 14);
|
|
19903
|
+
local.writeUInt32LE(compressed.length, 18);
|
|
19904
|
+
local.writeUInt32LE(entry.data.length, 22);
|
|
19905
|
+
local.writeUInt16LE(name.length, 26);
|
|
19906
|
+
body.push(local, name, compressed);
|
|
19907
|
+
const central = Buffer.alloc(46);
|
|
19908
|
+
central.writeUInt32LE(CENTRAL_HEADER, 0);
|
|
19909
|
+
central.writeUInt16LE(VERSION2, 4);
|
|
19910
|
+
central.writeUInt16LE(VERSION2, 6);
|
|
19911
|
+
central.writeUInt16LE(UTF8_NAMES, 8);
|
|
19912
|
+
central.writeUInt16LE(DEFLATE, 10);
|
|
19913
|
+
central.writeUInt16LE(time, 12);
|
|
19914
|
+
central.writeUInt16LE(day, 14);
|
|
19915
|
+
central.writeUInt32LE(checksum, 16);
|
|
19916
|
+
central.writeUInt32LE(compressed.length, 20);
|
|
19917
|
+
central.writeUInt32LE(entry.data.length, 24);
|
|
19918
|
+
central.writeUInt16LE(name.length, 28);
|
|
19919
|
+
central.writeUInt32LE(offset, 42);
|
|
19920
|
+
directory.push(central, name);
|
|
19921
|
+
offset += local.length + name.length + compressed.length;
|
|
19922
|
+
}
|
|
19923
|
+
const directoryBytes = Buffer.concat(directory);
|
|
19924
|
+
const end = Buffer.alloc(22);
|
|
19925
|
+
end.writeUInt32LE(END_OF_ARCHIVE, 0);
|
|
19926
|
+
end.writeUInt16LE(entries.length, 8);
|
|
19927
|
+
end.writeUInt16LE(entries.length, 10);
|
|
19928
|
+
end.writeUInt32LE(directoryBytes.length, 12);
|
|
19929
|
+
end.writeUInt32LE(offset, 16);
|
|
19930
|
+
return Buffer.concat([...body, directoryBytes, end]);
|
|
19931
|
+
}
|
|
19932
|
+
var LOCAL_HEADER, CENTRAL_HEADER, END_OF_ARCHIVE, VERSION2, UTF8_NAMES, DEFLATE;
|
|
19933
|
+
var init_zip = __esm({
|
|
19934
|
+
"packages/experience-design-system-cli/src/tui/zip.ts"() {
|
|
19935
|
+
"use strict";
|
|
19936
|
+
LOCAL_HEADER = 67324752;
|
|
19937
|
+
CENTRAL_HEADER = 33639248;
|
|
19938
|
+
END_OF_ARCHIVE = 101010256;
|
|
19939
|
+
VERSION2 = 20;
|
|
19940
|
+
UTF8_NAMES = 2048;
|
|
19941
|
+
DEFLATE = 8;
|
|
19942
|
+
}
|
|
19943
|
+
});
|
|
19944
|
+
|
|
19945
|
+
// packages/experience-design-system-cli/src/tui/support-bundle.ts
|
|
19946
|
+
import { readdir as readdir3, readFile as readFile21, stat as stat5, writeFile as writeFile8 } from "node:fs/promises";
|
|
19947
|
+
import { basename as basename6, join as join20, sep } from "node:path";
|
|
19948
|
+
async function bundleDebugLogs() {
|
|
19949
|
+
const session = currentSessionDir();
|
|
19950
|
+
const debugDir = currentDebugSessionDir();
|
|
19951
|
+
if (!session || !debugDir) return { status: "no-logs" };
|
|
19952
|
+
try {
|
|
19953
|
+
await settleDebugLogs();
|
|
19954
|
+
const logs = (await readdir3(debugDir, { recursive: true })).filter((file) => file.endsWith(".md")).sort();
|
|
19955
|
+
if (logs.length === 0) return { status: "no-logs" };
|
|
19956
|
+
const entries = await Promise.all(
|
|
19957
|
+
logs.map(async (file) => {
|
|
19958
|
+
const path6 = join20(debugDir, file);
|
|
19959
|
+
return { name: file.split(sep).join("/"), data: await readFile21(path6), modified: (await stat5(path6)).mtime };
|
|
19960
|
+
})
|
|
19961
|
+
);
|
|
19962
|
+
const path5 = join20(session, `${basename6(session)}-debug-logs.zip`);
|
|
19963
|
+
await writeFile8(path5, createZip(entries), { mode: 384 });
|
|
19964
|
+
return { status: "created", path: path5, files: entries.length };
|
|
19965
|
+
} catch {
|
|
19966
|
+
return { status: "failed", folder: debugDir };
|
|
19967
|
+
}
|
|
19968
|
+
}
|
|
19969
|
+
function supportInstruction(bundle) {
|
|
19970
|
+
switch (bundle.status) {
|
|
19971
|
+
case "created":
|
|
19972
|
+
return `Debug logs saved to ${bundle.path}
|
|
19973
|
+
Send this file to Contentful support so they can look into it.`;
|
|
19974
|
+
case "no-logs":
|
|
19975
|
+
return "No debug logs were recorded. To get help, turn on Debug Mode in Settings, run the import again and send the zip file it saves to Contentful support.";
|
|
19976
|
+
case "failed":
|
|
19977
|
+
return `Your debug logs are in ${bundle.folder}
|
|
19978
|
+
Zip that folder and send it to Contentful support so they can look into it.`;
|
|
19979
|
+
}
|
|
19980
|
+
}
|
|
19981
|
+
var init_support_bundle = __esm({
|
|
19982
|
+
"packages/experience-design-system-cli/src/tui/support-bundle.ts"() {
|
|
19983
|
+
"use strict";
|
|
19984
|
+
init_debug_store();
|
|
19985
|
+
init_zip();
|
|
19986
|
+
}
|
|
19987
|
+
});
|
|
19988
|
+
|
|
19863
19989
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/logic.ts
|
|
19864
19990
|
function errorAction(input, key, available) {
|
|
19865
19991
|
if (key.return && available.canAcknowledge) return "acknowledge";
|
|
@@ -19900,6 +20026,28 @@ var init_controls2 = __esm({
|
|
|
19900
20026
|
}
|
|
19901
20027
|
});
|
|
19902
20028
|
|
|
20029
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
|
|
20030
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
20031
|
+
function useSupportBundle() {
|
|
20032
|
+
const [bundle, setBundle] = useState3();
|
|
20033
|
+
useEffect3(() => {
|
|
20034
|
+
let active = true;
|
|
20035
|
+
void bundleDebugLogs().then((result) => {
|
|
20036
|
+
if (active) setBundle(result);
|
|
20037
|
+
});
|
|
20038
|
+
return () => {
|
|
20039
|
+
active = false;
|
|
20040
|
+
};
|
|
20041
|
+
}, []);
|
|
20042
|
+
return bundle;
|
|
20043
|
+
}
|
|
20044
|
+
var init_use_support_bundle = __esm({
|
|
20045
|
+
"packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts"() {
|
|
20046
|
+
"use strict";
|
|
20047
|
+
init_support_bundle();
|
|
20048
|
+
}
|
|
20049
|
+
});
|
|
20050
|
+
|
|
19903
20051
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
19904
20052
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
19905
20053
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -19911,6 +20059,7 @@ function ErrorStep({
|
|
|
19911
20059
|
onAcknowledgeBreakingChanges
|
|
19912
20060
|
}) {
|
|
19913
20061
|
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
20062
|
+
const bundle = useSupportBundle();
|
|
19914
20063
|
const controls = errorControls({
|
|
19915
20064
|
canRetry: onRetryCredentials !== void 0,
|
|
19916
20065
|
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
@@ -19922,6 +20071,7 @@ function ErrorStep({
|
|
|
19922
20071
|
" failed"
|
|
19923
20072
|
] }),
|
|
19924
20073
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
20074
|
+
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
19925
20075
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
19926
20076
|
"[",
|
|
19927
20077
|
control.keys,
|
|
@@ -19934,8 +20084,10 @@ var init_error_step = __esm({
|
|
|
19934
20084
|
"packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx"() {
|
|
19935
20085
|
"use strict";
|
|
19936
20086
|
init_theme();
|
|
20087
|
+
init_support_bundle();
|
|
19937
20088
|
init_controls2();
|
|
19938
20089
|
init_logic2();
|
|
20090
|
+
init_use_support_bundle();
|
|
19939
20091
|
}
|
|
19940
20092
|
});
|
|
19941
20093
|
|
|
@@ -20186,10 +20338,10 @@ var init_theme2 = __esm({
|
|
|
20186
20338
|
});
|
|
20187
20339
|
|
|
20188
20340
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
20189
|
-
import { useEffect as
|
|
20341
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
20190
20342
|
function useElapsed() {
|
|
20191
|
-
const [seconds2, setSeconds] =
|
|
20192
|
-
|
|
20343
|
+
const [seconds2, setSeconds] = useState4(0);
|
|
20344
|
+
useEffect4(() => {
|
|
20193
20345
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
20194
20346
|
return () => clearInterval(timer);
|
|
20195
20347
|
}, []);
|
|
@@ -20272,13 +20424,13 @@ var init_shared2 = __esm({
|
|
|
20272
20424
|
});
|
|
20273
20425
|
|
|
20274
20426
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
20275
|
-
import { useEffect as
|
|
20427
|
+
import { useEffect as useEffect5, useRef, useState as useState5 } from "react";
|
|
20276
20428
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
20277
20429
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
20278
20430
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
20279
|
-
const [focus, setFocus] =
|
|
20431
|
+
const [focus, setFocus] = useState5(0);
|
|
20280
20432
|
const viewed = useRef([optionAt(0)]).current;
|
|
20281
|
-
|
|
20433
|
+
useEffect5(() => {
|
|
20282
20434
|
startDebugRun({
|
|
20283
20435
|
flow: "import/preflight",
|
|
20284
20436
|
step: "00-preflight",
|
|
@@ -20403,13 +20555,13 @@ var init_controls4 = __esm({
|
|
|
20403
20555
|
});
|
|
20404
20556
|
|
|
20405
20557
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
20406
|
-
import { useEffect as
|
|
20558
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
20407
20559
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
20408
20560
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
20409
20561
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
20410
|
-
const [projectPath, setProjectPath] =
|
|
20562
|
+
const [projectPath, setProjectPath] = useState6(initialPath);
|
|
20411
20563
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
20412
|
-
|
|
20564
|
+
useEffect6(() => {
|
|
20413
20565
|
startDebugRun({
|
|
20414
20566
|
flow: "import/welcome",
|
|
20415
20567
|
step: "01-welcome",
|
|
@@ -20558,7 +20710,7 @@ var init_validate_path = __esm({
|
|
|
20558
20710
|
});
|
|
20559
20711
|
|
|
20560
20712
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
20561
|
-
import { useEffect as
|
|
20713
|
+
import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
|
|
20562
20714
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
20563
20715
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
20564
20716
|
function TokenInputScreen({
|
|
@@ -20567,10 +20719,10 @@ function TokenInputScreen({
|
|
|
20567
20719
|
onBack,
|
|
20568
20720
|
initialPath = ""
|
|
20569
20721
|
}) {
|
|
20570
|
-
const [tokenPath, setTokenPath] =
|
|
20571
|
-
const [failure, setFailure] =
|
|
20722
|
+
const [tokenPath, setTokenPath] = useState7(initialPath);
|
|
20723
|
+
const [failure, setFailure] = useState7(null);
|
|
20572
20724
|
const rejected = useRef4([]).current;
|
|
20573
|
-
|
|
20725
|
+
useEffect7(() => {
|
|
20574
20726
|
startDebugRun({
|
|
20575
20727
|
flow: "import/token-input",
|
|
20576
20728
|
step: "02-token-input",
|
|
@@ -20812,7 +20964,7 @@ var init_scan_files = __esm({
|
|
|
20812
20964
|
});
|
|
20813
20965
|
|
|
20814
20966
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
20815
|
-
import { useEffect as
|
|
20967
|
+
import { useEffect as useEffect8, useMemo, useState as useState8 } from "react";
|
|
20816
20968
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
20817
20969
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
20818
20970
|
function Row({ row }) {
|
|
@@ -20868,8 +21020,8 @@ function PathValidationScreen({
|
|
|
20868
21020
|
hasTokens = true
|
|
20869
21021
|
}) {
|
|
20870
21022
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
20871
|
-
const [scan, setScan] =
|
|
20872
|
-
|
|
21023
|
+
const [scan, setScan] = useState8();
|
|
21024
|
+
useEffect8(() => {
|
|
20873
21025
|
startDebugRun({
|
|
20874
21026
|
flow: "import/path-validation",
|
|
20875
21027
|
step: "03-path-validation",
|
|
@@ -20877,7 +21029,7 @@ function PathValidationScreen({
|
|
|
20877
21029
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
20878
21030
|
});
|
|
20879
21031
|
}, []);
|
|
20880
|
-
|
|
21032
|
+
useEffect8(() => {
|
|
20881
21033
|
setScan(scanFiles(resolvedPath));
|
|
20882
21034
|
}, [resolvedPath]);
|
|
20883
21035
|
const phase = phaseOf(scan);
|
|
@@ -20932,7 +21084,7 @@ var init_screen4 = __esm({
|
|
|
20932
21084
|
});
|
|
20933
21085
|
|
|
20934
21086
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
20935
|
-
import { useState as
|
|
21087
|
+
import { useState as useState9 } from "react";
|
|
20936
21088
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
20937
21089
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
20938
21090
|
function formLabelWidth(rows) {
|
|
@@ -20968,9 +21120,9 @@ function FieldForm({
|
|
|
20968
21120
|
busy = false,
|
|
20969
21121
|
children
|
|
20970
21122
|
}) {
|
|
20971
|
-
const [active, setActive] =
|
|
20972
|
-
const [editing, setEditing] =
|
|
20973
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
21123
|
+
const [active, setActive] = useState9(0);
|
|
21124
|
+
const [editing, setEditing] = useState9(false);
|
|
21125
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
20974
21126
|
const rowCount = fields2.length + actions.length;
|
|
20975
21127
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
20976
21128
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -21254,7 +21406,7 @@ var init_validate4 = __esm({
|
|
|
21254
21406
|
});
|
|
21255
21407
|
|
|
21256
21408
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
21257
|
-
import { useEffect as
|
|
21409
|
+
import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
|
|
21258
21410
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
21259
21411
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21260
21412
|
function CredentialsScreen({
|
|
@@ -21273,16 +21425,16 @@ function CredentialsScreen({
|
|
|
21273
21425
|
host: initial.host ?? ""
|
|
21274
21426
|
})
|
|
21275
21427
|
).current;
|
|
21276
|
-
const [values, setValues] =
|
|
21277
|
-
const [notice, setNotice] =
|
|
21278
|
-
const [validating, setValidating] =
|
|
21428
|
+
const [values, setValues] = useState10(initialValues);
|
|
21429
|
+
const [notice, setNotice] = useState10(null);
|
|
21430
|
+
const [validating, setValidating] = useState10(false);
|
|
21279
21431
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
21280
|
-
const [editing, setEditing] =
|
|
21281
|
-
const [focus, setFocus] =
|
|
21282
|
-
const [active, setActive] =
|
|
21283
|
-
const [beforeEdit, setBeforeEdit] =
|
|
21432
|
+
const [editing, setEditing] = useState10(!prefilled);
|
|
21433
|
+
const [focus, setFocus] = useState10(0);
|
|
21434
|
+
const [active, setActive] = useState10(0);
|
|
21435
|
+
const [beforeEdit, setBeforeEdit] = useState10(initialValues);
|
|
21284
21436
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
21285
|
-
|
|
21437
|
+
useEffect9(() => {
|
|
21286
21438
|
startDebugRun({
|
|
21287
21439
|
flow: "import/credentials",
|
|
21288
21440
|
step: "04-credentials",
|
|
@@ -21707,15 +21859,15 @@ var init_load = __esm({
|
|
|
21707
21859
|
});
|
|
21708
21860
|
|
|
21709
21861
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
21710
|
-
import { useEffect as
|
|
21862
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState11 } from "react";
|
|
21711
21863
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
21712
21864
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21713
21865
|
function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
21714
21866
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
21715
21867
|
const rows = loaded.ok ? loaded.rows : [];
|
|
21716
21868
|
const columns = useTerminalWidth();
|
|
21717
|
-
const [selected, setSelected] =
|
|
21718
|
-
|
|
21869
|
+
const [selected, setSelected] = useState11(0);
|
|
21870
|
+
useEffect10(() => {
|
|
21719
21871
|
startDebugRun({
|
|
21720
21872
|
flow: "import/token-review",
|
|
21721
21873
|
step: "05-token-review",
|
|
@@ -21830,13 +21982,13 @@ var init_steps = __esm({
|
|
|
21830
21982
|
|
|
21831
21983
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21832
21984
|
import { existsSync as existsSync11 } from "node:fs";
|
|
21833
|
-
import { dirname as dirname16, join as
|
|
21985
|
+
import { dirname as dirname16, join as join21, resolve as resolve22 } from "node:path";
|
|
21834
21986
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21835
21987
|
function findSkillPath(fileName) {
|
|
21836
21988
|
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
21837
21989
|
let dir = thisDir;
|
|
21838
21990
|
for (; ; ) {
|
|
21839
|
-
const candidate =
|
|
21991
|
+
const candidate = join21(dir, "skills", fileName);
|
|
21840
21992
|
if (existsSync11(candidate)) return candidate;
|
|
21841
21993
|
const parent = resolve22(dir, "..");
|
|
21842
21994
|
if (parent === dir) {
|
|
@@ -21949,9 +22101,9 @@ var init_selection2 = __esm({
|
|
|
21949
22101
|
|
|
21950
22102
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
21951
22103
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
21952
|
-
import { join as
|
|
22104
|
+
import { join as join22, resolve as resolve24 } from "node:path";
|
|
21953
22105
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
21954
|
-
const outDir = input.outDir ??
|
|
22106
|
+
const outDir = input.outDir ?? join22(resolve24(input.projectPath), ".contentful");
|
|
21955
22107
|
let progress = initialProgress({
|
|
21956
22108
|
hasCredentials: input.credentials !== null,
|
|
21957
22109
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -22101,11 +22253,11 @@ var init_run = __esm({
|
|
|
22101
22253
|
});
|
|
22102
22254
|
|
|
22103
22255
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
22104
|
-
import { useEffect as
|
|
22256
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState12 } from "react";
|
|
22105
22257
|
function useExtraction(input) {
|
|
22106
|
-
const [state2, setState] =
|
|
22258
|
+
const [state2, setState] = useState12();
|
|
22107
22259
|
const current = useRef6();
|
|
22108
|
-
|
|
22260
|
+
useEffect11(() => {
|
|
22109
22261
|
current.current = input;
|
|
22110
22262
|
if (!input) {
|
|
22111
22263
|
setState(void 0);
|
|
@@ -22195,11 +22347,11 @@ var init_run_tokens_only = __esm({
|
|
|
22195
22347
|
});
|
|
22196
22348
|
|
|
22197
22349
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
22198
|
-
import { useEffect as
|
|
22350
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
|
|
22199
22351
|
function useTokensOnly(input) {
|
|
22200
|
-
const [state2, setState] =
|
|
22352
|
+
const [state2, setState] = useState13();
|
|
22201
22353
|
const current = useRef7();
|
|
22202
|
-
|
|
22354
|
+
useEffect12(() => {
|
|
22203
22355
|
current.current = input;
|
|
22204
22356
|
if (!input) {
|
|
22205
22357
|
setState(void 0);
|
|
@@ -22453,32 +22605,32 @@ function CounterStrip(props) {
|
|
|
22453
22605
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
22454
22606
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
22455
22607
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
22456
|
-
const
|
|
22608
|
+
const sep2 = condensed ? " | " : " ";
|
|
22457
22609
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
22458
22610
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22459
22611
|
labelGrp,
|
|
22460
22612
|
" "
|
|
22461
22613
|
] }),
|
|
22462
22614
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
22463
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22615
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
22464
22616
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22465
22617
|
labelAcc,
|
|
22466
22618
|
" "
|
|
22467
22619
|
] }),
|
|
22468
22620
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
22469
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22621
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
22470
22622
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22471
22623
|
labelRej,
|
|
22472
22624
|
" "
|
|
22473
22625
|
] }),
|
|
22474
22626
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
22475
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22627
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
22476
22628
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22477
22629
|
labelUnd,
|
|
22478
22630
|
" "
|
|
22479
22631
|
] }),
|
|
22480
22632
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
22481
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22633
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 })
|
|
22482
22634
|
] }) });
|
|
22483
22635
|
}
|
|
22484
22636
|
var init_CounterStrip = __esm({
|
|
@@ -23509,7 +23661,7 @@ var init_useImmediateInput = __esm({
|
|
|
23509
23661
|
|
|
23510
23662
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
23511
23663
|
import { useStdout as useStdout2 } from "ink";
|
|
23512
|
-
import { useEffect as
|
|
23664
|
+
import { useEffect as useEffect13, useState as useState14 } from "react";
|
|
23513
23665
|
function readTerminalSize(stdout) {
|
|
23514
23666
|
return {
|
|
23515
23667
|
columns: stdout?.columns ?? 80,
|
|
@@ -23518,8 +23670,8 @@ function readTerminalSize(stdout) {
|
|
|
23518
23670
|
}
|
|
23519
23671
|
function useTerminalSize() {
|
|
23520
23672
|
const { stdout } = useStdout2();
|
|
23521
|
-
const [size, setSize] =
|
|
23522
|
-
|
|
23673
|
+
const [size, setSize] = useState14(() => readTerminalSize(stdout));
|
|
23674
|
+
useEffect13(() => {
|
|
23523
23675
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
23524
23676
|
stdout?.on("resize", updateSize);
|
|
23525
23677
|
updateSize();
|
|
@@ -24246,15 +24398,15 @@ var init_group_collapse = __esm({
|
|
|
24246
24398
|
});
|
|
24247
24399
|
|
|
24248
24400
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
24249
|
-
import { useState as
|
|
24401
|
+
import { useState as useState15 } from "react";
|
|
24250
24402
|
function useSidebarSearchState() {
|
|
24251
|
-
const [searchOpen, setSearchOpen] =
|
|
24252
|
-
const [searchQuery, setSearchQuery] =
|
|
24253
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
24254
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
24255
|
-
const [columnOneView, setColumnOneView] =
|
|
24256
|
-
const [activeFilters, setActiveFilters] =
|
|
24257
|
-
const [showHelp, setShowHelp] =
|
|
24403
|
+
const [searchOpen, setSearchOpen] = useState15(false);
|
|
24404
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
24405
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState15([]);
|
|
24406
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState15(null);
|
|
24407
|
+
const [columnOneView, setColumnOneView] = useState15("grouped");
|
|
24408
|
+
const [activeFilters, setActiveFilters] = useState15(/* @__PURE__ */ new Set());
|
|
24409
|
+
const [showHelp, setShowHelp] = useState15(false);
|
|
24258
24410
|
return {
|
|
24259
24411
|
searchOpen,
|
|
24260
24412
|
setSearchOpen,
|
|
@@ -24279,10 +24431,10 @@ var init_sidebar_search_state = __esm({
|
|
|
24279
24431
|
});
|
|
24280
24432
|
|
|
24281
24433
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
24282
|
-
import { useCallback, useState as
|
|
24434
|
+
import { useCallback, useState as useState16 } from "react";
|
|
24283
24435
|
function useOverlayPanel(opts) {
|
|
24284
24436
|
const { toggleKey, onClose } = opts;
|
|
24285
|
-
const [isOpen, setIsOpen] =
|
|
24437
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
24286
24438
|
const open = useCallback(() => {
|
|
24287
24439
|
setIsOpen(true);
|
|
24288
24440
|
}, []);
|
|
@@ -24521,23 +24673,23 @@ var init_state = __esm({
|
|
|
24521
24673
|
});
|
|
24522
24674
|
|
|
24523
24675
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
24524
|
-
import { useEffect as
|
|
24676
|
+
import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState17 } from "react";
|
|
24525
24677
|
function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
|
|
24526
24678
|
const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
|
|
24527
24679
|
const columnPlan = useMemo3(
|
|
24528
24680
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
24529
24681
|
[totalWidth, tokenCount, tokensWidth]
|
|
24530
24682
|
);
|
|
24531
|
-
const [decisions, setDecisions] =
|
|
24532
|
-
const [nav, setNav] =
|
|
24533
|
-
const [focusedColumn, setFocusedColumn] =
|
|
24534
|
-
const [tokensCursor, setTokensCursor] =
|
|
24535
|
-
const [showDependencies, setShowDependencies] =
|
|
24536
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
24537
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
24683
|
+
const [decisions, setDecisions] = useState17(/* @__PURE__ */ new Map());
|
|
24684
|
+
const [nav, setNav] = useState17({ cursor: 0, scrollOffset: 0 });
|
|
24685
|
+
const [focusedColumn, setFocusedColumn] = useState17("main");
|
|
24686
|
+
const [tokensCursor, setTokensCursor] = useState17(0);
|
|
24687
|
+
const [showDependencies, setShowDependencies] = useState17(false);
|
|
24688
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState17(false);
|
|
24689
|
+
const [cyclesCursor, setCyclesCursor] = useState17(0);
|
|
24538
24690
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
24539
|
-
const [aiCursor, setAiCursor] =
|
|
24540
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
24691
|
+
const [aiCursor, setAiCursor] = useState17(0);
|
|
24692
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState17(null);
|
|
24541
24693
|
const search = useSidebarSearchState();
|
|
24542
24694
|
const {
|
|
24543
24695
|
searchOpen,
|
|
@@ -24562,13 +24714,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24562
24714
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
24563
24715
|
[slotCycles]
|
|
24564
24716
|
);
|
|
24565
|
-
const [expandedGroups, setExpandedGroups] =
|
|
24717
|
+
const [expandedGroups, setExpandedGroups] = useState17(() => {
|
|
24566
24718
|
const seed = new Set(closures.keys());
|
|
24567
24719
|
for (const p of cycleParticipants) seed.add(p);
|
|
24568
24720
|
return seed;
|
|
24569
24721
|
});
|
|
24570
24722
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
24571
|
-
|
|
24723
|
+
useEffect14(() => {
|
|
24572
24724
|
if (seededGroupsRef.current) return;
|
|
24573
24725
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
24574
24726
|
seededGroupsRef.current = true;
|
|
@@ -24659,7 +24811,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24659
24811
|
entryCount: 0
|
|
24660
24812
|
});
|
|
24661
24813
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
24662
|
-
|
|
24814
|
+
useEffect14(() => {
|
|
24663
24815
|
setNav((prev) => {
|
|
24664
24816
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
24665
24817
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -25004,7 +25156,7 @@ var init_use_scope_gate = __esm({
|
|
|
25004
25156
|
});
|
|
25005
25157
|
|
|
25006
25158
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
25007
|
-
import { useEffect as
|
|
25159
|
+
import { useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
25008
25160
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
25009
25161
|
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
25010
25162
|
function ScopeGateScreen({
|
|
@@ -25018,7 +25170,7 @@ function ScopeGateScreen({
|
|
|
25018
25170
|
return loaded?.ok ? loaded.rows : [];
|
|
25019
25171
|
}, [tokensPath]);
|
|
25020
25172
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
25021
|
-
|
|
25173
|
+
useEffect15(() => {
|
|
25022
25174
|
startDebugRun({
|
|
25023
25175
|
flow: "import/scope-gate",
|
|
25024
25176
|
step: "07-scope-gate",
|
|
@@ -25251,13 +25403,13 @@ var init_load2 = __esm({
|
|
|
25251
25403
|
});
|
|
25252
25404
|
|
|
25253
25405
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
25254
|
-
import { useEffect as
|
|
25406
|
+
import { useEffect as useEffect16, useMemo as useMemo5, useRef as useRef10, useState as useState18 } from "react";
|
|
25255
25407
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
25256
25408
|
const sessionId = input?.sessionId;
|
|
25257
25409
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
25258
25410
|
const cacheCheck = useRef10(void 0);
|
|
25259
|
-
const [confirmed, setConfirmed] =
|
|
25260
|
-
|
|
25411
|
+
const [confirmed, setConfirmed] = useState18();
|
|
25412
|
+
useEffect16(() => {
|
|
25261
25413
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
25262
25414
|
startDebugRun({
|
|
25263
25415
|
flow: "import/scope-gate",
|
|
@@ -25271,7 +25423,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
25271
25423
|
exitMethod: "discarded"
|
|
25272
25424
|
});
|
|
25273
25425
|
}, [sessionId, loaded]);
|
|
25274
|
-
|
|
25426
|
+
useEffect16(() => {
|
|
25275
25427
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
25276
25428
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
25277
25429
|
}, [input, loaded]);
|
|
@@ -25597,11 +25749,11 @@ var init_run2 = __esm({
|
|
|
25597
25749
|
});
|
|
25598
25750
|
|
|
25599
25751
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
25600
|
-
import { useEffect as
|
|
25752
|
+
import { useEffect as useEffect17, useRef as useRef11, useState as useState19 } from "react";
|
|
25601
25753
|
function useGeneration(input) {
|
|
25602
|
-
const [state2, setState] =
|
|
25754
|
+
const [state2, setState] = useState19();
|
|
25603
25755
|
const current = useRef11();
|
|
25604
|
-
|
|
25756
|
+
useEffect17(() => {
|
|
25605
25757
|
current.current = input;
|
|
25606
25758
|
if (!input) {
|
|
25607
25759
|
setState(void 0);
|
|
@@ -25646,7 +25798,7 @@ var init_use_generation = __esm({
|
|
|
25646
25798
|
});
|
|
25647
25799
|
|
|
25648
25800
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
25649
|
-
import { join as
|
|
25801
|
+
import { join as join23 } from "node:path";
|
|
25650
25802
|
function buildFlowStart(input) {
|
|
25651
25803
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
25652
25804
|
const credentials = extraction.credentials ?? {
|
|
@@ -25659,7 +25811,7 @@ function buildFlowStart(input) {
|
|
|
25659
25811
|
handoff,
|
|
25660
25812
|
agent: extraction.agent,
|
|
25661
25813
|
projectPath: extraction.projectPath,
|
|
25662
|
-
outDir: extraction.projectPath ?
|
|
25814
|
+
outDir: extraction.projectPath ? join23(extraction.projectPath, ".contentful") : "",
|
|
25663
25815
|
rawTokensPath: extraction.rawTokensPath,
|
|
25664
25816
|
credentials: {
|
|
25665
25817
|
spaceId: credentials.spaceId,
|
|
@@ -26691,7 +26843,7 @@ var init_scroll_offset = __esm({
|
|
|
26691
26843
|
});
|
|
26692
26844
|
|
|
26693
26845
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26694
|
-
import React13, { useEffect as
|
|
26846
|
+
import React13, { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState20 } from "react";
|
|
26695
26847
|
import figures6 from "figures";
|
|
26696
26848
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26697
26849
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -27368,11 +27520,11 @@ function FieldEditor({
|
|
|
27368
27520
|
headerHeight = 2
|
|
27369
27521
|
}) {
|
|
27370
27522
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
27371
|
-
const [editorState, setEditorState] =
|
|
27372
|
-
const [parseErr] =
|
|
27373
|
-
const [listScrollStart, setListScrollStart] =
|
|
27523
|
+
const [editorState, setEditorState] = useState20(initialState);
|
|
27524
|
+
const [parseErr] = useState20(parseError);
|
|
27525
|
+
const [listScrollStart, setListScrollStart] = useState20(0);
|
|
27374
27526
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
27375
|
-
const [rowHeights, setRowHeights] =
|
|
27527
|
+
const [rowHeights, setRowHeights] = useState20({});
|
|
27376
27528
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
27377
27529
|
const initialFocus = (() => {
|
|
27378
27530
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -27440,25 +27592,25 @@ function FieldEditor({
|
|
|
27440
27592
|
textCursor: 0
|
|
27441
27593
|
};
|
|
27442
27594
|
})();
|
|
27443
|
-
const [focusLevel, setFocusLevel] =
|
|
27444
|
-
const [propIdx, setPropIdx] =
|
|
27445
|
-
const [slotIdx, setSlotIdx] =
|
|
27446
|
-
const [inSlots, setInSlots] =
|
|
27447
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
27448
|
-
const [activeField, setActiveField] =
|
|
27449
|
-
const [editingField, setEditingField] =
|
|
27450
|
-
const [textCursor, setTextCursor] =
|
|
27451
|
-
const [valueCursor, setValueCursor] =
|
|
27452
|
-
const [editingValue, setEditingValue] =
|
|
27453
|
-
const [valueText, setValueText] =
|
|
27454
|
-
const [pickerCursor, setPickerCursor] =
|
|
27455
|
-
const [validationError, setValidationError] =
|
|
27456
|
-
const [cursorVisible] =
|
|
27457
|
-
const [sourceOpen, setSourceOpen] =
|
|
27458
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
27459
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
27460
|
-
const [showHelp, setShowHelp] =
|
|
27461
|
-
const [pendingDelete, setPendingDelete] =
|
|
27595
|
+
const [focusLevel, setFocusLevel] = useState20(initialFocus.focusLevel);
|
|
27596
|
+
const [propIdx, setPropIdx] = useState20(initialFocus.propIdx);
|
|
27597
|
+
const [slotIdx, setSlotIdx] = useState20(initialFocus.slotIdx);
|
|
27598
|
+
const [inSlots, setInSlots] = useState20(initialFocus.inSlots);
|
|
27599
|
+
const [inComponentDesc, setInComponentDesc] = useState20(initialFocus.focusLevel === "componentDescription");
|
|
27600
|
+
const [activeField, setActiveField] = useState20(initialFocus.activeField);
|
|
27601
|
+
const [editingField, setEditingField] = useState20(false);
|
|
27602
|
+
const [textCursor, setTextCursor] = useState20(initialFocus.textCursor);
|
|
27603
|
+
const [valueCursor, setValueCursor] = useState20(0);
|
|
27604
|
+
const [editingValue, setEditingValue] = useState20(null);
|
|
27605
|
+
const [valueText, setValueText] = useState20("");
|
|
27606
|
+
const [pickerCursor, setPickerCursor] = useState20(0);
|
|
27607
|
+
const [validationError, setValidationError] = useState20(null);
|
|
27608
|
+
const [cursorVisible] = useState20(true);
|
|
27609
|
+
const [sourceOpen, setSourceOpen] = useState20(false);
|
|
27610
|
+
const [rationaleOpen, setRationaleOpen] = useState20(false);
|
|
27611
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState20(0);
|
|
27612
|
+
const [showHelp, setShowHelp] = useState20(false);
|
|
27613
|
+
const [pendingDelete, setPendingDelete] = useState20(null);
|
|
27462
27614
|
const props = editorState.props;
|
|
27463
27615
|
const slots = editorState.slots;
|
|
27464
27616
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -28218,7 +28370,7 @@ function FieldEditor({
|
|
|
28218
28370
|
}
|
|
28219
28371
|
return Math.max(start + 1, end2);
|
|
28220
28372
|
};
|
|
28221
|
-
|
|
28373
|
+
useEffect18(() => {
|
|
28222
28374
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
28223
28375
|
setListScrollStart((previous) => {
|
|
28224
28376
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -29613,7 +29765,7 @@ var init_FinalizeDialog = __esm({
|
|
|
29613
29765
|
});
|
|
29614
29766
|
|
|
29615
29767
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
29616
|
-
import { useEffect as
|
|
29768
|
+
import { useEffect as useEffect19, useRef as useRef12, useState as useState21 } from "react";
|
|
29617
29769
|
function useReviewFinalizePreview({
|
|
29618
29770
|
components,
|
|
29619
29771
|
...options
|
|
@@ -29625,12 +29777,12 @@ function useReviewFinalizePreview({
|
|
|
29625
29777
|
}
|
|
29626
29778
|
function useFinalizePreview(opts) {
|
|
29627
29779
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
29628
|
-
const [status, setStatus] =
|
|
29629
|
-
const [removed, setRemoved] =
|
|
29630
|
-
const [scrollOffset, setScrollOffset] =
|
|
29780
|
+
const [status, setStatus] = useState21("idle");
|
|
29781
|
+
const [removed, setRemoved] = useState21([]);
|
|
29782
|
+
const [scrollOffset, setScrollOffset] = useState21(0);
|
|
29631
29783
|
const generationRef = useRef12(0);
|
|
29632
29784
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
29633
|
-
|
|
29785
|
+
useEffect19(() => {
|
|
29634
29786
|
if (!open) {
|
|
29635
29787
|
setStatus("idle");
|
|
29636
29788
|
setRemoved([]);
|
|
@@ -29682,16 +29834,16 @@ var init_use_finalize_preview = __esm({
|
|
|
29682
29834
|
});
|
|
29683
29835
|
|
|
29684
29836
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
29685
|
-
import { useCallback as useCallback2, useEffect as
|
|
29837
|
+
import { useCallback as useCallback2, useEffect as useEffect20, useRef as useRef13, useState as useState22 } from "react";
|
|
29686
29838
|
function useReviewSession({
|
|
29687
29839
|
loadSession,
|
|
29688
29840
|
tokensPath,
|
|
29689
29841
|
onExtraLoaded
|
|
29690
29842
|
}) {
|
|
29691
|
-
const [components, setComponents] =
|
|
29692
|
-
const [loading, setLoading] =
|
|
29693
|
-
const [loadError, setLoadError] =
|
|
29694
|
-
const [availableTokens, setAvailableTokens] =
|
|
29843
|
+
const [components, setComponents] = useState22([]);
|
|
29844
|
+
const [loading, setLoading] = useState22(true);
|
|
29845
|
+
const [loadError, setLoadError] = useState22(null);
|
|
29846
|
+
const [availableTokens, setAvailableTokens] = useState22([]);
|
|
29695
29847
|
const loadInitialState = useCallback2(async () => {
|
|
29696
29848
|
const result = loadSession();
|
|
29697
29849
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -29701,7 +29853,7 @@ function useReviewSession({
|
|
|
29701
29853
|
}));
|
|
29702
29854
|
return { result, catalog };
|
|
29703
29855
|
}, [loadSession, tokensPath]);
|
|
29704
|
-
|
|
29856
|
+
useEffect20(() => {
|
|
29705
29857
|
let disposed = false;
|
|
29706
29858
|
void (async () => {
|
|
29707
29859
|
try {
|
|
@@ -29752,9 +29904,9 @@ function useReviewSession({
|
|
|
29752
29904
|
};
|
|
29753
29905
|
}
|
|
29754
29906
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29755
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
29756
|
-
const [componentRationale, setComponentRationale] =
|
|
29757
|
-
|
|
29907
|
+
const [reviewMetadata, setReviewMetadata] = useState22(null);
|
|
29908
|
+
const [componentRationale, setComponentRationale] = useState22(null);
|
|
29909
|
+
useEffect20(() => {
|
|
29758
29910
|
const current = components[selectedIdx];
|
|
29759
29911
|
if (!current) {
|
|
29760
29912
|
setReviewMetadata(null);
|
|
@@ -29792,7 +29944,7 @@ function useReviewHistory({
|
|
|
29792
29944
|
}) {
|
|
29793
29945
|
const historyRef = useRef13(null);
|
|
29794
29946
|
const historySeededRef = useRef13(false);
|
|
29795
|
-
|
|
29947
|
+
useEffect20(() => {
|
|
29796
29948
|
if (loading || historySeededRef.current) return;
|
|
29797
29949
|
historySeededRef.current = true;
|
|
29798
29950
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -29879,7 +30031,7 @@ var init_token_suggestions = __esm({
|
|
|
29879
30031
|
});
|
|
29880
30032
|
|
|
29881
30033
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
29882
|
-
import { useEffect as
|
|
30034
|
+
import { useEffect as useEffect21, useRef as useRef14, useState as useState23 } from "react";
|
|
29883
30035
|
function parseReviewEntry(draftValue) {
|
|
29884
30036
|
const parsed = JSON.parse(draftValue);
|
|
29885
30037
|
const keys = Object.keys(parsed);
|
|
@@ -29899,21 +30051,21 @@ function useReviewEditor({
|
|
|
29899
30051
|
onEditSaved,
|
|
29900
30052
|
onTokenSaved
|
|
29901
30053
|
}) {
|
|
29902
|
-
const [panelOpen, setPanelOpen] =
|
|
29903
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
29904
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
29905
|
-
const [textEntryActive, setTextEntryActive] =
|
|
29906
|
-
const [showJson, setShowJson] =
|
|
29907
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
29908
|
-
const [draftValue, setDraftValue] =
|
|
29909
|
-
const [saveError, setSaveError] =
|
|
29910
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
29911
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
29912
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
29913
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
30054
|
+
const [panelOpen, setPanelOpen] = useState23("none");
|
|
30055
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState23(0);
|
|
30056
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState23(0);
|
|
30057
|
+
const [textEntryActive, setTextEntryActive] = useState23(false);
|
|
30058
|
+
const [showJson, setShowJson] = useState23(false);
|
|
30059
|
+
const [showHiddenProps, setShowHiddenProps] = useState23(false);
|
|
30060
|
+
const [draftValue, setDraftValue] = useState23("");
|
|
30061
|
+
const [saveError, setSaveError] = useState23(null);
|
|
30062
|
+
const [tokenReviewRow, setTokenReviewRow] = useState23(0);
|
|
30063
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState23(false);
|
|
30064
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState23(0);
|
|
30065
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState23(/* @__PURE__ */ new Set());
|
|
29914
30066
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
29915
30067
|
const pendingGRef = useRef14(false);
|
|
29916
|
-
|
|
30068
|
+
useEffect21(() => {
|
|
29917
30069
|
setTokenReviewRow(0);
|
|
29918
30070
|
setTokenReviewEditing(false);
|
|
29919
30071
|
setTokenReviewEditCursor(0);
|
|
@@ -30033,12 +30185,12 @@ var init_use_review_editor = __esm({
|
|
|
30033
30185
|
});
|
|
30034
30186
|
|
|
30035
30187
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
30036
|
-
import { useState as
|
|
30188
|
+
import { useState as useState24 } from "react";
|
|
30037
30189
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
30038
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
30039
|
-
const [showFinalize, setShowFinalize] =
|
|
30040
|
-
const [showQuit, setShowQuit] =
|
|
30041
|
-
const [finalizeError, setFinalizeError] =
|
|
30190
|
+
const [sidebarFocused, setSidebarFocused] = useState24(true);
|
|
30191
|
+
const [showFinalize, setShowFinalize] = useState24(false);
|
|
30192
|
+
const [showQuit, setShowQuit] = useState24(false);
|
|
30193
|
+
const [finalizeError, setFinalizeError] = useState24(initialFinalizeError);
|
|
30042
30194
|
return {
|
|
30043
30195
|
sidebarFocused,
|
|
30044
30196
|
setSidebarFocused,
|
|
@@ -30395,24 +30547,24 @@ var init_preview_annotations = __esm({
|
|
|
30395
30547
|
});
|
|
30396
30548
|
|
|
30397
30549
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
30398
|
-
import { useCallback as useCallback3, useEffect as
|
|
30550
|
+
import { useCallback as useCallback3, useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
|
|
30399
30551
|
function useLivePreview(opts) {
|
|
30400
30552
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
30401
|
-
const [status, setStatus] =
|
|
30402
|
-
const [disabled, setDisabled] =
|
|
30553
|
+
const [status, setStatus] = useState25("idle");
|
|
30554
|
+
const [disabled, setDisabled] = useState25(false);
|
|
30403
30555
|
const timerRef = useRef15(null);
|
|
30404
30556
|
const generationRef = useRef15(0);
|
|
30405
30557
|
const latestRef = useRef15(0);
|
|
30406
30558
|
const inflightRef = useRef15(0);
|
|
30407
30559
|
const optsRef = useRef15(opts);
|
|
30408
|
-
|
|
30560
|
+
useEffect22(() => {
|
|
30409
30561
|
optsRef.current = opts;
|
|
30410
30562
|
});
|
|
30411
30563
|
const disabledRef = useRef15(disabled);
|
|
30412
|
-
|
|
30564
|
+
useEffect22(() => {
|
|
30413
30565
|
disabledRef.current = disabled;
|
|
30414
30566
|
}, [disabled]);
|
|
30415
|
-
|
|
30567
|
+
useEffect22(() => {
|
|
30416
30568
|
return () => {
|
|
30417
30569
|
if (timerRef.current) {
|
|
30418
30570
|
clearTimeout(timerRef.current);
|
|
@@ -30493,7 +30645,7 @@ var init_use_live_preview = __esm({
|
|
|
30493
30645
|
});
|
|
30494
30646
|
|
|
30495
30647
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
30496
|
-
import { useCallback as useCallback4, useEffect as
|
|
30648
|
+
import { useCallback as useCallback4, useEffect as useEffect23, useState as useState26 } from "react";
|
|
30497
30649
|
function useReviewPreview({
|
|
30498
30650
|
components,
|
|
30499
30651
|
loading,
|
|
@@ -30507,8 +30659,8 @@ function useReviewPreview({
|
|
|
30507
30659
|
deleteAllComponents,
|
|
30508
30660
|
onResult
|
|
30509
30661
|
}) {
|
|
30510
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
30511
|
-
const [removedComponents, setRemovedComponents] =
|
|
30662
|
+
const [previewAnnotations, setPreviewAnnotations] = useState26(/* @__PURE__ */ new Map());
|
|
30663
|
+
const [removedComponents, setRemovedComponents] = useState26([]);
|
|
30512
30664
|
const handleResult = useCallback4(
|
|
30513
30665
|
(response) => {
|
|
30514
30666
|
if (!response) return;
|
|
@@ -30534,14 +30686,14 @@ function useReviewPreview({
|
|
|
30534
30686
|
onResult: handleResult,
|
|
30535
30687
|
deleteAllComponents
|
|
30536
30688
|
});
|
|
30537
|
-
const [spinnerTick, setSpinnerTick] =
|
|
30538
|
-
|
|
30689
|
+
const [spinnerTick, setSpinnerTick] = useState26(0);
|
|
30690
|
+
useEffect23(() => {
|
|
30539
30691
|
if (livePreviewHook.status !== "running") return;
|
|
30540
30692
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
30541
30693
|
return () => clearInterval(id);
|
|
30542
30694
|
}, [livePreviewHook.status]);
|
|
30543
30695
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
30544
|
-
|
|
30696
|
+
useEffect23(() => {
|
|
30545
30697
|
if (loading) return;
|
|
30546
30698
|
if (!livePreview) return;
|
|
30547
30699
|
if (components.length === 0) return;
|
|
@@ -30626,7 +30778,7 @@ var init_review_log = __esm({
|
|
|
30626
30778
|
});
|
|
30627
30779
|
|
|
30628
30780
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
30629
|
-
import { useEffect as
|
|
30781
|
+
import { useEffect as useEffect24, useRef as useRef16 } from "react";
|
|
30630
30782
|
function useReviewLog({
|
|
30631
30783
|
loading,
|
|
30632
30784
|
loadError,
|
|
@@ -30636,7 +30788,7 @@ function useReviewLog({
|
|
|
30636
30788
|
const started = useRef16(false);
|
|
30637
30789
|
const latest = useRef16(components);
|
|
30638
30790
|
latest.current = components;
|
|
30639
|
-
|
|
30791
|
+
useEffect24(() => {
|
|
30640
30792
|
if (loading || started.current) return;
|
|
30641
30793
|
started.current = true;
|
|
30642
30794
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -30651,7 +30803,7 @@ function useReviewLog({
|
|
|
30651
30803
|
trail.current = openReviewTrail(components, Date.now());
|
|
30652
30804
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
30653
30805
|
}, [loading, loadError, components]);
|
|
30654
|
-
|
|
30806
|
+
useEffect24(
|
|
30655
30807
|
() => () => {
|
|
30656
30808
|
const open = trail.current;
|
|
30657
30809
|
trail.current = void 0;
|
|
@@ -30719,7 +30871,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
30719
30871
|
});
|
|
30720
30872
|
|
|
30721
30873
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
30722
|
-
import { useCallback as useCallback5, useEffect as
|
|
30874
|
+
import { useCallback as useCallback5, useEffect as useEffect25, useMemo as useMemo6, useRef as useRef17, useState as useState27 } from "react";
|
|
30723
30875
|
import figures8 from "figures";
|
|
30724
30876
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
30725
30877
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -30884,7 +31036,7 @@ function GenerateReviewStepView({
|
|
|
30884
31036
|
initialFinalizeError = null
|
|
30885
31037
|
}) {
|
|
30886
31038
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
30887
|
-
const [slotCycles, setSlotCycles] =
|
|
31039
|
+
const [slotCycles, setSlotCycles] = useState27([]);
|
|
30888
31040
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
30889
31041
|
setSlotCycles(cycles ?? []);
|
|
30890
31042
|
}, []);
|
|
@@ -30917,7 +31069,7 @@ function GenerateReviewStepView({
|
|
|
30917
31069
|
onExtraLoaded: setLoadedSlotCycles
|
|
30918
31070
|
});
|
|
30919
31071
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
30920
|
-
const [nav, setNav] =
|
|
31072
|
+
const [nav, setNav] = useState27({
|
|
30921
31073
|
cursorRowIdx: 0,
|
|
30922
31074
|
sidebarScrollOffset: 0
|
|
30923
31075
|
});
|
|
@@ -30933,10 +31085,10 @@ function GenerateReviewStepView({
|
|
|
30933
31085
|
finalizeError,
|
|
30934
31086
|
setFinalizeError
|
|
30935
31087
|
} = reviewSurface;
|
|
30936
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
31088
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState27(false);
|
|
30937
31089
|
const removedBannerDefaultedRef = useRef17(false);
|
|
30938
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
30939
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
31090
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState27(0);
|
|
31091
|
+
const [cyclesCursor, setCyclesCursor] = useState27(0);
|
|
30940
31092
|
const cyclePanel = useOverlayPanel({
|
|
30941
31093
|
toggleKey: "c",
|
|
30942
31094
|
onClose: () => {
|
|
@@ -30951,9 +31103,9 @@ function GenerateReviewStepView({
|
|
|
30951
31103
|
setBreakConfirm(false);
|
|
30952
31104
|
}
|
|
30953
31105
|
});
|
|
30954
|
-
const [breakCursor, setBreakCursor] =
|
|
30955
|
-
const [breakConfirm, setBreakConfirm] =
|
|
30956
|
-
const [expandedGroups, setExpandedGroups] =
|
|
31106
|
+
const [breakCursor, setBreakCursor] = useState27(0);
|
|
31107
|
+
const [breakConfirm, setBreakConfirm] = useState27(false);
|
|
31108
|
+
const [expandedGroups, setExpandedGroups] = useState27(/* @__PURE__ */ new Set());
|
|
30957
31109
|
const seededGroupsRef = useRef17(false);
|
|
30958
31110
|
const {
|
|
30959
31111
|
searchOpen,
|
|
@@ -30972,14 +31124,14 @@ function GenerateReviewStepView({
|
|
|
30972
31124
|
setShowHelp
|
|
30973
31125
|
} = useSidebarSearchState();
|
|
30974
31126
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
30975
|
-
const [breakingChanges, setBreakingChanges] =
|
|
30976
|
-
const [breakingCursor, setBreakingCursor] =
|
|
30977
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
30978
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
30979
|
-
const [autoRejected, setAutoRejected] =
|
|
30980
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
31127
|
+
const [breakingChanges, setBreakingChanges] = useState27([]);
|
|
31128
|
+
const [breakingCursor, setBreakingCursor] = useState27(0);
|
|
31129
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState27(false);
|
|
31130
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState27(null);
|
|
31131
|
+
const [autoRejected, setAutoRejected] = useState27([]);
|
|
31132
|
+
const [undoSnapshot, setUndoSnapshot] = useState27(null);
|
|
30981
31133
|
const autoRejectFiredRef = useRef17(false);
|
|
30982
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
31134
|
+
const [showReloadDialog, setShowReloadDialog] = useState27(false);
|
|
30983
31135
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
30984
31136
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
30985
31137
|
components,
|
|
@@ -31044,7 +31196,7 @@ function GenerateReviewStepView({
|
|
|
31044
31196
|
[components]
|
|
31045
31197
|
);
|
|
31046
31198
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
31047
|
-
|
|
31199
|
+
useEffect25(() => {
|
|
31048
31200
|
if (seededGroupsRef.current) return;
|
|
31049
31201
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
31050
31202
|
seededGroupsRef.current = true;
|
|
@@ -31071,7 +31223,7 @@ function GenerateReviewStepView({
|
|
|
31071
31223
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
31072
31224
|
}));
|
|
31073
31225
|
}, [slotCycles, cycleView]);
|
|
31074
|
-
|
|
31226
|
+
useEffect25(() => {
|
|
31075
31227
|
const decision = computeAutoRejectDecision({
|
|
31076
31228
|
loading,
|
|
31077
31229
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -31116,7 +31268,7 @@ function GenerateReviewStepView({
|
|
|
31116
31268
|
onAction: reviewLog.record
|
|
31117
31269
|
});
|
|
31118
31270
|
const autoRejectPushedRef = useRef17(false);
|
|
31119
|
-
|
|
31271
|
+
useEffect25(() => {
|
|
31120
31272
|
if (loading) return;
|
|
31121
31273
|
if (!historySeededRef.current) return;
|
|
31122
31274
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -31200,7 +31352,7 @@ function GenerateReviewStepView({
|
|
|
31200
31352
|
const panelHeight = leftPanelHeight + 2;
|
|
31201
31353
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
31202
31354
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
31203
|
-
|
|
31355
|
+
useEffect25(() => {
|
|
31204
31356
|
if (selectableRowPositions.length === 0) return;
|
|
31205
31357
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
31206
31358
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -32283,10 +32435,10 @@ var init_path_utils = __esm({
|
|
|
32283
32435
|
});
|
|
32284
32436
|
|
|
32285
32437
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
32286
|
-
import { useEffect as
|
|
32438
|
+
import { useEffect as useEffect26, useState as useState28 } from "react";
|
|
32287
32439
|
function useBlinkingCursor() {
|
|
32288
|
-
const [visible, setVisible] =
|
|
32289
|
-
|
|
32440
|
+
const [visible, setVisible] = useState28(true);
|
|
32441
|
+
useEffect26(() => {
|
|
32290
32442
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
32291
32443
|
return () => clearInterval(interval);
|
|
32292
32444
|
}, []);
|
|
@@ -32299,16 +32451,16 @@ var init_use_blinking_cursor = __esm({
|
|
|
32299
32451
|
});
|
|
32300
32452
|
|
|
32301
32453
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
32302
|
-
import { useState as
|
|
32454
|
+
import { useState as useState29 } from "react";
|
|
32303
32455
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
32304
32456
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
32305
|
-
import { dirname as dirname17, basename as
|
|
32457
|
+
import { dirname as dirname17, basename as basename7, join as join24 } from "node:path";
|
|
32306
32458
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
32307
32459
|
function autocomplete(partial) {
|
|
32308
32460
|
if (!partial) return null;
|
|
32309
32461
|
const normalized = normalizePath(partial);
|
|
32310
32462
|
const dir = dirname17(normalized);
|
|
32311
|
-
const base =
|
|
32463
|
+
const base = basename7(normalized);
|
|
32312
32464
|
let entries;
|
|
32313
32465
|
try {
|
|
32314
32466
|
entries = readdirSync4(dir);
|
|
@@ -32317,13 +32469,13 @@ function autocomplete(partial) {
|
|
|
32317
32469
|
}
|
|
32318
32470
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
32319
32471
|
if (matches.length === 0) return null;
|
|
32320
|
-
if (matches.length === 1) return
|
|
32472
|
+
if (matches.length === 1) return join24(dir, matches[0]);
|
|
32321
32473
|
let prefix = matches[0];
|
|
32322
32474
|
for (const m of matches) {
|
|
32323
32475
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
32324
32476
|
if (!prefix) break;
|
|
32325
32477
|
}
|
|
32326
|
-
return prefix.length > base.length ?
|
|
32478
|
+
return prefix.length > base.length ? join24(dir, prefix) : null;
|
|
32327
32479
|
}
|
|
32328
32480
|
function PathPrompt({
|
|
32329
32481
|
defaultPath,
|
|
@@ -32332,7 +32484,7 @@ function PathPrompt({
|
|
|
32332
32484
|
label = "Save to",
|
|
32333
32485
|
summary
|
|
32334
32486
|
}) {
|
|
32335
|
-
const [input, setInput] =
|
|
32487
|
+
const [input, setInput] = useState29("");
|
|
32336
32488
|
const cursorVisible = useBlinkingCursor();
|
|
32337
32489
|
useImmediateInput((rawInput, key) => {
|
|
32338
32490
|
if (key.return) {
|
|
@@ -32423,12 +32575,12 @@ var init_produced = __esm({
|
|
|
32423
32575
|
});
|
|
32424
32576
|
|
|
32425
32577
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
32426
|
-
import { useEffect as
|
|
32578
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
32427
32579
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
32428
32580
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
32429
32581
|
function useTimedSpinner() {
|
|
32430
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
32431
|
-
|
|
32582
|
+
const [elapsedSeconds, setElapsedSeconds] = useState30(0);
|
|
32583
|
+
useEffect27(() => {
|
|
32432
32584
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
32433
32585
|
return () => {
|
|
32434
32586
|
clearInterval(timer);
|
|
@@ -32701,7 +32853,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
32701
32853
|
});
|
|
32702
32854
|
|
|
32703
32855
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
32704
|
-
import { useEffect as
|
|
32856
|
+
import { useEffect as useEffect28, useState as useState31, useMemo as useMemo7 } from "react";
|
|
32705
32857
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
32706
32858
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
32707
32859
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -32895,8 +33047,8 @@ function WizardPreviewStep({
|
|
|
32895
33047
|
onQuit
|
|
32896
33048
|
}) {
|
|
32897
33049
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
32898
|
-
const [diffExpanded, setDiffExpanded] =
|
|
32899
|
-
const [scrollOffset, setScrollOffset] =
|
|
33050
|
+
const [diffExpanded, setDiffExpanded] = useState31(false);
|
|
33051
|
+
const [scrollOffset, setScrollOffset] = useState31(0);
|
|
32900
33052
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
32901
33053
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
32902
33054
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -32911,7 +33063,7 @@ function WizardPreviewStep({
|
|
|
32911
33063
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
32912
33064
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
32913
33065
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
32914
|
-
|
|
33066
|
+
useEffect28(() => {
|
|
32915
33067
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
32916
33068
|
}, [maxScroll]);
|
|
32917
33069
|
useImmediateInput((input, key) => {
|
|
@@ -33178,11 +33330,11 @@ var init_flow_log = __esm({
|
|
|
33178
33330
|
});
|
|
33179
33331
|
|
|
33180
33332
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
33181
|
-
import { useEffect as
|
|
33333
|
+
import { useEffect as useEffect29, useRef as useRef18 } from "react";
|
|
33182
33334
|
function useFlowLog(state2) {
|
|
33183
33335
|
const trail = useRef18(void 0);
|
|
33184
33336
|
const previous = useRef18(void 0);
|
|
33185
|
-
|
|
33337
|
+
useEffect29(() => {
|
|
33186
33338
|
const before = previous.current;
|
|
33187
33339
|
previous.current = state2;
|
|
33188
33340
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -33205,7 +33357,7 @@ function useFlowLog(state2) {
|
|
|
33205
33357
|
trail.current = open;
|
|
33206
33358
|
setDebugRunProgress(flowProgress(open, now));
|
|
33207
33359
|
}, [state2]);
|
|
33208
|
-
|
|
33360
|
+
useEffect29(
|
|
33209
33361
|
() => () => {
|
|
33210
33362
|
const open = trail.current;
|
|
33211
33363
|
trail.current = void 0;
|
|
@@ -33752,8 +33904,8 @@ var init_run_print_files_helpers = __esm({
|
|
|
33752
33904
|
});
|
|
33753
33905
|
|
|
33754
33906
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
33755
|
-
import { writeFile as
|
|
33756
|
-
import { join as
|
|
33907
|
+
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
33908
|
+
import { join as join25 } from "node:path";
|
|
33757
33909
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
33758
33910
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
33759
33911
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -33765,7 +33917,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
33765
33917
|
}
|
|
33766
33918
|
async function runPrintFiles(input, deps, onPatch) {
|
|
33767
33919
|
onPatch({ step: "printing" });
|
|
33768
|
-
const componentsPath =
|
|
33920
|
+
const componentsPath = join25(input.outDir, "components.json");
|
|
33769
33921
|
try {
|
|
33770
33922
|
const db = deps.openDb();
|
|
33771
33923
|
let components = [];
|
|
@@ -33854,7 +34006,7 @@ var init_save = __esm({
|
|
|
33854
34006
|
realSaveDeps = () => ({
|
|
33855
34007
|
openDb: openPipelineDb,
|
|
33856
34008
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
33857
|
-
writeFile: (path5, contents) =>
|
|
34009
|
+
writeFile: (path5, contents) => writeFile9(path5, contents),
|
|
33858
34010
|
appendRun,
|
|
33859
34011
|
buildSourceFingerprint,
|
|
33860
34012
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -33879,7 +34031,7 @@ var init_types9 = __esm({
|
|
|
33879
34031
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
33880
34032
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
33881
34033
|
import { tmpdir } from "node:os";
|
|
33882
|
-
import { join as
|
|
34034
|
+
import { join as join26, resolve as resolve27 } from "node:path";
|
|
33883
34035
|
function appendWizardLog(entry) {
|
|
33884
34036
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
33885
34037
|
}
|
|
@@ -34164,12 +34316,12 @@ var init_controller = __esm({
|
|
|
34164
34316
|
init_push();
|
|
34165
34317
|
init_save();
|
|
34166
34318
|
init_types9();
|
|
34167
|
-
WIZARD_LOG =
|
|
34319
|
+
WIZARD_LOG = join26(tmpdir(), "experiences-import-wizard.log");
|
|
34168
34320
|
}
|
|
34169
34321
|
});
|
|
34170
34322
|
|
|
34171
34323
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
34172
|
-
import { useEffect as
|
|
34324
|
+
import { useEffect as useEffect30, useRef as useRef19, useSyncExternalStore } from "react";
|
|
34173
34325
|
function useFlow(start, options = {}) {
|
|
34174
34326
|
const controller = useRef19();
|
|
34175
34327
|
if (start && !controller.current) {
|
|
@@ -34188,7 +34340,7 @@ function useFlow(start, options = {}) {
|
|
|
34188
34340
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
34189
34341
|
() => current?.getState()
|
|
34190
34342
|
);
|
|
34191
|
-
|
|
34343
|
+
useEffect30(() => {
|
|
34192
34344
|
if (!start) controller.current = void 0;
|
|
34193
34345
|
}, [start]);
|
|
34194
34346
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
@@ -34201,7 +34353,7 @@ var init_use_flow = __esm({
|
|
|
34201
34353
|
});
|
|
34202
34354
|
|
|
34203
34355
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
34204
|
-
import { join as
|
|
34356
|
+
import { join as join27, resolve as resolve28 } from "node:path";
|
|
34205
34357
|
function describeFileLocations({
|
|
34206
34358
|
contentfulBaseDir,
|
|
34207
34359
|
debugModeEnabled,
|
|
@@ -34210,14 +34362,14 @@ function describeFileLocations({
|
|
|
34210
34362
|
if (!debugModeEnabled) {
|
|
34211
34363
|
return {
|
|
34212
34364
|
debugLogs: "none while Debug Mode is off",
|
|
34213
|
-
importFiles: `${
|
|
34365
|
+
importFiles: `${join27("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
34214
34366
|
};
|
|
34215
34367
|
}
|
|
34216
34368
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
34217
|
-
const session = currentSessionDir2 ??
|
|
34369
|
+
const session = currentSessionDir2 ?? join27(base, ".contentful", "<date>-session-<n>");
|
|
34218
34370
|
return {
|
|
34219
|
-
debugLogs:
|
|
34220
|
-
importFiles: `${
|
|
34371
|
+
debugLogs: join27(session, "debug"),
|
|
34372
|
+
importFiles: `${join27(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
34221
34373
|
};
|
|
34222
34374
|
}
|
|
34223
34375
|
var init_file_locations = __esm({
|
|
@@ -34267,7 +34419,7 @@ var init_help_info = __esm({
|
|
|
34267
34419
|
});
|
|
34268
34420
|
|
|
34269
34421
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
34270
|
-
import { useEffect as
|
|
34422
|
+
import { useEffect as useEffect31, useState as useState32 } from "react";
|
|
34271
34423
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
34272
34424
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
34273
34425
|
function Section({ title, rows }) {
|
|
@@ -34280,8 +34432,8 @@ function Section({ title, rows }) {
|
|
|
34280
34432
|
] });
|
|
34281
34433
|
}
|
|
34282
34434
|
function HelpScreen({ onDone }) {
|
|
34283
|
-
const [info, setInfo] =
|
|
34284
|
-
|
|
34435
|
+
const [info, setInfo] = useState32();
|
|
34436
|
+
useEffect31(() => {
|
|
34285
34437
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
34286
34438
|
void readHelpInfo().then(setInfo);
|
|
34287
34439
|
}, []);
|
|
@@ -34328,14 +34480,14 @@ var init_PageContainer2 = __esm({
|
|
|
34328
34480
|
});
|
|
34329
34481
|
|
|
34330
34482
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
34331
|
-
import { useState as
|
|
34483
|
+
import { useState as useState33 } from "react";
|
|
34332
34484
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
34333
34485
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
34334
34486
|
function SettingsScreen({
|
|
34335
34487
|
onNavigate,
|
|
34336
34488
|
onBack
|
|
34337
34489
|
}) {
|
|
34338
|
-
const [focusIdx, setFocusIdx] =
|
|
34490
|
+
const [focusIdx, setFocusIdx] = useState33(0);
|
|
34339
34491
|
const items = [
|
|
34340
34492
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
34341
34493
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -34663,7 +34815,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
34663
34815
|
});
|
|
34664
34816
|
|
|
34665
34817
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
34666
|
-
import { useEffect as
|
|
34818
|
+
import { useEffect as useEffect32, useState as useState34 } from "react";
|
|
34667
34819
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
34668
34820
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
34669
34821
|
function StatusHeading() {
|
|
@@ -34680,11 +34832,11 @@ function AgentDetail({
|
|
|
34680
34832
|
record: record3
|
|
34681
34833
|
}) {
|
|
34682
34834
|
const settings = config.agents[name];
|
|
34683
|
-
const [saving, setSaving] =
|
|
34684
|
-
const [testing, setTesting] =
|
|
34685
|
-
const [notice, setNotice] =
|
|
34686
|
-
const [checks, setChecks] =
|
|
34687
|
-
|
|
34835
|
+
const [saving, setSaving] = useState34(false);
|
|
34836
|
+
const [testing, setTesting] = useState34(false);
|
|
34837
|
+
const [notice, setNotice] = useState34(null);
|
|
34838
|
+
const [checks, setChecks] = useState34(void 0);
|
|
34839
|
+
useEffect32(() => {
|
|
34688
34840
|
let active = true;
|
|
34689
34841
|
setChecks(void 0);
|
|
34690
34842
|
const timer = setTimeout(() => {
|
|
@@ -34776,17 +34928,17 @@ var init_AgentDetail = __esm({
|
|
|
34776
34928
|
});
|
|
34777
34929
|
|
|
34778
34930
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
34779
|
-
import { useEffect as
|
|
34931
|
+
import { useEffect as useEffect33, useRef as useRef20, useState as useState35 } from "react";
|
|
34780
34932
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
34781
34933
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
34782
34934
|
function AgentsScreen({ onDone }) {
|
|
34783
|
-
const [config, setConfig] =
|
|
34784
|
-
const [focus, setFocus] =
|
|
34785
|
-
const [open, setOpen] =
|
|
34786
|
-
const [notice, setNotice] =
|
|
34787
|
-
const [saving, setSaving] =
|
|
34788
|
-
const [loadError, setLoadError] =
|
|
34789
|
-
const [checks, setChecks] =
|
|
34935
|
+
const [config, setConfig] = useState35(null);
|
|
34936
|
+
const [focus, setFocus] = useState35(0);
|
|
34937
|
+
const [open, setOpen] = useState35(null);
|
|
34938
|
+
const [notice, setNotice] = useState35(null);
|
|
34939
|
+
const [saving, setSaving] = useState35(false);
|
|
34940
|
+
const [loadError, setLoadError] = useState35(null);
|
|
34941
|
+
const [checks, setChecks] = useState35({});
|
|
34790
34942
|
const visit = useRef20({
|
|
34791
34943
|
trail: createTrail(),
|
|
34792
34944
|
before: void 0,
|
|
@@ -34800,7 +34952,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34800
34952
|
);
|
|
34801
34953
|
}
|
|
34802
34954
|
};
|
|
34803
|
-
|
|
34955
|
+
useEffect33(() => {
|
|
34804
34956
|
readAgentConfig().then((loaded) => {
|
|
34805
34957
|
setConfig(loaded);
|
|
34806
34958
|
inspectAll(loaded);
|
|
@@ -35026,7 +35178,7 @@ var init_project_store = __esm({
|
|
|
35026
35178
|
});
|
|
35027
35179
|
|
|
35028
35180
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
35029
|
-
import { useEffect as
|
|
35181
|
+
import { useEffect as useEffect34, useRef as useRef21, useState as useState36 } from "react";
|
|
35030
35182
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
35031
35183
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
35032
35184
|
function debugFields(config) {
|
|
@@ -35041,10 +35193,10 @@ function debugFields(config) {
|
|
|
35041
35193
|
};
|
|
35042
35194
|
}
|
|
35043
35195
|
function ProjectScreen({ onDone }) {
|
|
35044
|
-
const [config, setConfig] =
|
|
35045
|
-
const [saving, setSaving] =
|
|
35046
|
-
const [notice, setNotice] =
|
|
35047
|
-
const [loadError, setLoadError] =
|
|
35196
|
+
const [config, setConfig] = useState36(null);
|
|
35197
|
+
const [saving, setSaving] = useState36(false);
|
|
35198
|
+
const [notice, setNotice] = useState36(null);
|
|
35199
|
+
const [loadError, setLoadError] = useState36(null);
|
|
35048
35200
|
const visit = useRef21({
|
|
35049
35201
|
trail: createTrail(),
|
|
35050
35202
|
before: void 0,
|
|
@@ -35052,7 +35204,7 @@ function ProjectScreen({ onDone }) {
|
|
|
35052
35204
|
error: ""
|
|
35053
35205
|
}).current;
|
|
35054
35206
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
35055
|
-
|
|
35207
|
+
useEffect34(() => {
|
|
35056
35208
|
readCredentials().then((cfg) => {
|
|
35057
35209
|
setConfig(cfg);
|
|
35058
35210
|
visit.before = snapshotOf(cfg);
|
|
@@ -35173,12 +35325,12 @@ var init_ProjectScreen = __esm({
|
|
|
35173
35325
|
});
|
|
35174
35326
|
|
|
35175
35327
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
35176
|
-
import { useState as
|
|
35328
|
+
import { useState as useState37 } from "react";
|
|
35177
35329
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
35178
35330
|
import { jsx as jsx63, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
35179
35331
|
function ConfigurationScreen({ onDone }) {
|
|
35180
|
-
const [focus, setFocus] =
|
|
35181
|
-
const [open, setOpen] =
|
|
35332
|
+
const [focus, setFocus] = useState37(0);
|
|
35333
|
+
const [open, setOpen] = useState37(null);
|
|
35182
35334
|
const close = () => setOpen(null);
|
|
35183
35335
|
useInput17((input, key) => {
|
|
35184
35336
|
if (open) return;
|
|
@@ -35239,13 +35391,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
35239
35391
|
});
|
|
35240
35392
|
|
|
35241
35393
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
35242
|
-
import { useEffect as
|
|
35394
|
+
import { useEffect as useEffect35, useState as useState38 } from "react";
|
|
35243
35395
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
35244
35396
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
35245
35397
|
function OptInAnalyticsScreen({ onDone }) {
|
|
35246
|
-
const [loading, setLoading] =
|
|
35247
|
-
const [enabled, setEnabled] =
|
|
35248
|
-
|
|
35398
|
+
const [loading, setLoading] = useState38(true);
|
|
35399
|
+
const [enabled, setEnabled] = useState38(true);
|
|
35400
|
+
useEffect35(() => {
|
|
35249
35401
|
readAnalyticsSetting().then((setting) => {
|
|
35250
35402
|
setEnabled(setting.enabled);
|
|
35251
35403
|
setLoading(false);
|
|
@@ -35308,18 +35460,18 @@ var init_screen12 = __esm({
|
|
|
35308
35460
|
});
|
|
35309
35461
|
|
|
35310
35462
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
35311
|
-
import { useEffect as
|
|
35463
|
+
import { useEffect as useEffect36, useRef as useRef22, useState as useState39 } from "react";
|
|
35312
35464
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
35313
35465
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
35314
35466
|
function DebugModeScreen({ onDone }) {
|
|
35315
|
-
const [setting, setSetting] =
|
|
35316
|
-
const [focus, setFocus] =
|
|
35317
|
-
const [pending, setPending] =
|
|
35467
|
+
const [setting, setSetting] = useState39(null);
|
|
35468
|
+
const [focus, setFocus] = useState39("enabled");
|
|
35469
|
+
const [pending, setPending] = useState39(
|
|
35318
35470
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
35319
35471
|
);
|
|
35320
|
-
const [notice, setNotice] =
|
|
35472
|
+
const [notice, setNotice] = useState39(null);
|
|
35321
35473
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
35322
|
-
|
|
35474
|
+
useEffect36(() => {
|
|
35323
35475
|
readDebugModeSetting().then((loaded) => {
|
|
35324
35476
|
setSetting(loaded);
|
|
35325
35477
|
setPending(loaded.retentionDays);
|
|
@@ -35460,21 +35612,21 @@ var app_exports = {};
|
|
|
35460
35612
|
__export(app_exports, {
|
|
35461
35613
|
runApp: () => runApp
|
|
35462
35614
|
});
|
|
35463
|
-
import { useEffect as
|
|
35615
|
+
import { useEffect as useEffect37, useState as useState40 } from "react";
|
|
35464
35616
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
35465
35617
|
function App({ importOptions, inkClear }) {
|
|
35466
|
-
const [screen, setScreen] =
|
|
35467
|
-
const [importExitCode, setImportExitCode] =
|
|
35618
|
+
const [screen, setScreen] = useState40("start");
|
|
35619
|
+
const [importExitCode, setImportExitCode] = useState40();
|
|
35468
35620
|
const showImportResult = importExitCode !== void 0;
|
|
35469
|
-
const [target, setTarget] =
|
|
35470
|
-
const [answers, setAnswers] =
|
|
35621
|
+
const [target, setTarget] = useState40();
|
|
35622
|
+
const [answers, setAnswers] = useState40({});
|
|
35471
35623
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
35472
|
-
const [extractionRun, setExtractionRun] =
|
|
35624
|
+
const [extractionRun, setExtractionRun] = useState40();
|
|
35473
35625
|
const extraction = useExtraction(extractionRun?.input);
|
|
35474
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
35626
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState40();
|
|
35475
35627
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
35476
|
-
const [tokenReview, setTokenReview] =
|
|
35477
|
-
const [scopeRun, setScopeRun] =
|
|
35628
|
+
const [tokenReview, setTokenReview] = useState40();
|
|
35629
|
+
const [scopeRun, setScopeRun] = useState40();
|
|
35478
35630
|
const scopeFlow = useScopeGateFlow(
|
|
35479
35631
|
scopeRun && {
|
|
35480
35632
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -35489,12 +35641,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35489
35641
|
}
|
|
35490
35642
|
}
|
|
35491
35643
|
);
|
|
35492
|
-
const [generationInput, setGenerationInput] =
|
|
35644
|
+
const [generationInput, setGenerationInput] = useState40();
|
|
35493
35645
|
const generation = useGeneration(generationInput);
|
|
35494
|
-
const [flowStart, setFlowStart] =
|
|
35646
|
+
const [flowStart, setFlowStart] = useState40();
|
|
35495
35647
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
35496
|
-
const [importDefaults, setImportDefaults] =
|
|
35497
|
-
|
|
35648
|
+
const [importDefaults, setImportDefaults] = useState40();
|
|
35649
|
+
useEffect37(() => {
|
|
35498
35650
|
if (screen !== "import") {
|
|
35499
35651
|
setImportDefaults(void 0);
|
|
35500
35652
|
return;
|
|
@@ -35567,7 +35719,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35567
35719
|
}
|
|
35568
35720
|
});
|
|
35569
35721
|
};
|
|
35570
|
-
|
|
35722
|
+
useEffect37(() => {
|
|
35571
35723
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
35572
35724
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
35573
35725
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -35589,12 +35741,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35589
35741
|
}
|
|
35590
35742
|
});
|
|
35591
35743
|
}, [tokensOnly, tokensOnlyRun]);
|
|
35592
|
-
|
|
35744
|
+
useEffect37(() => {
|
|
35593
35745
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
35594
35746
|
setExtractionRun(void 0);
|
|
35595
35747
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
35596
35748
|
}, [extraction, extractionRun]);
|
|
35597
|
-
|
|
35749
|
+
useEffect37(() => {
|
|
35598
35750
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
35599
35751
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35600
35752
|
setGenerationInput({
|
|
@@ -35612,7 +35764,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35612
35764
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
35613
35765
|
});
|
|
35614
35766
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
35615
|
-
|
|
35767
|
+
useEffect37(() => {
|
|
35616
35768
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
35617
35769
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35618
35770
|
inkClear();
|
|
@@ -35855,7 +36007,7 @@ var init_app = __esm({
|
|
|
35855
36007
|
// packages/experience-design-system-cli/program.ts
|
|
35856
36008
|
init_src3();
|
|
35857
36009
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
35858
|
-
import { join as
|
|
36010
|
+
import { join as join28 } from "node:path";
|
|
35859
36011
|
import { Command } from "commander";
|
|
35860
36012
|
|
|
35861
36013
|
// packages/experience-design-system-cli/src/commands/import-options.ts
|
|
@@ -35920,7 +36072,7 @@ init_analytics_store();
|
|
|
35920
36072
|
init_package_root();
|
|
35921
36073
|
var pkg = JSON.parse(
|
|
35922
36074
|
readFileSync10(
|
|
35923
|
-
|
|
36075
|
+
join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
35924
36076
|
"utf8"
|
|
35925
36077
|
)
|
|
35926
36078
|
);
|
|
@@ -35960,21 +36112,21 @@ function createProgram() {
|
|
|
35960
36112
|
init_config();
|
|
35961
36113
|
init_package_root();
|
|
35962
36114
|
import { existsSync as existsSync12 } from "node:fs";
|
|
35963
|
-
import { mkdir as mkdir10, readFile as
|
|
35964
|
-
import { dirname as dirname18, join as
|
|
36115
|
+
import { mkdir as mkdir10, readFile as readFile22, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
|
|
36116
|
+
import { dirname as dirname18, join as join29 } from "node:path";
|
|
35965
36117
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
35966
36118
|
async function readJson(path5) {
|
|
35967
36119
|
try {
|
|
35968
|
-
return JSON.parse(await
|
|
36120
|
+
return JSON.parse(await readFile22(path5, "utf8"));
|
|
35969
36121
|
} catch {
|
|
35970
36122
|
return void 0;
|
|
35971
36123
|
}
|
|
35972
36124
|
}
|
|
35973
36125
|
async function migrateOldConfig() {
|
|
35974
36126
|
try {
|
|
35975
|
-
const oldCredentials =
|
|
35976
|
-
const oldRuns =
|
|
35977
|
-
const oldDebugMode =
|
|
36127
|
+
const oldCredentials = join29(oldConfigDir2(), "credentials.json");
|
|
36128
|
+
const oldRuns = join29(oldConfigDir2(), "runs.json");
|
|
36129
|
+
const oldDebugMode = join29(
|
|
35978
36130
|
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
35979
36131
|
".contentful",
|
|
35980
36132
|
"config",
|