CLI-first Markdown structure checker for repositories
Project description
docguard
CLI-first Markdown structure checker for repositories.
Docguard helps teams keep documentation from growing too large, becoming unreachable from index files, or drifting away from expected document types such as ADRs.
Quick start
Install from PyPI as docguard-structure. The CLI command remains docguard. This is not the unrelated docguard-cli package. Use uv add docguard-structure, then run uv run docguard --summary. Existing uv users can upgrade with uv add --upgrade docguard-structure; see Update an existing uv install. Equivalent with pip: pip install docguard-structure. Git-based install: usage guide — Install from Git.
Run docguard init for a starter [tool.docguard] snippet, or use the strict baseline without configuration. Full install commands, configuration, pytest integration, and exit codes: usage guide. To adopt docguard in another repository, see Use in another repository.
docguard --summary
What this tool checks
Docguard focuses on document structure and repository health. Prose style checks DG-STYLE001 and DG-STYLE002 flag decorative strong emphasis, conversational phrasing, and parenthetical asides in body text. DG-STYLE003 flags forbidden documentation expressions in headings, prose, and table headers. These checks are not a general Markdown formatter.
With no configuration, docguard applies the strict baseline: scan README.md, CONTEXT.md, and docs; require reachability from README.md; enforce 300-line documents, 120-line sections, and a 20-line floor for untyped non-index documents; and fail duplicate guidance plus prose and documentation style diagnostics as errors. Any relaxation from that baseline must be recorded in [[tool.docguard.relaxations]] with a reason.
| Phase | What you can check | Diagnostics | Typical default |
|---|---|---|---|
| Core | Document and section size; stub detection; typed document shape; index reachability; prose and documentation style | DG-SIZE001, DG-SIZE002, DG-SIZE003, DG-FORMAT001, DG-FORMAT003, DG-ORG003, DG-STYLE001, DG-STYLE002, DG-STYLE003 |
strict baseline, error |
| Phase 2 | Link structure between files: orphans and hub dead ends | DG-ORG001, DG-ORG002 |
opt-in, warning |
| Phase 3 | Structure inside each file: mixed roles and heading level skips | DG-SPLIT001, DG-FORMAT002 |
opt-in, warning |
| Duplicate guidance | Repeated commands, list guidance, or prose paragraphs across the scan scope; headings and paragraphs opt-in | DG-SPLIT002 |
strict baseline, error |
Phase 2 details: organization rules. Phase 3 and duplicate guidance details: structure rules. Prose style details: prose style rules. To adopt docguard in another repository, see Use in another repository.
Development
Requires Python 3.11+ and uv on PATH:
uv pip install -e ".[dev]"
uv run pytest
uv run docguard README.md CONTEXT.md docs/ --summary
Documentation
- Usage
- Organization rules (Phase 2)
- Structure rules (Phase 3)
- Prose style rules
- Dogfood and self-test
- Release readiness
- Domain glossary (CONTEXT.md)
- Architecture decision records
Status
Alpha release with Trove classifier Development Status :: 3 - Alpha. Configuration keys, diagnostic JSON fields, and rule defaults may change; breaking changes are recorded in CHANGELOG.md. Exit codes and existing diagnostic meanings are preserved where practical.
Docguard uses a strict baseline by default. Relaxations require [[tool.docguard.relaxations]] entries with reasons. Release readiness is documented in docs/release-readiness.md.
Repository navigation
Relative links for clone checkouts and docguard reachability checks:
- docs/usage.md
- docs/organization-rules.md
- docs/structure-rules.md
- docs/prose-style-rules.md
- docs/dogfood.md
- docs/release-readiness.md
- CONTEXT.md
- docs/adr/0001-cli-first-docguard.md
- docs/adr/0002-structured-diagnostics-and-strict-config.md
- docs/adr/0003-organization-link-rules.md
- docs/adr/0004-utf-8-markdown-encoding.md
- docs/adr/0005-phase3-structure-diagnostics.md
- docs/adr/0006-document-budget-dogfood-gate.md
- docs/adr/0007-document-responsibility-drift-guard.md
- docs/adr/0008-pypi-alpha-distribution.md
- docs/adr/0009-duplicate-guidance-diagnostic.md
- docs/adr/0010-duplicate-guidance-kind-scope.md
- docs/adr/0011-duplicate-prose-paragraph-guidance.md
- docs/adr/0012-prose-style-diagnostics.md
- docs/adr/0013-pypi-distribution-name-docguard-structure.md
- docs/adr/0014-strict-baseline-and-policy-relaxations.md
- docs/adr/0015-forbidden-documentation-expressions.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docguard_structure-0.4.0.tar.gz.
File metadata
- Download URL: docguard_structure-0.4.0.tar.gz
- Upload date:
- Size: 63.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7eff90b5a649c09e13b83aef81938c69771227c7d99cb571dfad1a35945d7e69
|
|
| MD5 |
bbbfdcf629ab45a32d2ac3c97dd083fa
|
|
| BLAKE2b-256 |
77fb79160ad829f6e40399209cc66df00886a0d327321d0ec4513ea94b670889
|
Provenance
The following attestation bundles were made for docguard_structure-0.4.0.tar.gz:
Publisher:
publish.yml on takuto-NA/docguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docguard_structure-0.4.0.tar.gz -
Subject digest:
7eff90b5a649c09e13b83aef81938c69771227c7d99cb571dfad1a35945d7e69 - Sigstore transparency entry: 1655154308
- Sigstore integration time:
-
Permalink:
takuto-NA/docguard@ffa8120fed37107784960a2d5f3d56305eb99deb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/takuto-NA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ffa8120fed37107784960a2d5f3d56305eb99deb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file docguard_structure-0.4.0-py3-none-any.whl.
File metadata
- Download URL: docguard_structure-0.4.0-py3-none-any.whl
- Upload date:
- Size: 43.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb24bbc6e6d9b8b38b1b5802d26969d3036bbb5ada08fcee87ae3f8cca5175da
|
|
| MD5 |
cbfd212618ee545257fb3aa9dfa859d4
|
|
| BLAKE2b-256 |
618cf555fa1fd22c3217f50da52b518322c17e846f80a0d6bccd33de15205347
|
Provenance
The following attestation bundles were made for docguard_structure-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on takuto-NA/docguard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docguard_structure-0.4.0-py3-none-any.whl -
Subject digest:
eb24bbc6e6d9b8b38b1b5802d26969d3036bbb5ada08fcee87ae3f8cca5175da - Sigstore transparency entry: 1655154525
- Sigstore integration time:
-
Permalink:
takuto-NA/docguard@ffa8120fed37107784960a2d5f3d56305eb99deb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/takuto-NA
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ffa8120fed37107784960a2d5f3d56305eb99deb -
Trigger Event:
workflow_dispatch
-
Statement type: