Documentation
¶
Overview ¶
Command adrlint enforces the architecture decision records under docs/decisions (adr-lint.yml's checker).
adrlint docs [--root r] [--base <git ref>] [dir] lint every NNNN-title.md in dir (default docs/decisions) adrlint pr --files <path> [--root r] [--dir dir] check a pull request's "Decision:" line adrlint index [--write|--check] [--root r] [--dir dir] print, write or verify docs/decisions/INDEX.md adrlint keep-label --base B --before X --after Y --pr N --before-checks FILE [--repo dir] may a push keep decision-confirmed
--root (default ".") is the tree being judged: dir resolves under it and, with --base, git runs as "git -C root". The workflow runs a checker built from the base branch with --root pointing at the pull request's checkout, so a pull request cannot change the rules it is judged by.
docs rules (each violation is one file:line: message line on stdout, all are reported):
a MADR front matter: status (proposed|accepted|rejected|deprecated|superseded by ADR-NNNN, optionally followed by ";" and a free-text note; an ADR-NNNN in the note must exist), date (YYYY-MM-DD) and decision-makers; a "superseded by ADR-NNNN" status must name an ADR file that exists b the first heading is "# <title>"; the "##" sections are present and in order; "### Consequences" and "### Confirmation" sit under Decision Outcome c every README link to an ADR resolves; every relative link in an ADR resolves; numbers are unique (gaps are allowed: a number may be reserved by an in-flight PR). A record need not be listed in README.md: existing in the directory is the rule (ADR 0068; the README's table is frozen at 0066 and INDEX.md lists every record) docs/decisions/NEXT is retired (ADR 0089): there is no counter file, and one that exists is a violation d no consumer vocabulary (see vocabRE; the front matter block is not checked); a line carrying <!-- adrlint:allow vocabulary --> is exempt e with --base: only the ADR files the pull request's own diff touches (merge-base of <ref> and HEAD to HEAD) are judged; one the pull request does not touch is never flagged, so a branch behind <ref> is not blamed for what merged there. A touched ADR that is accepted at the merge-base or at the tip of <ref> is immutable: compared with its merge-base text it may change only its status line (to superseded by ADR-NNNN) and add or change a "Superseded by [..](..)" line, whose link must resolve to an existing ADR file, and may not be deleted. A file absent at the merge-base (the pull request added it) is free. When git cannot find a merge-base, <ref> itself is the comparison point (stricter) f with --base: an ADR file the pull request adds (in its diff, absent at the merge-base) must have a number that no ADR file at the tip of <ref> uses (ADR 0106, amending ADR 0089); a number below the tip's highest is fine when unused, gaps and out-of-order merges are allowed, there is no counter file, and two pull requests that took the same number are caught by the duplicate check of rule c on the queue's combined tree
pr reads PR_BODY and PR_LABELS (comma-separated) from the environment and the changed paths, one per line, from --files. The body needs exactly one "Decision: none" or "Decision: ADR-NNNN" line; the ADR must exist and be among the changed paths (the pull request adds or changes that record); "none" on a change under a protected path (docs/decisions/ included) needs the "decision-confirmed" label.
index generates INDEX.md in dir from every NNNN-title.md's front matter and first heading (internal/adrindex): a table of number, title, status and date, sorted by number. Without a flag it prints the file; --write writes it; --check exits 1 when the file is missing or differs from what would be generated, naming the first difference.
keep-label answers whether a push leaves the pull request's own change unchanged, so that the decision-confirmed label stays on it (ADR 0178, extending ADR 0078): it prints "keep" and exits 0, or "reset: <reason>" and exits 1 (any doubt is a reset). Both label-reset.yml and adr-lint.yml run it, from the base branch, on commits fetched as data.
Exit 0: ok. Exit 1: violations. Exit 2: usage or an unreadable input.