docguard-cli 0.36.2 → 0.37.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.
Files changed (35) hide show
  1. package/README.md +23 -18
  2. package/cli/commands/explain.mjs +28 -0
  3. package/cli/commands/guard.mjs +4 -0
  4. package/cli/commands/llms.mjs +3 -2
  5. package/cli/commands/retire.mjs +352 -0
  6. package/cli/commands/specs.mjs +77 -0
  7. package/cli/commands/trace.mjs +11 -1
  8. package/cli/config.mjs +2 -0
  9. package/cli/docguard.mjs +78 -18
  10. package/cli/findings.mjs +54 -0
  11. package/cli/scanners/document-lifecycle.mjs +184 -0
  12. package/cli/scanners/requirement-evidence.mjs +126 -0
  13. package/cli/scanners/spec-registry.mjs +517 -0
  14. package/cli/shared-requirements.mjs +91 -0
  15. package/cli/validators/document-lifecycle.mjs +51 -0
  16. package/cli/validators/spec-registry.mjs +47 -0
  17. package/cli/validators/traceability.mjs +52 -216
  18. package/docs/ai-integration.md +18 -5
  19. package/docs/commands.md +45 -0
  20. package/docs/quickstart.md +1 -1
  21. package/extensions/spec-kit-docguard/README.md +15 -5
  22. package/extensions/spec-kit-docguard/commands/brief.md +34 -0
  23. package/extensions/spec-kit-docguard/commands/preflight.md +52 -0
  24. package/extensions/spec-kit-docguard/extension.yml +18 -5
  25. package/extensions/spec-kit-docguard/skills/docguard-fix/SKILL.md +2 -2
  26. package/extensions/spec-kit-docguard/skills/docguard-guard/SKILL.md +2 -2
  27. package/extensions/spec-kit-docguard/skills/docguard-review/SKILL.md +2 -2
  28. package/extensions/spec-kit-docguard/skills/docguard-score/SKILL.md +2 -2
  29. package/extensions/spec-kit-docguard/skills/docguard-sync/SKILL.md +2 -2
  30. package/extensions/spec-kit-docguard/templates/extensions.yml +13 -6
  31. package/extensions/spec-kit-docguard/templates/github-workflows/docguard-guard.yml +1 -1
  32. package/package.json +1 -1
  33. package/schemas/docguard-config.schema.json +2 -0
  34. package/schemas/docguard-specs.schema.json +162 -0
  35. package/templates/ci/github-actions.yml +1 -1
@@ -3,8 +3,8 @@ schema_version: "1.0"
3
3
  extension:
4
4
  id: "docguard"
5
5
  name: "DocGuard — CDD Enforcement"
6
- version: "0.36.2"
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."
6
+ version: "0.37.1"
7
+ description: "Canonical-Driven Development enforcement as a true spec-kit extension. LLM-first design with automated validators, 5 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"
10
10
  license: "MIT"
@@ -49,6 +49,14 @@ provides:
49
49
  file: "commands/generate.md"
50
50
  description: "Reverse-engineer canonical docs from existing codebase"
51
51
 
52
+ - name: "speckit.docguard.brief"
53
+ file: "commands/brief.md"
54
+ description: "Brief prior spec intent and lifecycle before creating a new specification"
55
+
56
+ - name: "speckit.docguard.preflight"
57
+ file: "commands/preflight.md"
58
+ description: "Gate a generated specification against registry integrity and prior intent"
59
+
52
60
  # GitHub Actions workflow starters — copyable templates users drop into
53
61
  # .github/workflows/ for guard/fix/sync/score integration.
54
62
  workflows:
@@ -74,15 +82,20 @@ provides:
74
82
  description: "Initialize a new canonical document with metadata header"
75
83
 
76
84
  hooks:
85
+ before_specify:
86
+ command: "speckit.docguard.brief"
87
+ optional: false
88
+ description: "Load current spec intent and block specification on stale lifecycle state"
89
+
77
90
  after_implement:
78
91
  command: "speckit.docguard.guard"
79
92
  optional: false
80
93
  description: "Quality gate — ensures docs stay in sync with code"
81
94
 
82
95
  before_tasks:
83
- command: "speckit.docguard.review"
84
- optional: true
85
- prompt: "Review documentation consistency before generating tasks?"
96
+ command: "speckit.docguard.preflight"
97
+ optional: false
98
+ description: "Gate the generated spec before task generation"
86
99
 
87
100
  after_tasks:
88
101
  command: "speckit.docguard.score"
@@ -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.36.2
9
+ version: 0.37.1
10
10
  source: extensions/spec-kit-docguard/skills/docguard-fix
11
11
  ---
12
- <!-- docguard:version: 0.36.2 -->
12
+ <!-- docguard:version: 0.37.1 -->
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.36.2
10
+ version: 0.37.1
11
11
  source: extensions/spec-kit-docguard/skills/docguard-guard
12
12
  ---
13
- <!-- docguard:version: 0.36.2 -->
13
+ <!-- docguard:version: 0.37.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.36.2
9
+ version: 0.37.1
10
10
  source: extensions/spec-kit-docguard/skills/docguard-review
