docguard-cli 0.9.5 → 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.
Files changed (32) hide show
  1. package/README.md +281 -203
  2. package/cli/validators/metrics-consistency.mjs +2 -1
  3. package/commands/docguard.fix.md +37 -17
  4. package/commands/docguard.guard.md +45 -12
  5. package/commands/docguard.review.md +37 -19
  6. package/commands/docguard.score.md +36 -17
  7. package/docs/installation.md +37 -19
  8. package/docs/quickstart.md +21 -6
  9. package/extensions/spec-kit-docguard/LICENSE +21 -0
  10. package/extensions/spec-kit-docguard/README.md +105 -0
  11. package/extensions/spec-kit-docguard/commands/diagnose.md +43 -0
  12. package/extensions/spec-kit-docguard/commands/generate.md +50 -0
  13. package/extensions/spec-kit-docguard/commands/guard.md +73 -0
  14. package/extensions/spec-kit-docguard/commands/init.md +38 -0
  15. package/extensions/spec-kit-docguard/commands/score.md +53 -0
  16. package/extensions/spec-kit-docguard/commands/trace.md +56 -0
  17. package/extensions/spec-kit-docguard/extension.yml +109 -0
  18. package/extensions/spec-kit-docguard/scripts/bash/common.sh +106 -0
  19. package/extensions/spec-kit-docguard/scripts/bash/docguard-check-docs.sh +153 -0
  20. package/extensions/spec-kit-docguard/scripts/bash/docguard-init-doc.sh +153 -0
  21. package/extensions/spec-kit-docguard/scripts/bash/docguard-suggest-fix.sh +107 -0
  22. package/extensions/spec-kit-docguard/skills/docguard-fix/SKILL.md +218 -0
  23. package/extensions/spec-kit-docguard/skills/docguard-guard/SKILL.md +167 -0
  24. package/extensions/spec-kit-docguard/skills/docguard-review/SKILL.md +182 -0
  25. package/extensions/spec-kit-docguard/skills/docguard-score/SKILL.md +178 -0
  26. package/extensions/spec-kit-docguard/templates/extensions.yml +39 -0
  27. package/package.json +2 -1
  28. package/templates/commands/docguard.fix.md +35 -39
  29. package/templates/commands/docguard.guard.md +26 -13
  30. package/templates/commands/docguard.init.md +35 -28
  31. package/templates/commands/docguard.review.md +33 -23
  32. package/templates/commands/docguard.update.md +15 -4
package/README.md CHANGED
@@ -1,72 +1,90 @@
1
- # DocGuard
1
+ # 🛡️ DocGuard
2
2
 
3
- > **AI-native documentation enforcement for Canonical-Driven Development (CDD).**
4
- > AI diagnoses. AI fixes. AI verifies. Humans review.
3
+ > **The enforcement layer for Spec-Driven Development.**
4
+ > Validate. Score. Enforce. Ship documentation that AI agents can actually use.
5
5
 
