bmad-method 4.27.4 → 4.27.6

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CONTRIBUTING.md +2 -2
  3. package/bmad-core/agents/analyst.md +3 -4
  4. package/bmad-core/agents/architect.md +3 -4
  5. package/bmad-core/agents/bmad-master.md +9 -32
  6. package/bmad-core/agents/bmad-orchestrator.md +3 -8
  7. package/bmad-core/agents/dev.md +3 -4
  8. package/bmad-core/agents/pm.md +3 -4
  9. package/bmad-core/agents/po.md +3 -4
  10. package/bmad-core/agents/qa.md +3 -4
  11. package/bmad-core/agents/sm.md +3 -4
  12. package/bmad-core/agents/ux-expert.md +3 -4
  13. package/bmad-core/data/bmad-kb.md +3 -3
  14. package/bmad-core/tasks/create-next-story.md +0 -1
  15. package/bmad-core/tasks/validate-next-story.md +1 -1
  16. package/bmad-core/workflows/brownfield-fullstack.yaml +1 -1
  17. package/bmad-core/workflows/brownfield-service.yaml +1 -1
  18. package/bmad-core/workflows/brownfield-ui.yaml +1 -1
  19. package/bmad-core/workflows/greenfield-fullstack.yaml +1 -1
  20. package/bmad-core/workflows/greenfield-ui.yaml +1 -1
  21. package/dist/agents/analyst.txt +3 -3
  22. package/dist/agents/bmad-master.txt +7 -324
  23. package/dist/agents/bmad-orchestrator.txt +3 -229
  24. package/dist/agents/dev.txt +1 -1
  25. package/dist/agents/po.txt +1 -1
  26. package/dist/agents/sm.txt +0 -1
  27. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +0 -226
  28. package/dist/teams/team-all.txt +9 -236
  29. package/dist/teams/team-fullstack.txt +9 -235
  30. package/dist/teams/team-ide-minimal.txt +4 -231
  31. package/dist/teams/team-no-ui.txt +5 -231
  32. package/{GUIDING-PRINCIPLES.md → docs/GUIDING-PRINCIPLES.md} +19 -13
  33. package/docs/template-markup-references.md +86 -0
  34. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.md +2 -3
  35. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.md +2 -3
  36. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.md +2 -3
  37. package/expansion-packs/bmad-creator-tools/agents/bmad-the-creator.md +2 -3
  38. package/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.md +2 -3
  39. package/expansion-packs/bmad-infrastructure-devops/data/bmad-kb.md +307 -2
  40. package/package.json +1 -1
  41. package/tools/installer/bin/bmad.js +83 -0
  42. package/tools/installer/lib/file-manager.js +105 -2
  43. package/tools/installer/lib/ide-setup.js +41 -33
  44. package/tools/installer/lib/installer.js +62 -26
  45. package/tools/installer/package.json +1 -1
  46. package/bmad-core/utils/plan-management.md +0 -219
@@ -1,3 +1,308 @@
1
- # Usage Information
1
+ # BMad Infrastructure DevOps Expansion Pack Knowledge Base
2
2
 
