docguard-cli 0.5.1

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/PHILOSOPHY.md +150 -0
  3. package/README.md +309 -0
  4. package/STANDARD.md +751 -0
  5. package/cli/commands/agents.mjs +221 -0
  6. package/cli/commands/audit.mjs +92 -0
  7. package/cli/commands/badge.mjs +72 -0
  8. package/cli/commands/ci.mjs +80 -0
  9. package/cli/commands/diagnose.mjs +273 -0
  10. package/cli/commands/diff.mjs +360 -0
  11. package/cli/commands/fix.mjs +610 -0
  12. package/cli/commands/generate.mjs +842 -0
  13. package/cli/commands/guard.mjs +158 -0
  14. package/cli/commands/hooks.mjs +227 -0
  15. package/cli/commands/init.mjs +249 -0
  16. package/cli/commands/score.mjs +396 -0
  17. package/cli/commands/watch.mjs +143 -0
  18. package/cli/docguard.mjs +458 -0
  19. package/cli/validators/architecture.mjs +380 -0
  20. package/cli/validators/changelog.mjs +39 -0
  21. package/cli/validators/docs-sync.mjs +110 -0
  22. package/cli/validators/drift.mjs +101 -0
  23. package/cli/validators/environment.mjs +70 -0
  24. package/cli/validators/freshness.mjs +224 -0
  25. package/cli/validators/security.mjs +101 -0
  26. package/cli/validators/structure.mjs +88 -0
  27. package/cli/validators/test-spec.mjs +115 -0
  28. package/docs/ai-integration.md +179 -0
  29. package/docs/commands.md +239 -0
  30. package/docs/configuration.md +96 -0
  31. package/docs/faq.md +155 -0
  32. package/docs/installation.md +81 -0
  33. package/docs/profiles.md +103 -0
  34. package/docs/quickstart.md +79 -0
  35. package/package.json +57 -0
  36. package/templates/ADR.md.template +64 -0
  37. package/templates/AGENTS.md.template +88 -0
  38. package/templates/ARCHITECTURE.md.template +78 -0
  39. package/templates/CHANGELOG.md.template +16 -0
  40. package/templates/CURRENT-STATE.md.template +64 -0
  41. package/templates/DATA-MODEL.md.template +66 -0
  42. package/templates/DEPLOYMENT.md.template +66 -0
  43. package/templates/DRIFT-LOG.md.template +18 -0
  44. package/templates/ENVIRONMENT.md.template +43 -0
  45. package/templates/KNOWN-GOTCHAS.md.template +69 -0
  46. package/templates/ROADMAP.md.template +82 -0
  47. package/templates/RUNBOOKS.md.template +115 -0
  48. package/templates/SECURITY.md.template +42 -0
  49. package/templates/TEST-SPEC.md.template +55 -0
  50. package/templates/TROUBLESHOOTING.md.template +96 -0
  51. package/templates/VENDOR-BUGS.md.template +74 -0
  52. package/templates/ci/github-actions.yml +39 -0
  53. package/templates/commands/docguard.fix.md +65 -0
  54. package/templates/commands/docguard.guard.md +40 -0
  55. package/templates/commands/docguard.init.md +62 -0
  56. package/templates/commands/docguard.review.md +44 -0
  57. package/templates/commands/docguard.update.md +44 -0
