Commit 7393560
Implement comprehensive file watching functionality for validate and format commands:
Features:
- --watch flag for validate and format commands
- File system monitoring with fsnotify library
- Debouncing (500ms default) to prevent rapid re-runs
- Colored terminal output (green/red/yellow/cyan)
- Graceful shutdown with Ctrl+C handling
- Support for files, directories, and glob patterns
- Recursive directory watching
- Clear screen option for watch mode
- Cross-platform compatibility (macOS, Linux, Windows)
Implementation Details:
- New watch.go with FileWatcher struct and helper functions
- Watch mode integrated into validate and format commands
- Race-free implementation validated with go test -race
- Proper resource cleanup with defer patterns
- Atomic operations for debounce map management
Testing:
- Unit tests for watch functionality
- Integration tests for real-world scenarios
- Race detection tests passing
- Cross-platform file watching verified
Documentation:
- Updated help text with watch mode examples
- CLI flags with descriptions
- Watch mode usage patterns documented
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini.local>
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 73d5a52 commit 7393560
3 files changed
Lines changed: 410 additions & 0 deletions
0 commit comments