Skip to content

Add allocation-aware scanner contracts and shared text hints #38

Description

@alyldas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions