From 47794f301d9c4d9f78feeee434201ff4da6d777e Mon Sep 17 00:00:00 2001 From: Kayvan Sylvan Date: Sun, 15 Jun 2025 10:18:55 -0700 Subject: [PATCH] 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 --- tools/installer/bin/bmad.js | 6 +++--- tools/installer/lib/installer.js | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/installer/bin/bmad.js b/tools/installer/bin/bmad.js index 3381d4ed..ec2fb900 100755 --- a/tools/installer/bin/bmad.js +++ b/tools/installer/bin/bmad.js @@ -37,7 +37,7 @@ program .description('Install BMAD Method agents and tools') .option('-f, --full', 'Install complete .bmad-core folder') .option('-a, --agent ', 'Install specific agent with dependencies') - .option('-d, --directory ', 'Installation directory (default: ./bmad-core)') + .option('-d, --directory ', 'Installation directory (default: .bmad-core)') .option('-i, --ide ', 'Configure for specific IDE (cursor, claude-code, windsurf, roo)') .action(async (options) => { try { @@ -50,7 +50,7 @@ program const config = { installType: options.full ? 'full' : 'single-agent', agent: options.agent, - directory: options.directory || './.bmad-core', + directory: options.directory || '.bmad-core', ide: options.ide }; await installer.install(config); @@ -110,7 +110,7 @@ async function promptInstallation() { type: 'input', name: 'directory', message: 'Where would you like to install BMAD?', - default: './.bmad-core' + default: '.bmad-core' } ]); answers.directory = directory; diff --git a/tools/installer/lib/installer.js b/tools/installer/lib/installer.js index 7c4cd44a..bd0b2f69 100644 --- a/tools/installer/lib/installer.js +++ b/tools/installer/lib/installer.js @@ -12,7 +12,11 @@ class Installer { try { // 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 const state = await this.detectInstallationState(installDir); @@ -103,9 +107,9 @@ class Installer { }); 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; - return state; } return state; // clean install