Skip to content

Commit 4c65f3a

Browse files
Brian MadisonBrian Madison
authored andcommitted
quick install fixed
1 parent 401e8e4 commit 4c65f3a

File tree

4 files changed

+105
-47
lines changed

4 files changed

+105
-47
lines changed

src/core/module.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ document_output_language:
2020
result: "{value}"
2121

2222
output_folder:
23-
prompt: "Where should AI generated artifacts be saved across all modules?"
24-
default: "bmad-output"
23+
prompt: "Where should default output files be saved unless specified in other modules?"
24+
default: "_bmad-output"
2525
result: "{project-root}/{value}"
2626

2727
bmad_memory:

tools/cli/installers/lib/core/config-collector.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ class ConfigCollector {
105105

106106
for (const entry of entries) {
107107
if (entry.isDirectory()) {
108+
// Skip the _config directory - it's for system use
109+
if (entry.name === '_config' || entry.name === '_memory') {
110+
continue;
111+
}
112+
108113
const moduleConfigPath = path.join(bmadDir, entry.name, 'config.yaml');
114+
109115
if (await fs.pathExists(moduleConfigPath)) {
110116
try {
111117
const content = await fs.readFile(moduleConfigPath, 'utf8');

tools/cli/installers/lib/core/installer.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,11 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
491491

492492
let existingBmadDir = null;
493493
let existingBmadFolderName = null;
494-
let hasLegacyCfg = false;
495494

496495
if (await fs.pathExists(projectDir)) {
497496
const result = await this.findBmadDir(projectDir);
498497
existingBmadDir = result.bmadDir;
499498
existingBmadFolderName = path.basename(existingBmadDir);
500-
hasLegacyCfg = result.hasLegacyCfg;
501499
}
502500

503501
// Create a project directory if it doesn't exist (user already confirmed)
@@ -522,44 +520,6 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
522520

523521
const bmadDir = path.join(projectDir, bmadFolderName);
524522

525-
// Check for legacy _cfg folder and prompt for rename
526-
if (hasLegacyCfg && !config._quickUpdate) {
527-
spinner.stop();
528-
529-
console.log(chalk.yellow('\n⚠️ Legacy configuration folder detected'));
530-
console.log(chalk.dim(` Found: ${path.join(bmadDir, '_cfg')}`));
531-
console.log(chalk.dim(' The configuration folder has been renamed from "_cfg" to "_config"'));
532-
533-
const inquirer = require('inquirer');
534-
const { shouldRename } = await inquirer.prompt([
535-
{
536-
type: 'confirm',
537-
name: 'shouldRename',
538-
message: 'Would you like the installer to rename "_cfg" to "_config" for you?',
539-
default: true,
540-
},
541-
]);
542-
543-
if (!shouldRename) {
544-
console.log(chalk.red('\n❌ Installation cancelled'));
545-
console.log(chalk.dim('You must manually rename the "_cfg" folder to "_config" before proceeding.'));
546-
return { success: false, cancelled: true };
547-
}
548-
549-
// Perform the rename
550-
spinner.start('Renaming configuration folder...');
551-
try {
552-
const oldCfgPath = path.join(bmadDir, '_cfg');
553-
const newCfgPath = path.join(bmadDir, '_config');
554-
await fs.move(oldCfgPath, newCfgPath);
555-
spinner.succeed('Configuration folder renamed successfully');
556-
} catch (error) {
557-
spinner.fail('Failed to rename configuration folder');
558-
console.error(chalk.red(`Error: ${error.message}`));
559-
return { success: false, error: error.message };
560-
}
561-
}
562-
563523
// Check existing installation
564524
spinner.text = 'Checking for existing installation...';
565525
const existingInstall = await this.detector.detect(bmadDir);

tools/cli/lib/ui.js

Lines changed: 97 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,101 @@ class UI {
3333
await installer.handleLegacyV4Migration(confirmedDirectory, legacyV4);
3434
}
3535

36-
// Check if there's an existing BMAD installation
37-
const fs = require('fs-extra');
38-
const path = require('node:path');
39-
const bmadDir = await installer.findBmadDir(confirmedDirectory);
36+
// Check for legacy folders and prompt for rename before showing any menus
37+
let hasLegacyCfg = false;
38+
let hasLegacyBmadFolder = false;
39+
let bmadDir = null;
40+
let legacyBmadPath = null;
41+
42+
// First check for legacy .bmad folder (instead of _bmad)
43+
const entries = await fs.readdir(confirmedDirectory, { withFileTypes: true });
44+
for (const entry of entries) {
45+
if (entry.isDirectory() && entry.name === '.bmad') {
46+
hasLegacyBmadFolder = true;
47+
legacyBmadPath = path.join(confirmedDirectory, '.bmad');
48+
bmadDir = legacyBmadPath;
49+
50+
// Check if it has _cfg folder
51+
const cfgPath = path.join(legacyBmadPath, '_cfg');
52+
if (await fs.pathExists(cfgPath)) {
53+
hasLegacyCfg = true;
54+
}
55+
break;
56+
}
57+
}
58+
59+
// If no .bmad found, check for current installations
60+
if (!hasLegacyBmadFolder) {
61+
const bmadResult = await installer.findBmadDir(confirmedDirectory);
62+
bmadDir = bmadResult.bmadDir;
63+
hasLegacyCfg = bmadResult.hasLegacyCfg;
64+
}
65+
66+
if (hasLegacyBmadFolder || hasLegacyCfg) {
67+
console.log(chalk.yellow('\n⚠️ Legacy folder structure detected'));
68+
69+
let message = 'The following folders need to be renamed:\n';
70+
if (hasLegacyBmadFolder) {
71+
message += chalk.dim(` • ".bmad" → "_bmad"\n`);
72+
}
73+
if (hasLegacyCfg) {
74+
message += chalk.dim(` • "_cfg" → "_config"\n`);
75+
}
76+
console.log(message);
77+
78+
const { shouldRename } = await inquirer.prompt([
79+
{
80+
type: 'confirm',
81+
name: 'shouldRename',
82+
message: 'Would you like the installer to rename these folders for you?',
83+
default: true,
84+
},
85+
]);
86+
87+
if (!shouldRename) {
88+
console.log(chalk.red('\n❌ Installation cancelled'));
89+
console.log(chalk.dim('You must manually rename the folders before proceeding:'));
90+
if (hasLegacyBmadFolder) {
91+
console.log(chalk.dim(` • Rename ".bmad" to "_bmad"`));
92+
}
93+
if (hasLegacyCfg) {
94+
console.log(chalk.dim(` • Rename "_cfg" to "_config"`));
95+
}
96+
process.exit(0);
97+
return;
98+
}
99+
100+
// Perform the renames
101+
const ora = require('ora');
102+
const spinner = ora('Updating folder structure...').start();
103+
104+
try {
105+
// First rename .bmad to _bmad if needed
106+
if (hasLegacyBmadFolder) {
107+
const newBmadPath = path.join(confirmedDirectory, '_bmad');
108+
await fs.move(legacyBmadPath, newBmadPath);
109+
bmadDir = newBmadPath;
110+
spinner.succeed('Renamed ".bmad" to "_bmad"');
111+
}
112+
113+
// Then rename _cfg to _config if needed
114+
if (hasLegacyCfg) {
115+
spinner.start('Renaming configuration folder...');
116+
const oldCfgPath = path.join(bmadDir, '_cfg');
117+
const newCfgPath = path.join(bmadDir, '_config');
118+
await fs.move(oldCfgPath, newCfgPath);
119+
spinner.succeed('Renamed "_cfg" to "_config"');
120+
}
121+
122+
spinner.succeed('Folder structure updated successfully');
123+
} catch (error) {
124+
spinner.fail('Failed to update folder structure');
125+
console.error(chalk.red(`Error: ${error.message}`));
126+
process.exit(1);
127+
}
128+
}
129+
130+
// Check if there's an existing BMAD installation (after any folder renames)
40131
const hasExistingInstall = await fs.pathExists(bmadDir);
41132

42133
// Always ask for custom content, but we'll handle it differently for new installs
@@ -190,7 +281,8 @@ class UI {
190281
const { Installer } = require('../installers/lib/core/installer');
191282
const detector = new Detector();
192283
const installer = new Installer();
193-
const bmadDir = await installer.findBmadDir(projectDir || process.cwd());
284+
const bmadResult = await installer.findBmadDir(projectDir || process.cwd());
285+
const bmadDir = bmadResult.bmadDir;
194286
const existingInstall = await detector.detect(bmadDir);
195287
const configuredIdes = existingInstall.ides || [];
196288

0 commit comments

Comments
 (0)