@contentful/experience-design-system-cli 2.39.1-dev-build-6e58be6f.0 → 2.39.1-dev-build-c1faff77.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
- async function hashFile(filePath) {
2118
- const content = await readFile3(filePath, "utf8");
2119
- return hashContent(content);
2120
- }
2121
- async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
2122
- const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve5(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
2123
- const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
2124
- return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
2125
- }
2126
- var init_cache_keys = __esm({
2127
- "packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js"() {
2128
- "use strict";
2129
- init_agents();
2130
- }
2131
- });
2132
-
2133
- // packages/experience-design-system-types/dist/src/config/index.js
2134
- import { randomBytes as randomBytes4 } from "node:crypto";
2135
- import { mkdir as mkdir6, readFile as readFile20, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
2136
- import { homedir as homedir3 } from "node:os";
2137
- import { dirname as dirname14, join as join16 } from "node:path";
2138
- function configRoot2() {
2139
- return process.env["EDS_HOME"] || join16(homedir3(), ".contentful", "experience-design-system-cli");
2140
- }
2141
- async function readSettings2() {
2142
- try {
2143
- return JSON.parse(await readFile20(configFilePath2(), "utf8"));
2144
- } catch {
2145
- return {};
2146
- }
2147
- }
2148
- async function writeSettings2(settings) {
2149
- const path5 = configFilePath2();
2150
- await mkdir6(dirname14(path5), { recursive: true });
2151
- const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
2152
- await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
2153
- `, { mode: 384 });
2154
- await rename2(tmp, path5);
2155
- }
2156
- async function updateSettings2(patch) {
2157
- await writeSettings2({ ...await readSettings2(), ...patch });
2158
- }
2159
- var configFilePath2;
2160
- var init_config = __esm({
2161
- "packages/experience-design-system-types/dist/src/config/index.js"() {
2162
- "use strict";
2163
- configFilePath2 = () => join16(configRoot2(), "config.json");
2164
- }
2165
- });
2166
-
2167
- // packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
2168
- function toRetentionDays(value) {
2169
- return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
2170
- }
2171
- async function readDebugModeSetting() {
2172
- const { debugMode } = await readSettings2();
2173
- const saved = debugMode ?? {};
2174
- return {
2175
- enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
2176
- retentionDays: toRetentionDays(saved.retentionDays)
2177
- };
2178
- }
2179
- async function writeDebugModeSetting(change) {
2180
- await updateSettings2({ debugMode: { ...await readDebugModeSetting(), ...change } });
2181
- }
2182
- var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
2183
- var init_debug_mode_store = __esm({
2184
- "packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
2185
- "use strict";
2186
- init_config();
2187
- RETENTION_CHOICES = [7, 14, 30];
2188
- DEFAULT_RETENTION_DAYS = 30;
2189
- }
2190
- });
2191
-
2192
- // packages/experience-design-system-cli/src/tui/debug-prune.ts
2193
- import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
2194
- import { dirname as dirname17, join as join23 } from "node:path";
2195
- async function logFilesIn(dir) {
2196
- const entries = await readdir2(dir, { withFileTypes: true });
2197
- const nested = await Promise.all(
2198
- entries.map(async (entry) => {
2199
- const path5 = join23(dir, entry.name);
2200
- if (entry.isDirectory()) return logFilesIn(path5);
2201
- return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
2202
- })
2203
- );
2204
- return nested.flat();
2205
- }
2206
- async function removeEmptyFolders(from, stop) {
2207
- let dir = from;
2208
- let removed = 0;
2209
- for (; ; ) {
2210
- try {
2211
- await rmdir(dir);
2212
- } catch {
2213
- return removed;
2214
- }
2215
- removed += 1;
2216
- if (dir === stop) return removed;
2217
- dir = dirname17(dir);
2218
- }
2219
- }
2220
- async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
2221
- const cutoff = now - retentionDays * DAY_MS;
2222
- const contentfulDir = join23(base, ".contentful");
2223
- const result = { logs: 0, folders: 0 };
2224
- try {
2225
- const sessions = (await readdir2(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
2226
- for (const session of sessions) {
2227
- const files = await logFilesIn(join23(contentfulDir, session, "debug")).catch(() => []);
2228
- for (const file of files) {
2229
- try {
2230
- if ((await stat4(file)).mtimeMs >= cutoff) continue;
2231
- await rm(file);
2232
- result.logs += 1;
2233
- result.folders += await removeEmptyFolders(dirname17(file), join23(contentfulDir, session));
2234
- } catch {
2235
- }
2236
- }
2237
- }
2238
- } catch {
2239
- }
2240
- return result;
2241
- }
2242
- var DAY_MS, SESSION_FOLDER;
2243
- var init_debug_prune = __esm({
2244
- "packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
2245
- "use strict";
2246
- DAY_MS = 24 * 60 * 60 * 1e3;
2247
- SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
2248
- }
2249
- });
2250
-
2251
- // packages/experience-design-system-cli/src/tui/debug-store.ts
2252
- var debug_store_exports = {};
2253
- __export(debug_store_exports, {
2254
- currentDebugSessionDir: () => currentDebugSessionDir,
2255
- currentSessionDir: () => currentSessionDir,
2256
- finishDebugRun: () => finishDebugRun,
2257
- startDebugRun: () => startDebugRun,
2258
- startDebugSessionIn: () => startDebugSessionIn,
2259
- startImportRun: () => startImportRun
2260
- });
2261
- import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
2262
- import { existsSync as existsSync9, readdirSync as readdirSync4 } from "node:fs";
2263
- import { join as join24, resolve as resolve27 } from "node:path";
2264
- function generateRunId() {
2265
- const now = /* @__PURE__ */ new Date();
2266
- const pad = (n) => String(n).padStart(2, "0");
2267
- return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
2268
- }
2269
- function datePrefix(now = /* @__PURE__ */ new Date()) {
2270
- const pad = (n) => String(n).padStart(2, "0");
2271
- return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
2272
- }
2273
- function slugify(value) {
2274
- return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
2275
- }
2276
- async function readBaseDir() {
2277
- try {
2278
- const dir = (await readSettings2())["contentfulBaseDir"];
2279
- return typeof dir === "string" && dir !== "" ? resolve27(dir) : void 0;
2280
- } catch {
2281
- return void 0;
2282
- }
2283
- }
2284
- function nextSessionId(contentfulDir) {
2285
- const today = datePrefix();
2286
- const existing = existsSync9(contentfulDir) ? readdirSync4(contentfulDir) : [];
2287
- const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
2288
- const maxSeq = existing.reduce((max, entry) => {
2289
- const match2 = seqPattern.exec(entry);
2290
- return match2 ? Math.max(max, Number(match2[1])) : max;
2291
- }, 0);
2292
- return `${today}-session-${maxSeq + 1}`;
2293
- }
2294
- function startSession(base, { replace }) {
2295
- const contentfulDir = join24(base, ".contentful");
2296
- if (replace || !sessionDir) sessionDir = join24(contentfulDir, nextSessionId(contentfulDir));
2297
- return sessionDir;
2298
- }
2299
- function currentDebugSessionDir() {
2300
- return sessionDir && join24(sessionDir, "debug");
2301
- }
2302
- function currentSessionDir() {
2303
- return sessionDir;
2304
- }
2305
- async function startDebugSessionIn(base, { replace = false } = {}) {
2306
- try {
2307
- if (!await isDebugModeEnabled()) return;
2308
- await mkdir9(join24(startSession(resolve27(base), { replace }), "debug"), { recursive: true });
2309
- } catch {
2310
- }
2311
- }
2312
- function nextImportRunDir(session) {
2313
- const existing = existsSync9(session) ? readdirSync4(session) : [];
2314
- const maxRun = existing.reduce((max, entry) => {
2315
- const match2 = /^dsi-import-(\d+)$/.exec(entry);
2316
- return match2 ? Math.max(max, Number(match2[1])) : max;
2317
- }, 0);
2318
- return join24(session, `dsi-import-${maxRun + 1}`);
2319
- }
2320
- async function startImportRun(projectPath) {
2321
- await startDebugSessionIn(projectPath);
2322
- if (!sessionDir) return join24(resolve27(projectPath), ".contentful");
2323
- const dir = nextImportRunDir(sessionDir);
2324
- await mkdir9(dir, { recursive: true });
2325
- return dir;
2326
- }
2327
- async function isDebugModeEnabled() {
2328
- try {
2329
- return (await readDebugModeSetting()).enabled;
2330
- } catch {
2331
- return true;
2332
- }
2333
- }
2334
- function redact(value) {
2335
- const clone = { ...value };
2336
- if ("cma_token" in clone) {
2337
- const raw = clone.cma_token;
2338
- clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
2339
- }
2340
- return clone;
2341
- }
2342
- function startDebugRun({
2343
- flow,
2344
- step,
2345
- menuOption,
2346
- inputs
2347
- }) {
2348
- const runId = generateRunId();
2349
- const startedAt = Date.now();
2350
- const redactedInputs = redact(inputs);
2351
- isDebugModeEnabled().then((enabled) => {
2352
- if (!enabled) return;
2353
- pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
2354
- });
2355
- }
2356
- async function finishDebugRun({
2357
- outputs,
2358
- status,
2359
- exitMethod
2360
- }) {
2361
- const run = pendingRun;
2362
- if (!run) return;
2363
- pendingRun = void 0;
2364
- const durationMs = Date.now() - run.startedAt;
2365
- const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
2366
- const root = currentDebugSessionDir();
2367
- if (!root) return;
2368
- const flowSegments = run.flow.split("/");
2369
- const dir = join24(root, ...flowSegments);
2370
- await mkdir9(dir, { recursive: true });
2371
- const filename = nextAttemptFilename(dir, run.menuOption);
2372
- await writeFile8(join24(dir, filename), content, { mode: 384 });
2373
- }
2374
- function nextAttemptFilename(dir, menuOption) {
2375
- const today = datePrefix();
2376
- const optionSlug = slugify(menuOption);
2377
- const existing = existsSync9(dir) ? readdirSync4(dir) : [];
2378
- const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
2379
- const maxAttempt = existing.reduce((max, entry) => {
2380
- const match2 = attemptPattern.exec(entry);
2381
- return match2 ? Math.max(max, Number(match2[1])) : max;
2382
- }, 0);
2383
- return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
2384
- }
2385
- function renderMarkdown(run, finish) {
2386
- const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
2387
- const stepLabel = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
2388
- const flowSlug = run.flow.split("/").join("-");
2389
- return `# Debug Log
2390
-
2391
- - Run ID: ${run.runId}
2392
- - Flow: ${flowSlug}
2393
- - Step: ${stepLabel}
2394
- - Menu option: ${run.menuOption}
2395
- - Date: ${(/* @__PURE__ */ new Date()).toISOString()}
2396
- - CLI version: ${readPackageVersion()}
2397
- - Platform: ${process.platform} / Node ${process.version}
2398
- - Duration on screen: ${finish.durationMs}ms
2399
- - Status: ${finish.status}
2400
- - Exit method: ${finish.exitMethod}
2401
-
2402
- ## Inputs
2403
- \`\`\`json
2404
- ${JSON.stringify(run.inputs, null, 2)}
2405
- \`\`\`
2406
-
2407
- ## Outputs
2408
- \`\`\`json
2409
- ${JSON.stringify(finish.outputs, null, 2)}
2410
- \`\`\`
2411
- `;
2470
+ async function hashFile(filePath) {
2471
+ const content = await readFile4(filePath, "utf8");
2472
+ return hashContent(content);
2412
2473
  }
2413
- function handleCrash() {
2414
- return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
2474
+ async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
2475
+ const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve6(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
2476
+ const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
2477
+ return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
2415
2478
  }
2416
- var pendingRun, sessionDir;
2417
- var init_debug_store = __esm({
2418
- "packages/experience-design-system-cli/src/tui/debug-store.ts"() {
2479
+ var init_cache_keys = __esm({
2480
+ "packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js"() {
2419
2481
  "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 useEffect29, 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,7 +3151,7 @@ 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
  ] });
@@ -3112,7 +3162,7 @@ import { useState as useState5 } from "react";
3112
3162
  import { Box as Box10, Text as Text10 } from "ink";
3113
3163
 
3114
3164
  // packages/experience-design-system-cli/src/tui/shared/components/ClearableTextInput.tsx
3115
- import { useRef } from "react";
3165
+ import { useRef as useRef2 } from "react";
3116
3166
  import { useInput as useInput6 } from "ink";
3117
3167
  import TextInput from "ink-text-input";
3118
3168
  import { jsx as jsx10 } from "react/jsx-runtime";
@@ -3120,7 +3170,7 @@ function isClearKey(input, key) {
3120
3170
  return key.ctrl && input === "d";
3121
3171
  }
3122
3172
  function ClearableTextInput({ onChange, ...props }) {
3123
- const justCleared = useRef(false);
3173
+ const justCleared = useRef2(false);
3124
3174
  useInput6((input, key) => {
3125
3175
  if (!isClearKey(input, key)) return;
3126
3176
  justCleared.current = true;
@@ -3221,17 +3271,17 @@ function useTokenInputControls(onBack) {
3221
3271
  import { statSync } from "node:fs";
3222
3272
 
3223
3273
  // packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
3224
- import { homedir } from "node:os";
3225
- import { resolve } from "node:path";
3274
+ import { homedir as homedir2 } from "node:os";
3275
+ import { resolve as resolve2 } from "node:path";
3226
3276
  function stripQuotes(value) {
3227
3277
  const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
3228
3278
  return value.length >= 2 && quoted ? value.slice(1, -1) : value;
3229
3279
  }
3230
3280
  function expandHome(value) {
3231
- return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
3281
+ return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir2() + value.slice(1) : value;
3232
3282
  }
3233
3283
  function resolveUserPath(raw) {
3234
- return resolve(expandHome(stripQuotes(raw.trim())));
3284
+ return resolve2(expandHome(stripQuotes(raw.trim())));
3235
3285
  }
3236
3286
 
3237
3287
  // packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
@@ -3304,7 +3354,7 @@ function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
3304
3354
  }
3305
3355
 
3306
3356
  // 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";
3357
+ import { useEffect as useEffect5, useMemo, useState as useState7 } from "react";
3308
3358
  import { Box as Box12, Text as Text12 } from "ink";
3309
3359
 
3310
3360
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
@@ -3408,19 +3458,19 @@ function usePathValidationControls(phase, handlers) {
3408
3458
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
3409
3459
  import { DatabaseSync } from "node:sqlite";
3410
3460
  import { mkdirSync, readFileSync as readFileSync3 } from "node:fs";
3411
- import { readFile as readFile4 } from "node:fs/promises";
3461
+ import { readFile as readFile5 } from "node:fs/promises";
3412
3462
  import { createHash as createHash5 } from "node:crypto";
3413
3463
 
3414
3464
  // 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");
3465
+ import { homedir as homedir3 } from "node:os";
3466
+ import { dirname as dirname4, join as join6 } from "node:path";
3467
+ function configRoot2() {
3468
+ return process.env["EDS_HOME"] || join6(homedir3(), ".contentful", "experience-design-system-cli");
3419
3469
  }
3420
- var runsFilePath = () => join3(configRoot(), "state", "runs.json");
3470
+ var runsFilePath = () => join6(configRoot2(), "state", "runs.json");
3421
3471
 
3422
3472
  // 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";
3473
+ import { dirname as dirname6, resolve as resolve7 } from "node:path";
3424
3474
 
3425
3475
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
3426
3476
  var ELLIPSIS_MARKER = "/* \u2026 */";
@@ -3596,7 +3646,7 @@ function updateStepStatus(db, stepId, status, outputs, error, timestamp) {
3596
3646
  }
3597
3647
 
3598
3648
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js
3599
- import { randomBytes } from "node:crypto";
3649
+ import { randomBytes as randomBytes2 } from "node:crypto";
3600
3650
  var ADJECTIVES = [
3601
3651
  "aged",
3602
3652
  "amber",
@@ -3802,7 +3852,7 @@ var NOUNS = [
3802
3852
  "wind"
3803
3853
  ];
3804
3854
  function generateSessionId() {
3805
- const buf = randomBytes(4);
3855
+ const buf = randomBytes2(4);
3806
3856
  const adjIdx = buf[0] % ADJECTIVES.length;
3807
3857
  const nounIdx = buf[1] % NOUNS.length;
3808
3858
  const hex = ((buf[2] << 8 | buf[3]) & 65535).toString(16).padStart(4, "0");
@@ -4191,13 +4241,13 @@ CREATE INDEX IF NOT EXISTS idx_scanned_files_session ON scanned_files(session
4191
4241
  `;
4192
4242
  function getPipelineDbPath() {
4193
4243
  if (process.env.EDS_PIPELINE_DB_PATH) {
4194
- return resolve6(process.env.EDS_PIPELINE_DB_PATH);
4244
+ return resolve7(process.env.EDS_PIPELINE_DB_PATH);
4195
4245
  }
4196
- return resolve6(configRoot(), "pipeline.db");
4246
+ return resolve7(configRoot2(), "pipeline.db");
4197
4247
  }
4198
4248
  function openPipelineDb(dbPath) {
4199
4249
  const path5 = dbPath ?? getPipelineDbPath();
4200
- mkdirSync(dirname4(path5), { recursive: true });
4250
+ mkdirSync(dirname6(path5), { recursive: true });
4201
4251
  try {
4202
4252
  const db = new DatabaseSync(path5);
4203
4253
  db.exec("PRAGMA busy_timeout = 5000");
@@ -4862,16 +4912,16 @@ function extractRelativeImportPaths(sourceText) {
4862
4912
  return [...specifiers];
4863
4913
  }
4864
4914
  async function resolveRelativeImport(specifier, fromDir) {
4865
- const basePath = resolve6(fromDir, specifier);
4915
+ const basePath = resolve7(fromDir, specifier);
4866
4916
  const candidates = [
4867
4917
  basePath,
4868
4918
  ...rewrittenSourcePaths(basePath),
4869
4919
  ...SIBLING_FILE_EXTENSIONS.map((ext) => `${basePath}${ext}`),
4870
- ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve6(basePath, `index${ext}`))
4920
+ ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve7(basePath, `index${ext}`))
4871
4921
  ];
4872
4922
  for (const candidate of candidates) {
4873
4923
  try {
4874
- await readFile4(candidate, "utf8");
4924
+ await readFile5(candidate, "utf8");
4875
4925
  return candidate;
4876
4926
  } catch {
4877
4927
  }
@@ -4888,9 +4938,9 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
4888
4938
  return resolvedPaths;
4889
4939
  }
4890
4940
  async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
4891
- const visited = /* @__PURE__ */ new Set([resolve6(sourcePath)]);
4941
+ const visited = /* @__PURE__ */ new Set([resolve7(sourcePath)]);
4892
4942
  const discovered = [];
4893
- let frontier = [{ text: sourceText, dir: dirname4(sourcePath) }];
4943
+ let frontier = [{ text: sourceText, dir: dirname6(sourcePath) }];
4894
4944
  for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
4895
4945
  const nextFrontier = [];
4896
4946
  for (const node of frontier) {
@@ -4905,12 +4955,12 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
4905
4955
  break;
4906
4956
  let content;
4907
4957
  try {
4908
- content = await readFile4(resolvedPath, "utf8");
4958
+ content = await readFile5(resolvedPath, "utf8");
4909
4959
  } catch {
4910
4960
  continue;
4911
4961
  }
4912
4962
  discovered.push({ path: resolvedPath, content });
4913
- nextFrontier.push({ text: content, dir: dirname4(resolvedPath) });
4963
+ nextFrontier.push({ text: content, dir: dirname6(resolvedPath) });
4914
4964
  }
4915
4965
  }
4916
4966
  frontier = nextFrontier;
@@ -4944,7 +4994,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
4944
4994
  let truncatedSiblingCount = 0;
4945
4995
  const usesNotShown = /* @__PURE__ */ new Set();
4946
4996
  try {
4947
- const rawText = await readFile4(sourcePath, "utf8");
4997
+ const rawText = await readFile5(sourcePath, "utf8");
4948
4998
  let siblingUsesNotShown;
4949
4999
  let declaredTypeNames;
4950
5000
  ({
@@ -5705,8 +5755,8 @@ init_token_types();
5705
5755
  import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "ts-morph";
5706
5756
 
5707
5757
  // 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";
5758
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
5759
+ import { dirname as dirname7, join as join8, resolve as resolve8 } from "node:path";
5710
5760
  import { Node, Project, SyntaxKind } from "ts-morph";
5711
5761
  import ts from "typescript";
5712
5762
  var packageRootByFilePathCache = /* @__PURE__ */ new Map();
@@ -5894,7 +5944,7 @@ function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
5894
5944
  continue;
5895
5945
  for (const targetPattern of targets) {
5896
5946
  const substitutedTarget = substituteTsConfigPathTarget(targetPattern, match2.wildcard);
5897
- const resolvedPath = resolve7(tsConfigPaths.baseUrl, substitutedTarget);
5947
+ const resolvedPath = resolve8(tsConfigPaths.baseUrl, substitutedTarget);
5898
5948
  const sourceFilePath = resolveImportSourcePath(resolvedPath);
5899
5949
  if (sourceFilePath)
5900
5950
  return sourceFilePath;
@@ -5906,16 +5956,16 @@ function findNearestTsConfigPath(filePath) {
5906
5956
  if (nearestTsConfigPathCache.has(filePath)) {
5907
5957
  return nearestTsConfigPathCache.get(filePath) ?? void 0;
5908
5958
  }
5909
- let currentDir = dirname5(filePath);
5959
+ let currentDir = dirname7(filePath);
5910
5960
  while (true) {
5911
5961
  for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
5912
- const candidatePath = join5(currentDir, candidateName);
5913
- if (existsSync3(candidatePath)) {
5962
+ const candidatePath = join8(currentDir, candidateName);
5963
+ if (existsSync4(candidatePath)) {
5914
5964
  nearestTsConfigPathCache.set(filePath, candidatePath);
5915
5965
  return candidatePath;
5916
5966
  }
5917
5967
  }
5918
- const parentDir = dirname5(currentDir);
5968
+ const parentDir = dirname7(currentDir);
5919
5969
  if (parentDir === currentDir) {
5920
5970
  nearestTsConfigPathCache.set(filePath, null);
5921
5971
  return void 0;
@@ -5932,13 +5982,13 @@ function getTsConfigPaths(tsConfigPath) {
5932
5982
  tsConfigPathsCache.set(tsConfigPath, null);
5933
5983
  return void 0;
5934
5984
  }
5935
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname5(tsConfigPath));
5985
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname7(tsConfigPath));
5936
5986
  const paths = parsedConfig.options.paths;
5937
5987
  if (!paths || Object.keys(paths).length === 0) {
5938
5988
  tsConfigPathsCache.set(tsConfigPath, null);
5939
5989
  return void 0;
5940
5990
  }
5941
- const baseUrl = parsedConfig.options.baseUrl ?? dirname5(tsConfigPath);
5991
+ const baseUrl = parsedConfig.options.baseUrl ?? dirname7(tsConfigPath);
5942
5992
  const result = { baseUrl, paths };
5943
5993
  tsConfigPathsCache.set(tsConfigPath, result);
5944
5994
  return result;
@@ -5966,12 +6016,12 @@ function resolveImportSourcePath(basePath) {
5966
6016
  `${basePath}.tsx`,
5967
6017
  `${basePath}.js`,
5968
6018
  `${basePath}.jsx`,
5969
- join5(basePath, "index.ts"),
5970
- join5(basePath, "index.tsx"),
5971
- join5(basePath, "index.js"),
5972
- join5(basePath, "index.jsx")
6019
+ join8(basePath, "index.ts"),
6020
+ join8(basePath, "index.tsx"),
6021
+ join8(basePath, "index.js"),
6022
+ join8(basePath, "index.jsx")
5973
6023
  ];
5974
- return candidates.find((candidatePath) => existsSync3(candidatePath));
6024
+ return candidates.find((candidatePath) => existsSync4(candidatePath));
5975
6025
  }
5976
6026
  function findProjectSourceFileByImportPath(project, resolvedPath) {
5977
6027
  const candidatePaths = [
@@ -5980,10 +6030,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
5980
6030
  `${resolvedPath}.tsx`,
5981
6031
  `${resolvedPath}.js`,
5982
6032
  `${resolvedPath}.jsx`,
5983
- join5(resolvedPath, "index.ts"),
5984
- join5(resolvedPath, "index.tsx"),
5985
- join5(resolvedPath, "index.js"),
5986
- join5(resolvedPath, "index.jsx")
6033
+ join8(resolvedPath, "index.ts"),
6034
+ join8(resolvedPath, "index.tsx"),
6035
+ join8(resolvedPath, "index.js"),
6036
+ join8(resolvedPath, "index.jsx")
5987
6037
  ];
5988
6038
  for (const candidatePath of candidatePaths) {
5989
6039
  const sourceFile = project.getSourceFile(candidatePath);
@@ -6004,10 +6054,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
6004
6054
  if (!packageRootDir)
6005
6055
  return void 0;
6006
6056
  const preferredEntryPaths = [
6007
- join5(packageRootDir, "src/index.ts"),
6008
- join5(packageRootDir, "src/index.tsx"),
6009
- join5(packageRootDir, "index.ts"),
6010
- join5(packageRootDir, "index.tsx")
6057
+ join8(packageRootDir, "src/index.ts"),
6058
+ join8(packageRootDir, "src/index.tsx"),
6059
+ join8(packageRootDir, "index.ts"),
6060
+ join8(packageRootDir, "index.tsx")
6011
6061
  ];
6012
6062
  for (const entryPath of preferredEntryPaths) {
6013
6063
  const entrySourceFile = project.getSourceFile(entryPath);
@@ -6015,7 +6065,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
6015
6065
  return entrySourceFile;
6016
6066
  }
6017
6067
  }
6018
- return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join5(packageRootDir, "src"));
6068
+ return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join8(packageRootDir, "src"));
6019
6069
  }
6020
6070
  function getWorkspacePackageManifestForSourceFile(sourceFile) {
6021
6071
  const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
@@ -6024,7 +6074,7 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
6024
6074
  if (workspacePackageManifestCache.has(packageRootDir)) {
6025
6075
  return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
6026
6076
  }
6027
- const packageJsonPath = join5(packageRootDir, "package.json");
6077
+ const packageJsonPath = join8(packageRootDir, "package.json");
6028
6078
  try {
6029
6079
  const packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf8"));
6030
6080
  const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
@@ -6039,13 +6089,13 @@ function findNearestPackageRootDir(filePath) {
6039
6089
  if (packageRootByFilePathCache.has(filePath)) {
6040
6090
  return packageRootByFilePathCache.get(filePath) ?? void 0;
6041
6091
  }
6042
- let currentDir = dirname5(filePath);
6092
+ let currentDir = dirname7(filePath);
6043
6093
  while (true) {
6044
- if (existsSync3(join5(currentDir, "package.json"))) {
6094
+ if (existsSync4(join8(currentDir, "package.json"))) {
6045
6095
  packageRootByFilePathCache.set(filePath, currentDir);
6046
6096
  return currentDir;
6047
6097
  }
6048
- const parentDir = dirname5(currentDir);
6098
+ const parentDir = dirname7(currentDir);
6049
6099
  if (parentDir === currentDir) {
6050
6100
  packageRootByFilePathCache.set(filePath, null);
6051
6101
  return void 0;
@@ -6055,7 +6105,7 @@ function findNearestPackageRootDir(filePath) {
6055
6105
  }
6056
6106
 
6057
6107
  // 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";
6108
+ import { readFile as readFile6 } from "node:fs/promises";
6059
6109
  async function runFileExtractionWorkers(filePaths, concurrency, extractFile, formatError, onProgress, onResult) {
6060
6110
  const warnings = [];
6061
6111
  const items = [];
@@ -6067,7 +6117,7 @@ async function runFileExtractionWorkers(filePaths, concurrency, extractFile, for
6067
6117
  if (!filePath)
6068
6118
  break;
6069
6119
  try {
6070
- const source = await readFile5(filePath, "utf-8");
6120
+ const source = await readFile6(filePath, "utf-8");
6071
6121
  const outcome = await extractFile(filePath, source);
6072
6122
  warnings.push(...outcome.warnings ?? []);
6073
6123
  if (outcome.item)
@@ -9042,35 +9092,35 @@ function extractVueSlotsFromSetup(options) {
9042
9092
 
9043
9093
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
9044
9094
  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";
9095
+ import { basename, dirname as dirname9, resolve as resolve10, join as join10 } from "node:path";
9096
+ import { readFile as readFile7 } from "node:fs/promises";
9097
+ import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "node:fs";
9048
9098
  import { parse as parseSFC } from "@vue/compiler-sfc";
9049
9099
  import { Project as Project3, Node as Node6 } from "ts-morph";
9050
9100
 
9051
9101
  // 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";
9102
+ import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
9103
+ import { dirname as dirname8, join as join9, resolve as resolve9 } from "node:path";
9054
9104
  function resolveLocalModule(importingFilePath, specifier, options = {}) {
9055
- const basePath = resolve8(dirname6(importingFilePath), specifier);
9105
+ const basePath = resolve9(dirname8(importingFilePath), specifier);
9056
9106
  const candidates = [
9057
9107
  basePath,
9058
9108
  `${basePath}.js`,
9059
9109
  `${basePath}.ts`,
9060
9110
  `${basePath}.mjs`,
9061
9111
  `${basePath}.cjs`,
9062
- join6(basePath, "index.js"),
9063
- join6(basePath, "index.ts"),
9064
- join6(basePath, "index.mjs"),
9065
- join6(basePath, "index.cjs")
9112
+ join9(basePath, "index.js"),
9113
+ join9(basePath, "index.ts"),
9114
+ join9(basePath, "index.mjs"),
9115
+ join9(basePath, "index.cjs")
9066
9116
  ];
9067
9117
  for (const candidate of candidates) {
9068
- if (existsSync4(candidate) && statSync2(candidate).isFile())
9118
+ if (existsSync5(candidate) && statSync2(candidate).isFile())
9069
9119
  return candidate;
9070
9120
  }
9071
9121
  if (options.allowJavaScriptExtensionFallback && basePath.endsWith(".js")) {
9072
9122
  const tsPath = `${basePath.slice(0, -".js".length)}.ts`;
9073
- if (existsSync4(tsPath) && statSync2(tsPath).isFile())
9123
+ if (existsSync5(tsPath) && statSync2(tsPath).isFile())
9074
9124
  return tsPath;
9075
9125
  }
9076
9126
  return null;
@@ -9141,7 +9191,7 @@ function getVueComponentName(filePath) {
9141
9191
  if (fileName !== "index") {
9142
9192
  return fileName;
9143
9193
  }
9144
- const parentDirName = basename(dirname7(filePath));
9194
+ const parentDirName = basename(dirname9(filePath));
9145
9195
  return parentDirName || fileName;
9146
9196
  }
9147
9197
  async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
@@ -9285,7 +9335,7 @@ async function extractNamedObjectExportProps(importedRef, visitedImports) {
9285
9335
  if (visitedImports.has(visitKey))
9286
9336
  return [];
9287
9337
  visitedImports.add(visitKey);
9288
- const source = await readFile6(importedRef.filePath, "utf-8");
9338
+ const source = await readFile7(importedRef.filePath, "utf-8");
9289
9339
  const project = new Project3({
9290
9340
  compilerOptions: {
9291
9341
  strict: false,
@@ -9313,18 +9363,18 @@ function findWorkspaceRoot(startDir) {
9313
9363
  return workspaceRootCache.get(startDir);
9314
9364
  let dir = startDir;
9315
9365
  while (true) {
9316
- const pkgJsonPath = join7(dir, "package.json");
9317
- if (existsSync5(pkgJsonPath)) {
9366
+ const pkgJsonPath = join10(dir, "package.json");
9367
+ if (existsSync6(pkgJsonPath)) {
9318
9368
  try {
9319
9369
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9320
- if (pkg.workspaces || existsSync5(join7(dir, "pnpm-workspace.yaml"))) {
9370
+ if (pkg.workspaces || existsSync6(join10(dir, "pnpm-workspace.yaml"))) {
9321
9371
  workspaceRootCache.set(startDir, dir);
9322
9372
  return dir;
9323
9373
  }
9324
9374
  } catch {
9325
9375
  }
9326
9376
  }
9327
- const parent = dirname7(dir);
9377
+ const parent = dirname9(dir);
9328
9378
  if (parent === dir) {
9329
9379
  workspaceRootCache.set(startDir, null);
9330
9380
  return null;
@@ -9338,8 +9388,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
9338
9388
  return workspacePackageDirsCache.get(workspaceRoot);
9339
9389
  }
9340
9390
  const packageMap = /* @__PURE__ */ new Map();
9341
- const packagesDir = join7(workspaceRoot, "packages");
9342
- if (!existsSync5(packagesDir)) {
9391
+ const packagesDir = join10(workspaceRoot, "packages");
9392
+ if (!existsSync6(packagesDir)) {
9343
9393
  workspacePackageDirsCache.set(workspaceRoot, packageMap);
9344
9394
  return packageMap;
9345
9395
  }
@@ -9348,12 +9398,12 @@ function getWorkspacePackageDirs(workspaceRoot) {
9348
9398
  return;
9349
9399
  let entries;
9350
9400
  try {
9351
- entries = readdirSync(dir);
9401
+ entries = readdirSync2(dir);
9352
9402
  } catch {
9353
9403
  return;
9354
9404
  }
9355
- const pkgJsonPath = join7(dir, "package.json");
9356
- if (existsSync5(pkgJsonPath)) {
9405
+ const pkgJsonPath = join10(dir, "package.json");
9406
+ if (existsSync6(pkgJsonPath)) {
9357
9407
  try {
9358
9408
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9359
9409
  if (typeof pkg.name === "string") {
@@ -9365,7 +9415,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
9365
9415
  for (const entry of entries) {
9366
9416
  if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
9367
9417
  continue;
9368
- const entryPath = join7(dir, entry);
9418
+ const entryPath = join10(dir, entry);
9369
9419
  try {
9370
9420
  const stat5 = statSync3(entryPath);
9371
9421
  if (stat5.isDirectory()) {
@@ -9380,7 +9430,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
9380
9430
  return packageMap;
9381
9431
  }
9382
9432
  function resolveWorkspaceVueImport(specifier, importingFilePath) {
9383
- const workspaceRoot = findWorkspaceRoot(dirname7(importingFilePath));
9433
+ const workspaceRoot = findWorkspaceRoot(dirname9(importingFilePath));
9384
9434
  if (!workspaceRoot)
9385
9435
  return null;
9386
9436
  const packageDirs = getWorkspacePackageDirs(workspaceRoot);
@@ -9405,28 +9455,28 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9405
9455
  const packageDir = packageDirs.get(packageName);
9406
9456
  if (!packageDir)
9407
9457
  return null;
9408
- const pkgJsonPath = join7(packageDir, "package.json");
9458
+ const pkgJsonPath = join10(packageDir, "package.json");
9409
9459
  try {
9410
9460
  const pkg = JSON.parse(readFileSync5(pkgJsonPath, "utf8"));
9411
9461
  if (pkg.exports && subpath !== ".") {
9412
9462
  const exportValue = pkg.exports[subpath];
9413
9463
  if (typeof exportValue === "string" && exportValue.endsWith(".vue")) {
9414
- const resolved = resolve9(packageDir, exportValue);
9415
- if (existsSync5(resolved))
9464
+ const resolved = resolve10(packageDir, exportValue);
9465
+ if (existsSync6(resolved))
9416
9466
  return resolved;
9417
9467
  }
9418
9468
  }
9419
9469
  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)) {
9470
+ const subDir = resolve10(packageDir, subpath.replace(/^\.\//, ""));
9471
+ for (const base of [join10(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
9472
+ const subPkgPath = join10(base, "package.json");
9473
+ if (existsSync6(subPkgPath)) {
9424
9474
  try {
9425
9475
  const subPkg = JSON.parse(readFileSync5(subPkgPath, "utf8"));
9426
9476
  const main = subPkg.main || subPkg.module;
9427
9477
  if (typeof main === "string" && main.endsWith(".vue")) {
9428
- const resolved = resolve9(base, main);
9429
- if (existsSync5(resolved))
9478
+ const resolved = resolve10(base, main);
9479
+ if (existsSync6(resolved))
9430
9480
  return resolved;
9431
9481
  }
9432
9482
  } catch {
@@ -9437,8 +9487,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9437
9487
  if (subpath === ".") {
9438
9488
  const main = pkg.main || pkg.module;
9439
9489
  if (typeof main === "string" && main.endsWith(".vue")) {
9440
- const resolved = resolve9(packageDir, main);
9441
- if (existsSync5(resolved))
9490
+ const resolved = resolve10(packageDir, main);
9491
+ if (existsSync6(resolved))
9442
9492
  return resolved;
9443
9493
  }
9444
9494
  }
@@ -9447,7 +9497,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
9447
9497
  return null;
9448
9498
  }
9449
9499
  async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE__ */ new Set()) {
9450
- const resolvedFilePath = resolve9(filePath);
9500
+ const resolvedFilePath = resolve10(filePath);
9451
9501
  if (visited.has(resolvedFilePath)) {
9452
9502
  return [];
9453
9503
  }
@@ -9472,7 +9522,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
9472
9522
  if (specifier.startsWith(".")) {
9473
9523
  if (!specifier.endsWith(".vue"))
9474
9524
  continue;
9475
- localImports.set(defaultImport.getText(), resolve9(dirname7(resolvedFilePath), specifier));
9525
+ localImports.set(defaultImport.getText(), resolve10(dirname9(resolvedFilePath), specifier));
9476
9526
  } else {
9477
9527
  const resolvedVuePath = resolveWorkspaceVueImport(specifier, resolvedFilePath);
9478
9528
  if (resolvedVuePath) {
@@ -9516,7 +9566,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
9516
9566
  return [];
9517
9567
  }
9518
9568
  async function extractInheritedVueProps(filePath, visited) {
9519
- const source = await readFile6(filePath, "utf-8");
9569
+ const source = await readFile7(filePath, "utf-8");
9520
9570
  const { descriptor } = parseSFC(source);
9521
9571
  if (!descriptor.script) {
9522
9572
  return [];
@@ -9849,7 +9899,7 @@ async function extractAstroComponents(filePaths, onProgress) {
9849
9899
  }
9850
9900
 
9851
9901
  // 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";
9902
+ import { basename as basename3, dirname as dirname10, join as join11, resolve as resolve11 } from "node:path";
9853
9903
  import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
9854
9904
  function normalizeComponentName(input) {
9855
9905
  return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
@@ -10494,7 +10544,7 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
10494
10544
  }
10495
10545
  function resolveImportSourcePath2(fromFilePath, specifier) {
10496
10546
  if (specifier.startsWith(".")) {
10497
- const resolvedPath = resolve10(dirname8(fromFilePath), specifier);
10547
+ const resolvedPath = resolve11(dirname10(fromFilePath), specifier);
10498
10548
  if (resolvedPath.endsWith(".js")) {
10499
10549
  return `${resolvedPath.slice(0, -3)}.ts`;
10500
10550
  }
@@ -10504,14 +10554,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
10504
10554
  if (!specifier.startsWith(spectrumPrefix)) {
10505
10555
  return null;
10506
10556
  }
10507
- const packagesMarker = `${join8("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
10557
+ const packagesMarker = `${join11("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
10508
10558
  const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
10509
10559
  if (markerIndex === -1) {
10510
10560
  return null;
10511
10561
  }
10512
10562
  const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
10513
10563
  const componentPath = specifier.slice(spectrumPrefix.length);
10514
- return join8(packagesRoot, "core", "components", componentPath, "index.ts");
10564
+ return join11(packagesRoot, "core", "components", componentPath, "index.ts");
10515
10565
  }
10516
10566
  function getImportedBaseClass(classDecl, project, visitedFiles) {
10517
10567
  const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
@@ -10664,8 +10714,8 @@ async function extractWebComponentDefinitions(filePaths) {
10664
10714
 
10665
10715
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
10666
10716
  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";
10717
+ import { basename as basename4, dirname as dirname11, resolve as resolve12, join as join12 } from "node:path";
10718
+ import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
10669
10719
  import { createRequire } from "node:module";
10670
10720
  import { parse as parseSvelte } from "svelte/compiler";
10671
10721
  import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
@@ -10898,10 +10948,10 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
10898
10948
  function findNearestTsconfig(startDir) {
10899
10949
  let dir = startDir;
10900
10950
  for (let i = 0; i < 16; i++) {
10901
- const candidate = join9(dir, "tsconfig.json");
10902
- if (existsSync6(candidate))
10951
+ const candidate = join12(dir, "tsconfig.json");
10952
+ if (existsSync7(candidate))
10903
10953
  return candidate;
10904
- const parent = dirname9(dir);
10954
+ const parent = dirname11(dir);
10905
10955
  if (!parent || parent === dir)
10906
10956
  return null;
10907
10957
  dir = parent;
@@ -11031,32 +11081,32 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11031
11081
  } catch {
11032
11082
  resolvedJs = null;
11033
11083
  }
11034
- const seedDir = resolvedJs ? dirname9(resolvedJs) : dirname9(parentFile);
11084
+ const seedDir = resolvedJs ? dirname11(resolvedJs) : dirname11(parentFile);
11035
11085
  const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
11036
11086
  if (pkgRoot) {
11037
- const pkgJsonPath = join9(pkgRoot, "package.json");
11038
- if (existsSync6(pkgJsonPath)) {
11087
+ const pkgJsonPath = join12(pkgRoot, "package.json");
11088
+ if (existsSync7(pkgJsonPath)) {
11039
11089
  try {
11040
11090
  const pkgRaw = readFileSync6(pkgJsonPath, "utf-8");
11041
11091
  const pkg = JSON.parse(pkgRaw);
11042
11092
  const typesField = pkg.types ?? pkg.typings;
11043
11093
  if (typeof typesField === "string") {
11044
- const candidate = resolve11(pkgRoot, typesField);
11045
- if (existsSync6(candidate))
11094
+ const candidate = resolve12(pkgRoot, typesField);
11095
+ if (existsSync7(candidate))
11046
11096
  return candidate;
11047
11097
  }
11048
11098
  const exportsTypes = extractTypesFromExports(pkg.exports);
11049
11099
  if (exportsTypes) {
11050
- const candidate = resolve11(pkgRoot, exportsTypes);
11051
- if (existsSync6(candidate))
11100
+ const candidate = resolve12(pkgRoot, exportsTypes);
11101
+ if (existsSync7(candidate))
11052
11102
  return candidate;
11053
11103
  }
11054
11104
  } catch {
11055
11105
  }
11056
11106
  }
11057
11107
  for (const entry of ["index.d.ts", "index.d.mts"]) {
11058
- const candidate = join9(pkgRoot, entry);
11059
- if (existsSync6(candidate))
11108
+ const candidate = join12(pkgRoot, entry);
11109
+ if (existsSync7(candidate))
11060
11110
  return candidate;
11061
11111
  }
11062
11112
  }
@@ -11064,7 +11114,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11064
11114
  const noExt = resolvedJs.replace(/\.(m?js|cjs)$/, "");
11065
11115
  for (const ext of [".d.ts", ".d.mts"]) {
11066
11116
  const candidate = `${noExt}${ext}`;
11067
- if (existsSync6(candidate))
11117
+ if (existsSync7(candidate))
11068
11118
  return candidate;
11069
11119
  }
11070
11120
  }
@@ -11073,9 +11123,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
11073
11123
  function findPackageRootForSpecifier(seedDir, specifier) {
11074
11124
  let dir = seedDir;
11075
11125
  for (let i = 0; i < 32; i++) {
11076
- if (existsSync6(join9(dir, "package.json"))) {
11126
+ if (existsSync7(join12(dir, "package.json"))) {
11077
11127
  try {
11078
- const pkgRaw = readFileSync6(join9(dir, "package.json"), "utf-8");
11128
+ const pkgRaw = readFileSync6(join12(dir, "package.json"), "utf-8");
11079
11129
  const pkg = JSON.parse(pkgRaw);
11080
11130
  if (pkg.name === specifier)
11081
11131
  return dir;
@@ -11084,7 +11134,7 @@ function findPackageRootForSpecifier(seedDir, specifier) {
11084
11134
  } catch {
11085
11135
  }
11086
11136
  }
11087
- const parent = dirname9(dir);
11137
+ const parent = dirname11(dir);
11088
11138
  if (!parent || parent === dir)
11089
11139
  return null;
11090
11140
  dir = parent;
@@ -11216,11 +11266,11 @@ async function extractFromSvelteFile(filePath, source) {
11216
11266
  var ANATOMY_FOLDERS = /* @__PURE__ */ new Set(["anatomy", "parts"]);
11217
11267
  function getSvelteComponentName(filePath) {
11218
11268
  const file = basename4(filePath, ".svelte");
11219
- const parentDir = basename4(dirname9(filePath));
11269
+ const parentDir = basename4(dirname11(filePath));
11220
11270
  if (file === "index")
11221
11271
  return toPascalCase(parentDir);
11222
11272
  if (ANATOMY_FOLDERS.has(parentDir)) {
11223
- const grandparent = basename4(dirname9(dirname9(filePath)));
11273
+ const grandparent = basename4(dirname11(dirname11(filePath)));
11224
11274
  if (grandparent && grandparent !== "." && grandparent !== "/") {
11225
11275
  return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
11226
11276
  }
@@ -12035,7 +12085,7 @@ function mergeSlots2(fromSnippetProps, fromTemplate) {
12035
12085
  }
12036
12086
 
12037
12087
  // 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";
12088
+ import { readFile as readFile9 } from "node:fs/promises";
12039
12089
  import { ModuleKind as ModuleKind2, Project as Project7, ScriptTarget as ScriptTarget2 } from "ts-morph";
12040
12090
 
12041
12091
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/find-component-decorator.js
@@ -12349,7 +12399,7 @@ function extractProps2(cls, meta) {
12349
12399
  }
12350
12400
 
12351
12401
  // 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";
12402
+ import { dirname as dirname12, resolve as resolve13 } from "node:path";
12353
12403
 
12354
12404
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/normalize-component-name.js
12355
12405
  var SUFFIXES = ["Component", "Directive"];
@@ -12404,7 +12454,7 @@ function readComponentMetadata(cls, sourceFilePath) {
12404
12454
  const inlineTemplate = readDecoratorString(obj, "template");
12405
12455
  const templateUrlRel = readDecoratorString(obj, "templateUrl");
12406
12456
  const inputsArray = readDecoratorStringArray(obj, "inputs");
12407
- const templatePath = templateUrlRel ? resolve12(dirname10(sourceFilePath), templateUrlRel) : null;
12457
+ const templatePath = templateUrlRel ? resolve13(dirname12(sourceFilePath), templateUrlRel) : null;
12408
12458
  const decorator = cls.getDecorator("Component");
12409
12459
  const decoratorLine = decorator?.getStartLineNumber() ?? cls.getStartLineNumber();
12410
12460
  return {
@@ -12441,14 +12491,14 @@ function countLines(text, offset) {
12441
12491
  }
12442
12492
 
12443
12493
  // 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";
12494
+ import { readFile as readFile8 } from "node:fs/promises";
12445
12495
  async function resolveTemplateSource(meta) {
12446
12496
  if (meta.inlineTemplate !== null)
12447
12497
  return meta.inlineTemplate;
12448
12498
  if (meta.templatePath === null)
12449
12499
  return null;
12450
12500
  try {
12451
- return await readFile7(meta.templatePath, "utf8");
12501
+ return await readFile8(meta.templatePath, "utf8");
12452
12502
  } catch {
12453
12503
  return null;
12454
12504
  }
@@ -12638,7 +12688,7 @@ async function extractAngularComponents(filePaths, onProgress, _opts) {
12638
12688
  });
12639
12689
  for (const filePath of filePaths) {
12640
12690
  try {
12641
- const source = await readFile8(filePath, "utf8");
12691
+ const source = await readFile9(filePath, "utf8");
12642
12692
  const sourceFile = project.createSourceFile(filePath, source, { overwrite: true });
12643
12693
  for (const cls of sourceFile.getClasses()) {
12644
12694
  if (!hasComponentDecorator(cls))
@@ -13226,17 +13276,17 @@ function applyCompositionEdges(components, edges) {
13226
13276
  }
13227
13277
 
13228
13278
  // 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";
13279
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
13280
+ import { dirname as dirname13, join as join13, resolve as resolve14 } from "node:path";
13231
13281
  import { fileURLToPath as fileURLToPath3 } from "node:url";
13232
13282
  function resolvePromptPath(fileName) {
13233
- const thisDir = dirname11(fileURLToPath3(import.meta.url));
13283
+ const thisDir = dirname13(fileURLToPath3(import.meta.url));
13234
13284
  let dir = thisDir;
13235
13285
  for (; ; ) {
13236
- const candidate = join10(dir, "prompts");
13237
- if (existsSync7(candidate))
13238
- return join10(candidate, fileName);
13239
- const parent = resolve13(dir, "..");
13286
+ const candidate = join13(dir, "prompts");
13287
+ if (existsSync8(candidate))
13288
+ return join13(candidate, fileName);
13289
+ const parent = resolve14(dir, "..");
13240
13290
  if (parent === dir) {
13241
13291
  throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
13242
13292
  }
@@ -13401,7 +13451,7 @@ ${fileDigest}`);
13401
13451
  }
13402
13452
 
13403
13453
  // 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";
13454
+ import { dirname as dirname14 } from "node:path";
13405
13455
  function kebabToPascal3(name) {
13406
13456
  return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
13407
13457
  }
@@ -13465,8 +13515,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
13465
13515
  for (const file of files) {
13466
13516
  if (!file.path.endsWith("AGENTS.md"))
13467
13517
  continue;
13468
- const docDir = dirname12(file.path);
13469
- const parent = components.find((c2) => c2.sourcePath && dirname12(c2.sourcePath) === docDir)?.name;
13518
+ const docDir = dirname14(file.path);
13519
+ const parent = components.find((c2) => c2.sourcePath && dirname14(c2.sourcePath) === docDir)?.name;
13470
13520
  if (!parent || !componentNames.has(parent))
13471
13521
  continue;
13472
13522
  for (const line of file.content.split("\n")) {
@@ -13791,7 +13841,7 @@ function validateExtractedComponents(components) {
13791
13841
  }
13792
13842
 
13793
13843
  // 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";
13844
+ import { resolve as resolve16 } from "node:path";
13795
13845
 
13796
13846
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
13797
13847
  import { createHash as createHash7 } from "node:crypto";
@@ -13802,7 +13852,7 @@ function createComponentId(name, resolvedSourcePath) {
13802
13852
 
13803
13853
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
13804
13854
  import { access } from "node:fs/promises";
13805
- import { isAbsolute, relative, resolve as resolve14 } from "node:path";
13855
+ import { isAbsolute, relative, resolve as resolve15 } from "node:path";
13806
13856
  async function resolveComponentSourcePath(source, reviewRoot) {
13807
13857
  if (isAbsolute(source)) {
13808
13858
  try {
@@ -13812,7 +13862,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
13812
13862
  throw new Error(`Unable to access component source at ${source}`);
13813
13863
  }
13814
13864
  }
13815
- const candidate = resolve14(reviewRoot, source);
13865
+ const candidate = resolve15(reviewRoot, source);
13816
13866
  const relativeToRoot = relative(reviewRoot, candidate);
13817
13867
  if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
13818
13868
  throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
@@ -13827,7 +13877,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
13827
13877
 
13828
13878
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
13829
13879
  async function loadReviewInput(components, options = {}) {
13830
- const reviewRoot = resolve15(options.reviewRoot ?? process.cwd());
13880
+ const reviewRoot = resolve16(options.reviewRoot ?? process.cwd());
13831
13881
  const records = await Promise.all(components.map(async (component) => {
13832
13882
  let resolvedSourcePath;
13833
13883
  try {
@@ -13862,50 +13912,50 @@ async function loadAndValidateForReview(sessionId, projectRoot) {
13862
13912
  }
13863
13913
 
13864
13914
  // 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";
13915
+ import { access as access3, readFile as readFile11 } from "node:fs/promises";
13866
13916
 
13867
13917
  // 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";
13918
+ import { access as access2, mkdir as mkdir3, readFile as readFile10, writeFile as writeFile3 } from "node:fs/promises";
13869
13919
 
13870
13920
  // 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";
13921
+ import { resolve as resolve17 } from "node:path";
13872
13922
  async function getRefineSessionPaths(sessionId, artifactsRoot) {
13873
- const sessionDir2 = resolve16(artifactsRoot, sessionId);
13923
+ const sessionDir2 = resolve17(artifactsRoot, sessionId);
13874
13924
  return {
13875
13925
  sessionDir: sessionDir2,
13876
- eventsPath: resolve16(sessionDir2, "events.jsonl"),
13877
- statePath: resolve16(sessionDir2, "current-review-state.json")
13926
+ eventsPath: resolve17(sessionDir2, "events.jsonl"),
13927
+ statePath: resolve17(sessionDir2, "current-review-state.json")
13878
13928
  };
13879
13929
  }
13880
13930
 
13881
13931
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/ensure-review-session.js
13882
13932
  async function ensureRefineSession(sessionId, artifactsRoot, initialSnapshot) {
13883
13933
  const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
13884
- await mkdir(paths.sessionDir, { recursive: true });
13934
+ await mkdir3(paths.sessionDir, { recursive: true });
13885
13935
  try {
13886
13936
  await access2(paths.statePath);
13887
- const savedState = await readFile9(paths.statePath, "utf8");
13937
+ const savedState = await readFile10(paths.statePath, "utf8");
13888
13938
  return JSON.parse(savedState);
13889
13939
  } catch {
13890
- await writeFile(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
13891
- await writeFile(paths.eventsPath, "", "utf8");
13940
+ await writeFile3(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
13941
+ await writeFile3(paths.eventsPath, "", "utf8");
13892
13942
  return initialSnapshot;
13893
13943
  }
13894
13944
  }
13895
13945
 
13896
13946
  // 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";
13947
+ import { resolve as resolve18 } from "node:path";
13898
13948
  function getRefineArtifactsRoot() {
13899
13949
  if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
13900
- return resolve17(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
13950
+ return resolve18(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
13901
13951
  }
13902
- return resolve17(configRoot(), "reviews");
13952
+ return resolve18(configRoot2(), "reviews");
13903
13953
  }
13904
13954
 
13905
13955
  // 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";
13956
+ import { writeFile as writeFile4 } from "node:fs/promises";
13907
13957
  async function saveReviewState(statePath, session) {
13908
- await writeFile2(statePath, JSON.stringify(session, null, 2), "utf8");
13958
+ await writeFile4(statePath, JSON.stringify(session, null, 2), "utf8");
13909
13959
  }
13910
13960
 
13911
13961
  // packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/review/merge-preview-validation-errors-into-review-session.js
@@ -13915,7 +13965,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
13915
13965
  let snapshot;
13916
13966
  try {
13917
13967
  await access3(paths.statePath);
13918
- snapshot = JSON.parse(await readFile10(paths.statePath, "utf8"));
13968
+ snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
13919
13969
  } catch {
13920
13970
  snapshot = await loadAndValidateForReview(sessionId, void 0);
13921
13971
  snapshot = await ensureRefineSession(sessionId, artifactsRoot, snapshot);
@@ -13953,7 +14003,7 @@ async function mergePreviewValidationErrorsIntoReviewSession(sessionId, errors,
13953
14003
  }
13954
14004
 
13955
14005
  // 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";
14006
+ import { readFile as readFile12 } from "node:fs/promises";
13957
14007
  async function rejectComponentsByName(sessionId, names, opts = {}) {
13958
14008
  if (names.length === 0)
13959
14009
  return;
@@ -13969,7 +14019,7 @@ async function rejectComponentsByName(sessionId, names, opts = {}) {
13969
14019
  const nameSet = new Set(names);
13970
14020
  let snapshot;
13971
14021
  try {
13972
- snapshot = JSON.parse(await readFile11(paths.statePath, "utf8"));
14022
+ snapshot = JSON.parse(await readFile12(paths.statePath, "utf8"));
13973
14023
  } catch {
13974
14024
  return;
13975
14025
  }
@@ -14124,10 +14174,10 @@ function isSourceFile(name) {
14124
14174
  }
14125
14175
 
14126
14176
  // 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";
14177
+ import { readdirSync as readdirSync3 } from "node:fs";
14128
14178
  function readDirSafely(dir) {
14129
14179
  try {
14130
- return readdirSync2(dir, { withFileTypes: true });
14180
+ return readdirSync3(dir, { withFileTypes: true });
14131
14181
  } catch {
14132
14182
  return "unreadable";
14133
14183
  }
@@ -14195,7 +14245,7 @@ function collectFiles(root, options = {}) {
14195
14245
  }
14196
14246
 
14197
14247
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/generate-ulid.js
14198
- import { randomBytes as randomBytes2 } from "node:crypto";
14248
+ import { randomBytes as randomBytes3 } from "node:crypto";
14199
14249
  var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
14200
14250
  function encodeBase32(bytes, length) {
14201
14251
  let out = "";
@@ -14221,12 +14271,12 @@ function generateUlid(now = Date.now()) {
14221
14271
  n = Math.floor(n / 256);
14222
14272
  }
14223
14273
  const ts3 = encodeBase32(tsBytes, 10);
14224
- const rand = encodeBase32(randomBytes2(10), 16);
14274
+ const rand = encodeBase32(randomBytes3(10), 16);
14225
14275
  return (ts3 + rand).toUpperCase();
14226
14276
  }
14227
14277
 
14228
14278
  // 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";
14279
+ import { readFile as readFile13 } from "node:fs/promises";
14230
14280
 
14231
14281
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/migrate-record.js
14232
14282
  function migrateRecord(rec) {
@@ -14245,7 +14295,7 @@ var READABLE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
14245
14295
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/read-runs-file.js
14246
14296
  async function readRunsFileMaybe() {
14247
14297
  try {
14248
- const raw = await readFile12(runsFilePath(), "utf8");
14298
+ const raw = await readFile13(runsFilePath(), "utf8");
14249
14299
  const parsed = JSON.parse(raw);
14250
14300
  if (!READABLE_VERSIONS.has(parsed.version)) {
14251
14301
  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 +14311,14 @@ async function readRunsFileMaybe() {
14261
14311
  }
14262
14312
 
14263
14313
  // 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";
14314
+ import { mkdir as mkdir4, rename as rename2, writeFile as writeFile5 } from "node:fs/promises";
14315
+ import { dirname as dirname15 } from "node:path";
14266
14316
  async function writeRunsFileAtomic(file) {
14267
- await mkdir2(dirname13(runsFilePath()), { recursive: true });
14317
+ await mkdir4(dirname15(runsFilePath()), { recursive: true });
14268
14318
  const body = JSON.stringify(file, null, 2) + "\n";
14269
14319
  const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
14270
- await writeFile3(tmp, body, { mode: 384 });
14271
- await rename(tmp, runsFilePath());
14320
+ await writeFile5(tmp, body, { mode: 384 });
14321
+ await rename2(tmp, runsFilePath());
14272
14322
  }
14273
14323
 
14274
14324
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/append-run.js
@@ -14304,8 +14354,8 @@ async function updateRun(id, patch) {
14304
14354
  }
14305
14355
 
14306
14356
  // 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";
14357
+ import { readFile as readFile14, stat as stat2 } from "node:fs/promises";
14358
+ import { resolve as resolve19 } from "node:path";
14309
14359
 
14310
14360
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/sha256-hex.js
14311
14361
  import { createHash as createHash8 } from "node:crypto";
@@ -14327,12 +14377,12 @@ async function buildSourceFingerprint(opts) {
14327
14377
  const name = rowField(row, "name");
14328
14378
  if (!sourcePath)
14329
14379
  continue;
14330
- const abs = resolve18(sourcePath);
14380
+ const abs = resolve19(sourcePath);
14331
14381
  if (seen.has(abs))
14332
14382
  continue;
14333
14383
  seen.add(abs);
14334
14384
  try {
14335
- const st = await stat(abs);
14385
+ const st = await stat2(abs);
14336
14386
  const entry = { mtime: st.mtime.toISOString() };
14337
14387
  if (name)
14338
14388
  entry.componentName = name;
@@ -14344,10 +14394,10 @@ async function buildSourceFingerprint(opts) {
14344
14394
  let rawTokensMtime = null;
14345
14395
  let rawTokensContentHash = null;
14346
14396
  if (opts.rawTokensPath) {
14347
- const abs = resolve18(opts.rawTokensPath);
14397
+ const abs = resolve19(opts.rawTokensPath);
14348
14398
  rawTokensPath = abs;
14349
14399
  try {
14350
- const [st, buf] = await Promise.all([stat(abs), readFile13(abs)]);
14400
+ const [st, buf] = await Promise.all([stat2(abs), readFile14(abs)]);
14351
14401
  rawTokensMtime = st.mtime.toISOString();
14352
14402
  rawTokensContentHash = sha256Hex(buf);
14353
14403
  } catch {
@@ -14358,7 +14408,7 @@ async function buildSourceFingerprint(opts) {
14358
14408
 
14359
14409
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
14360
14410
  import { access as access4 } from "node:fs/promises";
14361
- import { join as join11 } from "node:path";
14411
+ import { join as join14 } from "node:path";
14362
14412
 
14363
14413
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/save-files.js
14364
14414
  var SAVE_FILES = ["components.json", "tokens.json"];
@@ -14368,7 +14418,7 @@ async function listConflictingFiles(path5) {
14368
14418
  const conflicts = [];
14369
14419
  for (const name of SAVE_FILES) {
14370
14420
  try {
14371
- await access4(join11(path5, name));
14421
+ await access4(join14(path5, name));
14372
14422
  conflicts.push(name);
14373
14423
  } catch {
14374
14424
  }
@@ -14382,7 +14432,7 @@ async function detectSaveConflict(path5) {
14382
14432
  }
14383
14433
 
14384
14434
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
14385
- import { join as join12 } from "node:path";
14435
+ import { join as join15 } from "node:path";
14386
14436
  function pad2(n) {
14387
14437
  return n < 10 ? `0${n}` : String(n);
14388
14438
  }
@@ -14393,11 +14443,11 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
14393
14443
  const hh = pad2(now.getHours());
14394
14444
  const mm = pad2(now.getMinutes());
14395
14445
  const ss = pad2(now.getSeconds());
14396
- return join12(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
14446
+ return join15(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
14397
14447
  }
14398
14448
 
14399
14449
  // 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";
14450
+ import { mkdir as mkdir5 } from "node:fs/promises";
14401
14451
  async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
14402
14452
  const acceptedSet = new Set(decisions.accepted);
14403
14453
  const rawComponents = loadRawComponents(db, sessionId);
@@ -14424,17 +14474,17 @@ async function writeScopeDecisionsSnapshot(db, sessionId, decisions) {
14424
14474
  };
14425
14475
  });
14426
14476
  const paths = await getRefineSessionPaths(sessionId, getRefineArtifactsRoot());
14427
- await mkdir3(paths.sessionDir, { recursive: true });
14477
+ await mkdir5(paths.sessionDir, { recursive: true });
14428
14478
  await saveReviewState(paths.statePath, { components: records });
14429
14479
  }
14430
14480
 
14431
14481
  // 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";
14482
+ import { readFile as readFile15 } from "node:fs/promises";
14433
14483
  async function loadAcceptedNames(sessionId) {
14434
14484
  try {
14435
14485
  const artifactsRoot = getRefineArtifactsRoot();
14436
14486
  const paths = await getRefineSessionPaths(sessionId, artifactsRoot);
14437
- const raw = await readFile14(paths.statePath, "utf8");
14487
+ const raw = await readFile15(paths.statePath, "utf8");
14438
14488
  const snapshot = JSON.parse(raw);
14439
14489
  const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
14440
14490
  if (accepted.length === 0)
@@ -14449,7 +14499,7 @@ async function loadAcceptedNames(sessionId) {
14449
14499
  import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
14450
14500
 
14451
14501
  // packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
14452
- import { randomBytes as randomBytes3 } from "node:crypto";
14502
+ import { randomBytes as randomBytes4 } from "node:crypto";
14453
14503
  var ADJECTIVES2 = [
14454
14504
  "bright",
14455
14505
  "calm",
@@ -14498,7 +14548,7 @@ var NOUNS2 = [
14498
14548
  function generateSessionId2() {
14499
14549
  const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
14500
14550
  const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
14501
- const hex = randomBytes3(2).toString("hex");
14551
+ const hex = randomBytes4(2).toString("hex");
14502
14552
  return `${adj}-${noun}-${hex}`;
14503
14553
  }
14504
14554
 
@@ -15760,11 +15810,11 @@ function formatApiError2(request) {
15760
15810
 
15761
15811
  // packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
15762
15812
  init_shared();
15763
- import { readFile as readFile15, stat as stat3 } from "node:fs/promises";
15813
+ import { readFile as readFile16, stat as stat4 } from "node:fs/promises";
15764
15814
 
15765
15815
  // 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";
15816
+ import { readdir as readdir2, stat as stat3 } from "node:fs/promises";
15817
+ import { join as join16 } from "node:path";
15768
15818
  var IGNORE_TOKEN_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".next", ".nuxt", ".git"]);
15769
15819
  async function collectJsonFiles(dir) {
15770
15820
  const results = [];
@@ -15774,17 +15824,17 @@ async function collectJsonFiles(dir) {
15774
15824
  async function walk(current, results) {
15775
15825
  let entries;
15776
15826
  try {
15777
- entries = await readdir(current);
15827
+ entries = await readdir2(current);
15778
15828
  } catch {
15779
15829
  return;
15780
15830
  }
15781
15831
  await Promise.all(entries.map(async (entry) => {
15782
15832
  if (IGNORE_TOKEN_DIRS.has(entry))
15783
15833
  return;
15784
- const full = join13(current, entry);
15834
+ const full = join16(current, entry);
15785
15835
  let s;
15786
15836
  try {
15787
- s = await stat2(full);
15837
+ s = await stat3(full);
15788
15838
  } catch {
15789
15839
  return;
15790
15840
  }
@@ -15800,7 +15850,7 @@ async function walk(current, results) {
15800
15850
  async function readTokensFromPath(flag, p) {
15801
15851
  let s;
15802
15852
  try {
15803
- s = await stat3(p);
15853
+ s = await stat4(p);
15804
15854
  } catch {
15805
15855
  throw new Error(`file not found: ${p} (from ${flag})`);
15806
15856
  }
@@ -15819,7 +15869,7 @@ async function readMergedFromDir(flag, dir) {
15819
15869
  const merged = {};
15820
15870
  for (const file of files.sort()) {
15821
15871
  try {
15822
- const text = await readFile15(file, "utf8");
15872
+ const text = await readFile16(file, "utf8");
15823
15873
  const parsed = JSON.parse(text);
15824
15874
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
15825
15875
  Object.assign(merged, parsed);
@@ -15833,7 +15883,7 @@ async function readMergedFromDir(flag, dir) {
15833
15883
  async function readSingleFile(flag, p) {
15834
15884
  let text;
15835
15885
  try {
15836
- text = await readFile15(p, "utf8");
15886
+ text = await readFile16(p, "utf8");
15837
15887
  } catch {
15838
15888
  throw new Error(`file not found: ${p} (from ${flag})`);
15839
15889
  }
@@ -15878,8 +15928,8 @@ function buildContentfulManagementClient(request) {
15878
15928
  }
15879
15929
 
15880
15930
  // 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";
15931
+ import { writeFile as writeFile6 } from "node:fs/promises";
15932
+ import { join as join17 } from "node:path";
15883
15933
 
15884
15934
  // packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
15885
15935
  import { fetchAll } from "contentful-management";
@@ -15911,8 +15961,8 @@ async function fetchAndPersistExistingContentfulEntities(request) {
15911
15961
  spaceId: request.spaceId,
15912
15962
  environmentId: request.environmentId
15913
15963
  });
15914
- const path5 = join14(request.outDir, ".existing-entities.json");
15915
- await writeFile4(path5, JSON.stringify(entities, null, 2), "utf8");
15964
+ const path5 = join17(request.outDir, ".existing-entities.json");
15965
+ await writeFile6(path5, JSON.stringify(entities, null, 2), "utf8");
15916
15966
  return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
15917
15967
  } catch (error) {
15918
15968
  return {
@@ -15924,12 +15974,12 @@ async function fetchAndPersistExistingContentfulEntities(request) {
15924
15974
  }
15925
15975
 
15926
15976
  // 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";
15977
+ import { readFile as readFile17 } from "node:fs/promises";
15928
15978
  async function readExistingContentfulEntitiesFromSession(request) {
15929
15979
  if (!request.path)
15930
15980
  return void 0;
15931
15981
  try {
15932
- const raw = await readFile16(request.path, "utf8");
15982
+ const raw = await readFile17(request.path, "utf8");
15933
15983
  const parsed = JSON.parse(raw);
15934
15984
  if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens))
15935
15985
  return void 0;
@@ -16269,7 +16319,7 @@ init_describe_agent_failure();
16269
16319
  init_resolve_binary();
16270
16320
  init_resolve_skill_path();
16271
16321
  init_parse_map_token_prop_tool_calls();
16272
- import { resolve as resolve19 } from "node:path";
16322
+ import { resolve as resolve20 } from "node:path";
16273
16323
  init_cache_keys();
16274
16324
 
16275
16325
  // packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
@@ -16578,7 +16628,7 @@ async function runMapTokens(request) {
16578
16628
  outDir: process.cwd(),
16579
16629
  existingTokensInline: request.existingEntitiesInline,
16580
16630
  ...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
16581
- ...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve19(request.skillPathOverride) } : {}
16631
+ ...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve20(request.skillPathOverride) } : {}
16582
16632
  });
16583
16633
  if (request.printPrompt) {
16584
16634
  const prompt2 = await buildMapPrompt();
@@ -16637,7 +16687,7 @@ async function runMapTokens(request) {
16637
16687
  }
16638
16688
 
16639
16689
  // 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";
16690
+ import { mkdir as mkdir6 } from "node:fs/promises";
16641
16691
  import { relative as relative2 } from "node:path";
16642
16692
 
16643
16693
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/quality/non-authorable-filter.js
@@ -16694,7 +16744,7 @@ function hasNoAuthoringSurface(component) {
16694
16744
  }
16695
16745
 
16696
16746
  // 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";
16747
+ import { readFile as readFile18 } from "node:fs/promises";
16698
16748
 
16699
16749
  // packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/constants/review-reasons.js
16700
16750
  var HIGH_CONFIDENCE_DATA_FETCH_WRAPPER_REASON = "data-fetch-wrapper";
@@ -16796,7 +16846,7 @@ function dedupeReasons(reasons) {
16796
16846
  async function inspectComponentSource(component) {
16797
16847
  let sourceText = "";
16798
16848
  try {
16799
- sourceText = await readFile17(component.source, "utf8");
16849
+ sourceText = await readFile18(component.source, "utf8");
16800
16850
  } catch {
16801
16851
  return {
16802
16852
  wrapperConfidence: 0,
@@ -17235,7 +17285,7 @@ function resolveCompositionAgentName(flagValue) {
17235
17285
  }
17236
17286
 
17237
17287
  // 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";
17288
+ import { readFile as readFile19 } from "node:fs/promises";
17239
17289
  async function readCandidateFiles(components, extraFiles = []) {
17240
17290
  const paths = new Set(extraFiles);
17241
17291
  for (const c2 of components) {
@@ -17245,7 +17295,7 @@ async function readCandidateFiles(components, extraFiles = []) {
17245
17295
  const out = [];
17246
17296
  await Promise.all([...paths].map(async (p) => {
17247
17297
  try {
17248
- const content = await readFile18(p, "utf8");
17298
+ const content = await readFile19(p, "utf8");
17249
17299
  out.push({ path: p, content });
17250
17300
  } catch {
17251
17301
  }
@@ -17359,7 +17409,7 @@ async function runExtractAndComposeSession(request) {
17359
17409
  onProgress,
17360
17410
  onDebugEvent
17361
17411
  });
17362
- await mkdir4(outDir, { recursive: true });
17412
+ await mkdir6(outDir, { recursive: true });
17363
17413
  const { sessionId } = getOrCreateSession(db, void 0, void 0, {
17364
17414
  command: "analyze extract",
17365
17415
  inputPath: projectPath,
@@ -17416,15 +17466,15 @@ init_build_prompt();
17416
17466
  init_create_local_cli_agent_invoker();
17417
17467
  init_invoke_agent_with_output();
17418
17468
  init_parse_token_tool_calls();
17419
- import { readFile as readFile19 } from "node:fs/promises";
17469
+ import { readFile as readFile20 } from "node:fs/promises";
17420
17470
  import { basename as basename5, resolve as pathResolve } from "node:path";
17421
17471
  init_cache_keys();
17422
17472
  init_parse_prompt_overrides();
17423
17473
  init_resolve_prompt_override();
17424
17474
 
17425
17475
  // 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";
17476
+ import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
17477
+ import { join as join18 } from "node:path";
17428
17478
  async function writeTokensFile(db, sessionId, outDir, onProgress) {
17429
17479
  onProgress?.({ kind: "writing-file" });
17430
17480
  const result = getDtcgTokensForSession(db, sessionId);
@@ -17432,9 +17482,9 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
17432
17482
  throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
17433
17483
  }
17434
17484
  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)}
17485
+ const tokensPath = join18(outDir, "tokens.json");
17486
+ await mkdir7(outDir, { recursive: true });
17487
+ await writeFile7(tokensPath, `${JSON.stringify(tree, null, 2)}
17438
17488
  `);
17439
17489
  return { tokensPath, tokenCount: result.tokens.length };
17440
17490
  }
@@ -17449,7 +17499,7 @@ async function runGenerateTokensSession(request) {
17449
17499
  throw new Error(`Prompt override error(s): ${promptErrors.join("; ")}`);
17450
17500
  const tokensOverride = overridesMap.get("tokens");
17451
17501
  const skillContentOverride = tokensOverride ? await resolvePromptOverride(tokensOverride) : void 0;
17452
- const rawTokensInline = await readFile19(pathResolve(rawTokensPath), "utf8");
17502
+ const rawTokensInline = await readFile20(pathResolve(rawTokensPath), "utf8");
17453
17503
  const tokenInputHash = hashTokenContent(rawTokensInline);
17454
17504
  const db = openPipelineDb();
17455
17505
  try {
@@ -17566,7 +17616,7 @@ async function readExistingEntities(request) {
17566
17616
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
17567
17617
  init_parse_prompt_overrides();
17568
17618
  init_resolve_prompt_override();
17569
- import { resolve as resolve20 } from "node:path";
17619
+ import { resolve as resolve21 } from "node:path";
17570
17620
  async function resolveGeneratePrompt(overrides) {
17571
17621
  const { overrides: parsed, errors } = parsePromptOverrides(overrides);
17572
17622
  if (errors.length > 0)
@@ -17577,7 +17627,7 @@ async function resolveGeneratePrompt(overrides) {
17577
17627
  const text = await resolvePromptOverride(entry);
17578
17628
  if (entry.kind === "text")
17579
17629
  return { text };
17580
- return { path: resolve20(entry.value), text };
17630
+ return { path: resolve21(entry.value), text };
17581
17631
  }
17582
17632
 
17583
17633
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
@@ -17961,7 +18011,7 @@ function PathValidationScreen({
17961
18011
  }) {
17962
18012
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
17963
18013
  const [scan, setScan] = useState7();
17964
- useEffect4(() => {
18014
+ useEffect5(() => {
17965
18015
  setScan(scanFiles(resolvedPath));
17966
18016
  }, [resolvedPath]);
17967
18017
  const phase = phaseOf(scan);
@@ -17988,7 +18038,7 @@ function PathValidationScreen({
17988
18038
  }
17989
18039
 
17990
18040
  // packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
17991
- import { useRef as useRef2, useState as useState9 } from "react";
18041
+ import { useRef as useRef3, useState as useState9 } from "react";
17992
18042
  import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
17993
18043
 
17994
18044
  // packages/experience-design-system-cli/src/tui/shared/components/FieldForm.tsx
@@ -18240,7 +18290,7 @@ function CredentialsScreen({
18240
18290
  validate: validate3 = validateCredentials,
18241
18291
  tokensOnly = false
18242
18292
  }) {
18243
- const initialValues = useRef2(
18293
+ const initialValues = useRef3(
18244
18294
  normalize({
18245
18295
  spaceId: initial.spaceId ?? "",
18246
18296
  environmentId: initial.environmentId || "master",
@@ -18621,23 +18671,23 @@ function TokenReviewScreen({ tokensPath, onContinue, onQuit }) {
18621
18671
  init_config();
18622
18672
 
18623
18673
  // 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";
18674
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState11 } from "react";
18625
18675
 
18626
18676
  // 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";
18677
+ import { mkdir as mkdir8 } from "node:fs/promises";
18678
+ import { join as join20, resolve as resolve24 } from "node:path";
18629
18679
 
18630
18680
  // 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";
18681
+ import { existsSync as existsSync9 } from "node:fs";
18682
+ import { dirname as dirname16, join as join19, resolve as resolve22 } from "node:path";
18633
18683
  import { fileURLToPath as fileURLToPath4 } from "node:url";
18634
18684
  function findSkillPath(fileName) {
18635
- const thisDir = dirname15(fileURLToPath4(import.meta.url));
18685
+ const thisDir = dirname16(fileURLToPath4(import.meta.url));
18636
18686
  let dir = thisDir;
18637
18687
  for (; ; ) {
18638
- const candidate = join17(dir, "skills", fileName);
18639
- if (existsSync8(candidate)) return candidate;
18640
- const parent = resolve21(dir, "..");
18688
+ const candidate = join19(dir, "skills", fileName);
18689
+ if (existsSync9(candidate)) return candidate;
18690
+ const parent = resolve22(dir, "..");
18641
18691
  if (parent === dir) {
18642
18692
  throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
18643
18693
  }
@@ -18646,11 +18696,11 @@ function findSkillPath(fileName) {
18646
18696
  }
18647
18697
 
18648
18698
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
18649
- import { resolve as resolve22 } from "node:path";
18699
+ import { resolve as resolve23 } from "node:path";
18650
18700
  var SELECT_SKILL_PATH = findSkillPath("select-components.md");
18651
18701
  var DEFAULT_TIMEOUT_MS5 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
18652
18702
  async function hashSelectPrompt(options) {
18653
- const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve22(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
18703
+ const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve23(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
18654
18704
  return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
18655
18705
  }
18656
18706
  async function runSelection(options) {
@@ -18745,7 +18795,7 @@ var realDeps = {
18745
18795
  var fail = (step, message) => ({ ok: false, step, message });
18746
18796
  var errorMessage2 = (error) => error instanceof Error ? error.message : String(error);
18747
18797
  async function runExtraction(input, onProgress, deps = realDeps) {
18748
- const outDir = input.outDir ?? join18(resolve23(input.projectPath), ".contentful");
18798
+ const outDir = input.outDir ?? join20(resolve24(input.projectPath), ".contentful");
18749
18799
  let progress = initialProgress({
18750
18800
  hasCredentials: input.credentials !== null,
18751
18801
  hasRawTokens: input.rawTokensPath !== ""
@@ -18849,7 +18899,7 @@ async function runExtraction(input, onProgress, deps = realDeps) {
18849
18899
  }
18850
18900
  async function fetchEntities(credentials, outDir) {
18851
18901
  try {
18852
- await mkdir7(outDir, { recursive: true });
18902
+ await mkdir8(outDir, { recursive: true });
18853
18903
  const result = await fetchAndPersistExistingContentfulEntities({
18854
18904
  spaceId: credentials.spaceId,
18855
18905
  environmentId: credentials.environmentId,
@@ -18869,7 +18919,7 @@ async function resolveSelectionPrompt(overrides) {
18869
18919
  if (select?.kind === "text") return { promptText: select.value };
18870
18920
  if (select?.kind === "path") {
18871
18921
  await resolvePromptOverride(select);
18872
- return { promptPath: resolve23(select.value) };
18922
+ return { promptPath: resolve24(select.value) };
18873
18923
  }
18874
18924
  return {};
18875
18925
  }
@@ -18877,8 +18927,8 @@ async function resolveSelectionPrompt(overrides) {
18877
18927
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
18878
18928
  function useExtraction(input) {
18879
18929
  const [state2, setState] = useState11();
18880
- const current = useRef3();
18881
- useEffect5(() => {
18930
+ const current = useRef4();
18931
+ useEffect6(() => {
18882
18932
  current.current = input;
18883
18933
  if (!input) {
18884
18934
  setState(void 0);
@@ -18904,7 +18954,7 @@ function useExtraction(input) {
18904
18954
  }
18905
18955
 
18906
18956
  // 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";
18957
+ import { useEffect as useEffect7, useRef as useRef5, useState as useState12 } from "react";
18908
18958
 
18909
18959
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run-tokens-only.ts
18910
18960
  var TOKENS_SKILL_PATH2 = findSkillPath("generate-tokens.md");
@@ -18938,8 +18988,8 @@ async function runTokensOnly(input, deps = realDeps2) {
18938
18988
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
18939
18989
  function useTokensOnly(input) {
18940
18990
  const [state2, setState] = useState12();
18941
- const current = useRef4();
18942
- useEffect6(() => {
18991
+ const current = useRef5();
18992
+ useEffect7(() => {
18943
18993
  current.current = input;
18944
18994
  if (!input) {
18945
18995
  setState(void 0);
@@ -19198,6 +19248,7 @@ function GotoBanner({
19198
19248
  borderStyle: "single",
19199
19249
  borderColor: PALETTE.accent,
19200
19250
  paddingX: 1,
19251
+ paddingBottom: 1,
19201
19252
  marginTop: width === void 0 ? 1 : 0,
19202
19253
  width,
19203
19254
  flexShrink: 0,
@@ -19209,7 +19260,7 @@ function GotoBanner({
19209
19260
  return renderRow(row, i, i === highlightIndex);
19210
19261
  }),
19211
19262
  moreBelow > 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: ` \u25BC ${moreBelow} more` }),
19212
- footerHint !== void 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint })
19263
+ footerHint !== void 0 && /* @__PURE__ */ jsx24(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint }) })
19213
19264
  ]
19214
19265
  }
19215
19266
  );
@@ -19707,11 +19758,11 @@ function buildVisibleRows(props) {
19707
19758
  if (!expanded) continue;
19708
19759
  const subtree = computeCycleMemberSubtree(key);
19709
19760
  const isLastAtDepthSubtree = (idx) => {
19710
- const own = subtree[idx].depth;
19761
+ const own2 = subtree[idx].depth;
19711
19762
  for (let j = idx + 1; j < subtree.length; j++) {
19712
19763
  const d = subtree[j].depth;
19713
- if (d < own) return true;
19714
- if (d === own) return false;
19764
+ if (d < own2) return true;
19765
+ if (d === own2) return false;
19715
19766
  }
19716
19767
  return true;
19717
19768
  };
@@ -19831,11 +19882,11 @@ function buildVisibleRows(props) {
19831
19882
  injectedChildren.push({ name: c2.name, depth: c2.depth, isCycleChild: false });
19832
19883
  }
19833
19884
  const isLastAtDepth = (idx) => {
19834
- const own = injectedChildren[idx].depth;
19885
+ const own2 = injectedChildren[idx].depth;
19835
19886
  for (let j = idx + 1; j < injectedChildren.length; j++) {
19836
19887
  const d = injectedChildren[j].depth;
19837
- if (d < own) return true;
19838
- if (d === own) return false;
19888
+ if (d < own2) return true;
19889
+ if (d === own2) return false;
19839
19890
  }
19840
19891
  return true;
19841
19892
  };
@@ -20068,7 +20119,7 @@ import React11 from "react";
20068
20119
  import { Box as Box23, Text as Text24 } from "ink";
20069
20120
 
20070
20121
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
20071
- import { useLayoutEffect, useRef as useRef5 } from "react";
20122
+ import { useLayoutEffect, useRef as useRef6 } from "react";
20072
20123
  import { useStdin } from "ink";
20073
20124
  function parseInput(data) {
20074
20125
  const isShiftTab = data === "\x1B[Z";
@@ -20131,7 +20182,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
20131
20182
  }
20132
20183
  function useImmediateInput(handler, enabled = true) {
20133
20184
  const { stdin, setRawMode } = useStdin();
20134
- const handlerRef = useRef5(handler);
20185
+ const handlerRef = useRef6(handler);
20135
20186
  handlerRef.current = handler;
20136
20187
  useLayoutEffect(() => {
20137
20188
  if (!enabled) return;
@@ -20142,7 +20193,7 @@ function useImmediateInput(handler, enabled = true) {
20142
20193
 
20143
20194
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
20144
20195
  import { useStdout as useStdout2 } from "ink";
20145
- import { useEffect as useEffect7, useState as useState13 } from "react";
20196
+ import { useEffect as useEffect8, useState as useState13 } from "react";
20146
20197
  function readTerminalSize(stdout) {
20147
20198
  return {
20148
20199
  columns: stdout?.columns ?? 80,
@@ -20152,7 +20203,7 @@ function readTerminalSize(stdout) {
20152
20203
  function useTerminalSize() {
20153
20204
  const { stdout } = useStdout2();
20154
20205
  const [size, setSize] = useState13(() => readTerminalSize(stdout));
20155
- useEffect7(() => {
20206
+ useEffect8(() => {
20156
20207
  const updateSize = () => setSize(readTerminalSize(stdout));
20157
20208
  stdout?.on("resize", updateSize);
20158
20209
  updateSize();
@@ -20335,7 +20386,7 @@ function createSidebarViewsHelpSection(includeBreaking) {
20335
20386
  }
20336
20387
 
20337
20388
  // 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";
20389
+ import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef7, useState as useState16 } from "react";
20339
20390
 
20340
20391
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/columns.ts
20341
20392
  var TWO_COLUMN_MIN_WIDTH = 100;
@@ -21071,8 +21122,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21071
21122
  for (const p of cycleParticipants) seed.add(p);
21072
21123
  return seed;
21073
21124
  });
21074
- const seededGroupsRef = useRef6(closures.size > 0 || cycleParticipants.size > 0);
21075
- useEffect8(() => {
21125
+ const seededGroupsRef = useRef7(closures.size > 0 || cycleParticipants.size > 0);
21126
+ useEffect9(() => {
21076
21127
  if (seededGroupsRef.current) return;
21077
21128
  if (closures.size === 0 && cycleParticipants.size === 0) return;
21078
21129
  seededGroupsRef.current = true;
@@ -21163,7 +21214,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
21163
21214
  entryCount: 0
21164
21215
  });
21165
21216
  const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
21166
- useEffect8(() => {
21217
+ useEffect9(() => {
21167
21218
  setNav((prev) => {
21168
21219
  const maxIdx = Math.max(0, visibleRows.length - 1);
21169
21220
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -21638,7 +21689,7 @@ function ScopeGateView({ components, tokensPath, onConfirm, onQuit }) {
21638
21689
  }
21639
21690
 
21640
21691
  // 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";
21692
+ import { useEffect as useEffect10, useMemo as useMemo5, useRef as useRef8, useState as useState17 } from "react";
21642
21693
 
21643
21694
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/cache-check.ts
21644
21695
  async function checkGenerationCache(input) {
@@ -21685,9 +21736,9 @@ var realDeps3 = { load: loadScopeGate, checkCache: checkGenerationCache };
21685
21736
  function useScopeGateFlow(input, deps = realDeps3) {
21686
21737
  const sessionId = input?.sessionId;
21687
21738
  const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
21688
- const cacheCheck = useRef7(void 0);
21739
+ const cacheCheck = useRef8(void 0);
21689
21740
  const [confirmed, setConfirmed] = useState17();
21690
- useEffect9(() => {
21741
+ useEffect10(() => {
21691
21742
  if (!input || !loaded?.ok || cacheCheck.current) return;
21692
21743
  cacheCheck.current = deps.checkCache(input.cache);
21693
21744
  }, [input, loaded]);
@@ -21714,7 +21765,7 @@ var capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
21714
21765
  function describeGeneration(input) {
21715
21766
  const agent = capitalize(input.agent);
21716
21767
  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." : ""}`;
21768
+ ${agent} is reading each selected component and writing a Contentful component definition for it.${input.hasTokens ? "\nUsing your design tokens for prop resolution." : ""}`;
21718
21769
  }
21719
21770
  function progressRows2(progress, agent) {
21720
21771
  const name = capitalize(agent);
@@ -21754,10 +21805,10 @@ function GenerationScreen({
21754
21805
  }
21755
21806
 
21756
21807
  // 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";
21808
+ import { useEffect as useEffect11, useRef as useRef9, useState as useState18 } from "react";
21758
21809
 
21759
21810
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
21760
- import { resolve as resolve24 } from "node:path";
21811
+ import { resolve as resolve25 } from "node:path";
21761
21812
 
21762
21813
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/map-tokens.ts
21763
21814
  async function prepareMapTokens(input, generatedSessionId) {
@@ -21892,7 +21943,7 @@ async function buildMapTokensOptions(input) {
21892
21943
  if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
21893
21944
  if (mapOverride?.kind === "path") {
21894
21945
  await resolvePromptOverride(mapOverride);
21895
- prompt.skillPathOverride = resolve24(mapOverride.value);
21946
+ prompt.skillPathOverride = resolve25(mapOverride.value);
21896
21947
  }
21897
21948
  if (input.existingEntitiesPath) {
21898
21949
  const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
@@ -21919,8 +21970,8 @@ function applyProgressEvent2(event, previous, total) {
21919
21970
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
21920
21971
  function useGeneration(input) {
21921
21972
  const [state2, setState] = useState18();
21922
- const current = useRef8();
21923
- useEffect10(() => {
21973
+ const current = useRef9();
21974
+ useEffect11(() => {
21924
21975
  current.current = input;
21925
21976
  if (!input) {
21926
21977
  setState(void 0);
@@ -21940,7 +21991,7 @@ function useGeneration(input) {
21940
21991
  }
21941
21992
 
21942
21993
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
21943
- import { join as join19 } from "node:path";
21994
+ import { join as join21 } from "node:path";
21944
21995
  function buildFlowStart(input) {
21945
21996
  const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
21946
21997
  const credentials = extraction.credentials ?? {
@@ -21953,7 +22004,7 @@ function buildFlowStart(input) {
21953
22004
  handoff,
21954
22005
  agent: extraction.agent,
21955
22006
  projectPath: extraction.projectPath,
21956
- outDir: extraction.projectPath ? join19(extraction.projectPath, ".contentful") : "",
22007
+ outDir: extraction.projectPath ? join21(extraction.projectPath, ".contentful") : "",
21957
22008
  rawTokensPath: extraction.rawTokensPath,
21958
22009
  credentials: {
21959
22010
  spaceId: credentials.spaceId,
@@ -22252,6 +22303,94 @@ var DTCGTokenSchema2 = z4.strictObject({
22252
22303
  // packages/experience-design-system-types/dist/src/dtcg/validate.js
22253
22304
  var TOKEN_TYPE_SET4 = new Set(DESIGN_TOKEN_TYPES2);
22254
22305
 
22306
+ // packages/experience-design-system-types/dist/src/property-contract/json-value.js
22307
+ var nodeTypes = globalThis.process?.getBuiltinModule?.("node:util")?.types;
22308
+
22309
+ // packages/experience-design-system-types/dist/src/property-contract/date-time-value.js
22310
+ import * as z5 from "zod/mini";
22311
+ var dateTimeValueSchema = z5.iso.datetime({ offset: true });
22312
+
22313
+ // packages/experience-design-system-types/dist/src/property-contract/target-definition.js
22314
+ var TARGET_PROPERTY_TYPES = [
22315
+ "String",
22316
+ "Number",
22317
+ "Boolean",
22318
+ "Array",
22319
+ "Record",
22320
+ "Integer",
22321
+ "DateTime",
22322
+ "RichText",
22323
+ "JSON",
22324
+ "ResourceLink",
22325
+ "Literal",
22326
+ "DiscriminatedUnion"
22327
+ ];
22328
+ var SAME_SPACE_RESOURCE_SOURCE = "crn:contentful:::content:spaces/$self/environments/$self";
22329
+ var targetDefinitionJsonSchema = {
22330
+ $schema: "http://json-schema.org/draft-07/schema#",
22331
+ $ref: "#/definitions/target",
22332
+ definitions: {
22333
+ target: {
22334
+ type: "object",
22335
+ required: ["type"],
22336
+ properties: {
22337
+ type: { enum: [...TARGET_PROPERTY_TYPES] },
22338
+ id: { type: "string" },
22339
+ name: { type: "string" },
22340
+ description: { type: "string" },
22341
+ required: { type: "boolean" },
22342
+ values: { type: "array", minItems: 1 },
22343
+ defaultValue: {},
22344
+ items: { $ref: "#/definitions/target" },
22345
+ fields: { type: "object", minProperties: 1, additionalProperties: { $ref: "#/definitions/target" } },
22346
+ allowedResources: {
22347
+ type: "array",
22348
+ minItems: 1,
22349
+ items: {
22350
+ type: "object",
22351
+ required: ["type", "source"],
22352
+ properties: {
22353
+ type: { enum: ["Contentful:Entry", "Contentful:Asset"] },
22354
+ source: { const: SAME_SPACE_RESOURCE_SOURCE },
22355
+ allowedTypes: { type: "array", items: { type: "string" } }
22356
+ },
22357
+ allOf: [
22358
+ {
22359
+ if: { properties: { type: { const: "Contentful:Entry" } } },
22360
+ then: { required: ["allowedTypes"] },
22361
+ else: { not: { required: ["allowedTypes"] } }
22362
+ }
22363
+ ],
22364
+ additionalProperties: false
22365
+ }
22366
+ },
22367
+ value: {},
22368
+ valueType: { $ref: "#/definitions/target" },
22369
+ discriminator: { type: "string", minLength: 1 },
22370
+ members: {
22371
+ type: "array",
22372
+ minItems: 2,
22373
+ uniqueItems: true,
22374
+ items: {
22375
+ allOf: [
22376
+ { $ref: "#/definitions/target" },
22377
+ { type: "object", properties: { type: { const: "Record" } }, required: ["type", "fields"] }
22378
+ ]
22379
+ }
22380
+ }
22381
+ },
22382
+ allOf: [
22383
+ {
22384
+ if: { properties: { type: { const: "DiscriminatedUnion" } } },
22385
+ then: { required: ["discriminator", "members"] },
22386
+ else: { not: { anyOf: [{ required: ["discriminator"] }, { required: ["members"] }] } }
22387
+ }
22388
+ ],
22389
+ additionalProperties: false
22390
+ }
22391
+ }
22392
+ };
22393
+
22255
22394
  // packages/experience-design-system-cli/src/tui/import/steps/preview-validation-error/logic.ts
22256
22395
  function failedComponentNames(errors) {
22257
22396
  return [...new Set(errors.map((error) => error.componentName))];
@@ -22313,7 +22452,7 @@ function PreviewValidationErrorScreen({
22313
22452
  }
22314
22453
 
22315
22454
  // 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";
22455
+ import { useCallback as useCallback5, useEffect as useEffect18, useMemo as useMemo6, useRef as useRef14, useState as useState26 } from "react";
22317
22456
  import figures8 from "figures";
22318
22457
 
22319
22458
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/review-json-panel.ts
@@ -22372,14 +22511,14 @@ function computeRenderStatuses(closure, directIssues) {
22372
22511
  for (const node of closure.nodes) {
22373
22512
  nodesByName.set(node.name, { name: node.name, path: node.path });
22374
22513
  }
22375
- const own = /* @__PURE__ */ new Map();
22514
+ const own2 = /* @__PURE__ */ new Map();
22376
22515
  for (const node of closure.nodes) {
22377
22516
  const s = directIssues.get(node.name);
22378
- if (s && s !== "ok") own.set(node.name, s);
22517
+ if (s && s !== "ok") own2.set(node.name, s);
22379
22518
  }
22380
22519
  const inheritedSources = /* @__PURE__ */ new Map();
22381
22520
  for (const node of closure.nodes) {
22382
- const ownStatus = own.get(node.name);
22521
+ const ownStatus = own2.get(node.name);
22383
22522
  if (!ownStatus) continue;
22384
22523
  for (let i = 0; i < node.path.length - 1; i++) {
22385
22524
  const ancestor = node.path[i];
@@ -22387,7 +22526,7 @@ function computeRenderStatuses(closure, directIssues) {
22387
22526
  inheritedSources.get(ancestor).set(node.name, ownStatus);
22388
22527
  }
22389
22528
  }
22390
- for (const [name, status] of own.entries()) {
22529
+ for (const [name, status] of own2.entries()) {
22391
22530
  out.set(name, {
22392
22531
  status,
22393
22532
  isOwn: true,
@@ -22574,7 +22713,7 @@ function enumerateCycleBreaks(cycle, components) {
22574
22713
  import { Box as Box32, Text as Text34 } from "ink";
22575
22714
 
22576
22715
  // 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";
22716
+ import React13, { useEffect as useEffect12, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
22578
22717
  import figures6 from "figures";
22579
22718
  import { Box as Box26, measureElement, Text as Text27 } from "ink";
22580
22719
 
@@ -23372,6 +23511,7 @@ function FieldEditor({
23372
23511
  const [rationaleOpen, setRationaleOpen] = useState19(false);
23373
23512
  const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
23374
23513
  const [showHelp, setShowHelp] = useState19(false);
23514
+ const [pendingDelete, setPendingDelete] = useState19(null);
23375
23515
  const props = editorState.props;
23376
23516
  const slots = editorState.slots;
23377
23517
  const contentPropIndexes = React13.useMemo(
@@ -23463,6 +23603,46 @@ function FieldEditor({
23463
23603
  setEditorState(next);
23464
23604
  onChange(serializeState(next, value));
23465
23605
  };
23606
+ const deleteRow = (row) => {
23607
+ if (row.kind === "prop") {
23608
+ const nextProps = removeAt(editorState.props, row.idx);
23609
+ commit({ ...editorState, props: nextProps });
23610
+ setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
23611
+ const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
23612
+ const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23613
+ if (!neighbour2) {
23614
+ setInSlots(false);
23615
+ setInComponentDesc(true);
23616
+ setFocusLevel("componentDescription");
23617
+ } else if (neighbour2.kind === "prop") {
23618
+ setInSlots(false);
23619
+ setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
23620
+ setFocusLevel("prop");
23621
+ } else {
23622
+ setInSlots(true);
23623
+ setSlotIdx(neighbour2.idx);
23624
+ setFocusLevel("slot");
23625
+ }
23626
+ return;
23627
+ }
23628
+ const nextSlots = removeAt(editorState.slots, row.idx);
23629
+ commit({ ...editorState, slots: nextSlots });
23630
+ const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
23631
+ const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23632
+ if (!neighbour) {
23633
+ setInSlots(false);
23634
+ setInComponentDesc(true);
23635
+ setFocusLevel("componentDescription");
23636
+ } else if (neighbour.kind === "slot") {
23637
+ setInSlots(true);
23638
+ setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
23639
+ setFocusLevel("slot");
23640
+ } else {
23641
+ setInSlots(false);
23642
+ setPropIdx(neighbour.idx);
23643
+ setFocusLevel("prop");
23644
+ }
23645
+ };
23466
23646
  const canonicalize = React13.useCallback((json) => {
23467
23647
  try {
23468
23648
  return JSON.stringify(JSON.parse(json));
@@ -23499,6 +23679,11 @@ function FieldEditor({
23499
23679
  onSave();
23500
23680
  return;
23501
23681
  }
23682
+ if (pendingDelete) {
23683
+ if (input === "y") deleteRow(pendingDelete);
23684
+ setPendingDelete(null);
23685
+ return;
23686
+ }
23502
23687
  const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
23503
23688
  const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
23504
23689
  const inValueListTextEntry = editingValue != null;
@@ -23698,6 +23883,11 @@ function FieldEditor({
23698
23883
  }
23699
23884
  return;
23700
23885
  }
23886
+ if (input === "d" && !key.ctrl && !key.meta) {
23887
+ if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
23888
+ if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
23889
+ return;
23890
+ }
23701
23891
  if (focusLevel === "slot" && key.return && currentSlot) {
23702
23892
  setFocusLevel("field");
23703
23893
  setActiveField(SLOT_FIELDS[0] ?? null);
@@ -24004,6 +24194,10 @@ function FieldEditor({
24004
24194
  }
24005
24195
  const hasEmptyProperties = props.length === 0 && slots.length === 0;
24006
24196
  const modeLabel = (() => {
24197
+ if (pendingDelete) {
24198
+ const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
24199
+ return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
24200
+ }
24007
24201
  if (editingValue) {
24008
24202
  return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
24009
24203
  }
@@ -24025,7 +24219,7 @@ function FieldEditor({
24025
24219
  if (rationaleOpen) {
24026
24220
  return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
24027
24221
  }
24028
- return `[\u2191\u2193] navigate rows [Enter] edit fields [s] source [${propRationaleKey}] prop rationale [${componentRationaleKey}] component rationale [h] help [Esc] exit panel`;
24222
+ return `[\u2191\u2193] navigate [Enter] edit fields [d] delete property [h] help [s] source [Esc] exit panel`;
24029
24223
  })();
24030
24224
  const rows = [];
24031
24225
  rows.push({ kind: "component-description" });
@@ -24077,7 +24271,7 @@ function FieldEditor({
24077
24271
  }
24078
24272
  return Math.max(start + 1, end2);
24079
24273
  };
24080
- useEffect11(() => {
24274
+ useEffect12(() => {
24081
24275
  if (focusLevel === "field" || selectedRowIdx < 0) return;
24082
24276
  setListScrollStart((previous) => {
24083
24277
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -24291,6 +24485,7 @@ function FieldEditor({
24291
24485
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
24292
24486
  /* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
24293
24487
  /* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
24488
+ /* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
24294
24489
  /* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
24295
24490
  /* @__PURE__ */ jsx32(Text27, { children: " " }),
24296
24491
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
@@ -24314,7 +24509,7 @@ function FieldEditor({
24314
24509
  /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
24315
24510
  ] }),
24316
24511
  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 }) })
24512
+ /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: pendingDelete ? PALETTE.text : PALETTE.muted, children: modeLabel }) })
24318
24513
  ]
24319
24514
  }
24320
24515
  );
@@ -24653,8 +24848,8 @@ function TokenReviewPanel({
24653
24848
  borderStyle: "single",
24654
24849
  borderColor: active ? PALETTE.text : void 0,
24655
24850
  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})` }),
24851
+ /* @__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(", ")})` : ""}` }),
24852
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `Tick the tokens this property may use (${rangeLabel}).` }),
24658
24853
  /* @__PURE__ */ jsx39(Text32, { children: " " }),
24659
24854
  current.paths.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no compatible tokens found for this token kind)" }),
24660
24855
  visiblePaths.map((path5, i) => {
@@ -24687,18 +24882,33 @@ function TokenReviewPanel({
24687
24882
  borderStyle: "single",
24688
24883
  borderColor: active ? PALETTE.text : void 0,
24689
24884
  children: [
24690
- /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `TOKEN REVIEW \u2014 ${componentName}` }),
24885
+ /* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `Review mapped tokens \u2014 ${componentName}` }),
24886
+ /* @__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.` }),
24887
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: "Suggested tokens come from the agent. Allowed tokens are what editors can pick in Contentful." }),
24888
+ /* @__PURE__ */ jsx39(Text32, { children: " " }),
24691
24889
  suggestions.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no token suggestions for this component)" }),
24692
24890
  suggestions.map((s, i) => {
24693
24891
  const focused = i === selectedRow;
24694
24892
  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(", ")}` })
24893
+ /* @__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(", ")})` : ""}` }) }),
24894
+ /* @__PURE__ */ jsx39(
24895
+ Text32,
24896
+ {
24897
+ color: PALETTE.muted,
24898
+ children: ` suggested: ${s.suggested.length > 0 ? s.suggested.join(", ") : "none"}`
24899
+ }
24900
+ ),
24901
+ /* @__PURE__ */ jsx39(
24902
+ Text32,
24903
+ {
24904
+ color: PALETTE.muted,
24905
+ children: ` allowed: ${s.allowed.length > 0 ? s.allowed.join(", ") : "none (any token)"}`
24906
+ }
24907
+ ),
24908
+ /* @__PURE__ */ jsx39(Text32, { children: " " })
24698
24909
  ] }, s.propName);
24699
24910
  }),
24700
- /* @__PURE__ */ jsx39(Text32, { children: " " }),
24701
- /* @__PURE__ */ jsx39(Text32, { children: "[\u2191/\u2193] move [Enter] edit allowed [Esc] close" })
24911
+ /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "[\u2191/\u2193] move [Enter] edit allowed tokens [Esc] close" })
24702
24912
  ]
24703
24913
  }
24704
24914
  );
@@ -24946,15 +25156,9 @@ function ReviewFinalizeError({
24946
25156
  function ReviewPanelFooter({
24947
25157
  reviewEditor,
24948
25158
  sidebarFocused,
24949
- sidebarFooter,
24950
- livePreview,
24951
- livePreviewSpinner
25159
+ sidebarFooter
24952
25160
  }) {
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
- ] });
25161
+ 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
25162
  }
24959
25163
  function ReviewComponentTitle({
24960
25164
  selectedKey,
@@ -24988,9 +25192,7 @@ function ReviewComponentPanel({
24988
25192
  sidebarFocused,
24989
25193
  fieldEditor,
24990
25194
  saveError,
24991
- sidebarFooter,
24992
- livePreview,
24993
- livePreviewSpinner
25195
+ sidebarFooter
24994
25196
  }) {
24995
25197
  const propCount = Object.keys(selectedEntry.$properties).length;
24996
25198
  const slotCount = selectedEntry.$slots ? Object.keys(selectedEntry.$slots).length : 0;
@@ -25027,9 +25229,7 @@ function ReviewComponentPanel({
25027
25229
  {
25028
25230
  reviewEditor,
25029
25231
  sidebarFocused,
25030
- sidebarFooter,
25031
- livePreview,
25032
- livePreviewSpinner
25232
+ sidebarFooter
25033
25233
  }
25034
25234
  ) }) })
25035
25235
  ] }) });
@@ -25143,7 +25343,7 @@ function finalizeReviewSession(extractSessionId, components) {
25143
25343
  }
25144
25344
 
25145
25345
  // 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";
25346
+ import { useCallback as useCallback2, useEffect as useEffect14, useRef as useRef11, useState as useState21 } from "react";
25147
25347
 
25148
25348
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/history.ts
25149
25349
  var DEFAULT_MAX_DEPTH = 50;
@@ -25199,7 +25399,7 @@ function createHistoryStack(seed, maxDepth = DEFAULT_MAX_DEPTH) {
25199
25399
  }
25200
25400
 
25201
25401
  // 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";
25402
+ import { useEffect as useEffect13, useRef as useRef10, useState as useState20 } from "react";
25203
25403
 
25204
25404
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/run-live-preview.ts
25205
25405
  var TimeoutError = class extends Error {
@@ -25357,9 +25557,9 @@ function useFinalizePreview(opts) {
25357
25557
  const [status, setStatus] = useState20("idle");
25358
25558
  const [removed, setRemoved] = useState20([]);
25359
25559
  const [scrollOffset, setScrollOffset] = useState20(0);
25360
- const generationRef = useRef9(0);
25560
+ const generationRef = useRef10(0);
25361
25561
  const acceptedKey = [...acceptedKeys].sort().join("\0");
25362
- useEffect12(() => {
25562
+ useEffect13(() => {
25363
25563
  if (!open) {
25364
25564
  setStatus("idle");
25365
25565
  setRemoved([]);
@@ -25422,7 +25622,7 @@ function useReviewSession({
25422
25622
  }));
25423
25623
  return { result, catalog };
25424
25624
  }, [loadSession, tokensPath]);
25425
- useEffect13(() => {
25625
+ useEffect14(() => {
25426
25626
  let disposed = false;
25427
25627
  void (async () => {
25428
25628
  try {
@@ -25475,7 +25675,7 @@ function useReviewSession({
25475
25675
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25476
25676
  const [reviewMetadata, setReviewMetadata] = useState21(null);
25477
25677
  const [componentRationale, setComponentRationale] = useState21(null);
25478
- useEffect13(() => {
25678
+ useEffect14(() => {
25479
25679
  const current = components[selectedIdx];
25480
25680
  if (!current) {
25481
25681
  setReviewMetadata(null);
@@ -25505,9 +25705,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
25505
25705
  return { reviewMetadata, componentRationale };
25506
25706
  }
25507
25707
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
25508
- const historyRef = useRef10(null);
25509
- const historySeededRef = useRef10(false);
25510
- useEffect13(() => {
25708
+ const historyRef = useRef11(null);
25709
+ const historySeededRef = useRef11(false);
25710
+ useEffect14(() => {
25511
25711
  if (loading || historySeededRef.current) return;
25512
25712
  historySeededRef.current = true;
25513
25713
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -25558,7 +25758,7 @@ function useReviewFinalize({
25558
25758
  }
25559
25759
 
25560
25760
  // 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";
25761
+ import { useEffect as useEffect15, useRef as useRef12, useState as useState22 } from "react";
25562
25762
 
25563
25763
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/token-suggestions.ts
25564
25764
  function collectTokenSuggestions(entry, availableTokens = []) {
@@ -25573,7 +25773,7 @@ function collectTokenSuggestions(entry, availableTokens = []) {
25573
25773
  const compatiblePaths = new Set(compatible);
25574
25774
  const allowed = availableTokens.length > 0 ? persistedAllowed.filter((path5) => compatiblePaths.has(path5)) : persistedAllowed;
25575
25775
  const paths = availableTokens.length > 0 ? compatible : allowed;
25576
- return { propName, paths, suggested: [...allowed], allowed };
25776
+ return { propName, kinds, paths, suggested: [...allowed], allowed };
25577
25777
  });
25578
25778
  }
25579
25779
 
@@ -25609,9 +25809,9 @@ function useReviewEditor({
25609
25809
  const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
25610
25810
  const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
25611
25811
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
25612
- const tokenReviewSuggestedRef = useRef11(/* @__PURE__ */ new Map());
25613
- const pendingGRef = useRef11(false);
25614
- useEffect14(() => {
25812
+ const tokenReviewSuggestedRef = useRef12(/* @__PURE__ */ new Map());
25813
+ const pendingGRef = useRef12(false);
25814
+ useEffect15(() => {
25615
25815
  setTokenReviewRow(0);
25616
25816
  setTokenReviewEditing(false);
25617
25817
  setTokenReviewEditCursor(0);
@@ -26023,7 +26223,7 @@ function handleJsonPanelInput(input, key, state2) {
26023
26223
  }
26024
26224
 
26025
26225
  // 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";
26226
+ import { useCallback as useCallback4, useEffect as useEffect17, useState as useState25 } from "react";
26027
26227
 
26028
26228
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/preview-annotations.ts
26029
26229
  function applyPreviewAnnotations(preview, localNames) {
@@ -26058,25 +26258,25 @@ function applyPreviewAnnotations(preview, localNames) {
26058
26258
  }
26059
26259
 
26060
26260
  // 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";
26261
+ import { useCallback as useCallback3, useEffect as useEffect16, useRef as useRef13, useState as useState24 } from "react";
26062
26262
  var DEFAULT_DEBOUNCE_MS = 500;
26063
26263
  function useLivePreview(opts) {
26064
26264
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
26065
26265
  const [status, setStatus] = useState24("idle");
26066
26266
  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(() => {
26267
+ const timerRef = useRef13(null);
26268
+ const generationRef = useRef13(0);
26269
+ const latestRef = useRef13(0);
26270
+ const inflightRef = useRef13(0);
26271
+ const optsRef = useRef13(opts);
26272
+ useEffect16(() => {
26073
26273
  optsRef.current = opts;
26074
26274
  });
26075
- const disabledRef = useRef12(disabled);
26076
- useEffect15(() => {
26275
+ const disabledRef = useRef13(disabled);
26276
+ useEffect16(() => {
26077
26277
  disabledRef.current = disabled;
26078
26278
  }, [disabled]);
26079
- useEffect15(() => {
26279
+ useEffect16(() => {
26080
26280
  return () => {
26081
26281
  if (timerRef.current) {
26082
26282
  clearTimeout(timerRef.current);
@@ -26190,13 +26390,13 @@ function useReviewPreview({
26190
26390
  deleteAllComponents
26191
26391
  });
26192
26392
  const [spinnerTick, setSpinnerTick] = useState25(0);
26193
- useEffect16(() => {
26393
+ useEffect17(() => {
26194
26394
  if (livePreviewHook.status !== "running") return;
26195
26395
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
26196
26396
  return () => clearInterval(id);
26197
26397
  }, [livePreviewHook.status]);
26198
26398
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
26199
- useEffect16(() => {
26399
+ useEffect17(() => {
26200
26400
  if (loading) return;
26201
26401
  if (!livePreview) return;
26202
26402
  if (components.length === 0) return;
@@ -26369,7 +26569,7 @@ var HELP_SECTIONS2 = [
26369
26569
  { keys: "P", label: "Component rationale" },
26370
26570
  { keys: "s", label: "Source code snippet" },
26371
26571
  { keys: "J", label: "Toggle JSON" },
26372
- { keys: "t", label: "Token review" }
26572
+ { keys: "t", label: "Review mapped tokens" }
26373
26573
  ]
26374
26574
  },
26375
26575
  {
@@ -26509,7 +26709,7 @@ function GenerateReviewStepView({
26509
26709
  setFinalizeError
26510
26710
  } = reviewSurface;
26511
26711
  const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
26512
- const removedBannerDefaultedRef = useRef13(false);
26712
+ const removedBannerDefaultedRef = useRef14(false);
26513
26713
  const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
26514
26714
  const [cyclesCursor, setCyclesCursor] = useState26(0);
26515
26715
  const cyclePanel = useOverlayPanel({
@@ -26529,7 +26729,7 @@ function GenerateReviewStepView({
26529
26729
  const [breakCursor, setBreakCursor] = useState26(0);
26530
26730
  const [breakConfirm, setBreakConfirm] = useState26(false);
26531
26731
  const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
26532
- const seededGroupsRef = useRef13(false);
26732
+ const seededGroupsRef = useRef14(false);
26533
26733
  const {
26534
26734
  searchOpen,
26535
26735
  setSearchOpen,
@@ -26553,7 +26753,7 @@ function GenerateReviewStepView({
26553
26753
  const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
26554
26754
  const [autoRejected, setAutoRejected] = useState26([]);
26555
26755
  const [undoSnapshot, setUndoSnapshot] = useState26(null);
26556
- const autoRejectFiredRef = useRef13(false);
26756
+ const autoRejectFiredRef = useRef14(false);
26557
26757
  const [showReloadDialog, setShowReloadDialog] = useState26(false);
26558
26758
  const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
26559
26759
  const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
@@ -26616,7 +26816,7 @@ function GenerateReviewStepView({
26616
26816
  [components]
26617
26817
  );
26618
26818
  const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
26619
- useEffect17(() => {
26819
+ useEffect18(() => {
26620
26820
  if (seededGroupsRef.current) return;
26621
26821
  if (closures.size === 0 && slotCycles.length === 0) return;
26622
26822
  seededGroupsRef.current = true;
@@ -26643,7 +26843,7 @@ function GenerateReviewStepView({
26643
26843
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
26644
26844
  }));
26645
26845
  }, [slotCycles, cycleView]);
26646
- useEffect17(() => {
26846
+ useEffect18(() => {
26647
26847
  const decision = computeAutoRejectDecision({
26648
26848
  loading,
26649
26849
  autoRejectFired: autoRejectFiredRef.current,
@@ -26686,8 +26886,8 @@ function GenerateReviewStepView({
26686
26886
  }),
26687
26887
  applySnapshot: applyHistorySnapshot
26688
26888
  });
26689
- const autoRejectPushedRef = useRef13(false);
26690
- useEffect17(() => {
26889
+ const autoRejectPushedRef = useRef14(false);
26890
+ useEffect18(() => {
26691
26891
  if (loading) return;
26692
26892
  if (!historySeededRef.current) return;
26693
26893
  if (!autoRejectFiredRef.current) return;
@@ -26771,7 +26971,7 @@ function GenerateReviewStepView({
26771
26971
  const panelHeight = leftPanelHeight + 2;
26772
26972
  const panelContentHeight = Math.max(1, panelHeight - 3);
26773
26973
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
26774
- useEffect17(() => {
26974
+ useEffect18(() => {
26775
26975
  if (selectableRowPositions.length === 0) return;
26776
26976
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
26777
26977
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -27517,9 +27717,7 @@ function GenerateReviewStepView({
27517
27717
  initialFocusTarget: pendingEditorFocus && pendingEditorFocus.componentName === selected.key ? pendingEditorFocus.target : { kind: "description" }
27518
27718
  }
27519
27719
  ),
27520
- saveError: reviewEditor.saveError,
27521
- livePreview: livePreviewHook,
27522
- livePreviewSpinner
27720
+ saveError: reviewEditor.saveError
27523
27721
  }
27524
27722
  ) : /* @__PURE__ */ jsx48(ReviewNoSelection, {})
27525
27723
  ] }),
@@ -27551,7 +27749,7 @@ function GenerateReviewStepView({
27551
27749
  hidden: dialogOpen
27552
27750
  }
27553
27751
  ),
27554
- !dialogOpen && sidebarFocused && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
27752
+ !dialogOpen && sidebarFocused && reviewEditor.panelOpen !== "token-review" && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
27555
27753
  ] });
27556
27754
  }
27557
27755
 
@@ -27696,11 +27894,11 @@ function DoneStep({
27696
27894
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
27697
27895
  import { useState as useState28 } from "react";
27698
27896
  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";
27897
+ import { readdirSync as readdirSync4 } from "node:fs";
27898
+ import { dirname as dirname17, basename as basename6, join as join22 } from "node:path";
27701
27899
 
27702
27900
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
27703
- import { resolve as resolve25 } from "node:path";
27901
+ import { resolve as resolve26 } from "node:path";
27704
27902
  import { homedir as homedir4 } from "node:os";
27705
27903
  function expandTilde(input) {
27706
27904
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -27714,14 +27912,14 @@ function normalizePath(input) {
27714
27912
  p = p.slice(1, -1);
27715
27913
  }
27716
27914
  p = expandTilde(p);
27717
- return resolve25(p);
27915
+ return resolve26(p);
27718
27916
  }
27719
27917
 
27720
27918
  // 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";
27919
+ import { useEffect as useEffect19, useState as useState27 } from "react";
27722
27920
  function useBlinkingCursor() {
27723
27921
  const [visible, setVisible] = useState27(true);
27724
- useEffect18(() => {
27922
+ useEffect19(() => {
27725
27923
  const interval = setInterval(() => setVisible((current) => !current), 500);
27726
27924
  return () => clearInterval(interval);
27727
27925
  }, []);
@@ -27733,23 +27931,23 @@ import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
27733
27931
  function autocomplete(partial) {
27734
27932
  if (!partial) return null;
27735
27933
  const normalized = normalizePath(partial);
27736
- const dir = dirname16(normalized);
27934
+ const dir = dirname17(normalized);
27737
27935
  const base = basename6(normalized);
27738
27936
  let entries;
27739
27937
  try {
27740
- entries = readdirSync3(dir);
27938
+ entries = readdirSync4(dir);
27741
27939
  } catch {
27742
27940
  return null;
27743
27941
  }
27744
27942
  const matches = entries.filter((e) => e.startsWith(base));
27745
27943
  if (matches.length === 0) return null;
27746
- if (matches.length === 1) return join20(dir, matches[0]);
27944
+ if (matches.length === 1) return join22(dir, matches[0]);
27747
27945
  let prefix = matches[0];
27748
27946
  for (const m of matches) {
27749
27947
  while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
27750
27948
  if (!prefix) break;
27751
27949
  }
27752
- return prefix.length > base.length ? join20(dir, prefix) : null;
27950
+ return prefix.length > base.length ? join22(dir, prefix) : null;
27753
27951
  }
27754
27952
  function PathPrompt({
27755
27953
  defaultPath,
@@ -27837,12 +28035,12 @@ function countedThings({ components, tokens }, counts = {}) {
27837
28035
  }
27838
28036
 
27839
28037
  // 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";
28038
+ import { useEffect as useEffect20, useState as useState29 } from "react";
27841
28039
  import { Spinner as Spinner2 } from "@inkjs/ui";
27842
28040
  import { jsx as jsx53 } from "react/jsx-runtime";
27843
28041
  function useTimedSpinner() {
27844
28042
  const [elapsedSeconds, setElapsedSeconds] = useState29(0);
27845
- useEffect19(() => {
28043
+ useEffect20(() => {
27846
28044
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
27847
28045
  return () => {
27848
28046
  clearInterval(timer);
@@ -27900,7 +28098,7 @@ function PushingStep({ progress, produced, counts }) {
27900
28098
  }
27901
28099
 
27902
28100
  // 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";
28101
+ import { useEffect as useEffect21, useState as useState30, useMemo as useMemo7 } from "react";
27904
28102
  import { Box as Box44, Text as Text46 } from "ink";
27905
28103
 
27906
28104
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/preview-diff.ts
@@ -28041,12 +28239,20 @@ function diffProperty(name, old, newDef) {
28041
28239
  diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
28042
28240
  return diffs;
28043
28241
  }
28242
+ function formatDefault(value) {
28243
+ const sys = value?.sys;
28244
+ if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
28245
+ const name = sys.urn.split("/designTokens/")[1];
28246
+ if (name) return name;
28247
+ }
28248
+ return JSON.stringify(value);
28249
+ }
28044
28250
  function formatOldProp(prop) {
28045
28251
  const parts = [];
28046
28252
  if (prop.type) parts.push(prop.type);
28047
28253
  if (prop.category) parts.push(prop.category);
28048
28254
  parts.push(prop.required ? "required" : "optional");
28049
- if (prop.default !== void 0) parts.push(`default=${JSON.stringify(prop.default)}`);
28255
+ if (prop.default !== void 0) parts.push(`default=${formatDefault(prop.default)}`);
28050
28256
  return parts.join(", ");
28051
28257
  }
28052
28258
  function formatPropDef(def) {
@@ -28055,7 +28261,7 @@ function formatPropDef(def) {
28055
28261
  if (def["$category"]) parts.push(def["$category"]);
28056
28262
  if (def["$required"] === true) parts.push("required");
28057
28263
  else parts.push("optional");
28058
- if (def["$default"] !== void 0) parts.push(`default=${JSON.stringify(def["$default"])}`);
28264
+ if (def["$default"] !== void 0) parts.push(`default=${formatDefault(def["$default"])}`);
28059
28265
  return parts.join(", ");
28060
28266
  }
28061
28267
 
@@ -28287,7 +28493,7 @@ function WizardPreviewStep({
28287
28493
  const activeLines = diffExpanded ? diffLines : summaryLines;
28288
28494
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
28289
28495
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
28290
- useEffect20(() => {
28496
+ useEffect21(() => {
28291
28497
  setScrollOffset((previous) => Math.min(previous, maxScroll));
28292
28498
  }, [maxScroll]);
28293
28499
  useImmediateInput((input, key) => {
@@ -28505,13 +28711,13 @@ function FlowScreen({
28505
28711
  }
28506
28712
 
28507
28713
  // 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";
28714
+ import { useEffect as useEffect22, useRef as useRef15, useSyncExternalStore } from "react";
28509
28715
 
28510
28716
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28511
28717
  import { appendFileSync, writeFileSync } from "node:fs";
28512
- import { mkdir as mkdir8 } from "node:fs/promises";
28718
+ import { mkdir as mkdir9 } from "node:fs/promises";
28513
28719
  import { tmpdir } from "node:os";
28514
- import { join as join22, resolve as resolve26 } from "node:path";
28720
+ import { join as join24, resolve as resolve27 } from "node:path";
28515
28721
 
28516
28722
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
28517
28723
  function shouldBypassPreview(state2) {
@@ -28858,8 +29064,8 @@ function pushFailure(e, deps) {
28858
29064
  }
28859
29065
 
28860
29066
  // 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";
29067
+ import { writeFile as writeFile8 } from "node:fs/promises";
29068
+ import { join as join23 } from "node:path";
28863
29069
 
28864
29070
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/run-print-files-helpers.ts
28865
29071
  function nextStateAfterPrint(opts) {
@@ -28882,7 +29088,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
28882
29088
  var realSaveDeps = () => ({
28883
29089
  openDb: openPipelineDb,
28884
29090
  readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
28885
- writeFile: (path5, contents) => writeFile7(path5, contents),
29091
+ writeFile: (path5, contents) => writeFile8(path5, contents),
28886
29092
  appendRun,
28887
29093
  buildSourceFingerprint,
28888
29094
  sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
@@ -28890,7 +29096,7 @@ var realSaveDeps = () => ({
28890
29096
  });
28891
29097
  async function runPrintFiles(input, deps, onPatch) {
28892
29098
  onPatch({ step: "printing" });
28893
- const componentsPath = join21(input.outDir, "components.json");
29099
+ const componentsPath = join23(input.outDir, "components.json");
28894
29100
  try {
28895
29101
  const db = deps.openDb();
28896
29102
  let components = [];
@@ -28971,7 +29177,7 @@ var EMPTY_PUSH_RESULT = {
28971
29177
  };
28972
29178
 
28973
29179
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
28974
- var WIZARD_LOG = join22(tmpdir(), "experiences-import-wizard.log");
29180
+ var WIZARD_LOG = join24(tmpdir(), "experiences-import-wizard.log");
28975
29181
  function appendWizardLog(entry) {
28976
29182
  appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
28977
29183
  }
@@ -28994,7 +29200,7 @@ function realFlowDeps() {
28994
29200
  }
28995
29201
  },
28996
29202
  mkdir: async (path5) => {
28997
- await mkdir8(path5, { recursive: true });
29203
+ await mkdir9(path5, { recursive: true });
28998
29204
  },
28999
29205
  detectSaveConflict,
29000
29206
  buildTimestampedSubdir,
@@ -29224,7 +29430,7 @@ function createFlowController(start, deps) {
29224
29430
  },
29225
29431
  async submitPath(submitted) {
29226
29432
  await deps.mkdir(submitted);
29227
- if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
29433
+ if (resolve27(submitted) !== resolve27(state2.outDir) && await deps.detectSaveConflict(submitted)) {
29228
29434
  const subdir = deps.buildTimestampedSubdir(submitted);
29229
29435
  await deps.mkdir(subdir);
29230
29436
  await proceedToWrite(subdir);
@@ -29247,7 +29453,7 @@ function createFlowController(start, deps) {
29247
29453
 
29248
29454
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
29249
29455
  function useFlow(start, options = {}) {
29250
- const controller = useRef14();
29456
+ const controller = useRef15();
29251
29457
  if (start && !controller.current) {
29252
29458
  try {
29253
29459
  startWizardLog();
@@ -29264,14 +29470,14 @@ function useFlow(start, options = {}) {
29264
29470
  (listener) => current?.subscribe(listener) ?? (() => void 0),
29265
29471
  () => current?.getState()
29266
29472
  );
29267
- useEffect21(() => {
29473
+ useEffect22(() => {
29268
29474
  if (!start) controller.current = void 0;
29269
29475
  }, [start]);
29270
29476
  return current && state2 ? { controller: current, state: state2 } : void 0;
29271
29477
  }
29272
29478
 
29273
29479
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
29274
- import { useEffect as useEffect22, useState as useState31 } from "react";
29480
+ import { useEffect as useEffect23, useState as useState31 } from "react";
29275
29481
  import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
29276
29482
  init_debug_store();
29277
29483
 
@@ -29304,7 +29510,7 @@ function describeFileLocations({
29304
29510
 
29305
29511
  // packages/experience-design-system-cli/src/tui/help/help-info.ts
29306
29512
  async function readHelpInfo() {
29307
- const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings2()]);
29513
+ const [debugMode, settings] = await Promise.all([readDebugModeSetting(), readSettings()]);
29308
29514
  const base = settings["contentfulBaseDir"];
29309
29515
  const locations = describeFileLocations({
29310
29516
  contentfulBaseDir: typeof base === "string" ? base : "",
@@ -29313,9 +29519,9 @@ async function readHelpInfo() {
29313
29519
  });
29314
29520
  return {
29315
29521
  storage: [
29316
- { label: "Config folder", value: configRoot2() },
29317
- { label: "Settings file", value: configFilePath2() },
29318
- { label: "Agent settings", value: `${configFilePath2()} (keys: agent, agentModel, agents)` },
29522
+ { label: "Config folder", value: configRoot() },
29523
+ { label: "Settings file", value: configFilePath() },
29524
+ { label: "Agent settings", value: `${configFilePath()} (keys: agent, agentModel, agents)` },
29319
29525
  { label: "Debug logs", value: locations.debugLogs },
29320
29526
  { label: "Import files", value: locations.importFiles }
29321
29527
  ],
@@ -29345,7 +29551,7 @@ function Section({ title, rows }) {
29345
29551
  }
29346
29552
  function HelpScreen({ onDone }) {
29347
29553
  const [info, setInfo] = useState31();
29348
- useEffect22(() => {
29554
+ useEffect23(() => {
29349
29555
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
29350
29556
  void readHelpInfo().then(setInfo);
29351
29557
  }, []);
@@ -29442,7 +29648,7 @@ import { useState as useState36 } from "react";
29442
29648
  import { Box as Box51, Text as Text53, useInput as useInput17 } from "ink";
29443
29649
 
29444
29650
  // 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";
29651
+ import { useEffect as useEffect25, useRef as useRef16, useState as useState34 } from "react";
29446
29652
  import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
29447
29653
  init_debug_store();
29448
29654
 
@@ -29475,7 +29681,7 @@ function scrubError(error, secrets) {
29475
29681
  return message;
29476
29682
  }
29477
29683
  function describeSettingsFile() {
29478
- const path5 = configFilePath2();
29684
+ const path5 = configFilePath();
29479
29685
  return { path: path5, eds_home_set: Boolean(process.env["EDS_HOME"]), exists: existsSync10(path5) };
29480
29686
  }
29481
29687
 
@@ -29715,8 +29921,8 @@ async function describeAgents(config) {
29715
29921
 
29716
29922
  // packages/experience-design-system-cli/src/tui/settings/shared/v1-store.ts
29717
29923
  init_config();
29718
- var readV1Store = readSettings2;
29719
- var writeV1Store = writeSettings2;
29924
+ var readV1Store = readSettings;
29925
+ var writeV1Store = writeSettings;
29720
29926
 
29721
29927
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
29722
29928
  var AGENT_LABELS = {
@@ -29771,7 +29977,7 @@ async function writeAgentConfig(config) {
29771
29977
  }
29772
29978
 
29773
29979
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
29774
- import { useEffect as useEffect23, useState as useState33 } from "react";
29980
+ import { useEffect as useEffect24, useState as useState33 } from "react";
29775
29981
  import { Box as Box48, Text as Text50 } from "ink";
29776
29982
 
29777
29983
  // packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentStatusBadge.tsx
@@ -29834,7 +30040,7 @@ function AgentDetail({
29834
30040
  const [testing, setTesting] = useState33(false);
29835
30041
  const [notice, setNotice] = useState33(null);
29836
30042
  const [checks, setChecks] = useState33(void 0);
29837
- useEffect23(() => {
30043
+ useEffect24(() => {
29838
30044
  let active = true;
29839
30045
  setChecks(void 0);
29840
30046
  const timer = setTimeout(() => {
@@ -29919,7 +30125,7 @@ function AgentsScreen({ onDone }) {
29919
30125
  const [saving, setSaving] = useState34(false);
29920
30126
  const [loadError, setLoadError] = useState34(null);
29921
30127
  const [checks, setChecks] = useState34({});
29922
- const visit = useRef15({
30128
+ const visit = useRef16({
29923
30129
  trail: createTrail(),
29924
30130
  before: void 0,
29925
30131
  environment: void 0,
@@ -29932,7 +30138,7 @@ function AgentsScreen({ onDone }) {
29932
30138
  );
29933
30139
  }
29934
30140
  };
29935
- useEffect24(() => {
30141
+ useEffect25(() => {
29936
30142
  readAgentConfig().then((loaded) => {
29937
30143
  setConfig(loaded);
29938
30144
  inspectAll(loaded);
@@ -30109,7 +30315,7 @@ function AgentsScreen({ onDone }) {
30109
30315
  }
30110
30316
 
30111
30317
  // 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";
30318
+ import { useEffect as useEffect26, useRef as useRef17, useState as useState35 } from "react";
30113
30319
  import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
30114
30320
  init_debug_store();
30115
30321
 
@@ -30167,14 +30373,14 @@ function ProjectScreen({ onDone }) {
30167
30373
  const [saving, setSaving] = useState35(false);
30168
30374
  const [notice, setNotice] = useState35(null);
30169
30375
  const [loadError, setLoadError] = useState35(null);
30170
- const visit = useRef16({
30376
+ const visit = useRef17({
30171
30377
  trail: createTrail(),
30172
30378
  before: void 0,
30173
30379
  persisted: void 0,
30174
30380
  error: ""
30175
30381
  }).current;
30176
30382
  const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
30177
- useEffect25(() => {
30383
+ useEffect26(() => {
30178
30384
  readCredentials().then((cfg) => {
30179
30385
  setConfig(cfg);
30180
30386
  visit.before = snapshotOf(cfg);
@@ -30326,7 +30532,7 @@ function ConfigurationScreen({ onDone }) {
30326
30532
  }
30327
30533
 
30328
30534
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
30329
- import { useEffect as useEffect26, useState as useState37 } from "react";
30535
+ import { useEffect as useEffect27, useState as useState37 } from "react";
30330
30536
  import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
30331
30537
 
30332
30538
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
@@ -30350,7 +30556,7 @@ import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-
30350
30556
  function OptInAnalyticsScreen({ onDone }) {
30351
30557
  const [loading, setLoading] = useState37(true);
30352
30558
  const [enabled, setEnabled] = useState37(true);
30353
- useEffect26(() => {
30559
+ useEffect27(() => {
30354
30560
  readAnalyticsSetting().then((setting) => {
30355
30561
  setEnabled(setting.enabled);
30356
30562
  setLoading(false);
@@ -30404,7 +30610,7 @@ function OptInAnalyticsScreen({ onDone }) {
30404
30610
  }
30405
30611
 
30406
30612
  // 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";
30613
+ import { useEffect as useEffect28, useRef as useRef18, useState as useState38 } from "react";
30408
30614
  import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
30409
30615
  init_debug_mode_store();
30410
30616
  init_debug_store();
@@ -30421,8 +30627,8 @@ function DebugModeScreen({ onDone }) {
30421
30627
  RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
30422
30628
  );
30423
30629
  const [notice, setNotice] = useState38(null);
30424
- const visit = useRef17({ trail: createTrail(), before: void 0, error: "" }).current;
30425
- useEffect27(() => {
30630
+ const visit = useRef18({ trail: createTrail(), before: void 0, error: "" }).current;
30631
+ useEffect28(() => {
30426
30632
  readDebugModeSetting().then((loaded) => {
30427
30633
  setSetting(loaded);
30428
30634
  setPending(loaded.retentionDays);
@@ -30577,7 +30783,7 @@ function App({ importOptions, inkClear }) {
30577
30783
  const [flowStart, setFlowStart] = useState39();
30578
30784
  const flow = useFlow(flowStart, { beforeStepChange: inkClear });
30579
30785
  const [importDefaults, setImportDefaults] = useState39();
30580
- useEffect28(() => {
30786
+ useEffect29(() => {
30581
30787
  if (screen !== "import") {
30582
30788
  setImportDefaults(void 0);
30583
30789
  return;
@@ -30603,7 +30809,7 @@ function App({ importOptions, inkClear }) {
30603
30809
  else await startExtraction(launch, result);
30604
30810
  };
30605
30811
  const prepareRun = async (launch, credentials) => {
30606
- const settings = await readSettings2();
30812
+ const settings = await readSettings();
30607
30813
  const { agent, agentModel } = resolveAgentChoice(launch.agent, settings);
30608
30814
  const generatePromptPath = typeof settings.generatePromptPath === "string" ? settings.generatePromptPath : void 0;
30609
30815
  const outDir = await (await Promise.resolve().then(() => (init_debug_store(), debug_store_exports))).startImportRun(resolveUserPath(launch.projectPath ?? ""));
@@ -30650,7 +30856,7 @@ function App({ importOptions, inkClear }) {
30650
30856
  }
30651
30857
  });
30652
30858
  };
30653
- useEffect28(() => {
30859
+ useEffect29(() => {
30654
30860
  if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
30655
30861
  const { credentialsSkipped, input, tokens } = tokensOnlyRun;
30656
30862
  const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
@@ -30672,12 +30878,12 @@ function App({ importOptions, inkClear }) {
30672
30878
  }
30673
30879
  });
30674
30880
  }, [tokensOnly, tokensOnlyRun]);
30675
- useEffect28(() => {
30881
+ useEffect29(() => {
30676
30882
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
30677
30883
  setExtractionRun(void 0);
30678
30884
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
30679
30885
  }, [extraction, extractionRun]);
30680
- useEffect28(() => {
30886
+ useEffect29(() => {
30681
30887
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
30682
30888
  const { extraction: produced, input, generatePromptPath } = scopeRun;
30683
30889
  setGenerationInput({
@@ -30695,7 +30901,7 @@ function App({ importOptions, inkClear }) {
30695
30901
  ...generatePromptPath ? { generatePromptPath } : {}
30696
30902
  });
30697
30903
  }, [scopeFlow, scopeRun, generationInput]);
30698
- useEffect28(() => {
30904
+ useEffect29(() => {
30699
30905
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
30700
30906
  const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
30701
30907
  inkClear();