RodriOliveira.AdrGuard
0.1.2
See the version list below for details.
dotnet tool install --global RodriOliveira.AdrGuard --version 0.1.2
dotnet new tool-manifest
dotnet tool install --local RodriOliveira.AdrGuard --version 0.1.2
#tool dotnet:?package=RodriOliveira.AdrGuard&version=0.1.2
nuke :add-package RodriOliveira.AdrGuard --version 0.1.2
ADR Guard
ADR Guard is a lightweight .NET command-line tool for validating and indexing Architecture Decision Records (ADRs).
It is designed for repositories that want ADR conventions to be explicit, reviewable, and enforceable in local development and CI without introducing a heavy runtime dependency.
Features
- validates ADR filenames, titles, statuses, and required sections;
- detects duplicate ADR IDs;
- detects broken relative links between ADRs;
- enforces a valid
Superseded bylink for superseded decisions; - generates a deterministic Markdown index;
- avoids rewriting an index that is already current;
- exposes stable validation codes (
ADR001throughADR008); - exposes predictable exit codes for CI/CD;
- ships as a .NET Tool with no third-party runtime dependencies.
Install
Releases are published to both NuGet.org and GitHub Packages.
The simplest installation uses NuGet.org:
dotnet tool install --global RodriOliveira.AdrGuard
Update an existing installation with:
dotnet tool update --global RodriOliveira.AdrGuard
GitHub Packages is also available as a secondary registry. NuGet clients require GitHub authentication to consume packages from that source.
The installed command is:
adr-guard
ADR format
ADR Guard expects Markdown files named with a four-digit ID followed by a lowercase kebab-case slug:
0001-use-postgresql.md
A minimal valid ADR looks like this:
# Use PostgreSQL
## Status
Accepted
## Context
We need a relational database.
## Decision
Use PostgreSQL.
## Consequences
The service depends on PostgreSQL operational knowledge.
Supported statuses:
ProposedAcceptedDeprecatedSuperseded
The required sections are Context, Decision, and Consequences. A Superseded ADR must also contain a Superseded by section linking to an existing ADR.
Validate ADRs
Validate a directory recursively:
adr-guard check docs/adr
When the directory is omitted, ADR Guard uses the current directory:
adr-guard check
A successful validation returns exit code 0. Validation failures are printed with the file path, stable rule code, and message.
Example:
docs/adr/0002-use-cache.md: ADR004 Status 'Approved' is invalid. Allowed values: Proposed, Accepted, Deprecated, Superseded.
Validation failed with 1 issue(s).
Generate the ADR index
Validate the ADR set and generate README.md inside the ADR directory:
adr-guard index docs/adr
The generated file is deterministic:
# Architecture Decision Records
| ADR | Decision | Status |
| --- | --- | --- |
| [0001](0001-use-postgresql.md) | Use PostgreSQL | Accepted |
| [0002](0002-adopt-opentelemetry.md) | Adopt OpenTelemetry | Proposed |
The index is written only after validation succeeds. If the existing file already matches the generated content, it is left untouched.
A custom output outside the ADR directory can be supplied with:
adr-guard index docs/adr --output adr-index.md
Inside the ADR directory, generated Markdown must be named README.md; otherwise it would become an ADR candidate on the next validation.
Validation rules
| Code | Validation |
|---|---|
ADR001 |
Filename must match NNNN-lowercase-kebab-case.md |
ADR002 |
Level-one title is required |
ADR003 |
Status is required |
ADR004 |
Status must be supported |
ADR005 |
Required section is missing or empty |
ADR006 |
ADR ID is duplicated |
ADR007 |
Relative ADR reference is broken |
ADR008 |
Superseded ADR has no valid Superseded by link |
ADR IDs do not need to be contiguous. Gaps are allowed because ADRs may be archived, migrated, or removed without renumbering historical decisions.
Exit codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
ADR validation failed |
2 |
Invalid command-line usage |
3 |
Operational error |
This makes CI integration straightforward:
- name: Validate ADRs
run: adr-guard check docs/adr
Build from source
Requirements:
- .NET SDK 10.0.400 or a compatible patch in the same feature band.
Build and test:
dotnet restore AdrGuard.slnx
dotnet build AdrGuard.slnx --configuration Release --no-restore
dotnet test AdrGuard.slnx --configuration Release --no-build
Create the tool package:
dotnet pack src/AdrGuard/AdrGuard.csproj --configuration Release --no-build --output artifacts/package
Install the locally built package:
dotnet tool install --tool-path ./.tools RodriOliveira.AdrGuard --version 0.1.0 --add-source ./artifacts/package
./.tools/adr-guard check docs/adr
Architecture decisions
ADR Guard validates its own architecture decisions. See docs/adr.
The repository CI builds and tests the solution, packages the .NET Tool, installs that package locally, runs the packaged adr-guard against docs/adr, regenerates the ADR index, and verifies that no documentation drift was introduced.
Additional resources
For more background on Architecture Decision Records, including documents, templates, and examples:
Releases
After a pull request is merged into main, the release workflow waits for the CI workflow for that main commit to complete successfully. It then:
- resolves a stable SemVer version, starting from
VersionPrefixand incrementing the patch for subsequent releases; - packs
RodriOliveira.AdrGuardwith that version; - authenticates to NuGet.org through Trusted Publishing (OIDC) and publishes the package;
- publishes the same package to GitHub Packages;
- creates the corresponding
vMAJOR.MINOR.PATCHtag and GitHub Release; - attaches the
.nupkgto the GitHub Release.
The workflow is idempotent for a commit that already has a release tag.
License
Licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.