@contentful/experience-design-system-cli 2.37.1-dev-build-e051d273.0 → 2.37.1-dev-build-4e7e3ced.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 CHANGED
@@ -2116,71 +2116,21 @@ var init_config = __esm({
2116
2116
  });
2117
2117
 
2118
2118
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
2119
- function toRetentionDays(value) {
2120
- return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
2121
- }
2122
2119
  async function readDebugModeSetting() {
2123
2120
  const { debugMode } = await readSettings2();
2124
- const saved = debugMode ?? {};
2125
- return {
2126
- enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
2127
- retentionDays: toRetentionDays(saved.retentionDays)
2128
- };
2121
+ return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
2129
2122
  }
2130
- async function writeDebugModeSetting(change) {
2131
- await updateSettings2({ debugMode: { ...await readDebugModeSetting(), ...change } });
2123
+ async function writeDebugModeSetting(setting) {
2124
+ await updateSettings2({ debugMode: setting });
2132
2125
  }
2133
- var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
2126
+ var DEFAULT_DEBUG_MODE_SETTING;
2134
2127
  var init_debug_mode_store = __esm({
2135
2128
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
2136
2129
  "use strict";
2137
2130
  init_config();
2138
- RETENTION_CHOICES = [30, 60, 90];
2139
- DEFAULT_RETENTION_DAYS = 30;
2140
- }
2141
- });
2142
-
2143
- // packages/experience-design-system-cli/src/tui/debug-prune.ts
2144
- import { readdir as readdir3, rm, stat as stat5 } from "node:fs/promises";
2145
- import { join as join24 } from "node:path";
2146
- async function logFilesIn(dir) {
2147
- const entries = await readdir3(dir, { withFileTypes: true });
2148
- const nested = await Promise.all(
2149
- entries.map(async (entry) => {
2150
- const path5 = join24(dir, entry.name);
2151
- if (entry.isDirectory()) return logFilesIn(path5);
2152
- return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
2153
- })
2154
- );
2155
- return nested.flat();
2156
- }
2157
- async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
2158
- const cutoff = now - retentionDays * DAY_MS;
2159
- const contentfulDir = join24(base, ".contentful");
2160
- let deleted = 0;
2161
- try {
2162
- const sessions = (await readdir3(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
2163
- for (const session of sessions) {
2164
- const files = await logFilesIn(join24(contentfulDir, session, "debug")).catch(() => []);
2165
- for (const file of files) {
2166
- try {
2167
- if ((await stat5(file)).mtimeMs >= cutoff) continue;
2168
- await rm(file);
2169
- deleted += 1;
2170
- } catch {
2171
- }
2172
- }
2173
- }
2174
- } catch {
2175
- }
2176
- return deleted;
2177
- }
2178
- var DAY_MS, SESSION_FOLDER;
2179
- var init_debug_prune = __esm({
2180
- "packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
2181
- "use strict";
2182
- DAY_MS = 24 * 60 * 60 * 1e3;
2183
- SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
2131
+ DEFAULT_DEBUG_MODE_SETTING = {
2132
+ enabled: true
2133
+ };
2184
2134
  }
2185
2135
  });
2186
2136
 
@@ -2196,7 +2146,7 @@ __export(debug_store_exports, {
2196
2146
  });
2197
2147
  import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
2198
2148
  import { existsSync as existsSync9, readdirSync as readdirSync4 } from "node:fs";
