Added options to choose the rule locations

This commit is contained in:
Hau Vo 2025-08-29 10:57:16 +07:00
parent 80d6437fe5
commit 06eea110b9
3 changed files with 84 additions and 20 deletions

View File

@ -475,6 +475,38 @@ async function promptInstallation() {
answers.githubCopilotConfig = { configChoice }; answers.githubCopilotConfig = { configChoice };
} }
// Configure Augment Code immediately if selected
if (ides.includes('augment-code')) {
console.log(chalk.cyan('\n📍 Augment Code Location Configuration'));
console.log(chalk.dim('Choose where to install BMad agents for Augment Code access.\n'));
const { selectedLocations } = await inquirer.prompt([
{
type: 'checkbox',
name: 'selectedLocations',
message: 'Select Augment Code command locations:',
choices: [
{
name: 'User Commands (Global): Available across all your projects (user-wide)',
value: 'user',
},
{
name: 'Workspace Commands (Project): Stored in repository, shared with team',
value: 'workspace',
},
],
validate: (selected) => {
if (selected.length === 0) {
return 'Please select at least one location';
}
return true;
},
},
]);
answers.augmentCodeConfig = { selectedLocations };
}
// Ask for web bundles installation // Ask for web bundles installation
const { includeWebBundles } = await inquirer.prompt([ const { includeWebBundles } = await inquirer.prompt([
{ {

View File

@ -75,7 +75,7 @@ class IdeSetup extends BaseIdeSetup {
return this.setupQwenCode(installDir, selectedAgent); return this.setupQwenCode(installDir, selectedAgent);
} }
case 'augment-code': { case 'augment-code': {
return this.setupAugmentCode(installDir, selectedAgent); return this.setupAugmentCode(installDir, selectedAgent, spinner, preConfiguredSettings);
} }
default: { default: {
console.log(chalk.yellow(`\nIDE ${ide} not yet supported`)); console.log(chalk.yellow(`\nIDE ${ide} not yet supported`));
@ -1440,7 +1440,7 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
console.log(chalk.dim('You can modify these settings anytime in .vscode/settings.json')); console.log(chalk.dim('You can modify these settings anytime in .vscode/settings.json'));
} }
async setupAugmentCode(installDir, selectedAgent) { async setupAugmentCode(installDir, selectedAgent, spinner = null, preConfiguredSettings = null) {
const os = require('node:os'); const os = require('node:os');
const inquirer = require('inquirer'); const inquirer = require('inquirer');
const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir); const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir);
@ -1449,8 +1449,28 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
const ideConfig = await configLoader.getIdeConfiguration('augment-code'); const ideConfig = await configLoader.getIdeConfiguration('augment-code');
const locations = ideConfig.locations; const locations = ideConfig.locations;
// Prompt user to select which locations to install to // Use pre-configured settings if provided, otherwise prompt
const { selectedLocations } = await inquirer.prompt([ let selectedLocations;
if (preConfiguredSettings && preConfiguredSettings.selectedLocations) {
selectedLocations = preConfiguredSettings.selectedLocations;
console.log(
chalk.dim(`Using pre-configured Augment Code locations: ${selectedLocations.join(', ')}`),
);
} else {
// Pause spinner during location selection to avoid UI conflicts
let spinnerWasActive = false;
if (spinner && spinner.isSpinning) {
spinner.stop();
spinnerWasActive = true;
}
// Clear any previous output and add spacing to avoid conflicts with loaders
console.log('\n'.repeat(2));
console.log(chalk.blue('📍 Augment Code Location Configuration'));
console.log(chalk.dim('Choose where to install BMad agents for Augment Code access.'));
console.log(''); // Add extra spacing
const response = await inquirer.prompt([
{ {
type: 'checkbox', type: 'checkbox',
name: 'selectedLocations', name: 'selectedLocations',
@ -1467,6 +1487,13 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
}, },
}, },
]); ]);
selectedLocations = response.selectedLocations;
// Restart spinner if it was active before prompts
if (spinner && spinnerWasActive) {
spinner.start();
}
}
// Install to each selected location // Install to each selected location
for (const locationKey of selectedLocations) { for (const locationKey of selectedLocations) {

View File

@ -408,7 +408,12 @@ class Installer {
if (ides.length > 0) { if (ides.length > 0) {
for (const ide of ides) { for (const ide of ides) {
spinner.text = `Setting up ${ide} integration...`; spinner.text = `Setting up ${ide} integration...`;
const preConfiguredSettings = ide === 'github-copilot' ? config.githubCopilotConfig : null; let preConfiguredSettings = null;
if (ide === 'github-copilot') {
preConfiguredSettings = config.githubCopilotConfig;
} else if (ide === 'augment-code') {
preConfiguredSettings = config.augmentCodeConfig;
}
await ideSetup.setup(ide, installDir, config.agent, spinner, preConfiguredSettings); await ideSetup.setup(ide, installDir, config.agent, spinner, preConfiguredSettings);
} }
} }