- Fix import order issues across multiple files
- Remove unused imports (loadAuthConfig, ValidationOptions)
- Add proper import group separations
- All lint checks and tests now pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Replaces scattered ad-hoc validation with a centralized, testable validation
system. Provides consistent error messages and comprehensive coverage of
flag combinations and edge cases.
Changes:
- Add flagValidator module with comprehensive validation functions
- Test coverage for all validation scenarios (17 tests)
- Replace scattered validation in index.ts with centralized validateFlags()
- Validate flag dependencies (--format/--silent require -p)
- Validate conflicting flags (--readonly vs --auto)
- Validate permission flag values (no empty tool names)
- Consistent error formatting and exit handling
All existing validation behavior preserved while adding new validations
for edge cases like empty permission tool names.
Extract common flag processing logic from TUI and headless code paths into
shared flagProcessor module. This eliminates code duplication where both
paths independently converted readonly/auto flags to mode and structured
permission overrides.
Changes:
- Add src/flags/flagProcessor.ts with shared flag processing functions
- Replace duplicated logic in chat.ts (lines 168-173 and 259-264)
- Add comprehensive unit tests for all flag processing scenarios
- Add validation for conflicting --readonly and --auto flags
This is a pure refactor with no behavior changes. All existing functionality
preserved while eliminating 20+ lines of duplicated code.