@@ -0,0 +1,69 @@
1
+ # Known Gotchas
2
+
3
+ <!-- docguard:version 0.1.0 -->
4
+ <!-- docguard:status living -->
5
+ <!-- docguard:last-reviewed YYYY-MM-DD -->
6
+
7
+ > **Implementation document** — Current state. Lessons learned during development and operations.
8
+ > This is a living document. Add entries as you discover them.
9
+
10
+ | Metadata | Value |
11
+ |----------|-------|
12
+ | **Status** | ![Status](https://img.shields.io/badge/status-living-blue) |
13
+ | **Version** | `0.1.0` |
14
+ | **Last Updated** | YYYY-MM-DD |
15
+
16
+ ---
17
+
18
+ ## How to Use This Document
19
+
20
+ Each gotcha follows this format:
21
+ - **Heading** = The component or area
22
+ - **Symptom**: What you observe
23
+ - **Gotcha**: The non-obvious root cause
24
+ - **Fix**: The verified solution
25
+ - **Step/Date**: When this was discovered (for traceability)
26
+
27
+ ---
28
+
29
+ ## 1. <!-- Component/Area Name -->
30
+
31
+ ### <!-- Short Descriptive Title -->
32
+
33
+ **Symptom**: <!-- What does the user/developer observe? -->
34
+
35
+ **Gotcha**: <!-- The non-obvious root cause that trips people up -->
36
+
37
+ **Fix**: <!-- The verified solution -->
38
+
39
+ <!-- Optional: code example -->
40
+ ```
41
+ <!-- code fix example -->
42
+ ```
43
+
44
+ > Discovered: YYYY-MM-DD
45
+
46
+ ---
47
+
48
+ ## 2. <!-- Next Component/Area -->
49
+
50
+ ### <!-- Short Descriptive Title -->
51
+
52
+ **Symptom**: <!-- What you observe -->
53
+
54
+ **Gotcha**: <!-- Root cause -->
55
+
56
+ **Fix**: <!-- Solution -->
57
+
58
+ > Discovered: YYYY-MM-DD
59
+
60
+ ---
61
+
62
+ ## Quick Reference Table
63
+
64
+ <!-- Summary of all gotchas for quick scanning -->
65
+
66
+ | # | Area | Gotcha Summary | Severity |
67
+ |---|------|---------------|----------|
68
+ | 1 | | | <!-- 🔴 Critical / 🟡 Medium / 🟢 Low --> |
69
+ | 2 | | | |
@@ -0,0 +1,82 @@
1
+ # Roadmap
2
+
3
+ <!-- docguard:version 0.1.0 -->
4
+ <!-- docguard:status living -->
5
+ <!-- docguard:last-reviewed YYYY-MM-DD -->
6
+ <!-- docguard:owner @your-github-username -->
7
+
8
+ > **Canonical document** — Design intent. The planned evolution of this project.
9
+ > Updated as priorities shift. Completed items move to CHANGELOG.md.
10
+
11
+ | Metadata | Value |
12
+ |----------|-------|
13
+ | **Status** | ![Status](https://img.shields.io/badge/status-living-blue) |
14
+ | **Version** | `0.1.0` |
15
+ | **Last Updated** | YYYY-MM-DD |
16
+ | **Owner** | @your-github-username |
17
+
18
+ ---
19
+
20
+ ## Vision
21
+
22
+ <!-- One sentence: where is this project going? -->
23
+
24
+ ## Current Phase
25
+
26
+ <!-- What phase is the project in right now? -->
27
+
28
+ | Phase | Name | Status | Timeline |
29
+ |:-----:|------|:------:|----------|
30
+ | 0 | <!-- e.g. Foundation --> | ✅ Complete | <!-- e.g. Q1 2026 --> |
31
+ | 1 | <!-- e.g. Core Features --> | 🔄 In Progress | <!-- e.g. Q2 2026 --> |
32
+ | 2 | <!-- e.g. Integrations --> | ⏳ Planned | <!-- e.g. Q3 2026 --> |
33
+ | 3 | <!-- e.g. Scale --> | 💭 Future | <!-- e.g. Q4 2026 --> |
34
+
35
+ ---
36
+
37
+ ## Phase 0: <!-- Name --> ✅
38
+
39
+ <!-- Summary of what was accomplished -->
40
+
41
+ - [x] <!-- Completed item 1 -->
42
+ - [x] <!-- Completed item 2 -->
43
+
44
+ ## Phase 1: <!-- Name --> 🔄
45
+
46
+ <!-- What's being built now -->
47
+
48
+ - [x] <!-- Already done -->
49
+ - [ ] <!-- In progress -->
50
+ - [ ] <!-- Planned this phase -->
51
+
52
+ ## Phase 2: <!-- Name --> ⏳
53
+
54
+ <!-- What comes after the current phase -->
55
+
56
+ - [ ] <!-- Feature 1 -->
57
+ - [ ] <!-- Feature 2 -->
58
+
59
+ ## Phase 3: <!-- Name --> 💭
60
+
61
+ <!-- Longer-term vision -->
62
+
63
+ - [ ] <!-- Feature 1 -->
64
+ - [ ] <!-- Feature 2 -->
65
+
66
+ ---
67
+
68
+ ## Parking Lot
69
+
70
+ <!-- Ideas that don't have a phase yet — captured so they're not lost -->
71
+
72
+ | Idea | Source | Notes |
73
+ |------|--------|-------|
74
+ | | <!-- e.g. user request, team discussion --> | |
75
+
76
+ ---
77
+
78
+ ## Revision History
79
+
80
+ | Date | Description |
81
+ |------|------------|
82
+ | YYYY-MM-DD | Initial roadmap created |
@@ -0,0 +1,115 @@
1
+ # Operational Runbooks
2
+
3
+ <!-- docguard:version 0.1.0 -->
4
+ <!-- docguard:status living -->
5
+ <!-- docguard:last-reviewed YYYY-MM-DD -->
6
+
7
+ > **Implementation document** — Current state. Step-by-step procedures for operations.
8
+ > Each runbook is a self-contained procedure that can be executed independently.
9
+
10
+ | Metadata | Value |
11
+ |----------|-------|
12
+ | **Status** | ![Status](https://img.shields.io/badge/status-living-blue) |
13
+ | **Version** | `0.1.0` |
14
+ | **Last Updated** | YYYY-MM-DD |
15
+
16
+ ---
17
+
18
+ ## Table of Contents
19
+
20
+ - [1. Deployment](#1-deployment)
21
+ - [2. Emergency Rollback](#2-emergency-rollback)
22
+ - [3. Health Monitoring](#3-health-monitoring)
23
+ - [4. Data Backup & Restore](#4-data-backup--restore)
24
+ - [5. Incident Response](#5-incident-response)
25
+
26
+ ---
27
+
28
+ ## 1. Deployment
29
+
30
+ ### Steps
31
+
32
+ 1. <!-- e.g. Push to GitHub → triggers build -->
33
+ 2. <!-- e.g. New container builds -->
34
+ 3. <!-- e.g. Health check passes -->
35
+ 4. <!-- Verification step -->
36
+
37
+ ### Verification
38
+
39
+ ```bash
40
+ # Verify deployment succeeded
41
+ ```
42
+
43
+ ---
44
+
45
+ ## 2. Emergency Rollback
46
+
47
+ ### When to Use
48
+
49
+ <!-- Under what conditions should a rollback be triggered? -->
50
+
51
+ ### Steps
52
+
53
+ ```bash
54
+ # Rollback command
55
+ ```
56
+
57
+ ### Constraints
58
+
59
+ - <!-- e.g. Database migrations must be backward-compatible -->
60
+
61
+ ---
62
+
63
+ ## 3. Health Monitoring
64
+
65
+ ### Endpoints
66
+
67
+ | Endpoint | Auth Required | Purpose |
68
+ |----------|:---:|---------|
69
+ | <!-- e.g. GET /health --> | No | Liveness check |
70
+ | <!-- e.g. GET /health/detailed --> | Yes | Component-level status |
71
+
72
+ ### Response Interpretation
73
+
74
+ | Status | Action |
75
+ |--------|--------|
76
+ | `healthy` | All systems operational |
77
+ | `degraded` | Non-critical issue, investigate |
78
+ | `unhealthy` | Critical failure, escalate immediately |
79
+
80
+ ---
81
+
82
+ ## 4. Data Backup & Restore
83
+
84
+ ### Create Backup
85
+
86
+ ```bash
87
+ # Backup command
88
+ ```
89
+
90
+ ### Restore from Backup
91
+
92
+ ```bash
93
+ # Restore command
94
+ ```
95
+
96
+ > ⚠️ Always verify backup integrity before restoring.
97
+
98
+ ---
99
+
100
+ ## 5. Incident Response
101
+
102
+ ### Severity Levels
103
+
104
+ | Level | Definition | Response Time | Escalation |
105
+ |-------|-----------|:---:|------------|
106
+ | **P0** | System down | Immediate | Page on-call |
107
+ | **P1** | Major feature broken | 15 min | Notify team lead |
108
+ | **P2** | Minor issue | 1 hour | Create ticket |
109
+ | **P3** | Cosmetic/low impact | Next sprint | Backlog |
110
+
111
+ ### Common Outage Scenarios
112
+
113
+ | Scenario | Impact | Mitigation |
114
+ |----------|--------|------------|
115
+ | <!-- e.g. Database down --> | <!-- e.g. All writes fail --> | <!-- e.g. Switch to read-only mode --> |
@@ -0,0 +1,42 @@
1
+ # Security
2
+
3
+ > **Canonical document** — Design intent. This file defines the security model.
4
+ > Last updated: YYYY-MM-DD
5
+
6
+ ---
7
+
8
+ ## Authentication
9
+
10
+ <!-- How users/services authenticate -->
11
+
12
+ | Method | Implementation | Details |
13
+ |--------|---------------|---------|
14
+ | <!-- e.g. JWT --> | <!-- e.g. RS256 tokens --> | <!-- e.g. 15min expiry --> |
15
+ | | | |
16
+
17
+ ## Authorization
18
+
19
+ <!-- Roles and permissions -->
20
+
21
+ | Role | Permissions | Scope |
22
+ |------|------------|-------|
23
+ | <!-- e.g. admin --> | <!-- e.g. read, write, delete --> | <!-- e.g. All resources --> |
24
+ | | | |
25
+
26
+ ## Secrets Management
27
+
28
+ <!-- Where secrets are stored, never in code -->
29
+
30
+ | Secret | Storage | Access Pattern |
31
+ |--------|---------|---------------|
32
+ | <!-- e.g. DB credentials --> | <!-- e.g. AWS Secrets Manager --> | <!-- e.g. Loaded at startup --> |
33
+ | | | |
34
+
35
+ ## Security Rules
36
+
37
+ <!-- Explicit rules that code must follow -->
38
+
39
+ - All API routes MUST require authentication except: <!-- list public routes -->
40
+ - Secrets MUST NOT appear in code, logs, or error messages
41
+ - All user input MUST be validated before processing
42
+ - PII (email, phone, name) MUST be masked in logs
@@ -0,0 +1,55 @@
1
+ # Test Specification
2
+
3
+ > **Canonical document** — Design intent. This file declares what tests MUST exist.
4
+ > Last updated: YYYY-MM-DD
5
+
6
+ ---
7
+
8
+ ## Test Categories
9
+
10
+ <!-- Which test types this project requires -->
11
+
12
+ | Category | Required | Applies To | Suggested Tools |
13
+ |----------|----------|-----------|-----------------|
14
+ | Unit | ✅ Yes | Services, utilities, helpers | <!-- e.g. jest, vitest, pytest --> |
15
+ | Integration | ✅ Yes | API routes, DB operations | <!-- e.g. supertest, httpx --> |
16
+ | E2E | ✅ Yes | Critical user journeys | <!-- e.g. playwright, cypress --> |
17
+ | Canary | ⚠️ Optional | Health checks, smoke tests | <!-- custom scripts --> |
18
+ | Load | ⚠️ Optional | High-traffic endpoints | <!-- e.g. k6, artillery --> |
19
+ | Security | ⚠️ Optional | Auth flows, input validation | <!-- e.g. OWASP ZAP --> |
20
+ | Contract | ⚠️ Optional | Public-facing APIs | <!-- e.g. pact, dredd --> |
21
+
22
+ ## Coverage Rules
23
+
24
+ <!-- Glob patterns: which source files must have matching test files -->
25
+
26
+ | Source Pattern | Required Test Pattern | Category |
27
+ |---------------|----------------------|----------|
28
+ | <!-- e.g. src/services/**/*.ts --> | <!-- e.g. tests/unit/**/*.test.ts --> | Unit |
29
+ | <!-- e.g. src/routes/**/*.ts --> | <!-- e.g. tests/integration/**/*.test.ts --> | Integration |
30
+
31
+ ## Service-to-Test Map
32
+
33
+ <!-- Specific mapping of source files to their test files -->
34
+
35
+ | Source File | Unit Test | Integration Test | Status |
36
+ |------------|-----------|-----------------|--------|
37
+ | | | | <!-- ✅ / ⚠️ / ❌ --> |
38
+
39
+ ## Critical User Journeys (E2E Required)
40
+
41
+ <!-- Each journey listed here MUST have a corresponding E2E test file -->
42
+
43
+ | # | Journey Description | Test File | Status |
44
+ |---|-------------------|-----------|--------|
45
+ | 1 | <!-- e.g. Login → Dashboard → View Data --> | <!-- e.g. e2e/login-flow.spec.ts --> | |
46
+ | 2 | | | |
47
+
48
+ ## Canary Tests (Pre-Deploy Gates)
49
+
50
+ <!-- Tests that MUST pass before any deployment -->
51
+
52
+ | Canary | What It Checks | File |
53
+ |--------|---------------|------|
54
+ | Health | <!-- e.g. /health returns 200 --> | |
55
+ | Auth | <!-- e.g. Login flow completes --> | |
@@ -0,0 +1,96 @@
1
+ # Troubleshooting Guide
2
+
3
+ <!-- docguard:version 0.1.0 -->
4
+ <!-- docguard:status living -->
5
+ <!-- docguard:last-reviewed YYYY-MM-DD -->
6
+
7
+ > **Implementation document** — Current state. Solutions for common issues.
8
+ > Organized by category. Each entry includes symptoms, diagnosis, and fix.
9
+
10
+ | Metadata | Value |
11
+ |----------|-------|
12
+ | **Status** | ![Status](https://img.shields.io/badge/status-living-blue) |
13
+ | **Version** | `0.1.0` |
14
+ | **Last Updated** | YYYY-MM-DD |
15
+
16
+ ---
17
+
18
+ ## 1. Setup & Local Environment
19
+
20
+ ### <!-- Issue Title -->
21
+
22
+ **Error**: `<!-- exact error message -->`
23
+
24
+ **Cause**: <!-- Root cause explanation -->
25
+
26
+ **Solution**:
27
+ ```bash
28
+ # Fix command
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 2. Database & Persistence
34
+
35
+ ### <!-- Issue Title -->
36
+
37
+ **Symptom**: <!-- What you observe -->
38
+
39
+ **Cause**: <!-- Why this happens -->
40
+
41
+ **Remediation**:
42
+ 1. <!-- Step 1 -->
43
+ 2. <!-- Step 2 -->
44
+
45
+ ---
46
+
47
+ ## 3. Authentication & Authorization
48
+
49
+ ### <!-- Issue Title -->
50
+
51
+ **Error**: `<!-- exact error message -->`
52
+
53
+ **Diagnostic**:
54
+ 1. <!-- How to diagnose -->
55
+
56
+ **Fix**: <!-- Solution -->
57
+
58
+ ---
59
+
60
+ ## 4. Deployment & Infrastructure
61
+
62
+ ### <!-- Issue Title -->
63
+
64
+ **Symptom**: <!-- What you observe -->
65
+
66
+ | Symptom | Probable Cause | Resolution |
67
+ |---------|---------------|------------|
68
+ | <!-- e.g. 502 after deploy --> | <!-- e.g. Health check failing --> | <!-- e.g. Check /health endpoint --> |
69
+
70
+ ---
71
+
72
+ ## 5. Build & Dependencies
73
+
74
+ ### <!-- Issue Title -->
75
+
76
+ **Error**: `<!-- exact error message -->`
77
+
78
+ **Fix**: <!-- Solution -->
79
+
80
+ ---
81
+
82
+ ## 6. Third-Party Services
83
+
84
+ ### <!-- Service Name -->
85
+
86
+ **Issue**: <!-- What goes wrong -->
87
+
88
+ **Workaround**: <!-- How to fix or work around -->
89
+
90
+ ---
91
+
92
+ ## Quick Diagnosis Table
93
+
94
+ | Symptom | Category | Solution |
95
+ |---------|----------|----------|
96
+ | | | |
@@ -0,0 +1,74 @@
1
+ # Vendor Bug Reports & Integration Issues
2
+
3
+ <!-- docguard:version 0.1.0 -->
4
+ <!-- docguard:status living -->
5
+ <!-- docguard:last-reviewed YYYY-MM-DD -->
6
+
7
+ > **Implementation document** — Current state. Tracks bugs filed with third-party vendors and workarounds.
8
+ > Essential for avoiding repeated investigation of known vendor issues.
9
+
10
+ | Metadata | Value |
11
+ |----------|-------|
12
+ | **Status** | ![Status](https://img.shields.io/badge/status-living-blue) |
13
+ | **Version** | `0.1.0` |
14
+ | **Last Updated** | YYYY-MM-DD |
15
+
16
+ ---
17
+
18
+ ## Active Vendor Issues
19
+
20
+ | # | Vendor | Issue | Filed Date | Ticket # | Status | Workaround |
21
+ |---|--------|-------|:---:|----------|--------|------------|
22
+ | 1 | <!-- e.g. AWS --> | <!-- Short description --> | YYYY-MM-DD | <!-- e.g. #12345 --> | <!-- 🟡 Open / 🟢 Fixed / 🔴 Won't Fix --> | <!-- Brief workaround --> |
23
+ | 2 | | | | | | |
24
+
25
+ ---
26
+
27
+ ## Detailed Reports
28
+
29
+ ### V-001: <!-- Vendor — Short Title -->
30
+
31
+ **Vendor**: <!-- e.g. AWS App Runner -->
32
+ **Filed**: YYYY-MM-DD
33
+ **Ticket**: <!-- e.g. AWS Support Case #12345 / GitHub Issue #789 -->
34
+ **Status**: 🟡 Open
35
+
36
+ **Description**:
37
+ <!-- What the issue is -->
38
+
39
+ **Steps to Reproduce**:
40
+ 1. <!-- Step 1 -->
41
+ 2. <!-- Step 2 -->
42
+
43
+ **Expected Behavior**:
44
+ <!-- What should happen -->
45
+
46
+ **Actual Behavior**:
47
+ <!-- What actually happens -->
48
+
49
+ **Workaround**:
50
+ <!-- How we work around this in our code -->
51
+
52
+ ```
53
+ <!-- Code workaround if applicable -->
54
+ ```
55
+
56
+ **Impact on Our System**:
57
+ <!-- How this affects our architecture/code -->
58
+
59
+ **Resolution**:
60
+ <!-- Leave empty until resolved. When resolved, document the fix and version. -->
61
+
62
+ ---
63
+
64
+ ### V-002: <!-- Next Issue -->
65
+
66
+ <!-- Same format as above -->
67
+
68
+ ---
69
+
70
+ ## Resolved Issues
71
+
72
+ | # | Vendor | Issue | Filed | Resolved | Fix Version |
73
+ |---|--------|-------|:---:|:---:|-----------|
74
+ | | | | | | |
@@ -0,0 +1,39 @@
1
+ name: DocGuard CDD Check
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ docguard:
14
+ name: CDD Compliance
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: '20'
22
+
23
+ - name: Run DocGuard CI
24
+ run: npx docguard ci --format json --threshold 70 > docguard-report.json
25
+
26
+ - name: Display Results
27
+ if: always()
28
+ run: |
29
+ echo "## DocGuard Report" >> $GITHUB_STEP_SUMMARY
30
+ echo '```json' >> $GITHUB_STEP_SUMMARY
31
+ cat docguard-report.json >> $GITHUB_STEP_SUMMARY
32
+ echo '```' >> $GITHUB_STEP_SUMMARY
33
+
34
+ - name: Upload Report
35
+ if: always()
36
+ uses: actions/upload-artifact@v4
37
+ with:
38
+ name: docguard-report
39
+ path: docguard-report.json
@@ -0,0 +1,65 @@
1
+ # /docguard.fix — Find and fix all CDD documentation issues
2
+
3
+ You are an AI agent responsible for maintaining documentation quality using DocGuard (Canonical-Driven Development).
4
+
5
+ ## Step 1: Assess Current State
6
+
7
+ Run this command and read the output:
8
+
9
+ ```bash
10
+ npx docguard fix --format json
11
+ ```
12
+
13
+ Parse the JSON result. It will contain:
14
+ - `issueCount`: total number of issues
15
+ - `issues[]`: each issue with `type`, `severity`, `file`, and `fix.ai_instruction`
16
+
17
+ If `issueCount` is 0, report "All CDD documentation is up to date" and stop.
18
+
19
+ ## Step 2: Fix Each Issue
20
+
21
+ For each issue in the JSON output:
22
+
23
+ ### If type is `missing-file`:
24
+ Run `npx docguard fix --auto` first to create skeleton files, then continue to Step 3.
25
+
26
+ ### If type is `empty-doc` or `partial-doc`:
27
+ The document exists but has template placeholders or insufficient content.
28
+ Proceed to Step 3 for this document.
29
+
30
+ ### If type is `missing-config`:
31
+ Create `.docguard.json` based on the project. Detect the project type from `package.json`.
32
+
33
+ ## Step 3: Write Real Content for Each Document
34
+
35
+ For each document that needs content, run:
36
+
37
+ ```bash
38
+ npx docguard fix --doc <name>
39
+ ```
40
+
41
+ Where `<name>` is one of: `architecture`, `data-model`, `security`, `test-spec`, `environment`
42
+
43
+ Read the output carefully — it contains:
44
+ - **RESEARCH STEPS**: Exactly what files to read and commands to run to understand the project
45
+ - **WRITE THE DOCUMENT**: The expected structure and content for each section
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
+ ```
56
+
57
+ All checks should pass. If any fail, read the output and fix the remaining issues.
58
+
59
+ Then run:
60
+
61
+ ```bash
62
+ npx docguard score
63
+ ```
64
+
65
+ Report the final CDD score to the user.
@@ -0,0 +1,40 @@
1
+ # /docguard.guard — Validate CDD compliance and fix any issues
2
+
3
+ You are an AI agent enforcing Canonical-Driven Development (CDD) compliance using DocGuard.
4
+
5
+ ## Step 1: Run Guard
6
+
7
+ ```bash
8
+ npx docguard guard
9
+ ```
10
+
11
+ Read the output. It shows pass/fail for each validator:
12
+ - Structure, Doc Sections, Docs-Sync, Drift, Changelog, Test-Spec, Environment, Freshness
13
+
14
+ ## Step 2: Handle Results
15
+
16
+ ### If all checks pass:
17
+ Report success and the score:
18
+ ```bash
19
+ npx docguard score
20
+ ```
21
+
22
+ ### If checks fail:
23
+ Run the fix workflow:
24
+ ```bash
25
+ npx docguard fix
26
+ ```
27
+
28
+ Read the output to understand what needs fixing. For documents that need real content:
29
+ ```bash
30
+ npx docguard fix --doc <name>
31
+ ```
32
+
33
+ Execute the research steps in the output, write real content, then re-run guard to verify.
34
+
35
+ ## Step 3: Report
36
+
37
+ Show the user:
38
+ 1. Which checks passed/failed
39
+ 2. What was fixed
40
+ 3. Final CDD score