Problem
src/daemon/selectors.ts is currently ~540 LOC and combines selector parsing/tokenization, matching/resolution, disambiguation scoring, and selector-chain generation.
Goal
Decompose selector system internals into focused modules while preserving selector DSL behavior.
Proposed split
src/daemon/selectors-parse.ts
- parse/tokenize/unquote/boolean parsing
src/daemon/selectors-match.ts
- selector and term matching primitives
src/daemon/selectors-resolve.ts
- fallback chain resolution + disambiguation scoring
src/daemon/selectors-build.ts
- selector-chain generation for replay/action recording
- Keep
src/daemon/selectors.ts as thin public facade.
Acceptance criteria
- No selector DSL behavior changes.
- Existing exports keep signatures and semantics.
- New modules target <=300 LOC where practical.
- Existing selector + replay-heal tests pass unchanged.
Validation
pnpm typecheck
pnpm test:unit
pnpm test:smoke
Problem
src/daemon/selectors.tsis currently ~540 LOC and combines selector parsing/tokenization, matching/resolution, disambiguation scoring, and selector-chain generation.Goal
Decompose selector system internals into focused modules while preserving selector DSL behavior.
Proposed split
src/daemon/selectors-parse.tssrc/daemon/selectors-match.tssrc/daemon/selectors-resolve.tssrc/daemon/selectors-build.tssrc/daemon/selectors.tsas thin public facade.Acceptance criteria
Validation
pnpm typecheckpnpm test:unitpnpm test:smoke