fix: update src/core and src/bmm path references to match renamed directories (#2053)

The v6.2.0 release renamed src/core to src/core-skills and src/bmm to
src/bmm-skills, but the installer CLI code still referenced the old
directory names, causing ENOENT crashes during installation.

Updated all path references across 7 files in tools/cli/ including
path.join() calls, string comparisons, regex patterns, and comments.

Fixes #2052

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Brian <bmadcode@gmail.com>
This commit is contained in:
Frank 2026-03-18 20:29:16 -04:00 committed by GitHub
parent 1b8424cf6d
commit 3c8d865457
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 41 additions and 38 deletions

View File

@ -82,11 +82,11 @@ class DependencyResolver {
// Check if this is a source directory (has 'src' subdirectory)
const srcDir = path.join(bmadDir, 'src');
if (await fs.pathExists(srcDir)) {
// Source directory structure: src/core or src/bmm
// Source directory structure: src/core-skills or src/bmm-skills
if (module === 'core') {
moduleDir = path.join(srcDir, 'core');
moduleDir = path.join(srcDir, 'core-skills');
} else if (module === 'bmm') {
moduleDir = path.join(srcDir, 'bmm');
moduleDir = path.join(srcDir, 'bmm-skills');
}
}
@ -401,8 +401,8 @@ class DependencyResolver {
const bmadPath = dep.dependency.replace(/^bmad\//, '');
// Try to resolve as if it's in src structure
// bmad/core/tasks/foo.md -> src/core/tasks/foo.md
// bmad/bmm/tasks/bar.md -> src/bmm/tasks/bar.md (bmm is directly under src/)
// bmad/core/tasks/foo.md -> src/core-skills/tasks/foo.md
// bmad/bmm/tasks/bar.md -> src/bmm-skills/tasks/bar.md (bmm is directly under src/)
// bmad/cis/agents/bar.md -> src/modules/cis/agents/bar.md
if (bmadPath.startsWith('core/')) {
@ -584,11 +584,11 @@ class DependencyResolver {
const relative = path.relative(bmadDir, filePath);
const parts = relative.split(path.sep);
// Handle source directory structure (src/core, src/bmm, or src/modules/xxx)
// Handle source directory structure (src/core-skills, src/bmm-skills, or src/modules/xxx)
if (parts[0] === 'src') {
if (parts[1] === 'core') {
if (parts[1] === 'core-skills') {
return 'core';
} else if (parts[1] === 'bmm') {
} else if (parts[1] === 'bmm-skills') {
return 'bmm';
} else if (parts[1] === 'modules' && parts.length > 2) {
return parts[2];
@ -631,11 +631,11 @@ class DependencyResolver {
let moduleBase;
// Check if file is in source directory structure
if (file.includes('/src/core/') || file.includes('/src/bmm/')) {
if (file.includes('/src/core-skills/') || file.includes('/src/bmm-skills/')) {
if (module === 'core') {
moduleBase = path.join(bmadDir, 'src', 'core');
moduleBase = path.join(bmadDir, 'src', 'core-skills');
} else if (module === 'bmm') {
moduleBase = path.join(bmadDir, 'src', 'bmm');
moduleBase = path.join(bmadDir, 'src', 'bmm-skills');
}
} else {
moduleBase = module === 'core' ? path.join(bmadDir, 'core') : path.join(bmadDir, 'modules', module);

View File

@ -1789,8 +1789,8 @@ class Installer {
.filter((entry) => entry.isDirectory() && entry.name !== '_config' && entry.name !== 'docs' && entry.name !== '_memory')
.map((entry) => entry.name);
// Add core module to scan (it's installed at root level as _config, but we check src/core)
const coreModulePath = getSourcePath('core');
// Add core module to scan (it's installed at root level as _config, but we check src/core-skills)
const coreModulePath = getSourcePath('core-skills');
const modulePaths = new Map();
// Map all module source paths
@ -2709,7 +2709,7 @@ class Installer {
// Get source path
let sourcePath;
if (moduleId === 'core') {
sourcePath = getSourcePath('core');
sourcePath = getSourcePath('core-skills');
} else {
// First check if it's in the custom cache
if (customModuleSources.has(moduleId)) {

View File

@ -764,10 +764,10 @@ class Manifest {
const configs = {};
for (const moduleName of modules) {
// Handle core module differently - it's in src/core not src/modules/core
// Handle core module differently - it's in src/core-skills not src/modules/core
const configPath =
moduleName === 'core'
? path.join(process.cwd(), 'src', 'core', 'config.yaml')
? path.join(process.cwd(), 'src', 'core-skills', 'config.yaml')
: path.join(process.cwd(), 'src', 'modules', moduleName, 'config.yaml');
try {

View File

@ -146,13 +146,13 @@ When running any workflow:
transformWorkflowPath(workflowPath) {
let transformed = workflowPath;
if (workflowPath.includes('/src/bmm/')) {
const match = workflowPath.match(/\/src\/bmm\/(.+)/);
if (workflowPath.includes('/src/bmm-skills/')) {
const match = workflowPath.match(/\/src\/bmm-skills\/(.+)/);
if (match) {
transformed = `{project-root}/${this.bmadFolderName}/bmm/${match[1]}`;
}
} else if (workflowPath.includes('/src/core/')) {
const match = workflowPath.match(/\/src\/core\/(.+)/);
} else if (workflowPath.includes('/src/core-skills/')) {
const match = workflowPath.match(/\/src\/core-skills\/(.+)/);
if (match) {
transformed = `{project-root}/${this.bmadFolderName}/core/${match[1]}`;
}

View File

@ -187,7 +187,7 @@ class ModuleManager {
/**
* List all available modules (excluding core which is always installed)
* bmm is the only built-in module, directly under src/bmm
* bmm is the only built-in module, directly under src/bmm-skills
* All other modules come from external-official-modules.yaml
* @returns {Object} Object with modules array and customModules array
*/
@ -195,10 +195,10 @@ class ModuleManager {
const modules = [];
const customModules = [];
// Add built-in bmm module (directly under src/bmm)
const bmmPath = getSourcePath('bmm');
// Add built-in bmm module (directly under src/bmm-skills)
const bmmPath = getSourcePath('bmm-skills');
if (await fs.pathExists(bmmPath)) {
const bmmInfo = await this.getModuleInfo(bmmPath, 'bmm', 'src/bmm');
const bmmInfo = await this.getModuleInfo(bmmPath, 'bmm', 'src/bmm-skills');
if (bmmInfo) {
modules.push(bmmInfo);
}
@ -251,7 +251,8 @@ class ModuleManager {
}
// Mark as custom if it's using custom.yaml OR if it's outside src/bmm or src/core
const isCustomSource = sourceDescription !== 'src/bmm' && sourceDescription !== 'src/core' && sourceDescription !== 'src/modules';
const isCustomSource =
sourceDescription !== 'src/bmm-skills' && sourceDescription !== 'src/core-skills' && sourceDescription !== 'src/modules';
const moduleInfo = {
id: defaultName,
path: modulePath,
@ -300,9 +301,9 @@ class ModuleManager {
return this.customModulePaths.get(moduleCode);
}
// Check for built-in bmm module (directly under src/bmm)
// Check for built-in bmm module (directly under src/bmm-skills)
if (moduleCode === 'bmm') {
const bmmPath = getSourcePath('bmm');
const bmmPath = getSourcePath('bmm-skills');
if (await fs.pathExists(bmmPath)) {
return bmmPath;
}
@ -1141,10 +1142,10 @@ class ModuleManager {
const projectRoot = path.dirname(bmadDir);
const emptyResult = { createdDirs: [], movedDirs: [], createdWdsFolders: [] };
// Special handling for core module - it's in src/core not src/modules
// Special handling for core module - it's in src/core-skills not src/modules
let sourcePath;
if (moduleName === 'core') {
sourcePath = getSourcePath('core');
sourcePath = getSourcePath('core-skills');
} else {
sourcePath = await this.findModuleSource(moduleName, { silent: true });
if (!sourcePath) {

View File

@ -16,7 +16,7 @@ function findProjectRoot(startPath = __dirname) {
try {
const pkg = fs.readJsonSync(packagePath);
// Check if this is the BMAD project
if (pkg.name === 'bmad-method' || fs.existsSync(path.join(currentPath, 'src', 'core'))) {
if (pkg.name === 'bmad-method' || fs.existsSync(path.join(currentPath, 'src', 'core-skills'))) {
return currentPath;
}
} catch {
@ -24,8 +24,8 @@ function findProjectRoot(startPath = __dirname) {
}
}
// Also check for src/core as a marker
if (fs.existsSync(path.join(currentPath, 'src', 'core', 'agents'))) {
// Also check for src/core-skills as a marker
if (fs.existsSync(path.join(currentPath, 'src', 'core-skills', 'agents'))) {
return currentPath;
}
@ -61,10 +61,10 @@ function getSourcePath(...segments) {
*/
function getModulePath(moduleName, ...segments) {
if (moduleName === 'core') {
return getSourcePath('core', ...segments);
return getSourcePath('core-skills', ...segments);
}
if (moduleName === 'bmm') {
return getSourcePath('bmm', ...segments);
return getSourcePath('bmm-skills', ...segments);
}
return getSourcePath('modules', moduleName, ...segments);
}

View File

@ -495,7 +495,7 @@ class YamlXmlBuilder {
// Extract module from path (e.g., /path/to/modules/bmm/agents/pm.yaml -> bmm)
// or /path/to/bmad/bmm/agents/pm.yaml -> bmm
// or /path/to/src/bmm/agents/pm.yaml -> bmm
// or /path/to/src/bmm-skills/agents/pm.yaml -> bmm
let module = 'core'; // default to core
const pathParts = agentYamlPath.split(path.sep);
@ -515,10 +515,12 @@ class YamlXmlBuilder {
module = potentialModule;
}
} else if (srcIndex !== -1 && pathParts[srcIndex + 1]) {
// Path contains /src/{module}/ (bmm and core are directly under src/)
// Path contains /src/{module}/ (bmm-skills and core-skills are directly under src/)
const potentialModule = pathParts[srcIndex + 1];
if (potentialModule === 'bmm' || potentialModule === 'core') {
module = potentialModule;
if (potentialModule === 'bmm-skills') {
module = 'bmm';
} else if (potentialModule === 'core-skills') {
module = 'core';
}
}