mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-29 16:14:59 +00:00
sidecar content goes to custom core config location
This commit is contained in:
@@ -28,11 +28,13 @@ class AgentCommandGenerator {
|
||||
|
||||
for (const agent of agents) {
|
||||
const launcherContent = await this.generateLauncherContent(agent);
|
||||
// Use relativePath if available (for nested agents), otherwise just name with .md
|
||||
const agentPathInModule = agent.relativePath || `${agent.name}.md`;
|
||||
artifacts.push({
|
||||
type: 'agent-launcher',
|
||||
module: agent.module,
|
||||
name: agent.name,
|
||||
relativePath: path.join(agent.module, 'agents', `${agent.name}.md`),
|
||||
relativePath: path.join(agent.module, 'agents', agentPathInModule),
|
||||
content: launcherContent,
|
||||
sourcePath: agent.path,
|
||||
});
|
||||
@@ -56,9 +58,12 @@ class AgentCommandGenerator {
|
||||
const template = await fs.readFile(this.templatePath, 'utf8');
|
||||
|
||||
// Replace template variables
|
||||
// Use relativePath if available (for nested agents), otherwise just name with .md
|
||||
const agentPathInModule = agent.relativePath || `${agent.name}.md`;
|
||||
return template
|
||||
.replaceAll('{{name}}', agent.name)
|
||||
.replaceAll('{{module}}', agent.module)
|
||||
.replaceAll('{{path}}', agentPathInModule)
|
||||
.replaceAll('{{description}}', agent.description || `${agent.name} agent`)
|
||||
.replaceAll('{bmad_folder}', this.bmadFolderName)
|
||||
.replaceAll('{*bmad_folder*}', '{bmad_folder}');
|
||||
|
||||
@@ -76,7 +76,7 @@ async function getTasksFromBmad(bmadDir, selectedModules = []) {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
async function getAgentsFromDir(dirPath, moduleName) {
|
||||
async function getAgentsFromDir(dirPath, moduleName, relativePath = '') {
|
||||
const agents = [];
|
||||
|
||||
if (!(await fs.pathExists(dirPath))) {
|
||||
@@ -87,10 +87,11 @@ async function getAgentsFromDir(dirPath, moduleName) {
|
||||
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dirPath, entry.name);
|
||||
const newRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
// Recurse into subdirectories
|
||||
const subDirAgents = await getAgentsFromDir(fullPath, moduleName);
|
||||
const subDirAgents = await getAgentsFromDir(fullPath, moduleName, newRelativePath);
|
||||
agents.push(...subDirAgents);
|
||||
} else if (entry.name.endsWith('.md')) {
|
||||
// Skip README files and other non-agent files
|
||||
@@ -117,6 +118,7 @@ async function getAgentsFromDir(dirPath, moduleName) {
|
||||
path: fullPath,
|
||||
name: entry.name.replace('.md', ''),
|
||||
module: moduleName,
|
||||
relativePath: newRelativePath, // Keep the .md extension for the full path
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user