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.
| Rule | Description |
|---|---|
pair | For every file matching primary, a file matching the partner template must exist. |
pair_hash | The 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_resolve | A manifest file enumerates path entries; each must resolve to an on-disk artefact. |
cross_file | A source must hold a relation to one or more targets (or, for resolves, the filesystem). |
file_graph | Assemble the repo’s file → file reference graph and assert a global structural property the 1-level cross-file kinds can’t express. |
ordered_block | The 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_match | For each line matching select (a regex), the line must satisfy the nested require: predicates. |
generated_file_fresh | A committed artefact must equal what a declared command generator produces, in one of two modes (exactly one of file / outputs). |
import_gate | Forbid 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_idempotent | Run 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_dir | For every matching directory / file, evaluate a nested require: block with the entry as context. |
for_each_file | For every matching directory / file, evaluate a nested require: block with the entry as context. |
dir_contains | Every directory matching select: must contain files matching every glob in require:. |
dir_only_contains | Every direct-child file of a directory matching select: must match at least one glob in allow:. |
unique_by | No two files matching select may share the value of key (a path template; tokens {path}/{dir}/{basename}/{stem}/{ext}/{parent_name}). |
every_matching_has | For every file or directory matching select:, every nested rule under require: must be satisfied. |