Rank a project's files by risk
scan_projectRank JavaScript and TypeScript files in a directory by risk density to identify failure-prone code before review. Excludes test files by default; choose includeTests to rank them as well.
Instructions
Walk a directory and rank its JavaScript/TypeScript files by risk density — how concentrated the failure-prone code is, not how big the file is. Test files are left out by default; pass includeTests to rank them too. Deterministic and fast — no model call. Call this at the start of a code review to decide which files are worth your attention, instead of reading the tree in arbitrary order.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of files to return (default 50) | |
| verbose | No | Include the raw metric counts for every file (default false) | |
| directory | Yes | Absolute path to the directory to scan | |
| includeTests | No | Rank test files too — *.spec.*, *.test.*, and anything under __tests__/test/tests/spec/__mocks__ (default false). They rank high for a structural reason rather than a real one: mocked awaits read as async complexity. Turn this on to audit a suite's own complexity. |