@contentful/experience-design-system-cli 2.39.1-dev-build-eee35c0c.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 +1321 -1451
- package/dist/index.js +1043 -1181
- 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
|
@@ -4,8 +4,8 @@ var __esm = (fn, res) => function __init() {
|
|
|
4
4
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
5
|
};
|
|
6
6
|
var __export = (target, all) => {
|
|
7
|
-
for (var
|
|
8
|
-
__defProp(target,
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
@@ -26,17 +26,17 @@ var init_config_root = __esm({
|
|
|
26
26
|
function escapeForRegExp(value) {
|
|
27
27
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
28
28
|
}
|
|
29
|
-
function identifierPattern(
|
|
30
|
-
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(
|
|
29
|
+
function identifierPattern(name) {
|
|
30
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name)}(?![A-Za-z0-9_$])`);
|
|
31
31
|
}
|
|
32
32
|
function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
33
33
|
if (text.length <= maxChars)
|
|
34
34
|
return { content: text, usesNotShown: [] };
|
|
35
|
-
const patterns = names.filter((
|
|
35
|
+
const patterns = names.filter((name) => name.length > 0).map((name) => ({ name, pattern: identifierPattern(name) }));
|
|
36
36
|
const lines = text.split("\n");
|
|
37
37
|
const windows = [];
|
|
38
38
|
lines.forEach((line, index) => {
|
|
39
|
-
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name
|
|
39
|
+
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name }) => name);
|
|
40
40
|
if (mentioned.length === 0)
|
|
41
41
|
return;
|
|
42
42
|
const start = Math.max(0, index - contextLines);
|
|
@@ -44,8 +44,8 @@ function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
|
44
44
|
const last = windows[windows.length - 1];
|
|
45
45
|
if (last && start <= last.end + 1) {
|
|
46
46
|
last.end = Math.max(last.end, end);
|
|
47
|
-
for (const
|
|
48
|
-
last.names.add(
|
|
47
|
+
for (const name of mentioned)
|
|
48
|
+
last.names.add(name);
|
|
49
49
|
} else {
|
|
50
50
|
windows.push({ start, end, names: new Set(mentioned) });
|
|
51
51
|
}
|
|
@@ -56,8 +56,8 @@ ${TRUNCATED_MARKER}`, usesNotShown: [] };
|
|
|
56
56
|
}
|
|
57
57
|
const lastWindowFor = /* @__PURE__ */ new Map();
|
|
58
58
|
for (const window of windows)
|
|
59
|
-
for (const
|
|
60
|
-
lastWindowFor.set(
|
|
59
|
+
for (const name of window.names)
|
|
60
|
+
lastWindowFor.set(name, window);
|
|
61
61
|
const kept = [];
|
|
62
62
|
const cut = /* @__PURE__ */ new Set();
|
|
63
63
|
let used = 0;
|
|
@@ -71,15 +71,15 @@ ${ELLIPSIS_MARKER}
|
|
|
71
71
|
const head = chunk.slice(0, maxChars);
|
|
72
72
|
kept.push({ window, text: head });
|
|
73
73
|
used += head.length;
|
|
74
|
-
for (const
|
|
75
|
-
if (lastWindowFor.get(
|
|
76
|
-
cut.add(
|
|
74
|
+
for (const name of window.names) {
|
|
75
|
+
if (lastWindowFor.get(name) === window && !identifierPattern(name).test(head))
|
|
76
|
+
cut.add(name);
|
|
77
77
|
}
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
for (const
|
|
81
|
-
if (lastWindowFor.get(
|
|
82
|
-
cut.add(
|
|
80
|
+
for (const name of window.names) {
|
|
81
|
+
if (lastWindowFor.get(name) === window)
|
|
82
|
+
cut.add(name);
|
|
83
83
|
}
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
@@ -90,7 +90,7 @@ ${ELLIPSIS_MARKER}
|
|
|
90
90
|
const parts = kept.map((entry, index) => (index > 0 ? `
|
|
91
91
|
${ELLIPSIS_MARKER}
|
|
92
92
|
` : "") + entry.text);
|
|
93
|
-
const usesNotShown = names.filter((
|
|
93
|
+
const usesNotShown = names.filter((name, index) => cut.has(name) && names.indexOf(name) === index);
|
|
94
94
|
return { content: `${parts.join("")}
|
|
95
95
|
${TRUNCATED_MARKER}`, usesNotShown };
|
|
96
96
|
}
|
|
@@ -105,8 +105,8 @@ var init_source_excerpt = __esm({
|
|
|
105
105
|
|
|
106
106
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js
|
|
107
107
|
import { createHash } from "node:crypto";
|
|
108
|
-
function deriveComponentId(
|
|
109
|
-
return createHash("sha256").update(`${
|
|
108
|
+
function deriveComponentId(name, source) {
|
|
109
|
+
return createHash("sha256").update(`${name}:${source}`).digest("hex").slice(0, 12);
|
|
110
110
|
}
|
|
111
111
|
var init_derive_component_id = __esm({
|
|
112
112
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js"() {
|
|
@@ -195,8 +195,8 @@ var init_read = __esm({
|
|
|
195
195
|
});
|
|
196
196
|
|
|
197
197
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js
|
|
198
|
-
function createSession(db, id,
|
|
199
|
-
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id,
|
|
198
|
+
function createSession(db, id, name, timestamp) {
|
|
199
|
+
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name, timestamp, timestamp);
|
|
200
200
|
}
|
|
201
201
|
function updateSessionTimestamp(db, sessionId, timestamp) {
|
|
202
202
|
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId);
|
|
@@ -1031,8 +1031,8 @@ var init_extract_sentinel_output = __esm({
|
|
|
1031
1031
|
});
|
|
1032
1032
|
|
|
1033
1033
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js
|
|
1034
|
-
function formatGenerateProgressLine(done, total,
|
|
1035
|
-
return `progress=generate:${done}/${total}:${
|
|
1034
|
+
function formatGenerateProgressLine(done, total, name) {
|
|
1035
|
+
return `progress=generate:${done}/${total}:${name}`;
|
|
1036
1036
|
}
|
|
1037
1037
|
var init_format_generate_progress_line = __esm({
|
|
1038
1038
|
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js"() {
|
|
@@ -1718,14 +1718,14 @@ function formatToolCall(obj) {
|
|
|
1718
1718
|
return ` ${ansi.cyan("\u25C8")} ${slot}${req} ${ansi.dim(desc)}`;
|
|
1719
1719
|
}
|
|
1720
1720
|
case "select_component": {
|
|
1721
|
-
const
|
|
1721
|
+
const name = String(obj["name"] ?? "");
|
|
1722
1722
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1723
|
-
return ` ${ansi.green("+")} ${
|
|
1723
|
+
return ` ${ansi.green("+")} ${name} ${ansi.dim(reason)}`;
|
|
1724
1724
|
}
|
|
1725
1725
|
case "reject_component": {
|
|
1726
|
-
const
|
|
1726
|
+
const name = String(obj["name"] ?? "");
|
|
1727
1727
|
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
1728
|
-
return ` ${ansi.dim("\u2013")} ${
|
|
1728
|
+
return ` ${ansi.dim("\u2013")} ${name} ${ansi.dim(reason)}`;
|
|
1729
1729
|
}
|
|
1730
1730
|
default:
|
|
1731
1731
|
return null;
|
|
@@ -3445,7 +3445,7 @@ function identifiersIn(propTypes) {
|
|
|
3445
3445
|
return [...names];
|
|
3446
3446
|
}
|
|
3447
3447
|
function declaresAnyType(text, typeNames) {
|
|
3448
|
-
return typeNames.some((
|
|
3448
|
+
return typeNames.some((name) => new RegExp(`\\b(?:type|interface|enum|const|class)\\s+${escapeForRegExp(name)}\\b`).test(text));
|
|
3449
3449
|
}
|
|
3450
3450
|
function extractRelativeImportPaths(sourceText) {
|
|
3451
3451
|
const specifiers = /* @__PURE__ */ new Set();
|
|
@@ -3510,7 +3510,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
3510
3510
|
frontier = nextFrontier;
|
|
3511
3511
|
}
|
|
3512
3512
|
const inHand = [sourceText, ...discovered.map((d) => d.content)];
|
|
3513
|
-
const declaredTypeNames = candidateTypeNames.filter((
|
|
3513
|
+
const declaredTypeNames = candidateTypeNames.filter((name) => inHand.some((text) => declaresAnyType(text, [name])));
|
|
3514
3514
|
const usesNotShown = /* @__PURE__ */ new Set();
|
|
3515
3515
|
const searchNames = [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])];
|
|
3516
3516
|
let enlarged = 0;
|
|
@@ -3520,19 +3520,19 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
3520
3520
|
enlarged++;
|
|
3521
3521
|
const budget = enlarge ? MAX_TYPE_DECLARING_SIBLING_CHARS : MAX_SIBLING_SNIPPET_CHARS;
|
|
3522
3522
|
const excerpt = excerptAroundNames(d.content, searchNames, budget);
|
|
3523
|
-
for (const
|
|
3524
|
-
usesNotShown.add(
|
|
3523
|
+
for (const name of excerpt.usesNotShown)
|
|
3524
|
+
usesNotShown.add(name);
|
|
3525
3525
|
return { path: d.path, content: excerpt.content };
|
|
3526
3526
|
});
|
|
3527
3527
|
const truncatedCount = Math.max(0, discovered.length - MAX_SIBLING_FILES);
|
|
3528
3528
|
return {
|
|
3529
3529
|
siblings,
|
|
3530
3530
|
truncatedCount,
|
|
3531
|
-
usesNotShown: propNames.filter((
|
|
3531
|
+
usesNotShown: propNames.filter((name) => usesNotShown.has(name)),
|
|
3532
3532
|
declaredTypeNames
|
|
3533
3533
|
};
|
|
3534
3534
|
}
|
|
3535
|
-
async function loadComponentSourceRef(
|
|
3535
|
+
async function loadComponentSourceRef(name, sourcePath, propNames = [], propTypes = []) {
|
|
3536
3536
|
let content = null;
|
|
3537
3537
|
let siblingFiles = [];
|
|
3538
3538
|
let truncatedSiblingCount = 0;
|
|
@@ -3549,18 +3549,18 @@ async function loadComponentSourceRef(name2, sourcePath, propNames = [], propTyp
|
|
|
3549
3549
|
} = await loadSiblingFiles(rawText, sourcePath, propNames, identifiersIn(propTypes)));
|
|
3550
3550
|
const mainExcerpt = excerptAroundNames(rawText, [.../* @__PURE__ */ new Set([...propNames, ...declaredTypeNames])], MAX_COMPONENT_SOURCE_CHARS);
|
|
3551
3551
|
content = mainExcerpt.content;
|
|
3552
|
-
for (const
|
|
3553
|
-
usesNotShown.add(
|
|
3554
|
-
for (const
|
|
3555
|
-
usesNotShown.add(
|
|
3552
|
+
for (const name2 of mainExcerpt.usesNotShown)
|
|
3553
|
+
usesNotShown.add(name2);
|
|
3554
|
+
for (const name2 of siblingUsesNotShown)
|
|
3555
|
+
usesNotShown.add(name2);
|
|
3556
3556
|
} catch {
|
|
3557
3557
|
}
|
|
3558
|
-
const ref = { component:
|
|
3558
|
+
const ref = { component: name, sourcePath, content };
|
|
3559
3559
|
if (siblingFiles.length > 0)
|
|
3560
3560
|
ref.siblingFiles = siblingFiles;
|
|
3561
3561
|
if (truncatedSiblingCount > 0)
|
|
3562
3562
|
ref.truncatedSiblingCount = truncatedSiblingCount;
|
|
3563
|
-
const notShown = propNames.filter((
|
|
3563
|
+
const notShown = propNames.filter((name2) => usesNotShown.has(name2));
|
|
3564
3564
|
if (notShown.length > 0)
|
|
3565
3565
|
ref.usesNotShown = notShown;
|
|
3566
3566
|
return ref;
|
|
@@ -3713,7 +3713,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
3713
3713
|
const allowedComponentsBySlot = indexRowsByKey(allowedComponents, (ac) => `${ac.component_id}::${ac.slot_name}`);
|
|
3714
3714
|
const tokenPathsByProp = indexRowsByKey(tokenPaths, (t) => `${t.component_id}::${t.prop_name}`);
|
|
3715
3715
|
const toTokenPaths = (rows) => rows === void 0 ? void 0 : rows.map((r) => r.path);
|
|
3716
|
-
return components.map(({ component_id, name
|
|
3716
|
+
return components.map(({ component_id, name, description }) => {
|
|
3717
3717
|
const compProps = propsByComponent.get(component_id) ?? [];
|
|
3718
3718
|
const $properties = {};
|
|
3719
3719
|
for (const p of compProps) {
|
|
@@ -3770,7 +3770,7 @@ function loadCDFComponents(db, sessionId) {
|
|
|
3770
3770
|
entry.$description = description;
|
|
3771
3771
|
if (Object.keys($slots).length > 0)
|
|
3772
3772
|
entry.$slots = $slots;
|
|
3773
|
-
return { key:
|
|
3773
|
+
return { key: name, entry };
|
|
3774
3774
|
});
|
|
3775
3775
|
}
|
|
3776
3776
|
function loadScopeComponents(db, sessionId) {
|
|
@@ -4648,29 +4648,29 @@ function extractTsxComponents(filePaths, componentFilePattern, extract) {
|
|
|
4648
4648
|
}
|
|
4649
4649
|
function resolveDefaultExportName(declarations, exported, allowVariableDeclaration = false) {
|
|
4650
4650
|
const declaration = declarations[0];
|
|
4651
|
-
const
|
|
4652
|
-
if (!
|
|
4651
|
+
const name = Node.isFunctionDeclaration(declaration) ? declaration.getName() : allowVariableDeclaration && Node.isVariableDeclaration(declaration) ? declaration.getName() : void 0;
|
|
4652
|
+
if (!name || !/^[A-Z]/.test(name) || exported.has(name))
|
|
4653
4653
|
return void 0;
|
|
4654
|
-
return
|
|
4654
|
+
return name;
|
|
4655
4655
|
}
|
|
4656
4656
|
function getRenderableExports(sourceFile, exclusions, options) {
|
|
4657
4657
|
const renderable = [];
|
|
4658
4658
|
const exported = sourceFile.getExportedDeclarations();
|
|
4659
4659
|
for (const [exportKey, declarations] of exported) {
|
|
4660
|
-
const
|
|
4661
|
-
if (!
|
|
4660
|
+
const name = exportKey === "default" ? resolveDefaultExportName(declarations, exported, options.allowVariableDeclaration) : exportKey;
|
|
4661
|
+
if (!name || !/^[A-Z]/.test(name))
|
|
4662
4662
|
continue;
|
|
4663
|
-
if (
|
|
4663
|
+
if (name.startsWith("use")) {
|
|
4664
4664
|
exclusions.push({
|
|
4665
4665
|
itemType: "component",
|
|
4666
|
-
name
|
|
4666
|
+
name,
|
|
4667
4667
|
source: sourceFile.getFilePath(),
|
|
4668
4668
|
reason: options.hookReason,
|
|
4669
4669
|
stage: "component-filter"
|
|
4670
4670
|
});
|
|
4671
4671
|
continue;
|
|
4672
4672
|
}
|
|
4673
|
-
renderable.push({ name
|
|
4673
|
+
renderable.push({ name, declarations });
|
|
4674
4674
|
}
|
|
4675
4675
|
return renderable;
|
|
4676
4676
|
}
|
|
@@ -5069,7 +5069,7 @@ function extractProps(classDecl) {
|
|
|
5069
5069
|
for (const property of classDecl.getProperties()) {
|
|
5070
5070
|
if (!hasDecorator(property, "Prop"))
|
|
5071
5071
|
continue;
|
|
5072
|
-
const
|
|
5072
|
+
const name = property.getName();
|
|
5073
5073
|
const typeNode = property.getTypeNode();
|
|
5074
5074
|
const typeText = typeNode ? typeNode.getText() : "unknown";
|
|
5075
5075
|
const hasQuestionToken = property.hasQuestionToken();
|
|
@@ -5107,21 +5107,21 @@ function extractProps(classDecl) {
|
|
|
5107
5107
|
}
|
|
5108
5108
|
const allowedValues = extractAllowedValues2(typeText);
|
|
5109
5109
|
props.push({
|
|
5110
|
-
name
|
|
5110
|
+
name,
|
|
5111
5111
|
type: typeText,
|
|
5112
5112
|
required: isRequired,
|
|
5113
5113
|
...defaultValue !== void 0 && { defaultValue },
|
|
5114
5114
|
...description && { description },
|
|
5115
5115
|
...allowedValues && { allowedValues },
|
|
5116
|
-
...intrinsicDomAttributeProps.has(
|
|
5116
|
+
...intrinsicDomAttributeProps.has(name) && { domAttribute: true },
|
|
5117
5117
|
sourceStartLine: property.getStartLineNumber(),
|
|
5118
5118
|
sourceEndLine: property.getEndLineNumber()
|
|
5119
5119
|
});
|
|
5120
5120
|
}
|
|
5121
5121
|
return props.sort((a, b) => a.name.localeCompare(b.name));
|
|
5122
5122
|
}
|
|
5123
|
-
function normalizeSlotName(
|
|
5124
|
-
const normalizedName =
|
|
5123
|
+
function normalizeSlotName(name) {
|
|
5124
|
+
const normalizedName = name && name.length > 0 ? name : "default";
|
|
5125
5125
|
return {
|
|
5126
5126
|
name: normalizedName,
|
|
5127
5127
|
isDefault: normalizedName === "default"
|
|
@@ -5191,9 +5191,9 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
5191
5191
|
if (tagName === "slot") {
|
|
5192
5192
|
const nameAttribute = openingElement.getAttributes().find((attribute) => Node2.isJsxAttribute(attribute) && attribute.getNameNode().getText() === "name");
|
|
5193
5193
|
const initializer2 = Node2.isJsxAttribute(nameAttribute) ? nameAttribute.getInitializer() : void 0;
|
|
5194
|
-
const
|
|
5194
|
+
const name2 = initializer2 && Node2.isStringLiteral(initializer2) ? initializer2.getLiteralValue() : initializer2 && Node2.isJsxExpression(initializer2) ? initializer2.getExpression()?.getText() ?? "" : "";
|
|
5195
5195
|
upsertSlot({
|
|
5196
|
-
...normalizeSlotName(
|
|
5196
|
+
...normalizeSlotName(name2)
|
|
5197
5197
|
});
|
|
5198
5198
|
return;
|
|
5199
5199
|
}
|
|
@@ -5202,11 +5202,11 @@ function extractSlots(classDecl, warnings, componentName) {
|
|
|
5202
5202
|
const initializer = slotAttribute.getInitializer();
|
|
5203
5203
|
if (!initializer || !Node2.isStringLiteral(initializer))
|
|
5204
5204
|
return;
|
|
5205
|
-
const
|
|
5206
|
-
if (!
|
|
5205
|
+
const name = initializer.getLiteralValue();
|
|
5206
|
+
if (!name)
|
|
5207
5207
|
return;
|
|
5208
5208
|
upsertSlot({
|
|
5209
|
-
name
|
|
5209
|
+
name,
|
|
5210
5210
|
isDefault: false
|
|
5211
5211
|
});
|
|
5212
5212
|
});
|
|
@@ -5228,15 +5228,15 @@ function extractFromSourceFile(sourceFile, warnings) {
|
|
|
5228
5228
|
const tag = getComponentTag(classDecl);
|
|
5229
5229
|
if (!tag)
|
|
5230
5230
|
continue;
|
|
5231
|
-
const
|
|
5231
|
+
const name = kebabToPascal(tag);
|
|
5232
5232
|
const props = extractProps(classDecl);
|
|
5233
|
-
const slots = extractSlots(classDecl, warnings,
|
|
5233
|
+
const slots = extractSlots(classDecl, warnings, name);
|
|
5234
5234
|
const eventNames = detectEvents(classDecl);
|
|
5235
5235
|
if (eventNames.length > 0) {
|
|
5236
|
-
warnings.push(`Component ${
|
|
5236
|
+
warnings.push(`Component ${name} has ${eventNames.length} events not captured: ${eventNames.join(", ")}`);
|
|
5237
5237
|
}
|
|
5238
5238
|
components.push({
|
|
5239
|
-
name
|
|
5239
|
+
name,
|
|
5240
5240
|
source: sourceFile.getFilePath(),
|
|
5241
5241
|
sourcePath: sourceFile.getFilePath(),
|
|
5242
5242
|
framework: "stencil",
|
|
@@ -5403,9 +5403,9 @@ function extractAllowedComponentsFromJsdoc(jsdocText, componentNames) {
|
|
|
5403
5403
|
return [];
|
|
5404
5404
|
const found = /* @__PURE__ */ new Set();
|
|
5405
5405
|
for (const raw of m[1].split(",")) {
|
|
5406
|
-
const
|
|
5407
|
-
if (
|
|
5408
|
-
found.add(
|
|
5406
|
+
const name = raw.trim();
|
|
5407
|
+
if (name && componentNames.has(name))
|
|
5408
|
+
found.add(name);
|
|
5409
5409
|
}
|
|
5410
5410
|
return [...found].sort();
|
|
5411
5411
|
}
|
|
@@ -5453,8 +5453,8 @@ function collectTypePredicateComponentReferences(sourceFile, ctx) {
|
|
|
5453
5453
|
const assertedTypeNode = returnTypeNode.getTypeNode();
|
|
5454
5454
|
if (!assertedTypeNode)
|
|
5455
5455
|
continue;
|
|
5456
|
-
for (const
|
|
5457
|
-
found.add(
|
|
5456
|
+
for (const name of extractAllowedComponentsFromTypeText(assertedTypeNode.getText(), ctx)) {
|
|
5457
|
+
found.add(name);
|
|
5458
5458
|
}
|
|
5459
5459
|
}
|
|
5460
5460
|
return [...found].sort();
|
|
@@ -5473,13 +5473,13 @@ function collectRuntimeTypeCheckComponentReferences(sourceFile, componentNames)
|
|
|
5473
5473
|
return void 0;
|
|
5474
5474
|
if (!Node3.isIdentifier(otherSide) && !Node3.isPropertyAccessExpression(otherSide))
|
|
5475
5475
|
return void 0;
|
|
5476
|
-
const
|
|
5477
|
-
if (!
|
|
5476
|
+
const name = otherSide.getText().split(".").pop();
|
|
5477
|
+
if (!name || !componentNames.has(name))
|
|
5478
5478
|
return void 0;
|
|
5479
5479
|
const baseIdentifier = Node3.isPropertyAccessExpression(otherSide) ? otherSide.getExpression() : otherSide;
|
|
5480
5480
|
if (!Node3.isIdentifier(baseIdentifier) || !localBindings.has(baseIdentifier.getText()))
|
|
5481
5481
|
return void 0;
|
|
5482
|
-
return
|
|
5482
|
+
return name;
|
|
5483
5483
|
};
|
|
5484
5484
|
const match2 = candidateFromTypeAccess(left, right) ?? candidateFromTypeAccess(right, left);
|
|
5485
5485
|
if (match2)
|
|
@@ -5531,8 +5531,8 @@ function collectArrayMapRenderComponentReferences(funcNode, componentNames, ownC
|
|
|
5531
5531
|
const found = /* @__PURE__ */ new Set();
|
|
5532
5532
|
const propNames = new Set(propTypesByName.keys());
|
|
5533
5533
|
const renderCountByComponent = /* @__PURE__ */ new Map();
|
|
5534
|
-
const bumpRenderCount = (
|
|
5535
|
-
renderCountByComponent.set(
|
|
5534
|
+
const bumpRenderCount = (name) => {
|
|
5535
|
+
renderCountByComponent.set(name, (renderCountByComponent.get(name) ?? 0) + 1);
|
|
5536
5536
|
};
|
|
5537
5537
|
for (const jsxElement of [
|
|
5538
5538
|
...funcNode.getDescendantsOfKind(SyntaxKind3.JsxSelfClosingElement),
|
|
@@ -5695,7 +5695,7 @@ function sourceFileUsesCreateContext(sourceFile) {
|
|
|
5695
5695
|
function isNextJsComponent(filePath, exportedNames) {
|
|
5696
5696
|
const normalized = filePath.replace(/\\/g, "/");
|
|
5697
5697
|
const isAppRouterFile = /\/app\/.*\/(page|layout)\.[jt]sx?$/.test(normalized);
|
|
5698
|
-
const hasNextExports = exportedNames.some((
|
|
5698
|
+
const hasNextExports = exportedNames.some((name) => name === "generateMetadata" || name === "generateStaticParams");
|
|
5699
5699
|
return isAppRouterFile || hasNextExports;
|
|
5700
5700
|
}
|
|
5701
5701
|
function isRepoLocalTransparentPolymorphicWrapperDeclaration(declaration, typeName) {
|
|
@@ -5877,8 +5877,8 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
5877
5877
|
const props = [];
|
|
5878
5878
|
let hasChildren = false;
|
|
5879
5879
|
for (const property of type.getProperties()) {
|
|
5880
|
-
const
|
|
5881
|
-
if (
|
|
5880
|
+
const name = property.getName();
|
|
5881
|
+
if (name === "children") {
|
|
5882
5882
|
if (suppressNeverChildrenSlot) {
|
|
5883
5883
|
const declaration2 = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
5884
5884
|
if (declaration2 && property.getTypeAtLocation(declaration2).isNever()) {
|
|
@@ -5888,7 +5888,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
5888
5888
|
hasChildren = true;
|
|
5889
5889
|
continue;
|
|
5890
5890
|
}
|
|
5891
|
-
if (slotNames.has(
|
|
5891
|
+
if (slotNames.has(name))
|
|
5892
5892
|
continue;
|
|
5893
5893
|
const declaration = property.getValueDeclaration() ?? property.getDeclarations()[0];
|
|
5894
5894
|
if (!declaration)
|
|
@@ -5899,7 +5899,7 @@ function extractPropsFromTypeSymbols(type, slotNames, suppressNeverChildrenSlot
|
|
|
5899
5899
|
const required = !property.isOptional();
|
|
5900
5900
|
const allowedValues = extractAllowedValues(propType);
|
|
5901
5901
|
props.push({
|
|
5902
|
-
name
|
|
5902
|
+
name,
|
|
5903
5903
|
type: typeText,
|
|
5904
5904
|
required,
|
|
5905
5905
|
...allowedValues && { allowedValues },
|
|
@@ -5930,19 +5930,19 @@ function extractPropsFromInterfaceDeclaration(declaration, slotNames, seen, excl
|
|
|
5930
5930
|
return acc;
|
|
5931
5931
|
const propType = symbol.getTypeAtLocation(decl);
|
|
5932
5932
|
const typeText = propType.isAny() ? ("getTypeNode" in decl && typeof decl.getTypeNode === "function" ? decl.getTypeNode()?.getText() : void 0) ?? propType.getText(decl) : propType.getText(decl);
|
|
5933
|
-
const
|
|
5934
|
-
if (
|
|
5933
|
+
const name = symbol.getName();
|
|
5934
|
+
if (name === "children") {
|
|
5935
5935
|
if (suppressNeverChildrenSlot && propType.isNever())
|
|
5936
5936
|
return acc;
|
|
5937
5937
|
acc.hasChildren = true;
|
|
5938
5938
|
return acc;
|
|
5939
5939
|
}
|
|
5940
|
-
if (slotNames.has(
|
|
5940
|
+
if (slotNames.has(name))
|
|
5941
5941
|
return acc;
|
|
5942
5942
|
const required = !symbol.isOptional();
|
|
5943
5943
|
const allowedValues = extractAllowedValues(propType);
|
|
5944
5944
|
acc.props.push({
|
|
5945
|
-
name
|
|
5945
|
+
name,
|
|
5946
5946
|
type: typeText,
|
|
5947
5947
|
required,
|
|
5948
5948
|
...allowedValues && { allowedValues },
|
|
@@ -6275,7 +6275,7 @@ function collectReboundDeclarations(body) {
|
|
|
6275
6275
|
function collectPropDataflow(func, param, availablePropNames) {
|
|
6276
6276
|
const valueAliases = /* @__PURE__ */ new Map();
|
|
6277
6277
|
const objectAliases = /* @__PURE__ */ new Map();
|
|
6278
|
-
const fullPropsShape = new Map([...availablePropNames].map((
|
|
6278
|
+
const fullPropsShape = new Map([...availablePropNames].map((name) => [name, name]));
|
|
6279
6279
|
const belongsToComponentFunction = (node) => node.getFirstAncestor((ancestor) => Node4.isFunctionDeclaration(ancestor) || Node4.isArrowFunction(ancestor) || Node4.isFunctionExpression(ancestor)) === func;
|
|
6280
6280
|
const resolveValue = (expression) => {
|
|
6281
6281
|
if (!expression)
|
|
@@ -6469,12 +6469,12 @@ function extractSlots2(type, hasChildren) {
|
|
|
6469
6469
|
slots.push({ name: "children", isDefault: true });
|
|
6470
6470
|
}
|
|
6471
6471
|
for (const property of type.getProperties()) {
|
|
6472
|
-
const
|
|
6473
|
-
if (
|
|
6472
|
+
const name = property.getName();
|
|
6473
|
+
if (name === "children")
|
|
6474
6474
|
continue;
|
|
6475
6475
|
if (!getRenderPropType(property))
|
|
6476
6476
|
continue;
|
|
6477
|
-
const slotName =
|
|
6477
|
+
const slotName = name.replace(/^render/, "");
|
|
6478
6478
|
slots.push({
|
|
6479
6479
|
name: slotName.charAt(0).toLowerCase() + slotName.slice(1),
|
|
6480
6480
|
isDefault: false
|
|
@@ -6487,9 +6487,9 @@ function isExpandableDomAttributeWrapperName(typeName) {
|
|
|
6487
6487
|
}
|
|
6488
6488
|
function getStringLiteralTypeValues(typeNode) {
|
|
6489
6489
|
if (Node4.isLiteralTypeNode(typeNode)) {
|
|
6490
|
-
const
|
|
6491
|
-
if (Node4.isStringLiteral(
|
|
6492
|
-
return [
|
|
6490
|
+
const literal3 = typeNode.getLiteral();
|
|
6491
|
+
if (Node4.isStringLiteral(literal3)) {
|
|
6492
|
+
return [literal3.getLiteralText()];
|
|
6493
6493
|
}
|
|
6494
6494
|
}
|
|
6495
6495
|
if (!Node4.isUnionTypeNode(typeNode))
|
|
@@ -6730,17 +6730,17 @@ function getSyntheticDomAttributeProps(typeNode) {
|
|
|
6730
6730
|
}
|
|
6731
6731
|
return [...propsByName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
6732
6732
|
}
|
|
6733
|
-
function getDomAttributeSurface(
|
|
6734
|
-
if (seen.has(
|
|
6733
|
+
function getDomAttributeSurface(name, seen = /* @__PURE__ */ new Set()) {
|
|
6734
|
+
if (seen.has(name))
|
|
6735
6735
|
return [];
|
|
6736
|
-
seen.add(
|
|
6736
|
+
seen.add(name);
|
|
6737
6737
|
const propsByName = /* @__PURE__ */ new Map();
|
|
6738
|
-
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[
|
|
6738
|
+
for (const parentName of DOM_ATTRIBUTE_WRAPPER_PARENTS[name] ?? []) {
|
|
6739
6739
|
for (const prop of getDomAttributeSurface(parentName, seen)) {
|
|
6740
6740
|
propsByName.set(prop.name, prop);
|
|
6741
6741
|
}
|
|
6742
6742
|
}
|
|
6743
|
-
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[
|
|
6743
|
+
for (const prop of DOM_ATTRIBUTE_PROP_SURFACES[name]) {
|
|
6744
6744
|
propsByName.set(prop.name, prop);
|
|
6745
6745
|
}
|
|
6746
6746
|
return [...propsByName.values()].map((prop) => ({
|
|
@@ -6837,12 +6837,12 @@ function extractPickedPropsFromTypeNode(typeNode, slotNames, excludedProps = /*
|
|
|
6837
6837
|
}
|
|
6838
6838
|
const pickedKeys = getStringLiteralTypeValues(pickedKeysNode);
|
|
6839
6839
|
const props = [];
|
|
6840
|
-
for (const
|
|
6841
|
-
if (slotNames.has(
|
|
6840
|
+
for (const name of pickedKeys) {
|
|
6841
|
+
if (slotNames.has(name))
|
|
6842
6842
|
continue;
|
|
6843
|
-
if (excludedProps.has(
|
|
6843
|
+
if (excludedProps.has(name))
|
|
6844
6844
|
continue;
|
|
6845
|
-
const pickedProp = sourcePropsByName.get(
|
|
6845
|
+
const pickedProp = sourcePropsByName.get(name);
|
|
6846
6846
|
if (pickedProp) {
|
|
6847
6847
|
props.push(pickedProp);
|
|
6848
6848
|
}
|
|
@@ -7071,7 +7071,7 @@ async function extractReactComponents(filePaths) {
|
|
|
7071
7071
|
function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
7072
7072
|
const components = [];
|
|
7073
7073
|
const usesCreateContext = sourceFileUsesCreateContext(sourceFile);
|
|
7074
|
-
for (const { name
|
|
7074
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
7075
7075
|
allowVariableDeclaration: true,
|
|
7076
7076
|
hookReason: "React hook names are not renderable components"
|
|
7077
7077
|
})) {
|
|
@@ -7083,7 +7083,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
7083
7083
|
const params = funcNode.getParameters();
|
|
7084
7084
|
if (params.length === 0) {
|
|
7085
7085
|
components.push({
|
|
7086
|
-
name
|
|
7086
|
+
name,
|
|
7087
7087
|
source: sourceFile.getFilePath(),
|
|
7088
7088
|
sourcePath: sourceFile.getFilePath(),
|
|
7089
7089
|
framework: isNext ? "next" : "react",
|
|
@@ -7127,7 +7127,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
7127
7127
|
}
|
|
7128
7128
|
const resolvedProps = [...mergedPropsByName.values()];
|
|
7129
7129
|
const noUsefulTypes = resolvedProps.length === 0 || resolvedProps.every((p) => p.type === "any");
|
|
7130
|
-
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile,
|
|
7130
|
+
const finalProps = noUsefulTypes ? extractPropTypes(sourceFile, name) ?? resolvedProps : resolvedProps;
|
|
7131
7131
|
const propsWithDefaults = finalProps.map((p) => {
|
|
7132
7132
|
if (!defaults.has(p.name))
|
|
7133
7133
|
return p;
|
|
@@ -7160,7 +7160,7 @@ function extractFromSourceFile2(sourceFile, isNext, exclusions) {
|
|
|
7160
7160
|
const propsTypeName = firstParamTypeNode?.getText?.().trim();
|
|
7161
7161
|
const propsTypeNameCapture = propsTypeName && /^[A-Za-z_$][\w$]*$/.test(propsTypeName) ? propsTypeName : void 0;
|
|
7162
7162
|
components.push({
|
|
7163
|
-
name
|
|
7163
|
+
name,
|
|
7164
7164
|
source: sourceFile.getFilePath(),
|
|
7165
7165
|
sourcePath: sourceFile.getFilePath(),
|
|
7166
7166
|
framework: isNext ? "next" : "react",
|
|
@@ -7561,10 +7561,10 @@ async function extractVueTsxComponents(filePaths) {
|
|
|
7561
7561
|
}
|
|
7562
7562
|
function extractFromSourceFile3(sourceFile, exclusions) {
|
|
7563
7563
|
const components = [];
|
|
7564
|
-
for (const { name
|
|
7564
|
+
for (const { name, declarations } of getRenderableExports(sourceFile, exclusions, {
|
|
7565
7565
|
hookReason: "Vue composition hook names are not renderable components"
|
|
7566
7566
|
})) {
|
|
7567
|
-
const component = extractVueTsxComponent(declarations,
|
|
7567
|
+
const component = extractVueTsxComponent(declarations, name, sourceFile);
|
|
7568
7568
|
if (component) {
|
|
7569
7569
|
components.push(component);
|
|
7570
7570
|
}
|
|
@@ -7580,11 +7580,11 @@ function extractVueTsxComponent(declarations, exportName, sourceFile) {
|
|
|
7580
7580
|
const resolved = resolveVueComponentOptions(declaration.getInitializer());
|
|
7581
7581
|
if (!resolved)
|
|
7582
7582
|
continue;
|
|
7583
|
-
const
|
|
7583
|
+
const name = extractVueGenericComponentName(resolved.options) ?? exportName;
|
|
7584
7584
|
const props = extractVueGenericComponentProps(resolved.options);
|
|
7585
7585
|
const slots = extractVueGenericComponentSlots(resolved.options, resolved.slotsTypeNode);
|
|
7586
7586
|
return {
|
|
7587
|
-
name
|
|
7587
|
+
name,
|
|
7588
7588
|
source: sourceFile.getFilePath(),
|
|
7589
7589
|
framework: "vue",
|
|
7590
7590
|
props,
|
|
@@ -7758,16 +7758,16 @@ function extractVueObjectPropDefinition(propName, initializer) {
|
|
|
7758
7758
|
for (const property of initializer.getProperties()) {
|
|
7759
7759
|
if (!Node5.isPropertyAssignment(property))
|
|
7760
7760
|
continue;
|
|
7761
|
-
const
|
|
7761
|
+
const name = property.getName();
|
|
7762
7762
|
const value = property.getInitializer();
|
|
7763
7763
|
if (!value)
|
|
7764
7764
|
continue;
|
|
7765
|
-
if (
|
|
7765
|
+
if (name === "type") {
|
|
7766
7766
|
type = getVuePropTypeText(value);
|
|
7767
7767
|
allowedValues = extractAllowedValues(value.getType());
|
|
7768
|
-
} else if (
|
|
7768
|
+
} else if (name === "required") {
|
|
7769
7769
|
required = value.getText() === "true";
|
|
7770
|
-
} else if (
|
|
7770
|
+
} else if (name === "default") {
|
|
7771
7771
|
defaultValue = value.getText();
|
|
7772
7772
|
}
|
|
7773
7773
|
}
|
|
@@ -8063,20 +8063,20 @@ async function extractVueComponents(filePaths, onProgress) {
|
|
|
8063
8063
|
async function extractFromVueSFC(filePath, source) {
|
|
8064
8064
|
const { descriptor, errors } = parseSFC(source);
|
|
8065
8065
|
const fileWarnings = errors.map((e) => `Parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
8066
|
-
const
|
|
8066
|
+
const name = getVueComponentName(filePath);
|
|
8067
8067
|
let props = [];
|
|
8068
8068
|
const setupProps = descriptor.scriptSetup ? await extractSetupProps(filePath, descriptor.scriptSetup.content) : null;
|
|
8069
8069
|
if (setupProps !== null) {
|
|
8070
8070
|
props = setupProps;
|
|
8071
8071
|
} else if (descriptor.script) {
|
|
8072
|
-
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings,
|
|
8072
|
+
return extractOptionsComponent(filePath, descriptor.script.content, fileWarnings, name, descriptor.template?.ast, source);
|
|
8073
8073
|
}
|
|
8074
8074
|
let slots = descriptor.template?.ast ? extractSlotsFromTemplate(descriptor.template.ast) : [];
|
|
8075
8075
|
const runtimeSlots = extractSlotsFromRuntimeAccess(source);
|
|
8076
8076
|
slots = mergeSlotsDedup(slots, runtimeSlots);
|
|
8077
8077
|
return {
|
|
8078
8078
|
component: {
|
|
8079
|
-
name
|
|
8079
|
+
name,
|
|
8080
8080
|
source: filePath,
|
|
8081
8081
|
sourcePath: filePath,
|
|
8082
8082
|
framework: "vue",
|
|
@@ -8094,7 +8094,7 @@ function getVueComponentName(filePath) {
|
|
|
8094
8094
|
const parentDirName = basename(dirname6(filePath));
|
|
8095
8095
|
return parentDirName || fileName;
|
|
8096
8096
|
}
|
|
8097
|
-
async function extractOptionsComponent(filePath, scriptContent, fileWarnings,
|
|
8097
|
+
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
8098
8098
|
const props = await extractOptionsProps(filePath, scriptContent);
|
|
8099
8099
|
let slots = templateAst ? extractSlotsFromTemplate(templateAst) : [];
|
|
8100
8100
|
if (sfcSource) {
|
|
@@ -8103,7 +8103,7 @@ async function extractOptionsComponent(filePath, scriptContent, fileWarnings, na
|
|
|
8103
8103
|
}
|
|
8104
8104
|
return {
|
|
8105
8105
|
component: {
|
|
8106
|
-
name
|
|
8106
|
+
name,
|
|
8107
8107
|
source: filePath,
|
|
8108
8108
|
sourcePath: filePath,
|
|
8109
8109
|
framework: "vue",
|
|
@@ -8176,13 +8176,13 @@ function extractGenericProps(typeText) {
|
|
|
8176
8176
|
const resolved = resolveTypeProperty(property);
|
|
8177
8177
|
if (!resolved)
|
|
8178
8178
|
continue;
|
|
8179
|
-
const { name
|
|
8179
|
+
const { name, typeText: resolvedTypeText, required } = resolved;
|
|
8180
8180
|
let typeText2 = resolvedTypeText;
|
|
8181
8181
|
if (!required) {
|
|
8182
8182
|
typeText2 = typeText2.replace(/\s*\|\s*undefined$/, "").replace(/^undefined\s*\|\s*/, "");
|
|
8183
8183
|
}
|
|
8184
8184
|
props.push({
|
|
8185
|
-
name
|
|
8185
|
+
name,
|
|
8186
8186
|
type: typeText2,
|
|
8187
8187
|
required
|
|
8188
8188
|
});
|
|
@@ -8478,14 +8478,14 @@ function parseObjectProps(obj) {
|
|
|
8478
8478
|
for (const prop of obj.getProperties()) {
|
|
8479
8479
|
if (!Node6.isPropertyAssignment(prop))
|
|
8480
8480
|
continue;
|
|
8481
|
-
const
|
|
8482
|
-
if (!isPublicVuePropName(
|
|
8481
|
+
const name = prop.getName();
|
|
8482
|
+
if (!isPublicVuePropName(name))
|
|
8483
8483
|
continue;
|
|
8484
8484
|
const init = prop.getInitializer();
|
|
8485
8485
|
if (!init || !Node6.isObjectLiteralExpression(init)) {
|
|
8486
8486
|
const initText = init?.getText() ?? "any";
|
|
8487
8487
|
result.push({
|
|
8488
|
-
name
|
|
8488
|
+
name,
|
|
8489
8489
|
type: VUE_TYPE_MAP[initText] ?? "any",
|
|
8490
8490
|
required: false,
|
|
8491
8491
|
sourceStartLine: prop.getStartLineNumber(),
|
|
@@ -8518,7 +8518,7 @@ function parseObjectProps(obj) {
|
|
|
8518
8518
|
}
|
|
8519
8519
|
}
|
|
8520
8520
|
result.push({
|
|
8521
|
-
name
|
|
8521
|
+
name,
|
|
8522
8522
|
type,
|
|
8523
8523
|
required,
|
|
8524
8524
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -8528,8 +8528,8 @@ function parseObjectProps(obj) {
|
|
|
8528
8528
|
}
|
|
8529
8529
|
return result;
|
|
8530
8530
|
}
|
|
8531
|
-
function isPublicVuePropName(
|
|
8532
|
-
return !/^[_$]/.test(
|
|
8531
|
+
function isPublicVuePropName(name) {
|
|
8532
|
+
return !/^[_$]/.test(name);
|
|
8533
8533
|
}
|
|
8534
8534
|
function extractSlotsFromTemplate(ast) {
|
|
8535
8535
|
const slots = [];
|
|
@@ -8561,10 +8561,10 @@ function extractSlotsFromRuntimeAccess(source) {
|
|
|
8561
8561
|
for (const pattern of [dotPattern, bracketPattern]) {
|
|
8562
8562
|
let match2;
|
|
8563
8563
|
while ((match2 = pattern.exec(source)) !== null) {
|
|
8564
|
-
const
|
|
8565
|
-
if (!seen.has(
|
|
8566
|
-
seen.add(
|
|
8567
|
-
slots.push({ name
|
|
8564
|
+
const name = match2[1];
|
|
8565
|
+
if (!seen.has(name)) {
|
|
8566
|
+
seen.add(name);
|
|
8567
|
+
slots.push({ name, isDefault: name === "default" });
|
|
8568
8568
|
}
|
|
8569
8569
|
}
|
|
8570
8570
|
}
|
|
@@ -8696,12 +8696,12 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
8696
8696
|
const propsTypeAlias = sf.getTypeAlias("Props");
|
|
8697
8697
|
if (propsInterface) {
|
|
8698
8698
|
for (const member of propsInterface.getProperties()) {
|
|
8699
|
-
const
|
|
8699
|
+
const name = member.getName();
|
|
8700
8700
|
const typeText = member.getTypeNode()?.getText() ?? "any";
|
|
8701
8701
|
const required = !member.hasQuestionToken();
|
|
8702
8702
|
const allowedValues = extractAllowedValues3(typeText);
|
|
8703
8703
|
props.push({
|
|
8704
|
-
name
|
|
8704
|
+
name,
|
|
8705
8705
|
type: typeText,
|
|
8706
8706
|
required,
|
|
8707
8707
|
...allowedValues && { allowedValues },
|
|
@@ -8715,10 +8715,10 @@ function extractPropsFromFrontmatter(frontmatter) {
|
|
|
8715
8715
|
const resolved = resolveTypeProperty(property);
|
|
8716
8716
|
if (!resolved)
|
|
8717
8717
|
continue;
|
|
8718
|
-
const { name
|
|
8718
|
+
const { name, declaration: decl, typeText, required } = resolved;
|
|
8719
8719
|
const allowedValues = extractAllowedValues3(typeText);
|
|
8720
8720
|
props.push({
|
|
8721
|
-
name
|
|
8721
|
+
name,
|
|
8722
8722
|
type: typeText,
|
|
8723
8723
|
required,
|
|
8724
8724
|
...allowedValues && { allowedValues },
|
|
@@ -8784,7 +8784,7 @@ function mergeSlots(...slotGroups) {
|
|
|
8784
8784
|
return merged;
|
|
8785
8785
|
}
|
|
8786
8786
|
function extractFromAstroFile(filePath, source) {
|
|
8787
|
-
const
|
|
8787
|
+
const name = basename2(filePath, ".astro");
|
|
8788
8788
|
const fenceIndex = source.startsWith("---") ? 0 : -1;
|
|
8789
8789
|
let frontmatter = "";
|
|
8790
8790
|
let template = source;
|
|
@@ -8803,7 +8803,7 @@ function extractFromAstroFile(filePath, source) {
|
|
|
8803
8803
|
});
|
|
8804
8804
|
const slots = mergeSlots(extractSlotsFromTemplate2(template), extractSlotsFromFrontmatter(frontmatter));
|
|
8805
8805
|
return {
|
|
8806
|
-
name
|
|
8806
|
+
name,
|
|
8807
8807
|
source: filePath,
|
|
8808
8808
|
sourcePath: filePath,
|
|
8809
8809
|
framework: "astro",
|
|
@@ -9023,10 +9023,10 @@ function extractSlotsFromTemplate3(templateContent) {
|
|
|
9023
9023
|
for (const match2 of templateContent.matchAll(slotRegex)) {
|
|
9024
9024
|
const attrs = match2[1] ?? "";
|
|
9025
9025
|
const nameMatch = attrs.match(/\bname=["']([^"']+)["']/);
|
|
9026
|
-
const
|
|
9027
|
-
slots.set(
|
|
9026
|
+
const name = nameMatch?.[1] ?? "default";
|
|
9027
|
+
slots.set(name, name === "default");
|
|
9028
9028
|
}
|
|
9029
|
-
return [...slots.entries()].map(([
|
|
9029
|
+
return [...slots.entries()].map(([name, isDefault]) => ({ name, isDefault })).sort((a, b) => a.name.localeCompare(b.name));
|
|
9030
9030
|
}
|
|
9031
9031
|
function mergeSlotLists(...slotLists) {
|
|
9032
9032
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -9055,20 +9055,20 @@ function extractJsDocSlots(classDecl) {
|
|
|
9055
9055
|
const comment = tag.getCommentText()?.trim();
|
|
9056
9056
|
if (!comment)
|
|
9057
9057
|
continue;
|
|
9058
|
-
let
|
|
9058
|
+
let name = "default";
|
|
9059
9059
|
let description = comment;
|
|
9060
9060
|
if (comment.startsWith("-")) {
|
|
9061
9061
|
description = comment.slice(1).trim();
|
|
9062
9062
|
} else {
|
|
9063
9063
|
const match2 = comment.match(/^(\S+)\s*-\s*(.*)$/s);
|
|
9064
9064
|
if (match2) {
|
|
9065
|
-
|
|
9065
|
+
name = match2[1];
|
|
9066
9066
|
description = match2[2].trim();
|
|
9067
9067
|
}
|
|
9068
9068
|
}
|
|
9069
9069
|
slots.push({
|
|
9070
|
-
name
|
|
9071
|
-
isDefault:
|
|
9070
|
+
name,
|
|
9071
|
+
isDefault: name === "default",
|
|
9072
9072
|
...description && { description }
|
|
9073
9073
|
});
|
|
9074
9074
|
}
|
|
@@ -9111,8 +9111,8 @@ function isNonPublicLitMember(member) {
|
|
|
9111
9111
|
function hasShoelaceRuntimeBookkeepingField(classDecl) {
|
|
9112
9112
|
return classDecl.getProperties().some((property) => property.getName() === "initialReflectedProperties");
|
|
9113
9113
|
}
|
|
9114
|
-
function isInternalRuntimeField(
|
|
9115
|
-
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(
|
|
9114
|
+
function isInternalRuntimeField(name, applyRuntimeFieldDenylist) {
|
|
9115
|
+
return applyRuntimeFieldDenylist && INTERNAL_RUNTIME_FIELD_NAMES.has(name);
|
|
9116
9116
|
}
|
|
9117
9117
|
function getExplicitLitPropertyAttributeName(property) {
|
|
9118
9118
|
const decorator = property.getDecorators().find((candidate) => candidate.getName() === "property");
|
|
@@ -9139,8 +9139,8 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
9139
9139
|
continue;
|
|
9140
9140
|
if (isNonPublicLitMember(property))
|
|
9141
9141
|
continue;
|
|
9142
|
-
const
|
|
9143
|
-
if (
|
|
9142
|
+
const name = property.getName();
|
|
9143
|
+
if (name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
9144
9144
|
continue;
|
|
9145
9145
|
const scope = property.getScope();
|
|
9146
9146
|
if (scope === "private" || scope === "protected")
|
|
@@ -9155,7 +9155,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
9155
9155
|
}
|
|
9156
9156
|
const typeNode = property.getTypeNode();
|
|
9157
9157
|
const type = typeNode ? typeNode.getText() : "any";
|
|
9158
|
-
const publicName =
|
|
9158
|
+
const publicName = name.startsWith("_") && hasDecorators ? getExplicitLitPropertyAttributeName(property) : null;
|
|
9159
9159
|
let defaultValue;
|
|
9160
9160
|
if (initializer) {
|
|
9161
9161
|
if (Node8.isStringLiteral(initializer)) {
|
|
@@ -9165,7 +9165,7 @@ function extractClassProperties(classDecl, applyRuntimeFieldDenylist = false) {
|
|
|
9165
9165
|
}
|
|
9166
9166
|
}
|
|
9167
9167
|
props.push({
|
|
9168
|
-
name: publicName ? kebabToCamel(publicName) :
|
|
9168
|
+
name: publicName ? kebabToCamel(publicName) : name,
|
|
9169
9169
|
type,
|
|
9170
9170
|
required: false,
|
|
9171
9171
|
...defaultValue !== void 0 && { defaultValue },
|
|
@@ -9185,15 +9185,15 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
9185
9185
|
continue;
|
|
9186
9186
|
if (isNonPublicLitMember(getter))
|
|
9187
9187
|
continue;
|
|
9188
|
-
const
|
|
9189
|
-
if (
|
|
9188
|
+
const name = getter.getName();
|
|
9189
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
9190
9190
|
continue;
|
|
9191
9191
|
const scope = getter.getScope();
|
|
9192
9192
|
if (scope === "private" || scope === "protected")
|
|
9193
9193
|
continue;
|
|
9194
|
-
const entry = accessors.get(
|
|
9194
|
+
const entry = accessors.get(name) ?? {};
|
|
9195
9195
|
entry.getter = getter;
|
|
9196
|
-
accessors.set(
|
|
9196
|
+
accessors.set(name, entry);
|
|
9197
9197
|
}
|
|
9198
9198
|
for (const setter of classDecl.getSetAccessors()) {
|
|
9199
9199
|
if (setter.isStatic())
|
|
@@ -9202,24 +9202,24 @@ function extractAccessorProperties(classDecl, applyRuntimeFieldDenylist = false)
|
|
|
9202
9202
|
continue;
|
|
9203
9203
|
if (isNonPublicLitMember(setter))
|
|
9204
9204
|
continue;
|
|
9205
|
-
const
|
|
9206
|
-
if (
|
|
9205
|
+
const name = setter.getName();
|
|
9206
|
+
if (name === "observedAttributes" || name === "template" || name.startsWith("#") || isInternalRuntimeField(name, applyRuntimeFieldDenylist))
|
|
9207
9207
|
continue;
|
|
9208
9208
|
const scope = setter.getScope();
|
|
9209
9209
|
if (scope === "private" || scope === "protected")
|
|
9210
9210
|
continue;
|
|
9211
|
-
const entry = accessors.get(
|
|
9211
|
+
const entry = accessors.get(name) ?? {};
|
|
9212
9212
|
entry.setter = setter;
|
|
9213
|
-
accessors.set(
|
|
9213
|
+
accessors.set(name, entry);
|
|
9214
9214
|
}
|
|
9215
|
-
for (const [
|
|
9215
|
+
for (const [name, { getter, setter }] of accessors) {
|
|
9216
9216
|
const hasPropertyDecorator = getter?.getDecorators().some((decorator) => decorator.getName() === "property") || setter?.getDecorators().some((decorator) => decorator.getName() === "property");
|
|
9217
9217
|
if (!hasPropertyDecorator && !(getter && setter))
|
|
9218
9218
|
continue;
|
|
9219
9219
|
const type = getter?.getReturnTypeNode()?.getText() ?? setter?.getParameters()[0]?.getTypeNode()?.getText() ?? "any";
|
|
9220
9220
|
const accessorNode = getter ?? setter;
|
|
9221
9221
|
props.push({
|
|
9222
|
-
name
|
|
9222
|
+
name,
|
|
9223
9223
|
type,
|
|
9224
9224
|
required: false,
|
|
9225
9225
|
...accessorNode ? {
|
|
@@ -9241,11 +9241,11 @@ function extractJsDocAttributeProps(classDecl) {
|
|
|
9241
9241
|
const match2 = normalizedComment?.match(/(?:\{([^}]+)\}\s+)?([^\s]+)(?:\s*-\s*([\s\S]*))?/);
|
|
9242
9242
|
if (!match2)
|
|
9243
9243
|
continue;
|
|
9244
|
-
const [, type,
|
|
9245
|
-
if (!
|
|
9244
|
+
const [, type, name, description] = match2;
|
|
9245
|
+
if (!name || name.startsWith("#"))
|
|
9246
9246
|
continue;
|
|
9247
9247
|
props.push({
|
|
9248
|
-
name
|
|
9248
|
+
name,
|
|
9249
9249
|
type: type?.trim() || "any",
|
|
9250
9250
|
required: false,
|
|
9251
9251
|
...description ? { description: description.replace(/\s+/g, " ").trim() } : {}
|
|
@@ -9597,7 +9597,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
9597
9597
|
const tagName = tagNameMap.get(className) ?? siblingDefinedTagName ?? decoratorTagName ?? jsDocTagName ?? fastDefinitionTagName ?? void 0;
|
|
9598
9598
|
if (!tagName)
|
|
9599
9599
|
continue;
|
|
9600
|
-
const
|
|
9600
|
+
const name = chooseComponentName(classDecl, className, tagName);
|
|
9601
9601
|
const observedAttrs = extractObservedAttributes(classDecl);
|
|
9602
9602
|
const inheritedProps = extractInheritedClassProperties(classDecl, project);
|
|
9603
9603
|
const classProps = mergePropLists(extractJsDocAttributeProps(classDecl), extractAccessorProperties(classDecl), extractClassProperties(classDecl));
|
|
@@ -9605,7 +9605,7 @@ function extractFromSourceFile4(sourceFile, project) {
|
|
|
9605
9605
|
const templateContent = extractTemplateContent(classDecl, project);
|
|
9606
9606
|
const slots = mergeSlotLists(extractInheritedSlots(classDecl, project), extractJsDocSlots(classDecl), extractSlotsFromTemplate3(templateContent), extractFastTemplateSlots(classDecl, project));
|
|
9607
9607
|
components.push({
|
|
9608
|
-
name
|
|
9608
|
+
name,
|
|
9609
9609
|
source: sourceFile.getFilePath(),
|
|
9610
9610
|
sourcePath: sourceFile.getFilePath(),
|
|
9611
9611
|
framework: "web-component",
|
|
@@ -9931,8 +9931,8 @@ async function retryComponentWithProject(component, ctx, project, warnings) {
|
|
|
9931
9931
|
}
|
|
9932
9932
|
function addImportedDeclarationsToProject(project, ctx) {
|
|
9933
9933
|
const importedNames = collectReferencedTypeNames(ctx.annotation);
|
|
9934
|
-
for (const
|
|
9935
|
-
const localDecl = findLocalTypeDeclaration(ctx.instance,
|
|
9934
|
+
for (const name of [...importedNames]) {
|
|
9935
|
+
const localDecl = findLocalTypeDeclaration(ctx.instance, name, ctx.moduleScript) ?? (ctx.moduleScript ? findLocalTypeDeclaration(ctx.moduleScript, name, ctx.instance) : null);
|
|
9936
9936
|
if (localDecl) {
|
|
9937
9937
|
for (const referenced of collectReferencedTypeNames(localDecl))
|
|
9938
9938
|
importedNames.add(referenced);
|
|
@@ -10113,21 +10113,21 @@ function collapseUnresolvedTypeWarnings(warnings) {
|
|
|
10113
10113
|
}
|
|
10114
10114
|
async function extractFromSvelteFile(filePath, source) {
|
|
10115
10115
|
const warnings = [];
|
|
10116
|
-
const
|
|
10116
|
+
const name = getSvelteComponentName(filePath);
|
|
10117
10117
|
let ast;
|
|
10118
10118
|
try {
|
|
10119
10119
|
ast = parseSvelte(source, { modern: true });
|
|
10120
10120
|
} catch (e) {
|
|
10121
10121
|
return {
|
|
10122
10122
|
component: null,
|
|
10123
|
-
warnings: [`${
|
|
10123
|
+
warnings: [`${name}: parse error in ${filePath}: ${e instanceof Error ? e.message : String(e)}`]
|
|
10124
10124
|
};
|
|
10125
10125
|
}
|
|
10126
10126
|
const instance = ast["instance"];
|
|
10127
10127
|
const moduleScript = ast["module"];
|
|
10128
10128
|
const fragment = ast["fragment"];
|
|
10129
10129
|
if (instance && hasV4ExportLetProps(instance)) {
|
|
10130
|
-
warnings.push(`${
|
|
10130
|
+
warnings.push(`${name}: Svelte 4 export let syntax not yet supported (${filePath}); see INTEG-4267 for v5-only scope and follow-up`);
|
|
10131
10131
|
return { component: null, warnings };
|
|
10132
10132
|
}
|
|
10133
10133
|
const propsCall = instance ? findPropsCall(instance) : null;
|
|
@@ -10142,7 +10142,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10142
10142
|
instance,
|
|
10143
10143
|
moduleScript,
|
|
10144
10144
|
filePath,
|
|
10145
|
-
componentName:
|
|
10145
|
+
componentName: name,
|
|
10146
10146
|
source,
|
|
10147
10147
|
snippetLocals
|
|
10148
10148
|
});
|
|
@@ -10154,12 +10154,12 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10154
10154
|
extractionReasons.push(...result.additionalReasons);
|
|
10155
10155
|
} else if (instance) {
|
|
10156
10156
|
} else {
|
|
10157
|
-
warnings.push(`${
|
|
10157
|
+
warnings.push(`${name}: no instance script block (${filePath}); no props extracted`);
|
|
10158
10158
|
}
|
|
10159
10159
|
const templateSlots = fragment ? extractTemplateSlots(fragment) : [];
|
|
10160
10160
|
const { slots, mixedWarning } = mergeSlots2(snippetSlotsFromProps, templateSlots);
|
|
10161
10161
|
if (mixedWarning) {
|
|
10162
|
-
warnings.push(`${
|
|
10162
|
+
warnings.push(`${name}: mixed Snippet and <slot> usage detected (${filePath}); preferring Snippet entries`);
|
|
10163
10163
|
}
|
|
10164
10164
|
let propsTypeNameCapture;
|
|
10165
10165
|
if (propsCall) {
|
|
@@ -10172,7 +10172,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10172
10172
|
}
|
|
10173
10173
|
}
|
|
10174
10174
|
const component = {
|
|
10175
|
-
name
|
|
10175
|
+
name,
|
|
10176
10176
|
source: filePath,
|
|
10177
10177
|
framework: "svelte",
|
|
10178
10178
|
props,
|
|
@@ -10198,7 +10198,7 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10198
10198
|
instance,
|
|
10199
10199
|
moduleScript,
|
|
10200
10200
|
annotation,
|
|
10201
|
-
componentName:
|
|
10201
|
+
componentName: name
|
|
10202
10202
|
};
|
|
10203
10203
|
}
|
|
10204
10204
|
}
|
|
@@ -10340,8 +10340,8 @@ function describeAnnotationForUser(annotation) {
|
|
|
10340
10340
|
if (!annotation)
|
|
10341
10341
|
return "<unknown>";
|
|
10342
10342
|
if (annotation.type === "TSTypeReference") {
|
|
10343
|
-
const
|
|
10344
|
-
return
|
|
10343
|
+
const name = annotation["typeName"]?.["name"] ?? null;
|
|
10344
|
+
return name ? `'${name}'` : "<unnamed reference>";
|
|
10345
10345
|
}
|
|
10346
10346
|
if (annotation.type === "TSIntersectionType")
|
|
10347
10347
|
return "<intersection>";
|
|
@@ -10416,7 +10416,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
10416
10416
|
return null;
|
|
10417
10417
|
const members = [];
|
|
10418
10418
|
for (const symbol of properties) {
|
|
10419
|
-
const
|
|
10419
|
+
const name = symbol.getName();
|
|
10420
10420
|
const declaration = symbol.getValueDeclaration() ?? symbol.getDeclarations()[0];
|
|
10421
10421
|
if (!declaration)
|
|
10422
10422
|
continue;
|
|
@@ -10431,7 +10431,7 @@ async function resolveViaTypeChecker(annotation, instance, moduleScript, filePat
|
|
|
10431
10431
|
const declaredTypeText = readDeclaredTypeNodeText(declaration);
|
|
10432
10432
|
const isSnippet = declaredTypeText !== null && isSnippetTypeText(declaredTypeText, snippetLocals) || typeRefersToSnippet(propType) || isSnippetTypeText(typeText, snippetLocals);
|
|
10433
10433
|
members.push({
|
|
10434
|
-
name
|
|
10434
|
+
name,
|
|
10435
10435
|
optional: optional5,
|
|
10436
10436
|
typeText,
|
|
10437
10437
|
...declaredTypeText ? { declaredTypeText } : {},
|
|
@@ -10519,7 +10519,7 @@ function mergeSets(a, b) {
|
|
|
10519
10519
|
out.add(v);
|
|
10520
10520
|
return out;
|
|
10521
10521
|
}
|
|
10522
|
-
function findLocalTypeDeclaration(instance,
|
|
10522
|
+
function findLocalTypeDeclaration(instance, name, module) {
|
|
10523
10523
|
for (const script of [instance, module]) {
|
|
10524
10524
|
const body = script?.["content"]?.["body"];
|
|
10525
10525
|
if (!body)
|
|
@@ -10528,7 +10528,7 @@ function findLocalTypeDeclaration(instance, name2, module) {
|
|
|
10528
10528
|
const decl = stmt.type === "ExportNamedDeclaration" ? stmt["declaration"] ?? stmt : stmt;
|
|
10529
10529
|
if (decl.type === "TSInterfaceDeclaration" || decl.type === "TSTypeAliasDeclaration") {
|
|
10530
10530
|
const id = decl["id"];
|
|
10531
|
-
if (id?.["name"] ===
|
|
10531
|
+
if (id?.["name"] === name)
|
|
10532
10532
|
return decl;
|
|
10533
10533
|
}
|
|
10534
10534
|
}
|
|
@@ -10549,8 +10549,8 @@ function readMembersFromInterfaceOrAlias(decl, snippetLocals) {
|
|
|
10549
10549
|
}
|
|
10550
10550
|
return [];
|
|
10551
10551
|
}
|
|
10552
|
-
function readMembersFromTypeLiteral(
|
|
10553
|
-
const members =
|
|
10552
|
+
function readMembersFromTypeLiteral(literal3, snippetLocals) {
|
|
10553
|
+
const members = literal3["members"];
|
|
10554
10554
|
if (!members)
|
|
10555
10555
|
return [];
|
|
10556
10556
|
return members.map((m) => readPropertySignature(m, snippetLocals)).filter((m) => !!m);
|
|
@@ -10559,8 +10559,8 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
10559
10559
|
if (member.type !== "TSPropertySignature")
|
|
10560
10560
|
return null;
|
|
10561
10561
|
const key = member["key"];
|
|
10562
|
-
const
|
|
10563
|
-
if (!
|
|
10562
|
+
const name = key?.["name"] ?? null;
|
|
10563
|
+
if (!name)
|
|
10564
10564
|
return null;
|
|
10565
10565
|
const optional5 = !!member["optional"];
|
|
10566
10566
|
const typeNode = member["typeAnnotation"]?.["typeAnnotation"];
|
|
@@ -10570,7 +10570,7 @@ function readPropertySignature(member, snippetLocals) {
|
|
|
10570
10570
|
const leading = member["leadingComments"] ?? [];
|
|
10571
10571
|
const description = extractJsdocText(leading);
|
|
10572
10572
|
return {
|
|
10573
|
-
name
|
|
10573
|
+
name,
|
|
10574
10574
|
optional: optional5,
|
|
10575
10575
|
typeText,
|
|
10576
10576
|
isSnippet,
|
|
@@ -10709,19 +10709,19 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
10709
10709
|
if (p.type !== "Property")
|
|
10710
10710
|
continue;
|
|
10711
10711
|
const key = p["key"];
|
|
10712
|
-
const
|
|
10713
|
-
if (!
|
|
10712
|
+
const name = key?.["name"] ?? null;
|
|
10713
|
+
if (!name)
|
|
10714
10714
|
continue;
|
|
10715
|
-
seenInDestructure.add(
|
|
10715
|
+
seenInDestructure.add(name);
|
|
10716
10716
|
const value = p["value"];
|
|
10717
10717
|
const hasDefault = value?.type === "AssignmentPattern";
|
|
10718
10718
|
const defaultValueRaw = hasDefault ? renderLiteral(value["right"]) : void 0;
|
|
10719
|
-
const typeMember = typeByName.get(
|
|
10719
|
+
const typeMember = typeByName.get(name);
|
|
10720
10720
|
if (typeMember?.isSnippet) {
|
|
10721
|
-
snippetNames.add(
|
|
10721
|
+
snippetNames.add(name);
|
|
10722
10722
|
const slot = {
|
|
10723
|
-
name
|
|
10724
|
-
isDefault:
|
|
10723
|
+
name,
|
|
10724
|
+
isDefault: name === "children",
|
|
10725
10725
|
...typeMember.description ? { description: typeMember.description } : {}
|
|
10726
10726
|
};
|
|
10727
10727
|
const authorText = typeMember.declaredTypeText ?? typeMember.typeText;
|
|
@@ -10732,7 +10732,7 @@ function extractFromDestructure(propsCall, _ctx, typeMembers, warnings, addition
|
|
|
10732
10732
|
}
|
|
10733
10733
|
const required = typeMember ? !typeMember.optional && !hasDefault : !hasDefault;
|
|
10734
10734
|
const propDef = {
|
|
10735
|
-
name
|
|
10735
|
+
name,
|
|
10736
10736
|
type: typeMember?.typeText ?? "unknown",
|
|
10737
10737
|
required
|
|
10738
10738
|
};
|
|
@@ -10790,9 +10790,9 @@ function propertyOrder(properties) {
|
|
|
10790
10790
|
for (const p of properties) {
|
|
10791
10791
|
if (p.type !== "Property")
|
|
10792
10792
|
continue;
|
|
10793
|
-
const
|
|
10794
|
-
if (
|
|
10795
|
-
m.set(
|
|
10793
|
+
const name = p["key"]?.["name"] ?? null;
|
|
10794
|
+
if (name)
|
|
10795
|
+
m.set(name, i++);
|
|
10796
10796
|
}
|
|
10797
10797
|
return m;
|
|
10798
10798
|
}
|
|
@@ -10971,10 +10971,10 @@ function extractTemplateSlots(fragment) {
|
|
|
10971
10971
|
if (!node)
|
|
10972
10972
|
return;
|
|
10973
10973
|
if (node.type === "SlotElement") {
|
|
10974
|
-
const
|
|
10975
|
-
if (!seen.has(
|
|
10976
|
-
seen.add(
|
|
10977
|
-
slots.push({ name
|
|
10974
|
+
const name = readSlotName(node);
|
|
10975
|
+
if (!seen.has(name)) {
|
|
10976
|
+
seen.add(name);
|
|
10977
|
+
slots.push({ name, isDefault: name === "default" });
|
|
10978
10978
|
}
|
|
10979
10979
|
}
|
|
10980
10980
|
const children = node["nodes"] ?? node["children"] ?? [];
|
|
@@ -11188,9 +11188,9 @@ function extractDecoratorInput(field) {
|
|
|
11188
11188
|
}
|
|
11189
11189
|
const resolved = resolvePropType(typeNode);
|
|
11190
11190
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11191
|
-
const
|
|
11191
|
+
const name = alias ?? fieldName;
|
|
11192
11192
|
const prop = {
|
|
11193
|
-
name
|
|
11193
|
+
name,
|
|
11194
11194
|
type: typeText,
|
|
11195
11195
|
required,
|
|
11196
11196
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -11266,9 +11266,9 @@ function extractSignalInput(field) {
|
|
|
11266
11266
|
const typeArg = init.getTypeArguments()[0];
|
|
11267
11267
|
const resolved = resolvePropType(typeArg);
|
|
11268
11268
|
const typeText = transformIsBoolean ? "boolean" : transformIsNumber ? "number" : resolved.text;
|
|
11269
|
-
const
|
|
11269
|
+
const name = alias ?? fieldName;
|
|
11270
11270
|
const prop = {
|
|
11271
|
-
name
|
|
11271
|
+
name,
|
|
11272
11272
|
type: typeText,
|
|
11273
11273
|
required,
|
|
11274
11274
|
sourceStartLine: field.getStartLineNumber(),
|
|
@@ -11361,10 +11361,10 @@ function extractProps2(cls, meta) {
|
|
|
11361
11361
|
const parsed = parseInputsArrayEntry(entry);
|
|
11362
11362
|
if (!parsed)
|
|
11363
11363
|
continue;
|
|
11364
|
-
const
|
|
11365
|
-
if (byName.has(
|
|
11364
|
+
const name = parsed.alias ?? parsed.fieldName;
|
|
11365
|
+
if (byName.has(name))
|
|
11366
11366
|
continue;
|
|
11367
|
-
byName.set(
|
|
11367
|
+
byName.set(name, { name, type: "any", required: false });
|
|
11368
11368
|
}
|
|
11369
11369
|
return [...byName.values()];
|
|
11370
11370
|
}
|
|
@@ -11513,16 +11513,16 @@ var init_resolve_template_source = __esm({
|
|
|
11513
11513
|
});
|
|
11514
11514
|
|
|
11515
11515
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/angular/helpers/resolution/strip-library-prefix.js
|
|
11516
|
-
function stripLibraryPrefix(
|
|
11516
|
+
function stripLibraryPrefix(name) {
|
|
11517
11517
|
for (const prefix of KNOWN_PREFIXES) {
|
|
11518
|
-
if (
|
|
11519
|
-
const rest =
|
|
11518
|
+
if (name.startsWith(prefix) && name.length > prefix.length) {
|
|
11519
|
+
const rest = name.slice(prefix.length);
|
|
11520
11520
|
if (rest[0] && rest[0] === rest[0].toUpperCase()) {
|
|
11521
11521
|
return rest;
|
|
11522
11522
|
}
|
|
11523
11523
|
}
|
|
11524
11524
|
}
|
|
11525
|
-
return
|
|
11525
|
+
return name;
|
|
11526
11526
|
}
|
|
11527
11527
|
var KNOWN_PREFIXES;
|
|
11528
11528
|
var init_strip_library_prefix = __esm({
|
|
@@ -11603,8 +11603,8 @@ function extractContentChildQueries(cls) {
|
|
|
11603
11603
|
if (init && Node15.isCallExpression(init)) {
|
|
11604
11604
|
const callee = init.getExpression();
|
|
11605
11605
|
if (Node15.isIdentifier(callee)) {
|
|
11606
|
-
const
|
|
11607
|
-
if (
|
|
11606
|
+
const name = callee.getText();
|
|
11607
|
+
if (name === "contentChild" || name === "contentChildren") {
|
|
11608
11608
|
const first = init.getArguments()[0];
|
|
11609
11609
|
const allowed = resolveClassIdentifierArg(first);
|
|
11610
11610
|
out.push(buildSlot(fieldName, allowed));
|
|
@@ -11633,9 +11633,9 @@ function resolveClassIdentifierArg(arg) {
|
|
|
11633
11633
|
return [arg.getText()];
|
|
11634
11634
|
return [];
|
|
11635
11635
|
}
|
|
11636
|
-
function buildSlot(
|
|
11636
|
+
function buildSlot(name, allowed) {
|
|
11637
11637
|
const slot = {
|
|
11638
|
-
name
|
|
11638
|
+
name,
|
|
11639
11639
|
isDefault: false
|
|
11640
11640
|
};
|
|
11641
11641
|
if (allowed.length > 0)
|
|
@@ -11679,11 +11679,11 @@ async function extractSlots3(cls, meta, props) {
|
|
|
11679
11679
|
const template = await resolveTemplateSource(meta);
|
|
11680
11680
|
if (template) {
|
|
11681
11681
|
for (const el of parseNgContentElements(template)) {
|
|
11682
|
-
const
|
|
11683
|
-
if (byName.has(
|
|
11682
|
+
const name = deriveSlotName(el.rawSelect, meta.normalizedName);
|
|
11683
|
+
if (byName.has(name))
|
|
11684
11684
|
continue;
|
|
11685
|
-
byName.set(
|
|
11686
|
-
name
|
|
11685
|
+
byName.set(name, {
|
|
11686
|
+
name,
|
|
11687
11687
|
isDefault: el.rawSelect === null
|
|
11688
11688
|
});
|
|
11689
11689
|
}
|
|
@@ -11777,9 +11777,9 @@ function normalizeSlots(slots) {
|
|
|
11777
11777
|
return slots.map((slot) => {
|
|
11778
11778
|
if (slot.name.trim())
|
|
11779
11779
|
return slot;
|
|
11780
|
-
const
|
|
11780
|
+
const name = fallbackIndex === 0 ? "children" : `slot_${fallbackIndex}`;
|
|
11781
11781
|
fallbackIndex++;
|
|
11782
|
-
return { ...slot, name
|
|
11782
|
+
return { ...slot, name };
|
|
11783
11783
|
});
|
|
11784
11784
|
}
|
|
11785
11785
|
var init_extract_angular_components = __esm({
|
|
@@ -12596,8 +12596,8 @@ var init_composition_cache_key = __esm({
|
|
|
12596
12596
|
|
|
12597
12597
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
12598
12598
|
import { dirname as dirname11 } from "node:path";
|
|
12599
|
-
function kebabToPascal3(
|
|
12600
|
-
return
|
|
12599
|
+
function kebabToPascal3(name) {
|
|
12600
|
+
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
12601
12601
|
}
|
|
12602
12602
|
function collectManifestEdges(files, componentNames) {
|
|
12603
12603
|
const edges = [];
|
|
@@ -13293,9 +13293,9 @@ var init_validate3 = __esm({
|
|
|
13293
13293
|
|
|
13294
13294
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js
|
|
13295
13295
|
import { createHash as createHash7 } from "node:crypto";
|
|
13296
|
-
function createComponentId(
|
|
13297
|
-
const sourceHash = createHash7("sha256").update(`${
|
|
13298
|
-
return `${
|
|
13296
|
+
function createComponentId(name, resolvedSourcePath) {
|
|
13297
|
+
const sourceHash = createHash7("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
|
|
13298
|
+
return `${name}-${sourceHash}`;
|
|
13299
13299
|
}
|
|
13300
13300
|
var init_create_component_id = __esm({
|
|
13301
13301
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/create-component-id.js"() {
|
|
@@ -13673,10 +13673,10 @@ var init_file_categories = __esm({
|
|
|
13673
13673
|
|
|
13674
13674
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/categorize-file.js
|
|
13675
13675
|
import path from "node:path";
|
|
13676
|
-
function categorizeFile(
|
|
13677
|
-
if (
|
|
13676
|
+
function categorizeFile(name) {
|
|
13677
|
+
if (name.endsWith(".d.ts"))
|
|
13678
13678
|
return "other";
|
|
13679
|
-
const ext = path.extname(
|
|
13679
|
+
const ext = path.extname(name);
|
|
13680
13680
|
return CATEGORY_BY_EXTENSION[ext] ?? "other";
|
|
13681
13681
|
}
|
|
13682
13682
|
var init_categorize_file = __esm({
|
|
@@ -13687,8 +13687,8 @@ var init_categorize_file = __esm({
|
|
|
13687
13687
|
});
|
|
13688
13688
|
|
|
13689
13689
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-noise-config-file.js
|
|
13690
|
-
function isNoiseConfigFile(
|
|
13691
|
-
return DENYLISTED_EXACT_FILE_NAMES.has(
|
|
13690
|
+
function isNoiseConfigFile(name) {
|
|
13691
|
+
return DENYLISTED_EXACT_FILE_NAMES.has(name) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name));
|
|
13692
13692
|
}
|
|
13693
13693
|
var init_is_noise_config_file = __esm({
|
|
13694
13694
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-noise-config-file.js"() {
|
|
@@ -13699,15 +13699,15 @@ var init_is_noise_config_file = __esm({
|
|
|
13699
13699
|
|
|
13700
13700
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/is-source-file.js
|
|
13701
13701
|
import path2 from "node:path";
|
|
13702
|
-
function isSourceFile(
|
|
13703
|
-
if (
|
|
13702
|
+
function isSourceFile(name) {
|
|
13703
|
+
if (name.endsWith(".d.ts"))
|
|
13704
13704
|
return false;
|
|
13705
|
-
if (EXCLUDED_SUFFIXES.some((suffix) =>
|
|
13705
|
+
if (EXCLUDED_SUFFIXES.some((suffix) => name.endsWith(suffix)))
|
|
13706
13706
|
return false;
|
|
13707
|
-
const ext = path2.extname(
|
|
13707
|
+
const ext = path2.extname(name);
|
|
13708
13708
|
if (INCLUDED_EXTENSIONS.has(ext))
|
|
13709
13709
|
return true;
|
|
13710
|
-
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(
|
|
13710
|
+
if (DENYLIST_GATED_EXTENSIONS.has(ext) && !isNoiseConfigFile(name))
|
|
13711
13711
|
return true;
|
|
13712
13712
|
return false;
|
|
13713
13713
|
}
|
|
@@ -14023,7 +14023,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
14023
14023
|
const seen = /* @__PURE__ */ new Set();
|
|
14024
14024
|
for (const row of rows) {
|
|
14025
14025
|
const sourcePath = rowField(row, "source_path");
|
|
14026
|
-
const
|
|
14026
|
+
const name = rowField(row, "name");
|
|
14027
14027
|
if (!sourcePath)
|
|
14028
14028
|
continue;
|
|
14029
14029
|
const abs = resolve17(sourcePath);
|
|
@@ -14033,8 +14033,8 @@ async function buildSourceFingerprint(opts) {
|
|
|
14033
14033
|
try {
|
|
14034
14034
|
const st = await stat(abs);
|
|
14035
14035
|
const entry = { mtime: st.mtime.toISOString() };
|
|
14036
|
-
if (
|
|
14037
|
-
entry.componentName =
|
|
14036
|
+
if (name)
|
|
14037
|
+
entry.componentName = name;
|
|
14038
14038
|
files[abs] = entry;
|
|
14039
14039
|
} catch {
|
|
14040
14040
|
}
|
|
@@ -14075,10 +14075,10 @@ import { access as access4 } from "node:fs/promises";
|
|
|
14075
14075
|
import { join as join9 } from "node:path";
|
|
14076
14076
|
async function listConflictingFiles(path5) {
|
|
14077
14077
|
const conflicts = [];
|
|
14078
|
-
for (const
|
|
14078
|
+
for (const name of SAVE_FILES) {
|
|
14079
14079
|
try {
|
|
14080
|
-
await access4(join9(path5,
|
|
14081
|
-
conflicts.push(
|
|
14080
|
+
await access4(join9(path5, name));
|
|
14081
|
+
conflicts.push(name);
|
|
14082
14082
|
} catch {
|
|
14083
14083
|
}
|
|
14084
14084
|
}
|
|
@@ -14584,18 +14584,18 @@ var init_pathSerializer_gen = __esm({
|
|
|
14584
14584
|
return "&";
|
|
14585
14585
|
}
|
|
14586
14586
|
};
|
|
14587
|
-
serializeArrayParam = ({ allowReserved, explode, name
|
|
14587
|
+
serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
14588
14588
|
if (!explode) {
|
|
14589
14589
|
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
14590
14590
|
switch (style) {
|
|
14591
14591
|
case "label":
|
|
14592
14592
|
return `.${joinedValues2}`;
|
|
14593
14593
|
case "matrix":
|
|
14594
|
-
return `;${
|
|
14594
|
+
return `;${name}=${joinedValues2}`;
|
|
14595
14595
|
case "simple":
|
|
14596
14596
|
return joinedValues2;
|
|
14597
14597
|
default:
|
|
14598
|
-
return `${
|
|
14598
|
+
return `${name}=${joinedValues2}`;
|
|
14599
14599
|
}
|
|
14600
14600
|
}
|
|
14601
14601
|
const separator = separatorArrayExplode(style);
|
|
@@ -14605,24 +14605,24 @@ var init_pathSerializer_gen = __esm({
|
|
|
14605
14605
|
}
|
|
14606
14606
|
return serializePrimitiveParam({
|
|
14607
14607
|
allowReserved,
|
|
14608
|
-
name
|
|
14608
|
+
name,
|
|
14609
14609
|
value: v
|
|
14610
14610
|
});
|
|
14611
14611
|
}).join(separator);
|
|
14612
14612
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
14613
14613
|
};
|
|
14614
|
-
serializePrimitiveParam = ({ allowReserved, name
|
|
14614
|
+
serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
14615
14615
|
if (value === void 0 || value === null) {
|
|
14616
14616
|
return "";
|
|
14617
14617
|
}
|
|
14618
14618
|
if (typeof value === "object") {
|
|
14619
14619
|
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
|
|
14620
14620
|
}
|
|
14621
|
-
return `${
|
|
14621
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
14622
14622
|
};
|
|
14623
|
-
serializeObjectParam = ({ allowReserved, explode, name
|
|
14623
|
+
serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
14624
14624
|
if (value instanceof Date) {
|
|
14625
|
-
return valueOnly ? value.toISOString() : `${
|
|
14625
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
14626
14626
|
}
|
|
14627
14627
|
if (style !== "deepObject" && !explode) {
|
|
14628
14628
|
let values = [];
|
|
@@ -14636,11 +14636,11 @@ var init_pathSerializer_gen = __esm({
|
|
|
14636
14636
|
const joinedValues2 = values.join(",");
|
|
14637
14637
|
switch (style) {
|
|
14638
14638
|
case "form":
|
|
14639
|
-
return `${
|
|
14639
|
+
return `${name}=${joinedValues2}`;
|
|
14640
14640
|
case "label":
|
|
14641
14641
|
return `.${joinedValues2}`;
|
|
14642
14642
|
case "matrix":
|
|
14643
|
-
return `;${
|
|
14643
|
+
return `;${name}=${joinedValues2}`;
|
|
14644
14644
|
default:
|
|
14645
14645
|
return joinedValues2;
|
|
14646
14646
|
}
|
|
@@ -14648,7 +14648,7 @@ var init_pathSerializer_gen = __esm({
|
|
|
14648
14648
|
const separator = separatorObjectExplode(style);
|
|
14649
14649
|
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
14650
14650
|
allowReserved,
|
|
14651
|
-
name: style === "deepObject" ? `${
|
|
14651
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
14652
14652
|
value: v
|
|
14653
14653
|
})).join(separator);
|
|
14654
14654
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
@@ -14671,31 +14671,31 @@ var init_utils_gen = __esm({
|
|
|
14671
14671
|
if (matches) {
|
|
14672
14672
|
for (const match2 of matches) {
|
|
14673
14673
|
let explode = false;
|
|
14674
|
-
let
|
|
14674
|
+
let name = match2.substring(1, match2.length - 1);
|
|
14675
14675
|
let style = "simple";
|
|
14676
|
-
if (
|
|
14676
|
+
if (name.endsWith("*")) {
|
|
14677
14677
|
explode = true;
|
|
14678
|
-
|
|
14678
|
+
name = name.substring(0, name.length - 1);
|
|
14679
14679
|
}
|
|
14680
|
-
if (
|
|
14681
|
-
|
|
14680
|
+
if (name.startsWith(".")) {
|
|
14681
|
+
name = name.substring(1);
|
|
14682
14682
|
style = "label";
|
|
14683
|
-
} else if (
|
|
14684
|
-
|
|
14683
|
+
} else if (name.startsWith(";")) {
|
|
14684
|
+
name = name.substring(1);
|
|
14685
14685
|
style = "matrix";
|
|
14686
14686
|
}
|
|
14687
|
-
const value = path5[
|
|
14687
|
+
const value = path5[name];
|
|
14688
14688
|
if (value === void 0 || value === null) {
|
|
14689
14689
|
continue;
|
|
14690
14690
|
}
|
|
14691
14691
|
if (Array.isArray(value)) {
|
|
14692
|
-
url = url.replace(match2, serializeArrayParam({ explode, name
|
|
14692
|
+
url = url.replace(match2, serializeArrayParam({ explode, name, style, value }));
|
|
14693
14693
|
continue;
|
|
14694
14694
|
}
|
|
14695
14695
|
if (typeof value === "object") {
|
|
14696
14696
|
url = url.replace(match2, serializeObjectParam({
|
|
14697
14697
|
explode,
|
|
14698
|
-
name
|
|
14698
|
+
name,
|
|
14699
14699
|
style,
|
|
14700
14700
|
value,
|
|
14701
14701
|
valueOnly: true
|
|
@@ -14704,7 +14704,7 @@ var init_utils_gen = __esm({
|
|
|
14704
14704
|
}
|
|
14705
14705
|
if (style === "matrix") {
|
|
14706
14706
|
url = url.replace(match2, `;${serializePrimitiveParam({
|
|
14707
|
-
name
|
|
14707
|
+
name,
|
|
14708
14708
|
value
|
|
14709
14709
|
})}`);
|
|
14710
14710
|
continue;
|
|
@@ -14715,12 +14715,12 @@ var init_utils_gen = __esm({
|
|
|
14715
14715
|
}
|
|
14716
14716
|
return url;
|
|
14717
14717
|
};
|
|
14718
|
-
createQuerySerializer = ({ allowReserved, array:
|
|
14718
|
+
createQuerySerializer = ({ allowReserved, array: array3, object } = {}) => {
|
|
14719
14719
|
const querySerializer = (queryParams) => {
|
|
14720
14720
|
const search = [];
|
|
14721
14721
|
if (queryParams && typeof queryParams === "object") {
|
|
14722
|
-
for (const
|
|
14723
|
-
const value = queryParams[
|
|
14722
|
+
for (const name in queryParams) {
|
|
14723
|
+
const value = queryParams[name];
|
|
14724
14724
|
if (value === void 0 || value === null) {
|
|
14725
14725
|
continue;
|
|
14726
14726
|
}
|
|
@@ -14728,10 +14728,10 @@ var init_utils_gen = __esm({
|
|
|
14728
14728
|
const serializedArray = serializeArrayParam({
|
|
14729
14729
|
allowReserved,
|
|
14730
14730
|
explode: true,
|
|
14731
|
-
name
|
|
14731
|
+
name,
|
|
14732
14732
|
style: "form",
|
|
14733
14733
|
value,
|
|
14734
|
-
...
|
|
14734
|
+
...array3
|
|
14735
14735
|
});
|
|
14736
14736
|
if (serializedArray)
|
|
14737
14737
|
search.push(serializedArray);
|
|
@@ -14739,7 +14739,7 @@ var init_utils_gen = __esm({
|
|
|
14739
14739
|
const serializedObject = serializeObjectParam({
|
|
14740
14740
|
allowReserved,
|
|
14741
14741
|
explode: true,
|
|
14742
|
-
name
|
|
14742
|
+
name,
|
|
14743
14743
|
style: "deepObject",
|
|
14744
14744
|
value,
|
|
14745
14745
|
...object
|
|
@@ -14749,7 +14749,7 @@ var init_utils_gen = __esm({
|
|
|
14749
14749
|
} else {
|
|
14750
14750
|
const serializedPrimitive = serializePrimitiveParam({
|
|
14751
14751
|
allowReserved,
|
|
14752
|
-
name
|
|
14752
|
+
name,
|
|
14753
14753
|
value
|
|
14754
14754
|
});
|
|
14755
14755
|
if (serializedPrimitive)
|
|
@@ -14783,11 +14783,11 @@ var init_utils_gen = __esm({
|
|
|
14783
14783
|
}
|
|
14784
14784
|
return;
|
|
14785
14785
|
};
|
|
14786
|
-
checkForExistence = (options,
|
|
14787
|
-
if (!
|
|
14786
|
+
checkForExistence = (options, name) => {
|
|
14787
|
+
if (!name) {
|
|
14788
14788
|
return false;
|
|
14789
14789
|
}
|
|
14790
|
-
if (options.headers.has(
|
|
14790
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
14791
14791
|
return true;
|
|
14792
14792
|
}
|
|
14793
14793
|
return false;
|
|
@@ -14801,20 +14801,20 @@ var init_utils_gen = __esm({
|
|
|
14801
14801
|
if (!token) {
|
|
14802
14802
|
continue;
|
|
14803
14803
|
}
|
|
14804
|
-
const
|
|
14804
|
+
const name = auth.name ?? "Authorization";
|
|
14805
14805
|
switch (auth.in) {
|
|
14806
14806
|
case "query":
|
|
14807
14807
|
if (!options.query) {
|
|
14808
14808
|
options.query = {};
|
|
14809
14809
|
}
|
|
14810
|
-
options.query[
|
|
14810
|
+
options.query[name] = token;
|
|
14811
14811
|
break;
|
|
14812
14812
|
case "cookie":
|
|
14813
|
-
options.headers.append("Cookie", `${
|
|
14813
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
14814
14814
|
break;
|
|
14815
14815
|
case "header":
|
|
14816
14816
|
default:
|
|
14817
|
-
options.headers.set(
|
|
14817
|
+
options.headers.set(name, token);
|
|
14818
14818
|
break;
|
|
14819
14819
|
}
|
|
14820
14820
|
}
|
|
@@ -15972,11 +15972,11 @@ function parseEdsiError(rawInput) {
|
|
|
15972
15972
|
...binding.diagnostics ? { diagnostics: binding.diagnostics } : {}
|
|
15973
15973
|
};
|
|
15974
15974
|
}
|
|
15975
|
-
const
|
|
15976
|
-
if (
|
|
15975
|
+
const literal3 = parseObjectLiteralTail(cleaned);
|
|
15976
|
+
if (literal3 && (literal3.code || literal3.cycle)) {
|
|
15977
15977
|
const braceStart = cleaned.lastIndexOf("{");
|
|
15978
15978
|
const head = braceStart === -1 ? cleaned : cleaned.slice(0, braceStart).trim();
|
|
15979
|
-
return { code:
|
|
15979
|
+
return { code: literal3.code ?? null, message: head || cleaned, cycle: literal3.cycle ?? null, raw: false };
|
|
15980
15980
|
}
|
|
15981
15981
|
return { code: null, message: cleaned || prefix || rawInput, cycle: null, raw: true };
|
|
15982
15982
|
}
|
|
@@ -16382,8 +16382,8 @@ var init_count_character_edits = __esm({
|
|
|
16382
16382
|
});
|
|
16383
16383
|
|
|
16384
16384
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/simplify-name-for-comparison.js
|
|
16385
|
-
function simplifyNameForComparison(
|
|
16386
|
-
const stripped =
|
|
16385
|
+
function simplifyNameForComparison(name) {
|
|
16386
|
+
const stripped = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
16387
16387
|
return stripped.endsWith("s") && stripped.length > 1 ? stripped.slice(0, -1) : stripped;
|
|
16388
16388
|
}
|
|
16389
16389
|
var init_simplify_name_for_comparison = __esm({
|
|
@@ -16774,9 +16774,9 @@ var init_apply_map_token_prop_calls = __esm({
|
|
|
16774
16774
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
|
|
16775
16775
|
import { execFile } from "node:child_process";
|
|
16776
16776
|
import { promisify } from "node:util";
|
|
16777
|
-
async function binaryExists(
|
|
16777
|
+
async function binaryExists(name) {
|
|
16778
16778
|
try {
|
|
16779
|
-
await execFileAsync(process.platform === "win32" ? "where" : "which", [
|
|
16779
|
+
await execFileAsync(process.platform === "win32" ? "where" : "which", [name]);
|
|
16780
16780
|
return true;
|
|
16781
16781
|
} catch {
|
|
16782
16782
|
return false;
|
|
@@ -17474,20 +17474,20 @@ function collectSiblingRendererImports(sourceText) {
|
|
|
17474
17474
|
continue;
|
|
17475
17475
|
if (/-g(?:ql|gl)(?:$|\.)/i.test(importPath))
|
|
17476
17476
|
continue;
|
|
17477
|
-
for (const
|
|
17478
|
-
if (
|
|
17479
|
-
names.add(
|
|
17477
|
+
for (const name of parseImportedNames(importClause)) {
|
|
17478
|
+
if (name)
|
|
17479
|
+
names.add(name);
|
|
17480
17480
|
}
|
|
17481
17481
|
}
|
|
17482
17482
|
return [...names];
|
|
17483
17483
|
}
|
|
17484
17484
|
function hasSiblingForwardRender(sourceText, siblingImports) {
|
|
17485
|
-
return siblingImports.some((
|
|
17486
|
-
const renderPattern = new RegExp(`<${escapeRegExp(
|
|
17485
|
+
return siblingImports.some((name) => {
|
|
17486
|
+
const renderPattern = new RegExp(`<${escapeRegExp(name)}\\b[\\s\\S]*?(?:/>|</${escapeRegExp(name)}>)`);
|
|
17487
17487
|
if (!renderPattern.test(sourceText))
|
|
17488
17488
|
return false;
|
|
17489
|
-
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
17490
|
-
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(
|
|
17489
|
+
const siblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\b[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
17490
|
+
const propsPlusSiblingSpreadPattern = new RegExp(`<${escapeRegExp(name)}\\b[^>]*\\{\\.\\.\\.props\\}[^>]*\\{\\.\\.\\.(?!props\\b)[^}]+\\}`);
|
|
17491
17491
|
return siblingSpreadPattern.test(sourceText) || propsPlusSiblingSpreadPattern.test(sourceText);
|
|
17492
17492
|
});
|
|
17493
17493
|
}
|
|
@@ -17704,34 +17704,34 @@ function isNumberType(type) {
|
|
|
17704
17704
|
function isComplexType(type) {
|
|
17705
17705
|
return !isSimpleType(type);
|
|
17706
17706
|
}
|
|
17707
|
-
function isDomPassThroughProp(
|
|
17708
|
-
if (DOM_PASS_THROUGH_PROPS.has(
|
|
17707
|
+
function isDomPassThroughProp(name) {
|
|
17708
|
+
if (DOM_PASS_THROUGH_PROPS.has(name))
|
|
17709
17709
|
return true;
|
|
17710
|
-
if (/^aria[-A-Z]/.test(
|
|
17710
|
+
if (/^aria[-A-Z]/.test(name))
|
|
17711
17711
|
return true;
|
|
17712
|
-
return
|
|
17712
|
+
return name.startsWith("data-");
|
|
17713
17713
|
}
|
|
17714
17714
|
function preClassifyProp(prop) {
|
|
17715
|
-
const { name
|
|
17716
|
-
if (/^on[A-Z]/.test(
|
|
17715
|
+
const { name, type } = prop;
|
|
17716
|
+
if (/^on[A-Z]/.test(name) || type.includes("=> void") || type.includes("EventHandler")) {
|
|
17717
17717
|
return { category: "exclude" };
|
|
17718
17718
|
}
|
|
17719
|
-
if (
|
|
17719
|
+
if (name === "ref" || name === "innerRef" || type.includes("Ref<") || type.includes("RefObject<")) {
|
|
17720
17720
|
return { category: "exclude" };
|
|
17721
17721
|
}
|
|
17722
|
-
if (
|
|
17722
|
+
if (name === "testId" || name === "data-testid" || name === "dataTestId") {
|
|
17723
17723
|
return { category: "exclude" };
|
|
17724
17724
|
}
|
|
17725
|
-
if (
|
|
17725
|
+
if (name === "key") {
|
|
17726
17726
|
return { category: "exclude" };
|
|
17727
17727
|
}
|
|
17728
17728
|
if (type.includes("Dispatch<") || type.includes("SetStateAction")) {
|
|
17729
17729
|
return { category: "exclude" };
|
|
17730
17730
|
}
|
|
17731
|
-
if (isDomPassThroughProp(
|
|
17731
|
+
if (isDomPassThroughProp(name)) {
|
|
17732
17732
|
return { category: "exclude" };
|
|
17733
17733
|
}
|
|
17734
|
-
if (
|
|
17734
|
+
if (name === "name" && prop.domAttribute) {
|
|
17735
17735
|
return { category: "exclude" };
|
|
17736
17736
|
}
|
|
17737
17737
|
if (isStringLiteralUnion(type)) {
|
|
@@ -17740,36 +17740,36 @@ function preClassifyProp(prop) {
|
|
|
17740
17740
|
if (!isComplexType(type)) {
|
|
17741
17741
|
const designNameStart = /^(variant|size|spacing|gap|color|bg|theme|align|layout|orientation|position)/i;
|
|
17742
17742
|
const designNameEnd = /(Color|Size|Variant|Style)$/;
|
|
17743
|
-
if (designNameStart.test(
|
|
17743
|
+
if (designNameStart.test(name) || designNameEnd.test(name)) {
|
|
17744
17744
|
return { category: "design", cdfTypeHint: "string" };
|
|
17745
17745
|
}
|
|
17746
17746
|
}
|
|
17747
17747
|
if (isBooleanType(type)) {
|
|
17748
17748
|
const stateNames = ["disabled", "loading", "expanded", "isOpen", "selected", "checked", "active", "preview"];
|
|
17749
|
-
if (stateNames.includes(
|
|
17749
|
+
if (stateNames.includes(name)) {
|
|
17750
17750
|
return { category: "state", cdfTypeHint: "boolean" };
|
|
17751
17751
|
}
|
|
17752
17752
|
}
|
|
17753
17753
|
if (isBooleanType(type)) {
|
|
17754
17754
|
const visualToggle = /^(hide|show|enable|disable|vertical|horizontal|reverse|bold|italic|imageOn|with)/i;
|
|
17755
|
-
if (visualToggle.test(
|
|
17755
|
+
if (visualToggle.test(name)) {
|
|
17756
17756
|
return { category: "design", cdfTypeHint: "boolean" };
|
|
17757
17757
|
}
|
|
17758
17758
|
}
|
|
17759
|
-
if (
|
|
17759
|
+
if (name === "componentId" || name === "sectionKey" || name === "locale" || name === "variantIndex") {
|
|
17760
17760
|
return { category: "state", cdfTypeHint: "string" };
|
|
17761
17761
|
}
|
|
17762
17762
|
if (isStringType(type)) {
|
|
17763
17763
|
const urlNameStart = /^(href|url|link|src)/i;
|
|
17764
17764
|
const urlNameEnd = /(Url|Href|Link|Src)$/;
|
|
17765
|
-
if (urlNameStart.test(
|
|
17765
|
+
if (urlNameStart.test(name) || urlNameEnd.test(name)) {
|
|
17766
17766
|
return { category: "content", cdfTypeHint: "string" };
|
|
17767
17767
|
}
|
|
17768
17768
|
}
|
|
17769
17769
|
if (isStringType(type)) {
|
|
17770
17770
|
const textNameStart = /^(label|title|text|description|caption|heading|subheading|body|alt|name|placeholder|summary)/i;
|
|
17771
17771
|
const textNameEnd = /(Text|Label|Title|Name)$/;
|
|
17772
|
-
if (textNameStart.test(
|
|
17772
|
+
if (textNameStart.test(name) || textNameEnd.test(name)) {
|
|
17773
17773
|
return { category: "content", cdfTypeHint: "string" };
|
|
17774
17774
|
}
|
|
17775
17775
|
}
|
|
@@ -18085,7 +18085,7 @@ async function resolveComposition(request) {
|
|
|
18085
18085
|
timeoutMs: 12e4,
|
|
18086
18086
|
promptViaStdin: true,
|
|
18087
18087
|
bedrock,
|
|
18088
|
-
onDebugEvent: (
|
|
18088
|
+
onDebugEvent: (name, payload) => onDebugEvent?.("agent", { event: name, ...payload })
|
|
18089
18089
|
});
|
|
18090
18090
|
lastAgentExitCode = res.exitCode;
|
|
18091
18091
|
if (res.exitCode !== 0 && res.stderr.trim()) {
|
|
@@ -18397,7 +18397,7 @@ function collectDuplicateNames(components) {
|
|
|
18397
18397
|
sources.push(c2.source);
|
|
18398
18398
|
nameCounts.set(c2.name, sources);
|
|
18399
18399
|
}
|
|
18400
|
-
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([
|
|
18400
|
+
return [...nameCounts.entries()].filter(([, srcs]) => srcs.length > 1).map(([name, sources]) => ({ name, sources }));
|
|
18401
18401
|
}
|
|
18402
18402
|
var init_collect_duplicate_names = __esm({
|
|
18403
18403
|
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/collect-duplicate-names.js"() {
|
|
@@ -18512,7 +18512,7 @@ async function runOneGenerateComponent(options, component, index, total) {
|
|
|
18512
18512
|
});
|
|
18513
18513
|
}
|
|
18514
18514
|
}
|
|
18515
|
-
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((
|
|
18515
|
+
effectiveSlots = effectiveSlots.map((slot) => slot.allowedComponents ? { ...slot, allowedComponents: slot.allowedComponents.filter((name) => allowedComponentNames2.has(name)) } : slot);
|
|
18516
18516
|
const cacheComponent = normalizeComponentForCache(component);
|
|
18517
18517
|
if (!noCache && precomputedCachedNames.has(component.name)) {
|
|
18518
18518
|
onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
|
|
@@ -19020,7 +19020,7 @@ var init_v1_store = __esm({
|
|
|
19020
19020
|
|
|
19021
19021
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-store.ts
|
|
19022
19022
|
function emptyAgents() {
|
|
19023
|
-
return Object.fromEntries(AGENT_NAMES.map((
|
|
19023
|
+
return Object.fromEntries(AGENT_NAMES.map((name) => [name, { model: "", binary: "" }]));
|
|
19024
19024
|
}
|
|
19025
19025
|
async function readAgentConfig() {
|
|
19026
19026
|
const store = await readV1Store();
|
|
@@ -19030,11 +19030,11 @@ async function readAgentConfig() {
|
|
|
19030
19030
|
const agents = emptyAgents();
|
|
19031
19031
|
const saved = store["agents"];
|
|
19032
19032
|
if (saved && typeof saved === "object") {
|
|
19033
|
-
for (const
|
|
19034
|
-
const entry = saved[
|
|
19033
|
+
for (const name of AGENT_NAMES) {
|
|
19034
|
+
const entry = saved[name];
|
|
19035
19035
|
if (entry && typeof entry === "object") {
|
|
19036
19036
|
const fields2 = entry;
|
|
19037
|
-
agents[
|
|
19037
|
+
agents[name] = { model: asString(fields2["model"]), binary: asString(fields2["binary"]) };
|
|
19038
19038
|
}
|
|
19039
19039
|
}
|
|
19040
19040
|
}
|
|
@@ -19047,10 +19047,10 @@ async function writeAgentConfig(config) {
|
|
|
19047
19047
|
const existing = await readV1Store();
|
|
19048
19048
|
const merged = { ...existing };
|
|
19049
19049
|
const agents = {};
|
|
19050
|
-
for (const
|
|
19051
|
-
const model = config.agents[
|
|
19052
|
-
const binary = config.agents[
|
|
19053
|
-
if (model || binary) agents[
|
|
19050
|
+
for (const name of AGENT_NAMES) {
|
|
19051
|
+
const model = config.agents[name].model.trim();
|
|
19052
|
+
const binary = config.agents[name].binary.trim();
|
|
19053
|
+
if (model || binary) agents[name] = { ...model ? { model } : {}, ...binary ? { binary } : {} };
|
|
19054
19054
|
}
|
|
19055
19055
|
const defaultModel = config.defaultChosen ? agents[config.defaultAgent]?.model : void 0;
|
|
19056
19056
|
if (config.defaultChosen) merged["agent"] = config.defaultAgent;
|
|
@@ -19080,9 +19080,9 @@ var init_agent_store = __esm({
|
|
|
19080
19080
|
|
|
19081
19081
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/apply-binary-overrides.ts
|
|
19082
19082
|
function applyBinaryOverrides(config) {
|
|
19083
|
-
for (const
|
|
19084
|
-
const key = `EDS_AGENT_BINARY_${
|
|
19085
|
-
const binary = config.agents[
|
|
19083
|
+
for (const name of AGENT_NAMES) {
|
|
19084
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
19085
|
+
const binary = config.agents[name].binary.trim();
|
|
19086
19086
|
if (binary) {
|
|
19087
19087
|
if (!shellValues.has(key)) shellValues.set(key, process.env[key]);
|
|
19088
19088
|
process.env[key] = binary;
|
|
@@ -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((name2) => SESSION_FOLDER.test(name2));
|
|
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
|
);
|
|
@@ -22399,7 +22051,7 @@ function collectDependents(components) {
|
|
|
22399
22051
|
function findRoots(components, selected) {
|
|
22400
22052
|
const scope = selected ? components.filter((c2) => selected.has(c2.name)) : components;
|
|
22401
22053
|
const dependents = collectDependents(scope);
|
|
22402
|
-
return scope.map((c2) => c2.name).filter((
|
|
22054
|
+
return scope.map((c2) => c2.name).filter((name) => !dependents.has(name)).sort();
|
|
22403
22055
|
}
|
|
22404
22056
|
function findCycleInClosure(root, reachable, components) {
|
|
22405
22057
|
const scopedComponents = components.filter((c2) => reachable.has(c2.name)).map((c2) => ({ name: c2.name, slots: c2.slots }));
|
|
@@ -22435,9 +22087,9 @@ function computeClosure(root, components) {
|
|
|
22435
22087
|
const reachable = walkReachable2(root, byName, known);
|
|
22436
22088
|
const cyclePath = findCycleInClosure(root, reachable, components);
|
|
22437
22089
|
if (cyclePath) {
|
|
22438
|
-
const nodes2 = [...reachable].sort().map((
|
|
22439
|
-
name
|
|
22440
|
-
depth:
|
|
22090
|
+
const nodes2 = [...reachable].sort().map((name) => ({
|
|
22091
|
+
name,
|
|
22092
|
+
depth: name === root ? 0 : 1,
|
|
22441
22093
|
path: [root],
|
|
22442
22094
|
parents: []
|
|
22443
22095
|
}));
|
|
@@ -22473,12 +22125,12 @@ function computeClosure(root, components) {
|
|
|
22473
22125
|
}
|
|
22474
22126
|
}
|
|
22475
22127
|
const nodes = [];
|
|
22476
|
-
for (const [
|
|
22128
|
+
for (const [name, d] of depth.entries()) {
|
|
22477
22129
|
nodes.push({
|
|
22478
|
-
name
|
|
22130
|
+
name,
|
|
22479
22131
|
depth: d,
|
|
22480
|
-
path: parentPath.get(
|
|
22481
|
-
parents: [...parents.get(
|
|
22132
|
+
path: parentPath.get(name),
|
|
22133
|
+
parents: [...parents.get(name) ?? /* @__PURE__ */ new Set()].sort()
|
|
22482
22134
|
});
|
|
22483
22135
|
}
|
|
22484
22136
|
nodes.sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name));
|
|
@@ -22501,8 +22153,8 @@ function findSharedDeps(closures) {
|
|
|
22501
22153
|
}
|
|
22502
22154
|
}
|
|
22503
22155
|
const out = /* @__PURE__ */ new Map();
|
|
22504
|
-
for (const [
|
|
22505
|
-
if (roots.length >= 2) out.set(
|
|
22156
|
+
for (const [name, roots] of counts.entries()) {
|
|
22157
|
+
if (roots.length >= 2) out.set(name, [...roots].sort());
|
|
22506
22158
|
}
|
|
22507
22159
|
return out;
|
|
22508
22160
|
}
|
|
@@ -22713,13 +22365,13 @@ function buildVisibleRows(props) {
|
|
|
22713
22365
|
...findRoots(subgraph),
|
|
22714
22366
|
...subgraph.filter((n) => hasDirectChild(n)).map((n) => n.name)
|
|
22715
22367
|
]);
|
|
22716
|
-
for (const
|
|
22717
|
-
const full = computeClosure(
|
|
22718
|
-
closures.set(
|
|
22368
|
+
for (const name of [...parentNames].sort()) {
|
|
22369
|
+
const full = computeClosure(name, subgraph);
|
|
22370
|
+
closures.set(name, { ...full, nodes: full.nodes.filter((n) => n.depth <= 1) });
|
|
22719
22371
|
}
|
|
22720
22372
|
const sharedDeps = findSharedDeps(closures);
|
|
22721
|
-
const hasCycleDepDirect = (
|
|
22722
|
-
const it = itemByKey.get(
|
|
22373
|
+
const hasCycleDepDirect = (name) => {
|
|
22374
|
+
const it = itemByKey.get(name)?.it;
|
|
22723
22375
|
if (!it) return false;
|
|
22724
22376
|
for (const target of allowedComponentNames(it.entry)) {
|
|
22725
22377
|
if (cycleParticipants.has(target)) return true;
|
|
@@ -22824,28 +22476,28 @@ function buildVisibleRows(props) {
|
|
|
22824
22476
|
});
|
|
22825
22477
|
});
|
|
22826
22478
|
}
|
|
22827
|
-
for (const
|
|
22828
|
-
const rec = itemByKey.get(
|
|
22479
|
+
for (const name of standaloneRoots) {
|
|
22480
|
+
const rec = itemByKey.get(name);
|
|
22829
22481
|
if (!rec) continue;
|
|
22830
22482
|
rows.push({
|
|
22831
22483
|
kind: "standalone",
|
|
22832
|
-
key: `stand:${
|
|
22833
|
-
label:
|
|
22484
|
+
key: `stand:${name}`,
|
|
22485
|
+
label: name,
|
|
22834
22486
|
indent: 0,
|
|
22835
22487
|
itemIdx: rec.idx
|
|
22836
22488
|
});
|
|
22837
22489
|
}
|
|
22838
22490
|
const nodeByName = new Map(subgraph.map((n) => [n.name, n]));
|
|
22839
|
-
const sharedLeafNames = [...sharedDeps.keys()].filter((
|
|
22491
|
+
const sharedLeafNames = [...sharedDeps.keys()].filter((name) => (nodeByName.get(name)?.slots.length ?? 0) === 0).sort();
|
|
22840
22492
|
const seenStandaloneNames = new Set(standaloneRoots);
|
|
22841
|
-
for (const
|
|
22842
|
-
if (seenStandaloneNames.has(
|
|
22843
|
-
const rec = itemByKey.get(
|
|
22493
|
+
for (const name of sharedLeafNames) {
|
|
22494
|
+
if (seenStandaloneNames.has(name)) continue;
|
|
22495
|
+
const rec = itemByKey.get(name);
|
|
22844
22496
|
if (!rec) continue;
|
|
22845
22497
|
rows.push({
|
|
22846
22498
|
kind: "standalone",
|
|
22847
|
-
key: `shared-standalone:${
|
|
22848
|
-
label: `${
|
|
22499
|
+
key: `shared-standalone:${name}`,
|
|
22500
|
+
label: `${name} (shared)`,
|
|
22849
22501
|
indent: 0,
|
|
22850
22502
|
sharedSuffix: true,
|
|
22851
22503
|
itemIdx: rec.idx
|
|
@@ -22861,13 +22513,13 @@ function buildVisibleRows(props) {
|
|
|
22861
22513
|
indent: 0,
|
|
22862
22514
|
itemIdx: -1
|
|
22863
22515
|
});
|
|
22864
|
-
for (const
|
|
22865
|
-
const rec = itemByKey.get(
|
|
22516
|
+
for (const name of flatNames) {
|
|
22517
|
+
const rec = itemByKey.get(name);
|
|
22866
22518
|
if (!rec) continue;
|
|
22867
22519
|
rows.push({
|
|
22868
22520
|
kind: "flat",
|
|
22869
|
-
key: `flat:${
|
|
22870
|
-
label:
|
|
22521
|
+
key: `flat:${name}`,
|
|
22522
|
+
label: name,
|
|
22871
22523
|
indent: 0,
|
|
22872
22524
|
itemIdx: rec.idx
|
|
22873
22525
|
});
|
|
@@ -22877,9 +22529,9 @@ function buildVisibleRows(props) {
|
|
|
22877
22529
|
if (filterVisibleKeys !== void 0) {
|
|
22878
22530
|
return rows.filter((row) => {
|
|
22879
22531
|
if (row.itemIdx < 0) return true;
|
|
22880
|
-
const
|
|
22881
|
-
if (
|
|
22882
|
-
return filterVisibleKeys.has(
|
|
22532
|
+
const name = items[row.itemIdx]?.key;
|
|
22533
|
+
if (name === void 0) return true;
|
|
22534
|
+
return filterVisibleKeys.has(name);
|
|
22883
22535
|
});
|
|
22884
22536
|
}
|
|
22885
22537
|
return rows;
|
|
@@ -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();
|
|
@@ -23601,11 +23253,11 @@ function computeCycleAwareAcceptCascade(target, components, cycleUnits) {
|
|
|
23601
23253
|
const byName = new Map(components.map((c2) => [c2.name, c2]));
|
|
23602
23254
|
const visited = /* @__PURE__ */ new Set();
|
|
23603
23255
|
const queue = [];
|
|
23604
|
-
const enqueue = (
|
|
23605
|
-
if (visited.has(
|
|
23606
|
-
visited.add(
|
|
23607
|
-
queue.push(
|
|
23608
|
-
const unit = cycleUnits.get(
|
|
23256
|
+
const enqueue = (name) => {
|
|
23257
|
+
if (visited.has(name)) return;
|
|
23258
|
+
visited.add(name);
|
|
23259
|
+
queue.push(name);
|
|
23260
|
+
const unit = cycleUnits.get(name);
|
|
23609
23261
|
if (unit) {
|
|
23610
23262
|
for (const member of unit) {
|
|
23611
23263
|
if (!visited.has(member)) {
|
|
@@ -23742,7 +23394,7 @@ function buildScopeGraph(components) {
|
|
|
23742
23394
|
cycles = [];
|
|
23743
23395
|
}
|
|
23744
23396
|
const cycleParticipants = /* @__PURE__ */ new Set();
|
|
23745
|
-
for (const cycle of cycles) for (const
|
|
23397
|
+
for (const cycle of cycles) for (const name of cycle.path) cycleParticipants.add(name);
|
|
23746
23398
|
return {
|
|
23747
23399
|
nodes,
|
|
23748
23400
|
cycles,
|
|
@@ -23967,10 +23619,10 @@ var init_lineage_layout = __esm({
|
|
|
23967
23619
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/sidebar-navigation.ts
|
|
23968
23620
|
function collectExpandedGroupRoots(closures, cycleParticipants) {
|
|
23969
23621
|
const roots = /* @__PURE__ */ new Set();
|
|
23970
|
-
for (const [
|
|
23971
|
-
if (closure.nodes.length > 1) roots.add(
|
|
23622
|
+
for (const [name, closure] of closures.entries()) {
|
|
23623
|
+
if (closure.nodes.length > 1) roots.add(name);
|
|
23972
23624
|
}
|
|
23973
|
-
for (const
|
|
23625
|
+
for (const name of cycleParticipants) roots.add(name);
|
|
23974
23626
|
return roots;
|
|
23975
23627
|
}
|
|
23976
23628
|
function computeSidebarViewToggle({
|
|
@@ -24042,9 +23694,9 @@ function buildFlatDimPredicate(input) {
|
|
|
24042
23694
|
const isFlat = input.viewMode === "flat";
|
|
24043
23695
|
const keys = isFlat ? input.filterVisibleKeys : void 0;
|
|
24044
23696
|
if (!hasSearch && keys === void 0) return void 0;
|
|
24045
|
-
return (
|
|
24046
|
-
if (hasSearch && !fuzzyMatches(input.searchQuery,
|
|
24047
|
-
if (keys !== void 0 && !keys.has(
|
|
23697
|
+
return (name) => {
|
|
23698
|
+
if (hasSearch && !fuzzyMatches(input.searchQuery, name)) return true;
|
|
23699
|
+
if (keys !== void 0 && !keys.has(name)) return true;
|
|
24048
23700
|
return false;
|
|
24049
23701
|
};
|
|
24050
23702
|
}
|
|
@@ -24064,7 +23716,7 @@ var init_step_filters = __esm({
|
|
|
24064
23716
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
24065
23717
|
function apply(state2, entries) {
|
|
24066
23718
|
const next = new Map(state2);
|
|
24067
|
-
for (const [
|
|
23719
|
+
for (const [name, decision] of entries) next.set(name, decision);
|
|
24068
23720
|
return next;
|
|
24069
23721
|
}
|
|
24070
23722
|
function reduceDecisions(state2, action, components, graph) {
|
|
@@ -24073,44 +23725,44 @@ function reduceDecisions(state2, action, components, graph) {
|
|
|
24073
23725
|
if (state2.get(action.name) === "accepted") return state2;
|
|
24074
23726
|
return apply(
|
|
24075
23727
|
state2,
|
|
24076
|
-
acceptCascade(graph, action.name).map((
|
|
23728
|
+
acceptCascade(graph, action.name).map((name) => [name, "accepted"])
|
|
24077
23729
|
);
|
|
24078
23730
|
}
|
|
24079
23731
|
case "reject": {
|
|
24080
23732
|
if (state2.get(action.name) === "rejected") return state2;
|
|
24081
23733
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
24082
23734
|
return apply(state2, [
|
|
24083
|
-
...toReject.map((
|
|
24084
|
-
...toDeselect.map((
|
|
23735
|
+
...toReject.map((name) => [name, "rejected"]),
|
|
23736
|
+
...toDeselect.map((name) => [name, "undecided"])
|
|
24085
23737
|
]);
|
|
24086
23738
|
}
|
|
24087
23739
|
case "toggle-all": {
|
|
24088
23740
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
24089
|
-
const anyNotAccepted = nonCycle.some((
|
|
23741
|
+
const anyNotAccepted = nonCycle.some((name) => state2.get(name) !== "accepted");
|
|
24090
23742
|
if (anyNotAccepted) {
|
|
24091
23743
|
return apply(state2, [
|
|
24092
|
-
...nonCycle.map((
|
|
24093
|
-
...reachableCycleMembers(graph, nonCycle).map((
|
|
23744
|
+
...nonCycle.map((name) => [name, "accepted"]),
|
|
23745
|
+
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
24094
23746
|
]);
|
|
24095
23747
|
}
|
|
24096
23748
|
return apply(state2, [
|
|
24097
|
-
...nonCycle.map((
|
|
23749
|
+
...nonCycle.map((name) => [name, "rejected"]),
|
|
24098
23750
|
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state2.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
24099
23751
|
]);
|
|
24100
23752
|
}
|
|
24101
23753
|
case "accept-unflagged": {
|
|
24102
23754
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
24103
23755
|
return apply(state2, [
|
|
24104
|
-
...seeds.map((
|
|
24105
|
-
...reachableCycleMembers(graph, seeds).map((
|
|
23756
|
+
...seeds.map((name) => [name, "accepted"]),
|
|
23757
|
+
...reachableCycleMembers(graph, seeds).map((name) => [name, "accepted"])
|
|
24106
23758
|
]);
|
|
24107
23759
|
}
|
|
24108
23760
|
}
|
|
24109
23761
|
}
|
|
24110
|
-
function rejectNeedsConfirmation(graph,
|
|
24111
|
-
if (state2.get(
|
|
24112
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
24113
|
-
const ancestors = toReject.filter((n) => n !==
|
|
23762
|
+
function rejectNeedsConfirmation(graph, name, state2) {
|
|
23763
|
+
if (state2.get(name) === "rejected") return false;
|
|
23764
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
23765
|
+
const ancestors = toReject.filter((n) => n !== name);
|
|
24114
23766
|
return ancestors.length + toDeselect.length >= 2;
|
|
24115
23767
|
}
|
|
24116
23768
|
function partitionDecisions(components, state2) {
|
|
@@ -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;
|
|
@@ -24208,8 +23860,8 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24208
23860
|
for (const node of closure.nodes) keys.add(node.name);
|
|
24209
23861
|
}
|
|
24210
23862
|
for (const unit of cycleUnits.values()) {
|
|
24211
|
-
if (![...unit].some((
|
|
24212
|
-
for (const
|
|
23863
|
+
if (![...unit].some((name) => decisions.get(name) === "accepted")) continue;
|
|
23864
|
+
for (const name of unit) keys.add(name);
|
|
24213
23865
|
}
|
|
24214
23866
|
return keys;
|
|
24215
23867
|
}, [closures, cycleUnits, showDependencies, decisions]);
|
|
@@ -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);
|
|
@@ -24307,12 +23959,12 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24307
23959
|
return void 0;
|
|
24308
23960
|
}
|
|
24309
23961
|
};
|
|
24310
|
-
const jumpCursorTo = (
|
|
23962
|
+
const jumpCursorTo = (name) => {
|
|
24311
23963
|
let idx = -1;
|
|
24312
23964
|
for (let i = 0; i < visibleRows.length; i++) {
|
|
24313
23965
|
const row = visibleRows[i];
|
|
24314
23966
|
if (row.itemIdx < 0) continue;
|
|
24315
|
-
if (groupedItems[row.itemIdx]?.key ===
|
|
23967
|
+
if (groupedItems[row.itemIdx]?.key === name) {
|
|
24316
23968
|
idx = i;
|
|
24317
23969
|
break;
|
|
24318
23970
|
}
|
|
@@ -24326,18 +23978,18 @@ function useScopeGate({ components, tokenCount, tokensWidth, onConfirm, onQuit }
|
|
|
24326
23978
|
});
|
|
24327
23979
|
};
|
|
24328
23980
|
const decide = (action) => setDecisions((prev) => reduceDecisions(prev, action, components, graph));
|
|
24329
|
-
const requestReject = (
|
|
24330
|
-
if (decisions.get(
|
|
24331
|
-
if (rejectNeedsConfirmation(graph,
|
|
24332
|
-
const { toReject, toDeselect } = rejectCascade(graph,
|
|
23981
|
+
const requestReject = (name) => {
|
|
23982
|
+
if (decisions.get(name) === "rejected") return;
|
|
23983
|
+
if (rejectNeedsConfirmation(graph, name, decisions)) {
|
|
23984
|
+
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
24333
23985
|
setPendingRejectCascade({
|
|
24334
|
-
target:
|
|
24335
|
-
ancestors: toReject.filter((n) => n !==
|
|
23986
|
+
target: name,
|
|
23987
|
+
ancestors: toReject.filter((n) => n !== name).sort(),
|
|
24336
23988
|
descendants: [...toDeselect].sort()
|
|
24337
23989
|
});
|
|
24338
23990
|
return;
|
|
24339
23991
|
}
|
|
24340
|
-
decide({ type: "reject", name
|
|
23992
|
+
decide({ type: "reject", name });
|
|
24341
23993
|
};
|
|
24342
23994
|
const mode = showHelp ? "help" : pendingRejectCascade ? "reject-prompt" : searchOpen ? "search" : cyclesPanelOpen ? "cycles" : aiRationalePanel.isOpen ? "flags" : "main";
|
|
24343
23995
|
const context = {
|
|
@@ -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,21 +24535,21 @@ 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
|
-
const
|
|
24541
|
+
const name = capitalize(agent);
|
|
24890
24542
|
const { components, mapTokens } = progress;
|
|
24891
24543
|
const rows = [
|
|
24892
24544
|
{
|
|
24893
|
-
text: components ? components.current : `Starting up ${
|
|
24545
|
+
text: components ? components.current : `Starting up ${name}...`,
|
|
24894
24546
|
complete: false,
|
|
24895
24547
|
...components ? { progress: { done: components.done, total: components.total } } : {}
|
|
24896
24548
|
}
|
|
24897
24549
|
];
|
|
24898
24550
|
if (mapTokens !== "idle") {
|
|
24899
24551
|
rows.push({
|
|
24900
|
-
text: mapTokens === "running" ? `Mapping token restrictions via ${
|
|
24552
|
+
text: mapTokens === "running" ? `Mapping token restrictions via ${name}...` : "Token restrictions ready",
|
|
24901
24553
|
complete: mapTokens === "complete"
|
|
24902
24554
|
});
|
|
24903
24555
|
}
|
|
@@ -24907,7 +24559,7 @@ var capitalize;
|
|
|
24907
24559
|
var init_logic11 = __esm({
|
|
24908
24560
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/logic.ts"() {
|
|
24909
24561
|
"use strict";
|
|
24910
|
-
capitalize = (
|
|
24562
|
+
capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1);
|
|
24911
24563
|
}
|
|
24912
24564
|
});
|
|
24913
24565
|
|
|
@@ -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,24 +24834,6 @@ var init_build_flow_start = __esm({
|
|
|
25182
24834
|
}
|
|
25183
24835
|
});
|
|
25184
24836
|
|
|
25185
|
-
// packages/experience-design-system-types/dist/src/source-input-association.js
|
|
25186
|
-
import * as z3 from "zod/mini";
|
|
25187
|
-
var name, SourceInputAssociationSchema;
|
|
25188
|
-
var init_source_input_association = __esm({
|
|
25189
|
-
"packages/experience-design-system-types/dist/src/source-input-association.js"() {
|
|
25190
|
-
"use strict";
|
|
25191
|
-
name = z3.string().check(z3.refine((value) => value.trim().length > 0));
|
|
25192
|
-
SourceInputAssociationSchema = z3.strictObject({
|
|
25193
|
-
schemaVersion: z3.literal(1),
|
|
25194
|
-
componentId: name,
|
|
25195
|
-
componentDeclarationId: name,
|
|
25196
|
-
rootSymbolId: name,
|
|
25197
|
-
inputName: name,
|
|
25198
|
-
inputPath: z3.array(name).check(z3.minLength(1))
|
|
25199
|
-
}).check(z3.refine((value) => value.inputPath[0] === value.inputName));
|
|
25200
|
-
}
|
|
25201
|
-
});
|
|
25202
|
-
|
|
25203
24837
|
// packages/experience-design-system-types/dist/src/cdf/vocabularies.js
|
|
25204
24838
|
var CDF_PROPERTY_TYPES2, CDF_PROPERTY_CATEGORIES2;
|
|
25205
24839
|
var init_vocabularies2 = __esm({
|
|
@@ -25394,38 +25028,38 @@ var init_validate5 = __esm({
|
|
|
25394
25028
|
});
|
|
25395
25029
|
|
|
25396
25030
|
// packages/experience-design-system-types/dist/src/cdf/types.js
|
|
25397
|
-
import * as
|
|
25031
|
+
import * as z3 from "zod/mini";
|
|
25398
25032
|
var CDFPropertySchema2, CDFSlotSchema2, CDFComponentSchema2, CDFTokenSchema2;
|
|
25399
25033
|
var init_types7 = __esm({
|
|
25400
25034
|
"packages/experience-design-system-types/dist/src/cdf/types.js"() {
|
|
25401
25035
|
"use strict";
|
|
25402
25036
|
init_vocabularies2();
|
|
25403
25037
|
init_token_types2();
|
|
25404
|
-
CDFPropertySchema2 =
|
|
25405
|
-
$type:
|
|
25406
|
-
$category:
|
|
25407
|
-
$description:
|
|
25408
|
-
$required:
|
|
25409
|
-
$default:
|
|
25410
|
-
$values:
|
|
25411
|
-
"$token.kind":
|
|
25412
|
-
"$token.allowed":
|
|
25038
|
+
CDFPropertySchema2 = z3.strictObject({
|
|
25039
|
+
$type: z3.enum(CDF_PROPERTY_TYPES2),
|
|
25040
|
+
$category: z3.enum(CDF_PROPERTY_CATEGORIES2),
|
|
25041
|
+
$description: z3.optional(z3.string()),
|
|
25042
|
+
$required: z3.optional(z3.boolean()),
|
|
25043
|
+
$default: z3.optional(z3.any()),
|
|
25044
|
+
$values: z3.optional(z3.array(z3.string())),
|
|
25045
|
+
"$token.kind": z3.optional(z3.string()),
|
|
25046
|
+
"$token.allowed": z3.optional(z3.array(z3.string()))
|
|
25413
25047
|
});
|
|
25414
|
-
CDFSlotSchema2 =
|
|
25415
|
-
$description:
|
|
25416
|
-
$allowedComponents:
|
|
25417
|
-
$required:
|
|
25048
|
+
CDFSlotSchema2 = z3.strictObject({
|
|
25049
|
+
$description: z3.optional(z3.string()),
|
|
25050
|
+
$allowedComponents: z3.optional(z3.array(z3.string())),
|
|
25051
|
+
$required: z3.optional(z3.boolean())
|
|
25418
25052
|
});
|
|
25419
|
-
CDFComponentSchema2 =
|
|
25420
|
-
$type:
|
|
25421
|
-
$description:
|
|
25422
|
-
$properties:
|
|
25423
|
-
$slots:
|
|
25053
|
+
CDFComponentSchema2 = z3.strictObject({
|
|
25054
|
+
$type: z3.literal("component"),
|
|
25055
|
+
$description: z3.optional(z3.string()),
|
|
25056
|
+
$properties: z3.record(z3.string(), CDFPropertySchema2),
|
|
25057
|
+
$slots: z3.optional(z3.record(z3.string(), CDFSlotSchema2))
|
|
25424
25058
|
});
|
|
25425
|
-
CDFTokenSchema2 =
|
|
25426
|
-
$type:
|
|
25427
|
-
$value:
|
|
25428
|
-
$description:
|
|
25059
|
+
CDFTokenSchema2 = z3.strictObject({
|
|
25060
|
+
$type: z3.enum(DESIGN_TOKEN_TYPES2),
|
|
25061
|
+
$value: z3.unknown(),
|
|
25062
|
+
$description: z3.optional(z3.string())
|
|
25429
25063
|
});
|
|
25430
25064
|
}
|
|
25431
25065
|
});
|
|
@@ -25435,9 +25069,9 @@ function stripUnsupportedSlotFields(entry) {
|
|
|
25435
25069
|
if (!entry.$slots)
|
|
25436
25070
|
return entry;
|
|
25437
25071
|
const cleaned = {};
|
|
25438
|
-
for (const [
|
|
25072
|
+
for (const [name, slot] of Object.entries(entry.$slots)) {
|
|
25439
25073
|
const { $required: _required, ...rest } = slot;
|
|
25440
|
-
cleaned[
|
|
25074
|
+
cleaned[name] = rest;
|
|
25441
25075
|
}
|
|
25442
25076
|
return { ...entry, $slots: cleaned };
|
|
25443
25077
|
}
|
|
@@ -25479,7 +25113,7 @@ function validateSlotReferences2(components) {
|
|
|
25479
25113
|
const slots = entry.$slots ?? {};
|
|
25480
25114
|
for (const [slotKey, slot] of Object.entries(slots)) {
|
|
25481
25115
|
const allowed = slot?.$allowedComponents ?? [];
|
|
25482
|
-
const unresolved = allowed.filter((
|
|
25116
|
+
const unresolved = allowed.filter((name) => !componentKeys.has(name));
|
|
25483
25117
|
if (unresolved.length === 0)
|
|
25484
25118
|
continue;
|
|
25485
25119
|
errors.push({
|
|
@@ -25525,17 +25159,17 @@ var init_cdf2 = __esm({
|
|
|
25525
25159
|
});
|
|
25526
25160
|
|
|
25527
25161
|
// packages/experience-design-system-types/dist/src/dtcg/types.js
|
|
25528
|
-
import * as
|
|
25162
|
+
import * as z4 from "zod/mini";
|
|
25529
25163
|
var DTCGTokenSchema2;
|
|
25530
25164
|
var init_types8 = __esm({
|
|
25531
25165
|
"packages/experience-design-system-types/dist/src/dtcg/types.js"() {
|
|
25532
25166
|
"use strict";
|
|
25533
25167
|
init_token_types2();
|
|
25534
|
-
DTCGTokenSchema2 =
|
|
25535
|
-
path:
|
|
25536
|
-
$type:
|
|
25537
|
-
$value:
|
|
25538
|
-
$description:
|
|
25168
|
+
DTCGTokenSchema2 = z4.strictObject({
|
|
25169
|
+
path: z4.string(),
|
|
25170
|
+
$type: z4.enum(DESIGN_TOKEN_TYPES2),
|
|
25171
|
+
$value: z4.unknown(),
|
|
25172
|
+
$description: z4.optional(z4.string())
|
|
25539
25173
|
});
|
|
25540
25174
|
}
|
|
25541
25175
|
});
|
|
@@ -25573,7 +25207,6 @@ var init_dtcg2 = __esm({
|
|
|
25573
25207
|
var init_src4 = __esm({
|
|
25574
25208
|
"packages/experience-design-system-types/dist/src/index.js"() {
|
|
25575
25209
|
"use strict";
|
|
25576
|
-
init_source_input_association();
|
|
25577
25210
|
init_cdf2();
|
|
25578
25211
|
init_dtcg2();
|
|
25579
25212
|
}
|
|
@@ -25584,7 +25217,7 @@ function failedComponentNames(errors) {
|
|
|
25584
25217
|
return [...new Set(errors.map((error) => error.componentName))];
|
|
25585
25218
|
}
|
|
25586
25219
|
function matchedComponentNames(errors, missingNames) {
|
|
25587
|
-
return failedComponentNames(errors).filter((
|
|
25220
|
+
return failedComponentNames(errors).filter((name) => !missingNames.includes(name));
|
|
25588
25221
|
}
|
|
25589
25222
|
function formatErrorLine(error) {
|
|
25590
25223
|
const context = [`Component: ${error.componentName}`, error.path ? `Path: ${error.path}` : null].filter(Boolean);
|
|
@@ -25730,11 +25363,11 @@ function computeRenderStatuses(closure, directIssues) {
|
|
|
25730
25363
|
inheritedSources.get(ancestor).set(node.name, ownStatus);
|
|
25731
25364
|
}
|
|
25732
25365
|
}
|
|
25733
|
-
for (const [
|
|
25734
|
-
out.set(
|
|
25366
|
+
for (const [name, status] of own.entries()) {
|
|
25367
|
+
out.set(name, {
|
|
25735
25368
|
status,
|
|
25736
25369
|
isOwn: true,
|
|
25737
|
-
sourceComponents: [
|
|
25370
|
+
sourceComponents: [name]
|
|
25738
25371
|
});
|
|
25739
25372
|
}
|
|
25740
25373
|
for (const [ancestor, sources] of inheritedSources.entries()) {
|
|
@@ -26000,7 +25633,7 @@ var init_scroll_offset = __esm({
|
|
|
26000
25633
|
});
|
|
26001
25634
|
|
|
26002
25635
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
|
|
26003
|
-
import React13, { useEffect as
|
|
25636
|
+
import React13, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState19 } from "react";
|
|
26004
25637
|
import figures6 from "figures";
|
|
26005
25638
|
import { Box as Box26, measureElement, Text as Text27 } from "ink";
|
|
26006
25639
|
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
@@ -26052,7 +25685,7 @@ function parseToState(json) {
|
|
|
26052
25685
|
}
|
|
26053
25686
|
const componentDescription = typeof component.$description === "string" ? component.$description : "";
|
|
26054
25687
|
const rawProps = component.$properties ?? {};
|
|
26055
|
-
const props = Object.entries(rawProps).map(([
|
|
25688
|
+
const props = Object.entries(rawProps).map(([name, raw]) => {
|
|
26056
25689
|
const p = raw ?? {};
|
|
26057
25690
|
const type = CDF_PROPERTY_TYPES2.includes(p.$type) ? p.$type : "string";
|
|
26058
25691
|
let defaultValue = null;
|
|
@@ -26064,7 +25697,7 @@ function parseToState(json) {
|
|
|
26064
25697
|
}
|
|
26065
25698
|
}
|
|
26066
25699
|
return {
|
|
26067
|
-
name
|
|
25700
|
+
name,
|
|
26068
25701
|
type,
|
|
26069
25702
|
category: CDF_PROPERTY_CATEGORIES2.includes(p.$category) ? p.$category : "content",
|
|
26070
25703
|
required: p.$required === true,
|
|
@@ -26076,10 +25709,10 @@ function parseToState(json) {
|
|
|
26076
25709
|
};
|
|
26077
25710
|
});
|
|
26078
25711
|
const rawSlots = component.$slots ?? {};
|
|
26079
|
-
const slots = Object.entries(rawSlots).map(([
|
|
25712
|
+
const slots = Object.entries(rawSlots).map(([name, raw]) => {
|
|
26080
25713
|
const s = raw ?? {};
|
|
26081
25714
|
return {
|
|
26082
|
-
name
|
|
25715
|
+
name,
|
|
26083
25716
|
description: typeof s.$description === "string" ? s.$description : "",
|
|
26084
25717
|
required: s.$required === true,
|
|
26085
25718
|
allowedComponents: Array.isArray(s.$allowedComponents) ? s.$allowedComponents.filter((v) => typeof v === "string") : []
|
|
@@ -26187,7 +25820,7 @@ function DefaultValueRow({
|
|
|
26187
25820
|
] });
|
|
26188
25821
|
}
|
|
26189
25822
|
function RowLabel({
|
|
26190
|
-
name
|
|
25823
|
+
name,
|
|
26191
25824
|
selected,
|
|
26192
25825
|
trailing = true
|
|
26193
25826
|
}) {
|
|
@@ -26200,7 +25833,7 @@ function RowLabel({
|
|
|
26200
25833
|
wrap: "truncate-end",
|
|
26201
25834
|
children: [
|
|
26202
25835
|
" ",
|
|
26203
|
-
|
|
25836
|
+
name,
|
|
26204
25837
|
trailing ? " " : ""
|
|
26205
25838
|
]
|
|
26206
25839
|
}
|
|
@@ -26552,10 +26185,10 @@ function SlotRow({
|
|
|
26552
26185
|
const slice = filtered.slice(start, start + MAX_VISIBLE);
|
|
26553
26186
|
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", children: [
|
|
26554
26187
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: " candidates (\u2191\u2193 cycle, Enter to add):" }),
|
|
26555
|
-
slice.map((
|
|
26188
|
+
slice.map((name, i) => {
|
|
26556
26189
|
const absIdx = start + i;
|
|
26557
26190
|
const isCursor = absIdx === cursor;
|
|
26558
|
-
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${
|
|
26191
|
+
return /* @__PURE__ */ jsx32(Text27, { color: isCursor ? PALETTE.accent : PALETTE.muted, children: isCursor ? ` ${figures6.pointer} ${name}` : ` ${name}` }, name);
|
|
26559
26192
|
})
|
|
26560
26193
|
] });
|
|
26561
26194
|
})() })
|
|
@@ -26767,7 +26400,6 @@ function FieldEditor({
|
|
|
26767
26400
|
const [rationaleOpen, setRationaleOpen] = useState19(false);
|
|
26768
26401
|
const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
|
|
26769
26402
|
const [showHelp, setShowHelp] = useState19(false);
|
|
26770
|
-
const [pendingDelete, setPendingDelete] = useState19(null);
|
|
26771
26403
|
const props = editorState.props;
|
|
26772
26404
|
const slots = editorState.slots;
|
|
26773
26405
|
const contentPropIndexes = React13.useMemo(
|
|
@@ -26859,46 +26491,6 @@ function FieldEditor({
|
|
|
26859
26491
|
setEditorState(next);
|
|
26860
26492
|
onChange(serializeState(next, value));
|
|
26861
26493
|
};
|
|
26862
|
-
const deleteRow = (row) => {
|
|
26863
|
-
if (row.kind === "prop") {
|
|
26864
|
-
const nextProps = removeAt(editorState.props, row.idx);
|
|
26865
|
-
commit({ ...editorState, props: nextProps });
|
|
26866
|
-
setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
|
|
26867
|
-
const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
|
|
26868
|
-
const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
|
|
26869
|
-
if (!neighbour2) {
|
|
26870
|
-
setInSlots(false);
|
|
26871
|
-
setInComponentDesc(true);
|
|
26872
|
-
setFocusLevel("componentDescription");
|
|
26873
|
-
} else if (neighbour2.kind === "prop") {
|
|
26874
|
-
setInSlots(false);
|
|
26875
|
-
setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
|
|
26876
|
-
setFocusLevel("prop");
|
|
26877
|
-
} else {
|
|
26878
|
-
setInSlots(true);
|
|
26879
|
-
setSlotIdx(neighbour2.idx);
|
|
26880
|
-
setFocusLevel("slot");
|
|
26881
|
-
}
|
|
26882
|
-
return;
|
|
26883
|
-
}
|
|
26884
|
-
const nextSlots = removeAt(editorState.slots, row.idx);
|
|
26885
|
-
commit({ ...editorState, slots: nextSlots });
|
|
26886
|
-
const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
|
|
26887
|
-
const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
|
|
26888
|
-
if (!neighbour) {
|
|
26889
|
-
setInSlots(false);
|
|
26890
|
-
setInComponentDesc(true);
|
|
26891
|
-
setFocusLevel("componentDescription");
|
|
26892
|
-
} else if (neighbour.kind === "slot") {
|
|
26893
|
-
setInSlots(true);
|
|
26894
|
-
setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
|
|
26895
|
-
setFocusLevel("slot");
|
|
26896
|
-
} else {
|
|
26897
|
-
setInSlots(false);
|
|
26898
|
-
setPropIdx(neighbour.idx);
|
|
26899
|
-
setFocusLevel("prop");
|
|
26900
|
-
}
|
|
26901
|
-
};
|
|
26902
26494
|
const canonicalize = React13.useCallback((json) => {
|
|
26903
26495
|
try {
|
|
26904
26496
|
return JSON.stringify(JSON.parse(json));
|
|
@@ -26935,11 +26527,6 @@ function FieldEditor({
|
|
|
26935
26527
|
onSave();
|
|
26936
26528
|
return;
|
|
26937
26529
|
}
|
|
26938
|
-
if (pendingDelete) {
|
|
26939
|
-
if (input === "y") deleteRow(pendingDelete);
|
|
26940
|
-
setPendingDelete(null);
|
|
26941
|
-
return;
|
|
26942
|
-
}
|
|
26943
26530
|
const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
|
|
26944
26531
|
const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
|
|
26945
26532
|
const inValueListTextEntry = editingValue != null;
|
|
@@ -27139,11 +26726,6 @@ function FieldEditor({
|
|
|
27139
26726
|
}
|
|
27140
26727
|
return;
|
|
27141
26728
|
}
|
|
27142
|
-
if (input === "d" && !key.ctrl && !key.meta) {
|
|
27143
|
-
if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
|
|
27144
|
-
if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
|
|
27145
|
-
return;
|
|
27146
|
-
}
|
|
27147
26729
|
if (focusLevel === "slot" && key.return && currentSlot) {
|
|
27148
26730
|
setFocusLevel("field");
|
|
27149
26731
|
setActiveField(SLOT_FIELDS[0] ?? null);
|
|
@@ -27450,10 +27032,6 @@ function FieldEditor({
|
|
|
27450
27032
|
}
|
|
27451
27033
|
const hasEmptyProperties = props.length === 0 && slots.length === 0;
|
|
27452
27034
|
const modeLabel = (() => {
|
|
27453
|
-
if (pendingDelete) {
|
|
27454
|
-
const name2 = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
|
|
27455
|
-
return `Delete ${pendingDelete.kind} "${name2}"? [y] delete \xB7 any other key cancels`;
|
|
27456
|
-
}
|
|
27457
27035
|
if (editingValue) {
|
|
27458
27036
|
return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
|
|
27459
27037
|
}
|
|
@@ -27475,7 +27053,7 @@ function FieldEditor({
|
|
|
27475
27053
|
if (rationaleOpen) {
|
|
27476
27054
|
return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
|
|
27477
27055
|
}
|
|
27478
|
-
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`;
|
|
27479
27057
|
})();
|
|
27480
27058
|
const rows = [];
|
|
27481
27059
|
rows.push({ kind: "component-description" });
|
|
@@ -27527,7 +27105,7 @@ function FieldEditor({
|
|
|
27527
27105
|
}
|
|
27528
27106
|
return Math.max(start + 1, end2);
|
|
27529
27107
|
};
|
|
27530
|
-
|
|
27108
|
+
useEffect11(() => {
|
|
27531
27109
|
if (focusLevel === "field" || selectedRowIdx < 0) return;
|
|
27532
27110
|
setListScrollStart((previous) => {
|
|
27533
27111
|
if (initialFocusTarget && !initialFocusScrollApplied.current) {
|
|
@@ -27741,7 +27319,6 @@ function FieldEditor({
|
|
|
27741
27319
|
/* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
|
|
27742
27320
|
/* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
|
|
27743
27321
|
/* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
|
|
27744
|
-
/* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
|
|
27745
27322
|
/* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
|
|
27746
27323
|
/* @__PURE__ */ jsx32(Text27, { children: " " }),
|
|
27747
27324
|
/* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
|
|
@@ -27765,7 +27342,7 @@ function FieldEditor({
|
|
|
27765
27342
|
/* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
|
|
27766
27343
|
] }),
|
|
27767
27344
|
validationError && /* @__PURE__ */ jsx32(Text27, { color: PALETTE.error, children: "\u2717 " + validationError }),
|
|
27768
|
-
/* @__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 }) })
|
|
27769
27346
|
]
|
|
27770
27347
|
}
|
|
27771
27348
|
);
|
|
@@ -28158,8 +27735,8 @@ function TokenReviewPanel({
|
|
|
28158
27735
|
borderStyle: "single",
|
|
28159
27736
|
borderColor: active ? PALETTE.text : void 0,
|
|
28160
27737
|
children: [
|
|
28161
|
-
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, wrap: "truncate", children: `
|
|
28162
|
-
/* @__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})` }),
|
|
28163
27740
|
/* @__PURE__ */ jsx39(Text32, { children: " " }),
|
|
28164
27741
|
current.paths.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no compatible tokens found for this token kind)" }),
|
|
28165
27742
|
visiblePaths.map((path5, i) => {
|
|
@@ -28192,33 +27769,18 @@ function TokenReviewPanel({
|
|
|
28192
27769
|
borderStyle: "single",
|
|
28193
27770
|
borderColor: active ? PALETTE.text : void 0,
|
|
28194
27771
|
children: [
|
|
28195
|
-
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `
|
|
28196
|
-
/* @__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.` }),
|
|
28197
|
-
/* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, wrap: "truncate", children: "Suggested tokens come from the agent. Allowed tokens are what editors can pick in Contentful." }),
|
|
28198
|
-
/* @__PURE__ */ jsx39(Text32, { children: " " }),
|
|
27772
|
+
/* @__PURE__ */ jsx39(Text32, { bold: true, color: active ? void 0 : PALETTE.muted, children: `TOKEN REVIEW \u2014 ${componentName}` }),
|
|
28199
27773
|
suggestions.length === 0 && /* @__PURE__ */ jsx39(Text32, { color: PALETTE.muted, children: "(no token suggestions for this component)" }),
|
|
28200
27774
|
suggestions.map((s, i) => {
|
|
28201
27775
|
const focused = i === selectedRow;
|
|
28202
27776
|
return /* @__PURE__ */ jsxs30(Box31, { flexDirection: "column", children: [
|
|
28203
|
-
/* @__PURE__ */ jsx39(Box31, { children: /* @__PURE__ */ jsx39(Text32, { color: focused ? PALETTE.accent : active ? void 0 : PALETTE.muted, bold: focused, children: `${focused ? figures7.pointer : " "} ${s.propName}
|
|
28204
|
-
/* @__PURE__ */ jsx39(
|
|
28205
|
-
|
|
28206
|
-
{
|
|
28207
|
-
color: PALETTE.muted,
|
|
28208
|
-
children: ` suggested: ${s.suggested.length > 0 ? s.suggested.join(", ") : "none"}`
|
|
28209
|
-
}
|
|
28210
|
-
),
|
|
28211
|
-
/* @__PURE__ */ jsx39(
|
|
28212
|
-
Text32,
|
|
28213
|
-
{
|
|
28214
|
-
color: PALETTE.muted,
|
|
28215
|
-
children: ` allowed: ${s.allowed.length > 0 ? s.allowed.join(", ") : "none (any token)"}`
|
|
28216
|
-
}
|
|
28217
|
-
),
|
|
28218
|
-
/* @__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(", ")}` })
|
|
28219
27780
|
] }, s.propName);
|
|
28220
27781
|
}),
|
|
28221
|
-
/* @__PURE__ */ jsx39(Text32, {
|
|
27782
|
+
/* @__PURE__ */ jsx39(Text32, { children: " " }),
|
|
27783
|
+
/* @__PURE__ */ jsx39(Text32, { children: "[\u2191/\u2193] move [Enter] edit allowed [Esc] close" })
|
|
28222
27784
|
]
|
|
28223
27785
|
}
|
|
28224
27786
|
);
|
|
@@ -28492,9 +28054,15 @@ function ReviewFinalizeError({
|
|
|
28492
28054
|
function ReviewPanelFooter({
|
|
28493
28055
|
reviewEditor,
|
|
28494
28056
|
sidebarFocused,
|
|
28495
|
-
sidebarFooter
|
|
28057
|
+
sidebarFooter,
|
|
28058
|
+
livePreview,
|
|
28059
|
+
livePreviewSpinner
|
|
28496
28060
|
}) {
|
|
28497
|
-
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
|
+
] });
|
|
28498
28066
|
}
|
|
28499
28067
|
function ReviewComponentTitle({
|
|
28500
28068
|
selectedKey,
|
|
@@ -28528,7 +28096,9 @@ function ReviewComponentPanel({
|
|
|
28528
28096
|
sidebarFocused,
|
|
28529
28097
|
fieldEditor,
|
|
28530
28098
|
saveError,
|
|
28531
|
-
sidebarFooter
|
|
28099
|
+
sidebarFooter,
|
|
28100
|
+
livePreview,
|
|
28101
|
+
livePreviewSpinner
|
|
28532
28102
|
}) {
|
|
28533
28103
|
const propCount = Object.keys(selectedEntry.$properties).length;
|
|
28534
28104
|
const slotCount = selectedEntry.$slots ? Object.keys(selectedEntry.$slots).length : 0;
|
|
@@ -28565,7 +28135,9 @@ function ReviewComponentPanel({
|
|
|
28565
28135
|
{
|
|
28566
28136
|
reviewEditor,
|
|
28567
28137
|
sidebarFocused,
|
|
28568
|
-
sidebarFooter
|
|
28138
|
+
sidebarFooter,
|
|
28139
|
+
livePreview,
|
|
28140
|
+
livePreviewSpinner
|
|
28569
28141
|
}
|
|
28570
28142
|
) }) })
|
|
28571
28143
|
] }) });
|
|
@@ -28677,7 +28249,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
28677
28249
|
);
|
|
28678
28250
|
db.exec("BEGIN");
|
|
28679
28251
|
try {
|
|
28680
|
-
for (const
|
|
28252
|
+
for (const name of toReject) statement.run(extractSessionId, name);
|
|
28681
28253
|
db.exec("COMMIT");
|
|
28682
28254
|
} catch (error) {
|
|
28683
28255
|
db.exec("ROLLBACK");
|
|
@@ -28922,7 +28494,7 @@ var init_FinalizeDialog = __esm({
|
|
|
28922
28494
|
});
|
|
28923
28495
|
|
|
28924
28496
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
|
|
28925
|
-
import { useEffect as
|
|
28497
|
+
import { useEffect as useEffect12, useRef as useRef9, useState as useState20 } from "react";
|
|
28926
28498
|
function useReviewFinalizePreview({
|
|
28927
28499
|
components,
|
|
28928
28500
|
...options
|
|
@@ -28937,9 +28509,9 @@ function useFinalizePreview(opts) {
|
|
|
28937
28509
|
const [status, setStatus] = useState20("idle");
|
|
28938
28510
|
const [removed, setRemoved] = useState20([]);
|
|
28939
28511
|
const [scrollOffset, setScrollOffset] = useState20(0);
|
|
28940
|
-
const generationRef =
|
|
28512
|
+
const generationRef = useRef9(0);
|
|
28941
28513
|
const acceptedKey = [...acceptedKeys].sort().join("\0");
|
|
28942
|
-
|
|
28514
|
+
useEffect12(() => {
|
|
28943
28515
|
if (!open) {
|
|
28944
28516
|
setStatus("idle");
|
|
28945
28517
|
setRemoved([]);
|
|
@@ -28991,7 +28563,7 @@ var init_use_finalize_preview = __esm({
|
|
|
28991
28563
|
});
|
|
28992
28564
|
|
|
28993
28565
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
|
|
28994
|
-
import { useCallback as useCallback2, useEffect as
|
|
28566
|
+
import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef10, useState as useState21 } from "react";
|
|
28995
28567
|
function useReviewSession({
|
|
28996
28568
|
loadSession,
|
|
28997
28569
|
tokensPath,
|
|
@@ -29010,7 +28582,7 @@ function useReviewSession({
|
|
|
29010
28582
|
}));
|
|
29011
28583
|
return { result, catalog };
|
|
29012
28584
|
}, [loadSession, tokensPath]);
|
|
29013
|
-
|
|
28585
|
+
useEffect13(() => {
|
|
29014
28586
|
let disposed = false;
|
|
29015
28587
|
void (async () => {
|
|
29016
28588
|
try {
|
|
@@ -29063,7 +28635,7 @@ function useReviewSession({
|
|
|
29063
28635
|
function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
29064
28636
|
const [reviewMetadata, setReviewMetadata] = useState21(null);
|
|
29065
28637
|
const [componentRationale, setComponentRationale] = useState21(null);
|
|
29066
|
-
|
|
28638
|
+
useEffect13(() => {
|
|
29067
28639
|
const current = components[selectedIdx];
|
|
29068
28640
|
if (!current) {
|
|
29069
28641
|
setReviewMetadata(null);
|
|
@@ -29093,9 +28665,9 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
|
|
|
29093
28665
|
return { reviewMetadata, componentRationale };
|
|
29094
28666
|
}
|
|
29095
28667
|
function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
|
|
29096
|
-
const historyRef =
|
|
29097
|
-
const historySeededRef =
|
|
29098
|
-
|
|
28668
|
+
const historyRef = useRef10(null);
|
|
28669
|
+
const historySeededRef = useRef10(false);
|
|
28670
|
+
useEffect13(() => {
|
|
29099
28671
|
if (loading || historySeededRef.current) return;
|
|
29100
28672
|
historySeededRef.current = true;
|
|
29101
28673
|
historyRef.current = createHistoryStack(createSnapshot(components));
|
|
@@ -29167,7 +28739,7 @@ function collectTokenSuggestions(entry, availableTokens = []) {
|
|
|
29167
28739
|
const compatiblePaths = new Set(compatible);
|
|
29168
28740
|
const allowed = availableTokens.length > 0 ? persistedAllowed.filter((path5) => compatiblePaths.has(path5)) : persistedAllowed;
|
|
29169
28741
|
const paths = availableTokens.length > 0 ? compatible : allowed;
|
|
29170
|
-
return { propName,
|
|
28742
|
+
return { propName, paths, suggested: [...allowed], allowed };
|
|
29171
28743
|
});
|
|
29172
28744
|
}
|
|
29173
28745
|
var init_token_suggestions = __esm({
|
|
@@ -29177,7 +28749,7 @@ var init_token_suggestions = __esm({
|
|
|
29177
28749
|
});
|
|
29178
28750
|
|
|
29179
28751
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
|
|
29180
|
-
import { useEffect as
|
|
28752
|
+
import { useEffect as useEffect14, useRef as useRef11, useState as useState22 } from "react";
|
|
29181
28753
|
function parseReviewEntry(draftValue) {
|
|
29182
28754
|
const parsed = JSON.parse(draftValue);
|
|
29183
28755
|
const keys = Object.keys(parsed);
|
|
@@ -29209,9 +28781,9 @@ function useReviewEditor({
|
|
|
29209
28781
|
const [tokenReviewEditing, setTokenReviewEditing] = useState22(false);
|
|
29210
28782
|
const [tokenReviewEditCursor, setTokenReviewEditCursor] = useState22(0);
|
|
29211
28783
|
const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState22(/* @__PURE__ */ new Set());
|
|
29212
|
-
const tokenReviewSuggestedRef =
|
|
29213
|
-
const pendingGRef =
|
|
29214
|
-
|
|
28784
|
+
const tokenReviewSuggestedRef = useRef11(/* @__PURE__ */ new Map());
|
|
28785
|
+
const pendingGRef = useRef11(false);
|
|
28786
|
+
useEffect14(() => {
|
|
29215
28787
|
setTokenReviewRow(0);
|
|
29216
28788
|
setTokenReviewEditing(false);
|
|
29217
28789
|
setTokenReviewEditCursor(0);
|
|
@@ -29661,13 +29233,13 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
29661
29233
|
const unchanged = new Set(preview.components.unchanged);
|
|
29662
29234
|
const changedNames = /* @__PURE__ */ new Set();
|
|
29663
29235
|
for (const item of preview.components.changed) {
|
|
29664
|
-
const
|
|
29665
|
-
if (typeof
|
|
29666
|
-
changedNames.add(
|
|
29236
|
+
const name = item.current?.name;
|
|
29237
|
+
if (typeof name !== "string") continue;
|
|
29238
|
+
changedNames.add(name);
|
|
29667
29239
|
if (item.changeClassification?.classification === "breaking") {
|
|
29668
|
-
out.set(
|
|
29240
|
+
out.set(name, "breaking");
|
|
29669
29241
|
} else {
|
|
29670
|
-
out.set(
|
|
29242
|
+
out.set(name, "changed");
|
|
29671
29243
|
}
|
|
29672
29244
|
}
|
|
29673
29245
|
const removedNames = /* @__PURE__ */ new Set();
|
|
@@ -29677,12 +29249,12 @@ function applyPreviewAnnotations(preview, localNames) {
|
|
|
29677
29249
|
out.set(entity.name, "removed");
|
|
29678
29250
|
}
|
|
29679
29251
|
}
|
|
29680
|
-
for (const
|
|
29681
|
-
if (unchanged.has(
|
|
29682
|
-
if (changedNames.has(
|
|
29683
|
-
if (removedNames.has(
|
|
29684
|
-
if (out.has(
|
|
29685
|
-
out.set(
|
|
29252
|
+
for (const name of localNames) {
|
|
29253
|
+
if (unchanged.has(name)) continue;
|
|
29254
|
+
if (changedNames.has(name)) continue;
|
|
29255
|
+
if (removedNames.has(name)) continue;
|
|
29256
|
+
if (out.has(name)) continue;
|
|
29257
|
+
out.set(name, "new");
|
|
29686
29258
|
}
|
|
29687
29259
|
return out;
|
|
29688
29260
|
}
|
|
@@ -29693,24 +29265,24 @@ var init_preview_annotations = __esm({
|
|
|
29693
29265
|
});
|
|
29694
29266
|
|
|
29695
29267
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
|
|
29696
|
-
import { useCallback as useCallback3, useEffect as
|
|
29268
|
+
import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef12, useState as useState24 } from "react";
|
|
29697
29269
|
function useLivePreview(opts) {
|
|
29698
29270
|
const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
29699
29271
|
const [status, setStatus] = useState24("idle");
|
|
29700
29272
|
const [disabled, setDisabled] = useState24(false);
|
|
29701
|
-
const timerRef =
|
|
29702
|
-
const generationRef =
|
|
29703
|
-
const latestRef =
|
|
29704
|
-
const inflightRef =
|
|
29705
|
-
const optsRef =
|
|
29706
|
-
|
|
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(() => {
|
|
29707
29279
|
optsRef.current = opts;
|
|
29708
29280
|
});
|
|
29709
|
-
const disabledRef =
|
|
29710
|
-
|
|
29281
|
+
const disabledRef = useRef12(disabled);
|
|
29282
|
+
useEffect15(() => {
|
|
29711
29283
|
disabledRef.current = disabled;
|
|
29712
29284
|
}, [disabled]);
|
|
29713
|
-
|
|
29285
|
+
useEffect15(() => {
|
|
29714
29286
|
return () => {
|
|
29715
29287
|
if (timerRef.current) {
|
|
29716
29288
|
clearTimeout(timerRef.current);
|
|
@@ -29791,7 +29363,7 @@ var init_use_live_preview = __esm({
|
|
|
29791
29363
|
});
|
|
29792
29364
|
|
|
29793
29365
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
|
|
29794
|
-
import { useCallback as useCallback4, useEffect as
|
|
29366
|
+
import { useCallback as useCallback4, useEffect as useEffect16, useState as useState25 } from "react";
|
|
29795
29367
|
function useReviewPreview({
|
|
29796
29368
|
components,
|
|
29797
29369
|
loading,
|
|
@@ -29833,13 +29405,13 @@ function useReviewPreview({
|
|
|
29833
29405
|
deleteAllComponents
|
|
29834
29406
|
});
|
|
29835
29407
|
const [spinnerTick, setSpinnerTick] = useState25(0);
|
|
29836
|
-
|
|
29408
|
+
useEffect16(() => {
|
|
29837
29409
|
if (livePreviewHook.status !== "running") return;
|
|
29838
29410
|
const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
|
|
29839
29411
|
return () => clearInterval(id);
|
|
29840
29412
|
}, [livePreviewHook.status]);
|
|
29841
29413
|
const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
|
|
29842
|
-
|
|
29414
|
+
useEffect16(() => {
|
|
29843
29415
|
if (loading) return;
|
|
29844
29416
|
if (!livePreview) return;
|
|
29845
29417
|
if (components.length === 0) return;
|
|
@@ -29896,7 +29468,7 @@ var init_LivePreviewSummary = __esm({
|
|
|
29896
29468
|
});
|
|
29897
29469
|
|
|
29898
29470
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
|
|
29899
|
-
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";
|
|
29900
29472
|
import figures8 from "figures";
|
|
29901
29473
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
29902
29474
|
import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -30110,7 +29682,7 @@ function GenerateReviewStepView({
|
|
|
30110
29682
|
setFinalizeError
|
|
30111
29683
|
} = reviewSurface;
|
|
30112
29684
|
const [removedBannerCollapsed, setRemovedBannerCollapsed] = useState26(false);
|
|
30113
|
-
const removedBannerDefaultedRef =
|
|
29685
|
+
const removedBannerDefaultedRef = useRef13(false);
|
|
30114
29686
|
const [cyclePanelScroll, setCyclePanelScroll] = useState26(0);
|
|
30115
29687
|
const [cyclesCursor, setCyclesCursor] = useState26(0);
|
|
30116
29688
|
const cyclePanel = useOverlayPanel({
|
|
@@ -30130,7 +29702,7 @@ function GenerateReviewStepView({
|
|
|
30130
29702
|
const [breakCursor, setBreakCursor] = useState26(0);
|
|
30131
29703
|
const [breakConfirm, setBreakConfirm] = useState26(false);
|
|
30132
29704
|
const [expandedGroups, setExpandedGroups] = useState26(/* @__PURE__ */ new Set());
|
|
30133
|
-
const seededGroupsRef =
|
|
29705
|
+
const seededGroupsRef = useRef13(false);
|
|
30134
29706
|
const {
|
|
30135
29707
|
searchOpen,
|
|
30136
29708
|
setSearchOpen,
|
|
@@ -30154,7 +29726,7 @@ function GenerateReviewStepView({
|
|
|
30154
29726
|
const [pendingEditorFocus, setPendingEditorFocus] = useState26(null);
|
|
30155
29727
|
const [autoRejected, setAutoRejected] = useState26([]);
|
|
30156
29728
|
const [undoSnapshot, setUndoSnapshot] = useState26(null);
|
|
30157
|
-
const autoRejectFiredRef =
|
|
29729
|
+
const autoRejectFiredRef = useRef13(false);
|
|
30158
29730
|
const [showReloadDialog, setShowReloadDialog] = useState26(false);
|
|
30159
29731
|
const acceptedCountForPreview = components.filter((c2) => c2.status === "accepted").length;
|
|
30160
29732
|
const { previewAnnotations, removedComponents, livePreviewHook, livePreviewSpinner } = useReviewPreview({
|
|
@@ -30217,7 +29789,7 @@ function GenerateReviewStepView({
|
|
|
30217
29789
|
[components]
|
|
30218
29790
|
);
|
|
30219
29791
|
const closures = useMemo6(() => computeAllClosures(componentGraph), [componentGraph]);
|
|
30220
|
-
|
|
29792
|
+
useEffect17(() => {
|
|
30221
29793
|
if (seededGroupsRef.current) return;
|
|
30222
29794
|
if (closures.size === 0 && slotCycles.length === 0) return;
|
|
30223
29795
|
seededGroupsRef.current = true;
|
|
@@ -30244,7 +29816,7 @@ function GenerateReviewStepView({
|
|
|
30244
29816
|
suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
|
|
30245
29817
|
}));
|
|
30246
29818
|
}, [slotCycles, cycleView]);
|
|
30247
|
-
|
|
29819
|
+
useEffect17(() => {
|
|
30248
29820
|
const decision = computeAutoRejectDecision({
|
|
30249
29821
|
loading,
|
|
30250
29822
|
autoRejectFired: autoRejectFiredRef.current,
|
|
@@ -30287,8 +29859,8 @@ function GenerateReviewStepView({
|
|
|
30287
29859
|
}),
|
|
30288
29860
|
applySnapshot: applyHistorySnapshot
|
|
30289
29861
|
});
|
|
30290
|
-
const autoRejectPushedRef =
|
|
30291
|
-
|
|
29862
|
+
const autoRejectPushedRef = useRef13(false);
|
|
29863
|
+
useEffect17(() => {
|
|
30292
29864
|
if (loading) return;
|
|
30293
29865
|
if (!historySeededRef.current) return;
|
|
30294
29866
|
if (!autoRejectFiredRef.current) return;
|
|
@@ -30372,7 +29944,7 @@ function GenerateReviewStepView({
|
|
|
30372
29944
|
const panelHeight = leftPanelHeight + 2;
|
|
30373
29945
|
const panelContentHeight = Math.max(1, panelHeight - 3);
|
|
30374
29946
|
const cycleViewportHeight = Math.max(1, panelHeight - 4);
|
|
30375
|
-
|
|
29947
|
+
useEffect17(() => {
|
|
30376
29948
|
if (selectableRowPositions.length === 0) return;
|
|
30377
29949
|
const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
|
|
30378
29950
|
const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
|
|
@@ -30407,10 +29979,10 @@ function GenerateReviewStepView({
|
|
|
30407
29979
|
const merged = /* @__PURE__ */ new Map();
|
|
30408
29980
|
for (const closure of closures.values()) {
|
|
30409
29981
|
const per = computeRenderStatuses(closure, directIssues);
|
|
30410
|
-
for (const [
|
|
30411
|
-
const existing = merged.get(
|
|
29982
|
+
for (const [name, rs] of per.entries()) {
|
|
29983
|
+
const existing = merged.get(name);
|
|
30412
29984
|
if (!existing || !existing.isOwn && rs.isOwn) {
|
|
30413
|
-
merged.set(
|
|
29985
|
+
merged.set(name, rs);
|
|
30414
29986
|
}
|
|
30415
29987
|
}
|
|
30416
29988
|
}
|
|
@@ -30465,11 +30037,11 @@ function GenerateReviewStepView({
|
|
|
30465
30037
|
reviewEditor.setSaveError(null);
|
|
30466
30038
|
setPendingEditorFocus(null);
|
|
30467
30039
|
};
|
|
30468
|
-
const jumpCursorToName = (
|
|
30040
|
+
const jumpCursorToName = (name) => {
|
|
30469
30041
|
for (let i = 0; i < visibleRowsMemo.length; i++) {
|
|
30470
30042
|
const row = visibleRowsMemo[i];
|
|
30471
30043
|
if (row.itemIdx < 0) continue;
|
|
30472
|
-
if (components[row.itemIdx]?.key ===
|
|
30044
|
+
if (components[row.itemIdx]?.key === name) {
|
|
30473
30045
|
jumpCursorToRow(i);
|
|
30474
30046
|
return;
|
|
30475
30047
|
}
|
|
@@ -30997,8 +30569,8 @@ function GenerateReviewStepView({
|
|
|
30997
30569
|
}
|
|
30998
30570
|
),
|
|
30999
30571
|
!dialogOpen && autoRejected.length > 0 && (() => {
|
|
31000
|
-
const stillRejected = autoRejected.filter((
|
|
31001
|
-
const c2 = components.find((x) => x.key ===
|
|
30572
|
+
const stillRejected = autoRejected.filter((name) => {
|
|
30573
|
+
const c2 = components.find((x) => x.key === name);
|
|
31002
30574
|
return c2?.status === "rejected";
|
|
31003
30575
|
});
|
|
31004
30576
|
if (stillRejected.length === 0) return null;
|
|
@@ -31118,7 +30690,9 @@ function GenerateReviewStepView({
|
|
|
31118
30690
|
initialFocusTarget: pendingEditorFocus && pendingEditorFocus.componentName === selected.key ? pendingEditorFocus.target : { kind: "description" }
|
|
31119
30691
|
}
|
|
31120
30692
|
),
|
|
31121
|
-
saveError: reviewEditor.saveError
|
|
30693
|
+
saveError: reviewEditor.saveError,
|
|
30694
|
+
livePreview: livePreviewHook,
|
|
30695
|
+
livePreviewSpinner
|
|
31122
30696
|
}
|
|
31123
30697
|
) : /* @__PURE__ */ jsx48(ReviewNoSelection, {})
|
|
31124
30698
|
] }),
|
|
@@ -31150,7 +30724,7 @@ function GenerateReviewStepView({
|
|
|
31150
30724
|
hidden: dialogOpen
|
|
31151
30725
|
}
|
|
31152
30726
|
),
|
|
31153
|
-
!dialogOpen && sidebarFocused &&
|
|
30727
|
+
!dialogOpen && sidebarFocused && /* @__PURE__ */ jsx48(CompactControlBar, { hasGroupRoots, searchActive: searchOpen || searchQuery.length > 0 })
|
|
31154
30728
|
] });
|
|
31155
30729
|
}
|
|
31156
30730
|
var HELP_SECTIONS2;
|
|
@@ -31232,7 +30806,7 @@ var init_generate_review_step = __esm({
|
|
|
31232
30806
|
{ keys: "P", label: "Component rationale" },
|
|
31233
30807
|
{ keys: "s", label: "Source code snippet" },
|
|
31234
30808
|
{ keys: "J", label: "Toggle JSON" },
|
|
31235
|
-
{ keys: "t", label: "
|
|
30809
|
+
{ keys: "t", label: "Token review" }
|
|
31236
30810
|
]
|
|
31237
30811
|
},
|
|
31238
30812
|
{
|
|
@@ -31431,7 +31005,7 @@ var init_DoneStep = __esm({
|
|
|
31431
31005
|
});
|
|
31432
31006
|
|
|
31433
31007
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts
|
|
31434
|
-
import { resolve as
|
|
31008
|
+
import { resolve as resolve25 } from "node:path";
|
|
31435
31009
|
import { homedir as homedir4 } from "node:os";
|
|
31436
31010
|
function expandTilde(input) {
|
|
31437
31011
|
if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
|
|
@@ -31445,7 +31019,7 @@ function normalizePath(input) {
|
|
|
31445
31019
|
p = p.slice(1, -1);
|
|
31446
31020
|
}
|
|
31447
31021
|
p = expandTilde(p);
|
|
31448
|
-
return
|
|
31022
|
+
return resolve25(p);
|
|
31449
31023
|
}
|
|
31450
31024
|
var init_path_utils = __esm({
|
|
31451
31025
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/path-utils.ts"() {
|
|
@@ -31454,10 +31028,10 @@ var init_path_utils = __esm({
|
|
|
31454
31028
|
});
|
|
31455
31029
|
|
|
31456
31030
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
|
|
31457
|
-
import { useEffect as
|
|
31031
|
+
import { useEffect as useEffect18, useState as useState27 } from "react";
|
|
31458
31032
|
function useBlinkingCursor() {
|
|
31459
31033
|
const [visible, setVisible] = useState27(true);
|
|
31460
|
-
|
|
31034
|
+
useEffect18(() => {
|
|
31461
31035
|
const interval = setInterval(() => setVisible((current) => !current), 500);
|
|
31462
31036
|
return () => clearInterval(interval);
|
|
31463
31037
|
}, []);
|
|
@@ -31472,29 +31046,29 @@ var init_use_blinking_cursor = __esm({
|
|
|
31472
31046
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/PathPrompt.tsx
|
|
31473
31047
|
import { useState as useState28 } from "react";
|
|
31474
31048
|
import { Box as Box42, Text as Text44 } from "ink";
|
|
31475
|
-
import { readdirSync as
|
|
31476
|
-
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";
|
|
31477
31051
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
31478
31052
|
function autocomplete(partial) {
|
|
31479
31053
|
if (!partial) return null;
|
|
31480
31054
|
const normalized = normalizePath(partial);
|
|
31481
|
-
const dir =
|
|
31055
|
+
const dir = dirname16(normalized);
|
|
31482
31056
|
const base = basename6(normalized);
|
|
31483
31057
|
let entries;
|
|
31484
31058
|
try {
|
|
31485
|
-
entries =
|
|
31059
|
+
entries = readdirSync3(dir);
|
|
31486
31060
|
} catch {
|
|
31487
31061
|
return null;
|
|
31488
31062
|
}
|
|
31489
31063
|
const matches = entries.filter((e) => e.startsWith(base));
|
|
31490
31064
|
if (matches.length === 0) return null;
|
|
31491
|
-
if (matches.length === 1) return
|
|
31065
|
+
if (matches.length === 1) return join21(dir, matches[0]);
|
|
31492
31066
|
let prefix = matches[0];
|
|
31493
31067
|
for (const m of matches) {
|
|
31494
31068
|
while (!m.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
31495
31069
|
if (!prefix) break;
|
|
31496
31070
|
}
|
|
31497
|
-
return prefix.length > base.length ?
|
|
31071
|
+
return prefix.length > base.length ? join21(dir, prefix) : null;
|
|
31498
31072
|
}
|
|
31499
31073
|
function PathPrompt({
|
|
31500
31074
|
defaultPath,
|
|
@@ -31594,12 +31168,12 @@ var init_produced = __esm({
|
|
|
31594
31168
|
});
|
|
31595
31169
|
|
|
31596
31170
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
|
|
31597
|
-
import { useEffect as
|
|
31171
|
+
import { useEffect as useEffect19, useState as useState29 } from "react";
|
|
31598
31172
|
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
31599
31173
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
31600
31174
|
function useTimedSpinner() {
|
|
31601
31175
|
const [elapsedSeconds, setElapsedSeconds] = useState29(0);
|
|
31602
|
-
|
|
31176
|
+
useEffect19(() => {
|
|
31603
31177
|
const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
|
|
31604
31178
|
return () => {
|
|
31605
31179
|
clearInterval(timer);
|
|
@@ -31680,31 +31254,31 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
31680
31254
|
const proposedProperties = proposed["$properties"] ?? {};
|
|
31681
31255
|
const proposedProps = new Set(Object.keys(proposedProperties));
|
|
31682
31256
|
const oldProps = current.fullProperties;
|
|
31683
|
-
for (const
|
|
31684
|
-
if (!currentProps.has(
|
|
31685
|
-
const def = proposedProperties[
|
|
31686
|
-
lines.push({ key: `${
|
|
31257
|
+
for (const name of [...proposedProps].sort()) {
|
|
31258
|
+
if (!currentProps.has(name)) {
|
|
31259
|
+
const def = proposedProperties[name];
|
|
31260
|
+
lines.push({ key: `${name}-add`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(def)}` });
|
|
31687
31261
|
}
|
|
31688
31262
|
}
|
|
31689
|
-
for (const
|
|
31690
|
-
if (!proposedProps.has(
|
|
31691
|
-
if (oldProps?.[
|
|
31692
|
-
lines.push({ key: `${
|
|
31263
|
+
for (const name of [...currentProps].sort()) {
|
|
31264
|
+
if (!proposedProps.has(name)) {
|
|
31265
|
+
if (oldProps?.[name]) {
|
|
31266
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(oldProps[name])}` });
|
|
31693
31267
|
} else {
|
|
31694
|
-
const cat = current.contentProperties.includes(
|
|
31695
|
-
lines.push({ key: `${
|
|
31268
|
+
const cat = current.contentProperties.includes(name) ? "content" : "design";
|
|
31269
|
+
lines.push({ key: `${name}-rm`, color: PALETTE.error, text: `- ${name} (${cat})` });
|
|
31696
31270
|
}
|
|
31697
31271
|
}
|
|
31698
31272
|
}
|
|
31699
31273
|
const handledProps = /* @__PURE__ */ new Set();
|
|
31700
|
-
for (const
|
|
31701
|
-
if (!proposedProps.has(
|
|
31702
|
-
const newDef = proposedProperties[
|
|
31703
|
-
const oldDef = oldProps?.[
|
|
31274
|
+
for (const name of [...currentProps].sort()) {
|
|
31275
|
+
if (!proposedProps.has(name)) continue;
|
|
31276
|
+
const newDef = proposedProperties[name];
|
|
31277
|
+
const oldDef = oldProps?.[name];
|
|
31704
31278
|
if (!oldDef) continue;
|
|
31705
|
-
const diffs = diffProperty(
|
|
31279
|
+
const diffs = diffProperty(name, oldDef, newDef);
|
|
31706
31280
|
if (diffs.length > 0) {
|
|
31707
|
-
handledProps.add(
|
|
31281
|
+
handledProps.add(name);
|
|
31708
31282
|
for (const d of diffs) lines.push(d);
|
|
31709
31283
|
}
|
|
31710
31284
|
}
|
|
@@ -31727,40 +31301,40 @@ function computeComponentDiffLines(current, proposed, changeClassification) {
|
|
|
31727
31301
|
const proposedSlots = proposed["$slots"] ?? {};
|
|
31728
31302
|
const proposedSlotNames = new Set(Object.keys(proposedSlots));
|
|
31729
31303
|
const currentSlotAllowed = current.currentSlotAllowed ?? {};
|
|
31730
|
-
for (const
|
|
31731
|
-
if (!currentSlots.has(
|
|
31732
|
-
lines.push({ key: `slot-${
|
|
31304
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
31305
|
+
if (!currentSlots.has(name)) {
|
|
31306
|
+
lines.push({ key: `slot-${name}-add`, color: PALETTE.success, text: `+ slot: ${name}` });
|
|
31733
31307
|
}
|
|
31734
31308
|
}
|
|
31735
|
-
for (const
|
|
31736
|
-
if (!proposedSlotNames.has(
|
|
31737
|
-
lines.push({ key: `slot-${
|
|
31309
|
+
for (const name of [...currentSlots].sort()) {
|
|
31310
|
+
if (!proposedSlotNames.has(name)) {
|
|
31311
|
+
lines.push({ key: `slot-${name}-rm`, color: PALETTE.error, text: `- slot: ${name}` });
|
|
31738
31312
|
}
|
|
31739
31313
|
}
|
|
31740
|
-
for (const
|
|
31741
|
-
const nextAllowed = normalizeAllowedComponents(proposedSlots[
|
|
31742
|
-
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[
|
|
31743
|
-
const prevExists = currentSlots.has(
|
|
31314
|
+
for (const name of [...proposedSlotNames].sort()) {
|
|
31315
|
+
const nextAllowed = normalizeAllowedComponents(proposedSlots[name]?.["$allowedComponents"]);
|
|
31316
|
+
const prevAllowed = normalizeAllowedComponents(currentSlotAllowed[name]);
|
|
31317
|
+
const prevExists = currentSlots.has(name);
|
|
31744
31318
|
if (!prevExists) {
|
|
31745
31319
|
if (nextAllowed.length > 0) {
|
|
31746
31320
|
lines.push({
|
|
31747
|
-
key: `slot-${
|
|
31321
|
+
key: `slot-${name}-allow-new`,
|
|
31748
31322
|
color: PALETTE.success,
|
|
31749
|
-
text: `+ slot ${
|
|
31323
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
31750
31324
|
});
|
|
31751
31325
|
}
|
|
31752
31326
|
continue;
|
|
31753
31327
|
}
|
|
31754
31328
|
if (arraysEqual(prevAllowed, nextAllowed)) continue;
|
|
31755
31329
|
lines.push({
|
|
31756
|
-
key: `slot-${
|
|
31330
|
+
key: `slot-${name}-allow-old`,
|
|
31757
31331
|
color: PALETTE.error,
|
|
31758
|
-
text: `- slot ${
|
|
31332
|
+
text: `- slot ${name} allowedComponents: [${prevAllowed.join(", ")}]`
|
|
31759
31333
|
});
|
|
31760
31334
|
lines.push({
|
|
31761
|
-
key: `slot-${
|
|
31335
|
+
key: `slot-${name}-allow-new`,
|
|
31762
31336
|
color: PALETTE.success,
|
|
31763
|
-
text: `+ slot ${
|
|
31337
|
+
text: `+ slot ${name} allowedComponents: [${nextAllowed.join(", ")}]`
|
|
31764
31338
|
});
|
|
31765
31339
|
}
|
|
31766
31340
|
return lines;
|
|
@@ -31796,7 +31370,7 @@ function normalizeType(type) {
|
|
|
31796
31370
|
return type.toLowerCase();
|
|
31797
31371
|
}
|
|
31798
31372
|
}
|
|
31799
|
-
function diffProperty(
|
|
31373
|
+
function diffProperty(name, old, newDef) {
|
|
31800
31374
|
const diffs = [];
|
|
31801
31375
|
const newType = newDef["$type"] ?? "";
|
|
31802
31376
|
const newCategory = newDef["$category"] ?? "";
|
|
@@ -31807,24 +31381,16 @@ function diffProperty(name2, old, newDef) {
|
|
|
31807
31381
|
const requiredChanged = old.required !== newRequired;
|
|
31808
31382
|
const defaultChanged = JSON.stringify(old.default) !== JSON.stringify(newDefault);
|
|
31809
31383
|
if (!typeChanged && !categoryChanged && !requiredChanged && !defaultChanged) return [];
|
|
31810
|
-
diffs.push({ key: `${
|
|
31811
|
-
diffs.push({ key: `${
|
|
31384
|
+
diffs.push({ key: `${name}-old`, color: PALETTE.error, text: `- ${name}: ${formatOldProp(old)}` });
|
|
31385
|
+
diffs.push({ key: `${name}-new`, color: PALETTE.success, text: `+ ${name}: ${formatPropDef(newDef)}` });
|
|
31812
31386
|
return diffs;
|
|
31813
31387
|
}
|
|
31814
|
-
function formatDefault(value) {
|
|
31815
|
-
const sys = value?.sys;
|
|
31816
|
-
if (sys?.linkType === "Contentful:DesignToken" && typeof sys.urn === "string") {
|
|
31817
|
-
const name2 = sys.urn.split("/designTokens/")[1];
|
|
31818
|
-
if (name2) return name2;
|
|
31819
|
-
}
|
|
31820
|
-
return JSON.stringify(value);
|
|
31821
|
-
}
|
|
31822
31388
|
function formatOldProp(prop) {
|
|
31823
31389
|
const parts = [];
|
|
31824
31390
|
if (prop.type) parts.push(prop.type);
|
|
31825
31391
|
if (prop.category) parts.push(prop.category);
|
|
31826
31392
|
parts.push(prop.required ? "required" : "optional");
|
|
31827
|
-
if (prop.default !== void 0) parts.push(`default=${
|
|
31393
|
+
if (prop.default !== void 0) parts.push(`default=${JSON.stringify(prop.default)}`);
|
|
31828
31394
|
return parts.join(", ");
|
|
31829
31395
|
}
|
|
31830
31396
|
function formatPropDef(def) {
|
|
@@ -31833,7 +31399,7 @@ function formatPropDef(def) {
|
|
|
31833
31399
|
if (def["$category"]) parts.push(def["$category"]);
|
|
31834
31400
|
if (def["$required"] === true) parts.push("required");
|
|
31835
31401
|
else parts.push("optional");
|
|
31836
|
-
if (def["$default"] !== void 0) parts.push(`default=${
|
|
31402
|
+
if (def["$default"] !== void 0) parts.push(`default=${JSON.stringify(def["$default"])}`);
|
|
31837
31403
|
return parts.join(", ");
|
|
31838
31404
|
}
|
|
31839
31405
|
var init_preview_diff = __esm({
|
|
@@ -31868,7 +31434,7 @@ var init_preview_confirmation_input = __esm({
|
|
|
31868
31434
|
});
|
|
31869
31435
|
|
|
31870
31436
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
|
|
31871
|
-
import { useEffect as
|
|
31437
|
+
import { useEffect as useEffect20, useState as useState30, useMemo as useMemo7 } from "react";
|
|
31872
31438
|
import { Box as Box44, Text as Text46 } from "ink";
|
|
31873
31439
|
import { Fragment as Fragment16, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
31874
31440
|
function buildPreviewSummaryLines(preview) {
|
|
@@ -31881,8 +31447,8 @@ function buildPreviewSummaryLines(preview) {
|
|
|
31881
31447
|
text: ` \uFF0B ${components.new.length} components will be created`
|
|
31882
31448
|
});
|
|
31883
31449
|
for (const [index, item] of components.new.entries()) {
|
|
31884
|
-
const
|
|
31885
|
-
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${
|
|
31450
|
+
const name = item.key ?? item.$name ?? "unknown";
|
|
31451
|
+
lines.push({ key: `summary-components-new-${index}`, color: PALETTE.success, text: ` + ${name}` });
|
|
31886
31452
|
}
|
|
31887
31453
|
}
|
|
31888
31454
|
if (components.changed.length > 0) {
|
|
@@ -31975,27 +31541,27 @@ function getPreviewScrollOffset(input, downArrow, upArrow, diffExpanded, current
|
|
|
31975
31541
|
}
|
|
31976
31542
|
return void 0;
|
|
31977
31543
|
}
|
|
31978
|
-
function appendChangedPreviewLine(lines, keyPrefix,
|
|
31544
|
+
function appendChangedPreviewLine(lines, keyPrefix, name, hasPendingDraftChanges, changeClassification) {
|
|
31979
31545
|
lines.push({
|
|
31980
|
-
key: `${keyPrefix}-h-${
|
|
31546
|
+
key: `${keyPrefix}-h-${name}`,
|
|
31981
31547
|
color: PALETTE.warning,
|
|
31982
|
-
text: ` ~ ${
|
|
31548
|
+
text: ` ~ ${name}${hasPendingDraftChanges ? " \u26A1 has pending draft changes" : ""}`
|
|
31983
31549
|
});
|
|
31984
31550
|
if (changeClassification?.classification !== "breaking") return;
|
|
31985
31551
|
const reasons = changeClassification.breakingChanges.map((bc) => `${"slotId" in bc ? bc.slotId : bc.propertyId}: ${bc.reason}`).join(", ");
|
|
31986
|
-
lines.push({ key: `${keyPrefix}-b-${
|
|
31552
|
+
lines.push({ key: `${keyPrefix}-b-${name}`, color: PALETTE.error, text: ` \u26A0 BREAKING: ${reasons}` });
|
|
31987
31553
|
}
|
|
31988
31554
|
function buildPreviewDiffLines(preview) {
|
|
31989
31555
|
const lines = [];
|
|
31990
31556
|
const { components, tokens } = preview;
|
|
31991
31557
|
for (const item of components.new) {
|
|
31992
31558
|
const raw = item;
|
|
31993
|
-
const
|
|
31994
|
-
lines.push({ key: `comp-new-${
|
|
31559
|
+
const name = raw.key ?? raw.$name ?? "unknown";
|
|
31560
|
+
lines.push({ key: `comp-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
31995
31561
|
const slots = raw.$slots ?? {};
|
|
31996
31562
|
for (const slotName of Object.keys(slots).sort()) {
|
|
31997
31563
|
lines.push({
|
|
31998
|
-
key: `comp-new-${
|
|
31564
|
+
key: `comp-new-${name}-slot-${slotName}`,
|
|
31999
31565
|
color: PALETTE.success,
|
|
32000
31566
|
text: ` slot: ${slotName}`
|
|
32001
31567
|
});
|
|
@@ -32003,7 +31569,7 @@ function buildPreviewDiffLines(preview) {
|
|
|
32003
31569
|
if (Array.isArray(allowed) && allowed.length > 0) {
|
|
32004
31570
|
const names = allowed.filter((n) => typeof n === "string");
|
|
32005
31571
|
lines.push({
|
|
32006
|
-
key: `comp-new-${
|
|
31572
|
+
key: `comp-new-${name}-slot-${slotName}-allow`,
|
|
32007
31573
|
color: PALETTE.success,
|
|
32008
31574
|
text: ` allowedComponents: [${names.join(", ")}]`
|
|
32009
31575
|
});
|
|
@@ -32041,8 +31607,8 @@ function buildPreviewDiffLines(preview) {
|
|
|
32041
31607
|
}
|
|
32042
31608
|
for (const item of tokens.new) {
|
|
32043
31609
|
const raw = item;
|
|
32044
|
-
const
|
|
32045
|
-
lines.push({ key: `tok-new-${
|
|
31610
|
+
const name = raw.name ?? raw.path ?? "unknown";
|
|
31611
|
+
lines.push({ key: `tok-new-${name}`, color: PALETTE.success, text: ` + ${name}` });
|
|
32046
31612
|
}
|
|
32047
31613
|
for (const item of tokens.removed) {
|
|
32048
31614
|
lines.push({ key: `tok-rm-${item.name}`, color: PALETTE.error, text: ` - ${item.name}` });
|
|
@@ -32078,7 +31644,7 @@ function WizardPreviewStep({
|
|
|
32078
31644
|
const activeLines = diffExpanded ? diffLines : summaryLines;
|
|
32079
31645
|
const maxScroll = Math.max(0, activeLines.length - viewportHeight);
|
|
32080
31646
|
const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
|
|
32081
|
-
|
|
31647
|
+
useEffect20(() => {
|
|
32082
31648
|
setScrollOffset((previous) => Math.min(previous, maxScroll));
|
|
32083
31649
|
}, [maxScroll]);
|
|
32084
31650
|
useImmediateInput((input, key) => {
|
|
@@ -32714,8 +32280,8 @@ var init_run_print_files_helpers = __esm({
|
|
|
32714
32280
|
});
|
|
32715
32281
|
|
|
32716
32282
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/save.ts
|
|
32717
|
-
import { writeFile as
|
|
32718
|
-
import { join as
|
|
32283
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
32284
|
+
import { join as join22 } from "node:path";
|
|
32719
32285
|
function buildSavedCDF(components, tokens, opts = {}) {
|
|
32720
32286
|
const cdf = buildCDF2(components, toCdfTokens(tokens), opts);
|
|
32721
32287
|
if (!cdf) throw new Error("nothing to save \u2014 no components or tokens resolved");
|
|
@@ -32727,7 +32293,7 @@ function buildSavedCDF(components, tokens, opts = {}) {
|
|
|
32727
32293
|
}
|
|
32728
32294
|
async function runPrintFiles(input, deps, onPatch) {
|
|
32729
32295
|
onPatch({ step: "printing" });
|
|
32730
|
-
const componentsPath =
|
|
32296
|
+
const componentsPath = join22(input.outDir, "components.json");
|
|
32731
32297
|
try {
|
|
32732
32298
|
const db = deps.openDb();
|
|
32733
32299
|
let components = [];
|
|
@@ -32811,7 +32377,7 @@ var init_save = __esm({
|
|
|
32811
32377
|
realSaveDeps = () => ({
|
|
32812
32378
|
openDb: openPipelineDb,
|
|
32813
32379
|
readTokens: (path5) => readTokensFromPath2({ flag: "tokens", path: path5 }),
|
|
32814
|
-
writeFile: (path5, contents) =>
|
|
32380
|
+
writeFile: (path5, contents) => writeFile7(path5, contents),
|
|
32815
32381
|
appendRun,
|
|
32816
32382
|
buildSourceFingerprint,
|
|
32817
32383
|
sleep: (ms) => new Promise((resolve29) => setTimeout(resolve29, ms)),
|
|
@@ -32834,9 +32400,9 @@ var init_types9 = __esm({
|
|
|
32834
32400
|
|
|
32835
32401
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/controller.ts
|
|
32836
32402
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
32837
|
-
import { mkdir as
|
|
32403
|
+
import { mkdir as mkdir8 } from "node:fs/promises";
|
|
32838
32404
|
import { tmpdir } from "node:os";
|
|
32839
|
-
import { join as
|
|
32405
|
+
import { join as join23, resolve as resolve26 } from "node:path";
|
|
32840
32406
|
function appendWizardLog(entry) {
|
|
32841
32407
|
appendFileSync(WIZARD_LOG, JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry }) + "\n");
|
|
32842
32408
|
}
|
|
@@ -32859,7 +32425,7 @@ function realFlowDeps() {
|
|
|
32859
32425
|
}
|
|
32860
32426
|
},
|
|
32861
32427
|
mkdir: async (path5) => {
|
|
32862
|
-
await
|
|
32428
|
+
await mkdir8(path5, { recursive: true });
|
|
32863
32429
|
},
|
|
32864
32430
|
detectSaveConflict,
|
|
32865
32431
|
buildTimestampedSubdir,
|
|
@@ -33089,7 +32655,7 @@ function createFlowController(start, deps) {
|
|
|
33089
32655
|
},
|
|
33090
32656
|
async submitPath(submitted) {
|
|
33091
32657
|
await deps.mkdir(submitted);
|
|
33092
|
-
if (
|
|
32658
|
+
if (resolve26(submitted) !== resolve26(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
33093
32659
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
33094
32660
|
await deps.mkdir(subdir);
|
|
33095
32661
|
await proceedToWrite(subdir);
|
|
@@ -33121,14 +32687,14 @@ var init_controller = __esm({
|
|
|
33121
32687
|
init_push();
|
|
33122
32688
|
init_save();
|
|
33123
32689
|
init_types9();
|
|
33124
|
-
WIZARD_LOG =
|
|
32690
|
+
WIZARD_LOG = join23(tmpdir(), "experiences-import-wizard.log");
|
|
33125
32691
|
}
|
|
33126
32692
|
});
|
|
33127
32693
|
|
|
33128
32694
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
|
|
33129
|
-
import { useEffect as
|
|
32695
|
+
import { useEffect as useEffect21, useRef as useRef14, useSyncExternalStore } from "react";
|
|
33130
32696
|
function useFlow(start, options = {}) {
|
|
33131
|
-
const controller =
|
|
32697
|
+
const controller = useRef14();
|
|
33132
32698
|
if (start && !controller.current) {
|
|
33133
32699
|
try {
|
|
33134
32700
|
startWizardLog();
|
|
@@ -33145,7 +32711,7 @@ function useFlow(start, options = {}) {
|
|
|
33145
32711
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
33146
32712
|
() => current?.getState()
|
|
33147
32713
|
);
|
|
33148
|
-
|
|
32714
|
+
useEffect21(() => {
|
|
33149
32715
|
if (!start) controller.current = void 0;
|
|
33150
32716
|
}, [start]);
|
|
33151
32717
|
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
@@ -33157,6 +32723,302 @@ var init_use_flow = __esm({
|
|
|
33157
32723
|
}
|
|
33158
32724
|
});
|
|
33159
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
|
+
}
|
|
32796
|
+
}
|
|
32797
|
+
} catch {
|
|
32798
|
+
}
|
|
32799
|
+
return result;
|
|
32800
|
+
}
|
|
32801
|
+
var DAY_MS, SESSION_FOLDER;
|
|
32802
|
+
var init_debug_prune = __esm({
|
|
32803
|
+
"packages/experience-design-system-cli/src/tui/debug-prune.ts"() {
|
|
32804
|
+
"use strict";
|
|
32805
|
+
DAY_MS = 24 * 60 * 60 * 1e3;
|
|
32806
|
+
SESSION_FOLDER = /^\d{2}-\d{2}-\d{4}-session-\d+$/;
|
|
32807
|
+
}
|
|
32808
|
+
});
|
|
32809
|
+
|
|
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;
|
|
32841
|
+
}
|
|
32842
|
+
}
|
|
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"() {
|
|
32978
|
+
"use strict";
|
|
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
|
+
});
|
|
33019
|
+
}
|
|
33020
|
+
});
|
|
33021
|
+
|
|
33160
33022
|
// packages/experience-design-system-cli/src/tui/help/file-locations.ts
|
|
33161
33023
|
import { join as join26, resolve as resolve28 } from "node:path";
|
|
33162
33024
|
function describeFileLocations({
|
|
@@ -33224,7 +33086,7 @@ var init_help_info = __esm({
|
|
|
33224
33086
|
});
|
|
33225
33087
|
|
|
33226
33088
|
// packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
|
|
33227
|
-
import { useEffect as
|
|
33089
|
+
import { useEffect as useEffect22, useState as useState31 } from "react";
|
|
33228
33090
|
import { Box as Box46, Text as Text47, useInput as useInput13 } from "ink";
|
|
33229
33091
|
import { Fragment as Fragment17, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
33230
33092
|
function Section({ title, rows }) {
|
|
@@ -33238,7 +33100,7 @@ function Section({ title, rows }) {
|
|
|
33238
33100
|
}
|
|
33239
33101
|
function HelpScreen({ onDone }) {
|
|
33240
33102
|
const [info, setInfo] = useState31();
|
|
33241
|
-
|
|
33103
|
+
useEffect22(() => {
|
|
33242
33104
|
startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
|
|
33243
33105
|
void readHelpInfo().then(setInfo);
|
|
33244
33106
|
}, []);
|
|
@@ -33350,7 +33212,7 @@ var init_PageContainer3 = __esm({
|
|
|
33350
33212
|
import { existsSync as existsSync11 } from "node:fs";
|
|
33351
33213
|
function diffSnapshots(before, after) {
|
|
33352
33214
|
const names = [.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])];
|
|
33353
|
-
const changed_fields = names.filter((
|
|
33215
|
+
const changed_fields = names.filter((name) => before[name] !== after[name]);
|
|
33354
33216
|
return { changed: changed_fields.length > 0, changed_fields };
|
|
33355
33217
|
}
|
|
33356
33218
|
function createTrail(limit = DEFAULT_TRAIL_LIMIT) {
|
|
@@ -33388,11 +33250,11 @@ var init_debug_trail = __esm({
|
|
|
33388
33250
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-status.ts
|
|
33389
33251
|
import { execFile as execFile2 } from "node:child_process";
|
|
33390
33252
|
import { access as access5, constants } from "node:fs/promises";
|
|
33391
|
-
function effectiveBinary(
|
|
33392
|
-
return savedBinary.trim() || AGENT_BINARIES[
|
|
33253
|
+
function effectiveBinary(name, savedBinary) {
|
|
33254
|
+
return savedBinary.trim() || AGENT_BINARIES[name];
|
|
33393
33255
|
}
|
|
33394
|
-
function defaultModelLabel(
|
|
33395
|
-
const model = DEFAULT_MODELS[
|
|
33256
|
+
function defaultModelLabel(name) {
|
|
33257
|
+
const model = DEFAULT_MODELS[name];
|
|
33396
33258
|
return model && model !== "Auto" ? model : "chosen by the agent";
|
|
33397
33259
|
}
|
|
33398
33260
|
function resolveOnPath(binary) {
|
|
@@ -33419,32 +33281,32 @@ function readVersion(binary) {
|
|
|
33419
33281
|
});
|
|
33420
33282
|
});
|
|
33421
33283
|
}
|
|
33422
|
-
async function inspect(
|
|
33423
|
-
const target = effectiveBinary(
|
|
33284
|
+
async function inspect(name, binary) {
|
|
33285
|
+
const target = effectiveBinary(name, binary);
|
|
33424
33286
|
const found = await resolveOnPath(target);
|
|
33425
33287
|
if (!found) return { checks: [fail3("path", `\`${target}\` was not found or is not executable`)], found: null };
|
|
33426
33288
|
const checks = [pass("path", found)];
|
|
33427
33289
|
checks.push(await readVersion(found));
|
|
33428
|
-
if (
|
|
33429
|
-
const auth = await withBinaryEnv(
|
|
33290
|
+
if (name === "claude") {
|
|
33291
|
+
const auth = await withBinaryEnv(name, found, () => checkAgentAuth(name));
|
|
33430
33292
|
checks.push(
|
|
33431
33293
|
auth === "ok" ? pass("login", "logged in") : fail3("login", auth === "not-found" ? "binary not found" : `not logged in: ${LOGIN_HINTS.claude}`)
|
|
33432
33294
|
);
|
|
33433
33295
|
}
|
|
33434
33296
|
return { checks, found };
|
|
33435
33297
|
}
|
|
33436
|
-
async function inspectAgent(
|
|
33437
|
-
return (await inspect(
|
|
33298
|
+
async function inspectAgent(name, binary) {
|
|
33299
|
+
return (await inspect(name, binary)).checks;
|
|
33438
33300
|
}
|
|
33439
|
-
async function testAgent(
|
|
33440
|
-
const { checks, found } = await inspect(
|
|
33301
|
+
async function testAgent(name, binary, model) {
|
|
33302
|
+
const { checks, found } = await inspect(name, binary);
|
|
33441
33303
|
if (!found || !checks.every((check) => check.step === "version" || check.ok)) return checks;
|
|
33442
33304
|
const started = Date.now();
|
|
33443
33305
|
const result = await withBinaryEnv(
|
|
33444
|
-
|
|
33306
|
+
name,
|
|
33445
33307
|
found,
|
|
33446
33308
|
() => createLocalCliAgentInvoker().invoke({
|
|
33447
|
-
agent:
|
|
33309
|
+
agent: name,
|
|
33448
33310
|
...model.trim() ? { model: model.trim() } : {},
|
|
33449
33311
|
prompt: TEST_PROMPT,
|
|
33450
33312
|
timeoutMs: PROMPT_TIMEOUT_MS
|
|
@@ -33460,7 +33322,7 @@ async function testAgent(name2, binary, model) {
|
|
|
33460
33322
|
}
|
|
33461
33323
|
return [...checks, pass("prompt", `answered in ${seconds}s`)];
|
|
33462
33324
|
}
|
|
33463
|
-
function statusFromChecks(
|
|
33325
|
+
function statusFromChecks(name, checks, savedBinary) {
|
|
33464
33326
|
if (checks.length === 0) return "checking";
|
|
33465
33327
|
if (checks.some((check) => check.step === "path" && !check.ok)) {
|
|
33466
33328
|
return savedBinary.trim() ? "not-found" : "not-configured";
|
|
@@ -33472,13 +33334,13 @@ function statusFromChecks(name2, checks, savedBinary) {
|
|
|
33472
33334
|
}
|
|
33473
33335
|
const login = checks.find((check) => check.step === "login");
|
|
33474
33336
|
if (login) return login.ok ? "ready" : "not-logged-in";
|
|
33475
|
-
return
|
|
33337
|
+
return name === "claude" ? "ready" : "unknown";
|
|
33476
33338
|
}
|
|
33477
|
-
function setupHint(
|
|
33478
|
-
if (status === "not-configured") return `${INSTALL_HINTS[
|
|
33479
|
-
if (status === "not-found") return `${INSTALL_HINTS[
|
|
33480
|
-
if (status === "not-logged-in") return LOGIN_HINTS[
|
|
33481
|
-
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[
|
|
33339
|
+
function setupHint(name, status) {
|
|
33340
|
+
if (status === "not-configured") return `${INSTALL_HINTS[name]}, or set its command path in settings`;
|
|
33341
|
+
if (status === "not-found") return `${INSTALL_HINTS[name]}, or correct the command path in settings`;
|
|
33342
|
+
if (status === "not-logged-in") return LOGIN_HINTS[name];
|
|
33343
|
+
if (status === "test-failed") return `read the test message; if it is a login problem, ${LOGIN_HINTS[name]}`;
|
|
33482
33344
|
if (status === "timed-out") return "it may be slow or waiting for input; run the test again, or try it in a terminal";
|
|
33483
33345
|
if (status === "unknown") return "run a full test to confirm it is logged in";
|
|
33484
33346
|
return "";
|
|
@@ -33490,14 +33352,14 @@ function testOutcome(checks) {
|
|
|
33490
33352
|
if (prompt.timedOut) return { ok: false, text: `Test timed out: ${prompt.detail}` };
|
|
33491
33353
|
return { ok: false, text: `Test failed: ${prompt.detail}` };
|
|
33492
33354
|
}
|
|
33493
|
-
function modelLine(
|
|
33355
|
+
function modelLine(name, savedModel) {
|
|
33494
33356
|
const model = savedModel.trim();
|
|
33495
|
-
return model ? model : `${defaultModelLabel(
|
|
33357
|
+
return model ? model : `${defaultModelLabel(name)} (built-in default)`;
|
|
33496
33358
|
}
|
|
33497
|
-
function baseRows(
|
|
33359
|
+
function baseRows(name, checks, savedBinary) {
|
|
33498
33360
|
const path5 = checks.find((check) => check.step === "path");
|
|
33499
33361
|
const version2 = checks.find((check) => check.step === "version");
|
|
33500
|
-
const hint = setupHint(
|
|
33362
|
+
const hint = setupHint(name, statusFromChecks(name, checks, savedBinary));
|
|
33501
33363
|
const setup = hint ? { label: "Setup", value: hint, tone: "muted" } : void 0;
|
|
33502
33364
|
if (!path5?.ok) {
|
|
33503
33365
|
const saved = savedBinary.trim() !== "";
|
|
@@ -33519,15 +33381,15 @@ function baseRows(name2, checks, savedBinary) {
|
|
|
33519
33381
|
found: true
|
|
33520
33382
|
};
|
|
33521
33383
|
}
|
|
33522
|
-
function panelRows(
|
|
33384
|
+
function panelRows(name, checks, settings) {
|
|
33523
33385
|
if (!checks) return checking;
|
|
33524
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
33525
|
-
const model = { label: "Model", value: modelLine(
|
|
33386
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, settings.binary);
|
|
33387
|
+
const model = { label: "Model", value: modelLine(name, settings.model), tone: "muted" };
|
|
33526
33388
|
return [command, ...found ? [...version2?.tone === "ok" ? [version2] : [], model] : [], ...setup ? [setup] : []];
|
|
33527
33389
|
}
|
|
33528
|
-
function statusRows(
|
|
33390
|
+
function statusRows(name, checks, savedBinary) {
|
|
33529
33391
|
if (!checks) return checking;
|
|
33530
|
-
const { command, version: version2, setup, found } = baseRows(
|
|
33392
|
+
const { command, version: version2, setup, found } = baseRows(name, checks, savedBinary);
|
|
33531
33393
|
if (!found) return [command];
|
|
33532
33394
|
const login = checks.find((check) => check.step === "login");
|
|
33533
33395
|
const prompt = checks.find((check) => check.step === "prompt");
|
|
@@ -33546,8 +33408,8 @@ function statusRows(name2, checks, savedBinary) {
|
|
|
33546
33408
|
const testRow = prompt ? [{ label: "Test", value: prompt.detail, tone: prompt.ok ? "ok" : "bad" }] : [];
|
|
33547
33409
|
return [command, ...version2 ? [version2] : [], loginRow, ...testRow, ...setup ? [setup] : []];
|
|
33548
33410
|
}
|
|
33549
|
-
async function withBinaryEnv(
|
|
33550
|
-
const key = `EDS_AGENT_BINARY_${
|
|
33411
|
+
async function withBinaryEnv(name, binary, run) {
|
|
33412
|
+
const key = `EDS_AGENT_BINARY_${name.toUpperCase()}`;
|
|
33551
33413
|
const previous = process.env[key];
|
|
33552
33414
|
process.env[key] = binary;
|
|
33553
33415
|
try {
|
|
@@ -33598,9 +33460,9 @@ var init_agent_status = __esm({
|
|
|
33598
33460
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/agent-debug.ts
|
|
33599
33461
|
function agentSnapshot(config) {
|
|
33600
33462
|
const snapshot = { default_agent: config.defaultAgent };
|
|
33601
|
-
for (const
|
|
33602
|
-
snapshot[`${
|
|
33603
|
-
snapshot[`${
|
|
33463
|
+
for (const name of AGENT_NAMES) {
|
|
33464
|
+
snapshot[`${name}.model`] = config.agents[name].model;
|
|
33465
|
+
snapshot[`${name}.binary`] = config.agents[name].binary;
|
|
33604
33466
|
}
|
|
33605
33467
|
return snapshot;
|
|
33606
33468
|
}
|
|
@@ -33617,10 +33479,10 @@ function environmentFrom(checks, savedBinary, envValue) {
|
|
|
33617
33479
|
}
|
|
33618
33480
|
async function describeAgents(config) {
|
|
33619
33481
|
const entries = await Promise.all(
|
|
33620
|
-
AGENT_NAMES.map(async (
|
|
33621
|
-
const saved = config.agents[
|
|
33622
|
-
const checks = await inspectAgent(
|
|
33623
|
-
return [
|
|
33482
|
+
AGENT_NAMES.map(async (name) => {
|
|
33483
|
+
const saved = config.agents[name].binary;
|
|
33484
|
+
const checks = await inspectAgent(name, saved);
|
|
33485
|
+
return [name, environmentFrom(checks, saved, process.env[`EDS_AGENT_BINARY_${name.toUpperCase()}`])];
|
|
33624
33486
|
})
|
|
33625
33487
|
);
|
|
33626
33488
|
return Object.fromEntries(entries);
|
|
@@ -33637,11 +33499,11 @@ var init_agent_debug = __esm({
|
|
|
33637
33499
|
import { Text as Text49 } from "ink";
|
|
33638
33500
|
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
33639
33501
|
function AgentStatusBadge({
|
|
33640
|
-
name
|
|
33502
|
+
name,
|
|
33641
33503
|
checks,
|
|
33642
33504
|
binary
|
|
33643
33505
|
}) {
|
|
33644
|
-
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(
|
|
33506
|
+
const { symbol, text, tone } = LIST_STATUS[checks ? statusFromChecks(name, checks, binary) : "checking"];
|
|
33645
33507
|
return /* @__PURE__ */ jsx59(Text49, { color: TONE_COLOR[tone], children: `${symbol} ${text}` });
|
|
33646
33508
|
}
|
|
33647
33509
|
var TONE_COLOR;
|
|
@@ -33659,7 +33521,7 @@ var init_AgentStatusBadge = __esm({
|
|
|
33659
33521
|
});
|
|
33660
33522
|
|
|
33661
33523
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentDetail.tsx
|
|
33662
|
-
import { useEffect as
|
|
33524
|
+
import { useEffect as useEffect23, useState as useState33 } from "react";
|
|
33663
33525
|
import { Box as Box48, Text as Text50 } from "ink";
|
|
33664
33526
|
import { jsx as jsx60, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
33665
33527
|
function StatusHeading() {
|
|
@@ -33669,53 +33531,53 @@ function StatusHeading() {
|
|
|
33669
33531
|
] });
|
|
33670
33532
|
}
|
|
33671
33533
|
function AgentDetail({
|
|
33672
|
-
name
|
|
33534
|
+
name,
|
|
33673
33535
|
config,
|
|
33674
33536
|
setConfig,
|
|
33675
33537
|
onBack,
|
|
33676
33538
|
record: record3
|
|
33677
33539
|
}) {
|
|
33678
|
-
const settings = config.agents[
|
|
33540
|
+
const settings = config.agents[name];
|
|
33679
33541
|
const [saving, setSaving] = useState33(false);
|
|
33680
33542
|
const [testing, setTesting] = useState33(false);
|
|
33681
33543
|
const [notice, setNotice] = useState33(null);
|
|
33682
33544
|
const [checks, setChecks] = useState33(void 0);
|
|
33683
|
-
|
|
33545
|
+
useEffect23(() => {
|
|
33684
33546
|
let active = true;
|
|
33685
33547
|
setChecks(void 0);
|
|
33686
33548
|
const timer = setTimeout(() => {
|
|
33687
|
-
void inspectAgent(
|
|
33549
|
+
void inspectAgent(name, settings.binary).then((result) => active && setChecks(result));
|
|
33688
33550
|
}, INSPECT_DELAY_MS);
|
|
33689
33551
|
return () => {
|
|
33690
33552
|
active = false;
|
|
33691
33553
|
clearTimeout(timer);
|
|
33692
33554
|
};
|
|
33693
|
-
}, [
|
|
33555
|
+
}, [name, settings.binary]);
|
|
33694
33556
|
const save = () => {
|
|
33695
33557
|
setSaving(true);
|
|
33696
33558
|
setNotice(null);
|
|
33697
33559
|
writeAgentConfig(config).then(() => {
|
|
33698
33560
|
applyBinaryOverrides(config);
|
|
33699
|
-
record3(`saved ${
|
|
33700
|
-
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[
|
|
33561
|
+
record3(`saved ${name}`);
|
|
33562
|
+
setNotice({ kind: "success", text: `Saved: ${AGENT_LABELS[name]} settings are written to config.json` });
|
|
33701
33563
|
}).catch((err) => {
|
|
33702
|
-
record3(`saving ${
|
|
33564
|
+
record3(`saving ${name} failed`, err);
|
|
33703
33565
|
setNotice({ kind: "error", text: `Not saved: ${err instanceof Error ? err.message : String(err)}` });
|
|
33704
33566
|
}).finally(() => setSaving(false));
|
|
33705
33567
|
};
|
|
33706
33568
|
const runTest = () => {
|
|
33707
33569
|
setTesting(true);
|
|
33708
33570
|
setNotice(null);
|
|
33709
|
-
testAgent(
|
|
33571
|
+
testAgent(name, settings.binary, settings.model).then((result) => {
|
|
33710
33572
|
setChecks(result);
|
|
33711
33573
|
const outcome = testOutcome(result);
|
|
33712
33574
|
if (!outcome || !outcome.ok)
|
|
33713
|
-
record3(`test of ${
|
|
33575
|
+
record3(`test of ${name} failed: ${outcome?.text ?? "the agent could not be started"}`);
|
|
33714
33576
|
setNotice(
|
|
33715
33577
|
outcome ? { kind: outcome.ok ? "success" : "error", text: outcome.text } : { kind: "error", text: "Test not run: the agent could not be started (see Status)" }
|
|
33716
33578
|
);
|
|
33717
33579
|
}).catch((err) => {
|
|
33718
|
-
record3(`test of ${
|
|
33580
|
+
record3(`test of ${name} could not run`, err);
|
|
33719
33581
|
setNotice({ kind: "error", text: `Test could not run: ${err instanceof Error ? err.message : String(err)}` });
|
|
33720
33582
|
}).finally(() => setTesting(false));
|
|
33721
33583
|
};
|
|
@@ -33726,19 +33588,19 @@ function AgentDetail({
|
|
|
33726
33588
|
hint: "run test",
|
|
33727
33589
|
onRun: runTest
|
|
33728
33590
|
};
|
|
33729
|
-
const formFields = fields(
|
|
33591
|
+
const formFields = fields(name);
|
|
33730
33592
|
const labelWidth = formLabelWidth([...formFields, action]);
|
|
33731
33593
|
return /* @__PURE__ */ jsx60(
|
|
33732
33594
|
FieldForm,
|
|
33733
33595
|
{
|
|
33734
|
-
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[
|
|
33735
|
-
subtitle: config.defaultAgent ===
|
|
33596
|
+
title: `Settings \u203A Configuration \u203A Agents \u203A ${AGENT_LABELS[name]}`,
|
|
33597
|
+
subtitle: config.defaultAgent === name ? "This is the default agent." : `Runs the \`${AGENT_BINARIES[name]}\` command.`,
|
|
33736
33598
|
fields: formFields,
|
|
33737
33599
|
values: { binary: settings.binary, model: settings.model },
|
|
33738
33600
|
onChange: (key, value) => {
|
|
33739
|
-
setConfig({ ...config, agents: { ...config.agents, [
|
|
33601
|
+
setConfig({ ...config, agents: { ...config.agents, [name]: { ...settings, [key]: value } } });
|
|
33740
33602
|
setNotice(null);
|
|
33741
|
-
record3(`edited ${
|
|
33603
|
+
record3(`edited ${name}.${key}`);
|
|
33742
33604
|
},
|
|
33743
33605
|
onSave: save,
|
|
33744
33606
|
onQuit: onBack,
|
|
@@ -33747,7 +33609,7 @@ function AgentDetail({
|
|
|
33747
33609
|
busy: saving || testing,
|
|
33748
33610
|
children: /* @__PURE__ */ jsxs48(Box48, { flexDirection: "column", marginTop: 1, children: [
|
|
33749
33611
|
/* @__PURE__ */ jsx60(StatusHeading, {}),
|
|
33750
|
-
statusRows(
|
|
33612
|
+
statusRows(name, checks, settings.binary).map((row) => /* @__PURE__ */ jsx60(FormReadOnlyRow, { label: row.label, labelWidth, children: /* @__PURE__ */ jsx60(Text50, { color: TONE_COLOR[row.tone], children: row.value }) }, row.label))
|
|
33751
33613
|
] })
|
|
33752
33614
|
}
|
|
33753
33615
|
);
|
|
@@ -33763,16 +33625,16 @@ var init_AgentDetail = __esm({
|
|
|
33763
33625
|
init_agent_status();
|
|
33764
33626
|
init_AgentStatusBadge();
|
|
33765
33627
|
init_apply_binary_overrides();
|
|
33766
|
-
fields = (
|
|
33767
|
-
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[
|
|
33768
|
-
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(
|
|
33628
|
+
fields = (name) => [
|
|
33629
|
+
{ key: "binary", label: "Command path", hint: `(empty: \`${AGENT_BINARIES[name]}\` from the PATH)` },
|
|
33630
|
+
{ key: "model", label: "Model", hint: `(empty: ${defaultModelLabel(name)})` }
|
|
33769
33631
|
];
|
|
33770
33632
|
INSPECT_DELAY_MS = 400;
|
|
33771
33633
|
}
|
|
33772
33634
|
});
|
|
33773
33635
|
|
|
33774
33636
|
// packages/experience-design-system-cli/src/tui/settings/configuration/agents/AgentsScreen.tsx
|
|
33775
|
-
import { useEffect as
|
|
33637
|
+
import { useEffect as useEffect24, useRef as useRef15, useState as useState34 } from "react";
|
|
33776
33638
|
import { Box as Box49, Text as Text51, useInput as useInput15 } from "ink";
|
|
33777
33639
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
33778
33640
|
function AgentsScreen({ onDone }) {
|
|
@@ -33783,20 +33645,20 @@ function AgentsScreen({ onDone }) {
|
|
|
33783
33645
|
const [saving, setSaving] = useState34(false);
|
|
33784
33646
|
const [loadError, setLoadError] = useState34(null);
|
|
33785
33647
|
const [checks, setChecks] = useState34({});
|
|
33786
|
-
const visit =
|
|
33648
|
+
const visit = useRef15({
|
|
33787
33649
|
trail: createTrail(),
|
|
33788
33650
|
before: void 0,
|
|
33789
33651
|
environment: void 0,
|
|
33790
33652
|
error: ""
|
|
33791
33653
|
}).current;
|
|
33792
33654
|
const inspectAll = (loaded) => {
|
|
33793
|
-
for (const
|
|
33794
|
-
void inspectAgent(
|
|
33795
|
-
(result) => setChecks((previous) => ({ ...previous, [
|
|
33655
|
+
for (const name of AGENT_NAMES) {
|
|
33656
|
+
void inspectAgent(name, loaded.agents[name].binary).then(
|
|
33657
|
+
(result) => setChecks((previous) => ({ ...previous, [name]: result }))
|
|
33796
33658
|
);
|
|
33797
33659
|
}
|
|
33798
33660
|
};
|
|
33799
|
-
|
|
33661
|
+
useEffect24(() => {
|
|
33800
33662
|
readAgentConfig().then((loaded) => {
|
|
33801
33663
|
setConfig(loaded);
|
|
33802
33664
|
inspectAll(loaded);
|
|
@@ -33832,21 +33694,21 @@ function AgentsScreen({ onDone }) {
|
|
|
33832
33694
|
exitMethod: change.changed ? "saved" : "discarded"
|
|
33833
33695
|
});
|
|
33834
33696
|
};
|
|
33835
|
-
const makeDefault = (
|
|
33697
|
+
const makeDefault = (name) => {
|
|
33836
33698
|
if (!config || saving) return;
|
|
33837
|
-
if (
|
|
33838
|
-
setNotice({ kind: "success", text: `${AGENT_LABELS[
|
|
33699
|
+
if (name === config.defaultAgent) {
|
|
33700
|
+
setNotice({ kind: "success", text: `${AGENT_LABELS[name]} is already the default agent` });
|
|
33839
33701
|
return;
|
|
33840
33702
|
}
|
|
33841
33703
|
setSaving(true);
|
|
33842
33704
|
setNotice(null);
|
|
33843
|
-
writeAgentConfig({ ...config, defaultAgent:
|
|
33844
|
-
setConfig((current) => current ? { ...current, defaultAgent:
|
|
33845
|
-
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[
|
|
33846
|
-
visit.trail.record(`made ${
|
|
33705
|
+
writeAgentConfig({ ...config, defaultAgent: name, defaultChosen: true }).then(() => {
|
|
33706
|
+
setConfig((current) => current ? { ...current, defaultAgent: name, defaultChosen: true } : current);
|
|
33707
|
+
setNotice({ kind: "success", text: `Default agent is now ${AGENT_LABELS[name]}` });
|
|
33708
|
+
visit.trail.record(`made ${name} the default`);
|
|
33847
33709
|
}).catch((err) => {
|
|
33848
33710
|
visit.error = scrubError(err, []);
|
|
33849
|
-
visit.trail.record(`making ${
|
|
33711
|
+
visit.trail.record(`making ${name} the default failed`);
|
|
33850
33712
|
setNotice({ kind: "error", text: `Default agent not changed: ${visit.error}` });
|
|
33851
33713
|
}).finally(() => setSaving(false));
|
|
33852
33714
|
};
|
|
@@ -33933,14 +33795,14 @@ function AgentsScreen({ onDone }) {
|
|
|
33933
33795
|
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "AGENT" }) }),
|
|
33934
33796
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: "STATUS" })
|
|
33935
33797
|
] }),
|
|
33936
|
-
AGENT_NAMES.map((
|
|
33937
|
-
const isFocused = focusedAgent ===
|
|
33798
|
+
AGENT_NAMES.map((name) => {
|
|
33799
|
+
const isFocused = focusedAgent === name;
|
|
33938
33800
|
return /* @__PURE__ */ jsxs49(Box49, { gap: 1, children: [
|
|
33939
33801
|
/* @__PURE__ */ jsx61(Text51, { color: isFocused ? PALETTE.accent : void 0, children: isFocused ? "\u276F" : " " }),
|
|
33940
|
-
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children:
|
|
33941
|
-
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[
|
|
33942
|
-
/* @__PURE__ */ jsx61(AgentStatusBadge, { name
|
|
33943
|
-
] },
|
|
33802
|
+
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.success, children: name === config.defaultAgent ? "\u2605" : " " }),
|
|
33803
|
+
/* @__PURE__ */ jsx61(Box49, { width: NAME_WIDTH, flexShrink: 0, children: /* @__PURE__ */ jsx61(Text51, { bold: isFocused, color: isFocused ? PALETTE.accent : void 0, children: AGENT_LABELS[name] }) }),
|
|
33804
|
+
/* @__PURE__ */ jsx61(AgentStatusBadge, { name, checks: checks[name], binary: config.agents[name].binary })
|
|
33805
|
+
] }, name);
|
|
33944
33806
|
}),
|
|
33945
33807
|
/* @__PURE__ */ jsxs49(Box49, { flexDirection: "column", marginTop: 1, children: [
|
|
33946
33808
|
/* @__PURE__ */ jsx61(Text51, { color: PALETTE.muted, children: `\u2500 ${AGENT_LABELS[focusedAgent]} ${"\u2500".repeat(30)}` }),
|
|
@@ -34022,7 +33884,7 @@ var init_project_store = __esm({
|
|
|
34022
33884
|
});
|
|
34023
33885
|
|
|
34024
33886
|
// packages/experience-design-system-cli/src/tui/settings/configuration/project/ProjectScreen.tsx
|
|
34025
|
-
import { useEffect as
|
|
33887
|
+
import { useEffect as useEffect25, useRef as useRef16, useState as useState35 } from "react";
|
|
34026
33888
|
import { Box as Box50, Text as Text52, useInput as useInput16 } from "ink";
|
|
34027
33889
|
import { Fragment as Fragment19, jsx as jsx62, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
34028
33890
|
function debugFields(config) {
|
|
@@ -34041,14 +33903,14 @@ function ProjectScreen({ onDone }) {
|
|
|
34041
33903
|
const [saving, setSaving] = useState35(false);
|
|
34042
33904
|
const [notice, setNotice] = useState35(null);
|
|
34043
33905
|
const [loadError, setLoadError] = useState35(null);
|
|
34044
|
-
const visit =
|
|
33906
|
+
const visit = useRef16({
|
|
34045
33907
|
trail: createTrail(),
|
|
34046
33908
|
before: void 0,
|
|
34047
33909
|
persisted: void 0,
|
|
34048
33910
|
error: ""
|
|
34049
33911
|
}).current;
|
|
34050
33912
|
const scrub = (err) => scrubError(err, [config?.cmaToken ?? ""]);
|
|
34051
|
-
|
|
33913
|
+
useEffect25(() => {
|
|
34052
33914
|
readCredentials().then((cfg) => {
|
|
34053
33915
|
setConfig(cfg);
|
|
34054
33916
|
visit.before = snapshotOf(cfg);
|
|
@@ -34235,13 +34097,13 @@ var init_ConfigurationScreen = __esm({
|
|
|
34235
34097
|
});
|
|
34236
34098
|
|
|
34237
34099
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
34238
|
-
import { useEffect as
|
|
34100
|
+
import { useEffect as useEffect26, useState as useState37 } from "react";
|
|
34239
34101
|
import { Box as Box52, Text as Text54, useInput as useInput18 } from "ink";
|
|
34240
34102
|
import { Fragment as Fragment20, jsx as jsx64, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
34241
34103
|
function OptInAnalyticsScreen({ onDone }) {
|
|
34242
34104
|
const [loading, setLoading] = useState37(true);
|
|
34243
34105
|
const [enabled, setEnabled] = useState37(true);
|
|
34244
|
-
|
|
34106
|
+
useEffect26(() => {
|
|
34245
34107
|
readAnalyticsSetting().then((setting) => {
|
|
34246
34108
|
setEnabled(setting.enabled);
|
|
34247
34109
|
setLoading(false);
|
|
@@ -34304,7 +34166,7 @@ var init_screen12 = __esm({
|
|
|
34304
34166
|
});
|
|
34305
34167
|
|
|
34306
34168
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
|
|
34307
|
-
import { useEffect as
|
|
34169
|
+
import { useEffect as useEffect27, useRef as useRef17, useState as useState38 } from "react";
|
|
34308
34170
|
import { Box as Box53, Text as Text55, useInput as useInput19 } from "ink";
|
|
34309
34171
|
import { Fragment as Fragment21, jsx as jsx65, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
34310
34172
|
function DebugModeScreen({ onDone }) {
|
|
@@ -34314,8 +34176,8 @@ function DebugModeScreen({ onDone }) {
|
|
|
34314
34176
|
RETENTION_CHOICES[RETENTION_CHOICES.length - 1]
|
|
34315
34177
|
);
|
|
34316
34178
|
const [notice, setNotice] = useState38(null);
|
|
34317
|
-
const visit =
|
|
34318
|
-
|
|
34179
|
+
const visit = useRef17({ trail: createTrail(), before: void 0, error: "" }).current;
|
|
34180
|
+
useEffect27(() => {
|
|
34319
34181
|
readDebugModeSetting().then((loaded) => {
|
|
34320
34182
|
setSetting(loaded);
|
|
34321
34183
|
setPending(loaded.retentionDays);
|
|
@@ -34456,7 +34318,7 @@ var app_exports = {};
|
|
|
34456
34318
|
__export(app_exports, {
|
|
34457
34319
|
runApp: () => runApp
|
|
34458
34320
|
});
|
|
34459
|
-
import { useEffect as
|
|
34321
|
+
import { useEffect as useEffect28, useState as useState39 } from "react";
|
|
34460
34322
|
import { Fragment as Fragment22, jsx as jsx66 } from "react/jsx-runtime";
|
|
34461
34323
|
function App({ importOptions, inkClear }) {
|
|
34462
34324
|
const [screen, setScreen] = useState39("start");
|
|
@@ -34490,7 +34352,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34490
34352
|
const [flowStart, setFlowStart] = useState39();
|
|
34491
34353
|
const flow = useFlow(flowStart, { beforeStepChange: inkClear });
|
|
34492
34354
|
const [importDefaults, setImportDefaults] = useState39();
|
|
34493
|
-
|
|
34355
|
+
useEffect28(() => {
|
|
34494
34356
|
if (screen !== "import") {
|
|
34495
34357
|
setImportDefaults(void 0);
|
|
34496
34358
|
return;
|
|
@@ -34563,7 +34425,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34563
34425
|
}
|
|
34564
34426
|
});
|
|
34565
34427
|
};
|
|
34566
|
-
|
|
34428
|
+
useEffect28(() => {
|
|
34567
34429
|
if (!tokensOnlyRun || tokensOnly?.status !== "done" || !tokensOnly.result.ok) return;
|
|
34568
34430
|
const { credentialsSkipped, input, tokens } = tokensOnlyRun;
|
|
34569
34431
|
const { tokensPath, tokenSessionId, tokenCount } = tokensOnly.result;
|
|
@@ -34585,12 +34447,12 @@ function App({ importOptions, inkClear }) {
|
|
|
34585
34447
|
}
|
|
34586
34448
|
});
|
|
34587
34449
|
}, [tokensOnly, tokensOnlyRun]);
|
|
34588
|
-
|
|
34450
|
+
useEffect28(() => {
|
|
34589
34451
|
if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
|
|
34590
34452
|
setExtractionRun(void 0);
|
|
34591
34453
|
setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
|
|
34592
34454
|
}, [extraction, extractionRun]);
|
|
34593
|
-
|
|
34455
|
+
useEffect28(() => {
|
|
34594
34456
|
if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
|
|
34595
34457
|
const { extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34596
34458
|
setGenerationInput({
|
|
@@ -34608,7 +34470,7 @@ function App({ importOptions, inkClear }) {
|
|
|
34608
34470
|
...generatePromptPath ? { generatePromptPath } : {}
|
|
34609
34471
|
});
|
|
34610
34472
|
}, [scopeFlow, scopeRun, generationInput]);
|
|
34611
|
-
|
|
34473
|
+
useEffect28(() => {
|
|
34612
34474
|
if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
|
|
34613
34475
|
const { credentialsSkipped, extraction: produced, input, generatePromptPath } = scopeRun;
|
|
34614
34476
|
inkClear();
|