@contentful/experience-design-system-cli 2.37.1-dev-build-5db7e407.0 → 2.37.1-dev-build-eed963c1.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((resolve27) => {
2124
+ return new Promise((resolve25) => {
2125
2125
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
2126
2126
  const child = spawn3(binary, args, {
2127
2127
  stdio: ["pipe", "pipe", "pipe"],
@@ -2170,7 +2170,7 @@ async function runAgent(options) {
2170
2170
  stderrLen: stderr.length,
2171
2171
  stderrTail: stderr.slice(-1e3)
2172
2172
  });
2173
- resolve27(result);
2173
+ resolve25(result);
2174
2174
  });
2175
2175
  });
2176
2176
  }
@@ -2192,7 +2192,7 @@ async function checkAgentAuth(agent) {
2192
2192
  return "not-found";
2193
2193
  if (agent !== "claude")
2194
2194
  return "ok";
2195
- return new Promise((resolve27) => {
2195
+ return new Promise((resolve25) => {
2196
2196
  const child = spawn4(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
2197
2197
  let stdout = "";
2198
2198
  let done = false;
@@ -2201,7 +2201,7 @@ async function checkAgentAuth(agent) {
2201
2201
  return;
2202
2202
  done = true;
2203
2203
  child.kill("SIGTERM");
2204
- resolve27("unauthenticated");
2204
+ resolve25("unauthenticated");
2205
2205
  }, 5e3);
2206
2206
  child.stdout?.on("data", (chunk) => {
2207
2207
  stdout += chunk.toString();
@@ -2212,14 +2212,14 @@ async function checkAgentAuth(agent) {
2212
2212
  done = true;
2213
2213
  clearTimeout(timer);
2214
2214
  if (code !== 0) {
2215
- resolve27("unauthenticated");
2215
+ resolve25("unauthenticated");
2216
2216
  return;
2217
2217
  }
2218
2218
  try {
2219
2219
  const status = JSON.parse(stdout);
2220
- resolve27(status.loggedIn ? "ok" : "unauthenticated");
2220
+ resolve25(status.loggedIn ? "ok" : "unauthenticated");
2221
2221
  } catch {
2222
- resolve27("unauthenticated");
2222
+ resolve25("unauthenticated");
2223
2223
  }
2224
2224
  });
2225
2225
  });
@@ -2229,9 +2229,9 @@ async function binaryIsOnPath(binary) {
2229
2229
  const fs = await import("node:fs/promises");
2230
2230
  return fs.access(binary).then(() => true, () => false);
2231
2231
  }
2232
- return new Promise((resolve27) => {
2232
+ return new Promise((resolve25) => {
2233
2233
  const child = spawn4(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
2234
- child.on("close", (code) => resolve27(code === 0));
2234
+ child.on("close", (code) => resolve25(code === 0));
2235
2235
  });
2236
2236
  }
2237
2237
  var init_check_agent_auth = __esm({
@@ -13144,11 +13144,11 @@ var init_load_and_validate_for_review = __esm({
13144
13144
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
13145
13145
  import { resolve as resolve15 } from "node:path";
13146
13146
  async function getRefineSessionPaths(sessionId, artifactsRoot) {
13147
- const sessionDir2 = resolve15(artifactsRoot, sessionId);
13147
+ const sessionDir = resolve15(artifactsRoot, sessionId);
13148
13148
  return {
13149
- sessionDir: sessionDir2,
13150
- eventsPath: resolve15(sessionDir2, "events.jsonl"),
13151
- statePath: resolve15(sessionDir2, "current-review-state.json")
13149
+ sessionDir,
13150
+ eventsPath: resolve15(sessionDir, "events.jsonl"),
13151
+ statePath: resolve15(sessionDir, "current-review-state.json")
13152
13152
  };
13153
13153
  }
13154
13154
  var init_review_session_paths = __esm({
@@ -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((resolve27) => setTimeout(resolve27, delayMs));
14904
+ return new Promise((resolve25) => setTimeout(resolve25, delayMs));
14905
14905
  }
14906
14906
  var MAX_RETRY_AFTER_MS;
14907
14907
  var init_http_utils = __esm({
@@ -15177,7 +15177,7 @@ var init_api_client = __esm({
15177
15177
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
15178
15178
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
15179
15179
  const jitter = Math.random() * baseDelay * 0.15;
15180
- await new Promise((resolve27) => setTimeout(resolve27, baseDelay + jitter));
15180
+ await new Promise((resolve25) => setTimeout(resolve25, baseDelay + jitter));
15181
15181
  }
15182
15182
  }
15183
15183
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -18734,7 +18734,7 @@ async function retryDatabaseWrite(operation, attempts = 8) {
18734
18734
  const message = error instanceof Error ? error.message : String(error);
18735
18735
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts)
18736
18736
  throw error;
18737
- await new Promise((resolve27) => setTimeout(resolve27, Math.min(250 * attempt, 2e3)));
18737
+ await new Promise((resolve25) => setTimeout(resolve25, Math.min(250 * attempt, 2e3)));
18738
18738
  }
18739
18739
  }
18740
18740
  }
@@ -20301,34 +20301,11 @@ var init_shared2 = __esm({
20301
20301
  });
20302
20302
 
20303
20303
  // packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
20304
- import { access as access5, readdir as readdir2, stat as stat4 } from "node:fs/promises";
20304
+ import { access as access5, stat as stat4 } from "node:fs/promises";
20305
20305
  import { join as join18 } from "node:path";
20306
- async function findLatestTokens(contentfulDir) {
20307
- const candidates = [join18(contentfulDir, "tokens.json")];
20308
- try {
20309
- for (const session of await readdir2(contentfulDir, { withFileTypes: true })) {
20310
- if (!session.isDirectory()) continue;
20311
- for (const run of await readdir2(join18(contentfulDir, session.name), { withFileTypes: true }).catch(() => [])) {
20312
- if (run.isDirectory() && /^dsi-import-\d+$/.test(run.name)) {
20313
- candidates.push(join18(contentfulDir, session.name, run.name, "tokens.json"));
20314
- }
20315
- }
20316
- }
20317
- } catch {
20318
- }
20319
- const found = [];
20320
- for (const path5 of candidates) {
20321
- try {
20322
- found.push({ path: path5, mtimeMs: (await stat4(path5)).mtimeMs });
20323
- } catch {
20324
- }
20325
- }
20326
- return found.sort((a, b) => b.mtimeMs - a.mtimeMs)[0]?.path ?? null;
20327
- }
20328
- async function inspectTokens({ rawTokensPath, contentfulDir, cache }) {
20306
+ async function inspectTokens({ rawTokensPath, outDir, cache }) {
20329
20307
  if (!cache) return { kind: "none" };
20330
- const tokensPath = await findLatestTokens(contentfulDir);
20331
- if (!tokensPath) return { kind: "none" };
20308
+ const tokensPath = join18(outDir, "tokens.json");
20332
20309
  try {
20333
20310
  await access5(tokensPath);
20334
20311
  } catch {
@@ -20543,12 +20520,13 @@ async function writeSettings2(settings) {
20543
20520
  async function updateSettings2(patch) {
20544
20521
  await writeSettings2({ ...await readSettings2(), ...patch });
20545
20522
  }
20546
- var configFilePath2, runsFilePath2, oldConfigDir2;
20523
+ var configFilePath2, runsFilePath2, debugSessionsDir2, oldConfigDir2;
20547
20524
  var init_config = __esm({
20548
20525
  "packages/experience-design-system-types/dist/src/config/index.js"() {
20549
20526
  "use strict";
20550
20527
  configFilePath2 = () => join19(configRoot2(), "config.json");
20551
20528
  runsFilePath2 = () => join19(configRoot2(), "state", "runs.json");
20529
+ debugSessionsDir2 = () => join19(configRoot2(), "debug", "sessions");
20552
20530
  oldConfigDir2 = () => join19(homedir3(), ".config", "experiences");
20553
20531
  }
20554
20532
  });
@@ -20676,7 +20654,7 @@ var init_selection2 = __esm({
20676
20654
  import { mkdir as mkdir7 } from "node:fs/promises";
20677
20655
  import { join as join21, resolve as resolve22 } from "node:path";
20678
20656
  async function runExtraction(input, onProgress, deps = realDeps) {
20679
- const outDir = input.outDir ?? join21(resolve22(input.projectPath), ".contentful");
20657
+ const outDir = join21(resolve22(input.projectPath), ".contentful");
20680
20658
  let progress = initialProgress({
20681
20659
  hasCredentials: input.credentials !== null,
20682
20660
  hasRawTokens: input.rawTokensPath !== "",
@@ -22101,7 +22079,8 @@ function GroupedSidebar(props) {
22101
22079
  dimPredicate,
22102
22080
  visibleRows: providedRows,
22103
22081
  graph,
22104
- filterVisibleKeys
22082
+ filterVisibleKeys,
22083
+ emptyMessage
22105
22084
  } = props;
22106
22085
  const allRows = providedRows ?? buildVisibleRows({
22107
22086
  items,
@@ -22118,6 +22097,10 @@ function GroupedSidebar(props) {
22118
22097
  const end = windowed ? start + (visibleCount ?? allRows.length) : allRows.length;
22119
22098
  const rows = windowed ? allRows.slice(start, end) : allRows;
22120
22099
  return /* @__PURE__ */ jsxs18(WindowedPanel, { width, height: props.height, title, focused, children: [
22100
+ allRows.length === 0 && emptyMessage !== void 0 && /* @__PURE__ */ jsxs18(Text19, { color: PALETTE2.warning, children: [
22101
+ " ",
22102
+ emptyMessage
22103
+ ] }),
22121
22104
  windowed && /* @__PURE__ */ jsx21(WindowIndicator, { direction: "up", count: start }),
22122
22105
  rows.map((row, i) => {
22123
22106
  const absoluteRowIdx = start + i;
@@ -22482,9 +22465,9 @@ function createSidebarViewsHelpSection(includeBreaking) {
22482
22465
  { keys: "L", label: "Flat view" },
22483
22466
  { keys: "i", label: "Focus lineage" }
22484
22467
  ];
22485
- if (includeBreaking) entries.push({ keys: "w", label: "Only breaking" });
22468
+ if (includeBreaking) entries.push({ keys: "w", label: "Show only components with breaking changes" });
22486
22469
  entries.push(
22487
- { keys: "o", label: "Only cycles" },
22470
+ { keys: "o", label: "Show only components in slot cycles" },
22488
22471
  { keys: "space", label: "Expand/collapse group" },
22489
22472
  { keys: "E / C", label: "Expand/collapse all" }
22490
22473
  );
@@ -23128,6 +23111,12 @@ function computeFilterKeys(input) {
23128
23111
  if (active.has("deleted")) for (const k of input.data.deleted ?? []) out.add(k);
23129
23112
  return out;
23130
23113
  }
23114
+ function describeEmptyFilter(input) {
23115
+ const names = [...input.filters].map((f) => FILTER_LABELS[f]);
23116
+ if (input.slotDependencies) names.push("slot dependencies");
23117
+ if (names.length === 0) return void 0;
23118
+ return `Nothing to show: no ${names.join(" or ")} in this import.`;
23119
+ }
23131
23120
  function intersectFilterKeys(a, b) {
23132
23121
  if (a === void 0) return b;
23133
23122
  if (b === void 0) return a;
@@ -23146,10 +23135,16 @@ function buildFlatDimPredicate(input) {
23146
23135
  return false;
23147
23136
  };
23148
23137
  }
23138
+ var FILTER_LABELS;
23149
23139
  var init_step_filters = __esm({
23150
23140
  "packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/step-filters.ts"() {
23151
23141
  "use strict";
23152
23142
  init_fuzzy_search();
23143
+ FILTER_LABELS = {
23144
+ broken: "components with breaking changes",
23145
+ cycles: "slot cycles",
23146
+ deleted: "removed components"
23147
+ };
23153
23148
  }
23154
23149
  });
23155
23150
 
@@ -23337,6 +23332,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
23337
23332
  }),
23338
23333
  [groupedItems, cycleParticipants, expandedGroups, columnOneView, graph, filterVisibleKeys]
23339
23334
  );
23335
+ const emptyMessage = visibleRows.length === 0 && filterVisibleKeys !== void 0 && !jumpFilterTarget ? describeEmptyFilter({ filters: activeFilters, slotDependencies: showDependencies }) : void 0;
23340
23336
  const total = visibleRows.length;
23341
23337
  const safeCursor = Math.min(nav.cursor, Math.max(0, total - 1));
23342
23338
  const currentRow = visibleRows[safeCursor];
@@ -23658,6 +23654,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
23658
23654
  expandedGroups,
23659
23655
  toggleExpanded,
23660
23656
  visibleRows,
23657
+ emptyMessage,
23661
23658
  safeCursor,
23662
23659
  scrollOffset: nav.scrollOffset,
23663
23660
  selectionStateByKey,
@@ -23767,6 +23764,7 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
23767
23764
  aiFlaggedByKey: gate.aiFlaggedByKey,
23768
23765
  dimPredicate: gate.dimPredicate,
23769
23766
  visibleRows: gate.visibleRows,
23767
+ emptyMessage: gate.emptyMessage,
23770
23768
  viewMode: gate.columnOneView,
23771
23769
  graph: graph.nodes
23772
23770
  }
@@ -23849,7 +23847,7 @@ var init_screen7 = __esm({
23849
23847
  title: "Panels",
23850
23848
  entries: [
23851
23849
  { keys: "c", label: "Cycle list" },
23852
- { keys: "d", label: "Show slot dependencies in main list" },
23850
+ { keys: "d", label: "Show slot dependenciess" },
23853
23851
  { keys: "x", label: "Review flags" }
23854
23852
  ]
23855
23853
  },
@@ -29678,18 +29676,18 @@ function GenerateReviewStepView({
29678
29676
  }
29679
29677
  return;
29680
29678
  }
29681
- if (input === "c" && !key.ctrl && !key.meta && cycleRows.length > 0) {
29679
+ if (input === "c" && !reviewEditor.textEntryActive && !key.ctrl && !key.meta && cycleRows.length > 0) {
29682
29680
  cyclePanel.open();
29683
29681
  setCyclePanelScroll(0);
29684
29682
  setCyclesCursor(0);
29685
29683
  return;
29686
29684
  }
29687
- if (input === "b" && sidebarFocused && breakingChanges.length > 0) {
29685
+ if (input === "b" && !reviewEditor.textEntryActive && sidebarFocused && breakingChanges.length > 0) {
29688
29686
  breakingPanel.open();
29689
29687
  setBreakingCursor(0);
29690
29688
  return;
29691
29689
  }
29692
- if (input === "o" || input === "w") {
29690
+ if (!reviewEditor.textEntryActive && (input === "o" || input === "w")) {
29693
29691
  const category = input === "o" ? "cycles" : "broken";
29694
29692
  setActiveFilters((prev) => {
29695
29693
  const next = new Set(prev);
@@ -30075,6 +30073,7 @@ function GenerateReviewStepView({
30075
30073
  visibleCount,
30076
30074
  dimPredicate,
30077
30075
  visibleRows: visibleRowsMemo,
30076
+ emptyMessage: visibleRowsMemo.length === 0 && filterVisibleKeys !== void 0 && !jumpFilterTarget ? describeEmptyFilter({ filters: activeFilters }) : void 0,
30078
30077
  viewMode: columnOneView,
30079
30078
  graph: sidebarGraph
30080
30079
  }
@@ -30215,12 +30214,12 @@ var init_generate_review_step = __esm({
30215
30214
  title: "Panels",
30216
30215
  entries: [
30217
30216
  { keys: "c", label: "Cycle list" },
30218
- { keys: "b", label: "Breaking changes" },
30219
- { keys: "w", label: "Only breaking" },
30220
- { keys: "o", label: "Only cycles" },
30217
+ { keys: "b", label: "Show breaking changes" },
30218
+ { keys: "w", label: "Filter components with breaking changes" },
30219
+ { keys: "o", label: "Filter components in slot cycles" },
30221
30220
  { keys: "p", label: "Prop rationale" },
30222
30221
  { keys: "P", label: "Component rationale" },
30223
- { keys: "s", label: "Source" },
30222
+ { keys: "s", label: "Source code snippet" },
30224
30223
  { keys: "J", label: "Toggle JSON" },
30225
30224
  { keys: "t", label: "Token review" }
30226
30225
  ]
@@ -31796,7 +31795,7 @@ var init_save = __esm({
31796
31795
  writeFile: (path5, contents) => writeFile7(path5, contents),
31797
31796
  appendRun,
31798
31797
  buildSourceFingerprint,
31799
- sleep: (ms) => new Promise((resolve27) => setTimeout(resolve27, ms)),
31798
+ sleep: (ms) => new Promise((resolve25) => setTimeout(resolve25, ms)),
31800
31799
  warn: (message) => process.stderr.write(message)
31801
31800
  });
31802
31801
  }
@@ -31818,7 +31817,7 @@ var init_types9 = __esm({
31818
31817
  import { appendFileSync, writeFileSync } from "node:fs";
31819
31818
  import { mkdir as mkdir8 } from "node:fs/promises";
31820
31819
  import { tmpdir } from "node:os";
31821
- import { join as join25, resolve as resolve25 } from "node:path";
31820
+ import { join as join25 } from "node:path";
31822
31821
  function appendWizardLog(entry) {
31823
31822
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
31824
31823
  }
@@ -32066,7 +32065,7 @@ function createFlowController(start, deps) {
32066
32065
  },
32067
32066
  async submitPath(submitted) {
32068
32067
  await deps.mkdir(submitted);
32069
- if (resolve25(submitted) !== resolve25(state.outDir) && await deps.detectSaveConflict(submitted)) {
32068
+ if (await deps.detectSaveConflict(submitted)) {
32070
32069
  const subdir = deps.buildTimestampedSubdir(submitted);
32071
32070
  await deps.mkdir(subdir);
32072
32071
  await proceedToWrite(subdir);
@@ -32154,18 +32153,9 @@ var init_debug_mode_store = __esm({
32154
32153
  });
32155
32154
 
32156
32155
  // packages/experience-design-system-cli/src/tui/debug-store.ts
32157
- var debug_store_exports = {};
32158
- __export(debug_store_exports, {
32159
- currentDebugSessionDir: () => currentDebugSessionDir,
32160
- currentSessionDir: () => currentSessionDir,
32161
- finishDebugRun: () => finishDebugRun,
32162
- startDebugRun: () => startDebugRun,
32163
- startDebugSessionIn: () => startDebugSessionIn,
32164
- startImportRun: () => startImportRun
32165
- });
32166
32156
  import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
32167
32157
  import { existsSync as existsSync11, readdirSync as readdirSync4 } from "node:fs";
32168
- import { join as join26, resolve as resolve26 } from "node:path";
32158
+ import { join as join26 } from "node:path";
32169
32159
  function generateRunId() {
32170
32160
  const now = /* @__PURE__ */ new Date();
32171
32161
  const pad = (n) => String(n).padStart(2, "0");
@@ -32178,17 +32168,10 @@ function datePrefix(now = /* @__PURE__ */ new Date()) {
32178
32168
  function slugify(value) {
32179
32169
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
32180
32170
  }
32181
- async function readBaseDir() {
32182
- try {
32183
- const dir = (await readSettings2())["contentfulBaseDir"];
32184
- return typeof dir === "string" && dir !== "" ? resolve26(dir) : void 0;
32185
- } catch {
32186
- return void 0;
32187
- }
32188
- }
32189
- function nextSessionId(contentfulDir) {
32171
+ function generateSessionId3() {
32190
32172
  const today = datePrefix();
32191
- const existing = existsSync11(contentfulDir) ? readdirSync4(contentfulDir) : [];
32173
+ const root = debugSessionsDir2();
32174
+ const existing = existsSync11(root) ? readdirSync4(root) : [];
32192
32175
  const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
32193
32176
  const maxSeq = existing.reduce((max, entry) => {
32194
32177
  const match2 = seqPattern.exec(entry);
@@ -32196,38 +32179,11 @@ function nextSessionId(contentfulDir) {
32196
32179
  }, 0);
32197
32180
  return `${today}-session-${maxSeq + 1}`;
32198
32181
  }
32199
- function startSession(base, { replace }) {
32200
- const contentfulDir = join26(base, ".contentful");
32201
- if (replace || !sessionDir) sessionDir = join26(contentfulDir, nextSessionId(contentfulDir));
32202
- return sessionDir;
32182
+ function sessionDebugDir() {
32183
+ return join26(debugSessionsDir2(), SESSION_ID);
32203
32184
  }
32204
32185
  function currentDebugSessionDir() {
32205
- return sessionDir && join26(sessionDir, "debug");
32206
- }
32207
- function currentSessionDir() {
32208
- return sessionDir;
32209
- }
32210
- async function startDebugSessionIn(base, { replace = false } = {}) {
32211
- try {
32212
- if (!await isDebugModeEnabled()) return;
32213
- await mkdir9(join26(startSession(resolve26(base), { replace }), "debug"), { recursive: true });
32214
- } catch {
32215
- }
32216
- }
32217
- function nextImportRunDir(session) {
32218
- const existing = existsSync11(session) ? readdirSync4(session) : [];
32219
- const maxRun = existing.reduce((max, entry) => {
32220
- const match2 = /^dsi-import-(\d+)$/.exec(entry);
32221
- return match2 ? Math.max(max, Number(match2[1])) : max;
32222
- }, 0);
32223
- return join26(session, `dsi-import-${maxRun + 1}`);
32224
- }
32225
- async function startImportRun(projectPath) {
32226
- await startDebugSessionIn(projectPath);
32227
- if (!sessionDir) return join26(resolve26(projectPath), ".contentful");
32228
- const dir = nextImportRunDir(sessionDir);
32229
- await mkdir9(dir, { recursive: true });
32230
- return dir;
32186
+ return sessionDebugDir();
32231
32187
  }
32232
32188
  async function isDebugModeEnabled() {
32233
32189
  try {
@@ -32268,10 +32224,8 @@ async function finishDebugRun({
32268
32224
  pendingRun = void 0;
32269
32225
  const durationMs = Date.now() - run.startedAt;
32270
32226
  const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
32271
- const root = currentDebugSessionDir();
32272
- if (!root) return;
32273
32227
  const flowSegments = run.flow.split("/");
32274
- const dir = join26(root, ...flowSegments);
32228
+ const dir = join26(sessionDebugDir(), ...flowSegments);
32275
32229
  await mkdir9(dir, { recursive: true });
32276
32230
  const filename = nextAttemptFilename(dir, run.menuOption);
32277
32231
  await writeFile8(join26(dir, filename), content, { mode: 384 });
@@ -32318,16 +32272,17 @@ ${JSON.stringify(finish.outputs, null, 2)}
32318
32272
  function handleCrash() {
32319
32273
  return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
32320
32274
  }
32321
- var pendingRun, sessionDir;
32275
+ var pendingRun, SESSION_ID;
32322
32276
  var init_debug_store = __esm({
32323
32277
  "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
32324
32278
  "use strict";
32325
32279
  init_config();
32326
32280
  init_version();
32327
32281
  init_debug_mode_store();
32328
- void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(([enabled, base]) => {
32329
- if (!enabled || !base) return void 0;
32330
- return mkdir9(join26(startSession(base, { replace: false }), "debug"), { recursive: true });
32282
+ SESSION_ID = generateSessionId3();
32283
+ void isDebugModeEnabled().then((enabled) => {
32284
+ if (!enabled) return void 0;
32285
+ return mkdir9(sessionDebugDir(), { recursive: true });
32331
32286
  });
32332
32287
  process.once("uncaughtException", (err) => {
32333
32288
  void handleCrash().finally(() => {
@@ -32353,7 +32308,8 @@ async function readHelpInfo() {
32353
32308
  return {
32354
32309
  storage: [
32355
32310
  { label: "Config folder", value: configRoot2() },
32356
- { label: "Settings file", value: configFilePath2() }
32311
+ { label: "Settings file", value: configFilePath2() },
32312
+ { label: "Debug logs", value: debugSessionsDir2() }
32357
32313
  ],
32358
32314
  troubleshooting: [
32359
32315
  { label: "CLI version", value: readPackageVersion() },
@@ -32362,7 +32318,7 @@ async function readHelpInfo() {
32362
32318
  { label: "Debug Mode", value: debugMode.enabled ? "on" : "off" },
32363
32319
  {
32364
32320
  label: "This session",
32365
- value: !debugMode.enabled ? "no logs written while Debug Mode is off" : currentDebugSessionDir() ?? "not started: set the Root Project Directory in Settings, or start an import"
32321
+ value: debugMode.enabled ? currentDebugSessionDir() : "no logs written while Debug Mode is off"
32366
32322
  }
32367
32323
  ]
32368
32324
  };
@@ -32519,8 +32475,7 @@ async function readCredentials() {
32519
32475
  cmaToken: store.cmaToken || "",
32520
32476
  host: store.host || "",
32521
32477
  defaultComponentDir: store.defaultComponentDir || "",
32522
- defaultTokenFile: store.defaultTokenFile || "",
32523
- contentfulBaseDir: store.contentfulBaseDir || ""
32478
+ defaultTokenFile: store.defaultTokenFile || ""
32524
32479
  };
32525
32480
  }
32526
32481
  async function writeCredentials(config) {
@@ -32553,8 +32508,7 @@ function debugFields(config) {
32553
32508
  cma_token: config?.cmaToken ?? "",
32554
32509
  host: config?.host ?? "",
32555
32510
  default_component_dir: config?.defaultComponentDir ?? "",
32556
- default_token_file: config?.defaultTokenFile ?? "",
32557
- contentful_base_dir: config?.contentfulBaseDir ?? ""
32511
+ default_token_file: config?.defaultTokenFile ?? ""
32558
32512
  };
32559
32513
  }
32560
32514
  function ConfigurationScreen({ onDone }) {
@@ -32592,7 +32546,6 @@ function ConfigurationScreen({ onDone }) {
32592
32546
  setNotice(null);
32593
32547
  writeCredentials(config).then(() => {
32594
32548
  setLastSaved(config);
32595
- if (config.contentfulBaseDir) void startDebugSessionIn(config.contentfulBaseDir, { replace: true });
32596
32549
  setNotice({ kind: "success", text: "Configuration saved" });
32597
32550
  setStage("form");
32598
32551
  }).catch((err) => {
@@ -32658,7 +32611,10 @@ function ConfigurationScreen({ onDone }) {
32658
32611
  const display = field === "cmaToken" ? "\u2022".repeat(value.length) : value;
32659
32612
  return /* @__PURE__ */ jsxs45(Box44, { gap: 1, children: [
32660
32613
  /* @__PURE__ */ jsx55(Text46, { color: isActive ? PALETTE.accent : void 0, children: isActive ? "\u276F" : " " }),
32661
- /* @__PURE__ */ jsx55(Box44, { width: LABEL_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx55(Text46, { bold: isActive, color: isActive ? PALETTE.accent : PALETTE.muted, children: FIELD_LABELS[field] }) }),
32614
+ /* @__PURE__ */ jsxs45(Text46, { bold: isActive, children: [
32615
+ FIELD_LABELS[field],
32616
+ ":"
32617
+ ] }),
32662
32618
  isActive && editing ? /* @__PURE__ */ jsx55(
32663
32619
  TextInput4,
32664
32620
  {
@@ -32667,8 +32623,7 @@ function ConfigurationScreen({ onDone }) {
32667
32623
  onSubmit: () => setEditing(false),
32668
32624
  mask: field === "cmaToken" ? "\u2022" : void 0
32669
32625
  }
32670
- ) : /* @__PURE__ */ jsx55(Text46, { bold: !!display, children: display || (FIELD_HINTS[field] ? "" : /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" })) }),
32671
- FIELD_HINTS[field] && /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: FIELD_HINTS[field] })
32626
+ ) : /* @__PURE__ */ jsx55(Text46, { children: display || /* @__PURE__ */ jsx55(Text46, { color: PALETTE.muted, children: "(empty)" }) })
32672
32627
  ] }, field);
32673
32628
  }) }),
32674
32629
  notice && /* @__PURE__ */ jsxs45(Fragment17, { children: [
@@ -32699,7 +32654,7 @@ function ConfigurationScreen({ onDone }) {
32699
32654
  )
32700
32655
  ] });
32701
32656
  }
32702
- var FIELD_ORDER, FIELD_LABELS, FIELD_HINTS, LABEL_WIDTH;
32657
+ var FIELD_ORDER, FIELD_LABELS;
32703
32658
  var init_ContentfulConfigScreen = __esm({
32704
32659
  "packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx"() {
32705
32660
  "use strict";
@@ -32713,22 +32668,16 @@ var init_ContentfulConfigScreen = __esm({
32713
32668
  "cmaToken",
32714
32669
  "host",
32715
32670
  "defaultComponentDir",
32716
- "defaultTokenFile",
32717
- "contentfulBaseDir"
32671
+ "defaultTokenFile"
32718
32672
  ];
32719
32673
  FIELD_LABELS = {
32720
32674
  spaceId: "Space ID",
32721
32675
  environmentId: "Environment ID",
32722
32676
  cmaToken: "CMA Token",
32723
- host: "API Host",
32724
- defaultComponentDir: "Default component directory",
32725
- defaultTokenFile: "Default token file",
32726
- contentfulBaseDir: "Root Project Directory"
32727
- };
32728
- FIELD_HINTS = {
32729
- contentfulBaseDir: "(where .contentful goes)"
32677
+ host: "API Host (optional)",
32678
+ defaultComponentDir: "Default component directory (optional)",
32679
+ defaultTokenFile: "Default token file (optional)"
32730
32680
  };
32731
- LABEL_WIDTH = Math.max(...Object.values(FIELD_LABELS).map((label) => label.length));
32732
32681
  }
32733
32682
  });
32734
32683
 
@@ -33022,7 +32971,7 @@ function App({ importOptions, inkClear }) {
33022
32971
  const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
33023
32972
  const state = await inspectTokens({
33024
32973
  rawTokensPath: tokens,
33025
- contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
32974
+ outDir: join27(resolveUserPath(projectPath2), ".contentful"),
33026
32975
  cache: importOptions.cache
33027
32976
  });
33028
32977
  if (state.kind === "cached") {
@@ -33043,7 +32992,6 @@ function App({ importOptions, inkClear }) {
33043
32992
  const settings = await readSettings2();
33044
32993
  const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
33045
32994
  const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
33046
- const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
33047
32995
  setExtractionRun({
33048
32996
  ...generatePromptPath ? { generatePromptPath } : {},
33049
32997
  // the later steps get the same agent, so they use what the stage used
@@ -33052,7 +33000,6 @@ function App({ importOptions, inkClear }) {
33052
33000
  tokenStrategy,
33053
33001
  input: {
33054
33002
  projectPath: resolveUserPath(launch.projectPath ?? ""),
33055
- outDir,
33056
33003
  filePaths: launch.filePaths ?? [],
33057
33004
  rawTokensPath: launch.tokens ?? "",
33058
33005
  tokenStrategy,
@@ -33399,14 +33346,14 @@ function runDevWatch(args) {
33399
33346
  process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
33400
33347
  return Promise.resolve(1);
33401
33348
  }
33402
- return new Promise((resolve27) => {
33349
+ return new Promise((resolve25) => {
33403
33350
  const child = spawn2(process.execPath, [script, ...args], { stdio: "inherit" });
33404
33351
  process.on("SIGINT", () => void 0);
33405
- child.on("exit", (code) => resolve27(code ?? 0));
33352
+ child.on("exit", (code) => resolve25(code ?? 0));
33406
33353
  child.on("error", (err) => {
33407
33354
  process.stderr.write(`${err.message}
33408
33355
  `);
33409
- resolve27(1);
33356
+ resolve25(1);
33410
33357
  });
33411
33358
  });
33412
33359
  }
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-5db7e407.0",
3
+ "version": "2.37.1-dev-build-eed963c1.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,23 +1,6 @@
1
1
  type Status = 'success' | 'error';
2
2
  type ExitMethod = 'saved' | 'discarded' | 'crashed';
3
- export declare function currentDebugSessionDir(): string | undefined;
4
- /** This terminal session's folder, `<base>/.contentful/<session>/`, or undefined until it is known. */
5
- export declare function currentSessionDir(): string | undefined;
6
- /**
7
- * Starts this terminal session's folder in `base`. The base directory setting being saved passes `replace` so the new
8
- * location wins; the import passes nothing and only starts a session when none exists yet. Fail-open like the rest of
9
- * the logger.
10
- */
11
- export declare function startDebugSessionIn(base: string, { replace }?: {
12
- replace?: boolean | undefined;
13
- }): Promise<void>;
14
- /**
15
- * Where this import run writes everything it produces (tokens.json, .existing-entities.json, components.json): a new
16
- * `dsi-import-N` folder in this session's folder, next to the debug logs. The session is started here, and waited for,
17
- * so the answer does not depend on how quickly the boot-time start finished. Without a session (Debug Mode off, or a
18
- * folder that cannot be created) the files stay in `<project>/.contentful`, as before.
19
- */
20
- export declare function startImportRun(projectPath: string): Promise<string>;
3
+ export declare function currentDebugSessionDir(): string;
21
4
  export declare function startDebugRun({ flow, step, menuOption, inputs, }: {
22
5
  flow: string;
23
6
  step: string;
@@ -8,11 +8,10 @@ export type TokensState = {
8
8
  };
9
9
  interface InspectInput {
10
10
  rawTokensPath: string;
11
- /** The `.contentful` folder: the sessions' `dsi-import` folders sit inside it, and an older `tokens.json` may sit in it. */
12
- contentfulDir: string;
11
+ outDir: string;
13
12
  cache: boolean;
14
13
  }
15
- export declare function inspectTokens({ rawTokensPath, contentfulDir, cache }: InspectInput): Promise<TokensState>;
14
+ export declare function inspectTokens({ rawTokensPath, outDir, cache }: InspectInput): Promise<TokensState>;
16
15
  export declare function gateText({ tokensPath, sourceChanged }: {
17
16
  tokensPath: string;
18
17
  sourceChanged: boolean;
@@ -2,8 +2,6 @@ import type { ExtractionHandoff, ImportHandoff } from '@contentful/experience-de
2
2
  export type TokenStrategy = ImportHandoff['tokens']['strategy'];
3
3
  export interface ExtractionInput {
4
4
  projectPath: string;
5
- /** Where the stage writes tokens.json and the other files. Defaults to `<projectPath>/.contentful`. */
6
- outDir?: string;
7
5
  /** Absolute source files from the path-validation step (collectFiles output). */
8
6
  filePaths: string[];
9
7
  /** Raw tokens file the user pointed at (always set: v2 asks for one). */
@@ -33,6 +33,7 @@ export interface GroupedSidebarProps {
33
33
  visibleRows?: VisibleRow[];
34
34
  graph: ComponentGraphNode[];
35
35
  filterVisibleKeys?: Set<string>;
36
+ emptyMessage?: string;
36
37
  }
37
38
  type RowKind = 'cycle' | 'empty' | 'group-root' | 'group-child' | 'standalone' | 'flat' | 'flat-header';
38
39
  export interface VisibleRow {