3
- TODO
3
+ ## Overview
4
+
5
+ The BMad Infrastructure DevOps expansion pack extends the BMad Method framework with comprehensive infrastructure and DevOps capabilities. It enables teams to design, implement, validate, and maintain modern cloud-native infrastructure alongside their application development efforts.
6
+
7
+ **Version**: 1.7.0
8
+ **BMad Compatibility**: v4+
9
+ **Author**: Brian (BMad)
10
+
11
+ ## Core Purpose
12
+
13
+ This expansion pack addresses the critical need for systematic infrastructure planning and implementation in modern software projects. It provides:
14
+
15
+ - Structured approach to infrastructure architecture design
16
+ - Platform engineering implementation guidance
17
+ - Comprehensive validation and review processes
18
+ - Integration with core BMad development workflows
19
+ - Support for cloud-native and traditional infrastructure patterns
20
+
21
+ ## When to Use This Expansion Pack
22
+
23
+ Use the BMad Infrastructure DevOps expansion pack when your project involves:
24
+
25
+ - **Cloud Infrastructure Design**: AWS, Azure, GCP, or multi-cloud architectures
26
+ - **Kubernetes and Container Orchestration**: Container platform design and implementation
27
+ - **Infrastructure as Code**: Terraform, CloudFormation, Pulumi implementations
28
+ - **GitOps Workflows**: ArgoCD, Flux, or similar continuous deployment patterns
29
+ - **Platform Engineering**: Building internal developer platforms and self-service capabilities
30
+ - **Service Mesh Implementation**: Istio, Linkerd, or similar service mesh architectures
31
+ - **DevOps Transformation**: Establishing or improving DevOps practices and culture
32
+
33
+ ## Key Components
34
+
35
+ ### 1. DevOps Agent: Alex
36
+
37
+ **Role**: DevOps Infrastructure Specialist
38
+ **Experience**: 15+ years in infrastructure and platform engineering
39
+
40
+ **Core Principles**:
41
+
42
+ - Infrastructure as Code (IaC) First
43
+ - Automation and Repeatability
44
+ - Reliability and Scalability
45
+ - Security by Design
46
+ - Cost Optimization
47
+ - Developer Experience Focus
48
+
49
+ **Commands**:
50
+
51
+ - `*help` - Display available commands and capabilities
52
+ - `*chat-mode` - Interactive conversation mode for infrastructure discussions
53
+ - `*create-doc` - Generate infrastructure documentation from templates
54
+ - `*review-infrastructure` - Conduct systematic infrastructure review
55
+ - `*validate-infrastructure` - Validate infrastructure against comprehensive checklist
56
+ - `*checklist` - Access the 16-section infrastructure validation checklist
57
+ - `*exit` - Return to normal context
58
+
59
+ ### 2. Infrastructure Templates
60
+
61
+ #### Infrastructure Architecture Template
62
+
63
+ **Purpose**: Design comprehensive infrastructure architecture
64
+ **Key Sections**:
65
+
66
+ - Infrastructure Overview (providers, regions, environments)
67
+ - Infrastructure as Code approach and tooling
68
+ - Network Architecture with visual diagrams
69
+ - Compute Resources planning
70
+ - Security Architecture design
71
+ - Monitoring and Observability strategy
72
+ - CI/CD Pipeline architecture
73
+ - Disaster Recovery planning
74
+ - BMad Integration points
75
+
76
+ #### Platform Implementation Template
77
+
78
+ **Purpose**: Implement platform infrastructure based on approved architecture
79
+ **Key Sections**:
80
+
81
+ - Foundation Infrastructure Layer
82
+ - Container Platform (Kubernetes) setup
83
+ - GitOps Workflow implementation
84
+ - Service Mesh configuration
85
+ - Developer Experience Platform
86
+ - Security hardening procedures
87
+ - Platform validation and testing
88
+
89
+ ### 3. Tasks
90
+
91
+ #### Review Infrastructure Task
92
+
93
+ **Purpose**: Systematic infrastructure review process
94
+ **Features**:
95
+
96
+ - Incremental or rapid assessment modes
97
+ - Architectural escalation for complex issues
98
+ - Advanced elicitation for deep analysis
99
+ - Prioritized findings and recommendations
100
+ - Integration with BMad Architecture phase
101
+
102
+ #### Validate Infrastructure Task
103
+
104
+ **Purpose**: Comprehensive infrastructure validation
105
+ **Features**:
106
+
107
+ - 16-section validation checklist
108
+ - Architecture Design Review Gate
109
+ - Compliance percentage tracking
110
+ - Remediation planning
111
+ - BMad integration assessment
112
+
113
+ ### 4. Infrastructure Validation Checklist
114
+
115
+ A comprehensive 16-section checklist covering:
116
+
117
+ **Foundation Infrastructure (Sections 1-12)**:
118
+
119
+ 1. Security Foundation - IAM, encryption, compliance
120
+ 2. Infrastructure as Code - Version control, testing, documentation
121
+ 3. Resilience & High Availability - Multi-AZ, failover, SLAs
122
+ 4. Backup & Disaster Recovery - Strategies, testing, RTO/RPO
123
+ 5. Monitoring & Observability - Metrics, logging, alerting
124
+ 6. Performance & Scalability - Auto-scaling, load testing
125
+ 7. Infrastructure Operations - Patching, maintenance, runbooks
126
+ 8. CI/CD Infrastructure - Pipelines, environments, deployments
127
+ 9. Networking & Connectivity - Architecture, security, DNS
128
+ 10. Compliance & Governance - Standards, auditing, policies
129
+ 11. BMad Integration - Agent support, workflow alignment
130
+ 12. Architecture Documentation - Diagrams, decisions, maintenance
131
+
132
+ **Platform Engineering (Sections 13-16)**: 13. Container Platform - Kubernetes setup, RBAC, networking 14. GitOps Workflows - Repository structure, deployment patterns 15. Service Mesh - Traffic management, security, observability 16. Developer Experience - Self-service, documentation, tooling
133
+
134
+ ## Integration with BMad Flow
135
+
136
+ ### Workflow Integration Points
137
+
138
+ 1. **After Architecture Phase**: Infrastructure design begins after application architecture is defined
139
+ 2. **Parallel to Development**: Infrastructure implementation runs alongside application development
140
+ 3. **Before Production**: Infrastructure validation gates before production deployment
141
+ 4. **Continuous Operation**: Ongoing infrastructure reviews and improvements
142
+
143
+ ### Agent Collaboration
144
+
145
+ - **With Architect (Sage)**: Joint planning sessions, design reviews, architectural alignment
146
+ - **With Developer (Blake)**: Platform capabilities, development environment setup
147
+ - **With Product Manager (Finley)**: Infrastructure requirements, cost considerations
148
+ - **With Creator Agents**: Infrastructure for creative workflows and asset management
149
+
150
+ ## Best Practices
151
+
152
+ ### Infrastructure Design
153
+
154
+ 1. **Start with Requirements**: Understand application needs before designing infrastructure
155
+ 2. **Design for Scale**: Plan for 10x growth from day one
156
+ 3. **Security First**: Implement defense in depth at every layer
157
+ 4. **Cost Awareness**: Balance performance with budget constraints
158
+ 5. **Document Everything**: Maintain comprehensive documentation
159
+
160
+ ### Implementation Approach
161
+
162
+ 1. **Incremental Rollout**: Deploy infrastructure in stages with validation gates
163
+ 2. **Automation Focus**: Automate repetitive tasks and deployments
164
+ 3. **Testing Strategy**: Include infrastructure testing in CI/CD pipelines
165
+ 4. **Monitoring Setup**: Implement observability before production
166
+ 5. **Team Training**: Ensure team understanding of infrastructure
167
+
168
+ ### Validation Process
169
+
170
+ 1. **Regular Reviews**: Schedule periodic infrastructure assessments
171
+ 2. **Checklist Compliance**: Maintain high compliance with validation checklist
172
+ 3. **Performance Baselines**: Establish and monitor performance metrics
173
+ 4. **Security Audits**: Regular security assessments and penetration testing
174
+ 5. **Cost Optimization**: Monthly cost reviews and optimization
175
+
176
+ ## Common Use Cases
177
+
178
+ ### 1. New Project Infrastructure
179
+
180
+ **Scenario**: Starting a new cloud-native application
181
+ **Process**:
182
+
183
+ 1. Use Infrastructure Architecture template for design
184
+ 2. Review with Architect agent
185
+ 3. Implement using Platform Implementation template
186
+ 4. Validate with comprehensive checklist
187
+ 5. Deploy incrementally with monitoring
188
+
189
+ ### 2. Infrastructure Modernization
190
+
191
+ **Scenario**: Migrating legacy infrastructure to cloud
192
+ **Process**:
193
+
194
+ 1. Review existing infrastructure
195
+ 2. Design target architecture
196
+ 3. Plan migration phases
197
+ 4. Implement with validation gates
198
+ 5. Monitor and optimize
199
+
200
+ ### 3. Platform Engineering Initiative
201
+
202
+ **Scenario**: Building internal developer platform
203
+ **Process**:
204
+
205
+ 1. Assess developer needs
206
+ 2. Design platform architecture
207
+ 3. Implement Kubernetes/GitOps foundation
208
+ 4. Build self-service capabilities
209
+ 5. Enable developer adoption
210
+
211
+ ### 4. Multi-Cloud Strategy
212
+
213
+ **Scenario**: Implementing multi-cloud architecture
214
+ **Process**:
215
+
216
+ 1. Define cloud strategy and requirements
217
+ 2. Design cloud-agnostic architecture
218
+ 3. Implement with IaC abstraction
219
+ 4. Validate cross-cloud functionality
220
+ 5. Establish unified monitoring
221
+
222
+ ## Advanced Features
223
+
224
+ ### GitOps Workflows
225
+
226
+ - **Repository Structure**: Organized by environment and application
227
+ - **Deployment Patterns**: Progressive delivery, canary deployments
228
+ - **Secret Management**: External secrets operator integration
229
+ - **Policy Enforcement**: OPA/Gatekeeper for compliance
230
+
231
+ ### Service Mesh Capabilities
232
+
233
+ - **Traffic Management**: Load balancing, circuit breaking, retries
234
+ - **Security**: mTLS, authorization policies
235
+ - **Observability**: Distributed tracing, service maps
236
+ - **Multi-Cluster**: Cross-cluster communication
237
+
238
+ ### Developer Self-Service
239
+
240
+ - **Portal Features**: Resource provisioning, environment management
241
+ - **API Gateway**: Centralized API management
242
+ - **Documentation**: Automated API docs, runbooks
243
+ - **Tooling**: CLI tools, IDE integrations
244
+
245
+ ## Troubleshooting Guide
246
+
247
+ ### Common Issues
248
+
249
+ 1. **Infrastructure Drift**
250
+
251
+ - Solution: Implement drift detection in IaC pipelines
252
+ - Prevention: Restrict manual changes, enforce GitOps
253
+
254
+ 2. **Cost Overruns**
255
+
256
+ - Solution: Implement cost monitoring and alerts
257
+ - Prevention: Resource tagging, budget limits
258
+
259
+ 3. **Performance Problems**
260
+
261
+ - Solution: Review monitoring data, scale resources
262
+ - Prevention: Load testing, capacity planning
263
+
264
+ 4. **Security Vulnerabilities**
265
+ - Solution: Immediate patching, security reviews
266
+ - Prevention: Automated scanning, compliance checks
267
+
268
+ ## Metrics and KPIs
269
+
270
+ ### Infrastructure Metrics
271
+
272
+ - **Availability**: Target 99.9%+ uptime
273
+ - **Performance**: Response time < 100ms
274
+ - **Cost Efficiency**: Cost per transaction trending down
275
+ - **Security**: Zero critical vulnerabilities
276
+ - **Automation**: 90%+ automated deployments
277
+
278
+ ### Platform Metrics
279
+
280
+ - **Developer Satisfaction**: NPS > 50
281
+ - **Self-Service Adoption**: 80%+ platform usage
282
+ - **Deployment Frequency**: Multiple per day
283
+ - **Lead Time**: < 1 hour from commit to production
284
+ - **MTTR**: < 30 minutes for incidents
285
+
286
+ ## Future Enhancements
287
+
288
+ ### Planned Features
289
+
290
+ 1. **AI-Driven Optimization**: Automated infrastructure tuning
291
+ 2. **Enhanced Security**: Zero-trust architecture templates
292
+ 3. **Edge Computing**: Support for edge infrastructure patterns
293
+ 4. **Sustainability**: Carbon footprint optimization
294
+ 5. **Advanced Compliance**: Industry-specific compliance templates
295
+
296
+ ### Integration Roadmap
297
+
298
+ 1. **Cloud Provider APIs**: Direct integration with AWS, Azure, GCP
299
+ 2. **IaC Tools**: Native support for Terraform, Pulumi
300
+ 3. **Monitoring Platforms**: Integration with Datadog, New Relic
301
+ 4. **Security Tools**: SIEM and vulnerability scanner integration
302
+ 5. **Cost Management**: FinOps platform integration
303
+
304
+ ## Conclusion
305
+
306
+ The BMad Infrastructure DevOps expansion pack provides a comprehensive framework for modern infrastructure and platform engineering. By following its structured approach and leveraging the provided tools and templates, teams can build reliable, scalable, and secure infrastructure that accelerates application delivery while maintaining operational excellence.
307
+
308
+ For support and updates, refer to the main BMad Method documentation or contact the BMad community.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmad-method",
3
- "version": "4.27.4",
3
+ "version": "4.27.6",
4
4
  "description": "Breakthrough Method of Agile AI-driven Development",
