remove hardcoded agent sidecar locations to fully use config option

This commit is contained in:
Brian Madison 2025-12-06 21:37:43 -06:00
parent 8c04ccf3f0
commit 903c7a4133
3 changed files with 15 additions and 6 deletions

View File

@ -447,6 +447,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
// Set bmad folder name on module manager and IDE manager for placeholder replacement
this.moduleManager.setBmadFolderName(bmadFolderName);
this.moduleManager.setCoreConfig(moduleConfigs.core || {});
this.ideManager.setBmadFolderName(bmadFolderName);
// Tool selection will be collected after we determine if it's a reinstall/update/new install
@ -1577,7 +1578,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
// Get agent sidecar folder from core config
const coreConfigPath = path.join(bmadDir, 'bmb', 'config.yaml');
let agentSidecarFolder = '{project-root}/.myagent-data';
let agentSidecarFolder;
if (await fs.pathExists(coreConfigPath)) {
const yamlLib = require('yaml');
@ -2641,7 +2642,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
const { copyAgentSidecarFiles } = require('../../../lib/agent/installer');
// Get agent sidecar folder from config or use default
const agentSidecarFolder = config.coreConfig?.agent_sidecar_folder || '{project-root}/.myagent-data';
const agentSidecarFolder = config.coreConfig?.agent_sidecar_folder;
// Resolve path variables
const resolvedSidecarFolder = agentSidecarFolder.replaceAll('{project-root}', projectDir).replaceAll('{bmad_folder}', bmadDir);

View File

@ -32,7 +32,7 @@ async function replaceAgentSidecarFolders(bmadDir) {
const coreConfigContent = await fs.readFile(coreConfigPath, 'utf8');
const coreConfig = yaml.parse(coreConfigContent);
const agentSidecarFolder = coreConfig.agent_sidecar_folder || '{project-root}/.myagent-data';
const agentSidecarFolder = coreConfig.agent_sidecar_folder;
// Use the literal value from config, don't resolve the placeholders
console.log(chalk.dim(`\n Replacing {agent_sidecar_folder} with: ${agentSidecarFolder}`));

View File

@ -37,6 +37,14 @@ class ModuleManager {
this.bmadFolderName = bmadFolderName;
}
/**
* Set the core configuration for access during module installation
* @param {Object} coreConfig - Core configuration object
*/
setCoreConfig(coreConfig) {
this.coreConfig = coreConfig;
}
/**
* Copy a file and replace {bmad_folder} placeholder with actual folder name
* @param {string} sourcePath - Source file path
@ -728,7 +736,7 @@ class ModuleManager {
}
// Compile with customizations if any
const { xml } = compileAgent(yamlContent, {}, agentName, relativePath, { config: coreConfig });
const { xml } = compileAgent(yamlContent, {}, agentName, relativePath, { config: this.coreConfig });
// Write the compiled MD file
await fs.writeFile(targetMdPath, xml, 'utf8');
@ -737,8 +745,8 @@ class ModuleManager {
if (hasSidecar) {
const { copyAgentSidecarFiles } = require('../../../lib/agent/installer');
// Get agent sidecar folder from core config or use default
const agentSidecarFolder = coreConfig.agent_sidecar_folder || '{project-root}/.myagent-data';
// Get agent sidecar folder from core config (should always be set)
const agentSidecarFolder = this.coreConfig?.agent_sidecar_folder;
// Resolve path variables
const projectDir = path.dirname(bmadDir);