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,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: docguard.guard
|
|
18
|
+
description: "Validate documentation passes CDD standards after implementation"
|
|
19
|
+
enabled: true
|
|
20
|
+
optional: false # Mandatory — always runs after implement
|
|
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: 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: 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.6",
|
|
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": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"documentation",
|
|
25
25
|
"governance",
|
|
26
26
|
"ai-agents",
|
|
27
|
-
"spec-
|
|
27
|
+
"spec-kit",
|
|
28
|
+
"spec-driven-development",
|
|
28
29
|
"docguard",
|
|
29
30
|
"validation",
|
|
30
31
|
"cli",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"files": [
|
|
48
49
|
"cli/",
|
|
49
50
|
"templates/",
|
|
51
|
+
"commands/",
|
|
52
|
+
"extensions/",
|
|
50
53
|
"docs/",
|
|
51
54
|
"STANDARD.md",
|
|
52
55
|
"PHILOSOPHY.md",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Requirements
|
|
2
|
+
|
|
3
|
+
<!-- docguard:version 0.1.0 -->
|
|
4
|
+
<!-- docguard:status draft -->
|
|
5
|
+
|
|
6
|
+
> Tracks functional requirements, non-functional requirements, and success criteria.
|
|
7
|
+
> Use requirement IDs (FR-001, NFR-001, SC-001) for traceability back to code and tests.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Functional Requirements
|
|
12
|
+
|
|
13
|
+
<!-- List functional requirements with FR-NNN IDs -->
|
|
14
|
+
|
|
15
|
+
| ID | Priority | Requirement | Status | Test Coverage |
|
|
16
|
+
|----|----------|-------------|--------|---------------|
|
|
17
|
+
| FR-001 | P1 | System MUST [capability] | 🔴 Draft | ❌ |
|
|
18
|
+
| FR-002 | P1 | System MUST [capability] | 🔴 Draft | ❌ |
|
|
19
|
+
| FR-003 | P2 | Users MUST be able to [interaction] | 🔴 Draft | ❌ |
|
|
20
|
+
|
|
21
|
+
## Non-Functional Requirements
|
|
22
|
+
|
|
23
|
+
<!-- Quality attributes: performance, security, reliability -->
|
|
24
|
+
|
|
25
|
+
| ID | Category | Requirement | Metric |
|
|
26
|
+
|----|----------|-------------|--------|
|
|
27
|
+
| NFR-001 | Performance | Response time < 200ms p95 | Measured via [tool] |
|
|
28
|
+
| NFR-002 | Security | All endpoints require authentication | Validated by guard |
|
|
29
|
+
| NFR-003 | Reliability | 99.9% uptime SLA | Monitored via [tool] |
|
|
30
|
+
|
|
31
|
+
## Success Criteria
|
|
32
|
+
|
|
33
|
+
<!-- Measurable outcomes — aligned with spec-kit SC-NNN format -->
|
|
34
|
+
|
|
35
|
+
| ID | Criteria | Measurement | Target |
|
|
36
|
+
|----|----------|-------------|--------|
|
|
37
|
+
| SC-001 | [Measurable user outcome] | [How measured] | [Target value] |
|
|
38
|
+
| SC-002 | [Performance metric] | [How measured] | [Target value] |
|
|
39
|
+
|
|
40
|
+
## User Scenarios
|
|
41
|
+
|
|
42
|
+
<!-- Spec-kit aligned: Given/When/Then acceptance scenarios -->
|
|
43
|
+
|
|
44
|
+
### User Story 1 - [Title] (Priority: P1)
|
|
45
|
+
|
|
46
|
+
[Description of user journey]
|
|
47
|
+
|
|
48
|
+
**Acceptance Scenarios**:
|
|
49
|
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
|
50
|
+
2. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
|
51
|
+
|
|
52
|
+
## Traceability Matrix
|
|
53
|
+
|
|
54
|
+
<!-- Maps requirements → code → tests -->
|
|
55
|
+
|
|
56
|
+
| Requirement | Source File | Test File | Status |
|
|
57
|
+
|-------------|------------|-----------|--------|
|
|
58
|
+
| FR-001 | `src/[file]` | `tests/[file]` | ❌ |
|
|
59
|
+
|
|
60
|
+
## Revision History
|
|
61
|
+
|
|
62
|
+
| Version | Date | Author | Changes |
|
|
63
|
+
|---------|------|--------|---------|
|
|
64
|
+
| 0.1.0 | YYYY-MM-DD | DocGuard Init | Initial template |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
*Generated by [DocGuard](https://github.com/raccioly/docguard) — aligned with [Spec Kit](https://github.com/github/spec-kit) standards.*
|
|
@@ -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.
|
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: Review documentation quality — identify drift, coverage gaps, and improvements
|
|
3
|
+
handoffs:
|
|
4
|
+
- label: Fix Issues
|
|
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 checks pass after review
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /docguard.review — Review Documentation vs Code
|
|
2
13
|
|
|
3
14
|
You are an AI agent reviewing documentation quality and detecting drift between docs and code.
|
|
4
15
|
|
|
5
|
-
## Step 1: Run
|
|
16
|
+
## Step 1: Run Diagnostics
|
|
6
17
|
|
|
7
18
|
```bash
|
|
8
|
-
npx docguard
|
|
19
|
+
npx docguard-cli diagnose
|
|
20
|
+
npx docguard-cli diff
|
|
21
|
+
npx docguard-cli score
|
|
9
22
|
```
|
|
10
23
|
|
|
11
|
-
Read
|
|
24
|
+
Read all output. Identify where documentation no longer matches the codebase.
|
|
12
25
|
|
|
13
|
-
## Step 2:
|
|
26
|
+
## Step 2: Semantic Analysis (Beyond CLI)
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
npx docguard guard
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Note any failed validators — these indicate docs that need updating.
|
|
20
|
-
|
|
21
|
-
## Step 3: Check Freshness
|
|
28
|
+
For each canonical doc, verify alignment with actual code:
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
| Analysis | What to Check |
|
|
31
|
+
|----------|--------------|
|
|
32
|
+
| Architecture ↔ Code | Components in ARCHITECTURE.md exist as real modules |
|
|
33
|
+
| Data Model ↔ Code | Schemas in DATA-MODEL.md match actual implementations |
|
|
34
|
+
| Security Claims | Auth mechanisms in SECURITY.md match actual code |
|
|
35
|
+
| Test Coverage | Critical flows in TEST-SPEC.md have actual test files |
|
|
36
|
+
| Terminology | Same concepts named consistently across all docs |
|
|
28
37
|
|
|
29
|
-
## Step
|
|
38
|
+
## Step 3: Update Stale Docs
|
|
30
39
|
|
|
31
40
|
For each stale or drifted document:
|
|
32
41
|
1. Read the relevant source code files
|
|
33
|
-
2. Update the
|
|
42
|
+
2. Update the specific section that changed
|
|
34
43
|
3. Update the `docguard:last-reviewed` date to today
|
|
35
44
|
4. If the change is intentional drift, add an entry to DRIFT-LOG.md
|
|
45
|
+
5. Add entry to CHANGELOG.md under [Unreleased]
|
|
36
46
|
|
|
37
|
-
## Step
|
|
47
|
+
## Step 4: Verify
|
|
38
48
|
|
|
39
49
|
```bash
|
|
40
|
-
npx docguard guard
|
|
41
|
-
npx docguard score
|
|
50
|
+
npx docguard-cli guard
|
|
51
|
+
npx docguard-cli score
|
|
42
52
|
```
|
|
43
53
|
|
|
44
|
-
Report
|
|
54
|
+
Report findings, changes made, and the final score.
|