docguard-cli 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +102 -0
- package/README.md +80 -32
- package/README.pt-BR.md +101 -0
- package/STANDARD.md +20 -10
- package/cli/commands/agents.mjs +149 -0
- package/cli/commands/diff.mjs +6 -15
- package/cli/commands/generate.mjs +14 -1001
- package/cli/commands/guard.mjs +136 -8
- package/cli/commands/llms.mjs +67 -5
- package/cli/commands/mcp.mjs +263 -0
- package/cli/commands/memory.mjs +115 -0
- package/cli/commands/score.mjs +76 -12
- package/cli/commands/trace.mjs +364 -1
- package/cli/commands/verify.mjs +93 -6
- package/cli/docguard.mjs +42 -5
- package/cli/findings.mjs +511 -0
- package/cli/scanners/agent-readability.mjs +202 -0
- package/cli/scanners/instruction-audit.mjs +320 -0
- package/cli/scanners/semantic-claims.mjs +7 -1
- package/cli/scanners/speckit.mjs +443 -28
- package/cli/shared-ignore.mjs +148 -16
- package/cli/shared.mjs +45 -1
- package/cli/validators/api-surface.mjs +113 -26
- package/cli/validators/architecture.mjs +66 -43
- package/cli/validators/canonical-sync.mjs +59 -28
- package/cli/validators/changelog.mjs +41 -17
- package/cli/validators/cross-reference.mjs +28 -11
- package/cli/validators/doc-quality.mjs +78 -44
- package/cli/validators/docs-coverage.mjs +90 -63
- package/cli/validators/docs-diff.mjs +63 -64
- package/cli/validators/docs-sync.mjs +48 -33
- package/cli/validators/drift.mjs +40 -34
- package/cli/validators/environment.mjs +67 -27
- package/cli/validators/freshness.mjs +12 -5
- package/cli/validators/generated-staleness.mjs +26 -10
- package/cli/validators/metadata-sync.mjs +28 -25
- package/cli/validators/metrics-consistency.mjs +89 -47
- package/cli/validators/schema-sync.mjs +37 -32
- package/cli/validators/security.mjs +7 -20
- package/cli/validators/spec-kit.mjs +3 -0
- package/cli/validators/structure.mjs +58 -23
- package/cli/validators/surface-sync.mjs +34 -15
- package/cli/validators/test-spec.mjs +87 -29
- package/cli/validators/todo-tracking.mjs +83 -74
- package/cli/validators/traceability.mjs +67 -39
- package/cli/writers/doc-generators.mjs +853 -0
- package/cli/writers/generate-io.mjs +142 -0
- package/cli/writers/sarif.mjs +129 -0
- package/commands/docguard.fix.md +56 -53
- package/commands/docguard.guard.md +53 -47
- package/commands/docguard.review.md +49 -31
- package/docs/ai-integration.md +133 -134
- package/docs/commands.md +49 -3
- package/docs/configuration.md +38 -0
- package/docs/faq.md +15 -0
- package/extensions/spec-kit-docguard/extension.yml +1 -1
- package/extensions/spec-kit-docguard/skills/docguard-fix/SKILL.md +2 -2
- package/extensions/spec-kit-docguard/skills/docguard-guard/SKILL.md +2 -2
- package/extensions/spec-kit-docguard/skills/docguard-review/SKILL.md +2 -2
- package/extensions/spec-kit-docguard/skills/docguard-score/SKILL.md +2 -2
- package/extensions/spec-kit-docguard/skills/docguard-sync/SKILL.md +2 -2
- package/package.json +2 -1
- package/schemas/docguard-config.schema.json +28 -0
- package/templates/ci/gitlab-component.yml +90 -0
- package/templates/commands/docguard.fix.md +33 -10
- package/templates/commands/docguard.guard.md +40 -26
- package/templates/commands/docguard.init.md +23 -11
- package/templates/commands/docguard.review.md +25 -8
- package/templates/commands/docguard.update.md +14 -4
package/docs/ai-integration.md
CHANGED
|
@@ -1,179 +1,178 @@
|
|
|
1
1
|
# AI Integration Guide
|
|
2
2
|
|
|
3
|
-
DocGuard is **AI-native
|
|
3
|
+
DocGuard is **AI-native by design**: a deterministic, zero-LLM core that finds
|
|
4
|
+
documentation-code drift, paired with surfaces that let any AI consumer act on
|
|
5
|
+
what it finds. The division of labour never changes:
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
> **Deterministic discovery, LLM judgment.** DocGuard extracts the facts
|
|
8
|
+
> (routes, schemas, env vars, documented claims, finding codes); the agent
|
|
9
|
+
> reads, verifies, and writes prose. DocGuard never calls an LLM itself.
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
docguard diagnose → AI reads output → AI writes docs → docguard guard → ✅
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
DocGuard is designed to be used **by** AI agents, not just **for** humans.
|
|
12
|
-
|
|
13
|
-
## Supported AI Agents
|
|
11
|
+
## Pick your integration surface
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
| You are… | Use | One-liner |
|
|
14
|
+
|----------|-----|-----------|
|
|
15
|
+
| An MCP-capable agent (Claude Code, Cursor, …) | **MCP server** | `claude mcp add docguard -- npx docguard-cli mcp` |
|
|
16
|
+
| An agent that can run CLI commands | **JSON contract** | `npx docguard-cli guard --format json` |
|
|
17
|
+
| A slash-command workflow | **Installed commands** | `docguard init` installs `/docguard.*` into `.agent/commands/` |
|
|
18
|
+
| GitHub Code Scanning / SARIF dashboards | **SARIF output** | `npx docguard-cli guard --format sarif` |
|
|
19
|
+
| A PR reviewer (human or bot) | **GitHub Action** | inline annotations + sticky doc-impact comment, default on |
|
|
20
|
+
| An LLM reading the repo cold | **llms.txt / llms-full.txt / context pack** | `docguard llms`, `llms --full`, `memory --pack` |
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|-------|------------|
|
|
19
|
-
| **Claude Code** | Reads `diagnose` output, writes docs, runs `guard` |
|
|
20
|
-
| **GitHub Copilot** | Slash commands in `.github/commands/` |
|
|
21
|
-
| **Cursor** | Slash commands in `.cursor/rules/` |
|
|
22
|
-
| **Google Antigravity** | Workflows in `.agents/workflows/` |
|
|
23
|
-
| **Google Gemini** | Commands in `.gemini/commands/` |
|
|
24
|
-
| **Any CLI-capable LLM** | Reads JSON output from `--format json` |
|
|
22
|
+
## MCP server (native tools, no shelling out)
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
```bash
|
|
25
|
+
# Claude Code
|
|
26
|
+
claude mcp add docguard -- npx docguard-cli mcp
|
|
27
|
+
# any MCP client: stdio transport, JSON-RPC 2.0
|
|
28
|
+
npx docguard-cli mcp
|
|
29
|
+
```
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
Five tools, each accepting an optional `projectDir`:
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
| Tool | Returns |
|
|
34
|
+
|------|---------|
|
|
35
|
+
| `docguard_guard` | The full guard JSON contract — status, findings (stable codes), coverage, unverified-claim count |
|
|
36
|
+
| `docguard_score` | `{score, grade, categories}` |
|
|
37
|
+
| `docguard_explain` | A finding code's contract: title, help, suppression pragma, owning validator |
|
|
38
|
+
| `docguard_verify_claims` | Documented numbers/limits/enums as verification tasks — **the caller checks each against the code** |
|
|
39
|
+
| `docguard_diagnose` | Failing/warning validators with per-finding suggestions, shaped for action |
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
The server is read-only (never scaffolds), keeps stdout as a pure JSON-RPC
|
|
42
|
+
transport, and turns in-tool failures (e.g. a malformed `.docguard.json`) into
|
|
43
|
+
`isError` results instead of dying.
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
## The JSON contract (CLI automation)
|
|
40
46
|
|
|
41
47
|
```bash
|
|
42
|
-
npx docguard-cli
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Output:
|
|
48
|
+
npx docguard-cli guard --format json
|
|
46
49
|
```
|
|
47
|
-
🔍 DocGuard Diagnose — my-project
|
|
48
|
-
Profile: standard | Score: 75/100 (B)
|
|
49
|
-
Guard: 35/41 passed | Status: WARN
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
| Field | Meaning |
|
|
52
|
+
|-------|---------|
|
|
53
|
+
| `status` | `PASS` / `WARN` / `FAIL` — severity-aware, matches the exit code (0/2/1) |
|
|
54
|
+
| `findings[]` | `{code, severity, confidence, message, location, suggestion}` — codes are stable API (`STR001`, `ENV003`, `XRF002`, …) |
|
|
55
|
+
| `nextStep` | The single suggested follow-up command (`null` on PASS) |
|
|
56
|
+
| `reportable[]` | Low-confidence findings (possible false positives) — verify before acting |
|
|
57
|
+
| `coverage` | Markdown tier map: canonical / tracked / ignored / `unclassified[]` |
|
|
58
|
+
| `semanticClaims.count` | Documented counts/limits/enums **not yet verified against code** |
|
|
59
|
+
| `validators[]` | Per-validator results — `na` means "nothing to validate", which is not a pass |
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
1. docguard fix --doc architecture
|
|
57
|
-
2. docguard guard ← verify fixes
|
|
61
|
+
Working with findings:
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
```bash
|
|
64
|
+
npx docguard-cli explain XRF002 # any code → contract, cause, fix, suppression
|
|
65
|
+
npx docguard-cli fix --write # apply deterministic fixes (provenance-checked)
|
|
66
|
+
npx docguard-cli feedback # report a false positive (local-first + prefilled issue)
|
|
62
67
|
```
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
Suppress a confirmed false positive **at the finding site**, never by disabling
|
|
70
|
+
a validator: `// docguard:ignore SEC001` on (or above) the flagged line, or
|
|
71
|
+
`<!-- docguard:validator <key> n/a — reason -->` in a doc.
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
## SARIF (GitHub Code Scanning)
|
|
67
74
|
|
|
68
75
|
```bash
|
|
69
|
-
npx docguard-cli
|
|
76
|
+
npx docguard-cli guard --format sarif > docguard.sarif
|
|
70
77
|
```
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
1. Read package.json for dependencies and project structure
|
|
78
|
-
2. List top-level directories (src/, lib/, cli/)
|
|
79
|
-
3. Read 2-3 representative files per directory
|
|
80
|
-
4. Map the import graph
|
|
81
|
-
5. Identify external dependencies
|
|
82
|
-
|
|
83
|
-
WRITE THE DOCUMENT:
|
|
84
|
-
- System Overview (2-3 sentences)
|
|
85
|
-
- Component Map (table of modules)
|
|
86
|
-
- Layer Boundaries (import rules)
|
|
87
|
-
- Data Flow (request lifecycle)
|
|
88
|
-
```
|
|
79
|
+
Findings map 1:1 onto SARIF 2.1.0 — codes become rules (with the registry's
|
|
80
|
+
title/help), locations become regions, low-confidence findings carry a property
|
|
81
|
+
bag. Upload with `github/codeql-action/upload-sarif` and DocGuard findings
|
|
82
|
+
appear inline on PR diffs and in the Security tab. Exit codes are unchanged
|
|
83
|
+
(0/2/1), so the same run can gate and report.
|
|
89
84
|
|
|
90
|
-
|
|
85
|
+
## GitHub Action (PR feedback)
|
|
91
86
|
|
|
92
|
-
```
|
|
93
|
-
|
|
87
|
+
```yaml
|
|
88
|
+
permissions: { pull-requests: write }
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
with: { fetch-depth: 0 }
|
|
92
|
+
- uses: raccioly/docguard@v0.12.0
|
|
93
|
+
with:
|
|
94
|
+
command: guard
|
|
95
|
+
# both default to 'true':
|
|
96
|
+
# annotations: inline ::error/::warning per finding (capped at 50)
|
|
97
|
+
# pr-comment: sticky comment — verdict, top findings, impacted canonical docs
|
|
94
98
|
```
|
|
95
99
|
|
|
96
|
-
|
|
100
|
+
The feedback steps run **even when guard fails** — that is when they matter —
|
|
101
|
+
and degrade gracefully on fork tokens and shallow clones.
|
|
97
102
|
|
|
98
|
-
##
|
|
103
|
+
## Context surfaces (for LLMs reading the repo)
|
|
99
104
|
|
|
100
|
-
|
|
105
|
+
| Artifact | Command | What it is |
|
|
106
|
+
|----------|---------|------------|
|
|
107
|
+
| `llms.txt` | `docguard llms` | Link index of the canonical docs ([llms.txt standard](https://llmstxt.org)) |
|
|
108
|
+
| `llms-full.txt` | `docguard llms --full` | Full doc bodies inlined — one fetch, per-doc 400-line cap |
|
|
109
|
+
| `.docguard/context-pack.md` | `docguard memory --pack` | Compact session-start context: guard status, scanner-derived surface counts, doc index with review dates, your AGENTS.md rules verbatim, known drift. Everything derived from code — regenerable, hallucination-free |
|
|
101
110
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
```
|
|
111
|
+
Load the context pack at agent session start; regenerate any time — it is
|
|
112
|
+
never hand-edited.
|
|
105
113
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"status": "WARN",
|
|
111
|
-
"score": 75,
|
|
112
|
-
"grade": "B",
|
|
113
|
-
"issues": [
|
|
114
|
-
{
|
|
115
|
-
"severity": "warning",
|
|
116
|
-
"validator": "Freshness",
|
|
117
|
-
"message": "ARCHITECTURE.md — 15 commits since last update",
|
|
118
|
-
"command": "docguard fix --doc architecture",
|
|
119
|
-
"docTarget": "architecture"
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
"fixCommands": ["docguard fix --doc architecture"]
|
|
123
|
-
}
|
|
124
|
-
```
|
|
114
|
+
## One source of truth for agent files
|
|
115
|
+
|
|
116
|
+
Teams hand-duplicate AGENTS.md into `CLAUDE.md`, `.cursor/rules/`,
|
|
117
|
+
`.github/copilot-instructions.md`, `GEMINI.md` — and the copies drift. Instead:
|
|
125
118
|
|
|
126
119
|
```bash
|
|
127
|
-
|
|
120
|
+
docguard agents --sync # regenerate the family from AGENTS.md (hash-marked)
|
|
121
|
+
docguard agents --check # CI gate: exit 2 if any generated variant is stale
|
|
128
122
|
```
|
|
129
123
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"project": "my-project",
|
|
133
|
-
"profile": "standard",
|
|
134
|
-
"status": "PASS",
|
|
135
|
-
"passed": 41,
|
|
136
|
-
"total": 41,
|
|
137
|
-
"validators": [
|
|
138
|
-
{ "name": "Structure", "status": "pass", "passed": 8, "total": 8 }
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
```
|
|
124
|
+
Generated variants carry a source-hash marker. Files you wrote by hand (no
|
|
125
|
+
marker) are never touched without `--force`.
|
|
142
126
|
|
|
143
|
-
##
|
|
127
|
+
## Slash commands
|
|
144
128
|
|
|
145
|
-
|
|
129
|
+
`docguard init` installs `/docguard.*` commands into `.agent/commands/` (the
|
|
130
|
+
spec-kit convention; agents like Claude Code, Copilot, and Cursor pick them
|
|
131
|
+
up). They encode the full workflows below — `templates/commands/` in this repo
|
|
132
|
+
is the canonical source.
|
|
146
133
|
|
|
147
|
-
|
|
134
|
+
## The agent workflow
|
|
148
135
|
|
|
149
|
-
```yaml
|
|
150
|
-
# .github/workflows/docguard.yml
|
|
151
|
-
name: DocGuard CDD Check
|
|
152
|
-
on: [pull_request]
|
|
153
|
-
jobs:
|
|
154
|
-
docguard:
|
|
155
|
-
runs-on: ubuntu-latest
|
|
156
|
-
steps:
|
|
157
|
-
- uses: actions/checkout@v4
|
|
158
|
-
- uses: actions/setup-node@v4
|
|
159
|
-
with: { node-version: '20' }
|
|
160
|
-
- run: npx docguard-cli ci --format json --threshold 70
|
|
161
136
|
```
|
|
162
|
-
|
|
163
|
-
Or copy `templates/ci/github-actions.yml` from this repo.
|
|
164
|
-
|
|
165
|
-
### Pre-commit Hook
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
npx docguard-cli hooks
|
|
137
|
+
diagnose → fix (research + write) → guard → verify --semantic → done
|
|
169
138
|
```
|
|
170
139
|
|
|
171
|
-
|
|
140
|
+
1. **`docguard diagnose`** — one command that identifies everything, with
|
|
141
|
+
AI-ready fix prompts (add `--format json` for structure).
|
|
142
|
+
2. **`docguard fix --doc <name>`** — emits research steps + expected structure
|
|
143
|
+
for one doc. Execute the research, write real content, no placeholders.
|
|
144
|
+
3. **`docguard guard`** — verify. Loop until PASS.
|
|
145
|
+
4. **`docguard verify --semantic`** — extract every checkable documented claim
|
|
146
|
+
(counts, limits, enums) with the nearest cited code path. **You** compare
|
|
147
|
+
each value against the code: a green guard asserts structure, not the truth
|
|
148
|
+
of documented numbers. This is the highest-value step an agent can run.
|
|
149
|
+
|
|
150
|
+
Before editing docs after code changes, prefer the mechanical layers:
|
|
151
|
+
`docguard sync --write` (regenerates `source=code` marked sections) and
|
|
152
|
+
`docguard fix --write` (counts, versions, anchors) — never hand-edit what the
|
|
153
|
+
tool can fix deterministically.
|
|
172
154
|
|
|
173
|
-
##
|
|
155
|
+
## Is your repo readable by agents?
|
|
174
156
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
157
|
+
```bash
|
|
158
|
+
docguard score
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The **Agent Readability** block (display-only) measures how well AI consumers
|
|
162
|
+
can read the repo: agent entry file, entry-file token budget, section
|
|
163
|
+
addressability, structured-content density, machine markers, llms.txt, link
|
|
164
|
+
integrity. Each failing metric names its fix.
|
|
165
|
+
|
|
166
|
+
## Best practices for AI agents
|
|
167
|
+
|
|
168
|
+
1. **MCP first** — native tools beat parsing CLI output.
|
|
169
|
+
2. **Trust the codes** — every finding has a stable code; `explain` it before
|
|
170
|
+
acting, suppress at the site with it, report false positives via `feedback`.
|
|
171
|
+
3. **Run `guard` after every fix batch** — loop until PASS.
|
|
172
|
+
4. **Never treat `na` as a pass** — "nothing to validate" is a coverage gap.
|
|
173
|
+
5. **Check `semanticClaims.count` on green runs** — offer `verify --semantic`.
|
|
174
|
+
6. **Respect the drift protocol** — deviating from canonical docs requires
|
|
175
|
+
`// DRIFT: reason` + a DRIFT-LOG.md entry, not a silent doc rewrite; the
|
|
176
|
+
docs may be right and the code wrong.
|
|
177
|
+
7. **`score --tax`** periodically — documentation should stay an asset, not a
|
|
178
|
+
burden.
|
package/docs/commands.md
CHANGED
|
@@ -36,8 +36,10 @@ npx docguard-cli diagnose --format prompt # Raw AI prompt (all issues combined)
|
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
npx docguard-cli guard # Text output
|
|
39
|
-
npx docguard-cli guard --format json # Structured JSON
|
|
39
|
+
npx docguard-cli guard --format json # Structured JSON (the stable agent contract)
|
|
40
|
+
npx docguard-cli guard --format sarif # SARIF 2.1.0 for GitHub Code Scanning
|
|
40
41
|
npx docguard-cli guard --verbose # Show all check details
|
|
42
|
+
npx docguard-cli guard --changed-only # Pre-commit lite mode (fast subset)
|
|
41
43
|
```
|
|
42
44
|
|
|
43
45
|
**Exit codes:** `0` (pass), `1` (errors), `2` (warnings)
|
|
@@ -52,12 +54,21 @@ When issues are found, guard outputs: `Run docguard diagnose to get AI fix promp
|
|
|
52
54
|
"status": "WARN",
|
|
53
55
|
"passed": 37,
|
|
54
56
|
"total": 40,
|
|
57
|
+
"findings": [
|
|
58
|
+
{ "code": "ENV003", "severity": "warn", "message": "…", "location": "docs-canonical/ENVIRONMENT.md", "suggestion": { "kind": "fix", "text": "…" } }
|
|
59
|
+
],
|
|
60
|
+
"nextStep": "docguard diagnose",
|
|
61
|
+
"coverage": { "canonical": 5, "tracked": 40, "ignored": 10, "unclassified": [] },
|
|
62
|
+
"semanticClaims": { "count": 12 },
|
|
55
63
|
"validators": [
|
|
56
64
|
{ "name": "Structure", "status": "pass", "passed": 8, "total": 8, "errors": [], "warnings": [] }
|
|
57
65
|
]
|
|
58
66
|
}
|
|
59
67
|
```
|
|
60
68
|
|
|
69
|
+
Every finding carries a stable code — `docguard explain <CODE>` for its
|
|
70
|
+
contract, `// docguard:ignore <CODE>` to suppress a false positive at the site.
|
|
71
|
+
|
|
61
72
|
### `docguard score`
|
|
62
73
|
|
|
63
74
|
**CDD maturity score** (0-100) with category breakdown.
|
|
@@ -157,8 +168,43 @@ npx docguard-cli fix --doc environment
|
|
|
157
168
|
**Generate agent-specific config files** from AGENTS.md.
|
|
158
169
|
|
|
159
170
|
```bash
|
|
160
|
-
npx docguard-cli agents
|
|
161
|
-
npx docguard-cli agents --
|
|
171
|
+
npx docguard-cli agents # one-shot scaffold (skips existing files)
|
|
172
|
+
npx docguard-cli agents --sync # AGENTS.md → CLAUDE.md/Copilot/Cursor/… (hash-marked, repeatable)
|
|
173
|
+
npx docguard-cli agents --check # CI gate: exit 2 if any synced variant is stale
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`--sync` treats AGENTS.md as the canonical source: generated variants carry a
|
|
177
|
+
source-hash marker and are regenerated on change; files you wrote by hand are
|
|
178
|
+
never touched without `--force`.
|
|
179
|
+
|
|
180
|
+
### `docguard mcp`
|
|
181
|
+
|
|
182
|
+
**MCP server over stdio** — DocGuard's read-only core as native agent tools
|
|
183
|
+
(`docguard_guard`, `docguard_score`, `docguard_explain`,
|
|
184
|
+
`docguard_verify_claims`, `docguard_diagnose`).
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
claude mcp add docguard -- npx docguard-cli mcp
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### `docguard verify --semantic`
|
|
191
|
+
|
|
192
|
+
**Extract documented claims** (counts, limits, enums) as a verification task
|
|
193
|
+
list with cited code paths — the agent checks each value against the code.
|
|
194
|
+
|
|
195
|
+
### `docguard explain <CODE>`
|
|
196
|
+
|
|
197
|
+
**Explain any finding code** (`STR001`, `ENV003`, …): what it means, how to fix
|
|
198
|
+
it, how to suppress a false positive at the finding site.
|
|
199
|
+
|
|
200
|
+
### `docguard llms` / `docguard memory --pack`
|
|
201
|
+
|
|
202
|
+
**Context surfaces for LLMs reading the repo:**
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
npx docguard-cli llms # llms.txt (link index)
|
|
206
|
+
npx docguard-cli llms --full # llms-full.txt (full doc bodies inlined)
|
|
207
|
+
npx docguard-cli memory --pack # .docguard/context-pack.md (session-start context)
|
|
162
208
|
```
|
|
163
209
|
|
|
164
210
|
---
|
package/docs/configuration.md
CHANGED
|
@@ -43,6 +43,20 @@ DocGuard is configured via `.docguard.json` in the project root. If no config fi
|
|
|
43
43
|
"security": true,
|
|
44
44
|
"environment": true,
|
|
45
45
|
"freshness": true
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
"severity": {
|
|
49
|
+
"security": "high",
|
|
50
|
+
"todoTracking": "low"
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
"collections": {
|
|
54
|
+
"extractors": "src/extractors/*.py",
|
|
55
|
+
"commands": "cli/commands/*.mjs"
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
"docs": {
|
|
59
|
+
"dirs": ["reference", "website/docs"]
|
|
46
60
|
}
|
|
47
61
|
}
|
|
48
62
|
```
|
|
@@ -73,6 +87,30 @@ See [Profiles](./profiles.md) for details.
|
|
|
73
87
|
| `environment` | `true` | Setup steps, env vars, prerequisites, .env.example |
|
|
74
88
|
| `freshness` | varies | Docs updated recently relative to code changes (git-based) |
|
|
75
89
|
|
|
90
|
+
## Severity overrides
|
|
91
|
+
|
|
92
|
+
`severity.<validator>` changes a validator's **exit-code weight** without hiding
|
|
93
|
+
anything from display: `"high"` promotes its warnings to blocking (CI fails),
|
|
94
|
+
`"low"` demotes them (shown, but never fail the build). Valid values:
|
|
95
|
+
`high | medium | low`. To silence a validator entirely, use `validators.<key>: false`.
|
|
96
|
+
|
|
97
|
+
## Collections — verify documented counts against code
|
|
98
|
+
|
|
99
|
+
`collections` binds a documentation noun to a glob whose **file count is the
|
|
100
|
+
source of truth**. With `"extractors": "src/extractors/*.py"`, a doc claiming
|
|
101
|
+
"16 extractors" while the glob matches 19 files becomes a guard warning (and a
|
|
102
|
+
`fix --write`-able correction). Declaring the noun *is* the opt-in — no other
|
|
103
|
+
marker needed. Reserved nouns (`checks`, `validators`, `tests`) keep their
|
|
104
|
+
built-in DocGuard meaning. An unresolvable glob is skipped, never treated as 0.
|
|
105
|
+
|
|
106
|
+
## Documentation homes — `docs.dirs`
|
|
107
|
+
|
|
108
|
+
Conventional doc folders (`docs/`, `doc/`, `documentation/`, `guides/`,
|
|
109
|
+
`handbook/`, `manual/`, `wiki/`, Docusaurus `website/docs/`, …) are
|
|
110
|
+
**auto-detected** and claim-scanned without enrollment. `docs.dirs` EXTENDS
|
|
111
|
+
that set with non-standard homes — it never replaces auto-detection. To exclude
|
|
112
|
+
a conventional dir, list it in `.docguardignore`.
|
|
113
|
+
|
|
76
114
|
## Muting a validator
|
|
77
115
|
|
|
78
116
|
Two ways to turn a validator off, for two different intents:
|
package/docs/faq.md
CHANGED
|
@@ -153,3 +153,18 @@ Yes. In `.docguard.json`:
|
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
Or use a profile that has them disabled by default (like `starter`).
|
|
156
|
+
|
|
157
|
+
### Can my AI agent use DocGuard without parsing CLI output?
|
|
158
|
+
|
|
159
|
+
Yes — run the MCP server: `claude mcp add docguard -- npx docguard-cli mcp`
|
|
160
|
+
exposes guard, score, explain, verify-claims, and diagnose as native tools for
|
|
161
|
+
Claude, Cursor, and any MCP client. For CLI-driven agents, `guard --format json`
|
|
162
|
+
is the stable contract (findings with stable codes) and `guard --format sarif`
|
|
163
|
+
feeds GitHub Code Scanning. See [AI Integration](./ai-integration.md).
|
|
164
|
+
|
|
165
|
+
### Guard flagged something that isn't wrong. What do I do?
|
|
166
|
+
|
|
167
|
+
Suppress it **at the finding site** with its code — `// docguard:ignore SEC001`
|
|
168
|
+
on (or above) the flagged line — and report it with `docguard feedback` (a
|
|
169
|
+
local-first record plus a one-click prefilled GitHub issue). Don't disable the
|
|
170
|
+
whole validator for one false positive.
|
|
@@ -3,7 +3,7 @@ schema_version: "1.0"
|
|
|
3
3
|
extension:
|
|
4
4
|
id: "docguard"
|
|
5
5
|
name: "DocGuard — CDD Enforcement"
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.30.0"
|
|
7
7
|
description: "Canonical-Driven Development enforcement as a true spec-kit extension. LLM-first design with automated validators, 4 AI behavior skills, spec-kit skill chaining, and workflow hooks. One pinned runtime dependency (@babel/parser); pure Node.js otherwise."
|
|
8
8
|
author: "Ricardo Accioly"
|
|
9
9
|
repository: "https://github.com/raccioly/docguard"
|
|
@@ -6,10 +6,10 @@ description: AI-driven documentation repair with structured research workflow, t
|
|
|
6
6
|
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
7
7
|
metadata:
|
|
8
8
|
author: docguard
|
|
9
|
-
version: 0.
|
|
9
|
+
version: 0.30.0
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-fix
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.30.0 -->
|
|
13
13
|
|
|
14
14
|
# DocGuard Fix Skill
|
|
15
15
|
|
|
@@ -7,10 +7,10 @@ description: Run DocGuard guard validation against Canonical-Driven Development
|
|
|
7
7
|
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
8
8
|
metadata:
|
|
9
9
|
author: docguard
|
|
10
|
-
version: 0.
|
|
10
|
+
version: 0.30.0
|
|
11
11
|
source: extensions/spec-kit-docguard/skills/docguard-guard
|
|
12
12
|
---
|
|
13
|
-
<!-- docguard:version: 0.
|
|
13
|
+
<!-- docguard:version: 0.30.0 -->
|
|
14
14
|
|
|
15
15
|
# DocGuard Guard Skill
|
|
16
16
|
|
|
@@ -6,10 +6,10 @@ description: Cross-document consistency analysis and quality assessment. Perform
|
|
|
6
6
|
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
7
7
|
metadata:
|
|
8
8
|
author: docguard
|
|
9
|
-
version: 0.
|
|
9
|
+
version: 0.30.0
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-review
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.30.0 -->
|
|
13
13
|
|
|
14
14
|
# DocGuard Review Skill
|
|
15
15
|
|
|
@@ -6,10 +6,10 @@ description: CDD maturity assessment with category-aware improvement roadmap. Ru
|
|
|
6
6
|
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
7
7
|
metadata:
|
|
8
8
|
author: docguard
|
|
9
|
-
version: 0.
|
|
9
|
+
version: 0.30.0
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-score
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.30.0 -->
|
|
13
13
|
|
|
14
14
|
# DocGuard Score Skill
|
|
15
15
|
|
|
@@ -4,10 +4,10 @@ description: Keep canonical documentation ALWAYS UP TO DATE. Refreshes code-trut
|
|
|
4
4
|
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
5
5
|
metadata:
|
|
6
6
|
author: docguard
|
|
7
|
-
version: 0.
|
|
7
|
+
version: 0.30.0
|
|
8
8
|
source: extensions/spec-kit-docguard/skills/docguard-sync
|
|
9
9
|
---
|
|
10
|
-
<!-- docguard:version: 0.
|
|
10
|
+
<!-- docguard:version: 0.30.0 -->
|
|
11
11
|
|
|
12
12
|
# DocGuard Sync Skill
|
|
13
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docguard-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "The enforcement tool for Canonical-Driven Development (CDD). Audit, generate, and guard your project documentation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"url": "https://github.com/raccioly/docguard"
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/raccioly/docguard#readme",
|
|
42
|
+
"mcpName": "io.github.raccioly/docguard",
|
|
42
43
|
"bugs": {
|
|
43
44
|
"url": "https://github.com/raccioly/docguard/issues"
|
|
44
45
|
},
|
|
@@ -175,6 +175,34 @@
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
"additionalProperties": true
|
|
178
|
+
},
|
|
179
|
+
"docs": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"description": "Documentation discovery (field report #6 follow-up).",
|
|
182
|
+
"properties": {
|
|
183
|
+
"dirs": {
|
|
184
|
+
"type": "array",
|
|
185
|
+
"items": { "type": "string" },
|
|
186
|
+
"description": "Additional documentation-home directories to claim-scan and count as 'tracked' (relative paths, e.g. [\"reference\", \"website/docs\"]). This EXTENDS the auto-detected conventional homes (docs/, doc/, documentation/, guides/, guide/, handbook/, manual/, wiki/, docs-canonical/, docs-implementation/, extensions/) — it never replaces them, since the goal is to track MORE clearly-documentation folders automatically. Only NAMED dirs are scanned; arbitrary subdirectories are never walked. To EXCLUDE a conventional dir, list it in .docguardignore."
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"additionalProperties": true
|
|
190
|
+
},
|
|
191
|
+
"specKit": {
|
|
192
|
+
"type": "object",
|
|
193
|
+
"description": "Spec-Kit validator overrides.",
|
|
194
|
+
"properties": {
|
|
195
|
+
"phantomCheck": {
|
|
196
|
+
"type": "boolean",
|
|
197
|
+
"description": "If false, disable phantom-completion detection (SPK008/SPK009) — checked tasks in tasks.md whose named deliverables don't exist and carry no implementation evidence. On by default."
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"additionalProperties": true
|
|
201
|
+
},
|
|
202
|
+
"collections": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"description": "Project-declared collections (field report #6): maps a documentation noun (e.g. \"extractors\") to a glob whose matching-file count is the source of truth. Metrics-Consistency then flags a documented count that disagrees (\"16 extractors\" in prose vs 19 files on disk), deterministically and with no LLM. A declared collection IS the opt-in binding, so — unlike the built-in checks/validators counts — it does not require the noun's line to mention \"docguard\". An unresolved glob (0 matches) is skipped, never asserting \"0\". Reserved nouns (checks, validators, tests) keep their built-in meaning. Complements surfaceSync (WHICH members drift) with a count check (HOW MANY). Example: { \"extractors\": \"src/extractors/*.py\", \"commands\": \"cli/commands/*.mjs\" }.",
|
|
205
|
+
"additionalProperties": { "type": "string" }
|
|
178
206
|
}
|
|
179
207
|
},
|
|
180
208
|
"additionalProperties": true
|