2199
- import { join as join25, resolve as resolve26 } from "node:path";
2149
+ import { join as join24, resolve as resolve26 } from "node:path";
2200
2150
  function generateRunId() {
2201
2151
  const now = /* @__PURE__ */ new Date();
2202
2152
  const pad = (n) => String(n).padStart(2, "0");
@@ -2228,12 +2178,12 @@ function nextSessionId(contentfulDir) {
2228
2178
  return `${today}-session-${maxSeq + 1}`;
2229
2179
  }
2230
2180
  function startSession(base, { replace }) {
2231
- const contentfulDir = join25(base, ".contentful");
2232
- if (replace || !sessionDir) sessionDir = join25(contentfulDir, nextSessionId(contentfulDir));
2181
+ const contentfulDir = join24(base, ".contentful");
2182
+ if (replace || !sessionDir) sessionDir = join24(contentfulDir, nextSessionId(contentfulDir));
2233
2183
  return sessionDir;
2234
2184
  }
2235
2185
  function currentDebugSessionDir() {
2236
- return sessionDir && join25(sessionDir, "debug");
2186
+ return sessionDir && join24(sessionDir, "debug");
2237
2187
  }
2238
2188
  function currentSessionDir() {
2239
2189
  return sessionDir;
@@ -2241,7 +2191,7 @@ function currentSessionDir() {
2241
2191
  async function startDebugSessionIn(base, { replace = false } = {}) {
2242
2192
  try {
2243
2193
  if (!await isDebugModeEnabled()) return;
2244
- await mkdir9(join25(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
2194
+ await mkdir9(join24(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
2245
2195
  } catch {
2246
2196
  }
2247
2197
  }
@@ -2251,11 +2201,11 @@ function nextImportRunDir(session) {
2251
2201
  const match2 = /^dsi-import-(\d+)$/.exec(entry);
2252
2202
  return match2 ? Math.max(max, Number(match2[1])) : max;
2253
2203
  }, 0);
2254
- return join25(session, `dsi-import-${maxRun + 1}`);
2204
+ return join24(session, `dsi-import-${maxRun + 1}`);
2255
2205
  }
2256
2206
  async function startImportRun(projectPath) {
2257
2207
  await startDebugSessionIn(projectPath);
2258
- if (!sessionDir) return join25(resolve26(projectPath), ".contentful");
2208
+ if (!sessionDir) return join24(resolve26(projectPath), ".contentful");
2259
2209
  const dir = nextImportRunDir(sessionDir);
2260
2210
  await mkdir9(dir, { recursive: true });
2261
2211
  return dir;
@@ -2302,10 +2252,10 @@ async function finishDebugRun({
2302
2252
  const root = currentDebugSessionDir();
2303
2253
  if (!root) return;
2304
2254
  const flowSegments = run.flow.split("/");
2305
- const dir = join25(root, ...flowSegments);
2255
+ const dir = join24(root, ...flowSegments);
2306
2256
  await mkdir9(dir, { recursive: true });
2307
2257
  const filename = nextAttemptFilename(dir, run.menuOption);
2308
- await writeFile8(join25(dir, filename), content, { mode: 384 });
2258
+ await writeFile8(join24(dir, filename), content, { mode: 384 });
2309
2259
  }
2310
2260
  function nextAttemptFilename(dir, menuOption) {
2311
2261
  const today = datePrefix();
@@ -2356,11 +2306,9 @@ var init_debug_store = __esm({
2356
2306
  init_config();
2357
2307
  init_version();
2358
2308
  init_debug_mode_store();
2359
- init_debug_prune();
2360
- void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(async ([enabled, base]) => {
2361
- if (!base) return;
2362
- await readDebugModeSetting().then(({ retentionDays }) => pruneExpiredLogs(base, retentionDays)).catch(() => void 0);
2363
- if (enabled) await mkdir9(join25(startSession(base, { replace: false }), "debug"), { recursive: true });
2309
+ void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
2310
+ if (!enabled || !base) return void 0;
2311
+ return mkdir9(join24(startSession(base, { replace: false }), "debug"), { recursive: true });
2364
2312
  });
2365
2313
  process.once("uncaughtException", (err) => {
2366
2314
  void handleCrash().finally(() => {
@@ -2381,7 +2329,7 @@ var init_debug_store = __esm({
2381
2329
  });
2382
2330
 
2383
2331
  // packages/experience-design-system-cli/app.tsx
2384
- import { join as join27 } from "node:path";
2332
+ import { join as join26 } from "node:path";
2385
2333
  import { useEffect as useEffect27, useState as useState36 } from "react";
2386
2334
 
2387
2335
  // packages/experience-design-system-cli/src/tui/home/home.tsx
@@ -2610,13 +2558,25 @@ function useWelcomeControls(onQuit) {
2610
2558
 
2611
2559
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
2612
2560
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
2613
- var RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
2561
+ var OVERVIEW_BOX_MAX_WIDTH = 90;
2562
+ var AI_MARKER = "\u273B";
2614
2563
  var OVERVIEW = [
2615
- { label: "Step 1", description: "Extract components from your codebase" },
2616
- { label: "Step 2", description: "Review what was extracted" },
2617
- { label: "Step 3", description: "Generate CDF definitions with Claude" },
2618
- { label: "Step 4", description: "Review generated definitions" },
2619
- { label: "Step 5", description: "Push to Contentful" }
2564
+ {
2565
+ label: "Step 1",
2566
+ description: "Extract components from your codebase",
2567
+ ai: true
2568
+ },
2569
+ { label: "Step 2", description: "Review what was extracted", ai: false },
2570
+ {
2571
+ label: "Step 3",
2572
+ description: "Generate component definitions",
2573
+ ai: true
2574
+ },
2575
+ { label: "Step 4", description: "Review generated definitions", ai: false },
2576
+ { label: "Step 5", description: "Push to Contentful", ai: false }
2577
+ ];
2578
+ var AI_DISCLOSURE = [
2579
+ "Steps marked \u273B use your local AI agent, which may send relevant code to your AI provider under your agreement with them. Contentful does not receive that code, or the prompts and responses. AI suggestions can be wrong or incomplete, so review and edit them before importing."
2620
2580
  ];
2621
2581
  function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
2622
2582
  const [projectPath, setProjectPath] = useState3(initialPath);
@@ -2626,18 +2586,37 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
2626
2586
  if (path5) onContinue(path5);
2627
2587
  };
2628
2588
  return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
2629
- /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "Let's import your design system into Contentful." }),
2630
- /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
2631
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: RULE }),
2632
- OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
2633
- /* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
2634
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
2635
- ] }, item.label)),
2636
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: RULE })
2637
- ] }),
2589
+ /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.accent, children: "Let's import your design system into Contentful." }),
2590
+ /* @__PURE__ */ jsx4(Box3, { flexDirection: "row", children: /* @__PURE__ */ jsxs3(
2591
+ Box3,
2592
+ {
2593
+ flexDirection: "column",
2594
+ borderStyle: "round",
2595
+ borderColor: PALETTE.border,
2596
+ paddingX: 2,
2597
+ paddingY: 1,
2598
+ width: OVERVIEW_BOX_MAX_WIDTH,
2599
+ flexShrink: 1,
2600
+ children: [
2601
+ OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
2602
+ /* @__PURE__ */ jsx4(Box3, { flexShrink: 0, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }) }),
2603
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, wrap: "truncate-end", children: item.description }),
2604
+ item.ai && /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.accent, children: AI_MARKER })
2605
+ ] }, item.label)),
2606
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
2607
+ /* @__PURE__ */ jsxs3(Text4, { bold: true, children: [
2608
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: AI_MARKER }),
2609
+ " AI disclosure"
2610
+ ] }),
2611
+ AI_DISCLOSURE.map((paragraph) => /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: paragraph }, paragraph))
2612
+ ] })
2613
+ ]
2614
+ }
2615
+ ) }),
2638
2616
  /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
2639
2617
  /* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
2640
2618
  /* @__PURE__ */ jsxs3(Box3, { children: [
2619
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "? " }),
2641
2620
  /* @__PURE__ */ jsx4(Text4, { children: "Project path: " }),
2642
2621
  /* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
2643
2622
  ] })
@@ -8830,8 +8809,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
8830
8809
  continue;
8831
8810
  const entryPath = join7(dir, entry);
8832
8811
  try {
8833
- const stat6 = statSync3(entryPath);
8834
- if (stat6.isDirectory()) {
8812
+ const stat5 = statSync3(entryPath);
8813
+ if (stat5.isDirectory()) {
8835
8814
  scanDir(entryPath, depth + 1);
8836
8815
  }
8837
8816
  } catch {
@@ -12918,15 +12897,15 @@ function walkProjectTree(dir, result, includeContent) {
12918
12897
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
12919
12898
  function collectFiles(root, options = {}) {
12920
12899
  const resolved = path4.resolve(root);
12921
- let stat6;
12900
+ let stat5;
12922
12901
  try {
12923
- stat6 = statSync4(resolved);
12902
+ stat5 = statSync4(resolved);
12924
12903
  } catch (err) {
12925
12904
  return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
12926
12905
  }
12927
- if (stat6.isFile())
12906
+ if (stat5.isFile())
12928
12907
  return { ok: false, failure: "is-file", rootPath: resolved };
12929
- if (!stat6.isDirectory())
12908
+ if (!stat5.isDirectory())
12930
12909
  return { ok: false, failure: "not-directory", rootPath: resolved };
12931
12910
  const result = {
12932
12911
  filePaths: [],
@@ -17076,7 +17055,7 @@ function useElapsed() {
17076
17055
 
17077
17056
  // packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx
17078
17057
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
17079
- var RULE2 = "\u2500".repeat(40);
17058
+ var RULE = "\u2500".repeat(40);
17080
17059
  function Line({ line }) {
17081
17060
  if (line.progress) {
17082
17061
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, children: [
@@ -17106,9 +17085,9 @@ function RunningStep({
17106
17085
  const elapsed = useElapsed();
17107
17086
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
17108
17087
  /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
17109
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE2 }),
17088
+ /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE }),
17110
17089
  /* @__PURE__ */ jsx10(Text10, { bold: true, children: stepLabel(stepNumber, totalSteps, title) }),
17111
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE2 })
17090
+ /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE })
17112
17091
  ] }),
