Commit graph

4 commits

Author SHA1 Message Date
Tomasz Stefaniak
fda6c3b508 fix: formatting 2025-08-08 13:05:40 -07:00
Patrick Erichsen
9218172625 fix: resolve remaining ESLint issues in audit-command-line-flags
- 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>
2025-08-05 16:33:27 -07:00
Chad Metcalf
7fea7fb369
feat: add comprehensive centralized command line flag validation
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.
2025-08-03 15:34:21 -07:00
Chad Metcalf
f1961e7e54
refactor: extract shared flag processing logic to eliminate duplication
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.
2025-08-03 15:14:54 -07:00