@contentful/experience-design-system-cli 2.39.1-dev-build-66a06016.0 → 2.39.1-dev-build-6e58be6f.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
@@ -73,359 +73,6 @@ var init_version = __esm({
73
73
  }
74
74
  });
75
75
 
76
- // packages/experience-design-system-types/dist/src/config/index.js
77
- import { randomBytes } from "node:crypto";
78
- import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
79
- import { homedir } from "node:os";
80
- import { dirname as dirname2, join as join3 } from "node:path";
81
- function configRoot() {
82
- return process.env["EDS_HOME"] || join3(homedir(), ".contentful", "experience-design-system-cli");
83
- }
84
- async function readSettings() {
85
- try {
86
- return JSON.parse(await readFile(configFilePath(), "utf8"));
87
- } catch {
88
- return {};
89
- }
90
- }
91
- async function writeSettings(settings) {
92
- const path5 = configFilePath();
93
- await mkdir(dirname2(path5), { recursive: true });
94
- const tmp = `${path5}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
95
- await writeFile(tmp, `${JSON.stringify(settings, null, 2)}
96
- `, { mode: 384 });
97
- await rename(tmp, path5);
98
- }
99
- async function updateSettings(patch) {
100
- await writeSettings({ ...await readSettings(), ...patch });
101
- }
102
- var configFilePath;
103
- var init_config = __esm({
104
- "packages/experience-design-system-types/dist/src/config/index.js"() {
105
- "use strict";
106
- configFilePath = () => join3(configRoot(), "config.json");
107
- }
108
- });
109
-
110
- // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
111
- function toRetentionDays(value) {
112
- return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
113
- }
114
- async function readDebugModeSetting() {
115
- const { debugMode } = await readSettings();
116
- const saved = debugMode ?? {};
117
- return {
118
- enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
119
- retentionDays: toRetentionDays(saved.retentionDays)
120
- };
121
- }
122
- async function writeDebugModeSetting(change) {
123
- await updateSettings({ debugMode: { ...await readDebugModeSetting(), ...change } });
124
- }
125
- var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
126
- var init_debug_mode_store = __esm({
127
- "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
128
- "use strict";
129
- init_config();
130
- RETENTION_CHOICES = [7, 14, 30];
131
- DEFAULT_RETENTION_DAYS = 30;
132
- }
133
- });
134
-
135
- // packages/experience-design-system-cli/src/tui/debug-prune.ts
136
- import { readdir, rm, rmdir, stat } from "node:fs/promises";
137
- import { dirname as dirname3, join as join4 } from "node:path";
138
- async function logFilesIn(dir) {
139
- const entries = await readdir(dir, { withFileTypes: true });
140
- const nested = await Promise.all(
141
- entries.map(async (entry) => {
142
- const path5 = join4(dir, entry.name);
143
- if (entry.isDirectory()) return logFilesIn(path5);
144
- return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
145
- })
146
- );
147
- return nested.flat();
148
- }
149
- async function removeEmptyFolders(from, stop) {
150
- let dir = from;
151
- let removed = 0;
152
- for (; ; ) {
153
- try {
154
- await rmdir(dir);
155
- } catch {
156
- return removed;
157
- }
158
- removed += 1;
159
- if (dir === stop) return removed;
160
- dir = dirname3(dir);
161
- }
162
- }
163
- async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
164
- const cutoff = now - retentionDays * DAY_MS;
165
- const contentfulDir = join4(base, ".contentful");
166
- const result = { logs: 0, folders: 0 };
167
- try {
168
- const sessions = (await readdir(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
169
- for (const session of sessions) {
170
- const files = await logFilesIn(join4(contentfulDir, session, "debug")).catch(() => []);
171
- for (const file of files) {
172
- try {
173
- if ((await stat(file)).mtimeMs >= cutoff) continue;
174
- await rm(file);
175
- result.logs += 1;
176
- result.folders += await removeEmptyFolders(dirname3(file), join4(contentfulDir, session));
177
- } catch {
178
- }
179
- }
180
- }
181
- } catch {
182
- }
183
- return result;
184
- }
185
- var DAY_MS, SESSION_FOLDER;
186
- var init_debug_prune = __esm({
187
- "packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
188
- "use strict";
189
- DAY_MS = 24 * 60 * 60 * 1e3;
190
- SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
191
- }
192
- });
193
-
194
- // packages/experience-design-system-cli/src/tui/debug-store.ts
195
- var debug_store_exports = {};
196
- __export(debug_store_exports, {
197
- currentDebugSessionDir: () => currentDebugSessionDir,
198
- currentSessionDir: () => currentSessionDir,
199
- finishDebugRun: () => finishDebugRun,
200
- startDebugRun: () => startDebugRun,
201
- startDebugSessionIn: () => startDebugSessionIn,
202
- startImportRun: () => startImportRun
203
- });
204
- import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
205
- import { existsSync as existsSync2, readdirSync } from "node:fs";
206
- import { join as join5, resolve } from "node:path";
207
- function generateRunId() {
208
- const now = /* @__PURE__ */ new Date();
209
- const pad = (n) => String(n).padStart(2, "0");
210
- return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
211
- }
212
- function datePrefix(now = /* @__PURE__ */ new Date()) {
213
- const pad = (n) => String(n).padStart(2, "0");
214
- return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
215
- }
216
- function slugify(value) {
217
- return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
218
- }
219
- async function readBaseDir() {
220
- try {
221
- const dir = (await readSettings())["contentfulBaseDir"];
222
- return typeof dir === "string" && dir !== "" ? resolve(dir) : void 0;
223
- } catch {
224
- return void 0;
225
- }
226
- }
227
- function nextSessionId(contentfulDir) {
228
- const today = datePrefix();
229
- const existing = existsSync2(contentfulDir) ? readdirSync(contentfulDir) : [];
230
- const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
231
- const maxSeq = existing.reduce((max, entry) => {
232
- const match2 = seqPattern.exec(entry);
233
- return match2 ? Math.max(max, Number(match2[1])) : max;
234
- }, 0);
235
- return `${today}-session-${maxSeq + 1}`;
236
- }
237
- function startSession(base, { replace }) {
238
- const contentfulDir = join5(base, ".contentful");
239
- if (replace || !sessionDir) sessionDir = join5(contentfulDir, nextSessionId(contentfulDir));
240
- return sessionDir;
241
- }
242
- function currentDebugSessionDir() {
243
- return sessionDir && join5(sessionDir, "debug");
244
- }
245
- function currentSessionDir() {
246
- return sessionDir;
247
- }
248
- async function startDebugSessionIn(base, { replace = false } = {}) {
249
- try {
250
- if (!await isDebugModeEnabled()) return;
251
- await mkdir2(join5(startSession(resolve(base), { replace }), "debug"), { recursive: true });
252
- await writeWaitingLogs();
253
- } catch {
254
- }
255
- }
256
- function nextImportRunDir(session) {
257
- const existing = existsSync2(session) ? readdirSync(session) : [];
258
- const maxRun = existing.reduce((max, entry) => {
259
- const match2 = /^dsi-import-(\d+)$/.exec(entry);
260
- return match2 ? Math.max(max, Number(match2[1])) : max;
261
- }, 0);
262
- return join5(session, `dsi-import-${maxRun + 1}`);
263
- }
264
- async function startImportRun(projectPath) {
265
- await startDebugSessionIn(projectPath);
266
- if (!sessionDir) return join5(resolve(projectPath), ".contentful");
267
- const dir = nextImportRunDir(sessionDir);
268
- await mkdir2(dir, { recursive: true });
269
- return dir;
270
- }
271
- async function isDebugModeEnabled() {
272
- try {
273
- return (await readDebugModeSetting()).enabled;
274
- } catch {
275
- return true;
276
- }
277
- }
278
- function redact(value) {
279
- const clone = { ...value };
280
- if ("cma_token" in clone) {
281
- const raw = clone.cma_token;
282
- clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
283
- }
284
- return clone;
285
- }
286
- function startDebugRun({
287
- flow,
288
- step,
289
- menuOption,
290
- inputs
291
- }) {
292
- const runId = generateRunId();
293
- const startedAt = Date.now();
294
- const redactedInputs = redact(inputs);
295
- isDebugModeEnabled().then((enabled) => {
296
- if (!enabled) return;
297
- pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
298
- });
299
- }
300
- async function finishDebugRun({
301
- outputs,
302
- status,
303
- exitMethod
304
- }) {
305
- const run = pendingRun;
306
- if (!run) return;
307
- pendingRun = void 0;
308
- const durationMs = Date.now() - run.startedAt;
309
- const log = {
310
- flow: run.flow,
311
- menuOption: run.menuOption,
312
- content: renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs })
313
- };
314
- const root = currentDebugSessionDir();
315
- if (!root) {
316
- if (waiting.length < WAITING_LIMIT) waiting.push(log);
317
- return;
318
- }
319
- await writeLog(root, log);
320
- }
321
- async function writeLog(root, log) {
322
- const dir = join5(root, ...log.flow.split("/"));
323
- await mkdir2(dir, { recursive: true });
324
- const filename = nextAttemptFilename(dir, log.menuOption);
325
- await writeFile2(join5(dir, filename), log.content, { mode: 384 });
326
- }
327
- async function writeWaitingLogs() {
328
- const root = currentDebugSessionDir();
329
- if (!root) return;
330
- for (const log of waiting.splice(0)) {
331
- try {
332
- await writeLog(root, log);
333
- } catch {
334
- }
335
- }
336
- }
337
- function nextAttemptFilename(dir, menuOption) {
338
- const today = datePrefix();
339
- const optionSlug = slugify(menuOption);
340
- const existing = existsSync2(dir) ? readdirSync(dir) : [];
341
- const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
342
- const maxAttempt = existing.reduce((max, entry) => {
343
- const match2 = attemptPattern.exec(entry);
344
- return match2 ? Math.max(max, Number(match2[1])) : max;
345
- }, 0);
346
- return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
347
- }
348
- function renderMarkdown(run, finish) {
349
- const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
350
- const stepLabel = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
351
- const flowSlug = run.flow.split("/").join("-");
352
- return `# Debug Log
353
-
354
- - Run ID: ${run.runId}
355
- - Flow: ${flowSlug}
356
- - Step: ${stepLabel}
357
- - Menu option: ${run.menuOption}
358
- - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
359
- - CLI version: ${readPackageVersion()}
360
- - Platform: ${process.platform} / Node ${process.version}
361
- - Duration on screen: ${finish.durationMs}ms
362
- - Status: ${finish.status}
363
- - Exit method: ${finish.exitMethod}
364
-
365
- ## Inputs
366
- \`\`\`json
367
- ${JSON.stringify(run.inputs, null, 2)}
368
- \`\`\`
369
-
370
- ## Outputs
371
- \`\`\`json
372
- ${JSON.stringify(finish.outputs, null, 2)}
373
- \`\`\`
374
- `;
375
- }
376
- function handleCrash() {
377
- return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
378
- }
379
- var pendingRun, sessionDir, WAITING_LIMIT, waiting;
380
- var init_debug_store = __esm({
381
- "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
382
- "use strict";
383
- init_config();
384
- init_version();
385
- init_debug_mode_store();
386
- init_debug_prune();
387
- void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(async ([enabled, base]) => {
388
- if (!base) return;
389
- const retention = await readDebugModeSetting().catch(() => void 0);
390
- const pruned = retention ? await pruneExpiredLogs(base, retention.retentionDays).catch(() => void 0) : void 0;
391
- if (!enabled) return;
392
- const debugDir = join5(startSession(base, { replace: false }), "debug");
393
- await mkdir2(debugDir, { recursive: true });
394
- await writeWaitingLogs();
395
- if (retention && pruned && pruned.logs + pruned.folders > 0) {
396
- await writeFile2(
397
- join5(debugDir, `${datePrefix()}-cleanup-${generateRunId()}.md`),
398
- `# Debug Log Cleanup
399
-
400
- - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
401
- - Retention: ${retention.retentionDays} days
402
- - Logs deleted: ${pruned.logs}
403
- - Empty folders removed: ${pruned.folders}
404
- `,
405
- { mode: 384 }
406
- );
407
- }
408
- });
409
- WAITING_LIMIT = 50;
410
- waiting = [];
411
- process.once("uncaughtException", (err) => {
412
- void handleCrash().finally(() => {
413
- throw err;
414
- });
415
- });
416
- process.once("unhandledRejection", (reason) => {
417
- void handleCrash().finally(() => {
418
- throw reason;
419
- });
420
- });
421
- process.once("SIGINT", () => {
422
- void handleCrash().finally(() => {
423
- process.exit(130);
424
- });
425
- });
426
- }
427
- });
428
-
429
76
  // packages/experience-design-system-backend-pipeline/dist/src/agents/types/agent-name.js
430
77
  var AGENT_NAMES;
