docguard-cli 0.37.0 → 0.38.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.md +6 -4
- package/cli/commands/reconcile.mjs +42 -0
- package/cli/commands/retire.mjs +11 -15
- package/cli/commands/specs.mjs +179 -3
- package/cli/commands/sync.mjs +16 -44
- package/cli/docguard.mjs +46 -9
- package/cli/scanners/document-lifecycle.mjs +19 -43
- package/cli/scanners/lifecycle-context.mjs +50 -0
- package/cli/scanners/reconciliation.mjs +141 -0
- package/cli/scanners/requirement-evidence.mjs +41 -8
- package/cli/scanners/retirement-manifest.mjs +52 -0
- package/cli/scanners/spec-registry.mjs +36 -9
- package/cli/shared-sync-scope.mjs +35 -0
- package/cli/validators/traceability.mjs +2 -1
- package/cli/writers/file-transaction.mjs +85 -0
- package/cli/writers/spec-outcomes.mjs +27 -0
- package/extensions/spec-kit-docguard/README.md +6 -2
- package/extensions/spec-kit-docguard/commands/complete.md +38 -0
- package/extensions/spec-kit-docguard/extension.yml +20 -4
- 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/extensions/spec-kit-docguard/templates/extensions.yml +16 -0
- package/extensions/spec-kit-docguard/templates/github-workflows/docguard-guard.yml +1 -1
- package/package.json +1 -1
- package/schemas/docguard-specs.schema.json +19 -2
- package/templates/ci/github-actions.yml +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append a bounded, machine-owned outcome index without rewriting spec intent.
|
|
3
|
+
* @implements docguard.document-lifecycle#FR-016
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const START = '<!-- docguard:implementation-outcomes:start -->';
|
|
7
|
+
const END = '<!-- docguard:implementation-outcomes:end -->';
|
|
8
|
+
|
|
9
|
+
function clean(value, max = 500) {
|
|
10
|
+
return String(value || '').replace(/\s+/g, ' ').replace(/[<>`]/g, '').trim().slice(0, max);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function appendImplementationOutcome(content, outcome) {
|
|
14
|
+
const reason = clean(outcome.reason);
|
|
15
|
+
if (!reason) throw new Error('Implementation outcome requires a non-empty reviewed reason.');
|
|
16
|
+
const evidence = [...new Set(outcome.evidence || [])].sort().map(path => `\`${path}\``).join(', ') || 'none';
|
|
17
|
+
const deviations = [...new Set(outcome.deviations || [])].sort().map(item => clean(item)).filter(Boolean).join('; ') || 'none';
|
|
18
|
+
const successor = outcome.successor ? `\`${outcome.successor}\`` : 'none';
|
|
19
|
+
const line = `- \`${outcome.revision}\` — ${reason} Evidence: ${evidence}. Accepted deviations: ${deviations}. Successor: ${successor}.`;
|
|
20
|
+
const block = `${START}\n## Implementation Outcomes\n\n${line}\n${END}`;
|
|
21
|
+
const pattern = new RegExp(`${START.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?${END.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`);
|
|
22
|
+
if (!pattern.test(content)) return `${content.trimEnd()}\n\n${block}\n`;
|
|
23
|
+
const prior = content.match(pattern)?.[0]
|
|
24
|
+
.split('\n').filter(item => item.startsWith('- `')) || [];
|
|
25
|
+
const lines = [...prior.filter(item => !item.startsWith(`- \`${outcome.revision}\``)), line].slice(-20);
|
|
26
|
+
return content.replace(pattern, `${START}\n## Implementation Outcomes\n\n${lines.join('\n')}\n${END}`);
|
|
27
|
+
}
|
|
@@ -53,6 +53,7 @@ docguard score
|
|
|
53
53
|
| `speckit.docguard.generate` | — | Reverse-engineer canonical docs from codebase |
|
|
54
54
|
| `speckit.docguard.brief` | — | Load current spec intent before specification |
|
|
55
55
|
| `speckit.docguard.preflight` | — | Gate the generated spec before task generation |
|
|
56
|
+
| `speckit.docguard.complete` | — | Plan reviewed completion and regenerate active context after verification |
|
|
56
57
|
|
|
57
58
|
## AI Skills
|
|
58
59
|
|
|
@@ -78,8 +79,11 @@ DocGuard integrates into the spec-kit workflow through hooks:
|
|
|
78
79
|
hooks:
|
|
79
80
|
before_specify: # Mandatory — read current spec intent first
|
|
80
81
|
command: speckit.docguard.brief
|
|
81
|
-
after_implement: #
|
|
82
|
-
command: speckit.docguard.guard
|
|
82
|
+
after_implement: # Guard is mandatory; completion review is optional
|
|
83
|
+
- command: speckit.docguard.guard
|
|
84
|
+
- command: speckit.docguard.complete
|
|
85
|
+
after_converge: # Optional completion review after convergence
|
|
86
|
+
command: speckit.docguard.complete
|
|
83
87
|
before_tasks: # Mandatory — gate the generated spec
|
|
84
88
|
command: speckit.docguard.preflight
|
|
85
89
|
after_tasks: # Optional — show score after tasks
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Review implementation evidence and plan the spec completion transaction"
|
|
3
|
+
allowed-tools: Bash, Read
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DocGuard Spec Completion Review
|
|
7
|
+
|
|
8
|
+
Run after implementation or convergence. This hook plans the lifecycle gate; it
|
|
9
|
+
does not mark the feature verified without a reviewed rationale.
|
|
10
|
+
|
|
11
|
+
1. Resolve the current feature `spec.md` and read its `Spec ID` metadata.
|
|
12
|
+
2. Run `docguard guard --format json`. Stop on errors.
|
|
13
|
+
3. Refresh deterministic evidence with `docguard specs --write`, then review and
|
|
14
|
+
commit that projection with the implementation.
|
|
15
|
+
4. Select the Git baseline that covers the implementation changes. Prefer the
|
|
16
|
+
registry's prior reconciliation revision; otherwise use the feature branch's
|
|
17
|
+
merge base with its configured default branch.
|
|
18
|
+
5. Run:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
docguard specs complete --id <spec-id> --since <ref> --check --format json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
6. Review every reconciliation classification. Unsupported or ambiguous changes
|
|
25
|
+
block completion. A possible implementation regression requires deciding
|
|
26
|
+
whether to fix code, amend approved intent, or record an accepted deviation.
|
|
27
|
+
7. When the evidence is complete, present the exact reviewed write command to
|
|
28
|
+
the maintainer. Apply it only when the maintainer supplies the rationale:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
docguard specs complete --id <spec-id> --since <ref> --write --reason "<reviewed outcome>"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The write records the outcome, advances delivery through `implemented` to
|
|
35
|
+
`verified`, and regenerates `.docguard/current-context.json` as one staged,
|
|
36
|
+
post-validated set. In-process write or validation failures roll the set back;
|
|
37
|
+
the command does not claim a durable journal across power loss or forced
|
|
38
|
+
termination.
|
|
@@ -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.38.0"
|
|
7
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"
|
|
@@ -57,6 +57,10 @@ provides:
|
|
|
57
57
|
file: "commands/preflight.md"
|
|
58
58
|
description: "Gate a generated specification against registry integrity and prior intent"
|
|
59
59
|
|
|
60
|
+
- name: "speckit.docguard.complete"
|
|
61
|
+
file: "commands/complete.md"
|
|
62
|
+
description: "Plan the reviewed implemented-to-verified lifecycle transaction"
|
|
63
|
+
|
|
60
64
|
# GitHub Actions workflow starters — copyable templates users drop into
|
|
61
65
|
# .github/workflows/ for guard/fix/sync/score integration.
|
|
62
66
|
workflows:
|
|
@@ -88,9 +92,21 @@ hooks:
|
|
|
88
92
|
description: "Load current spec intent and block specification on stale lifecycle state"
|
|
89
93
|
|
|
90
94
|
after_implement:
|
|
91
|
-
command: "speckit.docguard.guard"
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
- command: "speckit.docguard.guard"
|
|
96
|
+
optional: false
|
|
97
|
+
priority: 5
|
|
98
|
+
description: "Quality gate — ensures docs stay in sync with code"
|
|
99
|
+
- command: "speckit.docguard.complete"
|
|
100
|
+
optional: true
|
|
101
|
+
priority: 10
|
|
102
|
+
prompt: "Review evidence and plan this spec's completion transaction?"
|
|
103
|
+
description: "Plan lifecycle verification after implementation"
|
|
104
|
+
|
|
105
|
+
after_converge:
|
|
106
|
+
command: "speckit.docguard.complete"
|
|
107
|
+
optional: true
|
|
108
|
+
prompt: "Review evidence and plan this converged spec's completion transaction?"
|
|
109
|
+
description: "Plan lifecycle verification after convergence"
|
|
94
110
|
|
|
95
111
|
before_tasks:
|
|
96
112
|
command: "speckit.docguard.preflight"
|
|
@@ -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.38.0
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-fix
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.38.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.38.0
|
|
11
11
|
source: extensions/spec-kit-docguard/skills/docguard-guard
|
|
12
12
|
---
|
|
13
|
-
<!-- docguard:version: 0.
|
|
13
|
+
<!-- docguard:version: 0.38.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.38.0
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-review
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.38.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.38.0
|
|
10
10
|
source: extensions/spec-kit-docguard/skills/docguard-score
|
|
11
11
|
---
|
|
12
|
-
<!-- docguard:version: 0.
|
|
12
|
+
<!-- docguard:version: 0.38.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.38.0
|
|
8
8
|
source: extensions/spec-kit-docguard/skills/docguard-sync
|
|
9
9
|
---
|
|
10
|
-
<!-- docguard:version: 0.
|
|
10
|
+
<!-- docguard:version: 0.38.0 -->
|
|
11
11
|
|
|
12
12
|
# DocGuard Sync Skill
|
|
13
13
|
|
|
@@ -26,6 +26,22 @@ hooks:
|
|
|
26
26
|
description: "Validate documentation passes CDD standards after implementation"
|
|
27
27
|
enabled: true
|
|
28
28
|
optional: false
|
|
29
|
+
priority: 5
|
|
30
|
+
- extension: docguard
|
|
31
|
+
command: speckit.docguard.complete
|
|
32
|
+
description: "Plan reviewed lifecycle verification after implementation"
|
|
33
|
+
enabled: true
|
|
34
|
+
optional: true
|
|
35
|
+
priority: 10
|
|
36
|
+
prompt: "Review evidence and plan this spec's completion transaction?"
|
|
37
|
+
|
|
38
|
+
after_converge:
|
|
39
|
+
- extension: docguard
|
|
40
|
+
command: speckit.docguard.complete
|
|
41
|
+
description: "Plan reviewed lifecycle verification after convergence"
|
|
42
|
+
enabled: true
|
|
43
|
+
optional: true
|
|
44
|
+
prompt: "Review evidence and plan this converged spec's completion transaction?"
|
|
29
45
|
|
|
30
46
|
# Gate the generated spec before /speckit.tasks creates implementation work.
|
|
31
47
|
before_tasks:
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"required": ["$schema", "schemaVersion", "specs", "tombstones"],
|
|
9
9
|
"properties": {
|
|
10
10
|
"$schema": { "const": "https://raccioly.github.io/docguard/schemas/docguard-specs.schema.json" },
|
|
11
|
-
"schemaVersion": { "const":
|
|
11
|
+
"schemaVersion": { "const": 2 },
|
|
12
12
|
"specs": {
|
|
13
13
|
"type": "array",
|
|
14
14
|
"items": { "$ref": "#/definitions/spec" }
|
|
@@ -75,13 +75,18 @@
|
|
|
75
75
|
"reconciliation": {
|
|
76
76
|
"type": "object",
|
|
77
77
|
"additionalProperties": false,
|
|
78
|
-
"required": ["lastReviewedRevision"],
|
|
78
|
+
"required": ["lastReviewedRevision", "outcomes"],
|
|
79
79
|
"properties": {
|
|
80
80
|
"lastReviewedRevision": {
|
|
81
81
|
"anyOf": [
|
|
82
82
|
{ "type": "null" },
|
|
83
83
|
{ "type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$" }
|
|
84
84
|
]
|
|
85
|
+
},
|
|
86
|
+
"outcomes": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"maxItems": 20,
|
|
89
|
+
"items": { "$ref": "#/definitions/outcome" }
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
}
|
|
@@ -96,6 +101,18 @@
|
|
|
96
101
|
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
|
|
97
102
|
}
|
|
98
103
|
},
|
|
104
|
+
"outcome": {
|
|
105
|
+
"type": "object",
|
|
106
|
+
"additionalProperties": false,
|
|
107
|
+
"required": ["revision", "reason", "evidence", "deviations", "successor"],
|
|
108
|
+
"properties": {
|
|
109
|
+
"revision": { "type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$" },
|
|
110
|
+
"reason": { "type": "string", "minLength": 1, "maxLength": 500 },
|
|
111
|
+
"evidence": { "type": "array", "maxItems": 100, "items": { "type": "string", "minLength": 1 } },
|
|
112
|
+
"deviations": { "type": "array", "maxItems": 20, "items": { "type": "string", "minLength": 1, "maxLength": 500 } },
|
|
113
|
+
"successor": { "anyOf": [{ "type": "null" }, { "$ref": "#/definitions/specId" }] }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
99
116
|
"testEvidence": {
|
|
100
117
|
"type": "object",
|
|
101
118
|
"additionalProperties": false,
|