@contentful/experience-design-system-cli 2.39.1 → 2.40.1-dev-build-08f065f9.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,6 +73,359 @@ 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
+
76
429
  // packages/experience-design-system-backend-pipeline/dist/src/agents/types/agent-name.js
77
430
  var AGENT_NAMES;
78
431
  var init_agent_name = __esm({
@@ -477,14 +830,14 @@ var init_parse_prompt_overrides = __esm({
477
830
  });
478
831
 
479
832
  // packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
480
- import { readFile } from "node:fs/promises";
481
- import { resolve as resolve2 } from "node:path";
833
+ import { readFile as readFile2 } from "node:fs/promises";
834
+ import { resolve as resolve3 } from "node:path";
482
835
  async function resolvePromptOverride(override) {
483
836
  if (override.kind === "text")
484
837
  return override.value;
485
- const abs = resolve2(override.value);
838
+ const abs = resolve3(override.value);
486
839
  try {
487
- return await readFile(abs, "utf8");
840
+ return await readFile2(abs, "utf8");
488
841
  } catch {
489
842
  throw new Error(`--prompt: could not read prompt file: ${abs}`);
490
843
  }
@@ -1772,22 +2125,22 @@ var init_skill_files = __esm({
1772
2125
  });
1773
2126
 
1774
2127
  // packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
1775
- import { existsSync as existsSync2 } from "node:fs";
1776
- import { dirname as dirname3, join as join4, resolve as resolve3 } from "node:path";
2128
+ import { existsSync as existsSync3 } from "node:fs";
2129
+ import { dirname as dirname5, join as join7, resolve as resolve4 } from "node:path";
1777
2130
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1778
2131
  function resolveSkillPath(skill) {
1779
2132
  if (!(skill in SKILL_FILES))
1780
2133
  throw new Error(`Invalid skill: ${skill}`);
1781
- const thisDir = dirname3(fileURLToPath2(import.meta.url));
2134
+ const thisDir = dirname5(fileURLToPath2(import.meta.url));
1782
2135
  let dir = thisDir;
1783
2136
  for (; ; ) {
1784
- const candidate = join4(dir, "skills");
1785
- if (existsSync2(candidate)) {
2137
+ const candidate = join7(dir, "skills");
2138
+ if (existsSync3(candidate)) {
1786
2139
  const file = SKILL_FILES[skill];
1787
2140
  const stepDir = file === "select-components.md" ? "selection" : "generation";
1788
- return join4(candidate, stepDir, file);
2141
+ return join7(candidate, stepDir, file);
1789
2142
  }
1790
- const parent = resolve3(dir, "..");
2143
+ const parent = resolve4(dir, "..");
1791
2144
  if (parent === dir) {
1792
2145
  throw new Error(`skill file missing from package (could not locate skills/ directory from: ${thisDir})`);
1793
2146
  }
@@ -1802,20 +2155,20 @@ var init_resolve_skill_path = __esm({
1802
2155
  });
1803
2156
 
1804
2157
  // packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
1805
- import { readFile as readFile2 } from "node:fs/promises";
1806
- import { resolve as resolve4 } from "node:path";
2158
+ import { readFile as readFile3 } from "node:fs/promises";
2159
+ import { resolve as resolve5 } from "node:path";
1807
2160
  async function readSkillFile(skill, override) {
1808
2161
  if (override) {
1809
- const skillPath2 = resolve4(override);
2162
+ const skillPath2 = resolve5(override);
1810
2163
  try {
1811
- return await readFile2(skillPath2, "utf8");
2164
+ return await readFile3(skillPath2, "utf8");
1812
2165
  } catch {
1813
2166
  throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
1814
2167
  }
1815
2168
  }
1816
2169
  const skillPath = resolveSkillPath(skill);
1817
2170
  try {
1818
- return await readFile2(skillPath, "utf8");
2171
+ return await readFile3(skillPath, "utf8");
1819
2172
  } catch {
1820
2173
  throw new Error(`skill file missing from package (expected at: ${skillPath})`);
1821
2174
  }
@@ -2109,359 +2462,29 @@ __export(cache_keys_exports, {
2109
2462
  hashPromptForSkill: () => hashPromptForSkill
2110
2463
  });
2111
2464
  import { createHash as createHash4 } from "node:crypto";
2112
- import { readFile as readFile3 } from "node:fs/promises";
2113
- import { resolve as resolve5 } from "node:path";
2465
+ import { readFile as readFile4 } from "node:fs/promises";
2466
+ import { resolve as resolve6 } from "node:path";
2114
2467
  function hashContent(content) {
2115
2468
  return createHash4("sha256").update(content).digest("hex");
2116
2469
  }
2117
2470
  async function hashFile(filePath) {
2118
- const content = await readFile3(filePath, "utf8");
2471
+ const content = await readFile4(filePath, "utf8");
2119
2472
  return hashContent(content);
2120
2473
  }
2121
2474
  async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
2122
- const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve5(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
2475
+ const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve6(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
2123
2476
  const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
2124
2477
  return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
2125
2478
  }
2126
2479
  var init_cache_keys = __esm({
2127
2480
  "packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js"() {
2128
2481
  "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
- `;
2412
- }
2413
- function handleCrash() {
2414
- return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
2415
- }
2416
- var pendingRun, sessionDir;
2417
- var init_debug_store = __esm({
2418
- "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
2419
- "use strict";
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
- });
2482
+ init_agents();
2460
2483
  }
2461
2484
  });
2462
2485
 
2463
2486
  // packages/experience-design-system-cli/app.tsx
2464
- import { useEffect as useEffect28, useState as useState39 } from "react";
2487
+ import { useEffect as useEffect30, useState as useState39 } from "react";
2465
2488
 
2466
2489
  // packages/experience-design-system-cli/src/tui/home/home.tsx
2467
2490
  import { useEffect as useEffect2, useState as useState2 } from "react";
@@ -2669,8 +2692,9 @@ function ImportScreen({ exitCode, onDone }) {
2669
2692
  }
2670
2693
 
2671
2694
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
2672
- import { useState as useState4 } from "react";
2695
+ import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
2673
2696
  import { Box as Box9, Text as Text9 } from "ink";
2697
+ init_debug_store();
2674
2698
 
2675
2699
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/controls.ts
2676
2700
  import { useInput as useInput3 } from "ink";
@@ -3087,9 +3111,35 @@ function RunningStep({
3087
3111
 
3088
3112
  // packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
3089
3113
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3114
+ var optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
3090
3115
  function PreflightScreen({ onChoose, onQuit }) {
3091
3116
  const [focus, setFocus] = useState4(0);
3092
- usePreflightControls({ focus, onFocus: setFocus, onChoose, onQuit });
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 });
3093
3143
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
3094
3144
  /* @__PURE__ */ jsx9(StepHeader, { step: "setup" }),
3095
3145
  /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, paddingX: 2, paddingBottom: 1, children: [
@@ -3101,18 +3151,19 @@ function PreflightScreen({ onChoose, onQuit }) {
3101
3151
  /* @__PURE__ */ jsx9(Text9, { bold: focused, color: focused ? PALETTE.accent : void 0, children: option.label })
3102
3152
  ] }, option.target);
3103
3153
  }) }),
3104
- /* @__PURE__ */ jsx9(OverviewBox, { steps: overviewFor(IMPORT_TARGET_OPTIONS[focus].target) }),
3154
+ /* @__PURE__ */ jsx9(OverviewBox, { steps: overviewFor(optionAt(focus)) }),
3105
3155
  /* @__PURE__ */ jsx9(ControlHints, { hints: PREFLIGHT_CONTROLS })
3106
3156
  ] })
3107
3157
  ] });
3108
3158
  }
3109
3159
 
3110
3160
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
3111
- import { useState as useState5 } from "react";
3161
+ import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
3112
3162
  import { Box as Box10, Text as Text10 } from "ink";
3163
+ init_debug_store();
3113
3164
 
3114
3165
  // packages/experience-design-system-cli/src/tui/shared/components/ClearableTextInput.tsx
3115
- import { useRef } from "react";
3166
+ import { useRef as useRef2 } from "react";
3116
3167
  import { useInput as useInput6 } from "ink";
3117
3168
  import TextInput from "ink-text-input";
3118
3169
  import { jsx as jsx10 } from "react/jsx-runtime";
@@ -3120,7 +3171,7 @@ function isClearKey(input, key) {
3120
3171
  return key.ctrl && input === "d";
3121
3172
  }
3122
3173
  function ClearableTextInput({ onChange, ...props }) {
3123
- const justCleared = useRef(false);
3174
+ const justCleared = useRef2(false);
3124
3175
  useInput6((input, key) => {
3125
3176
  if (!isClearKey(input, key)) return;
3126
3177
  justCleared.current = true;
@@ -3166,12 +3217,46 @@ function useWelcomeControls(onQuit) {
3166
3217
 
3167
3218
  // packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
3168
3219
  import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3169
- function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
3220
+ function WelcomeScreen({ mode, onContinue, onQuit, initialPath = "" }) {
3170
3221
  const [projectPath, setProjectPath] = useState5(initialPath);
3171
- useWelcomeControls(onQuit);
3222
+ const visit = useRef3({ emptySubmits: 0 }).current;
3223
+ useEffect5(() => {
3224
+ startDebugRun({
3225
+ flow: "import/welcome",
3226
+ step: "01-welcome",
3227
+ menuOption: "Welcome",
3228
+ inputs: { import_mode: mode, initial_path: initialPath }
3229
+ });
3230
+ }, []);
3231
+ const quit = () => {
3232
+ void finishDebugRun({
3233
+ outputs: {
3234
+ project_path: null,
3235
+ typed_something: toProjectPath(projectPath) !== null,
3236
+ empty_submits: visit.emptySubmits
3237
+ },
3238
+ status: "success",
3239
+ exitMethod: "discarded"
3240
+ });
3241
+ onQuit();
3242
+ };
3243
+ useWelcomeControls(quit);
3172
3244
  const submit = (value) => {
3173
3245
  const path5 = toProjectPath(value);
3174
- if (path5) onContinue(path5);
3246
+ if (!path5) {
3247
+ visit.emptySubmits += 1;
3248
+ return;
3249
+ }
3250
+ void finishDebugRun({
3251
+ outputs: {
3252
+ project_path: path5,
3253
+ changed_from_initial: path5 !== initialPath.trim(),
3254
+ empty_submits: visit.emptySubmits
3255
+ },
3256
+ status: "success",
3257
+ exitMethod: "saved"
3258
+ });
3259
+ onContinue(path5);
3175
3260
  };
3176
3261
  return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
3177
3262
  /* @__PURE__ */ jsx11(StepHeader, { step: "setup" }),
@@ -3221,17 +3306,17 @@ function useTokenInputControls(onBack) {
3221
3306
  import { statSync } from "node:fs";
3222
3307
 
3223
3308
  // packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
3224
- import { homedir } from "node:os";
3225
- import { resolve } from "node:path";
3309
+ import { homedir as homedir2 } from "node:os";
3310
+ import { resolve as resolve2 } from "node:path";
3226
3311
  function stripQuotes(value) {
3227
3312
  const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
3228
3313
  return value.length >= 2 && quoted ? value.slice(1, -1) : value;
3229
3314
  }
3230
3315
  function expandHome(value) {
3231
- return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
3316
+ return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir2() + value.slice(1) : value;
3232
3317
  }
3233
3318
  function resolveUserPath(raw) {
3234
- return resolve(expandHome(stripQuotes(raw.trim())));
3319
+ return resolve2(expandHome(stripQuotes(raw.trim())));
3235
3320
  }
3236
3321
 
3237
3322
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
@@ -3304,7 +3389,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3304
3389
  }
3305
3390
 
3306
3391
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
3307
- import { useEffect as useEffect4, useMemo, useState as useState7 } from "react";
3392
+ import { useEffect as useEffect6, useMemo, useState as useState7 } from "react";
3308
3393
  import { Box as Box12, Text as Text12 } from "ink";
3309
3394
 
3310
3395
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
@@ -3408,19 +3493,19 @@ function usePathValidationControls(phase, handlers) {
3408
3493
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
3409
3494
  import { DatabaseSync } from "node:sqlite";
3410
3495
  import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
3411
- import { readFile as readFile4 } from "node:fs/promises";
3496
+ import { readFile as readFile5 } from "node:fs/promises";
3412
3497
  import { createHash as createHash5 } from "node:crypto";
3413
3498
 
3414
3499
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
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");
3500
+ import { homedir as homedir3 } from "node:os";
3501
+ import { dirname as dirname4, join as join6 } from "node:path";
3502
+ function configRoot2() {
3503
+ return process.env["EDS_HOME"] || join6(homedir3(), ".contentful", "experience-design-system-cli");
3419
3504
  }
3420
- var runsFilePath = () => join3(configRoot(), "state", "runs.json");
3505
+ var runsFilePath = () => join6(configRoot2(), "state", "runs.json");
3421
3506
 
3422
3507
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
3423
- import { dirname as dirname4, resolve as resolve6 } from "node:path";
3508
+ import { dirname as dirname6, resolve as resolve7 } from "node:path";
3424
3509
 
3425
3510
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
3426
3511
  var ELLIPSIS_MARKER = "/* \u2026 */";
@@ -3596,7 +3681,7 @@ function updateStepStatus(db, stepId, status, outputs, error, timestamp) {
3596
3681
  }
3597
3682
 
3598
3683
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js
3599
- import { randomBytes } from "node:crypto";
3684
+ import { randomBytes as randomBytes2 } from "node:crypto";
3600
3685
  var ADJECTIVES = [
3601
3686
  "aged",
3602
3687
  "amber",
@@ -3802,7 +3887,7 @@ var NOUNS = [
3802
3887
  "wind"
3803
3888
  ];
3804
3889
  function generateSessionId() {
3805
- const buf = randomBytes(4);
3890
+ const buf = randomBytes2(4);
3806
3891
  const adjIdx = buf[0] % ADJECTIVES.length;
3807
3892
  const nounIdx = buf[1] % NOUNS.length;
3808
3893
  const hex = ((buf[2] << 8 | buf[3]) & 65535).toString(16).padStart(4, "0");
@@ -4191,13 +4276,13 @@ CREATE INDEX IF NOT EXISTS idx_scanned_files_session ON scanned_files(session
4191
4276
  `;
4192
4277
  function getPipelineDbPath() {
4193
4278
  if (process.env.EDS_PIPELINE_DB_PATH) {
4194
- return resolve6(process.env.EDS_PIPELINE_DB_PATH);
4279
+ return resolve7(process.env.EDS_PIPELINE_DB_PATH);
4195
4280
  }
4196
- return resolve6(configRoot(), "pipeline.db");
4281
+ return resolve7(configRoot2(), "pipeline.db");
4197
4282
  }
4198
4283
  function openPipelineDb(dbPath) {
4199
4284
  const path5 = dbPath ?? getPipelineDbPath();
4200
- mkdirSync(dirname4(path5), { recursive: true });
4285
+ mkdirSync(dirname6(path5), { recursive: true });
4201
4286
  try {
4202
4287
  const db = new DatabaseSync(path5);
4203
4288
  db.exec("PRAGMA busy_timeout = 5000");
@@ -4862,16 +4947,16 @@ function extractRelativeImportPaths(sourceText) {
4862
4947
  return [...specifiers];
4863
4948
  }
4864
4949
  async function resolveRelativeImport(specifier, fromDir) {
4865
- const basePath = resolve6(fromDir, specifier);
4950
+ const basePath = resolve7(fromDir, specifier);
4866
4951
  const candidates = [
4867
4952
  basePath,
4868
4953
  ...rewrittenSourcePaths(basePath),
4869
4954
  ...SIBLING_FILE_EXTENSIONS.map((ext) => `${basePath}${ext}`),
4870
- ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve6(basePath, `index${ext}`))
4955
+ ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve7(basePath, `index${ext}`))
4871
4956
  ];
4872
4957
  for (const candidate of candidates) {
4873
4958
  try {
4874
- await readFile4(candidate, "utf8");
4959
+ await readFile5(candidate, "utf8");
4875
4960
  return candidate;
4876
4961
  } catch {
4877
4962
  }
@@ -4888,9 +4973,9 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
4888
4973
  return resolvedPaths;
4889
4974
  }
4890
4975
  async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
4891
- const visited = /* @__PURE__ */ new Set([resolve6(sourcePath)]);
4976
+ const visited = /* @__PURE__ */ new Set([resolve7(sourcePath)]);
4892
4977
  const discovered = [];
4893
- let frontier = [{ text: sourceText, dir: dirname4(sourcePath) }];
4978
+ let frontier = [{ text: sourceText, dir: dirname6(sourcePath) }];
4894
4979
  for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
4895
4980
  const nextFrontier = [];
4896
4981
  for (const node of frontier) {
@@ -4905,12 +4990,12 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
4905
4990
  break;
4906
4991
  let content;
4907
4992
  try {
4908
- content = await readFile4(resolvedPath, "utf8");
4993
+ content = await readFile5(resolvedPath, "utf8");
4909
4994
  } catch {
4910
4995
  continue;
4911
4996
  }
4912
4997
  discovered.push({ path: resolvedPath, content });
4913
- nextFrontier.push({ text: content, dir: dirname4(resolvedPath) });
4998
+ nextFrontier.push({ text: content, dir: dirname6(resolvedPath) });
4914
4999
  }
4915
5000
  }
4916
5001
  frontier = nextFrontier;
@@ -4944,7 +5029,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
4944
5029
  let truncatedSiblingCount = 0;
4945
5030
  const usesNotShown = /* @__PURE__ */ new Set();
4946
5031
  try {
4947
- const rawText = await readFile4(sourcePath, "utf8");
5032
+ const rawText = await readFile5(sourcePath, "utf8");
4948
5033
  let siblingUsesNotShown;
4949
5034
  let declaredTypeNames;
4950
5035
  ({
@@ -5705,8 +5790,8 @@ init_token_types();
5705
5790
  import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "ts-morph";
5706
5791
 
5707
5792
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
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";
5793
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
5794
+ import { dirname as dirname7, join as join8, resolve as resolve8 } from "node:path";
5710
5795
  import { Node, Project, SyntaxKind } from "ts-morph";
5711
5796
  import ts from "typescript";
5712
5797
  var packageRootByFilePathCache = /* @__PURE__ */ new Map();
@@ -5894,7 +5979,7 @@ function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
5894
5979
  continue;
5895
5980
  for (const targetPattern of targets) {
5896
5981
  const substitutedTarget = substituteTsConfigPathTarget(targetPattern, match2.wildcard);
5897
- const resolvedPath = resolve7(tsConfigPaths.baseUrl, substitutedTarget);
5982
+ const resolvedPath = resolve8(tsConfigPaths.baseUrl, substitutedTarget);
5898
5983
  const sourceFilePath = resolveImportSourcePath(resolvedPath);
5899
5984
  if (sourceFilePath)
5900
5985
  return sourceFilePath;
@@ -5906,16 +5991,16 @@ function findNearestTsConfigPath(filePath) {
5906
5991
  if (nearestTsConfigPathCache.has(filePath)) {
5907
5992
  return nearestTsConfigPathCache.get(filePath) ?? void 0;
5908
5993
  }
5909
- let currentDir = dirname5(filePath);
5994
+ let currentDir = dirname7(filePath);
5910
5995
  while (true) {
5911
5996
  for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
5912
- const candidatePath = join5(currentDir, candidateName);
5913
- if (existsSync3(candidatePath)) {
5997
+ const candidatePath = join8(currentDir, candidateName);
5998
+ if (existsSync4(candidatePath)) {
5914
5999
  nearestTsConfigPathCache.set(filePath, candidatePath);
5915
6000
  return candidatePath;
5916
6001
  }
5917
6002
  }
5918
- const parentDir = dirname5(currentDir);
6003
+ const parentDir = dirname7(currentDir);
5919
6004
  if (parentDir === currentDir) {
5920
6005
  nearestTsConfigPathCache.set(filePath, null);
5921
6006
  return void 0;
@@ -5932,13 +6017,13 @@ function getTsConfigPaths(tsConfigPath) {
5932
6017
  tsConfigPathsCache.set(tsConfigPath, null);
5933
6018
  return void 0;
5934
6019
  }
5935
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname5(tsConfigPath));
6020
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname7(tsConfigPath));
5936
6021
  const paths = parsedConfig.options.paths;
5937
6022
  if (!paths || Object.keys(paths).length === 0) {
5938
6023
  tsConfigPathsCache.set(tsConfigPath, null);
5939
6024
  return void 0;
5940
6025
  }
5941
- const baseUrl = parsedConfig.options.baseUrl ?? dirname5(tsConfigPath);
6026
+ const baseUrl = parsedConfig.options.baseUrl ?? dirname7(tsConfigPath);
5942
6027
  const result = { baseUrl, paths };
5943
6028
  tsConfigPathsCache.set(tsConfigPath, result);
5944
6029
  return result;
@@ -5966,12 +6051,12 @@ function resolveImportSourcePath(basePath) {
5966
6051
  `${basePath}.tsx`,
5967
6052
  `${basePath}.js`,
5968
6053
  `${basePath}.jsx`,
5969
- join5(basePath, "index.ts"),
5970
- join5(basePath, "index.tsx"),
5971
- join5(basePath, "index.js"),
5972
- join5(basePath, "index.jsx")
6054
+ join8(basePath, "index.ts"),
6055
+ join8(basePath, "index.tsx"),
6056
+ join8(basePath, "index.js"),
6057
+ join8(basePath, "index.jsx")
5973
6058
  ];
5974
- return candidates.find((candidatePath) => existsSync3(candidatePath));
6059
+ return candidates.find((candidatePath) => existsSync4(candidatePath));
5975
6060
  }
5976
6061
  function findProjectSourceFileByImportPath(project, resolvedPath) {
5977
6062
  const candidatePaths = [
@@ -5980,10 +6065,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
5980
6065
  `${resolvedPath}.tsx`,
5981
6066
  `${resolvedPath}.js`,
5982
6067
  `${resolvedPath}.jsx`,
5983
- join5(resolvedPath, "index.ts"),
5984
- join5(resolvedPath, "index.tsx"),
5985
- join5(resolvedPath, "index.js"),
5986
- join5(resolvedPath, "index.jsx")
6068
+ join8(resolvedPath, "index.ts"),
6069
+ join8(resolvedPath, "index.tsx"),
6070
+ join8(resolvedPath, "index.js"),
6071
+ join8(resolvedPath, "index.jsx")
5987
6072
  ];
5988
6073
  for (const candidatePath of candidatePaths) {
5989
6074
  const sourceFile = project.getSourceFile(candidatePath);
@@ -6004,10 +6089,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
6004
6089
  if (!packageRootDir)
6005
6090
  return void 0;
6006
6091
  const preferredEntryPaths = [
6007
- join5(packageRootDir, "src/index.ts"),
6008
- join5(packageRootDir, "src/index.tsx"),
6009
- join5(packageRootDir, "index.ts"),
6010
- join5(packageRootDir, "index.tsx")
6092
+ join8(packageRootDir, "src/index.ts"),
6093
+ join8(packageRootDir, "src/index.tsx"),
6094
+ join8(packageRootDir, "index.ts"),
6095
+ join8(packageRootDir, "index.tsx")
6011
6096
  ];
6012
6097
  for (const entryPath of preferredEntryPaths) {
6013
6098
  const entrySourceFile = project.getSourceFile(entryPath);
@@ -6015,7 +6100,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
6015
6100
  return entrySourceFile;
6016
6101
  }
6017
6102
  }
6018
- return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join5(packageRootDir, "src"));
6103
+ return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join8(packageRootDir, "src"));
6019
6104
  }
6020
6105
  function getWorkspacePackageManifestForSourceFile(sourceFile) {
6021
6106
  const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
@@ -6024,7 +6109,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
6024
6109
  if (workspacePackageManifestCache.has(packageRootDir)) {
6025
6110
  return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
6026
6111
  }
6027
- const packageJsonPath = join5(packageRootDir, "package.json");
6112
+ const packageJsonPath = join8(packageRootDir, "package.json");
6028
6113
  try {
6029
6114
  const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
6030
6115
  const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
@@ -6039,13 +6124,13 @@ function findNearestPackageRootDir(filePath) {
6039
6124
  if (packageRootByFilePathCache.has(filePath)) {
6040
6125
  return packageRootByFilePathCache.get(filePath) ?? void 0;
6041
6126
  }
6042
- let currentDir = dirname5(filePath);
6127
+ let currentDir = dirname7(filePath);
6043
6128
  while (true) {
6044
- if (existsSync3(join5(currentDir, "package.json"))) {
6129
+ if (existsSync4(join8(currentDir, "package.json"))) {
6045
6130
  packageRootByFilePathCache.set(filePath, currentDir);
6046
6131
  return currentDir;
6047
6132
  }
6048
- const parentDir = dirname5(currentDir);
6133
+ const parentDir = dirname7(currentDir);
6049
6134
  if (parentDir === currentDir) {
6050
6135
  packageRootByFilePathCache.set(filePath, null);
6051
6136
  return void 0;
@@ -6055,7 +6140,7 @@ function findNearestPackageRootDir(filePath) {
6055
6140
  }
6056
6141
 
6057
6142
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/file-extraction-workers.js
6058
- import { readFile as readFile5 } from "node:fs/promises";
6143
+ import { readFile as readFile6 } from "node:fs/promises";
6059
6144
  async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
6060
6145
  const warnings = [];
6061
6146
  const items = [];
@@ -6067,7 +6152,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
6067
6152
  if (!filePath)
6068
6153
  break;
6069
6154
  try {
6070
- const source = await readFile5(filePath, "utf-8");
6155
+ const source = await readFile6(filePath, "utf-8");
6071
6156
  const outcome = await extractFile(filePath, source);
6072
6157
  warnings.push(...outcome.warnings ?? []);
6073
6158
  if (outcome.item)
@@ -9042,35 +9127,35 @@ function extractVueSlotsFromSetup(options) {
9042
9127
 
9043
9128
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
9044
9129
  import os from "node:os";
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";
9130
+ import { basename, dirname as dirname9, resolve as resolve10, join as join10 } from "node:path";
9131
+ import { readFile as readFile7 } from "node:fs/promises";
9132
+ import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
9048
9133
  import { parse as parseSFC } from "@vue/compiler-sfc";
9049
9134
  import { Project as Project3, Node as Node6 } from "ts-morph";
9050
9135
 
9051
9136
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
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";
9137
+ import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
9138
+ import { dirname as dirname8, join as join9, resolve as resolve9 } from "node:path";
9054
9139
  function resolveLocalModule(importingFilePath, specifier, options = {}) {
9055
- const basePath = resolve8(dirname6(importingFilePath), specifier);
9140
+ const basePath = resolve9(dirname8(importingFilePath), specifier);
9056
9141
  const candidates = [
9057
9142
  basePath,
9058
9143
  `${basePath}.js`,
9059
9144
  `${basePath}.ts`,
9060
9145
  `${basePath}.mjs`,
9061
9146
  `${basePath}.cjs`,
9062
- join6(basePath, "index.js"),
9063
- join6(basePath, "index.ts"),
9064
- join6(basePath, "index.mjs"),
9065
- join6(basePath, "index.cjs")
9147
+ join9(basePath, "index.js"),
9148
+ join9(basePath, "index.ts"),
9149
+ join9(basePath, "index.mjs"),
9150
+ join9(basePath, "index.cjs")
9066
9151
  ];
9067
9152
  for (const candidate of candidates) {
9068
- if (existsSync4(candidate) && statSync2(candidate).isFile())
9153
+ if (existsSync5(candidate) && statSync2(candidate).isFile())
9069
9154
  return candidate;
9070
9155
  }
9071
9156
  if (options.allowJavaScriptExtensionFallback && basePath.endsWith(".js")) {
9072
9157
  const tsPath = `${basePath.slice(0, -".js".length)}.ts`;
9073
- if (existsSync4(tsPath) && statSync2(tsPath).isFile())
9158
+ if (existsSync5(tsPath) && statSync2(tsPath).isFile())
9074
9159
  return tsPath;
9075
9160
  }
9076
9161
  return null;
@@ -9141,7 +9226,7 @@ function getVueComponentName(filePath) {
9141
9226
  if (fileName !== "index") {
9142
9227
  return fileName;
9143
9228
  }
9144
- const parentDirName = basename(dirname7(filePath));
9229
+ const parentDirName = basename(dirname9(filePath));
9145
9230
  return parentDirName || fileName;
9146
9231
  }
9147
9232
  async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
@@ -9285,7 +9370,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
9285
9370
  if (visitedImports.has(visitKey))
9286
9371
  return [];
9287
9372
  visitedImports.add(visitKey);
9288
- const source = await readFile6(importedRef.filePath, "utf-8");
9373
+ const source = await readFile7(importedRef.filePath, "utf-8");
9289
9374
  const project = new Project3({
9290
9375
  compilerOptions: {
9291
9376
  strict: false,
@@ -9313,18 +9398,18 @@ function findWorkspaceRoot(startDir) {
9313
9398
  return workspaceRootCache.get(startDir);
9314
9399
  let dir = startDir;
9315
9400
  while (true) {
9316
- const pkgJsonPath = join7(dir, "package.json");
9317
- if (existsSync5(pkgJsonPath)) {
9401
+ const pkgJsonPath = join10(dir, "package.json");
9402
+ if (existsSync6(pkgJsonPath)) {
9318
9403
  try {
9319
9404
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9320
- if (pkg.workspaces || existsSync5(join7(dir, "pnpm-workspace.yaml"))) {
9405
+ if (pkg.workspaces || existsSync6(join10(dir, "pnpm-workspace.yaml"))) {
9321
9406
  workspaceRootCache.set(startDir, dir);
9322
9407
  return dir;
9323
9408
  }
9324
9409
  } catch {
9325
9410
  }
9326
9411
  }
9327
- const parent = dirname7(dir);
9412
+ const parent = dirname9(dir);
9328
9413
  if (parent === dir) {
9329
9414
  workspaceRootCache.set(startDir, null);
9330
9415
  return null;
@@ -9338,8 +9423,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
9338
9423
  return workspacePackageDirsCache.get(workspaceRoot);
9339
9424
  }
9340
9425
  const packageMap = /* @__PURE__ */ new Map();
9341
- const packagesDir = join7(workspaceRoot, "packages");
9342
- if (!existsSync5(packagesDir)) {
9426
+ const packagesDir = join10(workspaceRoot, "packages");
9427
+ if (!existsSync6(packagesDir)) {
9343
9428
  workspacePackageDirsCache.set(workspaceRoot, packageMap);
9344
9429
  return packageMap;
9345
9430
  }
@@ -9348,12 +9433,12 @@ function getWorkspacePackageDirs(workspaceRoot) {
9348
9433
  return;
9349
9434
  let entries;
9350
9435
  try {
9351
- entries = readdirSync(dir);
9436
+ entries = readdirSync2(dir);
9352
9437
  } catch {
9353
9438
  return;
9354
9439
  }
9355
- const pkgJsonPath = join7(dir, "package.json");
9356
- if (existsSync5(pkgJsonPath)) {
9440
+ const pkgJsonPath = join10(dir, "package.json");
9441
+ if (existsSync6(pkgJsonPath)) {
9357
9442
  try {
9358
9443
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9359
9444
  if (typeof pkg.name === "string") {
@@ -9365,7 +9450,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
9365
9450
  for (const entry of entries) {
9366
9451
  if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
9367
9452
  continue;
9368
- const entryPath = join7(dir, entry);
9453
+ const entryPath = join10(dir, entry);
9369
9454
  try {
9370
9455
  const stat5 = statSync3(entryPath);
9371
9456
  if (stat5.isDirectory()) {
@@ -9380,7 +9465,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
9380
9465
  return packageMap;
9381
9466
  }
9382
9467
  function resolveWorkspaceVueImport(specifier, importingFilePath) {
9383
- const workspaceRoot = findWorkspaceRoot(dirname7(importingFilePath));
9468
+ const workspaceRoot = findWorkspaceRoot(dirname9(importingFilePath));
9384
9469
  if (!workspaceRoot)
9385
9470
  return null;
9386
9471
  const packageDirs = getWorkspacePackageDirs(workspaceRoot);
@@ -9405,28 +9490,28 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9405
9490
  const packageDir = packageDirs.get(packageName);
9406
9491
  if (!packageDir)
9407
9492
  return null;
9408
- const pkgJsonPath = join7(packageDir, "package.json");
9493
+ const pkgJsonPath = join10(packageDir, "package.json");
9409
9494
  try {
9410
9495
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9411
9496
  if (pkg.exports && subpath !== ".") {
9412
9497
  const exportValue = pkg.exports[subpath];
9413
9498
  if (typeof exportValue === "string" && exportValue.endsWith(".vue")) {
9414
- const resolved = resolve9(packageDir, exportValue);
9415
- if (existsSync5(resolved))
9499
+ const resolved = resolve10(packageDir, exportValue);
9500
+ if (existsSync6(resolved))
9416
9501
  return resolved;
9417
9502
  }
9418
9503
  }
9419
9504
  if (subpath !== ".") {
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)) {
9505
+ const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
9506
+ for (const base of [join10(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
9507
+ const subPkgPath = join10(base, "package.json");
9508
+ if (existsSync6(subPkgPath)) {
9424
9509
  try {
9425
9510
  const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
9426
9511
  const main = subPkg.main || subPkg.module;
9427
9512
  if (typeof main === "string" && main.endsWith(".vue")) {
9428
- const resolved = resolve9(base, main);
9429
- if (existsSync5(resolved))
9513
+ const resolved = resolve10(base, main);
9514
+ if (existsSync6(resolved))
9430
9515
  return resolved;
9431
9516
  }
9432
9517
  } catch {
@@ -9437,8 +9522,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9437
9522
  if (subpath === ".") {
9438
9523
  const main = pkg.main || pkg.module;
9439
9524
  if (typeof main === "string" && main.endsWith(".vue")) {
9440
- const resolved = resolve9(packageDir, main);
9441
- if (existsSync5(resolved))
9525
+ const resolved = resolve10(packageDir, main);
9526
+ if (existsSync6(resolved))
9442
9527
  return resolved;
9443
9528
  }
9444
9529
  }
@@ -9447,7 +9532,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9447
9532
  return null;
9448
9533
  }
9449
9534
  async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE__ */ new Set()) {
9450
- const resolvedFilePath = resolve9(filePath);
9535
+ const resolvedFilePath = resolve10(filePath);
9451
9536
  if (visited.has(resolvedFilePath)) {
9452
9537
  return [];
9453
9538
  }
@@ -9472,7 +9557,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
9472
9557
  if (specifier.startsWith(".")) {
9473
9558
  if (!specifier.endsWith(".vue"))
9474
9559
  continue;
9475
- localImports.set(defaultImport.getText(), resolve9(dirname7(resolvedFilePath), specifier));
9560
+ localImports.set(defaultImport.getText(), resolve10(dirname9(resolvedFilePath), specifier));
9476
9561
  } else {
9477
9562
  const resolvedVuePath = resolveWorkspaceVueImport(specifier, resolvedFilePath);
9478
9563
  if (resolvedVuePath) {
@@ -9516,7 +9601,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
9516
9601
  return [];
9517
9602
  }
9518
9603
  async function extractInheritedVueProps(filePath, visited) {
9519
- const source = await readFile6(filePath, "utf-8");
9604
+ const source = await readFile7(filePath, "utf-8");
9520
9605
  const { descriptor } = parseSFC(source);
9521
9606
  if (!descriptor.script) {
9522
9607
  return [];
@@ -9849,7 +9934,7 @@ async function extractAstroComponents(filePaths, onProgress) {
9849
9934
  }
9850
9935
 
9851
9936
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
9852
- import { basename as basename3, dirname as dirname8, join as join8, resolve as resolve10 } from "node:path";
9937
+ import { basename as basename3, dirname as dirname10, join as join11, resolve as resolve11 } from "node:path";
9853
9938
  import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
9854
9939
  function normalizeComponentName(input) {
9855
9940
  return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
@@ -10494,7 +10579,7 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
10494
10579
  }
10495
10580
  function resolveImportSourcePath2(fromFilePath, specifier) {
10496
10581
  if (specifier.startsWith(".")) {
10497
- const resolvedPath = resolve10(dirname8(fromFilePath), specifier);
10582
+ const resolvedPath = resolve11(dirname10(fromFilePath), specifier);
10498
10583
  if (resolvedPath.endsWith(".js")) {
10499
10584
  return `${resolvedPath.slice(0, -3)}.ts`;
10500
10585
  }
@@ -10504,14 +10589,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
10504
10589
  if (!specifier.startsWith(spectrumPrefix)) {
10505
10590
  return null;
10506
10591
  }
10507
- const packagesMarker = `${join8("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
10592
+ const packagesMarker = `${join11("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
10508
10593
  const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
10509
10594
  if (markerIndex === -1) {
10510
10595
  return null;
10511
10596
  }
10512
10597
  const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
10513
10598
  const componentPath = specifier.slice(spectrumPrefix.length);
10514
- return join8(packagesRoot, "core", "components", componentPath, "index.ts");
10599
+ return join11(packagesRoot, "core", "components", componentPath, "index.ts");
10515
10600
  }
10516
10601
  function getImportedBaseClass(classDecl, project, visitedFiles) {
10517
10602
  const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
@@ -10664,8 +10749,8 @@ async function extractWebComponentDefinitions(filePaths) {
10664
10749
 
10665
10750
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
10666
10751
  import os3 from "node:os";
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";
10752
+ import { basename as basename4, dirname as dirname11, resolve as resolve12, join as join12 } from "node:path";
10753
+ import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
10669
10754
  import { createRequire } from "node:module";
10670
10755
  import { parse as parseSvelte } from "svelte/compiler";
10671
10756
  import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
@@ -10898,10 +10983,10 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
10898
10983
  function findNearestTsconfig(startDir) {
10899
10984
  let dir = startDir;
10900
10985
  for (let i = 0; i < 16; i++) {
10901
- const candidate = join9(dir, "tsconfig.json");
10902
- if (existsSync6(candidate))
10986
+ const candidate = join12(dir, "tsconfig.json");
10987
+ if (existsSync7(candidate))
10903
10988
  return candidate;
10904
- const parent = dirname9(dir);
10989
+ const parent = dirname11(dir);
10905
10990
  if (!parent || parent === dir)
10906
10991
  return null;
10907
10992
  dir = parent;
@@ -11031,32 +11116,32 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11031
11116
  } catch {
11032
11117
  resolvedJs = null;
11033
11118
  }
11034
- const seedDir = resolvedJs ? dirname9(resolvedJs) : dirname9(parentFile);
11119
+ const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
11035
11120
  const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
11036
11121
  if (pkgRoot) {
11037
- const pkgJsonPath = join9(pkgRoot, "package.json");
11038
- if (existsSync6(pkgJsonPath)) {
11122
+ const pkgJsonPath = join12(pkgRoot, "package.json");
11123
+ if (existsSync7(pkgJsonPath)) {
11039
11124
  try {
11040
11125
  const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
11041
11126
  const pkg = JSON.parse(pkgRaw);
11042
11127
  const typesField = pkg.types ?? pkg.typings;
11043
11128
  if (typeof typesField === "string") {
11044
- const candidate = resolve11(pkgRoot, typesField);
11045
- if (existsSync6(candidate))
11129
+ const candidate = resolve12(pkgRoot, typesField);
11130
+ if (existsSync7(candidate))
11046
11131
  return candidate;
11047
11132
  }
11048
11133
  const exportsTypes = extractTypesFromExports(pkg.exports);
11049
11134
  if (exportsTypes) {
11050
- const candidate = resolve11(pkgRoot, exportsTypes);
11051
- if (existsSync6(candidate))
11135
+ const candidate = resolve12(pkgRoot, exportsTypes);
11136
+ if (existsSync7(candidate))
11052
11137
  return candidate;
11053
11138
  }
11054
11139
  } catch {
11055
11140
  }
11056
11141
  }
11057
11142
  for (const entry of ["index.d.ts", "index.d.mts"]) {
11058
- const candidate = join9(pkgRoot, entry);
11059
- if (existsSync6(candidate))
11143
+ const candidate = join12(pkgRoot, entry);
11144
+ if (existsSync7(candidate))
11060
11145
  return candidate;
11061
11146
  }
11062
11147
  }
@@ -11064,7 +11149,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11064
11149
  const noExt = resolvedJs.replace(/\.(m?js|cjs)$/, "");
11065
11150
  for (const ext of [".d.ts", ".d.mts"]) {
11066
11151
  const candidate = `${noExt}${ext}`;
11067
- if (existsSync6(candidate))
11152
+ if (existsSync7(candidate))
11068
11153
  return candidate;
11069
11154
  }
11070
11155
  }
@@ -11073,9 +11158,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11073
11158
  function findPackageRootForSpecifier(seedDir, specifier) {
11074
11159
  let dir = seedDir;
11075
11160
  for (let i = 0; i < 32; i++) {
11076
- if (existsSync6(join9(dir, "package.json"))) {
11161
+ if (existsSync7(join12(dir, "package.json"))) {
11077
11162
  try {
11078
- const pkgRaw = readFileSync6(join9(dir, "package.json"), "utf-8");
11163
+ const pkgRaw = readFileSync6(join12(dir, "package.json"), "utf-8");
11079
11164
  const pkg = JSON.parse(pkgRaw);
11080
11165
  if (pkg.name === specifier)
11081
11166
  return dir;
@@ -11084,7 +11169,7 @@ function findPackageRootForSpecifier(seedDir, specifier) {
11084
11169
  } catch {
11085
11170
  }
11086
11171
  }
11087
- const parent = dirname9(dir);
11172
+ const parent = dirname11(dir);
11088
11173
  if (!parent || parent === dir)
11089
11174
  return null;
11090
11175
  dir = parent;
@@ -11216,11 +11301,11 @@ async function extractFromSvelteFile(filePath, source) {
11216
11301
  var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
11217
11302
  function getSvelteComponentName(filePath) {
11218
11303
  const file = basename4(filePath, ".svelte");
11219
- const parentDir = basename4(dirname9(filePath));
11304
+ const parentDir = basename4(dirname11(filePath));
11220
11305
  if (file === "index")
11221
11306
  return toPascalCase(parentDir);
11222
11307
  if (ANATOMY_FOLDERS.has(parentDir)) {
11223
- const grandparent = basename4(dirname9(dirname9(filePath)));
11308
+ const grandparent = basename4(dirname11(dirname11(filePath)));
11224
11309
  if (grandparent && grandparent !== "." && grandparent !== "/") {
11225
11310
  return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
11226
11311
  }
@@ -12035,7 +12120,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
12035
12120
  }
12036
12121
 
12037
12122
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/extract-angular-components.js
12038
- import { readFile as readFile8 } from "node:fs/promises";
12123
+ import { readFile as readFile9 } from "node:fs/promises";
12039
12124
  import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
12040
12125
 
12041
12126
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
@@ -12349,7 +12434,7 @@ function extractProps2(cls, meta) {
12349
12434
  }
12350
12435
 
12351
12436
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/read-component-metadata.js
12352
- import { dirname as dirname10, resolve as resolve12 } from "node:path";
12437
+ import { dirname as dirname12, resolve as resolve13 } from "node:path";
12353
12438
 
12354
12439
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
12355
12440
  var SUFFIXES = ["Component", "Directive"];
@@ -12404,7 +12489,7 @@ function readComponentMetadata(cls, sourceFilePath) {
12404
12489
  const inlineTemplate = readDecoratorString(obj, "template");
12405
12490
  const templateUrlRel = readDecoratorString(obj, "templateUrl");
12406
12491
  const inputsArray = readDecoratorStringArray(obj, "inputs");
12407
- const templatePath = templateUrlRel ? resolve12(dirname10(sourceFilePath), templateUrlRel) : null;
12492
+ const templatePath = templateUrlRel ? resolve13(dirname12(sourceFilePath), templateUrlRel) : null;
12408
12493
  const decorator = cls.getDecorator("Component");
12409
12494
  const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
12410
12495
  return {
@@ -12441,14 +12526,14 @@ function countLines(text, offset) {
12441
12526
  }
12442
12527
 
12443
12528
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/template/resolve-template-source.js
12444
- import { readFile as readFile7 } from "node:fs/promises";
12529
+ import { readFile as readFile8 } from "node:fs/promises";
12445
12530
  async function resolveTemplateSource(meta) {
12446
12531
  if (meta.inlineTemplate !== null)
12447
12532
  return meta.inlineTemplate;
12448
12533
  if (meta.templatePath === null)
12449
12534
  return null;
12450
12535
  try {
12451
- return await readFile7(meta.templatePath, "utf8");
12536
+ return await readFile8(meta.templatePath, "utf8");
12452
12537
  } catch {
12453
12538
  return null;
12454
12539
  }
@@ -12638,7 +12723,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
12638
12723
  });
12639
12724
  for (const filePath of filePaths) {
12640
12725
  try {
12641
- const source = await readFile8(filePath, "utf8");
12726
+ const source = await readFile9(filePath, "utf8");
12642
12727
  const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
12643
12728
  for (const cls of sourceFile.getClasses()) {
12644
12729
  if (!hasComponentDecorator(cls))
@@ -13226,17 +13311,17 @@ function applyCompositionEdges(components, edges) {
13226
13311
  }
13227
13312
 
13228
13313
  // packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
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";
13314
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
13315
+ import { dirname as dirname13, join as join13, resolve as resolve14 } from "node:path";
13231
13316
  import { fileURLToPath as fileURLToPath3 } from "node:url";
13232
13317
  function resolvePromptPath(fileName) {
13233
- const thisDir = dirname11(fileURLToPath3(import.meta.url));
13318
+ const thisDir = dirname13(fileURLToPath3(import.meta.url));
13234
13319
  let dir = thisDir;
13235
13320
  for (; ; ) {
13236
- const candidate = join10(dir, "prompts");
13237
- if (existsSync7(candidate))
13238
- return join10(candidate, fileName);
13239
- const parent = resolve13(dir, "..");
13321
+ const candidate = join13(dir, "prompts");
13322
+ if (existsSync8(candidate))
13323
+ return join13(candidate, fileName);
13324
+ const parent = resolve14(dir, "..");
13240
13325
  if (parent === dir) {
13241
13326
  throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
13242
13327
  }
@@ -13401,7 +13486,7 @@ ${fileDigest}`);
13401
13486
  }
13402
13487
 
13403
13488
  // packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
13404
- import { dirname as dirname12 } from "node:path";
13489
+ import { dirname as dirname14 } from "node:path";
13405
13490
  function kebabToPascal3(name) {
13406
13491
  return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
13407
13492
  }
@@ -13465,8 +13550,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
13465
13550
  for (const file of files) {
13466
13551
  if (!file.path.endsWith("AGENTS.md"))
13467
13552
  continue;
13468
- const docDir = dirname12(file.path);
13469
- const parent = components.find((c2) => c2.sourcePath && dirname12(c2.sourcePath) === docDir)?.name;
13553
+ const docDir = dirname14(file.path);
13554
+ const parent = components.find((c2) => c2.sourcePath && dirname14(c2.sourcePath) === docDir)?.name;
13470
13555
  if (!parent || !componentNames.has(parent))
13471
13556
  continue;
13472
13557
  for (const line of file.content.split("\n")) {
@@ -13791,7 +13876,7 @@ function validateExtractedComponents(components) {
13791
13876
  }
13792
13877
 
13793
13878
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
13794
- import { resolve as resolve15 } from "node:path";
13879
+ import { resolve as resolve16 } from "node:path";
13795
13880
 
13796
13881
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
13797
13882
  import { createHash as createHash7 } from "node:crypto";
@@ -13802,7 +13887,7 @@ function createComponentId(name, resolvedSourcePath) {
13802
13887
 
13803
13888
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
13804
13889
  import { access } from "node:fs/promises";
13805
- import { isAbsolute, relative, resolve as resolve14 } from "node:path";
13890
+ import { isAbsolute, relative, resolve as resolve15 } from "node:path";
13806
13891
  async function resolveComponentSourcePath(source, reviewRoot) {
13807
13892
  if (isAbsolute(source)) {
13808
13893
  try {
@@ -13812,7 +13897,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
13812
13897
  throw new Error(`Unable to access component source at ${source}`);
13813
13898
  }
13814
13899
  }
13815
- const candidate = resolve14(reviewRoot, source);
13900
+ const candidate = resolve15(reviewRoot, source);
13816
13901
  const relativeToRoot = relative(reviewRoot, candidate);
13817
13902
  if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
13818
13903
  throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
@@ -13827,7 +13912,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
13827
13912
 
13828
13913
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
13829
13914
  async function loadReviewInput(components, options = {}) {
13830
- const reviewRoot = resolve15(options.reviewRoot ?? process.cwd());
13915
+ const reviewRoot = resolve16(options.reviewRoot ?? process.cwd());
13831
13916
  const records = await Promise.all(components.map(async (component) => {
13832
13917
  let resolvedSourcePath;
13833
13918
  try {
@@ -13862,50 +13947,50 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
13862
13947
  }
13863
13948
 
13864
13949
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
13865
- import { access as access3, readFile as readFile10 } from "node:fs/promises";
13950
+ import { access as access3, readFile as readFile11 } from "node:fs/promises";
13866
13951
 
13867
13952
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
13868
- import { access as access2, mkdir, readFile as readFile9, writeFile } from "node:fs/promises";
13953
+ import { access as access2, mkdir as mkdir3, readFile as readFile10, writeFile as writeFile3 } from "node:fs/promises";
13869
13954
 
13870
13955
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
13871
- import { resolve as resolve16 } from "node:path";
13956
+ import { resolve as resolve17 } from "node:path";
13872
13957
  async function getRefineSessionPaths(sessionId, artifactsRoot) {
13873
- const sessionDir2 = resolve16(artifactsRoot, sessionId);
13958
+ const sessionDir2 = resolve17(artifactsRoot, sessionId);
13874
13959
  return {
13875
13960
  sessionDir: sessionDir2,
13876
- eventsPath: resolve16(sessionDir2, "events.jsonl"),
13877
- statePath: resolve16(sessionDir2, "current-review-state.json")
13961
+ eventsPath: resolve17(sessionDir2, "events.jsonl"),
13962
+ statePath: resolve17(sessionDir2, "current-review-state.json")
13878
13963
  };
13879
13964
  }
13880
13965
 
13881
13966
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
13882
13967
  async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
13883
13968
  const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
13884
- await mkdir(paths.sessionDir, { recursive: true });
13969
+ await mkdir3(paths.sessionDir, { recursive: true });
13885
13970
  try {
13886
13971
  await access2(paths.statePath);
13887
- const savedState = await readFile9(paths.statePath, "utf8");
13972
+ const savedState = await readFile10(paths.statePath, "utf8");
13888
13973
  return JSON.parse(savedState);
13889
13974
  } catch {
13890
- await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
13891
- await writeFile(paths.eventsPath, "", "utf8");
13975
+ await writeFile3(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
13976
+ await writeFile3(paths.eventsPath, "", "utf8");
13892
13977
  return initialSnapshot;
13893
13978
  }
13894
13979
  }
13895
13980
 
13896
13981
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
13897
- import { resolve as resolve17 } from "node:path";
13982
+ import { resolve as resolve18 } from "node:path";
13898
13983
  function getRefineArtifactsRoot() {
13899
13984
  if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
13900
- return resolve17(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
13985
+ return resolve18(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
13901
13986
  }
13902
- return resolve17(configRoot(), "reviews");
13987
+ return resolve18(configRoot2(), "reviews");
13903
13988
  }
13904
13989
 
13905
13990
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/save-review-state.js
13906
- import { writeFile as writeFile2 } from "node:fs/promises";
13991
+ import { writeFile as writeFile4 } from "node:fs/promises";
13907
13992
  async function saveReviewState(statePath, session) {
13908
- await writeFile2(statePath, JSON.stringify(session, null, 2), "utf8");
13993
+ await writeFile4(statePath, JSON.stringify(session, null, 2), "utf8");
13909
13994
  }
13910
13995
 
13911
13996
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
@@ -13915,7 +14000,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
13915
14000
  let snapshot;
13916
14001
  try {
13917
14002
  await access3(paths.statePath);
13918
- snapshot = JSON.parse(await readFile10(paths.statePath, "utf8"));
14003
+ snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
13919
14004
  } catch {
13920
14005
  snapshot = await loadAndValidateForReview(sessionId, void 0);
13921
14006
  snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
@@ -13953,7 +14038,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
13953
14038
  }
13954
14039
 
13955
14040
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/reject-components-by-name.js
13956
- import { readFile as readFile11 } from "node:fs/promises";
14041
+ import { readFile as readFile12 } from "node:fs/promises";
13957
14042
  async function rejectComponentsByName(sessionId, names, opts = {}) {
13958
14043
  if (names.length === 0)
13959
14044
  return;
@@ -13969,7 +14054,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
13969
14054
  const nameSet = new Set(names);
13970
14055
  let snapshot;
13971
14056
  try {
13972
- snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
14057
+ snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
13973
14058
  } catch {
13974
14059
  return;
13975
14060
  }
@@ -14124,10 +14209,10 @@ function isSourceFile(name) {
14124
14209
  }
14125
14210
 
14126
14211
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/read-dir-safely.js
14127
- import { readdirSync as readdirSync2 } from "node:fs";
14212
+ import { readdirSync as readdirSync3 } from "node:fs";
14128
14213
  function readDirSafely(dir) {
14129
14214
  try {
14130
- return readdirSync2(dir, { withFileTypes: true });
14215
+ return readdirSync3(dir, { withFileTypes: true });
14131
14216
  } catch {
14132
14217
  return "unreadable";
14133
14218
  }
@@ -14195,7 +14280,7 @@ function collectFiles(root, options = {}) {
14195
14280
  }
14196
14281
 
14197
14282
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/generate-ulid.js
14198
- import { randomBytes as randomBytes2 } from "node:crypto";
14283
+ import { randomBytes as randomBytes3 } from "node:crypto";
14199
14284
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
14200
14285
  function encodeBase32(bytes, length) {
14201
14286
  let out = "";
@@ -14221,12 +14306,12 @@ function generateUlid(now = Date.now()) {
14221
14306
  n = Math.floor(n / 256);
14222
14307
  }
14223
14308
  const ts3 = encodeBase32(tsBytes, 10);
14224
- const rand = encodeBase32(randomBytes2(10), 16);
14309
+ const rand = encodeBase32(randomBytes3(10), 16);
14225
14310
  return (ts3 + rand).toUpperCase();
14226
14311
  }
14227
14312
 
14228
14313
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
14229
- import { readFile as readFile12 } from "node:fs/promises";
14314
+ import { readFile as readFile13 } from "node:fs/promises";
14230
14315
 
14231
14316
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
14232
14317
  function migrateRecord(rec) {
@@ -14245,7 +14330,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
14245
14330
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
14246
14331
  async function readRunsFileMaybe() {
14247
14332
  try {
14248
- const raw = await readFile12(runsFilePath(), "utf8");
14333
+ const raw = await readFile13(runsFilePath(), "utf8");
14249
14334
  const parsed = JSON.parse(raw);
14250
14335
  if (!READABLE_VERSIONS.has(parsed.version)) {
14251
14336
  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.`);
@@ -14261,14 +14346,14 @@ async function readRunsFileMaybe() {
14261
14346
  }
14262
14347
 
14263
14348
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
14264
- import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
14265
- import { dirname as dirname13 } from "node:path";
14349
+ import { mkdir as mkdir4, rename as rename2, writeFile as writeFile5 } from "node:fs/promises";
14350
+ import { dirname as dirname15 } from "node:path";
14266
14351
  async function writeRunsFileAtomic(file) {
14267
- await mkdir2(dirname13(runsFilePath()), { recursive: true });
14352
+ await mkdir4(dirname15(runsFilePath()), { recursive: true });
14268
14353
  const body = JSON.stringify(file, null, 2) + "\n";
14269
14354
  const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
14270
- await writeFile3(tmp, body, { mode: 384 });
14271
- await rename(tmp, runsFilePath());
14355
+ await writeFile5(tmp, body, { mode: 384 });
14356
+ await rename2(tmp, runsFilePath());
14272
14357
  }
14273
14358
 
14274
14359
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/append-run.js
@@ -14304,8 +14389,8 @@ async function updateRun(id, patch) {
14304
14389
  }
14305
14390
 
14306
14391
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
14307
- import { readFile as readFile13, stat } from "node:fs/promises";
14308
- import { resolve as resolve18 } from "node:path";
14392
+ import { readFile as readFile14, stat as stat2 } from "node:fs/promises";
14393
+ import { resolve as resolve19 } from "node:path";
14309
14394
 
14310
14395
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
14311
14396
  import { createHash as createHash8 } from "node:crypto";
@@ -14327,12 +14412,12 @@ async function buildSourceFingerprint(opts) {
14327
14412
  const name = rowField(row, "name");
14328
14413
  if (!sourcePath)
14329
14414
  continue;
14330
- const abs = resolve18(sourcePath);
14415
+ const abs = resolve19(sourcePath);
14331
14416
  if (seen.has(abs))
14332
14417
  continue;
14333
14418
  seen.add(abs);
14334
14419
  try {
14335
- const st = await stat(abs);
14420
+ const st = await stat2(abs);
14336
14421
  const entry = { mtime: st.mtime.toISOString() };
14337
14422
  if (name)
14338
14423
  entry.componentName = name;
@@ -14344,10 +14429,10 @@ async function buildSourceFingerprint(opts) {
14344
14429
  let rawTokensMtime = null;
14345
14430
  let rawTokensContentHash = null;
14346
14431
  if (opts.rawTokensPath) {
14347
- const abs = resolve18(opts.rawTokensPath);
14432
+ const abs = resolve19(opts.rawTokensPath);
14348
14433
  rawTokensPath = abs;
14349
14434
  try {
14350
- const [st, buf] = await Promise.all([stat(abs), readFile13(abs)]);
14435
+ const [st, buf] = await Promise.all([stat2(abs), readFile14(abs)]);
14351
14436
  rawTokensMtime = st.mtime.toISOString();
14352
14437
  rawTokensContentHash = sha256Hex(buf);
14353
14438
  } catch {
@@ -14358,7 +14443,7 @@ async function buildSourceFingerprint(opts) {
14358
14443
 
14359
14444
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
14360
14445
  import { access as access4 } from "node:fs/promises";
14361
- import { join as join11 } from "node:path";
14446
+ import { join as join14 } from "node:path";
14362
14447
 
14363
14448
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
14364
14449
  var SAVE_FILES = ["components.json", "tokens.json"];
@@ -14368,7 +14453,7 @@ async function listConflictingFiles(path5) {
14368
14453
  const conflicts = [];
14369
14454
  for (const name of SAVE_FILES) {
14370
14455
  try {
14371
- await access4(join11(path5, name));
14456
+ await access4(join14(path5, name));
14372
14457
  conflicts.push(name);
14373
14458
  } catch {
14374
14459
  }
@@ -14382,7 +14467,7 @@ async function detectSaveConflict(path5) {
14382
14467
  }
14383
14468
 
14384
14469
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
14385
- import { join as join12 } from "node:path";
14470
+ import { join as join15 } from "node:path";
14386
14471
  function pad2(n) {
14387
14472
  return n < 10 ? `0${n}` : String(n);
14388
14473
  }
@@ -14393,11 +14478,11 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
14393
14478
  const hh = pad2(now.getHours());
14394
14479
  const mm = pad2(now.getMinutes());
14395
14480
  const ss = pad2(now.getSeconds());
14396
- return join12(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
14481
+ return join15(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
14397
14482
  }
14398
14483
 
14399
14484
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/services/write-scope-decisions-snapshot.js
14400
- import { mkdir as mkdir3 } from "node:fs/promises";
14485
+ import { mkdir as mkdir5 } from "node:fs/promises";
14401
14486
  async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
14402
14487
  const acceptedSet = new Set(decisions.accepted);
14403
14488
  const rawComponents = loadRawComponents(db, sessionId);
@@ -14424,17 +14509,17 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
14424
14509
  };
14425
14510
  });
14426
14511
  const paths = await getRefineSessionPaths(sessionId, getRefineArtifactsRoot());
14427
- await mkdir3(paths.sessionDir, { recursive: true });
14512
+ await mkdir5(paths.sessionDir, { recursive: true });
14428
14513
  await saveReviewState(paths.statePath, { components: records });
14429
14514
  }
14430
14515
 
14431
14516
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/load-accepted-names.js
14432
- import { readFile as readFile14 } from "node:fs/promises";
14517
+ import { readFile as readFile15 } from "node:fs/promises";
14433
14518
  async function loadAcceptedNames(sessionId) {
14434
14519
  try {
14435
14520
  const artifactsRoot = getRefineArtifactsRoot();
14436
14521
  const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
14437
- const raw = await readFile14(paths.statePath, "utf8");
14522
+ const raw = await readFile15(paths.statePath, "utf8");
14438
14523
  const snapshot = JSON.parse(raw);
14439
14524
  const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
14440
14525
  if (accepted.length === 0)
@@ -14449,7 +14534,7 @@ async function loadAcceptedNames(sessionId) {
14449
14534
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
14450
14535
 
14451
14536
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
14452
- import { randomBytes as randomBytes3 } from "node:crypto";
14537
+ import { randomBytes as randomBytes4 } from "node:crypto";
14453
14538
  var ADJECTIVES2 = [
14454
14539
  "bright",
14455
14540
  "calm",
@@ -14498,7 +14583,7 @@ var NOUNS2 = [
14498
14583
  function generateSessionId2() {
14499
14584
  const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
14500
14585
  const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
14501
- const hex = randomBytes3(2).toString("hex");
14586
+ const hex = randomBytes4(2).toString("hex");
14502
14587
  return `${adj}-${noun}-${hex}`;
14503
14588
  }
14504
14589
 
@@ -15760,11 +15845,11 @@ function formatApiError2(request) {
15760
15845
 
15761
15846
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
15762
15847
  init_shared();
15763
- import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
15848
+ import { readFile as readFile16, stat as stat4 } from "node:fs/promises";
15764
15849
 
15765
15850
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
15766
- import { readdir, stat as stat2 } from "node:fs/promises";
15767
- import { join as join13 } from "node:path";
15851
+ import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
15852
+ import { join as join16 } from "node:path";
15768
15853
  var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
15769
15854
  async function collectJsonFiles(dir) {
15770
15855
  const results = [];
@@ -15774,17 +15859,17 @@ async function collectJsonFiles(dir) {
15774
15859
  async function walk(current, results) {
15775
15860
  let entries;
15776
15861
  try {
15777
- entries = await readdir(current);
15862
+ entries = await readdir2(current);
15778
15863
  } catch {
15779
15864
  return;
15780
15865
  }
15781
15866
  await Promise.all(entries.map(async (entry) => {
15782
15867
  if (IGNORE_TOKEN_DIRS.has(entry))
15783
15868
  return;
15784
- const full = join13(current, entry);
15869
+ const full = join16(current, entry);
15785
15870
  let s;
15786
15871
  try {
15787
- s = await stat2(full);
15872
+ s = await stat3(full);
15788
15873
  } catch {
15789
15874
  return;
15790
15875
  }
@@ -15800,7 +15885,7 @@ async function walk(current, results) {
15800
15885
  async function readTokensFromPath(flag, p) {
15801
15886
  let s;
15802
15887
  try {
15803
- s = await stat3(p);
15888
+ s = await stat4(p);
15804
15889
  } catch {
15805
15890
  throw new Error(`file not found: ${p} (from ${flag})`);
15806
15891
  }
@@ -15819,7 +15904,7 @@ async function readMergedFromDir(flag, dir) {
15819
15904
  const merged = {};
15820
15905
  for (const file of files.sort()) {
15821
15906
  try {
15822
- const text = await readFile15(file, "utf8");
15907
+ const text = await readFile16(file, "utf8");
15823
15908
  const parsed = JSON.parse(text);
15824
15909
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
15825
15910
  Object.assign(merged, parsed);
@@ -15833,7 +15918,7 @@ async function readMergedFromDir(flag, dir) {
15833
15918
  async function readSingleFile(flag, p) {
15834
15919
  let text;
15835
15920
  try {
15836
- text = await readFile15(p, "utf8");
15921
+ text = await readFile16(p, "utf8");
15837
15922
  } catch {
15838
15923
  throw new Error(`file not found: ${p} (from ${flag})`);
15839
15924
  }
@@ -15878,8 +15963,8 @@ function buildContentfulManagementClient(request) {
15878
15963
  }
15879
15964
 
15880
15965
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
15881
- import { writeFile as writeFile4 } from "node:fs/promises";
15882
- import { join as join14 } from "node:path";
15966
+ import { writeFile as writeFile6 } from "node:fs/promises";
15967
+ import { join as join17 } from "node:path";
15883
15968
 
15884
15969
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
15885
15970
  import { fetchAll } from "contentful-management";
@@ -15911,8 +15996,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
15911
15996
  spaceId: request.spaceId,
15912
15997
  environmentId: request.environmentId
15913
15998
  });
15914
- const path5 = join14(request.outDir, ".existing-entities.json");
15915
- await writeFile4(path5, JSON.stringify(entities, null, 2), "utf8");
15999
+ const path5 = join17(request.outDir, ".existing-entities.json");
16000
+ await writeFile6(path5, JSON.stringify(entities, null, 2), "utf8");
15916
16001
  return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
15917
16002
  } catch (error) {
15918
16003
  return {
@@ -15924,12 +16009,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
15924
16009
  }
15925
16010
 
15926
16011
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/read-from-session.js
15927
- import { readFile as readFile16 } from "node:fs/promises";
16012
+ import { readFile as readFile17 } from "node:fs/promises";
15928
16013
  async function readExistingContentfulEntitiesFromSession(request) {
15929
16014
  if (!request.path)
15930
16015
  return void 0;
15931
16016
  try {
15932
- const raw = await readFile16(request.path, "utf8");
16017
+ const raw = await readFile17(request.path, "utf8");
15933
16018
  const parsed = JSON.parse(raw);
15934
16019
  if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
15935
16020
  return void 0;
@@ -16269,7 +16354,7 @@ init_describe_agent_failure();
16269
16354
  init_resolve_binary();
16270
16355
  init_resolve_skill_path();
16271
16356
  init_parse_map_token_prop_tool_calls();
16272
- import { resolve as resolve19 } from "node:path";
16357
+ import { resolve as resolve20 } from "node:path";
16273
16358
  init_cache_keys();
16274
16359
 
16275
16360
  // packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
@@ -16578,7 +16663,7 @@ async function runMapTokens(request) {
16578
16663
  outDir: process.cwd(),
16579
16664
  existingTokensInline: request.existingEntitiesInline,
16580
16665
  ...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
16581
- ...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve19(request.skillPathOverride) } : {}
16666
+ ...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve20(request.skillPathOverride) } : {}
16582
16667
  });
16583
16668
  if (request.printPrompt) {
16584
16669
  const prompt2 = await buildMapPrompt();
@@ -16637,7 +16722,7 @@ async function runMapTokens(request) {
16637
16722
  }
16638
16723
 
16639
16724
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/run-extract-and-compose-session.js
16640
- import { mkdir as mkdir4 } from "node:fs/promises";
16725
+ import { mkdir as mkdir6 } from "node:fs/promises";
16641
16726
  import { relative as relative2 } from "node:path";
16642
16727
 
16643
16728
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/quality/non-authorable-filter.js
@@ -16694,7 +16779,7 @@ function hasNoAuthoringSurface(component) {
16694
16779
  }
16695
16780
 
16696
16781
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/source-inspection.js
16697
- import { readFile as readFile17 } from "node:fs/promises";
16782
+ import { readFile as readFile18 } from "node:fs/promises";
16698
16783
 
16699
16784
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
16700
16785
  var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
@@ -16796,7 +16881,7 @@ function dedupeReasons(reasons) {
16796
16881
  async function inspectComponentSource(component) {
16797
16882
  let sourceText = "";
16798
16883
  try {
16799
- sourceText = await readFile17(component.source, "utf8");
16884
+ sourceText = await readFile18(component.source, "utf8");
16800
16885
  } catch {
16801
16886
  return {
16802
16887
  wrapperConfidence: 0,
@@ -17235,7 +17320,7 @@ function resolveCompositionAgentName(flagValue) {
17235
17320
  }
17236
17321
 
17237
17322
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-extract-and-compose-session/helpers/read-candidate-files.js
17238
- import { readFile as readFile18 } from "node:fs/promises";
17323
+ import { readFile as readFile19 } from "node:fs/promises";
17239
17324
  async function readCandidateFiles(components, extraFiles = []) {
17240
17325
  const paths = new Set(extraFiles);
17241
17326
  for (const c2 of components) {
@@ -17245,7 +17330,7 @@ async function readCandidateFiles(components, extraFiles = []) {
17245
17330
  const out = [];
17246
17331
  await Promise.all([...paths].map(async (p) => {
17247
17332
  try {
17248
- const content = await readFile18(p, "utf8");
17333
+ const content = await readFile19(p, "utf8");
17249
17334
  out.push({ path: p, content });
17250
17335
  } catch {
17251
17336
  }
@@ -17359,7 +17444,7 @@ async function runExtractAndComposeSession(request) {
17359
17444
  onProgress,
17360
17445
  onDebugEvent
17361
17446
  });
17362
- await mkdir4(outDir, { recursive: true });
17447
+ await mkdir6(outDir, { recursive: true });
17363
17448
  const { sessionId } = getOrCreateSession(db, void 0, void 0, {
17364
17449
  command: "analyze extract",
17365
17450
  inputPath: projectPath,
@@ -17416,15 +17501,15 @@ init_build_prompt();
17416
17501
  init_create_local_cli_agent_invoker();
17417
17502
  init_invoke_agent_with_output();
17418
17503
  init_parse_token_tool_calls();
17419
- import { readFile as readFile19 } from "node:fs/promises";
17504
+ import { readFile as readFile20 } from "node:fs/promises";
17420
17505
  import { basename as basename5, resolve as pathResolve } from "node:path";
17421
17506
  init_cache_keys();
17422
17507
  init_parse_prompt_overrides();
17423
17508
  init_resolve_prompt_override();
17424
17509
 
17425
17510
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
17426
- import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
17427
- import { join as join15 } from "node:path";
17511
+ import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
17512
+ import { join as join18 } from "node:path";
17428
17513
  async function writeTokensFile(db, sessionId, outDir, onProgress) {
17429
17514
  onProgress?.({ kind: "writing-file" });
17430
17515
  const result = getDtcgTokensForSession(db, sessionId);
@@ -17432,9 +17517,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
17432
17517
  throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
17433
17518
  }
17434
17519
  const tree = rebuildDTCGTree(result.groups, result.tokens);
17435
- const tokensPath = join15(outDir, "tokens.json");
17436
- await mkdir5(outDir, { recursive: true });
17437
- await writeFile5(tokensPath, `${JSON.stringify(tree, null, 2)}
17520
+ const tokensPath = join18(outDir, "tokens.json");
17521
+ await mkdir7(outDir, { recursive: true });
17522
+ await writeFile7(tokensPath, `${JSON.stringify(tree, null, 2)}
17438
17523
  `);
17439
17524
  return { tokensPath, tokenCount: result.tokens.length };
17440
17525
  }
@@ -17449,7 +17534,7 @@ async function runGenerateTokensSession(request) {
17449
17534
  throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
17450
17535
  const tokensOverride = overridesMap.get("tokens");
17451
17536
  const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
17452
- const rawTokensInline = await readFile19(pathResolve(rawTokensPath), "utf8");
17537
+ const rawTokensInline = await readFile20(pathResolve(rawTokensPath), "utf8");
17453
17538
  const tokenInputHash = hashTokenContent(rawTokensInline);
17454
17539
  const db = openPipelineDb();
17455
17540
  try {
@@ -17566,7 +17651,7 @@ async function readExistingEntities(request) {
17566
17651
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
17567
17652
  init_parse_prompt_overrides();
17568
17653
  init_resolve_prompt_override();
17569
- import { resolve as resolve20 } from "node:path";
17654
+ import { resolve as resolve21 } from "node:path";
17570
17655
  async function resolveGeneratePrompt(overrides) {
17571
17656
  const { overrides: parsed, errors } = parsePromptOverrides(overrides);
17572
17657
  if (errors.length > 0)
@@ -17577,7 +17662,7 @@ async function resolveGeneratePrompt(overrides) {
17577
17662
  const text = await resolvePromptOverride(entry);
17578
17663
  if (entry.kind === "text")
17579
17664
  return { text };
17580
- return { path: resolve20(entry.value), text };
17665
+ return { path: resolve21(entry.value), text };
17581
17666
  }
17582
17667
 
17583
17668
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
@@ -17961,7 +18046,7 @@ function PathValidationScreen({
17961
18046
  }) {
17962
18047
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
17963
18048
  const [scan, setScan] = useState7();
17964
- useEffect4(() => {
18049
+ useEffect6(() => {
17965
18050
  setScan(scanFiles(resolvedPath));
17966
18051
  }, [resolvedPath]);
17967
18052
  const phase = phaseOf(scan);
@@ -17988,7 +18073,7 @@ function PathValidationScreen({
17988
18073
  }
17989
18074
 
17990
18075
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
17991
- import { useRef as useRef2, useState as useState9 } from "react";
18076
+ import { useRef as useRef4, useState as useState9 } from "react";
17992
18077
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
17993
18078
 
17994
18079
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
@@ -18240,7 +18325,7 @@ function CredentialsScreen({
18240
18325
  validate: validate3 = validateCredentials,
18241
18326
  tokensOnly = false
18242
18327
  }) {
18243
- const initialValues = useRef2(
18328
+ const initialValues = useRef4(
18244
18329
  normalize({
18245
18330
  spaceId: initial.spaceId ?? "",
18246
18331
  environmentId: initial.environmentId || "master",
@@ -18621,23 +18706,23 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
18621
18706
  init_config();
18622
18707
 
18623
18708
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18624
- import { useEffect as useEffect5, useRef as useRef3, useState as useState11 } from "react";
18709
+ import { useEffect as useEffect7, useRef as useRef5, useState as useState11 } from "react";
18625
18710
 
18626
18711
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
18627
- import { mkdir as mkdir7 } from "node:fs/promises";
18628
- import { join as join18, resolve as resolve23 } from "node:path";
18712
+ import { mkdir as mkdir8 } from "node:fs/promises";
18713
+ import { join as join20, resolve as resolve24 } from "node:path";
18629
18714
 
18630
18715
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
18631
- import { existsSync as existsSync8 } from "node:fs";
18632
- import { dirname as dirname15, join as join17, resolve as resolve21 } from "node:path";
18716
+ import { existsSync as existsSync9 } from "node:fs";
18717
+ import { dirname as dirname16, join as join19, resolve as resolve22 } from "node:path";
18633
18718
  import { fileURLToPath as fileURLToPath4 } from "node:url";
18634
18719
  function findSkillPath(fileName) {
18635
- const thisDir = dirname15(fileURLToPath4(import.meta.url));
18720
+ const thisDir = dirname16(fileURLToPath4(import.meta.url));
18636
18721
  let dir = thisDir;
18637
18722
  for (; ; ) {
18638
- const candidate = join17(dir, "skills", fileName);
18639
- if (existsSync8(candidate)) return candidate;
18640
- const parent = resolve21(dir, "..");
18723
+ const candidate = join19(dir, "skills", fileName);
18724
+ if (existsSync9(candidate)) return candidate;
18725
+ const parent = resolve22(dir, "..");
18641
18726
  if (parent === dir) {
18642
18727
  throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
18643
18728
  }
@@ -18646,11 +18731,11 @@ function findSkillPath(fileName) {
18646
18731
  }
18647
18732
 
18648
18733
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
18649
- import { resolve as resolve22 } from "node:path";
18734
+ import { resolve as resolve23 } from "node:path";
18650
18735
  var SELECT_SKILL_PATH = findSkillPath("select-components.md");
18651
18736
  var DEFAULT_TIMEOUT_MS5 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
18652
18737
  async function hashSelectPrompt(options) {
18653
- const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve22(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
18738
+ const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve23(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
18654
18739
  return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
18655
18740
  }
18656
18741
  async function runSelection(options) {
@@ -18745,7 +18830,7 @@ var realDeps = {
18745
18830
  var fail = (step, message) => ({ ok: false, step, message });
18746
18831
  var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
18747
18832
  async function runExtraction(input, onProgress, deps = realDeps) {
18748
- const outDir = input.outDir ?? join18(resolve23(input.projectPath), ".contentful");
18833
+ const outDir = input.outDir ?? join20(resolve24(input.projectPath), ".contentful");
18749
18834
  let progress = initialProgress({
18750
18835
  hasCredentials: input.credentials !== null,
18751
18836
  hasRawTokens: input.rawTokensPath !== ""
@@ -18849,7 +18934,7 @@ async function runExtraction(input, onProgress, deps = realDeps) {
18849
18934
  }
18850
18935
  async function fetchEntities(credentials, outDir) {
18851
18936
  try {
18852
- await mkdir7(outDir, { recursive: true });
18937
+ await mkdir8(outDir, { recursive: true });
18853
18938
  const result = await fetchAndPersistExistingContentfulEntities({
18854
18939
  spaceId: credentials.spaceId,
18855
18940
  environmentId: credentials.environmentId,
@@ -18869,7 +18954,7 @@ async function resolveSelectionPrompt(overrides) {
18869
18954
  if (select?.kind === "text") return { promptText: select.value };
18870
18955
  if (select?.kind === "path") {
18871
18956
  await resolvePromptOverride(select);
18872
- return { promptPath: resolve23(select.value) };
18957
+ return { promptPath: resolve24(select.value) };
18873
18958
  }
18874
18959
  return {};
18875
18960
  }
@@ -18877,8 +18962,8 @@ async function resolveSelectionPrompt(overrides) {
18877
18962
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18878
18963
  function useExtraction(input) {
18879
18964
  const [state2, setState] = useState11();
18880
- const current = useRef3();
18881
- useEffect5(() => {
18965
+ const current = useRef5();
18966
+ useEffect7(() => {
18882
18967
  current.current = input;
18883
18968
  if (!input) {
18884
18969
  setState(void 0);
@@ -18904,7 +18989,7 @@ function useExtraction(input) {
18904
18989
  }
18905
18990
 
18906
18991
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18907
- import { useEffect as useEffect6, useRef as useRef4, useState as useState12 } from "react";
18992
+ import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
18908
18993
 
18909
18994
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
18910
18995
  var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
@@ -18938,8 +19023,8 @@ async function runTokensOnly(input, deps = realDeps2) {
18938
19023
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18939
19024
  function useTokensOnly(input) {
18940
19025
  const [state2, setState] = useState12();
18941
- const current = useRef4();
18942
- useEffect6(() => {
19026
+ const current = useRef6();
19027
+ useEffect8(() => {
18943
19028
  current.current = input;
18944
19029
  if (!input) {
18945
19030
  setState(void 0);
@@ -19198,6 +19283,7 @@ function GotoBanner({
19198
19283
  borderStyle: "single",
19199
19284
  borderColor: PALETTE.accent,
19200
19285
  paddingX: 1,
19286
+ paddingBottom: 1,
19201
19287
  marginTop: width === void 0 ? 1 : 0,
19202
19288
  width,
19203
19289
  flexShrink: 0,
@@ -19209,7 +19295,7 @@ function GotoBanner({
19209
19295
  return renderRow(row, i, i === highlightIndex);
19210
19296
  }),
19211
19297
  moreBelow > 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: ` \u25BC ${moreBelow} more` }),
19212
- footerHint !== void 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint })
19298
+ footerHint !== void 0 && /* @__PURE__ */ jsx24(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint }) })
19213
19299
  ]
19214
19300
  }
19215
19301
  );
@@ -19707,11 +19793,11 @@ function buildVisibleRows(props) {
19707
19793
  if (!expanded) continue;
19708
19794
  const subtree = computeCycleMemberSubtree(key);
19709
19795
  const isLastAtDepthSubtree = (idx) => {
19710
- const own = subtree[idx].depth;
19796
+ const own2 = subtree[idx].depth;
19711
19797
  for (let j = idx + 1; j < subtree.length; j++) {
19712
19798
  const d = subtree[j].depth;
19713
- if (d < own) return true;
19714
- if (d === own) return false;
19799
+ if (d < own2) return true;
19800
+ if (d === own2) return false;
19715
19801
  }
19716
19802
  return true;
19717
19803
  };
@@ -19831,11 +19917,11 @@ function buildVisibleRows(props) {
19831
19917
  injectedChildren.push({ name: c2.name, depth: c2.depth, isCycleChild: false });
19832
19918
  }
19833
19919
  const isLastAtDepth = (idx) => {
19834
- const own = injectedChildren[idx].depth;
19920
+ const own2 = injectedChildren[idx].depth;
19835
19921
  for (let j = idx + 1; j < injectedChildren.length; j++) {
19836
19922
  const d = injectedChildren[j].depth;
19837
- if (d < own) return true;
19838
- if (d === own) return false;
19923
+ if (d < own2) return true;
19924
+ if (d === own2) return false;
19839
19925
  }
19840
19926
  return true;
19841
19927
  };
@@ -20068,7 +20154,7 @@ import React11 from "react";
20068
20154
  import { Box as Box23, Text as Text24 } from "ink";
20069
20155
 
20070
20156
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
20071
- import { useLayoutEffect, useRef as useRef5 } from "react";
20157
+ import { useLayoutEffect, useRef as useRef7 } from "react";
20072
20158
  import { useStdin } from "ink";
20073
20159
  function parseInput(data) {
20074
20160
  const isShiftTab = data === "\x1B[Z";
@@ -20131,7 +20217,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
20131
20217
  }
20132
20218
  function useImmediateInput(handler, enabled = true) {
20133
20219
  const { stdin, setRawMode } = useStdin();
20134
- const handlerRef = useRef5(handler);
20220
+ const handlerRef = useRef7(handler);
20135
20221
  handlerRef.current = handler;
20136
20222
  useLayoutEffect(() => {
20137
20223
  if (!enabled) return;
@@ -20142,7 +20228,7 @@ function useImmediateInput(handler, enabled = true) {
20142
20228
 
20143
20229
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
20144
20230
  import { useStdout as useStdout2 } from "ink";
20145
- import { useEffect as useEffect7, useState as useState13 } from "react";
20231
+ import { useEffect as useEffect9, useState as useState13 } from "react";
20146
20232
  function readTerminalSize(stdout) {
20147
20233
  return {
20148
20234
  columns: stdout?.columns ?? 80,
@@ -20152,7 +20238,7 @@ function readTerminalSize(stdout) {
20152
20238
  function useTerminalSize() {
20153
20239
  const { stdout } = useStdout2();
20154
20240
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
20155
- useEffect7(() => {
20241
+ useEffect9(() => {
20156
20242
  const updateSize = () => setSize(readTerminalSize(stdout));
20157
20243
  stdout?.on("resize", updateSize);
20158
20244
  updateSize();
@@ -20335,7 +20421,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
20335
20421
  }
20336
20422
 
20337
20423
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
20338
- import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef6, useState as useState16 } from "react";
20424
+ import { useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState16 } from "react";
20339
20425
 
20340
20426
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
20341
20427
  var TWO_COLUMN_MIN_WIDTH = 100;
@@ -21071,8 +21157,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21071
21157
  for (const p of cycleParticipants) seed.add(p);
21072
21158
  return seed;
21073
21159
  });
21074
- const seededGroupsRef = useRef6(closures.size > 0 || cycleParticipants.size > 0);
21075
- useEffect8(() => {
21160
+ const seededGroupsRef = useRef8(closures.size > 0 || cycleParticipants.size > 0);
21161
+ useEffect10(() => {
21076
21162
  if (seededGroupsRef.current) return;
21077
21163
  if (closures.size === 0 && cycleParticipants.size === 0) return;
21078
21164
  seededGroupsRef.current = true;
@@ -21163,7 +21249,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21163
21249
  entryCount: 0
21164
21250
  });
21165
21251
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
21166
- useEffect8(() => {
21252
+ useEffect10(() => {
21167
21253
  setNav((prev) => {
21168
21254
  const maxIdx = Math.max(0, visibleRows.length - 1);
21169
21255
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -21638,7 +21724,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
21638
21724
  }
21639
21725
 
21640
21726
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
21641
- import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef7, useState as useState17 } from "react";
21727
+ import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef9, useState as useState17 } from "react";
21642
21728
 
21643
21729
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
21644
21730
  async function checkGenerationCache(input) {
@@ -21685,9 +21771,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
21685
21771
  function useScopeGateFlow(input, deps = realDeps3) {
21686
21772
  const sessionId = input?.sessionId;
21687
21773
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
21688
- const cacheCheck = useRef7(void 0);
21774
+ const cacheCheck = useRef9(void 0);
21689
21775
  const [confirmed, setConfirmed] = useState17();
21690
- useEffect9(() => {
21776
+ useEffect11(() => {
21691
21777
  if (!input || !loaded?.ok || cacheCheck.current) return;
21692
21778
  cacheCheck.current = deps.checkCache(input.cache);
21693
21779
  }, [input, loaded]);
@@ -21714,7 +21800,7 @@ var capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
21714
21800
  function describeGeneration(input) {
21715
21801
  const agent = capitalize(input.agent);
21716
21802
  return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
21717
- ${agent} is reading each selected component and writing a Contentful component definition for it${input.hasTokens ? " Using your design tokens for prop resolution." : ""}`;
21803
+ ${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
21718
21804
  }
21719
21805
  function progressRows2(progress, agent) {
21720
21806
  const name = capitalize(agent);
@@ -21754,10 +21840,10 @@ function GenerationScreen({
21754
21840
  }
21755
21841
 
21756
21842
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21757
- import { useEffect as useEffect10, useRef as useRef8, useState as useState18 } from "react";
21843
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState18 } from "react";
21758
21844
 
21759
21845
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
21760
- import { resolve as resolve24 } from "node:path";
21846
+ import { resolve as resolve25 } from "node:path";
21761
21847
 
21762
21848
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
21763
21849
  async function prepareMapTokens(input, generatedSessionId) {
@@ -21892,7 +21978,7 @@ async function buildMapTokensOptions(input) {
21892
21978
  if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
21893
21979
  if (mapOverride?.kind === "path") {
21894
21980
  await resolvePromptOverride(mapOverride);
21895
- prompt.skillPathOverride = resolve24(mapOverride.value);
21981
+ prompt.skillPathOverride = resolve25(mapOverride.value);
21896
21982
  }
21897
21983
  if (input.existingEntitiesPath) {
21898
21984
  const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
@@ -21919,8 +22005,8 @@ function applyProgressEvent2(event, previous, total) {
21919
22005
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21920
22006
  function useGeneration(input) {
21921
22007
  const [state2, setState] = useState18();
21922
- const current = useRef8();
21923
- useEffect10(() => {
22008
+ const current = useRef10();
22009
+ useEffect12(() => {
21924
22010
  current.current = input;
21925
22011
  if (!input) {
21926
22012
  setState(void 0);
@@ -21940,7 +22026,7 @@ function useGeneration(input) {
21940
22026
  }
21941
22027
 
21942
22028
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
21943
- import { join as join19 } from "node:path";
22029
+ import { join as join21 } from "node:path";
21944
22030
  function buildFlowStart(input) {
21945
22031
  const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
21946
22032
  const credentials = extraction.credentials ?? {
@@ -21953,7 +22039,7 @@ function buildFlowStart(input) {
21953
22039
  handoff,
21954
22040
  agent: extraction.agent,
21955
22041
  projectPath: extraction.projectPath,
21956
- outDir: extraction.projectPath ? join19(extraction.projectPath, ".contentful") : "",
22042
+ outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
21957
22043
  rawTokensPath: extraction.rawTokensPath,
21958
22044
  credentials: {
21959
22045
  spaceId: credentials.spaceId,
@@ -22252,6 +22338,94 @@ var DTCGTokenSchema2 = z4.strictObject({
22252
22338
  // packages/experience-design-system-types/dist/src/dtcg/validate.js
22253
22339
  var TOKEN_TYPE_SET4 = new Set(DESIGN_TOKEN_TYPES2);
22254
22340
 
22341
+ // packages/experience-design-system-types/dist/src/property-contract/json-value.js
22342
+ var nodeTypes = globalThis.process?.getBuiltinModule?.("node:util")?.types;
22343
+
22344
+ // packages/experience-design-system-types/dist/src/property-contract/date-time-value.js
22345
+ import * as z5 from "zod/mini";
22346
+ var dateTimeValueSchema = z5.iso.datetime({ offset: true });
22347
+
22348
+ // packages/experience-design-system-types/dist/src/property-contract/target-definition.js
22349
+ var TARGET_PROPERTY_TYPES = [
22350
+ "String",
22351
+ "Number",
22352
+ "Boolean",
22353
+ "Array",
22354
+ "Record",
22355
+ "Integer",
22356
+ "DateTime",
22357
+ "RichText",
22358
+ "JSON",
22359
+ "ResourceLink",
22360
+ "Literal",
22361
+ "DiscriminatedUnion"
22362
+ ];
22363
+ var SAME_SPACE_RESOURCE_SOURCE = "crn:contentful:::content:spaces/$self/environments/$self";
22364
+ var targetDefinitionJsonSchema = {
22365
+ $schema: "http://json-schema.org/draft-07/schema#",
22366
+ $ref: "#/definitions/target",
22367
+ definitions: {
22368
+ target: {
22369
+ type: "object",
22370
+ required: ["type"],
22371
+ properties: {
22372
+ type: { enum: [...TARGET_PROPERTY_TYPES] },
22373
+ id: { type: "string" },
22374
+ name: { type: "string" },
22375
+ description: { type: "string" },
22376
+ required: { type: "boolean" },
22377
+ values: { type: "array", minItems: 1 },
22378
+ defaultValue: {},
22379
+ items: { $ref: "#/definitions/target" },
22380
+ fields: { type: "object", minProperties: 1, additionalProperties: { $ref: "#/definitions/target" } },
22381
+ allowedResources: {
22382
+ type: "array",
22383
+ minItems: 1,
22384
+ items: {
22385
+ type: "object",
22386
+ required: ["type", "source"],
22387
+ properties: {
22388
+ type: { enum: ["Contentful:Entry", "Contentful:Asset"] },
22389
+ source: { const: SAME_SPACE_RESOURCE_SOURCE },
22390
+ allowedTypes: { type: "array", items: { type: "string" } }
22391
+ },
22392
+ allOf: [
22393
+ {
22394
+ if: { properties: { type: { const: "Contentful:Entry" } } },
22395
+ then: { required: ["allowedTypes"] },
22396
+ else: { not: { required: ["allowedTypes"] } }
22397
+ }
22398
+ ],
22399
+ additionalProperties: false
22400
+ }
22401
+ },
22402
+ value: {},
22403
+ valueType: { $ref: "#/definitions/target" },
22404
+ discriminator: { type: "string", minLength: 1 },
22405
+ members: {
22406
+ type: "array",
22407
+ minItems: 2,
22408
+ uniqueItems: true,
22409
+ items: {
22410
+ allOf: [
22411
+ { $ref: "#/definitions/target" },
22412
+ { type: "object", properties: { type: { const: "Record" } }, required: ["type", "fields"] }
22413
+ ]
22414
+ }
22415
+ }
22416
+ },
22417
+ allOf: [
22418
+ {
22419
+ if: { properties: { type: { const: "DiscriminatedUnion" } } },
22420
+ then: { required: ["discriminator", "members"] },
22421
+ else: { not: { anyOf: [{ required: ["discriminator"] }, { required: ["members"] }] } }
22422
+ }
22423
+ ],
22424
+ additionalProperties: false
22425
+ }
22426
+ }
22427
+ };
22428
+
22255
22429
  // packages/experience-design-system-cli/src/tui/import/steps/preview-validation-error/logic.ts
22256
22430
  function failedComponentNames(errors) {
22257
22431
  return [...new Set(errors.map((error) => error.componentName))];
@@ -22313,7 +22487,7 @@ function PreviewValidationErrorScreen({
22313
22487
  }
22314
22488
 
22315
22489
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
22316
- import { useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo6, useRef as useRef13, useState as useState26 } from "react";
22490
+ import { useCallback as useCallback5, useEffect as useEffect19, useMemo as useMemo6, useRef as useRef15, useState as useState26 } from "react";
22317
22491
  import figures8 from "figures";
22318
22492
 
22319
22493
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
@@ -22372,14 +22546,14 @@ function computeRenderStatuses(closure, directIssues) {
22372
22546
  for (const node of closure.nodes) {
22373
22547
  nodesByName.set(node.name, { name: node.name, path: node.path });
22374
22548
  }
22375
- const own = /* @__PURE__ */ new Map();
22549
+ const own2 = /* @__PURE__ */ new Map();
22376
22550
  for (const node of closure.nodes) {
22377
22551
  const s = directIssues.get(node.name);
22378
- if (s && s !== "ok") own.set(node.name, s);
22552
+ if (s && s !== "ok") own2.set(node.name, s);
22379
22553
  }
22380
22554
  const inheritedSources = /* @__PURE__ */ new Map();
22381
22555
  for (const node of closure.nodes) {
22382
- const ownStatus = own.get(node.name);
22556
+ const ownStatus = own2.get(node.name);
22383
22557
  if (!ownStatus) continue;
22384
22558
  for (let i = 0; i < node.path.length - 1; i++) {
22385
22559
  const ancestor = node.path[i];
@@ -22387,7 +22561,7 @@ function computeRenderStatuses(closure, directIssues) {
22387
22561
  inheritedSources.get(ancestor).set(node.name, ownStatus);
22388
22562
  }
22389
22563
  }
22390
- for (const [name, status] of own.entries()) {
22564
+ for (const [name, status] of own2.entries()) {
22391
22565
  out.set(name, {
22392
22566
  status,
22393
22567
  isOwn: true,
@@ -22574,7 +22748,7 @@ function enumerateCycleBreaks(cycle, components) {
22574
22748
  import { Box as Box32, Text as Text34 } from "ink";
22575
22749
 
22576
22750
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
22577
- import React13, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22751
+ import React13, { useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22578
22752
  import figures6 from "figures";
22579
22753
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
22580
22754
 
@@ -23372,6 +23546,7 @@ function FieldEditor({
23372
23546
  const [rationaleOpen, setRationaleOpen] = useState19(false);
23373
23547
  const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
23374
23548
  const [showHelp, setShowHelp] = useState19(false);
23549
+ const [pendingDelete, setPendingDelete] = useState19(null);
23375
23550
  const props = editorState.props;
23376
23551
  const slots = editorState.slots;
23377
23552
  const contentPropIndexes = React13.useMemo(
@@ -23463,6 +23638,46 @@ function FieldEditor({
23463
23638
  setEditorState(next);
23464
23639
  onChange(serializeState(next, value));
23465
23640
  };
23641
+ const deleteRow = (row) => {
23642
+ if (row.kind === "prop") {
23643
+ const nextProps = removeAt(editorState.props, row.idx);
23644
+ commit({ ...editorState, props: nextProps });
23645
+ setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
23646
+ const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
23647
+ const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23648
+ if (!neighbour2) {
23649
+ setInSlots(false);
23650
+ setInComponentDesc(true);
23651
+ setFocusLevel("componentDescription");
23652
+ } else if (neighbour2.kind === "prop") {
23653
+ setInSlots(false);
23654
+ setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
23655
+ setFocusLevel("prop");
23656
+ } else {
23657
+ setInSlots(true);
23658
+ setSlotIdx(neighbour2.idx);
23659
+ setFocusLevel("slot");
23660
+ }
23661
+ return;
23662
+ }
23663
+ const nextSlots = removeAt(editorState.slots, row.idx);
23664
+ commit({ ...editorState, slots: nextSlots });
23665
+ const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
23666
+ const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23667
+ if (!neighbour) {
23668
+ setInSlots(false);
23669
+ setInComponentDesc(true);
23670
+ setFocusLevel("componentDescription");
23671
+ } else if (neighbour.kind === "slot") {
23672
+ setInSlots(true);
23673
+ setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
23674
+ setFocusLevel("slot");
23675
+ } else {
23676
+ setInSlots(false);
23677
+ setPropIdx(neighbour.idx);
23678
+ setFocusLevel("prop");
23679
+ }
23680
+ };
23466
23681
  const canonicalize = React13.useCallback((json) => {
23467
23682
  try {
23468
23683
  return JSON.stringify(JSON.parse(json));
@@ -23499,6 +23714,11 @@ function FieldEditor({
23499
23714
  onSave();
23500
23715
  return;
23501
23716
  }
23717
+ if (pendingDelete) {
23718
+ if (input === "y") deleteRow(pendingDelete);
23719
+ setPendingDelete(null);
23720
+ return;
23721
+ }
23502
23722
  const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
23503
23723
  const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
23504
23724
  const inValueListTextEntry = editingValue != null;
@@ -23698,6 +23918,11 @@ function FieldEditor({
23698
23918
  }
23699
23919
  return;
23700
23920
  }
23921
+ if (input === "d" && !key.ctrl && !key.meta) {
23922
+ if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
23923
+ if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
23924
+ return;
23925
+ }
23701
23926
  if (focusLevel === "slot" && key.return && currentSlot) {
23702
23927
  setFocusLevel("field");
23703
23928
  setActiveField(SLOT_FIELDS[0] ?? null);
@@ -24004,6 +24229,10 @@ function FieldEditor({
24004
24229
  }
24005
24230
  const hasEmptyProperties = props.length === 0 && slots.length === 0;
24006
24231
  const modeLabel = (() => {
24232
+ if (pendingDelete) {
24233
+ const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
24234
+ return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
24235
+ }
24007
24236
  if (editingValue) {
24008
24237
  return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
24009
24238
  }
@@ -24025,7 +24254,7 @@ function FieldEditor({
24025
24254
  if (rationaleOpen) {
24026
24255
  return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
24027
24256
  }
24028
- return `[\u2191\u2193] navigate rows [Enter] edit fields [s] source [${propRationaleKey}] prop rationale [${componentRationaleKey}] component rationale [h] help [Esc] exit panel`;
24257
+ return `[\u2191\u2193] navigate [Enter] edit fields [d] delete property [h] help [s] source [Esc] exit panel`;
24029
24258
  })();
24030
24259
  const rows = [];
24031
24260
  rows.push({ kind: "component-description" });
@@ -24077,7 +24306,7 @@ function FieldEditor({
24077
24306
  }
24078
24307
  return Math.max(start + 1, end2);
24079
24308
  };
24080
- useEffect11(() => {
24309
+ useEffect13(() => {
24081
24310
  if (focusLevel === "field" || selectedRowIdx < 0) return;
24082
24311
  setListScrollStart((previous) => {
24083
24312
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -24291,6 +24520,7 @@ function FieldEditor({
24291
24520
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
24292
24521
  /* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
24293
24522
  /* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
24523
+ /* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
24294
24524
  /* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
24295
24525
  /* @__PURE__ */ jsx32(Text27, { children: " " }),
24296
24526
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
@@ -24314,7 +24544,7 @@ function FieldEditor({
24314
24544
  /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
24315
24545
  ] }),
24316
24546
  validationError && /* @__PURE__ */ jsx32(Text27, { color: PALETTE.error, children: "\u2717 " + validationError }),
24317
- /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: modeLabel }) })
24547
+ /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: pendingDelete ? PALETTE.text : PALETTE.muted, children: modeLabel }) })
24318
24548
  ]
24319
24549
  }
24320
24550
  );
@@ -24653,8 +24883,8 @@ function TokenReviewPanel({
24653
24883
  borderStyle: "single",
24654
24884
  borderColor: active ? PALETTE.text : void 0,
24655
24885
  children: [
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})` }),
24886
+ /* @__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(", ")})` : ""}` }),
24887
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `Tick the tokens this property may use (${rangeLabel}).` }),
24658
24888
  /* @__PURE__ */ jsx39(Text32, { children: " " }),
24659
24889
  current.paths.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no compatible tokens found for this token kind)" }),
24660
24890
  visiblePaths.map((path5, i) => {
@@ -24687,18 +24917,33 @@ function TokenReviewPanel({
24687
24917
  borderStyle: "single",
24688
24918
  borderColor: active ? PALETTE.text : void 0,
24689
24919
  children: [
24690
- /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `TOKEN REVIEW \u2014 ${componentName}` }),
24920
+ /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `Review mapped tokens \u2014 ${componentName}` }),
24921
+ /* @__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.` }),
24922
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: "Suggested tokens come from the agent. Allowed tokens are what editors can pick in Contentful." }),
24923
+ /* @__PURE__ */ jsx39(Text32, { children: " " }),
24691
24924
  suggestions.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no token suggestions for this component)" }),
24692
24925
  suggestions.map((s, i) => {
24693
24926
  const focused = i === selectedRow;
24694
24927
  return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", 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(", ")}` })
24928
+ /* @__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(", ")})` : ""}` }) }),
24929
+ /* @__PURE__ */ jsx39(
24930
+ Text32,
24931
+ {
24932
+ color: PALETTE.muted,
24933
+ children: ` suggested: ${s.suggested.length > 0 ? s.suggested.join(", ") : "none"}`
24934
+ }
24935
+ ),
24936
+ /* @__PURE__ */ jsx39(
24937
+ Text32,
24938
+ {
24939
+ color: PALETTE.muted,
24940
+ children: ` allowed: ${s.allowed.length > 0 ? s.allowed.join(", ") : "none (any token)"}`
24941
+ }
24942
+ ),
24943
+ /* @__PURE__ */ jsx39(Text32, { children: " " })
24698
24944
  ] }, s.propName);
24699
24945
  }),
24700
- /* @__PURE__ */ jsx39(Text32, { children: " " }),
24701
- /* @__PURE__ */ jsx39(Text32, { children: "[\u2191/\u2193] move [Enter] edit allowed [Esc] close" })
24946
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "[\u2191/\u2193] move [Enter] edit allowed tokens [Esc] close" })
24702
24947
  ]
24703
24948
  }
24704
24949
  );
@@ -24946,15 +25191,9 @@ function ReviewFinalizeError({
24946
25191
  function ReviewPanelFooter({
24947
25192
  reviewEditor,
24948
25193
  sidebarFocused,
24949
- sidebarFooter,
24950
- livePreview,
24951
- livePreviewSpinner
25194
+ sidebarFooter
24952
25195
  }) {
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
- ] });
25196
+ 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" : "") });
24958
25197
  }
24959
25198
  function ReviewComponentTitle({
24960
25199
  selectedKey,
@@ -24988,9 +25227,7 @@ function ReviewComponentPanel({
24988
25227
  sidebarFocused,
24989
25228
  fieldEditor,
24990
25229
  saveError,
24991
- sidebarFooter,
24992
- livePreview,
24993
- livePreviewSpinner
25230
+ sidebarFooter
24994
25231
  }) {
24995
25232
  const propCount = Object.keys(selectedEntry.$properties).length;
24996
25233
  const slotCount = selectedEntry.$slots ? Object.keys(selectedEntry.$slots).length : 0;
@@ -25027,9 +25264,7 @@ function ReviewComponentPanel({
25027
25264
  {
25028
25265
  reviewEditor,
25029
25266
  sidebarFocused,
25030
- sidebarFooter,
25031
- livePreview,
25032
- livePreviewSpinner
25267
+ sidebarFooter
25033
25268
  }
25034
25269
  ) }) })
25035
25270
  ] }) });
@@ -25143,7 +25378,7 @@ function finalizeReviewSession(extractSessionId, components) {
25143
25378
  }
25144
25379
 
25145
25380
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
25146
- import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef10, useState as useState21 } from "react";
25381
+ import { useCallback as useCallback2, useEffect as useEffect15, useRef as useRef12, useState as useState21 } from "react";
25147
25382
 
25148
25383
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
25149
25384
  var DEFAULT_MAX_DEPTH = 50;
@@ -25199,7 +25434,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
25199
25434
  }
25200
25435
 
25201
25436
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
25202
- import { useEffect as useEffect12, useRef as useRef9, useState as useState20 } from "react";
25437
+ import { useEffect as useEffect14, useRef as useRef11, useState as useState20 } from "react";
25203
25438
 
25204
25439
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
25205
25440
  var TimeoutError = class extends Error {
@@ -25357,9 +25592,9 @@ function useFinalizePreview(opts) {
25357
25592
  const [status, setStatus] = useState20("idle");
25358
25593
  const [removed, setRemoved] = useState20([]);
25359
25594
  const [scrollOffset, setScrollOffset] = useState20(0);
25360
- const generationRef = useRef9(0);
25595
+ const generationRef = useRef11(0);
25361
25596
  const acceptedKey = [...acceptedKeys].sort().join("\0");
25362
- useEffect12(() => {
25597
+ useEffect14(() => {
25363
25598
  if (!open) {
25364
25599
  setStatus("idle");
25365
25600
  setRemoved([]);
@@ -25422,7 +25657,7 @@ function useReviewSession({
25422
25657
  }));
25423
25658
  return { result, catalog };
25424
25659
  }, [loadSession, tokensPath]);
25425
- useEffect13(() => {
25660
+ useEffect15(() => {
25426
25661
  let disposed = false;
25427
25662
  void (async () => {
25428
25663
  try {
@@ -25475,7 +25710,7 @@ function useReviewSession({
25475
25710
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25476
25711
  const [reviewMetadata, setReviewMetadata] = useState21(null);
25477
25712
  const [componentRationale, setComponentRationale] = useState21(null);
25478
- useEffect13(() => {
25713
+ useEffect15(() => {
25479
25714
  const current = components[selectedIdx];
25480
25715
  if (!current) {
25481
25716
  setReviewMetadata(null);
@@ -25505,9 +25740,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25505
25740
  return { reviewMetadata, componentRationale };
25506
25741
  }
25507
25742
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
25508
- const historyRef = useRef10(null);
25509
- const historySeededRef = useRef10(false);
25510
- useEffect13(() => {
25743
+ const historyRef = useRef12(null);
25744
+ const historySeededRef = useRef12(false);
25745
+ useEffect15(() => {
25511
25746
  if (loading || historySeededRef.current) return;
25512
25747
  historySeededRef.current = true;
25513
25748
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -25558,7 +25793,7 @@ function useReviewFinalize({
25558
25793
  }
25559
25794
 
25560
25795
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
25561
- import { useEffect as useEffect14, useRef as useRef11, useState as useState22 } from "react";
25796
+ import { useEffect as useEffect16, useRef as useRef13, useState as useState22 } from "react";
25562
25797
 
25563
25798
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
25564
25799
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -25573,7 +25808,7 @@ function collectTokenSuggestions(entry, availableTokens = []) {
25573
25808
  const compatiblePaths = new Set(compatible);
25574
25809
  const allowed = availableTokens.length > 0 ? persistedAllowed.filter((path5) => compatiblePaths.has(path5)) : persistedAllowed;
25575
25810
  const paths = availableTokens.length > 0 ? compatible : allowed;
25576
- return { propName, paths, suggested: [...allowed], allowed };
25811
+ return { propName, kinds, paths, suggested: [...allowed], allowed };
25577
25812
  });
25578
25813
  }
25579
25814
 
@@ -25609,9 +25844,9 @@ function useReviewEditor({
25609
25844
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
25610
25845
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
25611
25846
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
25612
- const tokenReviewSuggestedRef = useRef11(/* @__PURE__ */ new Map());
25613
- const pendingGRef = useRef11(false);
25614
- useEffect14(() => {
25847
+ const tokenReviewSuggestedRef = useRef13(/* @__PURE__ */ new Map());
25848
+ const pendingGRef = useRef13(false);
25849
+ useEffect16(() => {
25615
25850
  setTokenReviewRow(0);
25616
25851
  setTokenReviewEditing(false);
25617
25852
  setTokenReviewEditCursor(0);
@@ -26023,7 +26258,7 @@ function handleJsonPanelInput(input, key, state2) {
26023
26258
  }
26024
26259
 
26025
26260
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
26026
- import { useCallback as useCallback4, useEffect as useEffect16, useState as useState25 } from "react";
26261
+ import { useCallback as useCallback4, useEffect as useEffect18, useState as useState25 } from "react";
26027
26262
 
26028
26263
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
26029
26264
  function applyPreviewAnnotations(preview, localNames) {
@@ -26058,25 +26293,25 @@ function applyPreviewAnnotations(preview, localNames) {
26058
26293
  }
26059
26294
 
26060
26295
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
26061
- import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef12, useState as useState24 } from "react";
26296
+ import { useCallback as useCallback3, useEffect as useEffect17, useRef as useRef14, useState as useState24 } from "react";
26062
26297
  var DEFAULT_DEBOUNCE_MS = 500;
26063
26298
  function useLivePreview(opts) {
26064
26299
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
26065
26300
  const [status, setStatus] = useState24("idle");
26066
26301
  const [disabled, setDisabled] = useState24(false);
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(() => {
26302
+ const timerRef = useRef14(null);
26303
+ const generationRef = useRef14(0);
26304
+ const latestRef = useRef14(0);
26305
+ const inflightRef = useRef14(0);
26306
+ const optsRef = useRef14(opts);
26307
+ useEffect17(() => {
26073
26308
  optsRef.current = opts;
26074
26309
  });
26075
- const disabledRef = useRef12(disabled);
26076
- useEffect15(() => {
26310
+ const disabledRef = useRef14(disabled);
26311
+ useEffect17(() => {
26077
26312
  disabledRef.current = disabled;
26078
26313
  }, [disabled]);
26079
- useEffect15(() => {
26314
+ useEffect17(() => {
26080
26315
  return () => {
26081
26316
  if (timerRef.current) {
26082
26317
  clearTimeout(timerRef.current);
@@ -26190,13 +26425,13 @@ function useReviewPreview({
26190
26425
  deleteAllComponents
26191
26426
  });
26192
26427
  const [spinnerTick, setSpinnerTick] = useState25(0);
26193
- useEffect16(() => {
26428
+ useEffect18(() => {
26194
26429
  if (livePreviewHook.status !== "running") return;
26195
26430
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
26196
26431
  return () => clearInterval(id);
26197
26432
  }, [livePreviewHook.status]);
26198
26433
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
26199
- useEffect16(() => {
26434
+ useEffect18(() => {
26200
26435
  if (loading) return;
26201
26436
  if (!livePreview) return;
26202
26437
  if (components.length === 0) return;
@@ -26369,7 +26604,7 @@ var HELP_SECTIONS2 = [
26369
26604
  { keys: "P", label: "Component rationale" },
26370
26605
  { keys: "s", label: "Source code snippet" },
26371
26606
  { keys: "J", label: "Toggle JSON" },
26372
- { keys: "t", label: "Token review" }
26607
+ { keys: "t", label: "Review mapped tokens" }
26373
26608
  ]
26374
26609
  },
26375
26610
  {
@@ -26509,7 +26744,7 @@ function GenerateReviewStepView({
26509
26744
  setFinalizeError
26510
26745
  } = reviewSurface;
26511
26746
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
26512
- const removedBannerDefaultedRef = useRef13(false);
26747
+ const removedBannerDefaultedRef = useRef15(false);
26513
26748
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
26514
26749
  const [cyclesCursor, setCyclesCursor] = useState26(0);
26515
26750
  const cyclePanel = useOverlayPanel({
@@ -26529,7 +26764,7 @@ function GenerateReviewStepView({
26529
26764
  const [breakCursor, setBreakCursor] = useState26(0);
26530
26765
  const [breakConfirm, setBreakConfirm] = useState26(false);
26531
26766
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
26532
- const seededGroupsRef = useRef13(false);
26767
+ const seededGroupsRef = useRef15(false);
26533
26768
  const {
26534
26769
  searchOpen,
26535
26770
  setSearchOpen,
@@ -26553,7 +26788,7 @@ function GenerateReviewStepView({
26553
26788
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
26554
26789
  const [autoRejected, setAutoRejected] = useState26([]);
26555
26790
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
26556
- const autoRejectFiredRef = useRef13(false);
26791
+ const autoRejectFiredRef = useRef15(false);
26557
26792
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
26558
26793
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
26559
26794
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -26616,7 +26851,7 @@ function GenerateReviewStepView({
26616
26851
  [components]
26617
26852
  );
26618
26853
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
26619
- useEffect17(() => {
26854
+ useEffect19(() => {
26620
26855
  if (seededGroupsRef.current) return;
26621
26856
  if (closures.size === 0 && slotCycles.length === 0) return;
26622
26857
  seededGroupsRef.current = true;
@@ -26643,7 +26878,7 @@ function GenerateReviewStepView({
26643
26878
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
26644
26879
  }));
26645
26880
  }, [slotCycles, cycleView]);
26646
- useEffect17(() => {
26881
+ useEffect19(() => {
26647
26882
  const decision = computeAutoRejectDecision({
26648
26883
  loading,
26649
26884
  autoRejectFired: autoRejectFiredRef.current,
@@ -26686,8 +26921,8 @@ function GenerateReviewStepView({
26686
26921
  }),
26687
26922
  applySnapshot: applyHistorySnapshot
26688
26923
  });
26689
- const autoRejectPushedRef = useRef13(false);
26690
- useEffect17(() => {
26924
+ const autoRejectPushedRef = useRef15(false);
26925
+ useEffect19(() => {
26691
26926
  if (loading) return;
26692
26927
  if (!historySeededRef.current) return;
26693
26928
  if (!autoRejectFiredRef.current) return;
@@ -26771,7 +27006,7 @@ function GenerateReviewStepView({
26771
27006
  const panelHeight = leftPanelHeight + 2;
26772
27007
  const panelContentHeight = Math.max(1, panelHeight - 3);
26773
27008
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
26774
- useEffect17(() => {
27009
+ useEffect19(() => {
26775
27010
  if (selectableRowPositions.length === 0) return;
26776
27011
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
26777
27012
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -27517,9 +27752,7 @@ function GenerateReviewStepView({
27517
27752
  initialFocusTarget: pendingEditorFocus && pendingEditorFocus.componentName === selected.key ? pendingEditorFocus.target : { kind: "description" }
27518
27753
  }
27519
27754
  ),
27520
- saveError: reviewEditor.saveError,
27521
- livePreview: livePreviewHook,
27522
- livePreviewSpinner
27755
+ saveError: reviewEditor.saveError
27523
27756
  }
27524
27757
  ) : /* @__PURE__ */ jsx48(ReviewNoSelection, {})
27525
27758
  ] }),
@@ -27551,7 +27784,7 @@ function GenerateReviewStepView({
27551
27784
  hidden: dialogOpen
27552
27785
  }
27553
27786
  ),
27554
- !dialogOpen && sidebarFocused && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
27787
+ !dialogOpen && sidebarFocused && reviewEditor.panelOpen !== "token-review" && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
27555
27788
  ] });
27556
27789
  }
27557
27790
 
@@ -27696,11 +27929,11 @@ function DoneStep({
27696
27929
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
27697
27930
  import { useState as useState28 } from "react";
27698
27931
  import { Box as Box42, Text as Text44 } from "ink";
27699
- import { readdirSync as readdirSync3 } from "node:fs";
27700
- import { dirname as dirname16, basename as basename6, join as join20 } from "node:path";
27932
+ import { readdirSync as readdirSync4 } from "node:fs";
27933
+ import { dirname as dirname17, basename as basename6, join as join22 } from "node:path";
27701
27934
 
27702
27935
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
27703
- import { resolve as resolve25 } from "node:path";
27936
+ import { resolve as resolve26 } from "node:path";
27704
27937
  import { homedir as homedir4 } from "node:os";
27705
27938
  function expandTilde(input) {
27706
27939
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -27714,14 +27947,14 @@ function normalizePath(input) {
27714
27947
  p = p.slice(1, -1);
27715
27948
  }
27716
27949
  p = expandTilde(p);
27717
- return resolve25(p);
27950
+ return resolve26(p);
27718
27951
  }
27719
27952
 
27720
27953
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
27721
- import { useEffect as useEffect18, useState as useState27 } from "react";
27954
+ import { useEffect as useEffect20, useState as useState27 } from "react";
27722
27955
  function useBlinkingCursor() {
27723
27956
  const [visible, setVisible] = useState27(true);
27724
- useEffect18(() => {
27957
+ useEffect20(() => {
27725
27958
  const interval = setInterval(() => setVisible((current) => !current), 500);
27726
27959
  return () => clearInterval(interval);
27727
27960
  }, []);
@@ -27733,23 +27966,23 @@ import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
27733
27966
  function autocomplete(partial) {
27734
27967
  if (!partial) return null;
27735
27968
  const normalized = normalizePath(partial);
27736
- const dir = dirname16(normalized);
27969
+ const dir = dirname17(normalized);
27737
27970
  const base = basename6(normalized);
27738
27971
  let entries;
27739
27972
  try {
27740
- entries = readdirSync3(dir);
27973
+ entries = readdirSync4(dir);
27741
27974
  } catch {
27742
27975
  return null;
27743
27976
  }
27744
27977
  const matches = entries.filter((e) => e.startsWith(base));
27745
27978
  if (matches.length === 0) return null;
27746
- if (matches.length === 1) return join20(dir, matches[0]);
27979
+ if (matches.length === 1) return join22(dir, matches[0]);
27747
27980
  let prefix = matches[0];
27748
27981
  for (const m of matches) {
27749
27982
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
27750
27983
  if (!prefix) break;
27751
27984
  }
27752
- return prefix.length > base.length ? join20(dir, prefix) : null;
27985
+ return prefix.length > base.length ? join22(dir, prefix) : null;
27753
27986
  }
27754
27987
  function PathPrompt({
27755
27988
  defaultPath,
@@ -27837,12 +28070,12 @@ function countedThings({ components, tokens }, counts = {}) {
27837
28070
  }
27838
28071
 
27839
28072
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
27840
- import { useEffect as useEffect19, useState as useState29 } from "react";
28073
+ import { useEffect as useEffect21, useState as useState29 } from "react";
27841
28074
  import { Spinner as Spinner2 } from "@inkjs/ui";
27842
28075
  import { jsx as jsx53 } from "react/jsx-runtime";
27843
28076
  function useTimedSpinner() {
27844
28077
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
27845
- useEffect19(() => {
28078
+ useEffect21(() => {
27846
28079
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
27847
28080
  return () => {
27848
28081
  clearInterval(timer);
@@ -27900,7 +28133,7 @@ function PushingStep({ progress, produced, counts }) {
27900
28133
  }
27901
28134
 
27902
28135
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
27903
- import { useEffect as useEffect20, useState as useState30, useMemo as useMemo7 } from "react";
28136
+ import { useEffect as useEffect22, useState as useState30, useMemo as useMemo7 } from "react";
27904
28137
  import { Box as Box44, Text as Text46 } from "ink";
27905
28138
 
27906
28139
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -28041,12 +28274,20 @@ function diffProperty(name, old, newDef) {
28041
28274
  diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
28042
28275
  return diffs;
28043
28276
  }
28277
+ function formatDefault(value) {
28278
+ const sys = value?.sys;
28279
+ if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
28280
+ const name = sys.urn.split("/designTokens/")[1];
28281
+ if (name) return name;
28282
+ }
28283
+ return JSON.stringify(value);
28284
+ }
28044
28285
  function formatOldProp(prop) {
28045
28286
  const parts = [];
28046
28287
  if (prop.type) parts.push(prop.type);
28047
28288
  if (prop.category) parts.push(prop.category);
28048
28289
  parts.push(prop.required ? "required" : "optional");
28049
- if (prop.default !== void 0) parts.push(`default=${JSON.stringify(prop.default)}`);
28290
+ if (prop.default !== void 0) parts.push(`default=${formatDefault(prop.default)}`);
28050
28291
  return parts.join(", ");
28051
28292
  }
28052
28293
  function formatPropDef(def) {
@@ -28055,7 +28296,7 @@ function formatPropDef(def) {
28055
28296
  if (def["$category"]) parts.push(def["$category"]);
28056
28297
  if (def["$required"] === true) parts.push("required");
28057
28298
  else parts.push("optional");
28058
- if (def["$default"] !== void 0) parts.push(`default=${JSON.stringify(def["$default"])}`);
28299
+ if (def["$default"] !== void 0) parts.push(`default=${formatDefault(def["$default"])}`);
28059
28300
  return parts.join(", ");
28060
28301
  }
28061
28302
 
@@ -28287,7 +28528,7 @@ function WizardPreviewStep({
28287
28528
  const activeLines = diffExpanded ? diffLines : summaryLines;
28288
28529
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
28289
28530
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
28290
- useEffect20(() => {
28531
+ useEffect22(() => {
28291
28532
  setScrollOffset((previous) => Math.min(previous, maxScroll));
28292
28533
  }, [maxScroll]);
28293
28534
  useImmediateInput((input, key) => {
@@ -28505,13 +28746,13 @@ function FlowScreen({
28505
28746
  }
28506
28747
 
28507
28748
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
28508
- import { useEffect as useEffect21, useRef as useRef14, useSyncExternalStore } from "react";
28749
+ import { useEffect as useEffect23, useRef as useRef16, useSyncExternalStore } from "react";
28509
28750
 
28510
28751
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28511
28752
  import { appendFileSync, writeFileSync } from "node:fs";
28512
- import { mkdir as mkdir8 } from "node:fs/promises";
28753
+ import { mkdir as mkdir9 } from "node:fs/promises";
28513
28754
  import { tmpdir } from "node:os";
28514
- import { join as join22, resolve as resolve26 } from "node:path";
28755
+ import { join as join24, resolve as resolve27 } from "node:path";
28515
28756
 
28516
28757
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
28517
28758
  function shouldBypassPreview(state2) {
@@ -28858,8 +29099,8 @@ function pushFailure(e, deps) {
28858
29099
  }
28859
29100
 
28860
29101
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
28861
- import { writeFile as writeFile7 } from "node:fs/promises";
28862
- import { join as join21 } from "node:path";
29102
+ import { writeFile as writeFile8 } from "node:fs/promises";
29103
+ import { join as join23 } from "node:path";
28863
29104
 
28864
29105
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
28865
29106
  function nextStateAfterPrint(opts) {
@@ -28882,7 +29123,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
28882
29123
  var realSaveDeps = () => ({
28883
29124
  openDb: openPipelineDb,
28884
29125
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
28885
- writeFile: (path5, contents) => writeFile7(path5, contents),
29126
+ writeFile: (path5, contents) => writeFile8(path5, contents),
28886
29127
  appendRun,
28887
29128
  buildSourceFingerprint,
28888
29129
  sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
@@ -28890,7 +29131,7 @@ var realSaveDeps = () => ({
28890
29131
  });
28891
29132
  async function runPrintFiles(input, deps, onPatch) {
28892
29133
  onPatch({ step: "printing" });
28893
- const componentsPath = join21(input.outDir, "components.json");
29134
+ const componentsPath = join23(input.outDir, "components.json");
28894
29135
  try {
28895
29136
  const db = deps.openDb();
28896
29137
  let components = [];
@@ -28971,7 +29212,7 @@ var EMPTY_PUSH_RESULT = {
28971
29212
  };
28972
29213
 
28973
29214
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28974
- var WIZARD_LOG = join22(tmpdir(), "experiences-import-wizard.log");
29215
+ var WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
28975
29216
  function appendWizardLog(entry) {
28976
29217
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
28977
29218
  }
@@ -28994,7 +29235,7 @@ function realFlowDeps() {
28994
29235
  }
28995
29236
  },
28996
29237
  mkdir: async (path5) => {
28997
- await mkdir8(path5, { recursive: true });
29238
+ await mkdir9(path5, { recursive: true });
28998
29239
  },
28999
29240
  detectSaveConflict,
29000
29241
  buildTimestampedSubdir,
@@ -29224,7 +29465,7 @@ function createFlowController(start, deps) {
29224
29465
  },
29225
29466
  async submitPath(submitted) {
29226
29467
  await deps.mkdir(submitted);
29227
- if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
29468
+ if (resolve27(submitted) !== resolve27(state2.outDir) && await deps.detectSaveConflict(submitted)) {
29228
29469
  const subdir = deps.buildTimestampedSubdir(submitted);
29229
29470
  await deps.mkdir(subdir);
29230
29471
  await proceedToWrite(subdir);
@@ -29247,7 +29488,7 @@ function createFlowController(start, deps) {
29247
29488
 
29248
29489
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
29249
29490
  function useFlow(start, options = {}) {
29250
- const controller = useRef14();
29491
+ const controller = useRef16();
29251
29492
  if (start && !controller.current) {
29252
29493
  try {
29253
29494
  startWizardLog();
@@ -29264,14 +29505,14 @@ function useFlow(start, options = {}) {
29264
29505
  (listener) => current?.subscribe(listener) ?? (() => void 0),
29265
29506
  () => current?.getState()
29266
29507
  );
29267
- useEffect21(() => {
29508
+ useEffect23(() => {
29268
29509
  if (!start) controller.current = void 0;
29269
29510
  }, [start]);
29270
29511
  return current && state2 ? { controller: current, state: state2 } : void 0;
29271
29512
  }
29272
29513
 
29273
29514
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
29274
- import { useEffect as useEffect22, useState as useState31 } from "react";
29515
+ import { useEffect as useEffect24, useState as useState31 } from "react";
29275
29516
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
29276
29517
  init_debug_store();
29277
29518
 
@@ -29304,7 +29545,7 @@ function describeFileLocations({
29304
29545
 
29305
29546
  // packages/experience-design-system-cli/src/tui/help/help-info.ts
29306
29547
  async function readHelpInfo() {
29307
- const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
29548
+ const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings()]);
29308
29549
  const base = settings["contentfulBaseDir"];
29309
29550
  const locations = describeFileLocations({
29310
29551
  contentfulBaseDir: typeof base === "string" ? base : "",
@@ -29313,9 +29554,9 @@ async function readHelpInfo() {
29313
29554
  });
29314
29555
  return {
29315
29556
  storage: [
29316
- { label: "Config folder", value: configRoot2() },
29317
- { label: "Settings file", value: configFilePath2() },
29318
- { label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
29557
+ { label: "Config folder", value: configRoot() },
29558
+ { label: "Settings file", value: configFilePath() },
29559
+ { label: "Agent settings", value: `${configFilePath()} (keys: agent, agentModel, agents)` },
29319
29560
  { label: "Debug logs", value: locations.debugLogs },
29320
29561
  { label: "Import files", value: locations.importFiles }
29321
29562
  ],
@@ -29345,7 +29586,7 @@ function Section({ title, rows }) {
29345
29586
  }
29346
29587
  function HelpScreen({ onDone }) {
29347
29588
  const [info, setInfo] = useState31();
29348
- useEffect22(() => {
29589
+ useEffect24(() => {
29349
29590
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
29350
29591
  void readHelpInfo().then(setInfo);
29351
29592
  }, []);
@@ -29442,7 +29683,7 @@ import { useState as useState36 } from "react";
29442
29683
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
29443
29684
 
29444
29685
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
29445
- import { useEffect as useEffect24, useRef as useRef15, useState as useState34 } from "react";
29686
+ import { useEffect as useEffect26, useRef as useRef17, useState as useState34 } from "react";
29446
29687
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
29447
29688
  init_debug_store();
29448
29689
 
@@ -29475,7 +29716,7 @@ function scrubError(error, secrets) {
29475
29716
  return message;
29476
29717
  }
29477
29718
  function describeSettingsFile() {
29478
- const path5 = configFilePath2();
29719
+ const path5 = configFilePath();
29479
29720
  return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
29480
29721
  }
29481
29722
 
@@ -29715,8 +29956,8 @@ async function describeAgents(config) {
29715
29956
 
29716
29957
  // packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts
29717
29958
  init_config();
29718
- var readV1Store = readSettings2;
29719
- var writeV1Store = writeSettings2;
29959
+ var readV1Store = readSettings;
29960
+ var writeV1Store = writeSettings;
29720
29961
 
29721
29962
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
29722
29963
  var AGENT_LABELS = {
@@ -29771,7 +30012,7 @@ async function writeAgentConfig(config) {
29771
30012
  }
29772
30013
 
29773
30014
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
29774
- import { useEffect as useEffect23, useState as useState33 } from "react";
30015
+ import { useEffect as useEffect25, useState as useState33 } from "react";
29775
30016
  import { Box as Box48, Text as Text50 } from "ink";
29776
30017
 
29777
30018
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
@@ -29834,7 +30075,7 @@ function AgentDetail({
29834
30075
  const [testing, setTesting] = useState33(false);
29835
30076
  const [notice, setNotice] = useState33(null);
29836
30077
  const [checks, setChecks] = useState33(void 0);
29837
- useEffect23(() => {
30078
+ useEffect25(() => {
29838
30079
  let active = true;
29839
30080
  setChecks(void 0);
29840
30081
  const timer = setTimeout(() => {
@@ -29919,7 +30160,7 @@ function AgentsScreen({ onDone }) {
29919
30160
  const [saving, setSaving] = useState34(false);
29920
30161
  const [loadError, setLoadError] = useState34(null);
29921
30162
  const [checks, setChecks] = useState34({});
29922
- const visit = useRef15({
30163
+ const visit = useRef17({
29923
30164
  trail: createTrail(),
29924
30165
  before: void 0,
29925
30166
  environment: void 0,
@@ -29932,7 +30173,7 @@ function AgentsScreen({ onDone }) {
29932
30173
  );
29933
30174
  }
29934
30175
  };
29935
- useEffect24(() => {
30176
+ useEffect26(() => {
29936
30177
  readAgentConfig().then((loaded) => {
29937
30178
  setConfig(loaded);
29938
30179
  inspectAll(loaded);
@@ -30109,7 +30350,7 @@ function AgentsScreen({ onDone }) {
30109
30350
  }
30110
30351
 
30111
30352
  // packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
30112
- import { useEffect as useEffect25, useRef as useRef16, useState as useState35 } from "react";
30353
+ import { useEffect as useEffect27, useRef as useRef18, useState as useState35 } from "react";
30113
30354
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
30114
30355
  init_debug_store();
30115
30356
 
@@ -30167,14 +30408,14 @@ function ProjectScreen({ onDone }) {
30167
30408
  const [saving, setSaving] = useState35(false);
30168
30409
  const [notice, setNotice] = useState35(null);
30169
30410
  const [loadError, setLoadError] = useState35(null);
30170
- const visit = useRef16({
30411
+ const visit = useRef18({
30171
30412
  trail: createTrail(),
30172
30413
  before: void 0,
30173
30414
  persisted: void 0,
30174
30415
  error: ""
30175
30416
  }).current;
30176
30417
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
30177
- useEffect25(() => {
30418
+ useEffect27(() => {
30178
30419
  readCredentials().then((cfg) => {
30179
30420
  setConfig(cfg);
30180
30421
  visit.before = snapshotOf(cfg);
@@ -30326,7 +30567,7 @@ function ConfigurationScreen({ onDone }) {
30326
30567
  }
30327
30568
 
30328
30569
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
30329
- import { useEffect as useEffect26, useState as useState37 } from "react";
30570
+ import { useEffect as useEffect28, useState as useState37 } from "react";
30330
30571
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
30331
30572
 
30332
30573
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -30350,7 +30591,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
30350
30591
  function OptInAnalyticsScreen({ onDone }) {
30351
30592
  const [loading, setLoading] = useState37(true);
30352
30593
  const [enabled, setEnabled] = useState37(true);
30353
- useEffect26(() => {
30594
+ useEffect28(() => {
30354
30595
  readAnalyticsSetting().then((setting) => {
30355
30596
  setEnabled(setting.enabled);
30356
30597
  setLoading(false);
@@ -30404,7 +30645,7 @@ function OptInAnalyticsScreen({ onDone }) {
30404
30645
  }
30405
30646
 
30406
30647
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
30407
- import { useEffect as useEffect27, useRef as useRef17, useState as useState38 } from "react";
30648
+ import { useEffect as useEffect29, useRef as useRef19, useState as useState38 } from "react";
30408
30649
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
30409
30650
  init_debug_mode_store();
30410
30651
  init_debug_store();
@@ -30421,8 +30662,8 @@ function DebugModeScreen({ onDone }) {
30421
30662
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
30422
30663
  );
30423
30664
  const [notice, setNotice] = useState38(null);
30424
- const visit = useRef17({ trail: createTrail(), before: void 0, error: "" }).current;
30425
- useEffect27(() => {
30665
+ const visit = useRef19({ trail: createTrail(), before: void 0, error: "" }).current;
30666
+ useEffect29(() => {
30426
30667
  readDebugModeSetting().then((loaded) => {
30427
30668
  setSetting(loaded);
30428
30669
  setPending(loaded.retentionDays);
@@ -30577,7 +30818,7 @@ function App({ importOptions, inkClear }) {
30577
30818
  const [flowStart, setFlowStart] = useState39();
30578
30819
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
30579
30820
  const [importDefaults, setImportDefaults] = useState39();
30580
- useEffect28(() => {
30821
+ useEffect30(() => {
30581
30822
  if (screen !== "import") {
30582
30823
  setImportDefaults(void 0);
30583
30824
  return;
@@ -30603,7 +30844,7 @@ function App({ importOptions, inkClear }) {
30603
30844
  else await startExtraction(launch, result);
30604
30845
  };
30605
30846
  const prepareRun = async (launch, credentials) => {
30606
- const settings = await readSettings2();
30847
+ const settings = await readSettings();
30607
30848
  const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
30608
30849
  const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
30609
30850
  const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
@@ -30650,7 +30891,7 @@ function App({ importOptions, inkClear }) {
30650
30891
  }
30651
30892
  });
30652
30893
  };
30653
- useEffect28(() => {
30894
+ useEffect30(() => {
30654
30895
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
30655
30896
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
30656
30897
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -30672,12 +30913,12 @@ function App({ importOptions, inkClear }) {
30672
30913
  }
30673
30914
  });
30674
30915
  }, [tokensOnly, tokensOnlyRun]);
30675
- useEffect28(() => {
30916
+ useEffect30(() => {
30676
30917
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
30677
30918
  setExtractionRun(void 0);
30678
30919
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
30679
30920
  }, [extraction, extractionRun]);
30680
- useEffect28(() => {
30921
+ useEffect30(() => {
30681
30922
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
30682
30923
  const { extraction: produced, input, generatePromptPath } = scopeRun;
30683
30924
  setGenerationInput({
@@ -30695,7 +30936,7 @@ function App({ importOptions, inkClear }) {
30695
30936
  ...generatePromptPath ? { generatePromptPath } : {}
30696
30937
  });
30697
30938
  }, [scopeFlow, scopeRun, generationInput]);
30698
- useEffect28(() => {
30939
+ useEffect30(() => {
30699
30940
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
30700
30941
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
30701
30942
  inkClear();
@@ -30778,6 +31019,7 @@ function App({ importOptions, inkClear }) {
30778
31019
  return /* @__PURE__ */ jsx66(
30779
31020
  WelcomeScreen,
30780
31021
  {
31022
+ mode: target,
30781
31023
  onContinue: (projectPath) => answer({ projectPath }),
30782
31024
  onQuit: () => goBackFrom("project"),
30783
31025
  initialPath: importDefaults.componentDir