@contentful/experience-design-system-cli 2.39.1-dev-build-66a06016.0 → 2.39.1-dev-build-6e58be6f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +754 -872
- package/dist/index.js +498 -641
- package/dist/package.json +2 -2
- 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 +4 -4
package/dist/index.js
CHANGED
|
@@ -19407,325 +19407,6 @@ var init_PageContainer = __esm({
|
|
|
19407
19407
|
}
|
|
19408
19408
|
});
|
|
19409
19409
|
|
|
19410
|
-
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
19411
|
-
function toRetentionDays(value) {
|
|
19412
|
-
return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
|
|
19413
|
-
}
|
|
19414
|
-
async function readDebugModeSetting() {
|
|
19415
|
-
const { debugMode } = await readSettings2();
|
|
19416
|
-
const saved = debugMode ?? {};
|
|
19417
|
-
return {
|
|
19418
|
-
enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
|
|
19419
|
-
retentionDays: toRetentionDays(saved.retentionDays)
|
|
19420
|
-
};
|
|
19421
|
-
}
|
|
19422
|
-
async function writeDebugModeSetting(change) {
|
|
19423
|
-
await updateSettings2({ debugMode: { ...await readDebugModeSetting(), ...change } });
|
|
19424
|
-
}
|
|
19425
|
-
var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
|
|
19426
|
-
var init_debug_mode_store = __esm({
|
|
19427
|
-
"packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
|
|
19428
|
-
"use strict";
|
|
19429
|
-
init_config();
|
|
19430
|
-
RETENTION_CHOICES = [7, 14, 30];
|
|
19431
|
-
DEFAULT_RETENTION_DAYS = 30;
|
|
19432
|
-
}
|
|
19433
|
-
});
|
|
19434
|
-
|
|
19435
|
-
// packages/experience-design-system-cli/src/tui/debug-prune.ts
|
|
19436
|
-
import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
|
|
19437
|
-
import { dirname as dirname15, join as join18 } from "node:path";
|
|
19438
|
-
async function logFilesIn(dir) {
|
|
19439
|
-
const entries = await readdir2(dir, { withFileTypes: true });
|
|
19440
|
-
const nested = await Promise.all(
|
|
19441
|
-
entries.map(async (entry) => {
|
|
19442
|
-
const path5 = join18(dir, entry.name);
|
|
19443
|
-
if (entry.isDirectory()) return logFilesIn(path5);
|
|
19444
|
-
return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
|
|
19445
|
-
})
|
|
19446
|
-
);
|
|
19447
|
-
return nested.flat();
|
|
19448
|
-
}
|
|
19449
|
-
async function removeEmptyFolders(from, stop) {
|
|
19450
|
-
let dir = from;
|
|
19451
|
-
let removed = 0;
|
|
19452
|
-
for (; ; ) {
|
|
19453
|
-
try {
|
|
19454
|
-
await rmdir(dir);
|
|
19455
|
-
} catch {
|
|
19456
|
-
return removed;
|
|
19457
|
-
}
|
|
19458
|
-
removed += 1;
|
|
19459
|
-
if (dir === stop) return removed;
|
|
19460
|
-
dir = dirname15(dir);
|
|
19461
|
-
}
|
|
19462
|
-
}
|
|
19463
|
-
async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
19464
|
-
const cutoff = now - retentionDays * DAY_MS;
|
|
19465
|
-
const contentfulDir = join18(base, ".contentful");
|
|
19466
|
-
const result = { logs: 0, folders: 0 };
|
|
19467
|
-
try {
|
|
19468
|
-
const sessions = (await readdir2(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
|
|
19469
|
-
for (const session of sessions) {
|
|
19470
|
-
const files = await logFilesIn(join18(contentfulDir, session, "debug")).catch(() => []);
|
|
19471
|
-
for (const file of files) {
|
|
19472
|
-
try {
|
|
19473
|
-
if ((await stat4(file)).mtimeMs >= cutoff) continue;
|
|
19474
|
-
await rm(file);
|
|
19475
|
-
result.logs += 1;
|
|
19476
|
-
result.folders += await removeEmptyFolders(dirname15(file), join18(contentfulDir, session));
|
|
19477
|
-
} catch {
|
|
19478
|
-
}
|
|
19479
|
-
}
|
|
19480
|
-
}
|
|
19481
|
-
} catch {
|
|
19482
|
-
}
|
|
19483
|
-
return result;
|
|
19484
|
-
}
|
|
19485
|
-
var DAY_MS, SESSION_FOLDER;
|
|
19486
|
-
var init_debug_prune = __esm({
|
|
19487
|
-
"packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
|
|
19488
|
-
"use strict";
|
|
19489
|
-
DAY_MS = 24 * 60 * 60 * 1e3;
|
|
19490
|
-
SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
|
|
19491
|
-
}
|
|
19492
|
-
});
|
|
19493
|
-
|
|
19494
|
-
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
19495
|
-
var debug_store_exports = {};
|
|
19496
|
-
__export(debug_store_exports, {
|
|
19497
|
-
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
19498
|
-
currentSessionDir: () => currentSessionDir,
|
|
19499
|
-
finishDebugRun: () => finishDebugRun,
|
|
19500
|
-
startDebugRun: () => startDebugRun,
|
|
19501
|
-
startDebugSessionIn: () => startDebugSessionIn,
|
|
19502
|
-
startImportRun: () => startImportRun
|
|
19503
|
-
});
|
|
19504
|
-
import { mkdir as mkdir7, writeFile as writeFile7 } from "node:fs/promises";
|
|
19505
|
-
import { existsSync as existsSync9, readdirSync as readdirSync3 } from "node:fs";
|
|
19506
|
-
import { join as join19, resolve as resolve20 } from "node:path";
|
|
19507
|
-
function generateRunId() {
|
|
19508
|
-
const now = /* @__PURE__ */ new Date();
|
|
19509
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
19510
|
-
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
19511
|
-
}
|
|
19512
|
-
function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
19513
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
19514
|
-
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
19515
|
-
}
|
|
19516
|
-
function slugify(value) {
|
|
19517
|
-
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
19518
|
-
}
|
|
19519
|
-
async function readBaseDir() {
|
|
19520
|
-
try {
|
|
19521
|
-
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
19522
|
-
return typeof dir === "string" && dir !== "" ? resolve20(dir) : void 0;
|
|
19523
|
-
} catch {
|
|
19524
|
-
return void 0;
|
|
19525
|
-
}
|
|
19526
|
-
}
|
|
19527
|
-
function nextSessionId(contentfulDir) {
|
|
19528
|
-
const today = datePrefix();
|
|
19529
|
-
const existing = existsSync9(contentfulDir) ? readdirSync3(contentfulDir) : [];
|
|
19530
|
-
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
19531
|
-
const maxSeq = existing.reduce((max, entry) => {
|
|
19532
|
-
const match2 = seqPattern.exec(entry);
|
|
19533
|
-
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
19534
|
-
}, 0);
|
|
19535
|
-
return `${today}-session-${maxSeq + 1}`;
|
|
19536
|
-
}
|
|
19537
|
-
function startSession(base, { replace }) {
|
|
19538
|
-
const contentfulDir = join19(base, ".contentful");
|
|
19539
|
-
if (replace || !sessionDir) sessionDir = join19(contentfulDir, nextSessionId(contentfulDir));
|
|
19540
|
-
return sessionDir;
|
|
19541
|
-
}
|
|
19542
|
-
function currentDebugSessionDir() {
|
|
19543
|
-
return sessionDir && join19(sessionDir, "debug");
|
|
19544
|
-
}
|
|
19545
|
-
function currentSessionDir() {
|
|
19546
|
-
return sessionDir;
|
|
19547
|
-
}
|
|
19548
|
-
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
19549
|
-
try {
|
|
19550
|
-
if (!await isDebugModeEnabled()) return;
|
|
19551
|
-
await mkdir7(join19(startSession(resolve20(base), { replace }), "debug"), { recursive: true });
|
|
19552
|
-
await writeWaitingLogs();
|
|
19553
|
-
} catch {
|
|
19554
|
-
}
|
|
19555
|
-
}
|
|
19556
|
-
function nextImportRunDir(session) {
|
|
19557
|
-
const existing = existsSync9(session) ? readdirSync3(session) : [];
|
|
19558
|
-
const maxRun = existing.reduce((max, entry) => {
|
|
19559
|
-
const match2 = /^dsi-import-(\d+)$/.exec(entry);
|
|
19560
|
-
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
19561
|
-
}, 0);
|
|
19562
|
-
return join19(session, `dsi-import-${maxRun + 1}`);
|
|
19563
|
-
}
|
|
19564
|
-
async function startImportRun(projectPath) {
|
|
19565
|
-
await startDebugSessionIn(projectPath);
|
|
19566
|
-
if (!sessionDir) return join19(resolve20(projectPath), ".contentful");
|
|
19567
|
-
const dir = nextImportRunDir(sessionDir);
|
|
19568
|
-
await mkdir7(dir, { recursive: true });
|
|
19569
|
-
return dir;
|
|
19570
|
-
}
|
|
19571
|
-
async function isDebugModeEnabled() {
|
|
19572
|
-
try {
|
|
19573
|
-
return (await readDebugModeSetting()).enabled;
|
|
19574
|
-
} catch {
|
|
19575
|
-
return true;
|
|
19576
|
-
}
|
|
19577
|
-
}
|
|
19578
|
-
function redact(value) {
|
|
19579
|
-
const clone = { ...value };
|
|
19580
|
-
if ("cma_token" in clone) {
|
|
19581
|
-
const raw = clone.cma_token;
|
|
19582
|
-
clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
|
|
19583
|
-
}
|
|
19584
|
-
return clone;
|
|
19585
|
-
}
|
|
19586
|
-
function startDebugRun({
|
|
19587
|
-
flow,
|
|
19588
|
-
step,
|
|
19589
|
-
menuOption,
|
|
19590
|
-
inputs
|
|
19591
|
-
}) {
|
|
19592
|
-
const runId = generateRunId();
|
|
19593
|
-
const startedAt = Date.now();
|
|
19594
|
-
const redactedInputs = redact(inputs);
|
|
19595
|
-
isDebugModeEnabled().then((enabled) => {
|
|
19596
|
-
if (!enabled) return;
|
|
19597
|
-
pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
|
|
19598
|
-
});
|
|
19599
|
-
}
|
|
19600
|
-
async function finishDebugRun({
|
|
19601
|
-
outputs,
|
|
19602
|
-
status,
|
|
19603
|
-
exitMethod
|
|
19604
|
-
}) {
|
|
19605
|
-
const run = pendingRun;
|
|
19606
|
-
if (!run) return;
|
|
19607
|
-
pendingRun = void 0;
|
|
19608
|
-
const durationMs = Date.now() - run.startedAt;
|
|
19609
|
-
const log = {
|
|
19610
|
-
flow: run.flow,
|
|
19611
|
-
menuOption: run.menuOption,
|
|
19612
|
-
content: renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs })
|
|
19613
|
-
};
|
|
19614
|
-
const root = currentDebugSessionDir();
|
|
19615
|
-
if (!root) {
|
|
19616
|
-
if (waiting.length < WAITING_LIMIT) waiting.push(log);
|
|
19617
|
-
return;
|
|
19618
|
-
}
|
|
19619
|
-
await writeLog(root, log);
|
|
19620
|
-
}
|
|
19621
|
-
async function writeLog(root, log) {
|
|
19622
|
-
const dir = join19(root, ...log.flow.split("/"));
|
|
19623
|
-
await mkdir7(dir, { recursive: true });
|
|
19624
|
-
const filename = nextAttemptFilename(dir, log.menuOption);
|
|
19625
|
-
await writeFile7(join19(dir, filename), log.content, { mode: 384 });
|
|
19626
|
-
}
|
|
19627
|
-
async function writeWaitingLogs() {
|
|
19628
|
-
const root = currentDebugSessionDir();
|
|
19629
|
-
if (!root) return;
|
|
19630
|
-
for (const log of waiting.splice(0)) {
|
|
19631
|
-
try {
|
|
19632
|
-
await writeLog(root, log);
|
|
19633
|
-
} catch {
|
|
19634
|
-
}
|
|
19635
|
-
}
|
|
19636
|
-
}
|
|
19637
|
-
function nextAttemptFilename(dir, menuOption) {
|
|
19638
|
-
const today = datePrefix();
|
|
19639
|
-
const optionSlug = slugify(menuOption);
|
|
19640
|
-
const existing = existsSync9(dir) ? readdirSync3(dir) : [];
|
|
19641
|
-
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
19642
|
-
const maxAttempt = existing.reduce((max, entry) => {
|
|
19643
|
-
const match2 = attemptPattern.exec(entry);
|
|
19644
|
-
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
19645
|
-
}, 0);
|
|
19646
|
-
return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
|
|
19647
|
-
}
|
|
19648
|
-
function renderMarkdown(run, finish) {
|
|
19649
|
-
const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
|
|
19650
|
-
const stepLabel = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
|
|
19651
|
-
const flowSlug = run.flow.split("/").join("-");
|
|
19652
|
-
return `# Debug Log
|
|
19653
|
-
|
|
19654
|
-
- Run ID: ${run.runId}
|
|
19655
|
-
- Flow: ${flowSlug}
|
|
19656
|
-
- Step: ${stepLabel}
|
|
19657
|
-
- Menu option: ${run.menuOption}
|
|
19658
|
-
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
19659
|
-
- CLI version: ${readPackageVersion()}
|
|
19660
|
-
- Platform: ${process.platform} / Node ${process.version}
|
|
19661
|
-
- Duration on screen: ${finish.durationMs}ms
|
|
19662
|
-
- Status: ${finish.status}
|
|
19663
|
-
- Exit method: ${finish.exitMethod}
|
|
19664
|
-
|
|
19665
|
-
## Inputs
|
|
19666
|
-
\`\`\`json
|
|
19667
|
-
${JSON.stringify(run.inputs, null, 2)}
|
|
19668
|
-
\`\`\`
|
|
19669
|
-
|
|
19670
|
-
## Outputs
|
|
19671
|
-
\`\`\`json
|
|
19672
|
-
${JSON.stringify(finish.outputs, null, 2)}
|
|
19673
|
-
\`\`\`
|
|
19674
|
-
`;
|
|
19675
|
-
}
|
|
19676
|
-
function handleCrash() {
|
|
19677
|
-
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
19678
|
-
}
|
|
19679
|
-
var pendingRun, sessionDir, WAITING_LIMIT, waiting;
|
|
19680
|
-
var init_debug_store = __esm({
|
|
19681
|
-
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
19682
|
-
"use strict";
|
|
19683
|
-
init_config();
|
|
19684
|
-
init_version();
|
|
19685
|
-
init_debug_mode_store();
|
|
19686
|
-
init_debug_prune();
|
|
19687
|
-
void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(async ([enabled, base]) => {
|
|
19688
|
-
if (!base) return;
|
|
19689
|
-
const retention = await readDebugModeSetting().catch(() => void 0);
|
|
19690
|
-
const pruned = retention ? await pruneExpiredLogs(base, retention.retentionDays).catch(() => void 0) : void 0;
|
|
19691
|
-
if (!enabled) return;
|
|
19692
|
-
const debugDir = join19(startSession(base, { replace: false }), "debug");
|
|
19693
|
-
await mkdir7(debugDir, { recursive: true });
|
|
19694
|
-
await writeWaitingLogs();
|
|
19695
|
-
if (retention && pruned && pruned.logs + pruned.folders > 0) {
|
|
19696
|
-
await writeFile7(
|
|
19697
|
-
join19(debugDir, `${datePrefix()}-cleanup-${generateRunId()}.md`),
|
|
19698
|
-
`# Debug Log Cleanup
|
|
19699
|
-
|
|
19700
|
-
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
19701
|
-
- Retention: ${retention.retentionDays} days
|
|
19702
|
-
- Logs deleted: ${pruned.logs}
|
|
19703
|
-
- Empty folders removed: ${pruned.folders}
|
|
19704
|
-
`,
|
|
19705
|
-
{ mode: 384 }
|
|
19706
|
-
);
|
|
19707
|
-
}
|
|
19708
|
-
});
|
|
19709
|
-
WAITING_LIMIT = 50;
|
|
19710
|
-
waiting = [];
|
|
19711
|
-
process.once("uncaughtException", (err) => {
|
|
19712
|
-
void handleCrash().finally(() => {
|
|
19713
|
-
throw err;
|
|
19714
|
-
});
|
|
19715
|
-
});
|
|
19716
|
-
process.once("unhandledRejection", (reason) => {
|
|
19717
|
-
void handleCrash().finally(() => {
|
|
19718
|
-
throw reason;
|
|
19719
|
-
});
|
|
19720
|
-
});
|
|
19721
|
-
process.once("SIGINT", () => {
|
|
19722
|
-
void handleCrash().finally(() => {
|
|
19723
|
-
process.exit(130);
|
|
19724
|
-
});
|
|
19725
|
-
});
|
|
19726
|
-
}
|
|
19727
|
-
});
|
|
19728
|
-
|
|
19729
19410
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/logic.ts
|
|
19730
19411
|
function overviewFor(target) {
|
|
19731
19412
|
return target === "tokens" ? TOKENS_ONLY_OVERVIEW : COMPONENTS_OVERVIEW;
|
|
@@ -20235,37 +19916,12 @@ var init_shared2 = __esm({
|
|
|
20235
19916
|
});
|
|
20236
19917
|
|
|
20237
19918
|
// packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx
|
|
20238
|
-
import {
|
|
19919
|
+
import { useState as useState4 } from "react";
|
|
20239
19920
|
import { Box as Box9, Text as Text9 } from "ink";
|
|
20240
19921
|
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
20241
19922
|
function PreflightScreen({ onChoose, onQuit }) {
|
|
20242
19923
|
const [focus, setFocus] = useState4(0);
|
|
20243
|
-
|
|
20244
|
-
useEffect4(() => {
|
|
20245
|
-
startDebugRun({
|
|
20246
|
-
flow: "import/preflight",
|
|
20247
|
-
step: "00-preflight",
|
|
20248
|
-
menuOption: "Preflight",
|
|
20249
|
-
inputs: { options: IMPORT_TARGET_OPTIONS.map((option) => option.target), initial_focus: optionAt(0) }
|
|
20250
|
-
});
|
|
20251
|
-
}, []);
|
|
20252
|
-
const moveTo = (next) => {
|
|
20253
|
-
setFocus(next);
|
|
20254
|
-
if (viewed[viewed.length - 1] !== optionAt(next)) viewed.push(optionAt(next));
|
|
20255
|
-
};
|
|
20256
|
-
const choose = (target) => {
|
|
20257
|
-
void finishDebugRun({
|
|
20258
|
-
outputs: { chosen: target, viewed, steps_that_will_run: overviewFor(target).map((step) => step.description) },
|
|
20259
|
-
status: "success",
|
|
20260
|
-
exitMethod: "saved"
|
|
20261
|
-
});
|
|
20262
|
-
onChoose(target);
|
|
20263
|
-
};
|
|
20264
|
-
const quit = () => {
|
|
20265
|
-
void finishDebugRun({ outputs: { chosen: null, viewed }, status: "success", exitMethod: "discarded" });
|
|
20266
|
-
onQuit();
|
|
20267
|
-
};
|
|
20268
|
-
usePreflightControls({ focus, onFocus: moveTo, onChoose: choose, onQuit: quit });
|
|
19924
|
+
usePreflightControls({ focus, onFocus: setFocus, onChoose, onQuit });
|
|
20269
19925
|
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
20270
19926
|
/* @__PURE__ */ jsx9(StepHeader, { step: "setup" }),
|
|
20271
19927
|
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", gap: 1, paddingX: 2, paddingBottom: 1, children: [
|
|
@@ -20277,28 +19933,25 @@ function PreflightScreen({ onChoose, onQuit }) {
|
|
|
20277
19933
|
/* @__PURE__ */ jsx9(Text9, { bold: focused, color: focused ? PALETTE.accent : void 0, children: option.label })
|
|
20278
19934
|
] }, option.target);
|
|
20279
19935
|
}) }),
|
|
20280
|
-
/* @__PURE__ */ jsx9(OverviewBox, { steps: overviewFor(
|
|
19936
|
+
/* @__PURE__ */ jsx9(OverviewBox, { steps: overviewFor(IMPORT_TARGET_OPTIONS[focus].target) }),
|
|
20281
19937
|
/* @__PURE__ */ jsx9(ControlHints, { hints: PREFLIGHT_CONTROLS })
|
|
20282
19938
|
] })
|
|
20283
19939
|
] });
|
|
20284
19940
|
}
|
|
20285
|
-
var optionAt;
|
|
20286
19941
|
var init_screen = __esm({
|
|
20287
19942
|
"packages/experience-design-system-cli/src/tui/import/steps/00-preflight/screen.tsx"() {
|
|
20288
19943
|
"use strict";
|
|
20289
19944
|
init_theme();
|
|
20290
|
-
init_debug_store();
|
|
20291
19945
|
init_controls();
|
|
20292
19946
|
init_logic();
|
|
20293
19947
|
init_shared2();
|
|
20294
19948
|
init_ControlHints();
|
|
20295
19949
|
init_StepHeader();
|
|
20296
|
-
optionAt = (index) => IMPORT_TARGET_OPTIONS[index].target;
|
|
20297
19950
|
}
|
|
20298
19951
|
});
|
|
20299
19952
|
|
|
20300
19953
|
// packages/experience-design-system-cli/src/tui/shared/components/ClearableTextInput.tsx
|
|
20301
|
-
import { useRef
|
|
19954
|
+
import { useRef } from "react";
|
|
20302
19955
|
import { useInput as useInput6 } from "ink";
|
|
20303
19956
|
import TextInput from "ink-text-input";
|
|
20304
19957
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
@@ -20306,7 +19959,7 @@ function isClearKey(input, key) {
|
|
|
20306
19959
|
return key.ctrl && input === "d";
|
|
20307
19960
|
}
|
|
20308
19961
|
function ClearableTextInput({ onChange, ...props }) {
|
|
20309
|
-
const justCleared =
|
|
19962
|
+
const justCleared = useRef(false);
|
|
20310
19963
|
useInput6((input, key) => {
|
|
20311
19964
|
if (!isClearKey(input, key)) return;
|
|
20312
19965
|
justCleared.current = true;
|
|
@@ -20439,7 +20092,7 @@ var init_controls5 = __esm({
|
|
|
20439
20092
|
|
|
20440
20093
|
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
20441
20094
|
import { homedir as homedir3 } from "node:os";
|
|
20442
|
-
import { resolve as
|
|
20095
|
+
import { resolve as resolve20 } from "node:path";
|
|
20443
20096
|
function stripQuotes(value) {
|
|
20444
20097
|
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
20445
20098
|
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
@@ -20448,7 +20101,7 @@ function expandHome(value) {
|
|
|
20448
20101
|
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir3() + value.slice(1) : value;
|
|
20449
20102
|
}
|
|
20450
20103
|
function resolveUserPath(raw) {
|
|
20451
|
-
return
|
|
20104
|
+
return resolve20(expandHome(stripQuotes(raw.trim())));
|
|
20452
20105
|
}
|
|
20453
20106
|
var init_resolve_user_path = __esm({
|
|
20454
20107
|
"packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts"() {
|
|
@@ -20680,7 +20333,7 @@ var init_scan_files = __esm({
|
|
|
20680
20333
|
});
|
|
20681
20334
|
|
|
20682
20335
|
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
20683
|
-
import { useEffect as
|
|
20336
|
+
import { useEffect as useEffect4, useMemo, useState as useState7 } from "react";
|
|
20684
20337
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
20685
20338
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
20686
20339
|
function Row({ row }) {
|
|
@@ -20736,7 +20389,7 @@ function PathValidationScreen({
|
|
|
20736
20389
|
}) {
|
|
20737
20390
|
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
20738
20391
|
const [scan, setScan] = useState7();
|
|
20739
|
-
|
|
20392
|
+
useEffect4(() => {
|
|
20740
20393
|
setScan(scanFiles(resolvedPath));
|
|
20741
20394
|
}, [resolvedPath]);
|
|
20742
20395
|
const phase = phaseOf(scan);
|
|
@@ -21033,7 +20686,7 @@ var init_validate4 = __esm({
|
|
|
21033
20686
|
});
|
|
21034
20687
|
|
|
21035
20688
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
21036
|
-
import { useRef as
|
|
20689
|
+
import { useRef as useRef2, useState as useState9 } from "react";
|
|
21037
20690
|
import { Box as Box14, Text as Text14, useInput as useInput11 } from "ink";
|
|
21038
20691
|
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21039
20692
|
function CredentialsScreen({
|
|
@@ -21043,7 +20696,7 @@ function CredentialsScreen({
|
|
|
21043
20696
|
validate: validate3 = validateCredentials,
|
|
21044
20697
|
tokensOnly = false
|
|
21045
20698
|
}) {
|
|
21046
|
-
const initialValues =
|
|
20699
|
+
const initialValues = useRef2(
|
|
21047
20700
|
normalize({
|
|
21048
20701
|
spaceId: initial.spaceId ?? "",
|
|
21049
20702
|
environmentId: initial.environmentId || "master",
|
|
@@ -21491,16 +21144,16 @@ var init_steps = __esm({
|
|
|
21491
21144
|
});
|
|
21492
21145
|
|
|
21493
21146
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
21494
|
-
import { existsSync as
|
|
21495
|
-
import { dirname as
|
|
21147
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
21148
|
+
import { dirname as dirname15, join as join18, resolve as resolve21 } from "node:path";
|
|
21496
21149
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
21497
21150
|
function findSkillPath(fileName) {
|
|
21498
|
-
const thisDir =
|
|
21151
|
+
const thisDir = dirname15(fileURLToPath4(import.meta.url));
|
|
21499
21152
|
let dir = thisDir;
|
|
21500
21153
|
for (; ; ) {
|
|
21501
|
-
const candidate =
|
|
21502
|
-
if (
|
|
21503
|
-
const parent =
|
|
21154
|
+
const candidate = join18(dir, "skills", fileName);
|
|
21155
|
+
if (existsSync9(candidate)) return candidate;
|
|
21156
|
+
const parent = resolve21(dir, "..");
|
|
21504
21157
|
if (parent === dir) {
|
|
21505
21158
|
throw new Error(`skill file not found (looked for skills/${fileName} from ${thisDir})`);
|
|
21506
21159
|
}
|
|
@@ -21514,9 +21167,9 @@ var init_find_skill_path = __esm({
|
|
|
21514
21167
|
});
|
|
21515
21168
|
|
|
21516
21169
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/selection.ts
|
|
21517
|
-
import { resolve as
|
|
21170
|
+
import { resolve as resolve22 } from "node:path";
|
|
21518
21171
|
async function hashSelectPrompt(options) {
|
|
21519
|
-
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(
|
|
21172
|
+
const promptHash = options.promptText ? hashContent(options.promptText) : options.promptPath ? await hashFile(resolve22(options.promptPath)) : await hashFile(SELECT_SKILL_PATH);
|
|
21520
21173
|
return hashContent(`${promptHash}|${options.agent}|${options.model ?? ""}`);
|
|
21521
21174
|
}
|
|
21522
21175
|
async function runSelection(options) {
|
|
@@ -21610,10 +21263,10 @@ var init_selection2 = __esm({
|
|
|
21610
21263
|
});
|
|
21611
21264
|
|
|
21612
21265
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/run.ts
|
|
21613
|
-
import { mkdir as
|
|
21614
|
-
import { join as
|
|
21266
|
+
import { mkdir as mkdir7 } from "node:fs/promises";
|
|
21267
|
+
import { join as join19, resolve as resolve23 } from "node:path";
|
|
21615
21268
|
async function runExtraction(input, onProgress, deps = realDeps) {
|
|
21616
|
-
const outDir = input.outDir ??
|
|
21269
|
+
const outDir = input.outDir ?? join19(resolve23(input.projectPath), ".contentful");
|
|
21617
21270
|
let progress = initialProgress({
|
|
21618
21271
|
hasCredentials: input.credentials !== null,
|
|
21619
21272
|
hasRawTokens: input.rawTokensPath !== ""
|
|
@@ -21717,7 +21370,7 @@ async function runExtraction(input, onProgress, deps = realDeps) {
|
|
|
21717
21370
|
}
|
|
21718
21371
|
async function fetchEntities(credentials, outDir) {
|
|
21719
21372
|
try {
|
|
21720
|
-
await
|
|
21373
|
+
await mkdir7(outDir, { recursive: true });
|
|
21721
21374
|
const result = await fetchAndPersistExistingContentfulEntities({
|
|
21722
21375
|
spaceId: credentials.spaceId,
|
|
21723
21376
|
environmentId: credentials.environmentId,
|
|
@@ -21737,7 +21390,7 @@ async function resolveSelectionPrompt(overrides) {
|
|
|
21737
21390
|
if (select?.kind === "text") return { promptText: select.value };
|
|
21738
21391
|
if (select?.kind === "path") {
|
|
21739
21392
|
await resolvePromptOverride(select);
|
|
21740
|
-
return { promptPath:
|
|
21393
|
+
return { promptPath: resolve23(select.value) };
|
|
21741
21394
|
}
|
|
21742
21395
|
return {};
|
|
21743
21396
|
}
|
|
@@ -21763,11 +21416,11 @@ var init_run = __esm({
|
|
|
21763
21416
|
});
|
|
21764
21417
|
|
|
21765
21418
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
21766
|
-
import { useEffect as
|
|
21419
|
+
import { useEffect as useEffect5, useRef as useRef3, useState as useState11 } from "react";
|
|
21767
21420
|
function useExtraction(input) {
|
|
21768
21421
|
const [state2, setState] = useState11();
|
|
21769
|
-
const current =
|
|
21770
|
-
|
|
21422
|
+
const current = useRef3();
|
|
21423
|
+
useEffect5(() => {
|
|
21771
21424
|
current.current = input;
|
|
21772
21425
|
if (!input) {
|
|
21773
21426
|
setState(void 0);
|
|
@@ -21838,11 +21491,11 @@ var init_run_tokens_only = __esm({
|
|
|
21838
21491
|
});
|
|
21839
21492
|
|
|
21840
21493
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-tokens-only.ts
|
|
21841
|
-
import { useEffect as
|
|
21494
|
+
import { useEffect as useEffect6, useRef as useRef4, useState as useState12 } from "react";
|
|
21842
21495
|
function useTokensOnly(input) {
|
|
21843
21496
|
const [state2, setState] = useState12();
|
|
21844
|
-
const current =
|
|
21845
|
-
|
|
21497
|
+
const current = useRef4();
|
|
21498
|
+
useEffect6(() => {
|
|
21846
21499
|
current.current = input;
|
|
21847
21500
|
if (!input) {
|
|
21848
21501
|
setState(void 0);
|
|
@@ -22139,7 +21792,6 @@ function GotoBanner({
|
|
|
22139
21792
|
borderStyle: "single",
|
|
22140
21793
|
borderColor: PALETTE.accent,
|
|
22141
21794
|
paddingX: 1,
|
|
22142
|
-
paddingBottom: 1,
|
|
22143
21795
|
marginTop: width === void 0 ? 1 : 0,
|
|
22144
21796
|
width,
|
|
22145
21797
|
flexShrink: 0,
|
|
@@ -22151,7 +21803,7 @@ function GotoBanner({
|
|
|
22151
21803
|
return renderRow(row, i, i === highlightIndex);
|
|
22152
21804
|
}),
|
|
22153
21805
|
moreBelow > 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: ` \u25BC ${moreBelow} more` }),
|
|
22154
|
-
footerHint !== void 0 && /* @__PURE__ */ jsx24(
|
|
21806
|
+
footerHint !== void 0 && /* @__PURE__ */ jsx24(Text21, { color: PALETTE.muted, children: footerHint })
|
|
22155
21807
|
]
|
|
22156
21808
|
}
|
|
22157
21809
|
);
|
|
@@ -23039,7 +22691,7 @@ var init_GroupedSidebar = __esm({
|
|
|
23039
22691
|
});
|
|
23040
22692
|
|
|
23041
22693
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/useImmediateInput.ts
|
|
23042
|
-
import { useLayoutEffect, useRef as
|
|
22694
|
+
import { useLayoutEffect, useRef as useRef5 } from "react";
|
|
23043
22695
|
import { useStdin } from "ink";
|
|
23044
22696
|
function parseInput(data) {
|
|
23045
22697
|
const isShiftTab = data === "\x1B[Z";
|
|
@@ -23101,7 +22753,7 @@ function registerInputHandler(stdin, setRawMode, handler) {
|
|
|
23101
22753
|
}
|
|
23102
22754
|
function useImmediateInput(handler, enabled = true) {
|
|
23103
22755
|
const { stdin, setRawMode } = useStdin();
|
|
23104
|
-
const handlerRef =
|
|
22756
|
+
const handlerRef = useRef5(handler);
|
|
23105
22757
|
handlerRef.current = handler;
|
|
23106
22758
|
useLayoutEffect(() => {
|
|
23107
22759
|
if (!enabled) return;
|
|
@@ -23119,7 +22771,7 @@ var init_useImmediateInput = __esm({
|
|
|
23119
22771
|
|
|
23120
22772
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
|
|
23121
22773
|
import { useStdout as useStdout2 } from "ink";
|
|
23122
|
-
import { useEffect as
|
|
22774
|
+
import { useEffect as useEffect7, useState as useState13 } from "react";
|
|
23123
22775
|
function readTerminalSize(stdout) {
|
|
23124
22776
|
return {
|
|
23125
22777
|
columns: stdout?.columns ?? 80,
|
|
@@ -23129,7 +22781,7 @@ function readTerminalSize(stdout) {
|
|
|
23129
22781
|
function useTerminalSize() {
|
|
23130
22782
|
const { stdout } = useStdout2();
|
|
23131
22783
|
const [size, setSize] = useState13(() => readTerminalSize(stdout));
|
|
23132
|
-
|
|
22784
|
+
useEffect7(() => {
|
|
23133
22785
|
const updateSize = () => setSize(readTerminalSize(stdout));
|
|
23134
22786
|
stdout?.on("resize", updateSize);
|
|
23135
22787
|
updateSize();
|
|
@@ -24131,7 +23783,7 @@ var init_state = __esm({
|
|
|
24131
23783
|
});
|
|
24132
23784
|
|
|
24133
23785
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
|
|
24134
|
-
import { useEffect as
|
|
23786
|
+
import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef6, useState as useState16 } from "react";
|
|
24135
23787
|
function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }) {
|
|
24136
23788
|
const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
|
|
24137
23789
|
const columnPlan = useMemo3(
|
|
@@ -24177,8 +23829,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24177
23829
|
for (const p of cycleParticipants) seed.add(p);
|
|
24178
23830
|
return seed;
|
|
24179
23831
|
});
|
|
24180
|
-
const seededGroupsRef =
|
|
24181
|
-
|
|
23832
|
+
const seededGroupsRef = useRef6(closures.size > 0 || cycleParticipants.size > 0);
|
|
23833
|
+
useEffect8(() => {
|
|
24182
23834
|
if (seededGroupsRef.current) return;
|
|
24183
23835
|
if (closures.size === 0 && cycleParticipants.size === 0) return;
|
|
24184
23836
|
seededGroupsRef.current = true;
|
|
@@ -24269,7 +23921,7 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24269
23921
|
entryCount: 0
|
|
24270
23922
|
});
|
|
24271
23923
|
const panelLayout = useMemo3(() => computePanelLayout(visibleCount), [visibleCount]);
|
|
24272
|
-
|
|
23924
|
+
useEffect8(() => {
|
|
24273
23925
|
setNav((prev) => {
|
|
24274
23926
|
const maxIdx = Math.max(0, visibleRows.length - 1);
|
|
24275
23927
|
const nextCursor = Math.min(prev.cursor, maxIdx);
|
|
@@ -24842,13 +24494,13 @@ var init_load2 = __esm({
|
|
|
24842
24494
|
});
|
|
24843
24495
|
|
|
24844
24496
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
|
|
24845
|
-
import { useEffect as
|
|
24497
|
+
import { useEffect as useEffect9, useMemo as useMemo5, useRef as useRef7, useState as useState17 } from "react";
|
|
24846
24498
|
function useScopeGateFlow(input, deps = realDeps3) {
|
|
24847
24499
|
const sessionId = input?.sessionId;
|
|
24848
24500
|
const loaded = useMemo5(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
|
|
24849
|
-
const cacheCheck =
|
|
24501
|
+
const cacheCheck = useRef7(void 0);
|
|
24850
24502
|
const [confirmed, setConfirmed] = useState17();
|
|
24851
|
-
|
|
24503
|
+
useEffect9(() => {
|
|
24852
24504
|
if (!input || !loaded?.ok || cacheCheck.current) return;
|
|
24853
24505
|
cacheCheck.current = deps.checkCache(input.cache);
|
|
24854
24506
|
}, [input, loaded]);
|
|
@@ -24883,7 +24535,7 @@ function formatAcceptanceSummary(counts) {
|
|
|
24883
24535
|
function describeGeneration(input) {
|
|
24884
24536
|
const agent = capitalize(input.agent);
|
|
24885
24537
|
return `${formatAcceptanceSummary({ accepted: input.acceptedCount, autoRejected: 0 })}
|
|
24886
|
-
${agent} is reading each selected component and writing a Contentful component definition for it
|
|
24538
|
+
${agent} is reading each selected component and writing a Contentful component definition for it${input.hasTokens ? " Using your design tokens for prop resolution." : ""}`;
|
|
24887
24539
|
}
|
|
24888
24540
|
function progressRows2(progress, agent) {
|
|
24889
24541
|
const name = capitalize(agent);
|
|
@@ -24986,7 +24638,7 @@ var init_save_decisions = __esm({
|
|
|
24986
24638
|
});
|
|
24987
24639
|
|
|
24988
24640
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
|
|
24989
|
-
import { resolve as
|
|
24641
|
+
import { resolve as resolve24 } from "node:path";
|
|
24990
24642
|
async function runGeneration(input, onProgress, deps = realDeps4) {
|
|
24991
24643
|
let progress = { components: null, mapTokens: "idle", mapTokensEligible: null };
|
|
24992
24644
|
const update = (change) => {
|
|
@@ -25072,7 +24724,7 @@ async function buildMapTokensOptions(input) {
|
|
|
25072
24724
|
if (mapOverride?.kind === "text") prompt.skillContentOverride = mapOverride.value;
|
|
25073
24725
|
if (mapOverride?.kind === "path") {
|
|
25074
24726
|
await resolvePromptOverride(mapOverride);
|
|
25075
|
-
prompt.skillPathOverride =
|
|
24727
|
+
prompt.skillPathOverride = resolve24(mapOverride.value);
|
|
25076
24728
|
}
|
|
25077
24729
|
if (input.existingEntitiesPath) {
|
|
25078
24730
|
const entities = await readExistingContentfulEntitiesFromSession({ path: input.existingEntitiesPath });
|
|
@@ -25119,11 +24771,11 @@ var init_run2 = __esm({
|
|
|
25119
24771
|
});
|
|
25120
24772
|
|
|
25121
24773
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
25122
|
-
import { useEffect as
|
|
24774
|
+
import { useEffect as useEffect10, useRef as useRef8, useState as useState18 } from "react";
|
|
25123
24775
|
function useGeneration(input) {
|
|
25124
24776
|
const [state2, setState] = useState18();
|
|
25125
|
-
const current =
|
|
25126
|
-
|
|
24777
|
+
const current = useRef8();
|
|
24778
|
+
useEffect10(() => {
|
|
25127
24779
|
current.current = input;
|
|
25128
24780
|
if (!input) {
|
|
25129
24781
|
setState(void 0);
|
|
@@ -25150,7 +24802,7 @@ var init_use_generation = __esm({
|
|
|
25150
24802
|
});
|
|
25151
24803
|
|
|
25152
24804
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/build-flow-start.ts
|
|
25153
|
-
import { join as
|
|
24805
|
+
import { join as join20 } from "node:path";
|
|
25154
24806
|
function buildFlowStart(input) {
|
|
25155
24807
|
const { extraction, handoff, saved, generatePromptPath, tokensOnly } = input;
|
|
25156
24808
|
const credentials = extraction.credentials ?? {
|
|
@@ -25163,7 +24815,7 @@ function buildFlowStart(input) {
|
|
|
25163
24815
|
handoff,
|
|
25164
24816
|
agent: extraction.agent,
|
|
25165
24817
|
projectPath: extraction.projectPath,
|
|
25166
|
-
outDir: extraction.projectPath ?
|
|
24818
|
+
outDir: extraction.projectPath ? join20(extraction.projectPath, ".contentful") : "",
|
|
25167
24819
|
rawTokensPath: extraction.rawTokensPath,
|
|
25168
24820
|
credentials: {
|
|
25169
24821
|
spaceId: credentials.spaceId,
|
|
@@ -25182,27 +24834,6 @@ var init_build_flow_start = __esm({
|
|
|
25182
24834
|
}
|
|
25183
24835
|
});
|
|
25184
24836
|
|
|
25185
|
-
// packages/experience-design-system-types/dist/src/agent-prompt-transport.js
|
|
25186
|
-
var init_agent_prompt_transport = __esm({
|
|
25187
|
-
"packages/experience-design-system-types/dist/src/agent-prompt-transport.js"() {
|
|
25188
|
-
"use strict";
|
|
25189
|
-
}
|
|
25190
|
-
});
|
|
25191
|
-
|
|
25192
|
-
// packages/experience-design-system-types/dist/src/agent-prompt-artifact.js
|
|
25193
|
-
var init_agent_prompt_artifact = __esm({
|
|
25194
|
-
"packages/experience-design-system-types/dist/src/agent-prompt-artifact.js"() {
|
|
25195
|
-
"use strict";
|
|
25196
|
-
}
|
|
25197
|
-
});
|
|
25198
|
-
|
|
25199
|
-
// packages/experience-design-system-types/dist/src/agent-process-lifecycle.js
|
|
25200
|
-
var init_agent_process_lifecycle = __esm({
|
|
25201
|
-
"packages/experience-design-system-types/dist/src/agent-process-lifecycle.js"() {
|
|
25202
|
-
"use strict";
|
|
25203
|
-
}
|
|
25204
|
-
});
|
|
25205
|
-
|
|
25206
24837
|
// packages/experience-design-system-types/dist/src/cdf/vocabularies.js
|
|
25207
24838
|
var CDF_PROPERTY_TYPES2, CDF_PROPERTY_CATEGORIES2;
|
|
25208
24839
|
var init_vocabularies2 = __esm({
|
|
@@ -25576,9 +25207,6 @@ var init_dtcg2 = __esm({
|
|
|
25576
25207
|
var init_src4 = __esm({
|
|
25577
25208
|
"packages/experience-design-system-types/dist/src/index.js"() {
|
|
25578
25209
|
"use strict";
|
|
25579
|
-
init_agent_prompt_transport();
|
|
25580
|
-
init_agent_prompt_artifact();
|
|
25581
|
-
init_agent_process_lifecycle();
|
|
25582
25210
|
init_cdf2();
|
|
25583
25211
|
init_dtcg2();
|
|
25584
25212
|
}
|
|
@@ -26005,7 +25633,7 @@ var init_scroll_offset = __esm({
|
|
|
26005
25633
|
});
|
|
26006
25634
|
|
|
26007
25635
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26008
|
-
import React13, { useEffect as
|
|
25636
|
+
import React13, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
26009
25637
|
import figures6 from "figures";
|
|
26010
25638
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26011
25639
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -26772,7 +26400,6 @@ function FieldEditor({
|
|
|
26772
26400
|
const [rationaleOpen, setRationaleOpen] = useState19(false);
|
|
26773
26401
|
const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
|
|
26774
26402
|
const [showHelp, setShowHelp] = useState19(false);
|
|
26775
|
-
const [pendingDelete, setPendingDelete] = useState19(null);
|
|
26776
26403
|
const props = editorState.props;
|
|
26777
26404
|
const slots = editorState.slots;
|
|
26778
26405
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -26864,46 +26491,6 @@ function FieldEditor({
|
|
|
26864
26491
|
setEditorState(next);
|
|
26865
26492
|
onChange(serializeState(next, value));
|
|
26866
26493
|
};
|
|
26867
|
-
const deleteRow = (row) => {
|
|
26868
|
-
if (row.kind === "prop") {
|
|
26869
|
-
const nextProps = removeAt(editorState.props, row.idx);
|
|
26870
|
-
commit({ ...editorState, props: nextProps });
|
|
26871
|
-
setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
|
|
26872
|
-
const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
|
|
26873
|
-
const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
|
|
26874
|
-
if (!neighbour2) {
|
|
26875
|
-
setInSlots(false);
|
|
26876
|
-
setInComponentDesc(true);
|
|
26877
|
-
setFocusLevel("componentDescription");
|
|
26878
|
-
} else if (neighbour2.kind === "prop") {
|
|
26879
|
-
setInSlots(false);
|
|
26880
|
-
setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
|
|
26881
|
-
setFocusLevel("prop");
|
|
26882
|
-
} else {
|
|
26883
|
-
setInSlots(true);
|
|
26884
|
-
setSlotIdx(neighbour2.idx);
|
|
26885
|
-
setFocusLevel("slot");
|
|
26886
|
-
}
|
|
26887
|
-
return;
|
|
26888
|
-
}
|
|
26889
|
-
const nextSlots = removeAt(editorState.slots, row.idx);
|
|
26890
|
-
commit({ ...editorState, slots: nextSlots });
|
|
26891
|
-
const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
|
|
26892
|
-
const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
|
|
26893
|
-
if (!neighbour) {
|
|
26894
|
-
setInSlots(false);
|
|
26895
|
-
setInComponentDesc(true);
|
|
26896
|
-
setFocusLevel("componentDescription");
|
|
26897
|
-
} else if (neighbour.kind === "slot") {
|
|
26898
|
-
setInSlots(true);
|
|
26899
|
-
setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
|
|
26900
|
-
setFocusLevel("slot");
|
|
26901
|
-
} else {
|
|
26902
|
-
setInSlots(false);
|
|
26903
|
-
setPropIdx(neighbour.idx);
|
|
26904
|
-
setFocusLevel("prop");
|
|
26905
|
-
}
|
|
26906
|
-
};
|
|
26907
26494
|
const canonicalize = React13.useCallback((json) => {
|
|
26908
26495
|
try {
|
|
26909
26496
|
return JSON.stringify(JSON.parse(json));
|
|
@@ -26940,11 +26527,6 @@ function FieldEditor({
|
|
|
26940
26527
|
onSave();
|
|
26941
26528
|
return;
|
|
26942
26529
|
}
|
|
26943
|
-
if (pendingDelete) {
|
|
26944
|
-
if (input === "y") deleteRow(pendingDelete);
|
|
26945
|
-
setPendingDelete(null);
|
|
26946
|
-
return;
|
|
26947
|
-
}
|
|
26948
26530
|
const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
|
|
26949
26531
|
const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
|
|
26950
26532
|
const inValueListTextEntry = editingValue != null;
|
|
@@ -27144,11 +26726,6 @@ function FieldEditor({
|
|
|
27144
26726
|
}
|
|
27145
26727
|
return;
|
|
27146
26728
|
}
|
|
27147
|
-
if (input === "d" && !key.ctrl && !key.meta) {
|
|
27148
|
-
if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
|
|
27149
|
-
if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
|
|
27150
|
-
return;
|
|
27151
|
-
}
|
|
27152
26729
|
if (focusLevel === "slot" && key.return && currentSlot) {
|
|
27153
26730
|
setFocusLevel("field");
|
|
27154
26731
|
setActiveField(SLOT_FIELDS[0] ?? null);
|
|
@@ -27455,10 +27032,6 @@ function FieldEditor({
|
|
|
27455
27032
|
}
|
|
27456
27033
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
27457
27034
|
const modeLabel = (() => {
|
|
27458
|
-
if (pendingDelete) {
|
|
27459
|
-
const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
27460
|
-
return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
|
|
27461
|
-
}
|
|
27462
27035
|
if (editingValue) {
|
|
27463
27036
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
27464
27037
|
}
|
|
@@ -27480,7 +27053,7 @@ function FieldEditor({
|
|
|
27480
27053
|
if (rationaleOpen) {
|
|
27481
27054
|
return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
|
|
27482
27055
|
}
|
|
27483
|
-
return `[\u2191\u2193] navigate [Enter] edit fields [
|
|
27056
|
+
return `[\u2191\u2193] navigate rows [Enter] edit fields [s] source [${propRationaleKey}] prop rationale [${componentRationaleKey}] component rationale [h] help [Esc] exit panel`;
|
|
27484
27057
|
})();
|
|
27485
27058
|
const rows = [];
|
|
27486
27059
|
rows.push({ kind: "component-description" });
|
|
@@ -27532,7 +27105,7 @@ function FieldEditor({
|
|
|
27532
27105
|
}
|
|
27533
27106
|
return Math.max(start + 1, end2);
|
|
27534
27107
|
};
|
|
27535
|
-
|
|
27108
|
+
useEffect11(() => {
|
|
27536
27109
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
27537
27110
|
setListScrollStart((previous) => {
|
|
27538
27111
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -27746,7 +27319,6 @@ function FieldEditor({
|
|
|
27746
27319
|
/* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
|
|
27747
27320
|
/* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
|
|
27748
27321
|
/* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
|
|
27749
|
-
/* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
|
|
27750
27322
|
/* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
|
|
27751
27323
|
/* @__PURE__ */ jsx32(Text27, { children: " " }),
|
|
27752
27324
|
/* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
|
|
@@ -27770,7 +27342,7 @@ function FieldEditor({
|
|
|
27770
27342
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
|
|
27771
27343
|
] }),
|
|
27772
27344
|
validationError && /* @__PURE__ */ jsx32(Text27, { color: PALETTE.error, children: "\u2717 " + validationError }),
|
|
27773
|
-
/* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color:
|
|
27345
|
+
/* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: modeLabel }) })
|
|
27774
27346
|
]
|
|
27775
27347
|
}
|
|
27776
27348
|
);
|
|
@@ -28163,8 +27735,8 @@ function TokenReviewPanel({
|
|
|
28163
27735
|
borderStyle: "single",
|
|
28164
27736
|
borderColor: active ? PALETTE.text : void 0,
|
|
28165
27737
|
children: [
|
|
28166
|
-
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, wrap: "truncate", children: `
|
|
28167
|
-
/* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `
|
|
27738
|
+
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, wrap: "truncate", children: `TOKEN REVIEW \u2014 ${componentName} \xB7 ${current.propName} (edit allowed)` }),
|
|
27739
|
+
/* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: `select which tokens are allowed (${rangeLabel})` }),
|
|
28168
27740
|
/* @__PURE__ */ jsx39(Text32, { children: " " }),
|
|
28169
27741
|
current.paths.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no compatible tokens found for this token kind)" }),
|
|
28170
27742
|
visiblePaths.map((path5, i) => {
|
|
@@ -28197,33 +27769,18 @@ function TokenReviewPanel({
|
|
|
28197
27769
|
borderStyle: "single",
|
|
28198
27770
|
borderColor: active ? PALETTE.text : void 0,
|
|
28199
27771
|
children: [
|
|
28200
|
-
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `
|
|
28201
|
-
/* @__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.` }),
|
|
28202
|
-
/* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: "Suggested tokens come from the agent. Allowed tokens are what editors can pick in Contentful." }),
|
|
28203
|
-
/* @__PURE__ */ jsx39(Text32, { children: " " }),
|
|
27772
|
+
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `TOKEN REVIEW \u2014 ${componentName}` }),
|
|
28204
27773
|
suggestions.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no token suggestions for this component)" }),
|
|
28205
27774
|
suggestions.map((s, i) => {
|
|
28206
27775
|
const focused = i === selectedRow;
|
|
28207
27776
|
return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", children: [
|
|
28208
|
-
/* @__PURE__ */ jsx39(Box31, { children: /* @__PURE__ */ jsx39(Text32, { color: focused ? PALETTE.accent : active ? void 0 : PALETTE.muted, bold: focused, children: `${focused ? figures7.pointer : " "} ${s.propName}
|
|
28209
|
-
/* @__PURE__ */ jsx39(
|
|
28210
|
-
|
|
28211
|
-
{
|
|
28212
|
-
color: PALETTE.muted,
|
|
28213
|
-
children: ` suggested: ${s.suggested.length > 0 ? s.suggested.join(", ") : "none"}`
|
|
28214
|
-
}
|
|
28215
|
-
),
|
|
28216
|
-
/* @__PURE__ */ jsx39(
|
|
28217
|
-
Text32,
|
|
28218
|
-
{
|
|
28219
|
-
color: PALETTE.muted,
|
|
28220
|
-
children: ` allowed: ${s.allowed.length > 0 ? s.allowed.join(", ") : "none (any token)"}`
|
|
28221
|
-
}
|
|
28222
|
-
),
|
|
28223
|
-
/* @__PURE__ */ jsx39(Text32, { children: " " })
|
|
27777
|
+
/* @__PURE__ */ jsx39(Box31, { children: /* @__PURE__ */ jsx39(Text32, { color: focused ? PALETTE.accent : active ? void 0 : PALETTE.muted, bold: focused, children: `${focused ? figures7.pointer : " "} ${s.propName}` }) }),
|
|
27778
|
+
/* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: ` suggested: ${s.suggested.join(", ")}` }),
|
|
27779
|
+
/* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: ` allowed: ${s.allowed.join(", ")}` })
|
|
28224
27780
|
] }, s.propName);
|
|
28225
27781
|
}),
|
|
28226
|
-
/* @__PURE__ */ jsx39(Text32, {
|
|
27782
|
+
/* @__PURE__ */ jsx39(Text32, { children: " " }),
|
|
27783
|
+
/* @__PURE__ */ jsx39(Text32, { children: "[\u2191/\u2193] move [Enter] edit allowed [Esc] close" })
|
|
28227
27784
|
]
|
|
28228
27785
|
}
|
|
28229
27786
|
);
|
|
@@ -28497,9 +28054,15 @@ function ReviewFinalizeError({
|
|
|
28497
28054
|
function ReviewPanelFooter({
|
|
28498
28055
|
reviewEditor,
|
|
28499
28056
|
sidebarFocused,
|
|
28500
|
-
sidebarFooter
|
|
28057
|
+
sidebarFooter,
|
|
28058
|
+
livePreview,
|
|
28059
|
+
livePreviewSpinner
|
|
28501
28060
|
}) {
|
|
28502
|
-
return /* @__PURE__ */
|
|
28061
|
+
return /* @__PURE__ */ jsxs32(Fragment10, { children: [
|
|
28062
|
+
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" : ""),
|
|
28063
|
+
livePreview.status === "running" && /* @__PURE__ */ jsx42(Text34, { children: ` ${livePreviewSpinner} live preview` }),
|
|
28064
|
+
livePreview.disabled && /* @__PURE__ */ jsx42(Text34, { children: " \xB7 live preview disabled" })
|
|
28065
|
+
] });
|
|
28503
28066
|
}
|
|
28504
28067
|
function ReviewComponentTitle({
|
|
28505
28068
|
selectedKey,
|
|
@@ -28533,7 +28096,9 @@ function ReviewComponentPanel({
|
|
|
28533
28096
|
sidebarFocused,
|
|
28534
28097
|
fieldEditor,
|
|
28535
28098
|
saveError,
|
|
28536
|
-
sidebarFooter
|
|
28099
|
+
sidebarFooter,
|
|
28100
|
+
livePreview,
|
|
28101
|
+
livePreviewSpinner
|
|
28537
28102
|
}) {
|
|
28538
28103
|
const propCount = Object.keys(selectedEntry.$properties).length;
|
|
28539
28104
|
const slotCount = selectedEntry.$slots ? Object.keys(selectedEntry.$slots).length : 0;
|
|
@@ -28570,7 +28135,9 @@ function ReviewComponentPanel({
|
|
|
28570
28135
|
{
|
|
28571
28136
|
reviewEditor,
|
|
28572
28137
|
sidebarFocused,
|
|
28573
|
-
sidebarFooter
|
|
28138
|
+
sidebarFooter,
|
|
28139
|
+
livePreview,
|
|
28140
|
+
livePreviewSpinner
|
|
28574
28141
|
}
|
|
28575
28142
|
) }) })
|
|
28576
28143
|
] }) });
|
|
@@ -28927,7 +28494,7 @@ var init_FinalizeDialog = __esm({
|
|
|
28927
28494
|
});
|
|
28928
28495
|
|
|
28929
28496
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
28930
|
-
import { useEffect as
|
|
28497
|
+
import { useEffect as useEffect12, useRef as useRef9, useState as useState20 } from "react";
|
|
28931
28498
|
function useReviewFinalizePreview({
|
|
28932
28499
|
components,
|
|
28933
28500
|
...options
|
|
@@ -28942,9 +28509,9 @@ function useFinalizePreview(opts) {
|
|
|
28942
28509
|
const [status, setStatus] = useState20("idle");
|
|
28943
28510
|
const [removed, setRemoved] = useState20([]);
|
|
28944
28511
|
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
28945
|
-
const generationRef =
|
|
28512
|
+
const generationRef = useRef9(0);
|
|
28946
28513
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
28947
|
-
|
|
28514
|
+
useEffect12(() => {
|
|
28948
28515
|
if (!open) {
|
|
28949
28516
|
setStatus("idle");
|
|
28950
28517
|
setRemoved([]);
|
|
@@ -28996,7 +28563,7 @@ var init_use_finalize_preview = __esm({
|
|
|
28996
28563
|
});
|
|
28997
28564
|
|
|
28998
28565
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
28999
|
-
import { useCallback as useCallback2, useEffect as
|
|
28566
|
+
import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef10, useState as useState21 } from "react";
|
|
29000
28567
|
function useReviewSession({
|
|
29001
28568
|
loadSession,
|
|
29002
28569
|
tokensPath,
|
|
@@ -29015,7 +28582,7 @@ function useReviewSession({
|
|
|
29015
28582
|
}));
|
|
29016
28583
|
return { result, catalog };
|
|
29017
28584
|
}, [loadSession, tokensPath]);
|
|
29018
|
-
|
|
28585
|
+
useEffect13(() => {
|
|
29019
28586
|
let disposed = false;
|
|
29020
28587
|
void (async () => {
|
|
29021
28588
|
try {
|
|
@@ -29068,7 +28635,7 @@ function useReviewSession({
|
|
|
29068
28635
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29069
28636
|
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
29070
28637
|
const [componentRationale, setComponentRationale] = useState21(null);
|
|
29071
|
-
|
|
28638
|
+
useEffect13(() => {
|
|
29072
28639
|
const current = components[selectedIdx];
|
|
29073
28640
|
if (!current) {
|
|
29074
28641
|
setReviewMetadata(null);
|
|
@@ -29098,9 +28665,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
|
29098
28665
|
return { reviewMetadata, componentRationale };
|
|
29099
28666
|
}
|
|
29100
28667
|
function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
|
|
29101
|
-
const historyRef =
|
|
29102
|
-
const historySeededRef =
|
|
29103
|
-
|
|
28668
|
+
const historyRef = useRef10(null);
|
|
28669
|
+
const historySeededRef = useRef10(false);
|
|
28670
|
+
useEffect13(() => {
|
|
29104
28671
|
if (loading || historySeededRef.current) return;
|
|
29105
28672
|
historySeededRef.current = true;
|
|
29106
28673
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -29172,7 +28739,7 @@ function collectTokenSuggestions(entry, availableTokens = []) {
|
|
|
29172
28739
|
const compatiblePaths = new Set(compatible);
|
|
29173
28740
|
const allowed = availableTokens.length > 0 ? persistedAllowed.filter((path5) => compatiblePaths.has(path5)) : persistedAllowed;
|
|
29174
28741
|
const paths = availableTokens.length > 0 ? compatible : allowed;
|
|
29175
|
-
return { propName,
|
|
28742
|
+
return { propName, paths, suggested: [...allowed], allowed };
|
|
29176
28743
|
});
|
|
29177
28744
|
}
|
|
29178
28745
|
var init_token_suggestions = __esm({
|
|
@@ -29182,7 +28749,7 @@ var init_token_suggestions = __esm({
|
|
|
29182
28749
|
});
|
|
29183
28750
|
|
|
29184
28751
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
29185
|
-
import { useEffect as
|
|
28752
|
+
import { useEffect as useEffect14, useRef as useRef11, useState as useState22 } from "react";
|
|
29186
28753
|
function parseReviewEntry(draftValue) {
|
|
29187
28754
|
const parsed = JSON.parse(draftValue);
|
|
29188
28755
|
const keys = Object.keys(parsed);
|
|
@@ -29214,9 +28781,9 @@ function useReviewEditor({
|
|
|
29214
28781
|
const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
|
|
29215
28782
|
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
|
|
29216
28783
|
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
29217
|
-
const tokenReviewSuggestedRef =
|
|
29218
|
-
const pendingGRef =
|
|
29219
|
-
|
|
28784
|
+
const tokenReviewSuggestedRef = useRef11(/* @__PURE__ */ new Map());
|
|
28785
|
+
const pendingGRef = useRef11(false);
|
|
28786
|
+
useEffect14(() => {
|
|
29220
28787
|
setTokenReviewRow(0);
|
|
29221
28788
|
setTokenReviewEditing(false);
|
|
29222
28789
|
setTokenReviewEditCursor(0);
|
|
@@ -29698,24 +29265,24 @@ var init_preview_annotations = __esm({
|
|
|
29698
29265
|
});
|
|
29699
29266
|
|
|
29700
29267
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
29701
|
-
import { useCallback as useCallback3, useEffect as
|
|
29268
|
+
import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef12, useState as useState24 } from "react";
|
|
29702
29269
|
function useLivePreview(opts) {
|
|
29703
29270
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
29704
29271
|
const [status, setStatus] = useState24("idle");
|
|
29705
29272
|
const [disabled, setDisabled] = useState24(false);
|
|
29706
|
-
const timerRef =
|
|
29707
|
-
const generationRef =
|
|
29708
|
-
const latestRef =
|
|
29709
|
-
const inflightRef =
|
|
29710
|
-
const optsRef =
|
|
29711
|
-
|
|
29273
|
+
const timerRef = useRef12(null);
|
|
29274
|
+
const generationRef = useRef12(0);
|
|
29275
|
+
const latestRef = useRef12(0);
|
|
29276
|
+
const inflightRef = useRef12(0);
|
|
29277
|
+
const optsRef = useRef12(opts);
|
|
29278
|
+
useEffect15(() => {
|
|
29712
29279
|
optsRef.current = opts;
|
|
29713
29280
|
});
|
|
29714
|
-
const disabledRef =
|
|
29715
|
-
|
|
29281
|
+
const disabledRef = useRef12(disabled);
|
|
29282
|
+
useEffect15(() => {
|
|
29716
29283
|
disabledRef.current = disabled;
|
|
29717
29284
|
}, [disabled]);
|
|
29718
|
-
|
|
29285
|
+
useEffect15(() => {
|
|
29719
29286
|
return () => {
|
|
29720
29287
|
if (timerRef.current) {
|
|
29721
29288
|
clearTimeout(timerRef.current);
|
|
@@ -29796,7 +29363,7 @@ var init_use_live_preview = __esm({
|
|
|
29796
29363
|
});
|
|
29797
29364
|
|
|
29798
29365
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
29799
|
-
import { useCallback as useCallback4, useEffect as
|
|
29366
|
+
import { useCallback as useCallback4, useEffect as useEffect16, useState as useState25 } from "react";
|
|
29800
29367
|
function useReviewPreview({
|
|
29801
29368
|
components,
|
|
29802
29369
|
loading,
|
|
@@ -29838,13 +29405,13 @@ function useReviewPreview({
|
|
|
29838
29405
|
deleteAllComponents
|
|
29839
29406
|
});
|
|
29840
29407
|
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
29841
|
-
|
|
29408
|
+
useEffect16(() => {
|
|
29842
29409
|
if (livePreviewHook.status !== "running") return;
|
|
29843
29410
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
29844
29411
|
return () => clearInterval(id);
|
|
29845
29412
|
}, [livePreviewHook.status]);
|
|
29846
29413
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
29847
|
-
|
|
29414
|
+
useEffect16(() => {
|
|
29848
29415
|
if (loading) return;
|
|
29849
29416
|
if (!livePreview) return;
|
|
29850
29417
|
if (components.length === 0) return;
|
|
@@ -29901,7 +29468,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
29901
29468
|
});
|
|
29902
29469
|
|
|
29903
29470
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
29904
|
-
import { useCallback as useCallback5, useEffect as
|
|
29471
|
+
import { useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo6, useRef as useRef13, useState as useState26 } from "react";
|
|
29905
29472
|
import figures8 from "figures";
|
|
29906
29473
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
29907
29474
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -30115,7 +29682,7 @@ function GenerateReviewStepView({
|
|
|
30115
29682
|
setFinalizeError
|
|
30116
29683
|
} = reviewSurface;
|
|
30117
29684
|
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
30118
|
-
const removedBannerDefaultedRef =
|
|
29685
|
+
const removedBannerDefaultedRef = useRef13(false);
|
|
30119
29686
|
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
30120
29687
|
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
30121
29688
|
const cyclePanel = useOverlayPanel({
|
|
@@ -30135,7 +29702,7 @@ function GenerateReviewStepView({
|
|
|
30135
29702
|
const [breakCursor, setBreakCursor] = useState26(0);
|
|
30136
29703
|
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
30137
29704
|
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
30138
|
-
const seededGroupsRef =
|
|
29705
|
+
const seededGroupsRef = useRef13(false);
|
|
30139
29706
|
const {
|
|
30140
29707
|
searchOpen,
|
|
30141
29708
|
setSearchOpen,
|
|
@@ -30159,7 +29726,7 @@ function GenerateReviewStepView({
|
|
|
30159
29726
|
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
30160
29727
|
const [autoRejected, setAutoRejected] = useState26([]);
|
|
30161
29728
|
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
30162
|
-
const autoRejectFiredRef =
|
|
29729
|
+
const autoRejectFiredRef = useRef13(false);
|
|
30163
29730
|
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
30164
29731
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
30165
29732
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
@@ -30222,7 +29789,7 @@ function GenerateReviewStepView({
|
|
|
30222
29789
|
[components]
|
|
30223
29790
|
);
|
|
30224
29791
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
30225
|
-
|
|
29792
|
+
useEffect17(() => {
|
|
30226
29793
|
if (seededGroupsRef.current) return;
|
|
30227
29794
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
30228
29795
|
seededGroupsRef.current = true;
|
|
@@ -30249,7 +29816,7 @@ function GenerateReviewStepView({
|
|
|
30249
29816
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
30250
29817
|
}));
|
|
30251
29818
|
}, [slotCycles, cycleView]);
|
|
30252
|
-
|
|
29819
|
+
useEffect17(() => {
|
|
30253
29820
|
const decision = computeAutoRejectDecision({
|
|
30254
29821
|
loading,
|
|
30255
29822
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -30292,8 +29859,8 @@ function GenerateReviewStepView({
|
|
|
30292
29859
|
}),
|
|
30293
29860
|
applySnapshot: applyHistorySnapshot
|
|
30294
29861
|
});
|
|
30295
|
-
const autoRejectPushedRef =
|
|
30296
|
-
|
|
29862
|
+
const autoRejectPushedRef = useRef13(false);
|
|
29863
|
+
useEffect17(() => {
|
|
30297
29864
|
if (loading) return;
|
|
30298
29865
|
if (!historySeededRef.current) return;
|
|
30299
29866
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -30377,7 +29944,7 @@ function GenerateReviewStepView({
|
|
|
30377
29944
|
const panelHeight = leftPanelHeight + 2;
|
|
30378
29945
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
30379
29946
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
30380
|
-
|
|
29947
|
+
useEffect17(() => {
|
|
30381
29948
|
if (selectableRowPositions.length === 0) return;
|
|
30382
29949
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
30383
29950
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -31123,7 +30690,9 @@ function GenerateReviewStepView({
|
|
|
31123
30690
|
initialFocusTarget: pendingEditorFocus && pendingEditorFocus.componentName === selected.key ? pendingEditorFocus.target : { kind: "description" }
|
|
31124
30691
|
}
|
|
31125
30692
|
),
|
|
31126
|
-
saveError: reviewEditor.saveError
|
|
30693
|
+
saveError: reviewEditor.saveError,
|
|
30694
|
+
livePreview: livePreviewHook,
|
|
30695
|
+
livePreviewSpinner
|
|
31127
30696
|
}
|
|
31128
30697
|
) : /* @__PURE__ */ jsx48(ReviewNoSelection, {})
|
|
31129
30698
|
] }),
|
|
@@ -31155,7 +30724,7 @@ function GenerateReviewStepView({
|
|
|
31155
30724
|
hidden: dialogOpen
|
|
31156
30725
|
}
|
|
31157
30726
|
),
|
|
31158
|
-
!dialogOpen && sidebarFocused &&
|
|
30727
|
+
!dialogOpen && sidebarFocused && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
|
|
31159
30728
|
] });
|
|
31160
30729
|
}
|
|
31161
30730
|
var HELP_SECTIONS2;
|
|
@@ -31237,7 +30806,7 @@ var init_generate_review_step = __esm({
|
|
|
31237
30806
|
{ keys: "P", label: "Component rationale" },
|
|
31238
30807
|
{ keys: "s", label: "Source code snippet" },
|
|
31239
30808
|
{ keys: "J", label: "Toggle JSON" },
|
|
31240
|
-
{ keys: "t", label: "
|
|
30809
|
+
{ keys: "t", label: "Token review" }
|
|
31241
30810
|
]
|
|
31242
30811
|
},
|
|
31243
30812
|
{
|
|
@@ -31436,7 +31005,7 @@ var init_DoneStep = __esm({
|
|
|
31436
31005
|
});
|
|
31437
31006
|
|
|
31438
31007
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
31439
|
-
import { resolve as
|
|
31008
|
+
import { resolve as resolve25 } from "node:path";
|
|
31440
31009
|
import { homedir as homedir4 } from "node:os";
|
|
31441
31010
|
function expandTilde(input) {
|
|
31442
31011
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -31450,7 +31019,7 @@ function normalizePath(input) {
|
|
|
31450
31019
|
p = p.slice(1, -1);
|
|
31451
31020
|
}
|
|
31452
31021
|
p = expandTilde(p);
|
|
31453
|
-
return
|
|
31022
|
+
return resolve25(p);
|
|
31454
31023
|
}
|
|
31455
31024
|
var init_path_utils = __esm({
|
|
31456
31025
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
|
|
@@ -31459,10 +31028,10 @@ var init_path_utils = __esm({
|
|
|
31459
31028
|
});
|
|
31460
31029
|
|
|
31461
31030
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
31462
|
-
import { useEffect as
|
|
31031
|
+
import { useEffect as useEffect18, useState as useState27 } from "react";
|
|
31463
31032
|
function useBlinkingCursor() {
|
|
31464
31033
|
const [visible, setVisible] = useState27(true);
|
|
31465
|
-
|
|
31034
|
+
useEffect18(() => {
|
|
31466
31035
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
31467
31036
|
return () => clearInterval(interval);
|
|
31468
31037
|
}, []);
|
|
@@ -31477,29 +31046,29 @@ var init_use_blinking_cursor = __esm({
|
|
|
31477
31046
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
31478
31047
|
import { useState as useState28 } from "react";
|
|
31479
31048
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
31480
|
-
import { readdirSync as
|
|
31481
|
-
import { dirname as
|
|
31049
|
+
import { readdirSync as readdirSync3 } from "node:fs";
|
|
31050
|
+
import { dirname as dirname16, basename as basename6, join as join21 } from "node:path";
|
|
31482
31051
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
31483
31052
|
function autocomplete(partial) {
|
|
31484
31053
|
if (!partial) return null;
|
|
31485
31054
|
const normalized = normalizePath(partial);
|
|
31486
|
-
const dir =
|
|
31055
|
+
const dir = dirname16(normalized);
|
|
31487
31056
|
const base = basename6(normalized);
|
|
31488
31057
|
let entries;
|
|
31489
31058
|
try {
|
|
31490
|
-
entries =
|
|
31059
|
+
entries = readdirSync3(dir);
|
|
31491
31060
|
} catch {
|
|
31492
31061
|
return null;
|
|
31493
31062
|
}
|
|
31494
31063
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
31495
31064
|
if (matches.length === 0) return null;
|
|
31496
|
-
if (matches.length === 1) return
|
|
31065
|
+
if (matches.length === 1) return join21(dir, matches[0]);
|
|
31497
31066
|
let prefix = matches[0];
|
|
31498
31067
|
for (const m of matches) {
|
|
31499
31068
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
31500
31069
|
if (!prefix) break;
|
|
31501
31070
|
}
|
|
31502
|
-
return prefix.length > base.length ?
|
|
31071
|
+
return prefix.length > base.length ? join21(dir, prefix) : null;
|
|
31503
31072
|
}
|
|
31504
31073
|
function PathPrompt({
|
|
31505
31074
|
defaultPath,
|
|
@@ -31599,12 +31168,12 @@ var init_produced = __esm({
|
|
|
31599
31168
|
});
|
|
31600
31169
|
|
|
31601
31170
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
31602
|
-
import { useEffect as
|
|
31171
|
+
import { useEffect as useEffect19, useState as useState29 } from "react";
|
|
31603
31172
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
31604
31173
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
31605
31174
|
function useTimedSpinner() {
|
|
31606
31175
|
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
31607
|
-
|
|
31176
|
+
useEffect19(() => {
|
|
31608
31177
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
31609
31178
|
return () => {
|
|
31610
31179
|
clearInterval(timer);
|
|
@@ -31816,20 +31385,12 @@ function diffProperty(name, old, newDef) {
|
|
|
31816
31385
|
diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
|
|
31817
31386
|
return diffs;
|
|
31818
31387
|
}
|
|
31819
|
-
function formatDefault(value) {
|
|
31820
|
-
const sys = value?.sys;
|
|
31821
|
-
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
31822
|
-
const name = sys.urn.split("/designTokens/")[1];
|
|
31823
|
-
if (name) return name;
|
|
31824
|
-
}
|
|
31825
|
-
return JSON.stringify(value);
|
|
31826
|
-
}
|
|
31827
31388
|
function formatOldProp(prop) {
|
|
31828
31389
|
const parts = [];
|
|
31829
31390
|
if (prop.type) parts.push(prop.type);
|
|
31830
31391
|
if (prop.category) parts.push(prop.category);
|
|
31831
31392
|
parts.push(prop.required ? "required" : "optional");
|
|
31832
|
-
if (prop.default !== void 0) parts.push(`default=${
|
|
31393
|
+
if (prop.default !== void 0) parts.push(`default=${JSON.stringify(prop.default)}`);
|
|
31833
31394
|
return parts.join(", ");
|
|
31834
31395
|
}
|
|
31835
31396
|
function formatPropDef(def) {
|
|
@@ -31838,7 +31399,7 @@ function formatPropDef(def) {
|
|
|
31838
31399
|
if (def["$category"]) parts.push(def["$category"]);
|
|
31839
31400
|
if (def["$required"] === true) parts.push("required");
|
|
31840
31401
|
else parts.push("optional");
|
|
31841
|
-
if (def["$default"] !== void 0) parts.push(`default=${
|
|
31402
|
+
if (def["$default"] !== void 0) parts.push(`default=${JSON.stringify(def["$default"])}`);
|
|
31842
31403
|
return parts.join(", ");
|
|
31843
31404
|
}
|
|
31844
31405
|
var init_preview_diff = __esm({
|
|
@@ -31873,7 +31434,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
31873
31434
|
});
|
|
31874
31435
|
|
|
31875
31436
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
31876
|
-
import { useEffect as
|
|
31437
|
+
import { useEffect as useEffect20, useState as useState30, useMemo as useMemo7 } from "react";
|
|
31877
31438
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
31878
31439
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
31879
31440
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -32083,7 +31644,7 @@ function WizardPreviewStep({
|
|
|
32083
31644
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
32084
31645
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
32085
31646
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
32086
|
-
|
|
31647
|
+
useEffect20(() => {
|
|
32087
31648
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
32088
31649
|
}, [maxScroll]);
|
|
32089
31650
|
useImmediateInput((input, key) => {
|
|
@@ -32719,8 +32280,8 @@ var init_run_print_files_helpers = __esm({
|
|
|
32719
32280
|
});
|
|
32720
32281
|
|
|
32721
32282
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
32722
|
-
import { writeFile as
|
|
32723
|
-
import { join as
|
|
32283
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
32284
|
+
import { join as join22 } from "node:path";
|
|
32724
32285
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
32725
32286
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
32726
32287
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -32732,7 +32293,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
32732
32293
|
}
|
|
32733
32294
|
async function runPrintFiles(input, deps, onPatch) {
|
|
32734
32295
|
onPatch({ step: "printing" });
|
|
32735
|
-
const componentsPath =
|
|
32296
|
+
const componentsPath = join22(input.outDir, "components.json");
|
|
32736
32297
|
try {
|
|
32737
32298
|
const db = deps.openDb();
|
|
32738
32299
|
let components = [];
|
|
@@ -32816,7 +32377,7 @@ var init_save = __esm({
|
|
|
32816
32377
|
realSaveDeps = () => ({
|
|
32817
32378
|
openDb: openPipelineDb,
|
|
32818
32379
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
32819
|
-
writeFile: (path5, contents) =>
|
|
32380
|
+
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32820
32381
|
appendRun,
|
|
32821
32382
|
buildSourceFingerprint,
|
|
32822
32383
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -32839,9 +32400,9 @@ var init_types9 = __esm({
|
|
|
32839
32400
|
|
|
32840
32401
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
32841
32402
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
32842
|
-
import { mkdir as
|
|
32403
|
+
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
32843
32404
|
import { tmpdir } from "node:os";
|
|
32844
|
-
import { join as
|
|
32405
|
+
import { join as join23, resolve as resolve26 } from "node:path";
|
|
32845
32406
|
function appendWizardLog(entry) {
|
|
32846
32407
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
32847
32408
|
}
|
|
@@ -32864,7 +32425,7 @@ function realFlowDeps() {
|
|
|
32864
32425
|
}
|
|
32865
32426
|
},
|
|
32866
32427
|
mkdir: async (path5) => {
|
|
32867
|
-
await
|
|
32428
|
+
await mkdir8(path5, { recursive: true });
|
|
32868
32429
|
},
|
|
32869
32430
|
detectSaveConflict,
|
|
32870
32431
|
buildTimestampedSubdir,
|
|
@@ -33094,7 +32655,7 @@ function createFlowController(start, deps) {
|
|
|
33094
32655
|
},
|
|
33095
32656
|
async submitPath(submitted) {
|
|
33096
32657
|
await deps.mkdir(submitted);
|
|
33097
|
-
if (
|
|
32658
|
+
if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
33098
32659
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
33099
32660
|
await deps.mkdir(subdir);
|
|
33100
32661
|
await proceedToWrite(subdir);
|
|
@@ -33110,55 +32671,351 @@ function createFlowController(start, deps) {
|
|
|
33110
32671
|
const names = namesToSkip(state2.previewValidationErrors);
|
|
33111
32672
|
if (names.length > 0) await deps.rejectComponentsByName(state2.extractSessionId, names);
|
|
33112
32673
|
}
|
|
33113
|
-
await preview();
|
|
32674
|
+
await preview();
|
|
32675
|
+
}
|
|
32676
|
+
};
|
|
32677
|
+
}
|
|
32678
|
+
var WIZARD_LOG;
|
|
32679
|
+
var init_controller = __esm({
|
|
32680
|
+
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts"() {
|
|
32681
|
+
"use strict";
|
|
32682
|
+
init_src3();
|
|
32683
|
+
init_slot_graph();
|
|
32684
|
+
init_cycle_detection();
|
|
32685
|
+
init_wizard_state_transitions();
|
|
32686
|
+
init_preview2();
|
|
32687
|
+
init_push();
|
|
32688
|
+
init_save();
|
|
32689
|
+
init_types9();
|
|
32690
|
+
WIZARD_LOG = join23(tmpdir(), "experiences-import-wizard.log");
|
|
32691
|
+
}
|
|
32692
|
+
});
|
|
32693
|
+
|
|
32694
|
+
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
32695
|
+
import { useEffect as useEffect21, useRef as useRef14, useSyncExternalStore } from "react";
|
|
32696
|
+
function useFlow(start, options = {}) {
|
|
32697
|
+
const controller = useRef14();
|
|
32698
|
+
if (start && !controller.current) {
|
|
32699
|
+
try {
|
|
32700
|
+
startWizardLog();
|
|
32701
|
+
} catch {
|
|
32702
|
+
}
|
|
32703
|
+
const flowDeps = (options.deps ?? realFlowDeps)();
|
|
32704
|
+
controller.current = createFlowController(start, {
|
|
32705
|
+
...flowDeps,
|
|
32706
|
+
...options.beforeStepChange ? { beforeStepChange: options.beforeStepChange } : {}
|
|
32707
|
+
});
|
|
32708
|
+
}
|
|
32709
|
+
const current = controller.current;
|
|
32710
|
+
const state2 = useSyncExternalStore(
|
|
32711
|
+
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
32712
|
+
() => current?.getState()
|
|
32713
|
+
);
|
|
32714
|
+
useEffect21(() => {
|
|
32715
|
+
if (!start) controller.current = void 0;
|
|
32716
|
+
}, [start]);
|
|
32717
|
+
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
32718
|
+
}
|
|
32719
|
+
var init_use_flow = __esm({
|
|
32720
|
+
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts"() {
|
|
32721
|
+
"use strict";
|
|
32722
|
+
init_controller();
|
|
32723
|
+
}
|
|
32724
|
+
});
|
|
32725
|
+
|
|
32726
|
+
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
32727
|
+
function toRetentionDays(value) {
|
|
32728
|
+
return RETENTION_CHOICES.find((choice) => choice === value) ?? DEFAULT_RETENTION_DAYS;
|
|
32729
|
+
}
|
|
32730
|
+
async function readDebugModeSetting() {
|
|
32731
|
+
const { debugMode } = await readSettings2();
|
|
32732
|
+
const saved = debugMode ?? {};
|
|
32733
|
+
return {
|
|
32734
|
+
enabled: typeof saved.enabled === "boolean" ? saved.enabled : true,
|
|
32735
|
+
retentionDays: toRetentionDays(saved.retentionDays)
|
|
32736
|
+
};
|
|
32737
|
+
}
|
|
32738
|
+
async function writeDebugModeSetting(change) {
|
|
32739
|
+
await updateSettings2({ debugMode: { ...await readDebugModeSetting(), ...change } });
|
|
32740
|
+
}
|
|
32741
|
+
var RETENTION_CHOICES, DEFAULT_RETENTION_DAYS;
|
|
32742
|
+
var init_debug_mode_store = __esm({
|
|
32743
|
+
"packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts"() {
|
|
32744
|
+
"use strict";
|
|
32745
|
+
init_config();
|
|
32746
|
+
RETENTION_CHOICES = [7, 14, 30];
|
|
32747
|
+
DEFAULT_RETENTION_DAYS = 30;
|
|
32748
|
+
}
|
|
32749
|
+
});
|
|
32750
|
+
|
|
32751
|
+
// packages/experience-design-system-cli/src/tui/debug-prune.ts
|
|
32752
|
+
import { readdir as readdir2, rm, rmdir, stat as stat4 } from "node:fs/promises";
|
|
32753
|
+
import { dirname as dirname17, join as join24 } from "node:path";
|
|
32754
|
+
async function logFilesIn(dir) {
|
|
32755
|
+
const entries = await readdir2(dir, { withFileTypes: true });
|
|
32756
|
+
const nested = await Promise.all(
|
|
32757
|
+
entries.map(async (entry) => {
|
|
32758
|
+
const path5 = join24(dir, entry.name);
|
|
32759
|
+
if (entry.isDirectory()) return logFilesIn(path5);
|
|
32760
|
+
return entry.isFile() && entry.name.endsWith(".md") ? [path5] : [];
|
|
32761
|
+
})
|
|
32762
|
+
);
|
|
32763
|
+
return nested.flat();
|
|
32764
|
+
}
|
|
32765
|
+
async function removeEmptyFolders(from, stop) {
|
|
32766
|
+
let dir = from;
|
|
32767
|
+
let removed = 0;
|
|
32768
|
+
for (; ; ) {
|
|
32769
|
+
try {
|
|
32770
|
+
await rmdir(dir);
|
|
32771
|
+
} catch {
|
|
32772
|
+
return removed;
|
|
32773
|
+
}
|
|
32774
|
+
removed += 1;
|
|
32775
|
+
if (dir === stop) return removed;
|
|
32776
|
+
dir = dirname17(dir);
|
|
32777
|
+
}
|
|
32778
|
+
}
|
|
32779
|
+
async function pruneExpiredLogs(base, retentionDays, now = Date.now()) {
|
|
32780
|
+
const cutoff = now - retentionDays * DAY_MS;
|
|
32781
|
+
const contentfulDir = join24(base, ".contentful");
|
|
32782
|
+
const result = { logs: 0, folders: 0 };
|
|
32783
|
+
try {
|
|
32784
|
+
const sessions = (await readdir2(contentfulDir)).filter((name) => SESSION_FOLDER.test(name));
|
|
32785
|
+
for (const session of sessions) {
|
|
32786
|
+
const files = await logFilesIn(join24(contentfulDir, session, "debug")).catch(() => []);
|
|
32787
|
+
for (const file of files) {
|
|
32788
|
+
try {
|
|
32789
|
+
if ((await stat4(file)).mtimeMs >= cutoff) continue;
|
|
32790
|
+
await rm(file);
|
|
32791
|
+
result.logs += 1;
|
|
32792
|
+
result.folders += await removeEmptyFolders(dirname17(file), join24(contentfulDir, session));
|
|
32793
|
+
} catch {
|
|
32794
|
+
}
|
|
32795
|
+
}
|
|
33114
32796
|
}
|
|
33115
|
-
}
|
|
32797
|
+
} catch {
|
|
32798
|
+
}
|
|
32799
|
+
return result;
|
|
33116
32800
|
}
|
|
33117
|
-
var
|
|
33118
|
-
var
|
|
33119
|
-
"packages/experience-design-system-cli/src/tui/
|
|
32801
|
+
var DAY_MS, SESSION_FOLDER;
|
|
32802
|
+
var init_debug_prune = __esm({
|
|
32803
|
+
"packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
|
|
33120
32804
|
"use strict";
|
|
33121
|
-
|
|
33122
|
-
|
|
33123
|
-
init_cycle_detection();
|
|
33124
|
-
init_wizard_state_transitions();
|
|
33125
|
-
init_preview2();
|
|
33126
|
-
init_push();
|
|
33127
|
-
init_save();
|
|
33128
|
-
init_types9();
|
|
33129
|
-
WIZARD_LOG = join25(tmpdir(), "experiences-import-wizard.log");
|
|
32805
|
+
DAY_MS = 24 * 60 * 60 * 1e3;
|
|
32806
|
+
SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
|
|
33130
32807
|
}
|
|
33131
32808
|
});
|
|
33132
32809
|
|
|
33133
|
-
// packages/experience-design-system-cli/src/tui/
|
|
33134
|
-
|
|
33135
|
-
|
|
33136
|
-
|
|
33137
|
-
|
|
33138
|
-
|
|
33139
|
-
|
|
33140
|
-
|
|
33141
|
-
|
|
33142
|
-
|
|
33143
|
-
|
|
33144
|
-
|
|
33145
|
-
|
|
33146
|
-
|
|
32810
|
+
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
32811
|
+
var debug_store_exports = {};
|
|
32812
|
+
__export(debug_store_exports, {
|
|
32813
|
+
currentDebugSessionDir: () => currentDebugSessionDir,
|
|
32814
|
+
currentSessionDir: () => currentSessionDir,
|
|
32815
|
+
finishDebugRun: () => finishDebugRun,
|
|
32816
|
+
startDebugRun: () => startDebugRun,
|
|
32817
|
+
startDebugSessionIn: () => startDebugSessionIn,
|
|
32818
|
+
startImportRun: () => startImportRun
|
|
32819
|
+
});
|
|
32820
|
+
import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
|
|
32821
|
+
import { existsSync as existsSync10, readdirSync as readdirSync4 } from "node:fs";
|
|
32822
|
+
import { join as join25, resolve as resolve27 } from "node:path";
|
|
32823
|
+
function generateRunId() {
|
|
32824
|
+
const now = /* @__PURE__ */ new Date();
|
|
32825
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
32826
|
+
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
32827
|
+
}
|
|
32828
|
+
function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
32829
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
32830
|
+
return `${pad(now.getMonth() + 1)}-${pad(now.getDate())}-${now.getFullYear()}`;
|
|
32831
|
+
}
|
|
32832
|
+
function slugify(value) {
|
|
32833
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
32834
|
+
}
|
|
32835
|
+
async function readBaseDir() {
|
|
32836
|
+
try {
|
|
32837
|
+
const dir = (await readSettings2())["contentfulBaseDir"];
|
|
32838
|
+
return typeof dir === "string" && dir !== "" ? resolve27(dir) : void 0;
|
|
32839
|
+
} catch {
|
|
32840
|
+
return void 0;
|
|
33147
32841
|
}
|
|
33148
|
-
const current = controller.current;
|
|
33149
|
-
const state2 = useSyncExternalStore(
|
|
33150
|
-
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
33151
|
-
() => current?.getState()
|
|
33152
|
-
);
|
|
33153
|
-
useEffect22(() => {
|
|
33154
|
-
if (!start) controller.current = void 0;
|
|
33155
|
-
}, [start]);
|
|
33156
|
-
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
33157
32842
|
}
|
|
33158
|
-
|
|
33159
|
-
|
|
32843
|
+
function nextSessionId(contentfulDir) {
|
|
32844
|
+
const today = datePrefix();
|
|
32845
|
+
const existing = existsSync10(contentfulDir) ? readdirSync4(contentfulDir) : [];
|
|
32846
|
+
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
32847
|
+
const maxSeq = existing.reduce((max, entry) => {
|
|
32848
|
+
const match2 = seqPattern.exec(entry);
|
|
32849
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32850
|
+
}, 0);
|
|
32851
|
+
return `${today}-session-${maxSeq + 1}`;
|
|
32852
|
+
}
|
|
32853
|
+
function startSession(base, { replace }) {
|
|
32854
|
+
const contentfulDir = join25(base, ".contentful");
|
|
32855
|
+
if (replace || !sessionDir) sessionDir = join25(contentfulDir, nextSessionId(contentfulDir));
|
|
32856
|
+
return sessionDir;
|
|
32857
|
+
}
|
|
32858
|
+
function currentDebugSessionDir() {
|
|
32859
|
+
return sessionDir && join25(sessionDir, "debug");
|
|
32860
|
+
}
|
|
32861
|
+
function currentSessionDir() {
|
|
32862
|
+
return sessionDir;
|
|
32863
|
+
}
|
|
32864
|
+
async function startDebugSessionIn(base, { replace = false } = {}) {
|
|
32865
|
+
try {
|
|
32866
|
+
if (!await isDebugModeEnabled()) return;
|
|
32867
|
+
await mkdir9(join25(startSession(resolve27(base), { replace }), "debug"), { recursive: true });
|
|
32868
|
+
} catch {
|
|
32869
|
+
}
|
|
32870
|
+
}
|
|
32871
|
+
function nextImportRunDir(session) {
|
|
32872
|
+
const existing = existsSync10(session) ? readdirSync4(session) : [];
|
|
32873
|
+
const maxRun = existing.reduce((max, entry) => {
|
|
32874
|
+
const match2 = /^dsi-import-(\d+)$/.exec(entry);
|
|
32875
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32876
|
+
}, 0);
|
|
32877
|
+
return join25(session, `dsi-import-${maxRun + 1}`);
|
|
32878
|
+
}
|
|
32879
|
+
async function startImportRun(projectPath) {
|
|
32880
|
+
await startDebugSessionIn(projectPath);
|
|
32881
|
+
if (!sessionDir) return join25(resolve27(projectPath), ".contentful");
|
|
32882
|
+
const dir = nextImportRunDir(sessionDir);
|
|
32883
|
+
await mkdir9(dir, { recursive: true });
|
|
32884
|
+
return dir;
|
|
32885
|
+
}
|
|
32886
|
+
async function isDebugModeEnabled() {
|
|
32887
|
+
try {
|
|
32888
|
+
return (await readDebugModeSetting()).enabled;
|
|
32889
|
+
} catch {
|
|
32890
|
+
return true;
|
|
32891
|
+
}
|
|
32892
|
+
}
|
|
32893
|
+
function redact(value) {
|
|
32894
|
+
const clone = { ...value };
|
|
32895
|
+
if ("cma_token" in clone) {
|
|
32896
|
+
const raw = clone.cma_token;
|
|
32897
|
+
clone.cma_token = typeof raw === "string" && raw.length > 0 ? `[present, ${raw.length} chars]` : "[not set]";
|
|
32898
|
+
}
|
|
32899
|
+
return clone;
|
|
32900
|
+
}
|
|
32901
|
+
function startDebugRun({
|
|
32902
|
+
flow,
|
|
32903
|
+
step,
|
|
32904
|
+
menuOption,
|
|
32905
|
+
inputs
|
|
32906
|
+
}) {
|
|
32907
|
+
const runId = generateRunId();
|
|
32908
|
+
const startedAt = Date.now();
|
|
32909
|
+
const redactedInputs = redact(inputs);
|
|
32910
|
+
isDebugModeEnabled().then((enabled) => {
|
|
32911
|
+
if (!enabled) return;
|
|
32912
|
+
pendingRun = { flow, step, runId, menuOption, inputs: redactedInputs, startedAt };
|
|
32913
|
+
});
|
|
32914
|
+
}
|
|
32915
|
+
async function finishDebugRun({
|
|
32916
|
+
outputs,
|
|
32917
|
+
status,
|
|
32918
|
+
exitMethod
|
|
32919
|
+
}) {
|
|
32920
|
+
const run = pendingRun;
|
|
32921
|
+
if (!run) return;
|
|
32922
|
+
pendingRun = void 0;
|
|
32923
|
+
const durationMs = Date.now() - run.startedAt;
|
|
32924
|
+
const content = renderMarkdown(run, { outputs: redact(outputs), status, exitMethod, durationMs });
|
|
32925
|
+
const root = currentDebugSessionDir();
|
|
32926
|
+
if (!root) return;
|
|
32927
|
+
const flowSegments = run.flow.split("/");
|
|
32928
|
+
const dir = join25(root, ...flowSegments);
|
|
32929
|
+
await mkdir9(dir, { recursive: true });
|
|
32930
|
+
const filename = nextAttemptFilename(dir, run.menuOption);
|
|
32931
|
+
await writeFile8(join25(dir, filename), content, { mode: 384 });
|
|
32932
|
+
}
|
|
32933
|
+
function nextAttemptFilename(dir, menuOption) {
|
|
32934
|
+
const today = datePrefix();
|
|
32935
|
+
const optionSlug = slugify(menuOption);
|
|
32936
|
+
const existing = existsSync10(dir) ? readdirSync4(dir) : [];
|
|
32937
|
+
const attemptPattern = new RegExp(`^${today}-${optionSlug}-attempt-(\\d+)\\.md$`);
|
|
32938
|
+
const maxAttempt = existing.reduce((max, entry) => {
|
|
32939
|
+
const match2 = attemptPattern.exec(entry);
|
|
32940
|
+
return match2 ? Math.max(max, Number(match2[1])) : max;
|
|
32941
|
+
}, 0);
|
|
32942
|
+
return `${today}-${optionSlug}-attempt-${maxAttempt + 1}.md`;
|
|
32943
|
+
}
|
|
32944
|
+
function renderMarkdown(run, finish) {
|
|
32945
|
+
const stepMatch = /^(\d+)-(.+)$/.exec(run.step);
|
|
32946
|
+
const stepLabel = stepMatch ? `${stepMatch[1]} - ${stepMatch[2]}` : run.step;
|
|
32947
|
+
const flowSlug = run.flow.split("/").join("-");
|
|
32948
|
+
return `# Debug Log
|
|
32949
|
+
|
|
32950
|
+
- Run ID: ${run.runId}
|
|
32951
|
+
- Flow: ${flowSlug}
|
|
32952
|
+
- Step: ${stepLabel}
|
|
32953
|
+
- Menu option: ${run.menuOption}
|
|
32954
|
+
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
32955
|
+
- CLI version: ${readPackageVersion()}
|
|
32956
|
+
- Platform: ${process.platform} / Node ${process.version}
|
|
32957
|
+
- Duration on screen: ${finish.durationMs}ms
|
|
32958
|
+
- Status: ${finish.status}
|
|
32959
|
+
- Exit method: ${finish.exitMethod}
|
|
32960
|
+
|
|
32961
|
+
## Inputs
|
|
32962
|
+
\`\`\`json
|
|
32963
|
+
${JSON.stringify(run.inputs, null, 2)}
|
|
32964
|
+
\`\`\`
|
|
32965
|
+
|
|
32966
|
+
## Outputs
|
|
32967
|
+
\`\`\`json
|
|
32968
|
+
${JSON.stringify(finish.outputs, null, 2)}
|
|
32969
|
+
\`\`\`
|
|
32970
|
+
`;
|
|
32971
|
+
}
|
|
32972
|
+
function handleCrash() {
|
|
32973
|
+
return finishDebugRun({ outputs: {}, status: "error", exitMethod: "crashed" });
|
|
32974
|
+
}
|
|
32975
|
+
var pendingRun, sessionDir;
|
|
32976
|
+
var init_debug_store = __esm({
|
|
32977
|
+
"packages/experience-design-system-cli/src/tui/debug-store.ts"() {
|
|
33160
32978
|
"use strict";
|
|
33161
|
-
|
|
32979
|
+
init_config();
|
|
32980
|
+
init_version();
|
|
32981
|
+
init_debug_mode_store();
|
|
32982
|
+
init_debug_prune();
|
|
32983
|
+
void Promise.all([isDebugModeEnabled(), readBaseDir()]).then(async ([enabled, base]) => {
|
|
32984
|
+
if (!base) return;
|
|
32985
|
+
const retention = await readDebugModeSetting().catch(() => void 0);
|
|
32986
|
+
const pruned = retention ? await pruneExpiredLogs(base, retention.retentionDays).catch(() => void 0) : void 0;
|
|
32987
|
+
if (!enabled) return;
|
|
32988
|
+
const debugDir = join25(startSession(base, { replace: false }), "debug");
|
|
32989
|
+
await mkdir9(debugDir, { recursive: true });
|
|
32990
|
+
if (retention && pruned && pruned.logs + pruned.folders > 0) {
|
|
32991
|
+
await writeFile8(
|
|
32992
|
+
join25(debugDir, `${datePrefix()}-cleanup-${generateRunId()}.md`),
|
|
32993
|
+
`# Debug Log Cleanup
|
|
32994
|
+
|
|
32995
|
+
- Date: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
32996
|
+
- Retention: ${retention.retentionDays} days
|
|
32997
|
+
- Logs deleted: ${pruned.logs}
|
|
32998
|
+
- Empty folders removed: ${pruned.folders}
|
|
32999
|
+
`,
|
|
33000
|
+
{ mode: 384 }
|
|
33001
|
+
);
|
|
33002
|
+
}
|
|
33003
|
+
});
|
|
33004
|
+
process.once("uncaughtException", (err) => {
|
|
33005
|
+
void handleCrash().finally(() => {
|
|
33006
|
+
throw err;
|
|
33007
|
+
});
|
|
33008
|
+
});
|
|
33009
|
+
process.once("unhandledRejection", (reason) => {
|
|
33010
|
+
void handleCrash().finally(() => {
|
|
33011
|
+
throw reason;
|
|
33012
|
+
});
|
|
33013
|
+
});
|
|
33014
|
+
process.once("SIGINT", () => {
|
|
33015
|
+
void handleCrash().finally(() => {
|
|
33016
|
+
process.exit(130);
|
|
33017
|
+
});
|
|
33018
|
+
});
|
|
33162
33019
|
}
|
|
33163
33020
|
});
|
|
33164
33021
|
|
|
@@ -33229,7 +33086,7 @@ var init_help_info = __esm({
|
|
|
33229
33086
|
});
|
|
33230
33087
|
|
|
33231
33088
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
33232
|
-
import { useEffect as
|
|
33089
|
+
import { useEffect as useEffect22, useState as useState31 } from "react";
|
|
33233
33090
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
33234
33091
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33235
33092
|
function Section({ title, rows }) {
|
|
@@ -33243,7 +33100,7 @@ function Section({ title, rows }) {
|
|
|
33243
33100
|
}
|
|
33244
33101
|
function HelpScreen({ onDone }) {
|
|
33245
33102
|
const [info, setInfo] = useState31();
|
|
33246
|
-
|
|
33103
|
+
useEffect22(() => {
|
|
33247
33104
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
33248
33105
|
void readHelpInfo().then(setInfo);
|
|
33249
33106
|
}, []);
|
|
@@ -33664,7 +33521,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
33664
33521
|
});
|
|
33665
33522
|
|
|
33666
33523
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
33667
|
-
import { useEffect as
|
|
33524
|
+
import { useEffect as useEffect23, useState as useState33 } from "react";
|
|
33668
33525
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
33669
33526
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33670
33527
|
function StatusHeading() {
|
|
@@ -33685,7 +33542,7 @@ function AgentDetail({
|
|
|
33685
33542
|
const [testing, setTesting] = useState33(false);
|
|
33686
33543
|
const [notice, setNotice] = useState33(null);
|
|
33687
33544
|
const [checks, setChecks] = useState33(void 0);
|
|
33688
|
-
|
|
33545
|
+
useEffect23(() => {
|
|
33689
33546
|
let active = true;
|
|
33690
33547
|
setChecks(void 0);
|
|
33691
33548
|
const timer = setTimeout(() => {
|
|
@@ -33777,7 +33634,7 @@ var init_AgentDetail = __esm({
|
|
|
33777
33634
|
});
|
|
33778
33635
|
|
|
33779
33636
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
33780
|
-
import { useEffect as
|
|
33637
|
+
import { useEffect as useEffect24, useRef as useRef15, useState as useState34 } from "react";
|
|
33781
33638
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
33782
33639
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33783
33640
|
function AgentsScreen({ onDone }) {
|
|
@@ -33788,7 +33645,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33788
33645
|
const [saving, setSaving] = useState34(false);
|
|
33789
33646
|
const [loadError, setLoadError] = useState34(null);
|
|
33790
33647
|
const [checks, setChecks] = useState34({});
|
|
33791
|
-
const visit =
|
|
33648
|
+
const visit = useRef15({
|
|
33792
33649
|
trail: createTrail(),
|
|
33793
33650
|
before: void 0,
|
|
33794
33651
|
environment: void 0,
|
|
@@ -33801,7 +33658,7 @@ function AgentsScreen({ onDone }) {
|
|
|
33801
33658
|
);
|
|
33802
33659
|
}
|
|
33803
33660
|
};
|
|
33804
|
-
|
|
33661
|
+
useEffect24(() => {
|
|
33805
33662
|
readAgentConfig().then((loaded) => {
|
|
33806
33663
|
setConfig(loaded);
|
|
33807
33664
|
inspectAll(loaded);
|
|
@@ -34027,7 +33884,7 @@ var init_project_store = __esm({
|
|
|
34027
33884
|
});
|
|
34028
33885
|
|
|
34029
33886
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
34030
|
-
import { useEffect as
|
|
33887
|
+
import { useEffect as useEffect25, useRef as useRef16, useState as useState35 } from "react";
|
|
34031
33888
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
34032
33889
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
34033
33890
|
function debugFields(config) {
|
|
@@ -34046,14 +33903,14 @@ function ProjectScreen({ onDone }) {
|
|
|
34046
33903
|
const [saving, setSaving] = useState35(false);
|
|
34047
33904
|
const [notice, setNotice] = useState35(null);
|
|
34048
33905
|
const [loadError, setLoadError] = useState35(null);
|
|
34049
|
-
const visit =
|
|
33906
|
+
const visit = useRef16({
|
|
34050
33907
|
trail: createTrail(),
|
|
34051
33908
|
before: void 0,
|
|
34052
33909
|
persisted: void 0,
|
|
34053
33910
|
error: ""
|
|
34054
33911
|
}).current;
|
|
34055
33912
|
const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
34056
|
-
|
|
33913
|
+
useEffect25(() => {
|
|
34057
33914
|
readCredentials().then((cfg) => {
|
|
34058
33915
|
setConfig(cfg);
|
|
34059
33916
|
visit.before = snapshotOf(cfg);
|
|
@@ -34240,13 +34097,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
34240
34097
|
});
|
|
34241
34098
|
|
|
34242
34099
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
34243
|
-
import { useEffect as
|
|
34100
|
+
import { useEffect as useEffect26, useState as useState37 } from "react";
|
|
34244
34101
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
34245
34102
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
34246
34103
|
function OptInAnalyticsScreen({ onDone }) {
|
|
34247
34104
|
const [loading, setLoading] = useState37(true);
|
|
34248
34105
|
const [enabled, setEnabled] = useState37(true);
|
|
34249
|
-
|
|
34106
|
+
useEffect26(() => {
|
|
34250
34107
|
readAnalyticsSetting().then((setting) => {
|
|
34251
34108
|
setEnabled(setting.enabled);
|
|
34252
34109
|
setLoading(false);
|
|
@@ -34309,7 +34166,7 @@ var init_screen12 = __esm({
|
|
|
34309
34166
|
});
|
|
34310
34167
|
|
|
34311
34168
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
34312
|
-
import { useEffect as
|
|
34169
|
+
import { useEffect as useEffect27, useRef as useRef17, useState as useState38 } from "react";
|
|
34313
34170
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
34314
34171
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
34315
34172
|
function DebugModeScreen({ onDone }) {
|
|
@@ -34319,8 +34176,8 @@ function DebugModeScreen({ onDone }) {
|
|
|
34319
34176
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
34320
34177
|
);
|
|
34321
34178
|
const [notice, setNotice] = useState38(null);
|
|
34322
|
-
const visit =
|
|
34323
|
-
|
|
34179
|
+
const visit = useRef17({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
34180
|
+
useEffect27(() => {
|
|
34324
34181
|
readDebugModeSetting().then((loaded) => {
|
|
34325
34182
|
setSetting(loaded);
|
|
34326
34183
|
setPending(loaded.retentionDays);
|
|
@@ -34461,7 +34318,7 @@ var app_exports = {};
|
|
|
34461
34318
|
__export(app_exports, {
|
|
34462
34319
|
runApp: () => runApp
|
|
34463
34320
|
});
|
|
34464
|
-
import { useEffect as
|
|
34321
|
+
import { useEffect as useEffect28, useState as useState39 } from "react";
|
|
34465
34322
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
34466
34323
|
function App({ importOptions, inkClear }) {
|
|
34467
34324
|
const [screen, setScreen] = useState39("start");
|
|
@@ -34495,7 +34352,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34495
34352
|
const [flowStart, setFlowStart] = useState39();
|
|
34496
34353
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
34497
34354
|
const [importDefaults, setImportDefaults] = useState39();
|
|
34498
|
-
|
|
34355
|
+
useEffect28(() => {
|
|
34499
34356
|
if (screen !== "import") {
|
|
34500
34357
|
setImportDefaults(void 0);
|
|
34501
34358
|
return;
|
|
@@ -34568,7 +34425,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34568
34425
|
}
|
|
34569
34426
|
});
|
|
34570
34427
|
};
|
|
34571
|
-
|
|
34428
|
+
useEffect28(() => {
|
|
34572
34429
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
34573
34430
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
34574
34431
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -34590,12 +34447,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34590
34447
|
}
|
|
34591
34448
|
});
|
|
34592
34449
|
}, [tokensOnly, tokensOnlyRun]);
|
|
34593
|
-
|
|
34450
|
+
useEffect28(() => {
|
|
34594
34451
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
34595
34452
|
setExtractionRun(void 0);
|
|
34596
34453
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
34597
34454
|
}, [extraction, extractionRun]);
|
|
34598
|
-
|
|
34455
|
+
useEffect28(() => {
|
|
34599
34456
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
34600
34457
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34601
34458
|
setGenerationInput({
|
|
@@ -34613,7 +34470,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34613
34470
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
34614
34471
|
});
|
|
34615
34472
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
34616
|
-
|
|
34473
|
+
useEffect28(() => {
|
|
34617
34474
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
34618
34475
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34619
34476
|
inkClear();
|