The no-mistakes npm package exposes async functions backed by the same Rust
analysis as the CLI. Use it for repeated structured queries without subprocess overhead.
When baselineRatchet is configured,
check() and check reports from analyzeProject() include
CheckReport.baselineRatchet. The async writeCheckBaseline(options) function
creates or prunes the configured baseline and returns the resulting check
report. The exported CheckBaselineReport contains per-kind counts and sites.
A stale CheckBaselineEntry can carry opaque analysisProfiles identifiers
from the baseline file.
For CI gating in Node, check the lengths of new and stale alongside the
other failing check channels.
The opt-in complexity rule runs through async check()
and analyzeProject() check reports, sharing the CLI's single-parse TS/JS
walk, Rust syn walk, per-folder thresholds, baselineFile/exceptions
ratchet, and countOptionalChaining toggle. Call async complexity(options)
(complexityJson) to retrieve raw per-function ComplexityReport metrics
directly; ComplexityRuleOptions, ComplexityFolderThreshold,
ComplexityBaselineEntry, ComplexityBaseline, ComplexityOptions,
ComplexityReport, FunctionComplexity, and ComplexityUnanalyzableFile are
exported from no-mistakes.
The opt-in coverage-patch rule runs through async
check() and analyzeProject() with the same diff and LCOV inputs as the CLI.
The package exports CoveragePatchRuleOptions. Each failing finding is one
per file and carries RuleFinding.uncoveredLines, the sorted line numbers of
every uncovered changed line; line stays the first of them. The CLI's
check --format github is a rendering of this report, so the Node equivalent is
the structured rules array rather than a separate option.
The opt-in github-actions-runner-policy
runs through async check() and analyzeProject(). The package exports
GithubActionsRunnerPolicyOptions and GithubActionsRunnerLabelRestriction
for typed rule configuration.
The opt-in crap rule uses the same LCOV inputs and score
limits in CLI check, async Node check(), and analyzeProject().
The package exports CrapRuleOptions, CrapScope, and CrapUnknownCoverage.
duplication also runs in async check reports. The package exports its rule options.
With includeSqlVerdicts: true, async check() and the check reports in
analyzeProject() expose sqlSkippedStatements when the SQL verdict ledger
contains unresolved executor sites. The counts match
the CLI report.
The opt-in postgres-explain-write-rollback
rule uses the same YAML configuration and report fields in CLI check,
Node check(), and analyzeProject() check reports.
PostgresExplainWriteRollbackOptions names its YAML options.
postgres-catalog-counts uses the configured
catalog and baseline file in async check() and analyzeProject() check reports.
Use the exported PostgresCatalogCountsOptions type to author rule options.
The opt-in postgres-lock-reason rule also
runs through CLI check, Node check(), and analyzeProject() check reports
with PostgresLockReasonOptions describing its YAML options. It defaults to
severity: advisory and shares the prepared lock-site projection with
postgres-lock-inventory.
Configured postgres-lock-written-rows-only
accepts optional schemaCatalogPath through PostgresLockWrittenRowsOnlyOptions.
Async check() and analyzeProject() check reports use the same prepared catalog
for DDL relationships and, with complete coverage, the same event-filtered trigger
write effects as CLI check, including UPDATE OF columns and bounded transitive
chains. Configure the catalog path in the rule's
YAML options; the existing async checkJson binding and report shape are unchanged.
The PostgresCatalogCountSqlShape type names the SQL shape selectors
available through configured postgres-catalog-counts checks.
Configured postgres-sql-statement-policy
runs through async check({ root, config }) and analyzeProject() check reports.
Omitting options.bannedStatements uses the seven default statement kinds;
an explicit empty array bans no statement kinds. bannedSettings and
bannedClauses apply independently. PostgresSqlStatementPolicyOptions describes
the YAML rule options, including the values of PostgresSqlStatementPolicyClause
accepted by bannedClauses. Set these options in the configuration file selected
by config. The same type exposes singleStatementTransactions and
planEvidence for standalone SQL files.
check() and check reports in analyzeProject() share the CLI's
integration annotation discovery scope.
Explicit integration-policy includes/excludes narrow test discovery while
retaining imported helper summaries and parse diagnostics. This preparation
change adds no invocation option, runtime export, or report field.
Configured github-actions-cache-setup-policy uses the same authored key
patterns, setup deadline caps, and unanalyzable policy in check() and
analyzeProject(). Rule options
ciTopology() reports unlocated-yaml-merge when a YAML merge key cannot
be matched to its location in the source. Workflow and structured-config
checks route the uncertainty through their configured policy and retain
independently verified findings in check().
CLI diagnostic
Configured workflow-topology-policy.options.forbiddenActivityTypes runs through
async check({ root, config }) and analyzeProject() check reports with the same
exact matching, event filtering, types key locations, custom messages, and
suppressions as CLI check. Configure it in the YAML selected by config;
there is no additional runtime export or invocation option. The existing
check → checkJson binding carries this rule. See
activity type configuration.
Configured workflow-topology-policy.options.forbidReusableWorkflowConcurrency
also runs through async check({ root, config }) and analyzeProject() check
reports. It shares CLI findings and suppression at the workflow-level
concurrency key. The exported WorkflowTopologyPolicyOptions type describes
these YAML options; configure them in the file selected by config. See the
reusable workflow concurrency policy.
Configured workflow-topology-policy.options.forbiddenEvents and
forbidSecretsInherit also run through async check({ root, config }) and
analyzeProject() check reports. Event bans use the same exact matching and
on locations as CLI check. The secrets ban reports the same secrets key.
Configure both in the YAML selected by config; there is no additional runtime
export or invocation option. See
forbidden events
and
secrets inherit.
check({ root, config }) and { type: "check", config } reports in
analyzeProject() honor the same forbidden-dependencies glob roots, root
exclusions and per-root file exceptions as the CLI. Configure them in the YAML
file selected by config; the exported ForbiddenDependenciesOptions and
ForbiddenDependencyException types describe these rule options. Dependency
resolution and transitive paths use the shared canonical graph. See the
rule's glob and exception contract.
check() and check reports in analyzeProject() apply the shared
unanalyzable policy to github-actions-checkout-credentials: unknown
persistence or permissions, custom tokens, and malformed YAML report by
default, advise without failing, or are ignored. Both APIs share suppression
and source locations with the CLI. Reusable-workflow literal permissions are
known upper bounds; unsafe write bounds remain findings under all policies,
with job permissions taking precedence over workflow defaults. Only checkout
steps are judged, so a valid pull_request_target workflow without checkout
stays clean.
pull_request_target also checks PR-head refs independently of persistence;
unresolved refs/repositories use the shared policy. Configure the optional
defaultBranch convention in the YAML file selected by config, not as a
check() argument. The Node/N-API signature and report types are unchanged. A checkout
can have separate credential and ref rows. See the
rule contract.
Configured container-image-policy findings and advisories also appear in the async check() and analyzeProject() check reports with the same suppression and options.unanalyzable behavior as CLI check. The package exports ContainerImagePolicyOptions for typed configuration.
Configured github-actions-reusable-workflow-permissions findings also appear in the check() report.
Configured github-actions-runner-policy findings and unanalyzable advisories also appear in the check() and analyzeProject() check reports without changing the Node/N-API signature.
The configured github-actions-job-permissions
rule also runs through the existing asynchronous check() and
analyzeProject() check-report APIs, with the same findings, advisories, and
suppression behavior as CLI check. Its unresolved permission declarations
use the shared unanalyzable policy; definite inherited write grants remain
findings under every policy. The rule adds no function, option, or report
type, so check() remains the runtime entrypoint.
no-single-enqueue-in-loop accepts singleExportPattern, bulkExportPattern,
and moduleGlobs in the YAML rule options loaded by async check({ root, config })
and analyzeProject() check reports. CLI and Node share the prepared call graph
and pattern selection. The exported NoSingleEnqueueInLoopOptions and
NoSingleEnqueueInLoopTarget describe the pattern and explicit-target options;
the runtime entrypoints and report fields are unchanged. See the
target selection contract.
The postgres-bounded-statements application accepts named catalog evidence
through PostgresColumnBoundEvidence and can report reason-only declarations
with reportUnverifiedColumnBounds.
Column bounds
postgres-table-shape accepts matchColumns,
commentReasonTokens, matchDefaultOnlyRangePartition, and reportDuplicateColumnSets in the config loaded by asynchronous check() and
analyzeProject() check reports. The package exports PostgresTableShapeOptions
and PostgresTableShape for consumers authoring these configurations.
The options support sqlInclude, reportUnreferencedObjects, and reportWriteOnlyColumns for catalog usage checks.
The options support reportDiscriminantTriggers for single-lookup parent guards.
The options support reportDuplicateCountOwners for advisory review of stored counts that a catalog view also computes.
queue-rate-limit-error-delay runs through async check({ root, config }) and
analyzeProject() check reports with the same findings, advisories,
unanalyzable routing, and suppression behavior as CLI check. Exported
QueueRateLimitErrorDelayOptions and QueueRateLimitErrorDelayTarget describe
its YAML rule options; the runtime entrypoints and report fields are unchanged.
See the rule contract.
Configured queue-no-enqueue-in-transaction
runs through asynchronous check({ root, config }) and analyzeProject() check
reports using the same RuleFinding as CLI check.
The exported QueueNoEnqueueInTransactionOptions,
QueueNoEnqueueInTransactionBoundary, QueueNoEnqueueInTransactionBegin, and
QueueNoEnqueueInTransactionPublisher describe the YAML rule options, including
optional unanalyzable (report, advise, or ignore).
query-reached-per-item accepts exemptCappedCursorPageReads and languages
in the rule's YAML options, selected by check({ root, config }) or an
analyzeProject() check report. exemptCappedCursorPageReads defaults to
false. languages lists shipped frontends (python, go, rust, rails,
php, java, kotlin, elixir, dart, swift, dotnet) that share that
check report; it defaults to empty, so TypeScript behavior is unchanged. There
is no new binding. The exported QueryReachedPerItemOptions and
QueryReachedPerItemAllowEntry describe that configuration; the async runtime
entrypoints and report fields are unchanged.
Allow entries accept an optional function string to match the exact enclosing
caller name, combined with any callee and line selectors. File-only entries
retain their behavior, including unused-entry reporting.
See the cursor exemption contract.
GithubActionsActionTimeoutPairOptions describes the YAML options for
github-actions-action-timeout-pair.
Pass the YAML path in config for async check() (checkJson) or an
analyzeProject() check report. Both use the CLI's nestedBelowStepTimeout
comparison and unanalyzable policy.
const { analyzeProject } = require("no-mistakes");
(async () => {
console.log(await analyzeProject({ root: process.cwd(), reports: [{ type: "check" }] }));
})();- Getting started
- PostgreSQL executor extraction
- Local
constwrappers that directly forward their parameters to a configured PostgreSQL executor are resolved bycheck(),analyzeProject(), andextractExecutedPostgresSql()using the shared executor binding proof. - Check SQL verdicts: per-obligation proof ledger and residual advice grouped per executor call/application
- PostgreSQL catalog generation
- Planning and graph APIs
- Test selection and analysis scope
- Resolution and workflow APIs
- Invocation Lock And Timeouts
- Agent Defaults
- Selected TypeScript and JavaScript module facts
- Declared runner config deadlines
- Live phase progress
- Effect alternatives: retained possible receiver targets and physical call matches
check() and { type: "check" } reports from analyzeProject() include an
optional CheckReport.incomplete array when a requested consumer cannot finish
because a prerequisite failed. Each exported CheckFailure identifies the
consumer (a rule identifier, configured trait, or check domain), optional source file and
configuration property, and diagnostic message. Successful consumers still
return their findings. These failures are neither findings nor advisories and
cannot be suppressed. The field is omitted when no prerequisite failures were
captured; its absence does not mean arbitrary dynamic JavaScript configuration
was evaluated. These isolated source or configuration failures resolve to the
partial report rather than rejecting the API call. Global invocation or
configuration errors that make the request unusable still reject the API call.
The CLI reports incomplete consumers and exits 1 for the same isolated
failures. Prerequisites follow each consumer's source and configuration input
selection, independently of other enabled rules. Binary assets, directories, and
dangling links outside that selection do not make a consumer incomplete. A required
source that fails to read or parse still names that consumer and input.
The cache-key policy, action input policy, required PR path-filter rule, and
Vitest default exclusion rule validate their options before analysis; invalid
options reject check() and analyzeProject() with the same sorted
configuration error message printed by the CLI (exit 2, empty stdout, no
incomplete entry). See rule configuration.
An unwinding panic during per-file fact extraction uses the same existing
CheckFailure shape with consumer fact-extraction, the file, and the panic
message. check() and check reports in analyzeProject() resolve with that
incomplete entry and independent findings; facts from the failed file are
discarded. The async bindings and exported types are unchanged. Other analysis
phases and process aborts remain outside this recovery boundary.
Per-file foreign receiver work-budget exhaustion uses the same incomplete
contract, with the affected file and an actionable message. check() and
analyzeProject() discard partial value-flow facts and preserve independent
source-check findings. Mixing a check with import-only dependency or dependent
reports preserves each standalone result, including partial check findings.
Import-only forbidden-dependencies checks retain their findings; repeated
partial checks share the complete canonical import projection.
Narrow root or simplify shared receiver mutations;
application include/exclude filters do not narrow the full graph evidence.
Reverse-query diagnostics classify exhausted value flow as operational-error.
Vitest config failures identify the config file and property (for example,
test.include), with the source line in the message.
postgres-materialized-view-shape runs through
the existing async check() → checkJson binding and analyzeProject() check
reports. The rule uses the shared application severity: the default error
fails the check, while severity: advisory returns non-failing advisories.
The package exports PostgresMaterializedViewShapeOptions,
PostgresMaterializedViewBaseTableAllowance, and
PostgresMaterializedViewShapeAllowEntry; configure them under rule options
in the YAML selected by config. No separate runtime export is needed.
A rule application with severity: advisory (see
rule applications) moves that rule's
findings from CheckReport.rules and CheckReport.codebase to
CheckReport.advisories in check() and analyzeProject(). The finding shape
is unchanged; only the list, and therefore the failure decision, differs.
check() and analyzeProject() reports with type: "check" audit unused
no-mistakes disable comments using the selected configuration's
reportUnusedDisableDirectives setting. The default advise puts
unused-disable-directive and invalid-disable-directive diagnostics in
CheckReport.advisories. The report mode puts them in CheckReport.rules.
The ignore mode keeps unknown rule IDs in CheckReport.advisories and omits
other hygiene diagnostics. Locations refer to the comment. Unknown and disabled
rule IDs have distinct messages. includeSuppressed controls only the optional
ledger of hidden findings. See suppression hygiene.
check() and analyzeProject() check reports include optional
CheckReport.acceptedBounds (AcceptedStatementBound[]) when a
no-mistakes-bound declaration suppresses postgres-bounded-statements for one
statement. Each entry has rule, file, line (the comment), rows, and
justification. A disable directive that covers the declaration or that
statement omits the entry. The field is omitted when empty and is not a failure. A
declaration missing rows<=N or its justification, or placed on a statement
the rule can already prove bounded, remains a finding. See
declared statement bounds.
Suppression hygiene in check() and analyzeProject() check reports includes
stale next-line directives inside statically recovered PostgreSQL executor SQL.
It follows reportUnusedDisableDirectives and uses the same physical comment
locations as CLI check; existing report types and async entrypoints apply.
Both APIs also honor repository and per-rule reportUnusedAllowEntries for
proven stale configured exceptions: advise (default) returns
unused-allow-entry in CheckReport.advisories, report returns the same
diagnostic in CheckReport.rules, and ignore omits it. An omitted per-rule
setting inherits the repository policy, and multiple applications of the same
rule route independently. The setting never expands analysis scope; incomplete
selector coverage stays silent. Literal file paths within the configured scope
also prove staleness when absent from both inventory and disk. Existing excluded
or ignored files and empty glob matches stay silent. The exported
UnusedAllowEntryPolicy union names this policy in DeclaredConfig and
DeclaredRule.
check(options) and check reports in analyzeProject() accept the same
effort: "low" | "max" option as CLI --effort. See
check options for precedence and fallback
warnings.
check({ only, skip }) and { type: "check", only, skip } reports in
analyzeProject() accept the same rule selectors as CLI --only and --skip:
registered rule IDs (for example "postgres-object-naming"), declared rule
groups ("group:<name>", see Rule Groups), or
"requires:schemaCatalogPath", with skip taking precedence over only.
Requirement selectors match effective configured applications. Entries reported
individually include the one-based applicationIndex for that rule.
Unknown selectors reject early. Every configured, enabled rule skipped by
selectors is reported under CheckReport.skippedRules (SkippedRule[],
omitted when empty), with exported CheckRuleGroup, CheckRuleRequirement,
CheckRuleSelector, SkippedRuleReason, and SkippedRule types.
The configured bash-empty-array-nounset
and zsh-readonly-parameter rules return
RuleFinding entries through async check() and analyzeProject() check reports.
Use the same configuration and file globs as the CLI. The package exports
BashEmptyArrayNounsetOptions and ZshReadonlyParameterOptions for typed
configuration.
For shellcheck-runner, both APIs apply the same repository or
rule-application unanalyzable policy when the ShellCheck executable is
missing or a failed invocation yields no recognized diagnostics. If an
abnormal exit has some recognized diagnostics, those findings are preserved
and the policy applies to selected scripts without recognized diagnostics.
Other launcher errors, such as permission denied, are hard errors. The default
is report; advise returns a non-failing advisory and ignore skips that
uncertainty. See the rule contract.
For postgres-require-query-annotation, low uses the same
literal-head proofs and
unanalyzable policy in both APIs; it omits annotation evaluator preparation.
CLI and async Node checks also share the low-effort proof for a local primitive
let string with a continuation-safe head, discarded literal/template +=
writes, and only direct configured executor reads in the same function.
Conditional appends and template interpolations need no SQL evaluation;
captures, aliases, reassignment, and dynamic ownership gaps remain unresolved.
These proofs include trusted builder append prefixes and fixed-return helpers
in the same file or through one direct source import, including local export
aliases and concise arrow bodies. Opaque append suffixes preserve the prefix
only for the trusted sql-template-strings tag. Unsupported helper or
mutation shapes remain unanalyzable.
The same prepared proof joins two adjacent exhaustive assignments to one local
let when each arm creates a fresh native tagged builder and the only later
use is its immediate configured executor read. It retains missing-head findings
and unresolved mixed or escaped forms without running the annotation evaluator.
They also include an exact directly imported helper that returns an immutable
append alias of one fresh tagged builder argument, with an inert native default
and a closed paired .text/.values executor read.
The one-hop proof also accepts a one-parameter imported helper whose complete
body creates a const append alias with literal-only suffixes and returns it.
Both conditional helper-call arms must prove the head; the private local result
may receive discarded literal/tagged appends before its paired field read.
Statements received as function parameters remain unanalyzable; see the
low-effort contract.
An exact top-level namespace destructure can follow unique explicit source
reexports to a fixed-head helper through the same prepared check projection;
other namespace shapes remain unresolved. At low effort, a helper's own
returned trusted builder may keep its fixed head through captured append-only
closures when every binding use is proven safe.
Captured trusted local builders also qualify when every exact-binding use is a
discarded append, a configured executor read, or a proven local append-only
effect. This preserves only the fixed head, even across arbitrary closure order.
The shared low proof also accepts bounded same-file append-only helper calls
and a returned parameter-rooted append chain when the caller discards it. An
append-only helper's captured callback may make discarded static appends to
its exact parameter, including after or between executor reads.
An unsupported use anywhere in a local builder's lifetime invalidates every
read of that builder, even reads before a mutation or escape. Plain immutable
strings keep their existing head proof.
The same prepared effect proof permits inert literal defaults on later helper
parameters and closed object arguments for supported destructured defaults.
For nextjs-redirect-destinations, low keeps
literal arrays and objects and
routes every other destination construction through the same unanalyzable
policy.
For test-no-unmocked-dynamic-imports, low accepts a top-level static
import, a vi.mock or jest.mock call, or a literal require() in setup
files; other setup-reachability shapes use the same unanalyzable policy. See
its Effort section.
For playwright-unique-test-ids and playwright-coverage, low accepts a
string literal test id, including JSX data-testid={"save"}, or a prop with a
literal default; other selector shapes use the same unanalyzable policy. See
playwright-unique-test-ids and
playwright-coverage.
For playwright-unique-html-ids, low checks literal HTML IDs and routes
other ID expressions through the shared unanalyzable policy. The rule remains
independent of tests.playwright.selectors.htmlIds; see
its Effort section.
The async check() and analyzeProject() check reports include the configured cross-module type and JSX rules. They return proven findings in rules and use the shared unanalyzable policy for uncertain cases. no-placeholder-never-type-reexports, playwright-consistent-component-attribute
The opt-in react-no-nested-buttons-and-links rule runs through async check() via checkJson and through the analyzeProject() check report. It uses common YAML rule options, returns definite nested controls in rules, and routes unanalyzable shapes through options.unanalyzable (defaulting to advise in advisories).
The opt-in swift-no-unguarded-darwin-import
rule runs through async check() via checkJson and through the
analyzeProject() check report.
For nextjs-no-caching, low checks
literal cache settings without preparing
constant propagation or configuration wrapper facts. Both APIs preserve shared
unanalyzable policy and suppression behavior; mixed low/max applications reuse
the same source inventory and parse.
For require-storybook-stories, low keeps
direct story coverage and configured
colocated-test coverage without transitive render-chain or dynamic/mock boundary
analysis. check({ effort: "low" }) and a check report in analyzeProject() use
the same shared unanalyzable policy as CLI --effort low.
For postgres-no-offset, low checks
literal SQL and the bounded helper/builder subset.
check({ effort: "low" }) and check reports in analyzeProject() use the same
unanalyzable policy, source locations, suppression, and SQL verdict controls as
the CLI. Configured SQL-template interpolations are bind values; unsupported
shapes follow the shared policy, and raw SQL files retain their existing
analysis. See the bounded helper contract.
For eligible bounded selections with reportUnusedDisableDirectives: ignore,
the prepared SQL facts also use the same
selected-file seeds and resolved import/re-export support closure described in
the rule's analysis contract; unsupported
requests retain broad preparation.
The postgres-required-predicates bounded-index-probe exemption also applies to
programmatic checks: it requires configured catalog index facts, a leading-column
equality, and the SELECT's own constant or parameter LIMIT. See the
rule's examples and controls.
postgres-explicit-columns and postgres-required-predicates also support
low through check() and analyzeProject() with the same bounded SQL helper
subset and unanalyzable policy as the CLI. See the
explicit-columns and
required-predicates Effort
sections.
postgres-no-test-state-mutation
also supports low in check() and analyzeProject() for configured test SQL;
bounded source helpers and finite inline Vitest rows use the same prepared
proofs as the CLI. Opaque tails retain the shared unanalyzable policy.
For finite-set-consistency, low evaluates YAML sequences, YAML string
selectors, and path-regex captures. Other extractor kinds use the same
unanalyzable policy as the CLI, and comparisons that involve those sets are
skipped even when their residual is ignored or suppressed. minSize does not
run on unsupported sets. Supported-set mismatches remain definite findings;
use effort: "max" to analyze TypeScript, SQL-enum, and Markdown sets.
For unconstructed-error-class, unresolved constructor targets and otherwise-unused
classes with unresolved constructors or statically named unresolved bases produce
non-failing advisories even with options.unanalyzable: report (the default).
advise also advises; ignore omits these diagnostics. No unanalyzable
value turns an unresolved constructor or a statically named unresolved base
into a failure. Dynamic base ancestry follows the shared policy.
report and advise differ for dynamic base ancestry and when namespace
escape is the class's only uncertainty.
Namespace-escape-only uncertainty keeps the shared policy: report fails,
advise advises, and ignore omits it. Definite unused Error classes remain
failures under every policy. Known constructor targets reuse the prepared
resolver, including path aliases, usable package declarations, and
tsconfig-visible ambient modules, and credit the actual class.
Immutable aliases and package constructor facades can resolve through shared
binding facts and concrete typeof class declarations. Unknown alternatives
remain uncertain; declaration proof does not broaden ordinary query scope.
Annotated constants follow their runtime initializer through barrels, and
dependency lookup uses the re-exporter's package context. Conditional package
entries and separate @types declarations honor the static import/re-export
context: .mts/.mjs selects import, .cts/.cjs selects require, and
ambiguous extensions retain agreement checks across branches. This also covers
default-object destructuring. CLI and aggregate API reports apply
the same proof: non-Error targets are silent, while unused Error subclasses
remain findings under every policy.
Known non-Error globals are quiet; shadowed names resolve independently.
Ordinary import/call query results remain unchanged. Suppressions apply at the
construction or class line in both report channels. The rule remains max
only; a requested low warns and runs max.
For version-pin-consistency, CLI check, check(options), and check reports
in analyzeProject() apply the same unanalyzable policy when a selected
anchor's declared comparison source is outside the selected file set and is
missing, unreadable, or malformed, or when a selected anchor itself cannot be
read as UTF-8. Actual read failures on the selected anchor use this policy too.
report fails by default, advise emits non-failing advice, and ignore
suppresses the uncertainty. A valid source outside the selected file set still
supplies the comparison pin, and definite mismatches remain failures.
For github-actions-script-expressions, CLI check, check(options), and
check reports in analyzeProject() apply the same unanalyzable policy when a
selected workflow or composite-action file cannot be read, including invalid
UTF-8. report fails by default, advise emits non-failing advice, and
ignore omits the uncertainty. Invalid YAML, unmatched source locations, and
unsupported expression shapes retain definite findings under every policy.
Both findings and advice honor suppression. Invalid UTF-8 points to its first
invalid byte's line; other read failures use line 1.
For package-json-export-target-prefix, CLI check, async check(options),
and analyzeProject() check reports use the same configuration, findings,
and advisory routing. See the rule contract.
For package-json-required-fields, CLI check, check(options), and check
reports in analyzeProject() apply the same unanalyzable policy to selected
manifests that cannot be read or parsed when a field check is enabled.
report fails by default, advise returns a non-failing advisory, and ignore
omits the uncertainty. Definite field violations remain failures, and empty
options request no checks. Both diagnostic channels honor suppression. See
the rule contract.
For github-actions-job-timeouts, check({ effort: "low" }) and a check report
in analyzeProject() use the same covering github-actions-step-timeouts
partner as CLI --effort low. With a certified step cap, the job rule skips
redundant rejectStepExceedingJob comparisons only for literal job timeouts at
least that cap; the partner reports step violations. Missing or ineligible
coverage produces the same warning, analysisFallbacks record, and max
fallback in both APIs. See its Effort section.
Configured github-actions-download-integrity applications use the existing
async check() → checkJson binding and analyzeProject() check reports.
GithubActionsDownloadIntegrityOptions exports the rule's configuration
contract, including opt-in shellSourceInclude, strictSequencing, and
skipAnnotationScope. The exported GithubActionsDownloadIntegritySkipAnnotationScope
union is "step" | "line"; the default preserves whole-step / whole-selected-file
scope. Set these fields in the rule application's YAML options selected by
config. Both entrypoints share the CLI's assignment recovery, literal step env
handling and selected-shell policy; line mode keeps exceptions local to the
annotated physical line or, for a standalone comment, the next line.
For github-actions-download-integrity, low skips assignment expansion for
URL values and routes a known downloader command with any dynamic candidate URL
through one shared unanalyzable diagnostic. Literal-only commands retain their
checks in CLI and Node API. The rule may inspect one binding to identify a
dynamic command prefix. See
its Effort section.
For declared-payload-compatibility, low checks scalar roots, flat objects
with scalar properties, and root arrays with scalar items. Nested child objects
or arrays use the same contract-level unanalyzable policy in check() and
analyzeProject() check reports; invalid documents, pointers, or configuration
remain failures. See
its Effort section.
dependents({ relationships: ["http"] }) includes static language HTTP
client literals for configured Python, Go, Rust, Rails, PHP, Java, Kotlin,
Elixir, and .NET packages. Root-relative paths and literal HTTP(S) URLs on
loopback hosts create http edges to matching routes across configured
languages. serverRouteEdges reports those same literals as client-call.
Computed URLs and URLs on other hosts produce no edge. Both entrypoints are the async functions the CLI JSON commands
call.
symbols, deadExports, and callSites return the same JSON rows as the
CLI for a configured Swift, .NET, Python, Go, Rust, Rails, PHP, Java, Kotlin,
Elixir, or Dart file. Language symbols report the recorded declaration line.
Language call sites preserve every proven reference file. They can use a
matching string for the line and fall back to line 1 when no text matches.
They set referenceOnly and leave
argCount, hasSpread, and args empty: the facts record names, not call
shapes, so those empty fields are not a proven zero-argument call. exportsOf
and importers stay TypeScript.
| CLI | Node API |
|---|---|
dependencies |
dependencies(options) |
dependents |
dependents(options) |
symbols |
symbols(options) |
import-usages |
importUsages(options) |
importers |
importers(options) |
exports-of |
exportsOf(options) |
dead-exports |
deadExports(options) |
call-sites |
callSites(options) |
resolve-check |
resolveCheck(options) |
fetches |
fetches(options) |
postgres lock-inventory |
postgresLockInventory(options) |
postgres catalog --output <path> |
generatePostgresCatalog({ ...options, output: path }) returns the catalog, including row-security metadata in complete coverage. |
| Source-only library capability | parsePostgresSql(sourceOrSources) |
| Source-only TS/JS executor SQL extraction | extractExecutedPostgresSql({ sources, importSpecifier, includeDiagnostics: true }) |
| Selected TS/JS modules | analyzeTypeScriptModules({ root, files }) |
flow |
flow(options) |
Global --verbose-timings |
collectDiagnostics(operation, ...args) returns { result, diagnostics } without stderr |
Global --progress |
Pass diagnosticsId and poll diagnosticsSnapshot({ id }); stderr-free live snapshots |
check |
check(options), including configured csp-allowed-origins, dependabot-cooldown-policy, forbidden-lint-suppressions, lint-rule-enforcement, playwright-no-serial, test-no-retries, terraform-iam-no-undocumented-wildcards, vitest-default-excludes, and vitest-project-policy |
check --write-baseline |
writeCheckBaseline(options) uses writeCheckBaselineJson and returns CheckReport. |
config resolve [--view declared] |
resolveConfig(options) |
lock status |
lockStatus() (shared-lock probe of the selected location without waiting) |
data-pw |
dataPw(options) |
effects |
effects(options) |
rsc-callers |
rscCallers(options) |
registry-extension |
registryExtension(options) |
tests plan |
testsPlan(options); framework accepts vitest, playwright, dotnet, swift, python, go, cargo, rails, php, java, kotlin, elixir, dart, or jest. Import TestPlanFramework for that union instead of indexing TestExecutionTarget['runner'] |
tests targets |
testsTargets(options) |
tests impact |
testsImpact(options) |
tests why |
testsWhy(options) |
tests comment |
testsComment(options) |
tests audit |
testsAudit(options) compares versioned plan/observation artifacts; see artifact contract and producer recipe |
tests graph |
testsGraph(options) or testsGraphMermaid(options) |
playwright check|edges|related|tests |
playwrightCheck, playwrightEdges, playwrightRelated, playwrightTests |
queues edges|related|check |
queueEdges, queueRelated, queueCheck. queueEdges and queueRelated return Kafka static topic literals in TypeScript, Python, Go, Rust, Ruby, PHP, Java, Kotlin, Elixir, and Dart as QueueEdge rows; import QueueEdge from the package entry. queueCheck returns QueueCheckFinding[], or QueueCheckReport with includeDiagnostics: true. The job identity is <cluster>:<topic> when a project cluster is set, and the bare topic otherwise. |
server routes|edges|related|contracts |
serverRouteList, serverRouteEdges, serverRouteRelated, serverContracts |
react analyze|check|usages |
reactAnalyze, reactCheck, reactUsages |
infra resource-refs|outputs|test-for |
infraResourceRefs, infraOutputs, infraTestFor |
swift importers|test-targets |
swiftImporters, swiftTestTargets |
changes diff |
changesDiff({ baseRoot, headRoot, config }) |
lockfile diff |
lockfileDiff(options). Set includeWarnings: true for entries plus structured binary-lockfile warnings. LockfileDiffEntry.manager is npm, pnpm, yarn, bun, poetry, uv, pipfile, go, cargo, gemfile, or composer. With no head or explicit lockfile, files tracked at base and deleted from the worktree report package removals. A malformed poetry, uv, Pipfile, go.mod, Cargo, Gemfile, or composer lockfile rejects the call. |
ci impact |
ciImpact(options) |
ci env |
ciEnv(options) |
ci topology |
ciTopology(options). Set format: "mermaid" for the same diagram text as the CLI. |
ci topology-impact |
ciTopologyImpact(options) |
impacted-checks |
impactedChecks(options) |
planning-impact (npm package only) |
writePlanningImpactArtifacts(options) |
Swift, .NET, Java, Kotlin, Elixir, Dart, and Rust frontends record no
language-specific queue jobs. The shared Kafka scanner checks configured
globs for supported literal shapes; language-specific shapes apply only to files with that language's extension.
Async queueEdges(), queueRelated(), and queueCheck() use the same
queue facts as the CLI. See feature parity.
queueCheck() reports shared-queue-rate-limit when a processor throws RateLimitError or calls .rateLimit() on a queue that carries more than one known job name, and abstains when that set is unknown.
queueCheck() also reports worker-rate-limit-per-process when .rateLimit() is called on a binding that resolves to a Worker, a Worker subclass, or a configured worker factory, and abstains with a diagnostic on QueueReport.diagnostics only when an unresolved receiver's binding originates from a queue module or worker construction. On a multi-job queue, calling worker.rateLimit() inside a processor emits both shared-queue-rate-limit and worker-rate-limit-per-process.
Pass { includeDiagnostics: true } to queueCheck() (or { type: "queueCheck", includeDiagnostics: true } in analyzeProject(), typed by QueueCheckOptions and BatchedQueueCheckOptions) to receive a QueueCheckReport ({ findings, diagnostics }) instead of the default bare QueueCheckFinding[] array. The diagnostics include debounce-ttl abstentions when deduplication options are dynamic.
Aggregate check() also surfaces unresolved worker-rate-limit-per-process receiver diagnostics in CheckReport.warnings without turning a clean run into a failure.
Source directives for queues-check suppress these warnings in aggregate check() and batched check queries. Set includeSuppressed: true to see matching warnings in the suppression ledger.
Import the exported QueueRateLimitFindingKind type for the rate-limit-specific values "shared-queue-rate-limit" | "worker-rate-limit-per-process".
queueCheck() shares the wait detection for literal computed members, immutable local aliases, and direct callback references. Exact wrappers share that handling, including member calls and import aliases.
Configure wrapper names with queues.factories.enqueueAndWait, Rust regex
name patterns with queues.factories.enqueueAndWaitPatterns (default []),
and declaration checks with
queues.factories.forbidEnqueueAndWaitDeclarations (default false) in the
discovered configuration file. These are not inline queueCheck() options.
Both wait finding kinds use the same project waitScopes.
Import the exported QueueWaitFindingKind type for the wait-specific values
"enqueue-and-wait" | "enqueue-and-wait-declaration".
QueueCheckFinding.kind remains string to preserve compatibility with
other finding kinds. queueCheck() also reports
scheduler-template-option when a job-scheduler
template sets delay, deduplication, parent, or jobId.
mixed-priority is one of those string kinds when one
queue mixes priority 0 and a priority greater than 0. See
queues check.
Declaration findings carry fix guidance in message;
no separate JSON field is added.
Call queueCheck({ root, config }) to select a configuration file by absolute
path or by path relative to root. In analyzeProject() set config on the
request for all queue reports. Set queues.requiredJobOptions in that file.
A missing-job-option finding lists the absent keys in message. Abstentions
appear in the queue report diagnostics.
queues.unboundedJobRetention is also configured in that file (selected by
config in queueCheck(), check(), and analyzeProject()), emitting
unbounded-job-retention findings. Undecided producer retention appears in
warnings in check() and analyzeProject() check reports. Exported types
QueueJobRetentionKey,
QueueUnboundedJobRetentionOptions, and QueueUnboundedJobRetentionConfig
describe its YAML shape.
queues.jobStateAsRecord is opt-in configuration emitting advisory
job-state-as-record findings (severity: "advisory" in queueCheck() and
advisories in check() / analyzeProject()). Exported types
QueueJobStateAsRecordOptions, QueueJobStateAsRecordConfig, and
QueueCheckSeverity describe its configuration and finding severity.
queues.includeTests explicitly opts configured test files back into the
shared queue scope across every queue check; exported type
QueueIncludeTestsConfig describes its YAML shape.
QueueFactoryArgument, QueueFactoryPropertyArgument,
QueueEnqueueFactoryOptions, QueueFactoriesOptions, and QueueFactories
are exported configuration types for the selected file's queues.factories.
They cover positional/property selectors, fixed queue names, wrapper defaults,
and returned-call options. They do not add a direct factories argument to
queues(), queueEdges(), queueCheck(), or analyzeProject(); those async
queue entrypoints load the root config and share the canonical queue graph.
check() and analyzeProject() also support their existing explicit config
path selection. See queue configuration.
related(options) is a deprecated compatibility alias for dependents(options).
Its CommonJS, ESM, and TypeScript exports remain available with @deprecated
annotations and unchanged options, async results, and errors. Node calls do not
print the CLI warning. For batched calls, use { type: "dependents", files: [...] }
in analyzeProject(). The "related" report type remains supported and has a
TypeScript @deprecated annotation.
See the migration guide.
| Runtime export | API |
|---|---|
createWorkflowTopologyIndex |
createWorkflowTopologyIndex(topology) |
version |
version() |
collectDiagnostics |
collectDiagnostics(operation, ...args); exported DiagnosticOperations preserves operation argument and result types |
diagnosticsSnapshot |
diagnosticsSnapshot({ id }) |
analyzeProject |
analyzeProject(options); import AnalyzeProjectReportType for report type instead of indexing AnalyzeProjectReportRequest['type'] |
writePlanningImpactArtifacts |
writePlanningImpactArtifacts(options) |
callSites |
callSites(options) |
check |
check(options) uses checkJson for configured rules, including queue-no-enqueue-in-transaction, playwright-no-serial and test-no-retries. Reports may include CheckReport.incomplete (CheckFailure[]) and CheckReport.acceptedBounds (AcceptedStatementBound[]). SQL-looking member queries that lack executor proof appear in unprovenMemberQuerySites (UnprovenMemberQuerySite[]). |
writeCheckBaseline |
writeCheckBaseline(options) uses writeCheckBaselineJson and returns CheckReport. |
ciEnv |
ciEnv(options) |
ciImpact |
ciImpact(options) |
ciTopology |
ciTopology(options) |
ciTopologyImpact |
ciTopologyImpact(options) |
complexity |
complexity(options) returns a ComplexityReport with per-function TS/JS and Rust cyclomatic complexity (FunctionComplexity[]) and unanalyzable files. |
dataPw |
dataPw(options) |
deadExports |
deadExports(options) |
dependencies |
dependencies(options) |
dependents |
dependents(options) |
effects |
effects(options) |
exportsOf |
exportsOf(options) |
postgresLockInventory |
postgresLockInventory(options) |
generatePostgresCatalog |
generatePostgresCatalog(options) |
parsePostgresSql |
parsePostgresSql(sourceOrSources) |
extractExecutedPostgresSql |
extractExecutedPostgresSql({ sources, importSpecifier }) |
analyzeTypeScriptModules |
analyzeTypeScriptModules({ root, files }) |
fetches |
fetches(options) |
flow |
flow(options) |
impactedChecks |
impactedChecks(options) |
importUsages |
importUsages(options) |
importers |
importers(options) |
infraOutputs |
infraOutputs(options) |
infraResourceRefs |
infraResourceRefs(options) |
infraTestFor |
infraTestFor(options) |
changesDiff |
changesDiff(options) |
lockfileDiff |
lockfileDiff(options) |
validateMermaidMarkdown |
validateMermaidMarkdown(options) |
playwrightCheck |
playwrightCheck(options) returns a PlaywrightCoverageReport with typed summary and coverage rows. |
playwrightEdges |
playwrightEdges(options) returns a PlaywrightEdgesReport; use kind to narrow each PlaywrightEdge. |
playwrightRelated |
playwrightRelated(options) returns a PlaywrightRelatedReport with tests and fetch_apis. |
playwrightTests |
playwrightTests(options) returns a PlaywrightTestsReport with test, route, selector, and fetch details. |
reactAnalyze |
reactAnalyze(options) |
reactCheck |
reactCheck(options) |
reactUsages |
reactUsages(options) |
registryExtension |
registryExtension(options) |
related |
related(options); deprecated, use dependents(options) |
resolveCheck |
resolveCheck(options) |
resolveConfig |
resolveConfig(options) returns a resolved report with optional playwright.httpClientHelpers (HttpClientHelper[]); resolveConfig({ view: "declared" }) returns DeclaredConfig through the same async resolveConfigJson binding. |
lockStatus |
lockStatus() |
rscCallers |
rscCallers(options) |
swiftImporters |
swiftImporters(options) |
swiftTestTargets |
swiftTestTargets(options) |
symbols |
symbols(options) |
testsComment |
testsComment(options) |
testsGraphMermaid |
testsGraphMermaid(options) |
queueCheck |
queueCheck(options) |
queueEdges |
queueEdges(options) |
queueRelated |
queueRelated(options) accepts QueueRelatedOptions with at least one file or queue node in files |
queues |
queues(options) |
serverContracts |
serverContracts(options) |
serverRouteEdges |
serverRouteEdges(options) |
serverRouteList |
serverRouteList(options) returns ServerRoute[], the same row type present in serverRoutes(). |
serverRouteRelated |
serverRouteRelated(options) |
serverRoutes |
serverRoutes(options) and serverRouteList(options) include static Laravel resource forms and Phoenix resources macros; Remix file-based routes appear when a type: remix project is configured |
testsAudit |
testsAudit(options) |
testsGraph |
testsGraph(options) |
testsImpact |
testsImpact(options) |
testsPlan |
testsPlan(options) |
testsTargets |
testsTargets(options) |
testsWhy |
testsWhy(options) |
symbols({ mode: "signature-impact", symbol }) returns a SignatureImpactResult
with unanalyzed: UnanalyzedFile[] and warnings for unrelated files that could
not be analyzed. Sources replace invalid UTF-8 with U+FFFD before parsing, so
invalid bytes in comments or strings remain analyzable. Each UnanalyzedFile
contains a project-relative file and diagnostic reason; a nonempty array adds
an unanalyzed-files warning. A failed file that could affect the target rejects
the request. Files without retained source also reject the request because their
imports cannot establish independence.
See PostgreSQL catalog generation.
See Invocation Lock And Timeouts.
See Agent Defaults.
See Selected TypeScript and JavaScript module facts.
See Declared runner config deadlines.
See Live phase progress.
See Effect alternatives.
check() and analyzeProject() also honor low effort for
postgres-no-unbounded-sql-identifier.
Import the exported PostgresNoUnboundedSqlIdentifierOptions,
PostgresSqlIdentifierValidator, and PostgresSqlIdentifierSource types for
identifierValidators (module?, name, argument), identifierSources
(module?, name), and compatible finiteDomainAssertions. At max effort,
a completed configured validator call proves its argument at later uses and
its returned value. Trusted validators may enforce an allow-list or an
identifier grammar plus length limit; trusted sources promise a bounded scalar
identifier return. Their bodies are not inspected. Module selectors match the
call-site import or canonical resolved origin through named or export *
barrels and npm re-exports. Guards still cover only the exact validated property
path before interpolation.
Workspace packages and export * barrels also preserve configured source
identity for typed catalog producers populated at module load. A source entry
counts as used only when its scalar return supplies a selected SQL identifier
proof; an unrelated call or returned-object property does not use it. CLI and
async Node reports from complete max-effort scans locate unused selectors on
their config items as unused-allow-entry, honoring reportUnusedAllowEntries.
These async APIs share the CLI proofs for imported literal-array guards,
immutable templates and additions whose parts are literal or bounded at capture,
literal properties selected from closed records, closed catalog map/join SQL,
built-in sql-template-strings .text fragments with append chains and helper
returns, including imported statements and synchronous factories used through
configured executor callback types. Readonly import proofs reject producer or
consumer member writes and namespace escapes that expose the statement.
Generated UUID helper prefixes must receive literal call arguments, and async
forwarding must be awaited. No tag option is required for the default or SQL
import from sql-template-strings. Unsupported syntax uses
the same report/advisory/ignore policy in CLI and async Node reports. See
closed domains.
At max effort, postgres-no-unbounded-sql-identifier shares the CLI's proof for
module constant literal arrays mapped through configured identifier validators
and declared finite string-literal parameter unions. Reassigned parameters,
widened casts, unresolved types, and open or mutable collections still report
through both check() and analyzeProject().
For postgres-require-query-annotation, these async reports share the CLI's
low-effort finite conditional heads, finite explicit helper returns, safe
returned-local builder proofs, and bounded literal names from direct tuple
loops, a two-literal name ternary, a string-literal for-of, and closed
local helper calls. An unresolved import leaves the ternary and string-list
forms under unanalyzable. Unsupported arms and escaped builders
retain the configured unanalyzable
policy. See low-effort annotation.
The postgres-no-mutable-sql-registry check accepts the exported
PostgresNoMutableSqlRegistryOptions configuration type. Its
effort: "low" tier
checks direct literal SQL through named executor imports without preparing
cross-file mutation analysis;
unsupported inputs use the shared unanalyzable report/advice/ignore policy.
postgres-sql-fragment-escape runs through the same async check() path. It
reports cross-file writes, rebinds, and namespace escapes of exported trusted
SQL fragments. For this consumer, CheckReport.incomplete is scoped to the
runtime dependency closure of files that reach a fragment or use a configured
SQL tag, subject to each application's include and exclude filters. See the
rule's coverage limits.
Configured postgres-no-test-state-mutation
applications run through the existing async check() binding and through
analyzeProject() check reports, with the same findings and advisories as CLI
check. Import the exported PostgresNoTestStateMutationOptions type for
testGlobs, helperRoots, executor targets, and the unanalyzable policy. The
runtime export remains check(options); this rule adds no separate function.
The shared prepared facts can also enumerate literal SQL fragments selected
by a local map from an exact imported Vitest it.each literal key array.
It also enumerates a local literal Set domain after a dominating membership
guard throws on nonmembers, with the same CLI and async API result.
The prepared helper projection also resolves fixed SQL switch arms whose
default is proven to throw, including a source-visible imported thrower.
It composes finite literal-string returns into complete ordinary SQL templates
before the shared policy check; parameterized-tag substitutions remain binds.
Local builder assignments after a direct throwing branch use the same
reachable SQL alternatives in CLI and async Node check reports.
Destructured and bound methods selected by executorNames on a configured imported receiver,
including local aliases, use the same CLI, CJS, ESM, and prepared check behavior.
Non-call runtime references retain the configured unanalyzable policy even if
a later direct call is analyzed. Defaulted destructuring parameters remain
uncertain; type-only references are excluded. This adds no public option or
separate API function.
The async check() API and analyzeProject() check reports also support
closed identifier construction for
postgres-no-test-state-mutation and postgres-bounded-statements. Their options
accept sqlIdentifierAssertions and rawSqlTags, using the exported
PostgresSqlIdentifierAssertion and PostgresRawSqlTag types. The same optional
fields appear on SqlExecutorProfile in requested SQL verdicts. Ordinary
parameterized tags still bind values; raw tag semantics require explicit opt-in.
The async check() API accepts PostgresRequireQueryAnnotationOptions.sqlLiteralHelpers in rule configuration, for example ["pg-copy-streams#from"]. Both effort modes recognize direct imported helper calls with one static literal argument; SqlExecutorProfile.sqlLiteralHelpers records the configured identities in requested SQL verdicts. See the annotation rule.
check() and check reports in analyzeProject() support
postgres-no-transformed-uuid-predicates.
Import PostgresNoTransformedUuidPredicatesOptions to name its catalog, executor,
and effort options. Both APIs preserve findings and non-failing advisories.
The async check() API and analyzeProject() check reports also support
postgres-json-relation-ids. Import
PostgresJsonRelationIdsOptions and PostgresJsonRelationIdsAllowEntry to name
its configuration. Its findings remain non-failing advisories in both APIs.
Playwright file selection uses the same static string/RegExp/mixed-array config
matchers as the CLI. check() and check reports in analyzeProject() retain scoped
matcher uncertainty in their existing warnings field; see
Playwright file matchers.
playwrightCheck() includes an optional warnings array for the same uncertainty;
the field is omitted when all configured matchers can be analyzed. Import
PlaywrightCoverageReport to name the warning-bearing result.
check() also runs configured coverage-producer-assertion-owner applications, returning ordinary rules findings or advisories. Its exported option types are CoverageProducerAssertionOwnerOptions, CoverageProducerFunction, CoverageAssertionImport, and CoverageAssertionOwnership. The existing asynchronous check → checkJson binding remains the runtime entrypoint. Uncertainty messages in rules and advisories name the unresolved call site and callee or the traversal option, limit value, and last module. Required source failures stay in incomplete, with the file and original error in the message. The CLI and async Node API return the same cause details. Those findings also carry an optional causes array (FindingCause: kind, file, line?, callee?, detail) capped at 25 entries; the message lists at most five and ends with +N more. RuleFinding.causes is omitted for ordinary findings, and option types are unchanged.
Assertion-owner checks preserve external package/export identity for named imports through a sole plain external star re-export, using the same resolver as the CLI. Local shadows, competing stars and unresolved cycles stay unknown.
check() and batched analyzeProject() check reports also run configured
forbidden-lint-suppressions applications.
Import ForbiddenLintSuppressionsOptions and
ForbiddenLintSuppressionDirective for their public configuration contract.
The existing asynchronous check → checkJson binding returns ordinary
RuleFinding rows: line identifies the directive and target identifies the
forbidden lint ID, * for a selected blanket disable, or the explicitly enabled
TypeScript directive name. No additional runtime export is required.
Configured production-exports-only-used-by-tests applications run through the existing async check() → checkJson binding and analyzeProject() check reports. ProductionExportsOnlyUsedByTestsOptions exports its explicit production/test/helper scope, opt-in ignoreExportsUsedInFile boolean (default false), exact-file platformConsumedExports entries, and shared uncertainty policy; results use ordinary check findings and advisories. PlatformConsumedExports is exported for programmatic configuration. Each entry uses a root-relative file and exact export names; only non-forwarded exports declared in that file are covered. Sibling exports retain their normal analysis and uncertainty advisories. Dynamic imports at explicit Promise.all destructuring holes and uncalled literal keys of local, non-escaping, never-written loader registries select no exports; tests remain consumers of those exports. Escaped or written registries, computed access, and rest patterns retain uncertainty.
test-no-live-repository-scan runs
through the existing asynchronous check() and analyzeProject() APIs; it adds
no new entrypoint. Type its options with TestNoLiveRepositoryScanOptions
(including runtimeAssets entries, TestNoLiveRepositoryScanRuntimeAsset,
and opt-in analyzers entries, TestNoLiveRepositoryScanAnalyzer),
exported from no-mistakes. Runtime-asset reads are advisories with
target runtime asset in the check report. A configured analyzer launch
against the live working directory is an ordinary finding with target
analyzer subprocess.
The reports share CommonJS binding provenance with the canonical call graph,
retain unresolved computed loads, and distinguish shared temporary roots from
owned mkdtemp directories. Direct import.meta.glob and fs-extra scans follow
the same rule contract. CLI and compiled CJS, ESM, and prepared API reports are
locked by saved-fixture snapshots.
Owned parameters and env roots follow every selected test caller through the same
canonical graph. Configured fixture paths and vi.stubEnv writes participate in
that proof. A failed parameter proof names the blocking caller or route in the
advisory text. Mixed or unresolved callers remain reported, and unrelated production
files do not invalidate ownership. CLI, CJS, ESM and prepared reports share these
semantics.
Node-origin module.require and imported createRequire loads use conservative
unresolved-root findings in these same async APIs, including computed module
arguments and simple loader aliases. They add no public module-fact fields.
Adding a check report to analyzeProject() retains ordinary traversal and
importer results, including config ownership diagnostics. Both projections
reuse the request inventory, sources, fact pass, and canonical graph.
For PostgreSQL query annotation checks, low effort recognizes direct .text/.values reads from a safe local builder tagged by the exact sql-template-strings import. The asynchronous check API also projects one direct immutable string export through the prepared resolver.
The async query-annotation check shares low's bounded fresh helper-result proof
for paired .text/.values reads; it does not run the annotation evaluator.
The pair may be followed by one options argument when its builder result has a
closed source-visible origin.
The same low proof accepts a native builder's paired fields in a nested closure
only when every reference preserves its fixed head, even if that closure runs
later or more than once.
The same prepared proof covers an immutable local record text template and
one exact { text, values } extraction from a fresh plain record.
It also accepts an exact fresh trusted builder returned into one local const
or directly appended at the executor, with the same one-hop prepared import
and escape guards as CLI checks.
The same prepared facts project an exact imported helper's fixed callback SQL
head to a direct inline configured executor callback, independently per call.
The async API shares low's same-file fixed-builder callback proof and exact
async callback parameter census without invoking the annotation evaluator.
The async check() and analyzeProject() annotation reports also share low's
awaited fresh native return-origin proof.
It uses the same prepared source/effect projections and requires exact awaited
const consumption by the immediately next configured executor. No API option,
report field or max-effort contract changes.
Configured postgres-bounded-statements
applications accept materializedBodies and columnBounds through the existing
asynchronous check() →
checkJson binding and analyzeProject() check reports. Import
PostgresBoundedStatementsOptions, PostgresMaterializedBodyPolicy,
PostgresColumnBound, and PostgresViewBoundMode for the rule options. columnBounds maps catalog
table.column names to a required nonempty reason; CLI and Node use the same
catalog validation and caller-bounded key proof. maxDomainRows accepts a
unique-key remainder whose free columns have proven finite domains when their
product is at most that cap. Leave it unset to keep those lookups reported.
An accepted product is silent. A product above the cap stays a finding and
names that product, including a materialized-body finding. Date literals in a
domain range are YYYY-MM-DD. A catalog check may qualify the physical column
with its table, with the catalog schema and table, or with the schema already
on the catalog key. A quoted name that contains a dot stays one identifier:
"audit.log".slot matches the table "audit.log" and does not match the two
identifiers audit and log. An enum domain is that
enum's current label count.
No separate runtime export is
needed.
materializedBodies excludes existence and scalar subquery probes. Unbounded
uncorrelated scalar reads remain ordinary SELECT findings even with ignore.
Scalar checks retain catalog-resolved unqualified outer references, ancestor
LATERAL scopes, partial unique-index predicate proofs and enclosing CTE caps.
An unqualified outer reference must complete a key; non-unique bare-correlated
reads remain findings.
Pool-building IN/array/derived bodies and explicit MATERIALIZED CTEs remain
independent obligations. A consumer of an existing materialized pool retains
that source obligation without repeating it; new unbounded scans still report.
collectDiagnostics(operation, ...args) is the asynchronous equivalent of CLI
--verbose-timings. Pass a public operation name and its normal arguments:
const { collectDiagnostics } = require("no-mistakes");
const { result, diagnostics } = await collectDiagnostics("check", {
root: process.cwd(),
});result is the operation's ordinary result, including existing JavaScript
postprocessing. diagnostics is an exported VerboseDiagnostics report with
elapsedMs, timings (DiagnosticTiming[]), work, phases
(PhaseResourceDiagnostic[]), hotFiles (HotFileDiagnostic[]), and optional
peakRssKiB. DiagnosticsResult<T>, DiagnosticFilePass, and
DiagnosticOperations and DiagnosticArguments<K> are also exported. The selector
map preserves each operation's required or optional argument tuple and asynchronous
result type.
For a union-valued selector, arguments must satisfy every possible operation;
otherwise narrow the selector before calling. For example, "check" | "dependents"
requires options with files, even though a literal "check" needs no options.
Selectors cover root analysis APIs, including analyzeProject, SQL extraction
and parsing, lockStatus, testsComment, and testsGraphMermaid. Both test-plan
renderers return their ordinary strings as the collected result. The selector
map excludes the collector itself and the version, diagnosticsSnapshot,
createWorkflowTopologyIndex, and writePlanningImpactArtifacts utilities.
Phase records contain label, wallMs, user/system CPU milliseconds
(userMs, systemMs), utilization as CPU/wall time, process-lifetime peak RSS
(peakRssKiB) and its increase (peakRssDeltaKiB). Each label appears once,
in first-appearance order. Repeated eligible spans sum wall/user/system time;
utilization divides total CPU by total wall time. Peak RSS takes the maximum
phase-end sample and its delta sums the individual nonnegative span increases.
Resource sampling is Unix only; unsupported or failed samples have no resource
record. Overlapping independent serial spans omit both resource records;
intentional serial envelopes still cover their parallel workers. Nested and
parallel spans retain elapsed timings without CPU/RSS attribution. Hot-file records contain pass, path, durationMs and units,
bounded to ten per pass. File parse covers parsing and requested fact extraction;
value-flow extraction/finalization cover collector setup through returned facts.
All file durations are elapsed milliseconds, including annotation roots. See diagnostic semantics for pass
units, ranking, RSS caveats and overlapping durations.
CPU/RSS samples cover the whole Node process, including concurrent work in other requests. Use an otherwise idle process for phase attribution.
The native analysis runs on libuv async tasks and collection writes no stderr.
Each collector call owns its observer; ordinary calls remain uninstrumented
unless their existing timing or live-progress options are enabled. Reports are
returned to the caller without a completed-request registry. If observation
started before rejection, the error carries optional .diagnostics
(DiagnosticsError); invalid controls can reject before a report exists.
Existing timings and diagnosticsId behavior remains available unchanged.
check({ timings: true }) returns ordered timings entries with label, durationMs, and parallel. Rule entries follow their phase, slowest first; combined passes are labeled accordingly. Parallel durations overlap.
Generated PostgreSQL catalogs include optional functions[signature].returnsSet evidence. check() uses it for postgres-bounded-statements LIMIT proofs; when metadata is absent, a parseable catalog CREATE FUNCTION ... RETURNS type declaration can prove scalar cardinality. Unknown, malformed and set-returning declarations stay conservative, matching the CLI.
github-actions-max-inline-script-lines is available through asynchronous check() and
analyzeProject() using the same configuration and RuleFinding report as CLI check.
Its positive integer maxLines option defaults to 10 and counts non-blank YAML
script-body lines, joining backslash continuations, in workflows and composite actions. See the
rule documentation.
github-actions-cache-key-policy is available through asynchronous check() and
analyzeProject() using the same configuration and RuleFinding report as CLI check.
Configure caches with a path, lockfile, and keyParts, and/or forbiddenPaths (with optional
forbiddenPathsMessage) to forbid caching specific normalized paths. rejectRestoreKeys defaults
to true and allowHashFiles defaults to false. Set forbidBroadHashFiles: true in the rule's
configuration to flag broad literal patterns in key and restore-keys. The
allowedHashFilesPatterns list exempts exact argument strings. See the
rule documentation.
test-fixture-size-cap is available through asynchronous check() and
analyzeProject() using the same configuration and RuleFinding report as CLI check.
Set options.threshold to cap literal Array.from lengths and single-argument Array
and new Array lengths in scopes.tests and scopes.helpers. eachCalls defaults
to []. Use eachTableMode: "all-elements" to report a flat numeric array or
an array of all-numeric row tuples once when it contains at least one numeric
cell and every cell is a non-exempt integer greater than the threshold.
Holes are skipped. The default is "per-element". The package exports
TestFixtureSizeCapOptions and TestFixtureSizeCapEachTableMode for typing
rule configurations. See the rule documentation.
vite-optimize-deps-nested-imports is available through asynchronous check() and
analyzeProject() using the same configuration and RuleFinding report as CLI check.
configFiles and packages are required. Optional includeSources entries name a
module and an export whose value is a static ["parent > child", …] array,
including an as const or satisfies wrapper. A subpath import is covered
only by that exact parent > specifier. A Node built-in still matches by
package name. Optional ignorePackages skips uncovered imports of those package names. See the
rule documentation.
import { resolveConfig, type DeclaredConfig, type DeclaredRule } from "no-mistakes";
const config: DeclaredConfig = await resolveConfig({ root: ".", view: "declared" });
const policy: DeclaredRule | undefined = config.rules?.find(
(entry) => entry.rule === "rust-max-lines-per-file" && entry.name === "source-policy",
);The declared view returns the source-level merged object directly, with canonical
aliases and no defaults, path expansion, or inherited rule materialization.
No config returns {}. The root file comes first; fragment lists concatenate in
sorted relative-path order. That order is stable and part of the API contract.
Explicit config selects one file and excludes fragments. Relative path strings
remain relative to the repository root.
ConfigResolveOptions, ConfigResolveView, DeclaredConfig, DeclaredRule,
DeclaredConfigValue, and DeclaredConfigObject are exported types. Rule options
use the recursive value type because authored options can be objects, arrays,
scalars, or null. Omitting view, or passing view: "resolved", retains the
existing ResolvedConfig return shape. Readers that parse YAML or match its raw
text should use the declared view before splitting configuration; CI path filters
that name the root config must also cover .no-mistakes/**.
Allow-entry hygiene uses the existing asynchronous check() → checkJson
binding and analyzeProject() check-report path. unused-allow-entry results
are RuleFinding objects returned in CheckReport.advisories when the
effective repository or per-rule reportUnusedAllowEntries policy is advise
(default), in CheckReport.rules when it is report, and omitted when it is
ignore: file/line locate the config entry, import names the checked
rule, and target carries the selector. No runtime export or report field is
added. Partial or uncertain selector coverage stays silent; established
rule-specific stale outputs retain their existing shape and severity. See
allow-entry hygiene.
github-actions-local-action-checkout
uses the existing asynchronous check() and analyzeProject() check report
paths with the same configuration and ordered per-job checkout analysis as CLI
check. Findings use the existing RuleFinding shape: rule identifies the
rule, file/line locate the local action's uses: line, and target identifies
the job#step (one-based step position). No new runtime
export, option type, or report field is needed.
The opt-in github-actions-no-required-pr-path-filters uses the same config and
RuleFinding shape in async check(), analyzeProject(), and the CLI.
GithubActionsNoRequiredPrPathFiltersOptions describes its YAML options;
options.workflows is required and non-empty (missing, empty, or non-literal
entries reject check() and analyzeProject() before analysis).
See the rule.
github-actions-pinned-hash reads
options.images from the rule configuration selected by config. The async
check() and analyzeProject() check paths use the same image findings and
unanalyzable policy as CLI check. Use the exported
GithubActionsPinnedHashOptions type when authoring the option object.
The opt-in github-actions-run-command-policy
runs through async check() and analyzeProject() check reports with the same
outcome as CLI check. Exported GithubActionsRunCommandPolicyOptions,
GithubActionsRunCommandPolicy, GithubActionsRunCommandForbiddenPattern,
GithubActionsRunCommandArg, and GithubActionsRunCommandArgScope describe
its YAML options. Policy violations appear in CheckReport.rules and abstained
unparsable-command diagnostics appear in CheckReport.advisories by default.
The opt-in github-actions-workflow-script-paths
runs through async check() and analyzeProject() check reports with the same
outcome as CLI check. Exported GithubActionsWorkflowScriptPathsOptions and
GithubActionsPathFilterEvent describe its YAML options (scriptDirs,
include, events, and unanalyzable). Uncovered script invocations appear
in CheckReport.rules and unprovable trigger or script diagnostics appear in
CheckReport.advisories by default.
github-actions-step-timeouts exports
GithubActionsStepTimeoutsOptions, GithubActionsStepTimeoutsActionCap, and
GithubActionsStepTimeoutsAllowEntry, including per-action actionCaps and
onlyConfiguredActions. Dynamic uses: steps that cannot be proved within the
strictest configured action cap appear in CheckReport.advisories by default.
Without an explicit cap override, a literal timeout above maxMinutes appears
in CheckReport.rules for steps the rule checks, including dynamic action
references. With onlyConfiguredActions: true, static action references must
match an actionCaps family to be checked.
The opt-in github-actions-no-poll-wait-job
runs through async check() and analyzeProject() check reports with the same
outcome as CLI check. Exported GithubActionsNoPollWaitJobOptions describes
its pollCommands and ignoreForLoops options. The opt-in
github-actions-pr-diff-range uses the
same check paths; exported GithubActionsPrDiffRangeOptions and
GithubActionsRevisionPair describe its requireConsistentRevisionPairs,
revisionPairs, and unanalyzable options (abstained diagnostics appear in
CheckReport.advisories by default).
The opt-in github-actions-env-policy
runs through async check() and analyzeProject() check reports with the same
outcome as CLI check. Exported GithubActionsEnvPolicyOptions and
GithubActionsEnvPolicyValue describe its YAML options. Policy violations appear
in CheckReport.rules; required values written as ${{ }} expressions appear in
CheckReport.advisories by default.
The opt-in dependabot-cooldown-policy
runs through async check() and analyzeProject() check reports with the
same outcome as CLI check. Configure it in the YAML selected by config.
DependabotCooldownPolicyOptions is exported for typed configuration.
Policy violations use RuleFinding, and unreadable or malformed input uses
CheckReport.incomplete (CheckFailure[]).
The opt-in terraform-iam-no-undocumented-wildcards
runs through async check() and analyzeProject() check reports. Configure it
in the YAML selected by config. Wildcard resources use RuleFinding and
unreadable or malformed files appear in CheckReport.incomplete.
The opt-in no-cross-package-relative-imports runs in
async check() and analyzeProject() check reports. Select the rule through
the YAML passed to config. The exported NoCrossPackageRelativeImportsOptions
and WorkspaceRelativeImportAllowEntry types describe its package-pair allowlist
and unanalyzable policy (advise by default, report, or ignore).
Reports use the existing RuleFinding fields for the importing file, line,
specifier, and resolved target when available; under the default advise,
computed and unresolved cross-package imports appear in advisories. Invalid
allow entries reject the request.
The configured pnpm-release-age-policy
rule runs through async check() and analyzeProject() check reports.
PnpmReleaseAgePolicyOptions describes the rule options, including
PnpmReleaseAgePermanentPackage entries with an exact name or
package-name pattern, and PnpmReleaseAgeTemporaryGroup entries with
exact version selectors. Configure the rule in the YAML selected by config.
The configured csp-allowed-origins rule runs
through async check() using the existing checkJson binding and through
batched analyzeProject() check reports. CspAllowedOriginsOptions exports
cspFiles (options.cspFiles), optional selfOrigins
(options.selfOrigins), and optional unanalyzable (options.unanalyzable,
default "report"). Findings and advisories use the standard RuleFinding
shape.
The configured vitest-default-excludes
rule runs through async check() using the existing checkJson binding and
through batched analyzeProject() check reports. VitestDefaultExcludesOptions
exports optional config (options.config), files (options.files, module
globs for config factories), and requiredGlobs. Findings use the standard
RuleFinding shape.
The configured vitest-project-policy rule
runs through check() and analyzeProject() check queries using the existing
async checkJson binding and JS facade. Exported VitestProjectPolicyOptions,
VitestDeclaredProjectPolicy, VitestPropertyLiteralKind, VitestPropertyParity,
and VitestPropertyLiteral describe its explicit config and helper path/glob
inputs, effective required/forbidden properties, parity pairs,
requiredExcludeGlobs, and declared
literal restrictions. requiredExcludeGlobs defaults to an empty list. When
set, each literal test.exclude array on the selected config must contain
those exact strings; a missing exclude stays silent. Helper globs select
the prepared visible-file inventory.
declared.forbiddenValues and declared.forbidLiteralKinds inspect every object
literal in config and helpers, including unimported helpers; computed expressions
remain allowed without constant propagation. Declared-only policies do not
report dynamic projects as incomplete. Selected config/helper sources that cannot
be read or parsed, and unresolved effective-policy values, are returned as
CheckReport.incomplete (CheckFailure[]). Application include/exclude filters
and source suppressions apply to declaration diagnostics.
test-no-retries and
playwright-no-serial run through asynchronous
check() and batched analyzeProject() check queries using the existing
checkJson binding. Import TestNoRetriesOptions, PlaywrightNoSerialOptions,
PlaywrightFixtureExport, and TestReliabilityAllowlistEntry from
no-mistakes to type rule options. TestNoRetriesOptions.files selects
Playwright config factory modules by repository-relative glob, and fixtures
on both option interfaces names repository { module, export } entries treated
as Playwright's test. Unresolved imported fixture bindings are returned in
CheckReport.incomplete.
Both rules return standard RuleFinding entries.
PostgreSQL executor options accept extraExecutorNames in the asynchronous
Node APIs, including extractExecutedPostgresSql. Each also accepts
excludeExecutorNames: string[], applied last to remove names from the
replacement list or defaults plus extras.
executorNames replaces [query, read, write]; extraExecutorNames extends
those defaults, including an empty extension with no importSpecifier.
Passing both is an error. This also applies to the PostgreSQL
rule option interfaces and config passed to check(); its configuration
warnings identify omitted default executors imported and called in scoped
files. Excluded defaults suppress those warnings; exclusions that are not
default names or are never imported from the configured module and called in
scoped files produce unused-entry warnings. See executor selection.
Async check() also returns statement rule findings for
configured Rust SQLx executors.
It also recognizes configured Python executors.
The same RuleFinding report identifies the source path and line.
The opt-in postgres-lock-written-rows-only
rule runs through the existing asynchronous check() API and the same rule
configuration as no-mistakes check; it adds no runtime export. Its public
contracts are PostgresLockWrittenRowsOnlyOptions,
PostgresLockWrittenRowsCheck, PostgresLockWrittenRowsChecks,
PostgresLockWrittenRowsSeverity,
PostgresLockWrittenRowsAllow, PostgresLockWrittenRowsWriteSet, and
PostgresLockWrittenRowsExecutorOption.
PostgresLockWrittenRowsOnlyOptions includes executorNames,
extraExecutorNames, and excludeExecutorNames with the selection contract
above. transactionExecutorTypeNames selects imported transaction-only executor
types for local write proofs on function parameters. Per-check severity defaults
to advise for the four established checks. The opt-in sequence checks
share-lock-then-write and redundant-prelock remain disabled unless named in
checks; redundant-prelock is advisory-only and rejects fail. Unresolved
SQL or transaction membership follows the configured unanalyzable policy.
Redundant pre-lock proofs require FROM ONLY and a unique key established by
schemaCatalogPath for updates or the supported upsert conflict target.
PostgresLockWrittenRowsOnlyOptions.executorOptions selects executor-routing
properties with entries such as { name: "query" } for { query: tx }.
It defaults to [] and combines with the existing executorOptionProperties
string list. Repeated names are deduplicated; names must be nonempty. These
property names leave same-spelled local executor bindings unchanged.
Configured factory bindings support const, using, and await using.
PostgresLockWrittenRowsOnlyOptions.schemaCatalogPath optionally supplies schema
relationships for table locks that order later DDL in the same transaction.
Guard-relation reads before later DDL do not require a catalog. Complete catalogs
also supply trigger-derived write evidence and non-null CTE join-key evidence;
ordering-only catalogs do not.
Direct imported factory callbacks also establish transaction membership for a
simple first parameter. Local, unexported option helpers specialize literal
boolean arguments; unresolved callers and unknown flags retain findings. Zero
resolved callers never establish transaction membership. An opaque whole-options
parameter without caller proof retains the configured executor's default.
The postgres-column-check-constraints
catalog rule maps check to the existing async check() runtime export and
analyzeProject() check reports; it adds no runtime export. Named option types
are exported from no-mistakes; see catalog checks.
The postgres-polymorphic-target
catalog rule runs through async check() and analyzeProject() check reports;
it adds no runtime export. Import PostgresPolymorphicTargetOptions and
PostgresPolymorphicTargetAllowEntry from no-mistakes.
The postgres-relational-storage
catalog rule runs through async check() and analyzeProject() check reports;
it adds no runtime export. Import PostgresRelationalStorageOptions,
PostgresRelationalStorageTypeEntry, and
PostgresRelationalStorageColumnEntry from no-mistakes.
The always-advisory postgres-grouping-not-aggregation
rule runs through the existing asynchronous check() and analyzeProject() check
report APIs; no additional runtime export is needed. Import
PostgresGroupingNotAggregationOptions and PostgresGroupingNotAggregationCode
from no-mistakes. Findings appear in advisories, and target contains one of
the five named shape codes for consumer filtering. An unset catalog disables all
shapes. Explicit failing severity and options.fail are rejected.
Both fail and report in PostgresGroupingNotAggregationUnanalyzableSql map
to advise. The canonical unanalyzable option uses the exported Unanalyzable
type and takes precedence over unanalyzableSql. Its report mode also emits
advice and ignore suppresses diagnostic advice. Proven grouping findings stay
advisory in every mode.
The opt-in postgres-no-duplicate-keyed-lookups
rule runs through the existing asynchronous check() and analyzeProject()
check report APIs; it adds no runtime export. Import
PostgresNoDuplicateKeyedLookupsOptions, PostgresNoDuplicateKeyedLookupsViews, and
PostgresNoDuplicateKeyedLookupsUnanalyzableSql from no-mistakes. It shares
the request-scoped prepared SQL facts, unanalyzable policy, and suppression
directives with CLI check.
await postgresLockInventory({ root, config, writeBaseline: false }) returns
the LockInventoryReport fields sites, category counts, unanalyzed SQL
inputs, unanalyzedByReason and unanalyzedByDirectory summaries,
baselineFile, baselineUnanalyzed, added, removed, unanalyzedAdded,
unanalyzedRemoved, and baselineUpdated, plus optional invocation metadata
such as jobsPoolWarning. Exported contract types include
PostgresLockInventoryRuleOptions, LockInventoryBaselineUnanalyzed, and
LockInventoryUnanalyzedDelta. Site keys ignore comments and whitespace; SQL
token changes create new keys. With writeBaseline: true, a missing baseline is
initialized from the analyzed sites. For an existing baseline, the writer prunes
stale entries after any intentional additions have been recorded manually. By
default (baselineUnanalyzed: false), both paths require all configured SQL to
be resolved. When baselineUnanalyzed: true is configured, the baseline also
tracks unresolved input counts by file and line, with reasons for reference.
Reclassified reasons and lower counts pass. In this mode unanalyzedRemoved
stays empty. Both --write-baseline and
writeBaseline: true can initialize and prune downward while unresolved inputs
exist, still refusing new resolved sites or unresolved growth. A failed scan
appears in failedScans and prevents creating or rewriting a baseline.
Read-only callers should treat a nonempty failedScans array as a failed
inventory even when the four delta arrays are empty. The command and
this asynchronous API share one prepared analysis. A malformed baseline rejects
the standalone API call. In check() and analyzeProject() check reports it
appears as an invalid-baseline finding. See the
rule and
command for keys and baseline workflow.
testsPlan({ root, framework: "vitest", changedFiles, unresolvedConfig: "error" })
rejects with the config file, line, expression, and suggested rewrite if an
unresolved runner config causes fallback. The exported UnresolvedTestConfig
type is "warn" | "error". Omit the option to use
testPlan.unresolvedConfig,
which defaults to "warn". When the changed files trigger an unresolved
runner-config fallback, "warn" returns the plan with fallback_triggered: true,
fallback_reason (including for Playwright matcher fallbacks), and a structured
test-config-fallback warning.
impactedChecks() inherits testPlan.unresolvedConfig from configuration with
no per-call override. When the changed files trigger an unresolved runner-config
fallback, "warn" returns a report with test-config-fallback in warnings
and "error" rejects with the diagnostic. Ordinary changes without that fallback
return a report under either policy. Pass genericOnly: true to bypass
test-framework planning and report only matching checks.commands entries.
testsPlan({ root, framework: "playwright", changedFiles }) can report
playwright-http-helper-skipped in warnings. Each warning gives the file,
line, and reason a configured HTTP helper call could not be linked to a
backend route. See backend changes in Playwright plans.
testsImpact() includes the same test-config-fallback diagnostic in warnings
when unresolved Vitest setup adds a test to the impact report.
changesDiff({ baseRoot, headRoot, config }) asynchronously compares two local
roots without Git or network access. It returns the CLI's schemaVersion 1
report, including complete: false and reasons for unreadable roots,
changedFiles (omitted when empty) for changed paths matched by no category's
paths, and unclassified for paths matched by a category's paths that every
matching category excluded or no rule could classify. Use
changesDiff<"fixtures" | "localization">(...) to name configured category
fields in TypeScript. Exported contracts include ChangesDiffOptions,
ChangesReport, ChangesReportMetadata, KeyChanges, FixtureAttributePaths,
ChangesConfig,
ChangeCategory, ChangeRule, ChangeIdRule, KeyedDiffOptions, and
KeyedDiffFormat.
testsPlan({ root, changes: "../changes.json", framework: "vitest" }) consumes
the same saved report as CLI tests plan --changes (relative changes paths
resolve against root, matching config). changedFiles from the report route
through the import graph in union with any explicit changedFiles or base
inputs without triggering a full-suite fallback, unless an entry cannot be
traced without a baseline (such as a lockfile, manifest, global config, or
deleted file without base). Missing, invalid, or incomplete reports, unknown
categories, and unclassified paths select the full suite with a structured
fallback_reason and warning. For categories marked
assertPureJsonLoader: true (user assertion that the loader returns parsed
JSON unchanged without extra fixture exposure or side effects), the planner
uses attributePaths to narrow matching fixture tests when it can trace their
reads and all loader uses in the file; by default it selects all matching
tests. Configured matchers reuse prepared source contents. See
changes configuration.
Configured lint-rule-enforcement applications
run through check() and analyzeProject() check reports. Use
LintRuleEnforcementOptions and LintRuleEnforcementLinter for configuration.
The existing asynchronous checkJson binding returns the same RuleFinding
rows as the CLI.
When lint-rule-enforcement reports an unproven no-var prerequisite
that caused vitest-default-excludes to abstain, the finding's
FindingCause.kind is lint-prerequisite and callee is the dependent
analyzer ID.
The test-correspondence rule reads its YAML configuration via async check() (checkJson) and analyzeProject() check queries. The exported TestCorrespondenceOptions type describes the options under the YAML rule application. The YAML baselineFile option is applied by both check entry points.