@contentful/experience-design-system-cli 2.34.5-dev-build-4985ea96.0 → 2.34.5-dev-build-98f09a97.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/credentials-store.d.ts +1 -1
- package/dist/src/import/tui/WizardApp.d.ts +2 -3
- package/dist/src/index.js +18 -218
- package/dist/src/lib/agent-model-options.d.ts +4 -4
- package/dist/src/lib/debug-logger.d.ts +0 -11
- package/dist/src/lib/debug-preamble.d.ts +3 -11
- package/dist/src/program.d.ts +3 -3
- package/package.json +6 -6
- package/dist/src/import/agent-model-resolve.d.ts +0 -27
- package/dist/src/import/tui/run-selection-agent.d.ts +0 -8
package/dist/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export type ExperiencesCredentials = {
|
|
|
7
7
|
agentModel?: string;
|
|
8
8
|
/** Feature 8: persisted custom prompt path for `generate components`. */
|
|
9
9
|
generatePromptPath?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Write JSONL trace of every command decision to ~/.contentful/experience-design-system-cli/debug/. */
|
|
11
11
|
debug?: boolean;
|
|
12
12
|
/** Print plain text with no color; an exported NO_COLOR still wins. */
|
|
13
13
|
noColor?: boolean;
|
|
@@ -17,7 +17,6 @@ export declare function buildGenerateTokensArgs(opts: {
|
|
|
17
17
|
model?: string;
|
|
18
18
|
bedrock?: boolean;
|
|
19
19
|
noCache?: boolean;
|
|
20
|
-
promptOverrides?: string[];
|
|
21
20
|
}): string[];
|
|
22
21
|
export declare function buildMapTokensArgs(opts: {
|
|
23
22
|
sessionId: string;
|
|
@@ -25,7 +24,6 @@ export declare function buildMapTokensArgs(opts: {
|
|
|
25
24
|
model?: string;
|
|
26
25
|
noCache?: boolean;
|
|
27
26
|
skipAgent?: boolean;
|
|
28
|
-
promptOverrides?: string[];
|
|
29
27
|
existingEntitiesPath?: string;
|
|
30
28
|
}): string[];
|
|
31
29
|
export declare function shouldRunMapTokens(opts: {
|
|
@@ -53,6 +51,7 @@ export type WizardAppProps = {
|
|
|
53
51
|
bedrock?: boolean;
|
|
54
52
|
initialProjectPath?: string;
|
|
55
53
|
host?: string;
|
|
54
|
+
compositionMap?: string;
|
|
56
55
|
promptOverrides?: string[];
|
|
57
56
|
noCache?: boolean;
|
|
58
57
|
livePreview?: boolean;
|
|
@@ -60,4 +59,4 @@ export type WizardAppProps = {
|
|
|
60
59
|
skipMapTokens?: boolean;
|
|
61
60
|
initialRawTokensPath?: string;
|
|
62
61
|
};
|
|
63
|
-
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, promptOverrides, noCache, livePreview, generatePromptPath, skipMapTokens, initialRawTokensPath, }?: WizardAppProps): React.ReactElement;
|
|
62
|
+
export declare function WizardApp({ initialSpaceId, initialEnvironmentId, initialCmaToken, initialHost, initialAgent, initialModel, bedrock, initialProjectPath, host, compositionMap, promptOverrides, noCache, livePreview, generatePromptPath, skipMapTokens, initialRawTokensPath, }?: WizardAppProps): React.ReactElement;
|
package/dist/src/index.js
CHANGED
|
@@ -1184,17 +1184,6 @@ function initDebugLogger(opts) {
|
|
|
1184
1184
|
function getDebugLogger() {
|
|
1185
1185
|
return singleton ?? new NoopDebugLogger();
|
|
1186
1186
|
}
|
|
1187
|
-
function resolveDebugMode(opts, configDebug) {
|
|
1188
|
-
if (opts.debug !== void 0) return opts.debug;
|
|
1189
|
-
const env = process.env["EDSI_DEBUG"];
|
|
1190
|
-
if (env !== void 0 && env !== "") {
|
|
1191
|
-
const v = env.toLowerCase();
|
|
1192
|
-
if (v === "1" || v === "true" || v === "yes" || v === "on") return true;
|
|
1193
|
-
if (v === "0" || v === "false" || v === "no" || v === "off") return false;
|
|
1194
|
-
}
|
|
1195
|
-
if (configDebug !== void 0) return configDebug;
|
|
1196
|
-
return false;
|
|
1197
|
-
}
|
|
1198
1187
|
function printDebugBanner(logger, phase) {
|
|
1199
1188
|
if (!logger.enabled || !logger.path) return;
|
|
1200
1189
|
const prefix = phase === "start" ? "\x1B[92m[debug]\x1B[0m " : "\x1B[92m[debug]\x1B[0m ";
|
|
@@ -4146,17 +4135,12 @@ var init_persistence = __esm({
|
|
|
4146
4135
|
|
|
4147
4136
|
// packages/experience-design-system-cli/src/lib/agent-model-options.ts
|
|
4148
4137
|
function addAgentModelOptions(cmd, config = {}) {
|
|
4149
|
-
const {
|
|
4150
|
-
agentDescription = AGENT_DESCRIPTION,
|
|
4151
|
-
includeModel = true,
|
|
4152
|
-
includeBedrock = true,
|
|
4153
|
-
modelDescription = MODEL_DESCRIPTION
|
|
4154
|
-
} = config;
|
|
4138
|
+
const { agentDescription = AGENT_DESCRIPTION, includeModel = true, modelDescription = MODEL_DESCRIPTION } = config;
|
|
4155
4139
|
cmd.option("--agent <name>", agentDescription);
|
|
4156
4140
|
if (includeModel) {
|
|
4157
4141
|
cmd.option("--model <name>", modelDescription);
|
|
4158
4142
|
}
|
|
4159
|
-
|
|
4143
|
+
cmd.option("--bedrock", BEDROCK_DESCRIPTION);
|
|
4160
4144
|
return cmd;
|
|
4161
4145
|
}
|
|
4162
4146
|
var AGENT_DESCRIPTION, MODEL_DESCRIPTION, BEDROCK_AGENTS, BEDROCK_DESCRIPTION;
|
|
@@ -4915,8 +4899,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
4915
4899
|
const { overrides: promptOverrides, errors: promptErrors } = parsePromptOverrides(opts.prompt ?? []);
|
|
4916
4900
|
if (promptErrors.length > 0) die(`Error: ${promptErrors.join("; ")}`);
|
|
4917
4901
|
let generatePrompt;
|
|
4918
|
-
const
|
|
4919
|
-
const generateOverride = promptOverrides.get(promptStage);
|
|
4902
|
+
const generateOverride = promptOverrides.get("generate");
|
|
4920
4903
|
if (generateOverride) {
|
|
4921
4904
|
try {
|
|
4922
4905
|
generatePrompt = await resolvePromptOverride(generateOverride);
|
|
@@ -5266,12 +5249,7 @@ function registerInternalGenerateCommand(program) {
|
|
|
5266
5249
|
addAgentFlags(componentsCmd).action(async (opts) => {
|
|
5267
5250
|
await runGenerateSkill("components", opts, opts.verbose ?? false);
|
|
5268
5251
|
});
|
|
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")
|
|
5270
|
-
"--prompt <stage=value>",
|
|
5271
|
-
"Override a stage prompt (repeatable). Used here for the tokens stage.",
|
|
5272
|
-
(v, acc) => [...acc, v],
|
|
5273
|
-
[]
|
|
5274
|
-
);
|
|
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");
|
|
5275
5253
|
addAgentFlags(tokensCmd).action(async (opts) => {
|
|
5276
5254
|
await runGenerateSkill("tokens", opts, opts.verbose ?? false);
|
|
5277
5255
|
});
|
|
@@ -8491,20 +8469,6 @@ async function runMapTokens(opts) {
|
|
|
8491
8469
|
);
|
|
8492
8470
|
}
|
|
8493
8471
|
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
|
-
}
|
|
8508
8472
|
const db = openPipelineDb();
|
|
8509
8473
|
try {
|
|
8510
8474
|
const sessionId2 = opts.session ?? findLatestSessionForCommand(db, "generate components");
|
|
@@ -8614,9 +8578,7 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
|
|
|
8614
8578
|
tokenTree,
|
|
8615
8579
|
componentSourceRefs,
|
|
8616
8580
|
outDir: process.cwd(),
|
|
8617
|
-
existingTokensInline
|
|
8618
|
-
...mapPromptText !== void 0 ? { skillContentOverride: mapPromptText } : {},
|
|
8619
|
-
...mapPromptText === void 0 && mapPromptPath ? { skillPathOverride: mapPromptPath } : {}
|
|
8581
|
+
existingTokensInline
|
|
8620
8582
|
});
|
|
8621
8583
|
if (opts.printPrompt) {
|
|
8622
8584
|
const prompt2 = await buildMapPrompt();
|
|
@@ -8641,8 +8603,7 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
|
|
|
8641
8603
|
agent,
|
|
8642
8604
|
model,
|
|
8643
8605
|
void 0,
|
|
8644
|
-
existingTokensInline ? [hashContent(existingTokensInline)] : []
|
|
8645
|
-
mapPromptText
|
|
8606
|
+
existingTokensInline ? [hashContent(existingTokensInline)] : []
|
|
8646
8607
|
);
|
|
8647
8608
|
const inputHash = computeMapTokensInputHash(db, sessionId2, componentSourceRefs);
|
|
8648
8609
|
if (!noCache) {
|
|
@@ -8690,12 +8651,7 @@ ${warnings.map((w) => ` ${w}`).join("\n")}
|
|
|
8690
8651
|
}
|
|
8691
8652
|
function registerMapTokensCommand(program) {
|
|
8692
8653
|
const map = program.command("map", { hidden: true }).description("Suggest token restrictions for generated design-token props");
|
|
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(
|
|
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("--token-map <path>", "Path to token-name-map.json sidecar").option(
|
|
8699
8655
|
"--existing-entities-path <path>",
|
|
8700
8656
|
"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."
|
|
8701
8657
|
);
|
|
@@ -8720,7 +8676,6 @@ var init_command4 = __esm({
|
|
|
8720
8676
|
init_MapTokensView();
|
|
8721
8677
|
init_resolve_defaults();
|
|
8722
8678
|
init_cli_errors();
|
|
8723
|
-
init_prompt_overrides();
|
|
8724
8679
|
DEFAULT_TIMEOUT_MS2 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
|
|
8725
8680
|
}
|
|
8726
8681
|
});
|
|
@@ -8748,50 +8703,6 @@ var init_path_utils = __esm({
|
|
|
8748
8703
|
}
|
|
8749
8704
|
});
|
|
8750
8705
|
|
|
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
|
-
|
|
8795
8706
|
// packages/experience-design-system-cli/src/analyze/select/tui/theme.ts
|
|
8796
8707
|
var PALETTE;
|
|
8797
8708
|
var init_theme = __esm({
|
|
@@ -26637,70 +26548,6 @@ var init_wizard_state_transitions = __esm({
|
|
|
26637
26548
|
}
|
|
26638
26549
|
});
|
|
26639
26550
|
|
|
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
|
-
|
|
26704
26551
|
// packages/experience-design-system-cli/src/import/tui/WizardApp.tsx
|
|
26705
26552
|
var WizardApp_exports = {};
|
|
26706
26553
|
__export(WizardApp_exports, {
|
|
@@ -26739,7 +26586,6 @@ function buildGenerateTokensArgs(opts) {
|
|
|
26739
26586
|
if (opts.model) args.push("--model", opts.model);
|
|
26740
26587
|
if (opts.bedrock) args.push("--bedrock");
|
|
26741
26588
|
if (opts.noCache) args.push("--no-cache");
|
|
26742
|
-
for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
|
|
26743
26589
|
return args;
|
|
26744
26590
|
}
|
|
26745
26591
|
function buildMapTokensArgs(opts) {
|
|
@@ -26747,7 +26593,6 @@ function buildMapTokensArgs(opts) {
|
|
|
26747
26593
|
if (opts.model) args.push("--model", opts.model);
|
|
26748
26594
|
if (opts.noCache) args.push("--no-cache");
|
|
26749
26595
|
if (opts.skipAgent) args.push("--skip-agent");
|
|
26750
|
-
for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
|
|
26751
26596
|
if (opts.existingEntitiesPath) args.push("--existing-entities-path", opts.existingEntitiesPath);
|
|
26752
26597
|
return args;
|
|
26753
26598
|
}
|
|
@@ -26823,6 +26668,7 @@ function WizardApp({
|
|
|
26823
26668
|
bedrock = false,
|
|
26824
26669
|
initialProjectPath,
|
|
26825
26670
|
host,
|
|
26671
|
+
compositionMap,
|
|
26826
26672
|
promptOverrides,
|
|
26827
26673
|
noCache = false,
|
|
26828
26674
|
livePreview = true,
|
|
@@ -26992,8 +26838,7 @@ If you are using AWS Bedrock, run:
|
|
|
26992
26838
|
agent: state.agent,
|
|
26993
26839
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
26994
26840
|
...state.bedrock ? { bedrock: true } : {},
|
|
26995
|
-
noCache: effectiveNoCache
|
|
26996
|
-
promptOverrides
|
|
26841
|
+
noCache: effectiveNoCache
|
|
26997
26842
|
});
|
|
26998
26843
|
const result = await runSpawnedCli(tokenArgs);
|
|
26999
26844
|
if (result.exitCode !== 0) {
|
|
@@ -27073,7 +26918,6 @@ If you are using AWS Bedrock, run:
|
|
|
27073
26918
|
...state.agentModel ? { model: state.agentModel } : {},
|
|
27074
26919
|
noCache: effectiveNoCache,
|
|
27075
26920
|
skipAgent: skipMapTokens,
|
|
27076
|
-
promptOverrides,
|
|
27077
26921
|
...state.existingEntitiesPath ? { existingEntitiesPath: state.existingEntitiesPath } : {}
|
|
27078
26922
|
});
|
|
27079
26923
|
const result = await runCli(args);
|
|
@@ -27092,6 +26936,7 @@ If you are using AWS Bedrock, run:
|
|
|
27092
26936
|
update({ step: "extracting", outDir, extractProgress: null, compositionPhase: null });
|
|
27093
26937
|
const extractArgs = [findCliPath(), "__extract", "--project", projectPath];
|
|
27094
26938
|
if (noCache) extractArgs.push("--composition-refresh");
|
|
26939
|
+
if (compositionMap) extractArgs.push("--composition-map", compositionMap);
|
|
27095
26940
|
for (const p of promptOverrides ?? []) extractArgs.push("--prompt", p);
|
|
27096
26941
|
if (state.agent) extractArgs.push("--agent", state.agent);
|
|
27097
26942
|
if (state.bedrock) extractArgs.push("--bedrock");
|
|
@@ -27156,34 +27001,6 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
|
|
|
27156
27001
|
});
|
|
27157
27002
|
return;
|
|
27158
27003
|
}
|
|
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
|
-
}
|
|
27187
27004
|
update({
|
|
27188
27005
|
step: "scope-gate",
|
|
27189
27006
|
extractSessionId
|
|
@@ -28430,27 +28247,15 @@ var init_WizardApp = __esm({
|
|
|
28430
28247
|
init_fetch_and_persist_existing_contentful_entities();
|
|
28431
28248
|
init_wizard_state_transitions();
|
|
28432
28249
|
init_cli_path();
|
|
28433
|
-
init_prompt_overrides();
|
|
28434
|
-
init_run_selection_agent();
|
|
28435
28250
|
WIZARD_LOG = join20(tmpdir(), "experiences-import-wizard.log");
|
|
28436
28251
|
}
|
|
28437
28252
|
});
|
|
28438
28253
|
|
|
28439
28254
|
// packages/experience-design-system-cli/src/import/command.ts
|
|
28440
28255
|
function registerImportCommand(program) {
|
|
28441
|
-
|
|
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(
|
|
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", ".").option("--tokens <path>", "Path to a raw token source file to import alongside components").option("--agent <name>", 'Agent to use for generation (overrides credentials.json; falls back to "claude")').option(
|
|
28452
28257
|
"--prompt <stage=value>",
|
|
28453
|
-
"Override a
|
|
28258
|
+
"Override a stage prompt (repeatable). value is a file path or literal text, e.g. --prompt composition=./p.md",
|
|
28454
28259
|
(v, acc) => [...acc, v],
|
|
28455
28260
|
[]
|
|
28456
28261
|
).option("--no-cache", "Re-run all steps even if output already exists").action(async (opts) => {
|
|
@@ -28476,9 +28281,8 @@ function registerImportCommand(program) {
|
|
|
28476
28281
|
const { createElement: createElement6 } = await import("react");
|
|
28477
28282
|
const { WizardApp: WizardApp2 } = await Promise.resolve().then(() => (init_WizardApp(), WizardApp_exports));
|
|
28478
28283
|
const creds = await readExperiencesCredentials();
|
|
28479
|
-
const
|
|
28480
|
-
const
|
|
28481
|
-
const resolvedModel = resolveModel(parsedAgentModel.model, creds.agentModel);
|
|
28284
|
+
const resolvedAgent = opts.agent || creds.agent || "claude";
|
|
28285
|
+
const resolvedModel = creds.agentModel || void 0;
|
|
28482
28286
|
const { waitUntilExit } = render5(
|
|
28483
28287
|
createElement6(WizardApp2, {
|
|
28484
28288
|
initialSpaceId: creds.spaceId,
|
|
@@ -28488,9 +28292,8 @@ function registerImportCommand(program) {
|
|
|
28488
28292
|
initialAgent: resolvedAgent,
|
|
28489
28293
|
...resolvedModel ? { initialModel: resolvedModel } : {},
|
|
28490
28294
|
initialProjectPath: opts.project !== "." ? normalizePath(opts.project) : void 0,
|
|
28491
|
-
...
|
|
28295
|
+
...opts.prompt && opts.prompt.length > 0 ? { promptOverrides: opts.prompt } : {},
|
|
28492
28296
|
noCache: opts.cache === false,
|
|
28493
|
-
skipMapTokens: false,
|
|
28494
28297
|
livePreview: true,
|
|
28495
28298
|
generatePromptPath: creds.generatePromptPath,
|
|
28496
28299
|
...opts.tokens ? { initialRawTokensPath: normalizePath(opts.tokens) } : {}
|
|
@@ -28505,11 +28308,8 @@ var init_command6 = __esm({
|
|
|
28505
28308
|
"packages/experience-design-system-cli/src/import/command.ts"() {
|
|
28506
28309
|
"use strict";
|
|
28507
28310
|
init_path_utils();
|
|
28508
|
-
init_agent_model_resolve();
|
|
28509
|
-
init_agent_model_options();
|
|
28510
28311
|
init_credentials_store();
|
|
28511
28312
|
init_host_utils();
|
|
28512
|
-
init_composition_options();
|
|
28513
28313
|
init_terminal_capabilities();
|
|
28514
28314
|
}
|
|
28515
28315
|
});
|
|
@@ -30860,14 +30660,14 @@ var init_extract_command = __esm({
|
|
|
30860
30660
|
});
|
|
30861
30661
|
|
|
30862
30662
|
// packages/experience-design-system-cli/src/lib/debug-preamble.ts
|
|
30863
|
-
async function beginCommand(command
|
|
30663
|
+
async function beginCommand(command) {
|
|
30864
30664
|
let configDebug;
|
|
30865
30665
|
try {
|
|
30866
30666
|
const creds = await readExperiencesCredentials();
|
|
30867
30667
|
configDebug = creds.debug;
|
|
30868
30668
|
} catch {
|
|
30869
30669
|
}
|
|
30870
|
-
const enabled =
|
|
30670
|
+
const enabled = configDebug ?? false;
|
|
30871
30671
|
const logger = initDebugLogger({ enabled, command });
|
|
30872
30672
|
if (logger.enabled) {
|
|
30873
30673
|
printDebugBanner(logger, "start");
|
|
@@ -30992,7 +30792,7 @@ function createProgram() {
|
|
|
30992
30792
|
const { analyticsDisabled } = await readExperiencesCredentials();
|
|
30993
30793
|
setPersistedAnalyticsDisabled(analyticsDisabled ?? false);
|
|
30994
30794
|
noteCommandStart(commandChain);
|
|
30995
|
-
await beginCommand(commandChain
|
|
30795
|
+
await beginCommand(commandChain);
|
|
30996
30796
|
});
|
|
30997
30797
|
program.hook("postAction", async () => {
|
|
30998
30798
|
await completeActiveCommand();
|
|
@@ -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;
|
|
8
7
|
modelDescription?: string;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
|
-
* Register --agent
|
|
12
|
-
* command.
|
|
13
|
-
*
|
|
10
|
+
* Register --agent, --bedrock, and optional --model flags with a Commander
|
|
11
|
+
* command. Pass includeModel: false to omit --model only — --bedrock is
|
|
12
|
+
* independent of model selection (it's a routing switch, not a model choice)
|
|
13
|
+
* and is always registered alongside --agent.
|
|
14
14
|
*/
|
|
15
15
|
export declare function addAgentModelOptions(cmd: Command, config?: AgentModelOptionsConfig): Command;
|
|
@@ -25,17 +25,6 @@ export declare function initDebugLogger(opts: InitDebugLoggerOptions): DebugLogg
|
|
|
25
25
|
export declare function getDebugLogger(): DebugLogger;
|
|
26
26
|
/** Test-only: reset the singleton. */
|
|
27
27
|
export declare function __resetDebugLoggerForTest(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Resolve effective debug-mode setting from three sources.
|
|
30
|
-
*
|
|
31
|
-
* Precedence (highest first):
|
|
32
|
-
* 1. `EDSI_DEBUG` env var (truthy: 1, true, yes, on)
|
|
33
|
-
* 2. Persisted `debug` field in credentials.json
|
|
34
|
-
* 4. Default: OFF
|
|
35
|
-
*/
|
|
36
|
-
export declare function resolveDebugMode(opts: {
|
|
37
|
-
debug?: boolean;
|
|
38
|
-
}, configDebug?: boolean): boolean;
|
|
39
28
|
/**
|
|
40
29
|
* Emit the bright-green "debug logs at <path>" banner to stderr.
|
|
41
30
|
* No-op when debug is disabled or stderr is not a TTY-friendly stream.
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { type DebugLogger } from './debug-logger.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Resolves the effective debug decision (flag > env > persisted config),
|
|
6
|
-
* initializes the singleton, and prints the bright-green start banner.
|
|
7
|
-
* Registers a process-exit handler that prints the end banner once.
|
|
8
|
-
*
|
|
9
|
-
* Returns the logger so the caller can emit events without a second import.
|
|
10
|
-
* When debug is disabled, the returned logger is a no-op.
|
|
3
|
+
* Initialize the debug logger from persisted credentials.
|
|
4
|
+
* Debug mode can only be configured via setup preferences;
|
|
11
5
|
*/
|
|
12
|
-
export declare function beginCommand(command: string
|
|
13
|
-
debug?: boolean;
|
|
14
|
-
}): Promise<DebugLogger>;
|
|
6
|
+
export declare function beginCommand(command: string): Promise<DebugLogger>;
|
package/dist/src/program.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export declare function runBuild(opts: {
|
|
|
16
16
|
exitCode: number;
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
19
|
-
* Walks `actionCommand` and its ancestors for a truthy `--bedrock`.
|
|
20
|
-
* is registered per-subcommand, so a
|
|
21
|
-
*
|
|
19
|
+
* Walks `actionCommand` and its ancestors for a truthy `--bedrock`.
|
|
20
|
+
* --bedrock is registered per-subcommand, so a root-level or
|
|
21
|
+
* subcommand-level setting can each carry it.
|
|
22
22
|
*/
|
|
23
23
|
export declare function resolveBedrockFromAncestors(actionCommand: Command): boolean;
|
|
24
24
|
export declare function createProgram(): 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-98f09a97.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-types": "2.34.5-dev-build-
|
|
45
|
-
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-
|
|
44
|
+
"@contentful/experience-design-system-types": "2.34.5-dev-build-98f09a97.0",
|
|
45
|
+
"@contentful/experience-design-system-cli-v2": "2.34.5-dev-build-98f09a97.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-98f09a97.0",
|
|
58
|
+
"@contentful/experience-design-system-extraction": "2.34.5-dev-build-98f09a97.0",
|
|
59
|
+
"@contentful/experience-design-system-generation": "2.34.5-dev-build-98f09a97.0"
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|