Context
Introduce shared scanner contracts in the core package so downstream packages can align on one result shape and reuse allocation-aware helper paths.
Scope
- Add shared
ScanInput, ScanHints, TextRange, and ScanResult contracts.
- Add shared helper flows for
check, scan, and censor with avoidable allocations minimized.
- Preserve the existing public API through backward-compatible wrappers or aliases where needed.
- Keep package implementation contained in this package; do not move downstream scanner logic here.
Acceptance Criteria
- Existing public API remains backward compatible.
- New contracts are exported and documented through the package's existing public surface conventions.
- Shared helpers can support early-exit
check, full scan, and censor use cases.
- Tests cover compatibility and the new shared contract/helper behavior.
- Benchmark evidence demonstrates the allocation-aware path does not regress the relevant baseline.
Validation
npm ci
npm run check
- Relevant unit/regression tests
- Relevant benchmarks
npm pack --dry-run
Compatibility Notes
This should be a backward-compatible additive change unless implementation discovers an existing contract conflict that needs an explicit note before PR review.
Context
Introduce shared scanner contracts in the core package so downstream packages can align on one result shape and reuse allocation-aware helper paths.
Scope
ScanInput,ScanHints,TextRange, andScanResultcontracts.check,scan, andcensorwith avoidable allocations minimized.Acceptance Criteria
check, fullscan, andcensoruse cases.Validation
npm cinpm run checknpm pack --dry-runCompatibility Notes
This should be a backward-compatible additive change unless implementation discovers an existing contract conflict that needs an explicit note before PR review.