Commit 17bfab2
Refactor: Maximize self-documentation through comprehensive code modernization
This refactor dramatically improves code clarity, maintainability, and self-documentation
by eliminating boilerplate, removing redundancy, and restructuring logic for transparency.
### New Utility Classes
- **Guard.cs**: Centralized parameter validation eliminating 30+ lines of boilerplate
- **GitHelper.cs**: Unified Git repository detection (eliminates 2 duplicate implementations)
### New Service Classes (Extracted from Program.cs)
- **AppConfig.cs**: Application configuration record (moved to Configuration/)
- **ConfigLoader.cs**: JSON configuration loading with error handling
- **OutputFormatter.cs**: File output with multiple format support
- **StatsCalculator.cs**: Processing statistics calculation
- **PathResolver.cs**: Path validation and user input handling
- **ContentBuilder.cs**: Project content assembly orchestration
### Code Improvements
- **Program.cs**: Reduced from 268 to 71 lines (-73%) with pure DI orchestration
- **ProjectScanner.cs**: Uses Guard and GitHelper, improved naming (path → projectPath)
- **FileFilterService.cs**: Uses Guard and GitHelper, removed duplicate FindGitRepoRoot
- **FileUtilities.cs**: Uses Guard for validation
### Deleted Deprecated Classes
- Removed MyAppsContext.cs (obsolete facade)
- Removed FileChecker.cs (obsolete facade)
- Removed FileUtils.cs (obsolete facade)
### Self-Documentation Improvements
- Consistent parameter naming (projectPath vs path/rootPath)
- Clear variable names (structure, fileContents vs sb, results)
- Expressive method extraction (single responsibility)
- Pure dependency injection (no static facades)
- Obvious data flow through constructor injection
### Impact
- 8 new focused classes with single responsibilities
- Eliminated all validation boilerplate through Guard
- Removed all code duplication (Git helpers, validation)
- Program.cs is now pure orchestration (73% reduction)
- Clear, testable, maintainable architecture
- Zero functional changes - backward compatible1 parent 812b957 commit 17bfab2
15 files changed
Lines changed: 475 additions & 453 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments