mirror of
https://github.com/bmadcode/BMAD-METHOD.git
synced 2025-12-17 09:45:25 +00:00
update menu updated
This commit is contained in:
parent
c7827bf031
commit
08f05cf9a4
@ -39,11 +39,6 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle reinstall by setting force flag
|
||||
if (config.actionType === 'reinstall') {
|
||||
config._requestedReinstall = true;
|
||||
}
|
||||
|
||||
// Regular install/update flow
|
||||
const result = await installer.install(config);
|
||||
|
||||
|
||||
@ -563,9 +563,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
|
||||
// Check if user already decided what to do (from early menu in ui.js)
|
||||
let action = null;
|
||||
if (config._requestedReinstall) {
|
||||
action = 'reinstall';
|
||||
} else if (config.actionType === 'update') {
|
||||
if (config.actionType === 'update') {
|
||||
action = 'update';
|
||||
} else {
|
||||
// Fallback: Ask the user (backwards compatibility for other code paths)
|
||||
@ -577,41 +575,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
action = promptResult.action;
|
||||
}
|
||||
|
||||
if (action === 'cancel') {
|
||||
console.log('Installation cancelled.');
|
||||
return { success: false, cancelled: true };
|
||||
}
|
||||
|
||||
if (action === 'reinstall') {
|
||||
// Warn about destructive operation
|
||||
console.log(chalk.red.bold('\n⚠️ WARNING: This is a destructive operation!'));
|
||||
console.log(chalk.red('All custom files and modifications in the bmad directory will be lost.'));
|
||||
|
||||
const inquirer = require('inquirer');
|
||||
const { confirmReinstall } = await inquirer.prompt([
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'confirmReinstall',
|
||||
message: chalk.yellow('Are you sure you want to delete and reinstall?'),
|
||||
default: false,
|
||||
},
|
||||
]);
|
||||
|
||||
if (!confirmReinstall) {
|
||||
console.log('Installation cancelled.');
|
||||
return { success: false, cancelled: true };
|
||||
}
|
||||
|
||||
// Remember previously configured IDEs before deleting
|
||||
config._previouslyConfiguredIdes = existingInstall.ides || [];
|
||||
|
||||
// Remove existing installation
|
||||
await fs.remove(bmadDir);
|
||||
console.log(chalk.green('✓ Removed existing installation\n'));
|
||||
|
||||
// Mark this as a full reinstall so we re-collect IDE configurations
|
||||
config._isFullReinstall = true;
|
||||
} else if (action === 'update') {
|
||||
if (action === 'update') {
|
||||
// Store that we're updating for later processing
|
||||
config._isUpdate = true;
|
||||
config._existingInstall = existingInstall;
|
||||
@ -2645,11 +2609,7 @@ If AgentVibes party mode is enabled, immediately trigger TTS with agent's voice:
|
||||
type: 'list',
|
||||
name: 'action',
|
||||
message: 'What would you like to do?',
|
||||
choices: [
|
||||
{ name: 'Update existing installation', value: 'update' },
|
||||
{ name: 'Remove and reinstall', value: 'reinstall' },
|
||||
{ name: 'Cancel', value: 'cancel' },
|
||||
],
|
||||
choices: [{ name: 'Update existing installation', value: 'update' }],
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
@ -177,20 +177,37 @@ class UI {
|
||||
|
||||
// Only show action menu if there's an existing installation
|
||||
if (hasExistingInstall) {
|
||||
// Get version information
|
||||
const { existingInstall } = await this.getExistingInstallation(confirmedDirectory);
|
||||
const packageJsonPath = path.join(__dirname, '../../../package.json');
|
||||
const currentVersion = require(packageJsonPath).version;
|
||||
const installedVersion = existingInstall.version || 'unknown';
|
||||
|
||||
// Build menu choices dynamically
|
||||
const choices = [];
|
||||
|
||||
// Always show Quick Update first (allows refreshing installation even on same version)
|
||||
if (installedVersion !== 'unknown') {
|
||||
choices.push({
|
||||
name: `Quick Update (v${installedVersion} → v${currentVersion})`,
|
||||
value: 'quick-update',
|
||||
});
|
||||
}
|
||||
|
||||
// Common actions
|
||||
choices.push(
|
||||
{ name: 'Modify BMAD Installation', value: 'update' },
|
||||
{ name: 'Add / Update Custom Content', value: 'add-custom' },
|
||||
{ name: 'Rebuild Agents', value: 'compile' },
|
||||
);
|
||||
|
||||
const promptResult = await inquirer.prompt([
|
||||
{
|
||||
type: 'list',
|
||||
name: 'actionType',
|
||||
message: 'What would you like to do?',
|
||||
choices: [
|
||||
{ name: 'Quick Update (Settings Preserved)', value: 'quick-update' },
|
||||
{ name: 'Modify BMAD Installation (Confirm or change each setting)', value: 'update' },
|
||||
{ name: 'Add Custom Content', value: 'add-custom' },
|
||||
{ name: 'Remove BMad Folder and Reinstall (Full clean install - BMad Customization Will Be Lost)', value: 'reinstall' },
|
||||
{ name: 'Compile Agents (Quick rebuild of all agent .md files)', value: 'compile' },
|
||||
{ name: 'Cancel', value: 'cancel' },
|
||||
],
|
||||
default: 'quick-update',
|
||||
choices: choices,
|
||||
default: choices[0].value, // Use the first option as default
|
||||
},
|
||||
]);
|
||||
|
||||
@ -265,19 +282,7 @@ class UI {
|
||||
};
|
||||
}
|
||||
|
||||
// Handle cancel
|
||||
if (actionType === 'cancel') {
|
||||
return {
|
||||
actionType: 'cancel',
|
||||
directory: confirmedDirectory,
|
||||
};
|
||||
}
|
||||
|
||||
// Handle reinstall - DON'T return early, let it flow through configuration collection
|
||||
// The installer will handle deletion when it sees actionType === 'reinstall'
|
||||
// For now, just note that we're in reinstall mode and continue below
|
||||
|
||||
// If actionType === 'update' or 'reinstall', continue with normal flow below
|
||||
// If actionType === 'update', continue with normal flow below
|
||||
}
|
||||
|
||||
// For new installations, ask about content types first
|
||||
@ -638,8 +643,8 @@ class UI {
|
||||
const { Installer } = require('../installers/lib/core/installer');
|
||||
const detector = new Detector();
|
||||
const installer = new Installer();
|
||||
const bmadDir = await installer.findBmadDir(directory);
|
||||
const existingInstall = await detector.detect(bmadDir);
|
||||
const bmadDirResult = await installer.findBmadDir(directory);
|
||||
const existingInstall = await detector.detect(bmadDirResult.bmadDir);
|
||||
const installedModuleIds = new Set(existingInstall.modules.map((mod) => mod.id));
|
||||
|
||||
return { existingInstall, installedModuleIds };
|
||||
@ -808,12 +813,13 @@ class UI {
|
||||
// Check for any bmad installation (any folder with _config/manifest.yaml)
|
||||
const { Installer } = require('../installers/lib/core/installer');
|
||||
const installer = new Installer();
|
||||
const bmadDir = await installer.findBmadDir(directory);
|
||||
const hasBmadInstall = (await fs.pathExists(bmadDir)) && (await fs.pathExists(path.join(bmadDir, '_config', 'manifest.yaml')));
|
||||
const bmadResult = await installer.findBmadDir(directory);
|
||||
const hasBmadInstall =
|
||||
(await fs.pathExists(bmadResult.bmadDir)) && (await fs.pathExists(path.join(bmadResult.bmadDir, '_config', 'manifest.yaml')));
|
||||
|
||||
console.log(
|
||||
chalk.gray(`Directory exists and contains ${files.length} item(s)`) +
|
||||
(hasBmadInstall ? chalk.yellow(` including existing BMAD installation (${path.basename(bmadDir)})`) : ''),
|
||||
(hasBmadInstall ? chalk.yellow(` including existing BMAD installation (${path.basename(bmadResult.bmadDir)})`) : ''),
|
||||
);
|
||||
} else {
|
||||
console.log(chalk.gray('Directory exists and is empty'));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user