bmad-method 4.22.0 → 4.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,12 +6,16 @@ const configLoader = require("./config-loader");
6
6
 
7
7
  // Dynamic import for ES module
8
8
  let chalk;
9
+ let inquirer;
9
10
 
10
11
  // Initialize ES modules
11
12
  async function initializeModules() {
12
13
  if (!chalk) {
13
14
  chalk = (await import("chalk")).default;
14
15
  }
16
+ if (!inquirer) {
17
+ inquirer = (await import("inquirer")).default;
18
+ }
15
19
  }
16
20
 
17
21
  class IdeSetup {
@@ -36,7 +40,7 @@ class IdeSetup {
36
40
  }
37
41
  }
38
42
 
39
- async setup(ide, installDir, selectedAgent = null) {
43
+ async setup(ide, installDir, selectedAgent = null, spinner = null) {
40
44
  await initializeModules();
41
45
  const ideConfig = await configLoader.getIdeConfiguration(ide);
42
46
 
@@ -58,6 +62,8 @@ class IdeSetup {
58
62
  return this.setupCline(installDir, selectedAgent);
59
63
  case "gemini":
60
64
  return this.setupGeminiCli(installDir, selectedAgent);
65
+ case "vs-code-copilot":
66
+ return this.setupVsCodeCopilot(installDir, selectedAgent, spinner);
61
67
  default:
62
68
  console.log(chalk.yellow(`\nIDE ${ide} not yet supported`));
63
69
  return false;
@@ -507,6 +513,213 @@ class IdeSetup {
507
513
 
508
514
  return true;
509
515
  }
516
+
517
+ async setupVsCodeCopilot(installDir, selectedAgent, spinner = null) {
518
+ await initializeModules();
519
+
520
+ // Configure VS Code workspace settings first to avoid UI conflicts with loading spinners
521
+ await this.configureVsCodeSettings(installDir, spinner);
522
+
523
+ const chatmodesDir = path.join(installDir, ".github", "chatmodes");
524
+ const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir);
525
+
526
+ await fileManager.ensureDirectory(chatmodesDir);
527
+
528
+ for (const agentId of agents) {
529
+ // Find the agent file
530
+ const agentPath = await this.findAgentPath(agentId, installDir);
531
+ const chatmodePath = path.join(chatmodesDir, `${agentId}.chatmode.md`);
532
+
533
+ if (agentPath) {
534
+ // Create chat mode file with agent content
535
+ const agentContent = await fileManager.readFile(agentPath);
536
+ const agentTitle = await this.getAgentTitle(agentId, installDir);
537
+
538
+ // Extract whenToUse for the description
539
+ const yamlMatch = agentContent.match(/```ya?ml\n([\s\S]*?)```/);
540
+ let description = `Activates the ${agentTitle} agent persona.`;
541
+ if (yamlMatch) {
542
+ const whenToUseMatch = yamlMatch[1].match(/whenToUse:\s*"(.*?)"/);
543
+ if (whenToUseMatch && whenToUseMatch[1]) {
544
+ description = whenToUseMatch[1];
545
+ }
546
+ }
547
+
548
+ let chatmodeContent = `---
549
+ description: "${description.replace(/"/g, '\\"')}"
550
+ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems', 'usages']
551
+ ---
552
+
553
+ `;
554
+ chatmodeContent += agentContent;
555
+
556
+ await fileManager.writeFile(chatmodePath, chatmodeContent);
557
+ console.log(chalk.green(`✓ Created chat mode: ${agentId}.chatmode.md`));
558
+ }
559
+ }
560
+
561
+ console.log(chalk.green(`\n✓ VS Code Copilot setup complete!`));
562
+ console.log(chalk.dim(`You can now find the BMAD agents in the Chat view's mode selector.`));
563
+
564
+ return true;
565
+ }
566
+
567
+ async configureVsCodeSettings(installDir, spinner) {
568
+ await initializeModules(); // Ensure inquirer is loaded
569
+ const vscodeDir = path.join(installDir, ".vscode");
570
+ const settingsPath = path.join(vscodeDir, "settings.json");
571
+
572
+ await fileManager.ensureDirectory(vscodeDir);
573
+
574
+ // Read existing settings if they exist
575
+ let existingSettings = {};
576
+ if (await fileManager.pathExists(settingsPath)) {
577
+ try {
578
+ const existingContent = await fileManager.readFile(settingsPath);
579
+ existingSettings = JSON.parse(existingContent);
580
+ console.log(chalk.yellow("Found existing .vscode/settings.json. Merging BMAD settings..."));
581
+ } catch (error) {
582
+ console.warn(chalk.yellow("Could not parse existing settings.json. Creating new one."));
583
+ existingSettings = {};
584
+ }
585
+ }
586
+
587
+ // Clear any previous output and add spacing to avoid conflicts with loaders
588
+ console.log('\n'.repeat(2));
589
+ console.log(chalk.blue("🔧 VS Code Copilot Agent Settings Configuration"));
590
+ console.log(chalk.dim("BMAD works best with specific VS Code settings for optimal agent experience."));
591
+ console.log(''); // Add extra spacing
592
+
593
+ const { configChoice } = await inquirer.prompt([
594
+ {
595
+ type: 'list',
596
+ name: 'configChoice',
597
+ message: 'How would you like to configure VS Code Copilot settings?',
598
+ choices: [
599
+ {
600
+ name: 'Use recommended defaults (fastest setup)',
601
+ value: 'defaults'
602
+ },
603
+ {
604
+ name: 'Configure each setting manually (customize to your preferences)',
605
+ value: 'manual'
606
+ },
607
+ {
608
+ name: 'Skip settings configuration (I\'ll configure manually later)\n',
609
+ value: 'skip'
610
+ }
611
+ ],
612
+ default: 'defaults'
613
+ }
614
+ ]);
615
+
616
+ let bmadSettings = {};
617
+
618
+ if (configChoice === 'skip') {
619
+ console.log(chalk.yellow("⚠️ Skipping VS Code settings configuration."));
620
+ console.log(chalk.dim("You can manually configure these settings in .vscode/settings.json:"));
621
+ console.log(chalk.dim(" • chat.agent.enabled: true"));
622
+ console.log(chalk.dim(" • chat.agent.maxRequests: 15"));
623
+ console.log(chalk.dim(" • github.copilot.chat.agent.runTasks: true"));
624
+ console.log(chalk.dim(" • chat.mcp.discovery.enabled: true"));
625
+ console.log(chalk.dim(" • github.copilot.chat.agent.autoFix: true"));
626
+ console.log(chalk.dim(" • chat.tools.autoApprove: false"));
627
+ return true;
628
+ }
629
+
630
+ if (configChoice === 'defaults') {
631
+ // Use recommended defaults
632
+ bmadSettings = {
633
+ "chat.agent.enabled": true,
634
+ "chat.agent.maxRequests": 15,
635
+ "github.copilot.chat.agent.runTasks": true,
636
+ "chat.mcp.discovery.enabled": true,
637
+ "github.copilot.chat.agent.autoFix": true,
638
+ "chat.tools.autoApprove": false
639
+ };
640
+ console.log(chalk.green("✓ Using recommended BMAD defaults for VS Code Copilot settings"));
641
+ } else {
642
+ // Manual configuration
643
+ console.log(chalk.blue("\n📋 Let's configure each setting for your preferences:"));
644
+
645
+ // Pause spinner during manual configuration prompts
646
+ let spinnerWasActive = false;
647
+ if (spinner && spinner.isSpinning) {
648
+ spinner.stop();
649
+ spinnerWasActive = true;
650
+ }
651
+
652
+ const manualSettings = await inquirer.prompt([
653
+ {
654
+ type: 'input',
655
+ name: 'maxRequests',
656
+ message: 'Maximum requests per agent session (recommended: 15)?',
657
+ default: '15',
658
+ validate: (input) => {
659
+ const num = parseInt(input);
660
+ if (isNaN(num) || num < 1 || num > 50) {
661
+ return 'Please enter a number between 1 and 50';
662
+ }
663
+ return true;
664
+ }
665
+ },
666
+ {
667
+ type: 'confirm',
668
+ name: 'runTasks',
669
+ message: 'Allow agents to run workspace tasks (package.json scripts, etc.)?',
670
+ default: true
671
+ },
672
+ {
673
+ type: 'confirm',
674
+ name: 'mcpDiscovery',
675
+ message: 'Enable MCP (Model Context Protocol) server discovery?',
676
+ default: true
677
+ },
678
+ {
679
+ type: 'confirm',
680
+ name: 'autoFix',
681
+ message: 'Enable automatic error detection and fixing in generated code?',
682
+ default: true
683
+ },
684
+ {
685
+ type: 'confirm',
686
+ name: 'autoApprove',
687
+ message: 'Auto-approve ALL tools without confirmation? (⚠️ EXPERIMENTAL - less secure)',
688
+ default: false
689
+ }
690
+ ]);
691
+
692
+ // Restart spinner if it was active before prompts
693
+ if (spinner && spinnerWasActive) {
694
+ spinner.start();
695
+ }
696
+
697
+ bmadSettings = {
698
+ "chat.agent.enabled": true, // Always enabled - required for BMAD agents
699
+ "chat.agent.maxRequests": parseInt(manualSettings.maxRequests),
700
+ "github.copilot.chat.agent.runTasks": manualSettings.runTasks,
701
+ "chat.mcp.discovery.enabled": manualSettings.mcpDiscovery,
702
+ "github.copilot.chat.agent.autoFix": manualSettings.autoFix,
703
+ "chat.tools.autoApprove": manualSettings.autoApprove
704
+ };
705
+
706
+ console.log(chalk.green("✓ Custom settings configured"));
707
+ }
708
+
709
+ // Merge settings (existing settings take precedence to avoid overriding user preferences)
710
+ const mergedSettings = { ...bmadSettings, ...existingSettings };
711
+
712
+ // Write the updated settings
713
+ await fileManager.writeFile(settingsPath, JSON.stringify(mergedSettings, null, 2));
714
+
715
+ console.log(chalk.green("✓ VS Code workspace settings configured successfully"));
716
+ console.log(chalk.dim(" Settings written to .vscode/settings.json:"));
717
+ Object.entries(bmadSettings).forEach(([key, value]) => {
718
+ console.log(chalk.dim(` • ${key}: ${value}`));
719
+ });
720
+ console.log(chalk.dim(""));
721
+ console.log(chalk.dim("You can modify these settings anytime in .vscode/settings.json"));
722
+ }
510
723
  }
511
724
 
512
725
  module.exports = new IdeSetup();
@@ -372,7 +372,7 @@ class Installer {
372
372
  if (ides.length > 0) {
373
373
  for (const ide of ides) {
374
374
  spinner.text = `Setting up ${ide} integration...`;
375
- await ideSetup.setup(ide, installDir, config.agent);
375
+ await ideSetup.setup(ide, installDir, config.agent, spinner);
376
376
  }
377
377
  }
378
378
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmad-method",
3
- "version": "4.22.0",
3
+ "version": "4.23.0",
4
4
  "description": "BMAD Method installer - AI-powered Agile development framework",
5
5
  "main": "lib/installer.js",
6
6
  "bin": {