fix: installer for github copilot asks follow up questions right away now so it does not seem to hang, and some minor doc improvements

This commit is contained in:
Brian Madison
2025-07-07 20:46:55 -05:00
parent ba9e3f3272
commit cadf8b6750
10 changed files with 577 additions and 55 deletions

View File

@@ -224,6 +224,58 @@ async function promptInstallation() {
answers.installType = selectedItems.includes('bmad-core') ? 'full' : 'expansion-only';
answers.expansionPacks = selectedItems.filter(item => item !== 'bmad-core');
// Ask sharding questions if installing BMad core
if (selectedItems.includes('bmad-core')) {
console.log(chalk.cyan('\n📋 Document Organization Settings'));
console.log(chalk.dim('Configure how your project documentation should be organized.\n'));
// Ask about PRD sharding
const { prdSharded } = await inquirer.prompt([
{
type: 'confirm',
name: 'prdSharded',
message: 'Will the PRD (Product Requirements Document) be sharded into multiple files?',
default: true
}
]);
answers.prdSharded = prdSharded;
// Ask about architecture sharding
const { architectureSharded } = await inquirer.prompt([
{
type: 'confirm',
name: 'architectureSharded',
message: 'Will the architecture documentation be sharded into multiple files?',
default: true
}
]);
answers.architectureSharded = architectureSharded;
// Show warning if architecture sharding is disabled
if (!architectureSharded) {
console.log(chalk.yellow.bold('\n⚠ IMPORTANT: Architecture Sharding Disabled'));
console.log(chalk.yellow('With architecture sharding disabled, you should still create the files listed'));
console.log(chalk.yellow('in devLoadAlwaysFiles (like coding-standards.md, tech-stack.md, source-tree.md)'));
console.log(chalk.yellow('as these are used by the dev agent at runtime.'));
console.log(chalk.yellow('\nAlternatively, you can remove these files from the devLoadAlwaysFiles list'));
console.log(chalk.yellow('in your core-config.yaml after installation.'));
const { acknowledge } = await inquirer.prompt([
{
type: 'confirm',
name: 'acknowledge',
message: 'Do you acknowledge this requirement and want to proceed?',
default: false
}
]);
if (!acknowledge) {
console.log(chalk.red('Installation cancelled.'));
process.exit(0);
}
}
}
// Ask for IDE configuration
const { ides } = await inquirer.prompt([
{
@@ -246,6 +298,37 @@ async function promptInstallation() {
// Use selected IDEs directly
answers.ides = ides;
// Configure GitHub Copilot immediately if selected
if (ides.includes('github-copilot')) {
console.log(chalk.cyan('\n🔧 GitHub Copilot Configuration'));
console.log(chalk.dim('BMad works best with specific VS Code settings for optimal agent experience.\n'));
const { configChoice } = await inquirer.prompt([
{
type: 'list',
name: 'configChoice',
message: chalk.yellow('How would you like to configure GitHub Copilot settings?'),
choices: [
{
name: 'Use recommended defaults (fastest setup)',
value: 'defaults'
},
{
name: 'Configure each setting manually (customize to your preferences)',
value: 'manual'
},
{
name: 'Skip settings configuration (I\'ll configure manually later)',
value: 'skip'
}
],
default: 'defaults'
}
]);
answers.githubCopilotConfig = { configChoice };
}
// Ask for web bundles installation
const { includeWebBundles } = await inquirer.prompt([
{

View File

@@ -271,6 +271,34 @@ class FileManager {
return manifest;
}
async modifyCoreConfig(installDir, config) {
const coreConfigPath = path.join(installDir, '.bmad-core', 'core-config.yaml');
try {
// Read the existing core-config.yaml
const coreConfigContent = await fs.readFile(coreConfigPath, 'utf8');
const coreConfig = yaml.load(coreConfigContent);
// Modify sharding settings if provided
if (config.prdSharded !== undefined) {
coreConfig.prd.prdSharded = config.prdSharded;
}
if (config.architectureSharded !== undefined) {
coreConfig.architecture.architectureSharded = config.architectureSharded;
}
// Write back the modified config
await fs.writeFile(coreConfigPath, yaml.dump(coreConfig, { indent: 2 }));
return true;
} catch (error) {
await initializeModules();
console.error(chalk.red(`Failed to modify core-config.yaml:`), error.message);
return false;
}
}
}
module.exports = new FileManager();

View File

@@ -41,7 +41,7 @@ class IdeSetup {
}
}
async setup(ide, installDir, selectedAgent = null, spinner = null) {
async setup(ide, installDir, selectedAgent = null, spinner = null, preConfiguredSettings = null) {
await initializeModules();
const ideConfig = await configLoader.getIdeConfiguration(ide);
@@ -66,7 +66,7 @@ class IdeSetup {
case "gemini":
return this.setupGeminiCli(installDir, selectedAgent);
case "github-copilot":
return this.setupGitHubCopilot(installDir, selectedAgent, spinner);
return this.setupGitHubCopilot(installDir, selectedAgent, spinner, preConfiguredSettings);
default:
console.log(chalk.yellow(`\nIDE ${ide} not yet supported`));
return false;
@@ -566,11 +566,11 @@ class IdeSetup {
return true;
}
async setupGitHubCopilot(installDir, selectedAgent, spinner = null) {
async setupGitHubCopilot(installDir, selectedAgent, spinner = null, preConfiguredSettings = null) {
await initializeModules();
// Configure VS Code workspace settings first to avoid UI conflicts with loading spinners
await this.configureVsCodeSettings(installDir, spinner);
await this.configureVsCodeSettings(installDir, spinner, preConfiguredSettings);
const chatmodesDir = path.join(installDir, ".github", "chatmodes");
const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir);
@@ -616,7 +616,7 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
return true;
}
async configureVsCodeSettings(installDir, spinner) {
async configureVsCodeSettings(installDir, spinner, preConfiguredSettings = null) {
await initializeModules(); // Ensure inquirer is loaded
const vscodeDir = path.join(installDir, ".vscode");
const settingsPath = path.join(vscodeDir, "settings.json");
@@ -636,34 +636,42 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
}
}
// Clear any previous output and add spacing to avoid conflicts with loaders
console.log('\n'.repeat(2));
console.log(chalk.blue("🔧 Github Copilot Agent Settings Configuration"));
console.log(chalk.dim("BMad works best with specific VS Code settings for optimal agent experience."));
console.log(''); // Add extra spacing
const { configChoice } = await inquirer.prompt([
{
type: 'list',
name: 'configChoice',
message: 'How would you like to configure Github Copilot settings?',
choices: [
{
name: 'Use recommended defaults (fastest setup)',
value: 'defaults'
},
{
name: 'Configure each setting manually (customize to your preferences)',
value: 'manual'
},
{
name: 'Skip settings configuration (I\'ll configure manually later)\n',
value: 'skip'
}
],
default: 'defaults'
}
]);
// Use pre-configured settings if provided, otherwise prompt
let configChoice;
if (preConfiguredSettings && preConfiguredSettings.configChoice) {
configChoice = preConfiguredSettings.configChoice;
console.log(chalk.dim(`Using pre-configured GitHub Copilot settings: ${configChoice}`));
} else {
// Clear any previous output and add spacing to avoid conflicts with loaders
console.log('\n'.repeat(2));
console.log(chalk.blue("🔧 Github Copilot Agent Settings Configuration"));
console.log(chalk.dim("BMad works best with specific VS Code settings for optimal agent experience."));
console.log(''); // Add extra spacing
const response = await inquirer.prompt([
{
type: 'list',
name: 'configChoice',
message: chalk.yellow('How would you like to configure GitHub Copilot settings?'),
choices: [
{
name: 'Use recommended defaults (fastest setup)',
value: 'defaults'
},
{
name: 'Configure each setting manually (customize to your preferences)',
value: 'manual'
},
{
name: 'Skip settings configuration (I\'ll configure manually later)',
value: 'skip'
}
],
default: 'defaults'
}
]);
configChoice = response.configChoice;
}
let bmadSettings = {};

View File

@@ -373,10 +373,17 @@ class Installer {
if (ides.length > 0) {
for (const ide of ides) {
spinner.text = `Setting up ${ide} integration...`;
await ideSetup.setup(ide, installDir, config.agent, spinner);
const preConfiguredSettings = ide === 'github-copilot' ? config.githubCopilotConfig : null;
await ideSetup.setup(ide, installDir, config.agent, spinner, preConfiguredSettings);
}
}
// Modify core-config.yaml if sharding preferences were provided
if (config.installType !== "expansion-only" && (config.prdSharded !== undefined || config.architectureSharded !== undefined)) {
spinner.text = "Configuring document sharding settings...";
await fileManager.modifyCoreConfig(installDir, config);
}
// Create manifest (skip for expansion-only installations)
if (config.installType !== "expansion-only") {
spinner.text = "Creating installation manifest...";