@metasession.co/devaudit-cli 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metasession.co/devaudit-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "DevAudit CLI — installs, syncs, and operates the Metasession SDLC across consumer projects.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@clack/prompts": "^0.8.2",
36
- "@metasession.co/devaudit-plugin-sdk": "^0.1.3",
36
+ "@metasession.co/devaudit-plugin-sdk": "^0.1.4",
37
37
  "commander": "^12.1.0",
38
38
  "consola": "^3.2.3",
39
39
  "env-paths": "^3.0.0",
@@ -19,14 +19,25 @@ echo "=== Compliance Artifact Validation ==="
19
19
  echo "Comparing: $BASE_BRANCH...HEAD"
20
20
  echo ""
21
21
 
22
- # Extract REQ-XXX references from commits in this PR.
22
+ # Extract the requirement(s) THIS PR implements — from the commit subject
23
+ # tag `[REQ-XXX]` and the `Ref: REQ-XXX` trailer only, NOT from arbitrary
24
+ # prose in commit bodies. A mention like "target close: REQ-002" or
25
+ # "prereq for REQ-034" is a forward-reference, not a requirement under
26
+ # change; scraping the whole body (%B) made CI demand evidence dirs for
27
+ # work that hasn't started (DevAudit: META-JOBS tracker, REQ-002 false
28
+ # positive). The RTM-row guard below is a secondary safety net.
23
29
  #
24
- # Requires ≥3 digits so placeholder patterns like `REQ-0XX` (used in
25
- # commit-body templates referring to a batch of sub-REQs) don't create
26
- # phantom IDs that block CI — the loose `\d+` would match `REQ-0` from
27
- # `REQ-0XX` and then ERROR on a missing evidence dir for the phantom
28
- # `REQ-0`. The project's stable id format is REQ-001 onwards (#232).
29
- REQUIREMENTS=$(git log "$BASE_BRANCH"..HEAD --format='%B' | grep -oP 'REQ-\d{3,}' | sort -u || true)
30
+ # Requires ≥3 digits so placeholder patterns like `REQ-0XX` don't create
31
+ # phantom IDs. The project's stable id format is REQ-001 onwards (#232).
32
+ PR_MSGS=$(git log "$BASE_BRANCH"..HEAD --format='%B' || true)
33
+ REQUIREMENTS=$(
34
+ {
35
+ # Subject/anywhere tag, e.g. `feat: [REQ-001] …`
36
+ printf '%s\n' "$PR_MSGS" | grep -oP '\[\KREQ-\d{3,}(?=\])' || true
37
+ # `Ref:` line (may list several, e.g. `Ref: REQ-001, REQ-003`)
38
+ printf '%s\n' "$PR_MSGS" | grep -iP '^\s*Ref:' | grep -oP 'REQ-\d{3,}' || true
39
+ } | sort -u
40
+ )
30
41
 
31
42
  if [ -z "$REQUIREMENTS" ]; then
32
43
  echo "No REQ-XXX references found in PR commits — skipping artifact validation."
@@ -195,6 +195,33 @@ assert_grep "no missing-test ERROR" 'ERROR: Test file referenced in test-plan.md
195
195
  assert_exit "validator exits 0 with depth-2 bare-filename reference" 0
196
196
  cd "$WORKDIR"
197
197
 
198
+ # --- case 6: a future REQ mentioned only in commit prose is ignored ---
199
+ # Regression for the META-JOBS REQ-002 false positive: scraping the whole
200
+ # commit body pulled in `REQ-002` from "target close: REQ-002" and then
201
+ # ERRORed on its missing evidence dir even though REQ-002 hadn't started.
202
+ # Only `[REQ-XXX]` subject tags and `Ref:` lines count as under-change.
203
+ echo "Case 6: future REQ mentioned only in prose is not validated"
204
+ make_fixture "$WORKDIR/case6" "Implements the access-control boundary.
205
+
206
+ Dependency advisories accepted under R-001; target close: REQ-002.
207
+
208
+ Ref: REQ-001"
209
+ # REQ-002 HAS an RTM row (the trap) but no evidence dir; REQ-001 is the real
210
+ # Ref but has no RTM row, so it INFO-skips. Old code would ERROR on REQ-002.
211
+ {
212
+ echo '# RTM'
213
+ echo
214
+ echo '| ID | Description | Status |'
215
+ echo '| --- | --- | --- |'
216
+ echo '| REQ-002 | Dependency hardening (not started) | PLANNED |'
217
+ } > compliance/RTM.md
218
+ git add . && git commit -q -m "chore: seed RTM with future REQ-002 row"
219
+ run_validator
220
+ assert_grep "REQ-002 not pulled in from prose" 'Requirements found in PR commits:.*REQ-002' 0
221
+ assert_grep "no evidence-dir ERROR for prose-only REQ-002" 'ERROR: Evidence directory missing.*REQ-002' 0
222
+ assert_exit "validator exits 0 when future REQ is only prose-mentioned" 0
223
+ cd "$WORKDIR"
224
+
198
225
  # --- summary ---
199
226
 
200
227
  echo