6
6
  [![npm](https://img.shields.io/npm/v/docguard-cli)](https://www.npmjs.com/package/docguard-cli)
7
+ [![PyPI](https://img.shields.io/pypi/v/docguard-cli)](https://pypi.org/project/docguard-cli/)
7
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
9
  [![Node.js](https://img.shields.io/badge/Node.js-18%2B-green)](https://nodejs.org)
9
10
  [![Zero Dependencies](https://img.shields.io/badge/Dependencies-0-brightgreen)](package.json)
10
- [![GitHub Marketplace](https://img.shields.io/badge/Marketplace-DocGuard-blue?logo=github)](https://github.com/marketplace/actions/docguard-cdd-compliance)
11
+ [![Spec Kit Extension](https://img.shields.io/badge/Spec_Kit-Extension-blueviolet)](https://github.com/github/spec-kit)
11
12
 
12
13
  ---
13
14
 
14
- ## What is CDD?
15
+ ## Table of Contents
16
+
17
+ - [What is DocGuard?](#what-is-docguard)
18
+ - [Quick Start](#-quick-start)
19
+ - [Spec Kit Integration](#-spec-kit-integration)
20
+ - [Commands](#-commands)
21
+ - [Validators](#-validators)
22
+ - [Templates](#-templates)
23
+ - [AI Agent Support](#-ai-agent-support)
24
+ - [Slash Commands](#-slash-commands)
25
+ - [CI/CD Integration](#%EF%B8%8F-cicd-integration)
26
+ - [File Structure](#-file-structure)
27
+ - [Configuration](#%EF%B8%8F-configuration)
28
+ - [Research Credits](#-research-credits)
15
29
 
16
- **Canonical-Driven Development** is a methodology where canonical documentation drives every phase of a project — from initial design through ongoing maintenance. Unlike traditional development where docs are written after code (and quickly rot), CDD treats documentation as the authoritative source that code must conform to.
30
+ ---
31
+
32
+ ## What is DocGuard?
33
+
34
+ DocGuard enforces **Canonical-Driven Development (CDD)** — a methodology where documentation is the source of truth, not an afterthought. AI writes the docs, DocGuard validates them.
17
35
 
18
- | Traditional | CDD |
19
- |-------------|-----|
36
+ | Traditional Development | Canonical-Driven Development |
37
+ |:----|:----|
20
38
  | Code first, docs maybe | Docs first, code conforms |
21
- | Docs rot silently | Drift is tracked explicitly |
39
+ | Docs rot silently | Drift is tracked and enforced |
22
40
  | Docs are optional | Docs are required and validated |
23
- | One agent, one context | Any agent, shared context |
41
+ | One AI agent, one context | Any agent, shared context via canonical docs |
24
42
 
25
- **DocGuard** is the CLI tool that enforces CDD auditing, generating, and guarding your project documentation.
43
+ DocGuard is an official [GitHub Spec Kit](https://github.com/github/spec-kit) community extension. It validates the artifacts that Spec Kit creates, ensuring your specs stay high-quality throughout the development lifecycle.
26
44
 
27
- 📖 **[Read the full philosophy](PHILOSOPHY.md)** | 📋 **[Read the standard](STANDARD.md)** | ⚖️ **[See comparisons](COMPARISONS.md)** | 🗺️ **[Roadmap](ROADMAP.md)**
45
+ 📖 **[Philosophy](PHILOSOPHY.md)** · 📋 **[CDD Standard](STANDARD.md)** · ⚖️ **[Comparisons](COMPARISONS.md)** · 🗺️ **[Roadmap](ROADMAP.md)**
28
46
 
29
47
  ---
30
48
 
31
- ## Quick Start
49
+ ## Quick Start
50
+
51
+ ### Node.js (npm)
32
52
 
33
53
  ```bash
34
- # The primary commandAI diagnoses AND fixes everything
54
+ # No install neededrun directly
35
55
  npx docguard-cli diagnose
36
56
 
37
- # Generate CDD docs from an existing codebase
38
- npx docguard-cli generate
39
-
40
- # Start from scratch (minimal setup for side projects)
41
- npx docguard-cli init --profile starter
57
+ # Or install globally
58
+ npm i -g docguard-cli
59
+ docguard diagnose
60
+ ```
42
61
 
43
- # Start from scratch (full enterprise setup)
44
- npx docguard-cli init
62
+ ### Python (PyPI)
45
63
 
46
- # CI gate — pass/fail for pipelines
47
- npx docguard-cli guard
64
+ ```bash
65
+ pip install docguard-cli
66
+ docguard diagnose
48
67
  ```
49
68
 
50
- No installation needed. Zero dependencies. Works with Node.js 18+.
69
+ > **Note:** The Python package is a thin wrapper that delegates to `npx`. Node.js 18+ is required on the system.
51
70
 
52
- ### Install
71
+ ### Core Workflow
53
72
 
54
73
  ```bash
55
- # Run directly (no install)
56
- npx docguard-cli diagnose
74
+ # 1. Initialize docs for your project
75
+ npx docguard-cli init
57
76
 
58
- # Or install globally
59
- npm i -g docguard-cli
60
- docguard diagnose
61
- ```
77
+ # 2. Or reverse-engineer docs from existing code
78
+ npx docguard-cli generate
62
79
 
63
- ### GitHub Action
80
+ # 3. AI diagnoses issues and generates fix prompts
81
+ npx docguard-cli diagnose
64
82
 
65
- ```yaml
66
- - uses: raccioly/docguard@v0.5.0
67
- with:
68
- command: guard
69
- fail-on-warning: true
83
+ # 4. Validate — use as CI gate
84
+ npx docguard-cli guard
85
+
86
+ # 5. Check maturity score
87
+ npx docguard-cli score
70
88
  ```
71
89
 
72
90
  ### The AI Loop
@@ -77,34 +95,89 @@ diagnose → AI reads prompts → AI fixes docs → guard verifies
77
95
  └───────────────── issues found? ←──────────────────────┘
78
96
  ```
79
97
 
80
- `diagnose` is the primary command. It runs all validators, maps every failure to an AI-actionable fix prompt, and outputs a remediation plan. Your AI agent runs it, fixes the docs, and runs `guard` to verify. Zero human intervention.
98
+ `diagnose` is the primary command. It runs all validators, maps every failure to an AI-actionable fix prompt, and outputs a remediation plan. Your AI agent runs it, fixes the docs, and runs `guard` to verify. Zero human intervention required.
81
99
 
82
100
  ---
83
101
 
84
- ## Usage
102
+ ## 🌱 Spec Kit Integration
85
103
 
86
- ```bash
87
- # Initialize CDD docs for your project
88
- npx docguard-cli init
104
+ DocGuard is a [community extension](https://github.com/github/spec-kit/blob/main/extensions/README.md) for GitHub's **Spec Kit** framework. While Spec Kit focuses on **creating** specifications (via AI slash commands like `/speckit.specify` and `/speckit.plan`), DocGuard focuses on **validating** their quality.
89
105
 
90
- # Reverse-engineer docs from existing code
91
- npx docguard-cli generate
106
+ ### How They Work Together
92
107
 
93
- # Validate project — use as CI gate
94
- npx docguard-cli guard
108
+ ```
109
+ ┌─────────────────┐ ┌──────────────────┐
110
+ │ Spec Kit │ │ DocGuard │
111
+ │ │ │ │
112
+ │ /speckit.specify│ ──────→ │ docguard guard │
113
+ │ Creates specs │ │ Validates specs │
114
+ │ (AI-driven) │ │ (automated) │
115
+ └─────────────────┘ └──────────────────┘
116
+ ```
95
117
 
96
- # Get AI-actionable fix prompts
97
- npx docguard-cli diagnose
118
+ | Phase | Tool | What happens |
119
+ |:------|:-----|:-------------|
120
+ | 1. Initialize | `specify init` | Creates `.specify/` directory and templates |
121
+ | 2. Write specs | `/speckit.specify` | AI creates `spec.md` with FR-IDs, user stories |
122
+ | 3. **Validate** | **`docguard guard`** | Checks spec quality (mandatory sections, FR/SC IDs) |
123
+ | 4. Plan | `/speckit.plan` | AI creates `plan.md` with technical context |
124
+ | 5. **Validate** | **`docguard guard`** | Checks plan quality (sections, structure) |
125
+ | 6. Tasks | `/speckit.tasks` | AI creates `tasks.md` with phased breakdown |
126
+ | 7. **Validate** | **`docguard guard`** | Checks task quality (phases, T-IDs) |
127
+ | 8. Implement | `/speckit.implement` | AI writes code |
128
+ | 9. **Enforce** | **`docguard guard`** | Final quality gate — CI/CD |
98
129
 
99
- # Check CDD maturity score
100
- npx docguard-cli score
130
+ ### What DocGuard Validates in Spec Kit Projects
131
+
132
+ - **spec.md** — Mandatory sections (User Scenarios, Requirements, Success Criteria), FR-xxx IDs, SC-xxx IDs
133
+ - **plan.md** — Summary, Technical Context, Project Structure sections
134
+ - **tasks.md** — Phased task breakdown (Phase 1, 2, 3+), T-xxx task IDs
135
+ - **constitution.md** — Detected at `.specify/memory/constitution.md` or project root
136
+ - **Requirement traceability** — FR, SC, NFR, US, AC, UC, SYS, ARCH, MOD, T IDs
137
+
138
+ ### Installing as a Spec Kit Extension
139
+
140
+ ```bash
141
+ specify extension add docguard
101
142
  ```
102
143
 
144
+ This installs DocGuard's slash commands (`/docguard.guard`, `/docguard.review`, `/docguard.fix`, `/docguard.score`) into your AI agent's command palette.
145
+
103
146
  ---
104
147
 
105
- ## 13 Commands
148
+ ## Usage
149
+
150
+ DocGuard ships **13 commands**:
151
+
152
+ | Command | Purpose |
153
+ |:--------|:--------|
154
+ | `diagnose` | **Primary** — identify every issue + generate AI fix prompts |
155
+ | `guard` | Validate project against canonical docs (CI gate) |
156
+ | `generate` | Reverse-engineer docs from existing codebase |
157
+ | `init` | Initialize CDD docs from templates (interactive) |
158
+ | `score` | CDD maturity score (0–100) with weighted breakdown |
159
+ | `fix --doc <name>` | Generate AI prompt for a specific document |
160
+ | `diff` | Compare canonical docs vs actual code artifacts |
161
+ | `agents` | Generate agent-specific config files |
162
+ | `trace` | Requirements traceability matrix |
163
+ | `ci` | CI/CD pipeline check with threshold |
164
+ | `watch` | Live watch mode with auto-fix |
165
+ | `hooks` | Install git hooks (pre-commit, pre-push) |
166
+ | `llms` | Generate `llms.txt` (AI-friendly project summary) |
167
+
168
+ ### CLI Flags
169
+
170
+ | Flag | Description | Commands |
171
+ |:-----|:------------|:---------|
172
+ | `--dir <path>` | Project directory (default: `.`) | All |
173
+ | `--verbose` | Show detailed output | All |
174
+ | `--format json` | Machine-readable output for CI/CD | score, guard, diff |
175
+ | `--force` | Overwrite existing files (creates `.bak` backups) | generate, agents, init |
176
+ | `--profile <name>` | Starter, standard, or enterprise | init |
177
+ | `--agent <name>` | Target specific AI agent | agents |
178
+
179
+ ### Example Output
106
180
 
107
- ### 🔮 Generate — Reverse-engineer docs from code
108
181
  ```
109
182
  $ npx docguard-cli generate
110
183
 
@@ -124,109 +197,22 @@ $ npx docguard-cli generate
124
197
  ✅ ENVIRONMENT.md (18 env vars detected)
125
198
  ✅ TEST-SPEC.md (45 tests, 8/10 services mapped)
126
199
  ✅ SECURITY.md (auth: NextAuth.js)
200
+ ✅ REQUIREMENTS.md (spec-kit aligned)
127
201
  ✅ AGENTS.md
128
202
  ✅ CHANGELOG.md
129
203
  ✅ DRIFT-LOG.md
130
204
 
131
- Generated: 8 Skipped: 0
132
- ```
133
-
134
- **Detects:** Next.js, React, Vue, Angular, Fastify, Express, Hono, Django, FastAPI, SvelteKit, and more.
135
- **Scans for:** Routes, models, services, tests, env vars, components, middleware.
136
-
137
- ### 📊 Score — CDD maturity assessment
138
- ```
139
- $ npx docguard-cli score
140
-
141
- Category Breakdown
142
-
143
- structure ████████████████████ 100% (×25) = 25 pts
144
- docQuality ██████████████████░░ 90% (×20) = 18 pts
145
- testing █████████░░░░░░░░░░░ 45% (×15) = 7 pts
146
- security █████████████████░░░ 85% (×10) = 9 pts
147
- environment ██████████████░░░░░░ 70% (×10) = 7 pts
148
- drift ████████████████████ 100% (×10) = 10 pts
149
- changelog ██████████████░░░░░░ 70% (×5) = 4 pts
150
- architecture █████████████████░░░ 85% (×5) = 4 pts
151
-
152
- CDD Maturity Score: 83/100 (A)
153
- Great — Strong CDD compliance
154
-
155
- Top improvements:
156
- → testing: Add tests/ directory and configure TEST-SPEC.md
157
- ```
158
-
159
- ### 🔍 Diff — Canonical docs vs code comparison
160
- ```
161
- $ npx docguard-cli diff
162
-
163
- 🛣️ API Routes
164
- In code but not documented:
165
- + src/routes/webhooks.ts
166
- + src/routes/admin/settings.ts
167
- ✓ In sync: 12 routes
168
-
169
- 🔧 Environment Variables
170
- Documented but not found in .env.example:
171
- − REDIS_URL
172
- ```
173
-
174
- ### 🤖 Agents — Generate agent-specific configs
175
- ```
176
- $ npx docguard-cli agents
177
-
178
- ✅ Cursor: .cursor/rules/cdd.mdc
179
- ✅ GitHub Copilot: .github/copilot-instructions.md
180
- ✅ Cline: .clinerules
181
- ✅ Windsurf: .windsurfrules
182
- ✅ Claude Code: CLAUDE.md
183
- ✅ Gemini CLI: .gemini/settings.json
184
-
185
- Created: 6 Skipped: 0
186
- ```
187
-
188
- ### 🔍 Audit — What docs exist/missing
189
- ```
190
- $ npx docguard-cli audit
191
-
192
- Score: 8/8 required files (100%)
193
- ```
194
-
195
- ### 🏗️ Init — Create CDD docs from templates
196
- ```
197
- $ npx docguard-cli init
198
-
199
- Created 9 files (8 docs + .docguard.json)
200
- ```
201
-
202
- ### 🛡️ Guard — Validate project against docs
203
- ```
204
- $ npx docguard-cli guard
205
-
206
- ✅ Structure 8/8 checks passed
207
- ✅ Doc Sections 10/10 checks passed
208
- ✅ Drift 1/1 checks passed
205
+ Generated: 9 Skipped: 0
209
206
  ```
210
207
 
211
208
  ---
212
209
 
213
- ## CLI Flags
214
-
215
- | Flag | Description | Commands |
216
- |------|-------------|----------|
217
- | `--dir <path>` | Project directory (default: `.`) | All |
218
- | `--verbose` | Show detailed output | All |
219
- | `--format json` | Output as JSON for CI/CD | score, diff |
220
- | `--fix` | Auto-create missing files | guard |
221
- | `--force` | Overwrite existing files | generate, agents, init |
222
- | `--agent <name>` | Target specific agent | agents |
223
-
224
- ---
210
+ ## 🔍 Validators
225
211
 
226
- ## 18 Validators
212
+ DocGuard runs **19 automated validators** on every `guard` check:
227
213
 
228
214
  | # | Validator | What It Checks | Default |
229
- |---|-----------|---------------|---------|
215
+ |:--|:----------|:--------------|:--------|
230
216
  | 1 | **Structure** | Required CDD files exist | ✅ On |
231
217
  | 2 | **Doc Sections** | Canonical docs have required sections | ✅ On |
232
218
  | 3 | **Docs-Sync** | Routes/services referenced in docs + OpenAPI cross-check | ✅ On |
@@ -237,7 +223,7 @@ $ npx docguard-cli guard
237
223
  | 8 | **Security** | No hardcoded secrets in source code | ✅ On |
238
224
  | 9 | **Architecture** | Imports follow layer boundaries | ✅ On |
239
225
  | 10 | **Freshness** | Docs not stale relative to code changes | ✅ On |
240
- | 11 | **Traceability** | Canonical docs linked to source + V-Model requirement IDs | ✅ On |
226
+ | 11 | **Traceability** | Requirement IDs (FR, SC, NFR, US, AC, T) trace to tests | ✅ On |
241
227
  | 12 | **Docs-Diff** | Code artifacts match documented entities | ✅ On |
242
228
  | 13 | **Metadata-Sync** | Version refs consistent across docs | ✅ On |
243
229
  | 14 | **Docs-Coverage** | Code features referenced in documentation | ✅ On |
@@ -245,26 +231,26 @@ $ npx docguard-cli guard
245
231
  | 16 | **Doc-Quality** | Writing quality (readability, passive voice, atomicity) | ✅ On |
246
232
  | 17 | **TODO-Tracking** | Untracked TODOs/FIXMEs and skipped tests | ✅ On |
247
233
  | 18 | **Schema-Sync** | Database models documented in DATA-MODEL.md | ✅ On |
248
- | 19 | **Spec-Kit** | GitHub Spec Kit artifact detection and CDD mapping | ✅ On |
234
+ | 19 | **Spec-Kit** | Spec quality validation (FR-IDs, mandatory sections, phased tasks) | ✅ On |
249
235
 
250
236
  ---
251
237
 
252
- ## 18 Templates
238
+ ## 📄 Templates
253
239
 
254
- Every template includes professional metadata: `docguard:version`, `docguard:status`, badges, and revision history.
240
+ DocGuard ships **18 professional templates** with metadata, badges, and revision history:
255
241
 
256
242
  | Template | Type | Purpose |
257
- |----------|------|---------|
258
- | ARCHITECTURE.md | Canonical | System design, components, boundaries |
243
+ |:---------|:-----|:--------|
244
+ | ARCHITECTURE.md | Canonical | System design, components, layer boundaries |
259
245
  | DATA-MODEL.md | Canonical | Schemas, entities, relationships |
260
- | SECURITY.md | Canonical | Auth, permissions, secrets |
261
- | TEST-SPEC.md | Canonical | Required tests, coverage |
262
- | ENVIRONMENT.md | Canonical | Env vars, setup steps |
246
+ | SECURITY.md | Canonical | Auth, permissions, secrets management |
247
+ | TEST-SPEC.md | Canonical | Test strategy, coverage requirements |
248
+ | ENVIRONMENT.md | Canonical | Environment variables, deployment config |
249
+ | REQUIREMENTS.md | Canonical | Spec-kit aligned FR/SC IDs, user stories |
263
250
  | DEPLOYMENT.md | Canonical | Infrastructure, CI/CD, DNS |
264
251
  | ADR.md | Canonical | Architecture Decision Records |
265
252
  | ROADMAP.md | Canonical | Project phases, feature tracking |
266
- | REQUIREMENTS.md | Canonical | Requirement IDs, V-Model traceability |
267
- | KNOWN-GOTCHAS.md | Implementation | Symptom/gotcha/fix entries |
253
+ | KNOWN-GOTCHAS.md | Implementation | Symptom gotcha fix entries |
268
254
  | TROUBLESHOOTING.md | Implementation | Error diagnosis guides |
269
255
  | RUNBOOKS.md | Implementation | Operational procedures |
270
256
  | VENDOR-BUGS.md | Implementation | Third-party issue tracker |
@@ -276,48 +262,93 @@ Every template includes professional metadata: `docguard:version`, `docguard:sta
276
262
 
277
263
  ---
278
264
 
279
- ## CDD File Structure
265
+ ## 🤖 AI Agent Support
266
+
267
+ DocGuard works with **every major AI coding agent**. All canonical docs are plain markdown — no vendor lock-in.
268
+
269
+ | Agent | Compatibility | Auto-Generate Config |
270
+ |:------|:---:|:---:|
271
+ | Google Antigravity | ✅ | `docguard agents --agent antigravity` |
272
+ | Claude Code | ✅ | `docguard agents --agent claude` |
273
+ | GitHub Copilot | ✅ | `docguard agents --agent copilot` |
274
+ | Cursor | ✅ | `docguard agents --agent cursor` |
275
+ | Windsurf | ✅ | `docguard agents --agent windsurf` |
276
+ | Cline | ✅ | `docguard agents --agent cline` |
277
+ | Google Gemini CLI | ✅ | `docguard agents --agent gemini` |
278
+ | Kiro (AWS) | ✅ | — |
279
+
280
+ ---
281
+
282
+ ## ⚡ Slash Commands
283
+
284
+ DocGuard provides AI agent slash commands for integrated workflows. Installed automatically via `docguard init` or `specify extension add docguard`:
285
+
286
+ | Command | What It Does |
287
+ |:--------|:-------------|
288
+ | `/docguard.guard` | Run quality validation — check all 19 validators |
289
+ | `/docguard.review` | Analyze doc quality and suggest improvements |
290
+ | `/docguard.fix` | Generate targeted fix prompts for specific issues |
291
+ | `/docguard.score` | Show CDD maturity score with category breakdown |
292
+
293
+ These commands are installed into your AI agent's command directory:
280
294
 
281
295
  ```
282
- your-project/
283
- ├── docs-canonical/ # Design intent (the "blueprint")
284
- │ ├── ARCHITECTURE.md # System design, components, boundaries
285
- │ ├── DATA-MODEL.md # Database schemas, entity relationships
286
- │ ├── SECURITY.md # Auth, permissions, secrets
287
- │ ├── TEST-SPEC.md # Required tests, coverage rules
288
- │ ├── ENVIRONMENT.md # Environment variables, setup
289
- │ └── REQUIREMENTS.md # Requirement IDs, V-Model traceability
290
-
291
- ├── docs-implementation/ # Current state (optional)
292
- │ ├── KNOWN-GOTCHAS.md # Lessons learned
293
- │ ├── TROUBLESHOOTING.md # Error solutions
294
- │ ├── RUNBOOKS.md # Operational procedures
295
- │ └── CURRENT-STATE.md # What's deployed now
296
-
297
- ├── AGENTS.md # AI agent behavior rules
298
- ├── CHANGELOG.md # Change tracking
299
- ├── DRIFT-LOG.md # Documented deviations
300
- ├── llms.txt # AI-friendly project summary
301
- └── .docguard.json # DocGuard configuration
296
+ .github/commands/ → GitHub Copilot
297
+ .cursor/rules/ → Cursor
298
+ .gemini/commands/ → Google Gemini
299
+ .claude/commands/ → Claude Code
300
+ .agents/workflows/ → Antigravity
302
301
  ```
303
302
 
304
303
  ---
305
304
 
306
- ## CI/CD Integration
305
+ ## 🧠 AI Skills (Enterprise)
306
+
307
+ Beyond slash commands, DocGuard provides **4 enterprise-grade AI skills** — deep behavior protocols that tell AI agents not just *what* to run, but *how to think, validate, and iterate*. Skills are modeled after [Spec Kit's](https://github.com/github/spec-kit) skill architecture.
308
+
309
+ | Skill | Lines | What It Does |
310
+ |:------|:-----:|:-------------|
311
+ | `docguard-guard` | 155 | 6-step quality gate with severity triage (CRITICAL→LOW), structured reporting, remediation |
312
+ | `docguard-fix` | 195 | 7-step research workflow with per-document codebase research and 3-iteration validation loops |
313
+ | `docguard-review` | 170 | Read-only semantic cross-document analysis with 6 analysis passes and quality scoring |
314
+ | `docguard-score` | 165 | CDD maturity assessment with ROI-based improvement roadmap and grade progression |
315
+
316
+ ### Workflow Hooks
317
+
318
+ DocGuard integrates into the spec-kit workflow as an automated quality gate:
319
+
320
+ | Hook | When | Behavior |
321
+ |:-----|:-----|:---------|
322
+ | `after_implement` | After `/speckit.implement` | **Mandatory** — always runs DocGuard guard |
323
+ | `before_tasks` | Before `/speckit.tasks` | Optional — reviews doc consistency |
324
+ | `after_tasks` | After `/speckit.tasks` | Optional — shows CDD maturity score |
325
+
326
+ ### Orchestration Scripts
327
+
328
+ For advanced users and CI/CD pipelines, DocGuard includes bash scripts with `--json` output:
329
+
330
+ | Script | Purpose |
331
+ |:-------|:--------|
332
+ | `docguard-check-docs.sh` | Discover project docs, return JSON inventory with metadata |
333
+ | `docguard-suggest-fix.sh` | Run guard, parse results, output prioritized fixes |
334
+ | `docguard-init-doc.sh` | Initialize canonical doc with metadata header |
335
+
336
+ ---
337
+
338
+ ## ⚙️ CI/CD Integration
307
339
 
308
340
  ### GitHub Actions
309
341
 
310
342
  ```yaml
311
- name: DocGuard
343
+ name: DocGuard CDD Check
312
344
  on: [pull_request]
313
345
  jobs:
314
- guard:
346
+ docguard:
315
347
  runs-on: ubuntu-latest
316
348
  steps:
317
349
  - uses: actions/checkout@v4
318
350
  - uses: actions/setup-node@v4
319
- with:
320
- node-version: '20'
351
+ with: { node-version: '20' }
321
352
  - run: npx docguard-cli guard
322
353
  - run: npx docguard-cli score --format json
323
354
  ```
@@ -325,39 +356,86 @@ jobs:
325
356
  ### Pre-commit Hook
326
357
 
327
358
  ```bash
328
- # .git/hooks/pre-commit
329
- #!/bin/sh
330
- npx docguard-cli guard
359
+ npx docguard-cli hooks --type pre-commit
331
360
  ```
332
361
 
333
- ---
362
+ ### GitHub Marketplace
334
363
 
335
- ## Agent Compatibility
364
+ ```yaml
365
+ - uses: raccioly/docguard@v0.9.5
366
+ with:
367
+ command: guard
368
+ fail-on-warning: true
369
+ ```
336
370
 
337
- DocGuard works with **every major AI coding agent**:
371
+ ---
338
372
 
339
- | Agent | Compatibility | Auto-Generate Config |
340
- |-------|:---:|:---:|
341
- | Google Antigravity | ✅ | — |
342
- | Claude Code | ✅ | `docguard agents --agent claude` |
343
- | GitHub Copilot | ✅ | `docguard agents --agent copilot` |
344
- | Cursor | ✅ | `docguard agents --agent cursor` |
345
- | Windsurf | ✅ | `docguard agents --agent windsurf` |
346
- | Cline | ✅ | `docguard agents --agent cline` |
347
- | Gemini CLI | ✅ | `docguard agents --agent gemini` |
348
- | Kiro (AWS) | ✅ | — |
373
+ ## 📁 File Structure
349
374
 
350
- All canonical docs are **plain markdown** — any agent can read them. No vendor lock-in.
375
+ ```
376
+ your-project/
377
+ ├── .specify/ # Spec Kit (if using specify init)
378
+ │ ├── specs/
379
+ │ │ └── 001-feature/
380
+ │ │ ├── spec.md # Requirements (FR-IDs, user stories)
381
+ │ │ ├── plan.md # Implementation plan
382
+ │ │ └── tasks.md # Task breakdown
383
+ │ ├── memory/
384
+ │ │ └── constitution.md # Project principles
385
+ │ └── templates/
386
+
387
+ ├── docs-canonical/ # CDD canonical docs (the "blueprint")
388
+ │ ├── ARCHITECTURE.md # System design, components
389
+ │ ├── DATA-MODEL.md # Database schemas
390
+ │ ├── SECURITY.md # Auth, permissions, secrets
391
+ │ ├── TEST-SPEC.md # Required tests, coverage
392
+ │ ├── ENVIRONMENT.md # Environment variables
393
+ │ └── REQUIREMENTS.md # Spec-kit aligned FR/SC IDs
394
+
395
+ ├── docs-implementation/ # Current state (optional)
396
+ │ ├── KNOWN-GOTCHAS.md
397
+ │ ├── TROUBLESHOOTING.md
398
+ │ ├── RUNBOOKS.md
399
+ │ └── CURRENT-STATE.md
400
+
401
+ ├── AGENTS.md # AI agent behavior rules
402
+ ├── CHANGELOG.md # Change tracking
403
+ ├── DRIFT-LOG.md # Documented deviations
404
+ ├── llms.txt # AI-friendly summary
405
+ └── .docguard.json # DocGuard configuration
406
+ ```
351
407
 
352
408
  ---
353
409
 
354
- ## Contributing
410
+ ## ⚙️ Configuration
411
+
412
+ Create `.docguard.json` in your project root (auto-generated by `docguard init`):
413
+
414
+ ```json
415
+ {
416
+ "projectName": "my-project",
417
+ "version": "0.4",
418
+ "profile": "standard",
419
+ "projectType": "webapp",
420
+ "validators": {
421
+ "structure": true,
422
+ "docsSync": true,
423
+ "drift": true,
424
+ "changelog": true,
425
+ "testSpec": true,
426
+ "security": true,
427
+ "environment": true,
428
+ "docQuality": true,
429
+ "specKit": true
430
+ }
431
+ }
432
+ ```
355
433
 
356
- We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
434
+ See [Configuration Guide](docs/configuration.md) for all options.
357
435
 
358
436
  ---
359
437
 
360
- ## Research Credits
438
+ ## 🔬 Research Credits
361
439
 
362
440
  DocGuard's quality evaluation and documentation generation patterns are informed by peer-reviewed research from the University of Arizona and the Joint Interoperability Test Command (JITC), U.S. Department of Defense:
363
441
 
@@ -366,11 +444,11 @@ DocGuard's quality evaluation and documentation generation patterns are informed
366
444
 
367
445
  Lead researcher: **[Martin Manuel Lopez](https://github.com/martinmanuel9)** · [ORCID 0009-0002-7652-2385](https://orcid.org/0009-0002-7652-2385)
368
446
 
369
- See [CONTRIBUTING.md](CONTRIBUTING.md#research--academic-credits) for full citations and concept attributions.
447
+ See [CONTRIBUTING.md](CONTRIBUTING.md#research--academic-credits) for full citations.
370
448
 
371
449
  ---
372
450
 
373
- ## License
451
+ ## 📄 License
374
452
 
375
453
  [MIT](LICENSE) — Free to use, modify, and distribute.
376
454
 
@@ -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;