11
11
  ---
12
- <!-- docguard:version: 0.36.2 -->
12
+ <!-- docguard:version: 0.37.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.36.2
9
+ version: 0.37.1
10
10
  source: extensions/spec-kit-docguard/skills/docguard-score
11
11
  ---
12
- <!-- docguard:version: 0.36.2 -->
12
+ <!-- docguard:version: 0.37.1 -->
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.36.2
7
+ version: 0.37.1
8
8
  source: extensions/spec-kit-docguard/skills/docguard-sync
9
9
  ---
10
- <!-- docguard:version: 0.36.2 -->
10
+ <!-- docguard:version: 0.37.1 -->
11
11
 
12
12
  # DocGuard Sync Skill
13
13
 
@@ -3,13 +3,21 @@
3
3
  # to integrate DocGuard into the spec-kit workflow.
4
4
  #
5
5
  # DocGuard will automatically run as a quality gate after implementation
6
- # and optionally before task generation.
6
+ # and preflight lifecycle state before specification and task generation.
7
7
 
8
8
  schema_version: "1.0"
9
9
 
10
10
  extension: docguard
11
11
 
12
12
  hooks:
13
+ # Brief current and retired spec intent before /speckit.specify starts.
14
+ before_specify:
15
+ - extension: docguard
16
+ command: speckit.docguard.brief
17
+ description: "Load current spec intent and block specification on stale lifecycle state"
18
+ enabled: true
19
+ optional: false
20
+
13
21
  # Run DocGuard guard after /speckit.implement completes
14
22
  # This ensures documentation stays in sync with code changes
15
23
  after_implement:
@@ -19,14 +27,13 @@ hooks:
19
27
  enabled: true
20
28
  optional: false
21
29
 
22
- # Run DocGuard review before /speckit.tasks to catch doc drift early
30
+ # Gate the generated spec before /speckit.tasks creates implementation work.
23
31
  before_tasks:
24
32
  - extension: docguard
25
- command: speckit.docguard.review
26
- description: "Review documentation consistency before generating tasks"
33
+ command: speckit.docguard.preflight
34
+ description: "Gate the generated spec against registry integrity and prior intent"
27
35
  enabled: true
28
- optional: true # Optional — user can skip
29
- prompt: "Run DocGuard review to check documentation health before task generation?"
36
+ optional: false
30
37
 
31
38
  # Run DocGuard guard after /speckit.tasks to validate doc coverage
32
39
  after_tasks:
@@ -35,7 +35,7 @@ jobs:
35
35
  node-version: '20'
36
36
 
37
37
  - name: Install DocGuard
38
- run: npm install --global --ignore-scripts docguard-cli@0.36.2
38
+ run: npm install --global --ignore-scripts docguard-cli@0.37.1
39
39
 
40
40
  - name: Run DocGuard
41
41
  shell: bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docguard-cli",
3
- "version": "0.36.2",
3
+ "version": "0.37.1",
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": {
@@ -105,6 +105,8 @@
105
105
  "todoTracking": { "type": "boolean" },
106
106
  "schemaSync": { "type": "boolean" },
107
107
  "specKit": { "type": "boolean" },
108
+ "documentLifecycle": { "type": "boolean" },
109
+ "specRegistry": { "type": "boolean" },
108
110
  "crossReference": { "type": "boolean" },
109
111
  "generatedStaleness":{ "type": "boolean" },
110
112
  "canonicalSync": { "type": "boolean" },
