refactor: update file paths to remove leading dot from bmad-core references

This commit is contained in:
manjaroblack
2025-08-18 09:46:16 -05:00
parent aa9777a06e
commit ed7291f2ce
41 changed files with 901 additions and 909 deletions

View File

@@ -34,8 +34,8 @@ class Installer {
? config.directory
: path.resolve(originalCwd, config.directory);
if (path.basename(installDir) === '.bmad-core') {
// If user points directly to .bmad-core, treat its parent as the project root
if (path.basename(installDir) === 'bmad-core') {
// If user points directly to bmad-core, treat its parent as the project root
installDir = path.dirname(installDir);
}
@@ -173,8 +173,8 @@ class Installer {
return state; // clean install
}
// Check for V4 installation (has .bmad-core with manifest)
const bmadCorePath = path.join(installDir, '.bmad-core');
// Check for V4 installation (has bmad-core with manifest)
const bmadCorePath = path.join(installDir, 'bmad-core');
const manifestPath = path.join(bmadCorePath, 'install-manifest.yaml');
if (await fileManager.pathExists(manifestPath)) {
@@ -193,7 +193,7 @@ class Installer {
return state;
}
// Check for .bmad-core without manifest (broken V4 or manual copy)
// Check for bmad-core without manifest (broken V4 or manual copy)
if (await fileManager.pathExists(bmadCorePath)) {
state.type = 'unknown_existing';
state.hasBmadCore = true;
@@ -227,23 +227,19 @@ class Installer {
switch (config.installType) {
case 'full': {
// Full installation - copy entire .bmad-core folder as a subdirectory
spinner.text = 'Copying complete .bmad-core folder...';
// Full installation - copy entire bmad-core folder as a subdirectory
spinner.text = 'Copying complete bmad-core folder...';
const sourceDir = resourceLocator.getBmadCorePath();
const bmadCoreDestDir = path.join(installDir, '.bmad-core');
await fileManager.copyDirectoryWithRootReplacement(
sourceDir,
bmadCoreDestDir,
'.bmad-core',
);
const bmadCoreDestDir = path.join(installDir, 'bmad-core');
await fileManager.copyDirectoryWithRootReplacement(sourceDir, bmadCoreDestDir, 'bmad-core');
// Copy common/ items to .bmad-core
// Copy common/ items to bmad-core
spinner.text = 'Copying common utilities...';
await this.copyCommonItems(installDir, '.bmad-core', spinner);
await this.copyCommonItems(installDir, 'bmad-core', spinner);
// Copy documentation files from docs/ to .bmad-core
// Copy documentation files from docs/ to bmad-core
spinner.text = 'Copying documentation files...';
await this.copyDocsItems(installDir, '.bmad-core', spinner);
await this.copyDocsItems(installDir, 'bmad-core', spinner);
// Get list of all files for manifest
const foundFiles = await resourceLocator.findFiles('**/*', {
@@ -251,7 +247,7 @@ class Installer {
nodir: true,
ignore: ['**/.git/**', '**/node_modules/**'],
});
files = foundFiles.map((file) => path.join('.bmad-core', file));
files = foundFiles.map((file) => path.join('bmad-core', file));
break;
}
@@ -263,16 +259,12 @@ class Installer {
const agentPath = configLoader.getAgentPath(config.agent);
const destinationAgentPath = path.join(
installDir,
'.bmad-core',
'bmad-core',
'agents',
`${config.agent}.md`,
);
await fileManager.copyFileWithRootReplacement(
agentPath,
destinationAgentPath,
'.bmad-core',
);
files.push(`.bmad-core/agents/${config.agent}.md`);
await fileManager.copyFileWithRootReplacement(agentPath, destinationAgentPath, 'bmad-core');
files.push(`bmad-core/agents/${config.agent}.md`);
// Copy dependencies
const { all: dependencies } = await resourceLocator.getAgentDependencies(config.agent);
@@ -284,15 +276,15 @@ class Installer {
if (dep.includes('*')) {
// Handle glob patterns with {root} replacement
const copiedFiles = await fileManager.copyGlobPattern(
dep.replace('.bmad-core/', ''),
dep.replace('bmad-core/', ''),
sourceBase,
path.join(installDir, '.bmad-core'),
'.bmad-core',
path.join(installDir, 'bmad-core'),
'bmad-core',
);
files.push(...copiedFiles.map((f) => `.bmad-core/${f}`));
files.push(...copiedFiles.map((f) => `bmad-core/${f}`));
} else {
// Handle single files with {root} replacement if needed
const sourcePath = path.join(sourceBase, dep.replace('.bmad-core/', ''));
const sourcePath = path.join(sourceBase, dep.replace('bmad-core/', ''));
const destinationPath = path.join(installDir, dep);
const needsRootReplacement =
@@ -300,7 +292,7 @@ class Installer {
let success = false;
success = await (needsRootReplacement
? fileManager.copyFileWithRootReplacement(sourcePath, destinationPath, '.bmad-core')
? fileManager.copyFileWithRootReplacement(sourcePath, destinationPath, 'bmad-core')
: fileManager.copyFile(sourcePath, destinationPath));
if (success) {
@@ -309,14 +301,14 @@ class Installer {
}
}
// Copy common/ items to .bmad-core
// Copy common/ items to bmad-core
spinner.text = 'Copying common utilities...';
const commonFiles = await this.copyCommonItems(installDir, '.bmad-core', spinner);
const commonFiles = await this.copyCommonItems(installDir, 'bmad-core', spinner);
files.push(...commonFiles);
// Copy documentation files from docs/ to .bmad-core
// Copy documentation files from docs/ to bmad-core
spinner.text = 'Copying documentation files...';
const documentFiles = await this.copyDocsItems(installDir, '.bmad-core', spinner);
const documentFiles = await this.copyDocsItems(installDir, 'bmad-core', spinner);
files.push(...documentFiles);
break;
@@ -336,15 +328,15 @@ class Installer {
if (dep.includes('*')) {
// Handle glob patterns with {root} replacement
const copiedFiles = await fileManager.copyGlobPattern(
dep.replace('.bmad-core/', ''),
dep.replace('bmad-core/', ''),
sourceBase,
path.join(installDir, '.bmad-core'),
'.bmad-core',
path.join(installDir, 'bmad-core'),
'bmad-core',
);
files.push(...copiedFiles.map((f) => `.bmad-core/${f}`));
files.push(...copiedFiles.map((f) => `bmad-core/${f}`));
} else {
// Handle single files with {root} replacement if needed
const sourcePath = path.join(sourceBase, dep.replace('.bmad-core/', ''));
const sourcePath = path.join(sourceBase, dep.replace('bmad-core/', ''));
const destinationPath = path.join(installDir, dep);
const needsRootReplacement =
@@ -352,7 +344,7 @@ class Installer {
let success = false;
success = await (needsRootReplacement
? fileManager.copyFileWithRootReplacement(sourcePath, destinationPath, '.bmad-core')
? fileManager.copyFileWithRootReplacement(sourcePath, destinationPath, 'bmad-core')
: fileManager.copyFile(sourcePath, destinationPath));
if (success) {
@@ -361,20 +353,20 @@ class Installer {
}
}
// Copy common/ items to .bmad-core
// Copy common/ items to bmad-core
spinner.text = 'Copying common utilities...';
const commonFiles = await this.copyCommonItems(installDir, '.bmad-core', spinner);
const commonFiles = await this.copyCommonItems(installDir, 'bmad-core', spinner);
files.push(...commonFiles);
// Copy documentation files from docs/ to .bmad-core
// Copy documentation files from docs/ to bmad-core
spinner.text = 'Copying documentation files...';
const documentFiles = await this.copyDocsItems(installDir, '.bmad-core', spinner);
const documentFiles = await this.copyDocsItems(installDir, 'bmad-core', spinner);
files.push(...documentFiles);
break;
}
case 'expansion-only': {
// Expansion-only installation - DO NOT create .bmad-core
// Expansion-only installation - DO NOT create bmad-core
// Only install expansion packs
spinner.text = 'Installing expansion packs only...';
@@ -633,7 +625,7 @@ class Installer {
console.log(` Directory: ${installDir}`);
if (state.hasBmadCore) {
console.log(' Found: .bmad-core directory (but no manifest)');
console.log(' Found: bmad-core directory (but no manifest)');
}
if (state.hasOtherFiles) {
console.log(' Found: Other files in directory');
@@ -771,7 +763,7 @@ class Installer {
// Skip the manifest file itself
if (file.endsWith('install-manifest.yaml')) continue;
const relativePath = file.replace('.bmad-core/', '');
const relativePath = file.replace('bmad-core/', '');
const destinationPath = path.join(installDir, file);
// Check if this is a common/ file that needs special processing
@@ -782,7 +774,7 @@ class Installer {
// This is a common/ file - needs template processing
const fs = require('node:fs').promises;
const content = await fs.readFile(commonSourcePath, 'utf8');
const updatedContent = content.replaceAll('{root}', '.bmad-core');
const updatedContent = content.replaceAll('{root}', 'bmad-core');
await fileManager.ensureDirectory(path.dirname(destinationPath));
await fs.writeFile(destinationPath, updatedContent, 'utf8');
spinner.text = `Restored: ${file}`;
@@ -845,8 +837,8 @@ class Installer {
async performReinstall(config, installDir, spinner) {
spinner.start('Preparing to reinstall BMad Method...');
// Remove existing .bmad-core
const bmadCorePath = path.join(installDir, '.bmad-core');
// Remove existing bmad-core
const bmadCorePath = path.join(installDir, 'bmad-core');
if (await fileManager.pathExists(bmadCorePath)) {
spinner.text = 'Removing existing installation...';
await fileManager.removeDirectory(bmadCorePath);
@@ -882,7 +874,7 @@ class Installer {
// Information about installation components
console.log(chalk.bold('\n🎯 Installation Summary:'));
if (config.installType !== 'expansion-only') {
console.log(chalk.green('✓ .bmad-core framework installed with all agents and workflows'));
console.log(chalk.green('✓ bmad-core framework installed with all agents and workflows'));
}
if (config.expansionPacks && config.expansionPacks.length > 0) {
@@ -941,7 +933,7 @@ class Installer {
// Important notice to read the user guide
console.log(
chalk.red.bold(
'\n📖 IMPORTANT: Please read the user guide at docs/user-guide.md (also installed at .bmad-core/user-guide.md)',
'\n📖 IMPORTANT: Please read the user guide at docs/user-guide.md (also installed at bmad-core/user-guide.md)',
),
);
console.log(
@@ -1787,7 +1779,7 @@ class Installer {
// Find all dot folders that might be expansion packs
const dotFolders = glob.sync('.*', {
cwd: installDir,
ignore: ['.git', '.git/**', '.bmad-core', '.bmad-core/**'],
ignore: ['.git', '.git/**', 'bmad-core', 'bmad-core/**'],
});
for (const folder of dotFolders) {
@@ -1944,22 +1936,22 @@ class Installer {
}
async findInstallation() {
// Look for .bmad-core in current directory or parent directories
// Look for bmad-core in current directory or parent directories
let currentDir = process.cwd();
while (currentDir !== path.dirname(currentDir)) {
const bmadDir = path.join(currentDir, '.bmad-core');
const bmadDir = path.join(currentDir, 'bmad-core');
const manifestPath = path.join(bmadDir, 'install-manifest.yaml');
if (await fileManager.pathExists(manifestPath)) {
return currentDir; // Return parent directory, not .bmad-core itself
return currentDir; // Return parent directory, not bmad-core itself
}
currentDir = path.dirname(currentDir);
}
// Also check if we're inside a .bmad-core directory
if (path.basename(process.cwd()) === '.bmad-core') {
// Also check if we're inside a bmad-core directory
if (path.basename(process.cwd()) === 'bmad-core') {
const manifestPath = path.join(process.cwd(), 'install-manifest.yaml');
if (await fileManager.pathExists(manifestPath)) {
return path.dirname(process.cwd()); // Return parent directory