Compare commits
4 Commits
2ef410c726
...
a69810afe5
| Author | SHA1 | Date |
|---|---|---|
|
|
a69810afe5 | |
|
|
1d505b17b4 | |
|
|
a6a960f88c | |
|
|
8ed36d9f0d |
|
|
@ -17,9 +17,7 @@ const { ManifestGenerator } = require('./manifest-generator');
|
|||
const { IdeConfigManager } = require('./ide-config-manager');
|
||||
const { CustomHandler } = require('../custom/handler');
|
||||
const prompts = require('../../../lib/prompts');
|
||||
|
||||
// BMAD installation folder name - this is constant and should never change
|
||||
const BMAD_FOLDER_NAME = '_bmad';
|
||||
const { BMAD_FOLDER_NAME } = require('../ide/shared/path-utils');
|
||||
|
||||
class Installer {
|
||||
constructor() {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ const fs = require('fs-extra');
|
|||
const chalk = require('chalk');
|
||||
const { XmlHandler } = require('../../../lib/xml-handler');
|
||||
const { getSourcePath } = require('../../../lib/project-root');
|
||||
const { BMAD_FOLDER_NAME } = require('./shared/path-utils');
|
||||
|
||||
/**
|
||||
* Base class for IDE-specific setup
|
||||
|
|
@ -18,7 +19,7 @@ class BaseIdeSetup {
|
|||
this.configFile = null; // Override in subclasses when detection is file-based
|
||||
this.detectionPaths = []; // Additional paths that indicate the IDE is configured
|
||||
this.xmlHandler = new XmlHandler();
|
||||
this.bmadFolderName = '_bmad'; // Default, can be overridden
|
||||
this.bmadFolderName = BMAD_FOLDER_NAME; // Default, can be overridden
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +58,7 @@ class BaseIdeSetup {
|
|||
if (this.configDir) {
|
||||
const configPath = path.join(projectDir, this.configDir);
|
||||
if (await fs.pathExists(configPath)) {
|
||||
const bmadRulesPath = path.join(configPath, 'bmad');
|
||||
const bmadRulesPath = path.join(configPath, BMAD_FOLDER_NAME);
|
||||
if (await fs.pathExists(bmadRulesPath)) {
|
||||
await fs.remove(bmadRulesPath);
|
||||
console.log(chalk.dim(`Removed ${this.name} BMAD configuration`));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('node:path');
|
||||
const chalk = require('chalk');
|
||||
const { BMAD_FOLDER_NAME } = require('./shared/path-utils');
|
||||
|
||||
/**
|
||||
* IDE Manager - handles IDE-specific setup
|
||||
|
|
@ -14,7 +15,7 @@ class IdeManager {
|
|||
constructor() {
|
||||
this.handlers = new Map();
|
||||
this._initialized = false;
|
||||
this.bmadFolderName = '_bmad'; // Default, can be overridden
|
||||
this.bmadFolderName = BMAD_FOLDER_NAME; // Default, can be overridden
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,7 +74,9 @@ class IdeManager {
|
|||
if (HandlerClass) {
|
||||
const instance = new HandlerClass();
|
||||
if (instance.name && typeof instance.name === 'string') {
|
||||
instance.setBmadFolderName(this.bmadFolderName);
|
||||
if (typeof instance.setBmadFolderName === 'function') {
|
||||
instance.setBmadFolderName(this.bmadFolderName);
|
||||
}
|
||||
this.handlers.set(instance.name, instance);
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +104,9 @@ class IdeManager {
|
|||
if (!platformInfo.installer) continue;
|
||||
|
||||
const handler = new ConfigDrivenIdeSetup(platformCode, platformInfo);
|
||||
handler.setBmadFolderName(this.bmadFolderName);
|
||||
if (typeof handler.setBmadFolderName === 'function') {
|
||||
handler.setBmadFolderName(this.bmadFolderName);
|
||||
}
|
||||
this.handlers.set(platformCode, handler);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const path = require('node:path');
|
||||
const fs = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
const { toColonPath, toDashPath, customAgentColonName, customAgentDashName } = require('./path-utils');
|
||||
const { toColonPath, toDashPath, customAgentColonName, customAgentDashName, BMAD_FOLDER_NAME } = require('./path-utils');
|
||||
|
||||
/**
|
||||
* Generates launcher command files for each agent
|
||||
* Similar to WorkflowCommandGenerator but for agents
|
||||
*/
|
||||
class AgentCommandGenerator {
|
||||
constructor(bmadFolderName = '_bmad') {
|
||||
constructor(bmadFolderName = BMAD_FOLDER_NAME) {
|
||||
this.templatePath = path.join(__dirname, '../templates/agent-command-template.md');
|
||||
this.bmadFolderName = bmadFolderName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
const TYPE_SEGMENTS = ['workflows', 'tasks', 'tools'];
|
||||
const AGENT_SEGMENT = 'agents';
|
||||
|
||||
// BMAD installation folder name - centralized constant for all installers
|
||||
const BMAD_FOLDER_NAME = '_bmad';
|
||||
|
||||
/**
|
||||
* Convert hierarchical path to flat dash-separated name (NEW STANDARD)
|
||||
* Converts: 'bmm', 'agents', 'pm' → 'bmad-agent-bmm-pm.md'
|
||||
|
|
@ -292,4 +295,5 @@ module.exports = {
|
|||
|
||||
TYPE_SEGMENTS,
|
||||
AGENT_SEGMENT,
|
||||
BMAD_FOLDER_NAME,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,20 +2,20 @@ const path = require('node:path');
|
|||
const fs = require('fs-extra');
|
||||
const csv = require('csv-parse/sync');
|
||||
const chalk = require('chalk');
|
||||
const { toColonName, toColonPath, toDashPath } = require('./path-utils');
|
||||
const { toColonName, toColonPath, toDashPath, BMAD_FOLDER_NAME } = require('./path-utils');
|
||||
|
||||
/**
|
||||
* Generates command files for standalone tasks and tools
|
||||
*/
|
||||
class TaskToolCommandGenerator {
|
||||
/**
|
||||
* @param {string} bmadFolderName - Name of the BMAD folder for template rendering (default: 'bmad')
|
||||
* @param {string} bmadFolderName - Name of the BMAD folder for template rendering (default: '_bmad')
|
||||
* Note: This parameter is accepted for API consistency with AgentCommandGenerator and
|
||||
* WorkflowCommandGenerator, but is not used for path stripping. The manifest always stores
|
||||
* filesystem paths with '_bmad/' prefix (the actual folder name), while bmadFolderName is
|
||||
* used for template placeholder rendering ({{bmadFolderName}}).
|
||||
*/
|
||||
constructor(bmadFolderName = '_bmad') {
|
||||
constructor(bmadFolderName = BMAD_FOLDER_NAME) {
|
||||
this.bmadFolderName = bmadFolderName;
|
||||
}
|
||||
|
||||
|
|
@ -33,13 +33,18 @@ class TaskToolCommandGenerator {
|
|||
const standaloneTools = tools ? tools.filter((t) => t.standalone === 'true' || t.standalone === true) : [];
|
||||
|
||||
const artifacts = [];
|
||||
const bmadPrefix = `${BMAD_FOLDER_NAME}/`;
|
||||
|
||||
// Collect task artifacts
|
||||
for (const task of standaloneTasks) {
|
||||
let taskPath = (task.path || '').replaceAll('\\', '/');
|
||||
// Convert absolute paths to relative paths
|
||||
if (path.isAbsolute(taskPath)) {
|
||||
taskPath = path.relative(bmadDir, taskPath).replaceAll('\\', '/');
|
||||
}
|
||||
// Remove _bmad/ prefix if present to get relative path within bmad folder
|
||||
if (taskPath.startsWith('_bmad/')) {
|
||||
taskPath = taskPath.slice(6); // Remove '_bmad/'
|
||||
if (taskPath.startsWith(bmadPrefix)) {
|
||||
taskPath = taskPath.slice(bmadPrefix.length);
|
||||
}
|
||||
|
||||
const taskExt = path.extname(taskPath) || '.md';
|
||||
|
|
@ -58,9 +63,13 @@ class TaskToolCommandGenerator {
|
|||
// Collect tool artifacts
|
||||
for (const tool of standaloneTools) {
|
||||
let toolPath = (tool.path || '').replaceAll('\\', '/');
|
||||
// Convert absolute paths to relative paths
|
||||
if (path.isAbsolute(toolPath)) {
|
||||
toolPath = path.relative(bmadDir, toolPath).replaceAll('\\', '/');
|
||||
}
|
||||
// Remove _bmad/ prefix if present to get relative path within bmad folder
|
||||
if (toolPath.startsWith('_bmad/')) {
|
||||
toolPath = toolPath.slice(6); // Remove '_bmad/'
|
||||
if (toolPath.startsWith(bmadPrefix)) {
|
||||
toolPath = toolPath.slice(bmadPrefix.length);
|
||||
}
|
||||
|
||||
const toolExt = path.extname(toolPath) || '.md';
|
||||
|
|
@ -159,9 +168,9 @@ class TaskToolCommandGenerator {
|
|||
if (bmadMatch) {
|
||||
// Found /_bmad/ or /bmad/ - use relative path after it
|
||||
itemPath = `{project-root}/${this.bmadFolderName}/${bmadMatch[1]}`;
|
||||
} else if (itemPath.startsWith('_bmad/')) {
|
||||
} else if (itemPath.startsWith(`${BMAD_FOLDER_NAME}/`)) {
|
||||
// Relative path starting with _bmad/
|
||||
itemPath = `{project-root}/${this.bmadFolderName}/${itemPath.slice(6)}`;
|
||||
itemPath = `{project-root}/${this.bmadFolderName}/${itemPath.slice(BMAD_FOLDER_NAME.length + 1)}`;
|
||||
} else if (itemPath.startsWith('bmad/')) {
|
||||
// Relative path starting with bmad/
|
||||
itemPath = `{project-root}/${this.bmadFolderName}/${itemPath.slice(5)}`;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ const path = require('node:path');
|
|||
const fs = require('fs-extra');
|
||||
const csv = require('csv-parse/sync');
|
||||
const chalk = require('chalk');
|
||||
const { toColonPath, toDashPath, customAgentColonName, customAgentDashName } = require('./path-utils');
|
||||
const { toColonPath, toDashPath, customAgentColonName, customAgentDashName, BMAD_FOLDER_NAME } = require('./path-utils');
|
||||
|
||||
/**
|
||||
* Generates command files for each workflow in the manifest
|
||||
*/
|
||||
class WorkflowCommandGenerator {
|
||||
constructor(bmadFolderName = '_bmad') {
|
||||
constructor(bmadFolderName = BMAD_FOLDER_NAME) {
|
||||
this.templatePath = path.join(__dirname, '../templates/workflow-command-template.md');
|
||||
this.bmadFolderName = bmadFolderName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const { XmlHandler } = require('../../../lib/xml-handler');
|
|||
const { getProjectRoot, getSourcePath, getModulePath } = require('../../../lib/project-root');
|
||||
const { filterCustomizationData } = require('../../../lib/agent/compiler');
|
||||
const { ExternalModuleManager } = require('./external-manager');
|
||||
const { BMAD_FOLDER_NAME } = require('../ide/shared/path-utils');
|
||||
|
||||
/**
|
||||
* Manages the installation, updating, and removal of BMAD modules.
|
||||
|
|
@ -27,7 +28,7 @@ const { ExternalModuleManager } = require('./external-manager');
|
|||
class ModuleManager {
|
||||
constructor(options = {}) {
|
||||
this.xmlHandler = new XmlHandler();
|
||||
this.bmadFolderName = '_bmad'; // Default, can be overridden
|
||||
this.bmadFolderName = BMAD_FOLDER_NAME; // Default, can be overridden
|
||||
this.customModulePaths = new Map(); // Initialize custom module paths
|
||||
this.externalModuleManager = new ExternalModuleManager(); // For external official modules
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue