@contentful/experience-design-system-cli 2.34.5-dev-build-a4f15b7e.0 → 2.34.5-dev-build-13ecfbdc.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
|
@@ -4135,12 +4135,17 @@ var init_persistence = __esm({
|
|
|
4135
4135
|
|
|
4136
4136
|
// packages/experience-design-system-cli/src/lib/agent-model-options.ts
|
|
4137
4137
|
function addAgentModelOptions(cmd, config = {}) {
|
|
4138
|
-
const {
|
|
4138
|
+
const {
|
|
4139
|
+
agentDescription = AGENT_DESCRIPTION,
|
|
4140
|
+
includeModel = true,
|
|
4141
|
+
includeBedrock = true,
|
|
4142
|
+
modelDescription = MODEL_DESCRIPTION
|
|
4143
|
+
} = config;
|
|
4139
4144
|
cmd.option("--agent <name>", agentDescription);
|
|
4140
4145
|
if (includeModel) {
|
|
4141
4146
|
cmd.option("--model <name>", modelDescription);
|
|
4142
4147
|
}
|
|
4143
|
-
cmd.option("--bedrock", BEDROCK_DESCRIPTION);
|
|
4148
|
+
if (includeBedrock) cmd.option("--bedrock", BEDROCK_DESCRIPTION);
|
|
4144
4149
|
return cmd;
|
|
4145
4150
|
}
|
|
4146
4151
|
var AGENT_DESCRIPTION, MODEL_DESCRIPTION, BEDROCK_AGENTS, BEDROCK_DESCRIPTION;
|
|
@@ -4899,7 +4904,8 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
4899
4904
|
const { overrides: promptOverrides, errors: promptErrors } = parsePromptOverrides(opts.prompt ?? []);
|
|
4900
4905
|
if (promptErrors.length > 0) die(`Error: ${promptErrors.join("; ")}`);
|
|
4901
4906
|
let generatePrompt;
|
|
4902
|
-
const
|
|
4907
|
+
const promptStage = skill === "tokens" ? "tokens" : "generate";
|
|
4908
|
+
const generateOverride = promptOverrides.get(promptStage);
|
|
4903
4909
|
if (generateOverride) {
|
|
4904
4910
|
try {
|
|
4905
4911
|
generatePrompt = await resolvePromptOverride(generateOverride);
|
|
@@ -5249,7 +5255,12 @@ function registerInternalGenerateCommand(program) {
|
|
|
5249
5255
|
addAgentFlags(componentsCmd).action(async (opts) => {
|
|
5250
5256
|
await runGenerateSkill("components", opts, opts.verbose ?? false);
|
|
5251
5257
|
});
|
|
5252
|
-
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")
|
|
5258
|
+
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(
|
|
5259
|
+
"--prompt <stage=value>",
|
|
5260
|
+
"Override a stage prompt (repeatable). Used here for the tokens stage.",
|
|
5261
|
+
(v, acc) => [...acc, v],
|
|
5262
|
+
[]
|
|
5263
|
+
);
|
|
5253
5264
|
addAgentFlags(tokensCmd).action(async (opts) => {
|
|
5254
5265
|
await runGenerateSkill("tokens", opts, opts.verbose ?? false);
|
|
5255
5266
|
});
|
|
@@ -8469,6 +8480,20 @@ async function runMapTokens(opts) {
|
|
|
8469
8480
|
);
|
|
8470
8481
|
}
|
|
8471
8482
|
const resultAgent = configuredAgent ?? "skipped";
|
|
8483
|
+
const { overrides: promptOverrides, errors: promptErrors } = parsePromptOverrides(opts.prompt ?? []);
|
|
8484
|
+
if (promptErrors.length > 0) die(`Error: ${promptErrors.join("; ")}`);
|
|
8485
|
+
const mapPromptOverride = promptOverrides.get("map-tokens");
|
|
8486
|
+
let mapPromptText;
|
|
8487
|
+
let mapPromptPath;
|
|
8488
|
+
if (mapPromptOverride?.kind === "text") mapPromptText = mapPromptOverride.value;
|
|
8489
|
+
if (mapPromptOverride?.kind === "path") {
|
|
8490
|
+
mapPromptPath = resolve8(mapPromptOverride.value);
|
|
8491
|
+
try {
|
|
8492
|
+
await resolvePromptOverride(mapPromptOverride);
|
|
8493
|
+
} catch (error) {
|
|
8494
|
+
die(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
8495
|
+
}
|
|
8496
|
+
}
|
|
8472
8497
|
const db = openPipelineDb();
|
|
8473
8498
|
try {
|
|
8474
8499
|
const sessionId2 = opts.session ?? findLatestSessionForCommand(db, "generate components");
|
|
@@ -8578,7 +8603,9 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
|
|
|
8578
8603
|
tokenTree,
|
|
8579
8604
|
componentSourceRefs,
|
|
8580
8605
|
outDir: process.cwd(),
|
|
8581
|
-
existingTokensInline
|
|
8606
|
+
existingTokensInline,
|
|
8607
|
+
...mapPromptText !== void 0 ? { skillContentOverride: mapPromptText } : {},
|
|
8608
|
+
...mapPromptText === void 0 && mapPromptPath ? { skillPathOverride: mapPromptPath } : {}
|
|
8582
8609
|
});
|
|
8583
8610
|
if (opts.printPrompt) {
|
|
8584
8611
|
const prompt2 = await buildMapPrompt();
|
|
@@ -8603,7 +8630,8 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
|
|
|
8603
8630
|
agent,
|
|
8604
8631
|
model,
|
|
8605
8632
|
void 0,
|
|
8606
|
-
existingTokensInline ? [hashContent(existingTokensInline)] : []
|
|
8633
|
+
existingTokensInline ? [hashContent(existingTokensInline)] : [],
|
|
8634
|
+
mapPromptText
|
|
8607
8635
|
);
|
|
8608
8636
|
const inputHash = computeMapTokensInputHash(db, sessionId2, componentSourceRefs);
|
|
8609
8637
|
if (!noCache) {
|
|
@@ -8651,7 +8679,12 @@ ${warnings.map((w) => ` ${w}`).join("\n")}
|
|
|
8651
8679
|
}
|
|
8652
8680
|
function registerMapTokensCommand(program) {
|
|
8653
8681
|
const map = program.command("map", { hidden: true }).description("Suggest token restrictions for generated design-token props");
|
|
8654
|
-
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(
|
|
8682
|
+
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(
|
|
8683
|
+
"--prompt <stage=value>",
|
|
8684
|
+
"Override a stage prompt (repeatable). Used here for the map-tokens stage.",
|
|
8685
|
+
(v, acc) => [...acc, v],
|
|
8686
|
+
[]
|
|
8687
|
+
).option("--token-map <path>", "Path to token-name-map.json sidecar").option(
|
|
8655
8688
|
"--existing-entities-path <path>",
|
|
8656
8689
|
"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."
|
|
8657
8690
|
);
|
|
@@ -8676,6 +8709,7 @@ var init_command4 = __esm({
|
|
|
8676
8709
|
init_MapTokensView();
|
|
8677
8710
|
init_resolve_defaults();
|
|
8678
8711
|
init_cli_errors();
|
|
8712
|
+
init_prompt_overrides();
|
|
8679
8713
|
DEFAULT_TIMEOUT_MS2 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
8680
8714
|
}
|
|
8681
8715
|
});
|
|
@@ -8703,6 +8737,50 @@ var init_path_utils = __esm({
|
|
|
8703
8737
|
}
|
|
8704
8738
|
});
|
|
8705
8739
|
|
|
8740
|
+
// packages/experience-design-system-cli/src/import/agent-model-resolve.ts
|
|
8741
|
+
function parseAgentModel(value) {
|
|
8742
|
+
if (!value?.trim()) return {};
|
|
8743
|
+
const trimmed = value.trim();
|
|
8744
|
+
const separator = trimmed.indexOf(":");
|
|
8745
|
+
if (separator >= 0) {
|
|
8746
|
+
return {
|
|
8747
|
+
agent: trimmed.slice(0, separator).trim() || void 0,
|
|
8748
|
+
model: trimmed.slice(separator + 1).trim() || void 0
|
|
8749
|
+
};
|
|
8750
|
+
}
|
|
8751
|
+
const [agent, ...modelParts] = trimmed.split(/\s+/);
|
|
8752
|
+
return { agent, ...modelParts.length > 0 ? { model: modelParts.join(" ") } : {} };
|
|
8753
|
+
}
|
|
8754
|
+
function resolveAgent(flagValue, storedValue) {
|
|
8755
|
+
if (flagValue && flagValue.length > 0) return flagValue;
|
|
8756
|
+
if (storedValue && storedValue.length > 0) return storedValue;
|
|
8757
|
+
return DEFAULT_AGENT;
|
|
8758
|
+
}
|
|
8759
|
+
function resolveModel(flagValue, storedValue) {
|
|
8760
|
+
if (flagValue && flagValue.length > 0) return flagValue;
|
|
8761
|
+
if (storedValue && storedValue.length > 0) return storedValue;
|
|
8762
|
+
return void 0;
|
|
8763
|
+
}
|
|
8764
|
+
var DEFAULT_AGENT;
|
|
8765
|
+
var init_agent_model_resolve = __esm({
|
|
8766
|
+
"packages/experience-design-system-cli/src/import/agent-model-resolve.ts"() {
|
|
8767
|
+
"use strict";
|
|
8768
|
+
DEFAULT_AGENT = "claude";
|
|
8769
|
+
}
|
|
8770
|
+
});
|
|
8771
|
+
|
|
8772
|
+
// packages/experience-design-system-cli/src/import/composition-options.ts
|
|
8773
|
+
function buildCompositionForwardingOptions(options) {
|
|
8774
|
+
return {
|
|
8775
|
+
...options.prompt && options.prompt.length > 0 ? { promptOverrides: options.prompt } : {}
|
|
8776
|
+
};
|
|
8777
|
+
}
|
|
8778
|
+
var init_composition_options = __esm({
|
|
8779
|
+
"packages/experience-design-system-cli/src/import/composition-options.ts"() {
|
|
8780
|
+
"use strict";
|
|
8781
|
+
}
|
|
8782
|
+
});
|
|
8783
|
+
|
|
8706
8784
|
// packages/experience-design-system-cli/src/analyze/select/tui/theme.ts
|
|
8707
8785
|
var PALETTE;
|
|
8708
8786
|
var init_theme = __esm({
|
|
@@ -26548,6 +26626,70 @@ var init_wizard_state_transitions = __esm({
|
|
|
26548
26626
|
}
|
|
26549
26627
|
});
|
|
26550
26628
|
|
|
26629
|
+
// packages/experience-design-system-cli/src/import/tui/run-selection-agent.ts
|
|
26630
|
+
async function runSelectionAgent(options) {
|
|
26631
|
+
const db = openPipelineDb();
|
|
26632
|
+
let components;
|
|
26633
|
+
try {
|
|
26634
|
+
components = loadRawComponents(db, options.sessionId);
|
|
26635
|
+
} finally {
|
|
26636
|
+
db.close();
|
|
26637
|
+
}
|
|
26638
|
+
if (components.length === 0) return;
|
|
26639
|
+
const invoker2 = createLocalCliAgentInvoker({
|
|
26640
|
+
onDebugEvent: (name, payload) => getDebugLogger().event("agent", name, payload)
|
|
26641
|
+
});
|
|
26642
|
+
const prompt = await buildPrompt({
|
|
26643
|
+
skill: "select",
|
|
26644
|
+
mode: "autonomous",
|
|
26645
|
+
rawComponentsInline: JSON.stringify(components, null, 2),
|
|
26646
|
+
outDir: process.cwd(),
|
|
26647
|
+
...options.promptText !== void 0 ? { skillContentOverride: options.promptText } : {},
|
|
26648
|
+
...options.promptText === void 0 && options.promptPath ? { skillPathOverride: options.promptPath } : {}
|
|
26649
|
+
});
|
|
26650
|
+
const { result } = await invokeAgentWithOutput(
|
|
26651
|
+
invoker2,
|
|
26652
|
+
{ agent: options.agent, model: options.model, prompt, timeoutMs: DEFAULT_TIMEOUT_MS4 },
|
|
26653
|
+
false
|
|
26654
|
+
);
|
|
26655
|
+
if (result.timedOut) throw new Error("selection agent timed out");
|
|
26656
|
+
if (result.exitCode !== 0) throw new Error(`selection agent exited with code ${result.exitCode}`);
|
|
26657
|
+
const { calls, warnings } = parseSelectToolCallLines(result.stdout);
|
|
26658
|
+
for (const warning of warnings) process.stderr.write(`Warning: selection agent: ${warning}
|
|
26659
|
+
`);
|
|
26660
|
+
const byName = new Map(calls.map((call) => [call.name, call]));
|
|
26661
|
+
const writeDb = openPipelineDb();
|
|
26662
|
+
try {
|
|
26663
|
+
const update = writeDb.prepare(
|
|
26664
|
+
`UPDATE raw_components SET status = ?, reject_reason = ? WHERE session_id = ? AND component_id = ?`
|
|
26665
|
+
);
|
|
26666
|
+
for (const component of components) {
|
|
26667
|
+
const call = byName.get(component.name);
|
|
26668
|
+
if (!call) continue;
|
|
26669
|
+
const rejected = call.tool === "reject_component";
|
|
26670
|
+
update.run(
|
|
26671
|
+
rejected ? "rejected" : "accepted",
|
|
26672
|
+
rejected ? call.reason ?? null : null,
|
|
26673
|
+
options.sessionId,
|
|
26674
|
+
component.component_id
|
|
26675
|
+
);
|
|
26676
|
+
}
|
|
26677
|
+
} finally {
|
|
26678
|
+
writeDb.close();
|
|
26679
|
+
}
|
|
26680
|
+
}
|
|
26681
|
+
var DEFAULT_TIMEOUT_MS4;
|
|
26682
|
+
var init_run_selection_agent = __esm({
|
|
26683
|
+
"packages/experience-design-system-cli/src/import/tui/run-selection-agent.ts"() {
|
|
26684
|
+
"use strict";
|
|
26685
|
+
init_src();
|
|
26686
|
+
init_debug_logger();
|
|
26687
|
+
init_agent_output();
|
|
26688
|
+
init_db();
|
|
26689
|
+
DEFAULT_TIMEOUT_MS4 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
26690
|
+
}
|
|
26691
|
+
});
|
|
26692
|
+
|
|
26551
26693
|
// packages/experience-design-system-cli/src/import/tui/WizardApp.tsx
|
|
26552
26694
|
var WizardApp_exports = {};
|
|
26553
26695
|
__export(WizardApp_exports, {
|
|
@@ -26586,6 +26728,7 @@ function buildGenerateTokensArgs(opts) {
|
|
|
26586
26728
|
if (opts.model) args.push("--model", opts.model);
|
|
26587
26729
|
if (opts.bedrock) args.push("--bedrock");
|
|
26588
26730
|
if (opts.noCache) args.push("--no-cache");
|
|
26731
|
+
for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
|
|
26589
26732
|
return args;
|
|
26590
26733
|
}
|
|
26591
26734
|
function buildMapTokensArgs(opts) {
|
|
@@ -26593,6 +26736,7 @@ function buildMapTokensArgs(opts) {
|
|
|
26593
26736
|
if (opts.model) args.push("--model", opts.model);
|
|
26594
26737
|
if (opts.noCache) args.push("--no-cache");
|
|
26595
26738
|
if (opts.skipAgent) args.push("--skip-agent");
|
|
26739
|
+
for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
|
|
26596
26740
|
if (opts.existingEntitiesPath) args.push("--existing-entities-path", opts.existingEntitiesPath);
|
|
26597
26741
|
return args;
|
|
26598
26742
|
}
|
|
@@ -26668,7 +26812,6 @@ function WizardApp({
|
|
|
26668
26812
|
bedrock = false,
|
|
26669
26813
|
initialProjectPath,
|
|
26670
26814
|
host,
|
|
26671
|
-
compositionMap,
|
|
26672
26815
|
promptOverrides,
|
|
26673
26816
|
noCache = false,
|
|
26674
26817
|
livePreview = true,
|
|
@@ -26838,7 +26981,8 @@ If you are using AWS Bedrock, run:
|
|
|
26838
26981
|
agent: state.agent,
|
|
26839
26982
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26840
26983
|
...state.bedrock ? { bedrock: true } : {},
|
|
26841
|
-
noCache: effectiveNoCache
|
|
26984
|
+
noCache: effectiveNoCache,
|
|
26985
|
+
promptOverrides
|
|
26842
26986
|
});
|
|
26843
26987
|
const result = await runSpawnedCli(tokenArgs);
|
|
26844
26988
|
if (result.exitCode !== 0) {
|
|
@@ -26918,6 +27062,7 @@ If you are using AWS Bedrock, run:
|
|
|
26918
27062
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26919
27063
|
noCache: effectiveNoCache,
|
|
26920
27064
|
skipAgent: skipMapTokens,
|
|
27065
|
+
promptOverrides,
|
|
26921
27066
|
...state.existingEntitiesPath ? { existingEntitiesPath: state.existingEntitiesPath } : {}
|
|
26922
27067
|
});
|
|
26923
27068
|
const result = await runCli(args);
|
|
@@ -26936,7 +27081,6 @@ If you are using AWS Bedrock, run:
|
|
|
26936
27081
|
update({ step: "extracting", outDir, extractProgress: null, compositionPhase: null });
|
|
26937
27082
|
const extractArgs = [findCliPath(), "__extract", "--project", projectPath];
|
|
26938
27083
|
if (noCache) extractArgs.push("--composition-refresh");
|
|
26939
|
-
if (compositionMap) extractArgs.push("--composition-map", compositionMap);
|
|
26940
27084
|
for (const p of promptOverrides ?? []) extractArgs.push("--prompt", p);
|
|
26941
27085
|
if (state.agent) extractArgs.push("--agent", state.agent);
|
|
26942
27086
|
if (state.bedrock) extractArgs.push("--bedrock");
|
|
@@ -27001,6 +27145,34 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
27001
27145
|
});
|
|
27002
27146
|
return;
|
|
27003
27147
|
}
|
|
27148
|
+
try {
|
|
27149
|
+
const { overrides, errors } = parsePromptOverrides(promptOverrides ?? []);
|
|
27150
|
+
if (errors.length > 0) throw new Error(errors.join("; "));
|
|
27151
|
+
const selectOverride = overrides.get("select");
|
|
27152
|
+
let promptText;
|
|
27153
|
+
let promptPath;
|
|
27154
|
+
if (selectOverride?.kind === "text") promptText = selectOverride.value;
|
|
27155
|
+
if (selectOverride?.kind === "path") {
|
|
27156
|
+
promptPath = resolve17(selectOverride.value);
|
|
27157
|
+
await resolvePromptOverride(selectOverride);
|
|
27158
|
+
}
|
|
27159
|
+
if (state.agent) {
|
|
27160
|
+
await runSelectionAgent({
|
|
27161
|
+
sessionId: extractSessionId ?? "",
|
|
27162
|
+
agent: state.agent,
|
|
27163
|
+
...state.agentModel ? { model: state.agentModel } : {},
|
|
27164
|
+
...promptText !== void 0 ? { promptText } : {},
|
|
27165
|
+
...promptPath ? { promptPath } : {}
|
|
27166
|
+
});
|
|
27167
|
+
}
|
|
27168
|
+
} catch (error) {
|
|
27169
|
+
update({
|
|
27170
|
+
step: "error",
|
|
27171
|
+
errorStep: "selection agent",
|
|
27172
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
27173
|
+
});
|
|
27174
|
+
return;
|
|
27175
|
+
}
|
|
27004
27176
|
update({
|
|
27005
27177
|
step: "scope-gate",
|
|
27006
27178
|
extractSessionId
|
|
@@ -28247,15 +28419,27 @@ var init_WizardApp = __esm({
|
|
|
28247
28419
|
init_fetch_and_persist_existing_contentful_entities();
|
|
28248
28420
|
init_wizard_state_transitions();
|
|
28249
28421
|
init_cli_path();
|
|
28422
|
+
init_prompt_overrides();
|
|
28423
|
+
init_run_selection_agent();
|
|
28250
28424
|
WIZARD_LOG = join20(tmpdir(), "experiences-import-wizard.log");
|
|
28251
28425
|
}
|
|
28252
28426
|
});
|
|
28253
28427
|
|
|
28254
28428
|
// packages/experience-design-system-cli/src/import/command.ts
|
|
28255
28429
|
function registerImportCommand(program) {
|
|
28256
|
-
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", ".")
|
|
28430
|
+
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", ".");
|
|
28431
|
+
cmd.option(
|
|
28432
|
+
"--tokens <path>",
|
|
28433
|
+
"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."
|
|
28434
|
+
);
|
|
28435
|
+
addAgentModelOptions(cmd, {
|
|
28436
|
+
agentDescription: 'Agent and optional model as agent:model or "agent model" (overrides credentials.json; falls back to "claude")',
|
|
28437
|
+
includeModel: false,
|
|
28438
|
+
includeBedrock: false
|
|
28439
|
+
});
|
|
28440
|
+
cmd.option(
|
|
28257
28441
|
"--prompt <stage=value>",
|
|
28258
|
-
"Override a
|
|
28442
|
+
"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",
|
|
28259
28443
|
(v, acc) => [...acc, v],
|
|
28260
28444
|
[]
|
|
28261
28445
|
).option("--no-cache", "Re-run all steps even if output already exists").action(async (opts) => {
|
|
@@ -28281,8 +28465,9 @@ function registerImportCommand(program) {
|
|
|
28281
28465
|
const { createElement: createElement6 } = await import("react");
|
|
28282
28466
|
const { WizardApp: WizardApp2 } = await Promise.resolve().then(() => (init_WizardApp(), WizardApp_exports));
|
|
28283
28467
|
const creds = await readExperiencesCredentials();
|
|
28284
|
-
const
|
|
28285
|
-
const
|
|
28468
|
+
const parsedAgentModel = parseAgentModel(opts.agent);
|
|
28469
|
+
const resolvedAgent = resolveAgent(parsedAgentModel.agent, creds.agent);
|
|
28470
|
+
const resolvedModel = resolveModel(parsedAgentModel.model, creds.agentModel);
|
|
28286
28471
|
const { waitUntilExit } = render5(
|
|
28287
28472
|
createElement6(WizardApp2, {
|
|
28288
28473
|
initialSpaceId: creds.spaceId,
|
|
@@ -28292,8 +28477,9 @@ function registerImportCommand(program) {
|
|
|
28292
28477
|
initialAgent: resolvedAgent,
|
|
28293
28478
|
...resolvedModel ? { initialModel: resolvedModel } : {},
|
|
28294
28479
|
initialProjectPath: opts.project !== "." ? normalizePath(opts.project) : void 0,
|
|
28295
|
-
...opts
|
|
28480
|
+
...buildCompositionForwardingOptions(opts),
|
|
28296
28481
|
noCache: opts.cache === false,
|
|
28482
|
+
skipMapTokens: false,
|
|
28297
28483
|
livePreview: true,
|
|
28298
28484
|
generatePromptPath: creds.generatePromptPath,
|
|
28299
28485
|
...opts.tokens ? { initialRawTokensPath: normalizePath(opts.tokens) } : {}
|
|
@@ -28308,8 +28494,11 @@ var init_command6 = __esm({
|
|
|
28308
28494
|
"packages/experience-design-system-cli/src/import/command.ts"() {
|
|
28309
28495
|
"use strict";
|
|
28310
28496
|
init_path_utils();
|
|
28497
|
+
init_agent_model_resolve();
|
|
28498
|
+
init_agent_model_options();
|
|
28311
28499
|
init_credentials_store();
|
|
28312
28500
|
init_host_utils();
|
|
28501
|
+
init_composition_options();
|
|
28313
28502
|
init_terminal_capabilities();
|
|
28314
28503
|
}
|
|
28315
28504
|
});
|
|
@@ -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-13ecfbdc.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-13ecfbdc.0",
|
|
45
|
+
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-13ecfbdc.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-extraction": "2.34.5-dev-build-
|
|
58
|
-
"@contentful/experience-design-system-generation": "2.34.5-dev-build-
|
|
59
|
-
"@contentful/experience-design-system-client": "2.34.5-dev-build-
|
|
57
|
+
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-13ecfbdc.0",
|
|
58
|
+
"@contentful/experience-design-system-generation": "2.34.5-dev-build-13ecfbdc.0",
|
|
59
|
+
"@contentful/experience-design-system-client": "2.34.5-dev-build-13ecfbdc.0"
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|