17113
17092
  /* @__PURE__ */ jsx10(Text10, { children: description }),
17114
17093
  /* @__PURE__ */ jsx10(Box9, { marginTop: 1, flexDirection: "column", gap: 1, children: lines.map((line, index) => /* @__PURE__ */ jsx10(Line, { line }, index)) }),
@@ -27968,7 +27947,7 @@ init_debug_mode_store();
27968
27947
  init_version();
27969
27948
 
27970
27949
  // packages/experience-design-system-cli/src/tui/help/file-locations.ts
27971
- import { join as join26, resolve as resolve27 } from "node:path";
27950
+ import { join as join25, resolve as resolve27 } from "node:path";
27972
27951
  function describeFileLocations({
27973
27952
  contentfulBaseDir,
27974
27953
  debugModeEnabled,
@@ -27977,14 +27956,14 @@ function describeFileLocations({
27977
27956
  if (!debugModeEnabled) {
27978
27957
  return {
27979
27958
  debugLogs: "none while Debug Mode is off",
27980
- importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
27959
+ importFiles: `${join25("<project>", ".contentful")}/ (tokens.json, components.json)`
27981
27960
  };
27982
27961
  }
27983
27962
  const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
27984
- const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
27963
+ const session = currentSessionDir2 ?? join25(base, ".contentful", "<date>-session-<n>");
27985
27964
  return {
27986
- debugLogs: join26(session, "debug"),
27987
- importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
27965
+ debugLogs: join25(session, "debug"),
27966
+ importFiles: `${join25(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
27988
27967
  };
27989
27968
  }
27990
27969
 
@@ -29237,74 +29216,51 @@ import { useEffect as useEffect26, useState as useState35 } from "react";
29237
29216
  import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
29238
29217
  init_debug_mode_store();
29239
29218
  init_debug_store();
29240
- import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
29241
- var ROWS = ["enabled", "retentionDays"];
29242
- var nextRetention = (current) => RETENTION_CHOICES[(RETENTION_CHOICES.indexOf(current) + 1) % RETENTION_CHOICES.length];
29219
+ import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
29243
29220
  function DebugModeScreen({ onDone }) {
29244
- const [setting, setSetting] = useState35(null);
29245
- const [focus, setFocus] = useState35("enabled");
29221
+ const [loading, setLoading] = useState35(true);
29222
+ const [enabled, setEnabled] = useState35(true);
29246
29223
  useEffect26(() => {
29247
- readDebugModeSetting().then((loaded) => {
29248
- setSetting(loaded);
29224
+ readDebugModeSetting().then((setting) => {
29225
+ setEnabled(setting.enabled);
29226
+ setLoading(false);
29249
29227
  startDebugRun({
29250
29228
  flow: "settings/debug-mode",
29251
29229
  step: "01-debug-mode",
29252
29230
  menuOption: "Debug Mode",
29253
- inputs: { ...loaded }
29231
+ inputs: { enabled: setting.enabled }
29254
29232
  });
29255
29233
  });
29256
29234
  }, []);
29257
- const change = (patch) => {
29258
- if (!setting) return;
29259
- setSetting({ ...setting, ...patch });
29260
- void writeDebugModeSetting(patch);
29261
- };
29262
29235
  useInput16((input, key) => {
29263
- if (!setting) return;
29264
- if (key.upArrow || key.downArrow) {
29265
- setFocus((current) => ROWS[(ROWS.indexOf(current) + (key.downArrow ? 1 : ROWS.length - 1)) % ROWS.length]);
29266
- return;
29267
- }
29236
+ if (loading) return;
29268
29237
  if (key.return || input === " ") {
29269
- if (focus === "enabled") change({ enabled: !setting.enabled });
29270
- else change({ retentionDays: nextRetention(setting.retentionDays) });
29238
+ setEnabled((current) => {
29239
+ const next = !current;
29240
+ void writeDebugModeSetting({ enabled: next });
29241
+ return next;
29242
+ });
29271
29243
  return;
29272
29244
  }
29273
29245
  if (key.escape || input === "q") {
29274
- void finishDebugRun({ outputs: { ...setting }, status: "success", exitMethod: "saved" });
29246
+ void finishDebugRun({ outputs: { enabled }, status: "success", exitMethod: "saved" });
29275
29247
  onDone();
29276
29248
  }
29277
29249
  });
29278
- const marker = (row) => focus === row ? "\u276F" : " ";
29279
29250
  return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
29280
29251
  /* @__PURE__ */ jsx62(Text53, { bold: true, children: "Settings \u203A Debug Mode" }),
29281
29252
  /* @__PURE__ */ jsx62(Text53, { children: " " }),
29282
- setting ? /* @__PURE__ */ jsxs51(Fragment21, { children: [
29283
- /* @__PURE__ */ jsxs51(Text53, { children: [
29284
- marker("enabled"),
29285
- " Debug logging:",
29286
- " ",
29287
- /* @__PURE__ */ jsx62(Text53, { bold: true, color: setting.enabled ? PALETTE.success : PALETTE.muted, children: setting.enabled ? "On" : "Off" })
29288
- ] }),
29289
- /* @__PURE__ */ jsxs51(Text53, { children: [
29290
- marker("retentionDays"),
29291
- " Delete logs after:",
29292
- " ",
29293
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
29294
- setting.retentionDays,
29295
- " days"
29296
- ] })
29297
- ] }),
29298
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
29299
- /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Older logs are deleted the next time the CLI starts." })
29300
- ] }) : /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Loading\u2026" }),
29253
+ loading ? /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs51(Text53, { children: [
29254
+ "Debug logging:",
29255
+ " ",
29256
+ /* @__PURE__ */ jsx62(Text53, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
29257
+ ] }),
29301
29258
  /* @__PURE__ */ jsx62(Text53, { children: " " }),
29302
29259
  /* @__PURE__ */ jsx62(
29303
29260
  ControlHints,
29304
29261
  {
29305
29262
  hints: [
29306
- { keys: "\u2191/\u2193", label: "move" },
29307
- { keys: "\u23CE/Space", label: "change" },
29263
+ { keys: "\u23CE/Space", label: "toggle" },
29308
29264
  { keys: "Esc/q", label: "back" }
29309
29265
  ]
29310
29266
  }
@@ -29313,7 +29269,7 @@ function DebugModeScreen({ onDone }) {
29313
29269
  }
29314
29270
 
29315
29271
  // packages/experience-design-system-cli/app.tsx
29316
- import { Fragment as Fragment22, jsx as jsx63 } from "react/jsx-runtime";
29272
+ import { Fragment as Fragment21, jsx as jsx63 } from "react/jsx-runtime";
29317
29273
  function App({ importOptions, inkClear }) {
29318
29274
  const [screen, setScreen] = useState36("start");
29319
29275
  const [importExitCode, setImportExitCode] = useState36();
@@ -29362,7 +29318,7 @@ function App({ importOptions, inkClear }) {
29362
29318
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
29363
29319
  const state2 = await inspectTokens({
29364
29320
  rawTokensPath: tokens,
29365
- contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
29321
+ contentfulDir: join26(resolveUserPath(projectPath2), ".contentful"),
29366
29322
  cache: importOptions.cache
29367
29323
  });
29368
29324
  if (state2.kind === "cached") {
@@ -29482,7 +29438,7 @@ function App({ importOptions, inkClear }) {
29482
29438
  }
29483
29439
  );
29484
29440
  }
29485
- if (importDefaults === void 0) return /* @__PURE__ */ jsx63(Fragment22, {});
29441
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx63(Fragment21, {});
29486
29442
  if (projectPath === void 0) {
29487
29443
  return /* @__PURE__ */ jsx63(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
29488
29444
  }
@@ -29521,7 +29477,7 @@ function App({ importOptions, inkClear }) {
29521
29477
  }
29522
29478
  );
29523
29479
  }
29524
- return /* @__PURE__ */ jsx63(Fragment22, {});
29480
+ return /* @__PURE__ */ jsx63(Fragment21, {});
29525
29481
  }
29526
29482
  if (scopeRun && scopeFlow) {
29527
29483
  if (scopeFlow.status === "failed") {
@@ -29558,7 +29514,7 @@ function App({ importOptions, inkClear }) {
29558
29514
  }
29559
29515
  );
29560
29516
  }
29561
- return /* @__PURE__ */ jsx63(Fragment22, {});
29517
+ return /* @__PURE__ */ jsx63(Fragment21, {});
29562
29518
  }
29563
29519
  if (pendingLaunch?.cached) {
29564
29520
  return /* @__PURE__ */ jsx63(
package/dist/index.js CHANGED
@@ -8266,8 +8266,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
8266
8266
  continue;
8267
8267
  const entryPath = join5(dir, entry);
8268
8268
  try {
8269
- const stat6 = statSync2(entryPath);
8270
- if (stat6.isDirectory()) {
8269
+ const stat5 = statSync2(entryPath);
8270
+ if (stat5.isDirectory()) {
8271
8271
  scanDir(entryPath, depth + 1);
8272
8272
  }
8273
8273
  } catch {
@@ -12911,15 +12911,15 @@ import { statSync as statSync3 } from "node:fs";
12911
12911
  import path4 from "node:path";
12912
12912
  function collectFiles(root, options = {}) {
12913
12913
  const resolved = path4.resolve(root);
12914
- let stat6;
12914
+ let stat5;
12915
12915
  try {
12916
- stat6 = statSync3(resolved);
12916
+ stat5 = statSync3(resolved);
12917
12917
  } catch (err) {
12918
12918
  return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
12919
12919
  }
12920
- if (stat6.isFile())
12920
+ if (stat5.isFile())
12921
12921
  return { ok: false, failure: "is-file", rootPath: resolved };
12922
- if (!stat6.isDirectory())
12922
+ if (!stat5.isDirectory())
12923
12923
  return { ok: false, failure: "not-directory", rootPath: resolved };
12924
12924
  const result = {
12925
12925
  filePaths: [],
@@ -18561,18 +18561,37 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
18561
18561
  if (path5) onContinue(path5);
18562
18562
  };
18563
18563
  return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
18564
- /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "Let's import your design system into Contentful." }),
18565
- /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
18566
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: RULE }),
18567
- OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
18568
- /* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
18569
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
18570
- ] }, item.label)),
18571
- /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: RULE })
18572
- ] }),
18564
+ /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.accent, children: "Let's import your design system into Contentful." }),
18565
+ /* @__PURE__ */ jsx4(Box3, { flexDirection: "row", children: /* @__PURE__ */ jsxs3(
18566
+ Box3,
18567
+ {
18568
+ flexDirection: "column",
18569
+ borderStyle: "round",
18570
+ borderColor: PALETTE.border,
18571
+ paddingX: 2,
18572
+ paddingY: 1,
18573
+ width: OVERVIEW_BOX_MAX_WIDTH,
18574
+ flexShrink: 1,
18575
+ children: [
18576
+ OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
18577
+ /* @__PURE__ */ jsx4(Box3, { flexShrink: 0, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }) }),
18578
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, wrap: "truncate-end", children: item.description }),
18579
+ item.ai && /* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.accent, children: AI_MARKER })
18580
+ ] }, item.label)),
18581
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
18582
+ /* @__PURE__ */ jsxs3(Text4, { bold: true, children: [
18583
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: AI_MARKER }),
18584
+ " AI disclosure"
18585
+ ] }),
18586
+ AI_DISCLOSURE.map((paragraph) => /* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: paragraph }, paragraph))
18587
+ ] })
18588
+ ]
18589
+ }
18590
+ ) }),
18573
18591
  /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
18574
18592
  /* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
18575
18593
  /* @__PURE__ */ jsxs3(Box3, { children: [
18594
+ /* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "? " }),
18576
18595
  /* @__PURE__ */ jsx4(Text4, { children: "Project path: " }),
18577
18596
  /* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
18578
18597
  ] })
@@ -18585,20 +18604,32 @@ function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
18585
18604
  ] }, control.keys)) })
18586
18605
  ] });
18587
18606
  }
18588
- var RULE, OVERVIEW;
18607
+ var OVERVIEW_BOX_MAX_WIDTH, AI_MARKER, OVERVIEW, AI_DISCLOSURE;
18589
18608
  var init_screen = __esm({
18590
18609
  "packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx"() {
18591
18610
  "use strict";
18592
18611
  init_theme();
18593
18612
  init_controls();
18594
18613
  init_logic();
18595
- RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
18614
+ OVERVIEW_BOX_MAX_WIDTH = 90;
18615
+ AI_MARKER = "\u273B";
18596
18616
  OVERVIEW = [
18597
- { label: "Step 1", description: "Extract components from your codebase" },
18598
- { label: "Step 2", description: "Review what was extracted" },
18599
- { label: "Step 3", description: "Generate CDF definitions with Claude" },
18600
- { label: "Step 4", description: "Review generated definitions" },
18601
- { label: "Step 5", description: "Push to Contentful" }
18617
+ {
18618
+ label: "Step 1",
18619
+ description: "Extract components from your codebase",
18620
+ ai: true
18621
+ },
18622
+ { label: "Step 2", description: "Review what was extracted", ai: false },
18623
+ {
18624
+ label: "Step 3",
18625
+ description: "Generate component definitions",
18626
+ ai: true
18627
+ },
18628
+ { label: "Step 4", description: "Review generated definitions", ai: false },
18629
+ { label: "Step 5", description: "Push to Contentful", ai: false }
18630
+ ];
18631
+ AI_DISCLOSURE = [
18632
+ "Steps marked \u273B use your local AI agent, which may send relevant code to your AI provider under your agreement with them. Contentful does not receive that code, or the prompts and responses. AI suggestions can be wrong or incomplete, so review and edit them before importing."
18602
18633
  ];
18603
18634
  }
18604
18635
  });
@@ -19429,9 +19460,9 @@ function RunningStep({
19429
19460
  const elapsed = useElapsed();
19430
19461
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
19431
19462
  /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
19432
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE2 }),
19463
+ /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE }),
19433
19464
  /* @__PURE__ */ jsx10(Text10, { bold: true, children: stepLabel(stepNumber, totalSteps, title) }),
19434
- /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE2 })
19465
+ /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: RULE })
19435
19466
  ] }),
19436
19467
  /* @__PURE__ */ jsx10(Text10, { children: description }),
19437
19468
  /* @__PURE__ */ jsx10(Box9, { marginTop: 1, flexDirection: "column", gap: 1, children: lines.map((line, index) => /* @__PURE__ */ jsx10(Line, { line }, index)) }),
@@ -19441,7 +19472,7 @@ function RunningStep({
19441
19472
  ] }) })
19442
19473
  ] });
19443
19474
  }
19444
- var RULE2;
19475
+ var RULE;
19445
19476
  var init_running_step = __esm({
19446
19477
  "packages/experience-design-system-cli/src/tui/import/shared/running-step/running-step.tsx"() {
19447
19478
  "use strict";
@@ -19449,7 +19480,7 @@ var init_running_step = __esm({
19449
19480
  init_logic7();
19450
19481
  init_theme2();
19451
19482
  init_use_elapsed();
19452
- RULE2 = "\u2500".repeat(40);
19483
+ RULE = "\u2500".repeat(40);
19453
19484
  }
19454
19485
  });
19455
19486
 
@@ -31252,71 +31283,21 @@ var init_use_flow = __esm({
31252
31283
  });
31253
31284
 
31254
31285
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
31255
- function toRetentionDays(value) {
31256
- return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
31257
- }
31258
31286
  async function readDebugModeSetting() {
31259
31287
  const { debugMode } = await readSettings2();
31260
- const saved = debugMode ?? {};
31261
- return {
31262
- enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
31263
- retentionDays: toRetentionDays(saved.retentionDays)
31264
- };
31288
+ return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
31265
31289
  }
31266
- async function writeDebugModeSetting(change) {
31267
- await updateSettings2({ debugMode: { ...await readDebugModeSetting(), ...change } });
31290
+ async function writeDebugModeSetting(setting) {
31291
+ await updateSettings2({ debugMode: setting });
31268
31292
  }
31269
- var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
31293
+ var DEFAULT_DEBUG_MODE_SETTING;
31270
31294
  var init_debug_mode_store = __esm({
31271
31295
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
31272
31296
  "use strict";
31273
31297
  init_config();
31274
- RETENTION_CHOICES = [30, 60, 90];
31275
- DEFAULT_RETENTION_DAYS = 30;
31276
- }
31277
- });
31278
-
31279
- // packages/experience-design-system-cli/src/tui/debug-prune.ts
31280
- import { readdir as readdir3, rm, stat as stat5 } from "node:fs/promises";
31281
- import { join as join25 } from "node:path";
31282
- async function logFilesIn(dir) {
31283
- const entries = await readdir3(dir, { withFileTypes: true });
31284
- const nested = await Promise.all(
31285
- entries.map(async (entry) => {
31286
- const path5 = join25(dir, entry.name);
31287
- if (entry.isDirectory()) return logFilesIn(path5);
31288
- return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
31289
- })
31290
- );
31291
- return nested.flat();
31292
- }
31293
- async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
31294
- const cutoff = now - retentionDays * DAY_MS;
31295
- const contentfulDir = join25(base, ".contentful");
31296
- let deleted = 0;
31297
- try {
31298
- const sessions = (await readdir3(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
31299
- for (const session of sessions) {
31300
- const files = await logFilesIn(join25(contentfulDir, session, "debug")).catch(() => []);
31301
- for (const file of files) {
31302
- try {
31303
- if ((await stat5(file)).mtimeMs >= cutoff) continue;
31304
- await rm(file);
31305
- deleted += 1;
31306
- } catch {
31307
- }
31308
- }
31309
- }
31310
- } catch {
31311
- }
31312
- return deleted;
31313
- }
31314
- var DAY_MS, SESSION_FOLDER;
31315
- var init_debug_prune = __esm({
31316
- "packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
31317
- "use strict";
31318
- DAY_MS = 24 * 60 * 60 * 1e3;
31319
- SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
31298
+ DEFAULT_DEBUG_MODE_SETTING = {
31299
+ enabled: true
31300
+ };
31320
31301
  }
31321
31302
  });
31322
31303
 
@@ -31332,7 +31313,7 @@ __export(debug_store_exports, {
31332
31313
  });
31333
31314
  import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
31334
31315
  import { existsSync as existsSync10, readdirSync as readdirSync4 } from "node:fs";
31335
- import { join as join26, resolve as resolve26 } from "node:path";
31316
+ import { join as join25, resolve as resolve26 } from "node:path";
31336
31317
  function generateRunId() {
31337
31318
  const now = /* @__PURE__ */ new Date();
31338
31319
  const pad = (n) => String(n).padStart(2, "0");
@@ -31364,12 +31345,12 @@ function nextSessionId(contentfulDir) {
31364
31345
  return `${today}-session-${maxSeq + 1}`;
31365
31346
  }
31366
31347
  function startSession(base, { replace }) {
31367
- const contentfulDir = join26(base, ".contentful");
31368
- if (replace || !sessionDir) sessionDir = join26(contentfulDir, nextSessionId(contentfulDir));
31348
+ const contentfulDir = join25(base, ".contentful");
31349
+ if (replace || !sessionDir) sessionDir = join25(contentfulDir, nextSessionId(contentfulDir));
31369
31350
  return sessionDir;
31370
31351
  }
31371
31352
  function currentDebugSessionDir() {
31372
- return sessionDir && join26(sessionDir, "debug");
31353
+ return sessionDir && join25(sessionDir, "debug");
31373
31354
  }
31374
31355
  function currentSessionDir() {
31375
31356
  return sessionDir;
@@ -31377,7 +31358,7 @@ function currentSessionDir() {
31377
31358
  async function startDebugSessionIn(base, { replace = false } = {}) {
31378
31359
  try {
31379
31360
  if (!await isDebugModeEnabled()) return;
31380
- await mkdir9(join26(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
31361
+ await mkdir9(join25(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
31381
31362
  } catch {
31382
31363
  }
31383
31364
  }
@@ -31387,11 +31368,11 @@ function nextImportRunDir(session) {
31387
31368
  const match2 = /^dsi-import-(\d+)$/.exec(entry);
31388
31369
  return match2 ? Math.max(max, Number(match2[1])) : max;
31389
31370
  }, 0);
31390
- return join26(session, `dsi-import-${maxRun + 1}`);
31371
+ return join25(session, `dsi-import-${maxRun + 1}`);
31391
31372
  }
31392
31373
  async function startImportRun(projectPath) {
31393
31374
  await startDebugSessionIn(projectPath);
31394
- if (!sessionDir) return join26(resolve26(projectPath), ".contentful");
31375
+ if (!sessionDir) return join25(resolve26(projectPath), ".contentful");
31395
31376
  const dir = nextImportRunDir(sessionDir);
31396
31377
  await mkdir9(dir, { recursive: true });
31397
31378
  return dir;
@@ -31438,10 +31419,10 @@ async function finishDebugRun({
31438
31419
  const root = currentDebugSessionDir();
31439
31420
  if (!root) return;
31440
31421
  const flowSegments = run.flow.split("/");
31441
- const dir = join26(root, ...flowSegments);
31422
+ const dir = join25(root, ...flowSegments);
31442
31423
  await mkdir9(dir, { recursive: true });
31443
31424
  const filename = nextAttemptFilename(dir, run.menuOption);
31444
- await writeFile8(join26(dir, filename), content, { mode: 384 });
31425
+ await writeFile8(join25(dir, filename), content, { mode: 384 });
31445
31426
  }
31446
31427
  function nextAttemptFilename(dir, menuOption) {
31447
31428
  const today = datePrefix();
@@ -31492,11 +31473,9 @@ var init_debug_store = __esm({
31492
31473
  init_config();
31493
31474
  init_version();
31494
31475
  init_debug_mode_store();
31495
- init_debug_prune();
31496
- void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(async ([enabled, base]) => {
31497
- if (!base) return;
31498
- await readDebugModeSetting().then(({ retentionDays }) => pruneExpiredLogs(base, retentionDays)).catch(() => void 0);
31499
- if (enabled) await mkdir9(join26(startSession(base, { replace: false }), "debug"), { recursive: true });
31476
+ void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
31477
+ if (!enabled || !base) return void 0;
31478
+ return mkdir9(join25(startSession(base, { replace: false }), "debug"), { recursive: true });
31500
31479
  });
31501
31480
  process.once("uncaughtException", (err) => {
31502
31481
  void handleCrash().finally(() => {
@@ -31517,7 +31496,7 @@ var init_debug_store = __esm({
31517
31496
  });
31518
31497
 
31519
31498
  // packages/experience-design-system-cli/src/tui/help/file-locations.ts
31520
- import { join as join27, resolve as resolve27 } from "node:path";
31499
+ import { join as join26, resolve as resolve27 } from "node:path";
31521
31500
  function describeFileLocations({
31522
31501
  contentfulBaseDir,
31523
31502
  debugModeEnabled,
@@ -31526,14 +31505,14 @@ function describeFileLocations({
31526
31505
  if (!debugModeEnabled) {
31527
31506
  return {
31528
31507
  debugLogs: "none while Debug Mode is off",
31529
- importFiles: `${join27("<project>", ".contentful")}/ (tokens.json, components.json)`
31508
+ importFiles: `${join26("<project>", ".contentful")}/ (tokens.json, components.json)`
31530
31509
  };
31531
31510
  }
31532
31511
  const base = contentfulBaseDir ? resolve27(contentfulBaseDir) : "<project>";
31533
- const session = currentSessionDir2 ?? join27(base, ".contentful", "<date>-session-<n>");
31512
+ const session = currentSessionDir2 ?? join26(base, ".contentful", "<date>-session-<n>");
31534
31513
  return {
31535
- debugLogs: join27(session, "debug"),
31536
- importFiles: `${join27(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
31514
+ debugLogs: join26(session, "debug"),
31515
+ importFiles: `${join26(session, "dsi-import-<n>")}/ (tokens.json, components.json)`
31537
31516
  };
31538
31517
  }
31539
31518
  var init_file_locations = __esm({
@@ -32815,79 +32794,57 @@ var init_screen11 = __esm({
32815
32794
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
32816
32795
  import { useEffect as useEffect26, useState as useState35 } from "react";
32817
32796
  import { Box as Box50, Text as Text53, useInput as useInput16 } from "ink";
32818
- import { Fragment as Fragment21, jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
32797
+ import { jsx as jsx62, jsxs as jsxs51 } from "react/jsx-runtime";
32819
32798
  function DebugModeScreen({ onDone }) {
32820
- const [setting, setSetting] = useState35(null);
32821
- const [focus, setFocus] = useState35("enabled");
32799
+ const [loading, setLoading] = useState35(true);
32800
+ const [enabled, setEnabled] = useState35(true);
32822
32801
  useEffect26(() => {
32823
- readDebugModeSetting().then((loaded) => {
32824
- setSetting(loaded);
32802
+ readDebugModeSetting().then((setting) => {
32803
+ setEnabled(setting.enabled);
32804
+ setLoading(false);
32825
32805
  startDebugRun({
32826
32806
  flow: "settings/debug-mode",
32827
32807
  step: "01-debug-mode",
32828
32808
  menuOption: "Debug Mode",
32829
- inputs: { ...loaded }
32809
+ inputs: { enabled: setting.enabled }
32830
32810
  });
32831
32811
  });
32832
32812
  }, []);
32833
- const change = (patch) => {
32834
- if (!setting) return;
32835
- setSetting({ ...setting, ...patch });
32836
- void writeDebugModeSetting(patch);
32837
- };
32838
32813
  useInput16((input, key) => {
32839
- if (!setting) return;
32840
- if (key.upArrow || key.downArrow) {
32841
- setFocus((current) => ROWS[(ROWS.indexOf(current) + (key.downArrow ? 1 : ROWS.length - 1)) % ROWS.length]);
32842
- return;
32843
- }
32814
+ if (loading) return;
32844
32815
  if (key.return || input === " ") {
32845
- if (focus === "enabled") change({ enabled: !setting.enabled });
32846
- else change({ retentionDays: nextRetention(setting.retentionDays) });
32816
+ setEnabled((current) => {
32817
+ const next = !current;
32818
+ void writeDebugModeSetting({ enabled: next });
32819
+ return next;
32820
+ });
32847
32821
  return;
32848
32822
  }
32849
32823
  if (key.escape || input === "q") {
32850
- void finishDebugRun({ outputs: { ...setting }, status: "success", exitMethod: "saved" });
32824
+ void finishDebugRun({ outputs: { enabled }, status: "success", exitMethod: "saved" });
32851
32825
  onDone();
32852
32826
  }
32853
32827
  });
32854
- const marker = (row) => focus === row ? "\u276F" : " ";
32855
32828
  return /* @__PURE__ */ jsxs51(Box50, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
32856
32829
  /* @__PURE__ */ jsx62(Text53, { bold: true, children: "Settings \u203A Debug Mode" }),
32857
32830
  /* @__PURE__ */ jsx62(Text53, { children: " " }),
32858
- setting ? /* @__PURE__ */ jsxs51(Fragment21, { children: [
32859
- /* @__PURE__ */ jsxs51(Text53, { children: [
32860
- marker("enabled"),
32861
- " Debug logging:",
32862
- " ",
32863
- /* @__PURE__ */ jsx62(Text53, { bold: true, color: setting.enabled ? PALETTE.success : PALETTE.muted, children: setting.enabled ? "On" : "Off" })
32864
- ] }),
32865
- /* @__PURE__ */ jsxs51(Text53, { children: [
32866
- marker("retentionDays"),
32867
- " Delete logs after:",
32868
- " ",
32869
- /* @__PURE__ */ jsxs51(Text53, { bold: true, color: PALETTE.accent, children: [
32870
- setting.retentionDays,
32871
- " days"
32872
- ] })
32873
- ] }),
32874
- /* @__PURE__ */ jsx62(Text53, { children: " " }),
32875
- /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Older logs are deleted the next time the CLI starts." })
32876
- ] }) : /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Loading\u2026" }),
32831
+ loading ? /* @__PURE__ */ jsx62(Text53, { color: PALETTE.muted, children: "Loading\u2026" }) : /* @__PURE__ */ jsxs51(Text53, { children: [
32832
+ "Debug logging:",
32833
+ " ",
32834
+ /* @__PURE__ */ jsx62(Text53, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
32835
+ ] }),
32877
32836
  /* @__PURE__ */ jsx62(Text53, { children: " " }),
32878
32837
  /* @__PURE__ */ jsx62(
32879
32838
  ControlHints,
32880
32839
  {
32881
32840
  hints: [
32882
- { keys: "\u2191/\u2193", label: "move" },
32883
- { keys: "\u23CE/Space", label: "change" },
32841
+ { keys: "\u23CE/Space", label: "toggle" },
32884
32842
  { keys: "Esc/q", label: "back" }
32885
32843
  ]
32886
32844
  }
32887
32845
  )
32888
32846
  ] });
32889
32847
  }
32890
- var ROWS, nextRetention;
32891
32848
  var init_screen12 = __esm({
32892
32849
  "packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx"() {
32893
32850
  "use strict";
@@ -32895,8 +32852,6 @@ var init_screen12 = __esm({
32895
32852
  init_debug_mode_store();
32896
32853
  init_debug_store();
32897
32854
  init_control_hints();
32898
- ROWS = ["enabled", "retentionDays"];
32899
- nextRetention = (current) => RETENTION_CHOICES[(RETENTION_CHOICES.indexOf(current) + 1) % RETENTION_CHOICES.length];
32900
32855
  }
32901
32856
  });
32902
32857
 
@@ -32905,9 +32860,9 @@ var app_exports = {};
32905
32860
  __export(app_exports, {
32906
32861
  runApp: () => runApp
32907
32862
  });
32908
- import { join as join28 } from "node:path";
32863
+ import { join as join27 } from "node:path";
32909
32864
  import { useEffect as useEffect27, useState as useState36 } from "react";
32910
- import { Fragment as Fragment22, jsx as jsx63 } from "react/jsx-runtime";
32865
+ import { Fragment as Fragment21, jsx as jsx63 } from "react/jsx-runtime";
32911
32866
  function App({ importOptions, inkClear }) {
32912
32867
  const [screen, setScreen] = useState36("start");
32913
32868
  const [importExitCode, setImportExitCode] = useState36();
@@ -32956,7 +32911,7 @@ function App({ importOptions, inkClear }) {
32956
32911
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
32957
32912
  const state2 = await inspectTokens({
32958
32913
  rawTokensPath: tokens,
32959
- contentfulDir: join28(resolveUserPath(projectPath2), ".contentful"),
32914
+ contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
32960
32915
  cache: importOptions.cache
32961
32916
  });
32962
32917
  if (state2.kind === "cached") {
@@ -33076,7 +33031,7 @@ function App({ importOptions, inkClear }) {
33076
33031
  }
33077
33032
  );
33078
33033
  }
33079
- if (importDefaults === void 0) return /* @__PURE__ */ jsx63(Fragment22, {});
33034
+ if (importDefaults === void 0) return /* @__PURE__ */ jsx63(Fragment21, {});
33080
33035
  if (projectPath === void 0) {
33081
33036
  return /* @__PURE__ */ jsx63(WelcomeScreen, { onContinue: setProjectPath, onQuit: leaveImport, initialPath: importDefaults.componentDir });
33082
33037
  }
@@ -33115,7 +33070,7 @@ function App({ importOptions, inkClear }) {
33115
33070
  }
33116
33071
  );
33117
33072
  }
33118
- return /* @__PURE__ */ jsx63(Fragment22, {});
33073
+ return /* @__PURE__ */ jsx63(Fragment21, {});
33119
33074
  }
33120
33075
  if (scopeRun && scopeFlow) {
33121
33076
  if (scopeFlow.status === "failed") {
@@ -33152,7 +33107,7 @@ function App({ importOptions, inkClear }) {
33152
33107
  }
33153
33108
  );
33154
33109
  }
33155
- return /* @__PURE__ */ jsx63(Fragment22, {});
33110
+ return /* @__PURE__ */ jsx63(Fragment21, {});
33156
33111
  }
33157
33112
  if (pendingLaunch?.cached) {
33158
33113
  return /* @__PURE__ */ jsx63(
@@ -33227,7 +33182,7 @@ var init_app = __esm({
33227
33182
  // packages/experience-design-system-cli/program.ts
33228
33183
  init_src3();
33229
33184
  import { readFileSync as readFileSync9 } from "node:fs";
33230
- import { join as join29 } from "node:path";
33185
+ import { join as join28 } from "node:path";
33231
33186
  import { Command } from "commander";
33232
33187
 
33233
33188
  // packages/experience-design-system-cli/src/commands/import-options.ts
@@ -33293,7 +33248,7 @@ init_analytics_store();
33293
33248
  init_package_root();
33294
33249
  var pkg = JSON.parse(
33295
33250
  readFileSync9(
33296
- join29(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
33251
+ join28(findPackageRoot(import.meta.url, "@contentful/experience-design-system-cli"), "package.json"),
33297
33252
  "utf8"
33298
33253
  )
33299
33254
  );
@@ -33334,7 +33289,7 @@ init_config();
33334
33289
  init_package_root();
33335
33290
  import { existsSync as existsSync12 } from "node:fs";
33336
33291
  import { mkdir as mkdir10, readFile as readFile19, rename as rename3, rmdir, unlink } from "node:fs/promises";
33337
- import { dirname as dirname16, join as join30 } from "node:path";
33292
+ import { dirname as dirname16, join as join29 } from "node:path";
33338
33293
  var PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
33339
33294
  async function readJson(path5) {
33340
33295
  try {
@@ -33345,9 +33300,9 @@ async function readJson(path5) {
33345
33300
  }
33346
33301
  async function migrateOldConfig() {
33347
33302
  try {
33348
- const oldCredentials = join30(oldConfigDir2(), "credentials.json");
33349
- const oldRuns = join30(oldConfigDir2(), "runs.json");
33350
- const oldDebugMode = join30(
33303
+ const oldCredentials = join29(oldConfigDir2(), "credentials.json");
33304
+ const oldRuns = join29(oldConfigDir2(), "runs.json");
33305
+ const oldDebugMode = join29(
33351
33306
  findPackageRoot(import.meta.url, PACKAGE_NAME3),
33352
33307
  ".contentful",
33353
33308
  "config",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-e051d273.0",
3
+ "version": "2.37.1-dev-build-4e7e3ced.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,11 +1,5 @@
1
- /** How long a debug log is kept before the CLI deletes it. Only these values are offered. */
2
- export declare const RETENTION_CHOICES: readonly [30, 60, 90];
3
- type RetentionDays = (typeof RETENTION_CHOICES)[number];
4
1
  export type DebugModeSetting = {
5
2
  enabled: boolean;
6
- retentionDays: RetentionDays;
7
3
  };
8
4
  export declare function readDebugModeSetting(): Promise<DebugModeSetting>;
9
- /** Saves the given fields and keeps the others, so turning logging off does not forget the retention. */
10
- export declare function writeDebugModeSetting(change: Partial<DebugModeSetting>): Promise<void>;
11
- export {};
5
+ export declare function writeDebugModeSetting(setting: DebugModeSetting): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-e051d273.0",
3
+ "version": "2.37.1-dev-build-4e7e3ced.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,8 +45,8 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-e051d273.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-e051d273.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-4e7e3ced.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-4e7e3ced.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",
@@ -1,7 +0,0 @@
1
- /**
2
- * Deletes the debug logs under `<base>/.contentful` that are older than `retentionDays`. It only looks at `.md` files
3
- * inside the `debug` folder of a session folder, so nothing the import produced or the user put there is touched. A file
4
- * that cannot be read or deleted is skipped: this runs at startup and must never get in the user's way. Returns how many
5
- * logs it deleted.
6
- */
7
- export declare function pruneExpiredLogs(base: string, retentionDays: number, now?: number): Promise<number>;