docguard-cli 0.10.0 → 0.11.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/PHILOSOPHY.md +59 -106
- package/README.md +23 -1
- package/cli/commands/diagnose.mjs +157 -52
- package/cli/commands/fix.mjs +113 -1
- package/cli/commands/generate.mjs +91 -0
- package/cli/commands/hooks.mjs +40 -2
- package/cli/commands/score.mjs +22 -0
- package/cli/commands/sync.mjs +123 -0
- package/cli/docguard.mjs +22 -0
- package/cli/scanners/cdk.mjs +10 -0
- package/cli/scanners/frontend.mjs +438 -0
- package/cli/scanners/iac.mjs +235 -0
- package/cli/scanners/integrations.mjs +116 -0
- package/cli/scanners/memory-plan.mjs +242 -0
- package/cli/scanners/project-type.mjs +310 -0
- package/cli/scanners/routes.mjs +149 -0
- package/cli/scanners/schemas.mjs +174 -1
- package/cli/shared-ignore.mjs +29 -2
- package/cli/shared-source.mjs +2 -1
- package/cli/validators/api-surface.mjs +112 -37
- package/cli/validators/changelog.mjs +3 -2
- package/cli/validators/docs-coverage.mjs +125 -6
- package/cli/validators/docs-sync.mjs +49 -8
- package/cli/validators/metadata-sync.mjs +6 -1
- package/cli/validators/metrics-consistency.mjs +5 -2
- package/cli/validators/test-spec.mjs +129 -11
- package/cli/validators/todo-tracking.mjs +55 -2
- package/cli/writers/api-reference.mjs +101 -0
- package/cli/writers/mechanical.mjs +116 -0
- package/cli/writers/sections.mjs +148 -0
- package/commands/docguard.fix.md +19 -3
- package/docs/doc-sections.md +37 -0
- package/extensions/spec-kit-docguard/README.md +7 -4
- package/extensions/spec-kit-docguard/commands/fix.md +74 -0
- package/extensions/spec-kit-docguard/commands/generate.md +25 -2
- package/extensions/spec-kit-docguard/commands/sync.md +62 -0
- package/extensions/spec-kit-docguard/extension.yml +1 -1
- package/extensions/spec-kit-docguard/skills/docguard-fix/SKILL.md +13 -3
- 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 +111 -0
- package/package.json +1 -1
- package/templates/ARCHITECTURE.md.template +52 -0
|
@@ -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.11.1
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-fix
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.11.1 -->
|
|
13
13
|
|
|
14
14
|
# DocGuard Fix Skill
|
|
15
15
|
|
|
@@ -36,9 +36,19 @@ Research the actual codebase to generate or repair canonical documentation that
|
|
|
36
36
|
|
|
37
37
|
## Execution Flow
|
|
38
38
|
|
|
39
|
+
### Step 0: Apply Mechanical Fixes First (no AI needed)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx docguard-cli fix --write 2>&1
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Removes endpoints documented in `docs-canonical/API-REFERENCE.md` that the OpenAPI
|
|
46
|
+
spec confirms no longer exist (table row + detail block). Only edits
|
|
47
|
+
`docguard:generated` docs, idempotent, prints what changed. Don't hand-edit these.
|
|
48
|
+
|
|
39
49
|
### Step 1: Diagnose Current State
|
|
40
50
|
|
|
41
|
-
Run the diagnostic to identify all issues:
|
|
51
|
+
Run the diagnostic to identify all issues (each tagged `mechanical` or `agent`):
|
|
42
52
|
|
|
43
53
|
```bash
|
|
44
54
|
npx docguard-cli diagnose 2>&1
|
|
@@ -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.11.1
|
|
11
11
|
source: extensions/spec-kit-docguard/skills/docguard-guard
|
|
12
12
|
---
|
|
13
|
-
<!-- docguard:version: 0.
|
|
13
|
+
<!-- docguard:version: 0.11.1 -->
|
|
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.11.1
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-review
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.11.1 -->
|
|
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.11.1
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-score
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.11.1 -->
|
|
13
13
|
|
|
14
14
|
# DocGuard Score Skill
|
|
15
15
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docguard-sync
|
|
3
|
+
description: Keep canonical documentation ALWAYS UP TO DATE. Refreshes code-truth doc sections in place (mechanical, idempotent, preserves human prose) and flags the prose sections you must review when code changes.
|
|
4
|
+
compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
|
|
5
|
+
metadata:
|
|
6
|
+
author: docguard
|
|
7
|
+
version: 0.11.1
|
|
8
|
+
source: extensions/spec-kit-docguard/skills/docguard-sync
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# DocGuard Sync Skill
|
|
12
|
+
|
|
13
|
+
## User Input
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
$ARGUMENTS
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You **MUST** consider the user input. If `--since <ref>` is provided, include the
|
|
20
|
+
git diff context in your reasoning when reviewing prose sections.
|
|
21
|
+
|
|
22
|
+
## Goal
|
|
23
|
+
|
|
24
|
+
When code changes, re-derive the code-truth surface (endpoints, entities,
|
|
25
|
+
screens, tech stack, env vars), refresh the matching `<!-- docguard:section
|
|
26
|
+
source=code -->` blocks in canonical docs in place, and **review/refresh the
|
|
27
|
+
human-written prose** in the same docs so it still describes reality.
|
|
28
|
+
|
|
29
|
+
## Operating Constraints
|
|
30
|
+
|
|
31
|
+
- **Mechanical refreshes do not need you.** DocGuard does them itself. Your job
|
|
32
|
+
is the prose sections flagged as "review" — where the human writing may no
|
|
33
|
+
longer match the new code reality.
|
|
34
|
+
- **Never edit anything outside the marked `source=human` sections** in
|
|
35
|
+
generated docs. The markers protect human writing; respect them.
|
|
36
|
+
- **Use the dry run first** to see what will change before applying.
|
|
37
|
+
|
|
38
|
+
## Execution Flow
|
|
39
|
+
|
|
40
|
+
### Step 1 — Preview what's stale
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx --yes docguard-cli@latest sync 2>&1
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Reads:
|
|
47
|
+
- `↻` / `•` lines: code-truth sections that drifted (you don't need to write these).
|
|
48
|
+
- `🤖 Prose to review` lines: human-written sections whose surrounding code changed — **these are yours**.
|
|
49
|
+
|
|
50
|
+
### Step 2 — Apply the mechanical refresh
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx --yes docguard-cli@latest sync --write 2>&1
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Re-derives every code-truth section from the current code and rewrites only those
|
|
57
|
+
markers. Idempotent — running again is a no-op when up to date.
|
|
58
|
+
|
|
59
|
+
### Step 3 — Review the flagged prose
|
|
60
|
+
|
|
61
|
+
For each `🤖 Prose to review` entry:
|
|
62
|
+
|
|
63
|
+
1. Open the doc (e.g. `docs-canonical/API-REFERENCE.md`).
|
|
64
|
+
2. Locate the `<!-- docguard:section id=<id> source=human -->` block.
|
|
65
|
+
3. **Read the surrounding `source=code` section first** — that's the new truth
|
|
66
|
+
(e.g. the refreshed endpoint list, the refreshed screens table).
|
|
67
|
+
4. Update the human prose so it still accurately describes that truth.
|
|
68
|
+
Examples of what to update:
|
|
69
|
+
- The API overview's endpoint count, or its description of the surface area.
|
|
70
|
+
- The Architecture overview when new components/services appeared.
|
|
71
|
+
- The Screens flows when new screens were added/removed/renamed.
|
|
72
|
+
5. Stay inside the `source=human` markers — don't touch the code sections.
|
|
73
|
+
|
|
74
|
+
### Step 4 — Verify
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx --yes docguard-cli@latest guard
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Confirm there are no errors. If the API surface drifted (`API-Surface` failures),
|
|
81
|
+
combine with `docguard fix --write` (the mechanical removal of stale endpoints).
|
|
82
|
+
|
|
83
|
+
### Step 5 — Loop
|
|
84
|
+
|
|
85
|
+
The intended flow is `sync → guard → (fix if needed) → guard → commit`. Run sync
|
|
86
|
+
again before opening a PR to make sure the memory is current.
|
|
87
|
+
|
|
88
|
+
## What to do if `--since <ref>` is provided
|
|
89
|
+
|
|
90
|
+
When `--since main` is given, DocGuard also lists the changed code files since
|
|
91
|
+
that ref. Use that diff to:
|
|
92
|
+
|
|
93
|
+
- Prioritize which prose sections to update first (the ones whose related code
|
|
94
|
+
files changed most).
|
|
95
|
+
- Cite concrete change reasons in your prose updates ("Added `/api/orders`
|
|
96
|
+
endpoint in commit X" → update the API overview accordingly).
|
|
97
|
+
|
|
98
|
+
## Common patterns
|
|
99
|
+
|
|
100
|
+
| Symptom | Action |
|
|
101
|
+
|---|---|
|
|
102
|
+
| `↻ docs-canonical/API-REFERENCE.md → endpoints` | Code-truth refreshed by `--write`. No action needed. |
|
|
103
|
+
| `🤖 docs-canonical/API-REFERENCE.md → overview` | Open the doc; update the `overview` prose to reflect the new endpoint set. |
|
|
104
|
+
| `Skipped … not marked docguard:generated` | The doc isn't owned by DocGuard. Either add the marker (and commit ownership) or skip with `--force`. |
|
|
105
|
+
| `Documentation memory is up to date` | Done — no drift. |
|
|
106
|
+
|
|
107
|
+
## Anti-patterns (do NOT do these)
|
|
108
|
+
|
|
109
|
+
- ❌ Editing inside `<!-- docguard:section source=code -->` — DocGuard will rewrite it on the next sync.
|
|
110
|
+
- ❌ Removing the markers to "make the doc look cleaner" — that breaks future sync/regeneration.
|
|
111
|
+
- ❌ Skipping `sync --write` and editing the code section by hand — let DocGuard do it.
|
package/package.json
CHANGED
|
@@ -58,6 +58,58 @@
|
|
|
58
58
|
|---------|---------|-----|----------|
|
|
59
59
|
| <!-- e.g. Stripe --> | <!-- e.g. Payments --> | <!-- e.g. 99.99% --> | <!-- e.g. Queue + retry --> |
|
|
60
60
|
|
|
61
|
+
## Infrastructure (IaC)
|
|
62
|
+
|
|
63
|
+
<!--
|
|
64
|
+
Skip this section if the project does not use Infrastructure-as-Code.
|
|
65
|
+
DocGuard auto-detects AWS CDK (cdk.json), Terraform (*.tf), Pulumi
|
|
66
|
+
(Pulumi.yaml), AWS SAM (template.yaml with AWS::Serverless::), and
|
|
67
|
+
Serverless Framework (serverless.yml). When any are detected and this
|
|
68
|
+
section is missing, DocGuard emits ONE consolidated reminder per tool.
|
|
69
|
+
|
|
70
|
+
Document the layout for YOUR IaC tool below. Remove the blocks that
|
|
71
|
+
don't apply.
|
|
72
|
+
-->
|
|
73
|
+
|
|
74
|
+
### AWS CDK
|
|
75
|
+
|
|
76
|
+
<!-- Remove this block if you don't use CDK -->
|
|
77
|
+
|
|
78
|
+
| Artifact | Location | Purpose |
|
|
79
|
+
|----------|----------|---------|
|
|
80
|
+
| App entrypoint | <!-- e.g. packages/cdk/bin/app.ts --> | Instantiates stacks per environment |
|
|
81
|
+
| Stacks | <!-- e.g. packages/cdk/lib/stacks/ --> | One file per CloudFormation stack |
|
|
82
|
+
| Constructs | <!-- e.g. packages/cdk/lib/constructs/ --> | Reusable infrastructure components |
|
|
83
|
+
| Synth config | <!-- e.g. packages/cdk/cdk.json --> | CDK CLI configuration |
|
|
84
|
+
| Context cache | <!-- e.g. packages/cdk/cdk.context.json --> | Environment lookup results (committed) |
|
|
85
|
+
| Synth output | <!-- e.g. packages/cdk/cdk.out/ --> | Generated CloudFormation (gitignored) |
|
|
86
|
+
|
|
87
|
+
### Terraform
|
|
88
|
+
|
|
89
|
+
<!-- Remove this block if you don't use Terraform -->
|
|
90
|
+
|
|
91
|
+
| Artifact | Location | Purpose |
|
|
92
|
+
|----------|----------|---------|
|
|
93
|
+
| Root module | <!-- e.g. infra/*.tf --> | Top-level resources |
|
|
94
|
+
| Reusable modules | <!-- e.g. infra/modules/ --> | Composable infrastructure blocks |
|
|
95
|
+
| Environment configs | <!-- e.g. infra/environments/ --> | Per-env tfvars (dev, staging, prod) |
|
|
96
|
+
| State backend | <!-- e.g. S3 bucket + DynamoDB lock table --> | Remote state storage |
|
|
97
|
+
|
|
98
|
+
### Pulumi / SAM / Serverless Framework
|
|
99
|
+
|
|
100
|
+
<!--
|
|
101
|
+
Document app program (index.ts), stack config, or manifest location.
|
|
102
|
+
Remove this block if you don't use these tools.
|
|
103
|
+
-->
|
|
104
|
+
|
|
105
|
+
### Deployment Pipeline
|
|
106
|
+
|
|
107
|
+
<!-- How does IaC code reach the cloud? -->
|
|
108
|
+
|
|
109
|
+
- <!-- e.g. PR → CI workflow → terraform plan + manual approval → terraform apply -->
|
|
110
|
+
- <!-- e.g. PR → CodePipeline → cdk deploy → dev/staging/prod -->
|
|
111
|
+
|
|
112
|
+
|
|
61
113
|
## Diagrams
|
|
62
114
|
|
|
63
115
|
<!-- Architecture diagrams using Mermaid, ASCII art, or linked images -->
|