@contentful/experience-design-system-cli 2.37.1-dev-build-a6ad74de.0 → 2.37.1-dev-build-ed4a0d5c.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 +456 -197
- package/dist/index.js +1943 -1493
- package/dist/package.json +1 -1
- package/dist/src/tui/import/steps/10-flow/flow/preview.d.ts +2 -0
- package/dist/src/tui/import/steps/10-flow/flow/push.d.ts +2 -0
- package/legacy/dist/src/analytics/exit.d.ts +1 -1
- package/legacy/dist/src/analytics/index.d.ts +2 -5
- package/legacy/dist/src/index.js +18680 -18565
- package/legacy/package.json +1 -1
- package/package.json +3 -3
- package/legacy/dist/src/analytics/apply.d.ts +0 -6
- package/legacy/dist/src/analytics/client.d.ts +0 -8
- package/legacy/dist/src/analytics/constants.d.ts +0 -4
- package/legacy/dist/src/analytics/normalize.d.ts +0 -3
- package/legacy/dist/src/analytics/os.d.ts +0 -2
- package/legacy/dist/src/analytics/session.d.ts +0 -3
- package/legacy/dist/src/analytics/tracker.d.ts +0 -16
- package/legacy/dist/src/analytics/types.d.ts +0 -28
package/dist/index.js
CHANGED
|
@@ -8,868 +8,247 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// packages/experience-design-system-
|
|
12
|
-
import {
|
|
11
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
13
|
import { dirname, join } from "node:path";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let dir = dirname(fileURLToPath(startUrl));
|
|
17
|
-
let found;
|
|
18
|
-
while (true) {
|
|
19
|
-
const manifestPath = join(dir, "package.json");
|
|
20
|
-
if (existsSync(manifestPath)) {
|
|
21
|
-
const pkg2 = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
22
|
-
if (pkg2.name === packageName) found = dir;
|
|
23
|
-
}
|
|
24
|
-
const parent = dirname(dir);
|
|
25
|
-
if (parent === dir) return found ?? dir;
|
|
26
|
-
dir = parent;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
var init_package_root = __esm({
|
|
30
|
-
"packages/experience-design-system-cli/src/tui/package-root.ts"() {
|
|
31
|
-
"use strict";
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// packages/experience-design-system-cli/src/tui/home/home.theme.ts
|
|
36
|
-
function brandBar(width, ramp = BRAND_RAMP) {
|
|
37
|
-
if (width <= 0 || ramp.length === 0) return [];
|
|
38
|
-
const base = Math.floor(width / ramp.length);
|
|
39
|
-
const remainder = width % ramp.length;
|
|
40
|
-
return ramp.map((color, i) => ({
|
|
41
|
-
text: BAR_CELL.repeat(base + (i < remainder ? 1 : 0)),
|
|
42
|
-
color
|
|
43
|
-
})).filter((segment) => segment.text.length > 0);
|
|
14
|
+
function configRoot() {
|
|
15
|
+
return process.env["EDS_HOME"] || join(homedir(), ".contentful", "experience-design-system-cli");
|
|
44
16
|
}
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
"packages/experience-design-system-
|
|
17
|
+
var runsFilePath;
|
|
18
|
+
var init_config_root = __esm({
|
|
19
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js"() {
|
|
48
20
|
"use strict";
|
|
49
|
-
|
|
50
|
-
blue: "#1773EB",
|
|
51
|
-
green: "#00C459",
|
|
52
|
-
orange: "#E44F20",
|
|
53
|
-
yellow: "#FFDA00",
|
|
54
|
-
white: "#FFFFFF",
|
|
55
|
-
slate: "#8B8D91",
|
|
56
|
-
steel: "#C4D1DE"
|
|
57
|
-
};
|
|
58
|
-
PALETTE = {
|
|
59
|
-
accent: BRAND.blue,
|
|
60
|
-
success: BRAND.green,
|
|
61
|
-
error: BRAND.orange,
|
|
62
|
-
warning: BRAND.yellow,
|
|
63
|
-
muted: BRAND.slate,
|
|
64
|
-
border: BRAND.steel
|
|
65
|
-
};
|
|
66
|
-
BRAND_RAMP = [BRAND.blue, BRAND.orange, BRAND.yellow];
|
|
67
|
-
BAR_CELL = "\u2501";
|
|
68
|
-
FOCUS_MARKER = "\u276F";
|
|
21
|
+
runsFilePath = () => join(configRoot(), "state", "runs.json");
|
|
69
22
|
}
|
|
70
23
|
});
|
|
71
24
|
|
|
72
|
-
// packages/experience-design-system-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
import semver from "semver";
|
|
76
|
-
function readPackageVersion() {
|
|
77
|
-
const root = findPackageRoot(import.meta.url, PACKAGE_NAME3);
|
|
78
|
-
const pkg2 = JSON.parse(readFileSync2(join4(root, "package.json"), "utf8"));
|
|
79
|
-
return pkg2.version ?? "unknown";
|
|
25
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
|
|
26
|
+
function escapeForRegExp(value) {
|
|
27
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
80
28
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
return match2 ? match2[1] : void 0;
|
|
29
|
+
function identifierPattern(name) {
|
|
30
|
+
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name)}(?![A-Za-z0-9_$])`);
|
|
84
31
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
32
|
+
function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
33
|
+
if (text.length <= maxChars)
|
|
34
|
+
return { content: text, usesNotShown: [] };
|
|
35
|
+
const patterns = names.filter((name) => name.length > 0).map((name) => ({ name, pattern: identifierPattern(name) }));
|
|
36
|
+
const lines = text.split("\n");
|
|
37
|
+
const windows = [];
|
|
38
|
+
lines.forEach((line, index) => {
|
|
39
|
+
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name }) => name);
|
|
40
|
+
if (mentioned.length === 0)
|
|
41
|
+
return;
|
|
42
|
+
const start = Math.max(0, index - contextLines);
|
|
43
|
+
const end = Math.min(lines.length - 1, index + contextLines);
|
|
44
|
+
const last = windows[windows.length - 1];
|
|
45
|
+
if (last && start <= last.end + 1) {
|
|
46
|
+
last.end = Math.max(last.end, end);
|
|
47
|
+
for (const name of mentioned)
|
|
48
|
+
last.names.add(name);
|
|
49
|
+
} else {
|
|
50
|
+
windows.push({ start, end, names: new Set(mentioned) });
|
|
97
51
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return {
|
|
52
|
+
});
|
|
53
|
+
if (windows.length === 0) {
|
|
54
|
+
return { content: `${text.slice(0, maxChars)}
|
|
55
|
+
${TRUNCATED_MARKER}`, usesNotShown: [] };
|
|
101
56
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
57
|
+
const lastWindowFor = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const window of windows)
|
|
59
|
+
for (const name of window.names)
|
|
60
|
+
lastWindowFor.set(name, window);
|
|
61
|
+
const kept = [];
|
|
62
|
+
const cut = /* @__PURE__ */ new Set();
|
|
63
|
+
let used = 0;
|
|
64
|
+
for (const window of [...windows].reverse()) {
|
|
65
|
+
const chunk = lines.slice(window.start, window.end + 1).join("\n");
|
|
66
|
+
const separator = kept.length > 0 ? `
|
|
67
|
+
${ELLIPSIS_MARKER}
|
|
68
|
+
` : "";
|
|
69
|
+
if (used + separator.length + chunk.length > maxChars) {
|
|
70
|
+
if (kept.length === 0) {
|
|
71
|
+
const head = chunk.slice(0, maxChars);
|
|
72
|
+
kept.push({ window, text: head });
|
|
73
|
+
used += head.length;
|
|
74
|
+
for (const name of window.names) {
|
|
75
|
+
if (lastWindowFor.get(name) === window && !identifierPattern(name).test(head))
|
|
76
|
+
cut.add(name);
|
|
77
|
+
}
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
for (const name of window.names) {
|
|
81
|
+
if (lastWindowFor.get(name) === window)
|
|
82
|
+
cut.add(name);
|
|
83
|
+
}
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
kept.push({ window, text: chunk });
|
|
87
|
+
used += separator.length + chunk.length;
|
|
110
88
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return columns > 0 ? columns : FALLBACK_COLUMNS;
|
|
119
|
-
}
|
|
120
|
-
function useTerminalWidth() {
|
|
121
|
-
const { stdout } = useStdout();
|
|
122
|
-
const [columns, setColumns] = useState(() => readColumns(stdout));
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
if (!stdout) return;
|
|
125
|
-
const onResize = () => setColumns(readColumns(stdout));
|
|
126
|
-
onResize();
|
|
127
|
-
stdout.on("resize", onResize);
|
|
128
|
-
return () => {
|
|
129
|
-
stdout.off("resize", onResize);
|
|
130
|
-
};
|
|
131
|
-
}, [stdout]);
|
|
132
|
-
return columns;
|
|
89
|
+
kept.sort((a, b) => a.window.start - b.window.start);
|
|
90
|
+
const parts = kept.map((entry, index) => (index > 0 ? `
|
|
91
|
+
${ELLIPSIS_MARKER}
|
|
92
|
+
` : "") + entry.text);
|
|
93
|
+
const usesNotShown = names.filter((name, index) => cut.has(name) && names.indexOf(name) === index);
|
|
94
|
+
return { content: `${parts.join("")}
|
|
95
|
+
${TRUNCATED_MARKER}`, usesNotShown };
|
|
133
96
|
}
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
"packages/experience-design-system-
|
|
97
|
+
var ELLIPSIS_MARKER, TRUNCATED_MARKER;
|
|
98
|
+
var init_source_excerpt = __esm({
|
|
99
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js"() {
|
|
137
100
|
"use strict";
|
|
138
|
-
|
|
101
|
+
ELLIPSIS_MARKER = "/* \u2026 */";
|
|
102
|
+
TRUNCATED_MARKER = "/* truncated */";
|
|
139
103
|
}
|
|
140
104
|
});
|
|
141
105
|
|
|
142
|
-
// packages/experience-design-system-
|
|
143
|
-
import {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) => `[${hint.keys}] ${hint.label}`).join(" \xB7 ") });
|
|
106
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js
|
|
107
|
+
import { createHash } from "node:crypto";
|
|
108
|
+
function deriveComponentId(name, source) {
|
|
109
|
+
return createHash("sha256").update(`${name}:${source}`).digest("hex").slice(0, 12);
|
|
147
110
|
}
|
|
148
|
-
var
|
|
149
|
-
"packages/experience-design-system-
|
|
111
|
+
var init_derive_component_id = __esm({
|
|
112
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js"() {
|
|
150
113
|
"use strict";
|
|
151
114
|
}
|
|
152
115
|
});
|
|
153
116
|
|
|
154
|
-
// packages/experience-design-system-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
117
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cdf/cdf-mappers.js
|
|
118
|
+
function mapContentfulTypeToCdfType(contentfulType) {
|
|
119
|
+
switch (contentfulType.toLowerCase()) {
|
|
120
|
+
case "string":
|
|
121
|
+
case "text":
|
|
122
|
+
return "string";
|
|
123
|
+
case "richtext":
|
|
124
|
+
return "richtext";
|
|
125
|
+
case "media":
|
|
126
|
+
return "media";
|
|
127
|
+
case "link":
|
|
128
|
+
return "link";
|
|
129
|
+
case "enum":
|
|
130
|
+
case "symbol":
|
|
131
|
+
return "enum";
|
|
132
|
+
case "token":
|
|
133
|
+
return "token";
|
|
134
|
+
case "boolean":
|
|
135
|
+
return "boolean";
|
|
136
|
+
default:
|
|
137
|
+
return "string";
|
|
164
138
|
}
|
|
165
|
-
return { label: "Upgrade Version" };
|
|
166
139
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const { exit } = useApp();
|
|
171
|
-
const terminalWidth = useTerminalWidth();
|
|
172
|
-
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
173
|
-
const upgradeDisabled = upgradeCheck?.status === "up-to-date";
|
|
174
|
-
useEffect2(() => {
|
|
175
|
-
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
176
|
-
}, []);
|
|
177
|
-
useInput((input, key) => {
|
|
178
|
-
if (input === "q" || key.escape) {
|
|
179
|
-
exit();
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
if (tooNarrow) return;
|
|
183
|
-
if (key.upArrow) {
|
|
184
|
-
setFocusIdx((i) => (i - 1 + START_ITEMS.length) % START_ITEMS.length);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (key.downArrow) {
|
|
188
|
-
setFocusIdx((i) => (i + 1) % START_ITEMS.length);
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (key.return) {
|
|
192
|
-
const item = START_ITEMS[focusIdx];
|
|
193
|
-
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
194
|
-
onNavigate(item.screen);
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
if (tooNarrow) {
|
|
199
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
200
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.warning, children: "Terminal too small" }),
|
|
201
|
-
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: "Press q to quit, make your terminal full screen, then run experiences import again." })
|
|
202
|
-
] });
|
|
140
|
+
function resolveCdfCategory(contentfulCategory, propName, contentProps, designProps) {
|
|
141
|
+
if (contentfulCategory && VALID_CATEGORIES.includes(contentfulCategory)) {
|
|
142
|
+
return contentfulCategory;
|
|
203
143
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
210
|
-
"v",
|
|
211
|
-
VERSION
|
|
212
|
-
] })
|
|
213
|
-
] }),
|
|
214
|
-
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
215
|
-
const focused = i === focusIdx;
|
|
216
|
-
const isUpgradeItem = item.screen === "upgrade";
|
|
217
|
-
const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
|
|
218
|
-
const dimmed = isUpgradeItem && upgradeDisabled;
|
|
219
|
-
return /* @__PURE__ */ jsxs(
|
|
220
|
-
Text2,
|
|
221
|
-
{
|
|
222
|
-
bold: focused && !dimmed,
|
|
223
|
-
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
224
|
-
children: [
|
|
225
|
-
focused ? `${FOCUS_MARKER} ` : " ",
|
|
226
|
-
display.label
|
|
227
|
-
]
|
|
228
|
-
},
|
|
229
|
-
item.label
|
|
230
|
-
);
|
|
231
|
-
}) }) }),
|
|
232
|
-
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
233
|
-
ControlHints,
|
|
234
|
-
{
|
|
235
|
-
hints: [
|
|
236
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
237
|
-
{ keys: "\u23CE", label: "select" },
|
|
238
|
-
{ keys: "q", label: "quit" }
|
|
239
|
-
]
|
|
240
|
-
}
|
|
241
|
-
) })
|
|
242
|
-
] });
|
|
144
|
+
if (contentProps.has(propName))
|
|
145
|
+
return "content";
|
|
146
|
+
if (designProps.has(propName))
|
|
147
|
+
return "design";
|
|
148
|
+
return "state";
|
|
243
149
|
}
|
|
244
|
-
var
|
|
245
|
-
var
|
|
246
|
-
"packages/experience-design-system-
|
|
150
|
+
var VALID_CATEGORIES;
|
|
151
|
+
var init_cdf_mappers = __esm({
|
|
152
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cdf/cdf-mappers.js"() {
|
|
247
153
|
"use strict";
|
|
248
|
-
|
|
249
|
-
init_version();
|
|
250
|
-
init_use_terminal_width();
|
|
251
|
-
init_control_hints();
|
|
252
|
-
VERSION = readPackageVersion();
|
|
253
|
-
HEADING = "Contentful Experiences";
|
|
254
|
-
SUBTITLE = "Let's import your design system into Contentful";
|
|
255
|
-
MIN_TERMINAL_WIDTH = 164;
|
|
256
|
-
START_ITEMS = [
|
|
257
|
-
{ label: "Import", screen: "import" },
|
|
258
|
-
{ label: "Upgrade Version", screen: "upgrade" },
|
|
259
|
-
{ label: "Settings", screen: "settings" },
|
|
260
|
-
{ label: "Help", screen: "help" }
|
|
261
|
-
];
|
|
154
|
+
VALID_CATEGORIES = ["content", "design", "state"];
|
|
262
155
|
}
|
|
263
156
|
});
|
|
264
157
|
|
|
265
|
-
// packages/experience-design-system-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
158
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/shared/index-rows-by-key.js
|
|
159
|
+
function indexRowsByKey(items, key) {
|
|
160
|
+
const map = /* @__PURE__ */ new Map();
|
|
161
|
+
for (const item of items) {
|
|
162
|
+
const k = key(item);
|
|
163
|
+
let arr = map.get(k);
|
|
164
|
+
if (!arr) {
|
|
165
|
+
arr = [];
|
|
166
|
+
map.set(k, arr);
|
|
272
167
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return
|
|
276
|
-
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
277
|
-
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
278
|
-
"\u2717 Import failed: process exited with code ",
|
|
279
|
-
exitCode ?? "unknown"
|
|
280
|
-
] }),
|
|
281
|
-
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
282
|
-
/* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
|
|
283
|
-
] });
|
|
168
|
+
arr.push(item);
|
|
169
|
+
}
|
|
170
|
+
return map;
|
|
284
171
|
}
|
|
285
|
-
var
|
|
286
|
-
"packages/experience-design-system-
|
|
172
|
+
var init_index_rows_by_key = __esm({
|
|
173
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/shared/index-rows-by-key.js"() {
|
|
287
174
|
"use strict";
|
|
288
|
-
init_home_theme();
|
|
289
175
|
}
|
|
290
176
|
});
|
|
291
177
|
|
|
292
|
-
// packages/experience-design-system-
|
|
293
|
-
function
|
|
294
|
-
|
|
178
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/read.js
|
|
179
|
+
function getSessionById(db, sessionId) {
|
|
180
|
+
const row = db.prepare("SELECT id FROM sessions WHERE id = ?").get(sessionId);
|
|
181
|
+
return row ?? null;
|
|
295
182
|
}
|
|
296
|
-
function
|
|
297
|
-
const
|
|
298
|
-
|
|
183
|
+
function getLatestCompletedSessionForCommand(db, command) {
|
|
184
|
+
const row = db.prepare(`SELECT s.id FROM sessions s
|
|
185
|
+
JOIN steps st ON st.session_id = s.id
|
|
186
|
+
WHERE st.command = ? AND st.status = 'complete'
|
|
187
|
+
ORDER BY st.started_at DESC, st.id DESC
|
|
188
|
+
LIMIT 1`).get(command);
|
|
189
|
+
return row?.id ?? null;
|
|
299
190
|
}
|
|
300
|
-
var
|
|
301
|
-
"packages/experience-design-system-
|
|
191
|
+
var init_read = __esm({
|
|
192
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/read.js"() {
|
|
302
193
|
"use strict";
|
|
303
194
|
}
|
|
304
195
|
});
|
|
305
196
|
|
|
306
|
-
// packages/experience-design-system-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
useInput3((_input, key) => {
|
|
310
|
-
if (shouldQuit(key)) onQuit();
|
|
311
|
-
});
|
|
197
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js
|
|
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);
|
|
312
200
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
201
|
+
function updateSessionTimestamp(db, sessionId, timestamp) {
|
|
202
|
+
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId);
|
|
203
|
+
}
|
|
204
|
+
var init_write = __esm({
|
|
205
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js"() {
|
|
316
206
|
"use strict";
|
|
317
|
-
init_logic();
|
|
318
|
-
WELCOME_CONTROLS = [
|
|
319
|
-
{ keys: "Enter", label: "Continue" },
|
|
320
|
-
{ keys: "Esc", label: "Back to menu" }
|
|
321
|
-
];
|
|
322
207
|
}
|
|
323
208
|
});
|
|
324
209
|
|
|
325
|
-
// packages/experience-design-system-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
330
|
-
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
331
|
-
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
332
|
-
useWelcomeControls(onQuit);
|
|
333
|
-
const submit = (value) => {
|
|
334
|
-
const path5 = toProjectPath(value);
|
|
335
|
-
if (path5) onContinue(path5);
|
|
336
|
-
};
|
|
337
|
-
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
338
|
-
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
339
|
-
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
340
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
341
|
-
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
342
|
-
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
343
|
-
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
344
|
-
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
|
|
345
|
-
] }, item.label)),
|
|
346
|
-
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
347
|
-
] }),
|
|
348
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
|
|
349
|
-
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
350
|
-
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
351
|
-
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
352
|
-
/* @__PURE__ */ jsx4(Text4, { children: "Project path:" }),
|
|
353
|
-
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
354
|
-
] })
|
|
355
|
-
] }),
|
|
356
|
-
/* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
|
|
357
|
-
"[",
|
|
358
|
-
control.keys,
|
|
359
|
-
"] ",
|
|
360
|
-
control.label
|
|
361
|
-
] }, control.keys)) })
|
|
362
|
-
] });
|
|
210
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/read.js
|
|
211
|
+
function getSessionIdForStep(db, stepId) {
|
|
212
|
+
const row = db.prepare("SELECT session_id FROM steps WHERE id = ?").get(stepId);
|
|
213
|
+
return row?.session_id ?? null;
|
|
363
214
|
}
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx"() {
|
|
215
|
+
var init_read2 = __esm({
|
|
216
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/read.js"() {
|
|
367
217
|
"use strict";
|
|
368
|
-
init_home_theme();
|
|
369
|
-
init_controls();
|
|
370
|
-
init_logic();
|
|
371
|
-
RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
372
|
-
OVERVIEW = [
|
|
373
|
-
{ label: "Step 1", description: "Extract components from your codebase" },
|
|
374
|
-
{ label: "Step 2", description: "Review what was extracted" },
|
|
375
|
-
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
376
|
-
{ label: "Step 4", description: "Review generated definitions" },
|
|
377
|
-
{ label: "Step 5", description: "Push to Contentful" }
|
|
378
|
-
];
|
|
379
218
|
}
|
|
380
219
|
});
|
|
381
220
|
|
|
382
|
-
// packages/experience-design-system-
|
|
383
|
-
function
|
|
384
|
-
|
|
221
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/write.js
|
|
222
|
+
function updatePendingStepsToInterrupted(db, sessionId, command, timestamp) {
|
|
223
|
+
db.prepare(`UPDATE steps SET status = 'interrupted', completed_at = ?, updated_at = ?
|
|
224
|
+
WHERE session_id = ? AND command = ? AND status = 'pending'`).run(timestamp, timestamp, sessionId, command);
|
|
385
225
|
}
|
|
386
|
-
function
|
|
387
|
-
const
|
|
388
|
-
|
|
226
|
+
function createPendingStep(db, sessionId, command, inputs, timestamp) {
|
|
227
|
+
const result = db.prepare(`INSERT INTO steps (session_id, command, status, started_at, inputs, outputs, updated_at)
|
|
228
|
+
VALUES (?, ?, 'pending', ?, ?, '{}', ?)`).run(sessionId, command, timestamp, JSON.stringify(inputs), timestamp);
|
|
229
|
+
return Number(result.lastInsertRowid);
|
|
389
230
|
}
|
|
390
|
-
|
|
391
|
-
|
|
231
|
+
function updateStepStatus(db, stepId, status, outputs, error, timestamp) {
|
|
232
|
+
db.prepare(`UPDATE steps SET status = ?, completed_at = ?, outputs = ?, error = ?, updated_at = ? WHERE id = ?`).run(status, timestamp, JSON.stringify(outputs), error, timestamp, stepId);
|
|
233
|
+
}
|
|
234
|
+
var init_write2 = __esm({
|
|
235
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/write.js"() {
|
|
392
236
|
"use strict";
|
|
393
237
|
}
|
|
394
238
|
});
|
|
395
239
|
|
|
396
|
-
// packages/experience-design-system-
|
|
397
|
-
import {
|
|
398
|
-
function
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
240
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js
|
|
241
|
+
import { randomBytes } from "node:crypto";
|
|
242
|
+
function generateSessionId() {
|
|
243
|
+
const buf = randomBytes(4);
|
|
244
|
+
const adjIdx = buf[0] % ADJECTIVES.length;
|
|
245
|
+
const nounIdx = buf[1] % NOUNS.length;
|
|
246
|
+
const hex = ((buf[2] << 8 | buf[3]) & 65535).toString(16).padStart(4, "0");
|
|
247
|
+
return `${ADJECTIVES[adjIdx]}-${NOUNS[nounIdx]}-${hex}`;
|
|
402
248
|
}
|
|
403
|
-
var
|
|
404
|
-
var
|
|
405
|
-
"packages/experience-design-system-
|
|
406
|
-
"use strict";
|
|
407
|
-
init_logic2();
|
|
408
|
-
TOKEN_INPUT_CONTROLS = [
|
|
409
|
-
{ keys: "Enter", label: "Continue" },
|
|
410
|
-
{ keys: "Esc", label: "Back" }
|
|
411
|
-
];
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
416
|
-
import { homedir } from "node:os";
|
|
417
|
-
import { resolve } from "node:path";
|
|
418
|
-
function stripQuotes(value) {
|
|
419
|
-
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
420
|
-
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
421
|
-
}
|
|
422
|
-
function expandHome(value) {
|
|
423
|
-
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
424
|
-
}
|
|
425
|
-
function resolveUserPath(raw) {
|
|
426
|
-
return resolve(expandHome(stripQuotes(raw.trim())));
|
|
427
|
-
}
|
|
428
|
-
var init_resolve_user_path = __esm({
|
|
429
|
-
"packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts"() {
|
|
430
|
-
"use strict";
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
435
|
-
import { statSync } from "node:fs";
|
|
436
|
-
function validateTokenPath(rawPath) {
|
|
437
|
-
const path5 = resolveUserPath(rawPath);
|
|
438
|
-
let stats;
|
|
439
|
-
try {
|
|
440
|
-
stats = statSync(path5);
|
|
441
|
-
} catch {
|
|
442
|
-
return { ok: false, error: `Path not found: ${path5}`, resolvedPath: path5 };
|
|
443
|
-
}
|
|
444
|
-
if (stats.isDirectory()) {
|
|
445
|
-
return {
|
|
446
|
-
ok: false,
|
|
447
|
-
error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
|
|
448
|
-
resolvedPath: path5
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
if (!stats.isFile()) {
|
|
452
|
-
return { ok: false, error: `Not a regular file: ${path5}`, resolvedPath: path5 };
|
|
453
|
-
}
|
|
454
|
-
return { ok: true, path: path5 };
|
|
455
|
-
}
|
|
456
|
-
var init_validate_path = __esm({
|
|
457
|
-
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts"() {
|
|
458
|
-
"use strict";
|
|
459
|
-
init_resolve_user_path();
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
464
|
-
import { useState as useState4 } from "react";
|
|
465
|
-
import { Box as Box4, Text as Text5 } from "ink";
|
|
466
|
-
import TextInput2 from "ink-text-input";
|
|
467
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
468
|
-
function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
469
|
-
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
470
|
-
const [failure, setFailure] = useState4(null);
|
|
471
|
-
useTokenInputControls(onBack);
|
|
472
|
-
const change = (value) => {
|
|
473
|
-
setTokenPath(value);
|
|
474
|
-
setFailure(null);
|
|
475
|
-
};
|
|
476
|
-
const submit = (value) => {
|
|
477
|
-
const rawPath = toTokenPath(value);
|
|
478
|
-
if (!rawPath) {
|
|
479
|
-
setFailure({ error: "Enter the path to your token file." });
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
const check = validateTokenPath(rawPath);
|
|
483
|
-
if (check.ok) onConfirm(check.path);
|
|
484
|
-
else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
|
|
485
|
-
};
|
|
486
|
-
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
487
|
-
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
488
|
-
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.muted, children: "Point me to your raw token file (e.g. ~/design-tokens/tokens.json). You can use ~, relative, or absolute paths. Claude will map it to Design Token Group Format (DTCG)." }),
|
|
489
|
-
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
490
|
-
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
491
|
-
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
492
|
-
/* @__PURE__ */ jsx5(Text5, { children: "Token path:" }),
|
|
493
|
-
/* @__PURE__ */ jsx5(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
|
|
494
|
-
] }),
|
|
495
|
-
failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
496
|
-
/* @__PURE__ */ jsxs4(Text5, { color: PALETTE.error, children: [
|
|
497
|
-
"\u2717 ",
|
|
498
|
-
failure.error
|
|
499
|
-
] }),
|
|
500
|
-
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { color: PALETTE.muted, children: [
|
|
501
|
-
" Resolved to: ",
|
|
502
|
-
failure.resolvedPath
|
|
503
|
-
] })
|
|
504
|
-
] })
|
|
505
|
-
] }),
|
|
506
|
-
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
507
|
-
"[",
|
|
508
|
-
control.keys,
|
|
509
|
-
"] ",
|
|
510
|
-
control.label
|
|
511
|
-
] }, control.keys)) })
|
|
512
|
-
] });
|
|
513
|
-
}
|
|
514
|
-
var init_screen2 = __esm({
|
|
515
|
-
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
|
|
516
|
-
"use strict";
|
|
517
|
-
init_home_theme();
|
|
518
|
-
init_controls2();
|
|
519
|
-
init_logic2();
|
|
520
|
-
init_validate_path();
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
|
|
524
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts
|
|
525
|
-
function describeFailure(failure, path5) {
|
|
526
|
-
switch (failure) {
|
|
527
|
-
case "is-file":
|
|
528
|
-
return {
|
|
529
|
-
headline: "That's a file, not a directory.",
|
|
530
|
-
hints: [
|
|
531
|
-
"Provide the path to your component library's root folder, not a specific file.",
|
|
532
|
-
"Example: ~/projects/my-design-system"
|
|
533
|
-
]
|
|
534
|
-
};
|
|
535
|
-
case "not-found":
|
|
536
|
-
return {
|
|
537
|
-
headline: `Directory not found: ${path5}`,
|
|
538
|
-
hints: ["Double-check the path and try again. Tip: you can use ~, relative, or absolute paths."]
|
|
539
|
-
};
|
|
540
|
-
case "permission-denied":
|
|
541
|
-
return {
|
|
542
|
-
headline: `Permission denied: ${path5}`,
|
|
543
|
-
hints: ["You don't have read access to this directory."]
|
|
544
|
-
};
|
|
545
|
-
case "not-directory":
|
|
546
|
-
return { headline: `Not a directory: ${path5}`, hints: [] };
|
|
547
|
-
case "unreadable":
|
|
548
|
-
return { headline: `Cannot access: ${path5}`, hints: [] };
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
function summarize(counts) {
|
|
552
|
-
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
553
|
-
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
554
|
-
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
555
|
-
});
|
|
556
|
-
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
557
|
-
if (componentFiles > 0) return { total: counts.total, rows };
|
|
558
|
-
if (counts.json > 0) {
|
|
559
|
-
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
560
|
-
}
|
|
561
|
-
return {
|
|
562
|
-
total: counts.total,
|
|
563
|
-
rows,
|
|
564
|
-
warning: "No component or token files found. Try a different path."
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
function phaseOf(scan) {
|
|
568
|
-
if (scan === void 0) return "scanning";
|
|
569
|
-
return scan.ok ? "ready" : "failed";
|
|
570
|
-
}
|
|
571
|
-
function keyAction(phase, input, key) {
|
|
572
|
-
if (key.escape) return "back";
|
|
573
|
-
if (phase === "ready") {
|
|
574
|
-
if (key.return) return "confirm";
|
|
575
|
-
if (input === "e") return "change-path";
|
|
576
|
-
}
|
|
577
|
-
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
578
|
-
return void 0;
|
|
579
|
-
}
|
|
580
|
-
var COMPONENT_CATEGORIES, ROW_LABELS, ROW_ORDER;
|
|
581
|
-
var init_logic3 = __esm({
|
|
582
|
-
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts"() {
|
|
583
|
-
"use strict";
|
|
584
|
-
COMPONENT_CATEGORIES = ["tsx", "ts", "vue", "astro", "jsx", "js"];
|
|
585
|
-
ROW_LABELS = {
|
|
586
|
-
tsx: ".tsx files",
|
|
587
|
-
ts: ".ts files",
|
|
588
|
-
vue: ".vue files",
|
|
589
|
-
astro: ".astro files",
|
|
590
|
-
jsx: ".jsx files",
|
|
591
|
-
js: ".js files",
|
|
592
|
-
json: ".json files (design tokens)",
|
|
593
|
-
other: "other (ignored)"
|
|
594
|
-
};
|
|
595
|
-
ROW_ORDER = ["tsx", "ts", "vue", "astro", "jsx", "js", "json", "other"];
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
|
|
599
|
-
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
600
|
-
import { useInput as useInput5 } from "ink";
|
|
601
|
-
function controlsFor(phase) {
|
|
602
|
-
return CONTROLS[phase];
|
|
603
|
-
}
|
|
604
|
-
function usePathValidationControls(phase, handlers) {
|
|
605
|
-
useInput5((input, key) => {
|
|
606
|
-
const action = keyAction(phase, input, key);
|
|
607
|
-
if (action === "confirm") handlers.onConfirm();
|
|
608
|
-
else if (action === "change-path") handlers.onChangePath();
|
|
609
|
-
else if (action === "back") handlers.onBack();
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
var CONTROLS;
|
|
613
|
-
var init_controls3 = __esm({
|
|
614
|
-
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts"() {
|
|
615
|
-
"use strict";
|
|
616
|
-
init_logic3();
|
|
617
|
-
CONTROLS = {
|
|
618
|
-
scanning: [{ keys: "Esc", label: "Back" }],
|
|
619
|
-
ready: [
|
|
620
|
-
{ keys: "Enter", label: "Yes, continue" },
|
|
621
|
-
{ keys: "e", label: "Change path" },
|
|
622
|
-
{ keys: "Esc", label: "Back" }
|
|
623
|
-
],
|
|
624
|
-
failed: [
|
|
625
|
-
{ keys: "Enter/e", label: "Try a different path" },
|
|
626
|
-
{ keys: "Esc", label: "Back" }
|
|
627
|
-
]
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js
|
|
633
|
-
import { homedir as homedir2 } from "node:os";
|
|
634
|
-
import { dirname as dirname2, join as join5 } from "node:path";
|
|
635
|
-
function configRoot() {
|
|
636
|
-
return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
|
|
637
|
-
}
|
|
638
|
-
var runsFilePath;
|
|
639
|
-
var init_config_root = __esm({
|
|
640
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/config-root.js"() {
|
|
641
|
-
"use strict";
|
|
642
|
-
runsFilePath = () => join5(configRoot(), "state", "runs.json");
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js
|
|
647
|
-
function escapeForRegExp(value) {
|
|
648
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
649
|
-
}
|
|
650
|
-
function identifierPattern(name) {
|
|
651
|
-
return new RegExp(`(?<![A-Za-z0-9_$])${escapeForRegExp(name)}(?![A-Za-z0-9_$])`);
|
|
652
|
-
}
|
|
653
|
-
function excerptAroundNames(text, names, maxChars, contextLines = 6) {
|
|
654
|
-
if (text.length <= maxChars)
|
|
655
|
-
return { content: text, usesNotShown: [] };
|
|
656
|
-
const patterns = names.filter((name) => name.length > 0).map((name) => ({ name, pattern: identifierPattern(name) }));
|
|
657
|
-
const lines = text.split("\n");
|
|
658
|
-
const windows = [];
|
|
659
|
-
lines.forEach((line, index) => {
|
|
660
|
-
const mentioned = patterns.filter(({ pattern }) => pattern.test(line)).map(({ name }) => name);
|
|
661
|
-
if (mentioned.length === 0)
|
|
662
|
-
return;
|
|
663
|
-
const start = Math.max(0, index - contextLines);
|
|
664
|
-
const end = Math.min(lines.length - 1, index + contextLines);
|
|
665
|
-
const last = windows[windows.length - 1];
|
|
666
|
-
if (last && start <= last.end + 1) {
|
|
667
|
-
last.end = Math.max(last.end, end);
|
|
668
|
-
for (const name of mentioned)
|
|
669
|
-
last.names.add(name);
|
|
670
|
-
} else {
|
|
671
|
-
windows.push({ start, end, names: new Set(mentioned) });
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
if (windows.length === 0) {
|
|
675
|
-
return { content: `${text.slice(0, maxChars)}
|
|
676
|
-
${TRUNCATED_MARKER}`, usesNotShown: [] };
|
|
677
|
-
}
|
|
678
|
-
const lastWindowFor = /* @__PURE__ */ new Map();
|
|
679
|
-
for (const window of windows)
|
|
680
|
-
for (const name of window.names)
|
|
681
|
-
lastWindowFor.set(name, window);
|
|
682
|
-
const kept = [];
|
|
683
|
-
const cut = /* @__PURE__ */ new Set();
|
|
684
|
-
let used = 0;
|
|
685
|
-
for (const window of [...windows].reverse()) {
|
|
686
|
-
const chunk = lines.slice(window.start, window.end + 1).join("\n");
|
|
687
|
-
const separator = kept.length > 0 ? `
|
|
688
|
-
${ELLIPSIS_MARKER}
|
|
689
|
-
` : "";
|
|
690
|
-
if (used + separator.length + chunk.length > maxChars) {
|
|
691
|
-
if (kept.length === 0) {
|
|
692
|
-
const head = chunk.slice(0, maxChars);
|
|
693
|
-
kept.push({ window, text: head });
|
|
694
|
-
used += head.length;
|
|
695
|
-
for (const name of window.names) {
|
|
696
|
-
if (lastWindowFor.get(name) === window && !identifierPattern(name).test(head))
|
|
697
|
-
cut.add(name);
|
|
698
|
-
}
|
|
699
|
-
continue;
|
|
700
|
-
}
|
|
701
|
-
for (const name of window.names) {
|
|
702
|
-
if (lastWindowFor.get(name) === window)
|
|
703
|
-
cut.add(name);
|
|
704
|
-
}
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
kept.push({ window, text: chunk });
|
|
708
|
-
used += separator.length + chunk.length;
|
|
709
|
-
}
|
|
710
|
-
kept.sort((a, b) => a.window.start - b.window.start);
|
|
711
|
-
const parts = kept.map((entry, index) => (index > 0 ? `
|
|
712
|
-
${ELLIPSIS_MARKER}
|
|
713
|
-
` : "") + entry.text);
|
|
714
|
-
const usesNotShown = names.filter((name, index) => cut.has(name) && names.indexOf(name) === index);
|
|
715
|
-
return { content: `${parts.join("")}
|
|
716
|
-
${TRUNCATED_MARKER}`, usesNotShown };
|
|
717
|
-
}
|
|
718
|
-
var ELLIPSIS_MARKER, TRUNCATED_MARKER;
|
|
719
|
-
var init_source_excerpt = __esm({
|
|
720
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/source-excerpt.js"() {
|
|
721
|
-
"use strict";
|
|
722
|
-
ELLIPSIS_MARKER = "/* \u2026 */";
|
|
723
|
-
TRUNCATED_MARKER = "/* truncated */";
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
|
|
727
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js
|
|
728
|
-
import { createHash } from "node:crypto";
|
|
729
|
-
function deriveComponentId(name, source) {
|
|
730
|
-
return createHash("sha256").update(`${name}:${source}`).digest("hex").slice(0, 12);
|
|
731
|
-
}
|
|
732
|
-
var init_derive_component_id = __esm({
|
|
733
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/components/derive-component-id.js"() {
|
|
734
|
-
"use strict";
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
|
|
738
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cdf/cdf-mappers.js
|
|
739
|
-
function mapContentfulTypeToCdfType(contentfulType) {
|
|
740
|
-
switch (contentfulType.toLowerCase()) {
|
|
741
|
-
case "string":
|
|
742
|
-
case "text":
|
|
743
|
-
return "string";
|
|
744
|
-
case "richtext":
|
|
745
|
-
return "richtext";
|
|
746
|
-
case "media":
|
|
747
|
-
return "media";
|
|
748
|
-
case "link":
|
|
749
|
-
return "link";
|
|
750
|
-
case "enum":
|
|
751
|
-
case "symbol":
|
|
752
|
-
return "enum";
|
|
753
|
-
case "token":
|
|
754
|
-
return "token";
|
|
755
|
-
case "boolean":
|
|
756
|
-
return "boolean";
|
|
757
|
-
default:
|
|
758
|
-
return "string";
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
function resolveCdfCategory(contentfulCategory, propName, contentProps, designProps) {
|
|
762
|
-
if (contentfulCategory && VALID_CATEGORIES.includes(contentfulCategory)) {
|
|
763
|
-
return contentfulCategory;
|
|
764
|
-
}
|
|
765
|
-
if (contentProps.has(propName))
|
|
766
|
-
return "content";
|
|
767
|
-
if (designProps.has(propName))
|
|
768
|
-
return "design";
|
|
769
|
-
return "state";
|
|
770
|
-
}
|
|
771
|
-
var VALID_CATEGORIES;
|
|
772
|
-
var init_cdf_mappers = __esm({
|
|
773
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cdf/cdf-mappers.js"() {
|
|
774
|
-
"use strict";
|
|
775
|
-
VALID_CATEGORIES = ["content", "design", "state"];
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
|
|
779
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/shared/index-rows-by-key.js
|
|
780
|
-
function indexRowsByKey(items, key) {
|
|
781
|
-
const map = /* @__PURE__ */ new Map();
|
|
782
|
-
for (const item of items) {
|
|
783
|
-
const k = key(item);
|
|
784
|
-
let arr = map.get(k);
|
|
785
|
-
if (!arr) {
|
|
786
|
-
arr = [];
|
|
787
|
-
map.set(k, arr);
|
|
788
|
-
}
|
|
789
|
-
arr.push(item);
|
|
790
|
-
}
|
|
791
|
-
return map;
|
|
792
|
-
}
|
|
793
|
-
var init_index_rows_by_key = __esm({
|
|
794
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/shared/index-rows-by-key.js"() {
|
|
795
|
-
"use strict";
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
|
|
799
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/read.js
|
|
800
|
-
function getSessionById(db, sessionId) {
|
|
801
|
-
const row = db.prepare("SELECT id FROM sessions WHERE id = ?").get(sessionId);
|
|
802
|
-
return row ?? null;
|
|
803
|
-
}
|
|
804
|
-
function getLatestCompletedSessionForCommand(db, command) {
|
|
805
|
-
const row = db.prepare(`SELECT s.id FROM sessions s
|
|
806
|
-
JOIN steps st ON st.session_id = s.id
|
|
807
|
-
WHERE st.command = ? AND st.status = 'complete'
|
|
808
|
-
ORDER BY st.started_at DESC, st.id DESC
|
|
809
|
-
LIMIT 1`).get(command);
|
|
810
|
-
return row?.id ?? null;
|
|
811
|
-
}
|
|
812
|
-
var init_read = __esm({
|
|
813
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/read.js"() {
|
|
814
|
-
"use strict";
|
|
815
|
-
}
|
|
816
|
-
});
|
|
817
|
-
|
|
818
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js
|
|
819
|
-
function createSession(db, id, name, timestamp) {
|
|
820
|
-
db.prepare("INSERT INTO sessions (id, name, created_at, updated_at) VALUES (?, ?, ?, ?)").run(id, name, timestamp, timestamp);
|
|
821
|
-
}
|
|
822
|
-
function updateSessionTimestamp(db, sessionId, timestamp) {
|
|
823
|
-
db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(timestamp, sessionId);
|
|
824
|
-
}
|
|
825
|
-
var init_write = __esm({
|
|
826
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/sessions/write.js"() {
|
|
827
|
-
"use strict";
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
|
|
831
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/read.js
|
|
832
|
-
function getSessionIdForStep(db, stepId) {
|
|
833
|
-
const row = db.prepare("SELECT session_id FROM steps WHERE id = ?").get(stepId);
|
|
834
|
-
return row?.session_id ?? null;
|
|
835
|
-
}
|
|
836
|
-
var init_read2 = __esm({
|
|
837
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/read.js"() {
|
|
838
|
-
"use strict";
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/write.js
|
|
843
|
-
function updatePendingStepsToInterrupted(db, sessionId, command, timestamp) {
|
|
844
|
-
db.prepare(`UPDATE steps SET status = 'interrupted', completed_at = ?, updated_at = ?
|
|
845
|
-
WHERE session_id = ? AND command = ? AND status = 'pending'`).run(timestamp, timestamp, sessionId, command);
|
|
846
|
-
}
|
|
847
|
-
function createPendingStep(db, sessionId, command, inputs, timestamp) {
|
|
848
|
-
const result = db.prepare(`INSERT INTO steps (session_id, command, status, started_at, inputs, outputs, updated_at)
|
|
849
|
-
VALUES (?, ?, 'pending', ?, ?, '{}', ?)`).run(sessionId, command, timestamp, JSON.stringify(inputs), timestamp);
|
|
850
|
-
return Number(result.lastInsertRowid);
|
|
851
|
-
}
|
|
852
|
-
function updateStepStatus(db, stepId, status, outputs, error, timestamp) {
|
|
853
|
-
db.prepare(`UPDATE steps SET status = ?, completed_at = ?, outputs = ?, error = ?, updated_at = ? WHERE id = ?`).run(status, timestamp, JSON.stringify(outputs), error, timestamp, stepId);
|
|
854
|
-
}
|
|
855
|
-
var init_write2 = __esm({
|
|
856
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/steps/write.js"() {
|
|
857
|
-
"use strict";
|
|
858
|
-
}
|
|
859
|
-
});
|
|
860
|
-
|
|
861
|
-
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js
|
|
862
|
-
import { randomBytes } from "node:crypto";
|
|
863
|
-
function generateSessionId() {
|
|
864
|
-
const buf = randomBytes(4);
|
|
865
|
-
const adjIdx = buf[0] % ADJECTIVES.length;
|
|
866
|
-
const nounIdx = buf[1] % NOUNS.length;
|
|
867
|
-
const hex = ((buf[2] << 8 | buf[3]) & 65535).toString(16).padStart(4, "0");
|
|
868
|
-
return `${ADJECTIVES[adjIdx]}-${NOUNS[nounIdx]}-${hex}`;
|
|
869
|
-
}
|
|
870
|
-
var ADJECTIVES, NOUNS;
|
|
871
|
-
var init_session_id = __esm({
|
|
872
|
-
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js"() {
|
|
249
|
+
var ADJECTIVES, NOUNS;
|
|
250
|
+
var init_session_id = __esm({
|
|
251
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/session-id.js"() {
|
|
873
252
|
"use strict";
|
|
874
253
|
ADJECTIVES = [
|
|
875
254
|
"aged",
|
|
@@ -1762,11 +1141,11 @@ var init_parse_prompt_overrides = __esm({
|
|
|
1762
1141
|
|
|
1763
1142
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
|
|
1764
1143
|
import { readFile } from "node:fs/promises";
|
|
1765
|
-
import { resolve
|
|
1144
|
+
import { resolve } from "node:path";
|
|
1766
1145
|
async function resolvePromptOverride(override) {
|
|
1767
1146
|
if (override.kind === "text")
|
|
1768
1147
|
return override.value;
|
|
1769
|
-
const abs =
|
|
1148
|
+
const abs = resolve(override.value);
|
|
1770
1149
|
try {
|
|
1771
1150
|
return await readFile(abs, "utf8");
|
|
1772
1151
|
} catch {
|
|
@@ -2104,7 +1483,7 @@ var init_parse_map_token_prop_tool_calls = __esm({
|
|
|
2104
1483
|
});
|
|
2105
1484
|
|
|
2106
1485
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js
|
|
2107
|
-
import { spawn
|
|
1486
|
+
import { spawn } from "node:child_process";
|
|
2108
1487
|
async function runAgent(options) {
|
|
2109
1488
|
const { agent, prompt, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
2110
1489
|
const bedrock = options.bedrock ?? process.env.EDS_BEDROCK === "1";
|
|
@@ -2123,7 +1502,7 @@ async function runAgent(options) {
|
|
|
2123
1502
|
});
|
|
2124
1503
|
return new Promise((resolve27) => {
|
|
2125
1504
|
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
2126
|
-
const child =
|
|
1505
|
+
const child = spawn(binary, args, {
|
|
2127
1506
|
stdio: ["pipe", "pipe", "pipe"],
|
|
2128
1507
|
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
2129
1508
|
});
|
|
@@ -2184,7 +1563,7 @@ var init_run_agent = __esm({
|
|
|
2184
1563
|
});
|
|
2185
1564
|
|
|
2186
1565
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/check-agent-auth.js
|
|
2187
|
-
import { spawn as
|
|
1566
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
2188
1567
|
async function checkAgentAuth(agent) {
|
|
2189
1568
|
const binary = resolveBinary(agent);
|
|
2190
1569
|
const binaryExists2 = await binaryIsOnPath(binary);
|
|
@@ -2193,7 +1572,7 @@ async function checkAgentAuth(agent) {
|
|
|
2193
1572
|
if (agent !== "claude")
|
|
2194
1573
|
return "ok";
|
|
2195
1574
|
return new Promise((resolve27) => {
|
|
2196
|
-
const child =
|
|
1575
|
+
const child = spawn2(binary, ["auth", "status", "--json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
2197
1576
|
let stdout = "";
|
|
2198
1577
|
let done = false;
|
|
2199
1578
|
const timer = setTimeout(() => {
|
|
@@ -2230,7 +1609,7 @@ async function binaryIsOnPath(binary) {
|
|
|
2230
1609
|
return fs.access(binary).then(() => true, () => false);
|
|
2231
1610
|
}
|
|
2232
1611
|
return new Promise((resolve27) => {
|
|
2233
|
-
const child =
|
|
1612
|
+
const child = spawn2(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
|
|
2234
1613
|
child.on("close", (code) => resolve27(code === 0));
|
|
2235
1614
|
});
|
|
2236
1615
|
}
|
|
@@ -3007,22 +2386,22 @@ var init_skill_files = __esm({
|
|
|
3007
2386
|
});
|
|
3008
2387
|
|
|
3009
2388
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
|
|
3010
|
-
import { existsSync
|
|
3011
|
-
import { dirname as
|
|
3012
|
-
import { fileURLToPath
|
|
2389
|
+
import { existsSync } from "node:fs";
|
|
2390
|
+
import { dirname as dirname2, join as join2, resolve as resolve2 } from "node:path";
|
|
2391
|
+
import { fileURLToPath } from "node:url";
|
|
3013
2392
|
function resolveSkillPath(skill) {
|
|
3014
2393
|
if (!(skill in SKILL_FILES))
|
|
3015
2394
|
throw new Error(`Invalid skill: ${skill}`);
|
|
3016
|
-
const thisDir =
|
|
2395
|
+
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
3017
2396
|
let dir = thisDir;
|
|
3018
2397
|
for (; ; ) {
|
|
3019
|
-
const candidate =
|
|
3020
|
-
if (
|
|
2398
|
+
const candidate = join2(dir, "skills");
|
|
2399
|
+
if (existsSync(candidate)) {
|
|
3021
2400
|
const file = SKILL_FILES[skill];
|
|
3022
2401
|
const stepDir = file === "select-components.md" ? "selection" : "generation";
|
|
3023
|
-
return
|
|
2402
|
+
return join2(candidate, stepDir, file);
|
|
3024
2403
|
}
|
|
3025
|
-
const parent =
|
|
2404
|
+
const parent = resolve2(dir, "..");
|
|
3026
2405
|
if (parent === dir) {
|
|
3027
2406
|
throw new Error(`skill file missing from package (could not locate skills/ directory from: ${thisDir})`);
|
|
3028
2407
|
}
|
|
@@ -3038,10 +2417,10 @@ var init_resolve_skill_path = __esm({
|
|
|
3038
2417
|
|
|
3039
2418
|
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
|
|
3040
2419
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
3041
|
-
import { resolve as
|
|
2420
|
+
import { resolve as resolve3 } from "node:path";
|
|
3042
2421
|
async function readSkillFile(skill, override) {
|
|
3043
2422
|
if (override) {
|
|
3044
|
-
const skillPath2 =
|
|
2423
|
+
const skillPath2 = resolve3(override);
|
|
3045
2424
|
try {
|
|
3046
2425
|
return await readFile2(skillPath2, "utf8");
|
|
3047
2426
|
} catch {
|
|
@@ -3345,7 +2724,7 @@ __export(cache_keys_exports, {
|
|
|
3345
2724
|
});
|
|
3346
2725
|
import { createHash as createHash4 } from "node:crypto";
|
|
3347
2726
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
3348
|
-
import { resolve as
|
|
2727
|
+
import { resolve as resolve4 } from "node:path";
|
|
3349
2728
|
function hashContent(content) {
|
|
3350
2729
|
return createHash4("sha256").update(content).digest("hex");
|
|
3351
2730
|
}
|
|
@@ -3354,7 +2733,7 @@ async function hashFile(filePath) {
|
|
|
3354
2733
|
return hashContent(content);
|
|
3355
2734
|
}
|
|
3356
2735
|
async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
|
|
3357
|
-
const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(
|
|
2736
|
+
const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve4(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
|
|
3358
2737
|
const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
|
|
3359
2738
|
return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
|
|
3360
2739
|
}
|
|
@@ -3367,19 +2746,19 @@ var init_cache_keys = __esm({
|
|
|
3367
2746
|
|
|
3368
2747
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
3369
2748
|
import { DatabaseSync } from "node:sqlite";
|
|
3370
|
-
import { mkdirSync, readFileSync
|
|
2749
|
+
import { mkdirSync, readFileSync } from "node:fs";
|
|
3371
2750
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
3372
2751
|
import { createHash as createHash5 } from "node:crypto";
|
|
3373
|
-
import { dirname as
|
|
2752
|
+
import { dirname as dirname3, resolve as resolve5 } from "node:path";
|
|
3374
2753
|
function getPipelineDbPath() {
|
|
3375
2754
|
if (process.env.EDS_PIPELINE_DB_PATH) {
|
|
3376
|
-
return
|
|
2755
|
+
return resolve5(process.env.EDS_PIPELINE_DB_PATH);
|
|
3377
2756
|
}
|
|
3378
|
-
return
|
|
2757
|
+
return resolve5(configRoot(), "pipeline.db");
|
|
3379
2758
|
}
|
|
3380
2759
|
function openPipelineDb(dbPath) {
|
|
3381
2760
|
const path5 = dbPath ?? getPipelineDbPath();
|
|
3382
|
-
mkdirSync(
|
|
2761
|
+
mkdirSync(dirname3(path5), { recursive: true });
|
|
3383
2762
|
try {
|
|
3384
2763
|
const db = new DatabaseSync(path5);
|
|
3385
2764
|
db.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -3649,7 +3028,7 @@ function loadComponentReviewMetadata(db, sessionId, componentName) {
|
|
|
3649
3028
|
let componentSource = compRow.source ?? null;
|
|
3650
3029
|
if (compRow.source_path) {
|
|
3651
3030
|
try {
|
|
3652
|
-
componentSource =
|
|
3031
|
+
componentSource = readFileSync(compRow.source_path, "utf8");
|
|
3653
3032
|
} catch {
|
|
3654
3033
|
}
|
|
3655
3034
|
}
|
|
@@ -4028,12 +3407,12 @@ function extractRelativeImportPaths(sourceText) {
|
|
|
4028
3407
|
return [...specifiers];
|
|
4029
3408
|
}
|
|
4030
3409
|
async function resolveRelativeImport(specifier, fromDir) {
|
|
4031
|
-
const basePath =
|
|
3410
|
+
const basePath = resolve5(fromDir, specifier);
|
|
4032
3411
|
const candidates = [
|
|
4033
3412
|
basePath,
|
|
4034
3413
|
...rewrittenSourcePaths(basePath),
|
|
4035
3414
|
...SIBLING_FILE_EXTENSIONS.map((ext) => `${basePath}${ext}`),
|
|
4036
|
-
...SIBLING_FILE_EXTENSIONS.map((ext) =>
|
|
3415
|
+
...SIBLING_FILE_EXTENSIONS.map((ext) => resolve5(basePath, `index${ext}`))
|
|
4037
3416
|
];
|
|
4038
3417
|
for (const candidate of candidates) {
|
|
4039
3418
|
try {
|
|
@@ -4054,9 +3433,9 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
|
|
|
4054
3433
|
return resolvedPaths;
|
|
4055
3434
|
}
|
|
4056
3435
|
async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
|
|
4057
|
-
const visited = /* @__PURE__ */ new Set([
|
|
3436
|
+
const visited = /* @__PURE__ */ new Set([resolve5(sourcePath)]);
|
|
4058
3437
|
const discovered = [];
|
|
4059
|
-
let frontier = [{ text: sourceText, dir:
|
|
3438
|
+
let frontier = [{ text: sourceText, dir: dirname3(sourcePath) }];
|
|
4060
3439
|
for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
|
|
4061
3440
|
const nextFrontier = [];
|
|
4062
3441
|
for (const node of frontier) {
|
|
@@ -4076,7 +3455,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
|
|
|
4076
3455
|
continue;
|
|
4077
3456
|
}
|
|
4078
3457
|
discovered.push({ path: resolvedPath, content });
|
|
4079
|
-
nextFrontier.push({ text: content, dir:
|
|
3458
|
+
nextFrontier.push({ text: content, dir: dirname3(resolvedPath) });
|
|
4080
3459
|
}
|
|
4081
3460
|
}
|
|
4082
3461
|
frontier = nextFrontier;
|
|
@@ -4741,7 +4120,7 @@ async function getCliCacheVersion() {
|
|
|
4741
4120
|
for (const s of skills) {
|
|
4742
4121
|
try {
|
|
4743
4122
|
const p = resolveSkillPath2(s);
|
|
4744
|
-
parts.push(
|
|
4123
|
+
parts.push(readFileSync(p, "utf8"));
|
|
4745
4124
|
} catch {
|
|
4746
4125
|
parts.push(`<missing:${s}>`);
|
|
4747
4126
|
}
|
|
@@ -4753,7 +4132,7 @@ async function getCliCacheVersion() {
|
|
|
4753
4132
|
return _cliCacheVersionCache;
|
|
4754
4133
|
}
|
|
4755
4134
|
}
|
|
4756
|
-
function storeExtractCache(db, filePath, fileHash,
|
|
4135
|
+
function storeExtractCache(db, filePath, fileHash, cliVersion2, components) {
|
|
4757
4136
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4758
4137
|
const componentsJson = JSON.stringify(components);
|
|
4759
4138
|
db.prepare(`INSERT INTO extract_cache (file_path, file_hash, cli_version, created_at, updated_at, components_json)
|
|
@@ -4761,12 +4140,12 @@ function storeExtractCache(db, filePath, fileHash, cliVersion, components) {
|
|
|
4761
4140
|
ON CONFLICT(file_hash, cli_version) DO UPDATE SET
|
|
4762
4141
|
file_path = excluded.file_path,
|
|
4763
4142
|
updated_at = excluded.updated_at,
|
|
4764
|
-
components_json = excluded.components_json`).run(filePath, fileHash,
|
|
4143
|
+
components_json = excluded.components_json`).run(filePath, fileHash, cliVersion2, now, now, componentsJson);
|
|
4765
4144
|
}
|
|
4766
|
-
function lookupExtractCache(db, fileHash,
|
|
4145
|
+
function lookupExtractCache(db, fileHash, cliVersion2) {
|
|
4767
4146
|
const row = db.prepare(`SELECT file_path, file_hash, cli_version, created_at, updated_at, components_json
|
|
4768
4147
|
FROM extract_cache
|
|
4769
|
-
WHERE file_hash = ? AND cli_version = ?`).get(fileHash,
|
|
4148
|
+
WHERE file_hash = ? AND cli_version = ?`).get(fileHash, cliVersion2);
|
|
4770
4149
|
if (!row)
|
|
4771
4150
|
return null;
|
|
4772
4151
|
let components = [];
|
|
@@ -4784,31 +4163,31 @@ function lookupExtractCache(db, fileHash, cliVersion) {
|
|
|
4784
4163
|
components
|
|
4785
4164
|
};
|
|
4786
4165
|
}
|
|
4787
|
-
function storeCompositionCache(db, inputHash,
|
|
4166
|
+
function storeCompositionCache(db, inputHash, cliVersion2, agentOutput) {
|
|
4788
4167
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4789
4168
|
db.prepare(`INSERT INTO composition_cache (input_hash, cli_version, agent_output, created_at, updated_at)
|
|
4790
4169
|
VALUES (?, ?, ?, ?, ?)
|
|
4791
4170
|
ON CONFLICT(input_hash, cli_version) DO UPDATE SET
|
|
4792
4171
|
agent_output = excluded.agent_output,
|
|
4793
|
-
updated_at = excluded.updated_at`).run(inputHash,
|
|
4172
|
+
updated_at = excluded.updated_at`).run(inputHash, cliVersion2, agentOutput, now, now);
|
|
4794
4173
|
}
|
|
4795
|
-
function lookupCompositionCache(db, inputHash,
|
|
4796
|
-
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash,
|
|
4174
|
+
function lookupCompositionCache(db, inputHash, cliVersion2) {
|
|
4175
|
+
const row = db.prepare(`SELECT agent_output FROM composition_cache WHERE input_hash = ? AND cli_version = ?`).get(inputHash, cliVersion2);
|
|
4797
4176
|
return row ? row.agent_output : null;
|
|
4798
4177
|
}
|
|
4799
|
-
function storeSelectCache(db, componentHash, promptHash,
|
|
4178
|
+
function storeSelectCache(db, componentHash, promptHash, cliVersion2, decision, reason) {
|
|
4800
4179
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4801
4180
|
db.prepare(`INSERT INTO select_cache (component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at)
|
|
4802
4181
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
4803
4182
|
ON CONFLICT(component_hash, prompt_hash, cli_version) DO UPDATE SET
|
|
4804
4183
|
decision = excluded.decision,
|
|
4805
4184
|
reason = excluded.reason,
|
|
4806
|
-
updated_at = excluded.updated_at`).run(componentHash, promptHash,
|
|
4185
|
+
updated_at = excluded.updated_at`).run(componentHash, promptHash, cliVersion2, decision, reason, now, now);
|
|
4807
4186
|
}
|
|
4808
|
-
function lookupSelectCache(db, componentHash, promptHash,
|
|
4187
|
+
function lookupSelectCache(db, componentHash, promptHash, cliVersion2) {
|
|
4809
4188
|
const row = db.prepare(`SELECT component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at
|
|
4810
4189
|
FROM select_cache
|
|
4811
|
-
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash,
|
|
4190
|
+
WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`).get(componentHash, promptHash, cliVersion2);
|
|
4812
4191
|
if (!row)
|
|
4813
4192
|
return null;
|
|
4814
4193
|
return {
|
|
@@ -5164,8 +4543,8 @@ var init_format_diagnostics = __esm({
|
|
|
5164
4543
|
});
|
|
5165
4544
|
|
|
5166
4545
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
5167
|
-
import { existsSync as
|
|
5168
|
-
import { dirname as
|
|
4546
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
4547
|
+
import { dirname as dirname4, join as join3, resolve as resolve6 } from "node:path";
|
|
5169
4548
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
5170
4549
|
import ts from "typescript";
|
|
5171
4550
|
function createTsxProject(filePaths) {
|
|
@@ -5349,7 +4728,7 @@ function resolveRepoLocalAliasImportPath(importingFilePath, moduleSpecifier) {
|
|
|
5349
4728
|
continue;
|
|
5350
4729
|
for (const targetPattern of targets) {
|
|
5351
4730
|
const substitutedTarget = substituteTsConfigPathTarget(targetPattern, match2.wildcard);
|
|
5352
|
-
const resolvedPath =
|
|
4731
|
+
const resolvedPath = resolve6(tsConfigPaths.baseUrl, substitutedTarget);
|
|
5353
4732
|
const sourceFilePath = resolveImportSourcePath(resolvedPath);
|
|
5354
4733
|
if (sourceFilePath)
|
|
5355
4734
|
return sourceFilePath;
|
|
@@ -5361,16 +4740,16 @@ function findNearestTsConfigPath(filePath) {
|
|
|
5361
4740
|
if (nearestTsConfigPathCache.has(filePath)) {
|
|
5362
4741
|
return nearestTsConfigPathCache.get(filePath) ?? void 0;
|
|
5363
4742
|
}
|
|
5364
|
-
let currentDir =
|
|
4743
|
+
let currentDir = dirname4(filePath);
|
|
5365
4744
|
while (true) {
|
|
5366
4745
|
for (const candidateName of ["tsconfig.json", "jsconfig.json"]) {
|
|
5367
|
-
const candidatePath =
|
|
5368
|
-
if (
|
|
4746
|
+
const candidatePath = join3(currentDir, candidateName);
|
|
4747
|
+
if (existsSync2(candidatePath)) {
|
|
5369
4748
|
nearestTsConfigPathCache.set(filePath, candidatePath);
|
|
5370
4749
|
return candidatePath;
|
|
5371
4750
|
}
|
|
5372
4751
|
}
|
|
5373
|
-
const parentDir =
|
|
4752
|
+
const parentDir = dirname4(currentDir);
|
|
5374
4753
|
if (parentDir === currentDir) {
|
|
5375
4754
|
nearestTsConfigPathCache.set(filePath, null);
|
|
5376
4755
|
return void 0;
|
|
@@ -5387,13 +4766,13 @@ function getTsConfigPaths(tsConfigPath) {
|
|
|
5387
4766
|
tsConfigPathsCache.set(tsConfigPath, null);
|
|
5388
4767
|
return void 0;
|
|
5389
4768
|
}
|
|
5390
|
-
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys,
|
|
4769
|
+
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, dirname4(tsConfigPath));
|
|
5391
4770
|
const paths = parsedConfig.options.paths;
|
|
5392
4771
|
if (!paths || Object.keys(paths).length === 0) {
|
|
5393
4772
|
tsConfigPathsCache.set(tsConfigPath, null);
|
|
5394
4773
|
return void 0;
|
|
5395
4774
|
}
|
|
5396
|
-
const baseUrl = parsedConfig.options.baseUrl ??
|
|
4775
|
+
const baseUrl = parsedConfig.options.baseUrl ?? dirname4(tsConfigPath);
|
|
5397
4776
|
const result = { baseUrl, paths };
|
|
5398
4777
|
tsConfigPathsCache.set(tsConfigPath, result);
|
|
5399
4778
|
return result;
|
|
@@ -5421,12 +4800,12 @@ function resolveImportSourcePath(basePath) {
|
|
|
5421
4800
|
`${basePath}.tsx`,
|
|
5422
4801
|
`${basePath}.js`,
|
|
5423
4802
|
`${basePath}.jsx`,
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
4803
|
+
join3(basePath, "index.ts"),
|
|
4804
|
+
join3(basePath, "index.tsx"),
|
|
4805
|
+
join3(basePath, "index.js"),
|
|
4806
|
+
join3(basePath, "index.jsx")
|
|
5428
4807
|
];
|
|
5429
|
-
return candidates.find((candidatePath) =>
|
|
4808
|
+
return candidates.find((candidatePath) => existsSync2(candidatePath));
|
|
5430
4809
|
}
|
|
5431
4810
|
function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
5432
4811
|
const candidatePaths = [
|
|
@@ -5435,10 +4814,10 @@ function findProjectSourceFileByImportPath(project, resolvedPath) {
|
|
|
5435
4814
|
`${resolvedPath}.tsx`,
|
|
5436
4815
|
`${resolvedPath}.js`,
|
|
5437
4816
|
`${resolvedPath}.jsx`,
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
4817
|
+
join3(resolvedPath, "index.ts"),
|
|
4818
|
+
join3(resolvedPath, "index.tsx"),
|
|
4819
|
+
join3(resolvedPath, "index.js"),
|
|
4820
|
+
join3(resolvedPath, "index.jsx")
|
|
5442
4821
|
];
|
|
5443
4822
|
for (const candidatePath of candidatePaths) {
|
|
5444
4823
|
const sourceFile = project.getSourceFile(candidatePath);
|
|
@@ -5459,10 +4838,10 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
5459
4838
|
if (!packageRootDir)
|
|
5460
4839
|
return void 0;
|
|
5461
4840
|
const preferredEntryPaths = [
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
4841
|
+
join3(packageRootDir, "src/index.ts"),
|
|
4842
|
+
join3(packageRootDir, "src/index.tsx"),
|
|
4843
|
+
join3(packageRootDir, "index.ts"),
|
|
4844
|
+
join3(packageRootDir, "index.tsx")
|
|
5466
4845
|
];
|
|
5467
4846
|
for (const entryPath of preferredEntryPaths) {
|
|
5468
4847
|
const entrySourceFile = project.getSourceFile(entryPath);
|
|
@@ -5470,7 +4849,7 @@ function findWorkspacePackageEntrySourceFile(originSourceFile, moduleSpecifier)
|
|
|
5470
4849
|
return entrySourceFile;
|
|
5471
4850
|
}
|
|
5472
4851
|
}
|
|
5473
|
-
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() ===
|
|
4852
|
+
return candidateSourceFiles.find((sourceFile) => sourceFile.getDirectoryPath() === join3(packageRootDir, "src"));
|
|
5474
4853
|
}
|
|
5475
4854
|
function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
5476
4855
|
const packageRootDir = findNearestPackageRootDir(sourceFile.getFilePath());
|
|
@@ -5479,9 +4858,9 @@ function getWorkspacePackageManifestForSourceFile(sourceFile) {
|
|
|
5479
4858
|
if (workspacePackageManifestCache.has(packageRootDir)) {
|
|
5480
4859
|
return workspacePackageManifestCache.get(packageRootDir) ?? void 0;
|
|
5481
4860
|
}
|
|
5482
|
-
const packageJsonPath =
|
|
4861
|
+
const packageJsonPath = join3(packageRootDir, "package.json");
|
|
5483
4862
|
try {
|
|
5484
|
-
const packageJson = JSON.parse(
|
|
4863
|
+
const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf8"));
|
|
5485
4864
|
const manifest = typeof packageJson.name === "string" ? { name: packageJson.name, rootDir: packageRootDir } : null;
|
|
5486
4865
|
workspacePackageManifestCache.set(packageRootDir, manifest);
|
|
5487
4866
|
return manifest ?? void 0;
|
|
@@ -5494,13 +4873,13 @@ function findNearestPackageRootDir(filePath) {
|
|
|
5494
4873
|
if (packageRootByFilePathCache.has(filePath)) {
|
|
5495
4874
|
return packageRootByFilePathCache.get(filePath) ?? void 0;
|
|
5496
4875
|
}
|
|
5497
|
-
let currentDir =
|
|
4876
|
+
let currentDir = dirname4(filePath);
|
|
5498
4877
|
while (true) {
|
|
5499
|
-
if (
|
|
4878
|
+
if (existsSync2(join3(currentDir, "package.json"))) {
|
|
5500
4879
|
packageRootByFilePathCache.set(filePath, currentDir);
|
|
5501
4880
|
return currentDir;
|
|
5502
4881
|
}
|
|
5503
|
-
const parentDir =
|
|
4882
|
+
const parentDir = dirname4(currentDir);
|
|
5504
4883
|
if (parentDir === currentDir) {
|
|
5505
4884
|
packageRootByFilePathCache.set(filePath, null);
|
|
5506
4885
|
return void 0;
|
|
@@ -8567,28 +7946,28 @@ var init_extract_vue_tsx_components = __esm({
|
|
|
8567
7946
|
});
|
|
8568
7947
|
|
|
8569
7948
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/resolve-local-module.js
|
|
8570
|
-
import { existsSync as
|
|
8571
|
-
import { dirname as
|
|
7949
|
+
import { existsSync as existsSync3, statSync } from "node:fs";
|
|
7950
|
+
import { dirname as dirname5, join as join4, resolve as resolve7 } from "node:path";
|
|
8572
7951
|
function resolveLocalModule(importingFilePath, specifier, options = {}) {
|
|
8573
|
-
const basePath =
|
|
7952
|
+
const basePath = resolve7(dirname5(importingFilePath), specifier);
|
|
8574
7953
|
const candidates = [
|
|
8575
7954
|
basePath,
|
|
8576
7955
|
`${basePath}.js`,
|
|
8577
7956
|
`${basePath}.ts`,
|
|
8578
7957
|
`${basePath}.mjs`,
|
|
8579
7958
|
`${basePath}.cjs`,
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
7959
|
+
join4(basePath, "index.js"),
|
|
7960
|
+
join4(basePath, "index.ts"),
|
|
7961
|
+
join4(basePath, "index.mjs"),
|
|
7962
|
+
join4(basePath, "index.cjs")
|
|
8584
7963
|
];
|
|
8585
7964
|
for (const candidate of candidates) {
|
|
8586
|
-
if (
|
|
7965
|
+
if (existsSync3(candidate) && statSync(candidate).isFile())
|
|
8587
7966
|
return candidate;
|
|
8588
7967
|
}
|
|
8589
7968
|
if (options.allowJavaScriptExtensionFallback && basePath.endsWith(".js")) {
|
|
8590
7969
|
const tsPath = `${basePath.slice(0, -".js".length)}.ts`;
|
|
8591
|
-
if (
|
|
7970
|
+
if (existsSync3(tsPath) && statSync(tsPath).isFile())
|
|
8592
7971
|
return tsPath;
|
|
8593
7972
|
}
|
|
8594
7973
|
return null;
|
|
@@ -8619,9 +7998,9 @@ var init_resolve_type_property = __esm({
|
|
|
8619
7998
|
|
|
8620
7999
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
8621
8000
|
import os from "node:os";
|
|
8622
|
-
import { basename, dirname as
|
|
8001
|
+
import { basename, dirname as dirname6, resolve as resolve8, join as join5 } from "node:path";
|
|
8623
8002
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
8624
|
-
import { existsSync as
|
|
8003
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, readdirSync, statSync as statSync2 } from "node:fs";
|
|
8625
8004
|
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
8626
8005
|
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
8627
8006
|
async function extractVueComponents(filePaths, onProgress) {
|
|
@@ -8663,7 +8042,7 @@ function getVueComponentName(filePath) {
|
|
|
8663
8042
|
if (fileName !== "index") {
|
|
8664
8043
|
return fileName;
|
|
8665
8044
|
}
|
|
8666
|
-
const parentDirName = basename(
|
|
8045
|
+
const parentDirName = basename(dirname6(filePath));
|
|
8667
8046
|
return parentDirName || fileName;
|
|
8668
8047
|
}
|
|
8669
8048
|
async function extractOptionsComponent(filePath, scriptContent, fileWarnings, name, templateAst, sfcSource) {
|
|
@@ -8834,18 +8213,18 @@ function findWorkspaceRoot(startDir) {
|
|
|
8834
8213
|
return workspaceRootCache.get(startDir);
|
|
8835
8214
|
let dir = startDir;
|
|
8836
8215
|
while (true) {
|
|
8837
|
-
const pkgJsonPath =
|
|
8838
|
-
if (
|
|
8216
|
+
const pkgJsonPath = join5(dir, "package.json");
|
|
8217
|
+
if (existsSync4(pkgJsonPath)) {
|
|
8839
8218
|
try {
|
|
8840
|
-
const pkg2 = JSON.parse(
|
|
8841
|
-
if (pkg2.workspaces ||
|
|
8219
|
+
const pkg2 = JSON.parse(readFileSync3(pkgJsonPath, "utf8"));
|
|
8220
|
+
if (pkg2.workspaces || existsSync4(join5(dir, "pnpm-workspace.yaml"))) {
|
|
8842
8221
|
workspaceRootCache.set(startDir, dir);
|
|
8843
8222
|
return dir;
|
|
8844
8223
|
}
|
|
8845
8224
|
} catch {
|
|
8846
8225
|
}
|
|
8847
8226
|
}
|
|
8848
|
-
const parent =
|
|
8227
|
+
const parent = dirname6(dir);
|
|
8849
8228
|
if (parent === dir) {
|
|
8850
8229
|
workspaceRootCache.set(startDir, null);
|
|
8851
8230
|
return null;
|
|
@@ -8858,8 +8237,8 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
8858
8237
|
return workspacePackageDirsCache.get(workspaceRoot);
|
|
8859
8238
|
}
|
|
8860
8239
|
const packageMap = /* @__PURE__ */ new Map();
|
|
8861
|
-
const packagesDir =
|
|
8862
|
-
if (!
|
|
8240
|
+
const packagesDir = join5(workspaceRoot, "packages");
|
|
8241
|
+
if (!existsSync4(packagesDir)) {
|
|
8863
8242
|
workspacePackageDirsCache.set(workspaceRoot, packageMap);
|
|
8864
8243
|
return packageMap;
|
|
8865
8244
|
}
|
|
@@ -8872,10 +8251,10 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
8872
8251
|
} catch {
|
|
8873
8252
|
return;
|
|
8874
8253
|
}
|
|
8875
|
-
const pkgJsonPath =
|
|
8876
|
-
if (
|
|
8254
|
+
const pkgJsonPath = join5(dir, "package.json");
|
|
8255
|
+
if (existsSync4(pkgJsonPath)) {
|
|
8877
8256
|
try {
|
|
8878
|
-
const pkg2 = JSON.parse(
|
|
8257
|
+
const pkg2 = JSON.parse(readFileSync3(pkgJsonPath, "utf8"));
|
|
8879
8258
|
if (typeof pkg2.name === "string") {
|
|
8880
8259
|
packageMap.set(pkg2.name, dir);
|
|
8881
8260
|
}
|
|
@@ -8885,9 +8264,9 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
8885
8264
|
for (const entry of entries) {
|
|
8886
8265
|
if (entry === "node_modules" || entry === ".git" || entry.startsWith("."))
|
|
8887
8266
|
continue;
|
|
8888
|
-
const entryPath =
|
|
8267
|
+
const entryPath = join5(dir, entry);
|
|
8889
8268
|
try {
|
|
8890
|
-
const stat5 =
|
|
8269
|
+
const stat5 = statSync2(entryPath);
|
|
8891
8270
|
if (stat5.isDirectory()) {
|
|
8892
8271
|
scanDir(entryPath, depth + 1);
|
|
8893
8272
|
}
|
|
@@ -8900,7 +8279,7 @@ function getWorkspacePackageDirs(workspaceRoot) {
|
|
|
8900
8279
|
return packageMap;
|
|
8901
8280
|
}
|
|
8902
8281
|
function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
8903
|
-
const workspaceRoot = findWorkspaceRoot(
|
|
8282
|
+
const workspaceRoot = findWorkspaceRoot(dirname6(importingFilePath));
|
|
8904
8283
|
if (!workspaceRoot)
|
|
8905
8284
|
return null;
|
|
8906
8285
|
const packageDirs = getWorkspacePackageDirs(workspaceRoot);
|
|
@@ -8925,28 +8304,28 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
8925
8304
|
const packageDir = packageDirs.get(packageName);
|
|
8926
8305
|
if (!packageDir)
|
|
8927
8306
|
return null;
|
|
8928
|
-
const pkgJsonPath =
|
|
8307
|
+
const pkgJsonPath = join5(packageDir, "package.json");
|
|
8929
8308
|
try {
|
|
8930
|
-
const pkg2 = JSON.parse(
|
|
8309
|
+
const pkg2 = JSON.parse(readFileSync3(pkgJsonPath, "utf8"));
|
|
8931
8310
|
if (pkg2.exports && subpath !== ".") {
|
|
8932
8311
|
const exportValue = pkg2.exports[subpath];
|
|
8933
8312
|
if (typeof exportValue === "string" && exportValue.endsWith(".vue")) {
|
|
8934
|
-
const resolved =
|
|
8935
|
-
if (
|
|
8313
|
+
const resolved = resolve8(packageDir, exportValue);
|
|
8314
|
+
if (existsSync4(resolved))
|
|
8936
8315
|
return resolved;
|
|
8937
8316
|
}
|
|
8938
8317
|
}
|
|
8939
8318
|
if (subpath !== ".") {
|
|
8940
|
-
const subDir =
|
|
8941
|
-
for (const base of [
|
|
8942
|
-
const subPkgPath =
|
|
8943
|
-
if (
|
|
8319
|
+
const subDir = resolve8(packageDir, subpath.replace(/^\.\//, ""));
|
|
8320
|
+
for (const base of [join5(packageDir, "src", subpath.replace(/^\.\//, "")), subDir]) {
|
|
8321
|
+
const subPkgPath = join5(base, "package.json");
|
|
8322
|
+
if (existsSync4(subPkgPath)) {
|
|
8944
8323
|
try {
|
|
8945
|
-
const subPkg = JSON.parse(
|
|
8324
|
+
const subPkg = JSON.parse(readFileSync3(subPkgPath, "utf8"));
|
|
8946
8325
|
const main = subPkg.main || subPkg.module;
|
|
8947
8326
|
if (typeof main === "string" && main.endsWith(".vue")) {
|
|
8948
|
-
const resolved =
|
|
8949
|
-
if (
|
|
8327
|
+
const resolved = resolve8(base, main);
|
|
8328
|
+
if (existsSync4(resolved))
|
|
8950
8329
|
return resolved;
|
|
8951
8330
|
}
|
|
8952
8331
|
} catch {
|
|
@@ -8957,8 +8336,8 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
8957
8336
|
if (subpath === ".") {
|
|
8958
8337
|
const main = pkg2.main || pkg2.module;
|
|
8959
8338
|
if (typeof main === "string" && main.endsWith(".vue")) {
|
|
8960
|
-
const resolved =
|
|
8961
|
-
if (
|
|
8339
|
+
const resolved = resolve8(packageDir, main);
|
|
8340
|
+
if (existsSync4(resolved))
|
|
8962
8341
|
return resolved;
|
|
8963
8342
|
}
|
|
8964
8343
|
}
|
|
@@ -8967,7 +8346,7 @@ function resolveWorkspaceVueImport(specifier, importingFilePath) {
|
|
|
8967
8346
|
return null;
|
|
8968
8347
|
}
|
|
8969
8348
|
async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE__ */ new Set()) {
|
|
8970
|
-
const resolvedFilePath =
|
|
8349
|
+
const resolvedFilePath = resolve8(filePath);
|
|
8971
8350
|
if (visited.has(resolvedFilePath)) {
|
|
8972
8351
|
return [];
|
|
8973
8352
|
}
|
|
@@ -8992,7 +8371,7 @@ async function extractOptionsProps(filePath, scriptContent, visited = /* @__PURE
|
|
|
8992
8371
|
if (specifier.startsWith(".")) {
|
|
8993
8372
|
if (!specifier.endsWith(".vue"))
|
|
8994
8373
|
continue;
|
|
8995
|
-
localImports.set(defaultImport.getText(),
|
|
8374
|
+
localImports.set(defaultImport.getText(), resolve8(dirname6(resolvedFilePath), specifier));
|
|
8996
8375
|
} else {
|
|
8997
8376
|
const resolvedVuePath = resolveWorkspaceVueImport(specifier, resolvedFilePath);
|
|
8998
8377
|
if (resolvedVuePath) {
|
|
@@ -9400,7 +8779,7 @@ var init_extract_astro_components = __esm({
|
|
|
9400
8779
|
});
|
|
9401
8780
|
|
|
9402
8781
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
9403
|
-
import { basename as basename3, dirname as
|
|
8782
|
+
import { basename as basename3, dirname as dirname7, join as join6, resolve as resolve9 } from "node:path";
|
|
9404
8783
|
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
9405
8784
|
function normalizeComponentName(input) {
|
|
9406
8785
|
return input.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
@@ -10043,7 +9422,7 @@ function getElementTagNameFromFastDefinition(classDecl, project) {
|
|
|
10043
9422
|
}
|
|
10044
9423
|
function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
10045
9424
|
if (specifier.startsWith(".")) {
|
|
10046
|
-
const resolvedPath =
|
|
9425
|
+
const resolvedPath = resolve9(dirname7(fromFilePath), specifier);
|
|
10047
9426
|
if (resolvedPath.endsWith(".js")) {
|
|
10048
9427
|
return `${resolvedPath.slice(0, -3)}.ts`;
|
|
10049
9428
|
}
|
|
@@ -10053,14 +9432,14 @@ function resolveImportSourcePath2(fromFilePath, specifier) {
|
|
|
10053
9432
|
if (!specifier.startsWith(spectrumPrefix)) {
|
|
10054
9433
|
return null;
|
|
10055
9434
|
}
|
|
10056
|
-
const packagesMarker = `${
|
|
9435
|
+
const packagesMarker = `${join6("2nd-gen", "packages")}${fromFilePath.includes("\\") ? "\\" : "/"}`;
|
|
10057
9436
|
const markerIndex = fromFilePath.lastIndexOf(packagesMarker);
|
|
10058
9437
|
if (markerIndex === -1) {
|
|
10059
9438
|
return null;
|
|
10060
9439
|
}
|
|
10061
9440
|
const packagesRoot = fromFilePath.slice(0, markerIndex + packagesMarker.length - 1);
|
|
10062
9441
|
const componentPath = specifier.slice(spectrumPrefix.length);
|
|
10063
|
-
return
|
|
9442
|
+
return join6(packagesRoot, "core", "components", componentPath, "index.ts");
|
|
10064
9443
|
}
|
|
10065
9444
|
function getImportedBaseClass(classDecl, project, visitedFiles) {
|
|
10066
9445
|
const extendsClause = classDecl.getHeritageClauses().find((clause) => clause.getToken() === SyntaxKind6.ExtendsKeyword);
|
|
@@ -10327,8 +9706,8 @@ var init_scoring = __esm({
|
|
|
10327
9706
|
|
|
10328
9707
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
10329
9708
|
import os3 from "node:os";
|
|
10330
|
-
import { basename as basename4, dirname as
|
|
10331
|
-
import { existsSync as
|
|
9709
|
+
import { basename as basename4, dirname as dirname8, resolve as resolve10, join as join7 } from "node:path";
|
|
9710
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
|
|
10332
9711
|
import { createRequire } from "node:module";
|
|
10333
9712
|
import { parse as parseSvelte } from "svelte/compiler";
|
|
10334
9713
|
import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
|
|
@@ -10461,10 +9840,10 @@ async function maybeRunResolveUnreachableRetry(components, warnings, retryContex
|
|
|
10461
9840
|
function findNearestTsconfig(startDir) {
|
|
10462
9841
|
let dir = startDir;
|
|
10463
9842
|
for (let i = 0; i < 16; i++) {
|
|
10464
|
-
const candidate =
|
|
10465
|
-
if (
|
|
9843
|
+
const candidate = join7(dir, "tsconfig.json");
|
|
9844
|
+
if (existsSync5(candidate))
|
|
10466
9845
|
return candidate;
|
|
10467
|
-
const parent =
|
|
9846
|
+
const parent = dirname8(dir);
|
|
10468
9847
|
if (!parent || parent === dir)
|
|
10469
9848
|
return null;
|
|
10470
9849
|
dir = parent;
|
|
@@ -10594,32 +9973,32 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
10594
9973
|
} catch {
|
|
10595
9974
|
resolvedJs = null;
|
|
10596
9975
|
}
|
|
10597
|
-
const seedDir = resolvedJs ?
|
|
9976
|
+
const seedDir = resolvedJs ? dirname8(resolvedJs) : dirname8(parentFile);
|
|
10598
9977
|
const pkgRoot = findPackageRootForSpecifier(seedDir, specifier);
|
|
10599
9978
|
if (pkgRoot) {
|
|
10600
|
-
const pkgJsonPath =
|
|
10601
|
-
if (
|
|
9979
|
+
const pkgJsonPath = join7(pkgRoot, "package.json");
|
|
9980
|
+
if (existsSync5(pkgJsonPath)) {
|
|
10602
9981
|
try {
|
|
10603
|
-
const pkgRaw =
|
|
9982
|
+
const pkgRaw = readFileSync4(pkgJsonPath, "utf-8");
|
|
10604
9983
|
const pkg2 = JSON.parse(pkgRaw);
|
|
10605
9984
|
const typesField = pkg2.types ?? pkg2.typings;
|
|
10606
9985
|
if (typeof typesField === "string") {
|
|
10607
|
-
const candidate =
|
|
10608
|
-
if (
|
|
9986
|
+
const candidate = resolve10(pkgRoot, typesField);
|
|
9987
|
+
if (existsSync5(candidate))
|
|
10609
9988
|
return candidate;
|
|
10610
9989
|
}
|
|
10611
9990
|
const exportsTypes = extractTypesFromExports(pkg2.exports);
|
|
10612
9991
|
if (exportsTypes) {
|
|
10613
|
-
const candidate =
|
|
10614
|
-
if (
|
|
9992
|
+
const candidate = resolve10(pkgRoot, exportsTypes);
|
|
9993
|
+
if (existsSync5(candidate))
|
|
10615
9994
|
return candidate;
|
|
10616
9995
|
}
|
|
10617
9996
|
} catch {
|
|
10618
9997
|
}
|
|
10619
9998
|
}
|
|
10620
9999
|
for (const entry of ["index.d.ts", "index.d.mts"]) {
|
|
10621
|
-
const candidate =
|
|
10622
|
-
if (
|
|
10000
|
+
const candidate = join7(pkgRoot, entry);
|
|
10001
|
+
if (existsSync5(candidate))
|
|
10623
10002
|
return candidate;
|
|
10624
10003
|
}
|
|
10625
10004
|
}
|
|
@@ -10627,7 +10006,7 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
10627
10006
|
const noExt = resolvedJs.replace(/\.(m?js|cjs)$/, "");
|
|
10628
10007
|
for (const ext of [".d.ts", ".d.mts"]) {
|
|
10629
10008
|
const candidate = `${noExt}${ext}`;
|
|
10630
|
-
if (
|
|
10009
|
+
if (existsSync5(candidate))
|
|
10631
10010
|
return candidate;
|
|
10632
10011
|
}
|
|
10633
10012
|
}
|
|
@@ -10636,9 +10015,9 @@ function locateDtsForSpecifier(req, specifier, parentFile) {
|
|
|
10636
10015
|
function findPackageRootForSpecifier(seedDir, specifier) {
|
|
10637
10016
|
let dir = seedDir;
|
|
10638
10017
|
for (let i = 0; i < 32; i++) {
|
|
10639
|
-
if (
|
|
10018
|
+
if (existsSync5(join7(dir, "package.json"))) {
|
|
10640
10019
|
try {
|
|
10641
|
-
const pkgRaw =
|
|
10020
|
+
const pkgRaw = readFileSync4(join7(dir, "package.json"), "utf-8");
|
|
10642
10021
|
const pkg2 = JSON.parse(pkgRaw);
|
|
10643
10022
|
if (pkg2.name === specifier)
|
|
10644
10023
|
return dir;
|
|
@@ -10647,7 +10026,7 @@ function findPackageRootForSpecifier(seedDir, specifier) {
|
|
|
10647
10026
|
} catch {
|
|
10648
10027
|
}
|
|
10649
10028
|
}
|
|
10650
|
-
const parent =
|
|
10029
|
+
const parent = dirname8(dir);
|
|
10651
10030
|
if (!parent || parent === dir)
|
|
10652
10031
|
return null;
|
|
10653
10032
|
dir = parent;
|
|
@@ -10778,11 +10157,11 @@ async function extractFromSvelteFile(filePath, source) {
|
|
|
10778
10157
|
}
|
|
10779
10158
|
function getSvelteComponentName(filePath) {
|
|
10780
10159
|
const file = basename4(filePath, ".svelte");
|
|
10781
|
-
const parentDir = basename4(
|
|
10160
|
+
const parentDir = basename4(dirname8(filePath));
|
|
10782
10161
|
if (file === "index")
|
|
10783
10162
|
return toPascalCase(parentDir);
|
|
10784
10163
|
if (ANATOMY_FOLDERS.has(parentDir)) {
|
|
10785
|
-
const grandparent = basename4(
|
|
10164
|
+
const grandparent = basename4(dirname8(dirname8(filePath)));
|
|
10786
10165
|
if (grandparent && grandparent !== "." && grandparent !== "/") {
|
|
10787
10166
|
return `${toPascalCase(grandparent)}${toPascalCase(file)}`;
|
|
10788
10167
|
}
|
|
@@ -12152,17 +11531,17 @@ var init_apply_mapping = __esm({
|
|
|
12152
11531
|
});
|
|
12153
11532
|
|
|
12154
11533
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/prompt/prompt-loader.js
|
|
12155
|
-
import { existsSync as
|
|
12156
|
-
import { dirname as
|
|
12157
|
-
import { fileURLToPath as
|
|
11534
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
|
|
11535
|
+
import { dirname as dirname9, join as join8, resolve as resolve11 } from "node:path";
|
|
11536
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12158
11537
|
function resolvePromptPath(fileName) {
|
|
12159
|
-
const thisDir =
|
|
11538
|
+
const thisDir = dirname9(fileURLToPath2(import.meta.url));
|
|
12160
11539
|
let dir = thisDir;
|
|
12161
11540
|
for (; ; ) {
|
|
12162
|
-
const candidate =
|
|
12163
|
-
if (
|
|
12164
|
-
return
|
|
12165
|
-
const parent =
|
|
11541
|
+
const candidate = join8(dir, "prompts");
|
|
11542
|
+
if (existsSync6(candidate))
|
|
11543
|
+
return join8(candidate, fileName);
|
|
11544
|
+
const parent = resolve11(dir, "..");
|
|
12166
11545
|
if (parent === dir) {
|
|
12167
11546
|
throw new Error(`prompt file missing from package installation (could not locate prompts/ directory from: ${thisDir})`);
|
|
12168
11547
|
}
|
|
@@ -12172,7 +11551,7 @@ function resolvePromptPath(fileName) {
|
|
|
12172
11551
|
function loadPrompt(fileName) {
|
|
12173
11552
|
const path5 = resolvePromptPath(fileName);
|
|
12174
11553
|
try {
|
|
12175
|
-
return
|
|
11554
|
+
return readFileSync5(path5, "utf8");
|
|
12176
11555
|
} catch {
|
|
12177
11556
|
throw new Error(`prompt file missing from package installation \u2014 try reinstalling (looked for: ${path5})`);
|
|
12178
11557
|
}
|
|
@@ -12350,7 +11729,7 @@ var init_composition_cache_key = __esm({
|
|
|
12350
11729
|
});
|
|
12351
11730
|
|
|
12352
11731
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/helpers/edges/manifest-doc-evidence.js
|
|
12353
|
-
import { dirname as
|
|
11732
|
+
import { dirname as dirname10 } from "node:path";
|
|
12354
11733
|
function kebabToPascal2(name) {
|
|
12355
11734
|
return name.split("-").filter(Boolean).map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1)).join("");
|
|
12356
11735
|
}
|
|
@@ -12412,8 +11791,8 @@ function collectAgentsDocEdges(files, components, componentNames) {
|
|
|
12412
11791
|
for (const file of files) {
|
|
12413
11792
|
if (!file.path.endsWith("AGENTS.md"))
|
|
12414
11793
|
continue;
|
|
12415
|
-
const docDir =
|
|
12416
|
-
const parent = components.find((c2) => c2.sourcePath &&
|
|
11794
|
+
const docDir = dirname10(file.path);
|
|
11795
|
+
const parent = components.find((c2) => c2.sourcePath && dirname10(c2.sourcePath) === docDir)?.name;
|
|
12417
11796
|
if (!parent || !componentNames.has(parent))
|
|
12418
11797
|
continue;
|
|
12419
11798
|
for (const line of file.content.split("\n")) {
|
|
@@ -13060,7 +12439,7 @@ var init_create_component_id = __esm({
|
|
|
13060
12439
|
|
|
13061
12440
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/resolve-component-source-path.js
|
|
13062
12441
|
import { access } from "node:fs/promises";
|
|
13063
|
-
import { isAbsolute, relative, resolve as
|
|
12442
|
+
import { isAbsolute, relative, resolve as resolve12 } from "node:path";
|
|
13064
12443
|
async function resolveComponentSourcePath(source, reviewRoot) {
|
|
13065
12444
|
if (isAbsolute(source)) {
|
|
13066
12445
|
try {
|
|
@@ -13070,7 +12449,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
|
|
|
13070
12449
|
throw new Error(`Unable to access component source at ${source}`);
|
|
13071
12450
|
}
|
|
13072
12451
|
}
|
|
13073
|
-
const candidate =
|
|
12452
|
+
const candidate = resolve12(reviewRoot, source);
|
|
13074
12453
|
const relativeToRoot = relative(reviewRoot, candidate);
|
|
13075
12454
|
if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
|
|
13076
12455
|
throw new Error(`Resolved component source is outside the review root: ${source}. Pass --project-root <path> to set the correct base.`);
|
|
@@ -13089,9 +12468,9 @@ var init_resolve_component_source_path = __esm({
|
|
|
13089
12468
|
});
|
|
13090
12469
|
|
|
13091
12470
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/helpers/load-review-input.js
|
|
13092
|
-
import { resolve as
|
|
12471
|
+
import { resolve as resolve13 } from "node:path";
|
|
13093
12472
|
async function loadReviewInput(components, options = {}) {
|
|
13094
|
-
const reviewRoot =
|
|
12473
|
+
const reviewRoot = resolve13(options.reviewRoot ?? process.cwd());
|
|
13095
12474
|
const records = await Promise.all(components.map(async (component) => {
|
|
13096
12475
|
let resolvedSourcePath;
|
|
13097
12476
|
try {
|
|
@@ -13142,13 +12521,13 @@ var init_load_and_validate_for_review = __esm({
|
|
|
13142
12521
|
});
|
|
13143
12522
|
|
|
13144
12523
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-session-paths.js
|
|
13145
|
-
import { resolve as
|
|
12524
|
+
import { resolve as resolve14 } from "node:path";
|
|
13146
12525
|
async function getRefineSessionPaths(sessionId, artifactsRoot) {
|
|
13147
|
-
const sessionDir2 =
|
|
12526
|
+
const sessionDir2 = resolve14(artifactsRoot, sessionId);
|
|
13148
12527
|
return {
|
|
13149
12528
|
sessionDir: sessionDir2,
|
|
13150
|
-
eventsPath:
|
|
13151
|
-
statePath:
|
|
12529
|
+
eventsPath: resolve14(sessionDir2, "events.jsonl"),
|
|
12530
|
+
statePath: resolve14(sessionDir2, "current-review-state.json")
|
|
13152
12531
|
};
|
|
13153
12532
|
}
|
|
13154
12533
|
var init_review_session_paths = __esm({
|
|
@@ -13180,12 +12559,12 @@ var init_ensure_review_session = __esm({
|
|
|
13180
12559
|
});
|
|
13181
12560
|
|
|
13182
12561
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js
|
|
13183
|
-
import { resolve as
|
|
12562
|
+
import { resolve as resolve15 } from "node:path";
|
|
13184
12563
|
function getRefineArtifactsRoot() {
|
|
13185
12564
|
if (process.env["EDS_REVIEW_ARTIFACTS_DIR"]) {
|
|
13186
|
-
return
|
|
12565
|
+
return resolve15(process.env["EDS_REVIEW_ARTIFACTS_DIR"]);
|
|
13187
12566
|
}
|
|
13188
|
-
return
|
|
12567
|
+
return resolve15(configRoot(), "reviews");
|
|
13189
12568
|
}
|
|
13190
12569
|
var init_review_artifacts_root = __esm({
|
|
13191
12570
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/review-session/repositories/review-artifacts-root.js"() {
|
|
@@ -13485,7 +12864,7 @@ var init_read_dir_safely = __esm({
|
|
|
13485
12864
|
});
|
|
13486
12865
|
|
|
13487
12866
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/walk-project-tree.js
|
|
13488
|
-
import { readFileSync as
|
|
12867
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
13489
12868
|
import path3 from "node:path";
|
|
13490
12869
|
function walkProjectTree(dir, result, includeContent) {
|
|
13491
12870
|
const entries = readDirSafely(dir);
|
|
@@ -13510,7 +12889,7 @@ function walkProjectTree(dir, result, includeContent) {
|
|
|
13510
12889
|
result.filePaths.push(full);
|
|
13511
12890
|
if (includeContent) {
|
|
13512
12891
|
try {
|
|
13513
|
-
const content =
|
|
12892
|
+
const content = readFileSync6(full, "utf8");
|
|
13514
12893
|
(result.candidateFiles ??= []).push({ path: full, content });
|
|
13515
12894
|
} catch {
|
|
13516
12895
|
}
|
|
@@ -13528,13 +12907,13 @@ var init_walk_project_tree = __esm({
|
|
|
13528
12907
|
});
|
|
13529
12908
|
|
|
13530
12909
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/helpers/collect-files/collect-files.js
|
|
13531
|
-
import { statSync as
|
|
12910
|
+
import { statSync as statSync3 } from "node:fs";
|
|
13532
12911
|
import path4 from "node:path";
|
|
13533
12912
|
function collectFiles(root, options = {}) {
|
|
13534
12913
|
const resolved = path4.resolve(root);
|
|
13535
12914
|
let stat5;
|
|
13536
12915
|
try {
|
|
13537
|
-
stat5 =
|
|
12916
|
+
stat5 = statSync3(resolved);
|
|
13538
12917
|
} catch (err) {
|
|
13539
12918
|
return { ok: false, failure: classifyStatError(err.code), rootPath: resolved };
|
|
13540
12919
|
}
|
|
@@ -13666,9 +13045,9 @@ var init_read_runs_file = __esm({
|
|
|
13666
13045
|
|
|
13667
13046
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/write-runs-file.js
|
|
13668
13047
|
import { mkdir as mkdir2, rename, writeFile as writeFile3 } from "node:fs/promises";
|
|
13669
|
-
import { dirname as
|
|
13048
|
+
import { dirname as dirname11 } from "node:path";
|
|
13670
13049
|
async function writeRunsFileAtomic(file) {
|
|
13671
|
-
await mkdir2(
|
|
13050
|
+
await mkdir2(dirname11(runsFilePath()), { recursive: true });
|
|
13672
13051
|
const body = JSON.stringify(file, null, 2) + "\n";
|
|
13673
13052
|
const tmp = `${runsFilePath()}.${process.pid}.${Date.now()}.tmp`;
|
|
13674
13053
|
await writeFile3(tmp, body, { mode: 384 });
|
|
@@ -13762,7 +13141,7 @@ var init_sha256_hex = __esm({
|
|
|
13762
13141
|
|
|
13763
13142
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/services/build-source-fingerprint.js
|
|
13764
13143
|
import { readFile as readFile11, stat } from "node:fs/promises";
|
|
13765
|
-
import { resolve as
|
|
13144
|
+
import { resolve as resolve16 } from "node:path";
|
|
13766
13145
|
function rowField(row, key) {
|
|
13767
13146
|
const v = row[key];
|
|
13768
13147
|
return typeof v === "string" ? v : null;
|
|
@@ -13776,7 +13155,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
13776
13155
|
const name = rowField(row, "name");
|
|
13777
13156
|
if (!sourcePath)
|
|
13778
13157
|
continue;
|
|
13779
|
-
const abs =
|
|
13158
|
+
const abs = resolve16(sourcePath);
|
|
13780
13159
|
if (seen.has(abs))
|
|
13781
13160
|
continue;
|
|
13782
13161
|
seen.add(abs);
|
|
@@ -13793,7 +13172,7 @@ async function buildSourceFingerprint(opts) {
|
|
|
13793
13172
|
let rawTokensMtime = null;
|
|
13794
13173
|
let rawTokensContentHash = null;
|
|
13795
13174
|
if (opts.rawTokensPath) {
|
|
13796
|
-
const abs =
|
|
13175
|
+
const abs = resolve16(opts.rawTokensPath);
|
|
13797
13176
|
rawTokensPath = abs;
|
|
13798
13177
|
try {
|
|
13799
13178
|
const [st, buf] = await Promise.all([stat(abs), readFile11(abs)]);
|
|
@@ -13822,12 +13201,12 @@ var init_save_files = __esm({
|
|
|
13822
13201
|
|
|
13823
13202
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/repositories/list-conflicting-files.js
|
|
13824
13203
|
import { access as access4 } from "node:fs/promises";
|
|
13825
|
-
import { join as
|
|
13204
|
+
import { join as join9 } from "node:path";
|
|
13826
13205
|
async function listConflictingFiles(path5) {
|
|
13827
13206
|
const conflicts = [];
|
|
13828
13207
|
for (const name of SAVE_FILES) {
|
|
13829
13208
|
try {
|
|
13830
|
-
await access4(
|
|
13209
|
+
await access4(join9(path5, name));
|
|
13831
13210
|
conflicts.push(name);
|
|
13832
13211
|
} catch {
|
|
13833
13212
|
}
|
|
@@ -13853,7 +13232,7 @@ var init_detect_save_conflict = __esm({
|
|
|
13853
13232
|
});
|
|
13854
13233
|
|
|
13855
13234
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js
|
|
13856
|
-
import { join as
|
|
13235
|
+
import { join as join10 } from "node:path";
|
|
13857
13236
|
function pad2(n) {
|
|
13858
13237
|
return n < 10 ? `0${n}` : String(n);
|
|
13859
13238
|
}
|
|
@@ -13864,7 +13243,7 @@ function buildTimestampedSubdir(base, now = /* @__PURE__ */ new Date()) {
|
|
|
13864
13243
|
const hh = pad2(now.getHours());
|
|
13865
13244
|
const mm = pad2(now.getMinutes());
|
|
13866
13245
|
const ss = pad2(now.getSeconds());
|
|
13867
|
-
return
|
|
13246
|
+
return join10(base, `dsi-${y}${m}${d}-${hh}${mm}${ss}`);
|
|
13868
13247
|
}
|
|
13869
13248
|
var init_build_timestamped_subdir = __esm({
|
|
13870
13249
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/runs/helpers/build-timestamped-subdir.js"() {
|
|
@@ -14039,9 +13418,62 @@ var init_create_tables = __esm({
|
|
|
14039
13418
|
});
|
|
14040
13419
|
|
|
14041
13420
|
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js
|
|
13421
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
13422
|
+
function generateSessionId2() {
|
|
13423
|
+
const adj = ADJECTIVES2[Math.floor(Math.random() * ADJECTIVES2.length)];
|
|
13424
|
+
const noun = NOUNS2[Math.floor(Math.random() * NOUNS2.length)];
|
|
13425
|
+
const hex = randomBytes3(2).toString("hex");
|
|
13426
|
+
return `${adj}-${noun}-${hex}`;
|
|
13427
|
+
}
|
|
13428
|
+
var ADJECTIVES2, NOUNS2;
|
|
14042
13429
|
var init_generate_session_id = __esm({
|
|
14043
13430
|
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/generate-session-id.js"() {
|
|
14044
13431
|
"use strict";
|
|
13432
|
+
ADJECTIVES2 = [
|
|
13433
|
+
"bright",
|
|
13434
|
+
"calm",
|
|
13435
|
+
"dark",
|
|
13436
|
+
"fast",
|
|
13437
|
+
"green",
|
|
13438
|
+
"happy",
|
|
13439
|
+
"keen",
|
|
13440
|
+
"light",
|
|
13441
|
+
"long",
|
|
13442
|
+
"loud",
|
|
13443
|
+
"pale",
|
|
13444
|
+
"quick",
|
|
13445
|
+
"sharp",
|
|
13446
|
+
"slow",
|
|
13447
|
+
"soft",
|
|
13448
|
+
"warm",
|
|
13449
|
+
"wild",
|
|
13450
|
+
"wise"
|
|
13451
|
+
];
|
|
13452
|
+
NOUNS2 = [
|
|
13453
|
+
"cloud",
|
|
13454
|
+
"creek",
|
|
13455
|
+
"dawn",
|
|
13456
|
+
"dusk",
|
|
13457
|
+
"field",
|
|
13458
|
+
"flame",
|
|
13459
|
+
"frost",
|
|
13460
|
+
"grove",
|
|
13461
|
+
"hill",
|
|
13462
|
+
"lake",
|
|
13463
|
+
"leaf",
|
|
13464
|
+
"moon",
|
|
13465
|
+
"peak",
|
|
13466
|
+
"rain",
|
|
13467
|
+
"river",
|
|
13468
|
+
"rock",
|
|
13469
|
+
"snow",
|
|
13470
|
+
"star",
|
|
13471
|
+
"storm",
|
|
13472
|
+
"tide",
|
|
13473
|
+
"tree",
|
|
13474
|
+
"wave",
|
|
13475
|
+
"wind"
|
|
13476
|
+
];
|
|
14045
13477
|
}
|
|
14046
13478
|
});
|
|
14047
13479
|
|
|
@@ -15825,7 +15257,7 @@ var init_format_api_error2 = __esm({
|
|
|
15825
15257
|
|
|
15826
15258
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/collect-json-files.js
|
|
15827
15259
|
import { readdir, stat as stat2 } from "node:fs/promises";
|
|
15828
|
-
import { join as
|
|
15260
|
+
import { join as join11 } from "node:path";
|
|
15829
15261
|
async function collectJsonFiles(dir) {
|
|
15830
15262
|
const results = [];
|
|
15831
15263
|
await walk(dir, results);
|
|
@@ -15841,7 +15273,7 @@ async function walk(current, results) {
|
|
|
15841
15273
|
await Promise.all(entries.map(async (entry) => {
|
|
15842
15274
|
if (IGNORE_TOKEN_DIRS.has(entry))
|
|
15843
15275
|
return;
|
|
15844
|
-
const full =
|
|
15276
|
+
const full = join11(current, entry);
|
|
15845
15277
|
let s;
|
|
15846
15278
|
try {
|
|
15847
15279
|
s = await stat2(full);
|
|
@@ -15975,7 +15407,7 @@ var init_fetch_from_contentful = __esm({
|
|
|
15975
15407
|
|
|
15976
15408
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/existing-entities/fetch-and-persist.js
|
|
15977
15409
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
15978
|
-
import { join as
|
|
15410
|
+
import { join as join12 } from "node:path";
|
|
15979
15411
|
async function fetchAndPersistExistingContentfulEntities(request) {
|
|
15980
15412
|
const t0 = Date.now();
|
|
15981
15413
|
try {
|
|
@@ -15987,7 +15419,7 @@ async function fetchAndPersistExistingContentfulEntities(request) {
|
|
|
15987
15419
|
spaceId: request.spaceId,
|
|
15988
15420
|
environmentId: request.environmentId
|
|
15989
15421
|
});
|
|
15990
|
-
const path5 =
|
|
15422
|
+
const path5 = join12(request.outDir, ".existing-entities.json");
|
|
15991
15423
|
await writeFile4(path5, JSON.stringify(entities, null, 2), "utf8");
|
|
15992
15424
|
return { ok: true, path: path5, durationMs: Date.now() - t0, entities };
|
|
15993
15425
|
} catch (error) {
|
|
@@ -16525,8 +15957,367 @@ var init_load_token_leaves = __esm({
|
|
|
16525
15957
|
}
|
|
16526
15958
|
});
|
|
16527
15959
|
|
|
15960
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/cli-info.js
|
|
15961
|
+
function setCliVersion(version) {
|
|
15962
|
+
cliVersionString = version;
|
|
15963
|
+
}
|
|
15964
|
+
function cliVersion() {
|
|
15965
|
+
return cliVersionString;
|
|
15966
|
+
}
|
|
15967
|
+
var cliVersionString;
|
|
15968
|
+
var init_cli_info = __esm({
|
|
15969
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/client/cli-info.js"() {
|
|
15970
|
+
"use strict";
|
|
15971
|
+
cliVersionString = "0.0.0-unknown";
|
|
15972
|
+
}
|
|
15973
|
+
});
|
|
15974
|
+
|
|
15975
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/opt-out.js
|
|
15976
|
+
function setPersistedAnalyticsDisabled(disabled) {
|
|
15977
|
+
persistedDisabled = disabled;
|
|
15978
|
+
}
|
|
15979
|
+
function analyticsEnabled() {
|
|
15980
|
+
return !persistedDisabled && !process.env["DISABLE_ANALYTICS"];
|
|
15981
|
+
}
|
|
15982
|
+
var persistedDisabled;
|
|
15983
|
+
var init_opt_out = __esm({
|
|
15984
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/client/opt-out.js"() {
|
|
15985
|
+
"use strict";
|
|
15986
|
+
persistedDisabled = false;
|
|
15987
|
+
}
|
|
15988
|
+
});
|
|
15989
|
+
|
|
15990
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/segment-client.js
|
|
15991
|
+
import { Analytics } from "@segment/analytics-node";
|
|
15992
|
+
function resolveWriteKey() {
|
|
15993
|
+
const key = (process.env["SEGMENT_WRITE_KEY"] ?? "").trim();
|
|
15994
|
+
return key.length > 0 ? key : DEFAULT_WRITE_KEY;
|
|
15995
|
+
}
|
|
15996
|
+
function getClient() {
|
|
15997
|
+
if (!analyticsEnabled())
|
|
15998
|
+
return null;
|
|
15999
|
+
const writeKey = resolveWriteKey();
|
|
16000
|
+
if (!writeKey)
|
|
16001
|
+
return null;
|
|
16002
|
+
if (!analyticsClient) {
|
|
16003
|
+
analyticsClient = new Analytics({ writeKey });
|
|
16004
|
+
analyticsClient.on("error", () => {
|
|
16005
|
+
});
|
|
16006
|
+
}
|
|
16007
|
+
return analyticsClient;
|
|
16008
|
+
}
|
|
16009
|
+
async function trackEvent(event, properties, anonymousId, options) {
|
|
16010
|
+
const client2 = getClient();
|
|
16011
|
+
if (!client2)
|
|
16012
|
+
return;
|
|
16013
|
+
try {
|
|
16014
|
+
client2.track({
|
|
16015
|
+
event,
|
|
16016
|
+
properties,
|
|
16017
|
+
anonymousId,
|
|
16018
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
16019
|
+
});
|
|
16020
|
+
if (options?.flush)
|
|
16021
|
+
await flushAnalytics();
|
|
16022
|
+
} catch {
|
|
16023
|
+
}
|
|
16024
|
+
}
|
|
16025
|
+
async function flushAnalytics() {
|
|
16026
|
+
if (!analyticsClient)
|
|
16027
|
+
return;
|
|
16028
|
+
try {
|
|
16029
|
+
await analyticsClient.closeAndFlush();
|
|
16030
|
+
} catch {
|
|
16031
|
+
} finally {
|
|
16032
|
+
analyticsClient = null;
|
|
16033
|
+
}
|
|
16034
|
+
}
|
|
16035
|
+
var DEFAULT_WRITE_KEY, analyticsClient;
|
|
16036
|
+
var init_segment_client = __esm({
|
|
16037
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/client/segment-client.js"() {
|
|
16038
|
+
"use strict";
|
|
16039
|
+
init_opt_out();
|
|
16040
|
+
DEFAULT_WRITE_KEY = "6DmxiEPN3SV1vbRTTMcNqDzCvkfwT06N";
|
|
16041
|
+
analyticsClient = null;
|
|
16042
|
+
}
|
|
16043
|
+
});
|
|
16044
|
+
|
|
16045
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/client/index.js
|
|
16046
|
+
var init_client2 = __esm({
|
|
16047
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/client/index.js"() {
|
|
16048
|
+
"use strict";
|
|
16049
|
+
init_cli_info();
|
|
16050
|
+
init_opt_out();
|
|
16051
|
+
init_segment_client();
|
|
16052
|
+
init_cli_info();
|
|
16053
|
+
init_opt_out();
|
|
16054
|
+
init_segment_client();
|
|
16055
|
+
}
|
|
16056
|
+
});
|
|
16057
|
+
|
|
16058
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/constants.js
|
|
16059
|
+
var ANALYTICS_SESSION_ENV, IMPORT_PIPELINE_ENV;
|
|
16060
|
+
var init_constants6 = __esm({
|
|
16061
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/constants.js"() {
|
|
16062
|
+
"use strict";
|
|
16063
|
+
ANALYTICS_SESSION_ENV = "EDS_ANALYTICS_SESSION_ID";
|
|
16064
|
+
IMPORT_PIPELINE_ENV = "EDS_IMPORT_PIPELINE";
|
|
16065
|
+
}
|
|
16066
|
+
});
|
|
16067
|
+
|
|
16068
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/session.js
|
|
16069
|
+
function resolveAnalyticsSessionId(explicit) {
|
|
16070
|
+
const inherited = process.env[ANALYTICS_SESSION_ENV]?.trim();
|
|
16071
|
+
if (inherited)
|
|
16072
|
+
return inherited;
|
|
16073
|
+
const passed = explicit?.trim();
|
|
16074
|
+
if (passed)
|
|
16075
|
+
return passed;
|
|
16076
|
+
return generateSessionId2();
|
|
16077
|
+
}
|
|
16078
|
+
function isPipelineAnalyticsChild() {
|
|
16079
|
+
return Boolean(process.env[ANALYTICS_SESSION_ENV]?.trim());
|
|
16080
|
+
}
|
|
16081
|
+
var init_session2 = __esm({
|
|
16082
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/session.js"() {
|
|
16083
|
+
"use strict";
|
|
16084
|
+
init_src();
|
|
16085
|
+
init_constants6();
|
|
16086
|
+
}
|
|
16087
|
+
});
|
|
16088
|
+
|
|
16089
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/normalize.js
|
|
16090
|
+
function normalizeCommand(commandChain) {
|
|
16091
|
+
return COMMAND_MAP[commandChain];
|
|
16092
|
+
}
|
|
16093
|
+
var COMMAND_MAP;
|
|
16094
|
+
var init_normalize = __esm({
|
|
16095
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/normalize.js"() {
|
|
16096
|
+
"use strict";
|
|
16097
|
+
COMMAND_MAP = {
|
|
16098
|
+
"analyze extract": "analyze_extract",
|
|
16099
|
+
"analyze select": "analyze_select",
|
|
16100
|
+
"generate components": "generate_components",
|
|
16101
|
+
"generate tokens": "generate_tokens",
|
|
16102
|
+
"map tokens": "map_tokens",
|
|
16103
|
+
apply: "apply_push",
|
|
16104
|
+
"print components": "print_components",
|
|
16105
|
+
"print tokens": "print_tokens",
|
|
16106
|
+
import: "import"
|
|
16107
|
+
};
|
|
16108
|
+
}
|
|
16109
|
+
});
|
|
16110
|
+
|
|
16111
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/pending-command.js
|
|
16112
|
+
function isPipelineStep() {
|
|
16113
|
+
return process.env[IMPORT_PIPELINE_ENV] === "1";
|
|
16114
|
+
}
|
|
16115
|
+
function buildBaseProps(command) {
|
|
16116
|
+
return {
|
|
16117
|
+
dsi_session_id: state.sessionId,
|
|
16118
|
+
command,
|
|
16119
|
+
...isPipelineStep() ? { is_pipeline_step: true } : {}
|
|
16120
|
+
};
|
|
16121
|
+
}
|
|
16122
|
+
function mergeContext(target, source) {
|
|
16123
|
+
if (source.space_key !== void 0)
|
|
16124
|
+
target.space_key = source.space_key;
|
|
16125
|
+
if (source.environment_key !== void 0)
|
|
16126
|
+
target.environment_key = source.environment_key;
|
|
16127
|
+
if (source.x_contentful_request_id !== void 0) {
|
|
16128
|
+
target.x_contentful_request_id = source.x_contentful_request_id;
|
|
16129
|
+
}
|
|
16130
|
+
}
|
|
16131
|
+
function noteCommandStart(commandChain) {
|
|
16132
|
+
const command = normalizeCommand(commandChain);
|
|
16133
|
+
if (!command)
|
|
16134
|
+
return;
|
|
16135
|
+
state.pending = {
|
|
16136
|
+
command,
|
|
16137
|
+
startedAt: Date.now(),
|
|
16138
|
+
invoked: false,
|
|
16139
|
+
terminalEmitted: false,
|
|
16140
|
+
context: {},
|
|
16141
|
+
completion: {}
|
|
16142
|
+
};
|
|
16143
|
+
}
|
|
16144
|
+
function setCommandContext(context) {
|
|
16145
|
+
if (!state.pending)
|
|
16146
|
+
return;
|
|
16147
|
+
mergeContext(state.pending.context, context);
|
|
16148
|
+
mergeContext(state.pending.completion, context);
|
|
16149
|
+
}
|
|
16150
|
+
function enrichCommandResult(fields) {
|
|
16151
|
+
if (!state.pending)
|
|
16152
|
+
return;
|
|
16153
|
+
Object.assign(state.pending.completion, fields);
|
|
16154
|
+
mergeContext(state.pending.context, fields);
|
|
16155
|
+
}
|
|
16156
|
+
var state;
|
|
16157
|
+
var init_pending_command = __esm({
|
|
16158
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/pending-command.js"() {
|
|
16159
|
+
"use strict";
|
|
16160
|
+
init_constants6();
|
|
16161
|
+
init_normalize();
|
|
16162
|
+
state = {
|
|
16163
|
+
pending: null,
|
|
16164
|
+
sessionId: void 0,
|
|
16165
|
+
sessionStartedEmitted: false
|
|
16166
|
+
};
|
|
16167
|
+
}
|
|
16168
|
+
});
|
|
16169
|
+
|
|
16170
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/os.js
|
|
16171
|
+
function getOsName() {
|
|
16172
|
+
return OS_NAMES2[process.platform] ?? "other";
|
|
16173
|
+
}
|
|
16174
|
+
var OS_NAMES2;
|
|
16175
|
+
var init_os = __esm({
|
|
16176
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/os.js"() {
|
|
16177
|
+
"use strict";
|
|
16178
|
+
OS_NAMES2 = {
|
|
16179
|
+
android: "Android",
|
|
16180
|
+
aix: "Linux",
|
|
16181
|
+
darwin: "macOS",
|
|
16182
|
+
freebsd: "Linux",
|
|
16183
|
+
linux: "Linux",
|
|
16184
|
+
openbsd: "Linux",
|
|
16185
|
+
sunos: "Linux",
|
|
16186
|
+
win32: "Windows"
|
|
16187
|
+
};
|
|
16188
|
+
}
|
|
16189
|
+
});
|
|
16190
|
+
|
|
16191
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/emit-events.js
|
|
16192
|
+
async function bindAnalyticsSessionId(explicit, context) {
|
|
16193
|
+
const id = resolveAnalyticsSessionId(explicit);
|
|
16194
|
+
await bindAnalyticsSession(id, context);
|
|
16195
|
+
return id;
|
|
16196
|
+
}
|
|
16197
|
+
async function bindAnalyticsSession(id, context) {
|
|
16198
|
+
state.sessionId = id;
|
|
16199
|
+
if (context)
|
|
16200
|
+
setCommandContext(context);
|
|
16201
|
+
await emitInvokedIfReady();
|
|
16202
|
+
}
|
|
16203
|
+
async function emitSessionStarted(entryCommand) {
|
|
16204
|
+
if (!state.sessionId || state.sessionStartedEmitted)
|
|
16205
|
+
return;
|
|
16206
|
+
state.sessionStartedEmitted = true;
|
|
16207
|
+
await trackEvent("dsi_cli_session_started", {
|
|
16208
|
+
dsi_session_id: state.sessionId,
|
|
16209
|
+
entry_command: entryCommand,
|
|
16210
|
+
cli_version: cliVersion(),
|
|
16211
|
+
node_version: process.version,
|
|
16212
|
+
os_name: getOsName()
|
|
16213
|
+
}, state.sessionId, { flush: true });
|
|
16214
|
+
await emitInvokedIfReady();
|
|
16215
|
+
}
|
|
16216
|
+
async function emitInvokedIfReady() {
|
|
16217
|
+
if (!state.pending || state.pending.invoked || !state.sessionId)
|
|
16218
|
+
return;
|
|
16219
|
+
state.pending.invoked = true;
|
|
16220
|
+
await trackEvent("dsi_cli_command_invoked", {
|
|
16221
|
+
...buildBaseProps(state.pending.command),
|
|
16222
|
+
...state.pending.context
|
|
16223
|
+
}, state.sessionId, { flush: true });
|
|
16224
|
+
}
|
|
16225
|
+
async function completeActiveCommand() {
|
|
16226
|
+
if (!state.pending || state.pending.terminalEmitted || !state.sessionId || !state.pending.invoked)
|
|
16227
|
+
return;
|
|
16228
|
+
state.pending.terminalEmitted = true;
|
|
16229
|
+
const durationMs = Date.now() - state.pending.startedAt;
|
|
16230
|
+
await trackEvent("dsi_cli_command_completed", {
|
|
16231
|
+
...buildBaseProps(state.pending.command),
|
|
16232
|
+
...state.pending.context,
|
|
16233
|
+
...state.pending.completion,
|
|
16234
|
+
outcome: "ok",
|
|
16235
|
+
duration_ms: durationMs
|
|
16236
|
+
}, state.sessionId, { flush: true });
|
|
16237
|
+
}
|
|
16238
|
+
async function failActiveCommand(fields = {}) {
|
|
16239
|
+
if (!state.pending || state.pending.terminalEmitted || !state.sessionId || !state.pending.invoked)
|
|
16240
|
+
return;
|
|
16241
|
+
state.pending.terminalEmitted = true;
|
|
16242
|
+
const durationMs = Date.now() - state.pending.startedAt;
|
|
16243
|
+
const outcome = fields.exit_code === 130 ? "interrupted" : "error";
|
|
16244
|
+
await trackEvent("dsi_cli_command_failed", {
|
|
16245
|
+
...buildBaseProps(state.pending.command),
|
|
16246
|
+
...state.pending.context,
|
|
16247
|
+
...fields,
|
|
16248
|
+
outcome,
|
|
16249
|
+
duration_ms: durationMs
|
|
16250
|
+
}, state.sessionId, { flush: true });
|
|
16251
|
+
}
|
|
16252
|
+
var init_emit_events = __esm({
|
|
16253
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/emit-events.js"() {
|
|
16254
|
+
"use strict";
|
|
16255
|
+
init_cli_info();
|
|
16256
|
+
init_segment_client();
|
|
16257
|
+
init_os();
|
|
16258
|
+
init_session2();
|
|
16259
|
+
init_pending_command();
|
|
16260
|
+
}
|
|
16261
|
+
});
|
|
16262
|
+
|
|
16263
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/index.js
|
|
16264
|
+
var init_tracker = __esm({
|
|
16265
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/tracker/index.js"() {
|
|
16266
|
+
"use strict";
|
|
16267
|
+
init_pending_command();
|
|
16268
|
+
init_emit_events();
|
|
16269
|
+
}
|
|
16270
|
+
});
|
|
16271
|
+
|
|
16272
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js
|
|
16273
|
+
function countWriteResult(items, entityType) {
|
|
16274
|
+
const subset = items.filter((item) => item.entityType === entityType);
|
|
16275
|
+
return {
|
|
16276
|
+
created_count: subset.filter((item) => item.action === "create" && item.status === "succeeded").length,
|
|
16277
|
+
updated_count: subset.filter((item) => item.action === "update" && item.status === "succeeded").length,
|
|
16278
|
+
failed_count: subset.filter((item) => item.status === "failed").length
|
|
16279
|
+
};
|
|
16280
|
+
}
|
|
16281
|
+
function recordApplyOutcome(client2, spaceId, environmentId, operation) {
|
|
16282
|
+
setCommandContext({
|
|
16283
|
+
space_key: spaceId,
|
|
16284
|
+
environment_key: environmentId,
|
|
16285
|
+
x_contentful_request_id: client2.getLastRequestId()
|
|
16286
|
+
});
|
|
16287
|
+
enrichCommandResult({
|
|
16288
|
+
dsi_operation_id: operation.sys.id,
|
|
16289
|
+
component_type_result: countWriteResult(operation.items ?? [], "ComponentType"),
|
|
16290
|
+
design_token_result: countWriteResult(operation.items ?? [], "DesignToken")
|
|
16291
|
+
});
|
|
16292
|
+
}
|
|
16293
|
+
function recordContentfulContext(client2, spaceId, environmentId) {
|
|
16294
|
+
setCommandContext({
|
|
16295
|
+
space_key: spaceId,
|
|
16296
|
+
environment_key: environmentId,
|
|
16297
|
+
x_contentful_request_id: client2.getLastRequestId()
|
|
16298
|
+
});
|
|
16299
|
+
}
|
|
16300
|
+
var init_apply2 = __esm({
|
|
16301
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/apply.js"() {
|
|
16302
|
+
"use strict";
|
|
16303
|
+
init_tracker();
|
|
16304
|
+
}
|
|
16305
|
+
});
|
|
16306
|
+
|
|
16307
|
+
// packages/experience-design-system-backend-pipeline/dist/src/analytics/index.js
|
|
16308
|
+
var init_analytics = __esm({
|
|
16309
|
+
"packages/experience-design-system-backend-pipeline/dist/src/analytics/index.js"() {
|
|
16310
|
+
"use strict";
|
|
16311
|
+
init_client2();
|
|
16312
|
+
init_session2();
|
|
16313
|
+
init_tracker();
|
|
16314
|
+
init_apply2();
|
|
16315
|
+
init_constants6();
|
|
16316
|
+
}
|
|
16317
|
+
});
|
|
16318
|
+
|
|
16528
16319
|
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
16529
|
-
import { resolve as
|
|
16320
|
+
import { resolve as resolve17 } from "node:path";
|
|
16530
16321
|
async function runMapTokens(request) {
|
|
16531
16322
|
const timeoutMs = request.agentTimeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
16532
16323
|
const db = openPipelineDb();
|
|
@@ -16535,6 +16326,7 @@ async function runMapTokens(request) {
|
|
|
16535
16326
|
if (!sessionId) {
|
|
16536
16327
|
throw new MapTokensRunFailure({ type: "no-session" });
|
|
16537
16328
|
}
|
|
16329
|
+
await bindAnalyticsSessionId(sessionId);
|
|
16538
16330
|
const tokenLeaves = loadTokenLeaves(db, sessionId);
|
|
16539
16331
|
const knownTokenPaths = new Set(tokenLeaves.map((t) => t.path));
|
|
16540
16332
|
if (request.tokenMapInline) {
|
|
@@ -16576,7 +16368,7 @@ async function runMapTokens(request) {
|
|
|
16576
16368
|
outDir: process.cwd(),
|
|
16577
16369
|
existingTokensInline: request.existingEntitiesInline,
|
|
16578
16370
|
...request.skillContentOverride !== void 0 ? { skillContentOverride: request.skillContentOverride } : {},
|
|
16579
|
-
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride:
|
|
16371
|
+
...request.skillContentOverride === void 0 && request.skillPathOverride ? { skillPathOverride: resolve17(request.skillPathOverride) } : {}
|
|
16580
16372
|
});
|
|
16581
16373
|
if (request.printPrompt) {
|
|
16582
16374
|
const prompt2 = await buildMapPrompt();
|
|
@@ -16652,6 +16444,7 @@ var init_run_map_tokens = __esm({
|
|
|
16652
16444
|
init_load_token_leaves();
|
|
16653
16445
|
init_rebuild_dtcg_tree();
|
|
16654
16446
|
init_resolve_token_defaults();
|
|
16447
|
+
init_analytics();
|
|
16655
16448
|
DEFAULT_TIMEOUT_MS2 = 5 * 60 * 1e3;
|
|
16656
16449
|
MapTokensRunFailure = class _MapTokensRunFailure extends Error {
|
|
16657
16450
|
reason;
|
|
@@ -18944,6 +18737,9 @@ async function runExtractAndComposeSession(request) {
|
|
|
18944
18737
|
outDir
|
|
18945
18738
|
});
|
|
18946
18739
|
await onSessionCreated?.(sessionId);
|
|
18740
|
+
await bindAnalyticsSessionId(sessionId);
|
|
18741
|
+
if (!isPipelineAnalyticsChild())
|
|
18742
|
+
await emitSessionStarted("import");
|
|
18947
18743
|
const stepId = createStep(db, sessionId, "analyze extract", { project: projectPath });
|
|
18948
18744
|
if (cacheHits === 0 && !noCache) {
|
|
18949
18745
|
await persistExtractCache(db, sourceFiles, extraction.components, cacheVersion);
|
|
@@ -18971,6 +18767,7 @@ async function runExtractAndComposeSession(request) {
|
|
|
18971
18767
|
await persistSlotCycles(db, sessionId, composition.components);
|
|
18972
18768
|
storeScannedFiles(db, sessionId, sourceFiles.map((f) => relative2(projectPath, f)));
|
|
18973
18769
|
await retryDatabaseWrite(() => updateStep(db, stepId, "complete", { sessionId }));
|
|
18770
|
+
enrichCommandResult({ extracted_component_count: composition.components.length });
|
|
18974
18771
|
return {
|
|
18975
18772
|
sessionId,
|
|
18976
18773
|
compositionPhase: composition.phase,
|
|
@@ -18997,12 +18794,13 @@ var init_run_extract_and_compose_session = __esm({
|
|
|
18997
18794
|
init_resolve_composition();
|
|
18998
18795
|
init_resolve_composition_prompt();
|
|
18999
18796
|
init_retry_database_write();
|
|
18797
|
+
init_analytics();
|
|
19000
18798
|
}
|
|
19001
18799
|
});
|
|
19002
18800
|
|
|
19003
18801
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-tokens-session/helpers/write-tokens-file.js
|
|
19004
18802
|
import { mkdir as mkdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
19005
|
-
import { join as
|
|
18803
|
+
import { join as join13 } from "node:path";
|
|
19006
18804
|
async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
19007
18805
|
onProgress?.({ kind: "writing-file" });
|
|
19008
18806
|
const result = getDtcgTokensForSession(db, sessionId);
|
|
@@ -19010,7 +18808,7 @@ async function writeTokensFile(db, sessionId, outDir, onProgress) {
|
|
|
19010
18808
|
throw new Error(`generate tokens: no tokens persisted for session ${sessionId}`);
|
|
19011
18809
|
}
|
|
19012
18810
|
const tree = rebuildDTCGTree(result.groups, result.tokens);
|
|
19013
|
-
const tokensPath =
|
|
18811
|
+
const tokensPath = join13(outDir, "tokens.json");
|
|
19014
18812
|
await mkdir5(outDir, { recursive: true });
|
|
19015
18813
|
await writeFile5(tokensPath, `${JSON.stringify(tree, null, 2)}
|
|
19016
18814
|
`);
|
|
@@ -19044,6 +18842,7 @@ async function runGenerateTokensSession(request) {
|
|
|
19044
18842
|
outDir
|
|
19045
18843
|
});
|
|
19046
18844
|
await onSessionCreated?.(tokenSessionId);
|
|
18845
|
+
await bindAnalyticsSessionId(tokenSessionId);
|
|
19047
18846
|
const tokenPromptHash = await hashPromptForSkill("tokens", agent, agentModel, skillPath);
|
|
19048
18847
|
const warnings = [];
|
|
19049
18848
|
onProgress?.({ kind: "resolving" });
|
|
@@ -19114,6 +18913,7 @@ var init_run_generate_tokens_session = __esm({
|
|
|
19114
18913
|
init_parse_prompt_overrides();
|
|
19115
18914
|
init_resolve_prompt_override();
|
|
19116
18915
|
init_write_tokens_file();
|
|
18916
|
+
init_analytics();
|
|
19117
18917
|
DEFAULT_TIMEOUT_MS3 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
19118
18918
|
TOKENS_TIMEOUT_MS = DEFAULT_TIMEOUT_MS3 * 5;
|
|
19119
18919
|
}
|
|
@@ -19183,7 +18983,7 @@ var init_read_existing_entities = __esm({
|
|
|
19183
18983
|
});
|
|
19184
18984
|
|
|
19185
18985
|
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js
|
|
19186
|
-
import { resolve as
|
|
18986
|
+
import { resolve as resolve18 } from "node:path";
|
|
19187
18987
|
async function resolveGeneratePrompt(overrides) {
|
|
19188
18988
|
const { overrides: parsed, errors } = parsePromptOverrides(overrides);
|
|
19189
18989
|
if (errors.length > 0)
|
|
@@ -19194,7 +18994,7 @@ async function resolveGeneratePrompt(overrides) {
|
|
|
19194
18994
|
const text = await resolvePromptOverride(entry);
|
|
19195
18995
|
if (entry.kind === "text")
|
|
19196
18996
|
return { text };
|
|
19197
|
-
return { path:
|
|
18997
|
+
return { path: resolve18(entry.value), text };
|
|
19198
18998
|
}
|
|
19199
18999
|
var init_resolve_generate_prompt = __esm({
|
|
19200
19000
|
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/resolve-generate-prompt.js"() {
|
|
@@ -19432,262 +19232,954 @@ async function restoreCachedComponents(db, sessionId, cachedComponents, promptHa
|
|
|
19432
19232
|
var init_restore_cached_components = __esm({
|
|
19433
19233
|
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js"() {
|
|
19434
19234
|
"use strict";
|
|
19435
|
-
init_db();
|
|
19436
|
-
init_normalize_component_for_cache();
|
|
19235
|
+
init_db();
|
|
19236
|
+
init_normalize_component_for_cache();
|
|
19237
|
+
}
|
|
19238
|
+
});
|
|
19239
|
+
|
|
19240
|
+
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js
|
|
19241
|
+
async function checkGenerateComponentsCache(request) {
|
|
19242
|
+
if (request.noCache) {
|
|
19243
|
+
return { sessionId: request.sessionId, cachedComponentNames: [], fullyCached: false, cacheDisabled: true };
|
|
19244
|
+
}
|
|
19245
|
+
const existingEntities = await readExistingEntities(request);
|
|
19246
|
+
const existingTokensInline = existingEntities ? JSON.stringify(summarizeForMapTokens({ entities: existingEntities })) : void 0;
|
|
19247
|
+
const prompt = await resolveGeneratePrompt(request.promptOverrides);
|
|
19248
|
+
const agent = request.agent;
|
|
19249
|
+
const promptHash = await hashPromptForSkill("components", agent, request.agentModel, prompt.path, existingTokensInline ? [hashContent(existingTokensInline)] : [], prompt.text);
|
|
19250
|
+
const db = openPipelineDb();
|
|
19251
|
+
try {
|
|
19252
|
+
const acceptedNames = await loadAcceptedNames(request.sessionId);
|
|
19253
|
+
const components = loadRawComponents(db, request.sessionId, acceptedNames ?? void 0);
|
|
19254
|
+
if (components.length === 0) {
|
|
19255
|
+
return { sessionId: request.sessionId, cachedComponentNames: [], fullyCached: false, cacheDisabled: false };
|
|
19256
|
+
}
|
|
19257
|
+
const allowedComponentNames2 = /* @__PURE__ */ new Set([
|
|
19258
|
+
...components.map((component) => component.name),
|
|
19259
|
+
...(existingEntities?.components ?? []).map((component) => component.name)
|
|
19260
|
+
]);
|
|
19261
|
+
const cachedComponents = [];
|
|
19262
|
+
for (const component of components) {
|
|
19263
|
+
const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
|
|
19264
|
+
if (resolution)
|
|
19265
|
+
cachedComponents.push({ component, resolution });
|
|
19266
|
+
await new Promise((r) => setImmediate(r));
|
|
19267
|
+
}
|
|
19268
|
+
if (request.restoreCache) {
|
|
19269
|
+
await restoreCachedComponents(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
|
|
19270
|
+
}
|
|
19271
|
+
return {
|
|
19272
|
+
sessionId: request.sessionId,
|
|
19273
|
+
cachedComponentNames: cachedComponents.map(({ component }) => component.name),
|
|
19274
|
+
fullyCached: cachedComponents.length === components.length,
|
|
19275
|
+
cacheDisabled: false
|
|
19276
|
+
};
|
|
19277
|
+
} finally {
|
|
19278
|
+
db.close();
|
|
19279
|
+
}
|
|
19280
|
+
}
|
|
19281
|
+
var init_check_generate_components_cache = __esm({
|
|
19282
|
+
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js"() {
|
|
19283
|
+
"use strict";
|
|
19284
|
+
init_summarize_for_map_tokens();
|
|
19285
|
+
init_resolve_component_cache();
|
|
19286
|
+
init_db();
|
|
19287
|
+
init_cache_keys();
|
|
19288
|
+
init_src();
|
|
19289
|
+
init_read_existing_entities();
|
|
19290
|
+
init_resolve_generate_prompt();
|
|
19291
|
+
init_restore_cached_components();
|
|
19292
|
+
}
|
|
19293
|
+
});
|
|
19294
|
+
|
|
19295
|
+
// packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/run-generate-components-session.js
|
|
19296
|
+
async function runGenerateComponentsSession(request) {
|
|
19297
|
+
const prompt = await resolveGeneratePrompt(request.promptOverrides);
|
|
19298
|
+
const effectiveSkillPath = prompt.path ?? request.skillPath;
|
|
19299
|
+
const existingEntities = await readExistingEntities(request);
|
|
19300
|
+
const existingTokensInline = existingEntities ? JSON.stringify(summarizeForMapTokens({ entities: existingEntities })) : void 0;
|
|
19301
|
+
const existingTokensHash = existingTokensInline ? [hashContent(existingTokensInline)] : [];
|
|
19302
|
+
const agent = request.agent;
|
|
19303
|
+
const promptHash = await hashPromptForSkill("components", agent, request.agentModel, effectiveSkillPath, existingTokensHash, prompt.text);
|
|
19304
|
+
await bindAnalyticsSessionId(request.sessionId);
|
|
19305
|
+
const db = openPipelineDb();
|
|
19306
|
+
try {
|
|
19307
|
+
const acceptedNames = await loadAcceptedNames(request.sessionId);
|
|
19308
|
+
const acceptedSet = acceptedNames ? new Set(acceptedNames) : void 0;
|
|
19309
|
+
let components = loadRawComponents(db, request.sessionId, acceptedSet ?? void 0);
|
|
19310
|
+
if (components.length === 0)
|
|
19311
|
+
return buildEmptySessionResponse(request.sessionId);
|
|
19312
|
+
const allowedComponentNames2 = /* @__PURE__ */ new Set([
|
|
19313
|
+
...components.map((c2) => c2.name),
|
|
19314
|
+
...(existingEntities?.components ?? []).map((c2) => c2.name)
|
|
19315
|
+
]);
|
|
19316
|
+
const { components: filtered, dropped } = filterDroppedAllowedComponents(db, request.sessionId, components, allowedComponentNames2, acceptedSet);
|
|
19317
|
+
components = filtered;
|
|
19318
|
+
const duplicateNames = collectDuplicateNames(components);
|
|
19319
|
+
const invoker = createLocalCliAgentInvoker({});
|
|
19320
|
+
const concurrency = Math.max(1, Math.min(DEFAULT_COMPONENT_CONCURRENCY, components.length));
|
|
19321
|
+
const results = await runWithPool(components, concurrency, (component, index) => runOneGenerateComponent({
|
|
19322
|
+
db,
|
|
19323
|
+
sessionId: request.sessionId,
|
|
19324
|
+
invoker,
|
|
19325
|
+
agent,
|
|
19326
|
+
model: request.agentModel,
|
|
19327
|
+
tokensInline: request.tokensInline,
|
|
19328
|
+
tokenMapInline: request.tokenMapInline,
|
|
19329
|
+
verbose: request.verbose ?? false,
|
|
19330
|
+
noCache: request.noCache,
|
|
19331
|
+
skillPathOverride: effectiveSkillPath,
|
|
19332
|
+
skillContentOverride: prompt.text,
|
|
19333
|
+
promptHash,
|
|
19334
|
+
existingContentfulEntities: existingEntities,
|
|
19335
|
+
existingTokensInline,
|
|
19336
|
+
precomputedCachedNames: request.precomputedCachedNames ?? /* @__PURE__ */ new Set(),
|
|
19337
|
+
allowedComponentNames: allowedComponentNames2,
|
|
19338
|
+
onProgress: request.onProgress
|
|
19339
|
+
}, component, index, components.length));
|
|
19340
|
+
const allOk = results.every((r) => !r.failed);
|
|
19341
|
+
const renamedSlotsCount = results.reduce((sum, r) => sum + r.renamedSlotsCount, 0);
|
|
19342
|
+
return {
|
|
19343
|
+
sessionId: request.sessionId,
|
|
19344
|
+
results,
|
|
19345
|
+
allOk,
|
|
19346
|
+
renamedSlotsCount,
|
|
19347
|
+
duplicateNames,
|
|
19348
|
+
droppedAllowedComponents: dropped,
|
|
19349
|
+
emptySession: false
|
|
19350
|
+
};
|
|
19351
|
+
} finally {
|
|
19352
|
+
db.close();
|
|
19353
|
+
}
|
|
19354
|
+
}
|
|
19355
|
+
var DEFAULT_COMPONENT_CONCURRENCY;
|
|
19356
|
+
var init_run_generate_components_session = __esm({
|
|
19357
|
+
"packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/run-generate-components-session.js"() {
|
|
19358
|
+
"use strict";
|
|
19359
|
+
init_create_local_cli_agent_invoker();
|
|
19360
|
+
init_db();
|
|
19361
|
+
init_cache_keys();
|
|
19362
|
+
init_src();
|
|
19363
|
+
init_summarize_for_map_tokens();
|
|
19364
|
+
init_build_empty_session_response();
|
|
19365
|
+
init_collect_duplicate_names();
|
|
19366
|
+
init_filter_dropped_allowed_components();
|
|
19367
|
+
init_read_existing_entities();
|
|
19368
|
+
init_resolve_generate_prompt();
|
|
19369
|
+
init_run_one_generate_component();
|
|
19370
|
+
init_run_with_pool();
|
|
19371
|
+
init_analytics();
|
|
19372
|
+
init_check_generate_components_cache();
|
|
19373
|
+
DEFAULT_COMPONENT_CONCURRENCY = Number(process.env["EDS_GENERATE_CONCURRENCY"] ?? 10);
|
|
19374
|
+
}
|
|
19375
|
+
});
|
|
19376
|
+
|
|
19377
|
+
// packages/experience-design-system-backend-pipeline/dist/src/index.js
|
|
19378
|
+
var init_src4 = __esm({
|
|
19379
|
+
"packages/experience-design-system-backend-pipeline/dist/src/index.js"() {
|
|
19380
|
+
"use strict";
|
|
19381
|
+
init_export_cdf_document();
|
|
19382
|
+
init_export_dtcg_tree();
|
|
19383
|
+
init_validate_cdf_file();
|
|
19384
|
+
init_validate_dtcg_token_file();
|
|
19385
|
+
init_format_diagnostics();
|
|
19386
|
+
init_read_json_file();
|
|
19387
|
+
init_rebuild_dtcg_tree();
|
|
19388
|
+
init_extract_components_endpoint();
|
|
19389
|
+
init_compose_components_endpoint();
|
|
19390
|
+
init_candidate_files2();
|
|
19391
|
+
init_manifest_doc_evidence();
|
|
19392
|
+
init_merge_edges();
|
|
19393
|
+
init_parse_map_edges();
|
|
19394
|
+
init_apply_mapping();
|
|
19395
|
+
init_resolve_mapping();
|
|
19396
|
+
init_prompt_loader();
|
|
19397
|
+
init_composition_cache_key();
|
|
19398
|
+
init_resolve_composition_sources();
|
|
19399
|
+
init_build_component_graph2();
|
|
19400
|
+
init_find_slot_cycles2();
|
|
19401
|
+
init_group_nodes_by_cycle_membership2();
|
|
19402
|
+
init_expand_seeds_to_include_cycle_groups2();
|
|
19403
|
+
init_select_descendants_respecting_cycles2();
|
|
19404
|
+
init_reject_ancestors_respecting_cycles2();
|
|
19405
|
+
init_select_all_descendants2();
|
|
19406
|
+
init_reject_all_ancestors2();
|
|
19407
|
+
init_expand_matches_by_one_hop2();
|
|
19408
|
+
init_find_all_parents2();
|
|
19409
|
+
init_propagate_descendant_issues_to_ancestors2();
|
|
19410
|
+
init_find_worst_issued_descendant2();
|
|
19411
|
+
init_suggest_cycle_break_edge();
|
|
19412
|
+
init_format_cycle_path();
|
|
19413
|
+
init_format_cycle_path_segments();
|
|
19414
|
+
init_select_components_endpoint();
|
|
19415
|
+
init_load_and_validate_for_review();
|
|
19416
|
+
init_merge_preview_validation_errors_into_review_session();
|
|
19417
|
+
init_merge_preview_validation_errors_into_review_session();
|
|
19418
|
+
init_reject_components_by_name();
|
|
19419
|
+
init_src();
|
|
19420
|
+
init_generate_cdf_components_endpoint();
|
|
19421
|
+
init_apply_components_endpoint();
|
|
19422
|
+
init_has_breaking_changes();
|
|
19423
|
+
init_token_utils();
|
|
19424
|
+
init_is_empty_preview();
|
|
19425
|
+
init_contentful_urls();
|
|
19426
|
+
init_api_error();
|
|
19427
|
+
init_api_client();
|
|
19428
|
+
init_api_client();
|
|
19429
|
+
init_parse_preview_errors();
|
|
19430
|
+
init_host_utils2();
|
|
19431
|
+
init_detect_slot_cycles2();
|
|
19432
|
+
init_assert_no_slot_cycles();
|
|
19433
|
+
init_assert_no_unresolved_slot_references();
|
|
19434
|
+
init_format_slot_cycle_report2();
|
|
19435
|
+
init_format_unresolved_slot_references2();
|
|
19436
|
+
init_mutate_cdf_component();
|
|
19437
|
+
init_mutate_dot_path();
|
|
19438
|
+
init_warn_on_unknown_patch_components2();
|
|
19439
|
+
init_annotate_preview2();
|
|
19440
|
+
init_annotate_preview();
|
|
19441
|
+
init_parse_edsi_error2();
|
|
19442
|
+
init_format_edsi_error2();
|
|
19443
|
+
init_format_api_error2();
|
|
19444
|
+
init_strip_lambda_log_prefix();
|
|
19445
|
+
init_read_tokens_from_path2();
|
|
19446
|
+
init_agents();
|
|
19447
|
+
init_agent_name();
|
|
19448
|
+
init_models();
|
|
19449
|
+
init_is_agent_name();
|
|
19450
|
+
init_agent_supports_bedrock();
|
|
19451
|
+
init_check_agent_auth();
|
|
19452
|
+
init_build_prompt();
|
|
19453
|
+
init_resolve_skill_path();
|
|
19454
|
+
init_create_local_cli_agent_invoker();
|
|
19455
|
+
init_parse_select_tool_calls();
|
|
19456
|
+
init_parse_token_tool_calls();
|
|
19457
|
+
init_build_contentful_management_client();
|
|
19458
|
+
init_fetch_and_persist();
|
|
19459
|
+
init_read_from_session();
|
|
19460
|
+
init_fetch_from_contentful();
|
|
19461
|
+
init_summarize_for_select();
|
|
19462
|
+
init_summarize_for_generate();
|
|
19463
|
+
init_summarize_for_map_tokens();
|
|
19464
|
+
init_resolve_token_defaults2();
|
|
19465
|
+
init_find_nearly_matching_component();
|
|
19466
|
+
init_normalize_component_for_cache();
|
|
19467
|
+
init_lookup_component_cache();
|
|
19468
|
+
init_resolve_component_cache();
|
|
19469
|
+
init_resolve_shared_inputs();
|
|
19470
|
+
init_apply_map_token_prop_calls();
|
|
19471
|
+
init_run_map_tokens();
|
|
19472
|
+
init_src();
|
|
19473
|
+
init_src();
|
|
19474
|
+
init_src();
|
|
19475
|
+
init_src();
|
|
19476
|
+
init_src();
|
|
19477
|
+
init_src();
|
|
19478
|
+
init_src();
|
|
19479
|
+
init_src();
|
|
19480
|
+
init_src();
|
|
19481
|
+
init_src();
|
|
19482
|
+
init_src();
|
|
19483
|
+
init_src();
|
|
19484
|
+
init_src();
|
|
19485
|
+
init_src();
|
|
19486
|
+
init_src();
|
|
19487
|
+
init_src();
|
|
19488
|
+
init_src();
|
|
19489
|
+
init_component();
|
|
19490
|
+
init_run_extract_and_compose_session();
|
|
19491
|
+
init_run_generate_tokens_session();
|
|
19492
|
+
init_run_generate_components_session();
|
|
19493
|
+
init_analytics();
|
|
19494
|
+
}
|
|
19495
|
+
});
|
|
19496
|
+
|
|
19497
|
+
// packages/experience-design-system-cli/src/tui/package-root.ts
|
|
19498
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
19499
|
+
import { dirname as dirname12, join as join14 } from "node:path";
|
|
19500
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
19501
|
+
function findPackageRoot(startUrl, packageName) {
|
|
19502
|
+
let dir = dirname12(fileURLToPath3(startUrl));
|
|
19503
|
+
let found;
|
|
19504
|
+
while (true) {
|
|
19505
|
+
const manifestPath = join14(dir, "package.json");
|
|
19506
|
+
if (existsSync7(manifestPath)) {
|
|
19507
|
+
const pkg2 = JSON.parse(readFileSync7(manifestPath, "utf8"));
|
|
19508
|
+
if (pkg2.name === packageName) found = dir;
|
|
19509
|
+
}
|
|
19510
|
+
const parent = dirname12(dir);
|
|
19511
|
+
if (parent === dir) return found ?? dir;
|
|
19512
|
+
dir = parent;
|
|
19513
|
+
}
|
|
19514
|
+
}
|
|
19515
|
+
var init_package_root = __esm({
|
|
19516
|
+
"packages/experience-design-system-cli/src/tui/package-root.ts"() {
|
|
19517
|
+
"use strict";
|
|
19518
|
+
}
|
|
19519
|
+
});
|
|
19520
|
+
|
|
19521
|
+
// packages/experience-design-system-types/dist/src/config/index.js
|
|
19522
|
+
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
19523
|
+
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
19524
|
+
import { homedir as homedir2 } from "node:os";
|
|
19525
|
+
import { dirname as dirname13, join as join17 } from "node:path";
|
|
19526
|
+
function configRoot2() {
|
|
19527
|
+
return process.env["EDS_HOME"] || join17(homedir2(), ".contentful", "experience-design-system-cli");
|
|
19528
|
+
}
|
|
19529
|
+
async function readSettings2() {
|
|
19530
|
+
try {
|
|
19531
|
+
return JSON.parse(await readFile18(configFilePath2(), "utf8"));
|
|
19532
|
+
} catch {
|
|
19533
|
+
return {};
|
|
19534
|
+
}
|
|
19535
|
+
}
|
|
19536
|
+
async function writeSettings2(settings) {
|
|
19537
|
+
const path5 = configFilePath2();
|
|
19538
|
+
await mkdir6(dirname13(path5), { recursive: true });
|
|
19539
|
+
const tmp = `${path5}.${process.pid}.${randomBytes4(4).toString("hex")}.tmp`;
|
|
19540
|
+
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
19541
|
+
`, { mode: 384 });
|
|
19542
|
+
await rename2(tmp, path5);
|
|
19543
|
+
}
|
|
19544
|
+
async function updateSettings2(patch) {
|
|
19545
|
+
await writeSettings2({ ...await readSettings2(), ...patch });
|
|
19546
|
+
}
|
|
19547
|
+
var configFilePath2, runsFilePath2, oldConfigDir2;
|
|
19548
|
+
var init_config = __esm({
|
|
19549
|
+
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
19550
|
+
"use strict";
|
|
19551
|
+
configFilePath2 = () => join17(configRoot2(), "config.json");
|
|
19552
|
+
runsFilePath2 = () => join17(configRoot2(), "state", "runs.json");
|
|
19553
|
+
oldConfigDir2 = () => join17(homedir2(), ".config", "experiences");
|
|
19554
|
+
}
|
|
19555
|
+
});
|
|
19556
|
+
|
|
19557
|
+
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
19558
|
+
var readV1Store, writeV1Store;
|
|
19559
|
+
var init_v1_store = __esm({
|
|
19560
|
+
"packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
|
|
19561
|
+
"use strict";
|
|
19562
|
+
init_config();
|
|
19563
|
+
readV1Store = readSettings2;
|
|
19564
|
+
writeV1Store = writeSettings2;
|
|
19565
|
+
}
|
|
19566
|
+
});
|
|
19567
|
+
|
|
19568
|
+
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
19569
|
+
async function readAnalyticsSetting() {
|
|
19570
|
+
const store = await readV1Store();
|
|
19571
|
+
const analyticsDisabled = store.analyticsDisabled;
|
|
19572
|
+
return { enabled: analyticsDisabled !== true };
|
|
19573
|
+
}
|
|
19574
|
+
async function writeAnalyticsSetting(setting) {
|
|
19575
|
+
const existing = await readV1Store();
|
|
19576
|
+
const updated = {
|
|
19577
|
+
...existing,
|
|
19578
|
+
analyticsDisabled: !setting.enabled
|
|
19579
|
+
};
|
|
19580
|
+
await writeV1Store(updated);
|
|
19581
|
+
}
|
|
19582
|
+
var init_analytics_store = __esm({
|
|
19583
|
+
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts"() {
|
|
19584
|
+
"use strict";
|
|
19585
|
+
init_v1_store();
|
|
19586
|
+
}
|
|
19587
|
+
});
|
|
19588
|
+
|
|
19589
|
+
// packages/experience-design-system-cli/src/tui/home/home.theme.ts
|
|
19590
|
+
function brandBar(width, ramp = BRAND_RAMP) {
|
|
19591
|
+
if (width <= 0 || ramp.length === 0) return [];
|
|
19592
|
+
const base = Math.floor(width / ramp.length);
|
|
19593
|
+
const remainder = width % ramp.length;
|
|
19594
|
+
return ramp.map((color, i) => ({
|
|
19595
|
+
text: BAR_CELL.repeat(base + (i < remainder ? 1 : 0)),
|
|
19596
|
+
color
|
|
19597
|
+
})).filter((segment) => segment.text.length > 0);
|
|
19598
|
+
}
|
|
19599
|
+
var BRAND, PALETTE, BRAND_RAMP, BAR_CELL, FOCUS_MARKER;
|
|
19600
|
+
var init_home_theme = __esm({
|
|
19601
|
+
"packages/experience-design-system-cli/src/tui/home/home.theme.ts"() {
|
|
19602
|
+
"use strict";
|
|
19603
|
+
BRAND = {
|
|
19604
|
+
blue: "#1773EB",
|
|
19605
|
+
green: "#00C459",
|
|
19606
|
+
orange: "#E44F20",
|
|
19607
|
+
yellow: "#FFDA00",
|
|
19608
|
+
white: "#FFFFFF",
|
|
19609
|
+
slate: "#8B8D91",
|
|
19610
|
+
steel: "#C4D1DE"
|
|
19611
|
+
};
|
|
19612
|
+
PALETTE = {
|
|
19613
|
+
accent: BRAND.blue,
|
|
19614
|
+
success: BRAND.green,
|
|
19615
|
+
error: BRAND.orange,
|
|
19616
|
+
warning: BRAND.yellow,
|
|
19617
|
+
muted: BRAND.slate,
|
|
19618
|
+
border: BRAND.steel
|
|
19619
|
+
};
|
|
19620
|
+
BRAND_RAMP = [BRAND.blue, BRAND.orange, BRAND.yellow];
|
|
19621
|
+
BAR_CELL = "\u2501";
|
|
19622
|
+
FOCUS_MARKER = "\u276F";
|
|
19623
|
+
}
|
|
19624
|
+
});
|
|
19625
|
+
|
|
19626
|
+
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
19627
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
19628
|
+
import { join as join18 } from "node:path";
|
|
19629
|
+
import semver from "semver";
|
|
19630
|
+
function readPackageVersion() {
|
|
19631
|
+
const root = findPackageRoot(import.meta.url, PACKAGE_NAME3);
|
|
19632
|
+
const pkg2 = JSON.parse(readFileSync8(join18(root, "package.json"), "utf8"));
|
|
19633
|
+
return pkg2.version ?? "unknown";
|
|
19634
|
+
}
|
|
19635
|
+
function parseVersionTag(tag) {
|
|
19636
|
+
const match2 = /^v(\d+\.\d+\.\d+)$/.exec(tag);
|
|
19637
|
+
return match2 ? match2[1] : void 0;
|
|
19638
|
+
}
|
|
19639
|
+
async function checkForUpgrade() {
|
|
19640
|
+
const current = readPackageVersion();
|
|
19641
|
+
try {
|
|
19642
|
+
const response = await fetch(TAGS_URL);
|
|
19643
|
+
if (!response.ok) return { status: "error" };
|
|
19644
|
+
const tags = await response.json();
|
|
19645
|
+
const versions = tags.map((tag) => tag.name ? parseVersionTag(tag.name) : void 0).filter((v) => v !== void 0);
|
|
19646
|
+
if (versions.length === 0) return { status: "error" };
|
|
19647
|
+
const latest = versions.reduce((best, v) => semver.gt(v, best) ? v : best);
|
|
19648
|
+
if (!semver.valid(current)) return { status: "error" };
|
|
19649
|
+
if (semver.gt(latest, current)) {
|
|
19650
|
+
return { status: "update-available", current, latest };
|
|
19651
|
+
}
|
|
19652
|
+
return { status: "up-to-date", current };
|
|
19653
|
+
} catch {
|
|
19654
|
+
return { status: "error" };
|
|
19655
|
+
}
|
|
19656
|
+
}
|
|
19657
|
+
var PACKAGE_NAME3, TAGS_URL;
|
|
19658
|
+
var init_version = __esm({
|
|
19659
|
+
"packages/experience-design-system-cli/src/tui/upgrade/version.ts"() {
|
|
19660
|
+
"use strict";
|
|
19661
|
+
init_package_root();
|
|
19662
|
+
PACKAGE_NAME3 = "@contentful/experience-design-system-cli";
|
|
19663
|
+
TAGS_URL = "https://api.github.com/repos/contentful/experience-design-system-sdk-public/tags?per_page=10";
|
|
19664
|
+
}
|
|
19665
|
+
});
|
|
19666
|
+
|
|
19667
|
+
// packages/experience-design-system-cli/src/tui/use-terminal-width.ts
|
|
19668
|
+
import { useEffect, useState } from "react";
|
|
19669
|
+
import { useStdout } from "ink";
|
|
19670
|
+
function readColumns(stdout) {
|
|
19671
|
+
const columns = stdout?.columns ?? 0;
|
|
19672
|
+
return columns > 0 ? columns : FALLBACK_COLUMNS;
|
|
19673
|
+
}
|
|
19674
|
+
function useTerminalWidth() {
|
|
19675
|
+
const { stdout } = useStdout();
|
|
19676
|
+
const [columns, setColumns] = useState(() => readColumns(stdout));
|
|
19677
|
+
useEffect(() => {
|
|
19678
|
+
if (!stdout) return;
|
|
19679
|
+
const onResize = () => setColumns(readColumns(stdout));
|
|
19680
|
+
onResize();
|
|
19681
|
+
stdout.on("resize", onResize);
|
|
19682
|
+
return () => {
|
|
19683
|
+
stdout.off("resize", onResize);
|
|
19684
|
+
};
|
|
19685
|
+
}, [stdout]);
|
|
19686
|
+
return columns;
|
|
19687
|
+
}
|
|
19688
|
+
var FALLBACK_COLUMNS;
|
|
19689
|
+
var init_use_terminal_width = __esm({
|
|
19690
|
+
"packages/experience-design-system-cli/src/tui/use-terminal-width.ts"() {
|
|
19691
|
+
"use strict";
|
|
19692
|
+
FALLBACK_COLUMNS = 80;
|
|
19693
|
+
}
|
|
19694
|
+
});
|
|
19695
|
+
|
|
19696
|
+
// packages/experience-design-system-cli/src/tui/control-hints.tsx
|
|
19697
|
+
import { Text } from "ink";
|
|
19698
|
+
import { jsx } from "react/jsx-runtime";
|
|
19699
|
+
function ControlHints({ hints }) {
|
|
19700
|
+
return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) => `[${hint.keys}] ${hint.label}`).join(" \xB7 ") });
|
|
19701
|
+
}
|
|
19702
|
+
var init_control_hints = __esm({
|
|
19703
|
+
"packages/experience-design-system-cli/src/tui/control-hints.tsx"() {
|
|
19704
|
+
"use strict";
|
|
19705
|
+
}
|
|
19706
|
+
});
|
|
19707
|
+
|
|
19708
|
+
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
19709
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
19710
|
+
import { Box, Text as Text2, useApp, useInput } from "ink";
|
|
19711
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19712
|
+
function upgradeItemDisplay(upgradeCheck) {
|
|
19713
|
+
if (upgradeCheck?.status === "update-available") {
|
|
19714
|
+
return { label: `Upgrade Version (v${upgradeCheck.latest} available)`, color: PALETTE.warning };
|
|
19715
|
+
}
|
|
19716
|
+
if (upgradeCheck?.status === "up-to-date") {
|
|
19717
|
+
return { label: "Upgrade Version (up to date)", color: PALETTE.muted };
|
|
19718
|
+
}
|
|
19719
|
+
return { label: "Upgrade Version" };
|
|
19720
|
+
}
|
|
19721
|
+
function HomeScreen({ onNavigate }) {
|
|
19722
|
+
const [focusIdx, setFocusIdx] = useState2(0);
|
|
19723
|
+
const [upgradeCheck, setUpgradeCheck] = useState2();
|
|
19724
|
+
const { exit } = useApp();
|
|
19725
|
+
const terminalWidth = useTerminalWidth();
|
|
19726
|
+
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
19727
|
+
const upgradeDisabled = upgradeCheck?.status === "up-to-date";
|
|
19728
|
+
useEffect2(() => {
|
|
19729
|
+
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
19730
|
+
}, []);
|
|
19731
|
+
useInput((input, key) => {
|
|
19732
|
+
if (input === "q" || key.escape) {
|
|
19733
|
+
exit();
|
|
19734
|
+
return;
|
|
19735
|
+
}
|
|
19736
|
+
if (tooNarrow) return;
|
|
19737
|
+
if (key.upArrow) {
|
|
19738
|
+
setFocusIdx((i) => (i - 1 + START_ITEMS.length) % START_ITEMS.length);
|
|
19739
|
+
return;
|
|
19740
|
+
}
|
|
19741
|
+
if (key.downArrow) {
|
|
19742
|
+
setFocusIdx((i) => (i + 1) % START_ITEMS.length);
|
|
19743
|
+
return;
|
|
19744
|
+
}
|
|
19745
|
+
if (key.return) {
|
|
19746
|
+
const item = START_ITEMS[focusIdx];
|
|
19747
|
+
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
19748
|
+
onNavigate(item.screen);
|
|
19749
|
+
return;
|
|
19750
|
+
}
|
|
19751
|
+
});
|
|
19752
|
+
if (tooNarrow) {
|
|
19753
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
19754
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.warning, children: "Terminal too small" }),
|
|
19755
|
+
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: "Press q to quit, make your terminal full screen, then run experiences import again." })
|
|
19756
|
+
] });
|
|
19757
|
+
}
|
|
19758
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
19759
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
19760
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, children: HEADING }),
|
|
19761
|
+
/* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
|
|
19762
|
+
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
19763
|
+
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
19764
|
+
"v",
|
|
19765
|
+
VERSION
|
|
19766
|
+
] })
|
|
19767
|
+
] }),
|
|
19768
|
+
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
19769
|
+
const focused = i === focusIdx;
|
|
19770
|
+
const isUpgradeItem = item.screen === "upgrade";
|
|
19771
|
+
const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
|
|
19772
|
+
const dimmed = isUpgradeItem && upgradeDisabled;
|
|
19773
|
+
return /* @__PURE__ */ jsxs(
|
|
19774
|
+
Text2,
|
|
19775
|
+
{
|
|
19776
|
+
bold: focused && !dimmed,
|
|
19777
|
+
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
19778
|
+
children: [
|
|
19779
|
+
focused ? `${FOCUS_MARKER} ` : " ",
|
|
19780
|
+
display.label
|
|
19781
|
+
]
|
|
19782
|
+
},
|
|
19783
|
+
item.label
|
|
19784
|
+
);
|
|
19785
|
+
}) }) }),
|
|
19786
|
+
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
19787
|
+
ControlHints,
|
|
19788
|
+
{
|
|
19789
|
+
hints: [
|
|
19790
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
19791
|
+
{ keys: "\u23CE", label: "select" },
|
|
19792
|
+
{ keys: "q", label: "quit" }
|
|
19793
|
+
]
|
|
19794
|
+
}
|
|
19795
|
+
) })
|
|
19796
|
+
] });
|
|
19797
|
+
}
|
|
19798
|
+
var VERSION, HEADING, SUBTITLE, MIN_TERMINAL_WIDTH, START_ITEMS;
|
|
19799
|
+
var init_home = __esm({
|
|
19800
|
+
"packages/experience-design-system-cli/src/tui/home/home.tsx"() {
|
|
19801
|
+
"use strict";
|
|
19802
|
+
init_home_theme();
|
|
19803
|
+
init_version();
|
|
19804
|
+
init_use_terminal_width();
|
|
19805
|
+
init_control_hints();
|
|
19806
|
+
VERSION = readPackageVersion();
|
|
19807
|
+
HEADING = "Contentful Experiences";
|
|
19808
|
+
SUBTITLE = "Let's import your design system into Contentful";
|
|
19809
|
+
MIN_TERMINAL_WIDTH = 164;
|
|
19810
|
+
START_ITEMS = [
|
|
19811
|
+
{ label: "Import", screen: "import" },
|
|
19812
|
+
{ label: "Upgrade Version", screen: "upgrade" },
|
|
19813
|
+
{ label: "Settings", screen: "settings" },
|
|
19814
|
+
{ label: "Help", screen: "help" }
|
|
19815
|
+
];
|
|
19816
|
+
}
|
|
19817
|
+
});
|
|
19818
|
+
|
|
19819
|
+
// packages/experience-design-system-cli/src/tui/import/PageContainer.tsx
|
|
19820
|
+
import { Box as Box2, Text as Text3, useInput as useInput2 } from "ink";
|
|
19821
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
19822
|
+
function ImportScreen({ exitCode, onDone }) {
|
|
19823
|
+
useInput2((input, key) => {
|
|
19824
|
+
if (key.return || key.escape || input === "q") {
|
|
19825
|
+
onDone();
|
|
19826
|
+
}
|
|
19827
|
+
});
|
|
19828
|
+
const isSuccess = exitCode === 0;
|
|
19829
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
19830
|
+
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
19831
|
+
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
19832
|
+
"\u2717 Import failed: process exited with code ",
|
|
19833
|
+
exitCode ?? "unknown"
|
|
19834
|
+
] }),
|
|
19835
|
+
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
19836
|
+
/* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
|
|
19837
|
+
] });
|
|
19838
|
+
}
|
|
19839
|
+
var init_PageContainer = __esm({
|
|
19840
|
+
"packages/experience-design-system-cli/src/tui/import/PageContainer.tsx"() {
|
|
19841
|
+
"use strict";
|
|
19842
|
+
init_home_theme();
|
|
19843
|
+
}
|
|
19844
|
+
});
|
|
19845
|
+
|
|
19846
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
19847
|
+
function shouldQuit(key) {
|
|
19848
|
+
return key.escape;
|
|
19849
|
+
}
|
|
19850
|
+
function toProjectPath(value) {
|
|
19851
|
+
const projectPath = value.trim();
|
|
19852
|
+
return projectPath === "" ? null : projectPath;
|
|
19853
|
+
}
|
|
19854
|
+
var init_logic = __esm({
|
|
19855
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts"() {
|
|
19856
|
+
"use strict";
|
|
19857
|
+
}
|
|
19858
|
+
});
|
|
19859
|
+
|
|
19860
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
19861
|
+
import { useInput as useInput3 } from "ink";
|
|
19862
|
+
function useWelcomeControls(onQuit) {
|
|
19863
|
+
useInput3((_input, key) => {
|
|
19864
|
+
if (shouldQuit(key)) onQuit();
|
|
19865
|
+
});
|
|
19866
|
+
}
|
|
19867
|
+
var WELCOME_CONTROLS;
|
|
19868
|
+
var init_controls = __esm({
|
|
19869
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts"() {
|
|
19870
|
+
"use strict";
|
|
19871
|
+
init_logic();
|
|
19872
|
+
WELCOME_CONTROLS = [
|
|
19873
|
+
{ keys: "Enter", label: "Continue" },
|
|
19874
|
+
{ keys: "Esc", label: "Back to menu" }
|
|
19875
|
+
];
|
|
19876
|
+
}
|
|
19877
|
+
});
|
|
19878
|
+
|
|
19879
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
19880
|
+
import { useState as useState3 } from "react";
|
|
19881
|
+
import { Box as Box3, Text as Text4 } from "ink";
|
|
19882
|
+
import TextInput from "ink-text-input";
|
|
19883
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
19884
|
+
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
19885
|
+
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
19886
|
+
useWelcomeControls(onQuit);
|
|
19887
|
+
const submit = (value) => {
|
|
19888
|
+
const path5 = toProjectPath(value);
|
|
19889
|
+
if (path5) onContinue(path5);
|
|
19890
|
+
};
|
|
19891
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
19892
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
19893
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
19894
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
19895
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
19896
|
+
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
19897
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
19898
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
|
|
19899
|
+
] }, item.label)),
|
|
19900
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
19901
|
+
] }),
|
|
19902
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
|
|
19903
|
+
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
19904
|
+
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
19905
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
19906
|
+
/* @__PURE__ */ jsx4(Text4, { children: "Project path:" }),
|
|
19907
|
+
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
19908
|
+
] })
|
|
19909
|
+
] }),
|
|
19910
|
+
/* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
|
|
19911
|
+
"[",
|
|
19912
|
+
control.keys,
|
|
19913
|
+
"] ",
|
|
19914
|
+
control.label
|
|
19915
|
+
] }, control.keys)) })
|
|
19916
|
+
] });
|
|
19917
|
+
}
|
|
19918
|
+
var RULE, OVERVIEW;
|
|
19919
|
+
var init_screen = __esm({
|
|
19920
|
+
"packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx"() {
|
|
19921
|
+
"use strict";
|
|
19922
|
+
init_home_theme();
|
|
19923
|
+
init_controls();
|
|
19924
|
+
init_logic();
|
|
19925
|
+
RULE = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
19926
|
+
OVERVIEW = [
|
|
19927
|
+
{ label: "Step 1", description: "Extract components from your codebase" },
|
|
19928
|
+
{ label: "Step 2", description: "Review what was extracted" },
|
|
19929
|
+
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
19930
|
+
{ label: "Step 4", description: "Review generated definitions" },
|
|
19931
|
+
{ label: "Step 5", description: "Push to Contentful" }
|
|
19932
|
+
];
|
|
19933
|
+
}
|
|
19934
|
+
});
|
|
19935
|
+
|
|
19936
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
19937
|
+
function shouldGoBack(key) {
|
|
19938
|
+
return key.escape;
|
|
19939
|
+
}
|
|
19940
|
+
function toTokenPath(value) {
|
|
19941
|
+
const tokenPath = value.trim();
|
|
19942
|
+
return tokenPath === "" ? null : tokenPath;
|
|
19943
|
+
}
|
|
19944
|
+
var init_logic2 = __esm({
|
|
19945
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts"() {
|
|
19946
|
+
"use strict";
|
|
19947
|
+
}
|
|
19948
|
+
});
|
|
19949
|
+
|
|
19950
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
19951
|
+
import { useInput as useInput4 } from "ink";
|
|
19952
|
+
function useTokenInputControls(onBack) {
|
|
19953
|
+
useInput4((_input, key) => {
|
|
19954
|
+
if (shouldGoBack(key)) onBack();
|
|
19955
|
+
});
|
|
19956
|
+
}
|
|
19957
|
+
var TOKEN_INPUT_CONTROLS;
|
|
19958
|
+
var init_controls2 = __esm({
|
|
19959
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts"() {
|
|
19960
|
+
"use strict";
|
|
19961
|
+
init_logic2();
|
|
19962
|
+
TOKEN_INPUT_CONTROLS = [
|
|
19963
|
+
{ keys: "Enter", label: "Continue" },
|
|
19964
|
+
{ keys: "Esc", label: "Back" }
|
|
19965
|
+
];
|
|
19437
19966
|
}
|
|
19438
19967
|
});
|
|
19439
19968
|
|
|
19440
|
-
// packages/experience-design-system-
|
|
19441
|
-
|
|
19442
|
-
|
|
19443
|
-
|
|
19969
|
+
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
19970
|
+
import { homedir as homedir3 } from "node:os";
|
|
19971
|
+
import { resolve as resolve19 } from "node:path";
|
|
19972
|
+
function stripQuotes(value) {
|
|
19973
|
+
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
19974
|
+
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
19975
|
+
}
|
|
19976
|
+
function expandHome(value) {
|
|
19977
|
+
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir3() + value.slice(1) : value;
|
|
19978
|
+
}
|
|
19979
|
+
function resolveUserPath(raw) {
|
|
19980
|
+
return resolve19(expandHome(stripQuotes(raw.trim())));
|
|
19981
|
+
}
|
|
19982
|
+
var init_resolve_user_path = __esm({
|
|
19983
|
+
"packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts"() {
|
|
19984
|
+
"use strict";
|
|
19444
19985
|
}
|
|
19445
|
-
|
|
19446
|
-
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
const
|
|
19986
|
+
});
|
|
19987
|
+
|
|
19988
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
19989
|
+
import { statSync as statSync4 } from "node:fs";
|
|
19990
|
+
function validateTokenPath(rawPath) {
|
|
19991
|
+
const path5 = resolveUserPath(rawPath);
|
|
19992
|
+
let stats;
|
|
19451
19993
|
try {
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
const allowedComponentNames2 = /* @__PURE__ */ new Set([
|
|
19458
|
-
...components.map((component) => component.name),
|
|
19459
|
-
...(existingEntities?.components ?? []).map((component) => component.name)
|
|
19460
|
-
]);
|
|
19461
|
-
const cachedComponents = [];
|
|
19462
|
-
for (const component of components) {
|
|
19463
|
-
const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
|
|
19464
|
-
if (resolution)
|
|
19465
|
-
cachedComponents.push({ component, resolution });
|
|
19466
|
-
await new Promise((r) => setImmediate(r));
|
|
19467
|
-
}
|
|
19468
|
-
if (request.restoreCache) {
|
|
19469
|
-
await restoreCachedComponents(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
|
|
19470
|
-
}
|
|
19994
|
+
stats = statSync4(path5);
|
|
19995
|
+
} catch {
|
|
19996
|
+
return { ok: false, error: `Path not found: ${path5}`, resolvedPath: path5 };
|
|
19997
|
+
}
|
|
19998
|
+
if (stats.isDirectory()) {
|
|
19471
19999
|
return {
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
cacheDisabled: false
|
|
20000
|
+
ok: false,
|
|
20001
|
+
error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
|
|
20002
|
+
resolvedPath: path5
|
|
19476
20003
|
};
|
|
19477
|
-
} finally {
|
|
19478
|
-
db.close();
|
|
19479
20004
|
}
|
|
20005
|
+
if (!stats.isFile()) {
|
|
20006
|
+
return { ok: false, error: `Not a regular file: ${path5}`, resolvedPath: path5 };
|
|
20007
|
+
}
|
|
20008
|
+
return { ok: true, path: path5 };
|
|
19480
20009
|
}
|
|
19481
|
-
var
|
|
19482
|
-
"packages/experience-design-system-
|
|
20010
|
+
var init_validate_path = __esm({
|
|
20011
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts"() {
|
|
19483
20012
|
"use strict";
|
|
19484
|
-
|
|
19485
|
-
init_resolve_component_cache();
|
|
19486
|
-
init_db();
|
|
19487
|
-
init_cache_keys();
|
|
19488
|
-
init_src();
|
|
19489
|
-
init_read_existing_entities();
|
|
19490
|
-
init_resolve_generate_prompt();
|
|
19491
|
-
init_restore_cached_components();
|
|
20013
|
+
init_resolve_user_path();
|
|
19492
20014
|
}
|
|
19493
20015
|
});
|
|
19494
20016
|
|
|
19495
|
-
// packages/experience-design-system-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
const
|
|
19502
|
-
const
|
|
19503
|
-
|
|
19504
|
-
const
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
|
|
19548
|
-
|
|
19549
|
-
|
|
19550
|
-
|
|
19551
|
-
|
|
20017
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
20018
|
+
import { useState as useState4 } from "react";
|
|
20019
|
+
import { Box as Box4, Text as Text5 } from "ink";
|
|
20020
|
+
import TextInput2 from "ink-text-input";
|
|
20021
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
20022
|
+
function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
20023
|
+
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
20024
|
+
const [failure, setFailure] = useState4(null);
|
|
20025
|
+
useTokenInputControls(onBack);
|
|
20026
|
+
const change = (value) => {
|
|
20027
|
+
setTokenPath(value);
|
|
20028
|
+
setFailure(null);
|
|
20029
|
+
};
|
|
20030
|
+
const submit = (value) => {
|
|
20031
|
+
const rawPath = toTokenPath(value);
|
|
20032
|
+
if (!rawPath) {
|
|
20033
|
+
setFailure({ error: "Enter the path to your token file." });
|
|
20034
|
+
return;
|
|
20035
|
+
}
|
|
20036
|
+
const check = validateTokenPath(rawPath);
|
|
20037
|
+
if (check.ok) onConfirm(check.path);
|
|
20038
|
+
else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
|
|
20039
|
+
};
|
|
20040
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
20041
|
+
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
20042
|
+
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.muted, children: "Point me to your raw token file (e.g. ~/design-tokens/tokens.json). You can use ~, relative, or absolute paths. Claude will map it to Design Token Group Format (DTCG)." }),
|
|
20043
|
+
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
20044
|
+
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
20045
|
+
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
20046
|
+
/* @__PURE__ */ jsx5(Text5, { children: "Token path:" }),
|
|
20047
|
+
/* @__PURE__ */ jsx5(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
|
|
20048
|
+
] }),
|
|
20049
|
+
failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
20050
|
+
/* @__PURE__ */ jsxs4(Text5, { color: PALETTE.error, children: [
|
|
20051
|
+
"\u2717 ",
|
|
20052
|
+
failure.error
|
|
20053
|
+
] }),
|
|
20054
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { color: PALETTE.muted, children: [
|
|
20055
|
+
" Resolved to: ",
|
|
20056
|
+
failure.resolvedPath
|
|
20057
|
+
] })
|
|
20058
|
+
] })
|
|
20059
|
+
] }),
|
|
20060
|
+
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
20061
|
+
"[",
|
|
20062
|
+
control.keys,
|
|
20063
|
+
"] ",
|
|
20064
|
+
control.label
|
|
20065
|
+
] }, control.keys)) })
|
|
20066
|
+
] });
|
|
20067
|
+
}
|
|
20068
|
+
var init_screen2 = __esm({
|
|
20069
|
+
"packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx"() {
|
|
20070
|
+
"use strict";
|
|
20071
|
+
init_home_theme();
|
|
20072
|
+
init_controls2();
|
|
20073
|
+
init_logic2();
|
|
20074
|
+
init_validate_path();
|
|
20075
|
+
}
|
|
20076
|
+
});
|
|
20077
|
+
|
|
20078
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts
|
|
20079
|
+
function describeFailure(failure, path5) {
|
|
20080
|
+
switch (failure) {
|
|
20081
|
+
case "is-file":
|
|
20082
|
+
return {
|
|
20083
|
+
headline: "That's a file, not a directory.",
|
|
20084
|
+
hints: [
|
|
20085
|
+
"Provide the path to your component library's root folder, not a specific file.",
|
|
20086
|
+
"Example: ~/projects/my-design-system"
|
|
20087
|
+
]
|
|
20088
|
+
};
|
|
20089
|
+
case "not-found":
|
|
20090
|
+
return {
|
|
20091
|
+
headline: `Directory not found: ${path5}`,
|
|
20092
|
+
hints: ["Double-check the path and try again. Tip: you can use ~, relative, or absolute paths."]
|
|
20093
|
+
};
|
|
20094
|
+
case "permission-denied":
|
|
20095
|
+
return {
|
|
20096
|
+
headline: `Permission denied: ${path5}`,
|
|
20097
|
+
hints: ["You don't have read access to this directory."]
|
|
20098
|
+
};
|
|
20099
|
+
case "not-directory":
|
|
20100
|
+
return { headline: `Not a directory: ${path5}`, hints: [] };
|
|
20101
|
+
case "unreadable":
|
|
20102
|
+
return { headline: `Cannot access: ${path5}`, hints: [] };
|
|
19552
20103
|
}
|
|
19553
20104
|
}
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
20105
|
+
function summarize(counts) {
|
|
20106
|
+
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
20107
|
+
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
20108
|
+
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
20109
|
+
});
|
|
20110
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
20111
|
+
if (componentFiles > 0) return { total: counts.total, rows };
|
|
20112
|
+
if (counts.json > 0) {
|
|
20113
|
+
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
20114
|
+
}
|
|
20115
|
+
return {
|
|
20116
|
+
total: counts.total,
|
|
20117
|
+
rows,
|
|
20118
|
+
warning: "No component or token files found. Try a different path."
|
|
20119
|
+
};
|
|
20120
|
+
}
|
|
20121
|
+
function phaseOf(scan) {
|
|
20122
|
+
if (scan === void 0) return "scanning";
|
|
20123
|
+
return scan.ok ? "ready" : "failed";
|
|
20124
|
+
}
|
|
20125
|
+
function keyAction(phase, input, key) {
|
|
20126
|
+
if (key.escape) return "back";
|
|
20127
|
+
if (phase === "ready") {
|
|
20128
|
+
if (key.return) return "confirm";
|
|
20129
|
+
if (input === "e") return "change-path";
|
|
20130
|
+
}
|
|
20131
|
+
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
20132
|
+
return void 0;
|
|
20133
|
+
}
|
|
20134
|
+
var COMPONENT_CATEGORIES, ROW_LABELS, ROW_ORDER;
|
|
20135
|
+
var init_logic3 = __esm({
|
|
20136
|
+
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts"() {
|
|
19557
20137
|
"use strict";
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19566
|
-
|
|
19567
|
-
|
|
19568
|
-
|
|
19569
|
-
|
|
19570
|
-
init_check_generate_components_cache();
|
|
19571
|
-
DEFAULT_COMPONENT_CONCURRENCY = Number(process.env["EDS_GENERATE_CONCURRENCY"] ?? 10);
|
|
20138
|
+
COMPONENT_CATEGORIES = ["tsx", "ts", "vue", "astro", "jsx", "js"];
|
|
20139
|
+
ROW_LABELS = {
|
|
20140
|
+
tsx: ".tsx files",
|
|
20141
|
+
ts: ".ts files",
|
|
20142
|
+
vue: ".vue files",
|
|
20143
|
+
astro: ".astro files",
|
|
20144
|
+
jsx: ".jsx files",
|
|
20145
|
+
js: ".js files",
|
|
20146
|
+
json: ".json files (design tokens)",
|
|
20147
|
+
other: "other (ignored)"
|
|
20148
|
+
};
|
|
20149
|
+
ROW_ORDER = ["tsx", "ts", "vue", "astro", "jsx", "js", "json", "other"];
|
|
19572
20150
|
}
|
|
19573
20151
|
});
|
|
19574
20152
|
|
|
19575
|
-
// packages/experience-design-system-
|
|
19576
|
-
|
|
19577
|
-
|
|
20153
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
20154
|
+
import { useInput as useInput5 } from "ink";
|
|
20155
|
+
function controlsFor(phase) {
|
|
20156
|
+
return CONTROLS[phase];
|
|
20157
|
+
}
|
|
20158
|
+
function usePathValidationControls(phase, handlers) {
|
|
20159
|
+
useInput5((input, key) => {
|
|
20160
|
+
const action = keyAction(phase, input, key);
|
|
20161
|
+
if (action === "confirm") handlers.onConfirm();
|
|
20162
|
+
else if (action === "change-path") handlers.onChangePath();
|
|
20163
|
+
else if (action === "back") handlers.onBack();
|
|
20164
|
+
});
|
|
20165
|
+
}
|
|
20166
|
+
var CONTROLS;
|
|
20167
|
+
var init_controls3 = __esm({
|
|
20168
|
+
"packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts"() {
|
|
19578
20169
|
"use strict";
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
init_apply_mapping();
|
|
19593
|
-
init_resolve_mapping();
|
|
19594
|
-
init_prompt_loader();
|
|
19595
|
-
init_composition_cache_key();
|
|
19596
|
-
init_resolve_composition_sources();
|
|
19597
|
-
init_build_component_graph2();
|
|
19598
|
-
init_find_slot_cycles2();
|
|
19599
|
-
init_group_nodes_by_cycle_membership2();
|
|
19600
|
-
init_expand_seeds_to_include_cycle_groups2();
|
|
19601
|
-
init_select_descendants_respecting_cycles2();
|
|
19602
|
-
init_reject_ancestors_respecting_cycles2();
|
|
19603
|
-
init_select_all_descendants2();
|
|
19604
|
-
init_reject_all_ancestors2();
|
|
19605
|
-
init_expand_matches_by_one_hop2();
|
|
19606
|
-
init_find_all_parents2();
|
|
19607
|
-
init_propagate_descendant_issues_to_ancestors2();
|
|
19608
|
-
init_find_worst_issued_descendant2();
|
|
19609
|
-
init_suggest_cycle_break_edge();
|
|
19610
|
-
init_format_cycle_path();
|
|
19611
|
-
init_format_cycle_path_segments();
|
|
19612
|
-
init_select_components_endpoint();
|
|
19613
|
-
init_load_and_validate_for_review();
|
|
19614
|
-
init_merge_preview_validation_errors_into_review_session();
|
|
19615
|
-
init_merge_preview_validation_errors_into_review_session();
|
|
19616
|
-
init_reject_components_by_name();
|
|
19617
|
-
init_src();
|
|
19618
|
-
init_generate_cdf_components_endpoint();
|
|
19619
|
-
init_apply_components_endpoint();
|
|
19620
|
-
init_has_breaking_changes();
|
|
19621
|
-
init_token_utils();
|
|
19622
|
-
init_is_empty_preview();
|
|
19623
|
-
init_contentful_urls();
|
|
19624
|
-
init_api_error();
|
|
19625
|
-
init_api_client();
|
|
19626
|
-
init_api_client();
|
|
19627
|
-
init_parse_preview_errors();
|
|
19628
|
-
init_host_utils2();
|
|
19629
|
-
init_detect_slot_cycles2();
|
|
19630
|
-
init_assert_no_slot_cycles();
|
|
19631
|
-
init_assert_no_unresolved_slot_references();
|
|
19632
|
-
init_format_slot_cycle_report2();
|
|
19633
|
-
init_format_unresolved_slot_references2();
|
|
19634
|
-
init_mutate_cdf_component();
|
|
19635
|
-
init_mutate_dot_path();
|
|
19636
|
-
init_warn_on_unknown_patch_components2();
|
|
19637
|
-
init_annotate_preview2();
|
|
19638
|
-
init_annotate_preview();
|
|
19639
|
-
init_parse_edsi_error2();
|
|
19640
|
-
init_format_edsi_error2();
|
|
19641
|
-
init_format_api_error2();
|
|
19642
|
-
init_strip_lambda_log_prefix();
|
|
19643
|
-
init_read_tokens_from_path2();
|
|
19644
|
-
init_agents();
|
|
19645
|
-
init_agent_name();
|
|
19646
|
-
init_models();
|
|
19647
|
-
init_is_agent_name();
|
|
19648
|
-
init_agent_supports_bedrock();
|
|
19649
|
-
init_check_agent_auth();
|
|
19650
|
-
init_build_prompt();
|
|
19651
|
-
init_resolve_skill_path();
|
|
19652
|
-
init_create_local_cli_agent_invoker();
|
|
19653
|
-
init_parse_select_tool_calls();
|
|
19654
|
-
init_parse_token_tool_calls();
|
|
19655
|
-
init_build_contentful_management_client();
|
|
19656
|
-
init_fetch_and_persist();
|
|
19657
|
-
init_read_from_session();
|
|
19658
|
-
init_fetch_from_contentful();
|
|
19659
|
-
init_summarize_for_select();
|
|
19660
|
-
init_summarize_for_generate();
|
|
19661
|
-
init_summarize_for_map_tokens();
|
|
19662
|
-
init_resolve_token_defaults2();
|
|
19663
|
-
init_find_nearly_matching_component();
|
|
19664
|
-
init_normalize_component_for_cache();
|
|
19665
|
-
init_lookup_component_cache();
|
|
19666
|
-
init_resolve_component_cache();
|
|
19667
|
-
init_resolve_shared_inputs();
|
|
19668
|
-
init_apply_map_token_prop_calls();
|
|
19669
|
-
init_run_map_tokens();
|
|
19670
|
-
init_src();
|
|
19671
|
-
init_src();
|
|
19672
|
-
init_src();
|
|
19673
|
-
init_src();
|
|
19674
|
-
init_src();
|
|
19675
|
-
init_src();
|
|
19676
|
-
init_src();
|
|
19677
|
-
init_src();
|
|
19678
|
-
init_src();
|
|
19679
|
-
init_src();
|
|
19680
|
-
init_src();
|
|
19681
|
-
init_src();
|
|
19682
|
-
init_src();
|
|
19683
|
-
init_src();
|
|
19684
|
-
init_src();
|
|
19685
|
-
init_src();
|
|
19686
|
-
init_src();
|
|
19687
|
-
init_component();
|
|
19688
|
-
init_run_extract_and_compose_session();
|
|
19689
|
-
init_run_generate_tokens_session();
|
|
19690
|
-
init_run_generate_components_session();
|
|
20170
|
+
init_logic3();
|
|
20171
|
+
CONTROLS = {
|
|
20172
|
+
scanning: [{ keys: "Esc", label: "Back" }],
|
|
20173
|
+
ready: [
|
|
20174
|
+
{ keys: "Enter", label: "Yes, continue" },
|
|
20175
|
+
{ keys: "e", label: "Change path" },
|
|
20176
|
+
{ keys: "Esc", label: "Back" }
|
|
20177
|
+
],
|
|
20178
|
+
failed: [
|
|
20179
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
20180
|
+
{ keys: "Esc", label: "Back" }
|
|
20181
|
+
]
|
|
20182
|
+
};
|
|
19691
20183
|
}
|
|
19692
20184
|
});
|
|
19693
20185
|
|
|
@@ -20302,15 +20794,15 @@ var init_shared2 = __esm({
|
|
|
20302
20794
|
|
|
20303
20795
|
// packages/experience-design-system-cli/src/tui/import/steps/05-token-reuse/logic.ts
|
|
20304
20796
|
import { access as access5, readdir as readdir2, stat as stat4 } from "node:fs/promises";
|
|
20305
|
-
import { join as
|
|
20797
|
+
import { join as join19 } from "node:path";
|
|
20306
20798
|
async function findLatestTokens(contentfulDir) {
|
|
20307
|
-
const candidates = [
|
|
20799
|
+
const candidates = [join19(contentfulDir, "tokens.json")];
|
|
20308
20800
|
try {
|
|
20309
20801
|
for (const session of await readdir2(contentfulDir, { withFileTypes: true })) {
|
|
20310
20802
|
if (!session.isDirectory()) continue;
|
|
20311
|
-
for (const run of await readdir2(
|
|
20803
|
+
for (const run of await readdir2(join19(contentfulDir, session.name), { withFileTypes: true }).catch(() => [])) {
|
|
20312
20804
|
if (run.isDirectory() && /^dsi-import-\d+$/.test(run.name)) {
|
|
20313
|
-
candidates.push(
|
|
20805
|
+
candidates.push(join19(contentfulDir, session.name, run.name, "tokens.json"));
|
|
20314
20806
|
}
|
|
20315
20807
|
}
|
|
20316
20808
|
}
|
|
@@ -20517,42 +21009,6 @@ var init_steps = __esm({
|
|
|
20517
21009
|
}
|
|
20518
21010
|
});
|
|
20519
21011
|
|
|
20520
|
-
// packages/experience-design-system-types/dist/src/config/index.js
|
|
20521
|
-
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
20522
|
-
import { mkdir as mkdir6, readFile as readFile18, rename as rename2, writeFile as writeFile6 } from "node:fs/promises";
|
|
20523
|
-
import { homedir as homedir3 } from "node:os";
|
|
20524
|
-
import { dirname as dirname13, join as join19 } from "node:path";
|
|
20525
|
-
function configRoot2() {
|
|
20526
|
-
return process.env["EDS_HOME"] || join19(homedir3(), ".contentful", "experience-design-system-cli");
|
|
20527
|
-
}
|
|
20528
|
-
async function readSettings2() {
|
|
20529
|
-
try {
|
|
20530
|
-
return JSON.parse(await readFile18(configFilePath2(), "utf8"));
|
|
20531
|
-
} catch {
|
|
20532
|
-
return {};
|
|
20533
|
-
}
|
|
20534
|
-
}
|
|
20535
|
-
async function writeSettings2(settings) {
|
|
20536
|
-
const path5 = configFilePath2();
|
|
20537
|
-
await mkdir6(dirname13(path5), { recursive: true });
|
|
20538
|
-
const tmp = `${path5}.${process.pid}.${randomBytes3(4).toString("hex")}.tmp`;
|
|
20539
|
-
await writeFile6(tmp, `${JSON.stringify(settings, null, 2)}
|
|
20540
|
-
`, { mode: 384 });
|
|
20541
|
-
await rename2(tmp, path5);
|
|
20542
|
-
}
|
|
20543
|
-
async function updateSettings2(patch) {
|
|
20544
|
-
await writeSettings2({ ...await readSettings2(), ...patch });
|
|
20545
|
-
}
|
|
20546
|
-
var configFilePath2, runsFilePath2, oldConfigDir2;
|
|
20547
|
-
var init_config = __esm({
|
|
20548
|
-
"packages/experience-design-system-types/dist/src/config/index.js"() {
|
|
20549
|
-
"use strict";
|
|
20550
|
-
configFilePath2 = () => join19(configRoot2(), "config.json");
|
|
20551
|
-
runsFilePath2 = () => join19(configRoot2(), "state", "runs.json");
|
|
20552
|
-
oldConfigDir2 = () => join19(homedir3(), ".config", "experiences");
|
|
20553
|
-
}
|
|
20554
|
-
});
|
|
20555
|
-
|
|
20556
21012
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/find-skill-path.ts
|
|
20557
21013
|
import { existsSync as existsSync10 } from "node:fs";
|
|
20558
21014
|
import { dirname as dirname14, join as join20, resolve as resolve20 } from "node:path";
|
|
@@ -20586,13 +21042,13 @@ async function runSelection(options) {
|
|
|
20586
21042
|
const db = openPipelineDb();
|
|
20587
21043
|
let components;
|
|
20588
21044
|
const cachedDecisions = /* @__PURE__ */ new Map();
|
|
20589
|
-
const
|
|
21045
|
+
const cliVersion2 = await getCliCacheVersion();
|
|
20590
21046
|
const promptHash = await hashSelectPrompt(options);
|
|
20591
21047
|
try {
|
|
20592
21048
|
components = loadRawComponents(db, options.sessionId);
|
|
20593
21049
|
if (!options.noCache) {
|
|
20594
21050
|
for (const component of components) {
|
|
20595
|
-
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash,
|
|
21051
|
+
const cached = lookupSelectCache(db, hashComponentShape(component), promptHash, cliVersion2);
|
|
20596
21052
|
if (cached) cachedDecisions.set(component.name, { decision: cached.decision, reason: cached.reason });
|
|
20597
21053
|
}
|
|
20598
21054
|
}
|
|
@@ -20647,7 +21103,7 @@ async function runSelection(options) {
|
|
|
20647
21103
|
writeDb,
|
|
20648
21104
|
hashComponentShape(component),
|
|
20649
21105
|
promptHash,
|
|
20650
|
-
|
|
21106
|
+
cliVersion2,
|
|
20651
21107
|
rejected ? "rejected" : "accepted",
|
|
20652
21108
|
rejected ? reason : null
|
|
20653
21109
|
);
|
|
@@ -20830,7 +21286,7 @@ var init_run = __esm({
|
|
|
20830
21286
|
// packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
|
|
20831
21287
|
import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
|
|
20832
21288
|
function useExtraction(input) {
|
|
20833
|
-
const [
|
|
21289
|
+
const [state2, setState] = useState8();
|
|
20834
21290
|
const current = useRef2();
|
|
20835
21291
|
useEffect5(() => {
|
|
20836
21292
|
current.current = input;
|
|
@@ -20855,7 +21311,7 @@ function useExtraction(input) {
|
|
|
20855
21311
|
if (current.current === input) current.current = void 0;
|
|
20856
21312
|
};
|
|
20857
21313
|
}, [input]);
|
|
20858
|
-
return
|
|
21314
|
+
return state2;
|
|
20859
21315
|
}
|
|
20860
21316
|
var init_use_extraction = __esm({
|
|
20861
21317
|
"packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts"() {
|
|
@@ -23171,62 +23627,62 @@ var init_step_filters = __esm({
|
|
|
23171
23627
|
});
|
|
23172
23628
|
|
|
23173
23629
|
// packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts
|
|
23174
|
-
function apply(
|
|
23175
|
-
const next = new Map(
|
|
23630
|
+
function apply(state2, entries) {
|
|
23631
|
+
const next = new Map(state2);
|
|
23176
23632
|
for (const [name, decision] of entries) next.set(name, decision);
|
|
23177
23633
|
return next;
|
|
23178
23634
|
}
|
|
23179
|
-
function reduceDecisions(
|
|
23635
|
+
function reduceDecisions(state2, action, components, graph) {
|
|
23180
23636
|
switch (action.type) {
|
|
23181
23637
|
case "accept": {
|
|
23182
|
-
if (
|
|
23638
|
+
if (state2.get(action.name) === "accepted") return state2;
|
|
23183
23639
|
return apply(
|
|
23184
|
-
|
|
23640
|
+
state2,
|
|
23185
23641
|
acceptCascade(graph, action.name).map((name) => [name, "accepted"])
|
|
23186
23642
|
);
|
|
23187
23643
|
}
|
|
23188
23644
|
case "reject": {
|
|
23189
|
-
if (
|
|
23645
|
+
if (state2.get(action.name) === "rejected") return state2;
|
|
23190
23646
|
const { toReject, toDeselect } = rejectCascade(graph, action.name);
|
|
23191
|
-
return apply(
|
|
23647
|
+
return apply(state2, [
|
|
23192
23648
|
...toReject.map((name) => [name, "rejected"]),
|
|
23193
23649
|
...toDeselect.map((name) => [name, "undecided"])
|
|
23194
23650
|
]);
|
|
23195
23651
|
}
|
|
23196
23652
|
case "toggle-all": {
|
|
23197
23653
|
const nonCycle = components.filter((c2) => !graph.cycleParticipants.has(c2.name)).map((c2) => c2.name);
|
|
23198
|
-
const anyNotAccepted = nonCycle.some((name) =>
|
|
23654
|
+
const anyNotAccepted = nonCycle.some((name) => state2.get(name) !== "accepted");
|
|
23199
23655
|
if (anyNotAccepted) {
|
|
23200
|
-
return apply(
|
|
23656
|
+
return apply(state2, [
|
|
23201
23657
|
...nonCycle.map((name) => [name, "accepted"]),
|
|
23202
23658
|
...reachableCycleMembers(graph, nonCycle).map((name) => [name, "accepted"])
|
|
23203
23659
|
]);
|
|
23204
23660
|
}
|
|
23205
|
-
return apply(
|
|
23661
|
+
return apply(state2, [
|
|
23206
23662
|
...nonCycle.map((name) => [name, "rejected"]),
|
|
23207
|
-
...components.filter((c2) => graph.cycleParticipants.has(c2.name) &&
|
|
23663
|
+
...components.filter((c2) => graph.cycleParticipants.has(c2.name) && state2.get(c2.name) === "accepted").map((c2) => [c2.name, "undecided"])
|
|
23208
23664
|
]);
|
|
23209
23665
|
}
|
|
23210
23666
|
case "accept-unflagged": {
|
|
23211
23667
|
const seeds = components.filter((c2) => !graph.cycleParticipants.has(c2.name) && !isAiFlagged(c2)).map((c2) => c2.name);
|
|
23212
|
-
return apply(
|
|
23668
|
+
return apply(state2, [
|
|
23213
23669
|
...seeds.map((name) => [name, "accepted"]),
|
|
23214
23670
|
...reachableCycleMembers(graph, seeds).map((name) => [name, "accepted"])
|
|
23215
23671
|
]);
|
|
23216
23672
|
}
|
|
23217
23673
|
}
|
|
23218
23674
|
}
|
|
23219
|
-
function rejectNeedsConfirmation(graph, name,
|
|
23220
|
-
if (
|
|
23675
|
+
function rejectNeedsConfirmation(graph, name, state2) {
|
|
23676
|
+
if (state2.get(name) === "rejected") return false;
|
|
23221
23677
|
const { toReject, toDeselect } = rejectCascade(graph, name);
|
|
23222
23678
|
const ancestors = toReject.filter((n) => n !== name);
|
|
23223
23679
|
return ancestors.length + toDeselect.length >= 2;
|
|
23224
23680
|
}
|
|
23225
|
-
function partitionDecisions(components,
|
|
23681
|
+
function partitionDecisions(components, state2) {
|
|
23226
23682
|
const accepted = [];
|
|
23227
23683
|
const rejected = [];
|
|
23228
23684
|
for (const c2 of components) {
|
|
23229
|
-
if (
|
|
23685
|
+
if (state2.get(c2.name) === "accepted") accepted.push(c2.name);
|
|
23230
23686
|
else rejected.push(c2.name);
|
|
23231
23687
|
}
|
|
23232
23688
|
return { accepted, rejected };
|
|
@@ -24222,7 +24678,7 @@ var init_run2 = __esm({
|
|
|
24222
24678
|
// packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
|
|
24223
24679
|
import { useEffect as useEffect9, useRef as useRef6, useState as useState14 } from "react";
|
|
24224
24680
|
function useGeneration(input) {
|
|
24225
|
-
const [
|
|
24681
|
+
const [state2, setState] = useState14();
|
|
24226
24682
|
const current = useRef6();
|
|
24227
24683
|
useEffect9(() => {
|
|
24228
24684
|
current.current = input;
|
|
@@ -24240,7 +24696,7 @@ function useGeneration(input) {
|
|
|
24240
24696
|
if (current.current === input) current.current = void 0;
|
|
24241
24697
|
};
|
|
24242
24698
|
}, [input]);
|
|
24243
|
-
return
|
|
24699
|
+
return state2;
|
|
24244
24700
|
}
|
|
24245
24701
|
var init_use_generation = __esm({
|
|
24246
24702
|
"packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts"() {
|
|
@@ -25186,7 +25642,7 @@ function parseToState(json) {
|
|
|
25186
25642
|
});
|
|
25187
25643
|
return { state: { componentDescription, props, slots }, error: null };
|
|
25188
25644
|
}
|
|
25189
|
-
function serializeState(
|
|
25645
|
+
function serializeState(state2, originalJson) {
|
|
25190
25646
|
let wrapperKey = null;
|
|
25191
25647
|
try {
|
|
25192
25648
|
const orig = JSON.parse(originalJson);
|
|
@@ -25200,7 +25656,7 @@ function serializeState(state, originalJson) {
|
|
|
25200
25656
|
} catch {
|
|
25201
25657
|
}
|
|
25202
25658
|
const $properties = {};
|
|
25203
|
-
for (const p of
|
|
25659
|
+
for (const p of state2.props) {
|
|
25204
25660
|
const def = {
|
|
25205
25661
|
$type: p.type,
|
|
25206
25662
|
$category: p.category
|
|
@@ -25223,10 +25679,10 @@ function serializeState(state, originalJson) {
|
|
|
25223
25679
|
$type: "component",
|
|
25224
25680
|
$properties
|
|
25225
25681
|
};
|
|
25226
|
-
if (
|
|
25227
|
-
if (
|
|
25682
|
+
if (state2.componentDescription) entry.$description = state2.componentDescription;
|
|
25683
|
+
if (state2.slots.length > 0) {
|
|
25228
25684
|
entry.$slots = {};
|
|
25229
|
-
for (const s of
|
|
25685
|
+
for (const s of state2.slots) {
|
|
25230
25686
|
const slotDef = {};
|
|
25231
25687
|
if (s.description) slotDef.$description = s.description;
|
|
25232
25688
|
if (s.required) slotDef.$required = true;
|
|
@@ -27722,7 +28178,7 @@ function finalizeReviewSession(extractSessionId, components) {
|
|
|
27722
28178
|
unresolved: unresolvedKeys.length
|
|
27723
28179
|
};
|
|
27724
28180
|
}
|
|
27725
|
-
var
|
|
28181
|
+
var init_session3 = __esm({
|
|
27726
28182
|
"packages/experience-design-system-cli/src/tui/import/steps/09-review/session.ts"() {
|
|
27727
28183
|
"use strict";
|
|
27728
28184
|
init_src4();
|
|
@@ -28169,7 +28625,7 @@ var init_use_review_session = __esm({
|
|
|
28169
28625
|
"use strict";
|
|
28170
28626
|
init_src4();
|
|
28171
28627
|
init_history();
|
|
28172
|
-
|
|
28628
|
+
init_session3();
|
|
28173
28629
|
init_use_finalize_preview();
|
|
28174
28630
|
}
|
|
28175
28631
|
});
|
|
@@ -28481,71 +28937,71 @@ var init_ReviewDialogs = __esm({
|
|
|
28481
28937
|
});
|
|
28482
28938
|
|
|
28483
28939
|
// packages/experience-design-system-cli/src/tui/import/steps/09-review/review-input.ts
|
|
28484
|
-
function handleReviewOverlayInput(input, key,
|
|
28485
|
-
if (
|
|
28486
|
-
if (
|
|
28487
|
-
if (input === "q" || key.escape || key.return)
|
|
28940
|
+
function handleReviewOverlayInput(input, key, state2) {
|
|
28941
|
+
if (state2.loading) return true;
|
|
28942
|
+
if (state2.loadError) {
|
|
28943
|
+
if (input === "q" || key.escape || key.return) state2.onQuit();
|
|
28488
28944
|
return true;
|
|
28489
28945
|
}
|
|
28490
|
-
if (
|
|
28946
|
+
if (state2.showFinalize) {
|
|
28491
28947
|
if (key.downArrow) {
|
|
28492
|
-
|
|
28948
|
+
state2.finalizePreview.scrollBy(1);
|
|
28493
28949
|
return true;
|
|
28494
28950
|
}
|
|
28495
28951
|
if (key.upArrow) {
|
|
28496
|
-
|
|
28952
|
+
state2.finalizePreview.scrollBy(-1);
|
|
28497
28953
|
return true;
|
|
28498
28954
|
}
|
|
28499
28955
|
return true;
|
|
28500
28956
|
}
|
|
28501
|
-
if (
|
|
28502
|
-
if (
|
|
28957
|
+
if (state2.dialogOpen || state2.showHelp) return true;
|
|
28958
|
+
if (state2.showReloadDialog) {
|
|
28503
28959
|
if (key.return) {
|
|
28504
|
-
|
|
28505
|
-
|
|
28960
|
+
state2.reloadFromSave();
|
|
28961
|
+
state2.setShowReloadDialog(false);
|
|
28506
28962
|
return true;
|
|
28507
28963
|
}
|
|
28508
28964
|
if (key.escape) {
|
|
28509
|
-
|
|
28965
|
+
state2.setShowReloadDialog(false);
|
|
28510
28966
|
return true;
|
|
28511
28967
|
}
|
|
28512
28968
|
return true;
|
|
28513
28969
|
}
|
|
28514
28970
|
if (key.ctrl && input === "z") {
|
|
28515
|
-
|
|
28971
|
+
state2.handleUndo();
|
|
28516
28972
|
return true;
|
|
28517
28973
|
}
|
|
28518
28974
|
if (key.ctrl && input === "y") {
|
|
28519
|
-
|
|
28975
|
+
state2.handleRedo();
|
|
28520
28976
|
return true;
|
|
28521
28977
|
}
|
|
28522
28978
|
if (key.ctrl && input === "r") {
|
|
28523
|
-
|
|
28979
|
+
state2.setShowReloadDialog(true);
|
|
28524
28980
|
return true;
|
|
28525
28981
|
}
|
|
28526
28982
|
return false;
|
|
28527
28983
|
}
|
|
28528
|
-
function handleTokenReviewInput(input, key,
|
|
28529
|
-
if (
|
|
28530
|
-
const suggestions =
|
|
28531
|
-
const row = suggestions[
|
|
28532
|
-
if (
|
|
28984
|
+
function handleTokenReviewInput(input, key, state2) {
|
|
28985
|
+
if (state2.panelOpen !== "token-review") return false;
|
|
28986
|
+
const suggestions = state2.currentTokenSuggestions();
|
|
28987
|
+
const row = suggestions[state2.tokenReviewRow];
|
|
28988
|
+
if (state2.tokenReviewEditing) {
|
|
28533
28989
|
if (key.ctrl && input === "s" && row) {
|
|
28534
|
-
|
|
28990
|
+
state2.handleTokenEditSave(row);
|
|
28535
28991
|
return true;
|
|
28536
28992
|
}
|
|
28537
28993
|
if (row && row.paths.length > 0) {
|
|
28538
28994
|
if (key.upArrow || input === "k") {
|
|
28539
|
-
|
|
28995
|
+
state2.setTokenReviewEditCursor((cursor) => Math.max(0, cursor - 1));
|
|
28540
28996
|
return true;
|
|
28541
28997
|
}
|
|
28542
28998
|
if (key.downArrow || input === "j") {
|
|
28543
|
-
|
|
28999
|
+
state2.setTokenReviewEditCursor((cursor) => Math.min(row.paths.length - 1, cursor + 1));
|
|
28544
29000
|
return true;
|
|
28545
29001
|
}
|
|
28546
29002
|
if (input === " " || key.return) {
|
|
28547
|
-
const path5 = row.paths[
|
|
28548
|
-
|
|
29003
|
+
const path5 = row.paths[state2.tokenReviewEditCursor];
|
|
29004
|
+
state2.setTokenReviewEditSelection((previous) => {
|
|
28549
29005
|
const next = new Set(previous);
|
|
28550
29006
|
if (next.has(path5) && next.size === 1) return next;
|
|
28551
29007
|
if (next.has(path5)) next.delete(path5);
|
|
@@ -28556,34 +29012,34 @@ function handleTokenReviewInput(input, key, state) {
|
|
|
28556
29012
|
}
|
|
28557
29013
|
}
|
|
28558
29014
|
if (key.escape) {
|
|
28559
|
-
|
|
29015
|
+
state2.setTokenReviewEditing(false);
|
|
28560
29016
|
return true;
|
|
28561
29017
|
}
|
|
28562
29018
|
return true;
|
|
28563
29019
|
}
|
|
28564
29020
|
if (key.upArrow || input === "k") {
|
|
28565
|
-
|
|
29021
|
+
state2.setTokenReviewRow((rowIndex) => Math.max(0, rowIndex - 1));
|
|
28566
29022
|
return true;
|
|
28567
29023
|
}
|
|
28568
29024
|
if (key.downArrow || input === "j") {
|
|
28569
|
-
|
|
29025
|
+
state2.setTokenReviewRow((rowIndex) => Math.min(Math.max(0, suggestions.length - 1), rowIndex + 1));
|
|
28570
29026
|
return true;
|
|
28571
29027
|
}
|
|
28572
29028
|
if (key.return && row) {
|
|
28573
|
-
|
|
28574
|
-
|
|
28575
|
-
|
|
29029
|
+
state2.setTokenReviewEditCursor(0);
|
|
29030
|
+
state2.setTokenReviewEditSelection(new Set(row.allowed));
|
|
29031
|
+
state2.setTokenReviewEditing(true);
|
|
28576
29032
|
return true;
|
|
28577
29033
|
}
|
|
28578
29034
|
if (key.escape || input === "t") {
|
|
28579
|
-
|
|
29035
|
+
state2.setPanelOpen("none");
|
|
28580
29036
|
return true;
|
|
28581
29037
|
}
|
|
28582
29038
|
return true;
|
|
28583
29039
|
}
|
|
28584
|
-
function setReviewPanel(
|
|
28585
|
-
|
|
28586
|
-
|
|
29040
|
+
function setReviewPanel(state2, panel) {
|
|
29041
|
+
state2.setPanelOpen(panel);
|
|
29042
|
+
state2.setPanelScrollOffset(() => 0);
|
|
28587
29043
|
}
|
|
28588
29044
|
function rationalePanelForInput(input, propKey, componentKey) {
|
|
28589
29045
|
if (input === propKey) return "prop-rationale";
|
|
@@ -28591,70 +29047,70 @@ function rationalePanelForInput(input, propKey, componentKey) {
|
|
|
28591
29047
|
if (input === "s") return "source";
|
|
28592
29048
|
return null;
|
|
28593
29049
|
}
|
|
28594
|
-
function handleRationalePanelInput(input, key,
|
|
28595
|
-
if (
|
|
28596
|
-
const next = computeNextScrollOffset(
|
|
29050
|
+
function handleRationalePanelInput(input, key, state2) {
|
|
29051
|
+
if (state2.panelOpen === "none" || state2.panelOpen === "token-review") return false;
|
|
29052
|
+
const next = computeNextScrollOffset(state2.panelScrollOffset, input, key, 9999, PANEL_CONTENT_HEIGHT);
|
|
28597
29053
|
if (next !== null) {
|
|
28598
|
-
|
|
29054
|
+
state2.setPanelScrollOffset(() => next);
|
|
28599
29055
|
return true;
|
|
28600
29056
|
}
|
|
28601
29057
|
if (key.escape) {
|
|
28602
|
-
setReviewPanel(
|
|
29058
|
+
setReviewPanel(state2, "none");
|
|
28603
29059
|
return true;
|
|
28604
29060
|
}
|
|
28605
29061
|
const togglable = !key.ctrl && !key.tab && !key.meta && !key.return;
|
|
28606
29062
|
if (!togglable) return true;
|
|
28607
|
-
const panel = rationalePanelForInput(input,
|
|
28608
|
-
if (panel) setReviewPanel(
|
|
29063
|
+
const panel = rationalePanelForInput(input, state2.propKey, state2.componentKey);
|
|
29064
|
+
if (panel) setReviewPanel(state2, state2.panelOpen === panel ? "none" : panel);
|
|
28609
29065
|
return true;
|
|
28610
29066
|
}
|
|
28611
|
-
function handleReviewPanelShortcuts(input, key,
|
|
28612
|
-
if (handleTokenReviewInput(input, key,
|
|
28613
|
-
if (handleRationalePanelInput(input, key,
|
|
28614
|
-
const rationaleKeyOk = !
|
|
29067
|
+
function handleReviewPanelShortcuts(input, key, state2) {
|
|
29068
|
+
if (handleTokenReviewInput(input, key, state2)) return true;
|
|
29069
|
+
if (handleRationalePanelInput(input, key, state2)) return true;
|
|
29070
|
+
const rationaleKeyOk = !state2.textEntryActive && !state2.showJson && !key.ctrl && !key.tab && !key.meta && !key.return;
|
|
28615
29071
|
if (!rationaleKeyOk) return false;
|
|
28616
|
-
const panel = rationalePanelForInput(input,
|
|
29072
|
+
const panel = rationalePanelForInput(input, state2.propKey, state2.componentKey);
|
|
28617
29073
|
if (panel) {
|
|
28618
|
-
setReviewPanel(
|
|
29074
|
+
setReviewPanel(state2, panel);
|
|
28619
29075
|
return true;
|
|
28620
29076
|
}
|
|
28621
|
-
if (input === "t" &&
|
|
28622
|
-
|
|
28623
|
-
|
|
29077
|
+
if (input === "t" && state2.currentTokenSuggestions().length > 0) {
|
|
29078
|
+
state2.setPanelOpen("token-review");
|
|
29079
|
+
state2.setTokenReviewRow(0);
|
|
28624
29080
|
return true;
|
|
28625
29081
|
}
|
|
28626
29082
|
return false;
|
|
28627
29083
|
}
|
|
28628
|
-
function handleReviewViewToggleInput(input,
|
|
29084
|
+
function handleReviewViewToggleInput(input, state2) {
|
|
28629
29085
|
if (input === "J") {
|
|
28630
|
-
|
|
28631
|
-
|
|
28632
|
-
|
|
29086
|
+
state2.setShowJson((previous) => !previous);
|
|
29087
|
+
state2.setJsonScrollOffset(0);
|
|
29088
|
+
state2.pendingGRef.current = false;
|
|
28633
29089
|
return true;
|
|
28634
29090
|
}
|
|
28635
29091
|
return false;
|
|
28636
29092
|
}
|
|
28637
|
-
function handleJsonPanelInput(input, key,
|
|
28638
|
-
if (
|
|
28639
|
-
const totalLines =
|
|
28640
|
-
const maxOffset = Math.max(0, totalLines -
|
|
29093
|
+
function handleJsonPanelInput(input, key, state2) {
|
|
29094
|
+
if (state2.sidebarFocused || !state2.showJson) return false;
|
|
29095
|
+
const totalLines = state2.jsonValue.split("\n").length;
|
|
29096
|
+
const maxOffset = Math.max(0, totalLines - state2.height);
|
|
28641
29097
|
if (input === "g" && !key.ctrl) {
|
|
28642
|
-
if (
|
|
28643
|
-
|
|
28644
|
-
|
|
29098
|
+
if (state2.pendingGRef.current) {
|
|
29099
|
+
state2.pendingGRef.current = false;
|
|
29100
|
+
state2.setJsonScrollOffset(() => 0);
|
|
28645
29101
|
return true;
|
|
28646
29102
|
}
|
|
28647
|
-
|
|
29103
|
+
state2.pendingGRef.current = true;
|
|
28648
29104
|
return true;
|
|
28649
29105
|
}
|
|
28650
|
-
const next = computeNextScrollOffset(
|
|
29106
|
+
const next = computeNextScrollOffset(state2.jsonScrollOffset, input, key, totalLines, state2.height);
|
|
28651
29107
|
if (next !== null) {
|
|
28652
|
-
|
|
29108
|
+
state2.pendingGRef.current = false;
|
|
28653
29109
|
const clamped = Math.min(maxOffset, Math.max(0, next));
|
|
28654
|
-
|
|
29110
|
+
state2.setJsonScrollOffset(() => clamped);
|
|
28655
29111
|
return true;
|
|
28656
29112
|
}
|
|
28657
|
-
|
|
29113
|
+
state2.pendingGRef.current = false;
|
|
28658
29114
|
return true;
|
|
28659
29115
|
}
|
|
28660
29116
|
var PANEL_CONTENT_HEIGHT;
|
|
@@ -30205,7 +30661,7 @@ var init_generate_review_step = __esm({
|
|
|
30205
30661
|
init_windowed_panel();
|
|
30206
30662
|
init_ReviewComponentPanel();
|
|
30207
30663
|
init_ReviewStatus();
|
|
30208
|
-
|
|
30664
|
+
init_session3();
|
|
30209
30665
|
init_use_review_session();
|
|
30210
30666
|
init_use_review_editor();
|
|
30211
30667
|
init_use_review_surface_state();
|
|
@@ -31182,38 +31638,38 @@ var init_run_teaser = __esm({
|
|
|
31182
31638
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
|
|
31183
31639
|
import { Box as Box41 } from "ink";
|
|
31184
31640
|
import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
31185
|
-
function totalStepsFor(
|
|
31186
|
-
const hasTokenStage = !!
|
|
31187
|
-
return 3 + (hasTokenStage ? 1 : 0) + 2 + (
|
|
31641
|
+
function totalStepsFor(state2) {
|
|
31642
|
+
const hasTokenStage = !!state2.tokensPath || !!state2.rawTokensPath;
|
|
31643
|
+
return 3 + (hasTokenStage ? 1 : 0) + 2 + (state2.mapTokensEligible === true ? 1 : 0);
|
|
31188
31644
|
}
|
|
31189
31645
|
function canEditFromPreview(cdf) {
|
|
31190
31646
|
if (!cdf) return false;
|
|
31191
31647
|
return parseCDFComponents(cdf).components.length > 0;
|
|
31192
31648
|
}
|
|
31193
31649
|
function FlowScreen({
|
|
31194
|
-
state,
|
|
31650
|
+
state: state2,
|
|
31195
31651
|
controller,
|
|
31196
31652
|
livePreview = true,
|
|
31197
31653
|
generatePromptPath,
|
|
31198
31654
|
onExit
|
|
31199
31655
|
}) {
|
|
31200
|
-
const totalSteps = totalStepsFor(
|
|
31656
|
+
const totalSteps = totalStepsFor(state2);
|
|
31201
31657
|
const quit = () => onExit(0);
|
|
31202
31658
|
const content = (() => {
|
|
31203
|
-
switch (
|
|
31659
|
+
switch (state2.step) {
|
|
31204
31660
|
case "final-review":
|
|
31205
31661
|
return /* @__PURE__ */ jsx52(
|
|
31206
31662
|
GenerateReviewStep,
|
|
31207
31663
|
{
|
|
31208
|
-
extractSessionId:
|
|
31209
|
-
tokenSessionId:
|
|
31664
|
+
extractSessionId: state2.extractSessionId,
|
|
31665
|
+
tokenSessionId: state2.tokenSessionId,
|
|
31210
31666
|
livePreview,
|
|
31211
|
-
spaceId:
|
|
31212
|
-
environmentId:
|
|
31213
|
-
cmaToken:
|
|
31214
|
-
host:
|
|
31215
|
-
tokensPath:
|
|
31216
|
-
initialFinalizeError:
|
|
31667
|
+
spaceId: state2.spaceId,
|
|
31668
|
+
environmentId: state2.environmentId,
|
|
31669
|
+
cmaToken: state2.cmaToken,
|
|
31670
|
+
host: state2.host,
|
|
31671
|
+
tokensPath: state2.tokensPath,
|
|
31672
|
+
initialFinalizeError: state2.finalizeErrorBanner,
|
|
31217
31673
|
onFinalize: controller.finalize,
|
|
31218
31674
|
onQuit: quit
|
|
31219
31675
|
}
|
|
@@ -31229,27 +31685,27 @@ function FlowScreen({
|
|
|
31229
31685
|
}
|
|
31230
31686
|
);
|
|
31231
31687
|
case "preview-gate":
|
|
31232
|
-
if (!
|
|
31688
|
+
if (!state2.serverPreview) return null;
|
|
31233
31689
|
return /* @__PURE__ */ jsx52(
|
|
31234
31690
|
WizardPreviewStep,
|
|
31235
31691
|
{
|
|
31236
|
-
preview:
|
|
31237
|
-
spaceId:
|
|
31238
|
-
environmentId:
|
|
31692
|
+
preview: state2.serverPreview,
|
|
31693
|
+
spaceId: state2.spaceId,
|
|
31694
|
+
environmentId: state2.environmentId,
|
|
31239
31695
|
stepNumber: totalSteps,
|
|
31240
31696
|
totalSteps,
|
|
31241
31697
|
onConfirm: controller.confirmPreview,
|
|
31242
|
-
...canEditFromPreview(
|
|
31698
|
+
...canEditFromPreview(state2.cdf) ? { onEdit: controller.editDefinitions } : {},
|
|
31243
31699
|
onQuit: quit
|
|
31244
31700
|
}
|
|
31245
31701
|
);
|
|
31246
31702
|
case "pushing":
|
|
31247
|
-
return /* @__PURE__ */ jsx52(PushingStep, { stepNumber: totalSteps, totalSteps, progress:
|
|
31703
|
+
return /* @__PURE__ */ jsx52(PushingStep, { stepNumber: totalSteps, totalSteps, progress: state2.pushProgress });
|
|
31248
31704
|
case "path-prompt":
|
|
31249
31705
|
return /* @__PURE__ */ jsx52(
|
|
31250
31706
|
PathPrompt,
|
|
31251
31707
|
{
|
|
31252
|
-
defaultPath:
|
|
31708
|
+
defaultPath: state2.outDir,
|
|
31253
31709
|
onSubmit: (submitted) => void controller.submitPath(submitted),
|
|
31254
31710
|
onCancel: quit
|
|
31255
31711
|
}
|
|
@@ -31265,12 +31721,12 @@ function FlowScreen({
|
|
|
31265
31721
|
}
|
|
31266
31722
|
);
|
|
31267
31723
|
case "print-gate": {
|
|
31268
|
-
const teaser = buildRunTeaserLine(
|
|
31724
|
+
const teaser = buildRunTeaserLine(state2.lastRunId);
|
|
31269
31725
|
return /* @__PURE__ */ jsx52(
|
|
31270
31726
|
GateStep,
|
|
31271
31727
|
{
|
|
31272
31728
|
message: "Files saved",
|
|
31273
|
-
summary:
|
|
31729
|
+
summary: state2.componentsPath ? `components.json \u2192 ${state2.componentsPath}` : void 0,
|
|
31274
31730
|
context: teaser ? `Your files are saved to disk. ${teaser}` : "Your files are saved to disk. Run `experiences import` again when you're ready to push to Contentful.",
|
|
31275
31731
|
continueLabel: "Exit",
|
|
31276
31732
|
onContinue: quit,
|
|
@@ -31279,17 +31735,17 @@ function FlowScreen({
|
|
|
31279
31735
|
);
|
|
31280
31736
|
}
|
|
31281
31737
|
case "done": {
|
|
31282
|
-
const totalFailed =
|
|
31738
|
+
const totalFailed = state2.pushResult.componentTypes.failed + state2.pushResult.designTokens.failed;
|
|
31283
31739
|
return /* @__PURE__ */ jsx52(
|
|
31284
31740
|
DoneStep,
|
|
31285
31741
|
{
|
|
31286
|
-
componentTypes:
|
|
31287
|
-
designTokens:
|
|
31288
|
-
summary:
|
|
31289
|
-
failures:
|
|
31290
|
-
spaceId:
|
|
31291
|
-
environmentId:
|
|
31292
|
-
host:
|
|
31742
|
+
componentTypes: state2.pushResult.componentTypes,
|
|
31743
|
+
designTokens: state2.pushResult.designTokens,
|
|
31744
|
+
summary: state2.pushResult.summary,
|
|
31745
|
+
failures: state2.pushResult.failures,
|
|
31746
|
+
spaceId: state2.spaceId,
|
|
31747
|
+
environmentId: state2.environmentId,
|
|
31748
|
+
host: state2.host,
|
|
31293
31749
|
onExit: () => onExit(totalFailed > 0 ? 1 : 0)
|
|
31294
31750
|
}
|
|
31295
31751
|
);
|
|
@@ -31298,8 +31754,8 @@ function FlowScreen({
|
|
|
31298
31754
|
return /* @__PURE__ */ jsx52(
|
|
31299
31755
|
PreviewValidationErrorScreen,
|
|
31300
31756
|
{
|
|
31301
|
-
errors:
|
|
31302
|
-
missingNames:
|
|
31757
|
+
errors: state2.previewValidationErrors,
|
|
31758
|
+
missingNames: state2.previewValidationMissingNames,
|
|
31303
31759
|
onEdit: controller.editDefinitions,
|
|
31304
31760
|
onSkip: () => void controller.skipValidationErrors(),
|
|
31305
31761
|
onQuit: quit
|
|
@@ -31309,10 +31765,10 @@ function FlowScreen({
|
|
|
31309
31765
|
return /* @__PURE__ */ jsx52(
|
|
31310
31766
|
ErrorStep,
|
|
31311
31767
|
{
|
|
31312
|
-
stepName:
|
|
31313
|
-
message:
|
|
31768
|
+
stepName: state2.errorStep,
|
|
31769
|
+
message: state2.errorMessage,
|
|
31314
31770
|
onExit: () => onExit(1),
|
|
31315
|
-
onAcknowledgeBreakingChanges:
|
|
31771
|
+
onAcknowledgeBreakingChanges: state2.errorAllowBreakingChangeAcknowledgment && state2.cdf ? controller.acknowledgeBreakingChanges : void 0
|
|
31316
31772
|
}
|
|
31317
31773
|
);
|
|
31318
31774
|
}
|
|
@@ -31339,8 +31795,8 @@ var init_screen10 = __esm({
|
|
|
31339
31795
|
});
|
|
31340
31796
|
|
|
31341
31797
|
// packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/wizard-state-transitions.ts
|
|
31342
|
-
function shouldBypassPreview(
|
|
31343
|
-
return
|
|
31798
|
+
function shouldBypassPreview(state2) {
|
|
31799
|
+
return state2.credentialsSkipped === true;
|
|
31344
31800
|
}
|
|
31345
31801
|
function buildSkippedPreviewTransition() {
|
|
31346
31802
|
return { step: "done", serverPreview: null };
|
|
@@ -31349,8 +31805,8 @@ function resolveCycleGateAction(opts) {
|
|
|
31349
31805
|
if (!opts.hasCycles) return "proceed";
|
|
31350
31806
|
return "block";
|
|
31351
31807
|
}
|
|
31352
|
-
function shouldRefusePush(
|
|
31353
|
-
return
|
|
31808
|
+
function shouldRefusePush(state2) {
|
|
31809
|
+
return state2.credentialsSkipped === true;
|
|
31354
31810
|
}
|
|
31355
31811
|
function buildSkippedPushTransition() {
|
|
31356
31812
|
return { step: "print-gate" };
|
|
@@ -31378,6 +31834,7 @@ function clearedValidationErrorState() {
|
|
|
31378
31834
|
}
|
|
31379
31835
|
async function runPreview(input, deps) {
|
|
31380
31836
|
if (shouldBypassPreview(input.state)) return buildSkippedPreviewTransition();
|
|
31837
|
+
setCommandContext({ space_key: input.spaceId, environment_key: input.environmentId });
|
|
31381
31838
|
try {
|
|
31382
31839
|
const client2 = deps.createClient({
|
|
31383
31840
|
cmaToken: input.cmaToken,
|
|
@@ -31426,6 +31883,7 @@ async function runPreview(input, deps) {
|
|
|
31426
31883
|
db.close();
|
|
31427
31884
|
}
|
|
31428
31885
|
}
|
|
31886
|
+
recordContentfulContext(client2, input.spaceId, input.environmentId);
|
|
31429
31887
|
if (isEmptyPreview(preview)) {
|
|
31430
31888
|
return {
|
|
31431
31889
|
step: "done",
|
|
@@ -31596,6 +32054,7 @@ async function runPush(input, deps, onPatch) {
|
|
|
31596
32054
|
} catch (logErr) {
|
|
31597
32055
|
safeLog(deps, { pollLogError: String(logErr) });
|
|
31598
32056
|
}
|
|
32057
|
+
recordApplyOutcome(client2, input.spaceId, input.environmentId, operation);
|
|
31599
32058
|
const pushResult = resultOf(operation, preview);
|
|
31600
32059
|
const pushSucceeded = pushResult.componentTypes.failed === 0 && pushResult.designTokens.failed === 0 && operation.sys.status !== "failed";
|
|
31601
32060
|
if (pushSucceeded && input.state.lastRunId) {
|
|
@@ -31763,17 +32222,17 @@ async function runPrintFiles(input, deps, onPatch) {
|
|
|
31763
32222
|
return { ok: true, patch: nextStateAfterPrint({ skipGate: input.skipGate, componentsPath }) };
|
|
31764
32223
|
}
|
|
31765
32224
|
async function recordRun(input, deps) {
|
|
31766
|
-
const { state } = input;
|
|
32225
|
+
const { state: state2 } = input;
|
|
31767
32226
|
try {
|
|
31768
32227
|
let sourceFingerprint = null;
|
|
31769
32228
|
try {
|
|
31770
|
-
if (
|
|
32229
|
+
if (state2.extractSessionId) {
|
|
31771
32230
|
const db = deps.openDb();
|
|
31772
32231
|
try {
|
|
31773
32232
|
sourceFingerprint = await deps.buildSourceFingerprint({
|
|
31774
32233
|
db,
|
|
31775
|
-
extractSessionId:
|
|
31776
|
-
rawTokensPath:
|
|
32234
|
+
extractSessionId: state2.extractSessionId,
|
|
32235
|
+
rawTokensPath: state2.rawTokensPath || null
|
|
31777
32236
|
});
|
|
31778
32237
|
} finally {
|
|
31779
32238
|
db.close();
|
|
@@ -31784,16 +32243,16 @@ async function recordRun(input, deps) {
|
|
|
31784
32243
|
`);
|
|
31785
32244
|
}
|
|
31786
32245
|
const record3 = await deps.appendRun({
|
|
31787
|
-
projectPath:
|
|
32246
|
+
projectPath: state2.projectPath,
|
|
31788
32247
|
savePath: input.savePath,
|
|
31789
|
-
componentCount:
|
|
31790
|
-
tokenCount:
|
|
31791
|
-
tokensPath: (
|
|
31792
|
-
tokenSessionId:
|
|
31793
|
-
agent:
|
|
32248
|
+
componentCount: state2.generatedAcceptedCount || state2.generatedCount,
|
|
32249
|
+
tokenCount: state2.tokenCount,
|
|
32250
|
+
tokensPath: (state2.tokenSessionId ? state2.tokensPath || null : null) || null,
|
|
32251
|
+
tokenSessionId: state2.tokenSessionId,
|
|
32252
|
+
agent: state2.agent,
|
|
31794
32253
|
pushedTo: null,
|
|
31795
|
-
extractSessionId:
|
|
31796
|
-
generateSessionId:
|
|
32254
|
+
extractSessionId: state2.extractSessionId ?? "",
|
|
32255
|
+
generateSessionId: state2.generateSessionId,
|
|
31797
32256
|
sourceFingerprint
|
|
31798
32257
|
});
|
|
31799
32258
|
return record3.id;
|
|
@@ -31957,7 +32416,7 @@ function namesToSkip(errors) {
|
|
|
31957
32416
|
return [...new Set(errors.map((e) => e.componentName))];
|
|
31958
32417
|
}
|
|
31959
32418
|
function createFlowController(start, deps) {
|
|
31960
|
-
let
|
|
32419
|
+
let state2 = initialFlowState(start);
|
|
31961
32420
|
const listeners = /* @__PURE__ */ new Set();
|
|
31962
32421
|
let allowEmptyDeleteAll = false;
|
|
31963
32422
|
let pendingSave = {};
|
|
@@ -31966,27 +32425,27 @@ function createFlowController(start, deps) {
|
|
|
31966
32425
|
deps.log({ update: sanitizeForLog(patch) });
|
|
31967
32426
|
} catch {
|
|
31968
32427
|
}
|
|
31969
|
-
if (patch.step !== void 0 && patch.step !==
|
|
32428
|
+
if (patch.step !== void 0 && patch.step !== state2.step) {
|
|
31970
32429
|
try {
|
|
31971
32430
|
deps.beforeStepChange?.();
|
|
31972
32431
|
} catch {
|
|
31973
32432
|
}
|
|
31974
32433
|
}
|
|
31975
|
-
|
|
32434
|
+
state2 = { ...state2, ...patch };
|
|
31976
32435
|
for (const listener of listeners) listener();
|
|
31977
32436
|
};
|
|
31978
32437
|
const preview = async () => {
|
|
31979
|
-
if (!
|
|
32438
|
+
if (!state2.credentialsSkipped) update({ step: "previewing" });
|
|
31980
32439
|
update(
|
|
31981
32440
|
await runPreview(
|
|
31982
32441
|
{
|
|
31983
|
-
state,
|
|
31984
|
-
extractSessionId:
|
|
31985
|
-
tokensPath:
|
|
31986
|
-
spaceId:
|
|
31987
|
-
environmentId:
|
|
31988
|
-
cmaToken:
|
|
31989
|
-
host:
|
|
32442
|
+
state: state2,
|
|
32443
|
+
extractSessionId: state2.extractSessionId,
|
|
32444
|
+
tokensPath: state2.tokensPath,
|
|
32445
|
+
spaceId: state2.spaceId,
|
|
32446
|
+
environmentId: state2.environmentId,
|
|
32447
|
+
cmaToken: state2.cmaToken,
|
|
32448
|
+
host: state2.host,
|
|
31990
32449
|
deleteAll: allowEmptyDeleteAll
|
|
31991
32450
|
},
|
|
31992
32451
|
deps.preview
|
|
@@ -31994,18 +32453,18 @@ function createFlowController(start, deps) {
|
|
|
31994
32453
|
);
|
|
31995
32454
|
};
|
|
31996
32455
|
const push = async (acknowledgeBreakingChanges) => {
|
|
31997
|
-
if (!
|
|
32456
|
+
if (!state2.cdf) return;
|
|
31998
32457
|
update(
|
|
31999
32458
|
await runPush(
|
|
32000
32459
|
{
|
|
32001
|
-
state,
|
|
32002
|
-
cdf:
|
|
32003
|
-
spaceId:
|
|
32004
|
-
environmentId:
|
|
32005
|
-
cmaToken:
|
|
32006
|
-
host:
|
|
32460
|
+
state: state2,
|
|
32461
|
+
cdf: state2.cdf,
|
|
32462
|
+
spaceId: state2.spaceId,
|
|
32463
|
+
environmentId: state2.environmentId,
|
|
32464
|
+
cmaToken: state2.cmaToken,
|
|
32465
|
+
host: state2.host,
|
|
32007
32466
|
acknowledgeBreakingChanges,
|
|
32008
|
-
preview:
|
|
32467
|
+
preview: state2.serverPreview
|
|
32009
32468
|
},
|
|
32010
32469
|
deps.push,
|
|
32011
32470
|
update
|
|
@@ -32021,11 +32480,11 @@ function createFlowController(start, deps) {
|
|
|
32021
32480
|
const { skipGate, andPush } = pendingSave;
|
|
32022
32481
|
const written = await runPrintFiles(
|
|
32023
32482
|
{
|
|
32024
|
-
extractSessionId:
|
|
32483
|
+
extractSessionId: state2.extractSessionId,
|
|
32025
32484
|
outDir: path5,
|
|
32026
32485
|
...skipGate ? { skipGate: true } : {},
|
|
32027
|
-
...
|
|
32028
|
-
...
|
|
32486
|
+
...state2.tokenSessionId ? { tokenSessionId: state2.tokenSessionId } : {},
|
|
32487
|
+
...state2.tokensPath ? { tokensPath: state2.tokensPath } : {},
|
|
32029
32488
|
...allowEmptyDeleteAll ? { allowEmpty: true } : {}
|
|
32030
32489
|
},
|
|
32031
32490
|
deps.save,
|
|
@@ -32033,21 +32492,21 @@ function createFlowController(start, deps) {
|
|
|
32033
32492
|
);
|
|
32034
32493
|
update(written.patch);
|
|
32035
32494
|
if (!written.ok) return;
|
|
32036
|
-
const runId = await recordRun({ state, savePath: path5 }, deps.save);
|
|
32495
|
+
const runId = await recordRun({ state: state2, savePath: path5 }, deps.save);
|
|
32037
32496
|
if (runId) update({ lastRunId: runId });
|
|
32038
32497
|
if (andPush) await preview();
|
|
32039
32498
|
};
|
|
32040
32499
|
const detectAcceptedCycles = () => {
|
|
32041
|
-
if (!
|
|
32500
|
+
if (!state2.extractSessionId) return [];
|
|
32042
32501
|
try {
|
|
32043
|
-
const accepted = deps.loadAcceptedComponents(
|
|
32502
|
+
const accepted = deps.loadAcceptedComponents(state2.extractSessionId);
|
|
32044
32503
|
return findSlotCycles3(buildComponentGraph3(accepted));
|
|
32045
32504
|
} catch {
|
|
32046
32505
|
return [];
|
|
32047
32506
|
}
|
|
32048
32507
|
};
|
|
32049
32508
|
const begin = () => {
|
|
32050
|
-
if (!
|
|
32509
|
+
if (!state2.extractSessionId || !start.handoff.generation) {
|
|
32051
32510
|
update({
|
|
32052
32511
|
step: "error",
|
|
32053
32512
|
errorStep: "start import",
|
|
@@ -32064,7 +32523,7 @@ function createFlowController(start, deps) {
|
|
|
32064
32523
|
};
|
|
32065
32524
|
begin();
|
|
32066
32525
|
return {
|
|
32067
|
-
getState: () =>
|
|
32526
|
+
getState: () => state2,
|
|
32068
32527
|
subscribe: (listener) => {
|
|
32069
32528
|
listeners.add(listener);
|
|
32070
32529
|
return () => listeners.delete(listener);
|
|
@@ -32087,7 +32546,7 @@ function createFlowController(start, deps) {
|
|
|
32087
32546
|
},
|
|
32088
32547
|
async submitPath(submitted) {
|
|
32089
32548
|
await deps.mkdir(submitted);
|
|
32090
|
-
if (resolve25(submitted) !== resolve25(
|
|
32549
|
+
if (resolve25(submitted) !== resolve25(state2.outDir) && await deps.detectSaveConflict(submitted)) {
|
|
32091
32550
|
const subdir = deps.buildTimestampedSubdir(submitted);
|
|
32092
32551
|
await deps.mkdir(subdir);
|
|
32093
32552
|
await proceedToWrite(subdir);
|
|
@@ -32099,9 +32558,9 @@ function createFlowController(start, deps) {
|
|
|
32099
32558
|
acknowledgeBreakingChanges: () => void push(true),
|
|
32100
32559
|
editDefinitions: () => update({ step: "final-review" }),
|
|
32101
32560
|
async skipValidationErrors() {
|
|
32102
|
-
if (
|
|
32103
|
-
const names = namesToSkip(
|
|
32104
|
-
if (names.length > 0) await deps.rejectComponentsByName(
|
|
32561
|
+
if (state2.extractSessionId) {
|
|
32562
|
+
const names = namesToSkip(state2.previewValidationErrors);
|
|
32563
|
+
if (names.length > 0) await deps.rejectComponentsByName(state2.extractSessionId, names);
|
|
32105
32564
|
}
|
|
32106
32565
|
await preview();
|
|
32107
32566
|
}
|
|
@@ -32139,14 +32598,14 @@ function useFlow(start, options = {}) {
|
|
|
32139
32598
|
});
|
|
32140
32599
|
}
|
|
32141
32600
|
const current = controller.current;
|
|
32142
|
-
const
|
|
32601
|
+
const state2 = useSyncExternalStore(
|
|
32143
32602
|
(listener) => current?.subscribe(listener) ?? (() => void 0),
|
|
32144
32603
|
() => current?.getState()
|
|
32145
32604
|
);
|
|
32146
32605
|
useEffect20(() => {
|
|
32147
32606
|
if (!start) controller.current = void 0;
|
|
32148
32607
|
}, [start]);
|
|
32149
|
-
return current &&
|
|
32608
|
+
return current && state2 ? { controller: current, state: state2 } : void 0;
|
|
32150
32609
|
}
|
|
32151
32610
|
var init_use_flow = __esm({
|
|
32152
32611
|
"packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts"() {
|
|
@@ -32520,17 +32979,6 @@ var init_PageContainer3 = __esm({
|
|
|
32520
32979
|
}
|
|
32521
32980
|
});
|
|
32522
32981
|
|
|
32523
|
-
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
32524
|
-
var readV1Store, writeV1Store;
|
|
32525
|
-
var init_v1_store = __esm({
|
|
32526
|
-
"packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts"() {
|
|
32527
|
-
"use strict";
|
|
32528
|
-
init_config();
|
|
32529
|
-
readV1Store = readSettings2;
|
|
32530
|
-
writeV1Store = writeSettings2;
|
|
32531
|
-
}
|
|
32532
|
-
});
|
|
32533
|
-
|
|
32534
32982
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
32535
32983
|
async function readCredentials() {
|
|
32536
32984
|
const store = await readV1Store();
|
|
@@ -32753,27 +33201,6 @@ var init_ContentfulConfigScreen = __esm({
|
|
|
32753
33201
|
}
|
|
32754
33202
|
});
|
|
32755
33203
|
|
|
32756
|
-
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts
|
|
32757
|
-
async function readAnalyticsSetting() {
|
|
32758
|
-
const store = await readV1Store();
|
|
32759
|
-
const analyticsDisabled = store.analyticsDisabled;
|
|
32760
|
-
return { enabled: analyticsDisabled !== true };
|
|
32761
|
-
}
|
|
32762
|
-
async function writeAnalyticsSetting(setting) {
|
|
32763
|
-
const existing = await readV1Store();
|
|
32764
|
-
const updated = {
|
|
32765
|
-
...existing,
|
|
32766
|
-
analyticsDisabled: !setting.enabled
|
|
32767
|
-
};
|
|
32768
|
-
await writeV1Store(updated);
|
|
32769
|
-
}
|
|
32770
|
-
var init_analytics_store = __esm({
|
|
32771
|
-
"packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/analytics-store.ts"() {
|
|
32772
|
-
"use strict";
|
|
32773
|
-
init_v1_store();
|
|
32774
|
-
}
|
|
32775
|
-
});
|
|
32776
|
-
|
|
32777
33204
|
// packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
|
|
32778
33205
|
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
32779
33206
|
import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
|
|
@@ -33041,16 +33468,16 @@ function App({ importOptions, inkClear }) {
|
|
|
33041
33468
|
const finishCredentials = async (result, projectPath2, tokens, filePaths) => {
|
|
33042
33469
|
if (!result.skipped) await writeCredentials({ ...result.credentials });
|
|
33043
33470
|
const launch = { projectPath: projectPath2, tokens, filePaths, ...importOptions };
|
|
33044
|
-
const
|
|
33471
|
+
const state2 = await inspectTokens({
|
|
33045
33472
|
rawTokensPath: tokens,
|
|
33046
33473
|
contentfulDir: join27(resolveUserPath(projectPath2), ".contentful"),
|
|
33047
33474
|
cache: importOptions.cache
|
|
33048
33475
|
});
|
|
33049
|
-
if (
|
|
33476
|
+
if (state2.kind === "cached") {
|
|
33050
33477
|
setPendingLaunch({
|
|
33051
33478
|
launch,
|
|
33052
33479
|
credentials: result,
|
|
33053
|
-
cached: { tokensPath:
|
|
33480
|
+
cached: { tokensPath: state2.tokensPath, sourceChanged: state2.sourceChanged }
|
|
33054
33481
|
});
|
|
33055
33482
|
return;
|
|
33056
33483
|
}
|
|
@@ -33315,25 +33742,26 @@ var init_app = __esm({
|
|
|
33315
33742
|
});
|
|
33316
33743
|
|
|
33317
33744
|
// packages/experience-design-system-cli/program.ts
|
|
33745
|
+
init_src4();
|
|
33318
33746
|
import { readFileSync as readFileSync9 } from "node:fs";
|
|
33319
33747
|
import { join as join28 } from "node:path";
|
|
33320
33748
|
import { Command } from "commander";
|
|
33321
33749
|
|
|
33322
33750
|
// packages/experience-design-system-cli/src/legacy/run-legacy.ts
|
|
33323
|
-
import { spawn } from "node:child_process";
|
|
33751
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
33324
33752
|
|
|
33325
33753
|
// packages/experience-design-system-cli/src/legacy/legacy-cli-path.ts
|
|
33326
33754
|
init_package_root();
|
|
33327
|
-
import { existsSync as
|
|
33328
|
-
import { join as
|
|
33755
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
33756
|
+
import { join as join15 } from "node:path";
|
|
33329
33757
|
var PACKAGE_NAME = "@contentful/experience-design-system-cli";
|
|
33330
33758
|
function findLegacyCliPath() {
|
|
33331
33759
|
const root = findPackageRoot(import.meta.url, PACKAGE_NAME);
|
|
33332
33760
|
const candidates = [
|
|
33333
|
-
|
|
33334
|
-
|
|
33761
|
+
join15(root, "legacy", "bin", "cli.js"),
|
|
33762
|
+
join15(root, "..", "experience-design-system-cli-legacy", "bin", "cli.js")
|
|
33335
33763
|
];
|
|
33336
|
-
const found = candidates.find((candidate) =>
|
|
33764
|
+
const found = candidates.find((candidate) => existsSync8(candidate));
|
|
33337
33765
|
if (!found) {
|
|
33338
33766
|
throw new Error(`Legacy CLI not found. Looked in:
|
|
33339
33767
|
${candidates.join("\n")}`);
|
|
@@ -33353,7 +33781,7 @@ function runLegacy(args) {
|
|
|
33353
33781
|
resolvePromise(1);
|
|
33354
33782
|
return;
|
|
33355
33783
|
}
|
|
33356
|
-
const child =
|
|
33784
|
+
const child = spawn3("node", [cliPath, ...args], { stdio: "inherit" });
|
|
33357
33785
|
child.on("close", (code) => resolvePromise(code ?? 1));
|
|
33358
33786
|
child.on("error", (err) => {
|
|
33359
33787
|
process.stderr.write(`${err.message}
|
|
@@ -33406,22 +33834,22 @@ function toImportOptions(raw) {
|
|
|
33406
33834
|
|
|
33407
33835
|
// packages/experience-design-system-cli/src/commands/watch.ts
|
|
33408
33836
|
init_package_root();
|
|
33409
|
-
import { spawn as
|
|
33410
|
-
import { existsSync as
|
|
33411
|
-
import { join as
|
|
33837
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
33838
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
33839
|
+
import { join as join16 } from "node:path";
|
|
33412
33840
|
var PACKAGE_NAME2 = "@contentful/experience-design-system-cli";
|
|
33413
33841
|
function extractWatchFlag(args) {
|
|
33414
33842
|
const rest = args.filter((arg) => arg !== "--watch");
|
|
33415
33843
|
return { watch: rest.length !== args.length, rest };
|
|
33416
33844
|
}
|
|
33417
33845
|
function runDevWatch(args) {
|
|
33418
|
-
const script =
|
|
33419
|
-
if (!
|
|
33846
|
+
const script = join16(findPackageRoot(import.meta.url, PACKAGE_NAME2), "scripts", "dev.mjs");
|
|
33847
|
+
if (!existsSync9(script)) {
|
|
33420
33848
|
process.stderr.write("--watch only works from a checkout of the repo (scripts/dev.mjs is not in the package).\n");
|
|
33421
33849
|
return Promise.resolve(1);
|
|
33422
33850
|
}
|
|
33423
33851
|
return new Promise((resolve27) => {
|
|
33424
|
-
const child =
|
|
33852
|
+
const child = spawn4(process.execPath, [script, ...args], { stdio: "inherit" });
|
|
33425
33853
|
process.on("SIGINT", () => void 0);
|
|
33426
33854
|
child.on("exit", (code) => resolve27(code ?? 0));
|
|
33427
33855
|
child.on("error", (err) => {
|
|
@@ -33449,6 +33877,7 @@ function registerImportCommand(program, openTui) {
|
|
|
33449
33877
|
}
|
|
33450
33878
|
|
|
33451
33879
|
// packages/experience-design-system-cli/program.ts
|
|
33880
|
+
init_analytics_store();
|
|
33452
33881
|
init_package_root();
|
|
33453
33882
|
var pkg = JSON.parse(
|
|
33454
33883
|
readFileSync9(
|
|
@@ -33464,6 +33893,27 @@ function createProgram() {
|
|
|
33464
33893
|
await runApp2(render, options);
|
|
33465
33894
|
});
|
|
33466
33895
|
registerForwardedCommands(program);
|
|
33896
|
+
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
33897
|
+
const chain = [];
|
|
33898
|
+
for (let c2 = actionCommand; c2 && c2.parent; c2 = c2.parent) chain.unshift(c2.name());
|
|
33899
|
+
const commandChain = chain.join(" ") || actionCommand.name();
|
|
33900
|
+
const { enabled } = await readAnalyticsSetting();
|
|
33901
|
+
setPersistedAnalyticsDisabled(!enabled);
|
|
33902
|
+
setCliVersion(pkg.version);
|
|
33903
|
+
noteCommandStart(commandChain);
|
|
33904
|
+
});
|
|
33905
|
+
program.hook("postAction", async () => {
|
|
33906
|
+
await completeActiveCommand();
|
|
33907
|
+
await flushAnalytics();
|
|
33908
|
+
});
|
|
33909
|
+
process.on("unhandledRejection", async (error) => {
|
|
33910
|
+
await failActiveCommand({
|
|
33911
|
+
error_name: error instanceof Error ? error.name : "UnhandledRejection",
|
|
33912
|
+
exit_code: 1
|
|
33913
|
+
});
|
|
33914
|
+
await flushAnalytics();
|
|
33915
|
+
process.exit(1);
|
|
33916
|
+
});
|
|
33467
33917
|
return program;
|
|
33468
33918
|
}
|
|
33469
33919
|
|