Conversation
…Files Simplify deleteOldAgentFiles() by replacing two separate loops with a unified map-based approach that handles both .github/agents/ and .github/aw/ file deletions. Changes: - Introduced filesToDelete map to group files by subdirectory - Eliminated duplicated file deletion logic - Maintained all functionality and error handling - Preserved verbose output behavior Benefits: - Reduced code complexity (51 lines → 39 lines) - Easier to maintain and extend - Clearer structure with explicit subdirectory mapping
pelikhan
approved these changes
Jan 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code Simplification - 2026-01-24
This PR simplifies recently modified code from PR #11654 to improve clarity and maintainability while preserving all functionality.
Files Simplified
pkg/cli/copilot-agents.go- Consolidated duplicate file deletion logic into a unified map-based approachImprovements Made
1. Reduced Complexity
.github/agents/files, one for.github/aw/files) with a single map-based approach2. Enhanced Clarity
filesToDeletemap that explicitly groups files by subdirectory3. Applied Project Standards
fmt.ErrorfChanges Based On
Recent changes from:
Code Comparison
Before (51 lines with duplication):
After (39 lines, no duplication):
Testing
Please verify after merge:
Review Focus
Please verify:
Benefits
This refactoring:
References: