docguard-cli 0.9.5 → 0.9.7
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/diff.mjs +16 -3
- package/cli/commands/init.mjs +4 -0
- package/cli/commands/setup.mjs +455 -0
- package/cli/docguard.mjs +12 -0
- package/cli/ensure-skills.mjs +96 -0
- package/cli/validators/doc-quality.mjs +2 -2
- package/cli/validators/docs-sync.mjs +41 -6
- package/cli/validators/metrics-consistency.mjs +2 -1
- package/cli/validators/todo-tracking.mjs +11 -6
- package/commands/docguard.fix.md +37 -17
- package/commands/docguard.guard.md +45 -12
- package/commands/docguard.review.md +37 -19
- package/commands/docguard.score.md +36 -17
- 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 +103 -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 +92 -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 +2 -1
- 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,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docguard-review
|
|
3
|
+
description: Cross-document consistency analysis and quality assessment. Performs read-only
|
|
4
|
+
analysis across all canonical docs, identifies drift, coverage gaps, and quality issues.
|
|
5
|
+
Produces a structured report with severity-ranked findings. Modeled after speckit-analyze.
|
|
6
|
+
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
7
|
+
metadata:
|
|
8
|
+
author: docguard
|
|
9
|
+
version: 0.9.5
|
|
10
|
+
source: extensions/spec-kit-docguard/skills/docguard-review
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# DocGuard Review Skill
|
|
14
|
+
|
|
15
|
+
## User Input
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
22
|
+
|
|
23
|
+
## Goal
|
|
24
|
+
|
|
25
|
+
Perform a comprehensive, **read-only** analysis of the project's documentation health. Unlike `/docguard.guard` (which runs CLI validators), this skill performs **semantic analysis** — checking whether documentation actually matches the codebase, whether cross-references are consistent, and whether the documentation tells a coherent story.
|
|
26
|
+
|
|
27
|
+
## Operating Constraints
|
|
28
|
+
|
|
29
|
+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report only. Offer remediation suggestions that the user must explicitly approve before any changes are made.
|
|
30
|
+
|
|
31
|
+
## Execution Flow
|
|
32
|
+
|
|
33
|
+
### Step 1: Gather Documentation Inventory
|
|
34
|
+
|
|
35
|
+
1. **List all canonical docs**: Read every file in `docs-canonical/`
|
|
36
|
+
2. **List support files**: Check for `CHANGELOG.md`, `DRIFT-LOG.md`, `AGENTS.md`, `README.md`, `ROADMAP.md`
|
|
37
|
+
3. **Check for spec-kit artifacts**: If `.specify/` exists, include `specs/*/spec.md`, `specs/*/plan.md`, `specs/*/tasks.md`
|
|
38
|
+
4. **Build a document map**:
|
|
39
|
+
|
|
40
|
+
| Document | Exists | Last Modified | Size | Metadata Version |
|
|
41
|
+
|----------|--------|---------------|------|-----------------|
|
|
42
|
+
| ARCHITECTURE.md | ✅ | 2026-03-14 | 5.2KB | 0.5.0 |
|
|
43
|
+
| SECURITY.md | ✅ | 2026-03-14 | 3.1KB | 0.5.0 |
|
|
44
|
+
| ... | ... | ... | ... | ... |
|
|
45
|
+
|
|
46
|
+
### Step 2: Run Quantitative Analysis
|
|
47
|
+
|
|
48
|
+
Execute DocGuard's diagnostic and scoring tools:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx docguard-cli diagnose 2>&1
|
|
52
|
+
npx docguard-cli score 2>&1
|
|
53
|
+
npx docguard-cli guard 2>&1
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Record:
|
|
57
|
+
- Guard pass/fail counts per validator
|
|
58
|
+
- CDD maturity score (0-100)
|
|
59
|
+
- ALCOA+ compliance attributes
|
|
60
|
+
- Category breakdown
|
|
61
|
+
|
|
62
|
+
### Step 3: Semantic Cross-Document Analysis
|
|
63
|
+
|
|
64
|
+
This is the **unique value** of the review skill — analysis that CLI validators cannot do.
|
|
65
|
+
|
|
66
|
+
#### A. Terminology Consistency
|
|
67
|
+
- Extract key technical terms from each document
|
|
68
|
+
- Flag terms used differently across documents (e.g., "validator" vs "checker" vs "rule")
|
|
69
|
+
- Flag abbreviations used without definition
|
|
70
|
+
- Build a de facto glossary
|
|
71
|
+
|
|
72
|
+
#### B. Architecture ↔ Code Alignment
|
|
73
|
+
- Read ARCHITECTURE.md component list
|
|
74
|
+
- Verify each listed component actually exists as a directory/module
|
|
75
|
+
- Flag components that exist in code but are missing from ARCHITECTURE.md
|
|
76
|
+
- Flag components listed in ARCHITECTURE.md that don't exist in code
|
|
77
|
+
|
|
78
|
+
#### C. Data Model ↔ Code Alignment
|
|
79
|
+
- Read DATA-MODEL.md schemas/structures
|
|
80
|
+
- Search codebase for actual data structures
|
|
81
|
+
- Flag schemas documented but not implemented
|
|
82
|
+
- Flag schemas implemented but not documented
|
|
83
|
+
|
|
84
|
+
#### D. Test Coverage ↔ Test-Spec Alignment
|
|
85
|
+
- Read TEST-SPEC.md critical flows
|
|
86
|
+
- Check actual test files exist for each critical flow
|
|
87
|
+
- Flag test scenarios documented but not implemented
|
|
88
|
+
- Flag test files with no corresponding TEST-SPEC.md entry
|
|
89
|
+
|
|
90
|
+
#### E. Security Claims ↔ Implementation
|
|
91
|
+
- Read SECURITY.md auth/secrets claims
|
|
92
|
+
- Verify auth implementation exists in code
|
|
93
|
+
- Check that listed secrets are actually used
|
|
94
|
+
- Flag security-relevant code not mentioned in SECURITY.md
|
|
95
|
+
|
|
96
|
+
#### F. Cross-Reference Integrity
|
|
97
|
+
- Find all internal doc links (`[text](file)` and `See ARCHITECTURE.md`)
|
|
98
|
+
- Verify every referenced file/section actually exists
|
|
99
|
+
- Flag broken cross-references
|
|
100
|
+
- Flag orphaned sections not referenced anywhere
|
|
101
|
+
|
|
102
|
+
### Step 4: Quality Assessment
|
|
103
|
+
|
|
104
|
+
For each document, evaluate:
|
|
105
|
+
|
|
106
|
+
| Criterion | Weight | Score | Notes |
|
|
107
|
+
|-----------|--------|-------|-------|
|
|
108
|
+
| Completeness | 30% | 0-10 | Are all mandatory sections present? |
|
|
109
|
+
| Accuracy | 30% | 0-10 | Does content match actual codebase? |
|
|
110
|
+
| Clarity | 20% | 0-10 | Readability, specificity, no jargon |
|
|
111
|
+
| Currency | 10% | 0-10 | Is content up-to-date with latest code? |
|
|
112
|
+
| Cross-refs | 10% | 0-10 | Are references valid and bidirectional? |
|
|
113
|
+
|
|
114
|
+
### Step 5: Severity Classification
|
|
115
|
+
|
|
116
|
+
Classify every finding using this matrix:
|
|
117
|
+
|
|
118
|
+
- **CRITICAL**: Security claim doesn't match implementation, missing mandatory doc, broken architecture reference
|
|
119
|
+
- **HIGH**: Undocumented component, stale content (>5 commits behind), terminology conflict
|
|
120
|
+
- **MEDIUM**: Missing cross-reference, minor coverage gap, readability issue
|
|
121
|
+
- **LOW**: Formatting inconsistency, optional section missing, minor terminology drift
|
|
122
|
+
|
|
123
|
+
### Step 6: Produce Analysis Report
|
|
124
|
+
|
|
125
|
+
Output a structured markdown report (do NOT write to disk):
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
## DocGuard Documentation Review
|
|
129
|
+
|
|
130
|
+
### Executive Summary
|
|
131
|
+
- **Overall Health**: [A+/A/B/C/D/F] ([score]/100)
|
|
132
|
+
- **Documents Analyzed**: [N]
|
|
133
|
+
- **Findings**: [CRITICAL: N, HIGH: N, MEDIUM: N, LOW: N]
|
|
134
|
+
- **Top Risk**: [Most impactful finding]
|
|
135
|
+
|
|
136
|
+
### Findings Table
|
|
137
|
+
|
|
138
|
+
| ID | Category | Severity | Location | Summary | Recommendation |
|
|
139
|
+
|----|----------|----------|----------|---------|----------------|
|
|
140
|
+
| R01 | Terminology | HIGH | ARCH:L15, SEC:L22 | "validator" vs "checker" | Standardize on "validator" |
|
|
141
|
+
| R02 | Coverage | MEDIUM | DATA-MODEL.md | Schema X undocumented | Add Schema X to Data Model |
|
|
142
|
+
|
|
143
|
+
### Per-Document Health
|
|
144
|
+
|
|
145
|
+
| Document | Completeness | Accuracy | Clarity | Currency | Cross-refs | Overall |
|
|
146
|
+
|----------|:----------:|:-------:|:------:|:-------:|:----------:|:-------:|
|
|
147
|
+
| ARCHITECTURE.md | 9/10 | 8/10 | 9/10 | 7/10 | 10/10 | 8.8/10 |
|
|
148
|
+
| SECURITY.md | 8/10 | 9/10 | 8/10 | 9/10 | 7/10 | 8.4/10 |
|
|
149
|
+
|
|
150
|
+
### Semantic Consistency
|
|
151
|
+
- **Terminology conflicts**: [N found]
|
|
152
|
+
- **Architecture gaps**: [N components undocumented]
|
|
153
|
+
- **Broken cross-refs**: [N found]
|
|
154
|
+
- **Test coverage gaps**: [N critical flows untested]
|
|
155
|
+
|
|
156
|
+
### Recommendations (Priority Order)
|
|
157
|
+
1. [Most impactful fix] — estimated effort: [LOW/MEDIUM/HIGH]
|
|
158
|
+
2. [Second most impactful] — estimated effort: [LOW/MEDIUM/HIGH]
|
|
159
|
+
3. ...
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Step 7: Offer Next Actions
|
|
163
|
+
|
|
164
|
+
Based on findings:
|
|
165
|
+
- **If CRITICAL issues**: "Run `/docguard.fix --doc [name]` to resolve blocking issues"
|
|
166
|
+
- **If only LOW/MEDIUM**: "Documentation is healthy. Consider `/docguard.fix` for polish"
|
|
167
|
+
- **If all clean**: "Documentation is excellent. No action needed."
|
|
168
|
+
|
|
169
|
+
Ask: "Would you like me to fix the top N issues? (I'll show you what I plan to change before applying)"
|
|
170
|
+
|
|
171
|
+
## Behavior Rules
|
|
172
|
+
|
|
173
|
+
- **NEVER modify files** — this is strictly read-only analysis
|
|
174
|
+
- **ALWAYS run real CLI commands** — don't simulate or guess results
|
|
175
|
+
- **Be specific** — cite exact file paths, line numbers, and content
|
|
176
|
+
- **Compare actual code vs docs** — don't just validate formatting
|
|
177
|
+
- **Limit findings to 50** — aggregate overflow in a summary count
|
|
178
|
+
- **Prioritize high-signal findings** — one CRITICAL finding is worth ten LOW findings
|
|
179
|
+
|
|
180
|
+
## Context
|
|
181
|
+
|
|
182
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docguard-score
|
|
3
|
+
description: CDD maturity assessment with category-aware improvement roadmap. Runs scoring
|
|
4
|
+
engine, analyzes category breakdown, identifies highest-impact improvements, and
|
|
5
|
+
generates a before/after improvement plan with projected score gains.
|
|
6
|
+
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
7
|
+
metadata:
|
|
8
|
+
author: docguard
|
|
9
|
+
version: 0.9.5
|
|
10
|
+
source: extensions/spec-kit-docguard/skills/docguard-score
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# DocGuard Score Skill
|
|
14
|
+
|
|
15
|
+
## User Input
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
22
|
+
|
|
23
|
+
## Goal
|
|
24
|
+
|
|
25
|
+
Run DocGuard's CDD maturity scoring engine, analyze the category breakdown, identify highest-ROI improvements, and produce an actionable improvement roadmap showing projected score gains per fix.
|
|
26
|
+
|
|
27
|
+
## Execution Flow
|
|
28
|
+
|
|
29
|
+
### Step 1: Run Scoring Engine
|
|
30
|
+
|
|
31
|
+
Execute both tools for comprehensive data:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx docguard-cli score 2>&1
|
|
35
|
+
npx docguard-cli guard 2>&1
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If in DocGuard dev environment:
|
|
39
|
+
```bash
|
|
40
|
+
node cli/docguard.mjs score 2>&1
|
|
41
|
+
node cli/docguard.mjs guard 2>&1
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Step 2: Parse Score Breakdown
|
|
45
|
+
|
|
46
|
+
Extract the category-level scores:
|
|
47
|
+
|
|
48
|
+
| Category | Score | Weight | Points | Potential Gain |
|
|
49
|
+
|----------|:-----:|:------:|:------:|:--------------:|
|
|
50
|
+
| Structure | X% | ×25 | N | [25 - N] |
|
|
51
|
+
| Doc Quality | X% | ×20 | N | [20 - N] |
|
|
52
|
+
| Testing | X% | ×15 | N | [15 - N] |
|
|
53
|
+
| Security | X% | ×10 | N | [10 - N] |
|
|
54
|
+
| Environment | X% | ×10 | N | [10 - N] |
|
|
55
|
+
| Drift | X% | ×10 | N | [10 - N] |
|
|
56
|
+
| Changelog | X% | ×5 | N | [5 - N] |
|
|
57
|
+
| Architecture | X% | ×5 | N | [5 - N] |
|
|
58
|
+
|
|
59
|
+
Calculate `Potential Gain` for each category = (weight - current points).
|
|
60
|
+
|
|
61
|
+
### Step 3: Grade Classification
|
|
62
|
+
|
|
63
|
+
| Grade | Score | Description |
|
|
64
|
+
|-------|:-----:|------------|
|
|
65
|
+
| A+ | 95-100 | Exemplary — production-grade documentation, CDD fully adopted |
|
|
66
|
+
| A | 85-94 | Strong — minor improvements possible, CI-gate ready |
|
|
67
|
+
| B | 70-84 | Good — documentation covers essentials, some gaps exist |
|
|
68
|
+
| C | 50-69 | Fair — significant documentation debt, multiple gaps |
|
|
69
|
+
| D | 30-49 | Poor — major structural gaps, limited doc coverage |
|
|
70
|
+
| F | 0-29 | Critical — documentation infrastructure missing |
|
|
71
|
+
|
|
72
|
+
### Step 4: ROI-Based Improvement Roadmap
|
|
73
|
+
|
|
74
|
+
Sort categories by `Potential Gain / Effort` ratio:
|
|
75
|
+
|
|
76
|
+
For each category below 100%, calculate:
|
|
77
|
+
- **Gap**: What checks are failing?
|
|
78
|
+
- **Effort**: How hard is it to fix? (LOW = update metadata, MEDIUM = add content, HIGH = research + write)
|
|
79
|
+
- **Impact**: Points gained if fixed to 100%
|
|
80
|
+
- **ROI**: Impact / Effort ranking
|
|
81
|
+
|
|
82
|
+
Generate an improvement plan ordered by ROI:
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
### Improvement Roadmap
|
|
86
|
+
|
|
87
|
+
| Priority | Category | Current | Target | Points Gain | Effort | Action |
|
|
88
|
+
|:--------:|----------|:-------:|:------:|:-----------:|--------|--------|
|
|
89
|
+
| 1 | Structure | 80% | 100% | +5 | LOW | Create REQUIREMENTS.md |
|
|
90
|
+
| 2 | Changelog | 60% | 100% | +2 | LOW | Add missing entry for v0.9.5 |
|
|
91
|
+
| 3 | Doc Quality | 85% | 100% | +3 | MEDIUM | Fix negation language in SECURITY.md |
|
|
92
|
+
| 4 | Testing | 70% | 100% | +4.5 | HIGH | Add E2E test documentation |
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Step 5: Guard Check Correlation
|
|
96
|
+
|
|
97
|
+
Cross-reference the score with guard results:
|
|
98
|
+
|
|
99
|
+
- For each failing guard check, show which score category it impacts
|
|
100
|
+
- Calculate: "If you fix these N guard warnings, score will increase from X to Y"
|
|
101
|
+
- Show the **minimum set of fixes** needed to reach the next grade level
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
### Path to Next Grade
|
|
105
|
+
|
|
106
|
+
**Current**: B (78/100)
|
|
107
|
+
**Next Grade**: A (85/100) — need +7 points
|
|
108
|
+
|
|
109
|
+
**Minimum fixes for grade A**:
|
|
110
|
+
1. Fix Structure (3 checks failing) → +5 points
|
|
111
|
+
2. Fix Changelog (1 check failing) → +2 points
|
|
112
|
+
Total effort: ~30 minutes
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Step 6: ALCOA+ Compliance Summary
|
|
116
|
+
|
|
117
|
+
If the score engine reports ALCOA+ attributes, include:
|
|
118
|
+
|
|
119
|
+
| Attribute | Status | Description |
|
|
120
|
+
|-----------|--------|------------|
|
|
121
|
+
| Attributable | ✅/❌ | Author information in metadata |
|
|
122
|
+
| Legible | ✅/❌ | Readable formatting and structure |
|
|
123
|
+
| Contemporaneous | ✅/❌ | Docs updated within freshness window |
|
|
124
|
+
| Original | ✅/❌ | Primary source documentation |
|
|
125
|
+
| Accurate | ✅/❌ | Content matches codebase |
|
|
126
|
+
| Complete | ✅/❌ | All required sections present |
|
|
127
|
+
| Consistent | ✅/❌ | No cross-document conflicts |
|
|
128
|
+
| Enduring | ✅/❌ | Durable format (markdown, version controlled) |
|
|
129
|
+
| Available | ✅/❌ | Accessible to all team members |
|
|
130
|
+
|
|
131
|
+
### Step 7: Historical Comparison
|
|
132
|
+
|
|
133
|
+
If user has run score before (check git log for score badge changes):
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
### Score History
|
|
137
|
+
| Date | Score | Grade | Change |
|
|
138
|
+
|------|:-----:|:-----:|:------:|
|
|
139
|
+
| 2026-03-14 | 100 | A+ | +22 |
|
|
140
|
+
| 2026-03-13 | 78 | B | baseline |
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Step 8: Completion Report
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
## CDD Maturity Assessment
|
|
147
|
+
|
|
148
|
+
**Project**: [name]
|
|
149
|
+
**Score**: [X]/100 ([grade])
|
|
150
|
+
**Guard**: [N]/[M] checks passed
|
|
151
|
+
**ALCOA+**: [N]/9 attributes met
|
|
152
|
+
|
|
153
|
+
### Category Health
|
|
154
|
+
[Table from Step 2]
|
|
155
|
+
|
|
156
|
+
### Improvement Roadmap
|
|
157
|
+
[Plan from Step 4]
|
|
158
|
+
|
|
159
|
+
### Path to Next Grade
|
|
160
|
+
[Analysis from Step 5]
|
|
161
|
+
|
|
162
|
+
### Suggested Next Steps
|
|
163
|
+
- `/docguard.fix` — Fix the top [N] issues automatically
|
|
164
|
+
- `/docguard.review` — Deep semantic analysis for accuracy verification
|
|
165
|
+
- `/docguard.guard` — Verify fixes pass all validators
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Behavior Rules
|
|
169
|
+
|
|
170
|
+
- **ALWAYS run real CLI** — never simulate scores
|
|
171
|
+
- **Show math** — explain how score is calculated (category × weight)
|
|
172
|
+
- **Be actionable** — every recommendation must have a specific action
|
|
173
|
+
- **Compare before/after** — if user has previously run score in this session, show improvement
|
|
174
|
+
- **Focus on ROI** — surface the cheapest fixes with the biggest score impact first
|
|
175
|
+
|
|
176
|
+
## Context
|
|
177
|
+
|
|
178
|
+
$ARGUMENTS
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# DocGuard Extension Hooks for Spec Kit
|
|
2
|
+
# Place this file at .specify/extensions.yml in your project root
|
|
3
|
+
# to integrate DocGuard into the spec-kit workflow.
|
|
4
|
+
#
|
|
5
|
+
# DocGuard will automatically run as a quality gate after implementation
|
|
6
|
+
# and optionally before task generation.
|
|
7
|
+
|
|
8
|
+
schema_version: "1.0"
|
|
9
|
+
|
|
10
|
+
extension: docguard
|
|
11
|
+
|
|
12
|
+
hooks:
|
|
13
|
+
# Run DocGuard guard after /speckit.implement completes
|
|
14
|
+
# This ensures documentation stays in sync with code changes
|
|
15
|
+
after_implement:
|
|
16
|
+
- extension: docguard
|
|
17
|
+
command: speckit.docguard.guard
|
|
18
|
+
description: "Validate documentation passes CDD standards after implementation"
|
|
19
|
+
enabled: true
|
|
20
|
+
optional: true
|
|
21
|
+
prompt: "Run DocGuard guard to verify documentation quality after implementation changes?"
|
|
22
|
+
|
|
23
|
+
# Run DocGuard review before /speckit.tasks to catch doc drift early
|
|
24
|
+
before_tasks:
|
|
25
|
+
- extension: docguard
|
|
26
|
+
command: speckit.docguard.review
|
|
27
|
+
description: "Review documentation consistency before generating tasks"
|
|
28
|
+
enabled: true
|
|
29
|
+
optional: true # Optional — user can skip
|
|
30
|
+
prompt: "Run DocGuard review to check documentation health before task generation?"
|
|
31
|
+
|
|
32
|
+
# Run DocGuard guard after /speckit.tasks to validate doc coverage
|
|
33
|
+
after_tasks:
|
|
34
|
+
- extension: docguard
|
|
35
|
+
command: speckit.docguard.score
|
|
36
|
+
description: "Show CDD maturity score after task generation"
|
|
37
|
+
enabled: true
|
|
38
|
+
optional: true
|
|
39
|
+
prompt: "Check CDD maturity score after task generation?"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docguard-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "The enforcement tool for Canonical-Driven Development (CDD). Audit, generate, and guard your project documentation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"cli/",
|
|
50
50
|
"templates/",
|
|
51
51
|
"commands/",
|
|
52
|
+
"extensions/",
|
|
52
53
|
"docs/",
|
|
53
54
|
"STANDARD.md",
|
|
54
55
|
"PHILOSOPHY.md",
|
|
@@ -1,65 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Find and fix all CDD documentation issues using AI-driven research
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Verify Fixes
|
|
5
|
+
agent: docguard.guard
|
|
6
|
+
prompt: Run guard to verify all fixes pass
|
|
7
|
+
- label: Check Score
|
|
8
|
+
agent: docguard.score
|
|
9
|
+
prompt: Show score improvement after fixes
|
|
10
|
+
---
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
# /docguard.fix — Find and Fix CDD Documentation Issues
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
You are an AI agent responsible for maintaining documentation quality using DocGuard.
|
|
6
15
|
|
|
7
|
-
|
|
16
|
+
## Step 1: Assess Current State
|
|
8
17
|
|
|
9
18
|
```bash
|
|
10
|
-
npx docguard
|
|
19
|
+
npx docguard-cli diagnose
|
|
11
20
|
```
|
|
12
21
|
|
|
13
|
-
Parse the
|
|
14
|
-
- `issueCount`: total number of issues
|
|
15
|
-
- `issues[]`: each issue with `type`, `severity`, `file`, and `fix.ai_instruction`
|
|
22
|
+
Parse the output to identify all issues — categorized as errors or warnings with AI-ready fix prompts.
|
|
16
23
|
|
|
17
|
-
If
|
|
24
|
+
If no issues found, report "All CDD documentation is up to date" and stop.
|
|
18
25
|
|
|
19
26
|
## Step 2: Fix Each Issue
|
|
20
27
|
|
|
21
|
-
For each issue
|
|
22
|
-
|
|
23
|
-
### If type is `missing-file`:
|
|
24
|
-
Run `npx docguard fix --auto` first to create skeleton files, then continue to Step 3.
|
|
28
|
+
For each issue, determine the fix type:
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
| Issue Type | Action |
|
|
31
|
+
|-----------|--------|
|
|
32
|
+
| `missing-file` | Run `npx docguard-cli fix --doc <name>` to generate |
|
|
33
|
+
| `empty-doc` / `partial-doc` | Proceed to Step 3 for codebase research |
|
|
34
|
+
| `missing-config` | Create `.docguard.json` based on project type |
|
|
35
|
+
| `stale-doc` | Update `docguard:last-reviewed` date and content |
|
|
36
|
+
| `quality-issue` | Fix negation language, add missing sections |
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
Create `.docguard.json` based on the project. Detect the project type from `package.json`.
|
|
38
|
+
## Step 3: Write Real Content
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
For each document that needs content, run:
|
|
40
|
+
For each document that needs content:
|
|
36
41
|
|
|
37
42
|
```bash
|
|
38
|
-
npx docguard fix --doc <name>
|
|
43
|
+
npx docguard-cli fix --doc <name>
|
|
39
44
|
```
|
|
40
45
|
|
|
41
|
-
Where `<name>` is
|
|
46
|
+
Where `<name>` is: `architecture`, `data-model`, `security`, `test-spec`, `environment`
|
|
42
47
|
|
|
43
48
|
Read the output carefully — it contains:
|
|
44
|
-
- **RESEARCH STEPS**: Exactly what files to read and commands to run
|
|
45
|
-
- **WRITE THE DOCUMENT**:
|
|
46
|
-
|
|
47
|
-
Execute the research steps, then write the document with REAL project content. No placeholders.
|
|
48
|
-
|
|
49
|
-
## Step 4: Verify
|
|
50
|
-
|
|
51
|
-
After fixing all documents, run:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npx docguard guard
|
|
55
|
-
```
|
|
49
|
+
- **RESEARCH STEPS**: Exactly what files to read and commands to run
|
|
50
|
+
- **WRITE THE DOCUMENT**: Expected structure and content for each section
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
Execute the research steps, then write with REAL project content. No placeholders.
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
## Step 4: Verify (Iterate up to 3 times)
|
|
60
55
|
|
|
61
56
|
```bash
|
|
62
|
-
npx docguard
|
|
57
|
+
npx docguard-cli guard
|
|
58
|
+
npx docguard-cli score
|
|
63
59
|
```
|
|
64
60
|
|
|
65
|
-
Report the final CDD score
|
|
61
|
+
All checks should pass. If any fail, read the output and fix remaining issues. Report the final CDD score.
|
|
@@ -1,33 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Run DocGuard guard validation — check all 19 validators and fix any issues
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix Issues
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Fix all documentation issues found by guard
|
|
7
|
+
- label: Check Score
|
|
8
|
+
agent: docguard.score
|
|
9
|
+
prompt: Show CDD maturity score after fixes
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /docguard.guard — Validate CDD Compliance
|
|
2
13
|
|
|
3
14
|
You are an AI agent enforcing Canonical-Driven Development (CDD) compliance using DocGuard.
|
|
4
15
|
|
|
5
16
|
## Step 1: Run Guard
|
|
6
17
|
|
|
7
18
|
```bash
|
|
8
|
-
npx docguard guard
|
|
19
|
+
npx docguard-cli guard
|
|
9
20
|
```
|
|
10
21
|
|
|
11
|
-
Read the output. It shows pass
|
|
12
|
-
|
|
22
|
+
Read the output. It shows pass (✅), warn (⚠️), or fail (❌) for each of the 19 validators:
|
|
23
|
+
|
|
24
|
+
| Priority | Validators |
|
|
25
|
+
|----------|-----------|
|
|
26
|
+
| CRITICAL | Structure, Security, Test-Spec |
|
|
27
|
+
| HIGH | Doc Sections, Drift, Changelog, Traceability |
|
|
28
|
+
| MEDIUM | Freshness, Docs-Coverage, Doc-Quality, Metrics-Consistency |
|
|
29
|
+
| LOW | TODO-Tracking, Schema-Sync, Spec-Kit, Metadata-Sync |
|
|
13
30
|
|
|
14
31
|
## Step 2: Handle Results
|
|
15
32
|
|
|
16
33
|
### If all checks pass:
|
|
17
34
|
Report success and the score:
|
|
18
35
|
```bash
|
|
19
|
-
npx docguard score
|
|
36
|
+
npx docguard-cli score
|
|
20
37
|
```
|
|
21
38
|
|
|
22
39
|
### If checks fail:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
npx docguard fix
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Read the output to understand what needs fixing. For documents that need real content:
|
|
40
|
+
For each failing check, provide an **exact fix** — specific file, section, and content.
|
|
41
|
+
Then run the fix workflow:
|
|
29
42
|
```bash
|
|
30
|
-
npx docguard fix --doc <name>
|
|
43
|
+
npx docguard-cli fix --doc <name>
|
|
31
44
|
```
|
|
32
45
|
|
|
33
46
|
Execute the research steps in the output, write real content, then re-run guard to verify.
|
|
@@ -35,6 +48,6 @@ Execute the research steps in the output, write real content, then re-run guard
|
|
|
35
48
|
## Step 3: Report
|
|
36
49
|
|
|
37
50
|
Show the user:
|
|
38
|
-
1. Which checks passed/failed
|
|
51
|
+
1. Which checks passed/failed (with severity)
|
|
39
52
|
2. What was fixed
|
|
40
53
|
3. Final CDD score
|
|
@@ -1,54 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Initialize Canonical-Driven Development in a new or existing project
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Generate Docs
|
|
5
|
+
agent: docguard.fix
|
|
6
|
+
prompt: Generate and populate all canonical documentation from codebase
|
|
7
|
+
- label: Check Status
|
|
8
|
+
agent: docguard.guard
|
|
9
|
+
prompt: Run guard to see initial documentation status
|
|
10
|
+
---
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
# /docguard.init — Set Up CDD Documentation
|
|
13
|
+
|
|
14
|
+
You are an AI agent initializing Canonical-Driven Development (CDD) for a new or existing project.
|
|
4
15
|
|
|
5
16
|
## Step 1: Initialize Skeleton Files
|
|
6
17
|
|
|
7
18
|
```bash
|
|
8
|
-
npx docguard init
|
|
19
|
+
npx docguard-cli init
|
|
9
20
|
```
|
|
10
21
|
|
|
11
|
-
This creates the folder structure and template files.
|
|
22
|
+
This creates the folder structure and template files. The templates are skeletons — they need real content.
|
|
12
23
|
|
|
13
24
|
## Step 2: Detect and Configure Project Type
|
|
14
25
|
|
|
15
|
-
Create `.docguard.json` based on what you find:
|
|
16
|
-
|
|
17
26
|
```bash
|
|
18
27
|
cat package.json
|
|
19
28
|
```
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
- `projectType`: "cli" (has `bin` field), "webapp" (has react/next/vue), "api" (has express/fastify), or "library" (default)
|
|
23
|
-
- `needsE2E`: true for webapps, false for CLIs/libraries
|
|
24
|
-
- `needsEnvVars`: true for APIs/webapps with env config, false for CLIs
|
|
25
|
-
- `needsDatabase`: true if database dependencies found
|
|
30
|
+
Create `.docguard.json` based on what you find:
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
| Signal | Setting |
|
|
33
|
+
|--------|---------|
|
|
34
|
+
| Has `bin` field | `projectType: "cli"` |
|
|
35
|
+
| Has react/next/vue | `projectType: "webapp"`, `needsE2E: true` |
|
|
36
|
+
| Has express/fastify | `projectType: "api"`, `needsEnvVars: true` |
|
|
37
|
+
| Has database deps | `needsDatabase: true` |
|
|
38
|
+
| Default | `projectType: "library"` |
|
|
28
39
|
|
|
29
40
|
## Step 3: Write Real Documentation
|
|
30
41
|
|
|
31
|
-
For each canonical document, generate
|
|
42
|
+
For each canonical document, generate a research prompt and write real content:
|
|
32
43
|
|
|
33
44
|
```bash
|
|
34
|
-
npx docguard fix --doc architecture
|
|
45
|
+
npx docguard-cli fix --doc architecture
|
|
46
|
+
npx docguard-cli fix --doc data-model
|
|
47
|
+
npx docguard-cli fix --doc security
|
|
48
|
+
npx docguard-cli fix --doc test-spec
|
|
49
|
+
npx docguard-cli fix --doc environment
|
|
35
50
|
```
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Repeat for each document:
|
|
40
|
-
```bash
|
|
41
|
-
npx docguard fix --doc data-model
|
|
42
|
-
npx docguard fix --doc security
|
|
43
|
-
npx docguard fix --doc test-spec
|
|
44
|
-
npx docguard fix --doc environment
|
|
45
|
-
```
|
|
52
|
+
For each: read the output, execute RESEARCH STEPS, then write with real project content.
|
|
46
53
|
|
|
47
|
-
## Step 4: Verify
|
|
54
|
+
## Step 4: Verify
|
|
48
55
|
|
|
49
56
|
```bash
|
|
50
|
-
npx docguard guard
|
|
51
|
-
npx docguard score
|
|
57
|
+
npx docguard-cli guard
|
|
58
|
+
npx docguard-cli score
|
|
52
59
|
```
|
|
53
60
|
|
|
54
61
|
All checks should pass. Report the final score.
|
|
@@ -56,7 +63,7 @@ All checks should pass. Report the final score.
|
|
|
56
63
|
## Step 5: Set Up Git Hooks (Optional)
|
|
57
64
|
|
|
58
65
|
```bash
|
|
59
|
-
npx docguard hooks
|
|
66
|
+
npx docguard-cli hooks
|
|
60
67
|
```
|
|
61
68
|
|
|
62
|
-
|
|
69
|
+
Installs pre-commit (guard), pre-push (score), and commit-msg (conventional commits) hooks.
|