chore: fix installation directory handling to use .bmad-core as default path

- Remove redundant ./ prefix from default directory
- Update all default paths from ./.bmad-core to .bmad-core
- Add logic to handle direct .bmad-core path selection
- Treat parent as project root when .bmad-core specified
- Simplify directory state detection for existing files
- Remove unknown_existing state type from installer logic
This commit is contained in:
Kayvan Sylvan 2025-06-15 10:18:55 -07:00
parent 25c356b415
commit 47794f301d
2 changed files with 10 additions and 6 deletions

View File

@ -37,7 +37,7 @@ program
.description('Install BMAD Method agents and tools') .description('Install BMAD Method agents and tools')
.option('-f, --full', 'Install complete .bmad-core folder') .option('-f, --full', 'Install complete .bmad-core folder')
.option('-a, --agent <agent>', 'Install specific agent with dependencies') .option('-a, --agent <agent>', 'Install specific agent with dependencies')
.option('-d, --directory <path>', 'Installation directory (default: ./bmad-core)') .option('-d, --directory <path>', 'Installation directory (default: .bmad-core)')
.option('-i, --ide <ide>', 'Configure for specific IDE (cursor, claude-code, windsurf, roo)') .option('-i, --ide <ide>', 'Configure for specific IDE (cursor, claude-code, windsurf, roo)')
.action(async (options) => { .action(async (options) => {
try { try {
@ -50,7 +50,7 @@ program
const config = { const config = {
installType: options.full ? 'full' : 'single-agent', installType: options.full ? 'full' : 'single-agent',
agent: options.agent, agent: options.agent,
directory: options.directory || './.bmad-core', directory: options.directory || '.bmad-core',
ide: options.ide ide: options.ide
}; };
await installer.install(config); await installer.install(config);
@ -110,7 +110,7 @@ async function promptInstallation() {
type: 'input', type: 'input',
name: 'directory', name: 'directory',
message: 'Where would you like to install BMAD?', message: 'Where would you like to install BMAD?',
default: './.bmad-core' default: '.bmad-core'
} }
]); ]);
answers.directory = directory; answers.directory = directory;

View File

@ -12,7 +12,11 @@ class Installer {
try { try {
// Resolve installation directory // Resolve installation directory
const installDir = path.resolve(config.directory); let installDir = path.resolve(config.directory);
if (path.basename(installDir) === '.bmad-core') {
// If user points directly to .bmad-core, treat its parent as the project root
installDir = path.dirname(installDir);
}
// Detect current state // Detect current state
const state = await this.detectInstallationState(installDir); const state = await this.detectInstallationState(installDir);
@ -103,9 +107,9 @@ class Installer {
}); });
if (files.length > 0) { if (files.length > 0) {
state.type = "unknown_existing"; // Directory has other files, but no BMAD installation.
// Treat as clean install but record that it isn't empty.
state.hasOtherFiles = true; state.hasOtherFiles = true;
return state;
} }
return state; // clean install return state; // clean install