fix(copilot): bound agent CLI grep matching

Merged
WA
1mo ago
+120-14

Summary

  • Use the shared linear-time regex helper for agent CLI grep, with literal matching for unsupported patterns.
  • Yield during scans and enforce a five-second scan budget after resource reads so searches can be cancelled and incomplete counts are not reported as complete.
  • Bound context collection to the remaining output limit, skip overlapping windows, and reuse match results when rendering output.

Type of Change

  • Bug fix

Testing

  • 236 tests across universal-grep.test.ts, linear-regex.test.ts, and operations.test.ts.
  • Four regressions verified against the original code and by independently removing each guard.
  • Context-window regression verifies a dense file completes within the scan budget while preserving output ordering and the full match count.
  • App type-check, lint, block-registry check, check:audits, and docs-manifest check.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)