fixed issue with agent customization application, now all fields are customized form the custom yaml. also added a recompile agents menu item

This commit is contained in:
Brian Madison
2025-12-17 17:58:37 +08:00
parent ccb64623bc
commit f36369512b
7 changed files with 3457 additions and 115 deletions

View File

@@ -731,7 +731,7 @@ class ModuleManager {
async compileModuleAgents(sourcePath, targetPath, moduleName, bmadDir, installer = null) {
const sourceAgentsPath = path.join(sourcePath, 'agents');
const targetAgentsPath = path.join(targetPath, 'agents');
const cfgAgentsDir = path.join(bmadDir, '_config', 'agents');
const cfgAgentsDir = path.join(bmadDir, '_bmad', '_config', 'agents');
// Check if agents directory exists in source
if (!(await fs.pathExists(sourceAgentsPath))) {
@@ -809,9 +809,9 @@ class ModuleManager {
const customizeData = yaml.parse(customizeContent);
customizedFields = customizeData.customized_fields || [];
// Build answers object from customizations (filter empty values)
// Build answers object from customizations
if (customizeData.persona) {
Object.assign(answers, filterCustomizationData(customizeData.persona));
answers.persona = customizeData.persona;
}
if (customizeData.agent?.metadata) {
const filteredMetadata = filterCustomizationData(customizeData.agent.metadata);
@@ -825,6 +825,12 @@ class ModuleManager {
if (customizeData.memories && customizeData.memories.length > 0) {
answers.memories = customizeData.memories;
}
if (customizeData.menu && customizeData.menu.length > 0) {
answers.menu = customizeData.menu;
}
if (customizeData.prompts && customizeData.prompts.length > 0) {
answers.prompts = customizeData.prompts;
}
}
// Check if agent has sidecar
@@ -839,8 +845,14 @@ class ModuleManager {
// Compile with customizations if any
const { xml } = await compileAgent(yamlContent, answers, agentName, relativePath, { config: this.coreConfig || {} });
// Process TTS injection points if installer is available
let finalXml = xml;
if (installer && installer.processTTSInjectionPoints) {
finalXml = installer.processTTSInjectionPoints(xml, targetMdPath);
}
// Write the compiled agent
await fs.writeFile(targetMdPath, xml, 'utf8');
await fs.writeFile(targetMdPath, finalXml, 'utf8');
// Handle sidecar copying if present
if (hasSidecar) {