@contentful/experience-design-system-cli 2.37.1-dev-build-5654e400.0 → 2.37.1-dev-build-cffd984a.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/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((resolve25) => {
2124
+ return new Promise((resolve27) => {
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
- resolve25(result);
2173
+ resolve27(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((resolve25) => {
2195
+ return new Promise((resolve27) => {
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
- resolve25("unauthenticated");
2204
+ resolve27("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
- resolve25("unauthenticated");
2215
+ resolve27("unauthenticated");
2216
2216
  return;
2217
2217
  }
2218
2218
  try {
2219
2219
  const status = JSON.parse(stdout);
2220
- resolve25(status.loggedIn ? "ok" : "unauthenticated");
2220
+ resolve27(status.loggedIn ? "ok" : "unauthenticated");
2221
2221
  } catch {
2222
- resolve25("unauthenticated");
2222
+ resolve27("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((resolve25) => {
2232
+ return new Promise((resolve27) => {
2233
2233
  const child = spawn4(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
2234
- child.on("close", (code) => resolve25(code === 0));
2234
+ child.on("close", (code) => resolve27(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 rename4 = db.prepare(`UPDATE raw_slots SET name = ? WHERE session_id = ? AND component_id = ? AND name = ? AND position = ?`);
4156
+ const rename5 = 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
- rename4.run(newName, sessionId, componentId, slot.name, slot.position);
4161
+ rename5.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((resolve25) => setTimeout(resolve25, delayMs));
14904
+ return new Promise((resolve27) => setTimeout(resolve27, 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((resolve25) => setTimeout(resolve25, baseDelay + jitter));
15180
+ await new Promise((resolve27) => setTimeout(resolve27, 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((resolve25) => setTimeout(resolve25, Math.min(250 * attempt, 2e3)));
18737
+ await new Promise((resolve27) => setTimeout(resolve27, 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 rename4 of renames) {
19254
+ for (const rename5 of renames) {
19255
19255
  onProgress?.({
19256
19256
  kind: "component:slot-renamed",
19257
19257
  componentName: component.name,
19258
- oldName: rename4.oldName,
19259
- newName: rename4.newName
19258
+ oldName: rename5.oldName,
19259
+ newName: rename5.newName
19260
19260
  });
19261
19261
  }
19262
19262
  }
@@ -20801,7 +20801,206 @@ var init_run = __esm({
20801
20801
  }
20802
20802
  });
20803
20803
 
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
+
20804
21002
  // 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";
20805
21004
  import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
20806
21005
  function useExtraction(input) {
20807
21006
  const [state, setState] = useState8();
@@ -20820,6 +21019,9 @@ function useExtraction(input) {
20820
21019
  reuseTokens: input.tokenStrategy === "reuse"
20821
21020
  })
20822
21021
  });
21022
+ void Promise.resolve().then(() => (init_debug_store(), debug_store_exports)).then(
21023
+ (store) => store.setDebugOutDir(join23(resolve24(input.projectPath), ".contentful"))
21024
+ );
20823
21025
  void runExtraction(input, (progress) => {
20824
21026
  if (current.current === input) setState({ status: "running", progress });
20825
21027
  }).then((result) => {
@@ -24041,7 +24243,7 @@ var init_save_decisions = __esm({
24041
24243
  });
24042
24244
 
24043
24245
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
24044
- import { resolve as resolve23 } from "node:path";
24246
+ import { resolve as resolve25 } from "node:path";
24045
24247
  async function runGeneration(input, onProgress, deps = realDeps3) {
24046
24248
  let progress = { components: null, mapTokens: "idle", mapTokensEligible: null };
24047
24249
  const update = (change) => {
@@ -24127,7 +24329,7 @@ async function buildMapTokensOptions(input) {
24127
24329
  if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
24128
24330
  if (mapOverride?.kind === "path") {
24129
24331
  await resolvePromptOverride(mapOverride);
24130
- prompt.skillPathOverride = resolve23(mapOverride.value);
24332
+ prompt.skillPathOverride = resolve25(mapOverride.value);
24131
24333
  }
24132
24334
  if (input.existingEntitiesPath) {
24133
24335
  const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
@@ -24205,7 +24407,7 @@ var init_use_generation = __esm({
24205
24407
  });
24206
24408
 
24207
24409
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
24208
- import { join as join22 } from "node:path";
24410
+ import { join as join24 } from "node:path";
24209
24411
  function buildFlowStart(input) {
24210
24412
  const { extraction, handoff, saved, generatePromptPath } = input;
24211
24413
  const credentials = extraction.credentials ?? {
@@ -24218,7 +24420,7 @@ function buildFlowStart(input) {
24218
24420
  handoff,
24219
24421
  agent: extraction.agent,
24220
24422
  projectPath: extraction.projectPath,
24221
- outDir: extraction.projectPath ? join22(extraction.projectPath, ".contentful") : "",
24423
+ outDir: extraction.projectPath ? join24(extraction.projectPath, ".contentful") : "",
24222
24424
  rawTokensPath: extraction.rawTokensPath,
24223
24425
  credentials: {
24224
24426
  spaceId: credentials.spaceId,
@@ -30414,7 +30616,7 @@ var init_DoneStep = __esm({
30414
30616
  });
30415
30617
 
30416
30618
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
30417
- import { resolve as resolve24 } from "node:path";
30619
+ import { resolve as resolve26 } from "node:path";
30418
30620
  import { homedir as homedir4 } from "node:os";
30419
30621
  function expandTilde(input) {
30420
30622
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -30428,7 +30630,7 @@ function normalizePath(input) {
30428
30630
  p = p.slice(1, -1);
30429
30631
  }
30430
30632
  p = expandTilde(p);
30431
- return resolve24(p);
30633
+ return resolve26(p);
30432
30634
  }
30433
30635
  var init_path_utils = __esm({
30434
30636
  "packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
@@ -30455,8 +30657,8 @@ var init_use_blinking_cursor = __esm({
30455
30657
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
30456
30658
  import { useState as useState24 } from "react";
30457
30659
  import { Box as Box37, Text as Text40 } from "ink";
30458
- import { readdirSync as readdirSync3 } from "node:fs";
30459
- import { dirname as dirname15, basename as basename6, join as join23 } from "node:path";
30660
+ import { readdirSync as readdirSync4 } from "node:fs";
30661
+ import { dirname as dirname15, basename as basename6, join as join25 } from "node:path";
30460
30662
  import { jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
30461
30663
  function autocomplete(partial) {
30462
30664
  if (!partial) return null;
@@ -30465,19 +30667,19 @@ function autocomplete(partial) {
30465
30667
  const base = basename6(normalized);
30466
30668
  let entries;
30467
30669
  try {
30468
- entries = readdirSync3(dir);
30670
+ entries = readdirSync4(dir);
30469
30671
  } catch {
30470
30672
  return null;
30471
30673
  }
30472
30674
  const matches = entries.filter((e) => e.startsWith(base));
30473
30675
  if (matches.length === 0) return null;
30474
- if (matches.length === 1) return join23(dir, matches[0]);
30676
+ if (matches.length === 1) return join25(dir, matches[0]);
30475
30677
  let prefix = matches[0];
30476
30678
  for (const m of matches) {
30477
30679
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
30478
30680
  if (!prefix) break;
30479
30681
  }
30480
- return prefix.length > base.length ? join23(dir, prefix) : null;
30682
+ return prefix.length > base.length ? join25(dir, prefix) : null;
30481
30683
  }
30482
30684
  function PathPrompt({
30483
30685
  defaultPath,
@@ -31134,6 +31336,7 @@ var init_run_teaser = __esm({
31134
31336
  });
31135
31337
 
31136
31338
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
31339
+ import { useEffect as useEffect20, useRef as useRef12 } from "react";
31137
31340
  import { Box as Box41 } from "ink";
31138
31341
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
31139
31342
  function totalStepsFor(state) {
@@ -31149,10 +31352,18 @@ function FlowScreen({
31149
31352
  controller,
31150
31353
  livePreview = true,
31151
31354
  generatePromptPath,
31152
- onExit
31355
+ onExit,
31356
+ onStepChange
31153
31357
  }) {
31154
31358
  const totalSteps = totalStepsFor(state);
31155
31359
  const quit = () => onExit(0);
31360
+ const previousStep = useRef12(state.step);
31361
+ useEffect20(() => {
31362
+ if (previousStep.current !== state.step) {
31363
+ onStepChange?.();
31364
+ previousStep.current = state.step;
31365
+ }
31366
+ }, [state.step, onStepChange]);
31156
31367
  const content = (() => {
31157
31368
  switch (state.step) {
31158
31369
  case "final-review":
@@ -31671,8 +31882,8 @@ var init_run_print_files_helpers = __esm({
31671
31882
  });
31672
31883
 
31673
31884
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
31674
- import { writeFile as writeFile7 } from "node:fs/promises";
31675
- import { join as join24 } from "node:path";
31885
+ import { writeFile as writeFile8 } from "node:fs/promises";
31886
+ import { join as join26 } from "node:path";
31676
31887
  function buildSavedCDF(components, tokens, opts = {}) {
31677
31888
  const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
31678
31889
  if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
@@ -31684,7 +31895,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
31684
31895
  }
31685
31896
  async function runPrintFiles(input, deps, onPatch) {
31686
31897
  onPatch({ step: "printing" });
31687
- const componentsPath = join24(input.outDir, "components.json");
31898
+ const componentsPath = join26(input.outDir, "components.json");
31688
31899
  try {
31689
31900
  const db = deps.openDb();
31690
31901
  let components = [];
@@ -31768,10 +31979,10 @@ var init_save = __esm({
31768
31979
  realSaveDeps = () => ({
31769
31980
  openDb: openPipelineDb,
31770
31981
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
31771
- writeFile: (path5, contents) => writeFile7(path5, contents),
31982
+ writeFile: (path5, contents) => writeFile8(path5, contents),
31772
31983
  appendRun,
31773
31984
  buildSourceFingerprint,
31774
- sleep: (ms) => new Promise((resolve25) => setTimeout(resolve25, ms)),
31985
+ sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
31775
31986
  warn: (message) => process.stderr.write(message)
31776
31987
  });
31777
31988
  }
@@ -31791,9 +32002,9 @@ var init_types9 = __esm({
31791
32002
 
31792
32003
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
31793
32004
  import { appendFileSync, writeFileSync } from "node:fs";
31794
- import { mkdir as mkdir8 } from "node:fs/promises";
32005
+ import { mkdir as mkdir9 } from "node:fs/promises";
31795
32006
  import { tmpdir } from "node:os";
31796
- import { join as join25 } from "node:path";
32007
+ import { join as join27 } from "node:path";
31797
32008
  function appendWizardLog(entry) {
31798
32009
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
31799
32010
  }
@@ -31816,7 +32027,7 @@ function realFlowDeps() {
31816
32027
  }
31817
32028
  },
31818
32029
  mkdir: async (path5) => {
31819
- await mkdir8(path5, { recursive: true });
32030
+ await mkdir9(path5, { recursive: true });
31820
32031
  },
31821
32032
  detectSaveConflict,
31822
32033
  buildTimestampedSubdir,
@@ -31920,12 +32131,6 @@ function createFlowController(start, deps) {
31920
32131
  deps.log({ update: sanitizeForLog(patch) });
31921
32132
  } catch {
31922
32133
  }
31923
- if (patch.step !== void 0 && patch.step !== state.step) {
31924
- try {
31925
- deps.beforeStepChange?.();
31926
- } catch {
31927
- }
31928
- }
31929
32134
  state = { ...state, ...patch };
31930
32135
  for (const listener of listeners) listener();
31931
32136
  };
@@ -32073,31 +32278,27 @@ var init_controller = __esm({
32073
32278
  init_push();
32074
32279
  init_save();
32075
32280
  init_types9();
32076
- WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
32281
+ WIZARD_LOG = join27(tmpdir(), "experiences-import-wizard.log");
32077
32282
  }
32078
32283
  });
32079
32284
 
32080
32285
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
32081
- import { useEffect as useEffect20, useRef as useRef12, useSyncExternalStore } from "react";
32082
- function useFlow(start, options = {}) {
32083
- const controller = useRef12();
32286
+ import { useEffect as useEffect21, useRef as useRef13, useSyncExternalStore } from "react";
32287
+ function useFlow(start, deps = realFlowDeps) {
32288
+ const controller = useRef13();
32084
32289
  if (start && !controller.current) {
32085
32290
  try {
32086
32291
  startWizardLog();
32087
32292
  } catch {
32088
32293
  }
32089
- const flowDeps = (options.deps ?? realFlowDeps)();
32090
- controller.current = createFlowController(start, {
32091
- ...flowDeps,
32092
- ...options.beforeStepChange ? { beforeStepChange: options.beforeStepChange } : {}
32093
- });
32294
+ controller.current = createFlowController(start, deps());
32094
32295
  }
32095
32296
  const current = controller.current;
32096
32297
  const state = useSyncExternalStore(
32097
32298
  (listener) => current?.subscribe(listener) ?? (() => void 0),
32098
32299
  () => current?.getState()
32099
32300
  );
32100
- useEffect20(() => {
32301
+ useEffect21(() => {
32101
32302
  if (!start) controller.current = void 0;
32102
32303
  }, [start]);
32103
32304
  return current && state ? { controller: current, state } : void 0;
@@ -32109,175 +32310,6 @@ var init_use_flow = __esm({
32109
32310
  }
32110
32311
  });
32111
32312
 
32112
- // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
32113
- async function readDebugModeSetting() {
32114
- const { debugMode } = await readSettings2();
32115
- return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
32116
- }
32117
- async function writeDebugModeSetting(setting) {
32118
- await updateSettings2({ debugMode: setting });
32119
- }
32120
- var DEFAULT_DEBUG_MODE_SETTING;
32121
- var init_debug_mode_store = __esm({
32122
- "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
32123
- "use strict";
32124
- init_config();
32125
- DEFAULT_DEBUG_MODE_SETTING = {
32126
- enabled: true
32127
- };
32128
- }
32129
- });
32130
-
32131
- // packages/experience-design-system-cli/src/tui/debug-store.ts
32132
- import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
32133
- import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
32134
- import { join as join26 } from "node:path";
32135
- function generateRunId() {
32136
- const now = /* @__PURE__ */ new Date();
32137
- const pad = (n) => String(n).padStart(2, "0");
32138
- return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
32139
- }
32140
- function datePrefix(now = /* @__PURE__ */ new Date()) {
32141
- const pad = (n) => String(n).padStart(2, "0");
32142
- return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
32143
- }
32144
- function slugify(value) {
32145
- return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
32146
- }
32147
- function generateSessionId3() {
32148
- const today = datePrefix();
32149
- const root = debugSessionsDir2();
32150
- const existing = existsSync11(root) ? readdirSync4(root) : [];
32151
- const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
32152
- const maxSeq = existing.reduce((max, entry) => {
32153
- const match2 = seqPattern.exec(entry);
32154
- return match2 ? Math.max(max, Number(match2[1])) : max;
32155
- }, 0);
32156
- return `${today}-session-${maxSeq + 1}`;
32157
- }
32158
- function sessionDebugDir() {
32159
- return join26(debugSessionsDir2(), SESSION_ID);
32160
- }
32161
- function currentDebugSessionDir() {
32162
- return sessionDebugDir();
32163
- }
32164
- async function isDebugModeEnabled() {
32165
- try {
32166
- return (await readDebugModeSetting()).enabled;
32167
- } catch {
32168
- return true;
32169
- }
32170
- }
32171
- function redact(value) {
32172
- const clone = { ...value };
32173
- if ("cma_token" in clone) {
32174
- const raw = clone.cma_token;
32175
- clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
32176
- }
32177
- return clone;
32178
- }
32179
- function startDebugRun({
32180
- flow,
32181
- step,
32182
- menuOption,
32183
- inputs
32184
- }) {
32185
- const runId = generateRunId();
32186
- const startedAt = Date.now();
32187
- const redactedInputs = redact(inputs);
32188
- isDebugModeEnabled().then((enabled) => {
32189
- if (!enabled) return;
32190
- pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
32191
- });
32192
- }
32193
- async function finishDebugRun({
32194
- outputs,
32195
- status,
32196
- exitMethod
32197
- }) {
32198
- const run = pendingRun;
32199
- if (!run) return;
32200
- pendingRun = void 0;
32201
- const durationMs = Date.now() - run.startedAt;
32202
- const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
32203
- const flowSegments = run.flow.split("/");
32204
- const dir = join26(sessionDebugDir(), ...flowSegments);
32205
- await mkdir9(dir, { recursive: true });
32206
- const filename = nextAttemptFilename(dir, run.menuOption);
32207
- await writeFile8(join26(dir, filename), content, { mode: 384 });
32208
- }
32209
- function nextAttemptFilename(dir, menuOption) {
32210
- const today = datePrefix();
32211
- const optionSlug = slugify(menuOption);
32212
- const existing = existsSync11(dir) ? readdirSync4(dir) : [];
32213
- const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
32214
- const maxAttempt = existing.reduce((max, entry) => {
32215
- const match2 = attemptPattern.exec(entry);
32216
- return match2 ? Math.max(max, Number(match2[1])) : max;
32217
- }, 0);
32218
- return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
32219
- }
32220
- function renderMarkdown(run, finish) {
32221
- const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
32222
- const stepLabel2 = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
32223
- const flowSlug = run.flow.split("/").join("-");
32224
- return `# Debug Log
32225
-
32226
- - Run ID: ${run.runId}
32227
- - Flow: ${flowSlug}
32228
- - Step: ${stepLabel2}
32229
- - Menu option: ${run.menuOption}
32230
- - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
32231
- - CLI version: ${readPackageVersion()}
32232
- - Platform: ${process.platform} / Node ${process.version}
32233
- - Duration on screen: ${finish.durationMs}ms
32234
- - Status: ${finish.status}
32235
- - Exit method: ${finish.exitMethod}
32236
-
32237
- ## Inputs
32238
- \`\`\`json
32239
- ${JSON.stringify(run.inputs, null, 2)}
32240
- \`\`\`
32241
-
32242
- ## Outputs
32243
- \`\`\`json
32244
- ${JSON.stringify(finish.outputs, null, 2)}
32245
- \`\`\`
32246
- `;
32247
- }
32248
- function handleCrash() {
32249
- return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
32250
- }
32251
- var pendingRun, SESSION_ID;
32252
- var init_debug_store = __esm({
32253
- "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
32254
- "use strict";
32255
- init_config();
32256
- init_version();
32257
- init_debug_mode_store();
32258
- SESSION_ID = generateSessionId3();
32259
- void isDebugModeEnabled().then((enabled) => {
32260
- if (!enabled) return void 0;
32261
- return mkdir9(sessionDebugDir(), { recursive: true });
32262
- });
32263
- process.once("uncaughtException", (err) => {
32264
- void handleCrash().finally(() => {
32265
- throw err;
32266
- });
32267
- });
32268
- process.once("unhandledRejection", (reason) => {
32269
- void handleCrash().finally(() => {
32270
- throw reason;
32271
- });
32272
- });
32273
- process.once("SIGINT", () => {
32274
- void handleCrash().finally(() => {
32275
- process.exit(130);
32276
- });
32277
- });
32278
- }
32279
- });
32280
-
32281
32313
  // packages/experience-design-system-cli/src/tui/help/help-info.ts
32282
32314
  async function readHelpInfo() {
32283
32315
  const debugMode = await readDebugModeSetting();
@@ -32285,7 +32317,7 @@ async function readHelpInfo() {
32285
32317
  storage: [
32286
32318
  { label: "Config folder", value: configRoot2() },
32287
32319
  { label: "Settings file", value: configFilePath2() },
32288
- { label: "Debug logs", value: debugSessionsDir2() }
32320
+ { label: "Debug logs", value: "<project>/.contentful/debug/sessions, next to components.json" }
32289
32321
  ],
32290
32322
  troubleshooting: [
32291
32323
  { label: "CLI version", value: readPackageVersion() },
@@ -32310,7 +32342,7 @@ var init_help_info = __esm({
32310
32342
  });
32311
32343
 
32312
32344
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
32313
- import { useEffect as useEffect21, useState as useState27 } from "react";
32345
+ import { useEffect as useEffect22, useState as useState27 } from "react";
32314
32346
  import { Box as Box42, Text as Text44, useInput as useInput9 } from "ink";
32315
32347
  import { Fragment as Fragment16, jsx as jsx53, jsxs as jsxs43 } from "react/jsx-runtime";
32316
32348
  function Section({ title, rows }) {
@@ -32324,7 +32356,7 @@ function Section({ title, rows }) {
32324
32356
  }
32325
32357
  function HelpScreen({ onDone }) {
32326
32358
  const [info, setInfo] = useState27();
32327
- useEffect21(() => {
32359
+ useEffect22(() => {
32328
32360
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
32329
32361
  void readHelpInfo().then(setInfo);
32330
32362
  }, []);
@@ -32473,7 +32505,7 @@ var init_config_store = __esm({
32473
32505
  });
32474
32506
 
32475
32507
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
32476
- import { useEffect as useEffect22, useState as useState29 } from "react";
32508
+ import { useEffect as useEffect23, useState as useState29 } from "react";
32477
32509
  import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
32478
32510
  import TextInput4 from "ink-text-input";
32479
32511
  import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -32495,7 +32527,7 @@ function ConfigurationScreen({ onDone }) {
32495
32527
  const [lastSaved, setLastSaved] = useState29(null);
32496
32528
  const [editing, setEditing] = useState29(false);
32497
32529
  const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
32498
- useEffect22(() => {
32530
+ useEffect23(() => {
32499
32531
  readCredentials().then((cfg) => {
32500
32532
  setConfig(cfg);
32501
32533
  setStage("form");
@@ -32679,13 +32711,13 @@ var init_analytics_store = __esm({
32679
32711
  });
32680
32712
 
32681
32713
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
32682
- import { useEffect as useEffect23, useState as useState30 } from "react";
32714
+ import { useEffect as useEffect24, useState as useState30 } from "react";
32683
32715
  import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
32684
32716
  import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
32685
32717
  function OptInAnalyticsScreen({ onDone }) {
32686
32718
  const [loading, setLoading] = useState30(true);
32687
32719
  const [enabled, setEnabled] = useState30(true);
32688
- useEffect23(() => {
32720
+ useEffect24(() => {
32689
32721
  readAnalyticsSetting().then((setting) => {
32690
32722
  setEnabled(setting.enabled);
32691
32723
  setLoading(false);
@@ -32748,12 +32780,12 @@ var init_screen11 = __esm({
32748
32780
  });
32749
32781
 
32750
32782
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
32751
- import { useEffect as useEffect24, useState as useState31 } from "react";
32783
+ import { useEffect as useEffect25, useState as useState31 } from "react";
32752
32784
  import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
32753
32785
  import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
32754
32786
  function UpgradeScreen({ onDone }) {
32755
32787
  const [upgradeCheck, setUpgradeCheck] = useState31();
32756
- useEffect24(() => {
32788
+ useEffect25(() => {
32757
32789
  startDebugRun({
32758
32790
  flow: "upgrade",
32759
32791
  step: "01-upgrade",
@@ -32828,13 +32860,13 @@ var init_PageContainer4 = __esm({
32828
32860
  });
32829
32861
 
32830
32862
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
32831
- import { useEffect as useEffect25, useState as useState32 } from "react";
32863
+ import { useEffect as useEffect26, useState as useState32 } from "react";
32832
32864
  import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
32833
32865
  import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
32834
32866
  function DebugModeScreen({ onDone }) {
32835
32867
  const [loading, setLoading] = useState32(true);
32836
32868
  const [enabled, setEnabled] = useState32(true);
32837
- useEffect25(() => {
32869
+ useEffect26(() => {
32838
32870
  readDebugModeSetting().then((setting) => {
32839
32871
  setEnabled(setting.enabled);
32840
32872
  setLoading(false);
@@ -32896,8 +32928,8 @@ var app_exports = {};
32896
32928
  __export(app_exports, {
32897
32929
  runApp: () => runApp
32898
32930
  });
32899
- import { join as join27 } from "node:path";
32900
- import { useEffect as useEffect26, useState as useState33 } from "react";
32931
+ import { join as join28 } from "node:path";
32932
+ import { useEffect as useEffect27, useState as useState33 } from "react";
32901
32933
  import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
32902
32934
  function App({ importOptions, inkClear }) {
32903
32935
  const [screen, setScreen] = useState33("start");
@@ -32927,9 +32959,9 @@ function App({ importOptions, inkClear }) {
32927
32959
  const [generationInput, setGenerationInput] = useState33();
32928
32960
  const generation = useGeneration(generationInput);
32929
32961
  const [flowStart, setFlowStart] = useState33();
32930
- const flow = useFlow(flowStart, { beforeStepChange: inkClear });
32962
+ const flow = useFlow(flowStart);
32931
32963
  const [importDefaults, setImportDefaults] = useState33();
32932
- useEffect26(() => {
32964
+ useEffect27(() => {
32933
32965
  if (screen !== "import") {
32934
32966
  setImportDefaults(void 0);
32935
32967
  return;
@@ -32947,7 +32979,7 @@ function App({ importOptions, inkClear }) {
32947
32979
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
32948
32980
  const state = await inspectTokens({
32949
32981
  rawTokensPath: tokens,
32950
- outDir: join27(resolveUserPath(projectPath2), ".contentful"),
32982
+ outDir: join28(resolveUserPath(projectPath2), ".contentful"),
32951
32983
  cache: importOptions.cache
32952
32984
  });
32953
32985
  if (state.kind === "cached") {
@@ -32987,12 +33019,12 @@ function App({ importOptions, inkClear }) {
32987
33019
  }
32988
33020
  });
32989
33021
  };
32990
- useEffect26(() => {
33022
+ useEffect27(() => {
32991
33023
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
32992
33024
  setExtractionRun(void 0);
32993
33025
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
32994
33026
  }, [extraction, extractionRun]);
32995
- useEffect26(() => {
33027
+ useEffect27(() => {
32996
33028
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
32997
33029
  const { extraction: produced, input, generatePromptPath } = scopeRun;
32998
33030
  setGenerationInput({
@@ -33010,7 +33042,7 @@ function App({ importOptions, inkClear }) {
33010
33042
  ...generatePromptPath ? { generatePromptPath } : {}
33011
33043
  });
33012
33044
  }, [scopeFlow, scopeRun, generationInput]);
33013
- useEffect26(() => {
33045
+ useEffect27(() => {
33014
33046
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
33015
33047
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
33016
33048
  inkClear();
@@ -33061,7 +33093,8 @@ function App({ importOptions, inkClear }) {
33061
33093
  state: flow.state,
33062
33094
  controller: flow.controller,
33063
33095
  generatePromptPath: flowStart.generatePromptPath,
33064
- onExit: setImportExitCode
33096
+ onExit: setImportExitCode,
33097
+ onStepChange: inkClear
33065
33098
  }
33066
33099
  );
33067
33100
  }
@@ -33218,7 +33251,7 @@ var init_app = __esm({
33218
33251
 
33219
33252
  // packages/experience-design-system-cli/program.ts
33220
33253
  import { readFileSync as readFileSync9 } from "node:fs";
33221
- import { join as join28 } from "node:path";
33254
+ import { join as join29 } from "node:path";
33222
33255
  import { Command } from "commander";
33223
33256
 
33224
33257
  // packages/experience-design-system-cli/src/legacy/run-legacy.ts
@@ -33322,14 +33355,14 @@ function runDevWatch(args) {
33322
33355
  process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
33323
33356
  return Promise.resolve(1);
33324
33357
  }
33325
- return new Promise((resolve25) => {
33358
+ return new Promise((resolve27) => {
33326
33359
  const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
33327
33360
  process.on("SIGINT", () => void 0);
33328
- child.on("exit", (code) => resolve25(code ?? 0));
33361
+ child.on("exit", (code) => resolve27(code ?? 0));
33329
33362
  child.on("error", (err) => {
33330
33363
  process.stderr.write(`${err.message}
33331
33364
  `);
33332
- resolve25(1);
33365
+ resolve27(1);
33333
33366
  });
33334
33367
  });
33335
33368
  }
@@ -33354,7 +33387,7 @@ function registerImportCommand(program, openTui) {
33354
33387
  init_package_root();
33355
33388
  var pkg = JSON.parse(
33356
33389
  readFileSync9(
33357
- join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
33390
+ join29(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
33358
33391
  "utf8"
33359
33392
  )
33360
33393
  );
@@ -33373,8 +33406,8 @@ function createProgram() {
33373
33406
  init_config();
33374
33407
  init_package_root();
33375
33408
  import { existsSync as existsSync12 } from "node:fs";
33376
- import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
33377
- import { dirname as dirname16, join as join29 } from "node:path";
33409
+ import { mkdir as mkdir10, readFile as readFile19, rename as rename4, rmdir, unlink } from "node:fs/promises";
33410
+ import { dirname as dirname16, join as join30 } from "node:path";
33378
33411
  var PACKAGE_NAME4 = "@contentful/experience-design-system-cli";
33379
33412
  async function readJson(path5) {
33380
33413
  try {
@@ -33385,9 +33418,9 @@ async function readJson(path5) {
33385
33418
  }
33386
33419
  async function migrateOldConfig() {
33387
33420
  try {
33388
- const oldCredentials = join29(oldConfigDir2(), "credentials.json");
33389
- const oldRuns = join29(oldConfigDir2(), "runs.json");
33390
- const oldDebugMode = join29(
33421
+ const oldCredentials = join30(oldConfigDir2(), "credentials.json");
33422
+ const oldRuns = join30(oldConfigDir2(), "runs.json");
33423
+ const oldDebugMode = join30(
33391
33424
  findPackageRoot(import.meta.url, PACKAGE_NAME4),
33392
33425
  ".contentful",
33393
33426
  "config",
@@ -33401,7 +33434,7 @@ async function migrateOldConfig() {
33401
33434
  if (existsSync12(oldRuns)) {
33402
33435
  if (!existsSync12(runsFilePath2())) {
33403
33436
  await mkdir10(dirname16(runsFilePath2()), { recursive: true });
33404
- await rename3(oldRuns, runsFilePath2());
33437
+ await rename4(oldRuns, runsFilePath2());
33405
33438
  } else {
33406
33439
  await unlink(oldRuns);
33407
33440
  }