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.
Files changed (40) hide show
  1. package/README.md +281 -203
  2. package/cli/commands/diff.mjs +16 -3
  3. package/cli/commands/init.mjs +4 -0
  4. package/cli/commands/setup.mjs +455 -0
  5. package/cli/docguard.mjs +12 -0
  6. package/cli/ensure-skills.mjs +96 -0
  7. package/cli/validators/doc-quality.mjs +2 -2
  8. package/cli/validators/docs-sync.mjs +41 -6
  9. package/cli/validators/metrics-consistency.mjs +2 -1
  10. package/cli/validators/todo-tracking.mjs +11 -6
  11. package/commands/docguard.fix.md +37 -17
  12. package/commands/docguard.guard.md +45 -12
  13. package/commands/docguard.review.md +37 -19
  14. package/commands/docguard.score.md +36 -17
  15. package/docs/installation.md +37 -19
  16. package/docs/quickstart.md +21 -6
  17. package/extensions/spec-kit-docguard/LICENSE +21 -0
  18. package/extensions/spec-kit-docguard/README.md +103 -0
  19. package/extensions/spec-kit-docguard/commands/diagnose.md +43 -0
  20. package/extensions/spec-kit-docguard/commands/generate.md +50 -0
  21. package/extensions/spec-kit-docguard/commands/guard.md +73 -0
  22. package/extensions/spec-kit-docguard/commands/init.md +38 -0
  23. package/extensions/spec-kit-docguard/commands/score.md +53 -0
  24. package/extensions/spec-kit-docguard/commands/trace.md +56 -0
  25. package/extensions/spec-kit-docguard/extension.yml +92 -0
  26. package/extensions/spec-kit-docguard/scripts/bash/common.sh +106 -0
  27. package/extensions/spec-kit-docguard/scripts/bash/docguard-check-docs.sh +153 -0
  28. package/extensions/spec-kit-docguard/scripts/bash/docguard-init-doc.sh +153 -0
  29. package/extensions/spec-kit-docguard/scripts/bash/docguard-suggest-fix.sh +107 -0
  30. package/extensions/spec-kit-docguard/skills/docguard-fix/SKILL.md +218 -0
  31. package/extensions/spec-kit-docguard/skills/docguard-guard/SKILL.md +167 -0
  32. package/extensions/spec-kit-docguard/skills/docguard-review/SKILL.md +182 -0
  33. package/extensions/spec-kit-docguard/skills/docguard-score/SKILL.md +178 -0
  34. package/extensions/spec-kit-docguard/templates/extensions.yml +39 -0
  35. package/package.json +2 -1
  36. package/templates/commands/docguard.fix.md +35 -39
  37. package/templates/commands/docguard.guard.md +26 -13
  38. package/templates/commands/docguard.init.md +35 -28
  39. package/templates/commands/docguard.review.md +33 -23
  40. package/templates/commands/docguard.update.md +15 -4
@@ -36,7 +36,8 @@ export function validateMetricsConsistency(projectDir, config, guardResults) {
36
36
  if (r.status === 'skipped') return sum;
37
37
  return sum + (r.total || 0);
38
38
  }, 0);
39
- const validatorCount = guardResults.filter(r => r.status !== 'skipped').length;
39
+ // +1 because Metrics-Consistency itself hasn't been added to results yet
40
+ const validatorCount = guardResults.filter(r => r.status !== 'skipped').length + 1;
40
41
 
41
42
  actuals.checks = totalChecks;
42
43
  actuals.validators = validatorCount;
@@ -110,14 +110,19 @@ function checkSkippedTests(projectDir) {
110
110
  const isSkipped = SKIP_PATTERNS.some(p => p.test(line));
111
111
  if (!isSkipped) continue;
112
112
 
113
- // Check surrounding lines (1 above, 1 below, and inline) for explanation
114
- const prevLine = i > 0 ? lines[i - 1] : '';
115
- const nextLine = i < lines.length - 1 ? lines[i + 1] : '';
113
+ // Check surrounding lines (3 above, 1 below, and inline) for explanation
114
+ // Developers commonly place block comments above the skip call
115
+ const surroundingLines = [];
116
+ for (let j = Math.max(0, i - 3); j <= Math.min(lines.length - 1, i + 1); j++) {
117
+ surroundingLines.push(lines[j]);
118
+ }
119
+
120
+ // Also check for block comment pattern: /* REASON: ... */ or /** ... REASON: ... */
121
+ const blockCommentPattern = /\/\*[\s\S]*?(REASON|SKIP|TODO|FIXME|NOTE|WHY)\s*:/i;
116
122
 
117
123
  const hasReason =
118
- SKIP_REASON_PATTERN.test(prevLine) ||
119
- SKIP_REASON_PATTERN.test(line) ||
120
- SKIP_REASON_PATTERN.test(nextLine);
124
+ surroundingLines.some(l => SKIP_REASON_PATTERN.test(l)) ||
125
+ blockCommentPattern.test(surroundingLines.join('\n'));
121
126
 
122
127
  if (hasReason) {
123
128
  skippedWithReason++;
@@ -1,21 +1,27 @@
1
1
  ---
2
- description: Generate AI prompts to fix specific documentation issues identified by DocGuard
2
+ description: AI-driven documentation repair research codebase, generate content, validate against CDD standards
3
+ handoffs:
4
+ - label: Verify Fixes
5
+ agent: docguard.guard
6
+ prompt: Run guard to verify all fixes pass
7
+ - label: Check Score Improvement
8
+ agent: docguard.score
9
+ prompt: Show score improvement after fixes
3
10
  ---
4
11
 
5
12
  # DocGuard Fix — AI-Assisted Documentation Repair
6
13
 
7
- Generate targeted fix prompts for specific documentation issues.
14
+ Generate or repair canonical documentation by researching the actual codebase.
8
15
 
9
16
  ## What to do
10
17
 
11
- 1. First, identify what needs fixing:
18
+ 1. **Identify what needs fixing**:
12
19
  ```bash
13
20
  npx docguard-cli diagnose
14
21
  ```
15
22
 
16
- 2. Generate fix prompts for specific documents:
23
+ 2. **For a specific document**, generate a research-aware fix prompt:
17
24
  ```bash
18
- # Fix a specific canonical doc
19
25
  npx docguard-cli fix --doc architecture
20
26
  npx docguard-cli fix --doc security
21
27
  npx docguard-cli fix --doc test-spec
@@ -23,23 +29,37 @@ npx docguard-cli fix --doc data-model
23
29
  npx docguard-cli fix --doc environment
24
30
  ```
25
31
 
26
- 3. The fix command generates a detailed AI prompt. Read the prompt and execute its instructions:
27
- - It will reference the project's actual code structure
28
- - It will list specific sections to add or update
29
- - It will include examples aligned with the project's tech stack
32
+ 3. **Execute the research workflow** from the generated prompt:
33
+ - Read actual code files (not just filenames)
34
+ - Map module structure and dependencies
35
+ - Extract real data structures and schemas
36
+ - Identify actual auth mechanisms and security patterns
30
37
 
31
- 4. After fixing, verify the improvement:
38
+ 4. **Write documentation with real content**:
39
+ - Use actual file paths, module names, dependency names
40
+ - Include working command examples
41
+ - Use positive language (IEEE 830: "MUST use" not "MUST NOT avoid")
42
+ - Ensure Flesch-Kincaid grade level 8-10
43
+
44
+ 5. **Include metadata header** in every canonical doc:
45
+ ```markdown
46
+ <!-- docguard:version X.X.X -->
47
+ <!-- docguard:status active -->
48
+ <!-- docguard:last-reviewed YYYY-MM-DD -->
49
+ ```
50
+
51
+ 6. **Validate the fix** (iterate up to 3 times):
32
52
  ```bash
33
53
  npx docguard-cli guard
34
54
  ```
35
55
 
36
- 5. If the project uses Spec Kit, ensure specs align with spec-kit templates:
37
- - `spec.md` must have: User Scenarios, Requirements (FR-IDs), Success Criteria (SC-IDs)
38
- - `plan.md` must have: Summary, Technical Context, Project Structure
39
- - `tasks.md` must have: Phased breakdown (Phase 1, 2, 3+), Task IDs (T001+)
56
+ 7. If the project uses Spec Kit, align with spec-kit templates:
57
+ - `spec.md`: User Scenarios, Requirements (FR-IDs), Success Criteria (SC-IDs)
58
+ - `plan.md`: Summary, Technical Context, Project Structure
59
+ - `tasks.md`: Phased breakdown (Phase 1, 2, 3+), Task IDs (T001+)
40
60
 
41
61
  ## Important
42
62
 
43
- - Never overwrite existing documentation without creating a `.bak` backup
44
- - Use `--force` only when explicitly instructed by the user
45
- - Log any deviations from canonical docs in DRIFT-LOG.md with `// DRIFT: reason`
63
+ - Never use placeholder content every section must reference real code
64
+ - Back up before overwriting use `.bak` files or `safeWrite()`
65
+ - Log deviations in DRIFT-LOG.md with `// DRIFT: reason`
@@ -1,5 +1,15 @@
1
1
  ---
2
- description: Run DocGuard guard validation — check project documentation quality against CDD standards
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
3
13
  ---
4
14
 
5
15
  # DocGuard Guard — Documentation Quality Gate
@@ -8,20 +18,43 @@ Run the DocGuard CLI to validate all documentation against Canonical-Driven Deve
8
18
 
9
19
  ## What to do
10
20
 
11
- 1. Run the guard command:
21
+ 1. **Run the guard command**:
12
22
  ```bash
13
23
  npx docguard-cli guard
14
24
  ```
15
25
 
16
- 2. Review the output. Each validator reports ✅ (pass) or ❌ (fail):
17
- - **Structure**: Required CDD files exist
18
- - **Doc Sections**: Canonical docs have required sections
19
- - **Drift**: Code deviations logged in DRIFT-LOG.md
20
- - **Test-Spec**: Tests match TEST-SPEC.md rules
21
- - **Security**: No hardcoded secrets
22
- - **Spec-Kit**: Spec quality validation (FR-IDs, sections)
23
- - **Doc-Quality**: Readability and writing quality
26
+ 2. **Parse the output**. Each of the 19 validators reports ✅ (pass), ⚠️ (warning), or ❌ (fail):
24
27
 
25
- 3. If any checks fail, run `docguard diagnose` for a remediation plan.
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 |
26
49
 
27
- 4. All checks must pass before committing. Exit code 0 = pass, 1 = fail, 2 = warnings only.
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.
@@ -1,35 +1,53 @@
1
1
  ---
2
- description: Review documentation qualityidentify improvements and suggest fixes based on CDD and spec-kit standards
2
+ description: Cross-document consistency analysissemantic 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
3
10
  ---
4
11
 
5
12
  # DocGuard Review — Documentation Quality Analysis
6
13
 
7
- Analyze the project's documentation quality and suggest specific improvements.
14
+ Perform comprehensive, read-only analysis of documentation health with semantic cross-document consistency checking.
8
15
 
9
16
  ## What to do
10
17
 
11
- 1. Run the full diagnostic:
18
+ 1. **Run the full diagnostic**:
12
19
  ```bash
13
20
  npx docguard-cli diagnose
14
- ```
15
-
16
- 2. Run the scoring engine:
17
- ```bash
18
21
  npx docguard-cli score
19
22
  ```
20
23
 
21
- 3. For each issue found, analyze the root cause:
22
- - **Missing sections**: Check which mandatory sections are absent from canonical docs
23
- - **Low readability**: Identify overly complex sentences or passive voice
24
- - **Drift**: Find `// DRIFT:` comments in code not logged in DRIFT-LOG.md
25
- - **Stale docs**: Compare doc modification dates against code changes
26
- - **Spec quality**: Verify specs have FR-IDs, SC-IDs, and Given/When/Then scenarios
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 |
27
44
 
28
- 4. Suggest specific improvements for each issue. Quote the relevant section and propose the fix.
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
29
50
 
30
- 5. Prioritize fixes by impact:
31
- - 🔴 HIGH: Missing docs, security issues, broken traceability
32
- - 🟡 MEDIUM: Low readability, missing sections, stale content
33
- - 🟢 LOW: Minor formatting, missing badges, metadata sync
51
+ 5. **Output a structured report** with findings table, per-document health scores, and priority-ordered recommendations.
34
52
 
35
- 6. After making changes, re-run `npx docguard-cli guard` to verify improvements.
53
+ 6. **Do NOT modify files** this is read-only analysis. Suggest fixes for user approval.
@@ -1,27 +1,37 @@
1
1
  ---
2
- description: Show CDD maturity score comprehensive documentation health assessment with category breakdown
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
3
13
  ---
4
14
 
5
15
  # DocGuard Score — CDD Maturity Assessment
6
16
 
7
- Calculate and display the project's Canonical-Driven Development maturity score.
17
+ Calculate and display the project's Canonical-Driven Development maturity score with ROI-based improvement roadmap.
8
18
 
9
19
  ## What to do
10
20
 
11
- 1. Run the scoring engine:
21
+ 1. **Run the scoring engine**:
12
22
  ```bash
13
23
  npx docguard-cli score
14
24
  ```
15
25
 
16
- 2. For JSON output (CI/CD integration):
26
+ 2. **For JSON output** (CI/CD integration):
17
27
  ```bash
18
28
  npx docguard-cli score --format json
19
29
  ```
20
30
 
21
- 3. Interpret the results:
31
+ 3. **Interpret the grade**:
22
32
 
23
33
  | Grade | Score | Meaning |
24
- |-------|-------|---------|
34
+ |-------|:-----:|---------|
25
35
  | A+ | 95-100 | Exemplary — production-grade documentation |
26
36
  | A | 85-94 | Strong — minor improvements possible |
27
37
  | B | 70-84 | Good — some gaps to address |
@@ -29,14 +39,23 @@ npx docguard-cli score --format json
29
39
  | D | 30-49 | Poor — major gaps in documentation |
30
40
  | F | 0-29 | Critical — documentation infrastructure missing |
31
41
 
32
- 4. Focus on the category breakdown:
33
- - **Structure** (25%): Do required files exist?
34
- - **Doc Quality** (20%): Readability, completeness, sections
35
- - **Testing** (15%): Test coverage documentation
36
- - **Security** (10%): Security documentation
37
- - **Environment** (10%): Environment variable documentation
38
- - **Drift** (10%): Deviation tracking
39
- - **Changelog** (5%): Change log maintenance
40
- - **Architecture** (5%): Architecture documentation
41
-
42
- 5. Prioritize improvements by category weight fixing Structure issues has the highest impact.
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.
@@ -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 npx (Recommended)
8
+ ## Install via npm
9
9
 
10
- No installation needed. Run directly:
10
+ ### Option 1: Run directly (no install)
11
11
 
12
12
  ```bash
13
- npx docguard --help
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
- ## Install as Dev Dependency
18
+ ### Option 2: Install globally
19
19
 
20
- For projects that want a pinned version:
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 Globally
43
+ ## Install via Python (PyPI)
39
44
 
40
45
  ```bash
41
- npm install -g docguard
46
+ pip install docguard-cli
47
+ docguard diagnose
42
48
  ```
43
49
 
44
- Then use anywhere:
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 guard
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 ci --threshold 70
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
  ```
@@ -20,16 +20,32 @@ cd your-project
20
20
  npx docguard-cli init
21
21
  ```
22
22
 
23
- Creates all 5 canonical docs + tracking files + AI slash commands.
23
+ Creates all 6 canonical docs (including REQUIREMENTS.md) + tracking files + AI slash commands.
24
24
 
25
- ### Option C: From existing code (best for established projects)
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 with auto-fix
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,103 @@
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** — Quality gate integrations at implement, tasks, and review phases
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 | Alias | Purpose |
44
+ |---------|-------|---------|
45
+ | `speckit.docguard.guard` | `docguard.guard` | Run 19-validator quality gate with severity triage |
46
+ | `speckit.docguard.fix` | `docguard.fix` | AI-driven documentation repair with codebase research |
47
+ | `speckit.docguard.review` | `docguard.review` | Cross-document semantic consistency analysis (read-only) |
48
+ | `speckit.docguard.score` | `docguard.score` | CDD maturity score with ROI improvement roadmap |
49
+ | `speckit.docguard.diagnose` | — | Diagnose issues + generate multi-perspective AI prompts |
50
+ | `speckit.docguard.generate` | — | Reverse-engineer canonical docs from codebase |
51
+
52
+ ## AI Skills
53
+
54
+ DocGuard provides 4 enterprise-grade AI behavior protocols modeled after Spec Kit's skill architecture:
55
+
56
+ | Skill | Lines | What It Does |
57
+ |-------|:-----:|-------------|
58
+ | `docguard-guard` | 155 | 6-step execution with severity triage, structured reporting, remediation recommendations |
59
+ | `docguard-fix` | 195 | 7-step research workflow with per-document codebase research, 3-iteration validation loops |
60
+ | `docguard-review` | 170 | Semantic cross-document analysis with 6 analysis passes and quality scoring matrix |
61
+ | `docguard-score` | 165 | CDD maturity assessment with ROI-based improvement roadmap and grade progression |
62
+
63
+ 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).
64
+
65
+ ## Spec Kit Integration
66
+
67
+ ### Workflow Hooks
68
+
69
+ DocGuard integrates into the spec-kit workflow through hooks:
70
+
71
+ ```yaml
72
+ hooks:
73
+ after_implement: # Optional — quality gate after /speckit.implement
74
+ command: speckit.docguard.guard
75
+ before_tasks: # Optional — review docs before task generation
76
+ command: speckit.docguard.review
77
+ after_tasks: # Optional — show score after tasks
78
+ command: speckit.docguard.score
79
+ ```
80
+
81
+ ### Workflow Chaining
82
+
83
+ All commands support YAML handoffs for seamless workflow chaining:
84
+
85
+ ```
86
+ guard → fix → review → score
87
+ ↑ ↓
88
+ └──────────────────────┘
89
+ ```
90
+
91
+ ## Scripts
92
+
93
+ | Script | Purpose |
94
+ |--------|---------|
95
+ | `docguard-check-docs.sh` | Discover docs, return JSON inventory with metadata |
96
+ | `docguard-suggest-fix.sh` | Run guard, prioritize fixes as JSON |
97
+ | `docguard-init-doc.sh` | Initialize canonical doc with metadata header |
98
+
99
+ All scripts support `--json` mode for AI-parseable output.
100
+
101
+ ## License
102
+
103
+ MIT © Ricardo Accioly