docguard-cli 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +281 -203
- package/cli/commands/init.mjs +1 -0
- package/cli/scanners/speckit.mjs +318 -87
- package/cli/validators/metrics-consistency.mjs +2 -1
- package/cli/validators/traceability.mjs +17 -9
- package/commands/docguard.fix.md +65 -0
- package/commands/docguard.guard.md +60 -0
- package/commands/docguard.review.md +53 -0
- package/commands/docguard.score.md +61 -0
- package/docs/installation.md +37 -19
- package/docs/quickstart.md +21 -6
- package/extensions/spec-kit-docguard/LICENSE +21 -0
- package/extensions/spec-kit-docguard/README.md +105 -0
- package/extensions/spec-kit-docguard/commands/diagnose.md +43 -0
- package/extensions/spec-kit-docguard/commands/generate.md +50 -0
- package/extensions/spec-kit-docguard/commands/guard.md +73 -0
- package/extensions/spec-kit-docguard/commands/init.md +38 -0
- package/extensions/spec-kit-docguard/commands/score.md +53 -0
- package/extensions/spec-kit-docguard/commands/trace.md +56 -0
- package/extensions/spec-kit-docguard/extension.yml +109 -0
- package/extensions/spec-kit-docguard/scripts/bash/common.sh +106 -0
- package/extensions/spec-kit-docguard/scripts/bash/docguard-check-docs.sh +153 -0
- package/extensions/spec-kit-docguard/scripts/bash/docguard-init-doc.sh +153 -0
- package/extensions/spec-kit-docguard/scripts/bash/docguard-suggest-fix.sh +107 -0
- package/extensions/spec-kit-docguard/skills/docguard-fix/SKILL.md +218 -0
- package/extensions/spec-kit-docguard/skills/docguard-guard/SKILL.md +167 -0
- package/extensions/spec-kit-docguard/skills/docguard-review/SKILL.md +182 -0
- package/extensions/spec-kit-docguard/skills/docguard-score/SKILL.md +178 -0
- package/extensions/spec-kit-docguard/templates/extensions.yml +39 -0
- package/package.json +5 -2
- package/templates/REQUIREMENTS.md.template +68 -0
- package/templates/commands/docguard.fix.md +35 -39
- package/templates/commands/docguard.guard.md +26 -13
- package/templates/commands/docguard.init.md +35 -28
- package/templates/commands/docguard.review.md +33 -23
- package/templates/commands/docguard.update.md +15 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run DocGuard guard validation — check project documentation against CDD standards with 19 validators
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix All Issues
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Fix all documentation issues found by guard
|
|
7
|
+
- label: Deep Review
|
|
8
|
+
agent: docguard.review
|
|
9
|
+
prompt: Perform semantic cross-document consistency analysis
|
|
10
|
+
- label: Check Score
|
|
11
|
+
agent: docguard.score
|
|
12
|
+
prompt: Show CDD maturity score and improvement roadmap
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# DocGuard Guard — Documentation Quality Gate
|
|
16
|
+
|
|
17
|
+
Run the DocGuard CLI to validate all documentation against Canonical-Driven Development standards.
|
|
18
|
+
|
|
19
|
+
## What to do
|
|
20
|
+
|
|
21
|
+
1. **Run the guard command**:
|
|
22
|
+
```bash
|
|
23
|
+
npx docguard-cli guard
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **Parse the output**. Each of the 19 validators reports ✅ (pass), ⚠️ (warning), or ❌ (fail):
|
|
27
|
+
|
|
28
|
+
| Validator | What It Checks |
|
|
29
|
+
|-----------|---------------|
|
|
30
|
+
| Structure | Required CDD files exist |
|
|
31
|
+
| Doc Sections | Canonical docs have required sections |
|
|
32
|
+
| Docs-Sync | External doc references are valid |
|
|
33
|
+
| Drift | Code deviations logged in DRIFT-LOG.md |
|
|
34
|
+
| Changelog | CHANGELOG.md is maintained |
|
|
35
|
+
| Test-Spec | Tests match TEST-SPEC.md rules |
|
|
36
|
+
| Environment | Environment documentation |
|
|
37
|
+
| Security | No hardcoded secrets, SECURITY.md quality |
|
|
38
|
+
| Architecture | Architecture documentation |
|
|
39
|
+
| Freshness | Docs updated within commit window |
|
|
40
|
+
| Traceability | Requirements trace to tests |
|
|
41
|
+
| Docs-Diff | Doc changes match code changes |
|
|
42
|
+
| Metadata-Sync | Metadata headers are consistent |
|
|
43
|
+
| Docs-Coverage | All config files documented |
|
|
44
|
+
| Doc-Quality | Readability, IEEE 830 compliance |
|
|
45
|
+
| TODO-Tracking | TODOs are tracked |
|
|
46
|
+
| Schema-Sync | Schema documentation matches code |
|
|
47
|
+
| Spec-Kit | Spec quality (FR-IDs, sections) |
|
|
48
|
+
| Metrics-Consistency | Internal counts are accurate |
|
|
49
|
+
|
|
50
|
+
3. **Triage findings by severity**:
|
|
51
|
+
- **CRITICAL**: Structure, Security, Test-Spec failures
|
|
52
|
+
- **HIGH**: Doc Sections, Drift, Changelog, Traceability failures
|
|
53
|
+
- **MEDIUM**: Freshness, Docs-Coverage, Doc-Quality, Metrics-Consistency warnings
|
|
54
|
+
- **LOW**: TODO-Tracking, Schema-Sync, Spec-Kit, Metadata-Sync warnings
|
|
55
|
+
|
|
56
|
+
4. For each failing check, provide an **exact fix** — specific file, section, and content to change.
|
|
57
|
+
|
|
58
|
+
5. After fixing, re-run `npx docguard-cli guard` to verify. Iterate until all checks pass.
|
|
59
|
+
|
|
60
|
+
6. Exit codes: 0 = all pass, 1 = failures, 2 = warnings only.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Cross-document consistency analysis — semantic review of documentation health, accuracy, and alignment with codebase
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix Issues Found
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Fix the documentation issues identified in the review
|
|
7
|
+
- label: Run Guard
|
|
8
|
+
agent: docguard.guard
|
|
9
|
+
prompt: Validate all documentation passes CDD standards
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# DocGuard Review — Documentation Quality Analysis
|
|
13
|
+
|
|
14
|
+
Perform comprehensive, read-only analysis of documentation health with semantic cross-document consistency checking.
|
|
15
|
+
|
|
16
|
+
## What to do
|
|
17
|
+
|
|
18
|
+
1. **Run the full diagnostic**:
|
|
19
|
+
```bash
|
|
20
|
+
npx docguard-cli diagnose
|
|
21
|
+
npx docguard-cli score
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
2. **Perform semantic analysis** (beyond what CLI can check):
|
|
25
|
+
|
|
26
|
+
| Analysis Pass | What to Check |
|
|
27
|
+
|--------------|--------------|
|
|
28
|
+
| Terminology | Same concepts named consistently across docs |
|
|
29
|
+
| Architecture ↔ Code | Components listed in ARCHITECTURE.md exist in codebase |
|
|
30
|
+
| Data Model ↔ Code | Schemas in DATA-MODEL.md match actual implementations |
|
|
31
|
+
| Test Coverage | Critical flows in TEST-SPEC.md have actual test files |
|
|
32
|
+
| Security Claims | Auth mechanisms in SECURITY.md match actual code |
|
|
33
|
+
| Cross-References | Internal doc links resolve to valid targets |
|
|
34
|
+
|
|
35
|
+
3. **Score each document** on 5 dimensions:
|
|
36
|
+
|
|
37
|
+
| Criterion | Weight | What to Evaluate |
|
|
38
|
+
|-----------|:------:|-----------------|
|
|
39
|
+
| Completeness | 30% | All mandatory sections present |
|
|
40
|
+
| Accuracy | 30% | Content matches actual codebase |
|
|
41
|
+
| Clarity | 20% | Readable, specific, no unexplained jargon |
|
|
42
|
+
| Currency | 10% | Up-to-date with latest code changes |
|
|
43
|
+
| Cross-refs | 10% | References are valid and bidirectional |
|
|
44
|
+
|
|
45
|
+
4. **Classify findings by severity**:
|
|
46
|
+
- 🔴 **CRITICAL**: Security claim mismatch, missing mandatory doc, broken architecture reference
|
|
47
|
+
- 🟠 **HIGH**: Undocumented component, stale content (>5 commits behind), terminology conflict
|
|
48
|
+
- 🟡 **MEDIUM**: Missing cross-reference, minor coverage gap, readability issue
|
|
49
|
+
- 🟢 **LOW**: Minor formatting, optional section missing, style inconsistency
|
|
50
|
+
|
|
51
|
+
5. **Output a structured report** with findings table, per-document health scores, and priority-ordered recommendations.
|
|
52
|
+
|
|
53
|
+
6. **Do NOT modify files** — this is read-only analysis. Suggest fixes for user approval.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CDD maturity score with ROI-based improvement roadmap — shows category breakdown, grade progression, and highest-impact fixes
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix Top Issues
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Fix the highest-ROI documentation issues to improve score
|
|
7
|
+
- label: Full Review
|
|
8
|
+
agent: docguard.review
|
|
9
|
+
prompt: Perform deep semantic analysis for accuracy verification
|
|
10
|
+
- label: Run Guard
|
|
11
|
+
agent: docguard.guard
|
|
12
|
+
prompt: Verify current guard status after improvements
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# DocGuard Score — CDD Maturity Assessment
|
|
16
|
+
|
|
17
|
+
Calculate and display the project's Canonical-Driven Development maturity score with ROI-based improvement roadmap.
|
|
18
|
+
|
|
19
|
+
## What to do
|
|
20
|
+
|
|
21
|
+
1. **Run the scoring engine**:
|
|
22
|
+
```bash
|
|
23
|
+
npx docguard-cli score
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **For JSON output** (CI/CD integration):
|
|
27
|
+
```bash
|
|
28
|
+
npx docguard-cli score --format json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. **Interpret the grade**:
|
|
32
|
+
|
|
33
|
+
| Grade | Score | Meaning |
|
|
34
|
+
|-------|:-----:|---------|
|
|
35
|
+
| A+ | 95-100 | Exemplary — production-grade documentation |
|
|
36
|
+
| A | 85-94 | Strong — minor improvements possible |
|
|
37
|
+
| B | 70-84 | Good — some gaps to address |
|
|
38
|
+
| C | 50-69 | Fair — significant documentation debt |
|
|
39
|
+
| D | 30-49 | Poor — major gaps in documentation |
|
|
40
|
+
| F | 0-29 | Critical — documentation infrastructure missing |
|
|
41
|
+
|
|
42
|
+
4. **Analyze category breakdown** (sorted by weight):
|
|
43
|
+
|
|
44
|
+
| Category | Weight | What It Measures |
|
|
45
|
+
|----------|:------:|-----------------|
|
|
46
|
+
| Structure | 25% | Required CDD files exist |
|
|
47
|
+
| Doc Quality | 20% | Readability, sections, IEEE 830 compliance |
|
|
48
|
+
| Testing | 15% | Test documentation coverage |
|
|
49
|
+
| Security | 10% | Security docs, secrets handling |
|
|
50
|
+
| Environment | 10% | Environment and setup docs |
|
|
51
|
+
| Drift | 10% | Code deviation tracking |
|
|
52
|
+
| Changelog | 5% | Change log maintenance |
|
|
53
|
+
| Architecture | 5% | Architecture documentation |
|
|
54
|
+
|
|
55
|
+
5. **Build an ROI-ranked improvement roadmap**:
|
|
56
|
+
- Calculate `Potential Gain = weight - current points` for each category
|
|
57
|
+
- Sort by `Potential Gain / Effort` ratio
|
|
58
|
+
- Show: "If you fix [X], score will increase from [Y] to [Z]"
|
|
59
|
+
- Show the **minimum set of fixes** to reach the next grade level
|
|
60
|
+
|
|
61
|
+
6. **Track progress**: Compare current score against previous runs to show improvement.
|
package/docs/installation.md
CHANGED
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
## Requirements
|
|
4
4
|
|
|
5
|
-
- **Node.js** ≥ 18
|
|
5
|
+
- **Node.js** ≥ 18 (required for both npm and Python installations)
|
|
6
6
|
- **git** (optional — needed for freshness validation)
|
|
7
7
|
|
|
8
|
-
## Install via
|
|
8
|
+
## Install via npm
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Option 1: Run directly (no install)
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npx docguard
|
|
13
|
+
npx docguard-cli diagnose
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
This downloads and runs DocGuard on demand. Always uses the latest version.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### Option 2: Install globally
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
```bash
|
|
21
|
+
npm i -g docguard-cli
|
|
22
|
+
docguard diagnose
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Option 3: Dev dependency (pinned version)
|
|
21
26
|
|
|
22
27
|
```bash
|
|
23
|
-
npm install --save-dev docguard
|
|
28
|
+
npm install --save-dev docguard-cli
|
|
24
29
|
```
|
|
25
30
|
|
|
26
31
|
Then use via npm scripts in `package.json`:
|
|
@@ -35,34 +40,44 @@ Then use via npm scripts in `package.json`:
|
|
|
35
40
|
}
|
|
36
41
|
```
|
|
37
42
|
|
|
38
|
-
## Install
|
|
43
|
+
## Install via Python (PyPI)
|
|
39
44
|
|
|
40
45
|
```bash
|
|
41
|
-
|
|
46
|
+
pip install docguard-cli
|
|
47
|
+
docguard diagnose
|
|
42
48
|
```
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
> **Note:** The Python package is a thin wrapper that delegates to `npx docguard-cli`. Node.js 18+ must be installed on the system.
|
|
51
|
+
|
|
52
|
+
The Python wrapper:
|
|
53
|
+
- Detects Node.js 18+ on your system
|
|
54
|
+
- Runs `npx docguard-cli` with all arguments forwarded
|
|
55
|
+
- Provides clear error messages if Node.js is missing
|
|
56
|
+
|
|
57
|
+
## Install as Spec Kit Extension
|
|
58
|
+
|
|
59
|
+
If your project uses [GitHub Spec Kit](https://github.com/github/spec-kit):
|
|
45
60
|
|
|
46
61
|
```bash
|
|
47
|
-
docguard
|
|
48
|
-
docguard score
|
|
62
|
+
specify extension add docguard
|
|
49
63
|
```
|
|
50
64
|
|
|
65
|
+
This installs DocGuard's slash commands into your AI agent's command palette.
|
|
66
|
+
|
|
51
67
|
## Verify Installation
|
|
52
68
|
|
|
53
69
|
```bash
|
|
54
|
-
npx docguard --version
|
|
70
|
+
npx docguard-cli --version
|
|
71
|
+
# Output: docguard v0.9.5
|
|
55
72
|
```
|
|
56
73
|
|
|
57
|
-
Should output `DocGuard v0.4.0` (or current version).
|
|
58
|
-
|
|
59
74
|
## CI/CD Installation
|
|
60
75
|
|
|
61
76
|
In GitHub Actions or similar:
|
|
62
77
|
|
|
63
78
|
```yaml
|
|
64
79
|
- name: Run DocGuard
|
|
65
|
-
run: npx docguard
|
|
80
|
+
run: npx docguard-cli guard
|
|
66
81
|
```
|
|
67
82
|
|
|
68
83
|
No separate install step needed — `npx` handles it.
|
|
@@ -71,11 +86,14 @@ No separate install step needed — `npx` handles it.
|
|
|
71
86
|
|
|
72
87
|
```bash
|
|
73
88
|
# If installed as dev dependency
|
|
74
|
-
npm update docguard
|
|
89
|
+
npm update docguard-cli
|
|
75
90
|
|
|
76
91
|
# If installed globally
|
|
77
|
-
npm update -g docguard
|
|
92
|
+
npm update -g docguard-cli
|
|
93
|
+
|
|
94
|
+
# If installed via Python
|
|
95
|
+
pip install --upgrade docguard-cli
|
|
78
96
|
|
|
79
97
|
# If using npx — always runs latest automatically
|
|
80
|
-
npx docguard@latest --version
|
|
98
|
+
npx docguard-cli@latest --version
|
|
81
99
|
```
|
package/docs/quickstart.md
CHANGED
|
@@ -20,16 +20,32 @@ cd your-project
|
|
|
20
20
|
npx docguard-cli init
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Creates all
|
|
23
|
+
Creates all 6 canonical docs (including REQUIREMENTS.md) + tracking files + AI slash commands.
|
|
24
24
|
|
|
25
|
-
### Option C:
|
|
25
|
+
### Option C: Spec-Driven Development (spec-kit projects)
|
|
26
|
+
|
|
27
|
+
If you're using [GitHub Spec Kit](https://github.com/github/spec-kit):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 1. Initialize spec-kit
|
|
31
|
+
specify init . --ai claude
|
|
32
|
+
|
|
33
|
+
# 2. Add DocGuard as enforcement layer
|
|
34
|
+
specify extension add docguard
|
|
35
|
+
|
|
36
|
+
# 3. Write specs with AI, validate with DocGuard
|
|
37
|
+
/speckit.specify Build an app that...
|
|
38
|
+
npx docguard-cli guard
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Option D: From existing code (established projects)
|
|
26
42
|
|
|
27
43
|
```bash
|
|
28
44
|
cd your-project
|
|
29
45
|
npx docguard-cli generate
|
|
30
46
|
```
|
|
31
47
|
|
|
32
|
-
Scans your codebase and generates pre-filled documentation.
|
|
48
|
+
Scans your codebase and generates pre-filled documentation, including REQUIREMENTS.md with spec-kit-aligned FR/SC IDs.
|
|
33
49
|
|
|
34
50
|
## Fill the Docs (AI Does It)
|
|
35
51
|
|
|
@@ -52,9 +68,8 @@ diagnose → AI reads prompts → AI fixes docs → guard verifies
|
|
|
52
68
|
## Verify
|
|
53
69
|
|
|
54
70
|
```bash
|
|
55
|
-
npx docguard-cli guard # Pass/fail check
|
|
71
|
+
npx docguard-cli guard # Pass/fail check (19 validators)
|
|
56
72
|
npx docguard-cli score # 0-100 maturity score
|
|
57
|
-
npx docguard-cli score --tax # How much time docs cost you
|
|
58
73
|
```
|
|
59
74
|
|
|
60
75
|
## Automate
|
|
@@ -66,7 +81,7 @@ npx docguard-cli hooks
|
|
|
66
81
|
# CI/CD pipelines
|
|
67
82
|
npx docguard-cli ci --threshold 70
|
|
68
83
|
|
|
69
|
-
# Live watch mode
|
|
84
|
+
# Live watch mode
|
|
70
85
|
npx docguard-cli watch --auto-fix
|
|
71
86
|
```
|
|
72
87
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ricardo Accioly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# DocGuard — CDD Enforcement Extension for Spec Kit
|
|
2
|
+
|
|
3
|
+
Enterprise-grade Canonical-Driven Development (CDD) enforcement for [Spec Kit](https://github.com/github/spec-kit). Validates, scores, and fixes project documentation with 19 automated validators, AI-driven research workflows, and spec-kit integration hooks.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **19 Validators** — Structure, Security, Doc Quality, Test-Spec, Drift, Freshness, and 13 more
|
|
8
|
+
- **4 AI Skills** — Enterprise-grade AI behavior protocols (not just step-lists)
|
|
9
|
+
- **3 Bash Scripts** — JSON-output orchestration for AI consumption
|
|
10
|
+
- **Workflow Chaining** — YAML handoffs enable guard → fix → review → score flows
|
|
11
|
+
- **Spec Kit Hooks** — Mandatory quality gate after `/speckit.implement`
|
|
12
|
+
- **Zero Dependencies** — Pure Node.js built-ins only
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g docguard-cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or use via npx:
|
|
21
|
+
```bash
|
|
22
|
+
npx docguard-cli guard
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Initialize CDD in your project
|
|
29
|
+
docguard init
|
|
30
|
+
|
|
31
|
+
# Check documentation health
|
|
32
|
+
docguard guard
|
|
33
|
+
|
|
34
|
+
# Get AI-ready fix prompts
|
|
35
|
+
docguard fix --doc architecture
|
|
36
|
+
|
|
37
|
+
# Calculate maturity score
|
|
38
|
+
docguard score
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
| Command | Purpose |
|
|
44
|
+
|---------|---------|
|
|
45
|
+
| `docguard.guard` | Run 19-validator quality gate with severity triage |
|
|
46
|
+
| `docguard.fix` | AI-driven documentation repair with codebase research |
|
|
47
|
+
| `docguard.review` | Cross-document semantic consistency analysis (read-only) |
|
|
48
|
+
| `docguard.score` | CDD maturity score with ROI improvement roadmap |
|
|
49
|
+
| `docguard.diagnose` | Diagnose issues + generate multi-perspective AI prompts |
|
|
50
|
+
| `docguard.generate` | Reverse-engineer canonical docs from codebase |
|
|
51
|
+
| `docguard.init` | Initialize CDD structure in a project |
|
|
52
|
+
| `docguard.trace` | Generate requirements traceability matrix |
|
|
53
|
+
|
|
54
|
+
## AI Skills
|
|
55
|
+
|
|
56
|
+
DocGuard provides 4 enterprise-grade AI behavior protocols modeled after Spec Kit's skill architecture:
|
|
57
|
+
|
|
58
|
+
| Skill | Lines | What It Does |
|
|
59
|
+
|-------|:-----:|-------------|
|
|
60
|
+
| `docguard-guard` | 155 | 6-step execution with severity triage, structured reporting, remediation recommendations |
|
|
61
|
+
| `docguard-fix` | 195 | 7-step research workflow with per-document codebase research, 3-iteration validation loops |
|
|
62
|
+
| `docguard-review` | 170 | Semantic cross-document analysis with 6 analysis passes and quality scoring matrix |
|
|
63
|
+
| `docguard-score` | 165 | CDD maturity assessment with ROI-based improvement roadmap and grade progression |
|
|
64
|
+
|
|
65
|
+
Skills differ from commands in a critical way: **commands tell agents what to run** (step-lists), while **skills tell agents how to think, validate, and iterate** (behavior protocols).
|
|
66
|
+
|
|
67
|
+
## Spec Kit Integration
|
|
68
|
+
|
|
69
|
+
### Workflow Hooks
|
|
70
|
+
|
|
71
|
+
DocGuard integrates into the spec-kit workflow through hooks:
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
hooks:
|
|
75
|
+
after_implement: # Mandatory — always runs after /speckit.implement
|
|
76
|
+
command: docguard.guard
|
|
77
|
+
before_tasks: # Optional — review docs before task generation
|
|
78
|
+
command: docguard.review
|
|
79
|
+
after_tasks: # Optional — show score after tasks
|
|
80
|
+
command: docguard.score
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Workflow Chaining
|
|
84
|
+
|
|
85
|
+
All commands support YAML handoffs for seamless workflow chaining:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
guard → fix → review → score
|
|
89
|
+
↑ ↓
|
|
90
|
+
└──────────────────────┘
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Scripts
|
|
94
|
+
|
|
95
|
+
| Script | Purpose |
|
|
96
|
+
|--------|---------|
|
|
97
|
+
| `docguard-check-docs.sh` | Discover docs, return JSON inventory with metadata |
|
|
98
|
+
| `docguard-suggest-fix.sh` | Run guard, prioritize fixes as JSON |
|
|
99
|
+
| `docguard-init-doc.sh` | Initialize canonical doc with metadata header |
|
|
100
|
+
|
|
101
|
+
All scripts support `--json` mode for AI-parseable output.
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT © Ricardo Accioly
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Diagnose documentation issues and generate AI-ready fix prompts"
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix All Issues
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Fix all documentation issues found
|
|
7
|
+
- label: Run Guard
|
|
8
|
+
agent: docguard.guard
|
|
9
|
+
prompt: Validate all checks pass
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# DocGuard Diagnose
|
|
13
|
+
|
|
14
|
+
Runs guard validation, analyzes failures, and generates AI-ready prompts to fix documentation issues.
|
|
15
|
+
|
|
16
|
+
## User Input
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
1. Run DocGuard diagnose on the current project:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx --yes docguard-cli@latest diagnose $ARGUMENTS
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. Review the output:
|
|
29
|
+
- **Issues found** — categorized as errors or warnings
|
|
30
|
+
- **Remediation plan** — ordered list of fix commands
|
|
31
|
+
- **AI-ready prompt** — copy/paste to your AI agent for automated fixes
|
|
32
|
+
|
|
33
|
+
3. For multi-perspective analysis, add `--debate` to get three-agent prompts (Advocate/Challenger/Synthesizer).
|
|
34
|
+
|
|
35
|
+
## Flags
|
|
36
|
+
|
|
37
|
+
- `--format json` — Output as JSON
|
|
38
|
+
- `--debate` — Generate multi-perspective AI prompts
|
|
39
|
+
- `--dir <path>` — Run on a different directory
|
|
40
|
+
|
|
41
|
+
## Research
|
|
42
|
+
|
|
43
|
+
Inspired by AITPG (IEEE TSE 2026) multi-agent prompting and TRACE (IEEE TMLCN 2026) calibrated quality evaluation.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Reverse-engineer canonical documentation from existing codebase"
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Validate Generated Docs
|
|
5
|
+
agent: docguard.guard
|
|
6
|
+
prompt: Validate generated documentation passes all checks
|
|
7
|
+
- label: Review Quality
|
|
8
|
+
agent: docguard.review
|
|
9
|
+
prompt: Review quality of generated documentation
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# DocGuard Generate
|
|
13
|
+
|
|
14
|
+
Scans your codebase and generates canonical documentation: ARCHITECTURE.md, DATA-MODEL.md, TEST-SPEC.md, SECURITY.md, ENVIRONMENT.md, and API-REFERENCE.md.
|
|
15
|
+
|
|
16
|
+
## User Input
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
1. Run DocGuard generate on the current project:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx --yes docguard-cli@latest generate $ARGUMENTS
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. Review the generated docs in `docs-canonical/`. Each document includes:
|
|
29
|
+
- Structured sections based on industry standards
|
|
30
|
+
- Data extracted from your actual codebase (routes, schemas, configs)
|
|
31
|
+
- Standards citation footer referencing relevant specifications
|
|
32
|
+
- DocGuard metadata headers for freshness tracking
|
|
33
|
+
|
|
34
|
+
3. Customize with `--doc <name>` to generate a specific document only.
|
|
35
|
+
|
|
36
|
+
## Generated Documents
|
|
37
|
+
|
|
38
|
+
| Document | Source | Standard |
|
|
39
|
+
|----------|--------|----------|
|
|
40
|
+
| ARCHITECTURE.md | Routes, configs, dependencies | arc42 / C4 Model |
|
|
41
|
+
| DATA-MODEL.md | Schema files, type definitions | C4 Component / ER |
|
|
42
|
+
| TEST-SPEC.md | Test files, test configs | ISO/IEC/IEEE 29119-3 |
|
|
43
|
+
| SECURITY.md | Auth modules, .gitignore, secrets | OWASP ASVS v4.0 |
|
|
44
|
+
| ENVIRONMENT.md | .env files, Docker, CI/CD configs | 12-Factor App |
|
|
45
|
+
| API-REFERENCE.md | Route handlers, OpenAPI specs | OpenAPI 3.1 |
|
|
46
|
+
|
|
47
|
+
## Flags
|
|
48
|
+
|
|
49
|
+
- `--doc <name>` — Generate a specific document only
|
|
50
|
+
- `--dir <path>` — Run on a different directory
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run 19-validator quality gate with severity triage and actionable remediation"
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix All Issues
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Fix all documentation issues found by guard
|
|
7
|
+
- label: Deep Review
|
|
8
|
+
agent: docguard.review
|
|
9
|
+
prompt: Perform semantic cross-document consistency analysis
|
|
10
|
+
- label: Check Score
|
|
11
|
+
agent: docguard.score
|
|
12
|
+
prompt: Show CDD maturity score and improvement roadmap
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# DocGuard Guard
|
|
16
|
+
|
|
17
|
+
Validate your project against its canonical documentation. Runs 160+ automated checks across 19 validators.
|
|
18
|
+
|
|
19
|
+
## User Input
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
$ARGUMENTS
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
26
|
+
|
|
27
|
+
## Execution
|
|
28
|
+
|
|
29
|
+
1. Run DocGuard guard validation:
|
|
30
|
+
```bash
|
|
31
|
+
npx --yes docguard-cli@latest guard $ARGUMENTS
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2. Parse each validator's result and build a severity-ranked findings table.
|
|
35
|
+
|
|
36
|
+
3. **Triage by severity**:
|
|
37
|
+
- **CRITICAL**: Structure, Security, Test-Spec failures → fix immediately
|
|
38
|
+
- **HIGH**: Doc Sections, Drift, Changelog, Traceability → fix before commit
|
|
39
|
+
- **MEDIUM**: Freshness, Docs-Coverage, Doc-Quality, Metrics → fix this sprint
|
|
40
|
+
- **LOW**: TODO-Tracking, Schema-Sync, Spec-Kit, Metadata → fix when convenient
|
|
41
|
+
|
|
42
|
+
4. For each failing check, provide an **exact fix** — specific file, section, and content.
|
|
43
|
+
|
|
44
|
+
5. Re-run guard after fixes. Iterate until all checks pass (max 3 iterations).
|
|
45
|
+
|
|
46
|
+
## Validators (19 total)
|
|
47
|
+
|
|
48
|
+
| Validator | What It Checks |
|
|
49
|
+
|-----------|---------------|
|
|
50
|
+
| Structure | Required CDD files exist |
|
|
51
|
+
| Doc Sections | Canonical docs have required sections |
|
|
52
|
+
| Docs-Sync | External doc references are valid |
|
|
53
|
+
| Drift | `// DRIFT:` comments have DRIFT-LOG entries |
|
|
54
|
+
| Changelog | CHANGELOG.md is maintained |
|
|
55
|
+
| Test-Spec | TEST-SPEC.md matches actual test files |
|
|
56
|
+
| Environment | Environment docs and .env.example exist |
|
|
57
|
+
| Security | No hardcoded secrets, .gitignore configured |
|
|
58
|
+
| Architecture | Layer boundaries and diagrams present |
|
|
59
|
+
| Freshness | Docs updated after recent code changes |
|
|
60
|
+
| Traceability | Canonical docs linked to source code |
|
|
61
|
+
| Docs-Diff | Entity/route/field drift between code and docs |
|
|
62
|
+
| Metadata-Sync | Metadata headers are consistent |
|
|
63
|
+
| Docs-Coverage | All config files documented |
|
|
64
|
+
| Doc-Quality | Readability, IEEE 830 compliance |
|
|
65
|
+
| TODO-Tracking | TODOs are tracked |
|
|
66
|
+
| Schema-Sync | Schema documentation matches code |
|
|
67
|
+
| Spec-Kit | Spec quality (FR-IDs, sections) |
|
|
68
|
+
| Metrics-Consistency | Internal counts are accurate |
|
|
69
|
+
|
|
70
|
+
## Flags
|
|
71
|
+
|
|
72
|
+
- `--format json` — Output results as JSON
|
|
73
|
+
- `--dir <path>` — Run on a different directory
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Initialize Canonical-Driven Development in a project"
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Generate Docs
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Generate documentation content from codebase
|
|
7
|
+
- label: Check Status
|
|
8
|
+
agent: docguard.guard
|
|
9
|
+
prompt: Run guard to see initial status
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# DocGuard Init
|
|
13
|
+
|
|
14
|
+
Initialize CDD in your project. Creates the `docs-canonical/` directory, required files (CHANGELOG.md, DRIFT-LOG.md, AGENTS.md), and optionally sets a compliance profile.
|
|
15
|
+
|
|
16
|
+
## User Input
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
1. Run DocGuard init on the current project:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx --yes docguard-cli@latest init $ARGUMENTS
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. Choose a compliance profile:
|
|
29
|
+
- **starter** — Minimal CDD (architecture + changelog only)
|
|
30
|
+
- **standard** — Full CDD (all 5 canonical docs)
|
|
31
|
+
- **enterprise** — Strict CDD (all docs, all validators, freshness enforced)
|
|
32
|
+
|
|
33
|
+
3. After init, run `speckit.docguard.generate` to populate the canonical docs with real data from your codebase.
|
|
34
|
+
|
|
35
|
+
## Flags
|
|
36
|
+
|
|
37
|
+
- `--profile <name>` — Set compliance profile (starter, standard, enterprise)
|
|
38
|
+
- `--dir <path>` — Run on a different directory
|