@contentful/experience-design-system-cli 2.37.1-dev-build-979aba4b.0 → 2.37.1-dev-build-eeb53912.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 +2939 -717
- package/dist/index.js +4604 -243
- package/dist/package.json +5 -2
- package/dist/src/tui/home/home.theme.d.ts +1 -2
- package/dist/src/tui/import/steps/04-credentials/logic.d.ts +0 -3
- package/dist/src/tui/import/steps/04-credentials/validate.d.ts +1 -1
- package/legacy/dist/src/analyze/select/tui/components/ScrollablePanel.d.ts +2 -2
- package/legacy/dist/src/analyze/select/tui/theme.d.ts +1 -1
- package/legacy/dist/src/index.js +378 -389
- package/legacy/package.json +5 -2
- package/package.json +5 -2
package/dist/app.js
CHANGED
|
@@ -1,513 +1,1389 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
5
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
6
|
-
import { Box, Text as Text2, useApp, useInput } from "ink";
|
|
7
|
-
|
|
8
|
-
// packages/experience-design-system-cli/src/tui/home/home.theme.ts
|
|
9
|
-
var BRAND = {
|
|
10
|
-
blue: "#1773EB",
|
|
11
|
-
green: "#00C459",
|
|
12
|
-
orange: "#E44F20",
|
|
13
|
-
yellow: "#FFDA00",
|
|
14
|
-
white: "#FFFFFF",
|
|
15
|
-
slate: "#A6B5C7",
|
|
16
|
-
steel: "#C4D1DE",
|
|
17
|
-
mist: "#DDE5EC",
|
|
18
|
-
fog: "#EFF2F6"
|
|
19
|
-
};
|
|
20
|
-
var PALETTE = {
|
|
21
|
-
accent: BRAND.blue,
|
|
22
|
-
heading: BRAND.white,
|
|
23
|
-
success: BRAND.green,
|
|
24
|
-
error: BRAND.orange,
|
|
25
|
-
warning: BRAND.yellow,
|
|
26
|
-
muted: BRAND.slate,
|
|
27
|
-
border: BRAND.steel
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
28
4
|
};
|
|
29
|
-
var BRAND_RAMP = [BRAND.blue, BRAND.orange, BRAND.yellow];
|
|
30
|
-
var BAR_CELL = "\u2501";
|
|
31
|
-
function brandBar(width, ramp = BRAND_RAMP) {
|
|
32
|
-
if (width <= 0 || ramp.length === 0) return [];
|
|
33
|
-
const base = Math.floor(width / ramp.length);
|
|
34
|
-
const remainder = width % ramp.length;
|
|
35
|
-
return ramp.map((color, i) => ({
|
|
36
|
-
text: BAR_CELL.repeat(base + (i < remainder ? 1 : 0)),
|
|
37
|
-
color
|
|
38
|
-
})).filter((segment) => segment.text.length > 0);
|
|
39
|
-
}
|
|
40
|
-
var FOCUS_MARKER = "\u276F";
|
|
41
|
-
|
|
42
|
-
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
43
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
44
|
-
import { join as join2 } from "node:path";
|
|
45
|
-
import semver from "semver";
|
|
46
5
|
|
|
47
|
-
// packages/experience-design-system-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
6
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/constants/vocabularies.js
|
|
7
|
+
var CDF_PROPERTY_TYPES, CDF_PROPERTY_CATEGORIES;
|
|
8
|
+
var init_vocabularies = __esm({
|
|
9
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/constants/vocabularies.js"() {
|
|
10
|
+
"use strict";
|
|
11
|
+
CDF_PROPERTY_TYPES = [
|
|
12
|
+
"string",
|
|
13
|
+
"richtext",
|
|
14
|
+
"number",
|
|
15
|
+
"media",
|
|
16
|
+
"link",
|
|
17
|
+
"enum",
|
|
18
|
+
"token",
|
|
19
|
+
"boolean"
|
|
20
|
+
];
|
|
21
|
+
CDF_PROPERTY_CATEGORIES = ["content", "design", "state", "unattached"];
|
|
63
22
|
}
|
|
64
|
-
}
|
|
23
|
+
});
|
|
65
24
|
|
|
66
|
-
// packages/experience-design-system-
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const latest = versions.reduce((best, v) => semver.gt(v, best) ? v : best);
|
|
87
|
-
if (!semver.valid(current)) return { status: "error" };
|
|
88
|
-
if (semver.gt(latest, current)) {
|
|
89
|
-
return { status: "update-available", current, latest };
|
|
90
|
-
}
|
|
91
|
-
return { status: "up-to-date", current };
|
|
92
|
-
} catch {
|
|
93
|
-
return { status: "error" };
|
|
25
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/constants/token-types.js
|
|
26
|
+
var DESIGN_TOKEN_TYPES;
|
|
27
|
+
var init_token_types = __esm({
|
|
28
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/constants/token-types.js"() {
|
|
29
|
+
"use strict";
|
|
30
|
+
DESIGN_TOKEN_TYPES = [
|
|
31
|
+
"color",
|
|
32
|
+
"dimension",
|
|
33
|
+
"fontFamily",
|
|
34
|
+
"fontWeight",
|
|
35
|
+
"duration",
|
|
36
|
+
"cubicBezier",
|
|
37
|
+
"number",
|
|
38
|
+
"strokeStyle",
|
|
39
|
+
"border",
|
|
40
|
+
"transition",
|
|
41
|
+
"shadow",
|
|
42
|
+
"gradient",
|
|
43
|
+
"typography"
|
|
44
|
+
];
|
|
94
45
|
}
|
|
95
|
-
}
|
|
46
|
+
});
|
|
96
47
|
|
|
97
|
-
// packages/experience-design-system-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
48
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/constants/schema.js
|
|
49
|
+
var CDF_SCHEMA_URL, cdfJsonSchema;
|
|
50
|
+
var init_schema = __esm({
|
|
51
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/constants/schema.js"() {
|
|
52
|
+
"use strict";
|
|
53
|
+
init_vocabularies();
|
|
54
|
+
init_token_types();
|
|
55
|
+
CDF_SCHEMA_URL = "https://contentful.com/schemas/cdf";
|
|
56
|
+
cdfJsonSchema = {
|
|
57
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
58
|
+
$id: CDF_SCHEMA_URL,
|
|
59
|
+
title: "CDF Component + Design Token Definition Format",
|
|
60
|
+
type: "object",
|
|
61
|
+
required: ["$schema"],
|
|
62
|
+
properties: {
|
|
63
|
+
$schema: { type: "string", const: CDF_SCHEMA_URL }
|
|
64
|
+
},
|
|
65
|
+
additionalProperties: { $ref: "#/definitions/groupOrEntry" },
|
|
66
|
+
definitions: {
|
|
67
|
+
groupOrEntry: {
|
|
68
|
+
oneOf: [{ $ref: "#/definitions/component" }, { $ref: "#/definitions/token" }, { $ref: "#/definitions/group" }]
|
|
69
|
+
},
|
|
70
|
+
component: {
|
|
71
|
+
type: "object",
|
|
72
|
+
required: ["$type", "$properties"],
|
|
73
|
+
properties: {
|
|
74
|
+
$type: { type: "string", const: "component" },
|
|
75
|
+
$description: { type: "string" },
|
|
76
|
+
$properties: {
|
|
77
|
+
type: "object",
|
|
78
|
+
additionalProperties: { $ref: "#/definitions/property" }
|
|
79
|
+
},
|
|
80
|
+
$slots: {
|
|
81
|
+
type: "object",
|
|
82
|
+
additionalProperties: { $ref: "#/definitions/slot" }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
additionalProperties: false
|
|
86
|
+
},
|
|
87
|
+
property: {
|
|
88
|
+
type: "object",
|
|
89
|
+
required: ["$type", "$category"],
|
|
90
|
+
properties: {
|
|
91
|
+
$type: { type: "string", enum: [...CDF_PROPERTY_TYPES] },
|
|
92
|
+
$category: { type: "string", enum: [...CDF_PROPERTY_CATEGORIES] },
|
|
93
|
+
$description: { type: "string" },
|
|
94
|
+
$required: { type: "boolean" },
|
|
95
|
+
$default: {},
|
|
96
|
+
$values: { type: "array", items: { type: "string" } },
|
|
97
|
+
"$token.kind": { type: "string" },
|
|
98
|
+
"$token.allowed": { type: "array", items: { type: "string" } }
|
|
99
|
+
},
|
|
100
|
+
additionalProperties: false
|
|
101
|
+
},
|
|
102
|
+
slot: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
$description: { type: "string" },
|
|
106
|
+
$required: { type: "boolean" },
|
|
107
|
+
$allowedComponents: { type: "array", items: { type: "string" } }
|
|
108
|
+
},
|
|
109
|
+
additionalProperties: false
|
|
110
|
+
},
|
|
111
|
+
token: {
|
|
112
|
+
type: "object",
|
|
113
|
+
required: ["$type", "$value"],
|
|
114
|
+
properties: {
|
|
115
|
+
$type: { type: "string", enum: [...DESIGN_TOKEN_TYPES] },
|
|
116
|
+
$value: {},
|
|
117
|
+
$description: { type: "string" }
|
|
118
|
+
},
|
|
119
|
+
additionalProperties: false
|
|
120
|
+
},
|
|
121
|
+
group: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: { $description: { type: "string" } },
|
|
124
|
+
additionalProperties: { $ref: "#/definitions/groupOrEntry" }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
115
127
|
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
119
130
|
|
|
120
|
-
// packages/experience-design-system-
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/helpers/validate.js
|
|
132
|
+
import { Ajv } from "ajv";
|
|
133
|
+
var ajv, validate, TOKEN_TYPE_SET;
|
|
134
|
+
var init_validate = __esm({
|
|
135
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/helpers/validate.js"() {
|
|
136
|
+
"use strict";
|
|
137
|
+
init_schema();
|
|
138
|
+
init_token_types();
|
|
139
|
+
ajv = new Ajv({ allErrors: true });
|
|
140
|
+
validate = ajv.compile(cdfJsonSchema);
|
|
141
|
+
TOKEN_TYPE_SET = new Set(DESIGN_TOKEN_TYPES);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
126
144
|
|
|
127
|
-
// packages/experience-design-system-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
var SUBTITLE = "Let's import your design system into Contentful";
|
|
132
|
-
var MIN_TERMINAL_WIDTH = 164;
|
|
133
|
-
var START_ITEMS = [
|
|
134
|
-
{ label: "Import", screen: "import" },
|
|
135
|
-
{ label: "Upgrade Version", screen: "upgrade" },
|
|
136
|
-
{ label: "Settings", screen: "settings" },
|
|
137
|
-
{ label: "Help", screen: "help" }
|
|
138
|
-
];
|
|
139
|
-
function upgradeItemDisplay(upgradeCheck) {
|
|
140
|
-
if (upgradeCheck?.status === "update-available") {
|
|
141
|
-
return { label: `Upgrade Version (v${upgradeCheck.latest} available)`, color: PALETTE.warning };
|
|
145
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/types/agent-name.js
|
|
146
|
+
var init_agent_name = __esm({
|
|
147
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/types/agent-name.js"() {
|
|
148
|
+
"use strict";
|
|
142
149
|
}
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/types/agent-run.js
|
|
153
|
+
var init_agent_run = __esm({
|
|
154
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/types/agent-run.js"() {
|
|
155
|
+
"use strict";
|
|
145
156
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const terminalWidth = useTerminalWidth();
|
|
153
|
-
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
154
|
-
const upgradeDisabled = upgradeCheck?.status === "up-to-date";
|
|
155
|
-
useEffect2(() => {
|
|
156
|
-
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
157
|
-
}, []);
|
|
158
|
-
useInput((input, key) => {
|
|
159
|
-
if (input === "q" || key.escape) {
|
|
160
|
-
exit();
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (tooNarrow) return;
|
|
164
|
-
if (key.upArrow) {
|
|
165
|
-
setFocusIdx((i) => (i - 1 + START_ITEMS.length) % START_ITEMS.length);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (key.downArrow) {
|
|
169
|
-
setFocusIdx((i) => (i + 1) % START_ITEMS.length);
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (key.return) {
|
|
173
|
-
const item = START_ITEMS[focusIdx];
|
|
174
|
-
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
175
|
-
onNavigate(item.screen);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
if (tooNarrow) {
|
|
180
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
181
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.warning, children: "Terminal too small" }),
|
|
182
|
-
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: "Press q to quit, make your terminal full screen, then run experiences import again." })
|
|
183
|
-
] });
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/types/invoker.js
|
|
160
|
+
var init_invoker = __esm({
|
|
161
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/types/invoker.js"() {
|
|
162
|
+
"use strict";
|
|
184
163
|
}
|
|
185
|
-
|
|
186
|
-
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
187
|
-
/* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.heading, children: HEADING }),
|
|
188
|
-
/* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
|
|
189
|
-
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
190
|
-
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
191
|
-
"v",
|
|
192
|
-
VERSION
|
|
193
|
-
] })
|
|
194
|
-
] }),
|
|
195
|
-
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
196
|
-
const focused = i === focusIdx;
|
|
197
|
-
const isUpgradeItem = item.screen === "upgrade";
|
|
198
|
-
const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
|
|
199
|
-
const dimmed = isUpgradeItem && upgradeDisabled;
|
|
200
|
-
return /* @__PURE__ */ jsxs(
|
|
201
|
-
Text2,
|
|
202
|
-
{
|
|
203
|
-
bold: focused && !dimmed,
|
|
204
|
-
dimColor: dimmed,
|
|
205
|
-
color: focused && !dimmed ? PALETTE.accent : display.color,
|
|
206
|
-
children: [
|
|
207
|
-
focused ? `${FOCUS_MARKER} ` : " ",
|
|
208
|
-
display.label
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
item.label
|
|
212
|
-
);
|
|
213
|
-
}) }) }),
|
|
214
|
-
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
215
|
-
ControlHints,
|
|
216
|
-
{
|
|
217
|
-
hints: [
|
|
218
|
-
{ keys: "\u2191/\u2193", label: "move" },
|
|
219
|
-
{ keys: "\u23CE", label: "select" },
|
|
220
|
-
{ keys: "q", label: "quit" }
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
) })
|
|
224
|
-
] });
|
|
225
|
-
}
|
|
164
|
+
});
|
|
226
165
|
|
|
227
|
-
// packages/experience-design-system-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
onDone();
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
const isSuccess = exitCode === 0;
|
|
237
|
-
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
238
|
-
/* @__PURE__ */ jsx3(Text3, { bold: true, children: "Import" }),
|
|
239
|
-
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
240
|
-
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
241
|
-
"\u2717 Import failed: process exited with code ",
|
|
242
|
-
exitCode ?? "unknown"
|
|
243
|
-
] }),
|
|
244
|
-
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
245
|
-
/* @__PURE__ */ jsx3(Text3, { dimColor: true, children: "[Enter] Back to Start" })
|
|
246
|
-
] });
|
|
247
|
-
}
|
|
166
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/types/prompts.js
|
|
167
|
+
var init_prompts = __esm({
|
|
168
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/types/prompts.js"() {
|
|
169
|
+
"use strict";
|
|
170
|
+
}
|
|
171
|
+
});
|
|
248
172
|
|
|
249
|
-
// packages/experience-design-system-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
173
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/types/tool-calls.js
|
|
174
|
+
var init_tool_calls = __esm({
|
|
175
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/types/tool-calls.js"() {
|
|
176
|
+
"use strict";
|
|
177
|
+
}
|
|
178
|
+
});
|
|
253
179
|
|
|
254
|
-
// packages/experience-design-system-
|
|
255
|
-
|
|
180
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/types/index.js
|
|
181
|
+
var init_types = __esm({
|
|
182
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/types/index.js"() {
|
|
183
|
+
"use strict";
|
|
184
|
+
init_agent_name();
|
|
185
|
+
init_agent_run();
|
|
186
|
+
init_invoker();
|
|
187
|
+
init_prompts();
|
|
188
|
+
init_tool_calls();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
256
191
|
|
|
257
|
-
// packages/experience-design-system-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return projectPath === "" ? null : projectPath;
|
|
264
|
-
}
|
|
192
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/constants/models.js
|
|
193
|
+
var init_models = __esm({
|
|
194
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/constants/models.js"() {
|
|
195
|
+
"use strict";
|
|
196
|
+
}
|
|
197
|
+
});
|
|
265
198
|
|
|
266
|
-
// packages/experience-design-system-
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (shouldQuit(key)) onQuit();
|
|
274
|
-
});
|
|
275
|
-
}
|
|
199
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/is-agent-name.js
|
|
200
|
+
var init_is_agent_name = __esm({
|
|
201
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/is-agent-name.js"() {
|
|
202
|
+
"use strict";
|
|
203
|
+
init_agent_name();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
276
206
|
|
|
277
|
-
// packages/experience-design-system-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
284
|
-
{ label: "Step 4", description: "Review generated definitions" },
|
|
285
|
-
{ label: "Step 5", description: "Push to Contentful" }
|
|
286
|
-
];
|
|
287
|
-
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
288
|
-
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
289
|
-
useWelcomeControls(onQuit);
|
|
290
|
-
const submit = (value) => {
|
|
291
|
-
const path = toProjectPath(value);
|
|
292
|
-
if (path) onContinue(path);
|
|
293
|
-
};
|
|
294
|
-
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
295
|
-
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
296
|
-
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
297
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
298
|
-
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
299
|
-
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
300
|
-
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
301
|
-
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: item.description })
|
|
302
|
-
] }, item.label)),
|
|
303
|
-
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
304
|
-
] }),
|
|
305
|
-
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", marginTop: 1, children: [
|
|
306
|
-
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
307
|
-
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
308
|
-
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
309
|
-
/* @__PURE__ */ jsx4(Text4, { children: "Project path:" }),
|
|
310
|
-
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
311
|
-
] })
|
|
312
|
-
] }),
|
|
313
|
-
/* @__PURE__ */ jsx4(Box3, { marginTop: 1, gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { dimColor: true, children: [
|
|
314
|
-
"[",
|
|
315
|
-
control.keys,
|
|
316
|
-
"] ",
|
|
317
|
-
control.label
|
|
318
|
-
] }, control.keys)) })
|
|
319
|
-
] });
|
|
320
|
-
}
|
|
207
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/constants/binaries.js
|
|
208
|
+
var init_binaries = __esm({
|
|
209
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/constants/binaries.js"() {
|
|
210
|
+
"use strict";
|
|
211
|
+
}
|
|
212
|
+
});
|
|
321
213
|
|
|
322
|
-
// packages/experience-design-system-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
214
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-binary.js
|
|
215
|
+
var init_resolve_binary = __esm({
|
|
216
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-binary.js"() {
|
|
217
|
+
"use strict";
|
|
218
|
+
init_binaries();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
326
221
|
|
|
327
|
-
// packages/experience-design-system-
|
|
328
|
-
|
|
222
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/constants/bedrock.js
|
|
223
|
+
var init_bedrock = __esm({
|
|
224
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/constants/bedrock.js"() {
|
|
225
|
+
"use strict";
|
|
226
|
+
}
|
|
227
|
+
});
|
|
329
228
|
|
|
330
|
-
// packages/experience-design-system-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return tokenPath === "" ? null : tokenPath;
|
|
337
|
-
}
|
|
229
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/bedrock/with-bedrock-provider-prefix.js
|
|
230
|
+
var init_with_bedrock_provider_prefix = __esm({
|
|
231
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/bedrock/with-bedrock-provider-prefix.js"() {
|
|
232
|
+
"use strict";
|
|
233
|
+
}
|
|
234
|
+
});
|
|
338
235
|
|
|
339
|
-
// packages/experience-design-system-
|
|
340
|
-
var
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
236
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-agent-model.js
|
|
237
|
+
var init_resolve_agent_model = __esm({
|
|
238
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-agent-model.js"() {
|
|
239
|
+
"use strict";
|
|
240
|
+
init_bedrock();
|
|
241
|
+
init_models();
|
|
242
|
+
init_with_bedrock_provider_prefix();
|
|
243
|
+
}
|
|
244
|
+
});
|
|
349
245
|
|
|
350
|
-
// packages/experience-design-system-
|
|
351
|
-
|
|
246
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/bedrock/agent-supports-bedrock.js
|
|
247
|
+
var init_agent_supports_bedrock = __esm({
|
|
248
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/bedrock/agent-supports-bedrock.js"() {
|
|
249
|
+
"use strict";
|
|
250
|
+
init_bedrock();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
352
253
|
|
|
353
|
-
// packages/experience-design-system-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
function expandHome(value) {
|
|
361
|
-
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
362
|
-
}
|
|
363
|
-
function resolveUserPath(raw) {
|
|
364
|
-
return resolve(expandHome(stripQuotes(raw.trim())));
|
|
365
|
-
}
|
|
254
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-claude-args.js
|
|
255
|
+
var init_build_claude_args = __esm({
|
|
256
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-claude-args.js"() {
|
|
257
|
+
"use strict";
|
|
258
|
+
}
|
|
259
|
+
});
|
|
366
260
|
|
|
367
|
-
// packages/experience-design-system-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
stats = statSync(path);
|
|
373
|
-
} catch {
|
|
374
|
-
return { ok: false, error: `Path not found: ${path}`, resolvedPath: path };
|
|
261
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/bedrock/codex-bedrock-config-args.js
|
|
262
|
+
var init_codex_bedrock_config_args = __esm({
|
|
263
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/bedrock/codex-bedrock-config-args.js"() {
|
|
264
|
+
"use strict";
|
|
265
|
+
init_bedrock();
|
|
375
266
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-codex-args.js
|
|
270
|
+
var init_build_codex_args = __esm({
|
|
271
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-codex-args.js"() {
|
|
272
|
+
"use strict";
|
|
273
|
+
init_codex_bedrock_config_args();
|
|
382
274
|
}
|
|
383
|
-
|
|
384
|
-
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-copilot-args.js
|
|
278
|
+
var init_build_copilot_args = __esm({
|
|
279
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-copilot-args.js"() {
|
|
280
|
+
"use strict";
|
|
281
|
+
init_resolve_agent_model();
|
|
385
282
|
}
|
|
386
|
-
|
|
387
|
-
}
|
|
283
|
+
});
|
|
388
284
|
|
|
389
|
-
// packages/experience-design-system-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const change = (value) => {
|
|
396
|
-
setTokenPath(value);
|
|
397
|
-
setFailure(null);
|
|
398
|
-
};
|
|
399
|
-
const submit = (value) => {
|
|
400
|
-
const rawPath = toTokenPath(value);
|
|
401
|
-
if (!rawPath) {
|
|
402
|
-
setFailure({ error: "Enter the path to your token file." });
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
const check = validateTokenPath(rawPath);
|
|
406
|
-
if (check.ok) onConfirm(check.path);
|
|
407
|
-
else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
|
|
408
|
-
};
|
|
409
|
-
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
410
|
-
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
411
|
-
/* @__PURE__ */ jsx5(Text5, { dimColor: true, 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)." }),
|
|
412
|
-
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
413
|
-
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
414
|
-
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
415
|
-
/* @__PURE__ */ jsx5(Text5, { children: "Token path:" }),
|
|
416
|
-
/* @__PURE__ */ jsx5(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
|
|
417
|
-
] }),
|
|
418
|
-
failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
419
|
-
/* @__PURE__ */ jsxs4(Text5, { color: PALETTE.error, children: [
|
|
420
|
-
"\u2717 ",
|
|
421
|
-
failure.error
|
|
422
|
-
] }),
|
|
423
|
-
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
424
|
-
" Resolved to: ",
|
|
425
|
-
failure.resolvedPath
|
|
426
|
-
] })
|
|
427
|
-
] })
|
|
428
|
-
] }),
|
|
429
|
-
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { dimColor: true, children: [
|
|
430
|
-
"[",
|
|
431
|
-
control.keys,
|
|
432
|
-
"] ",
|
|
433
|
-
control.label
|
|
434
|
-
] }, control.keys)) })
|
|
435
|
-
] });
|
|
436
|
-
}
|
|
285
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-cursor-args.js
|
|
286
|
+
var init_build_cursor_args = __esm({
|
|
287
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-cursor-args.js"() {
|
|
288
|
+
"use strict";
|
|
289
|
+
}
|
|
290
|
+
});
|
|
437
291
|
|
|
438
|
-
// packages/experience-design-system-
|
|
439
|
-
|
|
440
|
-
|
|
292
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-opencode-args.js
|
|
293
|
+
var init_build_opencode_args = __esm({
|
|
294
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-args/build-opencode-args.js"() {
|
|
295
|
+
"use strict";
|
|
296
|
+
}
|
|
297
|
+
});
|
|
441
298
|
|
|
442
|
-
// packages/experience-design-system-
|
|
443
|
-
|
|
299
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-agent-args.js
|
|
300
|
+
var init_build_agent_args = __esm({
|
|
301
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/build-agent-args.js"() {
|
|
302
|
+
"use strict";
|
|
303
|
+
init_build_claude_args();
|
|
304
|
+
init_build_codex_args();
|
|
305
|
+
init_build_copilot_args();
|
|
306
|
+
init_build_cursor_args();
|
|
307
|
+
init_build_opencode_args();
|
|
308
|
+
init_resolve_agent_model();
|
|
309
|
+
}
|
|
310
|
+
});
|
|
444
311
|
|
|
445
|
-
// packages/experience-design-system-
|
|
446
|
-
var
|
|
447
|
-
"
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
"
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
var
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
312
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/describe-agent-failure.js
|
|
313
|
+
var init_describe_agent_failure = __esm({
|
|
314
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/describe-agent-failure.js"() {
|
|
315
|
+
"use strict";
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/extract-sentinel-output.js
|
|
320
|
+
var init_extract_sentinel_output = __esm({
|
|
321
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/extract-sentinel-output.js"() {
|
|
322
|
+
"use strict";
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js
|
|
327
|
+
var init_format_generate_progress_line = __esm({
|
|
328
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/format-generate-progress-line.js"() {
|
|
329
|
+
"use strict";
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/parse-agent-model.js
|
|
334
|
+
var init_parse_agent_model = __esm({
|
|
335
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/parse-agent-model.js"() {
|
|
336
|
+
"use strict";
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-agent.js
|
|
341
|
+
var init_resolve_agent = __esm({
|
|
342
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-agent.js"() {
|
|
343
|
+
"use strict";
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-model.js
|
|
348
|
+
var init_resolve_model = __esm({
|
|
349
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/resolve-model.js"() {
|
|
350
|
+
"use strict";
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/looks-like-path.js
|
|
355
|
+
var init_looks_like_path = __esm({
|
|
356
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/looks-like-path.js"() {
|
|
357
|
+
"use strict";
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/parse-prompt-overrides.js
|
|
362
|
+
var init_parse_prompt_overrides = __esm({
|
|
363
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/parse-prompt-overrides.js"() {
|
|
364
|
+
"use strict";
|
|
365
|
+
init_looks_like_path();
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js
|
|
370
|
+
var init_resolve_prompt_override = __esm({
|
|
371
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/prompt-overrides/resolve-prompt-override.js"() {
|
|
372
|
+
"use strict";
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/build-user-agent.js
|
|
377
|
+
var init_build_user_agent = __esm({
|
|
378
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/metadata/build-user-agent.js"() {
|
|
379
|
+
"use strict";
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/constants/tool-names.js
|
|
384
|
+
var init_tool_names = __esm({
|
|
385
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/constants/tool-names.js"() {
|
|
386
|
+
"use strict";
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/helpers/find-json-object-end.js
|
|
391
|
+
var init_find_json_object_end = __esm({
|
|
392
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/helpers/find-json-object-end.js"() {
|
|
393
|
+
"use strict";
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/helpers/read-tool-call-objects.js
|
|
398
|
+
var init_read_tool_call_objects = __esm({
|
|
399
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/helpers/read-tool-call-objects.js"() {
|
|
400
|
+
"use strict";
|
|
401
|
+
init_find_json_object_end();
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-select-tool-calls.js
|
|
406
|
+
var init_parse_select_tool_calls = __esm({
|
|
407
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-select-tool-calls.js"() {
|
|
408
|
+
"use strict";
|
|
409
|
+
init_tool_names();
|
|
410
|
+
init_read_tool_call_objects();
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-tool-calls.js
|
|
415
|
+
var init_parse_tool_calls = __esm({
|
|
416
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-tool-calls.js"() {
|
|
417
|
+
"use strict";
|
|
418
|
+
init_tool_names();
|
|
419
|
+
init_read_tool_call_objects();
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-token-tool-calls.js
|
|
424
|
+
var init_parse_token_tool_calls = __esm({
|
|
425
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-token-tool-calls.js"() {
|
|
426
|
+
"use strict";
|
|
427
|
+
init_tool_names();
|
|
428
|
+
init_read_tool_call_objects();
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/helpers/is-string-array.js
|
|
433
|
+
var init_is_string_array = __esm({
|
|
434
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/helpers/is-string-array.js"() {
|
|
435
|
+
"use strict";
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-map-token-prop-tool-calls.js
|
|
440
|
+
var init_parse_map_token_prop_tool_calls = __esm({
|
|
441
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/parsers/parse-map-token-prop-tool-calls.js"() {
|
|
442
|
+
"use strict";
|
|
443
|
+
init_is_string_array();
|
|
444
|
+
init_read_tool_call_objects();
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js
|
|
449
|
+
var init_run_agent = __esm({
|
|
450
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/services/run-agent.js"() {
|
|
451
|
+
"use strict";
|
|
452
|
+
init_bedrock();
|
|
453
|
+
init_build_agent_args();
|
|
454
|
+
init_resolve_binary();
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/check-agent-auth.js
|
|
459
|
+
var init_check_agent_auth = __esm({
|
|
460
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/services/check-agent-auth.js"() {
|
|
461
|
+
"use strict";
|
|
462
|
+
init_resolve_binary();
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/colors.js
|
|
467
|
+
function detectColorSupport() {
|
|
468
|
+
if (process.env["NO_COLOR"] !== void 0)
|
|
469
|
+
return false;
|
|
470
|
+
if (process.env["FORCE_COLOR"] !== void 0)
|
|
471
|
+
return true;
|
|
472
|
+
return process.stderr.isTTY === true;
|
|
473
|
+
}
|
|
474
|
+
var colorsEnabled, wrap, ansi;
|
|
475
|
+
var init_colors = __esm({
|
|
476
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/colors.js"() {
|
|
477
|
+
"use strict";
|
|
478
|
+
colorsEnabled = detectColorSupport();
|
|
479
|
+
wrap = (code) => (text) => colorsEnabled ? `\x1B[${code}m${text}\x1B[0m` : text;
|
|
480
|
+
ansi = {
|
|
481
|
+
green: wrap(32),
|
|
482
|
+
red: wrap(31),
|
|
483
|
+
cyan: wrap(36),
|
|
484
|
+
yellow: wrap(33),
|
|
485
|
+
dim: wrap(2),
|
|
486
|
+
bold: wrap(1)
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/format-tool-call.js
|
|
492
|
+
var init_format_tool_call = __esm({
|
|
493
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/format-tool-call.js"() {
|
|
494
|
+
"use strict";
|
|
495
|
+
init_colors();
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/output-formatter.js
|
|
500
|
+
var init_output_formatter = __esm({
|
|
501
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/output-formatter.js"() {
|
|
502
|
+
"use strict";
|
|
503
|
+
init_colors();
|
|
504
|
+
init_format_tool_call();
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/index.js
|
|
509
|
+
var init_output_formatter2 = __esm({
|
|
510
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/output-formatter/index.js"() {
|
|
511
|
+
"use strict";
|
|
512
|
+
init_output_formatter();
|
|
513
|
+
init_colors();
|
|
514
|
+
init_format_tool_call();
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/services/invoke-agent-with-output.js
|
|
519
|
+
var init_invoke_agent_with_output = __esm({
|
|
520
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/services/invoke-agent-with-output.js"() {
|
|
521
|
+
"use strict";
|
|
522
|
+
init_output_formatter2();
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/invoker/create-local-cli-agent-invoker.js
|
|
527
|
+
var init_create_local_cli_agent_invoker = __esm({
|
|
528
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/invoker/create-local-cli-agent-invoker.js"() {
|
|
529
|
+
"use strict";
|
|
530
|
+
init_check_agent_auth();
|
|
531
|
+
init_run_agent();
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/candidate-file.js
|
|
536
|
+
var init_candidate_file = __esm({
|
|
537
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/candidate-file.js"() {
|
|
538
|
+
"use strict";
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/types/types.js
|
|
543
|
+
import * as z from "zod/mini";
|
|
544
|
+
var CDFPropertySchema, CDFSlotSchema, CDFComponentSchema, CDFTokenSchema;
|
|
545
|
+
var init_types2 = __esm({
|
|
546
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/types/types.js"() {
|
|
547
|
+
"use strict";
|
|
548
|
+
init_vocabularies();
|
|
549
|
+
init_token_types();
|
|
550
|
+
CDFPropertySchema = z.strictObject({
|
|
551
|
+
$type: z.enum(CDF_PROPERTY_TYPES),
|
|
552
|
+
$category: z.enum(CDF_PROPERTY_CATEGORIES),
|
|
553
|
+
$description: z.optional(z.string()),
|
|
554
|
+
$required: z.optional(z.boolean()),
|
|
555
|
+
$default: z.optional(z.any()),
|
|
556
|
+
$values: z.optional(z.array(z.string())),
|
|
557
|
+
"$token.kind": z.optional(z.string()),
|
|
558
|
+
"$token.allowed": z.optional(z.array(z.string()))
|
|
559
|
+
});
|
|
560
|
+
CDFSlotSchema = z.strictObject({
|
|
561
|
+
$description: z.optional(z.string()),
|
|
562
|
+
$allowedComponents: z.optional(z.array(z.string())),
|
|
563
|
+
$required: z.optional(z.boolean())
|
|
564
|
+
});
|
|
565
|
+
CDFComponentSchema = z.strictObject({
|
|
566
|
+
$type: z.literal("component"),
|
|
567
|
+
$description: z.optional(z.string()),
|
|
568
|
+
$properties: z.record(z.string(), CDFPropertySchema),
|
|
569
|
+
$slots: z.optional(z.record(z.string(), CDFSlotSchema))
|
|
570
|
+
});
|
|
571
|
+
CDFTokenSchema = z.strictObject({
|
|
572
|
+
$type: z.enum(DESIGN_TOKEN_TYPES),
|
|
573
|
+
$value: z.unknown(),
|
|
574
|
+
$description: z.optional(z.string())
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/types/index.js
|
|
580
|
+
var init_types3 = __esm({
|
|
581
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/types/index.js"() {
|
|
582
|
+
"use strict";
|
|
583
|
+
init_types2();
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/constants/index.js
|
|
588
|
+
var init_constants = __esm({
|
|
589
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/constants/index.js"() {
|
|
590
|
+
"use strict";
|
|
591
|
+
init_schema();
|
|
592
|
+
init_vocabularies();
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/helpers/build.js
|
|
597
|
+
var init_build = __esm({
|
|
598
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/helpers/build.js"() {
|
|
599
|
+
"use strict";
|
|
600
|
+
init_schema();
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/helpers/index.js
|
|
605
|
+
var init_helpers = __esm({
|
|
606
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/helpers/index.js"() {
|
|
607
|
+
"use strict";
|
|
608
|
+
init_build();
|
|
609
|
+
init_validate();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/index.js
|
|
614
|
+
var init_cdf = __esm({
|
|
615
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/index.js"() {
|
|
616
|
+
"use strict";
|
|
617
|
+
init_types3();
|
|
618
|
+
init_constants();
|
|
619
|
+
init_helpers();
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/types/types.js
|
|
624
|
+
import * as z2 from "zod/mini";
|
|
625
|
+
var DTCGTokenSchema;
|
|
626
|
+
var init_types4 = __esm({
|
|
627
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/types/types.js"() {
|
|
628
|
+
"use strict";
|
|
629
|
+
init_token_types();
|
|
630
|
+
DTCGTokenSchema = z2.strictObject({
|
|
631
|
+
path: z2.string(),
|
|
632
|
+
$type: z2.enum(DESIGN_TOKEN_TYPES),
|
|
633
|
+
$value: z2.unknown(),
|
|
634
|
+
$description: z2.optional(z2.string())
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/types/index.js
|
|
640
|
+
var init_types5 = __esm({
|
|
641
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/types/index.js"() {
|
|
642
|
+
"use strict";
|
|
643
|
+
init_types4();
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/constants/index.js
|
|
648
|
+
var init_constants2 = __esm({
|
|
649
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/constants/index.js"() {
|
|
650
|
+
"use strict";
|
|
651
|
+
init_token_types();
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/helpers/flatten.js
|
|
656
|
+
var init_flatten = __esm({
|
|
657
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/helpers/flatten.js"() {
|
|
658
|
+
"use strict";
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/helpers/validate.js
|
|
663
|
+
var TOKEN_TYPE_SET2;
|
|
664
|
+
var init_validate2 = __esm({
|
|
665
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/helpers/validate.js"() {
|
|
666
|
+
"use strict";
|
|
667
|
+
init_token_types();
|
|
668
|
+
init_flatten();
|
|
669
|
+
TOKEN_TYPE_SET2 = new Set(DESIGN_TOKEN_TYPES);
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/helpers/index.js
|
|
674
|
+
var init_helpers2 = __esm({
|
|
675
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/helpers/index.js"() {
|
|
676
|
+
"use strict";
|
|
677
|
+
init_flatten();
|
|
678
|
+
init_validate2();
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/index.js
|
|
683
|
+
var init_dtcg = __esm({
|
|
684
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/index.js"() {
|
|
685
|
+
"use strict";
|
|
686
|
+
init_types5();
|
|
687
|
+
init_constants2();
|
|
688
|
+
init_helpers2();
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/types/apply.js
|
|
693
|
+
var init_apply = __esm({
|
|
694
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/types/apply.js"() {
|
|
695
|
+
"use strict";
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/types/preview.js
|
|
700
|
+
var init_preview = __esm({
|
|
701
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/types/preview.js"() {
|
|
702
|
+
"use strict";
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/types/index.js
|
|
707
|
+
var init_types6 = __esm({
|
|
708
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/types/index.js"() {
|
|
709
|
+
"use strict";
|
|
710
|
+
init_apply();
|
|
711
|
+
init_preview();
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/index.js
|
|
716
|
+
var init_sources_api = __esm({
|
|
717
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/sources-api/index.js"() {
|
|
718
|
+
"use strict";
|
|
719
|
+
init_types6();
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/index.js
|
|
724
|
+
var init_shared = __esm({
|
|
725
|
+
"packages/experience-design-system-backend-pipeline/dist/src/steps/shared/index.js"() {
|
|
726
|
+
"use strict";
|
|
727
|
+
init_candidate_file();
|
|
728
|
+
init_cdf();
|
|
729
|
+
init_dtcg();
|
|
730
|
+
init_sources_api();
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/filter-design-token-props.js
|
|
735
|
+
var init_filter_design_token_props = __esm({
|
|
736
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/filter-design-token-props.js"() {
|
|
737
|
+
"use strict";
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/format-token-candidates.js
|
|
742
|
+
var init_format_token_candidates = __esm({
|
|
743
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/format-token-candidates.js"() {
|
|
744
|
+
"use strict";
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/infer-fence-lang.js
|
|
749
|
+
var init_infer_fence_lang = __esm({
|
|
750
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/infer-fence-lang.js"() {
|
|
751
|
+
"use strict";
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
|
|
755
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/build-input-sections.js
|
|
756
|
+
var init_build_input_sections = __esm({
|
|
757
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/build-input-sections.js"() {
|
|
758
|
+
"use strict";
|
|
759
|
+
init_shared();
|
|
760
|
+
init_filter_design_token_props();
|
|
761
|
+
init_format_token_candidates();
|
|
762
|
+
init_infer_fence_lang();
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/constants/skill-files.js
|
|
767
|
+
var init_skill_files = __esm({
|
|
768
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/constants/skill-files.js"() {
|
|
769
|
+
"use strict";
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js
|
|
774
|
+
var init_resolve_skill_path = __esm({
|
|
775
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/resolve-skill-path.js"() {
|
|
776
|
+
"use strict";
|
|
777
|
+
init_skill_files();
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js
|
|
782
|
+
var init_read_skill_file = __esm({
|
|
783
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/helpers/read-skill-file.js"() {
|
|
784
|
+
"use strict";
|
|
785
|
+
init_resolve_skill_path();
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-components-preamble.js
|
|
790
|
+
var init_build_components_preamble = __esm({
|
|
791
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-components-preamble.js"() {
|
|
792
|
+
"use strict";
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-map-tokens-preamble.js
|
|
797
|
+
var init_build_map_tokens_preamble = __esm({
|
|
798
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-map-tokens-preamble.js"() {
|
|
799
|
+
"use strict";
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-select-preamble.js
|
|
804
|
+
var init_build_select_preamble = __esm({
|
|
805
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-select-preamble.js"() {
|
|
806
|
+
"use strict";
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-tokens-preamble.js
|
|
811
|
+
var init_build_tokens_preamble = __esm({
|
|
812
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/preambles/build-tokens-preamble.js"() {
|
|
813
|
+
"use strict";
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/build-prompt.js
|
|
818
|
+
var init_build_prompt = __esm({
|
|
819
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/build-prompt.js"() {
|
|
820
|
+
"use strict";
|
|
821
|
+
init_build_input_sections();
|
|
822
|
+
init_read_skill_file();
|
|
823
|
+
init_build_components_preamble();
|
|
824
|
+
init_build_map_tokens_preamble();
|
|
825
|
+
init_build_select_preamble();
|
|
826
|
+
init_build_tokens_preamble();
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/format-custom-prompt-banner.js
|
|
831
|
+
var init_format_custom_prompt_banner = __esm({
|
|
832
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/prompts/format-custom-prompt-banner.js"() {
|
|
833
|
+
"use strict";
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/index.js
|
|
838
|
+
var init_agents = __esm({
|
|
839
|
+
"packages/experience-design-system-backend-pipeline/dist/src/agents/index.js"() {
|
|
840
|
+
"use strict";
|
|
841
|
+
init_types();
|
|
842
|
+
init_models();
|
|
843
|
+
init_is_agent_name();
|
|
844
|
+
init_resolve_binary();
|
|
845
|
+
init_resolve_agent_model();
|
|
846
|
+
init_agent_supports_bedrock();
|
|
847
|
+
init_build_agent_args();
|
|
848
|
+
init_describe_agent_failure();
|
|
849
|
+
init_extract_sentinel_output();
|
|
850
|
+
init_format_generate_progress_line();
|
|
851
|
+
init_parse_agent_model();
|
|
852
|
+
init_resolve_agent();
|
|
853
|
+
init_resolve_model();
|
|
854
|
+
init_looks_like_path();
|
|
855
|
+
init_parse_prompt_overrides();
|
|
856
|
+
init_resolve_prompt_override();
|
|
857
|
+
init_build_user_agent();
|
|
858
|
+
init_parse_select_tool_calls();
|
|
859
|
+
init_parse_tool_calls();
|
|
860
|
+
init_parse_token_tool_calls();
|
|
861
|
+
init_parse_map_token_prop_tool_calls();
|
|
862
|
+
init_parse_map_token_prop_tool_calls();
|
|
863
|
+
init_run_agent();
|
|
864
|
+
init_check_agent_auth();
|
|
865
|
+
init_invoke_agent_with_output();
|
|
866
|
+
init_output_formatter2();
|
|
867
|
+
init_create_local_cli_agent_invoker();
|
|
868
|
+
init_build_prompt();
|
|
869
|
+
init_resolve_skill_path();
|
|
870
|
+
init_format_custom_prompt_banner();
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js
|
|
875
|
+
var init_cache_keys = __esm({
|
|
876
|
+
"packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/helpers/cache-keys.js"() {
|
|
877
|
+
"use strict";
|
|
878
|
+
init_agents();
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
// packages/experience-design-system-cli/app.tsx
|
|
883
|
+
import { useEffect as useEffect9, useState as useState13 } from "react";
|
|
884
|
+
|
|
885
|
+
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
886
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
887
|
+
import { Box, Text as Text2, useApp, useInput } from "ink";
|
|
888
|
+
|
|
889
|
+
// packages/experience-design-system-cli/src/tui/home/home.theme.ts
|
|
890
|
+
var BRAND = {
|
|
891
|
+
blue: "#1773EB",
|
|
892
|
+
green: "#00C459",
|
|
893
|
+
orange: "#E44F20",
|
|
894
|
+
yellow: "#FFDA00",
|
|
895
|
+
white: "#FFFFFF",
|
|
896
|
+
slate: "#8B8D91",
|
|
897
|
+
steel: "#C4D1DE"
|
|
898
|
+
};
|
|
899
|
+
var PALETTE = {
|
|
900
|
+
accent: BRAND.blue,
|
|
901
|
+
success: BRAND.green,
|
|
902
|
+
error: BRAND.orange,
|
|
903
|
+
warning: BRAND.yellow,
|
|
904
|
+
muted: BRAND.slate,
|
|
905
|
+
border: BRAND.steel
|
|
906
|
+
};
|
|
907
|
+
var BRAND_RAMP = [BRAND.blue, BRAND.orange, BRAND.yellow];
|
|
908
|
+
var BAR_CELL = "\u2501";
|
|
909
|
+
function brandBar(width, ramp = BRAND_RAMP) {
|
|
910
|
+
if (width <= 0 || ramp.length === 0) return [];
|
|
911
|
+
const base = Math.floor(width / ramp.length);
|
|
912
|
+
const remainder = width % ramp.length;
|
|
913
|
+
return ramp.map((color, i) => ({
|
|
914
|
+
text: BAR_CELL.repeat(base + (i < remainder ? 1 : 0)),
|
|
915
|
+
color
|
|
916
|
+
})).filter((segment) => segment.text.length > 0);
|
|
917
|
+
}
|
|
918
|
+
var FOCUS_MARKER = "\u276F";
|
|
919
|
+
|
|
920
|
+
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
921
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
922
|
+
import { join as join2 } from "node:path";
|
|
923
|
+
import semver from "semver";
|
|
924
|
+
|
|
925
|
+
// packages/experience-design-system-cli/src/tui/package-root.ts
|
|
926
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
927
|
+
import { dirname, join } from "node:path";
|
|
928
|
+
import { fileURLToPath } from "node:url";
|
|
929
|
+
function findPackageRoot(startUrl, packageName) {
|
|
930
|
+
let dir = dirname(fileURLToPath(startUrl));
|
|
931
|
+
let found;
|
|
932
|
+
while (true) {
|
|
933
|
+
const manifestPath = join(dir, "package.json");
|
|
934
|
+
if (existsSync(manifestPath)) {
|
|
935
|
+
const pkg = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
936
|
+
if (pkg.name === packageName) found = dir;
|
|
937
|
+
}
|
|
938
|
+
const parent = dirname(dir);
|
|
939
|
+
if (parent === dir) return found ?? dir;
|
|
940
|
+
dir = parent;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// packages/experience-design-system-cli/src/tui/upgrade/version.ts
|
|
945
|
+
var PACKAGE_NAME = "@contentful/experience-design-system-cli";
|
|
946
|
+
var TAGS_URL = "https://api.github.com/repos/contentful/experience-design-system-sdk-public/tags?per_page=10";
|
|
947
|
+
function readPackageVersion() {
|
|
948
|
+
const root = findPackageRoot(import.meta.url, PACKAGE_NAME);
|
|
949
|
+
const pkg = JSON.parse(readFileSync2(join2(root, "package.json"), "utf8"));
|
|
950
|
+
return pkg.version ?? "unknown";
|
|
951
|
+
}
|
|
952
|
+
function parseVersionTag(tag) {
|
|
953
|
+
const match = /^v(\d+\.\d+\.\d+)$/.exec(tag);
|
|
954
|
+
return match ? match[1] : void 0;
|
|
955
|
+
}
|
|
956
|
+
async function checkForUpgrade() {
|
|
957
|
+
const current = readPackageVersion();
|
|
958
|
+
try {
|
|
959
|
+
const response = await fetch(TAGS_URL);
|
|
960
|
+
if (!response.ok) return { status: "error" };
|
|
961
|
+
const tags = await response.json();
|
|
962
|
+
const versions = tags.map((tag) => tag.name ? parseVersionTag(tag.name) : void 0).filter((v) => v !== void 0);
|
|
963
|
+
if (versions.length === 0) return { status: "error" };
|
|
964
|
+
const latest = versions.reduce((best, v) => semver.gt(v, best) ? v : best);
|
|
965
|
+
if (!semver.valid(current)) return { status: "error" };
|
|
966
|
+
if (semver.gt(latest, current)) {
|
|
967
|
+
return { status: "update-available", current, latest };
|
|
968
|
+
}
|
|
969
|
+
return { status: "up-to-date", current };
|
|
970
|
+
} catch {
|
|
971
|
+
return { status: "error" };
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// packages/experience-design-system-cli/src/tui/use-terminal-width.ts
|
|
976
|
+
import { useEffect, useState } from "react";
|
|
977
|
+
import { useStdout } from "ink";
|
|
978
|
+
var FALLBACK_COLUMNS = 80;
|
|
979
|
+
function readColumns(stdout) {
|
|
980
|
+
const columns = stdout?.columns ?? 0;
|
|
981
|
+
return columns > 0 ? columns : FALLBACK_COLUMNS;
|
|
982
|
+
}
|
|
983
|
+
function useTerminalWidth() {
|
|
984
|
+
const { stdout } = useStdout();
|
|
985
|
+
const [columns, setColumns] = useState(() => readColumns(stdout));
|
|
986
|
+
useEffect(() => {
|
|
987
|
+
if (!stdout) return;
|
|
988
|
+
const onResize = () => setColumns(readColumns(stdout));
|
|
989
|
+
onResize();
|
|
990
|
+
stdout.on("resize", onResize);
|
|
991
|
+
return () => {
|
|
992
|
+
stdout.off("resize", onResize);
|
|
993
|
+
};
|
|
994
|
+
}, [stdout]);
|
|
995
|
+
return columns;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
// packages/experience-design-system-cli/src/tui/control-hints.tsx
|
|
999
|
+
import { Text } from "ink";
|
|
1000
|
+
import { jsx } from "react/jsx-runtime";
|
|
1001
|
+
function ControlHints({ hints }) {
|
|
1002
|
+
return /* @__PURE__ */ jsx(Text, { children: hints.map((hint) => `[${hint.keys}] ${hint.label}`).join(" \xB7 ") });
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// packages/experience-design-system-cli/src/tui/home/home.tsx
|
|
1006
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1007
|
+
var VERSION = readPackageVersion();
|
|
1008
|
+
var HEADING = "Contentful Experiences";
|
|
1009
|
+
var SUBTITLE = "Let's import your design system into Contentful";
|
|
1010
|
+
var MIN_TERMINAL_WIDTH = 164;
|
|
1011
|
+
var START_ITEMS = [
|
|
1012
|
+
{ label: "Import", screen: "import" },
|
|
1013
|
+
{ label: "Upgrade Version", screen: "upgrade" },
|
|
1014
|
+
{ label: "Settings", screen: "settings" },
|
|
1015
|
+
{ label: "Help", screen: "help" }
|
|
1016
|
+
];
|
|
1017
|
+
function upgradeItemDisplay(upgradeCheck) {
|
|
1018
|
+
if (upgradeCheck?.status === "update-available") {
|
|
1019
|
+
return { label: `Upgrade Version (v${upgradeCheck.latest} available)`, color: PALETTE.warning };
|
|
1020
|
+
}
|
|
1021
|
+
if (upgradeCheck?.status === "up-to-date") {
|
|
1022
|
+
return { label: "Upgrade Version (up to date)", color: PALETTE.muted };
|
|
1023
|
+
}
|
|
1024
|
+
return { label: "Upgrade Version" };
|
|
1025
|
+
}
|
|
1026
|
+
function HomeScreen({ onNavigate }) {
|
|
1027
|
+
const [focusIdx, setFocusIdx] = useState2(0);
|
|
1028
|
+
const [upgradeCheck, setUpgradeCheck] = useState2();
|
|
1029
|
+
const { exit } = useApp();
|
|
1030
|
+
const terminalWidth = useTerminalWidth();
|
|
1031
|
+
const tooNarrow = terminalWidth < MIN_TERMINAL_WIDTH;
|
|
1032
|
+
const upgradeDisabled = upgradeCheck?.status === "up-to-date";
|
|
1033
|
+
useEffect2(() => {
|
|
1034
|
+
checkForUpgrade().then(setUpgradeCheck).catch(() => setUpgradeCheck({ status: "error" }));
|
|
1035
|
+
}, []);
|
|
1036
|
+
useInput((input, key) => {
|
|
1037
|
+
if (input === "q" || key.escape) {
|
|
1038
|
+
exit();
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
if (tooNarrow) return;
|
|
1042
|
+
if (key.upArrow) {
|
|
1043
|
+
setFocusIdx((i) => (i - 1 + START_ITEMS.length) % START_ITEMS.length);
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
if (key.downArrow) {
|
|
1047
|
+
setFocusIdx((i) => (i + 1) % START_ITEMS.length);
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
if (key.return) {
|
|
1051
|
+
const item = START_ITEMS[focusIdx];
|
|
1052
|
+
if (item.screen === "upgrade" && upgradeDisabled) return;
|
|
1053
|
+
onNavigate(item.screen);
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
if (tooNarrow) {
|
|
1058
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1059
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, color: PALETTE.warning, children: "Terminal too small" }),
|
|
1060
|
+
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: "Press q to quit, make your terminal full screen, then run experiences import again." })
|
|
1061
|
+
] });
|
|
1062
|
+
}
|
|
1063
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1064
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "column", alignItems: "center", children: [
|
|
1065
|
+
/* @__PURE__ */ jsx2(Text2, { bold: true, children: HEADING }),
|
|
1066
|
+
/* @__PURE__ */ jsx2(Text2, { children: brandBar(HEADING.length).map((segment, i) => /* @__PURE__ */ jsx2(Text2, { color: segment.color, children: segment.text }, i)) }),
|
|
1067
|
+
/* @__PURE__ */ jsx2(Text2, { color: PALETTE.muted, children: SUBTITLE }),
|
|
1068
|
+
/* @__PURE__ */ jsxs(Text2, { color: PALETTE.muted, children: [
|
|
1069
|
+
"v",
|
|
1070
|
+
VERSION
|
|
1071
|
+
] })
|
|
1072
|
+
] }),
|
|
1073
|
+
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", children: START_ITEMS.map((item, i) => {
|
|
1074
|
+
const focused = i === focusIdx;
|
|
1075
|
+
const isUpgradeItem = item.screen === "upgrade";
|
|
1076
|
+
const display = isUpgradeItem ? upgradeItemDisplay(upgradeCheck) : { label: item.label };
|
|
1077
|
+
const dimmed = isUpgradeItem && upgradeDisabled;
|
|
1078
|
+
return /* @__PURE__ */ jsxs(
|
|
1079
|
+
Text2,
|
|
1080
|
+
{
|
|
1081
|
+
bold: focused && !dimmed,
|
|
1082
|
+
color: dimmed ? PALETTE.muted : focused ? PALETTE.accent : display.color,
|
|
1083
|
+
children: [
|
|
1084
|
+
focused ? `${FOCUS_MARKER} ` : " ",
|
|
1085
|
+
display.label
|
|
1086
|
+
]
|
|
1087
|
+
},
|
|
1088
|
+
item.label
|
|
1089
|
+
);
|
|
1090
|
+
}) }) }),
|
|
1091
|
+
/* @__PURE__ */ jsx2(Box, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx2(
|
|
1092
|
+
ControlHints,
|
|
1093
|
+
{
|
|
1094
|
+
hints: [
|
|
1095
|
+
{ keys: "\u2191/\u2193", label: "move" },
|
|
1096
|
+
{ keys: "\u23CE", label: "select" },
|
|
1097
|
+
{ keys: "q", label: "quit" }
|
|
1098
|
+
]
|
|
1099
|
+
}
|
|
1100
|
+
) })
|
|
1101
|
+
] });
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// packages/experience-design-system-cli/src/tui/import/PageContainer.tsx
|
|
1105
|
+
import { Box as Box2, Text as Text3, useInput as useInput2 } from "ink";
|
|
1106
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1107
|
+
function ImportScreen({ exitCode, onDone }) {
|
|
1108
|
+
useInput2((input, key) => {
|
|
1109
|
+
if (key.return || key.escape || input === "q") {
|
|
1110
|
+
onDone();
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
const isSuccess = exitCode === 0;
|
|
1114
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
|
|
1115
|
+
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
1116
|
+
isSuccess ? /* @__PURE__ */ jsx3(Text3, { color: PALETTE.success, children: "\u2713 Import complete" }) : /* @__PURE__ */ jsxs2(Text3, { color: PALETTE.error, children: [
|
|
1117
|
+
"\u2717 Import failed: process exited with code ",
|
|
1118
|
+
exitCode ?? "unknown"
|
|
1119
|
+
] }),
|
|
1120
|
+
/* @__PURE__ */ jsx3(Text3, { children: " " }),
|
|
1121
|
+
/* @__PURE__ */ jsx3(Text3, { children: "[Enter] Back to Start" })
|
|
1122
|
+
] });
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
1126
|
+
import { useState as useState3 } from "react";
|
|
1127
|
+
import { Box as Box3, Text as Text4 } from "ink";
|
|
1128
|
+
import TextInput from "ink-text-input";
|
|
1129
|
+
|
|
1130
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
1131
|
+
import { useInput as useInput3 } from "ink";
|
|
1132
|
+
|
|
1133
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/logic.ts
|
|
1134
|
+
function shouldQuit(key) {
|
|
1135
|
+
return key.escape;
|
|
1136
|
+
}
|
|
1137
|
+
function toProjectPath(value) {
|
|
1138
|
+
const projectPath = value.trim();
|
|
1139
|
+
return projectPath === "" ? null : projectPath;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/controls.ts
|
|
1143
|
+
var WELCOME_CONTROLS = [
|
|
1144
|
+
{ keys: "Enter", label: "Continue" },
|
|
1145
|
+
{ keys: "Esc", label: "Back to menu" }
|
|
1146
|
+
];
|
|
1147
|
+
function useWelcomeControls(onQuit) {
|
|
1148
|
+
useInput3((_input, key) => {
|
|
1149
|
+
if (shouldQuit(key)) onQuit();
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
// packages/experience-design-system-cli/src/tui/import/steps/01-welcome/screen.tsx
|
|
1154
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1155
|
+
var 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";
|
|
1156
|
+
var OVERVIEW = [
|
|
1157
|
+
{ label: "Step 1", description: "Extract components from your codebase" },
|
|
1158
|
+
{ label: "Step 2", description: "Review what was extracted" },
|
|
1159
|
+
{ label: "Step 3", description: "Generate CDF definitions with Claude" },
|
|
1160
|
+
{ label: "Step 4", description: "Review generated definitions" },
|
|
1161
|
+
{ label: "Step 5", description: "Push to Contentful" }
|
|
1162
|
+
];
|
|
1163
|
+
function WelcomeScreen({ onContinue, onQuit, initialPath = "" }) {
|
|
1164
|
+
const [projectPath, setProjectPath] = useState3(initialPath);
|
|
1165
|
+
useWelcomeControls(onQuit);
|
|
1166
|
+
const submit = (value) => {
|
|
1167
|
+
const path = toProjectPath(value);
|
|
1168
|
+
if (path) onContinue(path);
|
|
1169
|
+
};
|
|
1170
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
1171
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, color: PALETTE.success, children: "\u{1F44B} Hey! Let's import your design system into Contentful." }),
|
|
1172
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: "I'll walk you through 5 steps to get your components into Contentful ExO." }),
|
|
1173
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
1174
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE }),
|
|
1175
|
+
OVERVIEW.map((item) => /* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
1176
|
+
/* @__PURE__ */ jsx4(Text4, { bold: true, children: item.label }),
|
|
1177
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.muted, children: item.description })
|
|
1178
|
+
] }, item.label)),
|
|
1179
|
+
/* @__PURE__ */ jsx4(Text4, { dimColor: true, children: RULE })
|
|
1180
|
+
] }),
|
|
1181
|
+
/* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", gap: 1, children: [
|
|
1182
|
+
/* @__PURE__ */ jsx4(Text4, { children: "Where is your component library?" }),
|
|
1183
|
+
/* @__PURE__ */ jsxs3(Box3, { gap: 1, children: [
|
|
1184
|
+
/* @__PURE__ */ jsx4(Text4, { color: PALETTE.accent, children: "?" }),
|
|
1185
|
+
/* @__PURE__ */ jsx4(Text4, { children: "Project path:" }),
|
|
1186
|
+
/* @__PURE__ */ jsx4(TextInput, { value: projectPath, onChange: setProjectPath, onSubmit: submit })
|
|
1187
|
+
] })
|
|
1188
|
+
] }),
|
|
1189
|
+
/* @__PURE__ */ jsx4(Box3, { gap: 3, children: WELCOME_CONTROLS.map((control) => /* @__PURE__ */ jsxs3(Text4, { children: [
|
|
1190
|
+
"[",
|
|
1191
|
+
control.keys,
|
|
1192
|
+
"] ",
|
|
1193
|
+
control.label
|
|
1194
|
+
] }, control.keys)) })
|
|
1195
|
+
] });
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
1199
|
+
import { useState as useState4 } from "react";
|
|
1200
|
+
import { Box as Box4, Text as Text5 } from "ink";
|
|
1201
|
+
import TextInput2 from "ink-text-input";
|
|
1202
|
+
|
|
1203
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
1204
|
+
import { useInput as useInput4 } from "ink";
|
|
1205
|
+
|
|
1206
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/logic.ts
|
|
1207
|
+
function shouldGoBack(key) {
|
|
1208
|
+
return key.escape;
|
|
1209
|
+
}
|
|
1210
|
+
function toTokenPath(value) {
|
|
1211
|
+
const tokenPath = value.trim();
|
|
1212
|
+
return tokenPath === "" ? null : tokenPath;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/controls.ts
|
|
1216
|
+
var TOKEN_INPUT_CONTROLS = [
|
|
1217
|
+
{ keys: "Enter", label: "Continue" },
|
|
1218
|
+
{ keys: "Esc", label: "Back" }
|
|
1219
|
+
];
|
|
1220
|
+
function useTokenInputControls(onBack) {
|
|
1221
|
+
useInput4((_input, key) => {
|
|
1222
|
+
if (shouldGoBack(key)) onBack();
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
1227
|
+
import { statSync } from "node:fs";
|
|
1228
|
+
|
|
1229
|
+
// packages/experience-design-system-cli/src/tui/import/resolve-user-path.ts
|
|
1230
|
+
import { homedir } from "node:os";
|
|
1231
|
+
import { resolve } from "node:path";
|
|
1232
|
+
function stripQuotes(value) {
|
|
1233
|
+
const quoted = value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'");
|
|
1234
|
+
return value.length >= 2 && quoted ? value.slice(1, -1) : value;
|
|
1235
|
+
}
|
|
1236
|
+
function expandHome(value) {
|
|
1237
|
+
return value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? homedir() + value.slice(1) : value;
|
|
1238
|
+
}
|
|
1239
|
+
function resolveUserPath(raw) {
|
|
1240
|
+
return resolve(expandHome(stripQuotes(raw.trim())));
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/validate-path.ts
|
|
1244
|
+
function validateTokenPath(rawPath) {
|
|
1245
|
+
const path = resolveUserPath(rawPath);
|
|
1246
|
+
let stats;
|
|
1247
|
+
try {
|
|
1248
|
+
stats = statSync(path);
|
|
1249
|
+
} catch {
|
|
1250
|
+
return { ok: false, error: `Path not found: ${path}`, resolvedPath: path };
|
|
1251
|
+
}
|
|
1252
|
+
if (stats.isDirectory()) {
|
|
1253
|
+
return {
|
|
1254
|
+
ok: false,
|
|
1255
|
+
error: "That's a directory \u2014 provide a path to a token file (e.g. tokens.json), not a folder.",
|
|
1256
|
+
resolvedPath: path
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
if (!stats.isFile()) {
|
|
1260
|
+
return { ok: false, error: `Not a regular file: ${path}`, resolvedPath: path };
|
|
1261
|
+
}
|
|
1262
|
+
return { ok: true, path };
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
// packages/experience-design-system-cli/src/tui/import/steps/02-token-input/screen.tsx
|
|
1266
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1267
|
+
function TokenInputScreen({ onConfirm, onBack, initialPath = "" }) {
|
|
1268
|
+
const [tokenPath, setTokenPath] = useState4(initialPath);
|
|
1269
|
+
const [failure, setFailure] = useState4(null);
|
|
1270
|
+
useTokenInputControls(onBack);
|
|
1271
|
+
const change = (value) => {
|
|
1272
|
+
setTokenPath(value);
|
|
1273
|
+
setFailure(null);
|
|
1274
|
+
};
|
|
1275
|
+
const submit = (value) => {
|
|
1276
|
+
const rawPath = toTokenPath(value);
|
|
1277
|
+
if (!rawPath) {
|
|
1278
|
+
setFailure({ error: "Enter the path to your token file." });
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
const check = validateTokenPath(rawPath);
|
|
1282
|
+
if (check.ok) onConfirm(check.path);
|
|
1283
|
+
else setFailure({ error: check.error, resolvedPath: check.resolvedPath });
|
|
1284
|
+
};
|
|
1285
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
1286
|
+
/* @__PURE__ */ jsx5(Text5, { bold: true, children: "Design tokens" }),
|
|
1287
|
+
/* @__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)." }),
|
|
1288
|
+
/* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1289
|
+
/* @__PURE__ */ jsxs4(Box4, { gap: 1, children: [
|
|
1290
|
+
/* @__PURE__ */ jsx5(Text5, { color: PALETTE.accent, children: "?" }),
|
|
1291
|
+
/* @__PURE__ */ jsx5(Text5, { children: "Token path:" }),
|
|
1292
|
+
/* @__PURE__ */ jsx5(TextInput2, { value: tokenPath, onChange: change, onSubmit: submit })
|
|
1293
|
+
] }),
|
|
1294
|
+
failure && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1295
|
+
/* @__PURE__ */ jsxs4(Text5, { color: PALETTE.error, children: [
|
|
1296
|
+
"\u2717 ",
|
|
1297
|
+
failure.error
|
|
1298
|
+
] }),
|
|
1299
|
+
failure.resolvedPath && /* @__PURE__ */ jsxs4(Text5, { color: PALETTE.muted, children: [
|
|
1300
|
+
" Resolved to: ",
|
|
1301
|
+
failure.resolvedPath
|
|
1302
|
+
] })
|
|
1303
|
+
] })
|
|
1304
|
+
] }),
|
|
1305
|
+
/* @__PURE__ */ jsx5(Box4, { marginTop: 1, gap: 3, children: TOKEN_INPUT_CONTROLS.map((control) => /* @__PURE__ */ jsxs4(Text5, { children: [
|
|
1306
|
+
"[",
|
|
1307
|
+
control.keys,
|
|
1308
|
+
"] ",
|
|
1309
|
+
control.label
|
|
1310
|
+
] }, control.keys)) })
|
|
1311
|
+
] });
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
1315
|
+
import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
|
|
1316
|
+
import { Box as Box5, Text as Text6 } from "ink";
|
|
1317
|
+
|
|
1318
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
1319
|
+
import { useInput as useInput5 } from "ink";
|
|
1320
|
+
|
|
1321
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/logic.ts
|
|
1322
|
+
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
1323
|
+
"node_modules",
|
|
1324
|
+
"dist",
|
|
1325
|
+
"build",
|
|
1326
|
+
".next",
|
|
1327
|
+
".nuxt",
|
|
1328
|
+
"coverage",
|
|
1329
|
+
"storybook-static",
|
|
1330
|
+
"out",
|
|
1331
|
+
".git"
|
|
1332
|
+
]);
|
|
1333
|
+
var CATEGORY_BY_EXTENSION = /* @__PURE__ */ new Map([
|
|
1334
|
+
["tsx", "tsx"],
|
|
1335
|
+
["ts", "ts"],
|
|
1336
|
+
["vue", "vue"],
|
|
1337
|
+
["astro", "astro"],
|
|
1338
|
+
["jsx", "jsx"],
|
|
1339
|
+
["js", "js"],
|
|
1340
|
+
["json", "json"]
|
|
1341
|
+
]);
|
|
1342
|
+
var COMPONENT_CATEGORIES = ["tsx", "ts", "vue", "astro", "jsx", "js"];
|
|
1343
|
+
var ROW_LABELS = {
|
|
1344
|
+
tsx: ".tsx files",
|
|
1345
|
+
ts: ".ts files",
|
|
1346
|
+
vue: ".vue files",
|
|
1347
|
+
astro: ".astro files",
|
|
1348
|
+
jsx: ".jsx files",
|
|
1349
|
+
js: ".js files",
|
|
1350
|
+
json: ".json files (design tokens)",
|
|
1351
|
+
other: "other (ignored)"
|
|
1352
|
+
};
|
|
1353
|
+
var ROW_ORDER = ["tsx", "ts", "vue", "astro", "jsx", "js", "json", "other"];
|
|
1354
|
+
function categorize(fileName) {
|
|
1355
|
+
if (fileName.endsWith(".d.ts")) return "other";
|
|
1356
|
+
const dot = fileName.lastIndexOf(".");
|
|
1357
|
+
const extension = dot === -1 ? "" : fileName.slice(dot + 1);
|
|
1358
|
+
return CATEGORY_BY_EXTENSION.get(extension) ?? "other";
|
|
1359
|
+
}
|
|
1360
|
+
function emptyCounts() {
|
|
1361
|
+
return { tsx: 0, ts: 0, vue: 0, astro: 0, jsx: 0, js: 0, json: 0, other: 0, total: 0 };
|
|
1362
|
+
}
|
|
1363
|
+
function addFile(counts, fileName) {
|
|
1364
|
+
const category = categorize(fileName);
|
|
1365
|
+
return { ...counts, [category]: counts[category] + 1, total: counts.total + 1 };
|
|
1366
|
+
}
|
|
1367
|
+
function mergeCounts(a, b) {
|
|
1368
|
+
return {
|
|
1369
|
+
tsx: a.tsx + b.tsx,
|
|
1370
|
+
ts: a.ts + b.ts,
|
|
1371
|
+
vue: a.vue + b.vue,
|
|
1372
|
+
astro: a.astro + b.astro,
|
|
1373
|
+
jsx: a.jsx + b.jsx,
|
|
1374
|
+
js: a.js + b.js,
|
|
1375
|
+
json: a.json + b.json,
|
|
1376
|
+
other: a.other + b.other,
|
|
1377
|
+
total: a.total + b.total
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
function failureFromErrorCode(code) {
|
|
1381
|
+
if (code === "ENOENT") return "not-found";
|
|
1382
|
+
if (code === "EACCES") return "permission-denied";
|
|
1383
|
+
return "unreadable";
|
|
1384
|
+
}
|
|
1385
|
+
function describeFailure(failure, path) {
|
|
1386
|
+
switch (failure) {
|
|
511
1387
|
case "is-file":
|
|
512
1388
|
return {
|
|
513
1389
|
headline: "That's a file, not a directory.",
|
|
@@ -532,190 +1408,1574 @@ function describeFailure(failure, path) {
|
|
|
532
1408
|
return { headline: `Cannot access: ${path}`, hints: [] };
|
|
533
1409
|
}
|
|
534
1410
|
}
|
|
535
|
-
function summarize(counts) {
|
|
536
|
-
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
537
|
-
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
538
|
-
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
1411
|
+
function summarize(counts) {
|
|
1412
|
+
const rows = ROW_ORDER.filter((category) => counts[category] > 0).map((category) => {
|
|
1413
|
+
const tone = category === "json" ? "accent" : category === "other" ? "muted" : "default";
|
|
1414
|
+
return { label: ROW_LABELS[category], count: counts[category], tone };
|
|
1415
|
+
});
|
|
1416
|
+
const componentFiles = COMPONENT_CATEGORIES.reduce((sum, category) => sum + counts[category], 0);
|
|
1417
|
+
if (componentFiles > 0) return { total: counts.total, rows };
|
|
1418
|
+
if (counts.json > 0) {
|
|
1419
|
+
return { total: counts.total, rows, warning: "No component files found \u2014 only token files detected." };
|
|
1420
|
+
}
|
|
1421
|
+
return {
|
|
1422
|
+
total: counts.total,
|
|
1423
|
+
rows,
|
|
1424
|
+
warning: "No component or token files found. Try a different path."
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
function phaseOf(scan) {
|
|
1428
|
+
if (scan === void 0) return "scanning";
|
|
1429
|
+
return scan.ok ? "ready" : "failed";
|
|
1430
|
+
}
|
|
1431
|
+
function keyAction(phase, input, key) {
|
|
1432
|
+
if (key.escape) return "back";
|
|
1433
|
+
if (phase === "ready") {
|
|
1434
|
+
if (key.return) return "confirm";
|
|
1435
|
+
if (input === "e") return "change-path";
|
|
1436
|
+
}
|
|
1437
|
+
if (phase === "failed" && (key.return || input === "e")) return "change-path";
|
|
1438
|
+
return void 0;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/controls.ts
|
|
1442
|
+
var CONTROLS = {
|
|
1443
|
+
scanning: [{ keys: "Esc", label: "Back" }],
|
|
1444
|
+
ready: [
|
|
1445
|
+
{ keys: "Enter", label: "Yes, continue" },
|
|
1446
|
+
{ keys: "e", label: "Change path" },
|
|
1447
|
+
{ keys: "Esc", label: "Back" }
|
|
1448
|
+
],
|
|
1449
|
+
failed: [
|
|
1450
|
+
{ keys: "Enter/e", label: "Try a different path" },
|
|
1451
|
+
{ keys: "Esc", label: "Back" }
|
|
1452
|
+
]
|
|
1453
|
+
};
|
|
1454
|
+
function controlsFor(phase) {
|
|
1455
|
+
return CONTROLS[phase];
|
|
1456
|
+
}
|
|
1457
|
+
function usePathValidationControls(phase, handlers) {
|
|
1458
|
+
useInput5((input, key) => {
|
|
1459
|
+
const action = keyAction(phase, input, key);
|
|
1460
|
+
if (action === "confirm") handlers.onConfirm();
|
|
1461
|
+
else if (action === "change-path") handlers.onChangePath();
|
|
1462
|
+
else if (action === "back") handlers.onBack();
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/loader.ts
|
|
1467
|
+
import { readdir, stat } from "node:fs/promises";
|
|
1468
|
+
import { join as join3 } from "node:path";
|
|
1469
|
+
async function isFile(path) {
|
|
1470
|
+
try {
|
|
1471
|
+
return (await stat(path)).isFile();
|
|
1472
|
+
} catch {
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
async function countEntry(directory, entry) {
|
|
1477
|
+
const path = join3(directory, entry.name);
|
|
1478
|
+
if (entry.isDirectory()) return countFiles(path);
|
|
1479
|
+
if (entry.isFile() || entry.isSymbolicLink() && await isFile(path)) return addFile(emptyCounts(), entry.name);
|
|
1480
|
+
return emptyCounts();
|
|
1481
|
+
}
|
|
1482
|
+
async function countFiles(directory) {
|
|
1483
|
+
let entries;
|
|
1484
|
+
try {
|
|
1485
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
1486
|
+
} catch {
|
|
1487
|
+
return emptyCounts();
|
|
1488
|
+
}
|
|
1489
|
+
const counts = await Promise.all(
|
|
1490
|
+
entries.filter((entry) => !IGNORED_DIRECTORIES.has(entry.name)).map((entry) => countEntry(directory, entry))
|
|
1491
|
+
);
|
|
1492
|
+
return counts.reduce(mergeCounts, emptyCounts());
|
|
1493
|
+
}
|
|
1494
|
+
async function scanProject(directory) {
|
|
1495
|
+
try {
|
|
1496
|
+
const stats = await stat(directory);
|
|
1497
|
+
if (stats.isFile()) return { ok: false, failure: "is-file" };
|
|
1498
|
+
if (!stats.isDirectory()) return { ok: false, failure: "not-directory" };
|
|
1499
|
+
} catch (error) {
|
|
1500
|
+
return { ok: false, failure: failureFromErrorCode(error.code) };
|
|
1501
|
+
}
|
|
1502
|
+
return { ok: true, counts: await countFiles(directory) };
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
// packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
|
|
1506
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1507
|
+
function Row({ row }) {
|
|
1508
|
+
return /* @__PURE__ */ jsxs5(Text6, { color: row.tone === "accent" ? PALETTE.accent : void 0, dimColor: row.tone === "muted", children: [
|
|
1509
|
+
" \u2022 ",
|
|
1510
|
+
String(row.count).padStart(3),
|
|
1511
|
+
" ",
|
|
1512
|
+
row.label
|
|
1513
|
+
] });
|
|
1514
|
+
}
|
|
1515
|
+
function Failure({ scan, path }) {
|
|
1516
|
+
const { headline, hints } = describeFailure(scan.failure, path);
|
|
1517
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
1518
|
+
/* @__PURE__ */ jsxs5(Text6, { color: PALETTE.error, children: [
|
|
1519
|
+
"\u2717 ",
|
|
1520
|
+
headline
|
|
1521
|
+
] }),
|
|
1522
|
+
hints.map((hint) => /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: hint }, hint))
|
|
1523
|
+
] });
|
|
1524
|
+
}
|
|
1525
|
+
function Summary({ scan, path }) {
|
|
1526
|
+
const { total, rows, warning } = summarize(scan.counts);
|
|
1527
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, children: [
|
|
1528
|
+
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1529
|
+
"Scanned ",
|
|
1530
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: path })
|
|
1531
|
+
] }),
|
|
1532
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
1533
|
+
/* @__PURE__ */ jsxs5(Text6, { color: PALETTE.success, children: [
|
|
1534
|
+
"\u2713 Found ",
|
|
1535
|
+
total,
|
|
1536
|
+
" files:"
|
|
1537
|
+
] }),
|
|
1538
|
+
rows.map((row) => /* @__PURE__ */ jsx6(Row, { row }, row.label))
|
|
1539
|
+
] }),
|
|
1540
|
+
warning && /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.warning, children: [
|
|
1541
|
+
"\u26A0 ",
|
|
1542
|
+
warning
|
|
1543
|
+
] }),
|
|
1544
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Does this look right?" })
|
|
1545
|
+
] });
|
|
1546
|
+
}
|
|
1547
|
+
function PathValidationScreen({
|
|
1548
|
+
projectPath,
|
|
1549
|
+
onConfirm,
|
|
1550
|
+
onChangePath,
|
|
1551
|
+
onBack
|
|
1552
|
+
}) {
|
|
1553
|
+
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
1554
|
+
const [scan, setScan] = useState5();
|
|
1555
|
+
useEffect3(() => {
|
|
1556
|
+
let cancelled = false;
|
|
1557
|
+
setScan(void 0);
|
|
1558
|
+
void scanProject(resolvedPath).then((result) => {
|
|
1559
|
+
if (!cancelled) setScan(result);
|
|
1560
|
+
});
|
|
1561
|
+
return () => {
|
|
1562
|
+
cancelled = true;
|
|
1563
|
+
};
|
|
1564
|
+
}, [resolvedPath]);
|
|
1565
|
+
const phase = phaseOf(scan);
|
|
1566
|
+
usePathValidationControls(phase, { onConfirm: () => onConfirm(resolvedPath), onChangePath, onBack });
|
|
1567
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
1568
|
+
scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
1569
|
+
"Scanning ",
|
|
1570
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath }),
|
|
1571
|
+
"..."
|
|
1572
|
+
] }),
|
|
1573
|
+
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath }),
|
|
1574
|
+
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath }),
|
|
1575
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
1576
|
+
"[",
|
|
1577
|
+
control.keys,
|
|
1578
|
+
"] ",
|
|
1579
|
+
control.label
|
|
1580
|
+
] }, control.keys)) })
|
|
1581
|
+
] });
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
1585
|
+
import { useRef, useState as useState6 } from "react";
|
|
1586
|
+
import { Box as Box6, Text as Text7 } from "ink";
|
|
1587
|
+
import TextInput3 from "ink-text-input";
|
|
1588
|
+
|
|
1589
|
+
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/controls.ts
|
|
1590
|
+
import { useInput as useInput6 } from "ink";
|
|
1591
|
+
|
|
1592
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/db.js
|
|
1593
|
+
import { DatabaseSync } from "node:sqlite";
|
|
1594
|
+
|
|
1595
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/export/export-cdf-document.js
|
|
1596
|
+
init_schema();
|
|
1597
|
+
|
|
1598
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/cdf/validators/validate-cdf-file.js
|
|
1599
|
+
init_validate();
|
|
1600
|
+
|
|
1601
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/shared/dtcg/validators/helpers/walk-dtcg.js
|
|
1602
|
+
init_token_types();
|
|
1603
|
+
|
|
1604
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/stencil/extract-stencil-components.js
|
|
1605
|
+
import { Project as Project2, Node as Node2, SyntaxKind as SyntaxKind2 } from "ts-morph";
|
|
1606
|
+
|
|
1607
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/shared/extract-tsx-components.js
|
|
1608
|
+
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
1609
|
+
import ts from "typescript";
|
|
1610
|
+
|
|
1611
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/react/extract-react-components.js
|
|
1612
|
+
import { Node as Node4, SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
1613
|
+
|
|
1614
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/helpers/evidence/structural-slot-evidence.js
|
|
1615
|
+
import { Node as Node3, SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
1616
|
+
|
|
1617
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/react/extract-react-components.js
|
|
1618
|
+
function createTextControlSurface(onChangeType, specificProps) {
|
|
1619
|
+
return [
|
|
1620
|
+
{ name: "autoComplete", type: "string", required: false },
|
|
1621
|
+
...specificProps,
|
|
1622
|
+
{ name: "disabled", type: "boolean", required: false },
|
|
1623
|
+
{ name: "name", type: "string", required: false },
|
|
1624
|
+
{ name: "onChange", type: onChangeType, required: false },
|
|
1625
|
+
{ name: "placeholder", type: "string", required: false },
|
|
1626
|
+
{ name: "readOnly", type: "boolean", required: false },
|
|
1627
|
+
{ name: "required", type: "boolean", required: false },
|
|
1628
|
+
{
|
|
1629
|
+
name: "value",
|
|
1630
|
+
type: "string | number | readonly string[]",
|
|
1631
|
+
required: false
|
|
1632
|
+
}
|
|
1633
|
+
];
|
|
1634
|
+
}
|
|
1635
|
+
var DOM_ATTRIBUTE_PROP_SURFACES = {
|
|
1636
|
+
HTMLProps: [],
|
|
1637
|
+
HTMLAttributes: [
|
|
1638
|
+
{ name: "className", type: "string", required: false },
|
|
1639
|
+
{ name: "hidden", type: "boolean", required: false },
|
|
1640
|
+
{ name: "id", type: "string", required: false },
|
|
1641
|
+
{
|
|
1642
|
+
name: "onClick",
|
|
1643
|
+
type: "MouseEventHandler<HTMLElement>",
|
|
1644
|
+
required: false
|
|
1645
|
+
},
|
|
1646
|
+
{ name: "style", type: "CSSProperties", required: false },
|
|
1647
|
+
{ name: "tabIndex", type: "number", required: false },
|
|
1648
|
+
{ name: "title", type: "string", required: false }
|
|
1649
|
+
],
|
|
1650
|
+
ImgHTMLAttributes: [
|
|
1651
|
+
{ name: "alt", type: "string", required: false },
|
|
1652
|
+
{ name: "crossOrigin", type: "string", required: false },
|
|
1653
|
+
{ name: "height", type: "number | string", required: false },
|
|
1654
|
+
{
|
|
1655
|
+
name: "loading",
|
|
1656
|
+
type: "string",
|
|
1657
|
+
required: false,
|
|
1658
|
+
allowedValues: ["eager", "lazy"]
|
|
1659
|
+
},
|
|
1660
|
+
{ name: "sizes", type: "string", required: false },
|
|
1661
|
+
{ name: "src", type: "string", required: false },
|
|
1662
|
+
{ name: "srcSet", type: "string", required: false },
|
|
1663
|
+
{ name: "width", type: "number | string", required: false }
|
|
1664
|
+
],
|
|
1665
|
+
LiHTMLAttributes: [],
|
|
1666
|
+
AnchorHTMLAttributes: [
|
|
1667
|
+
{ name: "download", type: "boolean | string", required: false },
|
|
1668
|
+
{ name: "href", type: "string", required: false },
|
|
1669
|
+
{ name: "hrefLang", type: "string", required: false },
|
|
1670
|
+
{ name: "referrerPolicy", type: "string", required: false },
|
|
1671
|
+
{ name: "rel", type: "string", required: false },
|
|
1672
|
+
{
|
|
1673
|
+
name: "target",
|
|
1674
|
+
type: "string",
|
|
1675
|
+
required: false,
|
|
1676
|
+
allowedValues: ["_blank", "_parent", "_self", "_top"]
|
|
1677
|
+
}
|
|
1678
|
+
],
|
|
1679
|
+
ButtonHTMLAttributes: [
|
|
1680
|
+
{ name: "autoFocus", type: "boolean", required: false },
|
|
1681
|
+
{ name: "disabled", type: "boolean", required: false },
|
|
1682
|
+
{ name: "form", type: "string", required: false },
|
|
1683
|
+
{ name: "formAction", type: "string", required: false },
|
|
1684
|
+
{ name: "formMethod", type: "string", required: false },
|
|
1685
|
+
{ name: "formNoValidate", type: "boolean", required: false },
|
|
1686
|
+
{ name: "formTarget", type: "string", required: false },
|
|
1687
|
+
{ name: "name", type: "string", required: false },
|
|
1688
|
+
{
|
|
1689
|
+
name: "type",
|
|
1690
|
+
type: "string",
|
|
1691
|
+
required: false,
|
|
1692
|
+
allowedValues: ["button", "reset", "submit"]
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
name: "value",
|
|
1696
|
+
type: "string | number | readonly string[]",
|
|
1697
|
+
required: false
|
|
1698
|
+
}
|
|
1699
|
+
],
|
|
1700
|
+
InputHTMLAttributes: createTextControlSurface("ChangeEventHandler<HTMLInputElement>", [
|
|
1701
|
+
{ name: "checked", type: "boolean", required: false },
|
|
1702
|
+
{ name: "max", type: "number | string", required: false },
|
|
1703
|
+
{ name: "maxLength", type: "number", required: false },
|
|
1704
|
+
{ name: "min", type: "number | string", required: false },
|
|
1705
|
+
{ name: "minLength", type: "number", required: false },
|
|
1706
|
+
{ name: "type", type: "string", required: false }
|
|
1707
|
+
]),
|
|
1708
|
+
FieldsetHTMLAttributes: [
|
|
1709
|
+
{ name: "disabled", type: "boolean", required: false },
|
|
1710
|
+
{ name: "form", type: "string", required: false },
|
|
1711
|
+
{ name: "name", type: "string", required: false }
|
|
1712
|
+
],
|
|
1713
|
+
LabelHTMLAttributes: [
|
|
1714
|
+
{ name: "form", type: "string", required: false },
|
|
1715
|
+
{ name: "htmlFor", type: "string", required: false }
|
|
1716
|
+
],
|
|
1717
|
+
SelectHTMLAttributes: [
|
|
1718
|
+
{ name: "autoComplete", type: "string", required: false },
|
|
1719
|
+
{ name: "disabled", type: "boolean", required: false },
|
|
1720
|
+
{ name: "form", type: "string", required: false },
|
|
1721
|
+
{ name: "multiple", type: "boolean", required: false },
|
|
1722
|
+
{ name: "name", type: "string", required: false },
|
|
1723
|
+
{
|
|
1724
|
+
name: "onChange",
|
|
1725
|
+
type: "ChangeEventHandler<HTMLSelectElement>",
|
|
1726
|
+
required: false
|
|
1727
|
+
},
|
|
1728
|
+
{ name: "required", type: "boolean", required: false },
|
|
1729
|
+
{ name: "size", type: "number", required: false },
|
|
1730
|
+
{
|
|
1731
|
+
name: "value",
|
|
1732
|
+
type: "string | number | readonly string[]",
|
|
1733
|
+
required: false
|
|
1734
|
+
}
|
|
1735
|
+
],
|
|
1736
|
+
SVGAttributes: [
|
|
1737
|
+
{
|
|
1738
|
+
name: "focusable",
|
|
1739
|
+
type: 'boolean | "auto"',
|
|
1740
|
+
required: false,
|
|
1741
|
+
allowedValues: ["auto"]
|
|
1742
|
+
},
|
|
1743
|
+
{ name: "height", type: "number | string", required: false },
|
|
1744
|
+
{ name: "viewBox", type: "string", required: false },
|
|
1745
|
+
{ name: "width", type: "number | string", required: false }
|
|
1746
|
+
],
|
|
1747
|
+
SVGProps: [],
|
|
1748
|
+
TextareaHTMLAttributes: createTextControlSurface("ChangeEventHandler<HTMLTextAreaElement>", [
|
|
1749
|
+
{ name: "cols", type: "number", required: false },
|
|
1750
|
+
{ name: "rows", type: "number", required: false },
|
|
1751
|
+
{ name: "wrap", type: "string", required: false }
|
|
1752
|
+
]),
|
|
1753
|
+
TdHTMLAttributes: [
|
|
1754
|
+
{
|
|
1755
|
+
name: "align",
|
|
1756
|
+
type: "string",
|
|
1757
|
+
required: false,
|
|
1758
|
+
allowedValues: ["center", "char", "justify", "left", "right"]
|
|
1759
|
+
},
|
|
1760
|
+
{ name: "colSpan", type: "number", required: false },
|
|
1761
|
+
{ name: "headers", type: "string", required: false },
|
|
1762
|
+
{ name: "rowSpan", type: "number", required: false },
|
|
1763
|
+
{ name: "scope", type: "string", required: false }
|
|
1764
|
+
]
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue-tsx/extract-vue-tsx-components.js
|
|
1768
|
+
import { Node as Node5, SyntaxKind as SyntaxKind5 } from "ts-morph";
|
|
1769
|
+
|
|
1770
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/vue/extract-vue-components.js
|
|
1771
|
+
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
1772
|
+
import { Project as Project3, Node as Node6 } from "ts-morph";
|
|
1773
|
+
|
|
1774
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/astro/extract-astro-components.js
|
|
1775
|
+
import { Project as Project4, Node as Node7 } from "ts-morph";
|
|
1776
|
+
|
|
1777
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/web-components/extract-web-components.js
|
|
1778
|
+
import { Project as Project5, Node as Node8, SyntaxKind as SyntaxKind6 } from "ts-morph";
|
|
1779
|
+
|
|
1780
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/extraction/src/framework-adapters/svelte/extract-svelte-components.js
|
|
1781
|
+
import { parse as parseSvelte } from "svelte/compiler";
|
|
1782
|
+
import { Project as Project6, Node as Node9, ScriptTarget, ModuleKind, ts as ts2 } from "ts-morph";
|
|
1783
|
+
|
|
1784
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/controller/endpoint/compose-components-endpoint.js
|
|
1785
|
+
init_agents();
|
|
1786
|
+
|
|
1787
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/composition/src/services/run-composition-service.js
|
|
1788
|
+
init_agents();
|
|
1789
|
+
|
|
1790
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/controller/select-components-endpoint.js
|
|
1791
|
+
init_agents();
|
|
1792
|
+
|
|
1793
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/selection/src/services/run-selection-service.js
|
|
1794
|
+
init_agents();
|
|
1795
|
+
var DEFAULT_TIMEOUT_MS = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
1796
|
+
|
|
1797
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/index.js
|
|
1798
|
+
import { DatabaseSync as DatabaseSync2 } from "node:sqlite";
|
|
1799
|
+
|
|
1800
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/session/repositories/migration.js
|
|
1801
|
+
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
1802
|
+
|
|
1803
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/credentials/helpers/host-utils.js
|
|
1804
|
+
var DEFAULT_CONFIGURED_HOST = "api.contentful.com";
|
|
1805
|
+
|
|
1806
|
+
// packages/experience-design-system-backend-pipeline/dist/src/persistence/src/index.js
|
|
1807
|
+
init_cache_keys();
|
|
1808
|
+
|
|
1809
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/generate-cdf-components-endpoint.js
|
|
1810
|
+
init_agents();
|
|
1811
|
+
|
|
1812
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/services/run-cdf-generation-service.js
|
|
1813
|
+
init_agents();
|
|
1814
|
+
|
|
1815
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/services/run-apply-service.js
|
|
1816
|
+
init_shared();
|
|
1817
|
+
|
|
1818
|
+
// packages/experience-design-system-client/dist/src/generated/core/bodySerializer.gen.js
|
|
1819
|
+
var jsonBodySerializer = {
|
|
1820
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
1821
|
+
};
|
|
1822
|
+
|
|
1823
|
+
// packages/experience-design-system-client/dist/src/generated/core/params.gen.js
|
|
1824
|
+
var extraPrefixesMap = {
|
|
1825
|
+
$body_: "body",
|
|
1826
|
+
$headers_: "headers",
|
|
1827
|
+
$path_: "path",
|
|
1828
|
+
$query_: "query"
|
|
1829
|
+
};
|
|
1830
|
+
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
1831
|
+
|
|
1832
|
+
// packages/experience-design-system-client/dist/src/generated/core/auth.gen.js
|
|
1833
|
+
var getAuthToken = async (auth, callback) => {
|
|
1834
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
1835
|
+
if (!token) {
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
if (auth.scheme === "bearer") {
|
|
1839
|
+
return `Bearer ${token}`;
|
|
1840
|
+
}
|
|
1841
|
+
if (auth.scheme === "basic") {
|
|
1842
|
+
return `Basic ${btoa(token)}`;
|
|
1843
|
+
}
|
|
1844
|
+
return token;
|
|
1845
|
+
};
|
|
1846
|
+
|
|
1847
|
+
// packages/experience-design-system-client/dist/src/generated/core/pathSerializer.gen.js
|
|
1848
|
+
var separatorArrayExplode = (style) => {
|
|
1849
|
+
switch (style) {
|
|
1850
|
+
case "label":
|
|
1851
|
+
return ".";
|
|
1852
|
+
case "matrix":
|
|
1853
|
+
return ";";
|
|
1854
|
+
case "simple":
|
|
1855
|
+
return ",";
|
|
1856
|
+
default:
|
|
1857
|
+
return "&";
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
var separatorArrayNoExplode = (style) => {
|
|
1861
|
+
switch (style) {
|
|
1862
|
+
case "form":
|
|
1863
|
+
return ",";
|
|
1864
|
+
case "pipeDelimited":
|
|
1865
|
+
return "|";
|
|
1866
|
+
case "spaceDelimited":
|
|
1867
|
+
return "%20";
|
|
1868
|
+
default:
|
|
1869
|
+
return ",";
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
var separatorObjectExplode = (style) => {
|
|
1873
|
+
switch (style) {
|
|
1874
|
+
case "label":
|
|
1875
|
+
return ".";
|
|
1876
|
+
case "matrix":
|
|
1877
|
+
return ";";
|
|
1878
|
+
case "simple":
|
|
1879
|
+
return ",";
|
|
1880
|
+
default:
|
|
1881
|
+
return "&";
|
|
1882
|
+
}
|
|
1883
|
+
};
|
|
1884
|
+
var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
1885
|
+
if (!explode) {
|
|
1886
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
1887
|
+
switch (style) {
|
|
1888
|
+
case "label":
|
|
1889
|
+
return `.${joinedValues2}`;
|
|
1890
|
+
case "matrix":
|
|
1891
|
+
return `;${name}=${joinedValues2}`;
|
|
1892
|
+
case "simple":
|
|
1893
|
+
return joinedValues2;
|
|
1894
|
+
default:
|
|
1895
|
+
return `${name}=${joinedValues2}`;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
const separator = separatorArrayExplode(style);
|
|
1899
|
+
const joinedValues = value.map((v) => {
|
|
1900
|
+
if (style === "label" || style === "simple") {
|
|
1901
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
1902
|
+
}
|
|
1903
|
+
return serializePrimitiveParam({
|
|
1904
|
+
allowReserved,
|
|
1905
|
+
name,
|
|
1906
|
+
value: v
|
|
1907
|
+
});
|
|
1908
|
+
}).join(separator);
|
|
1909
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
1910
|
+
};
|
|
1911
|
+
var serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
1912
|
+
if (value === void 0 || value === null) {
|
|
1913
|
+
return "";
|
|
1914
|
+
}
|
|
1915
|
+
if (typeof value === "object") {
|
|
1916
|
+
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
|
|
1917
|
+
}
|
|
1918
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
1919
|
+
};
|
|
1920
|
+
var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
1921
|
+
if (value instanceof Date) {
|
|
1922
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
1923
|
+
}
|
|
1924
|
+
if (style !== "deepObject" && !explode) {
|
|
1925
|
+
let values = [];
|
|
1926
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
1927
|
+
values = [
|
|
1928
|
+
...values,
|
|
1929
|
+
key,
|
|
1930
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
1931
|
+
];
|
|
1932
|
+
});
|
|
1933
|
+
const joinedValues2 = values.join(",");
|
|
1934
|
+
switch (style) {
|
|
1935
|
+
case "form":
|
|
1936
|
+
return `${name}=${joinedValues2}`;
|
|
1937
|
+
case "label":
|
|
1938
|
+
return `.${joinedValues2}`;
|
|
1939
|
+
case "matrix":
|
|
1940
|
+
return `;${name}=${joinedValues2}`;
|
|
1941
|
+
default:
|
|
1942
|
+
return joinedValues2;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
const separator = separatorObjectExplode(style);
|
|
1946
|
+
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
1947
|
+
allowReserved,
|
|
1948
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
1949
|
+
value: v
|
|
1950
|
+
})).join(separator);
|
|
1951
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1954
|
+
// packages/experience-design-system-client/dist/src/generated/client/utils.gen.js
|
|
1955
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
1956
|
+
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
1957
|
+
let url = _url;
|
|
1958
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
1959
|
+
if (matches) {
|
|
1960
|
+
for (const match of matches) {
|
|
1961
|
+
let explode = false;
|
|
1962
|
+
let name = match.substring(1, match.length - 1);
|
|
1963
|
+
let style = "simple";
|
|
1964
|
+
if (name.endsWith("*")) {
|
|
1965
|
+
explode = true;
|
|
1966
|
+
name = name.substring(0, name.length - 1);
|
|
1967
|
+
}
|
|
1968
|
+
if (name.startsWith(".")) {
|
|
1969
|
+
name = name.substring(1);
|
|
1970
|
+
style = "label";
|
|
1971
|
+
} else if (name.startsWith(";")) {
|
|
1972
|
+
name = name.substring(1);
|
|
1973
|
+
style = "matrix";
|
|
1974
|
+
}
|
|
1975
|
+
const value = path[name];
|
|
1976
|
+
if (value === void 0 || value === null) {
|
|
1977
|
+
continue;
|
|
1978
|
+
}
|
|
1979
|
+
if (Array.isArray(value)) {
|
|
1980
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
1981
|
+
continue;
|
|
1982
|
+
}
|
|
1983
|
+
if (typeof value === "object") {
|
|
1984
|
+
url = url.replace(match, serializeObjectParam({
|
|
1985
|
+
explode,
|
|
1986
|
+
name,
|
|
1987
|
+
style,
|
|
1988
|
+
value,
|
|
1989
|
+
valueOnly: true
|
|
1990
|
+
}));
|
|
1991
|
+
continue;
|
|
1992
|
+
}
|
|
1993
|
+
if (style === "matrix") {
|
|
1994
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
1995
|
+
name,
|
|
1996
|
+
value
|
|
1997
|
+
})}`);
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
2001
|
+
url = url.replace(match, replaceValue);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
return url;
|
|
2005
|
+
};
|
|
2006
|
+
var createQuerySerializer = ({ allowReserved, array: array2, object } = {}) => {
|
|
2007
|
+
const querySerializer = (queryParams) => {
|
|
2008
|
+
const search = [];
|
|
2009
|
+
if (queryParams && typeof queryParams === "object") {
|
|
2010
|
+
for (const name in queryParams) {
|
|
2011
|
+
const value = queryParams[name];
|
|
2012
|
+
if (value === void 0 || value === null) {
|
|
2013
|
+
continue;
|
|
2014
|
+
}
|
|
2015
|
+
if (Array.isArray(value)) {
|
|
2016
|
+
const serializedArray = serializeArrayParam({
|
|
2017
|
+
allowReserved,
|
|
2018
|
+
explode: true,
|
|
2019
|
+
name,
|
|
2020
|
+
style: "form",
|
|
2021
|
+
value,
|
|
2022
|
+
...array2
|
|
2023
|
+
});
|
|
2024
|
+
if (serializedArray)
|
|
2025
|
+
search.push(serializedArray);
|
|
2026
|
+
} else if (typeof value === "object") {
|
|
2027
|
+
const serializedObject = serializeObjectParam({
|
|
2028
|
+
allowReserved,
|
|
2029
|
+
explode: true,
|
|
2030
|
+
name,
|
|
2031
|
+
style: "deepObject",
|
|
2032
|
+
value,
|
|
2033
|
+
...object
|
|
2034
|
+
});
|
|
2035
|
+
if (serializedObject)
|
|
2036
|
+
search.push(serializedObject);
|
|
2037
|
+
} else {
|
|
2038
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
2039
|
+
allowReserved,
|
|
2040
|
+
name,
|
|
2041
|
+
value
|
|
2042
|
+
});
|
|
2043
|
+
if (serializedPrimitive)
|
|
2044
|
+
search.push(serializedPrimitive);
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
return search.join("&");
|
|
2049
|
+
};
|
|
2050
|
+
return querySerializer;
|
|
2051
|
+
};
|
|
2052
|
+
var getParseAs = (contentType) => {
|
|
2053
|
+
if (!contentType) {
|
|
2054
|
+
return "stream";
|
|
2055
|
+
}
|
|
2056
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
2057
|
+
if (!cleanContent) {
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
2061
|
+
return "json";
|
|
2062
|
+
}
|
|
2063
|
+
if (cleanContent === "multipart/form-data") {
|
|
2064
|
+
return "formData";
|
|
2065
|
+
}
|
|
2066
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
2067
|
+
return "blob";
|
|
2068
|
+
}
|
|
2069
|
+
if (cleanContent.startsWith("text/")) {
|
|
2070
|
+
return "text";
|
|
2071
|
+
}
|
|
2072
|
+
return;
|
|
2073
|
+
};
|
|
2074
|
+
var checkForExistence = (options, name) => {
|
|
2075
|
+
if (!name) {
|
|
2076
|
+
return false;
|
|
2077
|
+
}
|
|
2078
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
2079
|
+
return true;
|
|
2080
|
+
}
|
|
2081
|
+
return false;
|
|
2082
|
+
};
|
|
2083
|
+
var setAuthParams = async ({ security, ...options }) => {
|
|
2084
|
+
for (const auth of security) {
|
|
2085
|
+
if (checkForExistence(options, auth.name)) {
|
|
2086
|
+
continue;
|
|
2087
|
+
}
|
|
2088
|
+
const token = await getAuthToken(auth, options.auth);
|
|
2089
|
+
if (!token) {
|
|
2090
|
+
continue;
|
|
2091
|
+
}
|
|
2092
|
+
const name = auth.name ?? "Authorization";
|
|
2093
|
+
switch (auth.in) {
|
|
2094
|
+
case "query":
|
|
2095
|
+
if (!options.query) {
|
|
2096
|
+
options.query = {};
|
|
2097
|
+
}
|
|
2098
|
+
options.query[name] = token;
|
|
2099
|
+
break;
|
|
2100
|
+
case "cookie":
|
|
2101
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
2102
|
+
break;
|
|
2103
|
+
case "header":
|
|
2104
|
+
default:
|
|
2105
|
+
options.headers.set(name, token);
|
|
2106
|
+
break;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
};
|
|
2110
|
+
var buildUrl = (options) => {
|
|
2111
|
+
const url = getUrl({
|
|
2112
|
+
baseUrl: options.baseUrl,
|
|
2113
|
+
path: options.path,
|
|
2114
|
+
query: options.query,
|
|
2115
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
2116
|
+
url: options.url
|
|
539
2117
|
});
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
2118
|
+
return url;
|
|
2119
|
+
};
|
|
2120
|
+
var getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
2121
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
2122
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
2123
|
+
if (path) {
|
|
2124
|
+
url = defaultPathSerializer({ path, url });
|
|
2125
|
+
}
|
|
2126
|
+
let search = query ? querySerializer(query) : "";
|
|
2127
|
+
if (search.startsWith("?")) {
|
|
2128
|
+
search = search.substring(1);
|
|
2129
|
+
}
|
|
2130
|
+
if (search) {
|
|
2131
|
+
url += `?${search}`;
|
|
2132
|
+
}
|
|
2133
|
+
return url;
|
|
2134
|
+
};
|
|
2135
|
+
var mergeConfigs = (a, b) => {
|
|
2136
|
+
const config = { ...a, ...b };
|
|
2137
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
2138
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
2139
|
+
}
|
|
2140
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
2141
|
+
return config;
|
|
2142
|
+
};
|
|
2143
|
+
var mergeHeaders = (...headers) => {
|
|
2144
|
+
const mergedHeaders = new Headers();
|
|
2145
|
+
for (const header of headers) {
|
|
2146
|
+
if (!header || typeof header !== "object") {
|
|
2147
|
+
continue;
|
|
2148
|
+
}
|
|
2149
|
+
const iterator = header instanceof Headers ? header.entries() : Object.entries(header);
|
|
2150
|
+
for (const [key, value] of iterator) {
|
|
2151
|
+
if (value === null) {
|
|
2152
|
+
mergedHeaders.delete(key);
|
|
2153
|
+
} else if (Array.isArray(value)) {
|
|
2154
|
+
for (const v of value) {
|
|
2155
|
+
mergedHeaders.append(key, v);
|
|
2156
|
+
}
|
|
2157
|
+
} else if (value !== void 0) {
|
|
2158
|
+
mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
return mergedHeaders;
|
|
2163
|
+
};
|
|
2164
|
+
var Interceptors = class {
|
|
2165
|
+
_fns;
|
|
2166
|
+
constructor() {
|
|
2167
|
+
this._fns = [];
|
|
2168
|
+
}
|
|
2169
|
+
clear() {
|
|
2170
|
+
this._fns = [];
|
|
2171
|
+
}
|
|
2172
|
+
getInterceptorIndex(id) {
|
|
2173
|
+
if (typeof id === "number") {
|
|
2174
|
+
return this._fns[id] ? id : -1;
|
|
2175
|
+
} else {
|
|
2176
|
+
return this._fns.indexOf(id);
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
exists(id) {
|
|
2180
|
+
const index = this.getInterceptorIndex(id);
|
|
2181
|
+
return !!this._fns[index];
|
|
2182
|
+
}
|
|
2183
|
+
eject(id) {
|
|
2184
|
+
const index = this.getInterceptorIndex(id);
|
|
2185
|
+
if (this._fns[index]) {
|
|
2186
|
+
this._fns[index] = null;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
update(id, fn) {
|
|
2190
|
+
const index = this.getInterceptorIndex(id);
|
|
2191
|
+
if (this._fns[index]) {
|
|
2192
|
+
this._fns[index] = fn;
|
|
2193
|
+
return id;
|
|
2194
|
+
} else {
|
|
2195
|
+
return false;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
use(fn) {
|
|
2199
|
+
this._fns = [...this._fns, fn];
|
|
2200
|
+
return this._fns.length - 1;
|
|
2201
|
+
}
|
|
2202
|
+
};
|
|
2203
|
+
var createInterceptors = () => ({
|
|
2204
|
+
error: new Interceptors(),
|
|
2205
|
+
request: new Interceptors(),
|
|
2206
|
+
response: new Interceptors()
|
|
2207
|
+
});
|
|
2208
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
2209
|
+
allowReserved: false,
|
|
2210
|
+
array: {
|
|
2211
|
+
explode: true,
|
|
2212
|
+
style: "form"
|
|
2213
|
+
},
|
|
2214
|
+
object: {
|
|
2215
|
+
explode: true,
|
|
2216
|
+
style: "deepObject"
|
|
544
2217
|
}
|
|
2218
|
+
});
|
|
2219
|
+
var defaultHeaders = {
|
|
2220
|
+
"Content-Type": "application/json"
|
|
2221
|
+
};
|
|
2222
|
+
var createConfig = (override = {}) => ({
|
|
2223
|
+
...jsonBodySerializer,
|
|
2224
|
+
headers: defaultHeaders,
|
|
2225
|
+
parseAs: "auto",
|
|
2226
|
+
querySerializer: defaultQuerySerializer,
|
|
2227
|
+
...override
|
|
2228
|
+
});
|
|
2229
|
+
|
|
2230
|
+
// packages/experience-design-system-client/dist/src/generated/client/client.gen.js
|
|
2231
|
+
var createClient = (config = {}) => {
|
|
2232
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
2233
|
+
const getConfig = () => ({ ..._config });
|
|
2234
|
+
const setConfig = (config2) => {
|
|
2235
|
+
_config = mergeConfigs(_config, config2);
|
|
2236
|
+
return getConfig();
|
|
2237
|
+
};
|
|
2238
|
+
const interceptors = createInterceptors();
|
|
2239
|
+
const request = async (options) => {
|
|
2240
|
+
const opts = {
|
|
2241
|
+
..._config,
|
|
2242
|
+
...options,
|
|
2243
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
2244
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
2245
|
+
serializedBody: void 0
|
|
2246
|
+
};
|
|
2247
|
+
if (opts.security) {
|
|
2248
|
+
await setAuthParams({
|
|
2249
|
+
...opts,
|
|
2250
|
+
security: opts.security
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
if (opts.requestValidator) {
|
|
2254
|
+
await opts.requestValidator(opts);
|
|
2255
|
+
}
|
|
2256
|
+
if (opts.body && opts.bodySerializer) {
|
|
2257
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
2258
|
+
}
|
|
2259
|
+
if (opts.serializedBody === void 0 || opts.serializedBody === "") {
|
|
2260
|
+
opts.headers.delete("Content-Type");
|
|
2261
|
+
}
|
|
2262
|
+
const url = buildUrl(opts);
|
|
2263
|
+
const requestInit = {
|
|
2264
|
+
redirect: "follow",
|
|
2265
|
+
...opts,
|
|
2266
|
+
body: opts.serializedBody
|
|
2267
|
+
};
|
|
2268
|
+
let request2 = new Request(url, requestInit);
|
|
2269
|
+
for (const fn of interceptors.request._fns) {
|
|
2270
|
+
if (fn) {
|
|
2271
|
+
request2 = await fn(request2, opts);
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
const _fetch = opts.fetch;
|
|
2275
|
+
let response = await _fetch(request2);
|
|
2276
|
+
for (const fn of interceptors.response._fns) {
|
|
2277
|
+
if (fn) {
|
|
2278
|
+
response = await fn(response, request2, opts);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
const result = {
|
|
2282
|
+
request: request2,
|
|
2283
|
+
response
|
|
2284
|
+
};
|
|
2285
|
+
if (response.ok) {
|
|
2286
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
2287
|
+
return opts.responseStyle === "data" ? {} : {
|
|
2288
|
+
data: {},
|
|
2289
|
+
...result
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
2293
|
+
let data;
|
|
2294
|
+
switch (parseAs) {
|
|
2295
|
+
case "arrayBuffer":
|
|
2296
|
+
case "blob":
|
|
2297
|
+
case "formData":
|
|
2298
|
+
case "json":
|
|
2299
|
+
case "text":
|
|
2300
|
+
data = await response[parseAs]();
|
|
2301
|
+
break;
|
|
2302
|
+
case "stream":
|
|
2303
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
2304
|
+
data: response.body,
|
|
2305
|
+
...result
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
if (parseAs === "json") {
|
|
2309
|
+
if (opts.responseValidator) {
|
|
2310
|
+
await opts.responseValidator(data);
|
|
2311
|
+
}
|
|
2312
|
+
if (opts.responseTransformer) {
|
|
2313
|
+
data = await opts.responseTransformer(data);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
return opts.responseStyle === "data" ? data : {
|
|
2317
|
+
data,
|
|
2318
|
+
...result
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
const textError = await response.text();
|
|
2322
|
+
let jsonError;
|
|
2323
|
+
try {
|
|
2324
|
+
jsonError = JSON.parse(textError);
|
|
2325
|
+
} catch {
|
|
2326
|
+
}
|
|
2327
|
+
const error = jsonError ?? textError;
|
|
2328
|
+
let finalError = error;
|
|
2329
|
+
for (const fn of interceptors.error._fns) {
|
|
2330
|
+
if (fn) {
|
|
2331
|
+
finalError = await fn(error, response, request2, opts);
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
finalError = finalError || {};
|
|
2335
|
+
if (opts.throwOnError) {
|
|
2336
|
+
throw finalError;
|
|
2337
|
+
}
|
|
2338
|
+
return opts.responseStyle === "data" ? void 0 : {
|
|
2339
|
+
error: finalError,
|
|
2340
|
+
...result
|
|
2341
|
+
};
|
|
2342
|
+
};
|
|
545
2343
|
return {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
2344
|
+
buildUrl,
|
|
2345
|
+
connect: (options) => request({ ...options, method: "CONNECT" }),
|
|
2346
|
+
delete: (options) => request({ ...options, method: "DELETE" }),
|
|
2347
|
+
get: (options) => request({ ...options, method: "GET" }),
|
|
2348
|
+
getConfig,
|
|
2349
|
+
head: (options) => request({ ...options, method: "HEAD" }),
|
|
2350
|
+
interceptors,
|
|
2351
|
+
options: (options) => request({ ...options, method: "OPTIONS" }),
|
|
2352
|
+
patch: (options) => request({ ...options, method: "PATCH" }),
|
|
2353
|
+
post: (options) => request({ ...options, method: "POST" }),
|
|
2354
|
+
put: (options) => request({ ...options, method: "PUT" }),
|
|
2355
|
+
request,
|
|
2356
|
+
setConfig,
|
|
2357
|
+
trace: (options) => request({ ...options, method: "TRACE" })
|
|
549
2358
|
};
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
// packages/experience-design-system-client/dist/src/generated/client.gen.js
|
|
2362
|
+
var client = createClient(createConfig());
|
|
2363
|
+
|
|
2364
|
+
// packages/experience-design-system-client/dist/src/generated/sdk.gen.js
|
|
2365
|
+
var designSystemImportSourcelessPreview = (options) => {
|
|
2366
|
+
return (options.client ?? client).post({
|
|
2367
|
+
url: "/spaces/{spaceId}/environments/{environmentId}/design_systems/imports/preview",
|
|
2368
|
+
...options,
|
|
2369
|
+
headers: {
|
|
2370
|
+
"Content-Type": "application/json",
|
|
2371
|
+
...options.headers
|
|
2372
|
+
}
|
|
2373
|
+
});
|
|
2374
|
+
};
|
|
2375
|
+
var designSystemImportApply = (options) => {
|
|
2376
|
+
return (options.client ?? client).post({
|
|
2377
|
+
url: "/spaces/{spaceId}/environments/{environmentId}/design_systems/imports/apply",
|
|
2378
|
+
...options,
|
|
2379
|
+
headers: {
|
|
2380
|
+
"Content-Type": "application/json",
|
|
2381
|
+
...options.headers
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
};
|
|
2385
|
+
var designSystemImportGetOperation = (options) => {
|
|
2386
|
+
return (options.client ?? client).get({
|
|
2387
|
+
url: "/spaces/{spaceId}/environments/{environmentId}/design_systems/imports/apply/{operationId}",
|
|
2388
|
+
...options
|
|
2389
|
+
});
|
|
2390
|
+
};
|
|
2391
|
+
|
|
2392
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/constants/api.js
|
|
2393
|
+
var PREVIEW_ERROR_PREFIX = "preview failed:";
|
|
2394
|
+
var APPLY_ERROR_PREFIX = "apply failed:";
|
|
2395
|
+
var USER_AGENT = "experience-design-system-backend-pipeline";
|
|
2396
|
+
|
|
2397
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/http-utils.js
|
|
2398
|
+
var MAX_RETRY_AFTER_MS = 6e4;
|
|
2399
|
+
function isTransientStatus(status) {
|
|
2400
|
+
return status >= 500 && status <= 599;
|
|
2401
|
+
}
|
|
2402
|
+
function retryAfterMs(response) {
|
|
2403
|
+
const value = response.headers?.get("retry-after")?.trim();
|
|
2404
|
+
if (!value)
|
|
2405
|
+
return void 0;
|
|
2406
|
+
const seconds = Number(value);
|
|
2407
|
+
const delayMs = Number.isFinite(seconds) ? seconds * 1e3 : Date.parse(value) - Date.now();
|
|
2408
|
+
if (!Number.isFinite(delayMs) || delayMs < 0 || delayMs > MAX_RETRY_AFTER_MS)
|
|
2409
|
+
return void 0;
|
|
2410
|
+
return Math.round(delayMs);
|
|
550
2411
|
}
|
|
551
|
-
function
|
|
552
|
-
if (
|
|
553
|
-
|
|
2412
|
+
function isApsDenialBody(body) {
|
|
2413
|
+
if (!body)
|
|
2414
|
+
return false;
|
|
2415
|
+
try {
|
|
2416
|
+
const parsed = JSON.parse(body);
|
|
2417
|
+
const id = parsed?.sys?.id;
|
|
2418
|
+
return id === "NotFound" || id === "AccessDenied";
|
|
2419
|
+
} catch {
|
|
2420
|
+
return false;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
function stringifyError(error) {
|
|
2424
|
+
return typeof error === "string" ? error : JSON.stringify(error ?? {});
|
|
2425
|
+
}
|
|
2426
|
+
function errorMessage(error) {
|
|
2427
|
+
return error instanceof Error && error.message ? error.message : String(error);
|
|
2428
|
+
}
|
|
2429
|
+
function defaultSleep(delayMs) {
|
|
2430
|
+
return new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/sanitize-preview.js
|
|
2434
|
+
var PROPERTY_BREAKING_REASONS = /* @__PURE__ */ new Set([
|
|
2435
|
+
"removed",
|
|
2436
|
+
"added_required_no_default",
|
|
2437
|
+
"type_changed",
|
|
2438
|
+
"validation_narrowed"
|
|
2439
|
+
]);
|
|
2440
|
+
var SLOT_BREAKING_REASONS = /* @__PURE__ */ new Set(["slot_removed", "slot_allowed_components_narrowed"]);
|
|
2441
|
+
function sanitizeBreakingChanges(raw) {
|
|
2442
|
+
if (!Array.isArray(raw))
|
|
2443
|
+
return [];
|
|
2444
|
+
const out = [];
|
|
2445
|
+
for (const bc of raw) {
|
|
2446
|
+
if (typeof bc !== "object" || bc === null)
|
|
2447
|
+
continue;
|
|
2448
|
+
const reason = bc.reason;
|
|
2449
|
+
if (typeof reason !== "string")
|
|
2450
|
+
continue;
|
|
2451
|
+
if ("propertyId" in bc && typeof bc.propertyId === "string") {
|
|
2452
|
+
if (PROPERTY_BREAKING_REASONS.has(reason))
|
|
2453
|
+
out.push(bc);
|
|
2454
|
+
continue;
|
|
2455
|
+
}
|
|
2456
|
+
if ("slotId" in bc && typeof bc.slotId === "string") {
|
|
2457
|
+
if (SLOT_BREAKING_REASONS.has(reason))
|
|
2458
|
+
out.push(bc);
|
|
2459
|
+
continue;
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
return out;
|
|
554
2463
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if (
|
|
559
|
-
|
|
2464
|
+
function sanitizePreviewResponse(res) {
|
|
2465
|
+
for (const item of res.components?.changed ?? []) {
|
|
2466
|
+
const cc = item.changeClassification;
|
|
2467
|
+
if (cc && Array.isArray(cc.breakingChanges)) {
|
|
2468
|
+
cc.breakingChanges = sanitizeBreakingChanges(cc.breakingChanges);
|
|
2469
|
+
}
|
|
560
2470
|
}
|
|
561
|
-
|
|
562
|
-
return void 0;
|
|
2471
|
+
return res;
|
|
563
2472
|
}
|
|
564
2473
|
|
|
565
|
-
// packages/experience-design-system-
|
|
566
|
-
var
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
{ keys: "Esc", label: "Back" }
|
|
576
|
-
]
|
|
577
|
-
};
|
|
578
|
-
function controlsFor(phase) {
|
|
579
|
-
return CONTROLS[phase];
|
|
2474
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/host-utils.js
|
|
2475
|
+
var DEFAULT_API_HOST = "https://api.contentful.com";
|
|
2476
|
+
function trimTrailingSlashes(value) {
|
|
2477
|
+
return value.replace(/\/+$/, "");
|
|
2478
|
+
}
|
|
2479
|
+
function normalizeHostInput(host) {
|
|
2480
|
+
const value = host?.trim();
|
|
2481
|
+
if (!value)
|
|
2482
|
+
return void 0;
|
|
2483
|
+
return trimTrailingSlashes(value);
|
|
580
2484
|
}
|
|
581
|
-
function
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
2485
|
+
function toConfiguredHost2(host) {
|
|
2486
|
+
const normalized = normalizeHostInput(host);
|
|
2487
|
+
if (!normalized)
|
|
2488
|
+
return void 0;
|
|
2489
|
+
return normalized.replace(/^https:\/\//i, "");
|
|
2490
|
+
}
|
|
2491
|
+
function toApiHost2(host) {
|
|
2492
|
+
const normalized = normalizeHostInput(host);
|
|
2493
|
+
if (!normalized)
|
|
2494
|
+
return DEFAULT_API_HOST;
|
|
2495
|
+
if (/^[a-z][a-z\d+\-.]*:\/\//i.test(normalized))
|
|
2496
|
+
return normalized;
|
|
2497
|
+
return `https://${normalized}`;
|
|
588
2498
|
}
|
|
589
2499
|
|
|
590
|
-
// packages/experience-design-system-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
2500
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/types/api-error.js
|
|
2501
|
+
var ERROR_BODY_LOG_CAP = 16384;
|
|
2502
|
+
var ApiError = class extends Error {
|
|
2503
|
+
status;
|
|
2504
|
+
body;
|
|
2505
|
+
guidance;
|
|
2506
|
+
constructor(message, status, body, guidance) {
|
|
2507
|
+
super(message);
|
|
2508
|
+
this.status = status;
|
|
2509
|
+
this.body = body;
|
|
2510
|
+
this.guidance = guidance;
|
|
2511
|
+
if (body) {
|
|
2512
|
+
const trimmed = body.length > ERROR_BODY_LOG_CAP ? body.slice(0, ERROR_BODY_LOG_CAP) + "\u2026" : body;
|
|
2513
|
+
this.message = `${message}
|
|
2514
|
+
${trimmed}`;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
};
|
|
2518
|
+
|
|
2519
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/api-client/api-client.js
|
|
2520
|
+
var ApiClient = class {
|
|
2521
|
+
host;
|
|
2522
|
+
token;
|
|
2523
|
+
spaceId;
|
|
2524
|
+
environmentId;
|
|
2525
|
+
retry;
|
|
2526
|
+
lastRequestId;
|
|
2527
|
+
constructor(opts) {
|
|
2528
|
+
this.host = toApiHost2(opts.host);
|
|
2529
|
+
this.token = opts.cmaToken;
|
|
2530
|
+
this.spaceId = opts.spaceId;
|
|
2531
|
+
this.environmentId = opts.environmentId;
|
|
2532
|
+
const initialDelayMs = Math.max(0, opts.retry?.initialDelayMs ?? 250);
|
|
2533
|
+
this.retry = {
|
|
2534
|
+
maxAttempts: Math.max(1, Math.floor(opts.retry?.maxAttempts ?? 3)),
|
|
2535
|
+
initialDelayMs,
|
|
2536
|
+
maxDelayMs: Math.max(initialDelayMs, opts.retry?.maxDelayMs ?? 2e3),
|
|
2537
|
+
sleep: opts.retry?.sleep ?? defaultSleep
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
getLastRequestId() {
|
|
2541
|
+
return this.lastRequestId;
|
|
2542
|
+
}
|
|
2543
|
+
noteRequestId(response) {
|
|
2544
|
+
const id = response.headers.get("x-contentful-request-id");
|
|
2545
|
+
if (id)
|
|
2546
|
+
this.lastRequestId = id;
|
|
2547
|
+
}
|
|
2548
|
+
headers() {
|
|
2549
|
+
return {
|
|
2550
|
+
Authorization: `Bearer ${this.token}`,
|
|
2551
|
+
"Content-Type": "application/json",
|
|
2552
|
+
"X-Contentful-User-Agent": USER_AGENT
|
|
2553
|
+
};
|
|
2554
|
+
}
|
|
2555
|
+
async requestWithRetry(phase, errorPrefix, makeCall) {
|
|
2556
|
+
for (let attempt = 1; attempt <= this.retry.maxAttempts; attempt++) {
|
|
2557
|
+
let result;
|
|
2558
|
+
try {
|
|
2559
|
+
result = await makeCall();
|
|
2560
|
+
} catch (error) {
|
|
2561
|
+
if (attempt === this.retry.maxAttempts) {
|
|
2562
|
+
const body = `The request failed after ${attempt} attempts because of a network error: ${errorMessage(error)}. Check your connection and try again.`;
|
|
2563
|
+
throw new ApiError(`${errorPrefix} 0`, 0, body);
|
|
2564
|
+
}
|
|
2565
|
+
await this.retry.sleep(Math.min(this.retry.initialDelayMs * 2 ** (attempt - 1), this.retry.maxDelayMs));
|
|
2566
|
+
continue;
|
|
2567
|
+
}
|
|
2568
|
+
if (!isTransientStatus(result.response.status)) {
|
|
2569
|
+
this.noteRequestId(result.response);
|
|
2570
|
+
return result;
|
|
2571
|
+
}
|
|
2572
|
+
if (attempt === this.retry.maxAttempts) {
|
|
2573
|
+
const body = stringifyError(result.error);
|
|
2574
|
+
const guidance = `The ${phase} request failed after ${attempt} attempts because the service remained unavailable. Wait a moment and try again.`;
|
|
2575
|
+
throw new ApiError(`${errorPrefix} ${result.response.status}`, result.response.status, body, guidance);
|
|
2576
|
+
}
|
|
2577
|
+
const backoffMs = Math.min(this.retry.initialDelayMs * 2 ** (attempt - 1), this.retry.maxDelayMs);
|
|
2578
|
+
await this.retry.sleep(retryAfterMs(result.response) ?? backoffMs);
|
|
2579
|
+
}
|
|
2580
|
+
throw new Error("Retry attempts exhausted");
|
|
2581
|
+
}
|
|
2582
|
+
async validateToken() {
|
|
2583
|
+
const res = await fetch(`${this.host}/users/me`, { headers: this.headers() });
|
|
2584
|
+
this.noteRequestId(res);
|
|
2585
|
+
if (res.status === 401) {
|
|
2586
|
+
throw new ApiError("CMA token is invalid or revoked", res.status, await res.text());
|
|
2587
|
+
}
|
|
2588
|
+
if (!res.ok) {
|
|
2589
|
+
throw new ApiError(`unexpected error validating token: ${res.status}`, res.status, await res.text());
|
|
2590
|
+
}
|
|
2591
|
+
await this.checkPreflight();
|
|
2592
|
+
}
|
|
2593
|
+
async checkPreflight() {
|
|
2594
|
+
const url = `${this.host}/spaces/${this.spaceId}/environments/${this.environmentId}/design_systems/preflight`;
|
|
2595
|
+
let res;
|
|
2596
|
+
try {
|
|
2597
|
+
res = await fetch(url, { headers: this.headers() });
|
|
2598
|
+
} catch {
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
this.noteRequestId(res);
|
|
2602
|
+
if (res.ok)
|
|
2603
|
+
return;
|
|
2604
|
+
if (res.status >= 500)
|
|
2605
|
+
return;
|
|
2606
|
+
const body = await res.text();
|
|
2607
|
+
if (res.status === 404 && !isApsDenialBody(body))
|
|
2608
|
+
return;
|
|
2609
|
+
throw new ApiError(`preflight failed: ${res.status}`, res.status, body);
|
|
2610
|
+
}
|
|
2611
|
+
async previewImport(cdf) {
|
|
2612
|
+
const result = await this.requestWithRetry("preview", PREVIEW_ERROR_PREFIX, () => designSystemImportSourcelessPreview({
|
|
2613
|
+
baseUrl: this.host,
|
|
2614
|
+
headers: this.headers(),
|
|
2615
|
+
path: { spaceId: this.spaceId, environmentId: this.environmentId },
|
|
2616
|
+
body: cdf,
|
|
2617
|
+
parseAs: "json"
|
|
2618
|
+
}));
|
|
2619
|
+
if (!result.response.ok) {
|
|
2620
|
+
throw new ApiError(`${PREVIEW_ERROR_PREFIX} ${result.response.status}`, result.response.status, stringifyError(result.error));
|
|
2621
|
+
}
|
|
2622
|
+
return sanitizePreviewResponse(result.data);
|
|
2623
|
+
}
|
|
2624
|
+
async applyImport(cdf, opts) {
|
|
2625
|
+
let result;
|
|
2626
|
+
try {
|
|
2627
|
+
result = await designSystemImportApply({
|
|
2628
|
+
baseUrl: this.host,
|
|
2629
|
+
headers: this.headers(),
|
|
2630
|
+
path: { spaceId: this.spaceId, environmentId: this.environmentId },
|
|
2631
|
+
body: { ...cdf, acknowledgeBreakingChanges: opts.acknowledgeBreakingChanges },
|
|
2632
|
+
parseAs: "json"
|
|
2633
|
+
});
|
|
2634
|
+
} catch (error) {
|
|
2635
|
+
const body = `The apply request was not retried because its outcome is unknown and retrying could start a duplicate operation. Cause: ${errorMessage(error)}`;
|
|
2636
|
+
throw new ApiError(`${APPLY_ERROR_PREFIX} 0`, 0, body);
|
|
2637
|
+
}
|
|
2638
|
+
if (!result.response.ok) {
|
|
2639
|
+
const body = stringifyError(result.error);
|
|
2640
|
+
const guidance = isTransientStatus(result.response.status) ? "The apply request was not retried because the server may already have started an operation and retrying could create a duplicate." : void 0;
|
|
2641
|
+
throw new ApiError(`${APPLY_ERROR_PREFIX} ${result.response.status}`, result.response.status, body, guidance);
|
|
2642
|
+
}
|
|
2643
|
+
this.noteRequestId(result.response);
|
|
2644
|
+
return result.data;
|
|
2645
|
+
}
|
|
2646
|
+
async pollOperation(operationId, opts = {}) {
|
|
2647
|
+
const intervalMs = opts.intervalMs ?? 2e3;
|
|
2648
|
+
const maxIntervalMs = opts.maxIntervalMs ?? Math.round(intervalMs * 2.5);
|
|
2649
|
+
const maxAttempts = opts.maxAttempts ?? 150;
|
|
2650
|
+
const terminalStatuses = /* @__PURE__ */ new Set(["succeeded", "partial", "failed"]);
|
|
2651
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
2652
|
+
const result = await this.requestWithRetry("poll", "poll failed:", () => designSystemImportGetOperation({
|
|
2653
|
+
baseUrl: this.host,
|
|
2654
|
+
headers: this.headers(),
|
|
2655
|
+
path: { spaceId: this.spaceId, environmentId: this.environmentId, operationId },
|
|
2656
|
+
parseAs: "json"
|
|
2657
|
+
}));
|
|
2658
|
+
if (!result.response.ok) {
|
|
2659
|
+
throw new ApiError(`poll failed: ${result.response.status}`, result.response.status, stringifyError(result.error));
|
|
2660
|
+
}
|
|
2661
|
+
const op = result.data;
|
|
2662
|
+
opts.onProgress?.(op);
|
|
2663
|
+
if (terminalStatuses.has(op.sys.status))
|
|
2664
|
+
return op;
|
|
2665
|
+
if (attempt < maxAttempts - 1) {
|
|
2666
|
+
const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
|
|
2667
|
+
const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
|
|
2668
|
+
const jitter = Math.random() * baseDelay * 0.15;
|
|
2669
|
+
await new Promise((resolve2) => setTimeout(resolve2, baseDelay + jitter));
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
|
|
2673
|
+
}
|
|
2674
|
+
};
|
|
2675
|
+
|
|
2676
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/controller/validation/assert-no-unresolved-slot-references.js
|
|
2677
|
+
init_shared();
|
|
2678
|
+
|
|
2679
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/parse-binding-diagnostics.js
|
|
2680
|
+
function parseBindingDiagnostics(body) {
|
|
2681
|
+
if (!/binding configurations are invalid|Pointer path does not exist/i.test(body))
|
|
2682
|
+
return null;
|
|
2683
|
+
const locationMatches = [...body.matchAll(/(?:^|\.\s)([A-Za-z0-9_$-]+(?:\s*›\s*[A-Za-z0-9_$-]+){2,})/g)];
|
|
2684
|
+
const location = locationMatches.at(-1)?.[1];
|
|
2685
|
+
const pointerMessage = body.match(/Pointer path does not exist for '\[object Object\]':\s*(.+?)(?=\.\s*Default\s*›|$)/i)?.[1];
|
|
2686
|
+
const graphQlMessage = body.match(/return GraphQL validation error:\s*(.+?)(?=\.\s*Default\s*›|$)/i)?.[1];
|
|
2687
|
+
const heading = body.match(/^(.*?)(?=\.?\s*Pointer path does not exist|\.?\s*Default\s*›)/i)?.[1]?.trim();
|
|
2688
|
+
const diagnostics = [];
|
|
2689
|
+
if (pointerMessage)
|
|
2690
|
+
diagnostics.push({ message: pointerMessage.trim(), ...location ? { path: location } : {} });
|
|
2691
|
+
if (graphQlMessage)
|
|
2692
|
+
diagnostics.push({ message: graphQlMessage.trim(), ...location ? { path: location } : {} });
|
|
2693
|
+
return {
|
|
2694
|
+
code: "BindingValidationFailed",
|
|
2695
|
+
message: heading || "One or more binding configurations are invalid.",
|
|
2696
|
+
...diagnostics.length > 0 ? { diagnostics } : {}
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/helpers.js
|
|
2701
|
+
function asRecord(value) {
|
|
2702
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
2703
|
+
}
|
|
2704
|
+
function displayValue(value) {
|
|
2705
|
+
if (typeof value === "string")
|
|
2706
|
+
return value;
|
|
2707
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
2708
|
+
return String(value);
|
|
2709
|
+
if (value === null || value === void 0)
|
|
2710
|
+
return null;
|
|
594
2711
|
try {
|
|
595
|
-
return
|
|
2712
|
+
return JSON.stringify(value);
|
|
596
2713
|
} catch {
|
|
597
|
-
return
|
|
2714
|
+
return null;
|
|
598
2715
|
}
|
|
599
2716
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
if (entry.isDirectory()) return countFiles(path);
|
|
603
|
-
if (entry.isFile() || entry.isSymbolicLink() && await isFile(path)) return addFile(emptyCounts(), entry.name);
|
|
604
|
-
return emptyCounts();
|
|
2717
|
+
function isPathSegment(value) {
|
|
2718
|
+
return typeof value === "string" || typeof value === "number" && Number.isFinite(value);
|
|
605
2719
|
}
|
|
606
|
-
|
|
607
|
-
|
|
2720
|
+
function formatPath(value) {
|
|
2721
|
+
if (isPathSegment(value))
|
|
2722
|
+
return String(value) ? { path: String(value) } : { path: null };
|
|
2723
|
+
if (Array.isArray(value)) {
|
|
2724
|
+
const parts = value.filter(isPathSegment);
|
|
2725
|
+
return parts.length > 0 ? { path: parts.join(" \u203A ") } : { path: null };
|
|
2726
|
+
}
|
|
2727
|
+
return {};
|
|
2728
|
+
}
|
|
2729
|
+
function componentFromPath(path) {
|
|
2730
|
+
if (!path)
|
|
2731
|
+
return void 0;
|
|
2732
|
+
const manifestMatch = path.match(/manifest:components\/([^/›]+)/);
|
|
2733
|
+
if (manifestMatch?.[1])
|
|
2734
|
+
return manifestMatch[1];
|
|
2735
|
+
const parts = path.split(/[›/]/).map((part) => part.trim()).filter(Boolean);
|
|
2736
|
+
const componentsIndex = parts.findIndex((part) => part === "components");
|
|
2737
|
+
return componentsIndex === -1 ? void 0 : parts[componentsIndex + 1];
|
|
2738
|
+
}
|
|
2739
|
+
function diagnosticMessage(error) {
|
|
2740
|
+
const candidates = [
|
|
2741
|
+
["message", error.message],
|
|
2742
|
+
["details", error.details],
|
|
2743
|
+
["error", error.error],
|
|
2744
|
+
["name", error.name]
|
|
2745
|
+
];
|
|
2746
|
+
for (const [messageSource, value] of candidates) {
|
|
2747
|
+
const message = displayValue(value);
|
|
2748
|
+
if (message !== null)
|
|
2749
|
+
return { message, messageSource };
|
|
2750
|
+
}
|
|
2751
|
+
return { message: "Validation failed" };
|
|
2752
|
+
}
|
|
2753
|
+
function parseObjectLiteralTail(body) {
|
|
2754
|
+
const braceStart = body.lastIndexOf("{");
|
|
2755
|
+
if (braceStart === -1)
|
|
2756
|
+
return null;
|
|
2757
|
+
const tail = body.slice(braceStart);
|
|
2758
|
+
const codeMatch = tail.match(/code:\s*['"]([^'"]+)['"]/);
|
|
2759
|
+
const cycleMatch = tail.match(/cycle:\s*\[\s*([^\]]*)\s*\]/);
|
|
2760
|
+
if (!codeMatch && !cycleMatch)
|
|
2761
|
+
return null;
|
|
2762
|
+
const code = codeMatch ? codeMatch[1] : null;
|
|
2763
|
+
let cycle = null;
|
|
2764
|
+
if (cycleMatch) {
|
|
2765
|
+
cycle = cycleMatch[1].split(",").map((s) => s.trim().replace(/^['"]|['"]$/g, "")).filter((s) => s.length > 0);
|
|
2766
|
+
if (cycle.length === 0)
|
|
2767
|
+
cycle = null;
|
|
2768
|
+
}
|
|
2769
|
+
return { code, cycle };
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/parse-json-body.js
|
|
2773
|
+
function parseValidationDiagnostics(details) {
|
|
2774
|
+
if (!Array.isArray(details.errors))
|
|
2775
|
+
return [];
|
|
2776
|
+
const diagnostics = [];
|
|
2777
|
+
for (const rawError of details.errors) {
|
|
2778
|
+
const error = asRecord(rawError);
|
|
2779
|
+
if (!error)
|
|
2780
|
+
continue;
|
|
2781
|
+
const location = formatPath(error.path);
|
|
2782
|
+
const component = displayValue(error.component ?? error.componentName ?? error.componentId) ?? componentFromPath(location.path);
|
|
2783
|
+
diagnostics.push({ ...diagnosticMessage(error), ...location, ...component ? { component } : {} });
|
|
2784
|
+
}
|
|
2785
|
+
return diagnostics;
|
|
2786
|
+
}
|
|
2787
|
+
function parseJsonBody(body) {
|
|
2788
|
+
let parsed;
|
|
608
2789
|
try {
|
|
609
|
-
|
|
2790
|
+
parsed = JSON.parse(body);
|
|
610
2791
|
} catch {
|
|
611
|
-
return
|
|
2792
|
+
return null;
|
|
612
2793
|
}
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
2794
|
+
const p = asRecord(parsed);
|
|
2795
|
+
if (!p)
|
|
2796
|
+
return null;
|
|
2797
|
+
const details = asRecord(p.details) ?? {};
|
|
2798
|
+
const pick = (k) => p[k] !== void 0 ? p[k] : details[k];
|
|
2799
|
+
const codeRaw = pick("code") ?? asRecord(p.sys)?.id;
|
|
2800
|
+
const messageRaw = pick("message");
|
|
2801
|
+
const cycleRaw = pick("cycle");
|
|
2802
|
+
const out = {};
|
|
2803
|
+
if (typeof codeRaw === "string")
|
|
2804
|
+
out.code = codeRaw;
|
|
2805
|
+
if (typeof messageRaw === "string")
|
|
2806
|
+
out.message = messageRaw;
|
|
2807
|
+
if (Array.isArray(cycleRaw)) {
|
|
2808
|
+
const strs = cycleRaw.filter((x) => typeof x === "string");
|
|
2809
|
+
if (strs.length > 0)
|
|
2810
|
+
out.cycle = strs;
|
|
2811
|
+
}
|
|
2812
|
+
const diagnostics = parseValidationDiagnostics(details);
|
|
2813
|
+
if (diagnostics.length > 0)
|
|
2814
|
+
out.diagnostics = diagnostics;
|
|
2815
|
+
return out;
|
|
617
2816
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
2817
|
+
|
|
2818
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/strip-lambda-log-prefix.js
|
|
2819
|
+
var LAMBDA_LOG_PREFIX_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z\s+[0-9a-f-]+\s+ERROR\s+(?:\[dd\.[^\]]*\]\s*)?/;
|
|
2820
|
+
var DD_TAG_RE = /\[dd\.(?:trace_id|span_id)=[^\]]*\]\s*/g;
|
|
2821
|
+
function stripLambdaLogPrefix(body) {
|
|
2822
|
+
return body.replace(LAMBDA_LOG_PREFIX_RE, "").replace(DD_TAG_RE, "").trim();
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/parse-edsi-error.js
|
|
2826
|
+
var API_ERROR_PREFIX_RE = /^(?:apply|preview|poll) failed: \d+$/;
|
|
2827
|
+
function parseEdsiError(rawInput) {
|
|
2828
|
+
if (!rawInput)
|
|
2829
|
+
return { code: null, message: "", cycle: null, raw: true };
|
|
2830
|
+
const { body, prefix } = splitPhasePrefix(rawInput);
|
|
2831
|
+
const cleaned = stripLambdaLogPrefix(body);
|
|
2832
|
+
const json = parseJsonBody(cleaned) ?? parseJsonBody(body);
|
|
2833
|
+
const bindingFromJson = typeof json?.message === "string" ? parseBindingDiagnostics(json.message) : null;
|
|
2834
|
+
if (bindingFromJson) {
|
|
2835
|
+
return {
|
|
2836
|
+
code: bindingFromJson.code ?? json?.code ?? null,
|
|
2837
|
+
message: bindingFromJson.message ?? cleaned,
|
|
2838
|
+
cycle: null,
|
|
2839
|
+
raw: false,
|
|
2840
|
+
...bindingFromJson.diagnostics ? { diagnostics: bindingFromJson.diagnostics } : {}
|
|
2841
|
+
};
|
|
625
2842
|
}
|
|
626
|
-
|
|
2843
|
+
if (json && (json.code || json.message || json.cycle)) {
|
|
2844
|
+
return {
|
|
2845
|
+
code: json.code ?? null,
|
|
2846
|
+
message: json.message ?? (cleaned || prefix),
|
|
2847
|
+
cycle: json.cycle ?? null,
|
|
2848
|
+
raw: false,
|
|
2849
|
+
...json.diagnostics ? { diagnostics: json.diagnostics } : {}
|
|
2850
|
+
};
|
|
2851
|
+
}
|
|
2852
|
+
const binding = parseBindingDiagnostics(cleaned);
|
|
2853
|
+
if (binding) {
|
|
2854
|
+
return {
|
|
2855
|
+
code: binding.code ?? null,
|
|
2856
|
+
message: binding.message ?? cleaned,
|
|
2857
|
+
cycle: null,
|
|
2858
|
+
raw: false,
|
|
2859
|
+
...binding.diagnostics ? { diagnostics: binding.diagnostics } : {}
|
|
2860
|
+
};
|
|
2861
|
+
}
|
|
2862
|
+
const literal2 = parseObjectLiteralTail(cleaned);
|
|
2863
|
+
if (literal2 && (literal2.code || literal2.cycle)) {
|
|
2864
|
+
const braceStart = cleaned.lastIndexOf("{");
|
|
2865
|
+
const head = braceStart === -1 ? cleaned : cleaned.slice(0, braceStart).trim();
|
|
2866
|
+
return { code: literal2.code ?? null, message: head || cleaned, cycle: literal2.cycle ?? null, raw: false };
|
|
2867
|
+
}
|
|
2868
|
+
return { code: null, message: cleaned || prefix || rawInput, cycle: null, raw: true };
|
|
2869
|
+
}
|
|
2870
|
+
function splitPhasePrefix(input) {
|
|
2871
|
+
const nlIndex = input.indexOf("\n");
|
|
2872
|
+
if (nlIndex === -1)
|
|
2873
|
+
return { body: input, prefix: "" };
|
|
2874
|
+
const firstLine = input.slice(0, nlIndex);
|
|
2875
|
+
if (!API_ERROR_PREFIX_RE.test(firstLine))
|
|
2876
|
+
return { body: input, prefix: "" };
|
|
2877
|
+
return { body: input.slice(nlIndex + 1), prefix: firstLine };
|
|
627
2878
|
}
|
|
628
2879
|
|
|
629
|
-
// packages/experience-design-system-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
2880
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/format-parsed-edsi-error.js
|
|
2881
|
+
function formatParsedEdsiError(parsed, opts = {}) {
|
|
2882
|
+
const lines = [];
|
|
2883
|
+
if (parsed.code)
|
|
2884
|
+
lines.push(`[${parsed.code}]`);
|
|
2885
|
+
if (parsed.message)
|
|
2886
|
+
lines.push(parsed.message);
|
|
2887
|
+
for (const diagnostic of parsed.diagnostics ?? []) {
|
|
2888
|
+
const context = [
|
|
2889
|
+
diagnostic.component ? `Component: ${diagnostic.component}` : null,
|
|
2890
|
+
diagnostic.path ? `Path: ${diagnostic.path}` : null
|
|
2891
|
+
].filter(Boolean);
|
|
2892
|
+
lines.push(`- ${diagnostic.message}${context.length > 0 ? ` (${context.join("; ")})` : ""}`);
|
|
2893
|
+
if (diagnostic.path === null) {
|
|
2894
|
+
lines.push(" Location: not provided by the server. Review the submitted CDF file; no component or field was identified.");
|
|
2895
|
+
}
|
|
2896
|
+
if (opts.verbose && diagnostic.messageSource) {
|
|
2897
|
+
lines.push(` Message field: ${diagnostic.messageSource}`);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
if (parsed.code === "BindingValidationFailed") {
|
|
2901
|
+
const location = parsed.diagnostics?.find((d) => d.path)?.path;
|
|
2902
|
+
lines.push(location ? `Next action: review the binding at ${location} and correct its pointer or GraphQL selection.` : "Next action: review the binding pointer and GraphQL selection.");
|
|
2903
|
+
}
|
|
2904
|
+
if (parsed.code === "AccessDenied") {
|
|
2905
|
+
lines.push("Next action: this operation requires DesignToken and Component permissions in this environment. Ask a Contentful admin to grant both on your role.");
|
|
2906
|
+
}
|
|
2907
|
+
if (parsed.code === "NotFound") {
|
|
2908
|
+
lines.push("Next action: verify the resource id is correct. If it should exist, your role may lack read permission on DesignToken or Component.");
|
|
2909
|
+
}
|
|
2910
|
+
if (parsed.cycle && parsed.cycle.length > 0) {
|
|
2911
|
+
lines.push(`Cycle: ${parsed.cycle.join(" \u2192 ")} \u2192 ${parsed.cycle[0]}`);
|
|
2912
|
+
lines.push("Break the cycle by removing at least one $allowedComponents entry.");
|
|
2913
|
+
}
|
|
2914
|
+
if (opts.verbose && opts.raw) {
|
|
2915
|
+
lines.push("");
|
|
2916
|
+
lines.push("--- raw ---");
|
|
2917
|
+
lines.push(opts.raw);
|
|
2918
|
+
}
|
|
2919
|
+
return lines.filter(Boolean).join("\n");
|
|
638
2920
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
hints.map((hint) => /* @__PURE__ */ jsx6(Text6, { dimColor: true, children: hint }, hint))
|
|
647
|
-
] });
|
|
2921
|
+
|
|
2922
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/format-edsi-error.js
|
|
2923
|
+
function formatEdsiError(raw, opts = {}) {
|
|
2924
|
+
const input = typeof raw === "string" ? raw : displayValue(raw);
|
|
2925
|
+
if (!input)
|
|
2926
|
+
return "";
|
|
2927
|
+
return formatParsedEdsiError(parseEdsiError(input), { ...opts, raw: opts.raw ?? input });
|
|
648
2928
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
"\u2713 Found ",
|
|
659
|
-
total,
|
|
660
|
-
" files:"
|
|
661
|
-
] }),
|
|
662
|
-
rows.map((row) => /* @__PURE__ */ jsx6(Row, { row }, row.label))
|
|
663
|
-
] }),
|
|
664
|
-
warning && /* @__PURE__ */ jsxs5(Text6, { color: PALETTE.warning, children: [
|
|
665
|
-
"\u26A0 ",
|
|
666
|
-
warning
|
|
667
|
-
] }),
|
|
668
|
-
/* @__PURE__ */ jsx6(Text6, { children: "Does this look right?" })
|
|
669
|
-
] });
|
|
2929
|
+
|
|
2930
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/edsi-errors/format-api-error.js
|
|
2931
|
+
function formatApiError(error, verbose = false) {
|
|
2932
|
+
const formatted = formatEdsiError(error.body || error.message, { verbose, raw: error.body }) || error.message;
|
|
2933
|
+
const phase = error.message.split("\n", 1)[0];
|
|
2934
|
+
const withPhase = /^(?:apply|preview|poll) failed: \d+$/.test(phase) && formatted !== phase ? `${phase}
|
|
2935
|
+
${formatted}` : formatted;
|
|
2936
|
+
return error.guidance ? `${withPhase}
|
|
2937
|
+
${error.guidance}` : withPhase;
|
|
670
2938
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
onBack
|
|
676
|
-
}) {
|
|
677
|
-
const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
|
|
678
|
-
const [scan, setScan] = useState5();
|
|
679
|
-
useEffect3(() => {
|
|
680
|
-
let cancelled = false;
|
|
681
|
-
setScan(void 0);
|
|
682
|
-
void scanProject(resolvedPath).then((result) => {
|
|
683
|
-
if (!cancelled) setScan(result);
|
|
684
|
-
});
|
|
685
|
-
return () => {
|
|
686
|
-
cancelled = true;
|
|
687
|
-
};
|
|
688
|
-
}, [resolvedPath]);
|
|
689
|
-
const phase = phaseOf(scan);
|
|
690
|
-
usePathValidationControls(phase, { onConfirm: () => onConfirm(resolvedPath), onChangePath, onBack });
|
|
691
|
-
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", gap: 1, paddingX: 2, paddingY: 1, children: [
|
|
692
|
-
scan === void 0 && /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
693
|
-
"Scanning ",
|
|
694
|
-
/* @__PURE__ */ jsx6(Text6, { bold: true, children: resolvedPath }),
|
|
695
|
-
"..."
|
|
696
|
-
] }),
|
|
697
|
-
scan?.ok === false && /* @__PURE__ */ jsx6(Failure, { scan, path: resolvedPath }),
|
|
698
|
-
scan?.ok === true && /* @__PURE__ */ jsx6(Summary, { scan, path: resolvedPath }),
|
|
699
|
-
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, gap: 3, children: controlsFor(phase).map((control) => /* @__PURE__ */ jsxs5(Text6, { dimColor: true, children: [
|
|
700
|
-
"[",
|
|
701
|
-
control.keys,
|
|
702
|
-
"] ",
|
|
703
|
-
control.label
|
|
704
|
-
] }, control.keys)) })
|
|
705
|
-
] });
|
|
2939
|
+
|
|
2940
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/controller/errors/format-api-error.js
|
|
2941
|
+
function formatApiError2(request) {
|
|
2942
|
+
return formatApiError(request.error, request.verbose ?? false);
|
|
706
2943
|
}
|
|
707
2944
|
|
|
708
|
-
// packages/experience-design-system-
|
|
709
|
-
|
|
710
|
-
import { Box as Box6, Text as Text7 } from "ink";
|
|
711
|
-
import TextInput3 from "ink-text-input";
|
|
2945
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/helpers/tokens/read-tokens-from-path.js
|
|
2946
|
+
init_shared();
|
|
712
2947
|
|
|
713
|
-
// packages/experience-design-system-
|
|
714
|
-
|
|
2948
|
+
// packages/experience-design-system-backend-pipeline/dist/src/index.js
|
|
2949
|
+
init_agents();
|
|
2950
|
+
|
|
2951
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/client/build-contentful-management-client.js
|
|
2952
|
+
import { createClient as createClient2 } from "contentful-management";
|
|
2953
|
+
|
|
2954
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/helpers/existing-entities/fetch-from-contentful.js
|
|
2955
|
+
import { fetchAll } from "contentful-management";
|
|
2956
|
+
|
|
2957
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/apply/src/controller/endpoint/resolve-shared-inputs.js
|
|
2958
|
+
init_validate();
|
|
2959
|
+
|
|
2960
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
2961
|
+
init_build_prompt();
|
|
2962
|
+
init_create_local_cli_agent_invoker();
|
|
2963
|
+
init_describe_agent_failure();
|
|
2964
|
+
init_resolve_binary();
|
|
2965
|
+
init_resolve_skill_path();
|
|
2966
|
+
init_parse_map_token_prop_tool_calls();
|
|
2967
|
+
init_cache_keys();
|
|
2968
|
+
|
|
2969
|
+
// packages/experience-design-system-backend-pipeline/dist/src/agents/helpers/resolution/binary-exists.js
|
|
2970
|
+
import { execFile } from "node:child_process";
|
|
2971
|
+
import { promisify } from "node:util";
|
|
2972
|
+
var execFileAsync = promisify(execFile);
|
|
2973
|
+
|
|
2974
|
+
// packages/experience-design-system-backend-pipeline/dist/src/steps/generation/src/controller/map-tokens/run-map-tokens.js
|
|
2975
|
+
var DEFAULT_TIMEOUT_MS2 = 5 * 60 * 1e3;
|
|
715
2976
|
|
|
716
2977
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/logic.ts
|
|
717
2978
|
var FIELDS = ["spaceId", "environmentId", "cmaToken", "host"];
|
|
718
|
-
var DEFAULT_HOST = "api.contentful.com";
|
|
719
2979
|
function keyAction2(input, key) {
|
|
720
2980
|
if (key.escape) return "back";
|
|
721
2981
|
if (key.tab) return "next-field";
|
|
@@ -725,21 +2985,12 @@ function keyAction2(input, key) {
|
|
|
725
2985
|
function nextField(field) {
|
|
726
2986
|
return FIELDS[(FIELDS.indexOf(field) + 1) % FIELDS.length];
|
|
727
2987
|
}
|
|
728
|
-
function toConfiguredHost(host) {
|
|
729
|
-
const value = (host ?? "").trim().replace(/\/+$/, "");
|
|
730
|
-
return value === "" ? DEFAULT_HOST : value.replace(/^https:\/\//i, "");
|
|
731
|
-
}
|
|
732
|
-
function toApiHost(host) {
|
|
733
|
-
const value = host.trim().replace(/\/+$/, "");
|
|
734
|
-
if (value === "") return `https://${DEFAULT_HOST}`;
|
|
735
|
-
return /^[a-z][a-z\d+\-.]*:\/\//i.test(value) ? value : `https://${value}`;
|
|
736
|
-
}
|
|
737
2988
|
function normalize(values) {
|
|
738
2989
|
return {
|
|
739
2990
|
spaceId: values.spaceId.trim(),
|
|
740
2991
|
environmentId: values.environmentId.trim(),
|
|
741
2992
|
cmaToken: values.cmaToken.trim(),
|
|
742
|
-
host:
|
|
2993
|
+
host: toConfiguredHost2(values.host) ?? DEFAULT_CONFIGURED_HOST
|
|
743
2994
|
};
|
|
744
2995
|
}
|
|
745
2996
|
function missingField(values) {
|
|
@@ -767,59 +3018,30 @@ function useCredentialsControls(handlers) {
|
|
|
767
3018
|
}
|
|
768
3019
|
|
|
769
3020
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/validate.ts
|
|
770
|
-
var USER_AGENT = "app contentful.experience-design-system-cli";
|
|
771
|
-
function headers(token) {
|
|
772
|
-
return { Authorization: `Bearer ${token}`, "X-Contentful-User-Agent": USER_AGENT };
|
|
773
|
-
}
|
|
774
|
-
function isApsDenial(body) {
|
|
775
|
-
try {
|
|
776
|
-
const id = JSON.parse(body).sys?.id;
|
|
777
|
-
return id === "NotFound" || id === "AccessDenied";
|
|
778
|
-
} catch {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
function messageFrom(body) {
|
|
783
|
-
try {
|
|
784
|
-
const message = JSON.parse(body).message;
|
|
785
|
-
return typeof message === "string" && message !== "" ? message : void 0;
|
|
786
|
-
} catch {
|
|
787
|
-
return void 0;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
3021
|
async function validateCredentials(values) {
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
798
|
-
if (me.status === 401) return { ok: false, error: "CMA token is invalid or revoked." };
|
|
799
|
-
if (!me.ok) return { ok: false, error: `Unexpected error validating the token (${me.status}).` };
|
|
800
|
-
let preflight;
|
|
3022
|
+
const host = toApiHost2(values.host);
|
|
3023
|
+
const client2 = new ApiClient({
|
|
3024
|
+
host,
|
|
3025
|
+
spaceId: values.spaceId,
|
|
3026
|
+
environmentId: values.environmentId,
|
|
3027
|
+
cmaToken: values.cmaToken
|
|
3028
|
+
});
|
|
801
3029
|
try {
|
|
802
|
-
|
|
803
|
-
`${base}/spaces/${values.spaceId}/environments/${values.environmentId}/design_systems/preflight`,
|
|
804
|
-
{ headers: headers(values.cmaToken) }
|
|
805
|
-
);
|
|
806
|
-
} catch {
|
|
3030
|
+
await client2.validateToken();
|
|
807
3031
|
return { ok: true };
|
|
3032
|
+
} catch (error) {
|
|
3033
|
+
return { ok: false, error: toUserError(error, host) };
|
|
808
3034
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
if (
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
if (preflight.status === 404) {
|
|
817
|
-
return {
|
|
818
|
-
ok: false,
|
|
819
|
-
error: `Not found. Check the space ID, environment and API host.${detail ? ` (${detail})` : ""}`
|
|
820
|
-
};
|
|
3035
|
+
}
|
|
3036
|
+
function toUserError(error, host) {
|
|
3037
|
+
if (error instanceof ApiError) {
|
|
3038
|
+
if (error.status === 404 && error.message.startsWith("preflight failed:")) {
|
|
3039
|
+
return "Not found. Check the space ID, environment and API host.";
|
|
3040
|
+
}
|
|
3041
|
+
return formatApiError2({ error });
|
|
821
3042
|
}
|
|
822
|
-
|
|
3043
|
+
if (error instanceof Error) return `Could not reach ${host}: ${error.message}`;
|
|
3044
|
+
return String(error);
|
|
823
3045
|
}
|
|
824
3046
|
|
|
825
3047
|
// packages/experience-design-system-cli/src/tui/import/steps/04-credentials/screen.tsx
|
|
@@ -834,7 +3056,7 @@ function CredentialsScreen({
|
|
|
834
3056
|
onDone,
|
|
835
3057
|
onBack,
|
|
836
3058
|
initial = {},
|
|
837
|
-
validate = validateCredentials
|
|
3059
|
+
validate: validate2 = validateCredentials
|
|
838
3060
|
}) {
|
|
839
3061
|
const initialValues = useRef(
|
|
840
3062
|
normalize({
|
|
@@ -870,7 +3092,7 @@ function CredentialsScreen({
|
|
|
870
3092
|
return;
|
|
871
3093
|
}
|
|
872
3094
|
setValidating(true);
|
|
873
|
-
const result = await
|
|
3095
|
+
const result = await validate2(credentials);
|
|
874
3096
|
setValidating(false);
|
|
875
3097
|
if (result.ok) onDone({ skipped: false, credentials });
|
|
876
3098
|
else setError(result.error);
|
|
@@ -896,7 +3118,7 @@ function CredentialsScreen({
|
|
|
896
3118
|
value: values[field],
|
|
897
3119
|
focus: active === field && !validating,
|
|
898
3120
|
mask: field === "cmaToken" ? "\u2022" : void 0,
|
|
899
|
-
placeholder: field === "host" ?
|
|
3121
|
+
placeholder: field === "host" ? DEFAULT_CONFIGURED_HOST : void 0,
|
|
900
3122
|
onChange: change(field),
|
|
901
3123
|
onSubmit: () => void submit(field)
|
|
902
3124
|
}
|
|
@@ -940,7 +3162,7 @@ ${candidates.join("\n")}`);
|
|
|
940
3162
|
}
|
|
941
3163
|
|
|
942
3164
|
// packages/experience-design-system-cli/src/tui/import/spawn-v1-import.ts
|
|
943
|
-
function
|
|
3165
|
+
function buildArgs2(options) {
|
|
944
3166
|
const args = ["import"];
|
|
945
3167
|
if (options.project) {
|
|
946
3168
|
args.push("--project", options.project);
|
|
@@ -952,7 +3174,7 @@ function buildArgs(options) {
|
|
|
952
3174
|
}
|
|
953
3175
|
async function spawnV1Import(options = {}) {
|
|
954
3176
|
const cliPath = findLegacyCliPath();
|
|
955
|
-
const args =
|
|
3177
|
+
const args = buildArgs2(options);
|
|
956
3178
|
return new Promise((resolvePromise) => {
|
|
957
3179
|
const child = spawn("node", [cliPath, ...args], {
|
|
958
3180
|
stdio: "inherit",
|
|
@@ -999,28 +3221,28 @@ import { randomBytes } from "node:crypto";
|
|
|
999
3221
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
1000
3222
|
import { homedir as homedir2 } from "node:os";
|
|
1001
3223
|
import { dirname as dirname2, join as join5 } from "node:path";
|
|
1002
|
-
function
|
|
3224
|
+
function configRoot2() {
|
|
1003
3225
|
return process.env["EDS_HOME"] || join5(homedir2(), ".contentful", "experience-design-system-cli");
|
|
1004
3226
|
}
|
|
1005
|
-
var
|
|
1006
|
-
var
|
|
1007
|
-
async function
|
|
3227
|
+
var configFilePath2 = () => join5(configRoot2(), "config.json");
|
|
3228
|
+
var debugSessionsDir2 = () => join5(configRoot2(), "debug", "sessions");
|
|
3229
|
+
async function readSettings2() {
|
|
1008
3230
|
try {
|
|
1009
|
-
return JSON.parse(await readFile(
|
|
3231
|
+
return JSON.parse(await readFile(configFilePath2(), "utf8"));
|
|
1010
3232
|
} catch {
|
|
1011
3233
|
return {};
|
|
1012
3234
|
}
|
|
1013
3235
|
}
|
|
1014
|
-
async function
|
|
1015
|
-
const path =
|
|
3236
|
+
async function writeSettings2(settings) {
|
|
3237
|
+
const path = configFilePath2();
|
|
1016
3238
|
await mkdir(dirname2(path), { recursive: true });
|
|
1017
3239
|
const tmp = `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
1018
3240
|
await writeFile(tmp, `${JSON.stringify(settings, null, 2)}
|
|
1019
3241
|
`, { mode: 384 });
|
|
1020
3242
|
await rename(tmp, path);
|
|
1021
3243
|
}
|
|
1022
|
-
async function
|
|
1023
|
-
await
|
|
3244
|
+
async function updateSettings2(patch) {
|
|
3245
|
+
await writeSettings2({ ...await readSettings2(), ...patch });
|
|
1024
3246
|
}
|
|
1025
3247
|
|
|
1026
3248
|
// packages/experience-design-system-cli/src/tui/settings/debug-mode/debug-mode-store.ts
|
|
@@ -1028,11 +3250,11 @@ var DEFAULT_DEBUG_MODE_SETTING = {
|
|
|
1028
3250
|
enabled: true
|
|
1029
3251
|
};
|
|
1030
3252
|
async function readDebugModeSetting() {
|
|
1031
|
-
const { debugMode } = await
|
|
3253
|
+
const { debugMode } = await readSettings2();
|
|
1032
3254
|
return { ...DEFAULT_DEBUG_MODE_SETTING, ...debugMode };
|
|
1033
3255
|
}
|
|
1034
3256
|
async function writeDebugModeSetting(setting) {
|
|
1035
|
-
await
|
|
3257
|
+
await updateSettings2({ debugMode: setting });
|
|
1036
3258
|
}
|
|
1037
3259
|
|
|
1038
3260
|
// packages/experience-design-system-cli/src/tui/debug-store.ts
|
|
@@ -1049,9 +3271,9 @@ function datePrefix(now = /* @__PURE__ */ new Date()) {
|
|
|
1049
3271
|
function slugify(value) {
|
|
1050
3272
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
1051
3273
|
}
|
|
1052
|
-
function
|
|
3274
|
+
function generateSessionId3() {
|
|
1053
3275
|
const today = datePrefix();
|
|
1054
|
-
const root =
|
|
3276
|
+
const root = debugSessionsDir2();
|
|
1055
3277
|
const existing = existsSync3(root) ? readdirSync(root) : [];
|
|
1056
3278
|
const seqPattern = new RegExp(`^${today}-session-(\\d+)$`);
|
|
1057
3279
|
const maxSeq = existing.reduce((max, entry) => {
|
|
@@ -1060,9 +3282,9 @@ function generateSessionId() {
|
|
|
1060
3282
|
}, 0);
|
|
1061
3283
|
return `${today}-session-${maxSeq + 1}`;
|
|
1062
3284
|
}
|
|
1063
|
-
var SESSION_ID =
|
|
3285
|
+
var SESSION_ID = generateSessionId3();
|
|
1064
3286
|
function sessionDebugDir() {
|
|
1065
|
-
return join6(
|
|
3287
|
+
return join6(debugSessionsDir2(), SESSION_ID);
|
|
1066
3288
|
}
|
|
1067
3289
|
function currentDebugSessionDir() {
|
|
1068
3290
|
return sessionDebugDir();
|
|
@@ -1179,9 +3401,9 @@ async function readHelpInfo() {
|
|
|
1179
3401
|
const debugMode = await readDebugModeSetting();
|
|
1180
3402
|
return {
|
|
1181
3403
|
storage: [
|
|
1182
|
-
{ label: "Config folder", value:
|
|
1183
|
-
{ label: "Settings file", value:
|
|
1184
|
-
{ label: "Debug logs", value:
|
|
3404
|
+
{ label: "Config folder", value: configRoot2() },
|
|
3405
|
+
{ label: "Settings file", value: configFilePath2() },
|
|
3406
|
+
{ label: "Debug logs", value: debugSessionsDir2() }
|
|
1185
3407
|
],
|
|
1186
3408
|
troubleshooting: [
|
|
1187
3409
|
{ label: "CLI version", value: readPackageVersion() },
|
|
@@ -1202,7 +3424,7 @@ function Section({ title, rows }) {
|
|
|
1202
3424
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
1203
3425
|
/* @__PURE__ */ jsx8(Text8, { bold: true, color: PALETTE.accent, children: title }),
|
|
1204
3426
|
rows.map((row) => /* @__PURE__ */ jsxs7(Box7, { gap: 1, children: [
|
|
1205
|
-
/* @__PURE__ */ jsx8(Box7, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx8(Text8, {
|
|
3427
|
+
/* @__PURE__ */ jsx8(Box7, { width: 14, flexShrink: 0, children: /* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: row.label }) }),
|
|
1206
3428
|
/* @__PURE__ */ jsx8(Text8, { children: row.value })
|
|
1207
3429
|
] }, row.label))
|
|
1208
3430
|
] });
|
|
@@ -1232,7 +3454,7 @@ function HelpScreen({ onDone }) {
|
|
|
1232
3454
|
info ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1233
3455
|
/* @__PURE__ */ jsx8(Section, { title: "Where things are stored", rows: info.storage }),
|
|
1234
3456
|
/* @__PURE__ */ jsx8(Section, { title: "Troubleshooting", rows: info.troubleshooting }),
|
|
1235
|
-
/* @__PURE__ */ jsx8(Text8, {
|
|
3457
|
+
/* @__PURE__ */ jsx8(Text8, { color: PALETTE.muted, children: "Hit a problem? Turn on Debug Mode in Settings, reproduce it, then share the session folder above. The CMA token is redacted from those logs." })
|
|
1236
3458
|
] }) : /* @__PURE__ */ jsx8(Text8, { color: PALETTE.accent, children: "Loading..." }),
|
|
1237
3459
|
/* @__PURE__ */ jsx8(
|
|
1238
3460
|
ControlHints,
|
|
@@ -1307,8 +3529,8 @@ import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
|
1307
3529
|
import TextInput4 from "ink-text-input";
|
|
1308
3530
|
|
|
1309
3531
|
// packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
|
|
1310
|
-
var readV1Store =
|
|
1311
|
-
var writeV1Store =
|
|
3532
|
+
var readV1Store = readSettings2;
|
|
3533
|
+
var writeV1Store = writeSettings2;
|
|
1312
3534
|
|
|
1313
3535
|
// packages/experience-design-system-cli/src/tui/settings/contentful-configuration/config-store.ts
|
|
1314
3536
|
async function readCredentials() {
|
|
@@ -1474,7 +3696,7 @@ function ConfigurationScreen({ onDone }) {
|
|
|
1474
3696
|
onSubmit: () => setEditing(false),
|
|
1475
3697
|
mask: field === "cmaToken" ? "\u2022" : void 0
|
|
1476
3698
|
}
|
|
1477
|
-
) : /* @__PURE__ */ jsx10(Text10, { children: display || /* @__PURE__ */ jsx10(Text10, {
|
|
3699
|
+
) : /* @__PURE__ */ jsx10(Text10, { children: display || /* @__PURE__ */ jsx10(Text10, { color: PALETTE.muted, children: "(empty)" }) })
|
|
1478
3700
|
] }, field);
|
|
1479
3701
|
}) }),
|
|
1480
3702
|
notice && /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
@@ -1567,8 +3789,8 @@ function OptInAnalyticsScreen({ onDone }) {
|
|
|
1567
3789
|
/* @__PURE__ */ jsx11(Text11, { bold: true, color: enabled ? PALETTE.success : PALETTE.muted, children: enabled ? "On" : "Off" })
|
|
1568
3790
|
] }),
|
|
1569
3791
|
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1570
|
-
/* @__PURE__ */ jsx11(Text11, {
|
|
1571
|
-
/* @__PURE__ */ jsx11(Text11, {
|
|
3792
|
+
/* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Shares which CLI commands are used and where imports succeed or fail." }),
|
|
3793
|
+
/* @__PURE__ */ jsx11(Text11, { color: PALETTE.muted, children: "Never includes source code, file paths, credentials, or authored content." })
|
|
1572
3794
|
] }),
|
|
1573
3795
|
/* @__PURE__ */ jsx11(Text11, { children: " " }),
|
|
1574
3796
|
/* @__PURE__ */ jsx11(
|