@contentful/experience-design-system-cli 2.34.5-dev-build-4bbbf2f0.0 → 2.34.5-dev-build-4985ea96.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 +1 -1
- package/dist/src/import/agent-model-resolve.d.ts +27 -0
- package/dist/src/import/tui/WizardApp.d.ts +3 -2
- package/dist/src/import/tui/run-selection-agent.d.ts +8 -0
- package/dist/src/index.js +204 -15
- package/dist/src/lib/agent-model-options.d.ts +4 -4
- package/package.json +6 -6
package/dist/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolution chain for the combined `--agent` override on `experiences import`.
|
|
3
|
+
*
|
|
4
|
+
* The wizard path previously hard-defaulted `--agent` to `'claude'` at the
|
|
5
|
+
* commander layer, which (a) shadowed the stored `credentials.json` value when
|
|
6
|
+
* the user passed no flag, and (b) made it impossible to distinguish "user
|
|
7
|
+
* explicitly passed --agent claude" from "user passed nothing". The combined
|
|
8
|
+
* flag accepts either `agent:model` or `agent model`.
|
|
9
|
+
*
|
|
10
|
+
* These helpers produce the resolved values to feed into `WizardApp` /
|
|
11
|
+
* the import wizard:
|
|
12
|
+
*
|
|
13
|
+
* 1. CLI flag wins when provided.
|
|
14
|
+
* 2. Otherwise, the value persisted in `credentials.json` (written by
|
|
15
|
+
* `experiences setup`) is used.
|
|
16
|
+
* 3. Otherwise, the built-in default (currently `'claude'`) is used for
|
|
17
|
+
* the agent. Model has no default — agents pick a small/fast model
|
|
18
|
+
* themselves when no model is included in `--agent`.
|
|
19
|
+
*/
|
|
20
|
+
/** Built-in fallback agent when neither a flag nor a stored preference is set. */
|
|
21
|
+
export declare const DEFAULT_AGENT = "claude";
|
|
22
|
+
export declare function parseAgentModel(value: string | undefined): {
|
|
23
|
+
agent?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
};
|
|
26
|
+
export declare function resolveAgent(flagValue: string | undefined, storedValue: string | undefined): string;
|
|
27
|
+
export declare function resolveModel(flagValue: string | undefined, storedValue: string | undefined): string | undefined;
|
|
@@ -17,6 +17,7 @@ export declare function buildGenerateTokensArgs(opts: {
|
|
|
17
17
|
model?: string;
|
|
18
18
|
bedrock?: boolean;
|
|
19
19
|
noCache?: boolean;
|
|
20
|
+
promptOverrides?: string[];
|
|
20
21
|
}): string[];
|
|
21
22
|
export declare function buildMapTokensArgs(opts: {
|
|
22
23
|
sessionId: string;
|
|
@@ -24,6 +25,7 @@ export declare function buildMapTokensArgs(opts: {
|
|
|
24
25
|
model?: string;
|
|
25
26
|
noCache?: boolean;
|
|
26
27
|
skipAgent?: boolean;
|
|
28
|
+
promptOverrides?: string[];
|
|
27
29
|
existingEntitiesPath?: string;
|
|
28
30
|
}): string[];
|
|
29
31
|
export declare function shouldRunMapTokens(opts: {
|
|
@@ -51,7 +53,6 @@ export type WizardAppProps = {
|
|
|
51
53
|
bedrock?: boolean;
|
|
52
54
|
initialProjectPath?: string;
|
|
53
55
|
host?: string;
|
|
54
|
-
compositionMap?: string;
|
|
55
56
|
promptOverrides?: string[];
|
|
56
57
|
noCache?: boolean;
|
|
57
58
|
livePreview?: boolean;
|
|
@@ -59,4 +60,4 @@ export type WizardAppProps = {
|
|
|
59
60
|
skipMapTokens?: boolean;
|
|
60
61
|
initialRawTokensPath?: string;
|
|
61
62
|
};
|
|
62
|
-
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host,
|
|
63
|
+
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, promptOverrides, noCache, livePreview, generatePromptPath, skipMapTokens, initialRawTokensPath, }?: WizardAppProps): React.ReactElement;
|
package/dist/src/index.js
CHANGED
|
@@ -4146,12 +4146,17 @@ var init_persistence = __esm({
|
|
|
4146
4146
|
|
|
4147
4147
|
// packages/experience-design-system-cli/src/lib/agent-model-options.ts
|
|
4148
4148
|
function addAgentModelOptions(cmd, config = {}) {
|
|
4149
|
-
const {
|
|
4149
|
+
const {
|
|
4150
|
+
agentDescription = AGENT_DESCRIPTION,
|
|
4151
|
+
includeModel = true,
|
|
4152
|
+
includeBedrock = true,
|
|
4153
|
+
modelDescription = MODEL_DESCRIPTION
|
|
4154
|
+
} = config;
|
|
4150
4155
|
cmd.option("--agent <name>", agentDescription);
|
|
4151
4156
|
if (includeModel) {
|
|
4152
4157
|
cmd.option("--model <name>", modelDescription);
|
|
4153
4158
|
}
|
|
4154
|
-
cmd.option("--bedrock", BEDROCK_DESCRIPTION);
|
|
4159
|
+
if (includeBedrock) cmd.option("--bedrock", BEDROCK_DESCRIPTION);
|
|
4155
4160
|
return cmd;
|
|
4156
4161
|
}
|
|
4157
4162
|
var AGENT_DESCRIPTION, MODEL_DESCRIPTION, BEDROCK_AGENTS, BEDROCK_DESCRIPTION;
|
|
@@ -4910,7 +4915,8 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
4910
4915
|
const { overrides: promptOverrides, errors: promptErrors } = parsePromptOverrides(opts.prompt ?? []);
|
|
4911
4916
|
if (promptErrors.length > 0) die(`Error: ${promptErrors.join("; ")}`);
|
|
4912
4917
|
let generatePrompt;
|
|
4913
|
-
const
|
|
4918
|
+
const promptStage = skill === "tokens" ? "tokens" : "generate";
|
|
4919
|
+
const generateOverride = promptOverrides.get(promptStage);
|
|
4914
4920
|
if (generateOverride) {
|
|
4915
4921
|
try {
|
|
4916
4922
|
generatePrompt = await resolvePromptOverride(generateOverride);
|
|
@@ -5260,7 +5266,12 @@ function registerInternalGenerateCommand(program) {
|
|
|
5260
5266
|
addAgentFlags(componentsCmd).action(async (opts) => {
|
|
5261
5267
|
await runGenerateSkill("components", opts, opts.verbose ?? false);
|
|
5262
5268
|
});
|
|
5263
|
-
const tokensCmd = generate.command("tokens").description("Invoke a coding agent to produce tokens.json from raw token data").option("--raw-tokens <path>", "Path to raw token input file")
|
|
5269
|
+
const tokensCmd = generate.command("tokens").description("Invoke a coding agent to produce tokens.json from raw token data").option("--raw-tokens <path>", "Path to raw token input file").option(
|
|
5270
|
+
"--prompt <stage=value>",
|
|
5271
|
+
"Override a stage prompt (repeatable). Used here for the tokens stage.",
|
|
5272
|
+
(v, acc) => [...acc, v],
|
|
5273
|
+
[]
|
|
5274
|
+
);
|
|
5264
5275
|
addAgentFlags(tokensCmd).action(async (opts) => {
|
|
5265
5276
|
await runGenerateSkill("tokens", opts, opts.verbose ?? false);
|
|
5266
5277
|
});
|
|
@@ -8480,6 +8491,20 @@ async function runMapTokens(opts) {
|
|
|
8480
8491
|
);
|
|
8481
8492
|
}
|
|
8482
8493
|
const resultAgent = configuredAgent ?? "skipped";
|
|
8494
|
+
const { overrides: promptOverrides, errors: promptErrors } = parsePromptOverrides(opts.prompt ?? []);
|
|
8495
|
+
if (promptErrors.length > 0) die(`Error: ${promptErrors.join("; ")}`);
|
|
8496
|
+
const mapPromptOverride = promptOverrides.get("map-tokens");
|
|
8497
|
+
let mapPromptText;
|
|
8498
|
+
let mapPromptPath;
|
|
8499
|
+
if (mapPromptOverride?.kind === "text") mapPromptText = mapPromptOverride.value;
|
|
8500
|
+
if (mapPromptOverride?.kind === "path") {
|
|
8501
|
+
mapPromptPath = resolve8(mapPromptOverride.value);
|
|
8502
|
+
try {
|
|
8503
|
+
await resolvePromptOverride(mapPromptOverride);
|
|
8504
|
+
} catch (error) {
|
|
8505
|
+
die(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
8506
|
+
}
|
|
8507
|
+
}
|
|
8483
8508
|
const db = openPipelineDb();
|
|
8484
8509
|
try {
|
|
8485
8510
|
const sessionId2 = opts.session ?? findLatestSessionForCommand(db, "generate components");
|
|
@@ -8589,7 +8614,9 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
|
|
|
8589
8614
|
tokenTree,
|
|
8590
8615
|
componentSourceRefs,
|
|
8591
8616
|
outDir: process.cwd(),
|
|
8592
|
-
existingTokensInline
|
|
8617
|
+
existingTokensInline,
|
|
8618
|
+
...mapPromptText !== void 0 ? { skillContentOverride: mapPromptText } : {},
|
|
8619
|
+
...mapPromptText === void 0 && mapPromptPath ? { skillPathOverride: mapPromptPath } : {}
|
|
8593
8620
|
});
|
|
8594
8621
|
if (opts.printPrompt) {
|
|
8595
8622
|
const prompt2 = await buildMapPrompt();
|
|
@@ -8614,7 +8641,8 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
|
|
|
8614
8641
|
agent,
|
|
8615
8642
|
model,
|
|
8616
8643
|
void 0,
|
|
8617
|
-
existingTokensInline ? [hashContent(existingTokensInline)] : []
|
|
8644
|
+
existingTokensInline ? [hashContent(existingTokensInline)] : [],
|
|
8645
|
+
mapPromptText
|
|
8618
8646
|
);
|
|
8619
8647
|
const inputHash = computeMapTokensInputHash(db, sessionId2, componentSourceRefs);
|
|
8620
8648
|
if (!noCache) {
|
|
@@ -8662,7 +8690,12 @@ ${warnings.map((w) => ` ${w}`).join("\n")}
|
|
|
8662
8690
|
}
|
|
8663
8691
|
function registerMapTokensCommand(program) {
|
|
8664
8692
|
const map = program.command("map", { hidden: true }).description("Suggest token restrictions for generated design-token props");
|
|
8665
|
-
const tokensCmd = map.command("tokens").description("Invoke a coding agent to suggest $token.allowed for design-category token props").option("--session <id>", "Session ID from generate components (defaults to most recent)").option("--print-prompt", "Print the prompt without invoking the agent").option("--skip-agent", "Resolve token defaults without agentic $token.allowed inference").option("--no-cache", "Bypass the map-tokens cache and force a re-run").option(
|
|
8693
|
+
const tokensCmd = map.command("tokens").description("Invoke a coding agent to suggest $token.allowed for design-category token props").option("--session <id>", "Session ID from generate components (defaults to most recent)").option("--print-prompt", "Print the prompt without invoking the agent").option("--skip-agent", "Resolve token defaults without agentic $token.allowed inference").option("--no-cache", "Bypass the map-tokens cache and force a re-run").option(
|
|
8694
|
+
"--prompt <stage=value>",
|
|
8695
|
+
"Override a stage prompt (repeatable). Used here for the map-tokens stage.",
|
|
8696
|
+
(v, acc) => [...acc, v],
|
|
8697
|
+
[]
|
|
8698
|
+
).option("--token-map <path>", "Path to token-name-map.json sidecar").option(
|
|
8666
8699
|
"--existing-entities-path <path>",
|
|
8667
8700
|
"Path to the .existing-entities.json file written after CMA credentials are supplied. When present, the agent gets a list of the space's existing design tokens so it can prefer binding to them. Missing/malformed files are treated as no-op."
|
|
8668
8701
|
);
|
|
@@ -8687,6 +8720,7 @@ var init_command4 = __esm({
|
|
|
8687
8720
|
init_MapTokensView();
|
|
8688
8721
|
init_resolve_defaults();
|
|
8689
8722
|
init_cli_errors();
|
|
8723
|
+
init_prompt_overrides();
|
|
8690
8724
|
DEFAULT_TIMEOUT_MS2 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
8691
8725
|
}
|
|
8692
8726
|
});
|
|
@@ -8714,6 +8748,50 @@ var init_path_utils = __esm({
|
|
|
8714
8748
|
}
|
|
8715
8749
|
});
|
|
8716
8750
|
|
|
8751
|
+
// packages/experience-design-system-cli/src/import/agent-model-resolve.ts
|
|
8752
|
+
function parseAgentModel(value) {
|
|
8753
|
+
if (!value?.trim()) return {};
|
|
8754
|
+
const trimmed = value.trim();
|
|
8755
|
+
const separator = trimmed.indexOf(":");
|
|
8756
|
+
if (separator >= 0) {
|
|
8757
|
+
return {
|
|
8758
|
+
agent: trimmed.slice(0, separator).trim() || void 0,
|
|
8759
|
+
model: trimmed.slice(separator + 1).trim() || void 0
|
|
8760
|
+
};
|
|
8761
|
+
}
|
|
8762
|
+
const [agent, ...modelParts] = trimmed.split(/\s+/);
|
|
8763
|
+
return { agent, ...modelParts.length > 0 ? { model: modelParts.join(" ") } : {} };
|
|
8764
|
+
}
|
|
8765
|
+
function resolveAgent(flagValue, storedValue) {
|
|
8766
|
+
if (flagValue && flagValue.length > 0) return flagValue;
|
|
8767
|
+
if (storedValue && storedValue.length > 0) return storedValue;
|
|
8768
|
+
return DEFAULT_AGENT;
|
|
8769
|
+
}
|
|
8770
|
+
function resolveModel(flagValue, storedValue) {
|
|
8771
|
+
if (flagValue && flagValue.length > 0) return flagValue;
|
|
8772
|
+
if (storedValue && storedValue.length > 0) return storedValue;
|
|
8773
|
+
return void 0;
|
|
8774
|
+
}
|
|
8775
|
+
var DEFAULT_AGENT;
|
|
8776
|
+
var init_agent_model_resolve = __esm({
|
|
8777
|
+
"packages/experience-design-system-cli/src/import/agent-model-resolve.ts"() {
|
|
8778
|
+
"use strict";
|
|
8779
|
+
DEFAULT_AGENT = "claude";
|
|
8780
|
+
}
|
|
8781
|
+
});
|
|
8782
|
+
|
|
8783
|
+
// packages/experience-design-system-cli/src/import/composition-options.ts
|
|
8784
|
+
function buildCompositionForwardingOptions(options) {
|
|
8785
|
+
return {
|
|
8786
|
+
...options.prompt && options.prompt.length > 0 ? { promptOverrides: options.prompt } : {}
|
|
8787
|
+
};
|
|
8788
|
+
}
|
|
8789
|
+
var init_composition_options = __esm({
|
|
8790
|
+
"packages/experience-design-system-cli/src/import/composition-options.ts"() {
|
|
8791
|
+
"use strict";
|
|
8792
|
+
}
|
|
8793
|
+
});
|
|
8794
|
+
|
|
8717
8795
|
// packages/experience-design-system-cli/src/analyze/select/tui/theme.ts
|
|
8718
8796
|
var PALETTE;
|
|
8719
8797
|
var init_theme = __esm({
|
|
@@ -26559,6 +26637,70 @@ var init_wizard_state_transitions = __esm({
|
|
|
26559
26637
|
}
|
|
26560
26638
|
});
|
|
26561
26639
|
|
|
26640
|
+
// packages/experience-design-system-cli/src/import/tui/run-selection-agent.ts
|
|
26641
|
+
async function runSelectionAgent(options) {
|
|
26642
|
+
const db = openPipelineDb();
|
|
26643
|
+
let components;
|
|
26644
|
+
try {
|
|
26645
|
+
components = loadRawComponents(db, options.sessionId);
|
|
26646
|
+
} finally {
|
|
26647
|
+
db.close();
|
|
26648
|
+
}
|
|
26649
|
+
if (components.length === 0) return;
|
|
26650
|
+
const invoker2 = createLocalCliAgentInvoker({
|
|
26651
|
+
onDebugEvent: (name, payload) => getDebugLogger().event("agent", name, payload)
|
|
26652
|
+
});
|
|
26653
|
+
const prompt = await buildPrompt({
|
|
26654
|
+
skill: "select",
|
|
26655
|
+
mode: "autonomous",
|
|
26656
|
+
rawComponentsInline: JSON.stringify(components, null, 2),
|
|
26657
|
+
outDir: process.cwd(),
|
|
26658
|
+
...options.promptText !== void 0 ? { skillContentOverride: options.promptText } : {},
|
|
26659
|
+
...options.promptText === void 0 && options.promptPath ? { skillPathOverride: options.promptPath } : {}
|
|
26660
|
+
});
|
|
26661
|
+
const { result } = await invokeAgentWithOutput(
|
|
26662
|
+
invoker2,
|
|
26663
|
+
{ agent: options.agent, model: options.model, prompt, timeoutMs: DEFAULT_TIMEOUT_MS4 },
|
|
26664
|
+
false
|
|
26665
|
+
);
|
|
26666
|
+
if (result.timedOut) throw new Error("selection agent timed out");
|
|
26667
|
+
if (result.exitCode !== 0) throw new Error(`selection agent exited with code ${result.exitCode}`);
|
|
26668
|
+
const { calls, warnings } = parseSelectToolCallLines(result.stdout);
|
|
26669
|
+
for (const warning of warnings) process.stderr.write(`Warning: selection agent: ${warning}
|
|
26670
|
+
`);
|
|
26671
|
+
const byName = new Map(calls.map((call) => [call.name, call]));
|
|
26672
|
+
const writeDb = openPipelineDb();
|
|
26673
|
+
try {
|
|
26674
|
+
const update = writeDb.prepare(
|
|
26675
|
+
`UPDATE raw_components SET status = ?, reject_reason = ? WHERE session_id = ? AND component_id = ?`
|
|
26676
|
+
);
|
|
26677
|
+
for (const component of components) {
|
|
26678
|
+
const call = byName.get(component.name);
|
|
26679
|
+
if (!call) continue;
|
|
26680
|
+
const rejected = call.tool === "reject_component";
|
|
26681
|
+
update.run(
|
|
26682
|
+
rejected ? "rejected" : "accepted",
|
|
26683
|
+
rejected ? call.reason ?? null : null,
|
|
26684
|
+
options.sessionId,
|
|
26685
|
+
component.component_id
|
|
26686
|
+
);
|
|
26687
|
+
}
|
|
26688
|
+
} finally {
|
|
26689
|
+
writeDb.close();
|
|
26690
|
+
}
|
|
26691
|
+
}
|
|
26692
|
+
var DEFAULT_TIMEOUT_MS4;
|
|
26693
|
+
var init_run_selection_agent = __esm({
|
|
26694
|
+
"packages/experience-design-system-cli/src/import/tui/run-selection-agent.ts"() {
|
|
26695
|
+
"use strict";
|
|
26696
|
+
init_src();
|
|
26697
|
+
init_debug_logger();
|
|
26698
|
+
init_agent_output();
|
|
26699
|
+
init_db();
|
|
26700
|
+
DEFAULT_TIMEOUT_MS4 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
26701
|
+
}
|
|
26702
|
+
});
|
|
26703
|
+
|
|
26562
26704
|
// packages/experience-design-system-cli/src/import/tui/WizardApp.tsx
|
|
26563
26705
|
var WizardApp_exports = {};
|
|
26564
26706
|
__export(WizardApp_exports, {
|
|
@@ -26597,6 +26739,7 @@ function buildGenerateTokensArgs(opts) {
|
|
|
26597
26739
|
if (opts.model) args.push("--model", opts.model);
|
|
26598
26740
|
if (opts.bedrock) args.push("--bedrock");
|
|
26599
26741
|
if (opts.noCache) args.push("--no-cache");
|
|
26742
|
+
for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
|
|
26600
26743
|
return args;
|
|
26601
26744
|
}
|
|
26602
26745
|
function buildMapTokensArgs(opts) {
|
|
@@ -26604,6 +26747,7 @@ function buildMapTokensArgs(opts) {
|
|
|
26604
26747
|
if (opts.model) args.push("--model", opts.model);
|
|
26605
26748
|
if (opts.noCache) args.push("--no-cache");
|
|
26606
26749
|
if (opts.skipAgent) args.push("--skip-agent");
|
|
26750
|
+
for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
|
|
26607
26751
|
if (opts.existingEntitiesPath) args.push("--existing-entities-path", opts.existingEntitiesPath);
|
|
26608
26752
|
return args;
|
|
26609
26753
|
}
|
|
@@ -26679,7 +26823,6 @@ function WizardApp({
|
|
|
26679
26823
|
bedrock = false,
|
|
26680
26824
|
initialProjectPath,
|
|
26681
26825
|
host,
|
|
26682
|
-
compositionMap,
|
|
26683
26826
|
promptOverrides,
|
|
26684
26827
|
noCache = false,
|
|
26685
26828
|
livePreview = true,
|
|
@@ -26849,7 +26992,8 @@ If you are using AWS Bedrock, run:
|
|
|
26849
26992
|
agent: state.agent,
|
|
26850
26993
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26851
26994
|
...state.bedrock ? { bedrock: true } : {},
|
|
26852
|
-
noCache: effectiveNoCache
|
|
26995
|
+
noCache: effectiveNoCache,
|
|
26996
|
+
promptOverrides
|
|
26853
26997
|
});
|
|
26854
26998
|
const result = await runSpawnedCli(tokenArgs);
|
|
26855
26999
|
if (result.exitCode !== 0) {
|
|
@@ -26929,6 +27073,7 @@ If you are using AWS Bedrock, run:
|
|
|
26929
27073
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26930
27074
|
noCache: effectiveNoCache,
|
|
26931
27075
|
skipAgent: skipMapTokens,
|
|
27076
|
+
promptOverrides,
|
|
26932
27077
|
...state.existingEntitiesPath ? { existingEntitiesPath: state.existingEntitiesPath } : {}
|
|
26933
27078
|
});
|
|
26934
27079
|
const result = await runCli(args);
|
|
@@ -26947,7 +27092,6 @@ If you are using AWS Bedrock, run:
|
|
|
26947
27092
|
update({ step: "extracting", outDir, extractProgress: null, compositionPhase: null });
|
|
26948
27093
|
const extractArgs = [findCliPath(), "__extract", "--project", projectPath];
|
|
26949
27094
|
if (noCache) extractArgs.push("--composition-refresh");
|
|
26950
|
-
if (compositionMap) extractArgs.push("--composition-map", compositionMap);
|
|
26951
27095
|
for (const p of promptOverrides ?? []) extractArgs.push("--prompt", p);
|
|
26952
27096
|
if (state.agent) extractArgs.push("--agent", state.agent);
|
|
26953
27097
|
if (state.bedrock) extractArgs.push("--bedrock");
|
|
@@ -27012,6 +27156,34 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
27012
27156
|
});
|
|
27013
27157
|
return;
|
|
27014
27158
|
}
|
|
27159
|
+
try {
|
|
27160
|
+
const { overrides, errors } = parsePromptOverrides(promptOverrides ?? []);
|
|
27161
|
+
if (errors.length > 0) throw new Error(errors.join("; "));
|
|
27162
|
+
const selectOverride = overrides.get("select");
|
|
27163
|
+
let promptText;
|
|
27164
|
+
let promptPath;
|
|
27165
|
+
if (selectOverride?.kind === "text") promptText = selectOverride.value;
|
|
27166
|
+
if (selectOverride?.kind === "path") {
|
|
27167
|
+
promptPath = resolve17(selectOverride.value);
|
|
27168
|
+
await resolvePromptOverride(selectOverride);
|
|
27169
|
+
}
|
|
27170
|
+
if (state.agent) {
|
|
27171
|
+
await runSelectionAgent({
|
|
27172
|
+
sessionId: extractSessionId ?? "",
|
|
27173
|
+
agent: state.agent,
|
|
27174
|
+
...state.agentModel ? { model: state.agentModel } : {},
|
|
27175
|
+
...promptText !== void 0 ? { promptText } : {},
|
|
27176
|
+
...promptPath ? { promptPath } : {}
|
|
27177
|
+
});
|
|
27178
|
+
}
|
|
27179
|
+
} catch (error) {
|
|
27180
|
+
update({
|
|
27181
|
+
step: "error",
|
|
27182
|
+
errorStep: "selection agent",
|
|
27183
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
27184
|
+
});
|
|
27185
|
+
return;
|
|
27186
|
+
}
|
|
27015
27187
|
update({
|
|
27016
27188
|
step: "scope-gate",
|
|
27017
27189
|
extractSessionId
|
|
@@ -28258,15 +28430,27 @@ var init_WizardApp = __esm({
|
|
|
28258
28430
|
init_fetch_and_persist_existing_contentful_entities();
|
|
28259
28431
|
init_wizard_state_transitions();
|
|
28260
28432
|
init_cli_path();
|
|
28433
|
+
init_prompt_overrides();
|
|
28434
|
+
init_run_selection_agent();
|
|
28261
28435
|
WIZARD_LOG = join20(tmpdir(), "experiences-import-wizard.log");
|
|
28262
28436
|
}
|
|
28263
28437
|
});
|
|
28264
28438
|
|
|
28265
28439
|
// packages/experience-design-system-cli/src/import/command.ts
|
|
28266
28440
|
function registerImportCommand(program) {
|
|
28267
|
-
program.command("import").description("Run the full pipeline: analyze \u2192 select \u2192 generate \u2192 push").option("--project <path>", "Path to the project root to analyze", ".")
|
|
28441
|
+
const cmd = program.command("import").description("Run the full pipeline: analyze \u2192 select \u2192 generate \u2192 push").option("--project <path>", "Path to the project root to analyze", ".");
|
|
28442
|
+
cmd.option(
|
|
28443
|
+
"--tokens <path>",
|
|
28444
|
+
"Path to a raw token source file (SCSS, CSS variables, JS/TS, Style Dictionary, etc.) to classify and import alongside components. Bypasses the interactive token prompt."
|
|
28445
|
+
);
|
|
28446
|
+
addAgentModelOptions(cmd, {
|
|
28447
|
+
agentDescription: 'Agent and optional model as agent:model or "agent model" (overrides credentials.json; falls back to "claude")',
|
|
28448
|
+
includeModel: false,
|
|
28449
|
+
includeBedrock: false
|
|
28450
|
+
});
|
|
28451
|
+
cmd.option(
|
|
28268
28452
|
"--prompt <stage=value>",
|
|
28269
|
-
"Override a
|
|
28453
|
+
"Override a composition, selection, token, generation, or token-mapping prompt (repeatable). value is a file path or literal text, e.g. --prompt select=./p.md",
|
|
28270
28454
|
(v, acc) => [...acc, v],
|
|
28271
28455
|
[]
|
|
28272
28456
|
).option("--no-cache", "Re-run all steps even if output already exists").action(async (opts) => {
|
|
@@ -28292,8 +28476,9 @@ function registerImportCommand(program) {
|
|
|
28292
28476
|
const { createElement: createElement6 } = await import("react");
|
|
28293
28477
|
const { WizardApp: WizardApp2 } = await Promise.resolve().then(() => (init_WizardApp(), WizardApp_exports));
|
|
28294
28478
|
const creds = await readExperiencesCredentials();
|
|
28295
|
-
const
|
|
28296
|
-
const
|
|
28479
|
+
const parsedAgentModel = parseAgentModel(opts.agent);
|
|
28480
|
+
const resolvedAgent = resolveAgent(parsedAgentModel.agent, creds.agent);
|
|
28481
|
+
const resolvedModel = resolveModel(parsedAgentModel.model, creds.agentModel);
|
|
28297
28482
|
const { waitUntilExit } = render5(
|
|
28298
28483
|
createElement6(WizardApp2, {
|
|
28299
28484
|
initialSpaceId: creds.spaceId,
|
|
@@ -28303,8 +28488,9 @@ function registerImportCommand(program) {
|
|
|
28303
28488
|
initialAgent: resolvedAgent,
|
|
28304
28489
|
...resolvedModel ? { initialModel: resolvedModel } : {},
|
|
28305
28490
|
initialProjectPath: opts.project !== "." ? normalizePath(opts.project) : void 0,
|
|
28306
|
-
...opts
|
|
28491
|
+
...buildCompositionForwardingOptions(opts),
|
|
28307
28492
|
noCache: opts.cache === false,
|
|
28493
|
+
skipMapTokens: false,
|
|
28308
28494
|
livePreview: true,
|
|
28309
28495
|
generatePromptPath: creds.generatePromptPath,
|
|
28310
28496
|
...opts.tokens ? { initialRawTokensPath: normalizePath(opts.tokens) } : {}
|
|
@@ -28319,8 +28505,11 @@ var init_command6 = __esm({
|
|
|
28319
28505
|
"packages/experience-design-system-cli/src/import/command.ts"() {
|
|
28320
28506
|
"use strict";
|
|
28321
28507
|
init_path_utils();
|
|
28508
|
+
init_agent_model_resolve();
|
|
28509
|
+
init_agent_model_options();
|
|
28322
28510
|
init_credentials_store();
|
|
28323
28511
|
init_host_utils();
|
|
28512
|
+
init_composition_options();
|
|
28324
28513
|
init_terminal_capabilities();
|
|
28325
28514
|
}
|
|
28326
28515
|
});
|
|
@@ -4,12 +4,12 @@ export declare const MODEL_DESCRIPTION = "Model to use (defaults to a lightweigh
|
|
|
4
4
|
export interface AgentModelOptionsConfig {
|
|
5
5
|
agentDescription?: string;
|
|
6
6
|
includeModel?: boolean;
|
|
7
|
+
includeBedrock?: boolean;
|
|
7
8
|
modelDescription?: string;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
|
-
* Register --agent
|
|
11
|
-
* command.
|
|
12
|
-
*
|
|
13
|
-
* and is always registered alongside --agent.
|
|
11
|
+
* Register --agent plus optional --model and --bedrock flags with a Commander
|
|
12
|
+
* command. The optional flags can be omitted for commands with a narrower
|
|
13
|
+
* public surface.
|
|
14
14
|
*/
|
|
15
15
|
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.34.5-dev-build-
|
|
3
|
+
"version": "2.34.5-dev-build-4985ea96.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"svelte": "^5.56.4",
|
|
42
42
|
"ts-morph": "^27.0.2",
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
|
-
"@contentful/experience-design-system-
|
|
45
|
-
"@contentful/experience-design-system-
|
|
44
|
+
"@contentful/experience-design-system-types": "2.34.5-dev-build-4985ea96.0",
|
|
45
|
+
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-4985ea96.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"ink-testing-library": "^4.0.0",
|
|
55
55
|
"typescript-eslint": "^8.67.0",
|
|
56
56
|
"vitest": "^4.0.16",
|
|
57
|
-
"@contentful/experience-design-system-client": "2.34.5-dev-build-
|
|
58
|
-
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-
|
|
59
|
-
"@contentful/experience-design-system-generation": "2.34.5-dev-build-
|
|
57
|
+
"@contentful/experience-design-system-client": "2.34.5-dev-build-4985ea96.0",
|
|
58
|
+
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-4985ea96.0",
|
|
59
|
+
"@contentful/experience-design-system-generation": "2.34.5-dev-build-4985ea96.0"
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|