431
78
  var init_agent_name = __esm({
@@ -830,14 +477,14 @@ var init_parse_prompt_overrides = __esm({
830
477
  });
831
478
 
832
479
  // packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
833
- import { readFile as readFile2 } from "node:fs/promises";
834
- import { resolve as resolve3 } from "node:path";
480
+ import { readFile } from "node:fs/promises";
481
+ import { resolve as resolve2 } from "node:path";
835
482
  async function resolvePromptOverride(override) {
836
483
  if (override.kind === "text")
837
484
  return override.value;
838
- const abs = resolve3(override.value);
485
+ const abs = resolve2(override.value);
839
486
  try {
840
- return await readFile2(abs, "utf8");
487
+ return await readFile(abs, "utf8");
841
488
  } catch {
842
489
  throw new Error(`--prompt: could not read prompt file: ${abs}`);
843
490
  }
@@ -2125,22 +1772,22 @@ var init_skill_files = __esm({
2125
1772
  });
2126
1773
 
2127
1774
  // packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
2128
- import { existsSync as existsSync3 } from "node:fs";
2129
- import { dirname as dirname5, join as join7, resolve as resolve4 } from "node:path";
1775
+ import { existsSync as existsSync2 } from "node:fs";
1776
+ import { dirname as dirname3, join as join4, resolve as resolve3 } from "node:path";
2130
1777
  import { fileURLToPath as fileURLToPath2 } from "node:url";
2131
1778
  function resolveSkillPath(skill) {
2132
1779
  if (!(skill in SKILL_FILES))
2133
1780
  throw new Error(`Invalid skill: ${skill}`);
2134
- const thisDir = dirname5(fileURLToPath2(import.meta.url));
1781
+ const thisDir = dirname3(fileURLToPath2(import.meta.url));
2135
1782
  let dir = thisDir;
2136
1783
  for (; ; ) {
2137
- const candidate = join7(dir, "skills");
2138
- if (existsSync3(candidate)) {
1784
+ const candidate = join4(dir, "skills");
1785
+ if (existsSync2(candidate)) {
2139
1786
  const file = SKILL_FILES[skill];
2140
1787
  const stepDir = file === "select-components.md" ? "selection" : "generation";
2141
- return join7(candidate, stepDir, file);
1788
+ return join4(candidate, stepDir, file);
2142
1789
  }
2143
- const parent = resolve4(dir, "..");
1790
+ const parent = resolve3(dir, "..");
2144
1791
  if (parent === dir) {
2145
1792
  throw new Error(`skill file missing from package (could not locate skills/ directory from: ${thisDir})`);
2146
1793
  }
@@ -2155,20 +1802,20 @@ var init_resolve_skill_path = __esm({
2155
1802
  });
2156
1803
 
2157
1804
  // packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
2158
- import { readFile as readFile3 } from "node:fs/promises";
2159
- import { resolve as resolve5 } from "node:path";
1805
+ import { readFile as readFile2 } from "node:fs/promises";
1806
+ import { resolve as resolve4 } from "node:path";
2160
1807
  async function readSkillFile(skill, override) {
2161
1808
  if (override) {
2162
- const skillPath2 = resolve5(override);
1809
+ const skillPath2 = resolve4(override);
2163
1810
  try {
2164
- return await readFile3(skillPath2, "utf8");
1811
+ return await readFile2(skillPath2, "utf8");
2165
1812
  } catch {
2166
1813
  throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
2167
1814
  }
2168
1815
  }
2169
1816
  const skillPath = resolveSkillPath(skill);
2170
1817
  try {
2171
- return await readFile3(skillPath, "utf8");
1818
+ return await readFile2(skillPath, "utf8");
2172
1819
  } catch {
2173
1820
  throw new Error(`skill file missing from package (expected at: ${skillPath})`);
2174
1821
  }
@@ -2454,37 +2101,367 @@ var init_agents = __esm({
2454
2101
  }
2455
2102
  });
2456
2103
 
2457
- // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js
2458
- var cache_keys_exports = {};
2459
- __export(cache_keys_exports, {
2460
- hashContent: () => hashContent,
2461
- hashFile: () => hashFile,
2462
- hashPromptForSkill: () => hashPromptForSkill
2463
- });
2464
- import { createHash as createHash4 } from "node:crypto";
2465
- import { readFile as readFile4 } from "node:fs/promises";
2466
- import { resolve as resolve6 } from "node:path";
2467
- function hashContent(content) {
2468
- return createHash4("sha256").update(content).digest("hex");
2469
- }
2470
- async function hashFile(filePath) {
2471
- const content = await readFile4(filePath, "utf8");
2472
- return hashContent(content);
2104
+ // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js
2105
+ var cache_keys_exports = {};
2106
+ __export(cache_keys_exports, {
2107
+ hashContent: () => hashContent,
2108
+ hashFile: () => hashFile,
2109
+ hashPromptForSkill: () => hashPromptForSkill
2110
+ });
2111
+ import { createHash as createHash4 } from "node:crypto";
2112
+ import { readFile as readFile3 } from "node:fs/promises";
2113
+ import { resolve as resolve5 } from "node:path";
2114
+ function hashContent(content) {
2115
+ return createHash4("sha256").update(content).digest("hex");
2116
+ }
2117
+ async function hashFile(filePath) {
2118
+ const content = await readFile3(filePath, "utf8");
2119
+ return hashContent(content);
2120
+ }
2121
+ async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
2122
+ const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve5(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
2123
+ const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
2124
+ return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
2125
+ }
2126
+ var init_cache_keys = __esm({
2127
+ "packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js"() {
2128
+ "use strict";
2129
+ init_agents();
2130
+ }
2131
+ });
2132
+
2133
+ // packages/experience-design-system-types/dist/src/config/index.js
2134
+ import { randomBytes as randomBytes4 } from "node:crypto";
2135
+ import { mkdir as mkdir6, readFile as readFile20, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
2136
+ import { homedir as homedir3 } from "node:os";
2137
+ import { dirname as dirname14, join as join16 } from "node:path";
2138
+ function configRoot2() {
2139
+ return process.env["EDS_HOME"] || join16(homedir3(), ".contentful", "experience-design-system-cli");
2140
+ }
2141
+ async function readSettings2() {
2142
+ try {
2143
+ return JSON.parse(await readFile20(configFilePath2(), "utf8"));
2144
+ } catch {
2145
+ return {};
2146
+ }
2147
+ }
2148
+ async function writeSettings2(settings) {
2149
+ const path5 = configFilePath2();
2150
+ await mkdir6(dirname14(path5), { recursive: true });
2151
+ const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
2152
+ await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
2153
+ `, { mode: 384 });
2154
+ await rename2(tmp, path5);
2155
+ }
2156
+ async function updateSettings2(patch) {
2157
+ await writeSettings2({ ...await readSettings2(), ...patch });
2158
+ }
2159
+ var configFilePath2;
2160
+ var init_config = __esm({
2161
+ "packages/experience-design-system-types/dist/src/config/index.js"() {
2162
+ "use strict";
2163
+ configFilePath2 = () => join16(configRoot2(), "config.json");
2164
+ }
2165
+ });
2166
+
2167
+ // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
2168
+ function toRetentionDays(value) {
2169
+ return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
2170
+ }
2171
+ async function readDebugModeSetting() {
2172
+ const { debugMode } = await readSettings2();
2173
+ const saved = debugMode ?? {};
2174
+ return {
2175
+ enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
2176
+ retentionDays: toRetentionDays(saved.retentionDays)
2177
+ };
2178
+ }
2179
+ async function writeDebugModeSetting(change) {
2180
+ await updateSettings2({ debugMode: { ...await readDebugModeSetting(), ...change } });
2181
+ }
2182
+ var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
2183
+ var init_debug_mode_store = __esm({
2184
+ "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
2185
+ "use strict";
2186
+ init_config();
2187
+ RETENTION_CHOICES = [7, 14, 30];
2188
+ DEFAULT_RETENTION_DAYS = 30;
2189
+ }
2190
+ });
2191
+
2192
+ // packages/experience-design-system-cli/src/tui/debug-prune.ts
2193
+ import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
2194
+ import { dirname as dirname17, join as join23 } from "node:path";
2195
+ async function logFilesIn(dir) {
2196
+ const entries = await readdir2(dir, { withFileTypes: true });
2197
+ const nested = await Promise.all(
2198
+ entries.map(async (entry) => {
2199
+ const path5 = join23(dir, entry.name);
2200
+ if (entry.isDirectory()) return logFilesIn(path5);
2201
+ return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
2202
+ })
2203
+ );
2204
+ return nested.flat();
2205
+ }
2206
+ async function removeEmptyFolders(from, stop) {
2207
+ let dir = from;
2208
+ let removed = 0;
2209
+ for (; ; ) {
2210
+ try {
2211
+ await rmdir(dir);
2212
+ } catch {
2213
+ return removed;
2214
+ }
2215
+ removed += 1;
2216
+ if (dir === stop) return removed;
2217
+ dir = dirname17(dir);
2218
+ }
2219
+ }
2220
+ async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
2221
+ const cutoff = now - retentionDays * DAY_MS;
2222
+ const contentfulDir = join23(base, ".contentful");
2223
+ const result = { logs: 0, folders: 0 };
2224
+ try {
2225
+ const sessions = (await readdir2(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
2226
+ for (const session of sessions) {
2227
+ const files = await logFilesIn(join23(contentfulDir, session, "debug")).catch(() => []);
2228
+ for (const file of files) {
2229
+ try {
2230
+ if ((await stat4(file)).mtimeMs >= cutoff) continue;
2231
+ await rm(file);
2232
+ result.logs += 1;
2233
+ result.folders += await removeEmptyFolders(dirname17(file), join23(contentfulDir, session));
2234
+ } catch {
2235
+ }
2236
+ }
2237
+ }
2238
+ } catch {
2239
+ }
2240
+ return result;
2241
+ }
2242
+ var DAY_MS, SESSION_FOLDER;
2243
+ var init_debug_prune = __esm({
2244
+ "packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
2245
+ "use strict";
2246
+ DAY_MS = 24 * 60 * 60 * 1e3;
2247
+ SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
2248
+ }
2249
+ });
2250
+
2251
+ // packages/experience-design-system-cli/src/tui/debug-store.ts
2252
+ var debug_store_exports = {};
2253
+ __export(debug_store_exports, {
2254
+ currentDebugSessionDir: () => currentDebugSessionDir,
2255
+ currentSessionDir: () => currentSessionDir,
2256
+ finishDebugRun: () => finishDebugRun,
2257
+ startDebugRun: () => startDebugRun,
2258
+ startDebugSessionIn: () => startDebugSessionIn,
2259
+ startImportRun: () => startImportRun
2260
+ });
2261
+ import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
2262
+ import { existsSync as existsSync9, readdirSync as readdirSync4 } from "node:fs";
2263
+ import { join as join24, resolve as resolve27 } from "node:path";
2264
+ function generateRunId() {
2265
+ const now = /* @__PURE__ */ new Date();
2266
+ const pad = (n) => String(n).padStart(2, "0");
2267
+ return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
2268
+ }
2269
+ function datePrefix(now = /* @__PURE__ */ new Date()) {
2270
+ const pad = (n) => String(n).padStart(2, "0");
2271
+ return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
2272
+ }
2273
+ function slugify(value) {
2274
+ return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
2275
+ }
2276
+ async function readBaseDir() {
2277
+ try {
2278
+ const dir = (await readSettings2())["contentfulBaseDir"];
2279
+ return typeof dir === "string" && dir !== "" ? resolve27(dir) : void 0;
2280
+ } catch {
2281
+ return void 0;
2282
+ }
2283
+ }
2284
+ function nextSessionId(contentfulDir) {
2285
+ const today = datePrefix();
2286
+ const existing = existsSync9(contentfulDir) ? readdirSync4(contentfulDir) : [];
2287
+ const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
2288
+ const maxSeq = existing.reduce((max, entry) => {
2289
+ const match2 = seqPattern.exec(entry);
2290
+ return match2 ? Math.max(max, Number(match2[1])) : max;
2291
+ }, 0);
2292
+ return `${today}-session-${maxSeq + 1}`;
2293
+ }
2294
+ function startSession(base, { replace }) {
2295
+ const contentfulDir = join24(base, ".contentful");
2296
+ if (replace || !sessionDir) sessionDir = join24(contentfulDir, nextSessionId(contentfulDir));
2297
+ return sessionDir;
2298
+ }
2299
+ function currentDebugSessionDir() {
2300
+ return sessionDir && join24(sessionDir, "debug");
2301
+ }
2302
+ function currentSessionDir() {
2303
+ return sessionDir;
2304
+ }
2305
+ async function startDebugSessionIn(base, { replace = false } = {}) {
2306
+ try {
2307
+ if (!await isDebugModeEnabled()) return;
2308
+ await mkdir9(join24(startSession(resolve27(base), { replace }), "debug"), { recursive: true });
2309
+ } catch {
2310
+ }
2311
+ }
2312
+ function nextImportRunDir(session) {
2313
+ const existing = existsSync9(session) ? readdirSync4(session) : [];
2314
+ const maxRun = existing.reduce((max, entry) => {
2315
+ const match2 = /^dsi-import-(\d+)$/.exec(entry);
2316
+ return match2 ? Math.max(max, Number(match2[1])) : max;
2317
+ }, 0);
2318
+ return join24(session, `dsi-import-${maxRun + 1}`);
2319
+ }
2320
+ async function startImportRun(projectPath) {
2321
+ await startDebugSessionIn(projectPath);
2322
+ if (!sessionDir) return join24(resolve27(projectPath), ".contentful");
2323
+ const dir = nextImportRunDir(sessionDir);
2324
+ await mkdir9(dir, { recursive: true });
2325
+ return dir;
2326
+ }
2327
+ async function isDebugModeEnabled() {
2328
+ try {
2329
+ return (await readDebugModeSetting()).enabled;
2330
+ } catch {
2331
+ return true;
2332
+ }
2333
+ }
2334
+ function redact(value) {
2335
+ const clone = { ...value };
2336
+ if ("cma_token" in clone) {
2337
+ const raw = clone.cma_token;
2338
+ clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
2339
+ }
2340
+ return clone;
2341
+ }
2342
+ function startDebugRun({
2343
+ flow,
2344
+ step,
2345
+ menuOption,
2346
+ inputs
2347
+ }) {
2348
+ const runId = generateRunId();
2349
+ const startedAt = Date.now();
2350
+ const redactedInputs = redact(inputs);
2351
+ isDebugModeEnabled().then((enabled) => {
2352
+ if (!enabled) return;
2353
+ pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
2354
+ });
2355
+ }
2356
+ async function finishDebugRun({
2357
+ outputs,
2358
+ status,
2359
+ exitMethod
2360
+ }) {
2361
+ const run = pendingRun;
2362
+ if (!run) return;
2363
+ pendingRun = void 0;
2364
+ const durationMs = Date.now() - run.startedAt;
2365
+ const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
2366
+ const root = currentDebugSessionDir();
2367
+ if (!root) return;
2368
+ const flowSegments = run.flow.split("/");
2369
+ const dir = join24(root, ...flowSegments);
2370
+ await mkdir9(dir, { recursive: true });
2371
+ const filename = nextAttemptFilename(dir, run.menuOption);
2372
+ await writeFile8(join24(dir, filename), content, { mode: 384 });
2373
+ }
2374
+ function nextAttemptFilename(dir, menuOption) {
2375
+ const today = datePrefix();
2376
+ const optionSlug = slugify(menuOption);
2377
+ const existing = existsSync9(dir) ? readdirSync4(dir) : [];
2378
+ const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
2379
+ const maxAttempt = existing.reduce((max, entry) => {
2380
+ const match2 = attemptPattern.exec(entry);
2381
+ return match2 ? Math.max(max, Number(match2[1])) : max;
2382
+ }, 0);
2383
+ return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
2384
+ }
2385
+ function renderMarkdown(run, finish) {
2386
+ const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
2387
+ const stepLabel = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
2388
+ const flowSlug = run.flow.split("/").join("-");
2389
+ return `# Debug Log
2390
+
2391
+ - Run ID: ${run.runId}
2392
+ - Flow: ${flowSlug}
2393
+ - Step: ${stepLabel}
2394
+ - Menu option: ${run.menuOption}
2395
+ - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
2396
+ - CLI version: ${readPackageVersion()}
2397
+ - Platform: ${process.platform} / Node ${process.version}
2398
+ - Duration on screen: ${finish.durationMs}ms
2399
+ - Status: ${finish.status}
2400
+ - Exit method: ${finish.exitMethod}
2401
+
2402
+ ## Inputs
2403
+ \`\`\`json
2404
+ ${JSON.stringify(run.inputs, null, 2)}
2405
+ \`\`\`
2406
+
2407
+ ## Outputs
2408
+ \`\`\`json
2409
+ ${JSON.stringify(finish.outputs, null, 2)}
2410
+ \`\`\`
2411
+ `;
2473
2412
  }
2474
- async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
2475
- const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve6(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
2476
- const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
2477
- return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
2413
+ function handleCrash() {
2414
+ return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
2478
2415
  }
2479
- var init_cache_keys = __esm({
2480
- "packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js"() {
2416
+ var pendingRun, sessionDir;
2417
+ var init_debug_store = __esm({
2418
+ "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
2481
2419
  "use strict";
2482
- init_agents();
2420
+ init_config();
2421
+ init_version();
2422
+ init_debug_mode_store();
2423
+ init_debug_prune();
2424
+ void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(async ([enabled, base]) => {
2425
+ if (!base) return;
2426
+ const retention = await readDebugModeSetting().catch(() => void 0);
2427
+ const pruned = retention ? await pruneExpiredLogs(base, retention.retentionDays).catch(() => void 0) : void 0;
2428
+ if (!enabled) return;
2429
+ const debugDir = join24(startSession(base, { replace: false }), "debug");
2430
+ await mkdir9(debugDir, { recursive: true });
2431
+ if (retention && pruned && pruned.logs + pruned.folders > 0) {
2432
+ await writeFile8(
2433
+ join24(debugDir, `${datePrefix()}-cleanup-${generateRunId()}.md`),
2434
+ `# Debug Log Cleanup
2435
+
2436
+ - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
2437
+ - Retention: ${retention.retentionDays} days
2438
+ - Logs deleted: ${pruned.logs}
2439
+ - Empty folders removed: ${pruned.folders}
2440
+ `,
2441
+ { mode: 384 }
2442
+ );
2443
+ }
2444
+ });
2445
+ process.once("uncaughtException", (err) => {
2446
+ void handleCrash().finally(() => {
2447
+ throw err;
2448
+ });
2449
+ });
2450
+ process.once("unhandledRejection", (reason) => {
2451
+ void handleCrash().finally(() => {
2452
+ throw reason;
2453
+ });
2454
+ });
2455
+ process.once("SIGINT", () => {
2456
+ void handleCrash().finally(() => {
2457
+ process.exit(130);
2458
+ });
2459
+ });
2483
2460
  }
2484
2461
  });
2485
2462
 
2486
2463
  // packages/experience-design-system-cli/app.tsx
2487
- import { useEffect as useEffect29, useState as useState39 } from "react";
2464
+ import { useEffect as useEffect28, useState as useState39 } from "react";
2488
2465
 
2489
2466
  // packages/experience-design-system-cli/src/tui/home/home.tsx
2490
2467
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -2692,9 +2669,8 @@ function ImportScreen({ exitCode, onDone }) {
2692
2669
  }
2693
2670
 
2694
2671
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
2695
- import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
2672
+ import { useState as useState4 } from "react";
2696
2673
  import { Box as Box9, Text as Text9 } from "ink";
2697
- init_debug_store();
2698
2674
 
2699
2675
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/controls.ts
2700
2676
  import { useInput as useInput3 } from "ink";
@@ -3111,35 +3087,9 @@ function RunningStep({
3111
3087
 
3112
3088
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
3113
3089
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3114
- var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
3115
3090
  function PreflightScreen({ onChoose, onQuit }) {
3116
3091
  const [focus, setFocus] = useState4(0);
3117
- const viewed = useRef([optionAt(0)]).current;
3118
- useEffect4(() => {
3119
- startDebugRun({
3120
- flow: "import/preflight",
3121
- step: "00-preflight",
3122
- menuOption: "Preflight",
3123
- inputs: { options: IMPORT_TARGET_OPTIONS.map((option) => option.target), initial_focus: optionAt(0) }
3124
- });
3125
- }, []);
3126
- const moveTo = (next) => {
3127
- setFocus(next);
3128
- if (viewed[viewed.length - 1] !== optionAt(next)) viewed.push(optionAt(next));
3129
- };
3130
- const choose = (target) => {
3131
- void finishDebugRun({
3132
- outputs: { chosen: target, viewed, steps_that_will_run: overviewFor(target).map((step) => step.description) },
3133
- status: "success",
3134
- exitMethod: "saved"
3135
- });
3136
- onChoose(target);
3137
- };
3138
- const quit = () => {
3139
- void finishDebugRun({ outputs: { chosen: null, viewed }, status: "success", exitMethod: "discarded" });
3140
- onQuit();
3141
- };
3142
- usePreflightControls({ focus, onFocus: moveTo, onChoose: choose, onQuit: quit });
3092
+ usePreflightControls({ focus, onFocus: setFocus, onChoose, onQuit });
3143
3093
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
3144
3094
  /* @__PURE__ */ jsx9(StepHeader, { step: "setup" }),
3145
3095
  /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, paddingX: 2, paddingBottom: 1, children: [
@@ -3151,7 +3101,7 @@ function PreflightScreen({ onChoose, onQuit }) {
3151
3101
  /* @__PURE__ */ jsx9(Text9, { bold: focused, color: focused ? PALETTE.accent : void 0, children: option.label })
3152
3102
  ] }, option.target);
3153
3103
  }) }),
3154
- /* @__PURE__ */ jsx9(OverviewBox, { steps: overviewFor(optionAt(focus)) }),
3104
+ /* @__PURE__ */ jsx9(OverviewBox, { steps: overviewFor(IMPORT_TARGET_OPTIONS[focus].target) }),
3155
3105
  /* @__PURE__ */ jsx9(ControlHints, { hints: PREFLIGHT_CONTROLS })
3156
3106
  ] })
3157
3107
  ] });
@@ -3162,7 +3112,7 @@ import { useState as useState5 } from "react";
3162
3112
  import { Box as Box10, Text as Text10 } from "ink";
3163
3113
 
3164
3114
  // packages/experience-design-system-cli/src/tui/shared/components/ClearableTextInput.tsx
3165
- import { useRef as useRef2 } from "react";
3115
+ import { useRef } from "react";
3166
3116
  import { useInput as useInput6 } from "ink";
3167
3117
  import TextInput from "ink-text-input";
3168
3118
  import { jsx as jsx10 } from "react/jsx-runtime";
@@ -3170,7 +3120,7 @@ function isClearKey(input, key) {
3170
3120
  return key.ctrl && input === "d";
3171
3121
  }
3172
3122
  function ClearableTextInput({ onChange, ...props }) {
3173
- const justCleared = useRef2(false);
3123
+ const justCleared = useRef(false);
3174
3124
  useInput6((input, key) => {
3175
3125
  if (!isClearKey(input, key)) return;
3176
3126
  justCleared.current = true;
@@ -3271,17 +3221,17 @@ function useTokenInputControls(onBack) {
3271
3221
  import { statSync } from "node:fs";
3272
3222
 
3273
3223
  // packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
3274
- import { homedir as homedir2 } from "node:os";
3275
- import { resolve as resolve2 } from "node:path";
3224
+ import { homedir } from "node:os";
3225
+ import { resolve } from "node:path";
3276
3226
  function stripQuotes(value) {
3277
3227
  const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
3278
3228
  return value.length >= 2 && quoted ? value.slice(1, -1) : value;
3279
3229
  }
3280
3230
  function expandHome(value) {
3281
- return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir2() + value.slice(1) : value;
3231
+ return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
3282
3232
  }
3283
3233
  function resolveUserPath(raw) {
3284
- return resolve2(expandHome(stripQuotes(raw.trim())));
3234
+ return resolve(expandHome(stripQuotes(raw.trim())));
3285
3235
  }
3286
3236
 
3287
3237
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
@@ -3354,7 +3304,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3354
3304
  }
3355
3305
 
3356
3306
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
3357
- import { useEffect as useEffect5, useMemo, useState as useState7 } from "react";
3307
+ import { useEffect as useEffect4, useMemo, useState as useState7 } from "react";
3358
3308
  import { Box as Box12, Text as Text12 } from "ink";
3359
3309
 
3360
3310
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
@@ -3458,19 +3408,19 @@ function usePathValidationControls(phase, handlers) {
3458
3408
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
3459
3409
  import { DatabaseSync } from "node:sqlite";
3460
3410
  import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
3461
- import { readFile as readFile5 } from "node:fs/promises";
3411
+ import { readFile as readFile4 } from "node:fs/promises";
3462
3412
  import { createHash as createHash5 } from "node:crypto";
3463
3413
 
3464
3414
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
3465
- import { homedir as homedir3 } from "node:os";
3466
- import { dirname as dirname4, join as join6 } from "node:path";
3467
- function configRoot2() {
3468
- return process.env["EDS_HOME"] || join6(homedir3(), ".contentful", "experience-design-system-cli");
3415
+ import { homedir as homedir2 } from "node:os";
3416
+ import { dirname as dirname2, join as join3 } from "node:path";
3417
+ function configRoot() {
3418
+ return process.env["EDS_HOME"] || join3(homedir2(), ".contentful", "experience-design-system-cli");
3469
3419
  }
3470
- var runsFilePath = () => join6(configRoot2(), "state", "runs.json");
3420
+ var runsFilePath = () => join3(configRoot(), "state", "runs.json");
3471
3421
 
3472
3422
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
3473
- import { dirname as dirname6, resolve as resolve7 } from "node:path";
3423
+ import { dirname as dirname4, resolve as resolve6 } from "node:path";
3474
3424
 
3475
3425
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
3476
3426
  var ELLIPSIS_MARKER = "/* \u2026 */";
@@ -3646,7 +3596,7 @@ function updateStepStatus(db, stepId, status, outputs, error, timestamp) {
3646
3596
  }
3647
3597
 
3648
3598
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js
3649
- import { randomBytes as randomBytes2 } from "node:crypto";
3599
+ import { randomBytes } from "node:crypto";
3650
3600
  var ADJECTIVES = [
3651
3601
  "aged",
3652
3602
  "amber",
@@ -3852,7 +3802,7 @@ var NOUNS = [
3852
3802
  "wind"
3853
3803
  ];
3854
3804
  function generateSessionId() {
3855
- const buf = randomBytes2(4);
3805
+ const buf = randomBytes(4);
3856
3806
  const adjIdx = buf[0] % ADJECTIVES.length;
3857
3807
  const nounIdx = buf[1] % NOUNS.length;
3858
3808
  const hex = ((buf[2] << 8 | buf[3]) & 65535).toString(16).padStart(4, "0");
@@ -4241,13 +4191,13 @@ CREATE INDEX IF NOT EXISTS idx_scanned_files_session ON scanned_files(session
4241
4191
  `;
4242
4192
  function getPipelineDbPath() {
4243
4193
  if (process.env.EDS_PIPELINE_DB_PATH) {
4244
- return resolve7(process.env.EDS_PIPELINE_DB_PATH);
4194
+ return resolve6(process.env.EDS_PIPELINE_DB_PATH);
4245
4195
  }
4246
- return resolve7(configRoot2(), "pipeline.db");
4196
+ return resolve6(configRoot(), "pipeline.db");
4247
4197
  }
4248
4198
  function openPipelineDb(dbPath) {
4249
4199
  const path5 = dbPath ?? getPipelineDbPath();
4250
- mkdirSync(dirname6(path5), { recursive: true });
4200
+ mkdirSync(dirname4(path5), { recursive: true });
4251
4201
  try {
4252
4202
  const db = new DatabaseSync(path5);
4253
4203
  db.exec("PRAGMA busy_timeout = 5000");
@@ -4912,16 +4862,16 @@ function extractRelativeImportPaths(sourceText) {
4912
4862
  return [...specifiers];
4913
4863
  }
4914
4864
  async function resolveRelativeImport(specifier, fromDir) {
4915
- const basePath = resolve7(fromDir, specifier);
4865
+ const basePath = resolve6(fromDir, specifier);
4916
4866
  const candidates = [
4917
4867
  basePath,
4918
4868
  ...rewrittenSourcePaths(basePath),
4919
4869
  ...SIBLING_FILE_EXTENSIONS.map((ext) => `${basePath}${ext}`),
4920
- ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve7(basePath, `index${ext}`))
4870
+ ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve6(basePath, `index${ext}`))
4921
4871
  ];
4922
4872
  for (const candidate of candidates) {
4923
4873
  try {
4924
- await readFile5(candidate, "utf8");
4874
+ await readFile4(candidate, "utf8");
4925
4875
  return candidate;
4926
4876
  } catch {
4927
4877
  }
@@ -4938,9 +4888,9 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
4938
4888
  return resolvedPaths;
4939
4889
  }
4940
4890
  async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
4941
- const visited = /* @__PURE__ */ new Set([resolve7(sourcePath)]);
4891
+ const visited = /* @__PURE__ */ new Set([resolve6(sourcePath)]);
4942
4892
  const discovered = [];
4943
- let frontier = [{ text: sourceText, dir: dirname6(sourcePath) }];
4893
+ let frontier = [{ text: sourceText, dir: dirname4(sourcePath) }];
4944
4894
  for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
4945
4895
  const nextFrontier = [];
4946
4896
  for (const node of frontier) {
@@ -4955,12 +4905,12 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
4955
4905
  break;
4956
4906
  let content;
4957
4907
  try {
4958
- content = await readFile5(resolvedPath, "utf8");
4908
+ content = await readFile4(resolvedPath, "utf8");
4959
4909
  } catch {
4960
4910
  continue;
4961
4911
  }
4962
4912
  discovered.push({ path: resolvedPath, content });
4963
- nextFrontier.push({ text: content, dir: dirname6(resolvedPath) });
4913
+ nextFrontier.push({ text: content, dir: dirname4(resolvedPath) });
4964
4914
  }
4965
4915
  }
4966
4916
  frontier = nextFrontier;
@@ -4994,7 +4944,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
4994
4944
  let truncatedSiblingCount = 0;
4995
4945
  const usesNotShown = /* @__PURE__ */ new Set();
4996
4946
  try {
4997
- const rawText = await readFile5(sourcePath, "utf8");
4947
+ const rawText = await readFile4(sourcePath, "utf8");
4998
4948
  let siblingUsesNotShown;
4999
4949
  let declaredTypeNames;
5000
4950
  ({
@@ -5755,8 +5705,8 @@ init_token_types();
5755
5705
  import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "ts-morph";
5756
5706
 
5757
5707
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
5758
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
5759
- import { dirname as dirname7, join as join8, resolve as resolve8 } from "node:path";
5708
+ import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
5709
+ import { dirname as dirname5, join as join5, resolve as resolve7 } from "node:path";
5760
5710
  import { Node, Project, SyntaxKind } from "ts-morph";
5761
5711
  import ts from "typescript";
5762
5712
  var packageRootByFilePathCache = /* @__PURE__ */ new Map();
@@ -5944,7 +5894,7 @@ function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
5944
5894
  continue;
5945
5895
  for (const targetPattern of targets) {
5946
5896
  const substitutedTarget = substituteTsConfigPathTarget(targetPattern, match2.wildcard);
5947
- const resolvedPath = resolve8(tsConfigPaths.baseUrl, substitutedTarget);
5897
+ const resolvedPath = resolve7(tsConfigPaths.baseUrl, substitutedTarget);
5948
5898
  const sourceFilePath = resolveImportSourcePath(resolvedPath);
5949
5899
  if (sourceFilePath)
5950
5900
  return sourceFilePath;
@@ -5956,16 +5906,16 @@ function findNearestTsConfigPath(filePath) {
5956
5906
  if (nearestTsConfigPathCache.has(filePath)) {
5957
5907
  return nearestTsConfigPathCache.get(filePath) ?? void 0;
5958
5908
  }
5959
- let currentDir = dirname7(filePath);
5909
+ let currentDir = dirname5(filePath);
5960
5910
  while (true) {
5961
5911
  for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
5962
- const candidatePath = join8(currentDir, candidateName);
5963
- if (existsSync4(candidatePath)) {
5912
+ const candidatePath = join5(currentDir, candidateName);
5913
+ if (existsSync3(candidatePath)) {
5964
5914
  nearestTsConfigPathCache.set(filePath, candidatePath);
5965
5915
  return candidatePath;
5966
5916
  }
5967
5917
  }
5968
- const parentDir = dirname7(currentDir);
5918
+ const parentDir = dirname5(currentDir);
5969
5919
  if (parentDir === currentDir) {
5970
5920
  nearestTsConfigPathCache.set(filePath, null);
5971
5921
  return void 0;
@@ -5982,13 +5932,13 @@ function getTsConfigPaths(tsConfigPath) {
5982
5932
  tsConfigPathsCache.set(tsConfigPath, null);
5983
5933
  return void 0;
5984
5934
  }
5985
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname7(tsConfigPath));
5935
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname5(tsConfigPath));
5986
5936
  const paths = parsedConfig.options.paths;
5987
5937
  if (!paths || Object.keys(paths).length === 0) {
5988
5938
  tsConfigPathsCache.set(tsConfigPath, null);
5989
5939
  return void 0;
5990
5940
  }
5991
- const baseUrl = parsedConfig.options.baseUrl ?? dirname7(tsConfigPath);
5941
+ const baseUrl = parsedConfig.options.baseUrl ?? dirname5(tsConfigPath);
5992
5942
  const result = { baseUrl, paths };
5993
5943
  tsConfigPathsCache.set(tsConfigPath, result);
5994
5944
  return result;
@@ -6016,12 +5966,12 @@ function resolveImportSourcePath(basePath) {
6016
5966
  `${basePath}.tsx`,
6017
5967
  `${basePath}.js`,
6018
5968
  `${basePath}.jsx`,
6019
- join8(basePath, "index.ts"),
6020
- join8(basePath, "index.tsx"),
6021
- join8(basePath, "index.js"),
6022
- join8(basePath, "index.jsx")
5969
+ join5(basePath, "index.ts"),
5970
+ join5(basePath, "index.tsx"),
5971
+ join5(basePath, "index.js"),
5972
+ join5(basePath, "index.jsx")
6023
5973
  ];
6024
- return candidates.find((candidatePath) => existsSync4(candidatePath));
5974
+ return candidates.find((candidatePath) => existsSync3(candidatePath));
6025
5975
  }
6026
5976
  function findProjectSourceFileByImportPath(project, resolvedPath) {
6027
5977
  const candidatePaths = [
@@ -6030,10 +5980,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
6030
5980
  `${resolvedPath}.tsx`,
6031
5981
  `${resolvedPath}.js`,
6032
5982
  `${resolvedPath}.jsx`,
6033
- join8(resolvedPath, "index.ts"),
6034
- join8(resolvedPath, "index.tsx"),
6035
- join8(resolvedPath, "index.js"),
6036
- join8(resolvedPath, "index.jsx")
5983
+ join5(resolvedPath, "index.ts"),
5984
+ join5(resolvedPath, "index.tsx"),
5985
+ join5(resolvedPath, "index.js"),
5986
+ join5(resolvedPath, "index.jsx")
6037
5987
  ];
6038
5988
  for (const candidatePath of candidatePaths) {
6039
5989
  const sourceFile = project.getSourceFile(candidatePath);
@@ -6054,10 +6004,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
6054
6004
  if (!packageRootDir)
6055
6005
  return void 0;
6056
6006
  const preferredEntryPaths = [
6057
- join8(packageRootDir, "src/index.ts"),
6058
- join8(packageRootDir, "src/index.tsx"),
6059
- join8(packageRootDir, "index.ts"),
6060
- join8(packageRootDir, "index.tsx")
6007
+ join5(packageRootDir, "src/index.ts"),
6008
+ join5(packageRootDir, "src/index.tsx"),
6009
+ join5(packageRootDir, "index.ts"),
6010
+ join5(packageRootDir, "index.tsx")
6061
6011
  ];
6062
6012
  for (const entryPath of preferredEntryPaths) {
6063
6013
  const entrySourceFile = project.getSourceFile(entryPath);
@@ -6065,7 +6015,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
6065
6015
  return entrySourceFile;
6066
6016
  }
6067
6017
  }
6068
- return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join8(packageRootDir, "src"));
6018
+ return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join5(packageRootDir, "src"));
6069
6019
  }
6070
6020
  function getWorkspacePackageManifestForSourceFile(sourceFile) {
6071
6021
  const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
@@ -6074,7 +6024,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
6074
6024
  if (workspacePackageManifestCache.has(packageRootDir)) {
6075
6025
  return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
6076
6026
  }
6077
- const packageJsonPath = join8(packageRootDir, "package.json");
6027
+ const packageJsonPath = join5(packageRootDir, "package.json");
6078
6028
  try {
6079
6029
  const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
6080
6030
  const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
@@ -6089,13 +6039,13 @@ function findNearestPackageRootDir(filePath) {
6089
6039
  if (packageRootByFilePathCache.has(filePath)) {
6090
6040
  return packageRootByFilePathCache.get(filePath) ?? void 0;
6091
6041
  }
6092
- let currentDir = dirname7(filePath);
6042
+ let currentDir = dirname5(filePath);
6093
6043
  while (true) {
6094
- if (existsSync4(join8(currentDir, "package.json"))) {
6044
+ if (existsSync3(join5(currentDir, "package.json"))) {
6095
6045
  packageRootByFilePathCache.set(filePath, currentDir);
6096
6046
  return currentDir;
6097
6047
  }
6098
- const parentDir = dirname7(currentDir);
6048
+ const parentDir = dirname5(currentDir);
6099
6049
  if (parentDir === currentDir) {
6100
6050
  packageRootByFilePathCache.set(filePath, null);
6101
6051
  return void 0;
@@ -6105,7 +6055,7 @@ function findNearestPackageRootDir(filePath) {
6105
6055
  }
6106
6056
 
6107
6057
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
6108
- import { readFile as readFile6 } from "node:fs/promises";
6058
+ import { readFile as readFile5 } from "node:fs/promises";
6109
6059
  async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
6110
6060
  const warnings = [];
6111
6061
  const items = [];
@@ -6117,7 +6067,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
6117
6067
  if (!filePath)
6118
6068
  break;
6119
6069
  try {
6120
- const source = await readFile6(filePath, "utf-8");
6070
+ const source = await readFile5(filePath, "utf-8");
6121
6071
  const outcome = await extractFile(filePath, source);
6122
6072
  warnings.push(...outcome.warnings ?? []);
6123
6073
  if (outcome.item)
@@ -9092,35 +9042,35 @@ function extractVueSlotsFromSetup(options) {
9092
9042
 
9093
9043
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
9094
9044
  import os from "node:os";
9095
- import { basename, dirname as dirname9, resolve as resolve10, join as join10 } from "node:path";
9096
- import { readFile as readFile7 } from "node:fs/promises";
9097
- import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
9045
+ import { basename, dirname as dirname7, resolve as resolve9, join as join7 } from "node:path";
9046
+ import { readFile as readFile6 } from "node:fs/promises";
9047
+ import { existsSync as existsSync5, readFileSync as readFileSync5, readdirSync, statSync as statSync3 } from "node:fs";
9098
9048
  import { parse as parseSFC } from "@vue/compiler-sfc";
9099
9049
  import { Project as Project3, Node as Node6 } from "ts-morph";
9100
9050
 
9101
9051
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
9102
- import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
9103
- import { dirname as dirname8, join as join9, resolve as resolve9 } from "node:path";
9052
+ import { existsSync as existsSync4, statSync as statSync2 } from "node:fs";
9053
+ import { dirname as dirname6, join as join6, resolve as resolve8 } from "node:path";
9104
9054
  function resolveLocalModule(importingFilePath, specifier, options = {}) {
9105
- const basePath = resolve9(dirname8(importingFilePath), specifier);
9055
+ const basePath = resolve8(dirname6(importingFilePath), specifier);
9106
9056
  const candidates = [
9107
9057
  basePath,
9108
9058
  `${basePath}.js`,
9109
9059
  `${basePath}.ts`,
9110
9060
  `${basePath}.mjs`,
9111
9061
  `${basePath}.cjs`,
9112
- join9(basePath, "index.js"),
9113
- join9(basePath, "index.ts"),
9114
- join9(basePath, "index.mjs"),
9115
- join9(basePath, "index.cjs")
9062
+ join6(basePath, "index.js"),
9063
+ join6(basePath, "index.ts"),
9064
+ join6(basePath, "index.mjs"),
9065
+ join6(basePath, "index.cjs")
9116
9066
  ];
9117
9067
  for (const candidate of candidates) {
9118
- if (existsSync5(candidate) && statSync2(candidate).isFile())
9068
+ if (existsSync4(candidate) && statSync2(candidate).isFile())
9119
9069
  return candidate;
9120
9070
  }
9121
9071
  if (options.allowJavaScriptExtensionFallback && basePath.endsWith(".js")) {
9122
9072
  const tsPath = `${basePath.slice(0, -".js".length)}.ts`;
9123
- if (existsSync5(tsPath) && statSync2(tsPath).isFile())
9073
+ if (existsSync4(tsPath) && statSync2(tsPath).isFile())
9124
9074
  return tsPath;
9125
9075
  }
9126
9076
  return null;
@@ -9191,7 +9141,7 @@ function getVueComponentName(filePath) {
9191
9141
  if (fileName !== "index") {
9192
9142
  return fileName;
9193
9143
  }
9194
- const parentDirName = basename(dirname9(filePath));
9144
+ const parentDirName = basename(dirname7(filePath));
9195
9145
  return parentDirName || fileName;
9196
9146
  }
9197
9147
  async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
@@ -9335,7 +9285,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
9335
9285
  if (visitedImports.has(visitKey))
9336
9286
  return [];
9337
9287
  visitedImports.add(visitKey);
9338
- const source = await readFile7(importedRef.filePath, "utf-8");
9288
+ const source = await readFile6(importedRef.filePath, "utf-8");
9339
9289
  const project = new Project3({
9340
9290
  compilerOptions: {
9341
9291
  strict: false,
@@ -9363,18 +9313,18 @@ function findWorkspaceRoot(startDir) {
9363
9313
  return workspaceRootCache.get(startDir);
9364
9314
  let dir = startDir;
9365
9315
  while (true) {
9366
- const pkgJsonPath = join10(dir, "package.json");
9367
- if (existsSync6(pkgJsonPath)) {
9316
+ const pkgJsonPath = join7(dir, "package.json");
9317
+ if (existsSync5(pkgJsonPath)) {
9368
9318
  try {
9369
9319
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9370
- if (pkg.workspaces || existsSync6(join10(dir, "pnpm-workspace.yaml"))) {
9320
+ if (pkg.workspaces || existsSync5(join7(dir, "pnpm-workspace.yaml"))) {
9371
9321
  workspaceRootCache.set(startDir, dir);
9372
9322
  return dir;
9373
9323
  }
9374
9324
  } catch {
9375
9325
  }
9376
9326
  }
9377
- const parent = dirname9(dir);
9327
+ const parent = dirname7(dir);
9378
9328
  if (parent === dir) {
9379
9329
  workspaceRootCache.set(startDir, null);
9380
9330
  return null;
@@ -9388,8 +9338,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
9388
9338
  return workspacePackageDirsCache.get(workspaceRoot);
9389
9339
  }
9390
9340
  const packageMap = /* @__PURE__ */ new Map();
9391
- const packagesDir = join10(workspaceRoot, "packages");
9392
- if (!existsSync6(packagesDir)) {
9341
+ const packagesDir = join7(workspaceRoot, "packages");
9342
+ if (!existsSync5(packagesDir)) {
9393
9343
  workspacePackageDirsCache.set(workspaceRoot, packageMap);
9394
9344
  return packageMap;
9395
9345
  }
@@ -9398,12 +9348,12 @@ function getWorkspacePackageDirs(workspaceRoot) {
9398
9348
  return;
9399
9349
  let entries;
9400
9350
  try {
9401
- entries = readdirSync2(dir);
9351
+ entries = readdirSync(dir);
9402
9352
  } catch {
9403
9353
  return;
9404
9354
  }
9405
- const pkgJsonPath = join10(dir, "package.json");
9406
- if (existsSync6(pkgJsonPath)) {
9355
+ const pkgJsonPath = join7(dir, "package.json");
9356
+ if (existsSync5(pkgJsonPath)) {
9407
9357
  try {
9408
9358
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9409
9359
  if (typeof pkg.name === "string") {
@@ -9415,7 +9365,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
9415
9365
  for (const entry of entries) {
9416
9366
  if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
9417
9367
  continue;
9418
- const entryPath = join10(dir, entry);
9368
+ const entryPath = join7(dir, entry);
9419
9369
  try {
9420
9370
  const stat5 = statSync3(entryPath);
9421
9371
  if (stat5.isDirectory()) {
@@ -9430,7 +9380,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
9430
9380
  return packageMap;
9431
9381
  }
9432
9382
  function resolveWorkspaceVueImport(specifier, importingFilePath) {
9433
- const workspaceRoot = findWorkspaceRoot(dirname9(importingFilePath));
9383
+ const workspaceRoot = findWorkspaceRoot(dirname7(importingFilePath));
9434
9384
  if (!workspaceRoot)
9435
9385
  return null;
9436
9386
  const packageDirs = getWorkspacePackageDirs(workspaceRoot);
@@ -9455,28 +9405,28 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9455
9405
  const packageDir = packageDirs.get(packageName);
9456
9406
  if (!packageDir)
9457
9407
  return null;
9458
- const pkgJsonPath = join10(packageDir, "package.json");
9408
+ const pkgJsonPath = join7(packageDir, "package.json");
9459
9409
  try {
9460
9410
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9461
9411
  if (pkg.exports && subpath !== ".") {
9462
9412
  const exportValue = pkg.exports[subpath];
9463
9413
  if (typeof exportValue === "string" && exportValue.endsWith(".vue")) {
9464
- const resolved = resolve10(packageDir, exportValue);
9465
- if (existsSync6(resolved))
9414
+ const resolved = resolve9(packageDir, exportValue);
9415
+ if (existsSync5(resolved))
9466
9416
  return resolved;
9467
9417
  }
9468
9418
  }
9469
9419
  if (subpath !== ".") {
9470
- const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
9471
- for (const base of [join10(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
9472
- const subPkgPath = join10(base, "package.json");
9473
- if (existsSync6(subPkgPath)) {
9420
+ const subDir = resolve9(packageDir, subpath.replace(/^\.\//, ""));
9421
+ for (const base of [join7(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
9422
+ const subPkgPath = join7(base, "package.json");
9423
+ if (existsSync5(subPkgPath)) {
9474
9424
  try {
9475
9425
  const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
9476
9426
  const main = subPkg.main || subPkg.module;
9477
9427
  if (typeof main === "string" && main.endsWith(".vue")) {
9478
- const resolved = resolve10(base, main);
9479
- if (existsSync6(resolved))
9428
+ const resolved = resolve9(base, main);
9429
+ if (existsSync5(resolved))
9480
9430
  return resolved;
9481
9431
  }
9482
9432
  } catch {
@@ -9487,8 +9437,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9487
9437
  if (subpath === ".") {
9488
9438
  const main = pkg.main || pkg.module;
9489
9439
  if (typeof main === "string" && main.endsWith(".vue")) {
9490
- const resolved = resolve10(packageDir, main);
9491
- if (existsSync6(resolved))
9440
+ const resolved = resolve9(packageDir, main);
9441
+ if (existsSync5(resolved))
9492
9442
  return resolved;
9493
9443
  }
9494
9444
  }
@@ -9497,7 +9447,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9497
9447
  return null;
9498
9448
  }
9499
9449
  async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE__ */ new Set()) {
9500
- const resolvedFilePath = resolve10(filePath);
9450
+ const resolvedFilePath = resolve9(filePath);
9501
9451
  if (visited.has(resolvedFilePath)) {
9502
9452
  return [];
9503
9453
  }
@@ -9522,7 +9472,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
9522
9472
  if (specifier.startsWith(".")) {
9523
9473
  if (!specifier.endsWith(".vue"))
9524
9474
  continue;
9525
- localImports.set(defaultImport.getText(), resolve10(dirname9(resolvedFilePath), specifier));
9475
+ localImports.set(defaultImport.getText(), resolve9(dirname7(resolvedFilePath), specifier));
9526
9476
  } else {
9527
9477
  const resolvedVuePath = resolveWorkspaceVueImport(specifier, resolvedFilePath);
9528
9478
  if (resolvedVuePath) {
@@ -9566,7 +9516,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
9566
9516
  return [];
9567
9517
  }
9568
9518
  async function extractInheritedVueProps(filePath, visited) {
9569
- const source = await readFile7(filePath, "utf-8");
9519
+ const source = await readFile6(filePath, "utf-8");
9570
9520
  const { descriptor } = parseSFC(source);
9571
9521
  if (!descriptor.script) {
9572
9522
  return [];
@@ -9899,7 +9849,7 @@ async function extractAstroComponents(filePaths, onProgress) {
9899
9849
  }
9900
9850
 
9901
9851
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
9902
- import { basename as basename3, dirname as dirname10, join as join11, resolve as resolve11 } from "node:path";
9852
+ import { basename as basename3, dirname as dirname8, join as join8, resolve as resolve10 } from "node:path";
9903
9853
  import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
9904
9854
  function normalizeComponentName(input) {
9905
9855
  return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
@@ -10544,7 +10494,7 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
10544
10494
  }
10545
10495
  function resolveImportSourcePath2(fromFilePath, specifier) {
10546
10496
  if (specifier.startsWith(".")) {
10547
- const resolvedPath = resolve11(dirname10(fromFilePath), specifier);
10497
+ const resolvedPath = resolve10(dirname8(fromFilePath), specifier);
10548
10498
  if (resolvedPath.endsWith(".js")) {
10549
10499
  return `${resolvedPath.slice(0, -3)}.ts`;
10550
10500
  }
@@ -10554,14 +10504,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
10554
10504
  if (!specifier.startsWith(spectrumPrefix)) {
10555
10505
  return null;
10556
10506
  }
10557
- const packagesMarker = `${join11("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
10507
+ const packagesMarker = `${join8("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
10558
10508
  const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
10559
10509
  if (markerIndex === -1) {
10560
10510
  return null;
10561
10511
  }
10562
10512
  const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
10563
10513
  const componentPath = specifier.slice(spectrumPrefix.length);
10564
- return join11(packagesRoot, "core", "components", componentPath, "index.ts");
10514
+ return join8(packagesRoot, "core", "components", componentPath, "index.ts");
10565
10515
  }
10566
10516
  function getImportedBaseClass(classDecl, project, visitedFiles) {
10567
10517
  const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
@@ -10714,8 +10664,8 @@ async function extractWebComponentDefinitions(filePaths) {
10714
10664
 
10715
10665
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
10716
10666
  import os3 from "node:os";
10717
- import { basename as basename4, dirname as dirname11, resolve as resolve12, join as join12 } from "node:path";
10718
- import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
10667
+ import { basename as basename4, dirname as dirname9, resolve as resolve11, join as join9 } from "node:path";
10668
+ import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
10719
10669
  import { createRequire } from "node:module";
10720
10670
  import { parse as parseSvelte } from "svelte/compiler";
10721
10671
  import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
@@ -10948,10 +10898,10 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
10948
10898
  function findNearestTsconfig(startDir) {
10949
10899
  let dir = startDir;
10950
10900
  for (let i = 0; i < 16; i++) {
10951
- const candidate = join12(dir, "tsconfig.json");
10952
- if (existsSync7(candidate))
10901
+ const candidate = join9(dir, "tsconfig.json");
10902
+ if (existsSync6(candidate))
10953
10903
  return candidate;
10954
- const parent = dirname11(dir);
10904
+ const parent = dirname9(dir);
10955
10905
  if (!parent || parent === dir)
10956
10906
  return null;
10957
10907
  dir = parent;
@@ -11081,32 +11031,32 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11081
11031
  } catch {
11082
11032
  resolvedJs = null;
11083
11033
  }
11084
- const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
11034
+ const seedDir = resolvedJs ? dirname9(resolvedJs) : dirname9(parentFile);
11085
11035
  const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
11086
11036
  if (pkgRoot) {
11087
- const pkgJsonPath = join12(pkgRoot, "package.json");
11088
- if (existsSync7(pkgJsonPath)) {
11037
+ const pkgJsonPath = join9(pkgRoot, "package.json");
11038
+ if (existsSync6(pkgJsonPath)) {
11089
11039
  try {
11090
11040
  const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
11091
11041
  const pkg = JSON.parse(pkgRaw);
11092
11042
  const typesField = pkg.types ?? pkg.typings;
11093
11043
  if (typeof typesField === "string") {
11094
- const candidate = resolve12(pkgRoot, typesField);
11095
- if (existsSync7(candidate))
11044
+ const candidate = resolve11(pkgRoot, typesField);
11045
+ if (existsSync6(candidate))
11096
11046
  return candidate;
11097
11047
  }
11098
11048
  const exportsTypes = extractTypesFromExports(pkg.exports);
11099
11049
  if (exportsTypes) {
11100
- const candidate = resolve12(pkgRoot, exportsTypes);
11101
- if (existsSync7(candidate))
11050
+ const candidate = resolve11(pkgRoot, exportsTypes);
11051
+ if (existsSync6(candidate))
11102
11052
  return candidate;
11103
11053
  }
11104
11054
  } catch {
11105
11055
  }
11106
11056
  }
11107
11057
  for (const entry of ["index.d.ts", "index.d.mts"]) {
11108
- const candidate = join12(pkgRoot, entry);
11109
- if (existsSync7(candidate))
11058
+ const candidate = join9(pkgRoot, entry);
11059
+ if (existsSync6(candidate))
11110
11060
  return candidate;
11111
11061
  }
11112
11062
  }
@@ -11114,7 +11064,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11114
11064
  const noExt = resolvedJs.replace(/\.(m?js|cjs)$/, "");
11115
11065
  for (const ext of [".d.ts", ".d.mts"]) {
11116
11066
  const candidate = `${noExt}${ext}`;
11117
- if (existsSync7(candidate))
11067
+ if (existsSync6(candidate))
11118
11068
  return candidate;
11119
11069
  }
11120
11070
  }
@@ -11123,9 +11073,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11123
11073
  function findPackageRootForSpecifier(seedDir, specifier) {
11124
11074
  let dir = seedDir;
11125
11075
  for (let i = 0; i < 32; i++) {
11126
- if (existsSync7(join12(dir, "package.json"))) {
11076
+ if (existsSync6(join9(dir, "package.json"))) {
11127
11077
  try {
11128
- const pkgRaw = readFileSync6(join12(dir, "package.json"), "utf-8");
11078
+ const pkgRaw = readFileSync6(join9(dir, "package.json"), "utf-8");
11129
11079
  const pkg = JSON.parse(pkgRaw);
11130
11080
  if (pkg.name === specifier)
11131
11081
  return dir;
@@ -11134,7 +11084,7 @@ function findPackageRootForSpecifier(seedDir, specifier) {
11134
11084
  } catch {
11135
11085
  }
11136
11086
  }
11137
- const parent = dirname11(dir);
11087
+ const parent = dirname9(dir);
11138
11088
  if (!parent || parent === dir)
11139
11089
  return null;
11140
11090
  dir = parent;
@@ -11266,11 +11216,11 @@ async function extractFromSvelteFile(filePath, source) {
11266
11216
  var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
11267
11217
  function getSvelteComponentName(filePath) {
11268
11218
  const file = basename4(filePath, ".svelte");
11269
- const parentDir = basename4(dirname11(filePath));
11219
+ const parentDir = basename4(dirname9(filePath));
11270
11220
  if (file === "index")
11271
11221
  return toPascalCase(parentDir);
11272
11222
  if (ANATOMY_FOLDERS.has(parentDir)) {
11273
- const grandparent = basename4(dirname11(dirname11(filePath)));
11223
+ const grandparent = basename4(dirname9(dirname9(filePath)));
11274
11224
  if (grandparent && grandparent !== "." && grandparent !== "/") {
11275
11225
  return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
11276
11226
  }
@@ -12085,7 +12035,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
12085
12035
  }
12086
12036
 
12087
12037
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
12088
- import { readFile as readFile9 } from "node:fs/promises";
12038
+ import { readFile as readFile8 } from "node:fs/promises";
12089
12039
  import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
12090
12040
 
12091
12041
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
@@ -12399,7 +12349,7 @@ function extractProps2(cls, meta) {
12399
12349
  }
12400
12350
 
12401
12351
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
12402
- import { dirname as dirname12, resolve as resolve13 } from "node:path";
12352
+ import { dirname as dirname10, resolve as resolve12 } from "node:path";
12403
12353
 
12404
12354
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
12405
12355
  var SUFFIXES = ["Component", "Directive"];
@@ -12454,7 +12404,7 @@ function readComponentMetadata(cls, sourceFilePath) {
12454
12404
  const inlineTemplate = readDecoratorString(obj, "template");
12455
12405
  const templateUrlRel = readDecoratorString(obj, "templateUrl");
12456
12406
  const inputsArray = readDecoratorStringArray(obj, "inputs");
12457
- const templatePath = templateUrlRel ? resolve13(dirname12(sourceFilePath), templateUrlRel) : null;
12407
+ const templatePath = templateUrlRel ? resolve12(dirname10(sourceFilePath), templateUrlRel) : null;
12458
12408
  const decorator = cls.getDecorator("Component");
12459
12409
  const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
12460
12410
  return {
@@ -12491,14 +12441,14 @@ function countLines(text, offset) {
12491
12441
  }
12492
12442
 
12493
12443
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
12494
- import { readFile as readFile8 } from "node:fs/promises";
12444
+ import { readFile as readFile7 } from "node:fs/promises";
12495
12445
  async function resolveTemplateSource(meta) {
12496
12446
  if (meta.inlineTemplate !== null)
12497
12447
  return meta.inlineTemplate;
12498
12448
  if (meta.templatePath === null)
12499
12449
  return null;
12500
12450
  try {
12501
- return await readFile8(meta.templatePath, "utf8");
12451
+ return await readFile7(meta.templatePath, "utf8");
12502
12452
  } catch {
12503
12453
  return null;
12504
12454
  }
@@ -12688,7 +12638,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
12688
12638
  });
12689
12639
  for (const filePath of filePaths) {
12690
12640
  try {
12691
- const source = await readFile9(filePath, "utf8");
12641
+ const source = await readFile8(filePath, "utf8");
12692
12642
  const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
12693
12643
  for (const cls of sourceFile.getClasses()) {
12694
12644
  if (!hasComponentDecorator(cls))
@@ -13276,17 +13226,17 @@ function applyCompositionEdges(components, edges) {
13276
13226
  }
13277
13227
 
13278
13228
  // packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
13279
- import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
13280
- import { dirname as dirname13, join as join13, resolve as resolve14 } from "node:path";
13229
+ import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
13230
+ import { dirname as dirname11, join as join10, resolve as resolve13 } from "node:path";
13281
13231
  import { fileURLToPath as fileURLToPath3 } from "node:url";
13282
13232
  function resolvePromptPath(fileName) {
13283
- const thisDir = dirname13(fileURLToPath3(import.meta.url));
13233
+ const thisDir = dirname11(fileURLToPath3(import.meta.url));
13284
13234
  let dir = thisDir;
13285
13235
  for (; ; ) {
13286
- const candidate = join13(dir, "prompts");
13287
- if (existsSync8(candidate))
13288
- return join13(candidate, fileName);
13289
- const parent = resolve14(dir, "..");
13236
+ const candidate = join10(dir, "prompts");
13237
+ if (existsSync7(candidate))
13238
+ return join10(candidate, fileName);
13239
+ const parent = resolve13(dir, "..");
13290
13240
  if (parent === dir) {
13291
13241
  throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
13292
13242
  }
@@ -13451,7 +13401,7 @@ ${fileDigest}`);
13451
13401
  }
13452
13402
 
13453
13403
  // packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
13454
- import { dirname as dirname14 } from "node:path";
13404
+ import { dirname as dirname12 } from "node:path";
13455
13405
  function kebabToPascal3(name) {
13456
13406
  return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
13457
13407
  }
@@ -13515,8 +13465,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
13515
13465
  for (const file of files) {
13516
13466
  if (!file.path.endsWith("AGENTS.md"))
13517
13467
  continue;
13518
- const docDir = dirname14(file.path);
13519
- const parent = components.find((c2) => c2.sourcePath && dirname14(c2.sourcePath) === docDir)?.name;
13468
+ const docDir = dirname12(file.path);
13469
+ const parent = components.find((c2) => c2.sourcePath && dirname12(c2.sourcePath) === docDir)?.name;
13520
13470
  if (!parent || !componentNames.has(parent))
13521
13471
  continue;
13522
13472
  for (const line of file.content.split("\n")) {
@@ -13841,7 +13791,7 @@ function validateExtractedComponents(components) {
13841
13791
  }
13842
13792
 
13843
13793
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
13844
- import { resolve as resolve16 } from "node:path";
13794
+ import { resolve as resolve15 } from "node:path";
13845
13795
 
13846
13796
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
13847
13797
  import { createHash as createHash7 } from "node:crypto";
@@ -13852,7 +13802,7 @@ function createComponentId(name, resolvedSourcePath) {
13852
13802
 
13853
13803
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
13854
13804
  import { access } from "node:fs/promises";
13855
- import { isAbsolute, relative, resolve as resolve15 } from "node:path";
13805
+ import { isAbsolute, relative, resolve as resolve14 } from "node:path";
13856
13806
  async function resolveComponentSourcePath(source, reviewRoot) {
13857
13807
  if (isAbsolute(source)) {
13858
13808
  try {
@@ -13862,7 +13812,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
13862
13812
  throw new Error(`Unable to access component source at ${source}`);
13863
13813
  }
13864
13814
  }
13865
- const candidate = resolve15(reviewRoot, source);
13815
+ const candidate = resolve14(reviewRoot, source);
13866
13816
  const relativeToRoot = relative(reviewRoot, candidate);
13867
13817
  if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
13868
13818
  throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
@@ -13877,7 +13827,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
13877
13827
 
13878
13828
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
13879
13829
  async function loadReviewInput(components, options = {}) {
13880
- const reviewRoot = resolve16(options.reviewRoot ?? process.cwd());
13830
+ const reviewRoot = resolve15(options.reviewRoot ?? process.cwd());
13881
13831
  const records = await Promise.all(components.map(async (component) => {
13882
13832
  let resolvedSourcePath;
13883
13833
  try {
@@ -13912,50 +13862,50 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
13912
13862
  }
13913
13863
 
13914
13864
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
13915
- import { access as access3, readFile as readFile11 } from "node:fs/promises";
13865
+ import { access as access3, readFile as readFile10 } from "node:fs/promises";
13916
13866
 
13917
13867
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
13918
- import { access as access2, mkdir as mkdir3, readFile as readFile10, writeFile as writeFile3 } from "node:fs/promises";
13868
+ import { access as access2, mkdir, readFile as readFile9, writeFile } from "node:fs/promises";
13919
13869
 
13920
13870
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
13921
- import { resolve as resolve17 } from "node:path";
13871
+ import { resolve as resolve16 } from "node:path";
13922
13872
  async function getRefineSessionPaths(sessionId, artifactsRoot) {
13923
- const sessionDir2 = resolve17(artifactsRoot, sessionId);
13873
+ const sessionDir2 = resolve16(artifactsRoot, sessionId);
13924
13874
  return {
13925
13875
  sessionDir: sessionDir2,
13926
- eventsPath: resolve17(sessionDir2, "events.jsonl"),
13927
- statePath: resolve17(sessionDir2, "current-review-state.json")
13876
+ eventsPath: resolve16(sessionDir2, "events.jsonl"),
13877
+ statePath: resolve16(sessionDir2, "current-review-state.json")
13928
13878
  };
13929
13879
  }
13930
13880
 
13931
13881
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
13932
13882
  async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
13933
13883
  const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
13934
- await mkdir3(paths.sessionDir, { recursive: true });
13884
+ await mkdir(paths.sessionDir, { recursive: true });
13935
13885
  try {
13936
13886
  await access2(paths.statePath);
13937
- const savedState = await readFile10(paths.statePath, "utf8");
13887
+ const savedState = await readFile9(paths.statePath, "utf8");
13938
13888
  return JSON.parse(savedState);
13939
13889
  } catch {
13940
- await writeFile3(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
13941
- await writeFile3(paths.eventsPath, "", "utf8");
13890
+ await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
13891
+ await writeFile(paths.eventsPath, "", "utf8");
13942
13892
  return initialSnapshot;
13943
13893
  }
13944
13894
  }
13945
13895
 
13946
13896
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
13947
- import { resolve as resolve18 } from "node:path";
13897
+ import { resolve as resolve17 } from "node:path";
13948
13898
  function getRefineArtifactsRoot() {
13949
13899
  if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
13950
- return resolve18(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
13900
+ return resolve17(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
13951
13901
  }
13952
- return resolve18(configRoot2(), "reviews");
13902
+ return resolve17(configRoot(), "reviews");
13953
13903
  }
13954
13904
 
13955
13905
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
13956
- import { writeFile as writeFile4 } from "node:fs/promises";
13906
+ import { writeFile as writeFile2 } from "node:fs/promises";
13957
13907
  async function saveReviewState(statePath, session) {
13958
- await writeFile4(statePath, JSON.stringify(session, null, 2), "utf8");
13908
+ await writeFile2(statePath, JSON.stringify(session, null, 2), "utf8");
13959
13909
  }
13960
13910
 
13961
13911
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
@@ -13965,7 +13915,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
13965
13915
  let snapshot;
13966
13916
  try {
13967
13917
  await access3(paths.statePath);
13968
- snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
13918
+ snapshot = JSON.parse(await readFile10(paths.statePath, "utf8"));
13969
13919
  } catch {
13970
13920
  snapshot = await loadAndValidateForReview(sessionId, void 0);
13971
13921
  snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
@@ -14003,7 +13953,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
14003
13953
  }
14004
13954
 
14005
13955
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
14006
- import { readFile as readFile12 } from "node:fs/promises";
13956
+ import { readFile as readFile11 } from "node:fs/promises";
14007
13957
  async function rejectComponentsByName(sessionId, names, opts = {}) {
14008
13958
  if (names.length === 0)
14009
13959
  return;
@@ -14019,7 +13969,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
14019
13969
  const nameSet = new Set(names);
14020
13970
  let snapshot;
14021
13971
  try {
14022
- snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
13972
+ snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
14023
13973
  } catch {
14024
13974
  return;
14025
13975
  }
@@ -14174,10 +14124,10 @@ function isSourceFile(name) {
14174
14124
  }
14175
14125
 
14176
14126
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/read-dir-safely.js
14177
- import { readdirSync as readdirSync3 } from "node:fs";
14127
+ import { readdirSync as readdirSync2 } from "node:fs";
14178
14128
  function readDirSafely(dir) {
14179
14129
  try {
14180
- return readdirSync3(dir, { withFileTypes: true });
14130
+ return readdirSync2(dir, { withFileTypes: true });
14181
14131
  } catch {
14182
14132
  return "unreadable";
14183
14133
  }
@@ -14245,7 +14195,7 @@ function collectFiles(root, options = {}) {
14245
14195
  }
14246
14196
 
14247
14197
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/generate-ulid.js
14248
- import { randomBytes as randomBytes3 } from "node:crypto";
14198
+ import { randomBytes as randomBytes2 } from "node:crypto";
14249
14199
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
14250
14200
  function encodeBase32(bytes, length) {
14251
14201
  let out = "";
@@ -14271,12 +14221,12 @@ function generateUlid(now = Date.now()) {
14271
14221
  n = Math.floor(n / 256);
14272
14222
  }
14273
14223
  const ts3 = encodeBase32(tsBytes, 10);
14274
- const rand = encodeBase32(randomBytes3(10), 16);
14224
+ const rand = encodeBase32(randomBytes2(10), 16);
14275
14225
  return (ts3 + rand).toUpperCase();
14276
14226
  }
14277
14227
 
14278
14228
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
14279
- import { readFile as readFile13 } from "node:fs/promises";
14229
+ import { readFile as readFile12 } from "node:fs/promises";
14280
14230
 
14281
14231
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
14282
14232
  function migrateRecord(rec) {
@@ -14295,7 +14245,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
14295
14245
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
14296
14246
  async function readRunsFileMaybe() {
14297
14247
  try {
14298
- const raw = await readFile13(runsFilePath(), "utf8");
14248
+ const raw = await readFile12(runsFilePath(), "utf8");
14299
14249
  const parsed = JSON.parse(raw);
14300
14250
  if (!READABLE_VERSIONS.has(parsed.version)) {
14301
14251
  throw new Error(`runs.json version mismatch: file is v${parsed.version}, this CLI expects v${RUNS_FILE_VERSION} (also reads: ${[...READABLE_VERSIONS].join(", ")}). Back up and remove the file to start fresh.`);
@@ -14311,14 +14261,14 @@ async function readRunsFileMaybe() {
14311
14261
  }
14312
14262
 
14313
14263
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
14314
- import { mkdir as mkdir4, rename as rename2, writeFile as writeFile5 } from "node:fs/promises";
14315
- import { dirname as dirname15 } from "node:path";
14264
+ import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
14265
+ import { dirname as dirname13 } from "node:path";
14316
14266
  async function writeRunsFileAtomic(file) {
14317
- await mkdir4(dirname15(runsFilePath()), { recursive: true });
14267
+ await mkdir2(dirname13(runsFilePath()), { recursive: true });
14318
14268
  const body = JSON.stringify(file, null, 2) + "\n";
14319
14269
  const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
14320
- await writeFile5(tmp, body, { mode: 384 });
14321
- await rename2(tmp, runsFilePath());
14270
+ await writeFile3(tmp, body, { mode: 384 });
14271
+ await rename(tmp, runsFilePath());
14322
14272
  }
14323
14273
 
14324
14274
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/append-run.js
@@ -14354,8 +14304,8 @@ async function updateRun(id, patch) {
14354
14304
  }
14355
14305
 
14356
14306
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
14357
- import { readFile as readFile14, stat as stat2 } from "node:fs/promises";
14358
- import { resolve as resolve19 } from "node:path";
14307
+ import { readFile as readFile13, stat } from "node:fs/promises";
14308
+ import { resolve as resolve18 } from "node:path";
14359
14309
 
14360
14310
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
14361
14311
  import { createHash as createHash8 } from "node:crypto";
@@ -14377,12 +14327,12 @@ async function buildSourceFingerprint(opts) {
14377
14327
  const name = rowField(row, "name");
14378
14328
  if (!sourcePath)
14379
14329
  continue;
14380
- const abs = resolve19(sourcePath);
14330
+ const abs = resolve18(sourcePath);
14381
14331
  if (seen.has(abs))
14382
14332
  continue;
14383
14333
  seen.add(abs);
14384
14334
  try {
14385
- const st = await stat2(abs);
14335
+ const st = await stat(abs);
14386
14336
  const entry = { mtime: st.mtime.toISOString() };
14387
14337
  if (name)
14388
14338
  entry.componentName = name;
@@ -14394,10 +14344,10 @@ async function buildSourceFingerprint(opts) {
14394
14344
  let rawTokensMtime = null;
14395
14345
  let rawTokensContentHash = null;
14396
14346
  if (opts.rawTokensPath) {
14397
- const abs = resolve19(opts.rawTokensPath);
14347
+ const abs = resolve18(opts.rawTokensPath);
14398
14348
  rawTokensPath = abs;
14399
14349
  try {
14400
- const [st, buf] = await Promise.all([stat2(abs), readFile14(abs)]);
14350
+ const [st, buf] = await Promise.all([stat(abs), readFile13(abs)]);
14401
14351
  rawTokensMtime = st.mtime.toISOString();
14402
14352
  rawTokensContentHash = sha256Hex(buf);
14403
14353
  } catch {
@@ -14408,7 +14358,7 @@ async function buildSourceFingerprint(opts) {
14408
14358
 
14409
14359
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
14410
14360
  import { access as access4 } from "node:fs/promises";
14411
- import { join as join14 } from "node:path";
14361
+ import { join as join11 } from "node:path";
14412
14362
 
14413
14363
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
14414
14364
  var SAVE_FILES = ["components.json", "tokens.json"];
@@ -14418,7 +14368,7 @@ async function listConflictingFiles(path5) {
14418
14368
  const conflicts = [];
14419
14369
  for (const name of SAVE_FILES) {
14420
14370
  try {
14421
- await access4(join14(path5, name));
14371
+ await access4(join11(path5, name));
14422
14372
  conflicts.push(name);
14423
14373
  } catch {
14424
14374
  }
@@ -14432,7 +14382,7 @@ async function detectSaveConflict(path5) {
14432
14382
  }
14433
14383
 
14434
14384
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
14435
- import { join as join15 } from "node:path";
14385
+ import { join as join12 } from "node:path";
14436
14386
  function pad2(n) {
14437
14387
  return n < 10 ? `0${n}` : String(n);
14438
14388
  }
@@ -14443,11 +14393,11 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
14443
14393
  const hh = pad2(now.getHours());
14444
14394
  const mm = pad2(now.getMinutes());
14445
14395
  const ss = pad2(now.getSeconds());
14446
- return join15(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
14396
+ return join12(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
14447
14397
  }
14448
14398
 
14449
14399
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
14450
- import { mkdir as mkdir5 } from "node:fs/promises";
14400
+ import { mkdir as mkdir3 } from "node:fs/promises";
14451
14401
  async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
14452
14402
  const acceptedSet = new Set(decisions.accepted);
14453
14403
  const rawComponents = loadRawComponents(db, sessionId);
@@ -14474,17 +14424,17 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
14474
14424
  };
14475
14425
  });
14476
14426
  const paths = await getRefineSessionPaths(sessionId, getRefineArtifactsRoot());
14477
- await mkdir5(paths.sessionDir, { recursive: true });
14427
+ await mkdir3(paths.sessionDir, { recursive: true });
14478
14428
  await saveReviewState(paths.statePath, { components: records });
14479
14429
  }
14480
14430
 
14481
14431
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
14482
- import { readFile as readFile15 } from "node:fs/promises";
14432
+ import { readFile as readFile14 } from "node:fs/promises";
14483
14433
  async function loadAcceptedNames(sessionId) {
14484
14434
  try {
14485
14435
  const artifactsRoot = getRefineArtifactsRoot();
14486
14436
  const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
14487
- const raw = await readFile15(paths.statePath, "utf8");
14437
+ const raw = await readFile14(paths.statePath, "utf8");
14488
14438
  const snapshot = JSON.parse(raw);
14489
14439
  const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
14490
14440
  if (accepted.length === 0)
@@ -14499,7 +14449,7 @@ async function loadAcceptedNames(sessionId) {
14499
14449
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
14500
14450
 
14501
14451
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
14502
- import { randomBytes as randomBytes4 } from "node:crypto";
14452
+ import { randomBytes as randomBytes3 } from "node:crypto";
14503
14453
  var ADJECTIVES2 = [
14504
14454
  "bright",
14505
14455
  "calm",
@@ -14548,7 +14498,7 @@ var NOUNS2 = [
14548
14498
  function generateSessionId2() {
14549
14499
  const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
14550
14500
  const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
14551
- const hex = randomBytes4(2).toString("hex");
14501
+ const hex = randomBytes3(2).toString("hex");
14552
14502
  return `${adj}-${noun}-${hex}`;
14553
14503
  }
14554
14504
 
@@ -15810,11 +15760,11 @@ function formatApiError2(request) {
15810
15760
 
15811
15761
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
15812
15762
  init_shared();
15813
- import { readFile as readFile16, stat as stat4 } from "node:fs/promises";
15763
+ import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
15814
15764
 
15815
15765
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
15816
- import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
15817
- import { join as join16 } from "node:path";
15766
+ import { readdir, stat as stat2 } from "node:fs/promises";
15767
+ import { join as join13 } from "node:path";
15818
15768
  var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
15819
15769
  async function collectJsonFiles(dir) {
15820
15770
  const results = [];
@@ -15824,17 +15774,17 @@ async function collectJsonFiles(dir) {
15824
15774
  async function walk(current, results) {
15825
15775
  let entries;
15826
15776
  try {
15827
- entries = await readdir2(current);
15777
+ entries = await readdir(current);
15828
15778
  } catch {
15829
15779
  return;
15830
15780
  }
15831
15781
  await Promise.all(entries.map(async (entry) => {
15832
15782
  if (IGNORE_TOKEN_DIRS.has(entry))
15833
15783
  return;
15834
- const full = join16(current, entry);
15784
+ const full = join13(current, entry);
15835
15785
  let s;
15836
15786
  try {
15837
- s = await stat3(full);
15787
+ s = await stat2(full);
15838
15788
  } catch {
15839
15789
  return;
15840
15790
  }
@@ -15850,7 +15800,7 @@ async function walk(current, results) {
15850
15800
  async function readTokensFromPath(flag, p) {
15851
15801
  let s;
15852
15802
  try {
15853
- s = await stat4(p);
15803
+ s = await stat3(p);
15854
15804
  } catch {
15855
15805
  throw new Error(`file not found: ${p} (from ${flag})`);
15856
15806
  }
@@ -15869,7 +15819,7 @@ async function readMergedFromDir(flag, dir) {
15869
15819
  const merged = {};
15870
15820
  for (const file of files.sort()) {
15871
15821
  try {
15872
- const text = await readFile16(file, "utf8");
15822
+ const text = await readFile15(file, "utf8");
15873
15823
  const parsed = JSON.parse(text);
15874
15824
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
15875
15825
  Object.assign(merged, parsed);
@@ -15883,7 +15833,7 @@ async function readMergedFromDir(flag, dir) {
15883
15833
  async function readSingleFile(flag, p) {
15884
15834
  let text;
15885
15835
  try {
15886
- text = await readFile16(p, "utf8");
15836
+ text = await readFile15(p, "utf8");
15887
15837
  } catch {
15888
15838
  throw new Error(`file not found: ${p} (from ${flag})`);
15889
15839
  }
@@ -15928,8 +15878,8 @@ function buildContentfulManagementClient(request) {
15928
15878
  }
15929
15879
 
15930
15880
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
15931
- import { writeFile as writeFile6 } from "node:fs/promises";
15932
- import { join as join17 } from "node:path";
15881
+ import { writeFile as writeFile4 } from "node:fs/promises";
15882
+ import { join as join14 } from "node:path";
15933
15883
 
15934
15884
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
15935
15885
  import { fetchAll } from "contentful-management";
@@ -15961,8 +15911,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
15961
15911
  spaceId: request.spaceId,
15962
15912
  environmentId: request.environmentId
15963
15913
  });
15964
- const path5 = join17(request.outDir, ".existing-entities.json");
15965
- await writeFile6(path5, JSON.stringify(entities, null, 2), "utf8");
15914
+ const path5 = join14(request.outDir, ".existing-entities.json");
15915
+ await writeFile4(path5, JSON.stringify(entities, null, 2), "utf8");
15966
15916
  return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
15967
15917
  } catch (error) {
15968
15918
  return {
@@ -15974,12 +15924,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
15974
15924
  }
15975
15925
 
15976
15926
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
15977
- import { readFile as readFile17 } from "node:fs/promises";
15927
+ import { readFile as readFile16 } from "node:fs/promises";
15978
15928
  async function readExistingContentfulEntitiesFromSession(request) {
15979
15929
  if (!request.path)
15980
15930
  return void 0;
15981
15931
  try {
15982
- const raw = await readFile17(request.path, "utf8");
15932
+ const raw = await readFile16(request.path, "utf8");
15983
15933
  const parsed = JSON.parse(raw);
15984
15934
  if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
15985
15935
  return void 0;
@@ -16319,7 +16269,7 @@ init_describe_agent_failure();
16319
16269
  init_resolve_binary();
16320
16270
  init_resolve_skill_path();
16321
16271
  init_parse_map_token_prop_tool_calls();
16322
- import { resolve as resolve20 } from "node:path";
16272
+ import { resolve as resolve19 } from "node:path";
16323
16273
  init_cache_keys();
16324
16274
 
16325
16275
  // packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
@@ -16628,7 +16578,7 @@ async function runMapTokens(request) {
16628
16578
  outDir: process.cwd(),
16629
16579
  existingTokensInline: request.existingEntitiesInline,
16630
16580
  ...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
16631
- ...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve20(request.skillPathOverride) } : {}
16581
+ ...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve19(request.skillPathOverride) } : {}
16632
16582
  });
16633
16583
  if (request.printPrompt) {
16634
16584
  const prompt2 = await buildMapPrompt();
@@ -16687,7 +16637,7 @@ async function runMapTokens(request) {
16687
16637
  }
16688
16638
 
16689
16639
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/run-extract-and-compose-session.js
16690
- import { mkdir as mkdir6 } from "node:fs/promises";
16640
+ import { mkdir as mkdir4 } from "node:fs/promises";
16691
16641
  import { relative as relative2 } from "node:path";
16692
16642
 
16693
16643
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/quality/non-authorable-filter.js
@@ -16744,7 +16694,7 @@ function hasNoAuthoringSurface(component) {
16744
16694
  }
16745
16695
 
16746
16696
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
16747
- import { readFile as readFile18 } from "node:fs/promises";
16697
+ import { readFile as readFile17 } from "node:fs/promises";
16748
16698
 
16749
16699
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
16750
16700
  var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
@@ -16846,7 +16796,7 @@ function dedupeReasons(reasons) {
16846
16796
  async function inspectComponentSource(component) {
16847
16797
  let sourceText = "";
16848
16798
  try {
16849
- sourceText = await readFile18(component.source, "utf8");
16799
+ sourceText = await readFile17(component.source, "utf8");
16850
16800
  } catch {
16851
16801
  return {
16852
16802
  wrapperConfidence: 0,
@@ -17285,7 +17235,7 @@ function resolveCompositionAgentName(flagValue) {
17285
17235
  }
17286
17236
 
17287
17237
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
17288
- import { readFile as readFile19 } from "node:fs/promises";
17238
+ import { readFile as readFile18 } from "node:fs/promises";
17289
17239
  async function readCandidateFiles(components, extraFiles = []) {
17290
17240
  const paths = new Set(extraFiles);
17291
17241
  for (const c2 of components) {
@@ -17295,7 +17245,7 @@ async function readCandidateFiles(components, extraFiles = []) {
17295
17245
  const out = [];
17296
17246
  await Promise.all([...paths].map(async (p) => {
17297
17247
  try {
17298
- const content = await readFile19(p, "utf8");
17248
+ const content = await readFile18(p, "utf8");
17299
17249
  out.push({ path: p, content });
17300
17250
  } catch {
17301
17251
  }
@@ -17409,7 +17359,7 @@ async function runExtractAndComposeSession(request) {
17409
17359
  onProgress,
17410
17360
  onDebugEvent
17411
17361
  });
17412
- await mkdir6(outDir, { recursive: true });
17362
+ await mkdir4(outDir, { recursive: true });
17413
17363
  const { sessionId } = getOrCreateSession(db, void 0, void 0, {
17414
17364
  command: "analyze extract",
17415
17365
  inputPath: projectPath,
@@ -17466,15 +17416,15 @@ init_build_prompt();
17466
17416
  init_create_local_cli_agent_invoker();
17467
17417
  init_invoke_agent_with_output();
17468
17418
  init_parse_token_tool_calls();
17469
- import { readFile as readFile20 } from "node:fs/promises";
17419
+ import { readFile as readFile19 } from "node:fs/promises";
17470
17420
  import { basename as basename5, resolve as pathResolve } from "node:path";
17471
17421
  init_cache_keys();
17472
17422
  init_parse_prompt_overrides();
17473
17423
  init_resolve_prompt_override();
17474
17424
 
17475
17425
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
17476
- import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
17477
- import { join as join18 } from "node:path";
17426
+ import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
17427
+ import { join as join15 } from "node:path";
17478
17428
  async function writeTokensFile(db, sessionId, outDir, onProgress) {
17479
17429
  onProgress?.({ kind: "writing-file" });
17480
17430
  const result = getDtcgTokensForSession(db, sessionId);
@@ -17482,9 +17432,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
17482
17432
  throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
17483
17433
  }
17484
17434
  const tree = rebuildDTCGTree(result.groups, result.tokens);
17485
- const tokensPath = join18(outDir, "tokens.json");
17486
- await mkdir7(outDir, { recursive: true });
17487
- await writeFile7(tokensPath, `${JSON.stringify(tree, null, 2)}
17435
+ const tokensPath = join15(outDir, "tokens.json");
17436
+ await mkdir5(outDir, { recursive: true });
17437
+ await writeFile5(tokensPath, `${JSON.stringify(tree, null, 2)}
17488
17438
  `);
17489
17439
  return { tokensPath, tokenCount: result.tokens.length };
17490
17440
  }
@@ -17499,7 +17449,7 @@ async function runGenerateTokensSession(request) {
17499
17449
  throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
17500
17450
  const tokensOverride = overridesMap.get("tokens");
17501
17451
  const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
17502
- const rawTokensInline = await readFile20(pathResolve(rawTokensPath), "utf8");
17452
+ const rawTokensInline = await readFile19(pathResolve(rawTokensPath), "utf8");
17503
17453
  const tokenInputHash = hashTokenContent(rawTokensInline);
17504
17454
  const db = openPipelineDb();
17505
17455
  try {
@@ -17616,7 +17566,7 @@ async function readExistingEntities(request) {
17616
17566
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
17617
17567
  init_parse_prompt_overrides();
17618
17568
  init_resolve_prompt_override();
17619
- import { resolve as resolve21 } from "node:path";
17569
+ import { resolve as resolve20 } from "node:path";
17620
17570
  async function resolveGeneratePrompt(overrides) {
17621
17571
  const { overrides: parsed, errors } = parsePromptOverrides(overrides);
17622
17572
  if (errors.length > 0)
@@ -17627,7 +17577,7 @@ async function resolveGeneratePrompt(overrides) {
17627
17577
  const text = await resolvePromptOverride(entry);
17628
17578
  if (entry.kind === "text")
17629
17579
  return { text };
17630
- return { path: resolve21(entry.value), text };
17580
+ return { path: resolve20(entry.value), text };
17631
17581
  }
17632
17582
 
17633
17583
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
@@ -18011,7 +17961,7 @@ function PathValidationScreen({
18011
17961
  }) {
18012
17962
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
18013
17963
  const [scan, setScan] = useState7();
18014
- useEffect5(() => {
17964
+ useEffect4(() => {
18015
17965
  setScan(scanFiles(resolvedPath));
18016
17966
  }, [resolvedPath]);
18017
17967
  const phase = phaseOf(scan);
@@ -18038,7 +17988,7 @@ function PathValidationScreen({
18038
17988
  }
18039
17989
 
18040
17990
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
18041
- import { useRef as useRef3, useState as useState9 } from "react";
17991
+ import { useRef as useRef2, useState as useState9 } from "react";
18042
17992
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
18043
17993
 
18044
17994
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
@@ -18290,7 +18240,7 @@ function CredentialsScreen({
18290
18240
  validate: validate3 = validateCredentials,
18291
18241
  tokensOnly = false
18292
18242
  }) {
18293
- const initialValues = useRef3(
18243
+ const initialValues = useRef2(
18294
18244
  normalize({
18295
18245
  spaceId: initial.spaceId ?? "",
18296
18246
  environmentId: initial.environmentId || "master",
@@ -18671,23 +18621,23 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
18671
18621
  init_config();
18672
18622
 
18673
18623
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18674
- import { useEffect as useEffect6, useRef as useRef4, useState as useState11 } from "react";
18624
+ import { useEffect as useEffect5, useRef as useRef3, useState as useState11 } from "react";
18675
18625
 
18676
18626
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
18677
- import { mkdir as mkdir8 } from "node:fs/promises";
18678
- import { join as join20, resolve as resolve24 } from "node:path";
18627
+ import { mkdir as mkdir7 } from "node:fs/promises";
18628
+ import { join as join18, resolve as resolve23 } from "node:path";
18679
18629
 
18680
18630
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
18681
- import { existsSync as existsSync9 } from "node:fs";
18682
- import { dirname as dirname16, join as join19, resolve as resolve22 } from "node:path";
18631
+ import { existsSync as existsSync8 } from "node:fs";
18632
+ import { dirname as dirname15, join as join17, resolve as resolve21 } from "node:path";
18683
18633
  import { fileURLToPath as fileURLToPath4 } from "node:url";
18684
18634
  function findSkillPath(fileName) {
18685
- const thisDir = dirname16(fileURLToPath4(import.meta.url));
18635
+ const thisDir = dirname15(fileURLToPath4(import.meta.url));
18686
18636
  let dir = thisDir;
18687
18637
  for (; ; ) {
18688
- const candidate = join19(dir, "skills", fileName);
18689
- if (existsSync9(candidate)) return candidate;
18690
- const parent = resolve22(dir, "..");
18638
+ const candidate = join17(dir, "skills", fileName);
18639
+ if (existsSync8(candidate)) return candidate;
18640
+ const parent = resolve21(dir, "..");
18691
18641
  if (parent === dir) {
18692
18642
  throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
18693
18643
  }
@@ -18696,11 +18646,11 @@ function findSkillPath(fileName) {
18696
18646
  }
18697
18647
 
18698
18648
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
18699
- import { resolve as resolve23 } from "node:path";
18649
+ import { resolve as resolve22 } from "node:path";
18700
18650
  var SELECT_SKILL_PATH = findSkillPath("select-components.md");
18701
18651
  var DEFAULT_TIMEOUT_MS5 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
18702
18652
  async function hashSelectPrompt(options) {
18703
- const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve23(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
18653
+ const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve22(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
18704
18654
  return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
18705
18655
  }
18706
18656
  async function runSelection(options) {
@@ -18795,7 +18745,7 @@ var realDeps = {
18795
18745
  var fail = (step, message) => ({ ok: false, step, message });
18796
18746
  var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
18797
18747
  async function runExtraction(input, onProgress, deps = realDeps) {
18798
- const outDir = input.outDir ?? join20(resolve24(input.projectPath), ".contentful");
18748
+ const outDir = input.outDir ?? join18(resolve23(input.projectPath), ".contentful");
18799
18749
  let progress = initialProgress({
18800
18750
  hasCredentials: input.credentials !== null,
18801
18751
  hasRawTokens: input.rawTokensPath !== ""
@@ -18899,7 +18849,7 @@ async function runExtraction(input, onProgress, deps = realDeps) {
18899
18849
  }
18900
18850
  async function fetchEntities(credentials, outDir) {
18901
18851
  try {
18902
- await mkdir8(outDir, { recursive: true });
18852
+ await mkdir7(outDir, { recursive: true });
18903
18853
  const result = await fetchAndPersistExistingContentfulEntities({
18904
18854
  spaceId: credentials.spaceId,
18905
18855
  environmentId: credentials.environmentId,
@@ -18919,7 +18869,7 @@ async function resolveSelectionPrompt(overrides) {
18919
18869
  if (select?.kind === "text") return { promptText: select.value };
18920
18870
  if (select?.kind === "path") {
18921
18871
  await resolvePromptOverride(select);
18922
- return { promptPath: resolve24(select.value) };
18872
+ return { promptPath: resolve23(select.value) };
18923
18873
  }
18924
18874
  return {};
18925
18875
  }
@@ -18927,8 +18877,8 @@ async function resolveSelectionPrompt(overrides) {
18927
18877
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18928
18878
  function useExtraction(input) {
18929
18879
  const [state2, setState] = useState11();
18930
- const current = useRef4();
18931
- useEffect6(() => {
18880
+ const current = useRef3();
18881
+ useEffect5(() => {
18932
18882
  current.current = input;
18933
18883
  if (!input) {
18934
18884
  setState(void 0);
@@ -18954,7 +18904,7 @@ function useExtraction(input) {
18954
18904
  }
18955
18905
 
18956
18906
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18957
- import { useEffect as useEffect7, useRef as useRef5, useState as useState12 } from "react";
18907
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState12 } from "react";
18958
18908
 
18959
18909
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
18960
18910
  var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
@@ -18988,8 +18938,8 @@ async function runTokensOnly(input, deps = realDeps2) {
18988
18938
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18989
18939
  function useTokensOnly(input) {
18990
18940
  const [state2, setState] = useState12();
18991
- const current = useRef5();
18992
- useEffect7(() => {
18941
+ const current = useRef4();
18942
+ useEffect6(() => {
18993
18943
  current.current = input;
18994
18944
  if (!input) {
18995
18945
  setState(void 0);
@@ -19248,7 +19198,6 @@ function GotoBanner({
19248
19198
  borderStyle: "single",
19249
19199
  borderColor: PALETTE.accent,
19250
19200
  paddingX: 1,
19251
- paddingBottom: 1,
19252
19201
  marginTop: width === void 0 ? 1 : 0,
19253
19202
  width,
19254
19203
  flexShrink: 0,
@@ -19260,7 +19209,7 @@ function GotoBanner({
19260
19209
  return renderRow(row, i, i === highlightIndex);
19261
19210
  }),
19262
19211
  moreBelow > 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: ` \u25BC ${moreBelow} more` }),
19263
- footerHint !== void 0 && /* @__PURE__ */ jsx24(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint }) })
19212
+ footerHint !== void 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint })
19264
19213
  ]
19265
19214
  }
19266
19215
  );
@@ -20119,7 +20068,7 @@ import React11 from "react";
20119
20068
  import { Box as Box23, Text as Text24 } from "ink";
20120
20069
 
20121
20070
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
20122
- import { useLayoutEffect, useRef as useRef6 } from "react";
20071
+ import { useLayoutEffect, useRef as useRef5 } from "react";
20123
20072
  import { useStdin } from "ink";
20124
20073
  function parseInput(data) {
20125
20074
  const isShiftTab = data === "\x1B[Z";
@@ -20182,7 +20131,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
20182
20131
  }
20183
20132
  function useImmediateInput(handler, enabled = true) {
20184
20133
  const { stdin, setRawMode } = useStdin();
20185
- const handlerRef = useRef6(handler);
20134
+ const handlerRef = useRef5(handler);
20186
20135
  handlerRef.current = handler;
20187
20136
  useLayoutEffect(() => {
20188
20137
  if (!enabled) return;
@@ -20193,7 +20142,7 @@ function useImmediateInput(handler, enabled = true) {
20193
20142
 
20194
20143
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
20195
20144
  import { useStdout as useStdout2 } from "ink";
20196
- import { useEffect as useEffect8, useState as useState13 } from "react";
20145
+ import { useEffect as useEffect7, useState as useState13 } from "react";
20197
20146
  function readTerminalSize(stdout) {
20198
20147
  return {
20199
20148
  columns: stdout?.columns ?? 80,
@@ -20203,7 +20152,7 @@ function readTerminalSize(stdout) {
20203
20152
  function useTerminalSize() {
20204
20153
  const { stdout } = useStdout2();
20205
20154
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
20206
- useEffect8(() => {
20155
+ useEffect7(() => {
20207
20156
  const updateSize = () => setSize(readTerminalSize(stdout));
20208
20157
  stdout?.on("resize", updateSize);
20209
20158
  updateSize();
@@ -20386,7 +20335,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
20386
20335
  }
20387
20336
 
20388
20337
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
20389
- import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef7, useState as useState16 } from "react";
20338
+ import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef6, useState as useState16 } from "react";
20390
20339
 
20391
20340
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
20392
20341
  var TWO_COLUMN_MIN_WIDTH = 100;
@@ -21122,8 +21071,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21122
21071
  for (const p of cycleParticipants) seed.add(p);
21123
21072
  return seed;
21124
21073
  });
21125
- const seededGroupsRef = useRef7(closures.size > 0 || cycleParticipants.size > 0);
21126
- useEffect9(() => {
21074
+ const seededGroupsRef = useRef6(closures.size > 0 || cycleParticipants.size > 0);
21075
+ useEffect8(() => {
21127
21076
  if (seededGroupsRef.current) return;
21128
21077
  if (closures.size === 0 && cycleParticipants.size === 0) return;
21129
21078
  seededGroupsRef.current = true;
@@ -21214,7 +21163,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21214
21163
  entryCount: 0
21215
21164
  });
21216
21165
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
21217
- useEffect9(() => {
21166
+ useEffect8(() => {
21218
21167
  setNav((prev) => {
21219
21168
  const maxIdx = Math.max(0, visibleRows.length - 1);
21220
21169
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -21689,7 +21638,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
21689
21638
  }
21690
21639
 
21691
21640
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
21692
- import { useEffect as useEffect10, useMemo as useMemo5, useRef as useRef8, useState as useState17 } from "react";
21641
+ import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef7, useState as useState17 } from "react";
21693
21642
 
21694
21643
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
21695
21644
  async function checkGenerationCache(input) {
@@ -21736,9 +21685,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
21736
21685
  function useScopeGateFlow(input, deps = realDeps3) {
21737
21686
  const sessionId = input?.sessionId;
21738
21687
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
21739
- const cacheCheck = useRef8(void 0);
21688
+ const cacheCheck = useRef7(void 0);
21740
21689
  const [confirmed, setConfirmed] = useState17();
21741
- useEffect10(() => {
21690
+ useEffect9(() => {
21742
21691
  if (!input || !loaded?.ok || cacheCheck.current) return;
21743
21692
  cacheCheck.current = deps.checkCache(input.cache);
21744
21693
  }, [input, loaded]);
@@ -21765,7 +21714,7 @@ var capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
21765
21714
  function describeGeneration(input) {
21766
21715
  const agent = capitalize(input.agent);
21767
21716
  return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
21768
- ${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
21717
+ ${agent} is reading each selected component and writing a Contentful component definition for it${input.hasTokens ? " Using your design tokens for prop resolution." : ""}`;
21769
21718
  }
21770
21719
  function progressRows2(progress, agent) {
21771
21720
  const name = capitalize(agent);
@@ -21805,10 +21754,10 @@ function GenerationScreen({
21805
21754
  }
21806
21755
 
21807
21756
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21808
- import { useEffect as useEffect11, useRef as useRef9, useState as useState18 } from "react";
21757
+ import { useEffect as useEffect10, useRef as useRef8, useState as useState18 } from "react";
21809
21758
 
21810
21759
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
21811
- import { resolve as resolve25 } from "node:path";
21760
+ import { resolve as resolve24 } from "node:path";
21812
21761
 
21813
21762
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
21814
21763
  async function prepareMapTokens(input, generatedSessionId) {
@@ -21943,7 +21892,7 @@ async function buildMapTokensOptions(input) {
21943
21892
  if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
21944
21893
  if (mapOverride?.kind === "path") {
21945
21894
  await resolvePromptOverride(mapOverride);
21946
- prompt.skillPathOverride = resolve25(mapOverride.value);
21895
+ prompt.skillPathOverride = resolve24(mapOverride.value);
21947
21896
  }
21948
21897
  if (input.existingEntitiesPath) {
21949
21898
  const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
@@ -21970,8 +21919,8 @@ function applyProgressEvent2(event, previous, total) {
21970
21919
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21971
21920
  function useGeneration(input) {
21972
21921
  const [state2, setState] = useState18();
21973
- const current = useRef9();
21974
- useEffect11(() => {
21922
+ const current = useRef8();
21923
+ useEffect10(() => {
21975
21924
  current.current = input;
21976
21925
  if (!input) {
21977
21926
  setState(void 0);
@@ -21991,7 +21940,7 @@ function useGeneration(input) {
21991
21940
  }
21992
21941
 
21993
21942
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
21994
- import { join as join21 } from "node:path";
21943
+ import { join as join19 } from "node:path";
21995
21944
  function buildFlowStart(input) {
21996
21945
  const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
21997
21946
  const credentials = extraction.credentials ?? {
@@ -22004,7 +21953,7 @@ function buildFlowStart(input) {
22004
21953
  handoff,
22005
21954
  agent: extraction.agent,
22006
21955
  projectPath: extraction.projectPath,
22007
- outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
21956
+ outDir: extraction.projectPath ? join19(extraction.projectPath, ".contentful") : "",
22008
21957
  rawTokensPath: extraction.rawTokensPath,
22009
21958
  credentials: {
22010
21959
  spaceId: credentials.spaceId,
@@ -22364,7 +22313,7 @@ function PreviewValidationErrorScreen({
22364
22313
  }
22365
22314
 
22366
22315
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
22367
- import { useCallback as useCallback5, useEffect as useEffect18, useMemo as useMemo6, useRef as useRef14, useState as useState26 } from "react";
22316
+ import { useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo6, useRef as useRef13, useState as useState26 } from "react";
22368
22317
  import figures8 from "figures";
22369
22318
 
22370
22319
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
@@ -22625,7 +22574,7 @@ function enumerateCycleBreaks(cycle, components) {
22625
22574
  import { Box as Box32, Text as Text34 } from "ink";
22626
22575
 
22627
22576
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
22628
- import React13, { useEffect as useEffect12, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22577
+ import React13, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22629
22578
  import figures6 from "figures";
22630
22579
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
22631
22580
 
@@ -23423,7 +23372,6 @@ function FieldEditor({
23423
23372
  const [rationaleOpen, setRationaleOpen] = useState19(false);
23424
23373
  const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
23425
23374
  const [showHelp, setShowHelp] = useState19(false);
23426
- const [pendingDelete, setPendingDelete] = useState19(null);
23427
23375
  const props = editorState.props;
23428
23376
  const slots = editorState.slots;
23429
23377
  const contentPropIndexes = React13.useMemo(
@@ -23515,46 +23463,6 @@ function FieldEditor({
23515
23463
  setEditorState(next);
23516
23464
  onChange(serializeState(next, value));
23517
23465
  };
23518
- const deleteRow = (row) => {
23519
- if (row.kind === "prop") {
23520
- const nextProps = removeAt(editorState.props, row.idx);
23521
- commit({ ...editorState, props: nextProps });
23522
- setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
23523
- const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
23524
- const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23525
- if (!neighbour2) {
23526
- setInSlots(false);
23527
- setInComponentDesc(true);
23528
- setFocusLevel("componentDescription");
23529
- } else if (neighbour2.kind === "prop") {
23530
- setInSlots(false);
23531
- setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
23532
- setFocusLevel("prop");
23533
- } else {
23534
- setInSlots(true);
23535
- setSlotIdx(neighbour2.idx);
23536
- setFocusLevel("slot");
23537
- }
23538
- return;
23539
- }
23540
- const nextSlots = removeAt(editorState.slots, row.idx);
23541
- commit({ ...editorState, slots: nextSlots });
23542
- const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
23543
- const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23544
- if (!neighbour) {
23545
- setInSlots(false);
23546
- setInComponentDesc(true);
23547
- setFocusLevel("componentDescription");
23548
- } else if (neighbour.kind === "slot") {
23549
- setInSlots(true);
23550
- setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
23551
- setFocusLevel("slot");
23552
- } else {
23553
- setInSlots(false);
23554
- setPropIdx(neighbour.idx);
23555
- setFocusLevel("prop");
23556
- }
23557
- };
23558
23466
  const canonicalize = React13.useCallback((json) => {
23559
23467
  try {
23560
23468
  return JSON.stringify(JSON.parse(json));
@@ -23591,11 +23499,6 @@ function FieldEditor({
23591
23499
  onSave();
23592
23500
  return;
23593
23501
  }
23594
- if (pendingDelete) {
23595
- if (input === "y") deleteRow(pendingDelete);
23596
- setPendingDelete(null);
23597
- return;
23598
- }
23599
23502
  const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
23600
23503
  const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
23601
23504
  const inValueListTextEntry = editingValue != null;
@@ -23795,11 +23698,6 @@ function FieldEditor({
23795
23698
  }
23796
23699
  return;
23797
23700
  }
23798
- if (input === "d" && !key.ctrl && !key.meta) {
23799
- if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
23800
- if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
23801
- return;
23802
- }
23803
23701
  if (focusLevel === "slot" && key.return && currentSlot) {
23804
23702
  setFocusLevel("field");
23805
23703
  setActiveField(SLOT_FIELDS[0] ?? null);
@@ -24106,10 +24004,6 @@ function FieldEditor({
24106
24004
  }
24107
24005
  const hasEmptyProperties = props.length === 0 && slots.length === 0;
24108
24006
  const modeLabel = (() => {
24109
- if (pendingDelete) {
24110
- const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
24111
- return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
24112
- }
24113
24007
  if (editingValue) {
24114
24008
  return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
24115
24009
  }
@@ -24131,7 +24025,7 @@ function FieldEditor({
24131
24025
  if (rationaleOpen) {
24132
24026
  return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
24133
24027
  }
24134
- return `[\u2191\u2193] navigate [Enter] edit fields [d] delete property [h] help [s] source [Esc] exit panel`;
24028
+ return `[\u2191\u2193] navigate rows [Enter] edit fields [s] source [${propRationaleKey}] prop rationale [${componentRationaleKey}] component rationale [h] help [Esc] exit panel`;
24135
24029
  })();
24136
24030
  const rows = [];
24137
24031
  rows.push({ kind: "component-description" });
@@ -24183,7 +24077,7 @@ function FieldEditor({
24183
24077
  }
24184
24078
  return Math.max(start + 1, end2);
24185
24079
  };
24186
- useEffect12(() => {
24080
+ useEffect11(() => {
24187
24081
  if (focusLevel === "field" || selectedRowIdx < 0) return;
24188
24082
  setListScrollStart((previous) => {
24189
24083
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -24397,7 +24291,6 @@ function FieldEditor({
24397
24291
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
24398
24292
  /* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
24399
24293
  /* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
24400
- /* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
24401
24294
  /* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
24402
24295
  /* @__PURE__ */ jsx32(Text27, { children: " " }),
24403
24296
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
@@ -24421,7 +24314,7 @@ function FieldEditor({
24421
24314
  /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
24422
24315
  ] }),
24423
24316
  validationError && /* @__PURE__ */ jsx32(Text27, { color: PALETTE.error, children: "\u2717 " + validationError }),
24424
- /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: pendingDelete ? PALETTE.text : PALETTE.muted, children: modeLabel }) })
24317
+ /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: modeLabel }) })
24425
24318
  ]
24426
24319
  }
24427
24320
  );
@@ -24760,8 +24653,8 @@ function TokenReviewPanel({
24760
24653
  borderStyle: "single",
24761
24654
  borderColor: active ? PALETTE.text : void 0,
24762
24655
  children: [
24763
- /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, wrap: "truncate", children: `Review mapped tokens \u2014 ${componentName} \xB7 ${current.propName}${current.kinds.length > 0 ? ` (${current.kinds.join(", ")})` : ""}` }),
24764
- /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `Tick the tokens this property may use (${rangeLabel}).` }),
24656
+ /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, wrap: "truncate", children: `TOKEN REVIEW \u2014 ${componentName} \xB7 ${current.propName} (edit allowed)` }),
24657
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `select which tokens are allowed (${rangeLabel})` }),
24765
24658
  /* @__PURE__ */ jsx39(Text32, { children: " " }),
24766
24659
  current.paths.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no compatible tokens found for this token kind)" }),
24767
24660
  visiblePaths.map((path5, i) => {
@@ -24794,33 +24687,18 @@ function TokenReviewPanel({
24794
24687
  borderStyle: "single",
24795
24688
  borderColor: active ? PALETTE.text : void 0,
24796
24689
  children: [
24797
- /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `Review mapped tokens \u2014 ${componentName}` }),
24798
- /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `${componentName} has ${suggestions.length} design ${suggestions.length === 1 ? "prop" : "props"} of type token. Select which tokens are allowed for each property.` }),
24799
- /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: "Suggested tokens come from the agent. Allowed tokens are what editors can pick in Contentful." }),
24800
- /* @__PURE__ */ jsx39(Text32, { children: " " }),
24690
+ /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `TOKEN REVIEW \u2014 ${componentName}` }),
24801
24691
  suggestions.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no token suggestions for this component)" }),
24802
24692
  suggestions.map((s, i) => {
24803
24693
  const focused = i === selectedRow;
24804
24694
  return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", children: [
24805
- /* @__PURE__ */ jsx39(Box31, { children: /* @__PURE__ */ jsx39(Text32, { color: focused ? PALETTE.accent : active ? void 0 : PALETTE.muted, bold: focused, children: `${focused ? figures7.pointer : " "} ${s.propName}${s.kinds.length > 0 ? ` (${s.kinds.join(", ")})` : ""}` }) }),
24806
- /* @__PURE__ */ jsx39(
24807
- Text32,
24808
- {
24809
- color: PALETTE.muted,
24810
- children: ` suggested: ${s.suggested.length > 0 ? s.suggested.join(", ") : "none"}`
24811
- }
24812
- ),
24813
- /* @__PURE__ */ jsx39(
24814
- Text32,
24815
- {
24816
- color: PALETTE.muted,
24817
- children: ` allowed: ${s.allowed.length > 0 ? s.allowed.join(", ") : "none (any token)"}`
24818
- }
24819
- ),
24820
- /* @__PURE__ */ jsx39(Text32, { children: " " })
24695
+ /* @__PURE__ */ jsx39(Box31, { children: /* @__PURE__ */ jsx39(Text32, { color: focused ? PALETTE.accent : active ? void 0 : PALETTE.muted, bold: focused, children: `${focused ? figures7.pointer : " "} ${s.propName}` }) }),
24696
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: ` suggested: ${s.suggested.join(", ")}` }),
24697
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: ` allowed: ${s.allowed.join(", ")}` })
24821
24698
  ] }, s.propName);
24822
24699
  }),
24823
- /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "[\u2191/\u2193] move [Enter] edit allowed tokens [Esc] close" })
24700
+ /* @__PURE__ */ jsx39(Text32, { children: " " }),
24701
+ /* @__PURE__ */ jsx39(Text32, { children: "[\u2191/\u2193] move [Enter] edit allowed [Esc] close" })
24824
24702
  ]
24825
24703
  }
24826
24704
  );
@@ -25068,9 +24946,15 @@ function ReviewFinalizeError({
25068
24946
  function ReviewPanelFooter({
25069
24947
  reviewEditor,
25070
24948
  sidebarFocused,
25071
- sidebarFooter
24949
+ sidebarFooter,
24950
+ livePreview,
24951
+ livePreviewSpinner
25072
24952
  }) {
25073
- return /* @__PURE__ */ jsx42(Fragment10, { children: reviewEditor.panelOpen === "token-review" ? "" : sidebarFocused ? sidebarFooter : reviewEditor.showJson ? " [\u2191\u2193] scroll [Ctrl+u/d] half-page [gg/G] top/bottom [Tab] focus list" : " [Tab] focus list [Enter] edit fields" + (reviewEditor.currentTokenSuggestions().length > 0 ? " [t] review mapped tokens" : "") });
24953
+ return /* @__PURE__ */ jsxs32(Fragment10, { children: [
24954
+ reviewEditor.panelOpen === "token-review" ? " [\u2191/\u2193] move [Enter] edit allowed [Esc] close" : sidebarFocused ? sidebarFooter : reviewEditor.showJson ? " [\u2191\u2193] scroll [Ctrl+u/d] half-page [gg/G] top/bottom [Tab] focus list" : " [Tab] focus list (edit fields)" + (reviewEditor.currentTokenSuggestions().length > 0 ? " [t] token review" : ""),
24955
+ livePreview.status === "running" && /* @__PURE__ */ jsx42(Text34, { children: ` ${livePreviewSpinner} live preview` }),
24956
+ livePreview.disabled && /* @__PURE__ */ jsx42(Text34, { children: " \xB7 live preview disabled" })
24957
+ ] });
25074
24958
  }
25075
24959
  function ReviewComponentTitle({
25076
24960
  selectedKey,
@@ -25104,7 +24988,9 @@ function ReviewComponentPanel({
25104
24988
  sidebarFocused,
25105
24989
  fieldEditor,
25106
24990
  saveError,
25107
- sidebarFooter
24991
+ sidebarFooter,
24992
+ livePreview,
24993
+ livePreviewSpinner
25108
24994
  }) {
25109
24995
  const propCount = Object.keys(selectedEntry.$properties).length;
25110
24996
  const slotCount = selectedEntry.$slots ? Object.keys(selectedEntry.$slots).length : 0;
@@ -25141,7 +25027,9 @@ function ReviewComponentPanel({
25141
25027
  {
25142
25028
  reviewEditor,
25143
25029
  sidebarFocused,
25144
- sidebarFooter
25030
+ sidebarFooter,
25031
+ livePreview,
25032
+ livePreviewSpinner
25145
25033
  }
25146
25034
  ) }) })
25147
25035
  ] }) });
@@ -25255,7 +25143,7 @@ function finalizeReviewSession(extractSessionId, components) {
25255
25143
  }
25256
25144
 
25257
25145
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
25258
- import { useCallback as useCallback2, useEffect as useEffect14, useRef as useRef11, useState as useState21 } from "react";
25146
+ import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef10, useState as useState21 } from "react";
25259
25147
 
25260
25148
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
25261
25149
  var DEFAULT_MAX_DEPTH = 50;
@@ -25311,7 +25199,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
25311
25199
  }
25312
25200
 
25313
25201
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
25314
- import { useEffect as useEffect13, useRef as useRef10, useState as useState20 } from "react";
25202
+ import { useEffect as useEffect12, useRef as useRef9, useState as useState20 } from "react";
25315
25203
 
25316
25204
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
25317
25205
  var TimeoutError = class extends Error {
@@ -25469,9 +25357,9 @@ function useFinalizePreview(opts) {
25469
25357
  const [status, setStatus] = useState20("idle");
25470
25358
  const [removed, setRemoved] = useState20([]);
25471
25359
  const [scrollOffset, setScrollOffset] = useState20(0);
25472
- const generationRef = useRef10(0);
25360
+ const generationRef = useRef9(0);
25473
25361
  const acceptedKey = [...acceptedKeys].sort().join("\0");
25474
- useEffect13(() => {
25362
+ useEffect12(() => {
25475
25363
  if (!open) {
25476
25364
  setStatus("idle");
25477
25365
  setRemoved([]);
@@ -25534,7 +25422,7 @@ function useReviewSession({
25534
25422
  }));
25535
25423
  return { result, catalog };
25536
25424
  }, [loadSession, tokensPath]);
25537
- useEffect14(() => {
25425
+ useEffect13(() => {
25538
25426
  let disposed = false;
25539
25427
  void (async () => {
25540
25428
  try {
@@ -25587,7 +25475,7 @@ function useReviewSession({
25587
25475
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25588
25476
  const [reviewMetadata, setReviewMetadata] = useState21(null);
25589
25477
  const [componentRationale, setComponentRationale] = useState21(null);
25590
- useEffect14(() => {
25478
+ useEffect13(() => {
25591
25479
  const current = components[selectedIdx];
25592
25480
  if (!current) {
25593
25481
  setReviewMetadata(null);
@@ -25617,9 +25505,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25617
25505
  return { reviewMetadata, componentRationale };
25618
25506
  }
25619
25507
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
25620
- const historyRef = useRef11(null);
25621
- const historySeededRef = useRef11(false);
25622
- useEffect14(() => {
25508
+ const historyRef = useRef10(null);
25509
+ const historySeededRef = useRef10(false);
25510
+ useEffect13(() => {
25623
25511
  if (loading || historySeededRef.current) return;
25624
25512
  historySeededRef.current = true;
25625
25513
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -25670,7 +25558,7 @@ function useReviewFinalize({
25670
25558
  }
25671
25559
 
25672
25560
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
25673
- import { useEffect as useEffect15, useRef as useRef12, useState as useState22 } from "react";
25561
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState22 } from "react";
25674
25562
 
25675
25563
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
25676
25564
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -25685,7 +25573,7 @@ function collectTokenSuggestions(entry, availableTokens = []) {
25685
25573
  const compatiblePaths = new Set(compatible);
25686
25574
  const allowed = availableTokens.length > 0 ? persistedAllowed.filter((path5) => compatiblePaths.has(path5)) : persistedAllowed;
25687
25575
  const paths = availableTokens.length > 0 ? compatible : allowed;
25688
- return { propName, kinds, paths, suggested: [...allowed], allowed };
25576
+ return { propName, paths, suggested: [...allowed], allowed };
25689
25577
  });
25690
25578
  }
25691
25579
 
@@ -25721,9 +25609,9 @@ function useReviewEditor({
25721
25609
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
25722
25610
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
25723
25611
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
25724
- const tokenReviewSuggestedRef = useRef12(/* @__PURE__ */ new Map());
25725
- const pendingGRef = useRef12(false);
25726
- useEffect15(() => {
25612
+ const tokenReviewSuggestedRef = useRef11(/* @__PURE__ */ new Map());
25613
+ const pendingGRef = useRef11(false);
25614
+ useEffect14(() => {
25727
25615
  setTokenReviewRow(0);
25728
25616
  setTokenReviewEditing(false);
25729
25617
  setTokenReviewEditCursor(0);
@@ -26135,7 +26023,7 @@ function handleJsonPanelInput(input, key, state2) {
26135
26023
  }
26136
26024
 
26137
26025
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
26138
- import { useCallback as useCallback4, useEffect as useEffect17, useState as useState25 } from "react";
26026
+ import { useCallback as useCallback4, useEffect as useEffect16, useState as useState25 } from "react";
26139
26027
 
26140
26028
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
26141
26029
  function applyPreviewAnnotations(preview, localNames) {
@@ -26170,25 +26058,25 @@ function applyPreviewAnnotations(preview, localNames) {
26170
26058
  }
26171
26059
 
26172
26060
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
26173
- import { useCallback as useCallback3, useEffect as useEffect16, useRef as useRef13, useState as useState24 } from "react";
26061
+ import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef12, useState as useState24 } from "react";
26174
26062
  var DEFAULT_DEBOUNCE_MS = 500;
26175
26063
  function useLivePreview(opts) {
26176
26064
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
26177
26065
  const [status, setStatus] = useState24("idle");
26178
26066
  const [disabled, setDisabled] = useState24(false);
26179
- const timerRef = useRef13(null);
26180
- const generationRef = useRef13(0);
26181
- const latestRef = useRef13(0);
26182
- const inflightRef = useRef13(0);
26183
- const optsRef = useRef13(opts);
26184
- useEffect16(() => {
26067
+ const timerRef = useRef12(null);
26068
+ const generationRef = useRef12(0);
26069
+ const latestRef = useRef12(0);
26070
+ const inflightRef = useRef12(0);
26071
+ const optsRef = useRef12(opts);
26072
+ useEffect15(() => {
26185
26073
  optsRef.current = opts;
26186
26074
  });
26187
- const disabledRef = useRef13(disabled);
26188
- useEffect16(() => {
26075
+ const disabledRef = useRef12(disabled);
26076
+ useEffect15(() => {
26189
26077
  disabledRef.current = disabled;
26190
26078
  }, [disabled]);
26191
- useEffect16(() => {
26079
+ useEffect15(() => {
26192
26080
  return () => {
26193
26081
  if (timerRef.current) {
26194
26082
  clearTimeout(timerRef.current);
@@ -26302,13 +26190,13 @@ function useReviewPreview({
26302
26190
  deleteAllComponents
26303
26191
  });
26304
26192
  const [spinnerTick, setSpinnerTick] = useState25(0);
26305
- useEffect17(() => {
26193
+ useEffect16(() => {
26306
26194
  if (livePreviewHook.status !== "running") return;
26307
26195
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
26308
26196
  return () => clearInterval(id);
26309
26197
  }, [livePreviewHook.status]);
26310
26198
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
26311
- useEffect17(() => {
26199
+ useEffect16(() => {
26312
26200
  if (loading) return;
26313
26201
  if (!livePreview) return;
26314
26202
  if (components.length === 0) return;
@@ -26481,7 +26369,7 @@ var HELP_SECTIONS2 = [
26481
26369
  { keys: "P", label: "Component rationale" },
26482
26370
  { keys: "s", label: "Source code snippet" },
26483
26371
  { keys: "J", label: "Toggle JSON" },
26484
- { keys: "t", label: "Review mapped tokens" }
26372
+ { keys: "t", label: "Token review" }
26485
26373
  ]
26486
26374
  },
26487
26375
  {
@@ -26621,7 +26509,7 @@ function GenerateReviewStepView({
26621
26509
  setFinalizeError
26622
26510
  } = reviewSurface;
26623
26511
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
26624
- const removedBannerDefaultedRef = useRef14(false);
26512
+ const removedBannerDefaultedRef = useRef13(false);
26625
26513
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
26626
26514
  const [cyclesCursor, setCyclesCursor] = useState26(0);
26627
26515
  const cyclePanel = useOverlayPanel({
@@ -26641,7 +26529,7 @@ function GenerateReviewStepView({
26641
26529
  const [breakCursor, setBreakCursor] = useState26(0);
26642
26530
  const [breakConfirm, setBreakConfirm] = useState26(false);
26643
26531
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
26644
- const seededGroupsRef = useRef14(false);
26532
+ const seededGroupsRef = useRef13(false);
26645
26533
  const {
26646
26534
  searchOpen,
26647
26535
  setSearchOpen,
@@ -26665,7 +26553,7 @@ function GenerateReviewStepView({
26665
26553
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
26666
26554
  const [autoRejected, setAutoRejected] = useState26([]);
26667
26555
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
26668
- const autoRejectFiredRef = useRef14(false);
26556
+ const autoRejectFiredRef = useRef13(false);
26669
26557
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
26670
26558
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
26671
26559
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -26728,7 +26616,7 @@ function GenerateReviewStepView({
26728
26616
  [components]
26729
26617
  );
26730
26618
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
26731
- useEffect18(() => {
26619
+ useEffect17(() => {
26732
26620
  if (seededGroupsRef.current) return;
26733
26621
  if (closures.size === 0 && slotCycles.length === 0) return;
26734
26622
  seededGroupsRef.current = true;
@@ -26755,7 +26643,7 @@ function GenerateReviewStepView({
26755
26643
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
26756
26644
  }));
26757
26645
  }, [slotCycles, cycleView]);
26758
- useEffect18(() => {
26646
+ useEffect17(() => {
26759
26647
  const decision = computeAutoRejectDecision({
26760
26648
  loading,
26761
26649
  autoRejectFired: autoRejectFiredRef.current,
@@ -26798,8 +26686,8 @@ function GenerateReviewStepView({
26798
26686
  }),
26799
26687
  applySnapshot: applyHistorySnapshot
26800
26688
  });
26801
- const autoRejectPushedRef = useRef14(false);
26802
- useEffect18(() => {
26689
+ const autoRejectPushedRef = useRef13(false);
26690
+ useEffect17(() => {
26803
26691
  if (loading) return;
26804
26692
  if (!historySeededRef.current) return;
26805
26693
  if (!autoRejectFiredRef.current) return;
@@ -26883,7 +26771,7 @@ function GenerateReviewStepView({
26883
26771
  const panelHeight = leftPanelHeight + 2;
26884
26772
  const panelContentHeight = Math.max(1, panelHeight - 3);
26885
26773
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
26886
- useEffect18(() => {
26774
+ useEffect17(() => {
26887
26775
  if (selectableRowPositions.length === 0) return;
26888
26776
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
26889
26777
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -27629,7 +27517,9 @@ function GenerateReviewStepView({
27629
27517
  initialFocusTarget: pendingEditorFocus && pendingEditorFocus.componentName === selected.key ? pendingEditorFocus.target : { kind: "description" }
27630
27518
  }
27631
27519
  ),
27632
- saveError: reviewEditor.saveError
27520
+ saveError: reviewEditor.saveError,
27521
+ livePreview: livePreviewHook,
27522
+ livePreviewSpinner
27633
27523
  }
27634
27524
  ) : /* @__PURE__ */ jsx48(ReviewNoSelection, {})
27635
27525
  ] }),
@@ -27661,7 +27551,7 @@ function GenerateReviewStepView({
27661
27551
  hidden: dialogOpen
27662
27552
  }
27663
27553
  ),
27664
- !dialogOpen && sidebarFocused && reviewEditor.panelOpen !== "token-review" && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
27554
+ !dialogOpen && sidebarFocused && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
27665
27555
  ] });
27666
27556
  }
27667
27557
 
@@ -27806,11 +27696,11 @@ function DoneStep({
27806
27696
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
27807
27697
  import { useState as useState28 } from "react";
27808
27698
  import { Box as Box42, Text as Text44 } from "ink";
27809
- import { readdirSync as readdirSync4 } from "node:fs";
27810
- import { dirname as dirname17, basename as basename6, join as join22 } from "node:path";
27699
+ import { readdirSync as readdirSync3 } from "node:fs";
27700
+ import { dirname as dirname16, basename as basename6, join as join20 } from "node:path";
27811
27701
 
27812
27702
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
27813
- import { resolve as resolve26 } from "node:path";
27703
+ import { resolve as resolve25 } from "node:path";
27814
27704
  import { homedir as homedir4 } from "node:os";
27815
27705
  function expandTilde(input) {
27816
27706
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -27824,14 +27714,14 @@ function normalizePath(input) {
27824
27714
  p = p.slice(1, -1);
27825
27715
  }
27826
27716
  p = expandTilde(p);
27827
- return resolve26(p);
27717
+ return resolve25(p);
27828
27718
  }
27829
27719
 
27830
27720
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
27831
- import { useEffect as useEffect19, useState as useState27 } from "react";
27721
+ import { useEffect as useEffect18, useState as useState27 } from "react";
27832
27722
  function useBlinkingCursor() {
27833
27723
  const [visible, setVisible] = useState27(true);
27834
- useEffect19(() => {
27724
+ useEffect18(() => {
27835
27725
  const interval = setInterval(() => setVisible((current) => !current), 500);
27836
27726
  return () => clearInterval(interval);
27837
27727
  }, []);
@@ -27843,23 +27733,23 @@ import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
27843
27733
  function autocomplete(partial) {
27844
27734
  if (!partial) return null;
27845
27735
  const normalized = normalizePath(partial);
27846
- const dir = dirname17(normalized);
27736
+ const dir = dirname16(normalized);
27847
27737
  const base = basename6(normalized);
27848
27738
  let entries;
27849
27739
  try {
27850
- entries = readdirSync4(dir);
27740
+ entries = readdirSync3(dir);
27851
27741
  } catch {
27852
27742
  return null;
27853
27743
  }
27854
27744
  const matches = entries.filter((e) => e.startsWith(base));
27855
27745
  if (matches.length === 0) return null;
27856
- if (matches.length === 1) return join22(dir, matches[0]);
27746
+ if (matches.length === 1) return join20(dir, matches[0]);
27857
27747
  let prefix = matches[0];
27858
27748
  for (const m of matches) {
27859
27749
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
27860
27750
  if (!prefix) break;
27861
27751
  }
27862
- return prefix.length > base.length ? join22(dir, prefix) : null;
27752
+ return prefix.length > base.length ? join20(dir, prefix) : null;
27863
27753
  }
27864
27754
  function PathPrompt({
27865
27755
  defaultPath,
@@ -27947,12 +27837,12 @@ function countedThings({ components, tokens }, counts = {}) {
27947
27837
  }
27948
27838
 
27949
27839
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
27950
- import { useEffect as useEffect20, useState as useState29 } from "react";
27840
+ import { useEffect as useEffect19, useState as useState29 } from "react";
27951
27841
  import { Spinner as Spinner2 } from "@inkjs/ui";
27952
27842
  import { jsx as jsx53 } from "react/jsx-runtime";
27953
27843
  function useTimedSpinner() {
27954
27844
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
27955
- useEffect20(() => {
27845
+ useEffect19(() => {
27956
27846
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
27957
27847
  return () => {
27958
27848
  clearInterval(timer);
@@ -28010,7 +27900,7 @@ function PushingStep({ progress, produced, counts }) {
28010
27900
  }
28011
27901
 
28012
27902
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
28013
- import { useEffect as useEffect21, useState as useState30, useMemo as useMemo7 } from "react";
27903
+ import { useEffect as useEffect20, useState as useState30, useMemo as useMemo7 } from "react";
28014
27904
  import { Box as Box44, Text as Text46 } from "ink";
28015
27905
 
28016
27906
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -28151,20 +28041,12 @@ function diffProperty(name, old, newDef) {
28151
28041
  diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
28152
28042
  return diffs;
28153
28043
  }
28154
- function formatDefault(value) {
28155
- const sys = value?.sys;
28156
- if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
28157
- const name = sys.urn.split("/designTokens/")[1];
28158
- if (name) return name;
28159
- }
28160
- return JSON.stringify(value);
28161
- }
28162
28044
  function formatOldProp(prop) {
28163
28045
  const parts = [];
28164
28046
  if (prop.type) parts.push(prop.type);
28165
28047
  if (prop.category) parts.push(prop.category);
28166
28048
  parts.push(prop.required ? "required" : "optional");
28167
- if (prop.default !== void 0) parts.push(`default=${formatDefault(prop.default)}`);
28049
+ if (prop.default !== void 0) parts.push(`default=${JSON.stringify(prop.default)}`);
28168
28050
  return parts.join(", ");
28169
28051
  }
28170
28052
  function formatPropDef(def) {
@@ -28173,7 +28055,7 @@ function formatPropDef(def) {
28173
28055
  if (def["$category"]) parts.push(def["$category"]);
28174
28056
  if (def["$required"] === true) parts.push("required");
28175
28057
  else parts.push("optional");
28176
- if (def["$default"] !== void 0) parts.push(`default=${formatDefault(def["$default"])}`);
28058
+ if (def["$default"] !== void 0) parts.push(`default=${JSON.stringify(def["$default"])}`);
28177
28059
  return parts.join(", ");
28178
28060
  }
28179
28061
 
@@ -28405,7 +28287,7 @@ function WizardPreviewStep({
28405
28287
  const activeLines = diffExpanded ? diffLines : summaryLines;
28406
28288
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
28407
28289
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
28408
- useEffect21(() => {
28290
+ useEffect20(() => {
28409
28291
  setScrollOffset((previous) => Math.min(previous, maxScroll));
28410
28292
  }, [maxScroll]);
28411
28293
  useImmediateInput((input, key) => {
@@ -28623,13 +28505,13 @@ function FlowScreen({
28623
28505
  }
28624
28506
 
28625
28507
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
28626
- import { useEffect as useEffect22, useRef as useRef15, useSyncExternalStore } from "react";
28508
+ import { useEffect as useEffect21, useRef as useRef14, useSyncExternalStore } from "react";
28627
28509
 
28628
28510
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28629
28511
  import { appendFileSync, writeFileSync } from "node:fs";
28630
- import { mkdir as mkdir9 } from "node:fs/promises";
28512
+ import { mkdir as mkdir8 } from "node:fs/promises";
28631
28513
  import { tmpdir } from "node:os";
28632
- import { join as join24, resolve as resolve27 } from "node:path";
28514
+ import { join as join22, resolve as resolve26 } from "node:path";
28633
28515
 
28634
28516
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
28635
28517
  function shouldBypassPreview(state2) {
@@ -28976,8 +28858,8 @@ function pushFailure(e, deps) {
28976
28858
  }
28977
28859
 
28978
28860
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
28979
- import { writeFile as writeFile8 } from "node:fs/promises";
28980
- import { join as join23 } from "node:path";
28861
+ import { writeFile as writeFile7 } from "node:fs/promises";
28862
+ import { join as join21 } from "node:path";
28981
28863
 
28982
28864
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
28983
28865
  function nextStateAfterPrint(opts) {
@@ -29000,7 +28882,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
29000
28882
  var realSaveDeps = () => ({
29001
28883
  openDb: openPipelineDb,
29002
28884
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
29003
- writeFile: (path5, contents) => writeFile8(path5, contents),
28885
+ writeFile: (path5, contents) => writeFile7(path5, contents),
29004
28886
  appendRun,
29005
28887
  buildSourceFingerprint,
29006
28888
  sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
@@ -29008,7 +28890,7 @@ var realSaveDeps = () => ({
29008
28890
  });
29009
28891
  async function runPrintFiles(input, deps, onPatch) {
29010
28892
  onPatch({ step: "printing" });
29011
- const componentsPath = join23(input.outDir, "components.json");
28893
+ const componentsPath = join21(input.outDir, "components.json");
29012
28894
  try {
29013
28895
  const db = deps.openDb();
29014
28896
  let components = [];
@@ -29089,7 +28971,7 @@ var EMPTY_PUSH_RESULT = {
29089
28971
  };
29090
28972
 
29091
28973
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
29092
- var WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
28974
+ var WIZARD_LOG = join22(tmpdir(), "experiences-import-wizard.log");
29093
28975
  function appendWizardLog(entry) {
29094
28976
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
29095
28977
  }
@@ -29112,7 +28994,7 @@ function realFlowDeps() {
29112
28994
  }
29113
28995
  },
29114
28996
  mkdir: async (path5) => {
29115
- await mkdir9(path5, { recursive: true });
28997
+ await mkdir8(path5, { recursive: true });
29116
28998
  },
29117
28999
  detectSaveConflict,
29118
29000
  buildTimestampedSubdir,
@@ -29342,7 +29224,7 @@ function createFlowController(start, deps) {
29342
29224
  },
29343
29225
  async submitPath(submitted) {
29344
29226
  await deps.mkdir(submitted);
29345
- if (resolve27(submitted) !== resolve27(state2.outDir) && await deps.detectSaveConflict(submitted)) {
29227
+ if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
29346
29228
  const subdir = deps.buildTimestampedSubdir(submitted);
29347
29229
  await deps.mkdir(subdir);
29348
29230
  await proceedToWrite(subdir);
@@ -29365,7 +29247,7 @@ function createFlowController(start, deps) {
29365
29247
 
29366
29248
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
29367
29249
  function useFlow(start, options = {}) {
29368
- const controller = useRef15();
29250
+ const controller = useRef14();
29369
29251
  if (start && !controller.current) {
29370
29252
  try {
29371
29253
  startWizardLog();
@@ -29382,14 +29264,14 @@ function useFlow(start, options = {}) {
29382
29264
  (listener) => current?.subscribe(listener) ?? (() => void 0),
29383
29265
  () => current?.getState()
29384
29266
  );
29385
- useEffect22(() => {
29267
+ useEffect21(() => {
29386
29268
  if (!start) controller.current = void 0;
29387
29269
  }, [start]);
29388
29270
  return current && state2 ? { controller: current, state: state2 } : void 0;
29389
29271
  }
29390
29272
 
29391
29273
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
29392
- import { useEffect as useEffect23, useState as useState31 } from "react";
29274
+ import { useEffect as useEffect22, useState as useState31 } from "react";
29393
29275
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
29394
29276
  init_debug_store();
29395
29277
 
@@ -29422,7 +29304,7 @@ function describeFileLocations({
29422
29304
 
29423
29305
  // packages/experience-design-system-cli/src/tui/help/help-info.ts
29424
29306
  async function readHelpInfo() {
29425
- const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings()]);
29307
+ const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
29426
29308
  const base = settings["contentfulBaseDir"];
29427
29309
  const locations = describeFileLocations({
29428
29310
  contentfulBaseDir: typeof base === "string" ? base : "",
@@ -29431,9 +29313,9 @@ async function readHelpInfo() {
29431
29313
  });
29432
29314
  return {
29433
29315
  storage: [
29434
- { label: "Config folder", value: configRoot() },
29435
- { label: "Settings file", value: configFilePath() },
29436
- { label: "Agent settings", value: `${configFilePath()} (keys: agent, agentModel, agents)` },
29316
+ { label: "Config folder", value: configRoot2() },
29317
+ { label: "Settings file", value: configFilePath2() },
29318
+ { label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
29437
29319
  { label: "Debug logs", value: locations.debugLogs },
29438
29320
  { label: "Import files", value: locations.importFiles }
29439
29321
  ],
@@ -29463,7 +29345,7 @@ function Section({ title, rows }) {
29463
29345
  }
29464
29346
  function HelpScreen({ onDone }) {
29465
29347
  const [info, setInfo] = useState31();
29466
- useEffect23(() => {
29348
+ useEffect22(() => {
29467
29349
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
29468
29350
  void readHelpInfo().then(setInfo);
29469
29351
  }, []);
@@ -29560,7 +29442,7 @@ import { useState as useState36 } from "react";
29560
29442
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
29561
29443
 
29562
29444
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
29563
- import { useEffect as useEffect25, useRef as useRef16, useState as useState34 } from "react";
29445
+ import { useEffect as useEffect24, useRef as useRef15, useState as useState34 } from "react";
29564
29446
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
29565
29447
  init_debug_store();
29566
29448
 
@@ -29593,7 +29475,7 @@ function scrubError(error, secrets) {
29593
29475
  return message;
29594
29476
  }
29595
29477
  function describeSettingsFile() {
29596
- const path5 = configFilePath();
29478
+ const path5 = configFilePath2();
29597
29479
  return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
29598
29480
  }
29599
29481
 
@@ -29833,8 +29715,8 @@ async function describeAgents(config) {
29833
29715
 
29834
29716
  // packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts
29835
29717
  init_config();
29836
- var readV1Store = readSettings;
29837
- var writeV1Store = writeSettings;
29718
+ var readV1Store = readSettings2;
29719
+ var writeV1Store = writeSettings2;
29838
29720
 
29839
29721
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
29840
29722
  var AGENT_LABELS = {
@@ -29889,7 +29771,7 @@ async function writeAgentConfig(config) {
29889
29771
  }
29890
29772
 
29891
29773
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
29892
- import { useEffect as useEffect24, useState as useState33 } from "react";
29774
+ import { useEffect as useEffect23, useState as useState33 } from "react";
29893
29775
  import { Box as Box48, Text as Text50 } from "ink";
29894
29776
 
29895
29777
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
@@ -29952,7 +29834,7 @@ function AgentDetail({
29952
29834
  const [testing, setTesting] = useState33(false);
29953
29835
  const [notice, setNotice] = useState33(null);
29954
29836
  const [checks, setChecks] = useState33(void 0);
29955
- useEffect24(() => {
29837
+ useEffect23(() => {
29956
29838
  let active = true;
29957
29839
  setChecks(void 0);
29958
29840
  const timer = setTimeout(() => {
@@ -30037,7 +29919,7 @@ function AgentsScreen({ onDone }) {
30037
29919
  const [saving, setSaving] = useState34(false);
30038
29920
  const [loadError, setLoadError] = useState34(null);
30039
29921
  const [checks, setChecks] = useState34({});
30040
- const visit = useRef16({
29922
+ const visit = useRef15({
30041
29923
  trail: createTrail(),
30042
29924
  before: void 0,
30043
29925
  environment: void 0,
@@ -30050,7 +29932,7 @@ function AgentsScreen({ onDone }) {
30050
29932
  );
30051
29933
  }
30052
29934
  };
30053
- useEffect25(() => {
29935
+ useEffect24(() => {
30054
29936
  readAgentConfig().then((loaded) => {
30055
29937
  setConfig(loaded);
30056
29938
  inspectAll(loaded);
@@ -30227,7 +30109,7 @@ function AgentsScreen({ onDone }) {
30227
30109
  }
30228
30110
 
30229
30111
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
30230
- import { useEffect as useEffect26, useRef as useRef17, useState as useState35 } from "react";
30112
+ import { useEffect as useEffect25, useRef as useRef16, useState as useState35 } from "react";
30231
30113
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
30232
30114
  init_debug_store();
30233
30115
 
@@ -30285,14 +30167,14 @@ function ProjectScreen({ onDone }) {
30285
30167
  const [saving, setSaving] = useState35(false);
30286
30168
  const [notice, setNotice] = useState35(null);
30287
30169
  const [loadError, setLoadError] = useState35(null);
30288
- const visit = useRef17({
30170
+ const visit = useRef16({
30289
30171
  trail: createTrail(),
30290
30172
  before: void 0,
30291
30173
  persisted: void 0,
30292
30174
  error: ""
30293
30175
  }).current;
30294
30176
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
30295
- useEffect26(() => {
30177
+ useEffect25(() => {
30296
30178
  readCredentials().then((cfg) => {
30297
30179
  setConfig(cfg);
30298
30180
  visit.before = snapshotOf(cfg);
@@ -30444,7 +30326,7 @@ function ConfigurationScreen({ onDone }) {
30444
30326
  }
30445
30327
 
30446
30328
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
30447
- import { useEffect as useEffect27, useState as useState37 } from "react";
30329
+ import { useEffect as useEffect26, useState as useState37 } from "react";
30448
30330
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
30449
30331
 
30450
30332
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -30468,7 +30350,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
30468
30350
  function OptInAnalyticsScreen({ onDone }) {
30469
30351
  const [loading, setLoading] = useState37(true);
30470
30352
  const [enabled, setEnabled] = useState37(true);
30471
- useEffect27(() => {
30353
+ useEffect26(() => {
30472
30354
  readAnalyticsSetting().then((setting) => {
30473
30355
  setEnabled(setting.enabled);
30474
30356
  setLoading(false);
@@ -30522,7 +30404,7 @@ function OptInAnalyticsScreen({ onDone }) {
30522
30404
  }
30523
30405
 
30524
30406
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
30525
- import { useEffect as useEffect28, useRef as useRef18, useState as useState38 } from "react";
30407
+ import { useEffect as useEffect27, useRef as useRef17, useState as useState38 } from "react";
30526
30408
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
30527
30409
  init_debug_mode_store();
30528
30410
  init_debug_store();
@@ -30539,8 +30421,8 @@ function DebugModeScreen({ onDone }) {
30539
30421
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
30540
30422
  );
30541
30423
  const [notice, setNotice] = useState38(null);
30542
- const visit = useRef18({ trail: createTrail(), before: void 0, error: "" }).current;
30543
- useEffect28(() => {
30424
+ const visit = useRef17({ trail: createTrail(), before: void 0, error: "" }).current;
30425
+ useEffect27(() => {
30544
30426
  readDebugModeSetting().then((loaded) => {
30545
30427
  setSetting(loaded);
30546
30428
  setPending(loaded.retentionDays);
@@ -30695,7 +30577,7 @@ function App({ importOptions, inkClear }) {
30695
30577
  const [flowStart, setFlowStart] = useState39();
30696
30578
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
30697
30579
  const [importDefaults, setImportDefaults] = useState39();
30698
- useEffect29(() => {
30580
+ useEffect28(() => {
30699
30581
  if (screen !== "import") {
30700
30582
  setImportDefaults(void 0);
30701
30583
  return;
@@ -30721,7 +30603,7 @@ function App({ importOptions, inkClear }) {
30721
30603
  else await startExtraction(launch, result);
30722
30604
  };
30723
30605
  const prepareRun = async (launch, credentials) => {
30724
- const settings = await readSettings();
30606
+ const settings = await readSettings2();
30725
30607
  const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
30726
30608
  const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
30727
30609
  const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
@@ -30768,7 +30650,7 @@ function App({ importOptions, inkClear }) {
30768
30650
  }
30769
30651
  });
30770
30652
  };
30771
- useEffect29(() => {
30653
+ useEffect28(() => {
30772
30654
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
30773
30655
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
30774
30656
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -30790,12 +30672,12 @@ function App({ importOptions, inkClear }) {
30790
30672
  }
30791
30673
  });
30792
30674
  }, [tokensOnly, tokensOnlyRun]);
30793
- useEffect29(() => {
30675
+ useEffect28(() => {
30794
30676
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
30795
30677
  setExtractionRun(void 0);
30796
30678
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
30797
30679
  }, [extraction, extractionRun]);
30798
- useEffect29(() => {
30680
+ useEffect28(() => {
30799
30681
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
30800
30682
  const { extraction: produced, input, generatePromptPath } = scopeRun;
30801
30683
  setGenerationInput({
@@ -30813,7 +30695,7 @@ function App({ importOptions, inkClear }) {
30813
30695
  ...generatePromptPath ? { generatePromptPath } : {}
30814
30696
  });
30815
30697
  }, [scopeFlow, scopeRun, generationInput]);
30816
- useEffect29(() => {
30698
+ useEffect28(() => {
30817
30699
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
30818
30700
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
30819
30701
  inkClear();