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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# /docguard.init — Set up CDD documentation for this project
|
|
2
|
+
|
|
3
|
+
You are an AI agent initializing Canonical-Driven Development (CDD) for a new or existing project using DocGuard.
|
|
4
|
+
|
|
5
|
+
## Step 1: Initialize Skeleton Files
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx docguard init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This creates the folder structure and template files. But the templates are EMPTY — they need real content.
|
|
12
|
+
|
|
13
|
+
## Step 2: Detect and Configure Project Type
|
|
14
|
+
|
|
15
|
+
Create `.docguard.json` based on what you find:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cat package.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Determine:
|
|
22
|
+
- `projectType`: "cli" (has `bin` field), "webapp" (has react/next/vue), "api" (has express/fastify), or "library" (default)
|
|
23
|
+
- `needsE2E`: true for webapps, false for CLIs/libraries
|
|
24
|
+
- `needsEnvVars`: true for APIs/webapps with env config, false for CLIs
|
|
25
|
+
- `needsDatabase`: true if database dependencies found
|
|
26
|
+
|
|
27
|
+
Write `.docguard.json` with these settings.
|
|
28
|
+
|
|
29
|
+
## Step 3: Write Real Documentation
|
|
30
|
+
|
|
31
|
+
For each canonical document, generate an AI prompt and write real content:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx docguard fix --doc architecture
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Read the output, execute the RESEARCH STEPS, then write the ARCHITECTURE.md with real project content.
|
|
38
|
+
|
|
39
|
+
Repeat for each document:
|
|
40
|
+
```bash
|
|
41
|
+
npx docguard fix --doc data-model
|
|
42
|
+
npx docguard fix --doc security
|
|
43
|
+
npx docguard fix --doc test-spec
|
|
44
|
+
npx docguard fix --doc environment
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Step 4: Verify Everything
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx docguard guard
|
|
51
|
+
npx docguard score
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
All checks should pass. Report the final score.
|
|
55
|
+
|
|
56
|
+
## Step 5: Set Up Git Hooks (Optional)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx docguard hooks
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This installs pre-commit (guard), pre-push (score), and commit-msg (conventional commits) hooks.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# /docguard.review — Review documentation vs code for drift
|
|
2
|
+
|
|
3
|
+
You are an AI agent reviewing documentation quality and detecting drift between docs and code.
|
|
4
|
+
|
|
5
|
+
## Step 1: Run Diff
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx docguard diff
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Read the output carefully. It shows where documentation no longer matches the codebase.
|
|
12
|
+
|
|
13
|
+
## Step 2: Run Guard
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx docguard guard
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Note any failed validators — these indicate docs that need updating.
|
|
20
|
+
|
|
21
|
+
## Step 3: Check Freshness
|
|
22
|
+
|
|
23
|
+
For each file listed in the guard output with a freshness warning:
|
|
24
|
+
1. Read the document
|
|
25
|
+
2. Read the related source code
|
|
26
|
+
3. Compare: does the doc accurately describe the current code?
|
|
27
|
+
4. If not, update the doc to match reality
|
|
28
|
+
|
|
29
|
+
## Step 4: Update Stale Docs
|
|
30
|
+
|
|
31
|
+
For each stale or drifted document:
|
|
32
|
+
1. Read the relevant source code files
|
|
33
|
+
2. Update the document to match current implementation
|
|
34
|
+
3. Update the `docguard:last-reviewed` date to today
|
|
35
|
+
4. If the change is intentional drift, add an entry to DRIFT-LOG.md
|
|
36
|
+
|
|
37
|
+
## Step 5: Verify
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx docguard guard
|
|
41
|
+
npx docguard score
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Report the final results to the user.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# /docguard.update — Update canonical docs after code changes
|
|
2
|
+
|
|
3
|
+
You are an AI agent that updates documentation to reflect recent code changes.
|
|
4
|
+
|
|
5
|
+
## Step 1: Identify What Changed
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git log --oneline -10
|
|
9
|
+
git diff HEAD~5 --stat
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Read the recent commits. Understand what code changed and why.
|
|
13
|
+
|
|
14
|
+
## Step 2: Check Which Docs Are Affected
|
|
15
|
+
|
|
16
|
+
For each changed file, determine which canonical doc it affects:
|
|
17
|
+
|
|
18
|
+
| Code Change | Update This Doc |
|
|
19
|
+
|-------------|----------------|
|
|
20
|
+
| New API endpoint or route | ARCHITECTURE.md (component map) |
|
|
21
|
+
| Database schema change | DATA-MODEL.md (entities, fields) |
|
|
22
|
+
| New env variable | ENVIRONMENT.md (env var table) |
|
|
23
|
+
| Auth or permission change | SECURITY.md (auth/RBAC section) |
|
|
24
|
+
| New test or test config | TEST-SPEC.md (test categories) |
|
|
25
|
+
| New dependency added | ARCHITECTURE.md (tech stack) |
|
|
26
|
+
| Major refactoring | ARCHITECTURE.md (layer boundaries, data flow) |
|
|
27
|
+
|
|
28
|
+
## Step 3: Update Each Affected Doc
|
|
29
|
+
|
|
30
|
+
For each affected document:
|
|
31
|
+
1. Read the current document
|
|
32
|
+
2. Read the relevant source code changes
|
|
33
|
+
3. Update the specific section that changed
|
|
34
|
+
4. Update the `docguard:last-reviewed` date to today
|
|
35
|
+
5. Add entry to CHANGELOG.md under [Unreleased]
|
|
36
|
+
|
|
37
|
+
## Step 4: Verify
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx docguard guard
|
|
41
|
+
npx docguard score
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
All checks should pass. Report the changes made.
|