fix path bug
This commit is contained in:
@@ -1008,11 +1008,11 @@ class Installer {
|
||||
includeMetadata: true,
|
||||
});
|
||||
|
||||
// Replace {project-root} placeholder
|
||||
const processedContent = xmlContent.replaceAll('{project-root}', projectDir);
|
||||
// DO NOT replace {project-root} - LLMs understand this placeholder at runtime
|
||||
// const processedContent = xmlContent.replaceAll('{project-root}', projectDir);
|
||||
|
||||
// Write the built .md file to bmad/{module}/agents/
|
||||
await fs.writeFile(mdPath, processedContent, 'utf8');
|
||||
await fs.writeFile(mdPath, xmlContent, 'utf8');
|
||||
this.installedFiles.push(mdPath);
|
||||
|
||||
// Remove the source YAML file - we can regenerate from installer source if needed
|
||||
@@ -1107,11 +1107,11 @@ class Installer {
|
||||
includeMetadata: true,
|
||||
});
|
||||
|
||||
// Replace {project-root} placeholder
|
||||
const processedContent = xmlContent.replaceAll('{project-root}', projectDir);
|
||||
// DO NOT replace {project-root} - LLMs understand this placeholder at runtime
|
||||
// const processedContent = xmlContent.replaceAll('{project-root}', projectDir);
|
||||
|
||||
// Write the built .md file
|
||||
await fs.writeFile(targetMdPath, processedContent, 'utf8');
|
||||
await fs.writeFile(targetMdPath, xmlContent, 'utf8');
|
||||
|
||||
// Display result
|
||||
if (customizedFields.length > 0) {
|
||||
@@ -1200,11 +1200,11 @@ class Installer {
|
||||
includeMetadata: true,
|
||||
});
|
||||
|
||||
// Replace {project-root} placeholder
|
||||
const processedContent = xmlContent.replaceAll('{project-root}', projectDir);
|
||||
// DO NOT replace {project-root} - LLMs understand this placeholder at runtime
|
||||
// const processedContent = xmlContent.replaceAll('{project-root}', projectDir);
|
||||
|
||||
// Write the rebuilt .md file
|
||||
await fs.writeFile(targetMdPath, processedContent, 'utf8');
|
||||
await fs.writeFile(targetMdPath, xmlContent, 'utf8');
|
||||
|
||||
// Display result with customizations if any
|
||||
if (customizedFields.length > 0) {
|
||||
|
||||
@@ -131,7 +131,7 @@ class ActivationBuilder {
|
||||
// Replace placeholders
|
||||
const processed = stepsTemplate
|
||||
.replace('{agent-file-basename}', agentBasename)
|
||||
.replace('{module}', metadata.module || 'core')
|
||||
.replace('{{module}}', metadata.module || 'core') // Fixed to use {{module}}
|
||||
.replace('{AGENT_SPECIFIC_STEPS}', agentStepsXml)
|
||||
.replace('{MENU_STEP}', menuStep.toString())
|
||||
.replace('{HALT_STEP}', haltStep.toString())
|
||||
|
||||
@@ -135,6 +135,11 @@ class YamlXmlBuilder {
|
||||
const agent = agentYaml.agent;
|
||||
const metadata = agent.metadata || {};
|
||||
|
||||
// Add module from buildMetadata if available
|
||||
if (buildMetadata.module) {
|
||||
metadata.module = buildMetadata.module;
|
||||
}
|
||||
|
||||
// Analyze agent to determine needed handlers
|
||||
const profile = this.analyzer.analyzeAgentObject(agentYaml);
|
||||
|
||||
@@ -346,6 +351,27 @@ class YamlXmlBuilder {
|
||||
const sourceHash = await this.calculateFileHash(agentYamlPath);
|
||||
const customizeHash = customizeYamlPath ? await this.calculateFileHash(customizeYamlPath) : null;
|
||||
|
||||
// Extract module from path (e.g., /path/to/modules/bmm/agents/pm.yaml -> bmm)
|
||||
// or /path/to/bmad/bmm/agents/pm.yaml -> bmm
|
||||
let module = 'core'; // default to core
|
||||
const pathParts = agentYamlPath.split(path.sep);
|
||||
|
||||
// Look for module indicators in the path
|
||||
const modulesIndex = pathParts.indexOf('modules');
|
||||
const bmadIndex = pathParts.indexOf('bmad');
|
||||
|
||||
if (modulesIndex !== -1 && pathParts[modulesIndex + 1]) {
|
||||
// Path contains /modules/{module}/
|
||||
module = pathParts[modulesIndex + 1];
|
||||
} else if (bmadIndex !== -1 && pathParts[bmadIndex + 1]) {
|
||||
// Path contains /bmad/{module}/
|
||||
const potentialModule = pathParts[bmadIndex + 1];
|
||||
// Check if it's a known module, not 'agents' or '_cfg'
|
||||
if (['bmm', 'bmb', 'cis', 'core'].includes(potentialModule)) {
|
||||
module = potentialModule;
|
||||
}
|
||||
}
|
||||
|
||||
// Build metadata
|
||||
const buildMetadata = {
|
||||
sourceFile: path.basename(agentYamlPath),
|
||||
@@ -356,6 +382,7 @@ class YamlXmlBuilder {
|
||||
includeMetadata: options.includeMetadata !== false,
|
||||
skipActivation: options.skipActivation === true,
|
||||
forWebBundle: options.forWebBundle === true,
|
||||
module: module, // Add module to buildMetadata
|
||||
};
|
||||
|
||||
// Convert to XML and return
|
||||
|
||||
Reference in New Issue
Block a user