test(cmd): add unit and integration tests for state machine
Unit tests (76 tests, tests/unit/cmd-state-machine.test.js):
- State enum completeness and immutability
- All state transitions: IDLE, TYPING, RESULTS_OPEN, PARAM_MODE,
EXECUTING, OUTPUT_SELECTION, CHAIN_MODE, ERROR, CLOSING
- Guard evaluation and transition selection
- Escape layering: param -> typing -> idle -> closing
- IZUI handleEscape returns correct handled flag
- Invariant enforcement: index bounds, mutual exclusivity
- Machine reset clears all state
- Edge cases: rapid typing, unknown events, panel re-show
Playwright integration tests (tests/desktop/cmd-state-machine.spec.ts):
- IDLE -> TYPING on character input
- TYPING -> RESULTS_OPEN on ArrowDown
- TYPING -> PARAM_MODE on command+space
- TYPING -> EXECUTING on Enter with committed command
- Escape layering full sequence
- Double Enter blocked by executing guard
- Panel re-show resets state
- Backward-compatible _cmdState proxy
- Basic command execution flow
- Tab completion enters param mode
- URL opening
- Click on result executes via dispatch