@contentful/experience-design-system-cli 2.42.1-dev-build-2fb477e0.0 → 2.42.1-dev-build-c1f0c828.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +540 -404
- package/dist/index.js +439 -285
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +3 -1
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +3 -0
- package/dist/src/tui/support-bundle.d.ts +23 -0
- package/dist/src/tui/zip.d.ts +7 -0
- package/package.json +3 -3
package/dist/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,120 @@ 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 `The import hit an error. We zipped up your debug logs, you can find the file here:
|
|
19973
|
+
${bundle.path}
|
|
19974
|
+
Send that zip file to Contentful support so they can look into it.`;
|
|
19975
|
+
case "no-logs":
|
|
19976
|
+
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.";
|
|
19977
|
+
case "failed":
|
|
19978
|
+
return `The import hit an error. We could not zip your debug logs, but you can find them here:
|
|
19979
|
+
${bundle.folder}
|
|
19980
|
+
Zip that folder and send it to Contentful support so they can look into it.`;
|
|
19981
|
+
}
|
|
19982
|
+
}
|
|
19983
|
+
var init_support_bundle = __esm({
|
|
19984
|
+
"packages/experience-design-system-cli/src/tui/support-bundle.ts"() {
|
|
19985
|
+
"use strict";
|
|
19986
|
+
init_debug_store();
|
|
19987
|
+
init_zip();
|
|
19988
|
+
}
|
|
19989
|
+
});
|
|
19990
|
+
|
|
19863
19991
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/logic.ts
|
|
19864
19992
|
function errorAction(input, key, available) {
|
|
19865
19993
|
if (key.return && available.canAcknowledge) return "acknowledge";
|
|
@@ -19900,6 +20028,28 @@ var init_controls2 = __esm({
|
|
|
19900
20028
|
}
|
|
19901
20029
|
});
|
|
19902
20030
|
|
|
20031
|
+
// packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts
|
|
20032
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
20033
|
+
function useSupportBundle() {
|
|
20034
|
+
const [bundle, setBundle] = useState3();
|
|
20035
|
+
useEffect3(() => {
|
|
20036
|
+
let active = true;
|
|
20037
|
+
void bundleDebugLogs().then((result) => {
|
|
20038
|
+
if (active) setBundle(result);
|
|
20039
|
+
});
|
|
20040
|
+
return () => {
|
|
20041
|
+
active = false;
|
|
20042
|
+
};
|
|
20043
|
+
}, []);
|
|
20044
|
+
return bundle;
|
|
20045
|
+
}
|
|
20046
|
+
var init_use_support_bundle = __esm({
|
|
20047
|
+
"packages/experience-design-system-cli/src/tui/import/shared/error-step/use-support-bundle.ts"() {
|
|
20048
|
+
"use strict";
|
|
20049
|
+
init_support_bundle();
|
|
20050
|
+
}
|
|
20051
|
+
});
|
|
20052
|
+
|
|
19903
20053
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
19904
20054
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
19905
20055
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -19911,6 +20061,7 @@ function ErrorStep({
|
|
|
19911
20061
|
onAcknowledgeBreakingChanges
|
|
19912
20062
|
}) {
|
|
19913
20063
|
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
20064
|
+
const bundle = useSupportBundle();
|
|
19914
20065
|
const controls = errorControls({
|
|
19915
20066
|
canRetry: onRetryCredentials !== void 0,
|
|
19916
20067
|
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
@@ -19922,6 +20073,7 @@ function ErrorStep({
|
|
|
19922
20073
|
" failed"
|
|
19923
20074
|
] }),
|
|
19924
20075
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
20076
|
+
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
19925
20077
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
19926
20078
|
"[",
|
|
19927
20079
|
control.keys,
|
|
@@ -19934,8 +20086,10 @@ var init_error_step = __esm({
|
|
|
19934
20086
|
"packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx"() {
|
|
19935
20087
|
"use strict";
|
|
19936
20088
|
init_theme();
|
|
20089
|
+
init_support_bundle();
|
|
19937
20090
|
init_controls2();
|
|
19938
20091
|
init_logic2();
|
|
20092
|
+
init_use_support_bundle();
|
|
19939
20093
|
}
|
|
19940
20094
|
});
|
|
19941
20095
|
|
|
@@ -20186,10 +20340,10 @@ var init_theme2 = __esm({
|
|
|
20186
20340
|
});
|
|
20187
20341
|
|
|
20188
20342
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
20189
|
-
import { useEffect as
|
|
20343
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
20190
20344
|
function useElapsed() {
|
|
20191
|
-
const [seconds2, setSeconds] =
|
|
20192
|
-
|
|
20345
|
+
const [seconds2, setSeconds] = useState4(0);
|
|
20346
|
+
useEffect4(() => {
|
|
20193
20347
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
20194
20348
|
return () => clearInterval(timer);
|
|
20195
20349
|
}, []);
|
|
@@ -20272,13 +20426,13 @@ var init_shared2 = __esm({
|
|
|
20272
20426
|
});
|
|
20273
20427
|
|
|
20274
20428
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
20275
|
-
import { useEffect as
|
|
20429
|
+
import { useEffect as useEffect5, useRef, useState as useState5 } from "react";
|
|
20276
20430
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
20277
20431
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
20278
20432
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
20279
|
-
const [focus, setFocus] =
|
|
20433
|
+
const [focus, setFocus] = useState5(0);
|
|
20280
20434
|
const viewed = useRef([optionAt(0)]).current;
|
|
20281
|
-
|
|
20435
|
+
useEffect5(() => {
|
|
20282
20436
|
startDebugRun({
|
|
20283
20437
|
flow: "import/preflight",
|
|
20284
20438
|
step: "00-preflight",
|
|
@@ -20403,13 +20557,13 @@ var init_controls4 = __esm({
|
|
|
20403
20557
|
});
|
|
20404
20558
|
|
|
20405
20559
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
20406
|
-
import { useEffect as
|
|
20560
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState6 } from "react";
|
|
20407
20561
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
20408
20562
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
20409
20563
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
20410
|
-
const [projectPath, setProjectPath] =
|
|
20564
|
+
const [projectPath, setProjectPath] = useState6(initialPath);
|
|
20411
20565
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
20412
|
-
|
|
20566
|
+
useEffect6(() => {
|
|
20413
20567
|
startDebugRun({
|
|
20414
20568
|
flow: "import/welcome",
|
|
20415
20569
|
step: "01-welcome",
|
|
@@ -20558,7 +20712,7 @@ var init_validate_path = __esm({
|
|
|
20558
20712
|
});
|
|
20559
20713
|
|
|
20560
20714
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
20561
|
-
import { useEffect as
|
|
20715
|
+
import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
|
|
20562
20716
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
20563
20717
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
20564
20718
|
function TokenInputScreen({
|
|
@@ -20567,10 +20721,10 @@ function TokenInputScreen({
|
|
|
20567
20721
|
onBack,
|
|
20568
20722
|
initialPath = ""
|
|
20569
20723
|
}) {
|
|
20570
|
-
const [tokenPath, setTokenPath] =
|
|
20571
|
-
const [failure, setFailure] =
|
|
20724
|
+
const [tokenPath, setTokenPath] = useState7(initialPath);
|
|
20725
|
+
const [failure, setFailure] = useState7(null);
|
|
20572
20726
|
const rejected = useRef4([]).current;
|
|
20573
|
-
|
|
20727
|
+
useEffect7(() => {
|
|
20574
20728
|
startDebugRun({
|
|
20575
20729
|
flow: "import/token-input",
|
|
20576
20730
|
step: "02-token-input",
|
|
@@ -20821,7 +20975,7 @@ var init_scan_files = __esm({
|
|
|
20821
20975
|
});
|
|
20822
20976
|
|
|
20823
20977
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
20824
|
-
import { useEffect as
|
|
20978
|
+
import { useEffect as useEffect8, useMemo, useState as useState8 } from "react";
|
|
20825
20979
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
20826
20980
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
20827
20981
|
function Row({ row }) {
|
|
@@ -20882,8 +21036,8 @@ function PathValidationScreen({
|
|
|
20882
21036
|
hasTokens = true
|
|
20883
21037
|
}) {
|
|
20884
21038
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
20885
|
-
const [scan, setScan] =
|
|
20886
|
-
|
|
21039
|
+
const [scan, setScan] = useState8();
|
|
21040
|
+
useEffect8(() => {
|
|
20887
21041
|
startDebugRun({
|
|
20888
21042
|
flow: "import/path-validation",
|
|
20889
21043
|
step: "03-path-validation",
|
|
@@ -20891,7 +21045,7 @@ function PathValidationScreen({
|
|
|
20891
21045
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
20892
21046
|
});
|
|
20893
21047
|
}, []);
|
|
20894
|
-
|
|
21048
|
+
useEffect8(() => {
|
|
20895
21049
|
setScan(scanFiles(resolvedPath));
|
|
20896
21050
|
}, [resolvedPath]);
|
|
20897
21051
|
const phase = phaseOf(scan, { hasTokens });
|
|
@@ -20946,7 +21100,7 @@ var init_screen4 = __esm({
|
|
|
20946
21100
|
});
|
|
20947
21101
|
|
|
20948
21102
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
20949
|
-
import { useState as
|
|
21103
|
+
import { useState as useState9 } from "react";
|
|
20950
21104
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
20951
21105
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
20952
21106
|
function formLabelWidth(rows) {
|
|
@@ -20982,9 +21136,9 @@ function FieldForm({
|
|
|
20982
21136
|
busy = false,
|
|
20983
21137
|
children
|
|
20984
21138
|
}) {
|
|
20985
|
-
const [active, setActive] =
|
|
20986
|
-
const [editing, setEditing] =
|
|
20987
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
21139
|
+
const [active, setActive] = useState9(0);
|
|
21140
|
+
const [editing, setEditing] = useState9(false);
|
|
21141
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState9("");
|
|
20988
21142
|
const rowCount = fields2.length + actions.length;
|
|
20989
21143
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
20990
21144
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -21268,7 +21422,7 @@ var init_validate4 = __esm({
|
|
|
21268
21422
|
});
|
|
21269
21423
|
|
|
21270
21424
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
21271
|
-
import { useEffect as
|
|
21425
|
+
import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
|
|
21272
21426
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
21273
21427
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21274
21428
|
function CredentialsScreen({
|
|
@@ -21287,16 +21441,16 @@ function CredentialsScreen({
|
|
|
21287
21441
|
host: initial.host ?? ""
|
|
21288
21442
|
})
|
|
21289
21443
|
).current;
|
|
21290
|
-
const [values, setValues] =
|
|
21291
|
-
const [notice, setNotice] =
|
|
21292
|
-
const [validating, setValidating] =
|
|
21444
|
+
const [values, setValues] = useState10(initialValues);
|
|
21445
|
+
const [notice, setNotice] = useState10(null);
|
|
21446
|
+
const [validating, setValidating] = useState10(false);
|
|
21293
21447
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
21294
|
-
const [editing, setEditing] =
|
|
21295
|
-
const [focus, setFocus] =
|
|
21296
|
-
const [active, setActive] =
|
|
21297
|
-
const [beforeEdit, setBeforeEdit] =
|
|
21448
|
+
const [editing, setEditing] = useState10(!prefilled);
|
|
21449
|
+
const [focus, setFocus] = useState10(0);
|
|
21450
|
+
const [active, setActive] = useState10(0);
|
|
21451
|
+
const [beforeEdit, setBeforeEdit] = useState10(initialValues);
|
|
21298
21452
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
21299
|
-
|
|
21453
|
+
useEffect9(() => {
|
|
21300
21454
|
startDebugRun({
|
|
21301
21455
|
flow: "import/credentials",
|
|
21302
21456
|
step: "04-credentials",
|
|
@@ -21721,15 +21875,15 @@ var init_load = __esm({
|
|
|
21721
21875
|
});
|
|
21722
21876
|
|
|
21723
21877
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
21724
|
-
import { useEffect as
|
|
21878
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState11 } from "react";
|
|
21725
21879
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
21726
21880
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21727
21881
|
function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
21728
21882
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
21729
21883
|
const rows = loaded.ok ? loaded.rows : [];
|
|
21730
21884
|
const columns = useTerminalWidth();
|
|
21731
|
-
const [selected, setSelected] =
|
|
21732
|
-
|
|
21885
|
+
const [selected, setSelected] = useState11(0);
|
|
21886
|
+
useEffect10(() => {
|
|
21733
21887
|
startDebugRun({
|
|
21734
21888
|
flow: "import/token-review",
|
|
21735
21889
|
step: "05-token-review",
|
|
@@ -21844,13 +21998,13 @@ var init_steps = __esm({
|
|
|
21844
21998
|
|
|
21845
21999
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21846
22000
|
import { existsSync as existsSync11 } from "node:fs";
|
|
21847
|
-
import { dirname as dirname16, join as
|
|
22001
|
+
import { dirname as dirname16, join as join21, resolve as resolve22 } from "node:path";
|
|
21848
22002
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21849
22003
|
function findSkillPath(fileName) {
|
|
21850
22004
|
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
21851
22005
|
let dir = thisDir;
|
|
21852
22006
|
for (; ; ) {
|
|
21853
|
-
const candidate =
|
|
22007
|
+
const candidate = join21(dir, "skills", fileName);
|
|
21854
22008
|
if (existsSync11(candidate)) return candidate;
|
|
21855
22009
|
const parent = resolve22(dir, "..");
|
|
21856
22010
|
if (parent === dir) {
|
|
@@ -21963,9 +22117,9 @@ var init_selection2 = __esm({
|
|
|
21963
22117
|
|
|
21964
22118
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
21965
22119
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
21966
|
-
import { join as
|
|
22120
|
+
import { join as join22, resolve as resolve24 } from "node:path";
|
|
21967
22121
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
21968
|
-
const outDir = input.outDir ??
|
|
22122
|
+
const outDir = input.outDir ?? join22(resolve24(input.projectPath), ".contentful");
|
|
21969
22123
|
let progress = initialProgress({
|
|
21970
22124
|
hasCredentials: input.credentials !== null,
|
|
21971
22125
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -22115,11 +22269,11 @@ var init_run = __esm({
|
|
|
22115
22269
|
});
|
|
22116
22270
|
|
|
22117
22271
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
22118
|
-
import { useEffect as
|
|
22272
|
+
import { useEffect as useEffect11, useRef as useRef6, useState as useState12 } from "react";
|
|
22119
22273
|
function useExtraction(input) {
|
|
22120
|
-
const [state2, setState] =
|
|
22274
|
+
const [state2, setState] = useState12();
|
|
22121
22275
|
const current = useRef6();
|
|
22122
|
-
|
|
22276
|
+
useEffect11(() => {
|
|
22123
22277
|
current.current = input;
|
|
22124
22278
|
if (!input) {
|
|
22125
22279
|
setState(void 0);
|
|
@@ -22209,11 +22363,11 @@ var init_run_tokens_only = __esm({
|
|
|
22209
22363
|
});
|
|
22210
22364
|
|
|
22211
22365
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
22212
|
-
import { useEffect as
|
|
22366
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState13 } from "react";
|
|
22213
22367
|
function useTokensOnly(input) {
|
|
22214
|
-
const [state2, setState] =
|
|
22368
|
+
const [state2, setState] = useState13();
|
|
22215
22369
|
const current = useRef7();
|
|
22216
|
-
|
|
22370
|
+
useEffect12(() => {
|
|
22217
22371
|
current.current = input;
|
|
22218
22372
|
if (!input) {
|
|
22219
22373
|
setState(void 0);
|
|
@@ -22467,32 +22621,32 @@ function CounterStrip(props) {
|
|
|
22467
22621
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
22468
22622
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
22469
22623
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
22470
|
-
const
|
|
22624
|
+
const sep2 = condensed ? " | " : " ";
|
|
22471
22625
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
22472
22626
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22473
22627
|
labelGrp,
|
|
22474
22628
|
" "
|
|
22475
22629
|
] }),
|
|
22476
22630
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
22477
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22631
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
22478
22632
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22479
22633
|
labelAcc,
|
|
22480
22634
|
" "
|
|
22481
22635
|
] }),
|
|
22482
22636
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
22483
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22637
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
22484
22638
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22485
22639
|
labelRej,
|
|
22486
22640
|
" "
|
|
22487
22641
|
] }),
|
|
22488
22642
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
22489
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22643
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 }),
|
|
22490
22644
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22491
22645
|
labelUnd,
|
|
22492
22646
|
" "
|
|
22493
22647
|
] }),
|
|
22494
22648
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
22495
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22649
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep2 })
|
|
22496
22650
|
] }) });
|
|
22497
22651
|
}
|
|
22498
22652
|
var init_CounterStrip = __esm({
|
|
@@ -23523,7 +23677,7 @@ var init_useImmediateInput = __esm({
|
|
|
23523
23677
|
|
|
23524
23678
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
23525
23679
|
import { useStdout as useStdout2 } from "ink";
|
|
23526
|
-
import { useEffect as
|
|
23680
|
+
import { useEffect as useEffect13, useState as useState14 } from "react";
|
|
23527
23681
|
function readTerminalSize(stdout) {
|
|
23528
23682
|
return {
|
|
23529
23683
|
columns: stdout?.columns ?? 80,
|
|
@@ -23532,8 +23686,8 @@ function readTerminalSize(stdout) {
|
|
|
23532
23686
|
}
|
|
23533
23687
|
function useTerminalSize() {
|
|
23534
23688
|
const { stdout } = useStdout2();
|
|
23535
|
-
const [size, setSize] =
|
|
23536
|
-
|
|
23689
|
+
const [size, setSize] = useState14(() => readTerminalSize(stdout));
|
|
23690
|
+
useEffect13(() => {
|
|
23537
23691
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
23538
23692
|
stdout?.on("resize", updateSize);
|
|
23539
23693
|
updateSize();
|
|
@@ -24260,15 +24414,15 @@ var init_group_collapse = __esm({
|
|
|
24260
24414
|
});
|
|
24261
24415
|
|
|
24262
24416
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
24263
|
-
import { useState as
|
|
24417
|
+
import { useState as useState15 } from "react";
|
|
24264
24418
|
function useSidebarSearchState() {
|
|
24265
|
-
const [searchOpen, setSearchOpen] =
|
|
24266
|
-
const [searchQuery, setSearchQuery] =
|
|
24267
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
24268
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
24269
|
-
const [columnOneView, setColumnOneView] =
|
|
24270
|
-
const [activeFilters, setActiveFilters] =
|
|
24271
|
-
const [showHelp, setShowHelp] =
|
|
24419
|
+
const [searchOpen, setSearchOpen] = useState15(false);
|
|
24420
|
+
const [searchQuery, setSearchQuery] = useState15("");
|
|
24421
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState15([]);
|
|
24422
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState15(null);
|
|
24423
|
+
const [columnOneView, setColumnOneView] = useState15("grouped");
|
|
24424
|
+
const [activeFilters, setActiveFilters] = useState15(/* @__PURE__ */ new Set());
|
|
24425
|
+
const [showHelp, setShowHelp] = useState15(false);
|
|
24272
24426
|
return {
|
|
24273
24427
|
searchOpen,
|
|
24274
24428
|
setSearchOpen,
|
|
@@ -24293,10 +24447,10 @@ var init_sidebar_search_state = __esm({
|
|
|
24293
24447
|
});
|
|
24294
24448
|
|
|
24295
24449
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
24296
|
-
import { useCallback, useState as
|
|
24450
|
+
import { useCallback, useState as useState16 } from "react";
|
|
24297
24451
|
function useOverlayPanel(opts) {
|
|
24298
24452
|
const { toggleKey, onClose } = opts;
|
|
24299
|
-
const [isOpen, setIsOpen] =
|
|
24453
|
+
const [isOpen, setIsOpen] = useState16(false);
|
|
24300
24454
|
const open = useCallback(() => {
|
|
24301
24455
|
setIsOpen(true);
|
|
24302
24456
|
}, []);
|
|
@@ -24535,23 +24689,23 @@ var init_state = __esm({
|
|
|
24535
24689
|
});
|
|
24536
24690
|
|
|
24537
24691
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
24538
|
-
import { useEffect as
|
|
24692
|
+
import { useEffect as useEffect14, useMemo as useMemo3, useRef as useRef9, useState as useState17 } from "react";
|
|
24539
24693
|
function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
|
|
24540
24694
|
const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
|
|
24541
24695
|
const columnPlan = useMemo3(
|
|
24542
24696
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
24543
24697
|
[totalWidth, tokenCount, tokensWidth]
|
|
24544
24698
|
);
|
|
24545
|
-
const [decisions, setDecisions] =
|
|
24546
|
-
const [nav, setNav] =
|
|
24547
|
-
const [focusedColumn, setFocusedColumn] =
|
|
24548
|
-
const [tokensCursor, setTokensCursor] =
|
|
24549
|
-
const [showDependencies, setShowDependencies] =
|
|
24550
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
24551
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
24699
|
+
const [decisions, setDecisions] = useState17(/* @__PURE__ */ new Map());
|
|
24700
|
+
const [nav, setNav] = useState17({ cursor: 0, scrollOffset: 0 });
|
|
24701
|
+
const [focusedColumn, setFocusedColumn] = useState17("main");
|
|
24702
|
+
const [tokensCursor, setTokensCursor] = useState17(0);
|
|
24703
|
+
const [showDependencies, setShowDependencies] = useState17(false);
|
|
24704
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState17(false);
|
|
24705
|
+
const [cyclesCursor, setCyclesCursor] = useState17(0);
|
|
24552
24706
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
24553
|
-
const [aiCursor, setAiCursor] =
|
|
24554
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
24707
|
+
const [aiCursor, setAiCursor] = useState17(0);
|
|
24708
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState17(null);
|
|
24555
24709
|
const search = useSidebarSearchState();
|
|
24556
24710
|
const {
|
|
24557
24711
|
searchOpen,
|
|
@@ -24576,13 +24730,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24576
24730
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
24577
24731
|
[slotCycles]
|
|
24578
24732
|
);
|
|
24579
|
-
const [expandedGroups, setExpandedGroups] =
|
|
24733
|
+
const [expandedGroups, setExpandedGroups] = useState17(() => {
|
|
24580
24734
|
const seed = new Set(closures.keys());
|
|
24581
24735
|
for (const p of cycleParticipants) seed.add(p);
|
|
24582
24736
|
return seed;
|
|
24583
24737
|
});
|
|
24584
24738
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
24585
|
-
|
|
24739
|
+
useEffect14(() => {
|
|
24586
24740
|
if (seededGroupsRef.current) return;
|
|
24587
24741
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
24588
24742
|
seededGroupsRef.current = true;
|
|
@@ -24673,7 +24827,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24673
24827
|
entryCount: 0
|
|
24674
24828
|
});
|
|
24675
24829
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
24676
|
-
|
|
24830
|
+
useEffect14(() => {
|
|
24677
24831
|
setNav((prev) => {
|
|
24678
24832
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
24679
24833
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -25018,7 +25172,7 @@ var init_use_scope_gate = __esm({
|
|
|
25018
25172
|
});
|
|
25019
25173
|
|
|
25020
25174
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
25021
|
-
import { useEffect as
|
|
25175
|
+
import { useEffect as useEffect15, useMemo as useMemo4 } from "react";
|
|
25022
25176
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
25023
25177
|
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
25024
25178
|
function ScopeGateScreen({
|
|
@@ -25032,7 +25186,7 @@ function ScopeGateScreen({
|
|
|
25032
25186
|
return loaded?.ok ? loaded.rows : [];
|
|
25033
25187
|
}, [tokensPath]);
|
|
25034
25188
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
25035
|
-
|
|
25189
|
+
useEffect15(() => {
|
|
25036
25190
|
startDebugRun({
|
|
25037
25191
|
flow: "import/scope-gate",
|
|
25038
25192
|
step: "07-scope-gate",
|
|
@@ -25265,13 +25419,13 @@ var init_load2 = __esm({
|
|
|
25265
25419
|
});
|
|
25266
25420
|
|
|
25267
25421
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
25268
|
-
import { useEffect as
|
|
25422
|
+
import { useEffect as useEffect16, useMemo as useMemo5, useRef as useRef10, useState as useState18 } from "react";
|
|
25269
25423
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
25270
25424
|
const sessionId = input?.sessionId;
|
|
25271
25425
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
25272
25426
|
const cacheCheck = useRef10(void 0);
|
|
25273
|
-
const [confirmed, setConfirmed] =
|
|
25274
|
-
|
|
25427
|
+
const [confirmed, setConfirmed] = useState18();
|
|
25428
|
+
useEffect16(() => {
|
|
25275
25429
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
25276
25430
|
startDebugRun({
|
|
25277
25431
|
flow: "import/scope-gate",
|
|
@@ -25285,7 +25439,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
25285
25439
|
exitMethod: "discarded"
|
|
25286
25440
|
});
|
|
25287
25441
|
}, [sessionId, loaded]);
|
|
25288
|
-
|
|
25442
|
+
useEffect16(() => {
|
|
25289
25443
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
25290
25444
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
25291
25445
|
}, [input, loaded]);
|
|
@@ -25611,11 +25765,11 @@ var init_run2 = __esm({
|
|
|
25611
25765
|
});
|
|
25612
25766
|
|
|
25613
25767
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
25614
|
-
import { useEffect as
|
|
25768
|
+
import { useEffect as useEffect17, useRef as useRef11, useState as useState19 } from "react";
|
|
25615
25769
|
function useGeneration(input) {
|
|
25616
|
-
const [state2, setState] =
|
|
25770
|
+
const [state2, setState] = useState19();
|
|
25617
25771
|
const current = useRef11();
|
|
25618
|
-
|
|
25772
|
+
useEffect17(() => {
|
|
25619
25773
|
current.current = input;
|
|
25620
25774
|
if (!input) {
|
|
25621
25775
|
setState(void 0);
|
|
@@ -25660,7 +25814,7 @@ var init_use_generation = __esm({
|
|
|
25660
25814
|
});
|
|
25661
25815
|
|
|
25662
25816
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
25663
|
-
import { join as
|
|
25817
|
+
import { join as join23 } from "node:path";
|
|
25664
25818
|
function buildFlowStart(input) {
|
|
25665
25819
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
25666
25820
|
const credentials = extraction.credentials ?? {
|
|
@@ -25673,7 +25827,7 @@ function buildFlowStart(input) {
|
|
|
25673
25827
|
handoff,
|
|
25674
25828
|
agent: extraction.agent,
|
|
25675
25829
|
projectPath: extraction.projectPath,
|
|
25676
|
-
outDir: extraction.projectPath ?
|
|
25830
|
+
outDir: extraction.projectPath ? join23(extraction.projectPath, ".contentful") : "",
|
|
25677
25831
|
rawTokensPath: extraction.rawTokensPath,
|
|
25678
25832
|
credentials: {
|
|
25679
25833
|
spaceId: credentials.spaceId,
|
|
@@ -26705,7 +26859,7 @@ var init_scroll_offset = __esm({
|
|
|
26705
26859
|
});
|
|
26706
26860
|
|
|
26707
26861
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26708
|
-
import React13, { useEffect as
|
|
26862
|
+
import React13, { useEffect as useEffect18, useLayoutEffect as useLayoutEffect2, useState as useState20 } from "react";
|
|
26709
26863
|
import figures6 from "figures";
|
|
26710
26864
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26711
26865
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -27382,11 +27536,11 @@ function FieldEditor({
|
|
|
27382
27536
|
headerHeight = 2
|
|
27383
27537
|
}) {
|
|
27384
27538
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
27385
|
-
const [editorState, setEditorState] =
|
|
27386
|
-
const [parseErr] =
|
|
27387
|
-
const [listScrollStart, setListScrollStart] =
|
|
27539
|
+
const [editorState, setEditorState] = useState20(initialState);
|
|
27540
|
+
const [parseErr] = useState20(parseError);
|
|
27541
|
+
const [listScrollStart, setListScrollStart] = useState20(0);
|
|
27388
27542
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
27389
|
-
const [rowHeights, setRowHeights] =
|
|
27543
|
+
const [rowHeights, setRowHeights] = useState20({});
|
|
27390
27544
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
27391
27545
|
const initialFocus = (() => {
|
|
27392
27546
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -27454,25 +27608,25 @@ function FieldEditor({
|
|
|
27454
27608
|
textCursor: 0
|
|
27455
27609
|
};
|
|
27456
27610
|
})();
|
|
27457
|
-
const [focusLevel, setFocusLevel] =
|
|
27458
|
-
const [propIdx, setPropIdx] =
|
|
27459
|
-
const [slotIdx, setSlotIdx] =
|
|
27460
|
-
const [inSlots, setInSlots] =
|
|
27461
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
27462
|
-
const [activeField, setActiveField] =
|
|
27463
|
-
const [editingField, setEditingField] =
|
|
27464
|
-
const [textCursor, setTextCursor] =
|
|
27465
|
-
const [valueCursor, setValueCursor] =
|
|
27466
|
-
const [editingValue, setEditingValue] =
|
|
27467
|
-
const [valueText, setValueText] =
|
|
27468
|
-
const [pickerCursor, setPickerCursor] =
|
|
27469
|
-
const [validationError, setValidationError] =
|
|
27470
|
-
const [cursorVisible] =
|
|
27471
|
-
const [sourceOpen, setSourceOpen] =
|
|
27472
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
27473
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
27474
|
-
const [showHelp, setShowHelp] =
|
|
27475
|
-
const [pendingDelete, setPendingDelete] =
|
|
27611
|
+
const [focusLevel, setFocusLevel] = useState20(initialFocus.focusLevel);
|
|
27612
|
+
const [propIdx, setPropIdx] = useState20(initialFocus.propIdx);
|
|
27613
|
+
const [slotIdx, setSlotIdx] = useState20(initialFocus.slotIdx);
|
|
27614
|
+
const [inSlots, setInSlots] = useState20(initialFocus.inSlots);
|
|
27615
|
+
const [inComponentDesc, setInComponentDesc] = useState20(initialFocus.focusLevel === "componentDescription");
|
|
27616
|
+
const [activeField, setActiveField] = useState20(initialFocus.activeField);
|
|
27617
|
+
const [editingField, setEditingField] = useState20(false);
|
|
27618
|
+
const [textCursor, setTextCursor] = useState20(initialFocus.textCursor);
|
|
27619
|
+
const [valueCursor, setValueCursor] = useState20(0);
|
|
27620
|
+
const [editingValue, setEditingValue] = useState20(null);
|
|
27621
|
+
const [valueText, setValueText] = useState20("");
|
|
27622
|
+
const [pickerCursor, setPickerCursor] = useState20(0);
|
|
27623
|
+
const [validationError, setValidationError] = useState20(null);
|
|
27624
|
+
const [cursorVisible] = useState20(true);
|
|
27625
|
+
const [sourceOpen, setSourceOpen] = useState20(false);
|
|
27626
|
+
const [rationaleOpen, setRationaleOpen] = useState20(false);
|
|
27627
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState20(0);
|
|
27628
|
+
const [showHelp, setShowHelp] = useState20(false);
|
|
27629
|
+
const [pendingDelete, setPendingDelete] = useState20(null);
|
|
27476
27630
|
const props = editorState.props;
|
|
27477
27631
|
const slots = editorState.slots;
|
|
27478
27632
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -28232,7 +28386,7 @@ function FieldEditor({
|
|
|
28232
28386
|
}
|
|
28233
28387
|
return Math.max(start + 1, end2);
|
|
28234
28388
|
};
|
|
28235
|
-
|
|
28389
|
+
useEffect18(() => {
|
|
28236
28390
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
28237
28391
|
setListScrollStart((previous) => {
|
|
28238
28392
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -29627,7 +29781,7 @@ var init_FinalizeDialog = __esm({
|
|
|
29627
29781
|
});
|
|
29628
29782
|
|
|
29629
29783
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
29630
|
-
import { useEffect as
|
|
29784
|
+
import { useEffect as useEffect19, useRef as useRef12, useState as useState21 } from "react";
|
|
29631
29785
|
function useReviewFinalizePreview({
|
|
29632
29786
|
components,
|
|
29633
29787
|
...options
|
|
@@ -29639,12 +29793,12 @@ function useReviewFinalizePreview({
|
|
|
29639
29793
|
}
|
|
29640
29794
|
function useFinalizePreview(opts) {
|
|
29641
29795
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
29642
|
-
const [status, setStatus] =
|
|
29643
|
-
const [removed, setRemoved] =
|
|
29644
|
-
const [scrollOffset, setScrollOffset] =
|
|
29796
|
+
const [status, setStatus] = useState21("idle");
|
|
29797
|
+
const [removed, setRemoved] = useState21([]);
|
|
29798
|
+
const [scrollOffset, setScrollOffset] = useState21(0);
|
|
29645
29799
|
const generationRef = useRef12(0);
|
|
29646
29800
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
29647
|
-
|
|
29801
|
+
useEffect19(() => {
|
|
29648
29802
|
if (!open) {
|
|
29649
29803
|
setStatus("idle");
|
|
29650
29804
|
setRemoved([]);
|
|
@@ -29696,16 +29850,16 @@ var init_use_finalize_preview = __esm({
|
|
|
29696
29850
|
});
|
|
29697
29851
|
|
|
29698
29852
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
29699
|
-
import { useCallback as useCallback2, useEffect as
|
|
29853
|
+
import { useCallback as useCallback2, useEffect as useEffect20, useRef as useRef13, useState as useState22 } from "react";
|
|
29700
29854
|
function useReviewSession({
|
|
29701
29855
|
loadSession,
|
|
29702
29856
|
tokensPath,
|
|
29703
29857
|
onExtraLoaded
|
|
29704
29858
|
}) {
|
|
29705
|
-
const [components, setComponents] =
|
|
29706
|
-
const [loading, setLoading] =
|
|
29707
|
-
const [loadError, setLoadError] =
|
|
29708
|
-
const [availableTokens, setAvailableTokens] =
|
|
29859
|
+
const [components, setComponents] = useState22([]);
|
|
29860
|
+
const [loading, setLoading] = useState22(true);
|
|
29861
|
+
const [loadError, setLoadError] = useState22(null);
|
|
29862
|
+
const [availableTokens, setAvailableTokens] = useState22([]);
|
|
29709
29863
|
const loadInitialState = useCallback2(async () => {
|
|
29710
29864
|
const result = loadSession();
|
|
29711
29865
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -29715,7 +29869,7 @@ function useReviewSession({
|
|
|
29715
29869
|
}));
|
|
29716
29870
|
return { result, catalog };
|
|
29717
29871
|
}, [loadSession, tokensPath]);
|
|
29718
|
-
|
|
29872
|
+
useEffect20(() => {
|
|
29719
29873
|
let disposed = false;
|
|
29720
29874
|
void (async () => {
|
|
29721
29875
|
try {
|
|
@@ -29766,9 +29920,9 @@ function useReviewSession({
|
|
|
29766
29920
|
};
|
|
29767
29921
|
}
|
|
29768
29922
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29769
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
29770
|
-
const [componentRationale, setComponentRationale] =
|
|
29771
|
-
|
|
29923
|
+
const [reviewMetadata, setReviewMetadata] = useState22(null);
|
|
29924
|
+
const [componentRationale, setComponentRationale] = useState22(null);
|
|
29925
|
+
useEffect20(() => {
|
|
29772
29926
|
const current = components[selectedIdx];
|
|
29773
29927
|
if (!current) {
|
|
29774
29928
|
setReviewMetadata(null);
|
|
@@ -29806,7 +29960,7 @@ function useReviewHistory({
|
|
|
29806
29960
|
}) {
|
|
29807
29961
|
const historyRef = useRef13(null);
|
|
29808
29962
|
const historySeededRef = useRef13(false);
|
|
29809
|
-
|
|
29963
|
+
useEffect20(() => {
|
|
29810
29964
|
if (loading || historySeededRef.current) return;
|
|
29811
29965
|
historySeededRef.current = true;
|
|
29812
29966
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -29893,7 +30047,7 @@ var init_token_suggestions = __esm({
|
|
|
29893
30047
|
});
|
|
29894
30048
|
|
|
29895
30049
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
29896
|
-
import { useEffect as
|
|
30050
|
+
import { useEffect as useEffect21, useRef as useRef14, useState as useState23 } from "react";
|
|
29897
30051
|
function parseReviewEntry(draftValue) {
|
|
29898
30052
|
const parsed = JSON.parse(draftValue);
|
|
29899
30053
|
const keys = Object.keys(parsed);
|
|
@@ -29913,21 +30067,21 @@ function useReviewEditor({
|
|
|
29913
30067
|
onEditSaved,
|
|
29914
30068
|
onTokenSaved
|
|
29915
30069
|
}) {
|
|
29916
|
-
const [panelOpen, setPanelOpen] =
|
|
29917
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
29918
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
29919
|
-
const [textEntryActive, setTextEntryActive] =
|
|
29920
|
-
const [showJson, setShowJson] =
|
|
29921
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
29922
|
-
const [draftValue, setDraftValue] =
|
|
29923
|
-
const [saveError, setSaveError] =
|
|
29924
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
29925
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
29926
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
29927
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
30070
|
+
const [panelOpen, setPanelOpen] = useState23("none");
|
|
30071
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState23(0);
|
|
30072
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState23(0);
|
|
30073
|
+
const [textEntryActive, setTextEntryActive] = useState23(false);
|
|
30074
|
+
const [showJson, setShowJson] = useState23(false);
|
|
30075
|
+
const [showHiddenProps, setShowHiddenProps] = useState23(false);
|
|
30076
|
+
const [draftValue, setDraftValue] = useState23("");
|
|
30077
|
+
const [saveError, setSaveError] = useState23(null);
|
|
30078
|
+
const [tokenReviewRow, setTokenReviewRow] = useState23(0);
|
|
30079
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState23(false);
|
|
30080
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState23(0);
|
|
30081
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState23(/* @__PURE__ */ new Set());
|
|
29928
30082
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
29929
30083
|
const pendingGRef = useRef14(false);
|
|
29930
|
-
|
|
30084
|
+
useEffect21(() => {
|
|
29931
30085
|
setTokenReviewRow(0);
|
|
29932
30086
|
setTokenReviewEditing(false);
|
|
29933
30087
|
setTokenReviewEditCursor(0);
|
|
@@ -30047,12 +30201,12 @@ var init_use_review_editor = __esm({
|
|
|
30047
30201
|
});
|
|
30048
30202
|
|
|
30049
30203
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
30050
|
-
import { useState as
|
|
30204
|
+
import { useState as useState24 } from "react";
|
|
30051
30205
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
30052
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
30053
|
-
const [showFinalize, setShowFinalize] =
|
|
30054
|
-
const [showQuit, setShowQuit] =
|
|
30055
|
-
const [finalizeError, setFinalizeError] =
|
|
30206
|
+
const [sidebarFocused, setSidebarFocused] = useState24(true);
|
|
30207
|
+
const [showFinalize, setShowFinalize] = useState24(false);
|
|
30208
|
+
const [showQuit, setShowQuit] = useState24(false);
|
|
30209
|
+
const [finalizeError, setFinalizeError] = useState24(initialFinalizeError);
|
|
30056
30210
|
return {
|
|
30057
30211
|
sidebarFocused,
|
|
30058
30212
|
setSidebarFocused,
|
|
@@ -30409,24 +30563,24 @@ var init_preview_annotations = __esm({
|
|
|
30409
30563
|
});
|
|
30410
30564
|
|
|
30411
30565
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
30412
|
-
import { useCallback as useCallback3, useEffect as
|
|
30566
|
+
import { useCallback as useCallback3, useEffect as useEffect22, useRef as useRef15, useState as useState25 } from "react";
|
|
30413
30567
|
function useLivePreview(opts) {
|
|
30414
30568
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
30415
|
-
const [status, setStatus] =
|
|
30416
|
-
const [disabled, setDisabled] =
|
|
30569
|
+
const [status, setStatus] = useState25("idle");
|
|
30570
|
+
const [disabled, setDisabled] = useState25(false);
|
|
30417
30571
|
const timerRef = useRef15(null);
|
|
30418
30572
|
const generationRef = useRef15(0);
|
|
30419
30573
|
const latestRef = useRef15(0);
|
|
30420
30574
|
const inflightRef = useRef15(0);
|
|
30421
30575
|
const optsRef = useRef15(opts);
|
|
30422
|
-
|
|
30576
|
+
useEffect22(() => {
|
|
30423
30577
|
optsRef.current = opts;
|
|
30424
30578
|
});
|
|
30425
30579
|
const disabledRef = useRef15(disabled);
|
|
30426
|
-
|
|
30580
|
+
useEffect22(() => {
|
|
30427
30581
|
disabledRef.current = disabled;
|
|
30428
30582
|
}, [disabled]);
|
|
30429
|
-
|
|
30583
|
+
useEffect22(() => {
|
|
30430
30584
|
return () => {
|
|
30431
30585
|
if (timerRef.current) {
|
|
30432
30586
|
clearTimeout(timerRef.current);
|
|
@@ -30507,7 +30661,7 @@ var init_use_live_preview = __esm({
|
|
|
30507
30661
|
});
|
|
30508
30662
|
|
|
30509
30663
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
30510
|
-
import { useCallback as useCallback4, useEffect as
|
|
30664
|
+
import { useCallback as useCallback4, useEffect as useEffect23, useState as useState26 } from "react";
|
|
30511
30665
|
function useReviewPreview({
|
|
30512
30666
|
components,
|
|
30513
30667
|
loading,
|
|
@@ -30521,8 +30675,8 @@ function useReviewPreview({
|
|
|
30521
30675
|
deleteAllComponents,
|
|
30522
30676
|
onResult
|
|
30523
30677
|
}) {
|
|
30524
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
30525
|
-
const [removedComponents, setRemovedComponents] =
|
|
30678
|
+
const [previewAnnotations, setPreviewAnnotations] = useState26(/* @__PURE__ */ new Map());
|
|
30679
|
+
const [removedComponents, setRemovedComponents] = useState26([]);
|
|
30526
30680
|
const handleResult = useCallback4(
|
|
30527
30681
|
(response) => {
|
|
30528
30682
|
if (!response) return;
|
|
@@ -30548,14 +30702,14 @@ function useReviewPreview({
|
|
|
30548
30702
|
onResult: handleResult,
|
|
30549
30703
|
deleteAllComponents
|
|
30550
30704
|
});
|
|
30551
|
-
const [spinnerTick, setSpinnerTick] =
|
|
30552
|
-
|
|
30705
|
+
const [spinnerTick, setSpinnerTick] = useState26(0);
|
|
30706
|
+
useEffect23(() => {
|
|
30553
30707
|
if (livePreviewHook.status !== "running") return;
|
|
30554
30708
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
30555
30709
|
return () => clearInterval(id);
|
|
30556
30710
|
}, [livePreviewHook.status]);
|
|
30557
30711
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
30558
|
-
|
|
30712
|
+
useEffect23(() => {
|
|
30559
30713
|
if (loading) return;
|
|
30560
30714
|
if (!livePreview) return;
|
|
30561
30715
|
if (components.length === 0) return;
|
|
@@ -30640,7 +30794,7 @@ var init_review_log = __esm({
|
|
|
30640
30794
|
});
|
|
30641
30795
|
|
|
30642
30796
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
30643
|
-
import { useEffect as
|
|
30797
|
+
import { useEffect as useEffect24, useRef as useRef16 } from "react";
|
|
30644
30798
|
function useReviewLog({
|
|
30645
30799
|
loading,
|
|
30646
30800
|
loadError,
|
|
@@ -30650,7 +30804,7 @@ function useReviewLog({
|
|
|
30650
30804
|
const started = useRef16(false);
|
|
30651
30805
|
const latest = useRef16(components);
|
|
30652
30806
|
latest.current = components;
|
|
30653
|
-
|
|
30807
|
+
useEffect24(() => {
|
|
30654
30808
|
if (loading || started.current) return;
|
|
30655
30809
|
started.current = true;
|
|
30656
30810
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -30665,7 +30819,7 @@ function useReviewLog({
|
|
|
30665
30819
|
trail.current = openReviewTrail(components, Date.now());
|
|
30666
30820
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
30667
30821
|
}, [loading, loadError, components]);
|
|
30668
|
-
|
|
30822
|
+
useEffect24(
|
|
30669
30823
|
() => () => {
|
|
30670
30824
|
const open = trail.current;
|
|
30671
30825
|
trail.current = void 0;
|
|
@@ -30733,7 +30887,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
30733
30887
|
});
|
|
30734
30888
|
|
|
30735
30889
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
30736
|
-
import { useCallback as useCallback5, useEffect as
|
|
30890
|
+
import { useCallback as useCallback5, useEffect as useEffect25, useMemo as useMemo6, useRef as useRef17, useState as useState27 } from "react";
|
|
30737
30891
|
import figures8 from "figures";
|
|
30738
30892
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
30739
30893
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -30898,7 +31052,7 @@ function GenerateReviewStepView({
|
|
|
30898
31052
|
initialFinalizeError = null
|
|
30899
31053
|
}) {
|
|
30900
31054
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
30901
|
-
const [slotCycles, setSlotCycles] =
|
|
31055
|
+
const [slotCycles, setSlotCycles] = useState27([]);
|
|
30902
31056
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
30903
31057
|
setSlotCycles(cycles ?? []);
|
|
30904
31058
|
}, []);
|
|
@@ -30931,7 +31085,7 @@ function GenerateReviewStepView({
|
|
|
30931
31085
|
onExtraLoaded: setLoadedSlotCycles
|
|
30932
31086
|
});
|
|
30933
31087
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
30934
|
-
const [nav, setNav] =
|
|
31088
|
+
const [nav, setNav] = useState27({
|
|
30935
31089
|
cursorRowIdx: 0,
|
|
30936
31090
|
sidebarScrollOffset: 0
|
|
30937
31091
|
});
|
|
@@ -30947,10 +31101,10 @@ function GenerateReviewStepView({
|
|
|
30947
31101
|
finalizeError,
|
|
30948
31102
|
setFinalizeError
|
|
30949
31103
|
} = reviewSurface;
|
|
30950
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
31104
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState27(false);
|
|
30951
31105
|
const removedBannerDefaultedRef = useRef17(false);
|
|
30952
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
30953
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
31106
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState27(0);
|
|
31107
|
+
const [cyclesCursor, setCyclesCursor] = useState27(0);
|
|
30954
31108
|
const cyclePanel = useOverlayPanel({
|
|
30955
31109
|
toggleKey: "c",
|
|
30956
31110
|
onClose: () => {
|
|
@@ -30965,9 +31119,9 @@ function GenerateReviewStepView({
|
|
|
30965
31119
|
setBreakConfirm(false);
|
|
30966
31120
|
}
|
|
30967
31121
|
});
|
|
30968
|
-
const [breakCursor, setBreakCursor] =
|
|
30969
|
-
const [breakConfirm, setBreakConfirm] =
|
|
30970
|
-
const [expandedGroups, setExpandedGroups] =
|
|
31122
|
+
const [breakCursor, setBreakCursor] = useState27(0);
|
|
31123
|
+
const [breakConfirm, setBreakConfirm] = useState27(false);
|
|
31124
|
+
const [expandedGroups, setExpandedGroups] = useState27(/* @__PURE__ */ new Set());
|
|
30971
31125
|
const seededGroupsRef = useRef17(false);
|
|
30972
31126
|
const {
|
|
30973
31127
|
searchOpen,
|
|
@@ -30986,14 +31140,14 @@ function GenerateReviewStepView({
|
|
|
30986
31140
|
setShowHelp
|
|
30987
31141
|
} = useSidebarSearchState();
|
|
30988
31142
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
30989
|
-
const [breakingChanges, setBreakingChanges] =
|
|
30990
|
-
const [breakingCursor, setBreakingCursor] =
|
|
30991
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
30992
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
30993
|
-
const [autoRejected, setAutoRejected] =
|
|
30994
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
31143
|
+
const [breakingChanges, setBreakingChanges] = useState27([]);
|
|
31144
|
+
const [breakingCursor, setBreakingCursor] = useState27(0);
|
|
31145
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState27(false);
|
|
31146
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState27(null);
|
|
31147
|
+
const [autoRejected, setAutoRejected] = useState27([]);
|
|
31148
|
+
const [undoSnapshot, setUndoSnapshot] = useState27(null);
|
|
30995
31149
|
const autoRejectFiredRef = useRef17(false);
|
|
30996
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
31150
|
+
const [showReloadDialog, setShowReloadDialog] = useState27(false);
|
|
30997
31151
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
30998
31152
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
30999
31153
|
components,
|
|
@@ -31058,7 +31212,7 @@ function GenerateReviewStepView({
|
|
|
31058
31212
|
[components]
|
|
31059
31213
|
);
|
|
31060
31214
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
31061
|
-
|
|
31215
|
+
useEffect25(() => {
|
|
31062
31216
|
if (seededGroupsRef.current) return;
|
|
31063
31217
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
31064
31218
|
seededGroupsRef.current = true;
|
|
@@ -31085,7 +31239,7 @@ function GenerateReviewStepView({
|
|
|
31085
31239
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
31086
31240
|
}));
|
|
31087
31241
|
}, [slotCycles, cycleView]);
|
|
31088
|
-
|
|
31242
|
+
useEffect25(() => {
|
|
31089
31243
|
const decision = computeAutoRejectDecision({
|
|
31090
31244
|
loading,
|
|
31091
31245
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -31130,7 +31284,7 @@ function GenerateReviewStepView({
|
|
|
31130
31284
|
onAction: reviewLog.record
|
|
31131
31285
|
});
|
|
31132
31286
|
const autoRejectPushedRef = useRef17(false);
|
|
31133
|
-
|
|
31287
|
+
useEffect25(() => {
|
|
31134
31288
|
if (loading) return;
|
|
31135
31289
|
if (!historySeededRef.current) return;
|
|
31136
31290
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -31214,7 +31368,7 @@ function GenerateReviewStepView({
|
|
|
31214
31368
|
const panelHeight = leftPanelHeight + 2;
|
|
31215
31369
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
31216
31370
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
31217
|
-
|
|
31371
|
+
useEffect25(() => {
|
|
31218
31372
|
if (selectableRowPositions.length === 0) return;
|
|
31219
31373
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
31220
31374
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -32297,10 +32451,10 @@ var init_path_utils = __esm({
|
|
|
32297
32451
|
});
|
|
32298
32452
|
|
|
32299
32453
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
32300
|
-
import { useEffect as
|
|
32454
|
+
import { useEffect as useEffect26, useState as useState28 } from "react";
|
|
32301
32455
|
function useBlinkingCursor() {
|
|
32302
|
-
const [visible, setVisible] =
|
|
32303
|
-
|
|
32456
|
+
const [visible, setVisible] = useState28(true);
|
|
32457
|
+
useEffect26(() => {
|
|
32304
32458
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
32305
32459
|
return () => clearInterval(interval);
|
|
32306
32460
|
}, []);
|
|
@@ -32313,16 +32467,16 @@ var init_use_blinking_cursor = __esm({
|
|
|
32313
32467
|
});
|
|
32314
32468
|
|
|
32315
32469
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
32316
|
-
import { useState as
|
|
32470
|
+
import { useState as useState29 } from "react";
|
|
32317
32471
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
32318
32472
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
32319
|
-
import { dirname as dirname17, basename as
|
|
32473
|
+
import { dirname as dirname17, basename as basename7, join as join24 } from "node:path";
|
|
32320
32474
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
32321
32475
|
function autocomplete(partial) {
|
|
32322
32476
|
if (!partial) return null;
|
|
32323
32477
|
const normalized = normalizePath(partial);
|
|
32324
32478
|
const dir = dirname17(normalized);
|
|
32325
|
-
const base =
|
|
32479
|
+
const base = basename7(normalized);
|
|
32326
32480
|
let entries;
|
|
32327
32481
|
try {
|
|
32328
32482
|
entries = readdirSync4(dir);
|
|
@@ -32331,13 +32485,13 @@ function autocomplete(partial) {
|
|
|
32331
32485
|
}
|
|
32332
32486
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
32333
32487
|
if (matches.length === 0) return null;
|
|
32334
|
-
if (matches.length === 1) return
|
|
32488
|
+
if (matches.length === 1) return join24(dir, matches[0]);
|
|
32335
32489
|
let prefix = matches[0];
|
|
32336
32490
|
for (const m of matches) {
|
|
32337
32491
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
32338
32492
|
if (!prefix) break;
|
|
32339
32493
|
}
|
|
32340
|
-
return prefix.length > base.length ?
|
|
32494
|
+
return prefix.length > base.length ? join24(dir, prefix) : null;
|
|
32341
32495
|
}
|
|
32342
32496
|
function PathPrompt({
|
|
32343
32497
|
defaultPath,
|
|
@@ -32346,7 +32500,7 @@ function PathPrompt({
|
|
|
32346
32500
|
label = "Save to",
|
|
32347
32501
|
summary
|
|
32348
32502
|
}) {
|
|
32349
|
-
const [input, setInput] =
|
|
32503
|
+
const [input, setInput] = useState29("");
|
|
32350
32504
|
const cursorVisible = useBlinkingCursor();
|
|
32351
32505
|
useImmediateInput((rawInput, key) => {
|
|
32352
32506
|
if (key.return) {
|
|
@@ -32437,12 +32591,12 @@ var init_produced = __esm({
|
|
|
32437
32591
|
});
|
|
32438
32592
|
|
|
32439
32593
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
32440
|
-
import { useEffect as
|
|
32594
|
+
import { useEffect as useEffect27, useState as useState30 } from "react";
|
|
32441
32595
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
32442
32596
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
32443
32597
|
function useTimedSpinner() {
|
|
32444
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
32445
|
-
|
|
32598
|
+
const [elapsedSeconds, setElapsedSeconds] = useState30(0);
|
|
32599
|
+
useEffect27(() => {
|
|
32446
32600
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
32447
32601
|
return () => {
|
|
32448
32602
|
clearInterval(timer);
|
|
@@ -32715,7 +32869,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
32715
32869
|
});
|
|
32716
32870
|
|
|
32717
32871
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
32718
|
-
import { useEffect as
|
|
32872
|
+
import { useEffect as useEffect28, useState as useState31, useMemo as useMemo7 } from "react";
|
|
32719
32873
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
32720
32874
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
32721
32875
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -32909,8 +33063,8 @@ function WizardPreviewStep({
|
|
|
32909
33063
|
onQuit
|
|
32910
33064
|
}) {
|
|
32911
33065
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
32912
|
-
const [diffExpanded, setDiffExpanded] =
|
|
32913
|
-
const [scrollOffset, setScrollOffset] =
|
|
33066
|
+
const [diffExpanded, setDiffExpanded] = useState31(false);
|
|
33067
|
+
const [scrollOffset, setScrollOffset] = useState31(0);
|
|
32914
33068
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
32915
33069
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
32916
33070
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -32925,7 +33079,7 @@ function WizardPreviewStep({
|
|
|
32925
33079
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
32926
33080
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
32927
33081
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
32928
|
-
|
|
33082
|
+
useEffect28(() => {
|
|
32929
33083
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
32930
33084
|
}, [maxScroll]);
|
|
32931
33085
|
useImmediateInput((input, key) => {
|
|
@@ -33192,11 +33346,11 @@ var init_flow_log = __esm({
|
|
|
33192
33346
|
});
|
|
33193
33347
|
|
|
33194
33348
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
33195
|
-
import { useEffect as
|
|
33349
|
+
import { useEffect as useEffect29, useRef as useRef18 } from "react";
|
|
33196
33350
|
function useFlowLog(state2) {
|
|
33197
33351
|
const trail = useRef18(void 0);
|
|
33198
33352
|
const previous = useRef18(void 0);
|
|
33199
|
-
|
|
33353
|
+
useEffect29(() => {
|
|
33200
33354
|
const before = previous.current;
|
|
33201
33355
|
previous.current = state2;
|
|
33202
33356
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -33219,7 +33373,7 @@ function useFlowLog(state2) {
|
|
|
33219
33373
|
trail.current = open;
|
|
33220
33374
|
setDebugRunProgress(flowProgress(open, now));
|
|
33221
33375
|
}, [state2]);
|
|
33222
|
-
|
|
33376
|
+
useEffect29(
|
|
33223
33377
|
() => () => {
|
|
33224
33378
|
const open = trail.current;
|
|
33225
33379
|
trail.current = void 0;
|
|
@@ -33766,8 +33920,8 @@ var init_run_print_files_helpers = __esm({
|
|
|
33766
33920
|
});
|
|
33767
33921
|
|
|
33768
33922
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
33769
|
-
import { writeFile as
|
|
33770
|
-
import { join as
|
|
33923
|
+
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
33924
|
+
import { join as join25 } from "node:path";
|
|
33771
33925
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
33772
33926
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
33773
33927
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -33779,7 +33933,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
33779
33933
|
}
|
|
33780
33934
|
async function runPrintFiles(input, deps, onPatch) {
|
|
33781
33935
|
onPatch({ step: "printing" });
|
|
33782
|
-
const componentsPath =
|
|
33936
|
+
const componentsPath = join25(input.outDir, "components.json");
|
|
33783
33937
|
try {
|
|
33784
33938
|
const db = deps.openDb();
|
|
33785
33939
|
let components = [];
|
|
@@ -33868,7 +34022,7 @@ var init_save = __esm({
|
|
|
33868
34022
|
realSaveDeps = () => ({
|
|
33869
34023
|
openDb: openPipelineDb,
|
|
33870
34024
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
33871
|
-
writeFile: (path5, contents) =>
|
|
34025
|
+
writeFile: (path5, contents) => writeFile9(path5, contents),
|
|
33872
34026
|
appendRun,
|
|
33873
34027
|
buildSourceFingerprint,
|
|
33874
34028
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -33893,7 +34047,7 @@ var init_types9 = __esm({
|
|
|
33893
34047
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
33894
34048
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
33895
34049
|
import { tmpdir } from "node:os";
|
|
33896
|
-
import { join as
|
|
34050
|
+
import { join as join26, resolve as resolve27 } from "node:path";
|
|
33897
34051
|
function appendWizardLog(entry) {
|
|
33898
34052
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
33899
34053
|
}
|
|
@@ -34178,12 +34332,12 @@ var init_controller = __esm({
|
|
|
34178
34332
|
init_push();
|
|
34179
34333
|
init_save();
|
|
34180
34334
|
init_types9();
|
|
34181
|
-
WIZARD_LOG =
|
|
34335
|
+
WIZARD_LOG = join26(tmpdir(), "experiences-import-wizard.log");
|
|
34182
34336
|
}
|
|
34183
34337
|
});
|
|
34184
34338
|
|
|
34185
34339
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
34186
|
-
import { useEffect as
|
|
34340
|
+
import { useEffect as useEffect30, useRef as useRef19, useSyncExternalStore } from "react";
|
|
34187
34341
|
function useFlow(start, options = {}) {
|
|
34188
34342
|
const controller = useRef19();
|
|
34189
34343
|
if (start && !controller.current) {
|
|
@@ -34202,7 +34356,7 @@ function useFlow(start, options = {}) {
|
|
|
34202
34356
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
34203
34357
|
() => current?.getState()
|
|
34204
34358
|
);
|
|
34205
|
-
|
|
34359
|
+
useEffect30(() => {
|
|
34206
34360
|
if (!start) controller.current = void 0;
|
|
34207
34361
|
}, [start]);
|
|
34208
34362
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
@@ -34215,7 +34369,7 @@ var init_use_flow = __esm({
|
|
|
34215
34369
|
});
|
|
34216
34370
|
|
|
34217
34371
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
34218
|
-
import { join as
|
|
34372
|
+
import { join as join27, resolve as resolve28 } from "node:path";
|
|
34219
34373
|
function describeFileLocations({
|
|
34220
34374
|
contentfulBaseDir,
|
|
34221
34375
|
debugModeEnabled,
|
|
@@ -34224,14 +34378,14 @@ function describeFileLocations({
|
|
|
34224
34378
|
if (!debugModeEnabled) {
|
|
34225
34379
|
return {
|
|
34226
34380
|
debugLogs: "none while Debug Mode is off",
|
|
34227
|
-
importFiles: `${
|
|
34381
|
+
importFiles: `${join27("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
34228
34382
|
};
|
|
34229
34383
|
}
|
|
34230
34384
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
34231
|
-
const session = currentSessionDir2 ??
|
|
34385
|
+
const session = currentSessionDir2 ?? join27(base, ".contentful", "<date>-session-<n>");
|
|
34232
34386
|
return {
|
|
34233
|
-
debugLogs:
|
|
34234
|
-
importFiles: `${
|
|
34387
|
+
debugLogs: join27(session, "debug"),
|
|
34388
|
+
importFiles: `${join27(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
34235
34389
|
};
|
|
34236
34390
|
}
|
|
34237
34391
|
var init_file_locations = __esm({
|
|
@@ -34281,7 +34435,7 @@ var init_help_info = __esm({
|
|
|
34281
34435
|
});
|
|
34282
34436
|
|
|
34283
34437
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
34284
|
-
import { useEffect as
|
|
34438
|
+
import { useEffect as useEffect31, useState as useState32 } from "react";
|
|
34285
34439
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
34286
34440
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
34287
34441
|
function Section({ title, rows }) {
|
|
@@ -34294,8 +34448,8 @@ function Section({ title, rows }) {
|
|
|
34294
34448
|
] });
|
|
34295
34449
|
}
|
|
34296
34450
|
function HelpScreen({ onDone }) {
|
|
34297
|
-
const [info, setInfo] =
|
|
34298
|
-
|
|
34451
|
+
const [info, setInfo] = useState32();
|
|
34452
|
+
useEffect31(() => {
|
|
34299
34453
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
34300
34454
|
void readHelpInfo().then(setInfo);
|
|
34301
34455
|
}, []);
|
|
@@ -34342,14 +34496,14 @@ var init_PageContainer2 = __esm({
|
|
|
34342
34496
|
});
|
|
34343
34497
|
|
|
34344
34498
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
34345
|
-
import { useState as
|
|
34499
|
+
import { useState as useState33 } from "react";
|
|
34346
34500
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
34347
34501
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
34348
34502
|
function SettingsScreen({
|
|
34349
34503
|
onNavigate,
|
|
34350
34504
|
onBack
|
|
34351
34505
|
}) {
|
|
34352
|
-
const [focusIdx, setFocusIdx] =
|
|
34506
|
+
const [focusIdx, setFocusIdx] = useState33(0);
|
|
34353
34507
|
const items = [
|
|
34354
34508
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
34355
34509
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -34677,7 +34831,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
34677
34831
|
});
|
|
34678
34832
|
|
|
34679
34833
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
34680
|
-
import { useEffect as
|
|
34834
|
+
import { useEffect as useEffect32, useState as useState34 } from "react";
|
|
34681
34835
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
34682
34836
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
34683
34837
|
function StatusHeading() {
|
|
@@ -34694,11 +34848,11 @@ function AgentDetail({
|
|
|
34694
34848
|
record: record3
|
|
34695
34849
|
}) {
|
|
34696
34850
|
const settings = config.agents[name];
|
|
34697
|
-
const [saving, setSaving] =
|
|
34698
|
-
const [testing, setTesting] =
|
|
34699
|
-
const [notice, setNotice] =
|
|
34700
|
-
const [checks, setChecks] =
|
|
34701
|
-
|
|
34851
|
+
const [saving, setSaving] = useState34(false);
|
|
34852
|
+
const [testing, setTesting] = useState34(false);
|
|
34853
|
+
const [notice, setNotice] = useState34(null);
|
|
34854
|
+
const [checks, setChecks] = useState34(void 0);
|
|
34855
|
+
useEffect32(() => {
|
|
34702
34856
|
let active = true;
|
|
34703
34857
|
setChecks(void 0);
|
|
34704
34858
|
const timer = setTimeout(() => {
|
|
@@ -34790,17 +34944,17 @@ var init_AgentDetail = __esm({
|
|
|
34790
34944
|
});
|
|
34791
34945
|
|
|
34792
34946
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
34793
|
-
import { useEffect as
|
|
34947
|
+
import { useEffect as useEffect33, useRef as useRef20, useState as useState35 } from "react";
|
|
34794
34948
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
34795
34949
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
34796
34950
|
function AgentsScreen({ onDone }) {
|
|
34797
|
-
const [config, setConfig] =
|
|
34798
|
-
const [focus, setFocus] =
|
|
34799
|
-
const [open, setOpen] =
|
|
34800
|
-
const [notice, setNotice] =
|
|
34801
|
-
const [saving, setSaving] =
|
|
34802
|
-
const [loadError, setLoadError] =
|
|
34803
|
-
const [checks, setChecks] =
|
|
34951
|
+
const [config, setConfig] = useState35(null);
|
|
34952
|
+
const [focus, setFocus] = useState35(0);
|
|
34953
|
+
const [open, setOpen] = useState35(null);
|
|
34954
|
+
const [notice, setNotice] = useState35(null);
|
|
34955
|
+
const [saving, setSaving] = useState35(false);
|
|
34956
|
+
const [loadError, setLoadError] = useState35(null);
|
|
34957
|
+
const [checks, setChecks] = useState35({});
|
|
34804
34958
|
const visit = useRef20({
|
|
34805
34959
|
trail: createTrail(),
|
|
34806
34960
|
before: void 0,
|
|
@@ -34814,7 +34968,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34814
34968
|
);
|
|
34815
34969
|
}
|
|
34816
34970
|
};
|
|
34817
|
-
|
|
34971
|
+
useEffect33(() => {
|
|
34818
34972
|
readAgentConfig().then((loaded) => {
|
|
34819
34973
|
setConfig(loaded);
|
|
34820
34974
|
inspectAll(loaded);
|
|
@@ -35040,7 +35194,7 @@ var init_project_store = __esm({
|
|
|
35040
35194
|
});
|
|
35041
35195
|
|
|
35042
35196
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
35043
|
-
import { useEffect as
|
|
35197
|
+
import { useEffect as useEffect34, useRef as useRef21, useState as useState36 } from "react";
|
|
35044
35198
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
35045
35199
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
35046
35200
|
function debugFields(config) {
|
|
@@ -35055,10 +35209,10 @@ function debugFields(config) {
|
|
|
35055
35209
|
};
|
|
35056
35210
|
}
|
|
35057
35211
|
function ProjectScreen({ onDone }) {
|
|
35058
|
-
const [config, setConfig] =
|
|
35059
|
-
const [saving, setSaving] =
|
|
35060
|
-
const [notice, setNotice] =
|
|
35061
|
-
const [loadError, setLoadError] =
|
|
35212
|
+
const [config, setConfig] = useState36(null);
|
|
35213
|
+
const [saving, setSaving] = useState36(false);
|
|
35214
|
+
const [notice, setNotice] = useState36(null);
|
|
35215
|
+
const [loadError, setLoadError] = useState36(null);
|
|
35062
35216
|
const visit = useRef21({
|
|
35063
35217
|
trail: createTrail(),
|
|
35064
35218
|
before: void 0,
|
|
@@ -35066,7 +35220,7 @@ function ProjectScreen({ onDone }) {
|
|
|
35066
35220
|
error: ""
|
|
35067
35221
|
}).current;
|
|
35068
35222
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
35069
|
-
|
|
35223
|
+
useEffect34(() => {
|
|
35070
35224
|
readCredentials().then((cfg) => {
|
|
35071
35225
|
setConfig(cfg);
|
|
35072
35226
|
visit.before = snapshotOf(cfg);
|
|
@@ -35187,12 +35341,12 @@ var init_ProjectScreen = __esm({
|
|
|
35187
35341
|
});
|
|
35188
35342
|
|
|
35189
35343
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
35190
|
-
import { useState as
|
|
35344
|
+
import { useState as useState37 } from "react";
|
|
35191
35345
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
35192
35346
|
import { jsx as jsx63, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
35193
35347
|
function ConfigurationScreen({ onDone }) {
|
|
35194
|
-
const [focus, setFocus] =
|
|
35195
|
-
const [open, setOpen] =
|
|
35348
|
+
const [focus, setFocus] = useState37(0);
|
|
35349
|
+
const [open, setOpen] = useState37(null);
|
|
35196
35350
|
const close = () => setOpen(null);
|
|
35197
35351
|
useInput17((input, key) => {
|
|
35198
35352
|
if (open) return;
|
|
@@ -35253,13 +35407,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
35253
35407
|
});
|
|
35254
35408
|
|
|
35255
35409
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
35256
|
-
import { useEffect as
|
|
35410
|
+
import { useEffect as useEffect35, useState as useState38 } from "react";
|
|
35257
35411
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
35258
35412
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
35259
35413
|
function OptInAnalyticsScreen({ onDone }) {
|
|
35260
|
-
const [loading, setLoading] =
|
|
35261
|
-
const [enabled, setEnabled] =
|
|
35262
|
-
|
|
35414
|
+
const [loading, setLoading] = useState38(true);
|
|
35415
|
+
const [enabled, setEnabled] = useState38(true);
|
|
35416
|
+
useEffect35(() => {
|
|
35263
35417
|
readAnalyticsSetting().then((setting) => {
|
|
35264
35418
|
setEnabled(setting.enabled);
|
|
35265
35419
|
setLoading(false);
|
|
@@ -35322,18 +35476,18 @@ var init_screen12 = __esm({
|
|
|
35322
35476
|
});
|
|
35323
35477
|
|
|
35324
35478
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
35325
|
-
import { useEffect as
|
|
35479
|
+
import { useEffect as useEffect36, useRef as useRef22, useState as useState39 } from "react";
|
|
35326
35480
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
35327
35481
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
35328
35482
|
function DebugModeScreen({ onDone }) {
|
|
35329
|
-
const [setting, setSetting] =
|
|
35330
|
-
const [focus, setFocus] =
|
|
35331
|
-
const [pending, setPending] =
|
|
35483
|
+
const [setting, setSetting] = useState39(null);
|
|
35484
|
+
const [focus, setFocus] = useState39("enabled");
|
|
35485
|
+
const [pending, setPending] = useState39(
|
|
35332
35486
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
35333
35487
|
);
|
|
35334
|
-
const [notice, setNotice] =
|
|
35488
|
+
const [notice, setNotice] = useState39(null);
|
|
35335
35489
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
35336
|
-
|
|
35490
|
+
useEffect36(() => {
|
|
35337
35491
|
readDebugModeSetting().then((loaded) => {
|
|
35338
35492
|
setSetting(loaded);
|
|
35339
35493
|
setPending(loaded.retentionDays);
|
|
@@ -35474,21 +35628,21 @@ var app_exports = {};
|
|
|
35474
35628
|
__export(app_exports, {
|
|
35475
35629
|
runApp: () => runApp
|
|
35476
35630
|
});
|
|
35477
|
-
import { useEffect as
|
|
35631
|
+
import { useEffect as useEffect37, useState as useState40 } from "react";
|
|
35478
35632
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
35479
35633
|
function App({ importOptions, inkClear }) {
|
|
35480
|
-
const [screen, setScreen] =
|
|
35481
|
-
const [importExitCode, setImportExitCode] =
|
|
35634
|
+
const [screen, setScreen] = useState40("start");
|
|
35635
|
+
const [importExitCode, setImportExitCode] = useState40();
|
|
35482
35636
|
const showImportResult = importExitCode !== void 0;
|
|
35483
|
-
const [target, setTarget] =
|
|
35484
|
-
const [answers, setAnswers] =
|
|
35637
|
+
const [target, setTarget] = useState40();
|
|
35638
|
+
const [answers, setAnswers] = useState40({});
|
|
35485
35639
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
35486
|
-
const [extractionRun, setExtractionRun] =
|
|
35640
|
+
const [extractionRun, setExtractionRun] = useState40();
|
|
35487
35641
|
const extraction = useExtraction(extractionRun?.input);
|
|
35488
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
35642
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState40();
|
|
35489
35643
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
35490
|
-
const [tokenReview, setTokenReview] =
|
|
35491
|
-
const [scopeRun, setScopeRun] =
|
|
35644
|
+
const [tokenReview, setTokenReview] = useState40();
|
|
35645
|
+
const [scopeRun, setScopeRun] = useState40();
|
|
35492
35646
|
const scopeFlow = useScopeGateFlow(
|
|
35493
35647
|
scopeRun && {
|
|
35494
35648
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -35503,12 +35657,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35503
35657
|
}
|
|
35504
35658
|
}
|
|
35505
35659
|
);
|
|
35506
|
-
const [generationInput, setGenerationInput] =
|
|
35660
|
+
const [generationInput, setGenerationInput] = useState40();
|
|
35507
35661
|
const generation = useGeneration(generationInput);
|
|
35508
|
-
const [flowStart, setFlowStart] =
|
|
35662
|
+
const [flowStart, setFlowStart] = useState40();
|
|
35509
35663
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
35510
|
-
const [importDefaults, setImportDefaults] =
|
|
35511
|
-
|
|
35664
|
+
const [importDefaults, setImportDefaults] = useState40();
|
|
35665
|
+
useEffect37(() => {
|
|
35512
35666
|
if (screen !== "import") {
|
|
35513
35667
|
setImportDefaults(void 0);
|
|
35514
35668
|
return;
|
|
@@ -35581,7 +35735,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35581
35735
|
}
|
|
35582
35736
|
});
|
|
35583
35737
|
};
|
|
35584
|
-
|
|
35738
|
+
useEffect37(() => {
|
|
35585
35739
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
35586
35740
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
35587
35741
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -35603,12 +35757,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35603
35757
|
}
|
|
35604
35758
|
});
|
|
35605
35759
|
}, [tokensOnly, tokensOnlyRun]);
|
|
35606
|
-
|
|
35760
|
+
useEffect37(() => {
|
|
35607
35761
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
35608
35762
|
setExtractionRun(void 0);
|
|
35609
35763
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
35610
35764
|
}, [extraction, extractionRun]);
|
|
35611
|
-
|
|
35765
|
+
useEffect37(() => {
|
|
35612
35766
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
35613
35767
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35614
35768
|
setGenerationInput({
|
|
@@ -35626,7 +35780,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35626
35780
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
35627
35781
|
});
|
|
35628
35782
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
35629
|
-
|
|
35783
|
+
useEffect37(() => {
|
|
35630
35784
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
35631
35785
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35632
35786
|
inkClear();
|
|
@@ -35869,7 +36023,7 @@ var init_app = __esm({
|
|
|
35869
36023
|
// packages/experience-design-system-cli/program.ts
|
|
35870
36024
|
init_src3();
|
|
35871
36025
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
35872
|
-
import { join as
|
|
36026
|
+
import { join as join28 } from "node:path";
|
|
35873
36027
|
import { Command } from "commander";
|
|
35874
36028
|
|
|
35875
36029
|
// packages/experience-design-system-cli/src/commands/import-options.ts
|
|
@@ -35934,7 +36088,7 @@ init_analytics_store();
|
|
|
35934
36088
|
init_package_root();
|
|
35935
36089
|
var pkg = JSON.parse(
|
|
35936
36090
|
readFileSync10(
|
|
35937
|
-
|
|
36091
|
+
join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
35938
36092
|
"utf8"
|
|
35939
36093
|
)
|
|
35940
36094
|
);
|
|
@@ -35974,21 +36128,21 @@ function createProgram() {
|
|
|
35974
36128
|
init_config();
|
|
35975
36129
|
init_package_root();
|
|
35976
36130
|
import { existsSync as existsSync12 } from "node:fs";
|
|
35977
|
-
import { mkdir as mkdir10, readFile as
|
|
35978
|
-
import { dirname as dirname18, join as
|
|
36131
|
+
import { mkdir as mkdir10, readFile as readFile22, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
|
|
36132
|
+
import { dirname as dirname18, join as join29 } from "node:path";
|
|
35979
36133
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
35980
36134
|
async function readJson(path5) {
|
|
35981
36135
|
try {
|
|
35982
|
-
return JSON.parse(await
|
|
36136
|
+
return JSON.parse(await readFile22(path5, "utf8"));
|
|
35983
36137
|
} catch {
|
|
35984
36138
|
return void 0;
|
|
35985
36139
|
}
|
|
35986
36140
|
}
|
|
35987
36141
|
async function migrateOldConfig() {
|
|
35988
36142
|
try {
|
|
35989
|
-
const oldCredentials =
|
|
35990
|
-
const oldRuns =
|
|
35991
|
-
const oldDebugMode =
|
|
36143
|
+
const oldCredentials = join29(oldConfigDir2(), "credentials.json");
|
|
36144
|
+
const oldRuns = join29(oldConfigDir2(), "runs.json");
|
|
36145
|
+
const oldDebugMode = join29(
|
|
35992
36146
|
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
35993
36147
|
".contentful",
|
|
35994
36148
|
"config",
|