@contentful/experience-design-system-cli 2.27.1-dev-build-16b0c21.0 → 2.27.1-dev-build-887759e.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/package.json
CHANGED
|
@@ -7,6 +7,7 @@ export declare function buildSelectAgentArgs(opts: {
|
|
|
7
7
|
sessionId: string;
|
|
8
8
|
agent: string;
|
|
9
9
|
model?: string;
|
|
10
|
+
bedrock?: boolean;
|
|
10
11
|
selectPromptPath?: string;
|
|
11
12
|
noCache?: boolean;
|
|
12
13
|
}): string[];
|
|
@@ -23,6 +24,7 @@ export declare function buildGenerateComponentsArgs(opts: {
|
|
|
23
24
|
tokensPath?: string;
|
|
24
25
|
agent: string;
|
|
25
26
|
model?: string;
|
|
27
|
+
bedrock?: boolean;
|
|
26
28
|
noCache?: boolean;
|
|
27
29
|
generatePromptPath?: string;
|
|
28
30
|
}): string[];
|
|
@@ -38,6 +40,7 @@ export type WizardAppProps = {
|
|
|
38
40
|
initialHost?: string;
|
|
39
41
|
initialAgent?: string;
|
|
40
42
|
initialModel?: string;
|
|
43
|
+
bedrock?: boolean;
|
|
41
44
|
initialProjectPath?: string;
|
|
42
45
|
host?: string;
|
|
43
46
|
autoAcceptScope?: boolean;
|
|
@@ -68,4 +71,4 @@ export type WizardAppProps = {
|
|
|
68
71
|
onRunPicked?: (selection: RunPickerSelection) => void;
|
|
69
72
|
allowDeletions?: boolean;
|
|
70
73
|
};
|
|
71
|
-
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, initialProjectPath, host, autoAcceptScope, autoRejectCycles, compositionMode, compositionMap, compositionAgent, compositionAgentMode, compositionRefresh, generateMap, promptOverrides, noCache, autoFilter, livePreview, noPush, noSave, outDirOverride, onConflictMode, selectPromptPath, generatePromptPath, seedExtractSessionId, seedGenerateSessionId, seedTokenSessionId, seedTokensPath, initialStep, initialRawTokensPath, initialRuns, onRunPicked, allowDeletions, }?: WizardAppProps): React.ReactElement;
|
|
74
|
+
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, autoAcceptScope, autoRejectCycles, compositionMode, compositionMap, compositionAgent, compositionAgentMode, compositionRefresh, generateMap, promptOverrides, noCache, autoFilter, livePreview, noPush, noSave, outDirOverride, onConflictMode, selectPromptPath, generatePromptPath, seedExtractSessionId, seedGenerateSessionId, seedTokenSessionId, seedTokensPath, initialStep, initialRawTokensPath, initialRuns, onRunPicked, allowDeletions, }?: WizardAppProps): React.ReactElement;
|
package/dist/src/index.js
CHANGED
|
@@ -231,6 +231,9 @@ function resolveBinary(agent) {
|
|
|
231
231
|
return override.trim();
|
|
232
232
|
return AGENT_BINARIES[agent];
|
|
233
233
|
}
|
|
234
|
+
function agentSupportsBedrock(agent) {
|
|
235
|
+
return agent in BEDROCK_ENV_BY_AGENT;
|
|
236
|
+
}
|
|
234
237
|
function resolveAgentModel(agent, explicit) {
|
|
235
238
|
if (explicit && explicit.trim())
|
|
236
239
|
return explicit.trim();
|
|
@@ -254,7 +257,7 @@ function buildArgs(agent, prompt2, model, promptViaStdin = false) {
|
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
259
|
async function runAgent(options) {
|
|
257
|
-
const { agent, prompt: prompt2, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
260
|
+
const { agent, prompt: prompt2, timeoutMs, model, bedrock, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
258
261
|
const binary = resolveBinary(agent);
|
|
259
262
|
const useStdin2 = !!promptViaStdin;
|
|
260
263
|
const args = buildArgs(agent, prompt2, model, useStdin2);
|
|
@@ -263,13 +266,16 @@ async function runAgent(options) {
|
|
|
263
266
|
agent,
|
|
264
267
|
binary,
|
|
265
268
|
model,
|
|
269
|
+
bedrock: !!bedrock,
|
|
266
270
|
timeoutMs,
|
|
267
271
|
promptLen: prompt2.length,
|
|
268
272
|
promptHead: prompt2.slice(0, 500)
|
|
269
273
|
});
|
|
270
274
|
return new Promise((resolve27) => {
|
|
275
|
+
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
|
|
271
276
|
const child = spawn(binary, args, {
|
|
272
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
277
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
278
|
+
...bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}
|
|
273
279
|
});
|
|
274
280
|
if (useStdin2 && child.stdin) {
|
|
275
281
|
child.stdin.on("error", () => {
|
|
@@ -387,7 +393,7 @@ function extractSentinelOutput(stdout) {
|
|
|
387
393
|
return "multiple";
|
|
388
394
|
return stdout.slice(startIdx + START.length, endIdx).trim();
|
|
389
395
|
}
|
|
390
|
-
var VALID_SELECT_TOOL_NAMES, VALID_TOOL_NAMES, VALID_TOKEN_TOOL_NAMES, VALID_CDF_TYPES, VALID_CATEGORIES, AGENT_BINARIES, DEFAULT_MODELS;
|
|
396
|
+
var VALID_SELECT_TOOL_NAMES, VALID_TOOL_NAMES, VALID_TOKEN_TOOL_NAMES, VALID_CDF_TYPES, VALID_CATEGORIES, AGENT_BINARIES, BEDROCK_ENV_BY_AGENT, DEFAULT_MODELS;
|
|
391
397
|
var init_agent_runner = __esm({
|
|
392
398
|
"packages/experience-design-system-generation/dist/src/agent-runner.js"() {
|
|
393
399
|
"use strict";
|
|
@@ -403,6 +409,9 @@ var init_agent_runner = __esm({
|
|
|
403
409
|
opencode: "opencode",
|
|
404
410
|
cursor: "cursor-agent"
|
|
405
411
|
};
|
|
412
|
+
BEDROCK_ENV_BY_AGENT = {
|
|
413
|
+
claude: { CLAUDE_CODE_USE_BEDROCK: "1" }
|
|
414
|
+
};
|
|
406
415
|
DEFAULT_MODELS = {
|
|
407
416
|
claude: "haiku",
|
|
408
417
|
codex: "gpt-5.4-mini",
|
|
@@ -671,6 +680,7 @@ var src_exports = {};
|
|
|
671
680
|
__export(src_exports, {
|
|
672
681
|
AGENT_NAMES: () => AGENT_NAMES,
|
|
673
682
|
DEFAULT_AGENT_NAME: () => DEFAULT_AGENT_NAME,
|
|
683
|
+
agentSupportsBedrock: () => agentSupportsBedrock,
|
|
674
684
|
buildArgs: () => buildArgs,
|
|
675
685
|
buildPrompt: () => buildPrompt,
|
|
676
686
|
checkAgentAuth: () => checkAgentAuth,
|
|
@@ -21755,7 +21765,8 @@ function PropRow({
|
|
|
21755
21765
|
] }),
|
|
21756
21766
|
/* @__PURE__ */ jsx44(Text43, { dimColor: !selected, children: "type:" }),
|
|
21757
21767
|
activeField === "type" ? /* @__PURE__ */ jsx44(Picker, { value: prop.type, active: true }) : /* @__PURE__ */ jsx44(Text43, { color: selected ? PALETTE.warning : PALETTE.inverse, children: prop.type }),
|
|
21758
|
-
|
|
21768
|
+
/* @__PURE__ */ jsx44(Text43, { dimColor: !selected, children: "cat:" }),
|
|
21769
|
+
activeField === "category" ? /* @__PURE__ */ jsx44(Picker, { value: prop.category, active: true }) : /* @__PURE__ */ jsx44(Text43, { color: selected ? PALETTE.info : PALETTE.inverse, children: prop.category }),
|
|
21759
21770
|
/* @__PURE__ */ jsx44(Text43, { dimColor: !selected, children: "req:" }),
|
|
21760
21771
|
activeField === "required" ? /* @__PURE__ */ jsx44(Toggle, { value: prop.required, active: true }) : /* @__PURE__ */ jsx44(Toggle, { value: prop.required, active: false }),
|
|
21761
21772
|
prop.type === "token" && /* @__PURE__ */ jsxs43(Fragment12, { children: [
|
|
@@ -22088,58 +22099,13 @@ function FieldEditor({
|
|
|
22088
22099
|
const [showHelp, setShowHelp] = useState23(false);
|
|
22089
22100
|
const props = editorState.props;
|
|
22090
22101
|
const slots = editorState.slots;
|
|
22091
|
-
const contentPropIndexes = React23.useMemo(
|
|
22092
|
-
() => props.flatMap((prop, index) => prop.category === "content" ? [index] : []),
|
|
22093
|
-
[props]
|
|
22094
|
-
);
|
|
22095
|
-
const designPropIndexes = React23.useMemo(
|
|
22096
|
-
() => props.flatMap((prop, index) => prop.category === "design" ? [index] : []),
|
|
22097
|
-
[props]
|
|
22098
|
-
);
|
|
22099
|
-
const hiddenPropIndexes = React23.useMemo(
|
|
22100
|
-
() => showHiddenProps ? props.flatMap((prop, index) => prop.category === "state" || prop.category === "unattached" ? [index] : []) : [],
|
|
22101
|
-
[props, showHiddenProps]
|
|
22102
|
-
);
|
|
22103
22102
|
const visiblePropIndexes = React23.useMemo(
|
|
22104
|
-
() =>
|
|
22105
|
-
|
|
22106
|
-
);
|
|
22107
|
-
const propGroups = React23.useMemo(
|
|
22108
|
-
() => [
|
|
22109
|
-
{ kind: "content", label: "\u2500\u2500 CONTENT", indexes: contentPropIndexes },
|
|
22110
|
-
{ kind: "design", label: "\u2500\u2500 DESIGN", indexes: designPropIndexes },
|
|
22111
|
-
{ kind: "hidden", label: "\u2500\u2500 OTHER / HIDDEN", indexes: hiddenPropIndexes }
|
|
22112
|
-
],
|
|
22113
|
-
[contentPropIndexes, designPropIndexes, hiddenPropIndexes]
|
|
22114
|
-
);
|
|
22115
|
-
const selectableRows = React23.useMemo(
|
|
22116
|
-
() => [
|
|
22117
|
-
...contentPropIndexes.map((idx) => ({ kind: "prop", idx })),
|
|
22118
|
-
...designPropIndexes.map((idx) => ({ kind: "prop", idx })),
|
|
22119
|
-
...slots.map((_, idx) => ({ kind: "slot", idx })),
|
|
22120
|
-
...hiddenPropIndexes.map((idx) => ({ kind: "prop", idx }))
|
|
22121
|
-
],
|
|
22122
|
-
[contentPropIndexes, designPropIndexes, hiddenPropIndexes, slots]
|
|
22123
|
-
);
|
|
22124
|
-
const visiblePropPosition = visiblePropIndexes.indexOf(propIdx);
|
|
22125
|
-
const selectedSelectableIndex = React23.useMemo(
|
|
22126
|
-
() => selectableRows.findIndex(
|
|
22127
|
-
(row) => inSlots ? row.kind === "slot" && row.idx === slotIdx : row.kind === "prop" && row.idx === propIdx
|
|
22103
|
+
() => props.flatMap(
|
|
22104
|
+
(prop, index) => showHiddenProps || prop.category !== "state" && prop.category !== "unattached" ? [index] : []
|
|
22128
22105
|
),
|
|
22129
|
-
[
|
|
22106
|
+
[props, showHiddenProps]
|
|
22130
22107
|
);
|
|
22131
|
-
const
|
|
22132
|
-
setInComponentDesc(false);
|
|
22133
|
-
if (row.kind === "prop") {
|
|
22134
|
-
setInSlots(false);
|
|
22135
|
-
setPropIdx(row.idx);
|
|
22136
|
-
setFocusLevel("prop");
|
|
22137
|
-
} else {
|
|
22138
|
-
setInSlots(true);
|
|
22139
|
-
setSlotIdx(row.idx);
|
|
22140
|
-
setFocusLevel("slot");
|
|
22141
|
-
}
|
|
22142
|
-
};
|
|
22108
|
+
const visiblePropPosition = visiblePropIndexes.indexOf(propIdx);
|
|
22143
22109
|
const textEntryActive = focusLevel === "field" && activeField === "description" || focusLevel === "field" && activeField === "default" && (editorState.props[propIdx]?.type === "string" || editorState.props[propIdx]?.type === "token") || editingValue != null;
|
|
22144
22110
|
React23.useEffect(() => {
|
|
22145
22111
|
onTextEntryActiveChange?.(textEntryActive);
|
|
@@ -22360,13 +22326,51 @@ function FieldEditor({
|
|
|
22360
22326
|
}
|
|
22361
22327
|
return;
|
|
22362
22328
|
}
|
|
22329
|
+
if (focusLevel === "prop") {
|
|
22330
|
+
if (key.upArrow || input === "k") {
|
|
22331
|
+
if (visiblePropPosition > 0) {
|
|
22332
|
+
setPropIdx(visiblePropIndexes[visiblePropPosition - 1]);
|
|
22333
|
+
} else {
|
|
22334
|
+
setFocusLevel("componentDescription");
|
|
22335
|
+
setInSlots(false);
|
|
22336
|
+
setInComponentDesc(true);
|
|
22337
|
+
}
|
|
22338
|
+
return;
|
|
22339
|
+
}
|
|
22340
|
+
if (key.downArrow || input === "j") {
|
|
22341
|
+
if (visiblePropPosition >= 0 && visiblePropPosition < visiblePropIndexes.length - 1) {
|
|
22342
|
+
setPropIdx(visiblePropIndexes[visiblePropPosition + 1]);
|
|
22343
|
+
} else if (slots.length > 0) {
|
|
22344
|
+
setInSlots(true);
|
|
22345
|
+
setSlotIdx(0);
|
|
22346
|
+
setFocusLevel("slot");
|
|
22347
|
+
}
|
|
22348
|
+
return;
|
|
22349
|
+
}
|
|
22350
|
+
if (key.return && currentProp) {
|
|
22351
|
+
setFocusLevel("field");
|
|
22352
|
+
setActiveField(propFields(currentProp)[0] ?? null);
|
|
22353
|
+
setTextCursor(currentProp.description.length);
|
|
22354
|
+
return;
|
|
22355
|
+
}
|
|
22356
|
+
return;
|
|
22357
|
+
}
|
|
22363
22358
|
if (focusLevel === "componentDescription") {
|
|
22364
22359
|
if (key.upArrow || input === "k") {
|
|
22365
22360
|
return;
|
|
22366
22361
|
}
|
|
22367
22362
|
if (key.downArrow || input === "j") {
|
|
22368
|
-
|
|
22369
|
-
|
|
22363
|
+
if (visiblePropIndexes.length > 0) {
|
|
22364
|
+
setFocusLevel("prop");
|
|
22365
|
+
setPropIdx(visiblePropIndexes[0]);
|
|
22366
|
+
setInSlots(false);
|
|
22367
|
+
setInComponentDesc(false);
|
|
22368
|
+
} else if (slots.length > 0) {
|
|
22369
|
+
setFocusLevel("slot");
|
|
22370
|
+
setSlotIdx(0);
|
|
22371
|
+
setInSlots(true);
|
|
22372
|
+
setInComponentDesc(false);
|
|
22373
|
+
}
|
|
22370
22374
|
return;
|
|
22371
22375
|
}
|
|
22372
22376
|
if (key.return) {
|
|
@@ -22377,35 +22381,29 @@ function FieldEditor({
|
|
|
22377
22381
|
}
|
|
22378
22382
|
return;
|
|
22379
22383
|
}
|
|
22380
|
-
if (focusLevel === "
|
|
22384
|
+
if (focusLevel === "slot") {
|
|
22381
22385
|
if (key.upArrow || input === "k") {
|
|
22382
|
-
if (
|
|
22383
|
-
|
|
22384
|
-
} else if (
|
|
22385
|
-
setFocusLevel("componentDescription");
|
|
22386
|
+
if (slotIdx > 0) {
|
|
22387
|
+
setSlotIdx(slotIdx - 1);
|
|
22388
|
+
} else if (visiblePropIndexes.length > 0) {
|
|
22386
22389
|
setInSlots(false);
|
|
22387
|
-
|
|
22390
|
+
setPropIdx(visiblePropIndexes[visiblePropIndexes.length - 1]);
|
|
22391
|
+
setFocusLevel("prop");
|
|
22388
22392
|
}
|
|
22389
22393
|
return;
|
|
22390
22394
|
}
|
|
22391
22395
|
if (key.downArrow || input === "j") {
|
|
22392
|
-
if (
|
|
22393
|
-
|
|
22396
|
+
if (slotIdx < slots.length - 1) {
|
|
22397
|
+
setSlotIdx(slotIdx + 1);
|
|
22394
22398
|
}
|
|
22395
22399
|
return;
|
|
22396
22400
|
}
|
|
22397
|
-
if (
|
|
22401
|
+
if (key.return && currentSlot) {
|
|
22398
22402
|
setFocusLevel("field");
|
|
22399
22403
|
setActiveField(SLOT_FIELDS[0] ?? null);
|
|
22400
22404
|
setTextCursor(currentSlot.description.length);
|
|
22401
22405
|
return;
|
|
22402
22406
|
}
|
|
22403
|
-
if (focusLevel === "prop" && key.return && currentProp) {
|
|
22404
|
-
setFocusLevel("field");
|
|
22405
|
-
setActiveField(propFields(currentProp)[0] ?? null);
|
|
22406
|
-
setTextCursor(currentProp.description.length);
|
|
22407
|
-
return;
|
|
22408
|
-
}
|
|
22409
22407
|
return;
|
|
22410
22408
|
}
|
|
22411
22409
|
if (focusLevel === "field") {
|
|
@@ -22734,24 +22732,14 @@ function FieldEditor({
|
|
|
22734
22732
|
})();
|
|
22735
22733
|
const rows = [];
|
|
22736
22734
|
rows.push({ kind: "component-description" });
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
rows.push({ kind: "
|
|
22740
|
-
group.indexes.forEach((idx) => rows.push({ kind: "prop", idx }));
|
|
22735
|
+
if (visiblePropIndexes.length > 0) {
|
|
22736
|
+
rows.push({ kind: "header", label: `\u2500\u2500 PROPERTIES (${visiblePropIndexes.length}) `, section: "properties" });
|
|
22737
|
+
visiblePropIndexes.forEach((idx) => rows.push({ kind: "prop", idx }));
|
|
22741
22738
|
}
|
|
22742
22739
|
if (slots.length > 0) {
|
|
22743
22740
|
rows.push({ kind: "header", label: `\u2500\u2500 SLOTS (${slots.length}) `, section: "slots" });
|
|
22744
22741
|
slots.forEach((_, i) => rows.push({ kind: "slot", idx: i }));
|
|
22745
22742
|
}
|
|
22746
|
-
const hiddenGroup = propGroups.find((group) => group.kind === "hidden");
|
|
22747
|
-
if (hiddenGroup && hiddenGroup.indexes.length > 0) {
|
|
22748
|
-
rows.push({
|
|
22749
|
-
kind: "header",
|
|
22750
|
-
label: `${hiddenGroup.label} (${hiddenGroup.indexes.length}) `,
|
|
22751
|
-
section: "hidden"
|
|
22752
|
-
});
|
|
22753
|
-
hiddenGroup.indexes.forEach((idx) => rows.push({ kind: "prop", idx }));
|
|
22754
|
-
}
|
|
22755
22743
|
const selectedRowIdx = rows.findIndex(
|
|
22756
22744
|
(r) => r.kind === "prop" && !inSlots && !inComponentDesc && r.idx === propIdx || r.kind === "slot" && inSlots && r.idx === slotIdx || r.kind === "component-description" && inComponentDesc
|
|
22757
22745
|
);
|
|
@@ -22770,15 +22758,7 @@ function FieldEditor({
|
|
|
22770
22758
|
hasEmptyProperties && /* @__PURE__ */ jsx44(Text43, { color: PALETTE.warning, children: "\u26A0 No properties classified for this component. The LLM didn't find anything to classify. Reject this component or add fields manually." }),
|
|
22771
22759
|
/* @__PURE__ */ jsx44(Box41, { flexDirection: "column", width: innerWidth, children: visibleRowSlice.map((row, i) => {
|
|
22772
22760
|
if (row.kind === "header") {
|
|
22773
|
-
return /* @__PURE__ */ jsx44(
|
|
22774
|
-
Text43,
|
|
22775
|
-
{
|
|
22776
|
-
bold: true,
|
|
22777
|
-
color: row.section === "slots" ? PALETTE.info : row.section === "hidden" ? PALETTE.warning : PALETTE.success,
|
|
22778
|
-
children: row.label
|
|
22779
|
-
},
|
|
22780
|
-
`header-${i}`
|
|
22781
|
-
);
|
|
22761
|
+
return /* @__PURE__ */ jsx44(Text43, { bold: true, color: row.section === "slots" ? PALETTE.info : PALETTE.success, children: row.label }, `header-${i}`);
|
|
22782
22762
|
}
|
|
22783
22763
|
if (row.kind === "component-description") {
|
|
22784
22764
|
const isSelected2 = inComponentDesc;
|
|
@@ -26439,6 +26419,7 @@ import { jsx as jsx50, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
|
26439
26419
|
function buildSelectAgentArgs(opts) {
|
|
26440
26420
|
const args = ["analyze", "select-agent", "--agent", opts.agent, "--session", opts.sessionId, "--exclude-invalid"];
|
|
26441
26421
|
if (opts.model) args.push("--model", opts.model);
|
|
26422
|
+
if (opts.bedrock) args.push("--bedrock");
|
|
26442
26423
|
if (opts.selectPromptPath) args.push("--select-prompt-path", opts.selectPromptPath);
|
|
26443
26424
|
if (opts.noCache) args.push("--no-cache");
|
|
26444
26425
|
return args;
|
|
@@ -26474,6 +26455,7 @@ function buildGenerateComponentsArgs(opts) {
|
|
|
26474
26455
|
const args = ["generate", "components", "--agent", opts.agent, "--session", opts.sessionId];
|
|
26475
26456
|
if (opts.tokensPath) args.push("--tokens", opts.tokensPath);
|
|
26476
26457
|
if (opts.model) args.push("--model", opts.model);
|
|
26458
|
+
if (opts.bedrock) args.push("--bedrock");
|
|
26477
26459
|
if (opts.noCache) args.push("--no-cache");
|
|
26478
26460
|
if (opts.generatePromptPath) args.push("--generate-prompt-path", opts.generatePromptPath);
|
|
26479
26461
|
return args;
|
|
@@ -26506,6 +26488,7 @@ function WizardApp({
|
|
|
26506
26488
|
initialHost,
|
|
26507
26489
|
initialAgent,
|
|
26508
26490
|
initialModel,
|
|
26491
|
+
bedrock = false,
|
|
26509
26492
|
initialProjectPath,
|
|
26510
26493
|
host,
|
|
26511
26494
|
autoAcceptScope = false,
|
|
@@ -26566,6 +26549,7 @@ function WizardApp({
|
|
|
26566
26549
|
step: modifyEntryReady || rawTokensEntryReady || pushFromPickerReady ? initialStepResolved : initialRuns && initialRuns.length > 0 ? "run-picker" : initialStepResolved,
|
|
26567
26550
|
agent: initialAgent ?? "claude",
|
|
26568
26551
|
...initialModel ? { agentModel: initialModel } : {},
|
|
26552
|
+
...bedrock ? { bedrock: true } : {},
|
|
26569
26553
|
projectPath: initialProjectPath ?? "",
|
|
26570
26554
|
outDir: initialOutDir,
|
|
26571
26555
|
rawTokensPath: rawTokensEntryReady ? initialRawTokensPath : "",
|
|
@@ -26704,6 +26688,7 @@ If you are using AWS Bedrock, run:
|
|
|
26704
26688
|
const result = await new Promise((res) => {
|
|
26705
26689
|
const tokenArgs = [findCliPath(), "generate", "tokens", "--agent", state.agent, "--raw-tokens", rawTokensPath];
|
|
26706
26690
|
if (state.agentModel) tokenArgs.push("--model", state.agentModel);
|
|
26691
|
+
if (state.bedrock) tokenArgs.push("--bedrock");
|
|
26707
26692
|
const child = spawn4("node", tokenArgs);
|
|
26708
26693
|
let stdout2 = "";
|
|
26709
26694
|
let stderr = "";
|
|
@@ -26861,6 +26846,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
26861
26846
|
sessionId: sessionId2,
|
|
26862
26847
|
agent: state.agent,
|
|
26863
26848
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26849
|
+
...state.bedrock ? { bedrock: true } : {},
|
|
26864
26850
|
selectPromptPath,
|
|
26865
26851
|
noCache
|
|
26866
26852
|
});
|
|
@@ -26959,6 +26945,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
26959
26945
|
tokensPath,
|
|
26960
26946
|
agent: state.agent,
|
|
26961
26947
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26948
|
+
...state.bedrock ? { bedrock: true } : {},
|
|
26962
26949
|
noCache: effectiveNoCache
|
|
26963
26950
|
})
|
|
26964
26951
|
];
|
|
@@ -27028,6 +27015,7 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
27028
27015
|
tokensPath,
|
|
27029
27016
|
agent: state.agent,
|
|
27030
27017
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
27018
|
+
...state.bedrock ? { bedrock: true } : {},
|
|
27031
27019
|
noCache: effectiveNoCache,
|
|
27032
27020
|
generatePromptPath
|
|
27033
27021
|
})
|
|
@@ -28503,11 +28491,13 @@ import { isAbsolute as isAbsolute4, join as join15, relative as relative3, resol
|
|
|
28503
28491
|
init_src();
|
|
28504
28492
|
var AGENT_DESCRIPTION = `Agent to use: ${AGENT_NAMES.join(", ")} (defaults to value saved by experiences setup)`;
|
|
28505
28493
|
var MODEL_DESCRIPTION = "Model to use (defaults to a lightweight per-agent model; override with EDS_AGENT_MODEL_<AGENT>)";
|
|
28494
|
+
var BEDROCK_DESCRIPTION = "Route the selected agent through AWS Bedrock instead of its default model provider (requires AWS credentials in the environment: AWS_PROFILE, or AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN, plus AWS_REGION). Only supported by agents with a Bedrock routing mechanism (currently: claude).";
|
|
28506
28495
|
function addAgentModelOptions(cmd, config = {}) {
|
|
28507
28496
|
const { agentDescription = AGENT_DESCRIPTION, includeModel = true, modelDescription = MODEL_DESCRIPTION } = config;
|
|
28508
28497
|
cmd.option("--agent <name>", agentDescription);
|
|
28509
28498
|
if (includeModel) {
|
|
28510
28499
|
cmd.option("--model <name>", modelDescription);
|
|
28500
|
+
cmd.option("--bedrock", BEDROCK_DESCRIPTION);
|
|
28511
28501
|
}
|
|
28512
28502
|
return cmd;
|
|
28513
28503
|
}
|
|
@@ -29060,7 +29050,7 @@ function resolveProjectRoot(sessionId2, projectRootFlag) {
|
|
|
29060
29050
|
db.close();
|
|
29061
29051
|
}
|
|
29062
29052
|
}
|
|
29063
|
-
async function selectBatch(agent, model, batch, total, verbose, skillPathOverride) {
|
|
29053
|
+
async function selectBatch(agent, model, bedrock, batch, total, verbose, skillPathOverride) {
|
|
29064
29054
|
const prompt2 = await buildPrompt({
|
|
29065
29055
|
skill: "select",
|
|
29066
29056
|
mode: "autonomous",
|
|
@@ -29079,6 +29069,7 @@ async function selectBatch(agent, model, batch, total, verbose, skillPathOverrid
|
|
|
29079
29069
|
const result = await invoker.invoke({
|
|
29080
29070
|
agent,
|
|
29081
29071
|
model,
|
|
29072
|
+
bedrock,
|
|
29082
29073
|
prompt: prompt2,
|
|
29083
29074
|
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
29084
29075
|
onOutput: (chunk) => formatter.push(chunk)
|
|
@@ -29165,7 +29156,7 @@ ${outputBuf}`);
|
|
|
29165
29156
|
}
|
|
29166
29157
|
return results;
|
|
29167
29158
|
}
|
|
29168
|
-
async function selectAllComponents(agent, model, components, verbose, skillPathOverride, cacheConfig = { noCache: true }) {
|
|
29159
|
+
async function selectAllComponents(agent, model, bedrock, components, verbose, skillPathOverride, cacheConfig = { noCache: true }) {
|
|
29169
29160
|
const concurrency = Number(process.env.EDS_GENERATE_CONCURRENCY ?? DEFAULT_CONCURRENCY);
|
|
29170
29161
|
const batchSize = resolveBatchSize();
|
|
29171
29162
|
const total = components.length;
|
|
@@ -29230,7 +29221,7 @@ async function selectAllComponents(agent, model, components, verbose, skillPathO
|
|
|
29230
29221
|
while (nextBatch < batches.length) {
|
|
29231
29222
|
const b = nextBatch++;
|
|
29232
29223
|
const batch = batches[b];
|
|
29233
|
-
const batchResults = await selectBatch(agent, model, batch, total, verbose, skillPathOverride);
|
|
29224
|
+
const batchResults = await selectBatch(agent, model, bedrock, batch, total, verbose, skillPathOverride);
|
|
29234
29225
|
for (let k = 0; k < batch.length; k++) {
|
|
29235
29226
|
results[batch[k].index] = batchResults[k];
|
|
29236
29227
|
}
|
|
@@ -29294,6 +29285,12 @@ function registerAnalyzeSelectAgentCommand(program) {
|
|
|
29294
29285
|
return;
|
|
29295
29286
|
}
|
|
29296
29287
|
const agent = agentName;
|
|
29288
|
+
if (opts.bedrock && !agentSupportsBedrock(agent)) {
|
|
29289
|
+
process.stderr.write(`Error: --bedrock is not supported for --agent ${agent}
|
|
29290
|
+
`);
|
|
29291
|
+
await exitWithAnalytics(1);
|
|
29292
|
+
return;
|
|
29293
|
+
}
|
|
29297
29294
|
const selectPromptPath = opts.selectPromptPath ?? savedCreds.selectPromptPath;
|
|
29298
29295
|
if (selectPromptPath) {
|
|
29299
29296
|
const resolvedPath = resolve12(selectPromptPath);
|
|
@@ -29392,6 +29389,7 @@ function registerAnalyzeSelectAgentCommand(program) {
|
|
|
29392
29389
|
const selectResults = await selectAllComponents(
|
|
29393
29390
|
agent,
|
|
29394
29391
|
model,
|
|
29392
|
+
opts.bedrock,
|
|
29395
29393
|
selectionCandidates,
|
|
29396
29394
|
opts.verbose ?? false,
|
|
29397
29395
|
selectPromptPath ? resolve12(selectPromptPath) : void 0,
|
|
@@ -31151,7 +31149,7 @@ function printFallbackInstructions(options) {
|
|
|
31151
31149
|
lines.push(` Re-run the generate command with the agent available, or use --dry-run to inspect the prompt.`);
|
|
31152
31150
|
process.stderr.write(lines.join("\n") + "\n");
|
|
31153
31151
|
}
|
|
31154
|
-
async function runOneComponent(agent, model, db, sessionId2, component, tokensInline, tokenMapInline, index, total, verbose, noCache, skillPathOverride, promptHash) {
|
|
31152
|
+
async function runOneComponent(agent, model, bedrock, db, sessionId2, component, tokensInline, tokenMapInline, index, total, verbose, noCache, skillPathOverride, promptHash) {
|
|
31155
31153
|
const pos = c.dim(`[${index + 1}/${total}]`);
|
|
31156
31154
|
if (!noCache) {
|
|
31157
31155
|
const inputHash = computeComponentInputHash(component);
|
|
@@ -31236,6 +31234,7 @@ async function runOneComponent(agent, model, db, sessionId2, component, tokensIn
|
|
|
31236
31234
|
const result = await invoker2.invoke({
|
|
31237
31235
|
agent,
|
|
31238
31236
|
model,
|
|
31237
|
+
bedrock,
|
|
31239
31238
|
prompt: prompt2,
|
|
31240
31239
|
timeoutMs: DEFAULT_TIMEOUT_MS3,
|
|
31241
31240
|
onOutput: (chunk) => formatter.push(chunk)
|
|
@@ -31291,7 +31290,7 @@ ${outputBuf}`);
|
|
|
31291
31290
|
renamedSlotsCount: renames.length
|
|
31292
31291
|
};
|
|
31293
31292
|
}
|
|
31294
|
-
async function runAllComponents(agent, model, db, sessionId2, components, tokensInline, tokenMapInline, verbose, noCache, skillPathOverride, promptHash) {
|
|
31293
|
+
async function runAllComponents(agent, model, bedrock, db, sessionId2, components, tokensInline, tokenMapInline, verbose, noCache, skillPathOverride, promptHash) {
|
|
31295
31294
|
const concurrency = Number(process.env.EDS_GENERATE_CONCURRENCY ?? DEFAULT_COMPONENT_CONCURRENCY);
|
|
31296
31295
|
process.stderr.write(
|
|
31297
31296
|
`Categorizing ${c.bold(String(components.length))} component${components.length === 1 ? "" : "s"}` + c.dim(` (concurrency: ${concurrency})`) + "\n"
|
|
@@ -31305,6 +31304,7 @@ async function runAllComponents(agent, model, db, sessionId2, components, tokens
|
|
|
31305
31304
|
results[i] = await runOneComponent(
|
|
31306
31305
|
agent,
|
|
31307
31306
|
model,
|
|
31307
|
+
bedrock,
|
|
31308
31308
|
db,
|
|
31309
31309
|
sessionId2,
|
|
31310
31310
|
components[i],
|
|
@@ -31372,6 +31372,9 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
31372
31372
|
);
|
|
31373
31373
|
}
|
|
31374
31374
|
const agent = agentName;
|
|
31375
|
+
if (opts.bedrock && !agentSupportsBedrock(agent)) {
|
|
31376
|
+
die2(`Error: --bedrock is not supported for --agent ${agent}`);
|
|
31377
|
+
}
|
|
31375
31378
|
const generatePromptPath = skill === "components" ? opts.generatePromptPath ?? savedCreds.generatePromptPath : void 0;
|
|
31376
31379
|
if (generatePromptPath) {
|
|
31377
31380
|
if (!await pathExists3(resolve17(generatePromptPath))) {
|
|
@@ -31481,6 +31484,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
31481
31484
|
componentResults = await runAllComponents(
|
|
31482
31485
|
agent,
|
|
31483
31486
|
model,
|
|
31487
|
+
opts.bedrock,
|
|
31484
31488
|
db,
|
|
31485
31489
|
sessionId2,
|
|
31486
31490
|
allComponents,
|
|
@@ -31593,6 +31597,7 @@ session=${sessionId2 ?? ""}
|
|
|
31593
31597
|
const result = await invoker2.invoke({
|
|
31594
31598
|
agent,
|
|
31595
31599
|
model,
|
|
31600
|
+
bedrock: opts.bedrock,
|
|
31596
31601
|
prompt: prompt2,
|
|
31597
31602
|
timeoutMs: DEFAULT_TIMEOUT_MS3 * 5
|
|
31598
31603
|
});
|
|
@@ -32616,6 +32621,7 @@ function registerPrintCommand(program) {
|
|
|
32616
32621
|
}
|
|
32617
32622
|
|
|
32618
32623
|
// packages/experience-design-system-cli/src/import/command.ts
|
|
32624
|
+
init_src();
|
|
32619
32625
|
init_path_utils();
|
|
32620
32626
|
import { resolve as resolve25, join as join25 } from "node:path";
|
|
32621
32627
|
|
|
@@ -32820,6 +32826,7 @@ async function runPipeline(opts, progressWriter, cliPathOverride) {
|
|
|
32820
32826
|
if (useAgentSelect) {
|
|
32821
32827
|
editArgs = ["analyze", "select-agent", "--session", extractSessionId, "--agent", opts.agent];
|
|
32822
32828
|
if (opts.model) editArgs.push("--model", opts.model);
|
|
32829
|
+
if (opts.bedrock) editArgs.push("--bedrock");
|
|
32823
32830
|
if (opts.excludeInvalid) editArgs.push("--exclude-invalid");
|
|
32824
32831
|
if (opts.noCache) editArgs.push("--no-cache");
|
|
32825
32832
|
if (opts.selectPromptPath) editArgs.push("--select-prompt-path", opts.selectPromptPath);
|
|
@@ -32881,6 +32888,7 @@ async function runPipeline(opts, progressWriter, cliPathOverride) {
|
|
|
32881
32888
|
const generateLabel = stepLabel("Categorizing component props");
|
|
32882
32889
|
const generateArgs = ["generate", "components", "--agent", opts.agent];
|
|
32883
32890
|
if (opts.model) generateArgs.push("--model", opts.model);
|
|
32891
|
+
if (opts.bedrock) generateArgs.push("--bedrock");
|
|
32884
32892
|
if (extractSessionId) generateArgs.push("--session", extractSessionId);
|
|
32885
32893
|
if (opts.dryRun) generateArgs.push("--dry-run");
|
|
32886
32894
|
if (opts.verbose) generateArgs.push("--verbose");
|
|
@@ -33824,6 +33832,12 @@ function registerImportCommand(program) {
|
|
|
33824
33832
|
const resolvedAgent = resolveAgent(opts.agent, creds.agent);
|
|
33825
33833
|
const resolvedModel = resolveModel(opts.model, creds.agentModel);
|
|
33826
33834
|
const resolvedCompositionMode = resolveCompositionMode(opts, creds.compositionMode);
|
|
33835
|
+
if (opts.bedrock && !(isAgentName(resolvedAgent) && agentSupportsBedrock(resolvedAgent))) {
|
|
33836
|
+
process.stderr.write(`Error: --bedrock is not supported for --agent ${resolvedAgent}
|
|
33837
|
+
`);
|
|
33838
|
+
process.exit(1);
|
|
33839
|
+
return;
|
|
33840
|
+
}
|
|
33827
33841
|
const pickerDecision = await shouldShowRunPicker({
|
|
33828
33842
|
flags: {
|
|
33829
33843
|
...opts.pushFromRun !== void 0 ? { pushFromRun: opts.pushFromRun } : {},
|
|
@@ -33852,6 +33866,7 @@ function registerImportCommand(program) {
|
|
|
33852
33866
|
initialHost: toConfiguredHost(opts.host ?? creds.host) ?? DEFAULT_CONFIGURED_HOST,
|
|
33853
33867
|
initialAgent: resolvedAgent,
|
|
33854
33868
|
...resolvedModel ? { initialModel: resolvedModel } : {},
|
|
33869
|
+
...opts.bedrock ? { bedrock: true } : {},
|
|
33855
33870
|
initialProjectPath: opts.project !== "." ? normalizePath(opts.project) : void 0,
|
|
33856
33871
|
host: opts.host,
|
|
33857
33872
|
autoAcceptScope,
|
|
@@ -33914,6 +33929,12 @@ function registerImportCommand(program) {
|
|
|
33914
33929
|
const headlessAgent = resolveAgent(opts.agent, headlessCreds.agent);
|
|
33915
33930
|
const headlessModel = resolveModel(opts.model, headlessCreds.agentModel);
|
|
33916
33931
|
const headlessCompositionMode = resolveCompositionMode(opts, headlessCreds.compositionMode);
|
|
33932
|
+
if (opts.bedrock && !(isAgentName(headlessAgent) && agentSupportsBedrock(headlessAgent))) {
|
|
33933
|
+
process.stderr.write(`Error: --bedrock is not supported for --agent ${headlessAgent}
|
|
33934
|
+
`);
|
|
33935
|
+
process.exit(1);
|
|
33936
|
+
return;
|
|
33937
|
+
}
|
|
33917
33938
|
const result = await runPipeline(
|
|
33918
33939
|
{
|
|
33919
33940
|
project: projectRoot,
|
|
@@ -33923,6 +33944,7 @@ function registerImportCommand(program) {
|
|
|
33923
33944
|
cmaToken,
|
|
33924
33945
|
agent: headlessAgent,
|
|
33925
33946
|
model: headlessModel,
|
|
33947
|
+
...opts.bedrock ? { bedrock: true } : {},
|
|
33926
33948
|
tokens: opts.tokens,
|
|
33927
33949
|
selectAll: opts.selectAll,
|
|
33928
33950
|
select: opts.select.length > 0 ? opts.select : void 0,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
2
|
export declare const AGENT_DESCRIPTION: string;
|
|
3
3
|
export declare const MODEL_DESCRIPTION = "Model to use (defaults to a lightweight per-agent model; override with EDS_AGENT_MODEL_<AGENT>)";
|
|
4
|
+
export declare const BEDROCK_DESCRIPTION = "Route the selected agent through AWS Bedrock instead of its default model provider (requires AWS credentials in the environment: AWS_PROFILE, or AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN, plus AWS_REGION). Only supported by agents with a Bedrock routing mechanism (currently: claude).";
|
|
4
5
|
export interface AgentModelOptionsConfig {
|
|
5
6
|
agentDescription?: string;
|
|
6
7
|
includeModel?: boolean;
|
|
7
8
|
modelDescription?: string;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
|
-
* Register --agent and optionally --model flags to a Commander command, with customizable descriptions.
|
|
11
|
+
* Register --agent and optionally --model/--bedrock flags to a Commander command, with customizable descriptions.
|
|
11
12
|
* Pass `includeModel: false` for commands where the model dimension is not applicable (e.g., mapping-resolution agents that select an agent for logic, not model choice).
|
|
12
13
|
*/
|
|
13
14
|
export declare function addAgentModelOptions(cmd: Command, config?: AgentModelOptionsConfig): Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.27.1-dev-build-
|
|
3
|
+
"version": "2.27.1-dev-build-887759e.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"svelte": "^5.56.4",
|
|
40
40
|
"ts-morph": "^27.0.2",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
|
-
"@contentful/experience-design-system-types": "2.27.1-dev-build-
|
|
42
|
+
"@contentful/experience-design-system-types": "2.27.1-dev-build-887759e.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"ink-testing-library": "^4.0.0",
|
|
52
52
|
"typescript-eslint": "^8.67.0",
|
|
53
53
|
"vitest": "^4.0.16",
|
|
54
|
-
"@contentful/experience-design-system-client": "2.27.1-dev-build-
|
|
55
|
-
"@contentful/experience-design-system-generation": "2.27.1-dev-build-
|
|
56
|
-
"@contentful/experience-design-system-extraction": "2.27.1-dev-build-
|
|
54
|
+
"@contentful/experience-design-system-client": "2.27.1-dev-build-887759e.0",
|
|
55
|
+
"@contentful/experience-design-system-generation": "2.27.1-dev-build-887759e.0",
|
|
56
|
+
"@contentful/experience-design-system-extraction": "2.27.1-dev-build-887759e.0"
|
|
57
57
|
},
|
|
58
58
|
"repository": {
|
|
59
59
|
"type": "git",
|