@contentful/experience-design-system-cli 2.42.1-dev-build-25400cd0.0 → 2.42.1-dev-build-2fb477e0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +426 -548
- package/dist/index.js +307 -447
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +1 -3
- package/dist/src/tui/import/steps/03-path-validation/logic.d.ts +12 -2
- package/package.json +3 -3
- package/dist/src/tui/import/shared/error-step/use-support-bundle.d.ts +0 -3
- package/dist/src/tui/support-bundle.d.ts +0 -23
- package/dist/src/tui/zip.d.ts +0 -7
package/dist/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 stat5 = statSync2(entryPath);
|
|
8322
|
+
if (stat5.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 basename7 = filename.replace(/\.[^.]+$/, "");
|
|
11838
11838
|
let score = 0;
|
|
11839
11839
|
if (/^index\.[jt]sx?$/.test(filename))
|
|
11840
11840
|
score += 100;
|
|
11841
|
-
if (
|
|
11841
|
+
if (basename7 && segments.at(-2) === basename7)
|
|
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 stat5;
|
|
13789
13789
|
try {
|
|
13790
|
-
|
|
13790
|
+
stat5 = statSync4(resolved);
|
|
13791
13791
|
} catch (err) {
|
|
13792
13792
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
13793
13793
|
}
|
|
13794
|
-
if (
|
|
13794
|
+
if (stat5.isFile())
|
|
13795
13795
|
return { ok: false, failure: "is-file", rootPath: resolved };
|
|
13796
|
-
if (!
|
|
13796
|
+
if (!stat5.isDirectory())
|
|
13797
13797
|
return { ok: false, failure: "not-directory", rootPath: resolved };
|
|
13798
13798
|
const result = {
|
|
13799
13799
|
filePaths: [],
|
|
@@ -19501,7 +19501,6 @@ __export(debug_store_exports, {
|
|
|
19501
19501
|
currentSessionDir: () => currentSessionDir,
|
|
19502
19502
|
finishDebugRun: () => finishDebugRun,
|
|
19503
19503
|
setDebugRunProgress: () => setDebugRunProgress,
|
|
19504
|
-
settleDebugLogs: () => settleDebugLogs,
|
|
19505
19504
|
startDebugRun: () => startDebugRun,
|
|
19506
19505
|
startDebugSessionIn: () => startDebugSessionIn,
|
|
19507
19506
|
startImportRun: () => startImportRun
|
|
@@ -19606,19 +19605,7 @@ function startDebugRun({
|
|
|
19606
19605
|
function setDebugRunProgress(outputs) {
|
|
19607
19606
|
if (pendingRun) pendingRun.progress = outputs;
|
|
19608
19607
|
}
|
|
19609
|
-
function
|
|
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({
|
|
19608
|
+
async function finishDebugRun({
|
|
19622
19609
|
outputs,
|
|
19623
19610
|
status,
|
|
19624
19611
|
exitMethod
|
|
@@ -19701,7 +19688,7 @@ ${JSON.stringify(finish.outputs, null, 2)}
|
|
|
19701
19688
|
function handleCrash() {
|
|
19702
19689
|
return finishDebugRun({ outputs: pendingRun?.progress ?? {}, status: "error", exitMethod: "crashed" });
|
|
19703
19690
|
}
|
|
19704
|
-
var pendingRun, sessionDir,
|
|
19691
|
+
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
19705
19692
|
var init_debug_store = __esm({
|
|
19706
19693
|
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
19707
19694
|
"use strict";
|
|
@@ -19731,7 +19718,6 @@ var init_debug_store = __esm({
|
|
|
19731
19718
|
);
|
|
19732
19719
|
}
|
|
19733
19720
|
});
|
|
19734
|
-
unsettled = /* @__PURE__ */ new Set();
|
|
19735
19721
|
WAITING_LIMIT = 50;
|
|
19736
19722
|
waiting = [];
|
|
19737
19723
|
process.once("uncaughtException", (err) => {
|
|
@@ -19874,120 +19860,6 @@ var init_controls = __esm({
|
|
|
19874
19860
|
}
|
|
19875
19861
|
});
|
|
19876
19862
|
|
|
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
|
-
|
|
19991
19863
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/logic.ts
|
|
19992
19864
|
function errorAction(input, key, available) {
|
|
19993
19865
|
if (key.return && available.canAcknowledge) return "acknowledge";
|
|
@@ -20028,28 +19900,6 @@ var init_controls2 = __esm({
|
|
|
20028
19900
|
}
|
|
20029
19901
|
});
|
|
20030
19902
|
|
|
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
|
-
|
|
20053
19903
|
// packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx
|
|
20054
19904
|
import { Box as Box4, Text as Text4 } from "ink";
|
|
20055
19905
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -20061,7 +19911,6 @@ function ErrorStep({
|
|
|
20061
19911
|
onAcknowledgeBreakingChanges
|
|
20062
19912
|
}) {
|
|
20063
19913
|
useErrorControls({ onExit, onRetry: onRetryCredentials, onAcknowledge: onAcknowledgeBreakingChanges });
|
|
20064
|
-
const bundle = useSupportBundle();
|
|
20065
19914
|
const controls = errorControls({
|
|
20066
19915
|
canRetry: onRetryCredentials !== void 0,
|
|
20067
19916
|
canAcknowledge: onAcknowledgeBreakingChanges !== void 0
|
|
@@ -20073,7 +19922,6 @@ function ErrorStep({
|
|
|
20073
19922
|
" failed"
|
|
20074
19923
|
] }),
|
|
20075
19924
|
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.error, children: message }),
|
|
20076
|
-
bundle && /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: supportInstruction(bundle) }),
|
|
20077
19925
|
/* @__PURE__ */ jsx4(Box4, { marginTop: 1, gap: 3, children: controls.map((control) => /* @__PURE__ */ jsxs4(Text4, { color: PALETTE.muted, children: [
|
|
20078
19926
|
"[",
|
|
20079
19927
|
control.keys,
|
|
@@ -20086,10 +19934,8 @@ var init_error_step = __esm({
|
|
|
20086
19934
|
"packages/experience-design-system-cli/src/tui/import/shared/error-step/error-step.tsx"() {
|
|
20087
19935
|
"use strict";
|
|
20088
19936
|
init_theme();
|
|
20089
|
-
init_support_bundle();
|
|
20090
19937
|
init_controls2();
|
|
20091
19938
|
init_logic2();
|
|
20092
|
-
init_use_support_bundle();
|
|
20093
19939
|
}
|
|
20094
19940
|
});
|
|
20095
19941
|
|
|
@@ -20340,10 +20186,10 @@ var init_theme2 = __esm({
|
|
|
20340
20186
|
});
|
|
20341
20187
|
|
|
20342
20188
|
// packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
|
|
20343
|
-
import { useEffect as
|
|
20189
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
20344
20190
|
function useElapsed() {
|
|
20345
|
-
const [seconds2, setSeconds] =
|
|
20346
|
-
|
|
20191
|
+
const [seconds2, setSeconds] = useState3(0);
|
|
20192
|
+
useEffect3(() => {
|
|
20347
20193
|
const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
|
|
20348
20194
|
return () => clearInterval(timer);
|
|
20349
20195
|
}, []);
|
|
@@ -20426,13 +20272,13 @@ var init_shared2 = __esm({
|
|
|
20426
20272
|
});
|
|
20427
20273
|
|
|
20428
20274
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
20429
|
-
import { useEffect as
|
|
20275
|
+
import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
20430
20276
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
20431
20277
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
20432
20278
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
20433
|
-
const [focus, setFocus] =
|
|
20279
|
+
const [focus, setFocus] = useState4(0);
|
|
20434
20280
|
const viewed = useRef([optionAt(0)]).current;
|
|
20435
|
-
|
|
20281
|
+
useEffect4(() => {
|
|
20436
20282
|
startDebugRun({
|
|
20437
20283
|
flow: "import/preflight",
|
|
20438
20284
|
step: "00-preflight",
|
|
@@ -20557,13 +20403,13 @@ var init_controls4 = __esm({
|
|
|
20557
20403
|
});
|
|
20558
20404
|
|
|
20559
20405
|
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
20560
|
-
import { useEffect as
|
|
20406
|
+
import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
|
|
20561
20407
|
import { Box as Box10, Text as Text10 } from "ink";
|
|
20562
20408
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
20563
20409
|
function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
|
|
20564
|
-
const [projectPath, setProjectPath] =
|
|
20410
|
+
const [projectPath, setProjectPath] = useState5(initialPath);
|
|
20565
20411
|
const visit = useRef3({ emptySubmits: 0 }).current;
|
|
20566
|
-
|
|
20412
|
+
useEffect5(() => {
|
|
20567
20413
|
startDebugRun({
|
|
20568
20414
|
flow: "import/welcome",
|
|
20569
20415
|
step: "01-welcome",
|
|
@@ -20712,7 +20558,7 @@ var init_validate_path = __esm({
|
|
|
20712
20558
|
});
|
|
20713
20559
|
|
|
20714
20560
|
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
20715
|
-
import { useEffect as
|
|
20561
|
+
import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
|
|
20716
20562
|
import { Box as Box11, Text as Text11 } from "ink";
|
|
20717
20563
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
20718
20564
|
function TokenInputScreen({
|
|
@@ -20721,10 +20567,10 @@ function TokenInputScreen({
|
|
|
20721
20567
|
onBack,
|
|
20722
20568
|
initialPath = ""
|
|
20723
20569
|
}) {
|
|
20724
|
-
const [tokenPath, setTokenPath] =
|
|
20725
|
-
const [failure, setFailure] =
|
|
20570
|
+
const [tokenPath, setTokenPath] = useState6(initialPath);
|
|
20571
|
+
const [failure, setFailure] = useState6(null);
|
|
20726
20572
|
const rejected = useRef4([]).current;
|
|
20727
|
-
|
|
20573
|
+
useEffect6(() => {
|
|
20728
20574
|
startDebugRun({
|
|
20729
20575
|
flow: "import/token-input",
|
|
20730
20576
|
step: "02-token-input",
|
|
@@ -20876,9 +20722,14 @@ function scanReport(scan, path5, { hasTokens = true } = {}) {
|
|
|
20876
20722
|
...scan.warnings.length > 0 ? { scan_warnings: scan.warnings } : {}
|
|
20877
20723
|
};
|
|
20878
20724
|
}
|
|
20879
|
-
function
|
|
20725
|
+
function hasImportableFiles(counts, { hasTokens = true } = {}) {
|
|
20726
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
20727
|
+
return componentFiles > 0 || hasTokens && counts.json > 0;
|
|
20728
|
+
}
|
|
20729
|
+
function phaseOf(scan, { hasTokens = true } = {}) {
|
|
20880
20730
|
if (scan === void 0) return "scanning";
|
|
20881
|
-
|
|
20731
|
+
if (!scan.ok) return "failed";
|
|
20732
|
+
return hasImportableFiles(scan.counts, { hasTokens }) ? "ready" : "empty";
|
|
20882
20733
|
}
|
|
20883
20734
|
function keyAction(phase, input, key) {
|
|
20884
20735
|
if (key.escape) return "back";
|
|
@@ -20886,7 +20737,7 @@ function keyAction(phase, input, key) {
|
|
|
20886
20737
|
if (key.return) return "confirm";
|
|
20887
20738
|
if (input === "e") return "change-path";
|
|
20888
20739
|
}
|
|
20889
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
20740
|
+
if ((phase === "failed" || phase === "empty") && (key.return || input === "e")) return "change-path";
|
|
20890
20741
|
return void 0;
|
|
20891
20742
|
}
|
|
20892
20743
|
var COMPONENT_CATEGORIES, ROW_LABELS, ROW_ORDER;
|
|
@@ -20933,6 +20784,10 @@ var init_controls6 = __esm({
|
|
|
20933
20784
|
{ keys: "e", label: "Change path" },
|
|
20934
20785
|
{ keys: "Esc", label: "Back" }
|
|
20935
20786
|
],
|
|
20787
|
+
empty: [
|
|
20788
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
20789
|
+
{ keys: "Esc", label: "Back" }
|
|
20790
|
+
],
|
|
20936
20791
|
failed: [
|
|
20937
20792
|
{ keys: "Enter/e", label: "Try a different path" },
|
|
20938
20793
|
{ keys: "Esc", label: "Back" }
|
|
@@ -20966,7 +20821,7 @@ var init_scan_files = __esm({
|
|
|
20966
20821
|
});
|
|
20967
20822
|
|
|
20968
20823
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
20969
|
-
import { useEffect as
|
|
20824
|
+
import { useEffect as useEffect7, useMemo, useState as useState7 } from "react";
|
|
20970
20825
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
20971
20826
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
20972
20827
|
function Row({ row }) {
|
|
@@ -20990,7 +20845,8 @@ function Failure({ scan, path: path5 }) {
|
|
|
20990
20845
|
function Summary({
|
|
20991
20846
|
scan,
|
|
20992
20847
|
path: path5,
|
|
20993
|
-
hasTokens
|
|
20848
|
+
hasTokens,
|
|
20849
|
+
empty
|
|
20994
20850
|
}) {
|
|
20995
20851
|
const { total, rows, warning } = summarize(scan.counts, { hasTokens });
|
|
20996
20852
|
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", gap: 1, children: [
|
|
@@ -20999,7 +20855,11 @@ function Summary({
|
|
|
20999
20855
|
/* @__PURE__ */ jsx13(Text12, { bold: true, children: path5 })
|
|
21000
20856
|
] }),
|
|
21001
20857
|
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
21002
|
-
/* @__PURE__ */ jsxs12(Text12, { color: PALETTE.
|
|
20858
|
+
empty ? /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.muted, children: [
|
|
20859
|
+
"Found ",
|
|
20860
|
+
total,
|
|
20861
|
+
" files:"
|
|
20862
|
+
] }) : /* @__PURE__ */ jsxs12(Text12, { color: PALETTE.success, children: [
|
|
21003
20863
|
"\u2713 Found ",
|
|
21004
20864
|
total,
|
|
21005
20865
|
" files:"
|
|
@@ -21010,7 +20870,7 @@ function Summary({
|
|
|
21010
20870
|
"\u26A0 ",
|
|
21011
20871
|
warning
|
|
21012
20872
|
] }),
|
|
21013
|
-
/* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
20873
|
+
!empty && /* @__PURE__ */ jsx13(Text12, { children: "Does this look right?" })
|
|
21014
20874
|
] });
|
|
21015
20875
|
}
|
|
21016
20876
|
function PathValidationScreen({
|
|
@@ -21022,8 +20882,8 @@ function PathValidationScreen({
|
|
|
21022
20882
|
hasTokens = true
|
|
21023
20883
|
}) {
|
|
21024
20884
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
21025
|
-
const [scan, setScan] =
|
|
21026
|
-
|
|
20885
|
+
const [scan, setScan] = useState7();
|
|
20886
|
+
useEffect7(() => {
|
|
21027
20887
|
startDebugRun({
|
|
21028
20888
|
flow: "import/path-validation",
|
|
21029
20889
|
step: "03-path-validation",
|
|
@@ -21031,10 +20891,10 @@ function PathValidationScreen({
|
|
|
21031
20891
|
inputs: { import_mode: mode, project_path: projectPath, resolved_path: resolvedPath }
|
|
21032
20892
|
});
|
|
21033
20893
|
}, []);
|
|
21034
|
-
|
|
20894
|
+
useEffect7(() => {
|
|
21035
20895
|
setScan(scanFiles(resolvedPath));
|
|
21036
20896
|
}, [resolvedPath]);
|
|
21037
|
-
const phase = phaseOf(scan);
|
|
20897
|
+
const phase = phaseOf(scan, { hasTokens });
|
|
21038
20898
|
const finish = (outcome, exitMethod) => {
|
|
21039
20899
|
void finishDebugRun({
|
|
21040
20900
|
outputs: { outcome, ...scanReport(scan, resolvedPath, { hasTokens }) },
|
|
@@ -21066,7 +20926,7 @@ function PathValidationScreen({
|
|
|
21066
20926
|
"..."
|
|
21067
20927
|
] }),
|
|
21068
20928
|
scan?.ok === false && /* @__PURE__ */ jsx13(Failure, { scan, path: resolvedPath }),
|
|
21069
|
-
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens }),
|
|
20929
|
+
scan?.ok === true && /* @__PURE__ */ jsx13(Summary, { scan, path: resolvedPath, hasTokens, empty: phase === "empty" }),
|
|
21070
20930
|
/* @__PURE__ */ jsx13(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx13(ControlHints, { hints: controlsFor(phase) }) })
|
|
21071
20931
|
] })
|
|
21072
20932
|
] });
|
|
@@ -21086,7 +20946,7 @@ var init_screen4 = __esm({
|
|
|
21086
20946
|
});
|
|
21087
20947
|
|
|
21088
20948
|
// packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
|
|
21089
|
-
import { useState as
|
|
20949
|
+
import { useState as useState8 } from "react";
|
|
21090
20950
|
import { Box as Box13, Text as Text13, useInput as useInput10 } from "ink";
|
|
21091
20951
|
import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
21092
20952
|
function formLabelWidth(rows) {
|
|
@@ -21122,9 +20982,9 @@ function FieldForm({
|
|
|
21122
20982
|
busy = false,
|
|
21123
20983
|
children
|
|
21124
20984
|
}) {
|
|
21125
|
-
const [active, setActive] =
|
|
21126
|
-
const [editing, setEditing] =
|
|
21127
|
-
const [valueBeforeEdit, setValueBeforeEdit] =
|
|
20985
|
+
const [active, setActive] = useState8(0);
|
|
20986
|
+
const [editing, setEditing] = useState8(false);
|
|
20987
|
+
const [valueBeforeEdit, setValueBeforeEdit] = useState8("");
|
|
21128
20988
|
const rowCount = fields2.length + actions.length;
|
|
21129
20989
|
const labelWidth = formLabelWidth([...fields2, ...actions]);
|
|
21130
20990
|
const currentField = active < fields2.length ? fields2[active] : void 0;
|
|
@@ -21408,7 +21268,7 @@ var init_validate4 = __esm({
|
|
|
21408
21268
|
});
|
|
21409
21269
|
|
|
21410
21270
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
21411
|
-
import { useEffect as
|
|
21271
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState9 } from "react";
|
|
21412
21272
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
21413
21273
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21414
21274
|
function CredentialsScreen({
|
|
@@ -21427,16 +21287,16 @@ function CredentialsScreen({
|
|
|
21427
21287
|
host: initial.host ?? ""
|
|
21428
21288
|
})
|
|
21429
21289
|
).current;
|
|
21430
|
-
const [values, setValues] =
|
|
21431
|
-
const [notice, setNotice] =
|
|
21432
|
-
const [validating, setValidating] =
|
|
21290
|
+
const [values, setValues] = useState9(initialValues);
|
|
21291
|
+
const [notice, setNotice] = useState9(null);
|
|
21292
|
+
const [validating, setValidating] = useState9(false);
|
|
21433
21293
|
const prefilled = initialValues.spaceId !== "" && initialValues.cmaToken !== "";
|
|
21434
|
-
const [editing, setEditing] =
|
|
21435
|
-
const [focus, setFocus] =
|
|
21436
|
-
const [active, setActive] =
|
|
21437
|
-
const [beforeEdit, setBeforeEdit] =
|
|
21294
|
+
const [editing, setEditing] = useState9(!prefilled);
|
|
21295
|
+
const [focus, setFocus] = useState9(0);
|
|
21296
|
+
const [active, setActive] = useState9(0);
|
|
21297
|
+
const [beforeEdit, setBeforeEdit] = useState9(initialValues);
|
|
21438
21298
|
const visit = useRef5({ attempts: [], lastReason: "" }).current;
|
|
21439
|
-
|
|
21299
|
+
useEffect8(() => {
|
|
21440
21300
|
startDebugRun({
|
|
21441
21301
|
flow: "import/credentials",
|
|
21442
21302
|
step: "04-credentials",
|
|
@@ -21861,15 +21721,15 @@ var init_load = __esm({
|
|
|
21861
21721
|
});
|
|
21862
21722
|
|
|
21863
21723
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-review/screen.tsx
|
|
21864
|
-
import { useEffect as
|
|
21724
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState10 } from "react";
|
|
21865
21725
|
import { Box as Box15, Text as Text15, useInput as useInput12 } from "ink";
|
|
21866
21726
|
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21867
21727
|
function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
|
|
21868
21728
|
const loaded = useMemo2(() => loadTokenRows(tokensPath), [tokensPath]);
|
|
21869
21729
|
const rows = loaded.ok ? loaded.rows : [];
|
|
21870
21730
|
const columns = useTerminalWidth();
|
|
21871
|
-
const [selected, setSelected] =
|
|
21872
|
-
|
|
21731
|
+
const [selected, setSelected] = useState10(0);
|
|
21732
|
+
useEffect9(() => {
|
|
21873
21733
|
startDebugRun({
|
|
21874
21734
|
flow: "import/token-review",
|
|
21875
21735
|
step: "05-token-review",
|
|
@@ -21984,13 +21844,13 @@ var init_steps = __esm({
|
|
|
21984
21844
|
|
|
21985
21845
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21986
21846
|
import { existsSync as existsSync11 } from "node:fs";
|
|
21987
|
-
import { dirname as dirname16, join as
|
|
21847
|
+
import { dirname as dirname16, join as join20, resolve as resolve22 } from "node:path";
|
|
21988
21848
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21989
21849
|
function findSkillPath(fileName) {
|
|
21990
21850
|
const thisDir = dirname16(fileURLToPath4(import.meta.url));
|
|
21991
21851
|
let dir = thisDir;
|
|
21992
21852
|
for (; ; ) {
|
|
21993
|
-
const candidate =
|
|
21853
|
+
const candidate = join20(dir, "skills", fileName);
|
|
21994
21854
|
if (existsSync11(candidate)) return candidate;
|
|
21995
21855
|
const parent = resolve22(dir, "..");
|
|
21996
21856
|
if (parent === dir) {
|
|
@@ -22103,9 +21963,9 @@ var init_selection2 = __esm({
|
|
|
22103
21963
|
|
|
22104
21964
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
22105
21965
|
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
22106
|
-
import { join as
|
|
21966
|
+
import { join as join21, resolve as resolve24 } from "node:path";
|
|
22107
21967
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
22108
|
-
const outDir = input.outDir ??
|
|
21968
|
+
const outDir = input.outDir ?? join21(resolve24(input.projectPath), ".contentful");
|
|
22109
21969
|
let progress = initialProgress({
|
|
22110
21970
|
hasCredentials: input.credentials !== null,
|
|
22111
21971
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -22255,11 +22115,11 @@ var init_run = __esm({
|
|
|
22255
22115
|
});
|
|
22256
22116
|
|
|
22257
22117
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
22258
|
-
import { useEffect as
|
|
22118
|
+
import { useEffect as useEffect10, useRef as useRef6, useState as useState11 } from "react";
|
|
22259
22119
|
function useExtraction(input) {
|
|
22260
|
-
const [state2, setState] =
|
|
22120
|
+
const [state2, setState] = useState11();
|
|
22261
22121
|
const current = useRef6();
|
|
22262
|
-
|
|
22122
|
+
useEffect10(() => {
|
|
22263
22123
|
current.current = input;
|
|
22264
22124
|
if (!input) {
|
|
22265
22125
|
setState(void 0);
|
|
@@ -22349,11 +22209,11 @@ var init_run_tokens_only = __esm({
|
|
|
22349
22209
|
});
|
|
22350
22210
|
|
|
22351
22211
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
22352
|
-
import { useEffect as
|
|
22212
|
+
import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
|
|
22353
22213
|
function useTokensOnly(input) {
|
|
22354
|
-
const [state2, setState] =
|
|
22214
|
+
const [state2, setState] = useState12();
|
|
22355
22215
|
const current = useRef7();
|
|
22356
|
-
|
|
22216
|
+
useEffect11(() => {
|
|
22357
22217
|
current.current = input;
|
|
22358
22218
|
if (!input) {
|
|
22359
22219
|
setState(void 0);
|
|
@@ -22607,32 +22467,32 @@ function CounterStrip(props) {
|
|
|
22607
22467
|
const labelAcc = condensed ? "Acc" : "Accepted";
|
|
22608
22468
|
const labelRej = condensed ? "Rej" : "Rejected";
|
|
22609
22469
|
const labelUnd = condensed ? "Und" : "Undecided";
|
|
22610
|
-
const
|
|
22470
|
+
const sep = condensed ? " | " : " ";
|
|
22611
22471
|
return /* @__PURE__ */ jsx23(Box20, { children: /* @__PURE__ */ jsxs20(Text20, { children: [
|
|
22612
22472
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22613
22473
|
labelGrp,
|
|
22614
22474
|
" "
|
|
22615
22475
|
] }),
|
|
22616
22476
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.groups }),
|
|
22617
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22477
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
22618
22478
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22619
22479
|
labelAcc,
|
|
22620
22480
|
" "
|
|
22621
22481
|
] }),
|
|
22622
22482
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: `${counters.accepted}/${counters.total}` }),
|
|
22623
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22483
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
22624
22484
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22625
22485
|
labelRej,
|
|
22626
22486
|
" "
|
|
22627
22487
|
] }),
|
|
22628
22488
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.rejected }),
|
|
22629
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22489
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep }),
|
|
22630
22490
|
/* @__PURE__ */ jsxs20(Text20, { color: PALETTE.muted, children: [
|
|
22631
22491
|
labelUnd,
|
|
22632
22492
|
" "
|
|
22633
22493
|
] }),
|
|
22634
22494
|
/* @__PURE__ */ jsx23(Text20, { bold: true, children: counters.undecided }),
|
|
22635
|
-
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children:
|
|
22495
|
+
/* @__PURE__ */ jsx23(Text20, { color: PALETTE.muted, children: sep })
|
|
22636
22496
|
] }) });
|
|
22637
22497
|
}
|
|
22638
22498
|
var init_CounterStrip = __esm({
|
|
@@ -23663,7 +23523,7 @@ var init_useImmediateInput = __esm({
|
|
|
23663
23523
|
|
|
23664
23524
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
23665
23525
|
import { useStdout as useStdout2 } from "ink";
|
|
23666
|
-
import { useEffect as
|
|
23526
|
+
import { useEffect as useEffect12, useState as useState13 } from "react";
|
|
23667
23527
|
function readTerminalSize(stdout) {
|
|
23668
23528
|
return {
|
|
23669
23529
|
columns: stdout?.columns ?? 80,
|
|
@@ -23672,8 +23532,8 @@ function readTerminalSize(stdout) {
|
|
|
23672
23532
|
}
|
|
23673
23533
|
function useTerminalSize() {
|
|
23674
23534
|
const { stdout } = useStdout2();
|
|
23675
|
-
const [size, setSize] =
|
|
23676
|
-
|
|
23535
|
+
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
23536
|
+
useEffect12(() => {
|
|
23677
23537
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
23678
23538
|
stdout?.on("resize", updateSize);
|
|
23679
23539
|
updateSize();
|
|
@@ -24400,15 +24260,15 @@ var init_group_collapse = __esm({
|
|
|
24400
24260
|
});
|
|
24401
24261
|
|
|
24402
24262
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/sidebar-search-state.ts
|
|
24403
|
-
import { useState as
|
|
24263
|
+
import { useState as useState14 } from "react";
|
|
24404
24264
|
function useSidebarSearchState() {
|
|
24405
|
-
const [searchOpen, setSearchOpen] =
|
|
24406
|
-
const [searchQuery, setSearchQuery] =
|
|
24407
|
-
const [autocompleteCandidates, setAutocompleteCandidates] =
|
|
24408
|
-
const [jumpFilterTarget, setJumpFilterTarget] =
|
|
24409
|
-
const [columnOneView, setColumnOneView] =
|
|
24410
|
-
const [activeFilters, setActiveFilters] =
|
|
24411
|
-
const [showHelp, setShowHelp] =
|
|
24265
|
+
const [searchOpen, setSearchOpen] = useState14(false);
|
|
24266
|
+
const [searchQuery, setSearchQuery] = useState14("");
|
|
24267
|
+
const [autocompleteCandidates, setAutocompleteCandidates] = useState14([]);
|
|
24268
|
+
const [jumpFilterTarget, setJumpFilterTarget] = useState14(null);
|
|
24269
|
+
const [columnOneView, setColumnOneView] = useState14("grouped");
|
|
24270
|
+
const [activeFilters, setActiveFilters] = useState14(/* @__PURE__ */ new Set());
|
|
24271
|
+
const [showHelp, setShowHelp] = useState14(false);
|
|
24412
24272
|
return {
|
|
24413
24273
|
searchOpen,
|
|
24414
24274
|
setSearchOpen,
|
|
@@ -24433,10 +24293,10 @@ var init_sidebar_search_state = __esm({
|
|
|
24433
24293
|
});
|
|
24434
24294
|
|
|
24435
24295
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useOverlayPanel.ts
|
|
24436
|
-
import { useCallback, useState as
|
|
24296
|
+
import { useCallback, useState as useState15 } from "react";
|
|
24437
24297
|
function useOverlayPanel(opts) {
|
|
24438
24298
|
const { toggleKey, onClose } = opts;
|
|
24439
|
-
const [isOpen, setIsOpen] =
|
|
24299
|
+
const [isOpen, setIsOpen] = useState15(false);
|
|
24440
24300
|
const open = useCallback(() => {
|
|
24441
24301
|
setIsOpen(true);
|
|
24442
24302
|
}, []);
|
|
@@ -24675,23 +24535,23 @@ var init_state = __esm({
|
|
|
24675
24535
|
});
|
|
24676
24536
|
|
|
24677
24537
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
24678
|
-
import { useEffect as
|
|
24538
|
+
import { useEffect as useEffect13, useMemo as useMemo3, useRef as useRef9, useState as useState16 } from "react";
|
|
24679
24539
|
function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
|
|
24680
24540
|
const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
|
|
24681
24541
|
const columnPlan = useMemo3(
|
|
24682
24542
|
() => computeColumnWidths(totalWidth, tokenCount > 0, tokensWidth),
|
|
24683
24543
|
[totalWidth, tokenCount, tokensWidth]
|
|
24684
24544
|
);
|
|
24685
|
-
const [decisions, setDecisions] =
|
|
24686
|
-
const [nav, setNav] =
|
|
24687
|
-
const [focusedColumn, setFocusedColumn] =
|
|
24688
|
-
const [tokensCursor, setTokensCursor] =
|
|
24689
|
-
const [showDependencies, setShowDependencies] =
|
|
24690
|
-
const [cyclesPanelOpen, setCyclesPanelOpen] =
|
|
24691
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
24545
|
+
const [decisions, setDecisions] = useState16(/* @__PURE__ */ new Map());
|
|
24546
|
+
const [nav, setNav] = useState16({ cursor: 0, scrollOffset: 0 });
|
|
24547
|
+
const [focusedColumn, setFocusedColumn] = useState16("main");
|
|
24548
|
+
const [tokensCursor, setTokensCursor] = useState16(0);
|
|
24549
|
+
const [showDependencies, setShowDependencies] = useState16(false);
|
|
24550
|
+
const [cyclesPanelOpen, setCyclesPanelOpen] = useState16(false);
|
|
24551
|
+
const [cyclesCursor, setCyclesCursor] = useState16(0);
|
|
24692
24552
|
const aiRationalePanel = useOverlayPanel({ toggleKey: "x" });
|
|
24693
|
-
const [aiCursor, setAiCursor] =
|
|
24694
|
-
const [pendingRejectCascade, setPendingRejectCascade] =
|
|
24553
|
+
const [aiCursor, setAiCursor] = useState16(0);
|
|
24554
|
+
const [pendingRejectCascade, setPendingRejectCascade] = useState16(null);
|
|
24695
24555
|
const search = useSidebarSearchState();
|
|
24696
24556
|
const {
|
|
24697
24557
|
searchOpen,
|
|
@@ -24716,13 +24576,13 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24716
24576
|
() => slotCycles.map((c2, i) => ({ cycleIndex: i, jumpTarget: c2.path[0] })),
|
|
24717
24577
|
[slotCycles]
|
|
24718
24578
|
);
|
|
24719
|
-
const [expandedGroups, setExpandedGroups] =
|
|
24579
|
+
const [expandedGroups, setExpandedGroups] = useState16(() => {
|
|
24720
24580
|
const seed = new Set(closures.keys());
|
|
24721
24581
|
for (const p of cycleParticipants) seed.add(p);
|
|
24722
24582
|
return seed;
|
|
24723
24583
|
});
|
|
24724
24584
|
const seededGroupsRef = useRef9(closures.size > 0 || cycleParticipants.size > 0);
|
|
24725
|
-
|
|
24585
|
+
useEffect13(() => {
|
|
24726
24586
|
if (seededGroupsRef.current) return;
|
|
24727
24587
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
24728
24588
|
seededGroupsRef.current = true;
|
|
@@ -24813,7 +24673,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24813
24673
|
entryCount: 0
|
|
24814
24674
|
});
|
|
24815
24675
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
24816
|
-
|
|
24676
|
+
useEffect13(() => {
|
|
24817
24677
|
setNav((prev) => {
|
|
24818
24678
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
24819
24679
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -25158,7 +25018,7 @@ var init_use_scope_gate = __esm({
|
|
|
25158
25018
|
});
|
|
25159
25019
|
|
|
25160
25020
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/screen.tsx
|
|
25161
|
-
import { useEffect as
|
|
25021
|
+
import { useEffect as useEffect14, useMemo as useMemo4 } from "react";
|
|
25162
25022
|
import { Box as Box25, Text as Text26 } from "ink";
|
|
25163
25023
|
import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
25164
25024
|
function ScopeGateScreen({
|
|
@@ -25172,7 +25032,7 @@ function ScopeGateScreen({
|
|
|
25172
25032
|
return loaded?.ok ? loaded.rows : [];
|
|
25173
25033
|
}, [tokensPath]);
|
|
25174
25034
|
const longest = useMemo4(() => longestEntries(tokens), [tokens]);
|
|
25175
|
-
|
|
25035
|
+
useEffect14(() => {
|
|
25176
25036
|
startDebugRun({
|
|
25177
25037
|
flow: "import/scope-gate",
|
|
25178
25038
|
step: "07-scope-gate",
|
|
@@ -25405,13 +25265,13 @@ var init_load2 = __esm({
|
|
|
25405
25265
|
});
|
|
25406
25266
|
|
|
25407
25267
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
25408
|
-
import { useEffect as
|
|
25268
|
+
import { useEffect as useEffect15, useMemo as useMemo5, useRef as useRef10, useState as useState17 } from "react";
|
|
25409
25269
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
25410
25270
|
const sessionId = input?.sessionId;
|
|
25411
25271
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
25412
25272
|
const cacheCheck = useRef10(void 0);
|
|
25413
|
-
const [confirmed, setConfirmed] =
|
|
25414
|
-
|
|
25273
|
+
const [confirmed, setConfirmed] = useState17();
|
|
25274
|
+
useEffect15(() => {
|
|
25415
25275
|
if (!sessionId || !loaded || loaded.ok) return;
|
|
25416
25276
|
startDebugRun({
|
|
25417
25277
|
flow: "import/scope-gate",
|
|
@@ -25425,7 +25285,7 @@ function useScopeGateFlow(input, deps = realDeps3) {
|
|
|
25425
25285
|
exitMethod: "discarded"
|
|
25426
25286
|
});
|
|
25427
25287
|
}, [sessionId, loaded]);
|
|
25428
|
-
|
|
25288
|
+
useEffect15(() => {
|
|
25429
25289
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
25430
25290
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
25431
25291
|
}, [input, loaded]);
|
|
@@ -25751,11 +25611,11 @@ var init_run2 = __esm({
|
|
|
25751
25611
|
});
|
|
25752
25612
|
|
|
25753
25613
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
25754
|
-
import { useEffect as
|
|
25614
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState18 } from "react";
|
|
25755
25615
|
function useGeneration(input) {
|
|
25756
|
-
const [state2, setState] =
|
|
25616
|
+
const [state2, setState] = useState18();
|
|
25757
25617
|
const current = useRef11();
|
|
25758
|
-
|
|
25618
|
+
useEffect16(() => {
|
|
25759
25619
|
current.current = input;
|
|
25760
25620
|
if (!input) {
|
|
25761
25621
|
setState(void 0);
|
|
@@ -25800,7 +25660,7 @@ var init_use_generation = __esm({
|
|
|
25800
25660
|
});
|
|
25801
25661
|
|
|
25802
25662
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
25803
|
-
import { join as
|
|
25663
|
+
import { join as join22 } from "node:path";
|
|
25804
25664
|
function buildFlowStart(input) {
|
|
25805
25665
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
25806
25666
|
const credentials = extraction.credentials ?? {
|
|
@@ -25813,7 +25673,7 @@ function buildFlowStart(input) {
|
|
|
25813
25673
|
handoff,
|
|
25814
25674
|
agent: extraction.agent,
|
|
25815
25675
|
projectPath: extraction.projectPath,
|
|
25816
|
-
outDir: extraction.projectPath ?
|
|
25676
|
+
outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
|
|
25817
25677
|
rawTokensPath: extraction.rawTokensPath,
|
|
25818
25678
|
credentials: {
|
|
25819
25679
|
spaceId: credentials.spaceId,
|
|
@@ -26845,7 +26705,7 @@ var init_scroll_offset = __esm({
|
|
|
26845
26705
|
});
|
|
26846
26706
|
|
|
26847
26707
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26848
|
-
import React13, { useEffect as
|
|
26708
|
+
import React13, { useEffect as useEffect17, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
26849
26709
|
import figures6 from "figures";
|
|
26850
26710
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26851
26711
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -27522,11 +27382,11 @@ function FieldEditor({
|
|
|
27522
27382
|
headerHeight = 2
|
|
27523
27383
|
}) {
|
|
27524
27384
|
const { state: initialState, error: parseError } = parseToState(value);
|
|
27525
|
-
const [editorState, setEditorState] =
|
|
27526
|
-
const [parseErr] =
|
|
27527
|
-
const [listScrollStart, setListScrollStart] =
|
|
27385
|
+
const [editorState, setEditorState] = useState19(initialState);
|
|
27386
|
+
const [parseErr] = useState19(parseError);
|
|
27387
|
+
const [listScrollStart, setListScrollStart] = useState19(0);
|
|
27528
27388
|
const initialFocusScrollApplied = React13.useRef(false);
|
|
27529
|
-
const [rowHeights, setRowHeights] =
|
|
27389
|
+
const [rowHeights, setRowHeights] = useState19({});
|
|
27530
27390
|
const rowMeasureRefs = React13.useRef(/* @__PURE__ */ new Map());
|
|
27531
27391
|
const initialFocus = (() => {
|
|
27532
27392
|
if (initialFocusTarget?.kind === "description") {
|
|
@@ -27594,25 +27454,25 @@ function FieldEditor({
|
|
|
27594
27454
|
textCursor: 0
|
|
27595
27455
|
};
|
|
27596
27456
|
})();
|
|
27597
|
-
const [focusLevel, setFocusLevel] =
|
|
27598
|
-
const [propIdx, setPropIdx] =
|
|
27599
|
-
const [slotIdx, setSlotIdx] =
|
|
27600
|
-
const [inSlots, setInSlots] =
|
|
27601
|
-
const [inComponentDesc, setInComponentDesc] =
|
|
27602
|
-
const [activeField, setActiveField] =
|
|
27603
|
-
const [editingField, setEditingField] =
|
|
27604
|
-
const [textCursor, setTextCursor] =
|
|
27605
|
-
const [valueCursor, setValueCursor] =
|
|
27606
|
-
const [editingValue, setEditingValue] =
|
|
27607
|
-
const [valueText, setValueText] =
|
|
27608
|
-
const [pickerCursor, setPickerCursor] =
|
|
27609
|
-
const [validationError, setValidationError] =
|
|
27610
|
-
const [cursorVisible] =
|
|
27611
|
-
const [sourceOpen, setSourceOpen] =
|
|
27612
|
-
const [rationaleOpen, setRationaleOpen] =
|
|
27613
|
-
const [rationaleScrollOffset, setRationaleScrollOffset] =
|
|
27614
|
-
const [showHelp, setShowHelp] =
|
|
27615
|
-
const [pendingDelete, setPendingDelete] =
|
|
27457
|
+
const [focusLevel, setFocusLevel] = useState19(initialFocus.focusLevel);
|
|
27458
|
+
const [propIdx, setPropIdx] = useState19(initialFocus.propIdx);
|
|
27459
|
+
const [slotIdx, setSlotIdx] = useState19(initialFocus.slotIdx);
|
|
27460
|
+
const [inSlots, setInSlots] = useState19(initialFocus.inSlots);
|
|
27461
|
+
const [inComponentDesc, setInComponentDesc] = useState19(initialFocus.focusLevel === "componentDescription");
|
|
27462
|
+
const [activeField, setActiveField] = useState19(initialFocus.activeField);
|
|
27463
|
+
const [editingField, setEditingField] = useState19(false);
|
|
27464
|
+
const [textCursor, setTextCursor] = useState19(initialFocus.textCursor);
|
|
27465
|
+
const [valueCursor, setValueCursor] = useState19(0);
|
|
27466
|
+
const [editingValue, setEditingValue] = useState19(null);
|
|
27467
|
+
const [valueText, setValueText] = useState19("");
|
|
27468
|
+
const [pickerCursor, setPickerCursor] = useState19(0);
|
|
27469
|
+
const [validationError, setValidationError] = useState19(null);
|
|
27470
|
+
const [cursorVisible] = useState19(true);
|
|
27471
|
+
const [sourceOpen, setSourceOpen] = useState19(false);
|
|
27472
|
+
const [rationaleOpen, setRationaleOpen] = useState19(false);
|
|
27473
|
+
const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
|
|
27474
|
+
const [showHelp, setShowHelp] = useState19(false);
|
|
27475
|
+
const [pendingDelete, setPendingDelete] = useState19(null);
|
|
27616
27476
|
const props = editorState.props;
|
|
27617
27477
|
const slots = editorState.slots;
|
|
27618
27478
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -28372,7 +28232,7 @@ function FieldEditor({
|
|
|
28372
28232
|
}
|
|
28373
28233
|
return Math.max(start + 1, end2);
|
|
28374
28234
|
};
|
|
28375
|
-
|
|
28235
|
+
useEffect17(() => {
|
|
28376
28236
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
28377
28237
|
setListScrollStart((previous) => {
|
|
28378
28238
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -29767,7 +29627,7 @@ var init_FinalizeDialog = __esm({
|
|
|
29767
29627
|
});
|
|
29768
29628
|
|
|
29769
29629
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
29770
|
-
import { useEffect as
|
|
29630
|
+
import { useEffect as useEffect18, useRef as useRef12, useState as useState20 } from "react";
|
|
29771
29631
|
function useReviewFinalizePreview({
|
|
29772
29632
|
components,
|
|
29773
29633
|
...options
|
|
@@ -29779,12 +29639,12 @@ function useReviewFinalizePreview({
|
|
|
29779
29639
|
}
|
|
29780
29640
|
function useFinalizePreview(opts) {
|
|
29781
29641
|
const { open, extractSessionId, tokensPath, spaceId, environmentId, cmaToken, host, acceptedKeys } = opts;
|
|
29782
|
-
const [status, setStatus] =
|
|
29783
|
-
const [removed, setRemoved] =
|
|
29784
|
-
const [scrollOffset, setScrollOffset] =
|
|
29642
|
+
const [status, setStatus] = useState20("idle");
|
|
29643
|
+
const [removed, setRemoved] = useState20([]);
|
|
29644
|
+
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
29785
29645
|
const generationRef = useRef12(0);
|
|
29786
29646
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
29787
|
-
|
|
29647
|
+
useEffect18(() => {
|
|
29788
29648
|
if (!open) {
|
|
29789
29649
|
setStatus("idle");
|
|
29790
29650
|
setRemoved([]);
|
|
@@ -29836,16 +29696,16 @@ var init_use_finalize_preview = __esm({
|
|
|
29836
29696
|
});
|
|
29837
29697
|
|
|
29838
29698
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
29839
|
-
import { useCallback as useCallback2, useEffect as
|
|
29699
|
+
import { useCallback as useCallback2, useEffect as useEffect19, useRef as useRef13, useState as useState21 } from "react";
|
|
29840
29700
|
function useReviewSession({
|
|
29841
29701
|
loadSession,
|
|
29842
29702
|
tokensPath,
|
|
29843
29703
|
onExtraLoaded
|
|
29844
29704
|
}) {
|
|
29845
|
-
const [components, setComponents] =
|
|
29846
|
-
const [loading, setLoading] =
|
|
29847
|
-
const [loadError, setLoadError] =
|
|
29848
|
-
const [availableTokens, setAvailableTokens] =
|
|
29705
|
+
const [components, setComponents] = useState21([]);
|
|
29706
|
+
const [loading, setLoading] = useState21(true);
|
|
29707
|
+
const [loadError, setLoadError] = useState21(null);
|
|
29708
|
+
const [availableTokens, setAvailableTokens] = useState21([]);
|
|
29849
29709
|
const loadInitialState = useCallback2(async () => {
|
|
29850
29710
|
const result = loadSession();
|
|
29851
29711
|
if (result.error || !tokensPath) return { result, catalog: result.tokens };
|
|
@@ -29855,7 +29715,7 @@ function useReviewSession({
|
|
|
29855
29715
|
}));
|
|
29856
29716
|
return { result, catalog };
|
|
29857
29717
|
}, [loadSession, tokensPath]);
|
|
29858
|
-
|
|
29718
|
+
useEffect19(() => {
|
|
29859
29719
|
let disposed = false;
|
|
29860
29720
|
void (async () => {
|
|
29861
29721
|
try {
|
|
@@ -29906,9 +29766,9 @@ function useReviewSession({
|
|
|
29906
29766
|
};
|
|
29907
29767
|
}
|
|
29908
29768
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29909
|
-
const [reviewMetadata, setReviewMetadata] =
|
|
29910
|
-
const [componentRationale, setComponentRationale] =
|
|
29911
|
-
|
|
29769
|
+
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
29770
|
+
const [componentRationale, setComponentRationale] = useState21(null);
|
|
29771
|
+
useEffect19(() => {
|
|
29912
29772
|
const current = components[selectedIdx];
|
|
29913
29773
|
if (!current) {
|
|
29914
29774
|
setReviewMetadata(null);
|
|
@@ -29946,7 +29806,7 @@ function useReviewHistory({
|
|
|
29946
29806
|
}) {
|
|
29947
29807
|
const historyRef = useRef13(null);
|
|
29948
29808
|
const historySeededRef = useRef13(false);
|
|
29949
|
-
|
|
29809
|
+
useEffect19(() => {
|
|
29950
29810
|
if (loading || historySeededRef.current) return;
|
|
29951
29811
|
historySeededRef.current = true;
|
|
29952
29812
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -30033,7 +29893,7 @@ var init_token_suggestions = __esm({
|
|
|
30033
29893
|
});
|
|
30034
29894
|
|
|
30035
29895
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
30036
|
-
import { useEffect as
|
|
29896
|
+
import { useEffect as useEffect20, useRef as useRef14, useState as useState22 } from "react";
|
|
30037
29897
|
function parseReviewEntry(draftValue) {
|
|
30038
29898
|
const parsed = JSON.parse(draftValue);
|
|
30039
29899
|
const keys = Object.keys(parsed);
|
|
@@ -30053,21 +29913,21 @@ function useReviewEditor({
|
|
|
30053
29913
|
onEditSaved,
|
|
30054
29914
|
onTokenSaved
|
|
30055
29915
|
}) {
|
|
30056
|
-
const [panelOpen, setPanelOpen] =
|
|
30057
|
-
const [panelScrollOffset, setPanelScrollOffset] =
|
|
30058
|
-
const [jsonScrollOffset, setJsonScrollOffset] =
|
|
30059
|
-
const [textEntryActive, setTextEntryActive] =
|
|
30060
|
-
const [showJson, setShowJson] =
|
|
30061
|
-
const [showHiddenProps, setShowHiddenProps] =
|
|
30062
|
-
const [draftValue, setDraftValue] =
|
|
30063
|
-
const [saveError, setSaveError] =
|
|
30064
|
-
const [tokenReviewRow, setTokenReviewRow] =
|
|
30065
|
-
const [tokenReviewEditing, setTokenReviewEditing] =
|
|
30066
|
-
const [tokenReviewEditCursor, setTokenReviewEditCursor] =
|
|
30067
|
-
const [tokenReviewEditSelection, setTokenReviewEditSelection] =
|
|
29916
|
+
const [panelOpen, setPanelOpen] = useState22("none");
|
|
29917
|
+
const [panelScrollOffset, setPanelScrollOffset] = useState22(0);
|
|
29918
|
+
const [jsonScrollOffset, setJsonScrollOffset] = useState22(0);
|
|
29919
|
+
const [textEntryActive, setTextEntryActive] = useState22(false);
|
|
29920
|
+
const [showJson, setShowJson] = useState22(false);
|
|
29921
|
+
const [showHiddenProps, setShowHiddenProps] = useState22(false);
|
|
29922
|
+
const [draftValue, setDraftValue] = useState22("");
|
|
29923
|
+
const [saveError, setSaveError] = useState22(null);
|
|
29924
|
+
const [tokenReviewRow, setTokenReviewRow] = useState22(0);
|
|
29925
|
+
const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
|
|
29926
|
+
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
|
|
29927
|
+
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
30068
29928
|
const tokenReviewSuggestedRef = useRef14(/* @__PURE__ */ new Map());
|
|
30069
29929
|
const pendingGRef = useRef14(false);
|
|
30070
|
-
|
|
29930
|
+
useEffect20(() => {
|
|
30071
29931
|
setTokenReviewRow(0);
|
|
30072
29932
|
setTokenReviewEditing(false);
|
|
30073
29933
|
setTokenReviewEditCursor(0);
|
|
@@ -30187,12 +30047,12 @@ var init_use_review_editor = __esm({
|
|
|
30187
30047
|
});
|
|
30188
30048
|
|
|
30189
30049
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-surface-state.ts
|
|
30190
|
-
import { useState as
|
|
30050
|
+
import { useState as useState23 } from "react";
|
|
30191
30051
|
function useReviewSurfaceState(initialFinalizeError = null) {
|
|
30192
|
-
const [sidebarFocused, setSidebarFocused] =
|
|
30193
|
-
const [showFinalize, setShowFinalize] =
|
|
30194
|
-
const [showQuit, setShowQuit] =
|
|
30195
|
-
const [finalizeError, setFinalizeError] =
|
|
30052
|
+
const [sidebarFocused, setSidebarFocused] = useState23(true);
|
|
30053
|
+
const [showFinalize, setShowFinalize] = useState23(false);
|
|
30054
|
+
const [showQuit, setShowQuit] = useState23(false);
|
|
30055
|
+
const [finalizeError, setFinalizeError] = useState23(initialFinalizeError);
|
|
30196
30056
|
return {
|
|
30197
30057
|
sidebarFocused,
|
|
30198
30058
|
setSidebarFocused,
|
|
@@ -30549,24 +30409,24 @@ var init_preview_annotations = __esm({
|
|
|
30549
30409
|
});
|
|
30550
30410
|
|
|
30551
30411
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
30552
|
-
import { useCallback as useCallback3, useEffect as
|
|
30412
|
+
import { useCallback as useCallback3, useEffect as useEffect21, useRef as useRef15, useState as useState24 } from "react";
|
|
30553
30413
|
function useLivePreview(opts) {
|
|
30554
30414
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
30555
|
-
const [status, setStatus] =
|
|
30556
|
-
const [disabled, setDisabled] =
|
|
30415
|
+
const [status, setStatus] = useState24("idle");
|
|
30416
|
+
const [disabled, setDisabled] = useState24(false);
|
|
30557
30417
|
const timerRef = useRef15(null);
|
|
30558
30418
|
const generationRef = useRef15(0);
|
|
30559
30419
|
const latestRef = useRef15(0);
|
|
30560
30420
|
const inflightRef = useRef15(0);
|
|
30561
30421
|
const optsRef = useRef15(opts);
|
|
30562
|
-
|
|
30422
|
+
useEffect21(() => {
|
|
30563
30423
|
optsRef.current = opts;
|
|
30564
30424
|
});
|
|
30565
30425
|
const disabledRef = useRef15(disabled);
|
|
30566
|
-
|
|
30426
|
+
useEffect21(() => {
|
|
30567
30427
|
disabledRef.current = disabled;
|
|
30568
30428
|
}, [disabled]);
|
|
30569
|
-
|
|
30429
|
+
useEffect21(() => {
|
|
30570
30430
|
return () => {
|
|
30571
30431
|
if (timerRef.current) {
|
|
30572
30432
|
clearTimeout(timerRef.current);
|
|
@@ -30647,7 +30507,7 @@ var init_use_live_preview = __esm({
|
|
|
30647
30507
|
});
|
|
30648
30508
|
|
|
30649
30509
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
30650
|
-
import { useCallback as useCallback4, useEffect as
|
|
30510
|
+
import { useCallback as useCallback4, useEffect as useEffect22, useState as useState25 } from "react";
|
|
30651
30511
|
function useReviewPreview({
|
|
30652
30512
|
components,
|
|
30653
30513
|
loading,
|
|
@@ -30661,8 +30521,8 @@ function useReviewPreview({
|
|
|
30661
30521
|
deleteAllComponents,
|
|
30662
30522
|
onResult
|
|
30663
30523
|
}) {
|
|
30664
|
-
const [previewAnnotations, setPreviewAnnotations] =
|
|
30665
|
-
const [removedComponents, setRemovedComponents] =
|
|
30524
|
+
const [previewAnnotations, setPreviewAnnotations] = useState25(/* @__PURE__ */ new Map());
|
|
30525
|
+
const [removedComponents, setRemovedComponents] = useState25([]);
|
|
30666
30526
|
const handleResult = useCallback4(
|
|
30667
30527
|
(response) => {
|
|
30668
30528
|
if (!response) return;
|
|
@@ -30688,14 +30548,14 @@ function useReviewPreview({
|
|
|
30688
30548
|
onResult: handleResult,
|
|
30689
30549
|
deleteAllComponents
|
|
30690
30550
|
});
|
|
30691
|
-
const [spinnerTick, setSpinnerTick] =
|
|
30692
|
-
|
|
30551
|
+
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
30552
|
+
useEffect22(() => {
|
|
30693
30553
|
if (livePreviewHook.status !== "running") return;
|
|
30694
30554
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
30695
30555
|
return () => clearInterval(id);
|
|
30696
30556
|
}, [livePreviewHook.status]);
|
|
30697
30557
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
30698
|
-
|
|
30558
|
+
useEffect22(() => {
|
|
30699
30559
|
if (loading) return;
|
|
30700
30560
|
if (!livePreview) return;
|
|
30701
30561
|
if (components.length === 0) return;
|
|
@@ -30780,7 +30640,7 @@ var init_review_log = __esm({
|
|
|
30780
30640
|
});
|
|
30781
30641
|
|
|
30782
30642
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-log.ts
|
|
30783
|
-
import { useEffect as
|
|
30643
|
+
import { useEffect as useEffect23, useRef as useRef16 } from "react";
|
|
30784
30644
|
function useReviewLog({
|
|
30785
30645
|
loading,
|
|
30786
30646
|
loadError,
|
|
@@ -30790,7 +30650,7 @@ function useReviewLog({
|
|
|
30790
30650
|
const started = useRef16(false);
|
|
30791
30651
|
const latest = useRef16(components);
|
|
30792
30652
|
latest.current = components;
|
|
30793
|
-
|
|
30653
|
+
useEffect23(() => {
|
|
30794
30654
|
if (loading || started.current) return;
|
|
30795
30655
|
started.current = true;
|
|
30796
30656
|
startDebugRun({ ...REVIEW_RUN, inputs: reviewInputs(components) });
|
|
@@ -30805,7 +30665,7 @@ function useReviewLog({
|
|
|
30805
30665
|
trail.current = openReviewTrail(components, Date.now());
|
|
30806
30666
|
setDebugRunProgress(reviewProgress(trail.current, components, Date.now()));
|
|
30807
30667
|
}, [loading, loadError, components]);
|
|
30808
|
-
|
|
30668
|
+
useEffect23(
|
|
30809
30669
|
() => () => {
|
|
30810
30670
|
const open = trail.current;
|
|
30811
30671
|
trail.current = void 0;
|
|
@@ -30873,7 +30733,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
30873
30733
|
});
|
|
30874
30734
|
|
|
30875
30735
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
30876
|
-
import { useCallback as useCallback5, useEffect as
|
|
30736
|
+
import { useCallback as useCallback5, useEffect as useEffect24, useMemo as useMemo6, useRef as useRef17, useState as useState26 } from "react";
|
|
30877
30737
|
import figures8 from "figures";
|
|
30878
30738
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
30879
30739
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -31038,7 +30898,7 @@ function GenerateReviewStepView({
|
|
|
31038
30898
|
initialFinalizeError = null
|
|
31039
30899
|
}) {
|
|
31040
30900
|
const { columns: terminalWidth, rows: terminalRows } = useTerminalSize();
|
|
31041
|
-
const [slotCycles, setSlotCycles] =
|
|
30901
|
+
const [slotCycles, setSlotCycles] = useState26([]);
|
|
31042
30902
|
const setLoadedSlotCycles = useCallback5((cycles) => {
|
|
31043
30903
|
setSlotCycles(cycles ?? []);
|
|
31044
30904
|
}, []);
|
|
@@ -31071,7 +30931,7 @@ function GenerateReviewStepView({
|
|
|
31071
30931
|
onExtraLoaded: setLoadedSlotCycles
|
|
31072
30932
|
});
|
|
31073
30933
|
const reviewLog = useReviewLog({ loading, loadError, components });
|
|
31074
|
-
const [nav, setNav] =
|
|
30934
|
+
const [nav, setNav] = useState26({
|
|
31075
30935
|
cursorRowIdx: 0,
|
|
31076
30936
|
sidebarScrollOffset: 0
|
|
31077
30937
|
});
|
|
@@ -31087,10 +30947,10 @@ function GenerateReviewStepView({
|
|
|
31087
30947
|
finalizeError,
|
|
31088
30948
|
setFinalizeError
|
|
31089
30949
|
} = reviewSurface;
|
|
31090
|
-
const [removedBannerCollapsed, setRemovedBannerCollapsed] =
|
|
30950
|
+
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
31091
30951
|
const removedBannerDefaultedRef = useRef17(false);
|
|
31092
|
-
const [cyclePanelScroll, setCyclePanelScroll] =
|
|
31093
|
-
const [cyclesCursor, setCyclesCursor] =
|
|
30952
|
+
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
30953
|
+
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
31094
30954
|
const cyclePanel = useOverlayPanel({
|
|
31095
30955
|
toggleKey: "c",
|
|
31096
30956
|
onClose: () => {
|
|
@@ -31105,9 +30965,9 @@ function GenerateReviewStepView({
|
|
|
31105
30965
|
setBreakConfirm(false);
|
|
31106
30966
|
}
|
|
31107
30967
|
});
|
|
31108
|
-
const [breakCursor, setBreakCursor] =
|
|
31109
|
-
const [breakConfirm, setBreakConfirm] =
|
|
31110
|
-
const [expandedGroups, setExpandedGroups] =
|
|
30968
|
+
const [breakCursor, setBreakCursor] = useState26(0);
|
|
30969
|
+
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
30970
|
+
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
31111
30971
|
const seededGroupsRef = useRef17(false);
|
|
31112
30972
|
const {
|
|
31113
30973
|
searchOpen,
|
|
@@ -31126,14 +30986,14 @@ function GenerateReviewStepView({
|
|
|
31126
30986
|
setShowHelp
|
|
31127
30987
|
} = useSidebarSearchState();
|
|
31128
30988
|
const breakingPanel = useOverlayPanel({ toggleKey: "b", onClose: () => setBreakingDetailOpen(false) });
|
|
31129
|
-
const [breakingChanges, setBreakingChanges] =
|
|
31130
|
-
const [breakingCursor, setBreakingCursor] =
|
|
31131
|
-
const [breakingDetailOpen, setBreakingDetailOpen] =
|
|
31132
|
-
const [pendingEditorFocus, setPendingEditorFocus] =
|
|
31133
|
-
const [autoRejected, setAutoRejected] =
|
|
31134
|
-
const [undoSnapshot, setUndoSnapshot] =
|
|
30989
|
+
const [breakingChanges, setBreakingChanges] = useState26([]);
|
|
30990
|
+
const [breakingCursor, setBreakingCursor] = useState26(0);
|
|
30991
|
+
const [breakingDetailOpen, setBreakingDetailOpen] = useState26(false);
|
|
30992
|
+
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
30993
|
+
const [autoRejected, setAutoRejected] = useState26([]);
|
|
30994
|
+
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
31135
30995
|
const autoRejectFiredRef = useRef17(false);
|
|
31136
|
-
const [showReloadDialog, setShowReloadDialog] =
|
|
30996
|
+
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
31137
30997
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
31138
30998
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
31139
30999
|
components,
|
|
@@ -31198,7 +31058,7 @@ function GenerateReviewStepView({
|
|
|
31198
31058
|
[components]
|
|
31199
31059
|
);
|
|
31200
31060
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
31201
|
-
|
|
31061
|
+
useEffect24(() => {
|
|
31202
31062
|
if (seededGroupsRef.current) return;
|
|
31203
31063
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
31204
31064
|
seededGroupsRef.current = true;
|
|
@@ -31225,7 +31085,7 @@ function GenerateReviewStepView({
|
|
|
31225
31085
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
31226
31086
|
}));
|
|
31227
31087
|
}, [slotCycles, cycleView]);
|
|
31228
|
-
|
|
31088
|
+
useEffect24(() => {
|
|
31229
31089
|
const decision = computeAutoRejectDecision({
|
|
31230
31090
|
loading,
|
|
31231
31091
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -31270,7 +31130,7 @@ function GenerateReviewStepView({
|
|
|
31270
31130
|
onAction: reviewLog.record
|
|
31271
31131
|
});
|
|
31272
31132
|
const autoRejectPushedRef = useRef17(false);
|
|
31273
|
-
|
|
31133
|
+
useEffect24(() => {
|
|
31274
31134
|
if (loading) return;
|
|
31275
31135
|
if (!historySeededRef.current) return;
|
|
31276
31136
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -31354,7 +31214,7 @@ function GenerateReviewStepView({
|
|
|
31354
31214
|
const panelHeight = leftPanelHeight + 2;
|
|
31355
31215
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
31356
31216
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
31357
|
-
|
|
31217
|
+
useEffect24(() => {
|
|
31358
31218
|
if (selectableRowPositions.length === 0) return;
|
|
31359
31219
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
31360
31220
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -32437,10 +32297,10 @@ var init_path_utils = __esm({
|
|
|
32437
32297
|
});
|
|
32438
32298
|
|
|
32439
32299
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
32440
|
-
import { useEffect as
|
|
32300
|
+
import { useEffect as useEffect25, useState as useState27 } from "react";
|
|
32441
32301
|
function useBlinkingCursor() {
|
|
32442
|
-
const [visible, setVisible] =
|
|
32443
|
-
|
|
32302
|
+
const [visible, setVisible] = useState27(true);
|
|
32303
|
+
useEffect25(() => {
|
|
32444
32304
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
32445
32305
|
return () => clearInterval(interval);
|
|
32446
32306
|
}, []);
|
|
@@ -32453,16 +32313,16 @@ var init_use_blinking_cursor = __esm({
|
|
|
32453
32313
|
});
|
|
32454
32314
|
|
|
32455
32315
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
32456
|
-
import { useState as
|
|
32316
|
+
import { useState as useState28 } from "react";
|
|
32457
32317
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
32458
32318
|
import { readdirSync as readdirSync4 } from "node:fs";
|
|
32459
|
-
import { dirname as dirname17, basename as
|
|
32319
|
+
import { dirname as dirname17, basename as basename6, join as join23 } from "node:path";
|
|
32460
32320
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
32461
32321
|
function autocomplete(partial) {
|
|
32462
32322
|
if (!partial) return null;
|
|
32463
32323
|
const normalized = normalizePath(partial);
|
|
32464
32324
|
const dir = dirname17(normalized);
|
|
32465
|
-
const base =
|
|
32325
|
+
const base = basename6(normalized);
|
|
32466
32326
|
let entries;
|
|
32467
32327
|
try {
|
|
32468
32328
|
entries = readdirSync4(dir);
|
|
@@ -32471,13 +32331,13 @@ function autocomplete(partial) {
|
|
|
32471
32331
|
}
|
|
32472
32332
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
32473
32333
|
if (matches.length === 0) return null;
|
|
32474
|
-
if (matches.length === 1) return
|
|
32334
|
+
if (matches.length === 1) return join23(dir, matches[0]);
|
|
32475
32335
|
let prefix = matches[0];
|
|
32476
32336
|
for (const m of matches) {
|
|
32477
32337
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
32478
32338
|
if (!prefix) break;
|
|
32479
32339
|
}
|
|
32480
|
-
return prefix.length > base.length ?
|
|
32340
|
+
return prefix.length > base.length ? join23(dir, prefix) : null;
|
|
32481
32341
|
}
|
|
32482
32342
|
function PathPrompt({
|
|
32483
32343
|
defaultPath,
|
|
@@ -32486,7 +32346,7 @@ function PathPrompt({
|
|
|
32486
32346
|
label = "Save to",
|
|
32487
32347
|
summary
|
|
32488
32348
|
}) {
|
|
32489
|
-
const [input, setInput] =
|
|
32349
|
+
const [input, setInput] = useState28("");
|
|
32490
32350
|
const cursorVisible = useBlinkingCursor();
|
|
32491
32351
|
useImmediateInput((rawInput, key) => {
|
|
32492
32352
|
if (key.return) {
|
|
@@ -32577,12 +32437,12 @@ var init_produced = __esm({
|
|
|
32577
32437
|
});
|
|
32578
32438
|
|
|
32579
32439
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
32580
|
-
import { useEffect as
|
|
32440
|
+
import { useEffect as useEffect26, useState as useState29 } from "react";
|
|
32581
32441
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
32582
32442
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
32583
32443
|
function useTimedSpinner() {
|
|
32584
|
-
const [elapsedSeconds, setElapsedSeconds] =
|
|
32585
|
-
|
|
32444
|
+
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
32445
|
+
useEffect26(() => {
|
|
32586
32446
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
32587
32447
|
return () => {
|
|
32588
32448
|
clearInterval(timer);
|
|
@@ -32855,7 +32715,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
32855
32715
|
});
|
|
32856
32716
|
|
|
32857
32717
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
32858
|
-
import { useEffect as
|
|
32718
|
+
import { useEffect as useEffect27, useState as useState30, useMemo as useMemo7 } from "react";
|
|
32859
32719
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
32860
32720
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
32861
32721
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -33049,8 +32909,8 @@ function WizardPreviewStep({
|
|
|
33049
32909
|
onQuit
|
|
33050
32910
|
}) {
|
|
33051
32911
|
const breakingWithImpact = hasBreakingChangesWithImpact(preview);
|
|
33052
|
-
const [diffExpanded, setDiffExpanded] =
|
|
33053
|
-
const [scrollOffset, setScrollOffset] =
|
|
32912
|
+
const [diffExpanded, setDiffExpanded] = useState30(false);
|
|
32913
|
+
const [scrollOffset, setScrollOffset] = useState30(0);
|
|
33054
32914
|
const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
|
|
33055
32915
|
const summaryLines = useMemo7(() => buildPreviewSummaryLines(preview), [preview]);
|
|
33056
32916
|
const diffLines = useMemo7(() => buildPreviewDiffLines(preview), [preview]);
|
|
@@ -33065,7 +32925,7 @@ function WizardPreviewStep({
|
|
|
33065
32925
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
33066
32926
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
33067
32927
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
33068
|
-
|
|
32928
|
+
useEffect27(() => {
|
|
33069
32929
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
33070
32930
|
}, [maxScroll]);
|
|
33071
32931
|
useImmediateInput((input, key) => {
|
|
@@ -33332,11 +33192,11 @@ var init_flow_log = __esm({
|
|
|
33332
33192
|
});
|
|
33333
33193
|
|
|
33334
33194
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow-log.ts
|
|
33335
|
-
import { useEffect as
|
|
33195
|
+
import { useEffect as useEffect28, useRef as useRef18 } from "react";
|
|
33336
33196
|
function useFlowLog(state2) {
|
|
33337
33197
|
const trail = useRef18(void 0);
|
|
33338
33198
|
const previous = useRef18(void 0);
|
|
33339
|
-
|
|
33199
|
+
useEffect28(() => {
|
|
33340
33200
|
const before = previous.current;
|
|
33341
33201
|
previous.current = state2;
|
|
33342
33202
|
const moved = before !== void 0 && before.step !== state2.step;
|
|
@@ -33359,7 +33219,7 @@ function useFlowLog(state2) {
|
|
|
33359
33219
|
trail.current = open;
|
|
33360
33220
|
setDebugRunProgress(flowProgress(open, now));
|
|
33361
33221
|
}, [state2]);
|
|
33362
|
-
|
|
33222
|
+
useEffect28(
|
|
33363
33223
|
() => () => {
|
|
33364
33224
|
const open = trail.current;
|
|
33365
33225
|
trail.current = void 0;
|
|
@@ -33906,8 +33766,8 @@ var init_run_print_files_helpers = __esm({
|
|
|
33906
33766
|
});
|
|
33907
33767
|
|
|
33908
33768
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
33909
|
-
import { writeFile as
|
|
33910
|
-
import { join as
|
|
33769
|
+
import { writeFile as writeFile8 } from "node:fs/promises";
|
|
33770
|
+
import { join as join24 } from "node:path";
|
|
33911
33771
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
33912
33772
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
33913
33773
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -33919,7 +33779,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
33919
33779
|
}
|
|
33920
33780
|
async function runPrintFiles(input, deps, onPatch) {
|
|
33921
33781
|
onPatch({ step: "printing" });
|
|
33922
|
-
const componentsPath =
|
|
33782
|
+
const componentsPath = join24(input.outDir, "components.json");
|
|
33923
33783
|
try {
|
|
33924
33784
|
const db = deps.openDb();
|
|
33925
33785
|
let components = [];
|
|
@@ -34008,7 +33868,7 @@ var init_save = __esm({
|
|
|
34008
33868
|
realSaveDeps = () => ({
|
|
34009
33869
|
openDb: openPipelineDb,
|
|
34010
33870
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
34011
|
-
writeFile: (path5, contents) =>
|
|
33871
|
+
writeFile: (path5, contents) => writeFile8(path5, contents),
|
|
34012
33872
|
appendRun,
|
|
34013
33873
|
buildSourceFingerprint,
|
|
34014
33874
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -34033,7 +33893,7 @@ var init_types9 = __esm({
|
|
|
34033
33893
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
34034
33894
|
import { mkdir as mkdir9 } from "node:fs/promises";
|
|
34035
33895
|
import { tmpdir } from "node:os";
|
|
34036
|
-
import { join as
|
|
33896
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
34037
33897
|
function appendWizardLog(entry) {
|
|
34038
33898
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
34039
33899
|
}
|
|
@@ -34318,12 +34178,12 @@ var init_controller = __esm({
|
|
|
34318
34178
|
init_push();
|
|
34319
34179
|
init_save();
|
|
34320
34180
|
init_types9();
|
|
34321
|
-
WIZARD_LOG =
|
|
34181
|
+
WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
34322
34182
|
}
|
|
34323
34183
|
});
|
|
34324
34184
|
|
|
34325
34185
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
34326
|
-
import { useEffect as
|
|
34186
|
+
import { useEffect as useEffect29, useRef as useRef19, useSyncExternalStore } from "react";
|
|
34327
34187
|
function useFlow(start, options = {}) {
|
|
34328
34188
|
const controller = useRef19();
|
|
34329
34189
|
if (start && !controller.current) {
|
|
@@ -34342,7 +34202,7 @@ function useFlow(start, options = {}) {
|
|
|
34342
34202
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
34343
34203
|
() => current?.getState()
|
|
34344
34204
|
);
|
|
34345
|
-
|
|
34205
|
+
useEffect29(() => {
|
|
34346
34206
|
if (!start) controller.current = void 0;
|
|
34347
34207
|
}, [start]);
|
|
34348
34208
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
@@ -34355,7 +34215,7 @@ var init_use_flow = __esm({
|
|
|
34355
34215
|
});
|
|
34356
34216
|
|
|
34357
34217
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
34358
|
-
import { join as
|
|
34218
|
+
import { join as join26, resolve as resolve28 } from "node:path";
|
|
34359
34219
|
function describeFileLocations({
|
|
34360
34220
|
contentfulBaseDir,
|
|
34361
34221
|
debugModeEnabled,
|
|
@@ -34364,14 +34224,14 @@ function describeFileLocations({
|
|
|
34364
34224
|
if (!debugModeEnabled) {
|
|
34365
34225
|
return {
|
|
34366
34226
|
debugLogs: "none while Debug Mode is off",
|
|
34367
|
-
importFiles: `${
|
|
34227
|
+
importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
|
|
34368
34228
|
};
|
|
34369
34229
|
}
|
|
34370
34230
|
const base = contentfulBaseDir ? resolve28(contentfulBaseDir) : "<project>";
|
|
34371
|
-
const session = currentSessionDir2 ??
|
|
34231
|
+
const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
|
|
34372
34232
|
return {
|
|
34373
|
-
debugLogs:
|
|
34374
|
-
importFiles: `${
|
|
34233
|
+
debugLogs: join26(session, "debug"),
|
|
34234
|
+
importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
|
|
34375
34235
|
};
|
|
34376
34236
|
}
|
|
34377
34237
|
var init_file_locations = __esm({
|
|
@@ -34421,7 +34281,7 @@ var init_help_info = __esm({
|
|
|
34421
34281
|
});
|
|
34422
34282
|
|
|
34423
34283
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
34424
|
-
import { useEffect as
|
|
34284
|
+
import { useEffect as useEffect30, useState as useState31 } from "react";
|
|
34425
34285
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
34426
34286
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
34427
34287
|
function Section({ title, rows }) {
|
|
@@ -34434,8 +34294,8 @@ function Section({ title, rows }) {
|
|
|
34434
34294
|
] });
|
|
34435
34295
|
}
|
|
34436
34296
|
function HelpScreen({ onDone }) {
|
|
34437
|
-
const [info, setInfo] =
|
|
34438
|
-
|
|
34297
|
+
const [info, setInfo] = useState31();
|
|
34298
|
+
useEffect30(() => {
|
|
34439
34299
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
34440
34300
|
void readHelpInfo().then(setInfo);
|
|
34441
34301
|
}, []);
|
|
@@ -34482,14 +34342,14 @@ var init_PageContainer2 = __esm({
|
|
|
34482
34342
|
});
|
|
34483
34343
|
|
|
34484
34344
|
// packages/experience-design-system-cli/src/tui/settings/PageContainer.tsx
|
|
34485
|
-
import { useState as
|
|
34345
|
+
import { useState as useState32 } from "react";
|
|
34486
34346
|
import { Box as Box47, Text as Text48, useInput as useInput14 } from "ink";
|
|
34487
34347
|
import { jsx as jsx58, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
34488
34348
|
function SettingsScreen({
|
|
34489
34349
|
onNavigate,
|
|
34490
34350
|
onBack
|
|
34491
34351
|
}) {
|
|
34492
|
-
const [focusIdx, setFocusIdx] =
|
|
34352
|
+
const [focusIdx, setFocusIdx] = useState32(0);
|
|
34493
34353
|
const items = [
|
|
34494
34354
|
{ label: "Configuration", screen: "settings-configuration" },
|
|
34495
34355
|
{ label: "Opt-in Analytics", screen: "settings-opt-in-analytics" },
|
|
@@ -34817,7 +34677,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
34817
34677
|
});
|
|
34818
34678
|
|
|
34819
34679
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
34820
|
-
import { useEffect as
|
|
34680
|
+
import { useEffect as useEffect31, useState as useState33 } from "react";
|
|
34821
34681
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
34822
34682
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
34823
34683
|
function StatusHeading() {
|
|
@@ -34834,11 +34694,11 @@ function AgentDetail({
|
|
|
34834
34694
|
record: record3
|
|
34835
34695
|
}) {
|
|
34836
34696
|
const settings = config.agents[name];
|
|
34837
|
-
const [saving, setSaving] =
|
|
34838
|
-
const [testing, setTesting] =
|
|
34839
|
-
const [notice, setNotice] =
|
|
34840
|
-
const [checks, setChecks] =
|
|
34841
|
-
|
|
34697
|
+
const [saving, setSaving] = useState33(false);
|
|
34698
|
+
const [testing, setTesting] = useState33(false);
|
|
34699
|
+
const [notice, setNotice] = useState33(null);
|
|
34700
|
+
const [checks, setChecks] = useState33(void 0);
|
|
34701
|
+
useEffect31(() => {
|
|
34842
34702
|
let active = true;
|
|
34843
34703
|
setChecks(void 0);
|
|
34844
34704
|
const timer = setTimeout(() => {
|
|
@@ -34930,17 +34790,17 @@ var init_AgentDetail = __esm({
|
|
|
34930
34790
|
});
|
|
34931
34791
|
|
|
34932
34792
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
34933
|
-
import { useEffect as
|
|
34793
|
+
import { useEffect as useEffect32, useRef as useRef20, useState as useState34 } from "react";
|
|
34934
34794
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
34935
34795
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
34936
34796
|
function AgentsScreen({ onDone }) {
|
|
34937
|
-
const [config, setConfig] =
|
|
34938
|
-
const [focus, setFocus] =
|
|
34939
|
-
const [open, setOpen] =
|
|
34940
|
-
const [notice, setNotice] =
|
|
34941
|
-
const [saving, setSaving] =
|
|
34942
|
-
const [loadError, setLoadError] =
|
|
34943
|
-
const [checks, setChecks] =
|
|
34797
|
+
const [config, setConfig] = useState34(null);
|
|
34798
|
+
const [focus, setFocus] = useState34(0);
|
|
34799
|
+
const [open, setOpen] = useState34(null);
|
|
34800
|
+
const [notice, setNotice] = useState34(null);
|
|
34801
|
+
const [saving, setSaving] = useState34(false);
|
|
34802
|
+
const [loadError, setLoadError] = useState34(null);
|
|
34803
|
+
const [checks, setChecks] = useState34({});
|
|
34944
34804
|
const visit = useRef20({
|
|
34945
34805
|
trail: createTrail(),
|
|
34946
34806
|
before: void 0,
|
|
@@ -34954,7 +34814,7 @@ function AgentsScreen({ onDone }) {
|
|
|
34954
34814
|
);
|
|
34955
34815
|
}
|
|
34956
34816
|
};
|
|
34957
|
-
|
|
34817
|
+
useEffect32(() => {
|
|
34958
34818
|
readAgentConfig().then((loaded) => {
|
|
34959
34819
|
setConfig(loaded);
|
|
34960
34820
|
inspectAll(loaded);
|
|
@@ -35180,7 +35040,7 @@ var init_project_store = __esm({
|
|
|
35180
35040
|
});
|
|
35181
35041
|
|
|
35182
35042
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
35183
|
-
import { useEffect as
|
|
35043
|
+
import { useEffect as useEffect33, useRef as useRef21, useState as useState35 } from "react";
|
|
35184
35044
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
35185
35045
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
35186
35046
|
function debugFields(config) {
|
|
@@ -35195,10 +35055,10 @@ function debugFields(config) {
|
|
|
35195
35055
|
};
|
|
35196
35056
|
}
|
|
35197
35057
|
function ProjectScreen({ onDone }) {
|
|
35198
|
-
const [config, setConfig] =
|
|
35199
|
-
const [saving, setSaving] =
|
|
35200
|
-
const [notice, setNotice] =
|
|
35201
|
-
const [loadError, setLoadError] =
|
|
35058
|
+
const [config, setConfig] = useState35(null);
|
|
35059
|
+
const [saving, setSaving] = useState35(false);
|
|
35060
|
+
const [notice, setNotice] = useState35(null);
|
|
35061
|
+
const [loadError, setLoadError] = useState35(null);
|
|
35202
35062
|
const visit = useRef21({
|
|
35203
35063
|
trail: createTrail(),
|
|
35204
35064
|
before: void 0,
|
|
@@ -35206,7 +35066,7 @@ function ProjectScreen({ onDone }) {
|
|
|
35206
35066
|
error: ""
|
|
35207
35067
|
}).current;
|
|
35208
35068
|
const scrub2 = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
35209
|
-
|
|
35069
|
+
useEffect33(() => {
|
|
35210
35070
|
readCredentials().then((cfg) => {
|
|
35211
35071
|
setConfig(cfg);
|
|
35212
35072
|
visit.before = snapshotOf(cfg);
|
|
@@ -35327,12 +35187,12 @@ var init_ProjectScreen = __esm({
|
|
|
35327
35187
|
});
|
|
35328
35188
|
|
|
35329
35189
|
// packages/experience-design-system-cli/src/tui/settings/configuration/ConfigurationScreen.tsx
|
|
35330
|
-
import { useState as
|
|
35190
|
+
import { useState as useState36 } from "react";
|
|
35331
35191
|
import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
|
|
35332
35192
|
import { jsx as jsx63, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
35333
35193
|
function ConfigurationScreen({ onDone }) {
|
|
35334
|
-
const [focus, setFocus] =
|
|
35335
|
-
const [open, setOpen] =
|
|
35194
|
+
const [focus, setFocus] = useState36(0);
|
|
35195
|
+
const [open, setOpen] = useState36(null);
|
|
35336
35196
|
const close = () => setOpen(null);
|
|
35337
35197
|
useInput17((input, key) => {
|
|
35338
35198
|
if (open) return;
|
|
@@ -35393,13 +35253,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
35393
35253
|
});
|
|
35394
35254
|
|
|
35395
35255
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
35396
|
-
import { useEffect as
|
|
35256
|
+
import { useEffect as useEffect34, useState as useState37 } from "react";
|
|
35397
35257
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
35398
35258
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
35399
35259
|
function OptInAnalyticsScreen({ onDone }) {
|
|
35400
|
-
const [loading, setLoading] =
|
|
35401
|
-
const [enabled, setEnabled] =
|
|
35402
|
-
|
|
35260
|
+
const [loading, setLoading] = useState37(true);
|
|
35261
|
+
const [enabled, setEnabled] = useState37(true);
|
|
35262
|
+
useEffect34(() => {
|
|
35403
35263
|
readAnalyticsSetting().then((setting) => {
|
|
35404
35264
|
setEnabled(setting.enabled);
|
|
35405
35265
|
setLoading(false);
|
|
@@ -35462,18 +35322,18 @@ var init_screen12 = __esm({
|
|
|
35462
35322
|
});
|
|
35463
35323
|
|
|
35464
35324
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
35465
|
-
import { useEffect as
|
|
35325
|
+
import { useEffect as useEffect35, useRef as useRef22, useState as useState38 } from "react";
|
|
35466
35326
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
35467
35327
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
35468
35328
|
function DebugModeScreen({ onDone }) {
|
|
35469
|
-
const [setting, setSetting] =
|
|
35470
|
-
const [focus, setFocus] =
|
|
35471
|
-
const [pending, setPending] =
|
|
35329
|
+
const [setting, setSetting] = useState38(null);
|
|
35330
|
+
const [focus, setFocus] = useState38("enabled");
|
|
35331
|
+
const [pending, setPending] = useState38(
|
|
35472
35332
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
35473
35333
|
);
|
|
35474
|
-
const [notice, setNotice] =
|
|
35334
|
+
const [notice, setNotice] = useState38(null);
|
|
35475
35335
|
const visit = useRef22({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
35476
|
-
|
|
35336
|
+
useEffect35(() => {
|
|
35477
35337
|
readDebugModeSetting().then((loaded) => {
|
|
35478
35338
|
setSetting(loaded);
|
|
35479
35339
|
setPending(loaded.retentionDays);
|
|
@@ -35614,21 +35474,21 @@ var app_exports = {};
|
|
|
35614
35474
|
__export(app_exports, {
|
|
35615
35475
|
runApp: () => runApp
|
|
35616
35476
|
});
|
|
35617
|
-
import { useEffect as
|
|
35477
|
+
import { useEffect as useEffect36, useState as useState39 } from "react";
|
|
35618
35478
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
35619
35479
|
function App({ importOptions, inkClear }) {
|
|
35620
|
-
const [screen, setScreen] =
|
|
35621
|
-
const [importExitCode, setImportExitCode] =
|
|
35480
|
+
const [screen, setScreen] = useState39("start");
|
|
35481
|
+
const [importExitCode, setImportExitCode] = useState39();
|
|
35622
35482
|
const showImportResult = importExitCode !== void 0;
|
|
35623
|
-
const [target, setTarget] =
|
|
35624
|
-
const [answers, setAnswers] =
|
|
35483
|
+
const [target, setTarget] = useState39();
|
|
35484
|
+
const [answers, setAnswers] = useState39({});
|
|
35625
35485
|
const answer = (patch) => setAnswers((current) => ({ ...current, ...patch }));
|
|
35626
|
-
const [extractionRun, setExtractionRun] =
|
|
35486
|
+
const [extractionRun, setExtractionRun] = useState39();
|
|
35627
35487
|
const extraction = useExtraction(extractionRun?.input);
|
|
35628
|
-
const [tokensOnlyRun, setTokensOnlyRun] =
|
|
35488
|
+
const [tokensOnlyRun, setTokensOnlyRun] = useState39();
|
|
35629
35489
|
const tokensOnly = useTokensOnly(tokensOnlyRun?.tokens);
|
|
35630
|
-
const [tokenReview, setTokenReview] =
|
|
35631
|
-
const [scopeRun, setScopeRun] =
|
|
35490
|
+
const [tokenReview, setTokenReview] = useState39();
|
|
35491
|
+
const [scopeRun, setScopeRun] = useState39();
|
|
35632
35492
|
const scopeFlow = useScopeGateFlow(
|
|
35633
35493
|
scopeRun && {
|
|
35634
35494
|
sessionId: scopeRun.extraction.sessionId,
|
|
@@ -35643,12 +35503,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35643
35503
|
}
|
|
35644
35504
|
}
|
|
35645
35505
|
);
|
|
35646
|
-
const [generationInput, setGenerationInput] =
|
|
35506
|
+
const [generationInput, setGenerationInput] = useState39();
|
|
35647
35507
|
const generation = useGeneration(generationInput);
|
|
35648
|
-
const [flowStart, setFlowStart] =
|
|
35508
|
+
const [flowStart, setFlowStart] = useState39();
|
|
35649
35509
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
35650
|
-
const [importDefaults, setImportDefaults] =
|
|
35651
|
-
|
|
35510
|
+
const [importDefaults, setImportDefaults] = useState39();
|
|
35511
|
+
useEffect36(() => {
|
|
35652
35512
|
if (screen !== "import") {
|
|
35653
35513
|
setImportDefaults(void 0);
|
|
35654
35514
|
return;
|
|
@@ -35721,7 +35581,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35721
35581
|
}
|
|
35722
35582
|
});
|
|
35723
35583
|
};
|
|
35724
|
-
|
|
35584
|
+
useEffect36(() => {
|
|
35725
35585
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
35726
35586
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
35727
35587
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -35743,12 +35603,12 @@ function App({ importOptions, inkClear }) {
|
|
|
35743
35603
|
}
|
|
35744
35604
|
});
|
|
35745
35605
|
}, [tokensOnly, tokensOnlyRun]);
|
|
35746
|
-
|
|
35606
|
+
useEffect36(() => {
|
|
35747
35607
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
35748
35608
|
setExtractionRun(void 0);
|
|
35749
35609
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
35750
35610
|
}, [extraction, extractionRun]);
|
|
35751
|
-
|
|
35611
|
+
useEffect36(() => {
|
|
35752
35612
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
35753
35613
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35754
35614
|
setGenerationInput({
|
|
@@ -35766,7 +35626,7 @@ function App({ importOptions, inkClear }) {
|
|
|
35766
35626
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
35767
35627
|
});
|
|
35768
35628
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
35769
|
-
|
|
35629
|
+
useEffect36(() => {
|
|
35770
35630
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
35771
35631
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
35772
35632
|
inkClear();
|
|
@@ -36009,7 +35869,7 @@ var init_app = __esm({
|
|
|
36009
35869
|
// packages/experience-design-system-cli/program.ts
|
|
36010
35870
|
init_src3();
|
|
36011
35871
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
36012
|
-
import { join as
|
|
35872
|
+
import { join as join27 } from "node:path";
|
|
36013
35873
|
import { Command } from "commander";
|
|
36014
35874
|
|
|
36015
35875
|
// packages/experience-design-system-cli/src/commands/import-options.ts
|
|
@@ -36074,7 +35934,7 @@ init_analytics_store();
|
|
|
36074
35934
|
init_package_root();
|
|
36075
35935
|
var pkg = JSON.parse(
|
|
36076
35936
|
readFileSync10(
|
|
36077
|
-
|
|
35937
|
+
join27(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
36078
35938
|
"utf8"
|
|
36079
35939
|
)
|
|
36080
35940
|
);
|
|
@@ -36114,21 +35974,21 @@ function createProgram() {
|
|
|
36114
35974
|
init_config();
|
|
36115
35975
|
init_package_root();
|
|
36116
35976
|
import { existsSync as existsSync12 } from "node:fs";
|
|
36117
|
-
import { mkdir as mkdir10, readFile as
|
|
36118
|
-
import { dirname as dirname18, join as
|
|
35977
|
+
import { mkdir as mkdir10, readFile as readFile21, rename as rename3, rmdir as rmdir2, unlink } from "node:fs/promises";
|
|
35978
|
+
import { dirname as dirname18, join as join28 } from "node:path";
|
|
36119
35979
|
var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
36120
35980
|
async function readJson(path5) {
|
|
36121
35981
|
try {
|
|
36122
|
-
return JSON.parse(await
|
|
35982
|
+
return JSON.parse(await readFile21(path5, "utf8"));
|
|
36123
35983
|
} catch {
|
|
36124
35984
|
return void 0;
|
|
36125
35985
|
}
|
|
36126
35986
|
}
|
|
36127
35987
|
async function migrateOldConfig() {
|
|
36128
35988
|
try {
|
|
36129
|
-
const oldCredentials =
|
|
36130
|
-
const oldRuns =
|
|
36131
|
-
const oldDebugMode =
|
|
35989
|
+
const oldCredentials = join28(oldConfigDir2(), "credentials.json");
|
|
35990
|
+
const oldRuns = join28(oldConfigDir2(), "runs.json");
|
|
35991
|
+
const oldDebugMode = join28(
|
|
36132
35992
|
findPackageRoot(import.meta.url, PACKAGE_NAME3),
|
|
36133
35993
|
".contentful",
|
|
36134
35994
|
"config",
|