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