@@ -0,0 +1,162 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raccioly.github.io/docguard/schemas/docguard-specs.schema.json",
4
+ "title": "DocGuard Spec Lifecycle Registry",
5
+ "description": "Committed lifecycle controls and deterministic evidence for Spec Kit artifacts. Requirement prose remains in the authoritative spec.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["$schema", "schemaVersion", "specs", "tombstones"],
9
+ "properties": {
10
+ "$schema": { "const": "https://raccioly.github.io/docguard/schemas/docguard-specs.schema.json" },
11
+ "schemaVersion": { "const": 1 },
12
+ "specs": {
13
+ "type": "array",
14
+ "items": { "$ref": "#/definitions/spec" }
15
+ },
16
+ "tombstones": {
17
+ "type": "array",
18
+ "items": { "$ref": "#/definitions/tombstone" }
19
+ }
20
+ },
21
+ "definitions": {
22
+ "specId": {
23
+ "type": "string",
24
+ "pattern": "^[a-z0-9][a-z0-9._-]{2,127}$"
25
+ },
26
+ "stringSet": {
27
+ "type": "array",
28
+ "uniqueItems": true,
29
+ "items": { "type": "string", "minLength": 1 }
30
+ },
31
+ "specIdSet": {
32
+ "type": "array",
33
+ "uniqueItems": true,
34
+ "items": { "$ref": "#/definitions/specId" }
35
+ },
36
+ "lifecycle": {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "required": ["approval", "delivery", "context", "retirementReason", "storage", "persistenceModel"],
40
+ "properties": {
41
+ "approval": { "enum": ["draft", "approved", "rejected"] },
42
+ "delivery": { "enum": ["planned", "in_progress", "implemented", "verified", "released"] },
43
+ "context": { "enum": ["current", "retired"] },
44
+ "retirementReason": { "enum": [null, "completed", "superseded", "abandoned"] },
45
+ "storage": { "enum": ["working_tree", "git_history"] },
46
+ "persistenceModel": { "enum": [null, "flow_back", "flow_forward", "living"] }
47
+ }
48
+ },
49
+ "reviewed": {
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["lifecycle", "relations", "scope", "reconciliation"],
53
+ "properties": {
54
+ "lifecycle": { "$ref": "#/definitions/lifecycle" },
55
+ "relations": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["extends", "duplicates", "conflictsWith", "supersedes", "supersededBy"],
59
+ "properties": {
60
+ "extends": { "$ref": "#/definitions/specIdSet" },
61
+ "duplicates": { "$ref": "#/definitions/specIdSet" },
62
+ "conflictsWith": { "$ref": "#/definitions/specIdSet" },
63
+ "supersedes": { "$ref": "#/definitions/specIdSet" },
64
+ "supersededBy": { "$ref": "#/definitions/specIdSet" }
65
+ }
66
+ },
67
+ "scope": {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["canonicalDocs"],
71
+ "properties": {
72
+ "canonicalDocs": { "$ref": "#/definitions/stringSet" }
73
+ }
74
+ },
75
+ "reconciliation": {
76
+ "type": "object",
77
+ "additionalProperties": false,
78
+ "required": ["lastReviewedRevision"],
79
+ "properties": {
80
+ "lastReviewedRevision": {
81
+ "anyOf": [
82
+ { "type": "null" },
83
+ { "type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$" }
84
+ ]
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
90
+ "artifact": {
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "required": ["path", "digest"],
94
+ "properties": {
95
+ "path": { "type": "string", "minLength": 1 },
96
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
97
+ }
98
+ },
99
+ "testEvidence": {
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": ["requirementId", "file", "line"],
103
+ "properties": {
104
+ "requirementId": { "type": "string", "minLength": 1 },
105
+ "file": { "type": "string", "minLength": 1 },
106
+ "line": { "type": "integer", "minimum": 1 }
107
+ }
108
+ },
109
+ "spec": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": ["specId", "path", "reviewed", "intent", "observed"],
113
+ "properties": {
114
+ "specId": { "$ref": "#/definitions/specId" },
115
+ "path": { "type": "string", "minLength": 1 },
116
+ "reviewed": { "$ref": "#/definitions/reviewed" },
117
+ "intent": {
118
+ "type": "object",
119
+ "additionalProperties": false,
120
+ "required": ["requirements"],
121
+ "properties": {
122
+ "requirements": { "$ref": "#/definitions/stringSet" }
123
+ }
124
+ },
125
+ "observed": {
126
+ "type": "object",
127
+ "additionalProperties": false,
128
+ "required": ["artifacts", "taskCompletion", "implementationEvidence", "testEvidence"],
129
+ "properties": {
130
+ "artifacts": { "type": "array", "items": { "$ref": "#/definitions/artifact" } },
131
+ "taskCompletion": {
132
+ "type": "object",
133
+ "additionalProperties": false,
134
+ "required": ["checked", "total"],
135
+ "properties": {
136
+ "checked": { "type": "integer", "minimum": 0 },
137
+ "total": { "type": "integer", "minimum": 0 }
138
+ }
139
+ },
140
+ "implementationEvidence": { "type": "array", "items": { "type": "object" } },
141
+ "testEvidence": { "type": "array", "items": { "$ref": "#/definitions/testEvidence" } }
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "tombstone": {
147
+ "type": "object",
148
+ "additionalProperties": false,
149
+ "required": ["specId", "path", "archivedFrom", "blob", "retentionRef", "objectFormat", "recoverability", "requirements"],
150
+ "properties": {
151
+ "specId": { "anyOf": [{ "type": "null" }, { "$ref": "#/definitions/specId" }] },
152
+ "path": { "type": "string", "minLength": 1 },
153
+ "archivedFrom": { "type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$" },
154
+ "blob": { "type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$" },
155
+ "retentionRef": { "anyOf": [{ "type": "null" }, { "type": "string", "minLength": 1 }] },
156
+ "objectFormat": { "enum": [null, "sha1", "sha256"] },
157
+ "recoverability": { "enum": [null, "verified"] },
158
+ "requirements": { "$ref": "#/definitions/stringSet" }
159
+ }
160
+ }
161
+ }
162
+ }
@@ -31,7 +31,7 @@ jobs:
31
31
  node-version: '20'
32
32
 
33
33
  - name: Install DocGuard
34
- run: npm install --global --ignore-scripts docguard-cli@0.36.2
34
+ run: npm install --global --ignore-scripts docguard-cli@0.37.1
35
35
 
36
36
  - name: Run DocGuard
37
37
  shell: bash