docguard-cli 0.35.0 → 0.36.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 +8 -15
- package/cli/commands/agent.mjs +27 -6
- package/cli/commands/ci.mjs +3 -0
- package/cli/commands/diagnose.mjs +8 -2
- package/cli/commands/feedback.mjs +83 -89
- package/cli/commands/fix.mjs +4 -0
- package/cli/commands/generate.mjs +3 -0
- package/cli/commands/guard.mjs +37 -20
- package/cli/commands/hooks.mjs +61 -40
- package/cli/commands/init.mjs +51 -5
- package/cli/commands/memory.mjs +29 -15
- package/cli/commands/report.mjs +12 -7
- package/cli/commands/score.mjs +39 -19
- package/cli/commands/sync.mjs +2 -0
- package/cli/commands/watch.mjs +113 -70
- package/cli/config.mjs +6 -3
- package/cli/docguard.mjs +12 -4
- package/cli/findings.mjs +13 -13
- package/cli/scanners/memory-plan.mjs +279 -134
- package/cli/scanners/project-type.mjs +6 -1
- package/cli/scanners/semantic-claims.mjs +176 -26
- package/cli/shared-diff.mjs +22 -1
- package/cli/shared-doc-roles.mjs +59 -0
- package/cli/shared-ignore.mjs +15 -2
- package/cli/shared-source.mjs +223 -1
- package/cli/validator-coverage.mjs +20 -0
- package/cli/validators/api-surface.mjs +94 -70
- package/cli/validators/architecture.mjs +19 -5
- package/cli/validators/diff-suspicion.mjs +45 -9
- package/cli/validators/docs-coverage.mjs +6 -5
- package/cli/validators/docs-diff.mjs +51 -7
- package/cli/validators/environment.mjs +3 -2
- package/cli/validators/freshness.mjs +140 -83
- package/cli/validators/schema-sync.mjs +3 -2
- package/cli/validators/security.mjs +58 -23
- package/cli/validators/structure.mjs +3 -1
- package/cli/validators/test-spec.mjs +3 -2
- package/cli/validators/todo-tracking.mjs +61 -28
- package/cli/validators/traceability.mjs +152 -38
- package/docs/configuration.md +41 -0
- package/extensions/spec-kit-docguard/extension.yml +2 -3
- 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 +1 -2
- package/extensions/spec-kit-docguard/templates/github-workflows/docguard-guard.yml +74 -29
- package/package.json +1 -1
- package/schemas/docguard-config.schema.json +43 -1
- package/templates/ci/github-actions.yml +51 -11
|
@@ -1,48 +1,93 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# reports. Pair with `docguard-autofix.yml` if you want mechanical fixes
|
|
5
|
-
# applied automatically.
|
|
6
|
-
#
|
|
7
|
-
# Setup:
|
|
8
|
-
# 1. Copy this file to .github/workflows/docguard-guard.yml
|
|
9
|
-
# 2. (Optional) Set `fail-on-warning: 'true'` to make warnings block the PR.
|
|
1
|
+
# Copy this starter to .github/workflows/. Reports stay in runner temp.
|
|
2
|
+
# The static CLI pin is checked against package.json by ci-reproducibility tests.
|
|
3
|
+
# Warnings are non-blocking; set FAIL_ON_WARNING to true to make them fail.
|
|
10
4
|
name: DocGuard Guard
|
|
11
5
|
|
|
12
6
|
on:
|
|
13
|
-
push:
|
|
14
|
-
branches: [main]
|
|
15
7
|
pull_request:
|
|
16
8
|
branches: [main]
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
17
11
|
|
|
18
12
|
permissions:
|
|
19
13
|
contents: read
|
|
20
|
-
pull-requests: write # only needed for the optional score comment below
|
|
21
14
|
|
|
22
15
|
jobs:
|
|
23
16
|
guard:
|
|
24
17
|
runs-on: ubuntu-latest
|
|
18
|
+
env:
|
|
19
|
+
FAIL_ON_WARNING: 'false'
|
|
25
20
|
steps:
|
|
26
|
-
-
|
|
21
|
+
- name: Initialize report paths
|
|
22
|
+
shell: bash
|
|
23
|
+
run: |
|
|
24
|
+
echo "DOCGUARD_REPORT=$RUNNER_TEMP/docguard-report.json" >> "$GITHUB_ENV"
|
|
25
|
+
echo "DOCGUARD_LOG=$RUNNER_TEMP/docguard-stderr.log" >> "$GITHUB_ENV"
|
|
26
|
+
echo "DOCGUARD_SCORE=$RUNNER_TEMP/docguard-score.json" >> "$GITHUB_ENV"
|
|
27
|
+
|
|
28
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
27
29
|
with:
|
|
28
|
-
fetch-depth: 0
|
|
30
|
+
fetch-depth: 0 # Freshness needs the complete commit history.
|
|
31
|
+
persist-credentials: false
|
|
29
32
|
|
|
30
|
-
-
|
|
31
|
-
uses: raccioly/docguard@v0.25.0
|
|
33
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
32
34
|
with:
|
|
33
|
-
|
|
34
|
-
# Flip to 'true' once your repo is clean — turns warnings into hard failures.
|
|
35
|
-
fail-on-warning: 'false'
|
|
35
|
+
node-version: '20'
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
- name: Install DocGuard
|
|
38
|
+
run: npm install --global --ignore-scripts docguard-cli@0.36.0
|
|
39
|
+
|
|
40
|
+
- name: Run DocGuard
|
|
41
|
+
shell: bash
|
|
42
|
+
run: |
|
|
43
|
+
status=0
|
|
44
|
+
docguard guard --format json > "$DOCGUARD_REPORT" 2> "$DOCGUARD_LOG" || status=$?
|
|
45
|
+
cat "$DOCGUARD_LOG" >&2
|
|
46
|
+
# Validate machine output and normalize the verdict from the actual
|
|
47
|
+
# exit code (including CI threshold failures in older releases).
|
|
48
|
+
DOCGUARD_STATUS="$status" node --input-type=module -e '
|
|
49
|
+
import fs from "node:fs";
|
|
50
|
+
const file = process.env.DOCGUARD_REPORT;
|
|
51
|
+
const report = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
52
|
+
if (!report || typeof report !== "object" || Array.isArray(report)) throw new Error("Invalid DocGuard report");
|
|
53
|
+
const status = Number(process.env.DOCGUARD_STATUS);
|
|
54
|
+
report.status = status === 0 ? "PASS" : status === 2 ? "WARN" : "FAIL";
|
|
55
|
+
fs.writeFileSync(file, JSON.stringify(report, null, 2) + "\n");
|
|
56
|
+
'
|
|
57
|
+
if [ "$status" -eq 2 ] && [ "$FAIL_ON_WARNING" != 'true' ]; then
|
|
58
|
+
echo "::warning::DocGuard found warnings; see the report artifact"
|
|
59
|
+
exit 0
|
|
60
|
+
fi
|
|
61
|
+
exit "$status"
|
|
62
|
+
|
|
63
|
+
# Optional PR score stays read-only and travels with the findings artifact.
|
|
64
|
+
- name: Capture PR score
|
|
65
|
+
if: always() && github.event_name == 'pull_request'
|
|
66
|
+
run: docguard score --format json > "$DOCGUARD_SCORE"
|
|
67
|
+
|
|
68
|
+
- name: Display Results
|
|
69
|
+
if: always()
|
|
70
|
+
shell: bash
|
|
71
|
+
run: |
|
|
72
|
+
echo "## DocGuard Report" >> "$GITHUB_STEP_SUMMARY"
|
|
73
|
+
if [ -s "$DOCGUARD_REPORT" ]; then
|
|
74
|
+
echo '<details><summary>JSON findings</summary>' >> "$GITHUB_STEP_SUMMARY"
|
|
75
|
+
echo '' >> "$GITHUB_STEP_SUMMARY"
|
|
76
|
+
echo '````json' >> "$GITHUB_STEP_SUMMARY"
|
|
77
|
+
cat "$DOCGUARD_REPORT" >> "$GITHUB_STEP_SUMMARY"
|
|
78
|
+
echo '````' >> "$GITHUB_STEP_SUMMARY"
|
|
79
|
+
echo '</details>' >> "$GITHUB_STEP_SUMMARY"
|
|
80
|
+
else
|
|
81
|
+
echo 'No report produced; inspect the install/run logs.' >> "$GITHUB_STEP_SUMMARY"
|
|
82
|
+
fi
|
|
43
83
|
|
|
44
|
-
- name:
|
|
45
|
-
|
|
84
|
+
- name: Upload Report
|
|
85
|
+
if: always()
|
|
86
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
46
87
|
with:
|
|
47
|
-
|
|
48
|
-
|
|
88
|
+
name: docguard-report
|
|
89
|
+
path: |
|
|
90
|
+
${{ env.DOCGUARD_REPORT }}
|
|
91
|
+
${{ env.DOCGUARD_LOG }}
|
|
92
|
+
${{ env.DOCGUARD_SCORE }}
|
|
93
|
+
if-no-files-found: warn
|
package/package.json
CHANGED
|
@@ -185,10 +185,52 @@
|
|
|
185
185
|
"type": "object",
|
|
186
186
|
"description": "Documentation discovery (field report #6 follow-up).",
|
|
187
187
|
"properties": {
|
|
188
|
+
"roles": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"description": "Explicit canonical document roles in an existing layout. Each mapping is required and remains subject to content checks; maps do not certify prose or change historical intent.",
|
|
191
|
+
"properties": {
|
|
192
|
+
"architecture": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"minLength": 1,
|
|
195
|
+
"pattern": "\\.[mM][dD]$"
|
|
196
|
+
},
|
|
197
|
+
"dataModel": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"minLength": 1,
|
|
200
|
+
"pattern": "\\.[mM][dD]$"
|
|
201
|
+
},
|
|
202
|
+
"security": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"minLength": 1,
|
|
205
|
+
"pattern": "\\.[mM][dD]$"
|
|
206
|
+
},
|
|
207
|
+
"testSpec": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"minLength": 1,
|
|
210
|
+
"pattern": "\\.[mM][dD]$"
|
|
211
|
+
},
|
|
212
|
+
"environment": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"minLength": 1,
|
|
215
|
+
"pattern": "\\.[mM][dD]$"
|
|
216
|
+
},
|
|
217
|
+
"apiReference": {
|
|
218
|
+
"type": "string",
|
|
219
|
+
"minLength": 1,
|
|
220
|
+
"pattern": "\\.[mM][dD]$"
|
|
221
|
+
},
|
|
222
|
+
"requirements": {
|
|
223
|
+
"type": "string",
|
|
224
|
+
"minLength": 1,
|
|
225
|
+
"pattern": "\\.[mM][dD]$"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"additionalProperties": false
|
|
229
|
+
},
|
|
188
230
|
"dirs": {
|
|
189
231
|
"type": "array",
|
|
190
232
|
"items": { "type": "string" },
|
|
191
|
-
"description": "Additional documentation
|
|
233
|
+
"description": "Additional documentation inventory directories, extending conventional homes. Explicit directories also participate in freshness review. Inventory membership does not imply every detector scans every document; semantic extraction has its own declared scope. Use docs.roles to map existing Markdown documents to canonical roles, and .docguardignore to exclude paths."
|
|
192
234
|
}
|
|
193
235
|
},
|
|
194
236
|
"additionalProperties": true
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# Copy this starter to .github/workflows/. Reports stay in runner temp.
|
|
2
|
+
# The static CLI pin is checked against package.json by ci-reproducibility tests.
|
|
1
3
|
name: DocGuard CDD Check
|
|
2
4
|
|
|
3
5
|
on:
|
|
@@ -11,29 +13,67 @@ permissions:
|
|
|
11
13
|
|
|
12
14
|
jobs:
|
|
13
15
|
docguard:
|
|
14
|
-
name: CDD Compliance
|
|
15
16
|
runs-on: ubuntu-latest
|
|
16
17
|
steps:
|
|
17
|
-
-
|
|
18
|
+
- name: Initialize report paths
|
|
19
|
+
shell: bash
|
|
20
|
+
run: |
|
|
21
|
+
echo "DOCGUARD_REPORT=$RUNNER_TEMP/docguard-report.json" >> "$GITHUB_ENV"
|
|
22
|
+
echo "DOCGUARD_LOG=$RUNNER_TEMP/docguard-stderr.log" >> "$GITHUB_ENV"
|
|
23
|
+
|
|
24
|
+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0 # Freshness needs the complete commit history.
|
|
27
|
+
persist-credentials: false
|
|
18
28
|
|
|
19
|
-
- uses: actions/setup-node@v4
|
|
29
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
20
30
|
with:
|
|
21
31
|
node-version: '20'
|
|
22
32
|
|
|
23
|
-
- name:
|
|
24
|
-
run:
|
|
33
|
+
- name: Install DocGuard
|
|
34
|
+
run: npm install --global --ignore-scripts docguard-cli@0.36.0
|
|
35
|
+
|
|
36
|
+
- name: Run DocGuard
|
|
37
|
+
shell: bash
|
|
38
|
+
run: |
|
|
39
|
+
status=0
|
|
40
|
+
docguard ci --format json --threshold 70 --no-history > "$DOCGUARD_REPORT" 2> "$DOCGUARD_LOG" || status=$?
|
|
41
|
+
cat "$DOCGUARD_LOG" >&2
|
|
42
|
+
# Validate machine output and normalize the verdict from the actual
|
|
43
|
+
# exit code (including CI threshold failures in older releases).
|
|
44
|
+
DOCGUARD_STATUS="$status" node --input-type=module -e '
|
|
45
|
+
import fs from "node:fs";
|
|
46
|
+
const file = process.env.DOCGUARD_REPORT;
|
|
47
|
+
const report = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
48
|
+
if (!report || typeof report !== "object" || Array.isArray(report)) throw new Error("Invalid DocGuard report");
|
|
49
|
+
const status = Number(process.env.DOCGUARD_STATUS);
|
|
50
|
+
report.status = status === 0 ? "PASS" : status === 2 ? "WARN" : "FAIL";
|
|
51
|
+
fs.writeFileSync(file, JSON.stringify(report, null, 2) + "\n");
|
|
52
|
+
'
|
|
53
|
+
exit "$status"
|
|
25
54
|
|
|
26
55
|
- name: Display Results
|
|
27
56
|
if: always()
|
|
57
|
+
shell: bash
|
|
28
58
|
run: |
|
|
29
|
-
echo "## DocGuard Report" >> $GITHUB_STEP_SUMMARY
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
echo "## DocGuard Report" >> "$GITHUB_STEP_SUMMARY"
|
|
60
|
+
if [ -s "$DOCGUARD_REPORT" ]; then
|
|
61
|
+
echo '<details><summary>JSON findings</summary>' >> "$GITHUB_STEP_SUMMARY"
|
|
62
|
+
echo '' >> "$GITHUB_STEP_SUMMARY"
|
|
63
|
+
echo '````json' >> "$GITHUB_STEP_SUMMARY"
|
|
64
|
+
cat "$DOCGUARD_REPORT" >> "$GITHUB_STEP_SUMMARY"
|
|
65
|
+
echo '````' >> "$GITHUB_STEP_SUMMARY"
|
|
66
|
+
echo '</details>' >> "$GITHUB_STEP_SUMMARY"
|
|
67
|
+
else
|
|
68
|
+
echo 'No report produced; inspect the install/run logs.' >> "$GITHUB_STEP_SUMMARY"
|
|
69
|
+
fi
|
|
33
70
|
|
|
34
71
|
- name: Upload Report
|
|
35
72
|
if: always()
|
|
36
|
-
uses: actions/upload-artifact@v4
|
|
73
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
37
74
|
with:
|
|
38
75
|
name: docguard-report
|
|
39
|
-
path:
|
|
76
|
+
path: |
|
|
77
|
+
${{ env.DOCGUARD_REPORT }}
|
|
78
|
+
${{ env.DOCGUARD_LOG }}
|
|
79
|
+
if-no-files-found: warn
|