Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

doctor

Check the health of your ADR repository.

Usage

adrs doctor [OPTIONS]

Options

OptionDescription
--ngNo-op for doctor (prints a note; see below)
--ignore <RULE>Ignore a rule by ID or name (repeatable); merged with [doctor].ignore in adrs.toml
--warnings-as-errorsExit with status 1 if there are warnings, not just errors
-C, --cwd <DIR>Working directory
-h, --helpPrint help

Description

Runs diagnostic checks on your ADR repository and reports any issues found.

The global --ng flag has no effect on doctor. Lint rules detect each ADR's format (Nygard or MADR) from the file itself, so the repository mode does not change which checks run. Passing --ng doctor prints a note to that effect rather than ignoring the flag silently.

Checks Performed

CheckDescription
File NamingADR files follow the NNNN-title.md pattern
Duplicate NumbersNo two ADRs have the same number
Numbering GapsSequential numbering without gaps
Broken LinksAll referenced ADRs exist
Superseded StatusSuperseded ADRs have corresponding links
Parse ErrorsAll ADRs can be parsed correctly

Examples

Healthy Repository

adrs doctor

Output:

No issues found. Your ADR repository is healthy!

Repository with Issues

adrs doctor

Output:

error: [ADR012] doc/adr/0003-duplicate.md: Duplicate ADR number 2. Also used in: doc/adr/0002-use-postgresql.md
warning: [ADR009] Filename number (0003) does not match title number (2) [doc/adr/0003-duplicate.md:1]

Found 1 error(s), 1 warning(s), 0 info(s)

Each line has the form <severity>: [<rule ID>] <message> [<location>]. Rule IDs like ADR009 and ADR012 map to the checks below.

Severity Levels

LevelDescription
infoInformational, no action needed
warningPotential issue, but not critical
errorProblem that should be fixed

Exit Codes

CodeDescription
0No issues, or only warnings/info (default)
1One or more errors, or warnings with --warnings-as-errors / warnings_as_errors = true

By default, warnings alone do not fail the check; only errors do. Pass --warnings-as-errors (or set warnings_as_errors = true in [doctor]) to also fail on warnings. This allows using doctor in CI pipelines:

- name: Check ADR health
  run: adrs doctor

Configuration

doctor reads a [doctor] section from adrs.toml:

[doctor]
# Rule IDs or rule names to suppress (matched case-insensitively)
ignore = ["ADR011"]

# Exit with status 1 if there are warnings, not just errors
warnings_as_errors = false

--ignore flags on the command line merge with (do not replace) [doctor].ignore from config, so you can suppress an extra rule for a single run without editing adrs.toml. --warnings-as-errors on the command line ORs with [doctor].warnings_as_errors, so either one being set is enough to make warnings fail the check.

Pre-commit Hook

adrs ships a pre-commit hook (also compatible with prek) that runs doctor whenever a markdown file changes. Add it to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/joshrotenberg/adrs
    rev: v0.9.0
    hooks:
      - id: adrs-doctor

The hook uses language: system, so it expects adrs to already be on PATH. See Installation for ways to install it (cargo install adrs, a release binary, Homebrew, etc.).

The hook triggers on any staged .md file but always checks the whole repository, since doctor's checks (numbering, links, superseded status) are repository-wide. If your ADRs live outside the default directory, scope the trigger further with files: in your own config, e.g.:

      - id: adrs-doctor
        files: ^doc/adr/.*\.md$
  • list - List ADRs
  • link - Fix broken links