5
5
  "main": "tools/cli.js",
6
6
  "bin": {
@@ -224,6 +224,58 @@ async function promptInstallation() {
224
224
  answers.installType = selectedItems.includes('bmad-core') ? 'full' : 'expansion-only';
225
225
  answers.expansionPacks = selectedItems.filter(item => item !== 'bmad-core');
226
226
 
227
+ // Ask sharding questions if installing BMad core
228
+ if (selectedItems.includes('bmad-core')) {
229
+ console.log(chalk.cyan('\n📋 Document Organization Settings'));
230
+ console.log(chalk.dim('Configure how your project documentation should be organized.\n'));
231
+
232
+ // Ask about PRD sharding
233
+ const { prdSharded } = await inquirer.prompt([
234
+ {
235
+ type: 'confirm',
236
+ name: 'prdSharded',
237
+ message: 'Will the PRD (Product Requirements Document) be sharded into multiple files?',
238
+ default: true
239
+ }
240
+ ]);
241
+ answers.prdSharded = prdSharded;
242
+
243
+ // Ask about architecture sharding
244
+ const { architectureSharded } = await inquirer.prompt([
245
+ {
246
+ type: 'confirm',
247
+ name: 'architectureSharded',
248
+ message: 'Will the architecture documentation be sharded into multiple files?',
249
+ default: true
250
+ }
251
+ ]);
252
+ answers.architectureSharded = architectureSharded;
253
+
254
+ // Show warning if architecture sharding is disabled
255
+ if (!architectureSharded) {
256
+ console.log(chalk.yellow.bold('\n⚠️ IMPORTANT: Architecture Sharding Disabled'));
257
+ console.log(chalk.yellow('With architecture sharding disabled, you should still create the files listed'));
258
+ console.log(chalk.yellow('in devLoadAlwaysFiles (like coding-standards.md, tech-stack.md, source-tree.md)'));
259
+ console.log(chalk.yellow('as these are used by the dev agent at runtime.'));
260
+ console.log(chalk.yellow('\nAlternatively, you can remove these files from the devLoadAlwaysFiles list'));
261
+ console.log(chalk.yellow('in your core-config.yaml after installation.'));
262
+
263
+ const { acknowledge } = await inquirer.prompt([
264
+ {
265
+ type: 'confirm',
266
+ name: 'acknowledge',
267
+ message: 'Do you acknowledge this requirement and want to proceed?',
268
+ default: false
269
+ }
270
+ ]);
271
+
272
+ if (!acknowledge) {
273
+ console.log(chalk.red('Installation cancelled.'));
274
+ process.exit(0);
275
+ }
276
+ }
277
+ }
278
+
227
279
  // Ask for IDE configuration
228
280
  const { ides } = await inquirer.prompt([
229
281
  {
@@ -246,6 +298,37 @@ async function promptInstallation() {
246
298
  // Use selected IDEs directly
247
299
  answers.ides = ides;
248
300
 
301
+ // Configure GitHub Copilot immediately if selected
302
+ if (ides.includes('github-copilot')) {
303
+ console.log(chalk.cyan('\n🔧 GitHub Copilot Configuration'));
304
+ console.log(chalk.dim('BMad works best with specific VS Code settings for optimal agent experience.\n'));
305
+
306
+ const { configChoice } = await inquirer.prompt([
307
+ {
308
+ type: 'list',
309
+ name: 'configChoice',
310
+ message: chalk.yellow('How would you like to configure GitHub Copilot settings?'),
311
+ choices: [
312
+ {
313
+ name: 'Use recommended defaults (fastest setup)',
314
+ value: 'defaults'
315
+ },
316
+ {
317
+ name: 'Configure each setting manually (customize to your preferences)',
318
+ value: 'manual'
319
+ },
320
+ {
321
+ name: 'Skip settings configuration (I\'ll configure manually later)',
322
+ value: 'skip'
323
+ }
324
+ ],
325
+ default: 'defaults'
326
+ }
327
+ ]);
328
+
329
+ answers.githubCopilotConfig = { configChoice };
330
+ }
331
+
249
332
  // Ask for web bundles installation
250
333
  const { includeWebBundles } = await inquirer.prompt([
251
334
  {
@@ -47,7 +47,7 @@ class FileManager {
47
47
  }
48
48
  }
49
49
 
50
- async copyGlobPattern(pattern, sourceDir, destDir) {
50
+ async copyGlobPattern(pattern, sourceDir, destDir, rootValue = null) {
51
51
  const files = glob.sync(pattern, { cwd: sourceDir });
52
52
  const copied = [];
53
53
 
@@ -55,7 +55,17 @@ class FileManager {
55
55
  const sourcePath = path.join(sourceDir, file);
56
56
  const destPath = path.join(destDir, file);
57
57
 
58
- if (await this.copyFile(sourcePath, destPath)) {
58
+ // Use root replacement if rootValue is provided and file needs it
59
+ const needsRootReplacement = rootValue && (file.endsWith('.md') || file.endsWith('.yaml') || file.endsWith('.yml'));
60
+
61
+ let success = false;
62
+ if (needsRootReplacement) {
63
+ success = await this.copyFileWithRootReplacement(sourcePath, destPath, rootValue);
64
+ } else {
65
+ success = await this.copyFile(sourcePath, destPath);
66
+ }
67
+
68
+ if (success) {
59
69
  copied.push(file);
60
70
  }
61
71
  }
@@ -271,6 +281,99 @@ class FileManager {
271
281
 
272
282
  return manifest;
273
283
  }
284
+
285
+ async modifyCoreConfig(installDir, config) {
286
+ const coreConfigPath = path.join(installDir, '.bmad-core', 'core-config.yaml');
287
+
288
+ try {
289
+ // Read the existing core-config.yaml
290
+ const coreConfigContent = await fs.readFile(coreConfigPath, 'utf8');
291
+ const coreConfig = yaml.load(coreConfigContent);
292
+
293
+ // Modify sharding settings if provided
294
+ if (config.prdSharded !== undefined) {
295
+ coreConfig.prd.prdSharded = config.prdSharded;
296
+ }
297
+
298
+ if (config.architectureSharded !== undefined) {
299
+ coreConfig.architecture.architectureSharded = config.architectureSharded;
300
+ }
301
+
302
+ // Write back the modified config
303
+ await fs.writeFile(coreConfigPath, yaml.dump(coreConfig, { indent: 2 }));
304
+
305
+ return true;
306
+ } catch (error) {
307
+ await initializeModules();
308
+ console.error(chalk.red(`Failed to modify core-config.yaml:`), error.message);
309
+ return false;
310
+ }
311
+ }
312
+
313
+ async copyFileWithRootReplacement(source, destination, rootValue) {
314
+ try {
315
+ // Read the source file content
316
+ const fs = require('fs').promises;
317
+ const content = await fs.readFile(source, 'utf8');
318
+
319
+ // Replace {root} with the specified root value
320
+ const updatedContent = content.replace(/\{root\}/g, rootValue);
321
+
322
+ // Ensure directory exists
323
+ await this.ensureDirectory(path.dirname(destination));
324
+
325
+ // Write the updated content
326
+ await fs.writeFile(destination, updatedContent, 'utf8');
327
+
328
+ return true;
329
+ } catch (error) {
330
+ await initializeModules();
331
+ console.error(chalk.red(`Failed to copy ${source} with root replacement:`), error.message);
332
+ return false;
333
+ }
334
+ }
335
+
336
+ async copyDirectoryWithRootReplacement(source, destination, rootValue, fileExtensions = ['.md', '.yaml', '.yml']) {
337
+ try {
338
+ await initializeModules(); // Ensure chalk is initialized
339
+ await this.ensureDirectory(destination);
340
+
341
+ // Get all files in source directory
342
+ const files = glob.sync('**/*', {
343
+ cwd: source,
344
+ nodir: true
345
+ });
346
+
347
+ let replacedCount = 0;
348
+
349
+ for (const file of files) {
350
+ const sourcePath = path.join(source, file);
351
+ const destPath = path.join(destination, file);
352
+
353
+ // Check if this file type should have {root} replacement
354
+ const shouldReplace = fileExtensions.some(ext => file.endsWith(ext));
355
+
356
+ if (shouldReplace) {
357
+ if (await this.copyFileWithRootReplacement(sourcePath, destPath, rootValue)) {
358
+ replacedCount++;
359
+ }
360
+ } else {
361
+ // Regular copy for files that don't need replacement
362
+ await this.copyFile(sourcePath, destPath);
363
+ }
364
+ }
365
+
366
+ if (replacedCount > 0) {
367
+ console.log(chalk.dim(` Processed ${replacedCount} files with {root} replacement`));
368
+ }
369
+
370
+ return true;
371
+ } catch (error) {
372
+ await initializeModules();
373
+ console.error(chalk.red(`Failed to copy directory ${source} with root replacement:`), error.message);
374
+ return false;
375
+ }
376
+ }
274
377
  }
275
378
 
276
379
  module.exports = new FileManager();
@@ -41,7 +41,7 @@ class IdeSetup {
41
41
  }
42
42
  }
43
43
 
44
- async setup(ide, installDir, selectedAgent = null, spinner = null) {
44
+ async setup(ide, installDir, selectedAgent = null, spinner = null, preConfiguredSettings = null) {
45
45
  await initializeModules();
46
46
  const ideConfig = await configLoader.getIdeConfiguration(ide);
47
47
 
@@ -66,7 +66,7 @@ class IdeSetup {
66
66
  case "gemini":
67
67
  return this.setupGeminiCli(installDir, selectedAgent);
68
68
  case "github-copilot":
69
- return this.setupGitHubCopilot(installDir, selectedAgent, spinner);
69
+ return this.setupGitHubCopilot(installDir, selectedAgent, spinner, preConfiguredSettings);
70
70
  default:
71
71
  console.log(chalk.yellow(`\nIDE ${ide} not yet supported`));
72
72
  return false;
@@ -566,11 +566,11 @@ class IdeSetup {
566
566
  return true;
567
567
  }
568
568
 
569
- async setupGitHubCopilot(installDir, selectedAgent, spinner = null) {
569
+ async setupGitHubCopilot(installDir, selectedAgent, spinner = null, preConfiguredSettings = null) {
570
570
  await initializeModules();
571
571
 
572
572
  // Configure VS Code workspace settings first to avoid UI conflicts with loading spinners
573
- await this.configureVsCodeSettings(installDir, spinner);
573
+ await this.configureVsCodeSettings(installDir, spinner, preConfiguredSettings);
574
574
 
575
575
  const chatmodesDir = path.join(installDir, ".github", "chatmodes");
576
576
  const agents = selectedAgent ? [selectedAgent] : await this.getAllAgentIds(installDir);
@@ -616,7 +616,7 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
616
616
  return true;
617
617
  }
618
618
 
619
- async configureVsCodeSettings(installDir, spinner) {
619
+ async configureVsCodeSettings(installDir, spinner, preConfiguredSettings = null) {
620
620
  await initializeModules(); // Ensure inquirer is loaded
621
621
  const vscodeDir = path.join(installDir, ".vscode");
622
622
  const settingsPath = path.join(vscodeDir, "settings.json");
@@ -636,34 +636,42 @@ tools: ['changes', 'codebase', 'fetch', 'findTestFiles', 'githubRepo', 'problems
636
636
  }
637
637
  }
638
638
 
639
- // Clear any previous output and add spacing to avoid conflicts with loaders
640
- console.log('\n'.repeat(2));
641
- console.log(chalk.blue("🔧 Github Copilot Agent Settings Configuration"));
642
- console.log(chalk.dim("BMad works best with specific VS Code settings for optimal agent experience."));
643
- console.log(''); // Add extra spacing
644
-
645
- const { configChoice } = await inquirer.prompt([
646
- {
647
- type: 'list',
648
- name: 'configChoice',
649
- message: 'How would you like to configure Github Copilot settings?',
650
- choices: [
651
- {
652
- name: 'Use recommended defaults (fastest setup)',
653
- value: 'defaults'
654
- },
655
- {
656
- name: 'Configure each setting manually (customize to your preferences)',
657
- value: 'manual'
658
- },
659
- {
660
- name: 'Skip settings configuration (I\'ll configure manually later)\n',
661
- value: 'skip'
662
- }
663
- ],
664
- default: 'defaults'
665
- }
666
- ]);
639
+ // Use pre-configured settings if provided, otherwise prompt
640
+ let configChoice;
641
+ if (preConfiguredSettings && preConfiguredSettings.configChoice) {
642
+ configChoice = preConfiguredSettings.configChoice;
643
+ console.log(chalk.dim(`Using pre-configured GitHub Copilot settings: ${configChoice}`));
644
+ } else {
645
+ // Clear any previous output and add spacing to avoid conflicts with loaders
646
+ console.log('\n'.repeat(2));
647
+ console.log(chalk.blue("🔧 Github Copilot Agent Settings Configuration"));
648
+ console.log(chalk.dim("BMad works best with specific VS Code settings for optimal agent experience."));
649
+ console.log(''); // Add extra spacing
650
+
651
+ const response = await inquirer.prompt([
652
+ {
653
+ type: 'list',
654
+ name: 'configChoice',
655
+ message: chalk.yellow('How would you like to configure GitHub Copilot settings?'),
656
+ choices: [
657
+ {
658
+ name: 'Use recommended defaults (fastest setup)',
659
+ value: 'defaults'
660
+ },
661
+ {
662
+ name: 'Configure each setting manually (customize to your preferences)',
663
+ value: 'manual'
664
+ },
665
+ {
666
+ name: 'Skip settings configuration (I\'ll configure manually later)',
667
+ value: 'skip'
668
+ }
669
+ ],
670
+ default: 'defaults'
671
+ }
672
+ ]);
673
+ configChoice = response.configChoice;
674
+ }
667
675
 
668
676
  let bmadSettings = {};
669
677