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.