303 lines
8.5 KiB
Markdown
303 lines
8.5 KiB
Markdown
# PR #777 Implementation Plan
|
||
|
||
**PR**: [#777 - Fix Issue #505: Add 'new' tool to GitHub Copilot chatmodes](https://github.com/bmad-code-org/BMAD-METHOD/pull/777)
|
||
**Author**: jhaindev
|
||
**Status**: Planning Phase
|
||
**Date**: October 26, 2025
|
||
|
||
## Overview
|
||
|
||
This PR fixes Issue #505 by adding the 'new' tool to the GitHub Copilot chatmode configuration. This enables BMAD agents to create new files when using custom chat modes in GitHub Copilot.
|
||
|
||
## Problem Statement
|
||
|
||
**Issue #505**: Agents cannot create new files using GitHub Copilot custom chat modes. While the 'editFiles' tool allows editing existing files, it cannot create non-existent files. The 'new' tool is required for full file creation capability.
|
||
|
||
**Impact**:
|
||
|
||
- Analyst agent and other BMAD agents cannot create new files via chat commands
|
||
- Commands like `*create-project-brief` fail to generate new files
|
||
- Users must manually create files before agents can work with them
|
||
|
||
**Root Cause**: The 'new' tool is missing from the tools array in the GitHub Copilot chatmode configuration.
|
||
|
||
## Solution Overview
|
||
|
||
Add the 'new' tool to the tools array in the GitHub Copilot chatmode configuration file.
|
||
|
||
**Location**: `tools/installer/lib/ide-setup.js` (line 2179)
|
||
|
||
**Change Type**: Single-line addition (additive, no breaking changes)
|
||
|
||
**Scope**: Minimal - only adds 'new' to existing tools array
|
||
|
||
## Files to Modify
|
||
|
||
### 1. tools/installer/lib/ide-setup.js
|
||
|
||
**Current State** (line 2179):
|
||
|
||
```javascript
|
||
tools: [
|
||
'changes',
|
||
'codebase',
|
||
'fetch',
|
||
'findTestFiles',
|
||
'githubRepo',
|
||
'problems',
|
||
'usages',
|
||
'editFiles',
|
||
'runCommands',
|
||
'runTasks',
|
||
'runTests',
|
||
'search',
|
||
'searchResults',
|
||
'terminalLastCommand',
|
||
'terminalSelection',
|
||
'testFailure',
|
||
];
|
||
```
|
||
|
||
**Required Change**:
|
||
Add 'new' tool after 'editFiles' to maintain consistent pattern
|
||
|
||
**Target State** (line 2179):
|
||
|
||
```javascript
|
||
tools: [
|
||
'changes',
|
||
'codebase',
|
||
'fetch',
|
||
'findTestFiles',
|
||
'githubRepo',
|
||
'problems',
|
||
'usages',
|
||
'editFiles',
|
||
'new',
|
||
'runCommands',
|
||
'runTasks',
|
||
'runTests',
|
||
'search',
|
||
'searchResults',
|
||
'terminalLastCommand',
|
||
'terminalSelection',
|
||
'testFailure',
|
||
];
|
||
```
|
||
|
||
**Change Details**:
|
||
|
||
- Insert: `'new', ` after `'editFiles', ` on line 2179
|
||
- Additions: 1 line (6 characters + comma + space)
|
||
- Deletions: 0 lines
|
||
- Pattern: Maintains existing structure from PR #324
|
||
|
||
## Implementation Strategy
|
||
|
||
### Phase 1: File Modification (5 minutes)
|
||
|
||
1. Make the single-line change to add 'new' to the tools array
|
||
2. Verify syntax is correct
|
||
3. Confirm file saves properly
|
||
|
||
### Phase 2: Validation (10 minutes)
|
||
|
||
1. Run npm validate to check configuration
|
||
2. Run npm lint to check for linting errors
|
||
3. Verify installer can be executed
|
||
4. Check that chatmode files are properly generated with 'new' tool
|
||
|
||
### Phase 3: Testing (15 minutes)
|
||
|
||
1. Execute installer to generate chatmode files
|
||
2. Verify chatmode files include 'new' in tools array
|
||
3. Verify all 10 agent chatmodes have 'new' tool
|
||
4. Check for any warnings or errors
|
||
|
||
### Phase 4: Documentation (10 minutes)
|
||
|
||
1. Create comprehensive test results documentation
|
||
2. Document validation results
|
||
3. Generate git diff
|
||
4. Create implementation summary
|
||
|
||
### Phase 5: Git Operations (5 minutes)
|
||
|
||
1. Commit changes with detailed message
|
||
2. Verify commit on feature branch
|
||
3. Prepare for GitHub integration
|
||
|
||
## Research Evidence (from PR Description)
|
||
|
||
**Microsoft Documentation**:
|
||
|
||
- Issue #12568 (vscode-copilot-release): 'new' identified as distinct tool for file creation
|
||
- Issue #10253: Documents 'editFiles' limitation with non-existent files
|
||
- Fixed in Copilot extension v0.28.2025052204+
|
||
|
||
**Pattern Reference**:
|
||
|
||
- PR #324 established pattern for GitHub Copilot tool configurations
|
||
- This change follows the same additive pattern
|
||
|
||
## Expected Behavior After Fix
|
||
|
||
### Before Fix
|
||
|
||
- ❌ Agent requests to create files fail
|
||
- ❌ 'new' tool not available in chat mode
|
||
- ❌ Only 'editFiles' available (limited to existing files)
|
||
|
||
### After Fix
|
||
|
||
- ✅ Agent can create new files
|
||
- ✅ 'new' tool available in all agent chat modes
|
||
- ✅ Commands like `*create-project-brief` successfully generate files
|
||
- ✅ All 10 agents have 'new' capability
|
||
|
||
## Test Plan
|
||
|
||
### Test 1: Configuration Validation
|
||
|
||
- **Objective**: Verify the change doesn't break configuration parsing
|
||
- **Method**: Run npm validate
|
||
- **Expected Result**: All configurations valid, no errors
|
||
|
||
### Test 2: Linting Check
|
||
|
||
- **Objective**: Ensure no new linting errors introduced
|
||
- **Method**: Run npm lint
|
||
- **Expected Result**: No new linting issues
|
||
|
||
### Test 3: Installer Execution
|
||
|
||
- **Objective**: Verify installer can generate chatmode files with 'new' tool
|
||
- **Method**: Execute installer to generate chatmodes
|
||
- **Expected Result**: Chatmode files created successfully with 'new' in tools array
|
||
|
||
### Test 4: Chatmode Generation
|
||
|
||
- **Objective**: Verify all agent chatmodes include 'new' tool
|
||
- **Method**: Inspect generated `.github/chatmodes/*.chatmode.md` files
|
||
- **Expected Result**: All 10 agents have 'new' in tools array
|
||
|
||
### Test 5: Pattern Verification
|
||
|
||
- **Objective**: Ensure 'new' is positioned correctly in tools array
|
||
- **Method**: Verify 'new' appears after 'editFiles'
|
||
- **Expected Result**: Tools array has correct order and structure
|
||
|
||
## Success Criteria
|
||
|
||
✅ Single-line change applied correctly
|
||
✅ npm validate passes - no errors
|
||
✅ npm lint passes - no new errors
|
||
✅ Installer executes successfully
|
||
✅ All chatmode files generated with 'new' tool
|
||
✅ All 10 agents have 'new' capability
|
||
✅ No regressions to existing functionality
|
||
✅ Pattern matches PR #324 precedent
|
||
✅ Fixes Issue #505 completely
|
||
|
||
## Git Commit Message
|
||
|
||
```
|
||
fix(github-copilot): add 'new' tool to chatmode configuration for file creation
|
||
|
||
- Add 'new' tool to tools array in GitHub Copilot chatmode config
|
||
- Enables BMAD agents to create new files via chat commands
|
||
- Positioned after 'editFiles' to maintain consistent pattern
|
||
- Complements existing file editing capability
|
||
- Fixes Issue #505: Analyst agent cannot create files
|
||
|
||
This change follows the pattern established in PR #324 and aligns with
|
||
Microsoft's GitHub Copilot extension documentation for file creation
|
||
capabilities. The 'new' tool is essential for agents to create
|
||
non-existent files when using custom chat modes.
|
||
|
||
Fixes #505
|
||
```
|
||
|
||
## Affected Components
|
||
|
||
**Direct Impact**:
|
||
|
||
- GitHub Copilot chatmode tool configuration
|
||
- All 10 BMAD agent chatmodes
|
||
- Installer's IDE setup module
|
||
|
||
**Indirect Impact**:
|
||
|
||
- File creation commands in agents
|
||
- Chat mode initialization
|
||
- User experience with file creation tasks
|
||
|
||
**No Impact**:
|
||
|
||
- Core agent definitions
|
||
- Task definitions
|
||
- Team configurations
|
||
- Other IDE integrations (VS Code settings, Cursor, Kiro)
|
||
|
||
## Risks & Mitigations
|
||
|
||
| Risk | Probability | Impact | Mitigation |
|
||
| ------------------------------ | ----------- | ------ | ---------------------------------- |
|
||
| Tool not recognized by Copilot | Low | High | Verified in latest Copilot version |
|
||
| Breaking existing behavior | Very Low | Medium | Additive only, no removals |
|
||
| Configuration parsing error | Very Low | High | npm validate verification |
|
||
| Linting failure | Low | Low | npm lint verification |
|
||
|
||
## Dependencies
|
||
|
||
**Version Requirements**:
|
||
|
||
- VS Code: Latest with GitHub Copilot extension (v1.x+)
|
||
- GitHub Copilot: v0.28.2025052204+ (has 'new' tool)
|
||
- Node.js: v18+ (existing requirement)
|
||
|
||
**External Dependencies**: None new
|
||
|
||
## Rollback Plan
|
||
|
||
If issues arise:
|
||
|
||
1. Remove 'new' from tools array on line 2179
|
||
2. Regenerate chatmode files via installer
|
||
3. Revert git commit if needed
|
||
|
||
**Estimated Rollback Time**: < 2 minutes
|
||
|
||
## Next Steps After Implementation
|
||
|
||
1. ✅ Implement the single-line change
|
||
2. ✅ Run all validations and tests
|
||
3. ✅ Generate comprehensive documentation
|
||
4. ✅ Create git commit
|
||
5. ⏭️ Post implementation comment on GitHub
|
||
6. ⏭️ Request review from maintainers
|
||
7. ⏭️ Merge to v6-alpha branch when approved
|
||
|
||
## Implementation Checklist
|
||
|
||
- [ ] Apply single-line change to ide-setup.js
|
||
- [ ] Verify syntax correctness
|
||
- [ ] Run npm validate
|
||
- [ ] Run npm lint
|
||
- [ ] Execute installer successfully
|
||
- [ ] Verify chatmode files generated correctly
|
||
- [ ] Check all 10 agents have 'new' tool
|
||
- [ ] Create test results documentation
|
||
- [ ] Generate git diff
|
||
- [ ] Commit changes
|
||
- [ ] Verify feature branch
|
||
- [ ] Post GitHub comment
|
||
- [ ] Ready for merge
|
||
|
||
---
|
||
|
||
**Implementation Status**: Planning Complete - Ready to Execute
|
||
**Estimated Total Time**: 45 minutes
|
||
**Complexity**: Very Low (single-line change)
|
||
**Risk Level**: Very Low (additive, no breaking changes)
|