@contentful/experience-design-system-cli 2.37.1-dev-build-cffd984a.0 → 2.37.1-dev-build-2fb4dadf.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 +287 -364
- package/dist/index.js +229 -258
- package/dist/package.json +1 -1
- package/dist/src/tui/debug-store.d.ts +0 -6
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2121,7 +2121,7 @@ async function runAgent(options) {
|
|
|
2121
2121
|
promptLen: prompt.length,
|
|
2122
2122
|
promptHead: prompt.slice(0, 500)
|
|
2123
2123
|
});
|
|
2124
|
-
return new Promise((
|
|
2124
|
+
return new Promise((resolve25) => {
|
|
2125
2125
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
2126
2126
|
const child = spawn3(binary, args, {
|
|
2127
2127
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -2170,7 +2170,7 @@ async function runAgent(options) {
|
|
|
2170
2170
|
stderrLen: stderr.length,
|
|
2171
2171
|
stderrTail: stderr.slice(-1e3)
|
|
2172
2172
|
});
|
|
2173
|
-
|
|
2173
|
+
resolve25(result);
|
|
2174
2174
|
});
|
|
2175
2175
|
});
|
|
2176
2176
|
}
|
|
@@ -2192,7 +2192,7 @@ async function checkAgentAuth(agent) {
|
|
|
2192
2192
|
return "not-found";
|
|
2193
2193
|
if (agent !== "claude")
|
|
2194
2194
|
return "ok";
|
|
2195
|
-
return new Promise((
|
|
2195
|
+
return new Promise((resolve25) => {
|
|
2196
2196
|
const child = spawn4(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
2197
2197
|
let stdout = "";
|
|
2198
2198
|
let done = false;
|
|
@@ -2201,7 +2201,7 @@ async function checkAgentAuth(agent) {
|
|
|
2201
2201
|
return;
|
|
2202
2202
|
done = true;
|
|
2203
2203
|
child.kill("SIGTERM");
|
|
2204
|
-
|
|
2204
|
+
resolve25("unauthenticated");
|
|
2205
2205
|
}, 5e3);
|
|
2206
2206
|
child.stdout?.on("data", (chunk) => {
|
|
2207
2207
|
stdout += chunk.toString();
|
|
@@ -2212,14 +2212,14 @@ async function checkAgentAuth(agent) {
|
|
|
2212
2212
|
done = true;
|
|
2213
2213
|
clearTimeout(timer);
|
|
2214
2214
|
if (code !== 0) {
|
|
2215
|
-
|
|
2215
|
+
resolve25("unauthenticated");
|
|
2216
2216
|
return;
|
|
2217
2217
|
}
|
|
2218
2218
|
try {
|
|
2219
2219
|
const status = JSON.parse(stdout);
|
|
2220
|
-
|
|
2220
|
+
resolve25(status.loggedIn ? "ok" : "unauthenticated");
|
|
2221
2221
|
} catch {
|
|
2222
|
-
|
|
2222
|
+
resolve25("unauthenticated");
|
|
2223
2223
|
}
|
|
2224
2224
|
});
|
|
2225
2225
|
});
|
|
@@ -2229,9 +2229,9 @@ async function binaryIsOnPath(binary) {
|
|
|
2229
2229
|
const fs = await import("node:fs/promises");
|
|
2230
2230
|
return fs.access(binary).then(() => true, () => false);
|
|
2231
2231
|
}
|
|
2232
|
-
return new Promise((
|
|
2232
|
+
return new Promise((resolve25) => {
|
|
2233
2233
|
const child = spawn4(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
2234
|
-
child.on("close", (code) =>
|
|
2234
|
+
child.on("close", (code) => resolve25(code === 0));
|
|
2235
2235
|
});
|
|
2236
2236
|
}
|
|
2237
2237
|
var init_check_agent_auth = __esm({
|
|
@@ -4153,12 +4153,12 @@ function renameEmptySlots(db, sessionId, componentId, componentName, slotCount)
|
|
|
4153
4153
|
return { renames: [], warnings: [] };
|
|
4154
4154
|
const renames = [];
|
|
4155
4155
|
const warnings = [];
|
|
4156
|
-
const
|
|
4156
|
+
const rename4 = db.prepare(`UPDATE raw_slots SET name = ? WHERE session_id = ? AND component_id = ? AND name = ? AND position = ?`);
|
|
4157
4157
|
db.exec("BEGIN");
|
|
4158
4158
|
try {
|
|
4159
4159
|
for (const slot of emptySlots) {
|
|
4160
4160
|
const newName = slotCount === 1 ? "children" : `slot_${slot.position}`;
|
|
4161
|
-
|
|
4161
|
+
rename4.run(newName, sessionId, componentId, slot.name, slot.position);
|
|
4162
4162
|
renames.push({ oldName: slot.name, newName });
|
|
4163
4163
|
warnings.push(`${componentName}: slot at position ${slot.position} had empty name \u2014 renamed to "${newName}" for classification`);
|
|
4164
4164
|
}
|
|
@@ -14901,7 +14901,7 @@ function errorMessage(error) {
|
|
|
14901
14901
|
return error instanceof Error && error.message ? error.message : String(error);
|
|
14902
14902
|
}
|
|
14903
14903
|
function defaultSleep(delayMs) {
|
|
14904
|
-
return new Promise((
|
|
14904
|
+
return new Promise((resolve25) => setTimeout(resolve25, delayMs));
|
|
14905
14905
|
}
|
|
14906
14906
|
var MAX_RETRY_AFTER_MS;
|
|
14907
14907
|
var init_http_utils = __esm({
|
|
@@ -15177,7 +15177,7 @@ var init_api_client = __esm({
|
|
|
15177
15177
|
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
15178
15178
|
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
15179
15179
|
const jitter = Math.random() * baseDelay * 0.15;
|
|
15180
|
-
await new Promise((
|
|
15180
|
+
await new Promise((resolve25) => setTimeout(resolve25, baseDelay + jitter));
|
|
15181
15181
|
}
|
|
15182
15182
|
}
|
|
15183
15183
|
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
@@ -18734,7 +18734,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
|
|
|
18734
18734
|
const message = error instanceof Error ? error.message : String(error);
|
|
18735
18735
|
if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
|
|
18736
18736
|
throw error;
|
|
18737
|
-
await new Promise((
|
|
18737
|
+
await new Promise((resolve25) => setTimeout(resolve25, Math.min(250 * attempt, 2e3)));
|
|
18738
18738
|
}
|
|
18739
18739
|
}
|
|
18740
18740
|
}
|
|
@@ -19251,12 +19251,12 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
19251
19251
|
if (renames.length > 0) {
|
|
19252
19252
|
const renameMap = new Map(renames.map((r) => [r.oldName, r.newName]));
|
|
19253
19253
|
effectiveSlots = component.slots.map((s) => renameMap.has(s.name) ? { ...s, name: renameMap.get(s.name) } : s);
|
|
19254
|
-
for (const
|
|
19254
|
+
for (const rename4 of renames) {
|
|
19255
19255
|
onProgress?.({
|
|
19256
19256
|
kind: "component:slot-renamed",
|
|
19257
19257
|
componentName: component.name,
|
|
19258
|
-
oldName:
|
|
19259
|
-
newName:
|
|
19258
|
+
oldName: rename4.oldName,
|
|
19259
|
+
newName: rename4.newName
|
|
19260
19260
|
});
|
|
19261
19261
|
}
|
|
19262
19262
|
}
|
|
@@ -19402,7 +19402,7 @@ var init_run_with_pool = __esm({
|
|
|
19402
19402
|
});
|
|
19403
19403
|
|
|
19404
19404
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js
|
|
19405
|
-
function restoreCachedComponents(db, sessionId, cachedComponents, promptHash, allowedComponentNames2) {
|
|
19405
|
+
async function restoreCachedComponents(db, sessionId, cachedComponents, promptHash, allowedComponentNames2) {
|
|
19406
19406
|
const restorations = [];
|
|
19407
19407
|
const rekeyed = [];
|
|
19408
19408
|
const componentStatus = db.prepare("SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?");
|
|
@@ -19417,6 +19417,7 @@ function restoreCachedComponents(db, sessionId, cachedComponents, promptHash, al
|
|
|
19417
19417
|
componentId: component.component_id
|
|
19418
19418
|
});
|
|
19419
19419
|
rekeyed.push({ component, cached: resolution.entry });
|
|
19420
|
+
await new Promise((r) => setImmediate(r));
|
|
19420
19421
|
}
|
|
19421
19422
|
copyComponentsFromCache(db, restorations, { allowedComponentNames: allowedComponentNames2 });
|
|
19422
19423
|
storeCaches(db, rekeyed.map(({ component, cached }) => ({
|
|
@@ -19457,12 +19458,15 @@ async function checkGenerateComponentsCache(request) {
|
|
|
19457
19458
|
...components.map((component) => component.name),
|
|
19458
19459
|
...(existingEntities?.components ?? []).map((component) => component.name)
|
|
19459
19460
|
]);
|
|
19460
|
-
const cachedComponents =
|
|
19461
|
+
const cachedComponents = [];
|
|
19462
|
+
for (const component of components) {
|
|
19461
19463
|
const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
+
if (resolution)
|
|
19465
|
+
cachedComponents.push({ component, resolution });
|
|
19466
|
+
await new Promise((r) => setImmediate(r));
|
|
19467
|
+
}
|
|
19464
19468
|
if (request.restoreCache) {
|
|
19465
|
-
restoreCachedComponents(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
|
|
19469
|
+
await restoreCachedComponents(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
|
|
19466
19470
|
}
|
|
19467
19471
|
return {
|
|
19468
19472
|
sessionId: request.sessionId,
|
|
@@ -20801,206 +20805,7 @@ var init_run = __esm({
|
|
|
20801
20805
|
}
|
|
20802
20806
|
});
|
|
20803
20807
|
|
|
20804
|
-
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
20805
|
-
async function readDebugModeSetting() {
|
|
20806
|
-
const { debugMode } = await readSettings2();
|
|
20807
|
-
return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
|
|
20808
|
-
}
|
|
20809
|
-
async function writeDebugModeSetting(setting) {
|
|
20810
|
-
await updateSettings2({ debugMode: setting });
|
|
20811
|
-
}
|
|
20812
|
-
var DEFAULT_DEBUG_MODE_SETTING;
|
|
20813
|
-
var init_debug_mode_store = __esm({
|
|
20814
|
-
"packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
|
|
20815
|
-
"use strict";
|
|
20816
|
-
init_config();
|
|
20817
|
-
DEFAULT_DEBUG_MODE_SETTING = {
|
|
20818
|
-
enabled: true
|
|
20819
|
-
};
|
|
20820
|
-
}
|
|
20821
|
-
});
|
|
20822
|
-
|
|
20823
|
-
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
20824
|
-
var debug_store_exports = {};
|
|
20825
|
-
__export(debug_store_exports, {
|
|
20826
|
-
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
20827
|
-
finishDebugRun: () => finishDebugRun,
|
|
20828
|
-
setDebugOutDir: () => setDebugOutDir,
|
|
20829
|
-
startDebugRun: () => startDebugRun
|
|
20830
|
-
});
|
|
20831
|
-
import { cp, mkdir as mkdir8, rename as rename3, rm, writeFile as writeFile7 } from "node:fs/promises";
|
|
20832
|
-
import { existsSync as existsSync11, readdirSync as readdirSync3 } from "node:fs";
|
|
20833
|
-
import { join as join22, resolve as resolve23 } from "node:path";
|
|
20834
|
-
function generateRunId() {
|
|
20835
|
-
const now = /* @__PURE__ */ new Date();
|
|
20836
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
20837
|
-
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
20838
|
-
}
|
|
20839
|
-
function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
20840
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
20841
|
-
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
20842
|
-
}
|
|
20843
|
-
function slugify(value) {
|
|
20844
|
-
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
20845
|
-
}
|
|
20846
|
-
function generateSessionId3() {
|
|
20847
|
-
const today = datePrefix();
|
|
20848
|
-
const root = debugSessionsDir2();
|
|
20849
|
-
const existing = existsSync11(root) ? readdirSync3(root) : [];
|
|
20850
|
-
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
20851
|
-
const maxSeq = existing.reduce((max, entry) => {
|
|
20852
|
-
const match2 = seqPattern.exec(entry);
|
|
20853
|
-
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
20854
|
-
}, 0);
|
|
20855
|
-
return `${today}-session-${maxSeq + 1}`;
|
|
20856
|
-
}
|
|
20857
|
-
function sessionDebugDir() {
|
|
20858
|
-
return join22(projectSessionsRoot ?? debugSessionsDir2(), SESSION_ID);
|
|
20859
|
-
}
|
|
20860
|
-
function currentDebugSessionDir() {
|
|
20861
|
-
return sessionDebugDir();
|
|
20862
|
-
}
|
|
20863
|
-
async function setDebugOutDir(outDir) {
|
|
20864
|
-
if (!await isDebugModeEnabled()) return;
|
|
20865
|
-
const nextRoot = join22(resolve23(outDir), "debug", "sessions");
|
|
20866
|
-
const from = sessionDebugDir();
|
|
20867
|
-
const to = join22(nextRoot, SESSION_ID);
|
|
20868
|
-
if (from === to) return;
|
|
20869
|
-
try {
|
|
20870
|
-
await mkdir8(nextRoot, { recursive: true });
|
|
20871
|
-
if (existsSync11(from)) {
|
|
20872
|
-
try {
|
|
20873
|
-
await rename3(from, to);
|
|
20874
|
-
} catch {
|
|
20875
|
-
await cp(from, to, { recursive: true });
|
|
20876
|
-
await rm(from, { recursive: true, force: true });
|
|
20877
|
-
}
|
|
20878
|
-
} else {
|
|
20879
|
-
await mkdir8(to, { recursive: true });
|
|
20880
|
-
}
|
|
20881
|
-
projectSessionsRoot = nextRoot;
|
|
20882
|
-
} catch {
|
|
20883
|
-
}
|
|
20884
|
-
}
|
|
20885
|
-
async function isDebugModeEnabled() {
|
|
20886
|
-
try {
|
|
20887
|
-
return (await readDebugModeSetting()).enabled;
|
|
20888
|
-
} catch {
|
|
20889
|
-
return true;
|
|
20890
|
-
}
|
|
20891
|
-
}
|
|
20892
|
-
function redact(value) {
|
|
20893
|
-
const clone = { ...value };
|
|
20894
|
-
if ("cma_token" in clone) {
|
|
20895
|
-
const raw = clone.cma_token;
|
|
20896
|
-
clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
|
|
20897
|
-
}
|
|
20898
|
-
return clone;
|
|
20899
|
-
}
|
|
20900
|
-
function startDebugRun({
|
|
20901
|
-
flow,
|
|
20902
|
-
step,
|
|
20903
|
-
menuOption,
|
|
20904
|
-
inputs
|
|
20905
|
-
}) {
|
|
20906
|
-
const runId = generateRunId();
|
|
20907
|
-
const startedAt = Date.now();
|
|
20908
|
-
const redactedInputs = redact(inputs);
|
|
20909
|
-
isDebugModeEnabled().then((enabled) => {
|
|
20910
|
-
if (!enabled) return;
|
|
20911
|
-
pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
|
|
20912
|
-
});
|
|
20913
|
-
}
|
|
20914
|
-
async function finishDebugRun({
|
|
20915
|
-
outputs,
|
|
20916
|
-
status,
|
|
20917
|
-
exitMethod
|
|
20918
|
-
}) {
|
|
20919
|
-
const run = pendingRun;
|
|
20920
|
-
if (!run) return;
|
|
20921
|
-
pendingRun = void 0;
|
|
20922
|
-
const durationMs = Date.now() - run.startedAt;
|
|
20923
|
-
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
20924
|
-
const flowSegments = run.flow.split("/");
|
|
20925
|
-
const dir = join22(sessionDebugDir(), ...flowSegments);
|
|
20926
|
-
await mkdir8(dir, { recursive: true });
|
|
20927
|
-
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
20928
|
-
await writeFile7(join22(dir, filename), content, { mode: 384 });
|
|
20929
|
-
}
|
|
20930
|
-
function nextAttemptFilename(dir, menuOption) {
|
|
20931
|
-
const today = datePrefix();
|
|
20932
|
-
const optionSlug = slugify(menuOption);
|
|
20933
|
-
const existing = existsSync11(dir) ? readdirSync3(dir) : [];
|
|
20934
|
-
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
20935
|
-
const maxAttempt = existing.reduce((max, entry) => {
|
|
20936
|
-
const match2 = attemptPattern.exec(entry);
|
|
20937
|
-
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
20938
|
-
}, 0);
|
|
20939
|
-
return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
|
|
20940
|
-
}
|
|
20941
|
-
function renderMarkdown(run, finish) {
|
|
20942
|
-
const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
|
|
20943
|
-
const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
|
|
20944
|
-
const flowSlug = run.flow.split("/").join("-");
|
|
20945
|
-
return `# Debug Log
|
|
20946
|
-
|
|
20947
|
-
- Run ID: ${run.runId}
|
|
20948
|
-
- Flow: ${flowSlug}
|
|
20949
|
-
- Step: ${stepLabel2}
|
|
20950
|
-
- Menu option: ${run.menuOption}
|
|
20951
|
-
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
20952
|
-
- CLI version: ${readPackageVersion()}
|
|
20953
|
-
- Platform: ${process.platform} / Node ${process.version}
|
|
20954
|
-
- Duration on screen: ${finish.durationMs}ms
|
|
20955
|
-
- Status: ${finish.status}
|
|
20956
|
-
- Exit method: ${finish.exitMethod}
|
|
20957
|
-
|
|
20958
|
-
## Inputs
|
|
20959
|
-
\`\`\`json
|
|
20960
|
-
${JSON.stringify(run.inputs, null, 2)}
|
|
20961
|
-
\`\`\`
|
|
20962
|
-
|
|
20963
|
-
## Outputs
|
|
20964
|
-
\`\`\`json
|
|
20965
|
-
${JSON.stringify(finish.outputs, null, 2)}
|
|
20966
|
-
\`\`\`
|
|
20967
|
-
`;
|
|
20968
|
-
}
|
|
20969
|
-
function handleCrash() {
|
|
20970
|
-
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
20971
|
-
}
|
|
20972
|
-
var pendingRun, SESSION_ID, projectSessionsRoot;
|
|
20973
|
-
var init_debug_store = __esm({
|
|
20974
|
-
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
20975
|
-
"use strict";
|
|
20976
|
-
init_config();
|
|
20977
|
-
init_version();
|
|
20978
|
-
init_debug_mode_store();
|
|
20979
|
-
SESSION_ID = generateSessionId3();
|
|
20980
|
-
void isDebugModeEnabled().then((enabled) => {
|
|
20981
|
-
if (!enabled) return void 0;
|
|
20982
|
-
return mkdir8(sessionDebugDir(), { recursive: true });
|
|
20983
|
-
});
|
|
20984
|
-
process.once("uncaughtException", (err) => {
|
|
20985
|
-
void handleCrash().finally(() => {
|
|
20986
|
-
throw err;
|
|
20987
|
-
});
|
|
20988
|
-
});
|
|
20989
|
-
process.once("unhandledRejection", (reason) => {
|
|
20990
|
-
void handleCrash().finally(() => {
|
|
20991
|
-
throw reason;
|
|
20992
|
-
});
|
|
20993
|
-
});
|
|
20994
|
-
process.once("SIGINT", () => {
|
|
20995
|
-
void handleCrash().finally(() => {
|
|
20996
|
-
process.exit(130);
|
|
20997
|
-
});
|
|
20998
|
-
});
|
|
20999
|
-
}
|
|
21000
|
-
});
|
|
21001
|
-
|
|
21002
20808
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
21003
|
-
import { join as join23, resolve as resolve24 } from "node:path";
|
|
21004
20809
|
import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
21005
20810
|
function useExtraction(input) {
|
|
21006
20811
|
const [state, setState] = useState8();
|
|
@@ -21019,9 +20824,6 @@ function useExtraction(input) {
|
|
|
21019
20824
|
reuseTokens: input.tokenStrategy === "reuse"
|
|
21020
20825
|
})
|
|
21021
20826
|
});
|
|
21022
|
-
void Promise.resolve().then(() => (init_debug_store(), debug_store_exports)).then(
|
|
21023
|
-
(store) => store.setDebugOutDir(join23(resolve24(input.projectPath), ".contentful"))
|
|
21024
|
-
);
|
|
21025
20827
|
void runExtraction(input, (progress) => {
|
|
21026
20828
|
if (current.current === input) setState({ status: "running", progress });
|
|
21027
20829
|
}).then((result) => {
|
|
@@ -24243,7 +24045,7 @@ var init_save_decisions = __esm({
|
|
|
24243
24045
|
});
|
|
24244
24046
|
|
|
24245
24047
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
24246
|
-
import { resolve as
|
|
24048
|
+
import { resolve as resolve23 } from "node:path";
|
|
24247
24049
|
async function runGeneration(input, onProgress, deps = realDeps3) {
|
|
24248
24050
|
let progress = { components: null, mapTokens: "idle", mapTokensEligible: null };
|
|
24249
24051
|
const update = (change) => {
|
|
@@ -24329,7 +24131,7 @@ async function buildMapTokensOptions(input) {
|
|
|
24329
24131
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
24330
24132
|
if (mapOverride?.kind === "path") {
|
|
24331
24133
|
await resolvePromptOverride(mapOverride);
|
|
24332
|
-
prompt.skillPathOverride =
|
|
24134
|
+
prompt.skillPathOverride = resolve23(mapOverride.value);
|
|
24333
24135
|
}
|
|
24334
24136
|
if (input.existingEntitiesPath) {
|
|
24335
24137
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -24407,7 +24209,7 @@ var init_use_generation = __esm({
|
|
|
24407
24209
|
});
|
|
24408
24210
|
|
|
24409
24211
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
24410
|
-
import { join as
|
|
24212
|
+
import { join as join22 } from "node:path";
|
|
24411
24213
|
function buildFlowStart(input) {
|
|
24412
24214
|
const { extraction, handoff, saved, generatePromptPath } = input;
|
|
24413
24215
|
const credentials = extraction.credentials ?? {
|
|
@@ -24420,7 +24222,7 @@ function buildFlowStart(input) {
|
|
|
24420
24222
|
handoff,
|
|
24421
24223
|
agent: extraction.agent,
|
|
24422
24224
|
projectPath: extraction.projectPath,
|
|
24423
|
-
outDir: extraction.projectPath ?
|
|
24225
|
+
outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
|
|
24424
24226
|
rawTokensPath: extraction.rawTokensPath,
|
|
24425
24227
|
credentials: {
|
|
24426
24228
|
spaceId: credentials.spaceId,
|
|
@@ -30616,7 +30418,7 @@ var init_DoneStep = __esm({
|
|
|
30616
30418
|
});
|
|
30617
30419
|
|
|
30618
30420
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
30619
|
-
import { resolve as
|
|
30421
|
+
import { resolve as resolve24 } from "node:path";
|
|
30620
30422
|
import { homedir as homedir4 } from "node:os";
|
|
30621
30423
|
function expandTilde(input) {
|
|
30622
30424
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -30630,7 +30432,7 @@ function normalizePath(input) {
|
|
|
30630
30432
|
p = p.slice(1, -1);
|
|
30631
30433
|
}
|
|
30632
30434
|
p = expandTilde(p);
|
|
30633
|
-
return
|
|
30435
|
+
return resolve24(p);
|
|
30634
30436
|
}
|
|
30635
30437
|
var init_path_utils = __esm({
|
|
30636
30438
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
|
|
@@ -30657,8 +30459,8 @@ var init_use_blinking_cursor = __esm({
|
|
|
30657
30459
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
30658
30460
|
import { useState as useState24 } from "react";
|
|
30659
30461
|
import { Box as Box37, Text as Text40 } from "ink";
|
|
30660
|
-
import { readdirSync as
|
|
30661
|
-
import { dirname as dirname15, basename as basename6, join as
|
|
30462
|
+
import { readdirSync as readdirSync3 } from "node:fs";
|
|
30463
|
+
import { dirname as dirname15, basename as basename6, join as join23 } from "node:path";
|
|
30662
30464
|
import { jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
30663
30465
|
function autocomplete(partial) {
|
|
30664
30466
|
if (!partial) return null;
|
|
@@ -30667,19 +30469,19 @@ function autocomplete(partial) {
|
|
|
30667
30469
|
const base = basename6(normalized);
|
|
30668
30470
|
let entries;
|
|
30669
30471
|
try {
|
|
30670
|
-
entries =
|
|
30472
|
+
entries = readdirSync3(dir);
|
|
30671
30473
|
} catch {
|
|
30672
30474
|
return null;
|
|
30673
30475
|
}
|
|
30674
30476
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
30675
30477
|
if (matches.length === 0) return null;
|
|
30676
|
-
if (matches.length === 1) return
|
|
30478
|
+
if (matches.length === 1) return join23(dir, matches[0]);
|
|
30677
30479
|
let prefix = matches[0];
|
|
30678
30480
|
for (const m of matches) {
|
|
30679
30481
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
30680
30482
|
if (!prefix) break;
|
|
30681
30483
|
}
|
|
30682
|
-
return prefix.length > base.length ?
|
|
30484
|
+
return prefix.length > base.length ? join23(dir, prefix) : null;
|
|
30683
30485
|
}
|
|
30684
30486
|
function PathPrompt({
|
|
30685
30487
|
defaultPath,
|
|
@@ -31882,8 +31684,8 @@ var init_run_print_files_helpers = __esm({
|
|
|
31882
31684
|
});
|
|
31883
31685
|
|
|
31884
31686
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
31885
|
-
import { writeFile as
|
|
31886
|
-
import { join as
|
|
31687
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
31688
|
+
import { join as join24 } from "node:path";
|
|
31887
31689
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
31888
31690
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
31889
31691
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -31895,7 +31697,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
31895
31697
|
}
|
|
31896
31698
|
async function runPrintFiles(input, deps, onPatch) {
|
|
31897
31699
|
onPatch({ step: "printing" });
|
|
31898
|
-
const componentsPath =
|
|
31700
|
+
const componentsPath = join24(input.outDir, "components.json");
|
|
31899
31701
|
try {
|
|
31900
31702
|
const db = deps.openDb();
|
|
31901
31703
|
let components = [];
|
|
@@ -31979,10 +31781,10 @@ var init_save = __esm({
|
|
|
31979
31781
|
realSaveDeps = () => ({
|
|
31980
31782
|
openDb: openPipelineDb,
|
|
31981
31783
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
31982
|
-
writeFile: (path5, contents) =>
|
|
31784
|
+
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
31983
31785
|
appendRun,
|
|
31984
31786
|
buildSourceFingerprint,
|
|
31985
|
-
sleep: (ms) => new Promise((
|
|
31787
|
+
sleep: (ms) => new Promise((resolve25) => setTimeout(resolve25, ms)),
|
|
31986
31788
|
warn: (message) => process.stderr.write(message)
|
|
31987
31789
|
});
|
|
31988
31790
|
}
|
|
@@ -32002,9 +31804,9 @@ var init_types9 = __esm({
|
|
|
32002
31804
|
|
|
32003
31805
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
32004
31806
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
32005
|
-
import { mkdir as
|
|
31807
|
+
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
32006
31808
|
import { tmpdir } from "node:os";
|
|
32007
|
-
import { join as
|
|
31809
|
+
import { join as join25 } from "node:path";
|
|
32008
31810
|
function appendWizardLog(entry) {
|
|
32009
31811
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
32010
31812
|
}
|
|
@@ -32027,7 +31829,7 @@ function realFlowDeps() {
|
|
|
32027
31829
|
}
|
|
32028
31830
|
},
|
|
32029
31831
|
mkdir: async (path5) => {
|
|
32030
|
-
await
|
|
31832
|
+
await mkdir8(path5, { recursive: true });
|
|
32031
31833
|
},
|
|
32032
31834
|
detectSaveConflict,
|
|
32033
31835
|
buildTimestampedSubdir,
|
|
@@ -32278,7 +32080,7 @@ var init_controller = __esm({
|
|
|
32278
32080
|
init_push();
|
|
32279
32081
|
init_save();
|
|
32280
32082
|
init_types9();
|
|
32281
|
-
WIZARD_LOG =
|
|
32083
|
+
WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
32282
32084
|
}
|
|
32283
32085
|
});
|
|
32284
32086
|
|
|
@@ -32310,6 +32112,175 @@ var init_use_flow = __esm({
|
|
|
32310
32112
|
}
|
|
32311
32113
|
});
|
|
32312
32114
|
|
|
32115
|
+
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
32116
|
+
async function readDebugModeSetting() {
|
|
32117
|
+
const { debugMode } = await readSettings2();
|
|
32118
|
+
return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
|
|
32119
|
+
}
|
|
32120
|
+
async function writeDebugModeSetting(setting) {
|
|
32121
|
+
await updateSettings2({ debugMode: setting });
|
|
32122
|
+
}
|
|
32123
|
+
var DEFAULT_DEBUG_MODE_SETTING;
|
|
32124
|
+
var init_debug_mode_store = __esm({
|
|
32125
|
+
"packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
|
|
32126
|
+
"use strict";
|
|
32127
|
+
init_config();
|
|
32128
|
+
DEFAULT_DEBUG_MODE_SETTING = {
|
|
32129
|
+
enabled: true
|
|
32130
|
+
};
|
|
32131
|
+
}
|
|
32132
|
+
});
|
|
32133
|
+
|
|
32134
|
+
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
32135
|
+
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
32136
|
+
import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
32137
|
+
import { join as join26 } from "node:path";
|
|
32138
|
+
function generateRunId() {
|
|
32139
|
+
const now = /* @__PURE__ */ new Date();
|
|
32140
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
32141
|
+
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
32142
|
+
}
|
|
32143
|
+
function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
32144
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
32145
|
+
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
32146
|
+
}
|
|
32147
|
+
function slugify(value) {
|
|
32148
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
32149
|
+
}
|
|
32150
|
+
function generateSessionId3() {
|
|
32151
|
+
const today = datePrefix();
|
|
32152
|
+
const root = debugSessionsDir2();
|
|
32153
|
+
const existing = existsSync11(root) ? readdirSync4(root) : [];
|
|
32154
|
+
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
32155
|
+
const maxSeq = existing.reduce((max, entry) => {
|
|
32156
|
+
const match2 = seqPattern.exec(entry);
|
|
32157
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32158
|
+
}, 0);
|
|
32159
|
+
return `${today}-session-${maxSeq + 1}`;
|
|
32160
|
+
}
|
|
32161
|
+
function sessionDebugDir() {
|
|
32162
|
+
return join26(debugSessionsDir2(), SESSION_ID);
|
|
32163
|
+
}
|
|
32164
|
+
function currentDebugSessionDir() {
|
|
32165
|
+
return sessionDebugDir();
|
|
32166
|
+
}
|
|
32167
|
+
async function isDebugModeEnabled() {
|
|
32168
|
+
try {
|
|
32169
|
+
return (await readDebugModeSetting()).enabled;
|
|
32170
|
+
} catch {
|
|
32171
|
+
return true;
|
|
32172
|
+
}
|
|
32173
|
+
}
|
|
32174
|
+
function redact(value) {
|
|
32175
|
+
const clone = { ...value };
|
|
32176
|
+
if ("cma_token" in clone) {
|
|
32177
|
+
const raw = clone.cma_token;
|
|
32178
|
+
clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
|
|
32179
|
+
}
|
|
32180
|
+
return clone;
|
|
32181
|
+
}
|
|
32182
|
+
function startDebugRun({
|
|
32183
|
+
flow,
|
|
32184
|
+
step,
|
|
32185
|
+
menuOption,
|
|
32186
|
+
inputs
|
|
32187
|
+
}) {
|
|
32188
|
+
const runId = generateRunId();
|
|
32189
|
+
const startedAt = Date.now();
|
|
32190
|
+
const redactedInputs = redact(inputs);
|
|
32191
|
+
isDebugModeEnabled().then((enabled) => {
|
|
32192
|
+
if (!enabled) return;
|
|
32193
|
+
pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
|
|
32194
|
+
});
|
|
32195
|
+
}
|
|
32196
|
+
async function finishDebugRun({
|
|
32197
|
+
outputs,
|
|
32198
|
+
status,
|
|
32199
|
+
exitMethod
|
|
32200
|
+
}) {
|
|
32201
|
+
const run = pendingRun;
|
|
32202
|
+
if (!run) return;
|
|
32203
|
+
pendingRun = void 0;
|
|
32204
|
+
const durationMs = Date.now() - run.startedAt;
|
|
32205
|
+
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
32206
|
+
const flowSegments = run.flow.split("/");
|
|
32207
|
+
const dir = join26(sessionDebugDir(), ...flowSegments);
|
|
32208
|
+
await mkdir9(dir, { recursive: true });
|
|
32209
|
+
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
32210
|
+
await writeFile8(join26(dir, filename), content, { mode: 384 });
|
|
32211
|
+
}
|
|
32212
|
+
function nextAttemptFilename(dir, menuOption) {
|
|
32213
|
+
const today = datePrefix();
|
|
32214
|
+
const optionSlug = slugify(menuOption);
|
|
32215
|
+
const existing = existsSync11(dir) ? readdirSync4(dir) : [];
|
|
32216
|
+
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
32217
|
+
const maxAttempt = existing.reduce((max, entry) => {
|
|
32218
|
+
const match2 = attemptPattern.exec(entry);
|
|
32219
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32220
|
+
}, 0);
|
|
32221
|
+
return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
|
|
32222
|
+
}
|
|
32223
|
+
function renderMarkdown(run, finish) {
|
|
32224
|
+
const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
|
|
32225
|
+
const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
|
|
32226
|
+
const flowSlug = run.flow.split("/").join("-");
|
|
32227
|
+
return `# Debug Log
|
|
32228
|
+
|
|
32229
|
+
- Run ID: ${run.runId}
|
|
32230
|
+
- Flow: ${flowSlug}
|
|
32231
|
+
- Step: ${stepLabel2}
|
|
32232
|
+
- Menu option: ${run.menuOption}
|
|
32233
|
+
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
32234
|
+
- CLI version: ${readPackageVersion()}
|
|
32235
|
+
- Platform: ${process.platform} / Node ${process.version}
|
|
32236
|
+
- Duration on screen: ${finish.durationMs}ms
|
|
32237
|
+
- Status: ${finish.status}
|
|
32238
|
+
- Exit method: ${finish.exitMethod}
|
|
32239
|
+
|
|
32240
|
+
## Inputs
|
|
32241
|
+
\`\`\`json
|
|
32242
|
+
${JSON.stringify(run.inputs, null, 2)}
|
|
32243
|
+
\`\`\`
|
|
32244
|
+
|
|
32245
|
+
## Outputs
|
|
32246
|
+
\`\`\`json
|
|
32247
|
+
${JSON.stringify(finish.outputs, null, 2)}
|
|
32248
|
+
\`\`\`
|
|
32249
|
+
`;
|
|
32250
|
+
}
|
|
32251
|
+
function handleCrash() {
|
|
32252
|
+
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
32253
|
+
}
|
|
32254
|
+
var pendingRun, SESSION_ID;
|
|
32255
|
+
var init_debug_store = __esm({
|
|
32256
|
+
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
32257
|
+
"use strict";
|
|
32258
|
+
init_config();
|
|
32259
|
+
init_version();
|
|
32260
|
+
init_debug_mode_store();
|
|
32261
|
+
SESSION_ID = generateSessionId3();
|
|
32262
|
+
void isDebugModeEnabled().then((enabled) => {
|
|
32263
|
+
if (!enabled) return void 0;
|
|
32264
|
+
return mkdir9(sessionDebugDir(), { recursive: true });
|
|
32265
|
+
});
|
|
32266
|
+
process.once("uncaughtException", (err) => {
|
|
32267
|
+
void handleCrash().finally(() => {
|
|
32268
|
+
throw err;
|
|
32269
|
+
});
|
|
32270
|
+
});
|
|
32271
|
+
process.once("unhandledRejection", (reason) => {
|
|
32272
|
+
void handleCrash().finally(() => {
|
|
32273
|
+
throw reason;
|
|
32274
|
+
});
|
|
32275
|
+
});
|
|
32276
|
+
process.once("SIGINT", () => {
|
|
32277
|
+
void handleCrash().finally(() => {
|
|
32278
|
+
process.exit(130);
|
|
32279
|
+
});
|
|
32280
|
+
});
|
|
32281
|
+
}
|
|
32282
|
+
});
|
|
32283
|
+
|
|
32313
32284
|
// packages/experience-design-system-cli/src/tui/help/help-info.ts
|
|
32314
32285
|
async function readHelpInfo() {
|
|
32315
32286
|
const debugMode = await readDebugModeSetting();
|
|
@@ -32317,7 +32288,7 @@ async function readHelpInfo() {
|
|
|
32317
32288
|
storage: [
|
|
32318
32289
|
{ label: "Config folder", value: configRoot2() },
|
|
32319
32290
|
{ label: "Settings file", value: configFilePath2() },
|
|
32320
|
-
{ label: "Debug logs", value:
|
|
32291
|
+
{ label: "Debug logs", value: debugSessionsDir2() }
|
|
32321
32292
|
],
|
|
32322
32293
|
troubleshooting: [
|
|
32323
32294
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -32928,7 +32899,7 @@ var app_exports = {};
|
|
|
32928
32899
|
__export(app_exports, {
|
|
32929
32900
|
runApp: () => runApp
|
|
32930
32901
|
});
|
|
32931
|
-
import { join as
|
|
32902
|
+
import { join as join27 } from "node:path";
|
|
32932
32903
|
import { useEffect as useEffect27, useState as useState33 } from "react";
|
|
32933
32904
|
import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
|
|
32934
32905
|
function App({ importOptions, inkClear }) {
|
|
@@ -32979,7 +32950,7 @@ function App({ importOptions, inkClear }) {
|
|
|
32979
32950
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
32980
32951
|
const state = await inspectTokens({
|
|
32981
32952
|
rawTokensPath: tokens,
|
|
32982
|
-
outDir:
|
|
32953
|
+
outDir: join27(resolveUserPath(projectPath2), ".contentful"),
|
|
32983
32954
|
cache: importOptions.cache
|
|
32984
32955
|
});
|
|
32985
32956
|
if (state.kind === "cached") {
|
|
@@ -33251,7 +33222,7 @@ var init_app = __esm({
|
|
|
33251
33222
|
|
|
33252
33223
|
// packages/experience-design-system-cli/program.ts
|
|
33253
33224
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
33254
|
-
import { join as
|
|
33225
|
+
import { join as join28 } from "node:path";
|
|
33255
33226
|
import { Command } from "commander";
|
|
33256
33227
|
|
|
33257
33228
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
@@ -33355,14 +33326,14 @@ function runDevWatch(args) {
|
|
|
33355
33326
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33356
33327
|
return Promise.resolve(1);
|
|
33357
33328
|
}
|
|
33358
|
-
return new Promise((
|
|
33329
|
+
return new Promise((resolve25) => {
|
|
33359
33330
|
const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33360
33331
|
process.on("SIGINT", () => void 0);
|
|
33361
|
-
child.on("exit", (code) =>
|
|
33332
|
+
child.on("exit", (code) => resolve25(code ?? 0));
|
|
33362
33333
|
child.on("error", (err) => {
|
|
33363
33334
|
process.stderr.write(`${err.message}
|
|
33364
33335
|
`);
|
|
33365
|
-
|
|
33336
|
+
resolve25(1);
|
|
33366
33337
|
});
|
|
33367
33338
|
});
|
|
33368
33339
|
}
|
|
@@ -33387,7 +33358,7 @@ function registerImportCommand(program, openTui) {
|
|
|
33387
33358
|
init_package_root();
|
|
33388
33359
|
var pkg = JSON.parse(
|
|
33389
33360
|
readFileSync9(
|
|
33390
|
-
|
|
33361
|
+
join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
|
|
33391
33362
|
"utf8"
|
|
33392
33363
|
)
|
|
33393
33364
|
);
|
|
@@ -33406,8 +33377,8 @@ function createProgram() {
|
|
|
33406
33377
|
init_config();
|
|
33407
33378
|
init_package_root();
|
|
33408
33379
|
import { existsSync as existsSync12 } from "node:fs";
|
|
33409
|
-
import { mkdir as mkdir10, readFile as readFile19, rename as
|
|
33410
|
-
import { dirname as dirname16, join as
|
|
33380
|
+
import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
|
|
33381
|
+
import { dirname as dirname16, join as join29 } from "node:path";
|
|
33411
33382
|
var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
|
|
33412
33383
|
async function readJson(path5) {
|
|
33413
33384
|
try {
|
|
@@ -33418,9 +33389,9 @@ async function readJson(path5) {
|
|
|
33418
33389
|
}
|
|
33419
33390
|
async function migrateOldConfig() {
|
|
33420
33391
|
try {
|
|
33421
|
-
const oldCredentials =
|
|
33422
|
-
const oldRuns =
|
|
33423
|
-
const oldDebugMode =
|
|
33392
|
+
const oldCredentials = join29(oldConfigDir2(), "credentials.json");
|
|
33393
|
+
const oldRuns = join29(oldConfigDir2(), "runs.json");
|
|
33394
|
+
const oldDebugMode = join29(
|
|
33424
33395
|
findPackageRoot(import.meta.url, PACKAGE_NAME4),
|
|
33425
33396
|
".contentful",
|
|
33426
33397
|
"config",
|
|
@@ -33434,7 +33405,7 @@ async function migrateOldConfig() {
|
|
|
33434
33405
|
if (existsSync12(oldRuns)) {
|
|
33435
33406
|
if (!existsSync12(runsFilePath2())) {
|
|
33436
33407
|
await mkdir10(dirname16(runsFilePath2()), { recursive: true });
|
|
33437
|
-
await
|
|
33408
|
+
await rename3(oldRuns, runsFilePath2());
|
|
33438
33409
|
} else {
|
|
33439
33410
|
await unlink(oldRuns);
|
|
33440
33411
|
}
|