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.
- package/LICENSE +21 -0
- package/PHILOSOPHY.md +150 -0
- package/README.md +309 -0
- package/STANDARD.md +751 -0
- package/cli/commands/agents.mjs +221 -0
- package/cli/commands/audit.mjs +92 -0
- package/cli/commands/badge.mjs +72 -0
- package/cli/commands/ci.mjs +80 -0
- package/cli/commands/diagnose.mjs +273 -0
- package/cli/commands/diff.mjs +360 -0
- package/cli/commands/fix.mjs +610 -0
- package/cli/commands/generate.mjs +842 -0
- package/cli/commands/guard.mjs +158 -0
- package/cli/commands/hooks.mjs +227 -0
- package/cli/commands/init.mjs +249 -0
- package/cli/commands/score.mjs +396 -0
- package/cli/commands/watch.mjs +143 -0
- package/cli/docguard.mjs +458 -0
- package/cli/validators/architecture.mjs +380 -0
- package/cli/validators/changelog.mjs +39 -0
- package/cli/validators/docs-sync.mjs +110 -0
- package/cli/validators/drift.mjs +101 -0
- package/cli/validators/environment.mjs +70 -0
- package/cli/validators/freshness.mjs +224 -0
- package/cli/validators/security.mjs +101 -0
- package/cli/validators/structure.mjs +88 -0
- package/cli/validators/test-spec.mjs +115 -0
- package/docs/ai-integration.md +179 -0
- package/docs/commands.md +239 -0
- package/docs/configuration.md +96 -0
- package/docs/faq.md +155 -0
- package/docs/installation.md +81 -0
- package/docs/profiles.md +103 -0
- package/docs/quickstart.md +79 -0
- package/package.json +57 -0
- package/templates/ADR.md.template +64 -0
- package/templates/AGENTS.md.template +88 -0
- package/templates/ARCHITECTURE.md.template +78 -0
- package/templates/CHANGELOG.md.template +16 -0
- package/templates/CURRENT-STATE.md.template +64 -0
- package/templates/DATA-MODEL.md.template +66 -0
- package/templates/DEPLOYMENT.md.template +66 -0
- package/templates/DRIFT-LOG.md.template +18 -0
- package/templates/ENVIRONMENT.md.template +43 -0
- package/templates/KNOWN-GOTCHAS.md.template +69 -0
- package/templates/ROADMAP.md.template +82 -0
- package/templates/RUNBOOKS.md.template +115 -0
- package/templates/SECURITY.md.template +42 -0
- package/templates/TEST-SPEC.md.template +55 -0
- package/templates/TROUBLESHOOTING.md.template +96 -0
- package/templates/VENDOR-BUGS.md.template +74 -0
- package/templates/ci/github-actions.yml +39 -0
- package/templates/commands/docguard.fix.md +65 -0
- package/templates/commands/docguard.guard.md +40 -0
- package/templates/commands/docguard.init.md +62 -0
- package/templates/commands/docguard.review.md +44 -0
- package/templates/commands/docguard.update.md +44 -0
package/docs/commands.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Commands Reference
|
|
2
|
+
|
|
3
|
+
DocGuard v0.5.0 — 13 commands, zero dependencies.
|
|
4
|
+
|
|
5
|
+
## The AI Loop
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
diagnose (identify + fix) → AI executes → guard (verify)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`diagnose` is the primary command. `guard` is the CI gate.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Primary Commands
|
|
16
|
+
|
|
17
|
+
### `docguard diagnose` (alias: `dx`)
|
|
18
|
+
|
|
19
|
+
**The AI orchestrator.** Runs all validators, maps every failure to an AI fix prompt, outputs a remediation plan.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx docguard diagnose # Human-readable remediation plan
|
|
23
|
+
npx docguard diagnose --format json # Structured for automation
|
|
24
|
+
npx docguard diagnose --format prompt # Raw AI prompt (all issues combined)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**JSON output includes:**
|
|
28
|
+
- `issues[]` — severity, validator, message, fix command
|
|
29
|
+
- `fixCommands[]` — unique commands to run
|
|
30
|
+
- `score` — current CDD maturity score
|
|
31
|
+
- `grade` — letter grade (A+ to F)
|
|
32
|
+
|
|
33
|
+
### `docguard guard`
|
|
34
|
+
|
|
35
|
+
**Identify issues.** Validate project against canonical docs. Use for CI gates and pre-commit hooks.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx docguard guard # Text output
|
|
39
|
+
npx docguard guard --format json # Structured JSON
|
|
40
|
+
npx docguard guard --verbose # Show all check details
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Exit codes:** `0` (pass), `1` (errors), `2` (warnings)
|
|
44
|
+
|
|
45
|
+
When issues are found, guard outputs: `Run docguard diagnose to get AI fix prompts.`
|
|
46
|
+
|
|
47
|
+
**JSON output includes:**
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"project": "my-app",
|
|
51
|
+
"profile": "standard",
|
|
52
|
+
"status": "WARN",
|
|
53
|
+
"passed": 37,
|
|
54
|
+
"total": 40,
|
|
55
|
+
"validators": [
|
|
56
|
+
{ "name": "Structure", "status": "pass", "passed": 8, "total": 8, "errors": [], "warnings": [] }
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `docguard score`
|
|
62
|
+
|
|
63
|
+
**CDD maturity score** (0-100) with category breakdown.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx docguard score # Visual bar chart
|
|
67
|
+
npx docguard score --format json # Structured JSON
|
|
68
|
+
npx docguard score --tax # Documentation tax estimate
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**`--tax` output:**
|
|
72
|
+
```
|
|
73
|
+
📋 Documentation Tax Estimate
|
|
74
|
+
─────────────────────────────────
|
|
75
|
+
Tracked docs: 7 files
|
|
76
|
+
Active profile: standard
|
|
77
|
+
Est. maintenance: ~5 min/week
|
|
78
|
+
Tax-to-value ratio: LOW
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Grades:** A+ (95+), A (80+), B (65+), C (50+), D (30+), F (<30)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Setup Commands
|
|
86
|
+
|
|
87
|
+
### `docguard init`
|
|
88
|
+
|
|
89
|
+
**Initialize CDD documentation** from templates.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx docguard init # Full CDD (standard profile)
|
|
93
|
+
npx docguard init --profile starter # Minimal: ARCHITECTURE + CHANGELOG
|
|
94
|
+
npx docguard init --profile enterprise # Everything + strict validators
|
|
95
|
+
npx docguard init --dir /path/to/project # Specify directory
|
|
96
|
+
npx docguard init --skip-prompts # No AI prompt output
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Profiles:**
|
|
100
|
+
|
|
101
|
+
| Profile | Docs Created | Validators |
|
|
102
|
+
|---------|-------------|------------|
|
|
103
|
+
| `starter` | ARCHITECTURE, CHANGELOG, AGENTS, DRIFT-LOG | structure, docsSync, changelog |
|
|
104
|
+
| `standard` | All 5 canonical + tracking | Most validators (default) |
|
|
105
|
+
| `enterprise` | All docs | All validators + freshness |
|
|
106
|
+
|
|
107
|
+
### `docguard generate`
|
|
108
|
+
|
|
109
|
+
**Reverse-engineer docs from existing code.** Scans your codebase and creates pre-filled documentation.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npx docguard generate
|
|
113
|
+
npx docguard generate --dir /path/to/project
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Detects:** Next.js, React, Vue, Angular, Express, Fastify, Hono, Django, FastAPI, SvelteKit, and more.
|
|
117
|
+
|
|
118
|
+
### `docguard audit`
|
|
119
|
+
|
|
120
|
+
**Scan and report** which CDD documents exist, are missing, or need attention.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npx docguard audit
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## AI Integration Commands
|
|
129
|
+
|
|
130
|
+
### `docguard fix`
|
|
131
|
+
|
|
132
|
+
**Find issues and generate AI fix instructions.**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npx docguard fix # Human-readable issue list
|
|
136
|
+
npx docguard fix --format json # Machine-readable for VS Code/CI
|
|
137
|
+
npx docguard fix --format prompt # AI-ready prompt
|
|
138
|
+
npx docguard fix --auto # Create missing skeleton files
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### `docguard fix --doc <name>`
|
|
142
|
+
|
|
143
|
+
**Generate a deep AI research prompt** for a specific document.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npx docguard fix --doc architecture
|
|
147
|
+
npx docguard fix --doc data-model
|
|
148
|
+
npx docguard fix --doc security
|
|
149
|
+
npx docguard fix --doc test-spec
|
|
150
|
+
npx docguard fix --doc environment
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Output includes:** TASK, PURPOSE, RESEARCH STEPS (what to grep/read), WRITE THE DOCUMENT (expected sections).
|
|
154
|
+
|
|
155
|
+
### `docguard agents`
|
|
156
|
+
|
|
157
|
+
**Generate agent-specific config files** from AGENTS.md.
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npx docguard agents
|
|
161
|
+
npx docguard agents --list
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## DevOps Commands
|
|
167
|
+
|
|
168
|
+
### `docguard ci`
|
|
169
|
+
|
|
170
|
+
**Single command for CI/CD pipelines.** Runs guard + score internally (no subprocess).
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npx docguard ci # Basic check
|
|
174
|
+
npx docguard ci --threshold 70 # Fail below score 70
|
|
175
|
+
npx docguard ci --threshold 80 --fail-on-warning # Strict mode
|
|
176
|
+
npx docguard ci --format json # JSON for GitHub Actions
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### `docguard hooks`
|
|
180
|
+
|
|
181
|
+
**Install git hooks** for automatic validation.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npx docguard hooks # Install all hooks
|
|
185
|
+
npx docguard hooks --list # Show installed hooks
|
|
186
|
+
npx docguard hooks --remove # Remove hooks
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Hooks installed:**
|
|
190
|
+
- `pre-commit` → runs `docguard guard`
|
|
191
|
+
- `pre-push` → runs `docguard score` with threshold
|
|
192
|
+
- `commit-msg` → validates conventional commit format
|
|
193
|
+
|
|
194
|
+
### `docguard watch`
|
|
195
|
+
|
|
196
|
+
**Live watch mode** — re-runs guard on file changes.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npx docguard watch # Watch and re-run guard
|
|
200
|
+
npx docguard watch --auto-fix # Also output AI fix prompts on failure
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### `docguard badge`
|
|
204
|
+
|
|
205
|
+
**Generate shields.io badges** for README.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx docguard badge
|
|
209
|
+
npx docguard badge --format json
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### `docguard diff`
|
|
213
|
+
|
|
214
|
+
**Show gaps** between documentation and actual codebase.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
npx docguard diff
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Global Flags
|
|
223
|
+
|
|
224
|
+
| Flag | Description |
|
|
225
|
+
|------|-------------|
|
|
226
|
+
| `--dir <path>` | Project directory (default: current directory) |
|
|
227
|
+
| `--format <type>` | Output format: `text` (default), `json`, `prompt` |
|
|
228
|
+
| `--verbose` | Show detailed output |
|
|
229
|
+
| `--profile <name>` | Compliance profile: `starter`, `standard`, `enterprise` |
|
|
230
|
+
| `--tax` | Show documentation tax estimate (with `score`) |
|
|
231
|
+
| `--auto-fix` | Output AI fix prompts on failure (with `watch`) |
|
|
232
|
+
| `--skip-prompts` | Suppress AI prompts after init |
|
|
233
|
+
| `--auto` | Auto-fix issues (with `fix` command) |
|
|
234
|
+
| `--doc <name>` | Target specific document (with `fix` command) |
|
|
235
|
+
| `--threshold <n>` | Minimum score for CI pass (with `ci` command) |
|
|
236
|
+
| `--fail-on-warning` | Fail CI on warnings (with `ci` command) |
|
|
237
|
+
| `--force` | Overwrite existing files |
|
|
238
|
+
| `--help` | Show help |
|
|
239
|
+
| `--version` | Show version |
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
DocGuard is configured via `.docguard.json` in the project root. If no config file exists, sensible defaults are used with auto-detection.
|
|
4
|
+
|
|
5
|
+
## Full Reference
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"projectName": "my-project",
|
|
10
|
+
"version": "0.5",
|
|
11
|
+
"profile": "standard",
|
|
12
|
+
"projectType": "webapp",
|
|
13
|
+
|
|
14
|
+
"requiredFiles": {
|
|
15
|
+
"canonical": [
|
|
16
|
+
"docs-canonical/ARCHITECTURE.md",
|
|
17
|
+
"docs-canonical/DATA-MODEL.md",
|
|
18
|
+
"docs-canonical/SECURITY.md",
|
|
19
|
+
"docs-canonical/TEST-SPEC.md",
|
|
20
|
+
"docs-canonical/ENVIRONMENT.md"
|
|
21
|
+
],
|
|
22
|
+
"agentFile": ["AGENTS.md", "CLAUDE.md"],
|
|
23
|
+
"changelog": "CHANGELOG.md",
|
|
24
|
+
"driftLog": "DRIFT-LOG.md"
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
"projectTypeConfig": {
|
|
28
|
+
"needsEnvVars": true,
|
|
29
|
+
"needsEnvExample": true,
|
|
30
|
+
"needsE2E": true,
|
|
31
|
+
"needsDatabase": true,
|
|
32
|
+
"testFramework": "vitest",
|
|
33
|
+
"runCommand": "npm run dev"
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
"validators": {
|
|
37
|
+
"structure": true,
|
|
38
|
+
"docsSync": true,
|
|
39
|
+
"drift": true,
|
|
40
|
+
"changelog": true,
|
|
41
|
+
"architecture": true,
|
|
42
|
+
"testSpec": true,
|
|
43
|
+
"security": true,
|
|
44
|
+
"environment": true,
|
|
45
|
+
"freshness": true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Profile Field
|
|
51
|
+
|
|
52
|
+
The `profile` field sets a baseline preset. User config overrides profile defaults.
|
|
53
|
+
|
|
54
|
+
| Profile | Description | Validators Enabled |
|
|
55
|
+
|---------|-------------|-------------------|
|
|
56
|
+
| `starter` | Minimal CDD — ARCHITECTURE + CHANGELOG | structure, docsSync, changelog |
|
|
57
|
+
| `standard` | Full CDD — all 5 canonical docs (default) | Most validators |
|
|
58
|
+
| `enterprise` | Strict — all docs + all validators | All validators + freshness |
|
|
59
|
+
|
|
60
|
+
See [Profiles](./profiles.md) for details.
|
|
61
|
+
|
|
62
|
+
## Validators
|
|
63
|
+
|
|
64
|
+
| Validator | Default | What It Checks |
|
|
65
|
+
|-----------|---------|----------------|
|
|
66
|
+
| `structure` | `true` | `docs-canonical/` exists, required files present, expected sections |
|
|
67
|
+
| `docsSync` | `true` | AGENTS.md references DocGuard workflow |
|
|
68
|
+
| `drift` | `true` | DRIFT-LOG.md exists and has entries when code deviates |
|
|
69
|
+
| `changelog` | `true` | CHANGELOG.md has [Unreleased] section, version entries |
|
|
70
|
+
| `architecture` | varies | Component map, layer boundaries, import graph analysis |
|
|
71
|
+
| `testSpec` | `true` | Test framework, coverage, critical flows documented |
|
|
72
|
+
| `security` | varies | Auth, secrets, RBAC documentation |
|
|
73
|
+
| `environment` | `true` | Setup steps, env vars, prerequisites, .env.example |
|
|
74
|
+
| `freshness` | varies | Docs updated recently relative to code changes (git-based) |
|
|
75
|
+
|
|
76
|
+
## Project Type Detection
|
|
77
|
+
|
|
78
|
+
DocGuard auto-detects your project type from `package.json`:
|
|
79
|
+
|
|
80
|
+
| Signal | Detected Type |
|
|
81
|
+
|--------|--------------|
|
|
82
|
+
| `bin` field | `cli` |
|
|
83
|
+
| `next`, `react`, `vue`, `angular`, `svelte` | `webapp` |
|
|
84
|
+
| `express`, `fastify`, `hono`, `koa` | `api` |
|
|
85
|
+
| `main`, `exports`, `module` | `library` |
|
|
86
|
+
| `manage.py` | `webapp` (Django) |
|
|
87
|
+
| `pyproject.toml` | `library` (Python) |
|
|
88
|
+
|
|
89
|
+
## Project Type Defaults
|
|
90
|
+
|
|
91
|
+
| Type | Env Vars | .env.example | E2E | Database |
|
|
92
|
+
|------|----------|-------------|-----|----------|
|
|
93
|
+
| `cli` | ✗ | ✗ | ✗ | ✗ |
|
|
94
|
+
| `library` | ✗ | ✗ | ✗ | ✗ |
|
|
95
|
+
| `webapp` | ✓ | ✓ | ✓ | ✓ |
|
|
96
|
+
| `api` | ✓ | ✓ | ✗ | ✓ |
|
package/docs/faq.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Frequently Asked Questions
|
|
2
|
+
|
|
3
|
+
## General
|
|
4
|
+
|
|
5
|
+
### What is DocGuard?
|
|
6
|
+
|
|
7
|
+
DocGuard is an AI-native CLI tool that enforces Canonical-Driven Development (CDD). It ensures your project documentation stays accurate, comprehensive, and in sync with your code — using AI to write and maintain the docs.
|
|
8
|
+
|
|
9
|
+
### What is CDD?
|
|
10
|
+
|
|
11
|
+
Canonical-Driven Development is a methodology where documentation is the source of truth. Instead of writing code first and documenting later (which leads to "document rot"), CDD enforces that documentation exists, is structured, and stays fresh.
|
|
12
|
+
|
|
13
|
+
### Does DocGuard write documentation for me?
|
|
14
|
+
|
|
15
|
+
**No — but it tells AI what to write.** DocGuard generates structured research prompts that AI agents execute. The AI reads your codebase, writes the documentation, and DocGuard verifies it's correct. Your role: review what the AI wrote.
|
|
16
|
+
|
|
17
|
+
### What's the difference between DocGuard and just writing docs manually?
|
|
18
|
+
|
|
19
|
+
DocGuard adds three things:
|
|
20
|
+
1. **Structure** — Enforces consistent doc templates across all projects
|
|
21
|
+
2. **Enforcement** — Validates docs exist, have required sections, stay fresh
|
|
22
|
+
3. **AI automation** — Generates prompts so AI writes the docs, not humans
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
### What's the most important command?
|
|
29
|
+
|
|
30
|
+
**`docguard diagnose`** — it's the primary command. It runs all checks, identifies every issue, and generates AI fix prompts in a single output. Start here.
|
|
31
|
+
|
|
32
|
+
### What's the difference between `guard` and `diagnose`?
|
|
33
|
+
|
|
34
|
+
| Command | Purpose | When to use |
|
|
35
|
+
|---------|---------|-------------|
|
|
36
|
+
| `guard` | Identify issues (pass/fail gate) | CI pipelines, pre-commit hooks |
|
|
37
|
+
| `diagnose` | Identify + generate fix prompts | Development, AI agents, fixing docs |
|
|
38
|
+
|
|
39
|
+
`diagnose` runs `guard` internally and adds the fix layer on top.
|
|
40
|
+
|
|
41
|
+
### What's the difference between `fix` and `diagnose`?
|
|
42
|
+
|
|
43
|
+
`fix` generates prompts for individual documents (`fix --doc architecture`). `diagnose` runs everything at once and outputs a combined remediation plan. Use `diagnose` for a full health check; use `fix --doc` when you know exactly which doc needs work.
|
|
44
|
+
|
|
45
|
+
### What does `generate` do that `init` doesn't?
|
|
46
|
+
|
|
47
|
+
`init` creates empty skeleton templates. `generate` scans your existing codebase and creates pre-filled docs with real content (detected components, routes, env vars, etc.).
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Profiles
|
|
52
|
+
|
|
53
|
+
### What profile should I use?
|
|
54
|
+
|
|
55
|
+
| Situation | Profile |
|
|
56
|
+
|-----------|---------|
|
|
57
|
+
| Side project, tutorial, prototype | `starter` |
|
|
58
|
+
| Team project, active development | `standard` (default) |
|
|
59
|
+
| Regulated, enterprise, compliance | `enterprise` |
|
|
60
|
+
|
|
61
|
+
### Can I switch profiles later?
|
|
62
|
+
|
|
63
|
+
Yes. Change the `"profile"` field in `.docguard.json` and run `docguard diagnose` to see what's missing.
|
|
64
|
+
|
|
65
|
+
### Can I override specific validators within a profile?
|
|
66
|
+
|
|
67
|
+
Yes. Profile sets the baseline, your config overrides:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"profile": "starter",
|
|
72
|
+
"validators": {
|
|
73
|
+
"freshness": true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Document Tax
|
|
81
|
+
|
|
82
|
+
### What is "document tax"?
|
|
83
|
+
|
|
84
|
+
The time and effort required to maintain documentation. Too little documentation leads to "document rot" (stale, useless docs). Too much enforcement creates "document tax" (developers spend more time on docs than code).
|
|
85
|
+
|
|
86
|
+
### How does DocGuard avoid document tax?
|
|
87
|
+
|
|
88
|
+
1. **AI writes the docs** — human cost drops to near-zero
|
|
89
|
+
2. **Compliance profiles** — choose the right level for your project
|
|
90
|
+
3. **`score --tax`** — measures your actual maintenance cost
|
|
91
|
+
4. **Smart enforcement** — only flags when relevant code changed
|
|
92
|
+
|
|
93
|
+
### What does `score --tax` show?
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
📋 Documentation Tax Estimate
|
|
97
|
+
─────────────────────────────────
|
|
98
|
+
Tracked docs: 7 files
|
|
99
|
+
Active profile: standard
|
|
100
|
+
Est. maintenance: ~5 min/week
|
|
101
|
+
Tax-to-value ratio: LOW
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
If tax is HIGH, consider using `starter` profile or letting AI handle more.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## CI/CD
|
|
109
|
+
|
|
110
|
+
### How do I add DocGuard to CI?
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx docguard ci --format json --threshold 70
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Exit code 0 = pass, 1 = fail. Use `--threshold` to set minimum score.
|
|
117
|
+
|
|
118
|
+
### Is there a GitHub Action?
|
|
119
|
+
|
|
120
|
+
Yes — DocGuard ships a template at `templates/ci/github-actions.yml`. Copy it to `.github/workflows/` or use the reusable action in `action.yml`.
|
|
121
|
+
|
|
122
|
+
### Does DocGuard block commits?
|
|
123
|
+
|
|
124
|
+
Only if you install hooks (`docguard hooks`). Without hooks, it's advisory only.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Technical
|
|
129
|
+
|
|
130
|
+
### Does DocGuard have dependencies?
|
|
131
|
+
|
|
132
|
+
**Zero.** Pure Node.js, no npm dependencies. Works with Node.js 18+.
|
|
133
|
+
|
|
134
|
+
### Does it work with non-JavaScript projects?
|
|
135
|
+
|
|
136
|
+
Yes. DocGuard validates documentation structure, not code. It works with any project that has a `docs-canonical/` directory. Some validators (architecture import analysis) are JavaScript-focused, but the core CDD framework is language-agnostic.
|
|
137
|
+
|
|
138
|
+
### Does DocGuard read my code?
|
|
139
|
+
|
|
140
|
+
Yes — for features like `generate`, `diff`, and `architecture` validation. It reads local files only. No data is sent anywhere.
|
|
141
|
+
|
|
142
|
+
### Can I disable validators I don't need?
|
|
143
|
+
|
|
144
|
+
Yes. In `.docguard.json`:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"validators": {
|
|
149
|
+
"security": false,
|
|
150
|
+
"freshness": false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Or use a profile that has them disabled by default (like `starter`).
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- **Node.js** ≥ 18
|
|
6
|
+
- **git** (optional — needed for freshness validation)
|
|
7
|
+
|
|
8
|
+
## Install via npx (Recommended)
|
|
9
|
+
|
|
10
|
+
No installation needed. Run directly:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx docguard --help
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This downloads and runs DocGuard on demand. Always uses the latest version.
|
|
17
|
+
|
|
18
|
+
## Install as Dev Dependency
|
|
19
|
+
|
|
20
|
+
For projects that want a pinned version:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save-dev docguard
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then use via npm scripts in `package.json`:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"scripts": {
|
|
31
|
+
"guard": "docguard guard",
|
|
32
|
+
"score": "docguard score",
|
|
33
|
+
"lint:docs": "docguard ci --threshold 70"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Install Globally
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -g docguard
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then use anywhere:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
docguard guard
|
|
48
|
+
docguard score
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Verify Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx docguard --version
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Should output `DocGuard v0.4.0` (or current version).
|
|
58
|
+
|
|
59
|
+
## CI/CD Installation
|
|
60
|
+
|
|
61
|
+
In GitHub Actions or similar:
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
- name: Run DocGuard
|
|
65
|
+
run: npx docguard ci --threshold 70
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
No separate install step needed — `npx` handles it.
|
|
69
|
+
|
|
70
|
+
## Upgrading
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# If installed as dev dependency
|
|
74
|
+
npm update docguard
|
|
75
|
+
|
|
76
|
+
# If installed globally
|
|
77
|
+
npm update -g docguard
|
|
78
|
+
|
|
79
|
+
# If using npx — always runs latest automatically
|
|
80
|
+
npx docguard@latest --version
|
|
81
|
+
```
|
package/docs/profiles.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Compliance Profiles
|
|
2
|
+
|
|
3
|
+
DocGuard supports three compliance profiles to match different project needs.
|
|
4
|
+
|
|
5
|
+
## The Problem: Document Tax
|
|
6
|
+
|
|
7
|
+
Requiring all 5 canonical docs for a weekend side project is overkill. Requiring only ARCHITECTURE.md for a regulated enterprise app is dangerous. Profiles solve this.
|
|
8
|
+
|
|
9
|
+
## Profiles
|
|
10
|
+
|
|
11
|
+
### `starter` — For side projects and prototypes
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx docguard init --profile starter
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Creates:** ARCHITECTURE.md, CHANGELOG.md, AGENTS.md, DRIFT-LOG.md
|
|
18
|
+
|
|
19
|
+
**Validators enabled:** structure, docsSync, changelog
|
|
20
|
+
|
|
21
|
+
**Validators disabled:** drift, architecture, testSpec, security, environment, freshness
|
|
22
|
+
|
|
23
|
+
**Use when:** Solo projects, hackathons, learning projects, anything where "some docs" beats "no docs."
|
|
24
|
+
|
|
25
|
+
### `standard` — For team projects (default)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx docguard init # default profile
|
|
29
|
+
npx docguard init --profile standard # explicit
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Creates:** All 5 canonical docs + AGENTS.md + CHANGELOG.md + DRIFT-LOG.md
|
|
33
|
+
|
|
34
|
+
**Validators enabled:** structure, docsSync, drift, changelog, testSpec, environment, freshness
|
|
35
|
+
|
|
36
|
+
**Validators disabled:** architecture (deep import analysis), security (secrets scanning)
|
|
37
|
+
|
|
38
|
+
**Use when:** Active team projects, repos with 3+ contributors, anything that will live longer than a sprint.
|
|
39
|
+
|
|
40
|
+
### `enterprise` — For regulated and critical projects
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx docguard init --profile enterprise
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Creates:** All 5 canonical docs + all tracking files
|
|
47
|
+
|
|
48
|
+
**Validators enabled:** ALL — including architecture (import graph), security (secrets), and freshness
|
|
49
|
+
|
|
50
|
+
**Use when:** Regulated industries, SOC2/HIPAA compliance, mission-critical production systems, enterprise monorepos.
|
|
51
|
+
|
|
52
|
+
## Setting a Profile
|
|
53
|
+
|
|
54
|
+
### At init time
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx docguard init --profile starter
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### In `.docguard.json`
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"profile": "enterprise"
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Overriding specific validators
|
|
69
|
+
|
|
70
|
+
Profiles set defaults, but you can override anything:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"profile": "starter",
|
|
75
|
+
"validators": {
|
|
76
|
+
"freshness": true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This uses the starter baseline but enables freshness checks.
|
|
82
|
+
|
|
83
|
+
## Graduating Between Profiles
|
|
84
|
+
|
|
85
|
+
As your project grows:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
starter → standard → enterprise
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
1. Start with `starter` — just ARCHITECTURE + CHANGELOG
|
|
92
|
+
2. When your team grows, switch to `standard` — add all 5 docs
|
|
93
|
+
3. When you need compliance, switch to `enterprise` — enable all validators
|
|
94
|
+
|
|
95
|
+
Change the `"profile"` field in `.docguard.json` and run `docguard diagnose` to see what's missing.
|
|
96
|
+
|
|
97
|
+
## Measuring the Cost
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx docguard score --tax
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Shows estimated weekly maintenance time. If the tax is HIGH, consider downgrading your profile. If LOW, you might benefit from upgrading.
|