Skip to content

Cross-file

Rule kinds in the Cross-file family. Each rule below links to its own page with options, an example, and any auto-fix support.

RuleDescription
pairFor every file matching primary, a file matching the partner template must exist.
pair_hashThe algorithm digest (sha256 default / sha512) of every file matching source must appear in the single target file, either as an embedded hex substring (format: contains, default) or a <hex> <path> manifest line (format: sums-line, where the path token must be the source’s path; a leading * binary marker and a ./ prefix are tolerated).
registry_paths_resolveA manifest file enumerates path entries; each must resolve to an on-disk artefact.
cross_fileA source must hold a relation to one or more targets (or, for resolves, the filesystem).
file_graphAssemble the repo’s file → file reference graph and assert a global structural property the 1-level cross-file kinds can’t express.
ordered_blockThe lines between a start / end marker pair must stay sorted (and, with unique: true, free of duplicates) under comparator (lexical / lexical-ci / numeric).
for_each_matchFor each line matching select (a regex), the line must satisfy the nested require: predicates.
generated_file_freshA committed artefact must equal what a declared command generator produces, in one of two modes (exactly one of file / outputs).
import_gateForbid imports whose extracted target matches a forbid regex, within the paths scope, an architectural import firewall (staging-layer isolation, core/providers separation, private-API gates).
command_idempotentRun a user-declared formatter/checker in its --check (idempotence) mode once: exit 0 ⇒ the tree is formatter-clean (silent); non-zero ⇒ violation(s).
for_each_dirFor every matching directory / file, evaluate a nested require: block with the entry as context.
for_each_fileFor every matching directory / file, evaluate a nested require: block with the entry as context.
dir_containsEvery directory matching select: must contain files matching every glob in require:.
dir_only_containsEvery direct-child file of a directory matching select: must match at least one glob in allow:.
unique_byNo two files matching select may share the value of key (a path template; tokens {path}/{dir}/{basename}/{stem}/{ext}/{parent_name}).
every_matching_hasFor every file or directory matching select:, every nested rule under require: must be satisfied.