@metasession.co/devaudit-cli 0.1.40 → 0.1.42

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.
@@ -160,9 +160,10 @@ Reached only on the **tracked** route from Phase 0 (the issue is already fetched
160
160
  For HIGH/CRITICAL also include: threat model (against STRIDE categories applicable to the touched surfaces), four-eyes attestation slot, rollback plan — the template has slots for all of these.
161
161
 
162
162
  **Don't delete sections** — mark with `N/A — <reason>` if a clause genuinely doesn't apply (e.g. UI-only change with no personal-data scope). Empty stubs commit-then-upload as placeholder evidence and break the audit trail.
163
- 6. **Update `compliance/RTM.md`** with the new entry: REQ-XXX, title, risk class, linked issue, linked test cases (placeholder).
164
- 7. **Post plan summary as an issue comment.** Format: TL;DR; Risk class + signals; Acceptance criteria; Technical approach (one paragraph); Dependencies; Test scope.
165
- 8. **Checkpoint** pause for human approval **iff** risk class is HIGH or CRITICAL. LOW and MEDIUM pass through to Phase 2 automatically. The checkpoint can be forced on for all classes via the `--require-plan-approval` flag (or `DEVAUDIT_REQUIRE_PLAN_APPROVAL=1` env var) for orgs that want it always-on.
163
+ 6. **Invoke `requirements-aligner` to populate the SRS-ID column on the AC table.** The plan's "Acceptance criteria" table carries an SRS-ID column per AC; `requirements-aligner` fuzzy-matches each AC against `docs/SRS.md` and proposes new `REQ-AREA-NNN` stubs, flags stale items, or annotates `@srs-deferred`. Don't author the SRS-ID column inline — call via the standard Claude Code Skill mechanism (`Skill(name: "requirements-aligner", …)`). Block plan APPROVAL until every AC has a resolved SRS-ID per the skill's Phase 1 contract (configurable via `sdlc-config.json:requirements_aligner.block_on_stage_1`; ramp-up mode default-on for legacy projects).
164
+ 7. **Update `compliance/RTM.md`** with the new entry: REQ-XXX, title, risk class, linked issue, linked test cases (placeholder).
165
+ 8. **Post plan summary as an issue comment.** Format: TL;DR; Risk class + signals; Acceptance criteria (with SRS-IDs); Technical approach (one paragraph); Dependencies; Test scope.
166
+ 9. **Checkpoint** — pause for human approval **iff** risk class is HIGH or CRITICAL. LOW and MEDIUM pass through to Phase 2 automatically. The checkpoint can be forced on for all classes via the `--require-plan-approval` flag (or `DEVAUDIT_REQUIRE_PLAN_APPROVAL=1` env var) for orgs that want it always-on.
166
167
 
167
168
  ### Phase 2 — Implement and test (SDLC stage 2)
168
169
 
@@ -193,12 +194,14 @@ Reached only on the **tracked** route from Phase 0 (the issue is already fetched
193
194
 
194
195
  ### Phase 3 — Compile evidence (SDLC stage 3)
195
196
 
196
- 1. **Re-run the full test pack** with artefact capture:
197
+ 1. **Invoke `requirements-aligner` to drop the per-REQ SRS-alignment artefact.** The skill's Phase 2 produces `compliance/evidence/REQ-XXX/srs-alignment.md` — the per-REQ trace from each AC to its SRS item, with an operator sign-off block. The artefact uploads with `evidence_type=srs_alignment` and closes `ISO29119.3.4` + `SOC2.CC2.1` for the REQ. Call via the standard Skill mechanism; don't inline the alignment logic.
198
+ 2. **Re-run the full test pack** with artefact capture:
197
199
  - `npm run test:e2e -- --reporter=html` (produces `playwright-report/`)
198
200
  - `npx vitest run --coverage` (produces `coverage/`)
199
- 2. **Organise artefacts** under `compliance/evidence/REQ-XXX/` with date-prefixed naming:
201
+ 3. **Organise artefacts** under `compliance/evidence/REQ-XXX/` with date-prefixed naming:
200
202
  ```
201
203
  compliance/evidence/REQ-XXX/
204
+ ├── srs-alignment.md ← produced in step 1 by requirements-aligner
202
205
  ├── YYYY-MM-DD_e2e-results.json
203
206
  ├── YYYY-MM-DD_playwright-report/
204
207
  ├── YYYY-MM-DD_traces/ ← per-test trace.zip + error-context.md
@@ -207,7 +210,7 @@ Reached only on the **tracked** route from Phase 0 (the issue is already fetched
207
210
  ```
208
211
 
209
212
  Copy Playwright's `test-results/` folder verbatim into `YYYY-MM-DD_traces/` so trace-by-test-name is available for audit without walking the HTML report's hash-name index. For HIGH/CRITICAL releases the traces are part of the audit trail — *"what state was the page in when test X failed and was overridden?"* answers in one `ls` instead of an HTML-report walk.
210
- 3. **Upload each artefact to the portal**:
213
+ 4. **Upload each artefact to the portal**:
211
214
  ```bash
212
215
  devaudit push <project-slug> REQ-XXX <evidence-type> <file> \
213
216
  --release "v$(date +%Y.%m.%d)" --create-release-if-missing \
@@ -215,9 +218,9 @@ Reached only on the **tracked** route from Phase 0 (the issue is already fetched
215
218
  --git-sha "$(git rev-parse HEAD)" \
216
219
  --branch "$(git rev-parse --abbrev-ref HEAD)"
217
220
  ```
218
- Evidence types: `screenshot`, `e2e_result`, `test_report`, `audit_log`, `compliance_document`, `manual_upload`.
219
- 4. **Verify uploads landed.** `gh api` or `curl` against `https://devaudit.metasession.co/projects/<slug>/requirements/REQ-XXX/evidence` should show every artefact.
220
- 5. **Update `compliance/RTM.md`** with portal links for each evidence row.
221
+ Evidence types: `screenshot`, `e2e_result`, `test_report`, `audit_log`, `compliance_document`, `manual_upload`, `srs_alignment` (from step 1).
222
+ 5. **Verify uploads landed.** `gh api` or `curl` against `https://devaudit.metasession.co/projects/<slug>/requirements/REQ-XXX/evidence` should show every artefact.
223
+ 6. **Update `compliance/RTM.md`** with portal links for each evidence row.
221
224
 
222
225
  ### Phase 4 — Submit for UAT review (SDLC stage 4)
223
226
 
@@ -101,6 +101,87 @@ jobs:
101
101
  echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
102
102
  echo "Release version: ${VERSION}"
103
103
 
104
+ # Housekeeping artefact auto-generation (DevAudit-Installer#116 WS3+WS4)
105
+ #
106
+ # Housekeeping releases (bare-date version) need two operator-authored
107
+ # artefacts to clear the portal's release-completeness checklist:
108
+ # `RELEASE-TICKET-<version>.md` and `security-summary-<version>.md`.
109
+ # When the version resolves to a bare-date AND those artefacts don't
110
+ # already exist on develop, generate stubs from the CI gate JSON and
111
+ # open a PR that the operator reviews + signs off + merges. Once
112
+ # merged, the next compliance-evidence.yml run uploads them as
113
+ # evidence and the matrix flips both items to ✓.
114
+ #
115
+ # Mirrors the `incident-export.yml` pattern: auto-PR, operator fills
116
+ # in sign-off, merge to land.
117
+ - name: Auto-generate housekeeping stubs (if needed)
118
+ if: steps.resolve.outputs.skip != 'true'
119
+ env:
120
+ GH_TOKEN: ${{ secrets.DEVAUDIT_USER_TOKEN || github.token }}
121
+ VERSION: ${{ steps.version.outputs.version }}
122
+ run: |
123
+ # Guard: only fire for bare-date (housekeeping) versions.
124
+ if ! [[ "$VERSION" =~ ^v[0-9]{4}\.[0-9]{2}\.[0-9]{2}(\.[0-9]+)?$ ]]; then
125
+ echo "Version ${VERSION} is not housekeeping; skipping stub generation."
126
+ exit 0
127
+ fi
128
+ TICKET_PATH="compliance/pending-releases/RELEASE-TICKET-${VERSION}.md"
129
+ SECSUM_PATH="compliance/security-summary-${VERSION}.md"
130
+ # Skip when both stubs already exist (this branch already carries
131
+ # them, or a prior run already opened the PR and the artefacts
132
+ # have since merged).
133
+ if [ -f "$TICKET_PATH" ] && [ -f "$SECSUM_PATH" ]; then
134
+ echo "Housekeeping stubs already present for ${VERSION}; nothing to generate."
135
+ exit 0
136
+ fi
137
+ chmod +x scripts/generate-housekeeping-release-ticket.sh 2>/dev/null || true
138
+ chmod +x scripts/generate-security-summary.sh 2>/dev/null || true
139
+ mkdir -p compliance/pending-releases
140
+ # Generate any missing stubs. Each generator is independent so a
141
+ # partial-state branch (e.g. ticket already merged but security-
142
+ # summary still missing) only writes the missing half.
143
+ if [ ! -f "$TICKET_PATH" ]; then
144
+ bash scripts/generate-housekeeping-release-ticket.sh "$VERSION" > "$TICKET_PATH"
145
+ echo "Wrote $TICKET_PATH"
146
+ fi
147
+ if [ ! -f "$SECSUM_PATH" ]; then
148
+ bash scripts/generate-security-summary.sh "$VERSION" > "$SECSUM_PATH"
149
+ echo "Wrote $SECSUM_PATH"
150
+ fi
151
+ # Open the auto-PR. force-with-lease so re-runs on the same
152
+ # bare-date version update the same branch in place.
153
+ BRANCH="chore/housekeeping-release-${VERSION}"
154
+ git config user.name 'devaudit-bot'
155
+ git config user.email 'devaudit-bot@users.noreply.github.com'
156
+ git fetch origin develop
157
+ git checkout -B "${BRANCH}" origin/develop
158
+ # Re-write under the new branch (the checkout above resets the
159
+ # working tree — regenerate so the commit captures the stubs).
160
+ if [ ! -f "$TICKET_PATH" ]; then
161
+ bash scripts/generate-housekeeping-release-ticket.sh "$VERSION" > "$TICKET_PATH"
162
+ fi
163
+ if [ ! -f "$SECSUM_PATH" ]; then
164
+ bash scripts/generate-security-summary.sh "$VERSION" > "$SECSUM_PATH"
165
+ fi
166
+ git add "$TICKET_PATH" "$SECSUM_PATH"
167
+ if git diff --cached --quiet; then
168
+ echo "No change — stubs already on develop."
169
+ exit 0
170
+ fi
171
+ git commit -m "chore: housekeeping release-ticket stub + security-summary for ${VERSION}" \
172
+ -m "Auto-generated by compliance-evidence.yml (DevAudit-Installer#116)." \
173
+ -m "" \
174
+ -m "REPLACE markers in the Risk Assessment + Sign-off blocks require operator review before merge."
175
+ git push --force-with-lease origin "${BRANCH}"
176
+ EXISTING=$(gh pr list --head "${BRANCH}" --json number --jq '.[0].number' || true)
177
+ if [ -z "$EXISTING" ]; then
178
+ gh pr create --base develop --head "${BRANCH}" \
179
+ --title "chore(housekeeping): release-ticket + security-summary stubs for ${VERSION}" \
180
+ --body "Auto-generated by the \`Compliance Evidence Upload\` workflow when develop received a housekeeping push (no \`REQ-XXX\` in commit subjects; version derived as bare-date \`${VERSION}\`).\n\n**Files added:**\n- \`${TICKET_PATH}\` — release ticket stub with commit summary + sign-off block\n- \`${SECSUM_PATH}\` — security summary stub scraping SAST + dep-audit gate JSON\n\n**Required before merge:**\n- [ ] Replace \`REPLACE — …\` markers in the **Summary**, **Risk Assessment**, and **Sign-off** blocks on both files\n- [ ] Confirm the auto-scraped SAST + dep-audit counts match what the gate panel shows\n- [ ] Add reviewer sign-off (operator name + date)\n\nOnce merged, the next \`compliance-evidence.yml\` run uploads both artefacts as evidence and the portal's release-completeness checklist flips the **Security summary present** + **Release ticket present** items to ✓.\n\nSee [stage-3 SDLC doc \"Housekeeping releases\" section](../SDLC/3-compile-evidence.md) for the full operator walkthrough."
181
+ else
182
+ echo "PR #${EXISTING} already open for ${VERSION} — branch updated in place."
183
+ fi
184
+
104
185
  - name: Upload compliance documents
105
186
  if: steps.resolve.outputs.skip != 'true'
106
187
  run: |
@@ -84,5 +84,14 @@
84
84
  "production_review": {
85
85
  "enabled": true,
86
86
  "terminal_status": "prod_review"
87
+ },
88
+
89
+ "_comment_requirements_aligner": "requirements-aligner skill toggles (DevAudit-Installer#119, v0.1.42+). Controls when the skill blocks vs advises. block_on_stage_1=false (default) means the skill advises on AC-to-SRS mapping at plan APPROVAL but doesn't block; flip to true once docs/SRS.md is populated enough for the check to be reliably surfacing real drift (not false-positives on sparse SoT). block_on_stage_3=true means the per-REQ srs-alignment.md artefact is required before Stage 3 completes — the per-REQ evidence is the hard gate. auto_file_followup_issue=false means the skill never opens GitHub issues automatically; if gaps are detected and operator defers, operator files follow-up manually. ramp_up_runs=5 means the first 5 invocations on a project are audit-only regardless of block_on_stage_1, so legacy projects with sparse SRS get time to populate before blocking enforces.",
90
+ "requirements_aligner": {
91
+ "enabled": true,
92
+ "block_on_stage_1": false,
93
+ "block_on_stage_3": true,
94
+ "auto_file_followup_issue": false,
95
+ "ramp_up_runs": 5
87
96
  }
88
97
  }