@metasession.co/devaudit-cli 0.1.1 → 0.1.2

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 (70) hide show
  1. package/README.md +13 -10
  2. package/dist/index.js +17 -5
  3. package/dist/index.js.map +1 -1
  4. package/package.json +9 -5
  5. package/scripts/upload-evidence.sh +225 -0
  6. package/sdlc/.claude/settings.local.json +11 -0
  7. package/sdlc/CLAUDE.md +73 -0
  8. package/sdlc/HOST_ADAPTER.md +127 -0
  9. package/sdlc/SKILLS.md +137 -0
  10. package/sdlc/STACK_ADAPTER.md +130 -0
  11. package/sdlc/ai-rules/INSTRUCTIONS-SDLC.md +172 -0
  12. package/sdlc/ai-rules/README.md +103 -0
  13. package/sdlc/ai-rules/SDLC_RULES.md +584 -0
  14. package/sdlc/ai-rules/claude/CLAUDE.md +192 -0
  15. package/sdlc/ai-rules/cursor/.cursorrules +167 -0
  16. package/sdlc/ai-rules/windsurf/.windsurfrules +167 -0
  17. package/sdlc/article.md +219 -0
  18. package/sdlc/files/_common/0-project-setup.md +410 -0
  19. package/sdlc/files/_common/1-plan-requirement.md +381 -0
  20. package/sdlc/files/_common/2-implement-and-test.md +276 -0
  21. package/sdlc/files/_common/3-compile-evidence.md +603 -0
  22. package/sdlc/files/_common/4-submit-for-review.md +362 -0
  23. package/sdlc/files/_common/5-deploy-main.md +251 -0
  24. package/sdlc/files/_common/Periodic_Security_Review_Schedule.md +169 -0
  25. package/sdlc/files/_common/README_TEMPLATE.md +441 -0
  26. package/sdlc/files/_common/Test_Architecture.md +461 -0
  27. package/sdlc/files/_common/Test_Plan_TEMPLATE.md +311 -0
  28. package/sdlc/files/_common/Test_Policy.md +277 -0
  29. package/sdlc/files/_common/Test_Strategy.md +359 -0
  30. package/sdlc/files/_common/github/ISSUE_TEMPLATE/bug.yml +75 -0
  31. package/sdlc/files/_common/github/ISSUE_TEMPLATE/config.yml +11 -0
  32. package/sdlc/files/_common/github/ISSUE_TEMPLATE/requirement.yml +75 -0
  33. package/sdlc/files/_common/github/ISSUE_TEMPLATE/task.yml +48 -0
  34. package/sdlc/files/_common/github/pull_request_template.md +69 -0
  35. package/sdlc/files/_common/implementing-an-sdlc-issue.md +413 -0
  36. package/sdlc/files/_common/scripts/derive-release-version.sh +40 -0
  37. package/sdlc/files/_common/scripts/derive-release-version.test.sh +98 -0
  38. package/sdlc/files/_common/scripts/submit-for-uat-review.sh +162 -0
  39. package/sdlc/files/_common/scripts/validate-commits.sh +83 -0
  40. package/sdlc/files/_common/scripts/validate-compliance-artifacts.sh +202 -0
  41. package/sdlc/files/_common/scripts/validate-compliance-artifacts.test.sh +202 -0
  42. package/sdlc/files/_common/skills/_schema/skill.schema.json +36 -0
  43. package/sdlc/files/_common/skills/e2e-test-engineer/SKILL.md +254 -0
  44. package/sdlc/files/_common/skills/e2e-test-engineer/references/bootstrap.md +244 -0
  45. package/sdlc/files/_common/skills/e2e-test-engineer/references/evidence.ts +40 -0
  46. package/sdlc/files/_common/skills/sdlc-implementer/SKILL.md +189 -0
  47. package/sdlc/files/_common/skills/sdlc-implementer/references/call-graph.md +64 -0
  48. package/sdlc/files/_common/skills/sdlc-implementer/references/change-request-loop.md +192 -0
  49. package/sdlc/files/_common/skills/sdlc-implementer/references/compliance-constraints.md +81 -0
  50. package/sdlc/files/ci/check-release-approval.yml.template +201 -0
  51. package/sdlc/files/ci/ci-status-fallback.yml.template +41 -0
  52. package/sdlc/files/ci/ci.yml.template +390 -0
  53. package/sdlc/files/ci/compliance-evidence.yml.template +161 -0
  54. package/sdlc/files/ci/compliance-validation.yml.template +34 -0
  55. package/sdlc/files/ci/post-deploy-prod.yml.template +159 -0
  56. package/sdlc/files/ci/python/ci.yml.template +335 -0
  57. package/sdlc/files/hosts/_schema/adapter.schema.json +103 -0
  58. package/sdlc/files/hosts/railway/adapter.json +32 -0
  59. package/sdlc/files/sdlc-config.example.json +74 -0
  60. package/sdlc/files/stacks/_schema/adapter.schema.json +151 -0
  61. package/sdlc/files/stacks/node/adapter.json +54 -0
  62. package/sdlc/files/stacks/node/hooks/.prettierrc.json +9 -0
  63. package/sdlc/files/stacks/node/hooks/commit-msg +7 -0
  64. package/sdlc/files/stacks/node/hooks/commitlint.config.mjs +64 -0
  65. package/sdlc/files/stacks/node/hooks/lint-staged.config.mjs +16 -0
  66. package/sdlc/files/stacks/node/hooks/pre-commit +13 -0
  67. package/sdlc/files/stacks/node/hooks/pre-push +15 -0
  68. package/sdlc/files/stacks/node/scripts/check-requirement-jsdoc.sh +54 -0
  69. package/sdlc/files/stacks/python/adapter.json +36 -0
  70. package/sdlc/files/stacks/python/hooks/.pre-commit-config.yaml +51 -0
@@ -0,0 +1,413 @@
1
+ # Implementing a GitHub issue under the Metasession SDLC
2
+
3
+ End-to-end walkthrough for taking a GitHub issue from triage to merged-and-deployed under the Metasession SDLC. Audience: this project's developers and AI coding agents.
4
+
5
+ > This document is **synced into your repo from DevAudit-Installer** via `devaudit update`. Do not edit this file in place — your edits will be overwritten on the next sync. To propose a change, open a Task issue against [`metasession-dev/DevAudit-Installer`](https://github.com/metasession-dev/DevAudit-Installer) referencing `sdlc/files/_common/implementing-an-sdlc-issue.md`.
6
+ >
7
+ > For the broader DevAudit positioning (three-pillar story, standards coverage, the portal itself), see the [DevAudit portal repo's documentation](https://github.com/metasession-dev/devaudit).
8
+
9
+ ## What you need before you start
10
+
11
+ | Prerequisite | How to check |
12
+ | ----------------------------------------------------------------------------------------------- | -------------------------------------------------- |
13
+ | The project is SDLC-onboarded (has `sdlc-config.json`, `compliance/`, the synced AI rule files) | `devaudit status .` from the project root |
14
+ | The `devaudit` CLI is installed | `devaudit --version` should print `0.1.1` or later |
15
+ | You're authenticated against the portal | `devaudit auth status` |
16
+ | Your `gh` CLI is authenticated against the project's GitHub repo | `gh auth status` |
17
+ | Your local checkout is on `develop` (or branched from it) and up-to-date | `git status` |
18
+
19
+ If `devaudit status` reports gaps, see [`DevAudit-Installer/docs/onboarding.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/docs/onboarding.md) to re-sync the framework, then come back here.
20
+
21
+ ## The five stages, at a glance
22
+
23
+ | Stage | Doc (canonical) | What you produce |
24
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
25
+ | 1 — Plan requirement | [`sdlc/_common/1-plan-requirement.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/1-plan-requirement.md) | `compliance/plans/REQ-XXX/implementation-plan.md` + RTM entry + risk classification |
26
+ | 2 — Implement and test | [`sdlc/_common/2-implement-and-test.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/2-implement-and-test.md) | Code + tests + all gates green locally |
27
+ | 3 — Compile evidence | [`sdlc/_common/3-compile-evidence.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/3-compile-evidence.md) | Evidence uploaded to the portal under REQ-XXX |
28
+ | 4 — Submit for review | [`sdlc/_common/4-submit-for-review.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/4-submit-for-review.md) | PR open against `main` with the gates green and UAT approval requested |
29
+ | 5 — Deploy to main | [`sdlc/_common/5-deploy-main.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/5-deploy-main.md) | Merge → production deploy → smoke evidence captured → release marked Released |
30
+
31
+ The stage-doc files are synced into every consumer project's repo by `devaudit update`; the canonical copies live in DevAudit-Installer (links above).
32
+
33
+ ## Trivial-change escape hatch
34
+
35
+ For typo fixes, formatting changes, dependency bumps, and other zero-risk chores, **skip stages 1 and 3** and go straight to stage 2 (and a `chore:` PR). The risk threshold for the full ceremony is in [`Test_Policy.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/Test_Policy.md) §Risk-Based Testing. Even trivial changes must run **all gates locally before pushing** — that's not optional.
36
+
37
+ If you're not sure whether your change is trivial, treat it as non-trivial (cheaper than discovering mid-PR that an auditor needs evidence).
38
+
39
+ ## Automated mode (`sdlc-implementer` — pending Phase C smoke)
40
+
41
+ The [`sdlc-implementer`](#skills-inventory) skill has been authored (SKILL.md + 3 references on `main`, validator-clean) but hasn't yet been smoke-tested against `wawagardenbar-app`. Once Phase C completes, this entire walkthrough collapses to:
42
+
43
+ ```text
44
+ > Implement issue #N under the SDLC.
45
+ ```
46
+
47
+ The skill runs phases 1–4 unattended (with a plan-approval pause for HIGH/CRITICAL risk) and surfaces a UAT review waiting for you on the portal. Approve it on the portal, then:
48
+
49
+ ```text
50
+ > Resume REQ-XXX.
51
+ ```
52
+
53
+ The skill completes phase 5: merge, monitor post-deploy, capture production smoke evidence, mark the release Released. If changes are requested at UAT instead of approval, the skill addresses them and re-submits for UAT re-review.
54
+
55
+ The manual walkthrough below remains the source of truth for what the skill is doing (and the fallback for cases where the skill can't be used). Until the skill ships, follow the walkthrough manually — the sample prompts at the end of this doc are the per-stage stopgap.
56
+
57
+ ---
58
+
59
+ ## End-to-end walkthrough
60
+
61
+ ### 1. Pick up the issue
62
+
63
+ Either pick an existing issue or open one. Opening one — use the **Requirement** template (see [Issue templates](#issue-templates) below); it forces the SDLC-mandatory fields up front. Existing issues without those fields need the missing fields added as a comment before stage 1.
64
+
65
+ Skim the issue for:
66
+
67
+ - **Risk class signals** — does it touch auth, payments, RBAC, evidence storage, audit log, or anything an auditor would ask about? → HIGH/CRITICAL likely.
68
+ - **Acceptance criteria** — does the issue spell them out? If not, you'll derive them in stage 1.
69
+ - **Dependencies** — does it depend on another in-flight issue or a portal API change? Flag in stage 1.
70
+
71
+ Assign yourself, move the issue to **In Progress** in the project board.
72
+
73
+ ### 2. Stage 1 — Plan the requirement
74
+
75
+ Goal: a written, reviewable plan before any code lands.
76
+
77
+ Steps (manual; the [`sdlc-implementer`](#skills-inventory) orchestration skill will run this phase automatically once Phase C smoke completes):
78
+
79
+ 1. **Classify risk** per [`Test_Policy.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/Test_Policy.md) — LOW, MEDIUM, HIGH, or CRITICAL.
80
+ 2. **Pick or assign a REQ-XXX ID.** Inspect `compliance/RTM.md` for existing entries; if this is genuinely new, take the next available number.
81
+ 3. **Write `compliance/plans/REQ-XXX/implementation-plan.md`** per the stage-1 template. Sections: context, acceptance criteria, technical approach, security considerations, dependencies, test scope.
82
+ 4. **Update `compliance/RTM.md`** with the new entry: REQ-XXX, title, risk class, linked issue, linked test cases (placeholder).
83
+ 5. **Post the plan summary** as a comment on the GitHub issue. Stop here. Wait for review before implementing.
84
+
85
+ For HIGH/CRITICAL risk, the plan must explicitly include:
86
+
87
+ - **Threat model** — what attackers/abusers could do; what's mitigated; what's accepted
88
+ - **Four-eyes attestation slot** — names the second reviewer who'll sign off pre-merge
89
+ - **Rollback plan** — what reverts the change if production smoke fails
90
+
91
+ Sample prompt for an AI agent kicking off stage 1: see [`Sample prompts → Stage 1`](#sample-prompts).
92
+
93
+ ### 3. Stage 2 — Implement and test
94
+
95
+ Goal: code, tests, all gates green locally before pushing.
96
+
97
+ 1. **Branch from `develop`**: `git checkout -b feat/REQ-XXX-short-description`.
98
+ 2. **Write failing tests first** per `sdlc/Test_Architecture.md`. The risk class dictates depth:
99
+ - LOW: unit tests on the changed function(s); no e2e required unless the change touches a user-facing flow.
100
+ - MEDIUM: unit + integration; e2e for any UI-facing change.
101
+ - HIGH: unit + integration + e2e for every user-visible path + at least one negative/abuse test.
102
+ - CRITICAL: HIGH plus targeted security tests (authz bypass attempts, input fuzzing where applicable).
103
+ - **For any e2e or visual-regression work in this step, invoke the `e2e-test-engineer` skill** — it derives scenarios from the acceptance criteria + diff, reconciles with the existing pack, retires obsolete tests, runs the suite, and files defects for failures. Don't author e2e tests by hand when the skill is shipped. (Once `sdlc-implementer` Phase C smoke completes, it enforces this delegation automatically.)
104
+ 3. **Implement the change.** Reference the implementation plan; deviations from the plan must be noted in the plan itself (it's the source of truth, not a one-shot artefact).
105
+ 4. **Run all gates locally** before pushing:
106
+ ```bash
107
+ npm run lint # 0 errors, 0 warnings on changed files
108
+ npx tsc --noEmit # 0 errors
109
+ npx vitest run # all pass
110
+ npx playwright test # all pass on changed routes
111
+ semgrep scan --config auto # 0 high/critical
112
+ npm audit --audit-level=high # 0 high/critical
113
+ ```
114
+ _(commands shown for Node; Python consumers run `ruff check`, `mypy src/`, `pytest`, etc. — see the consumer's `sdlc-config.json` and stack adapter)_
115
+ 5. **Commit with Conventional Commits** + a `Ref: REQ-XXX` trailer + `Co-Authored-By:` if AI-assisted.
116
+ 6. **Push to your branch.** This triggers the consumer's CI on `develop` push (if the branch IS develop) or stays branch-local until you open the PR. Most projects use a feature-branch flow — push to feature branch, PR to develop.
117
+
118
+ If any gate fails: fix the underlying issue. Do **not** use `--no-verify`, `// eslint-disable`, `// @ts-expect-error`, `xfail`, or any other bypass. If a gate is structurally wrong for this change, surface that as a blocker in the issue, don't silently work around it.
119
+
120
+ ### 4. Stage 3 — Compile evidence
121
+
122
+ Goal: every test result + report + screenshot lands on the portal under REQ-XXX so auditors can verify the change was tested.
123
+
124
+ 1. **Run the full test suite one more time**, this time capturing artefacts:
125
+ ```bash
126
+ npm run test:e2e -- --reporter=html # produces playwright-report/
127
+ npx vitest run --coverage # produces coverage/
128
+ ```
129
+ 2. **Organise artefacts** under `compliance/evidence/REQ-XXX/`. Convention:
130
+ ```
131
+ compliance/evidence/REQ-XXX/
132
+ ├── 2026-MM-DD_e2e-results.json
133
+ ├── 2026-MM-DD_playwright-report/ # full HTML report
134
+ ├── 2026-MM-DD_unit-coverage/ # vitest coverage HTML
135
+ └── 2026-MM-DD_screenshots/*.png # failing/edge-case shots if applicable
136
+ ```
137
+ 3. **Upload to the portal** via the CLI:
138
+ ```bash
139
+ devaudit push <project-slug> REQ-XXX e2e_result compliance/evidence/REQ-XXX/2026-MM-DD_e2e-results.json \
140
+ --release "v$(date +%Y.%m.%d)" --create-release-if-missing \
141
+ --environment uat --category testing \
142
+ --git-sha "$(git rev-parse HEAD)" --branch "$(git rev-parse --abbrev-ref HEAD)"
143
+ ```
144
+ Repeat per evidence type (`screenshot`, `test_report`, `audit_log`, `compliance_document`, `manual_upload`).
145
+ 4. **Verify uploads** at `https://devaudit.metasession.co/projects/<slug>/requirements/REQ-XXX`. Every entry should render.
146
+ 5. **Update `compliance/RTM.md`** with the portal links for each evidence row.
147
+
148
+ CI also uploads evidence automatically on `develop` push (via the `ci.yml.template` workflow synced from DevAudit-Installer). Manual stage 3 uploads from your laptop are a belt-and-braces complement, mostly useful when you want to attach evidence the automated workflow doesn't produce (manual sign-off PDFs, threat models, etc.).
149
+
150
+ ### 5. Stage 4 — Submit for review
151
+
152
+ Goal: PR open against `main` with all gates green and the UAT approval requested.
153
+
154
+ 1. **Verify gates one more time** — `gh pr checks` once the PR is open. Required status checks (per branch protection): `Quality Gates`, `Compliance Validation`, `DevAudit Release Approval`. The release-approval check will be **pending** until UAT signs off on the portal; that's expected.
155
+ 2. **Open the PR** with `gh pr create --base main --head develop` (or feature → develop → main per the project's branching flow). PR body **must** include the SDLC-mandated fields — see [`pull_request_template.md`](../.github/pull_request_template.md) — pre-filled by GitHub when you open the PR via the UI:
156
+ - Linked issue (`Closes #N`)
157
+ - REQ-XXX
158
+ - Risk class
159
+ - Evidence portal link
160
+ - Four-eyes attestation (HIGH/CRITICAL only)
161
+ - Rollback plan (HIGH/CRITICAL only)
162
+ 3. **Add labels** — `awaiting-uat-review` is the canonical "ready for human review" signal. Add `risk:HIGH` or `risk:CRITICAL` where applicable so reviewers can prioritise.
163
+ 4. **Wait for UAT approval on the portal.** Reviewer opens `https://devaudit.metasession.co/projects/<slug>/releases/<version>` and clicks Approve (or Request Changes). The `DevAudit Release Approval` check unblocks once approval is granted.
164
+
165
+ If a reviewer asks for changes:
166
+
167
+ - Update the implementation plan with the deviation
168
+ - Repeat stages 2 and 3 for the changes
169
+ - Re-request review
170
+
171
+ ### 6. Stage 5 — Merge and deploy
172
+
173
+ Goal: PR merged → production deploys → smoke evidence captured → release marked Released.
174
+
175
+ 1. **Merge** the PR via `gh pr merge --merge` (preserves audit trail per the SDLC merge-commit convention). Branch protection blocks `--squash` and `--rebase` on SDLC repos.
176
+ 2. **Watch the deploy** — `gh run watch` against the `post-deploy-prod.yml` workflow. ~3–5 minutes typically.
177
+ 3. **Verify production smoke evidence uploaded.** The post-deploy workflow runs production smoke tests and pushes evidence with `--environment production`. Confirm at `https://devaudit.metasession.co/projects/<slug>/releases/<version>`.
178
+ 4. **Mark the release as Released** on the portal once production smoke is green.
179
+
180
+ If production smoke fails:
181
+
182
+ - **Do not** mark the release as Released. File a defect issue immediately.
183
+ - Follow the project's incident playbook (rollback or roll-forward per the original plan's rollback section).
184
+
185
+ ---
186
+
187
+ ## Sample prompts
188
+
189
+ Copy-paste these into Claude Code, Cursor, or any agent with shell access to kick off each stage. The agent should already have `AGENT.md` (portal) or the consumer's `INSTRUCTIONS.md` loaded as the canonical rules file.
190
+
191
+ > **Replace placeholders.** `{ISSUE_NUMBER}`, `{REQ_ID}`, `{PROJECT_SLUG}`, `{VERSION}` etc. are placeholders — substitute the real values before invoking.
192
+
193
+ ### Stage 1 — Plan the requirement
194
+
195
+ ```text
196
+ I'm picking up GitHub issue #{ISSUE_NUMBER} in this repo. Follow the Metasession SDLC
197
+ stage 1 (plan-requirement) for it:
198
+
199
+ 1. Run `gh issue view {ISSUE_NUMBER}` and read the issue fully, including comments.
200
+ 2. Classify the risk per sdlc/Test_Policy.md (LOW / MEDIUM / HIGH / CRITICAL).
201
+ 3. Assign a REQ-XXX ID if not already present in compliance/RTM.md (use the next free number).
202
+ 4. Create compliance/plans/REQ-XXX/implementation-plan.md per the stage-1 template
203
+ (context / acceptance criteria / technical approach / security considerations /
204
+ dependencies / test scope). For HIGH/CRITICAL also include threat model,
205
+ four-eyes attestation slot, and rollback plan.
206
+ 5. Update compliance/RTM.md with the new entry.
207
+ 6. Post a plan summary as a comment on issue #{ISSUE_NUMBER}.
208
+
209
+ STOP after the plan is posted. Do NOT begin implementation.
210
+
211
+ Reference: AGENT.md (or INSTRUCTIONS.md for consumer repos), and the canonical
212
+ sdlc/_common/1-plan-requirement.md from DevAudit-Installer.
213
+ ```
214
+
215
+ ### Stage 2 — Implement and test
216
+
217
+ ```text
218
+ Implement REQ-{REQ_ID} per compliance/plans/REQ-{REQ_ID}/implementation-plan.md.
219
+ Follow SDLC stage 2 (implement-and-test):
220
+
221
+ 1. Branch: `feat/REQ-{REQ_ID}-short-description` off develop.
222
+ 2. Write failing tests first per Test_Architecture.md. Risk class is {RISK_CLASS};
223
+ match the test depth from §Test depth by risk class in the plan.
224
+ 3. Implement the change. Any deviation from the plan: note it IN the plan, don't
225
+ silently diverge.
226
+ 4. Run ALL gates locally before pushing. Must all pass:
227
+ - npm run lint
228
+ - npx tsc --noEmit
229
+ - npx vitest run
230
+ - npx playwright test
231
+ - semgrep scan --config auto
232
+ - npm audit --audit-level=high
233
+ 5. Conventional commit with `Ref: REQ-{REQ_ID}` trailer and `Co-Authored-By:`
234
+ line if AI-assisted.
235
+
236
+ Do NOT use --no-verify, eslint-disable, @ts-expect-error, xfail, or any bypass.
237
+ If a gate is structurally wrong for this change, stop and surface it as a blocker.
238
+ ```
239
+
240
+ ### Stage 3 — Compile evidence
241
+
242
+ ```text
243
+ Compile evidence for REQ-{REQ_ID} per SDLC stage 3 (compile-evidence):
244
+
245
+ 1. Run the full test suite capturing artefacts:
246
+ - npm run test:e2e -- --reporter=html
247
+ - npx vitest run --coverage
248
+ 2. Organise artefacts under compliance/evidence/REQ-{REQ_ID}/ with the date-prefixed
249
+ naming convention (YYYY-MM-DD_<artefact>).
250
+ 3. Upload each artefact to the portal via:
251
+
252
+ devaudit push {PROJECT_SLUG} REQ-{REQ_ID} <evidence-type> <file> \
253
+ --release "v$(date +%Y.%m.%d)" --create-release-if-missing \
254
+ --environment uat --category testing \
255
+ --git-sha "$(git rev-parse HEAD)" \
256
+ --branch "$(git rev-parse --abbrev-ref HEAD)"
257
+
258
+ evidence-type is one of: screenshot, e2e_result, test_report, audit_log,
259
+ compliance_document, manual_upload.
260
+ 4. Verify uploads landed at
261
+ https://devaudit.metasession.co/projects/{PROJECT_SLUG}/requirements/REQ-{REQ_ID}
262
+ 5. Update compliance/RTM.md with portal links per evidence row.
263
+ ```
264
+
265
+ ### Stage 4 — Submit for review
266
+
267
+ ```text
268
+ Open the PR for REQ-{REQ_ID} per SDLC stage 4 (submit-for-review):
269
+
270
+ 1. Verify the branch is up-to-date with develop and all gates pass locally.
271
+ 2. Open the PR with `gh pr create --base main` (or --base develop per project flow).
272
+ Use the SDLC PR template — body must include:
273
+ - "Closes #{ISSUE_NUMBER}"
274
+ - "REQ: REQ-{REQ_ID}"
275
+ - "Risk: {RISK_CLASS}"
276
+ - "Evidence: https://devaudit.metasession.co/projects/{PROJECT_SLUG}/requirements/REQ-{REQ_ID}"
277
+ - For HIGH/CRITICAL: "Four-eyes attestation: <reviewer-username>" and
278
+ "Rollback plan: <ref to plan §rollback>"
279
+ 3. Add labels: `awaiting-uat-review`, `risk:{RISK_CLASS}`.
280
+ 4. Confirm `gh pr checks <pr-number>` shows all required statuses passing or
281
+ pending-on-UAT-approval. STOP and report; do not merge.
282
+ 5. Notify the assigned reviewer.
283
+
284
+ If `gh pr checks` shows ANY required check failing, STOP and surface the failure;
285
+ do not announce the PR as ready.
286
+ ```
287
+
288
+ ### Stage 5 — Merge + deploy
289
+
290
+ ```text
291
+ Merge REQ-{REQ_ID} per SDLC stage 5 (deploy-main), then track to production:
292
+
293
+ 1. Confirm `gh pr view <pr-number>` shows UAT-approved status from the portal.
294
+ 2. Merge with `gh pr merge <pr-number> --merge` (audit trail; never --squash,
295
+ never --rebase).
296
+ 3. Watch `gh run watch` against the post-deploy-prod.yml workflow.
297
+ 4. Verify production smoke evidence uploaded (environment=production) at
298
+ https://devaudit.metasession.co/projects/{PROJECT_SLUG}/releases/{VERSION}
299
+ 5. Mark the release as `Released` on the portal.
300
+
301
+ If production smoke FAILS:
302
+ - Do NOT mark the release as Released.
303
+ - File a defect issue with title "[INCIDENT] REQ-{REQ_ID} production smoke failed".
304
+ - Page the on-call per the project's incident playbook.
305
+ - Roll back per the implementation plan's rollback section.
306
+ ```
307
+
308
+ ---
309
+
310
+ ## Issue templates
311
+
312
+ The portal repo ships three GitHub issue templates under `.github/ISSUE_TEMPLATE/`. Consuming projects should adopt the same shape — the templates are reproduced in `sdlc/files/_common/github/` in DevAudit-Installer and synced to consumers on `devaudit update`.
313
+
314
+ | Template | When to use | Mandatory fields |
315
+ | -------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
316
+ | [Requirement](../.github/ISSUE_TEMPLATE/requirement.yml) | New feature, enhancement, or significant change. Full SDLC stages 1–5. | Title (one-line summary), context/why, acceptance criteria, suspected risk class, dependencies |
317
+ | [Bug](../.github/ISSUE_TEMPLATE/bug.yml) | Defect in shipped behaviour. Full SDLC if it touches a high-risk surface; otherwise lighter. | Reproduction, expected vs actual, environment, risk class |
318
+ | [Task](../.github/ISSUE_TEMPLATE/task.yml) | Chores, refactors, docs, dependency bumps. Trivial-change escape hatch — skip stages 1 + 3. | Title, what + why, definition of done |
319
+
320
+ `.github/ISSUE_TEMPLATE/config.yml` disables blank issues; choosing one of the three templates is mandatory.
321
+
322
+ ### How to create an issue from a template
323
+
324
+ GitHub UI: **New issue** → pick a template. The template's mandatory fields are rendered as form inputs; you cannot submit until they're filled in.
325
+
326
+ Or via CLI:
327
+
328
+ ```sh
329
+ gh issue create --template requirement.yml --title "Add SAML SSO" \
330
+ --body "$(cat <<'EOF'
331
+ ### Why
332
+ Customers in regulated industries need SAML-based auth.
333
+
334
+ ### Acceptance criteria
335
+ - [ ] SAML 2.0 metadata exchange flow works for Azure AD
336
+ - [ ] User attributes mapped to UserProfile
337
+ - [ ] Failed-auth audit events logged
338
+
339
+ ### Suspected risk class
340
+ HIGH (authentication surface, regulated-industry signal)
341
+
342
+ ### Dependencies
343
+ None
344
+ EOF
345
+ )"
346
+ ```
347
+
348
+ Once the issue exists, you can proceed to stage 1 with one of the [sample prompts](#sample-prompts).
349
+
350
+ ---
351
+
352
+ ## Skills inventory
353
+
354
+ The Metasession SDLC framework includes a set of [Claude Code Skills](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/SKILLS.md) — discrete, discoverable agent capabilities each scoped to one slice of the lifecycle. Skills live in `sdlc/files/_common/skills/<name>/` in DevAudit-Installer and are synced to consumers on `devaudit update`.
355
+
356
+ ### Integrated today
357
+
358
+ | Skill | Stage | Scope |
359
+ | ------------------------------------------------------------------------------------------------------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
360
+ | [`e2e-test-engineer`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/skills/e2e-test-engineer/SKILL.md) | 2 | Bootstrap or maintain e2e + visual regression suites. Derives scenarios from issue/PR diff, reconciles with existing pack, retires obsolete tests (after confirmation), runs the suite, files defects for failures. Framework-agnostic (Playwright, Cypress, WDIO, Selenium, …). |
361
+
362
+ ### Planned
363
+
364
+ One orchestration skill replaces an earlier roadmap of five atomic skills. The atomic ones (`risk-classifier`, `commit-message-author`, `compliance-evidence-author`, `sast-triager`, `release-ticket-author`) were deprioritised: Claude Code's innate capabilities already cover what each wrapped; the actual value-add is end-to-end orchestration with framework-compliant pauses, not five discoverable helpers a human still has to compose.
365
+
366
+ | Skill (planned name) | Stage | Scope it will cover |
367
+ | -------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
368
+ | `sdlc-implementer` | All 5 stages | One-command orchestration: `"implement issue #N under the SDLC"` triggers Phase 1 (classify risk, write plan, update RTM) → Phase 2 (branch, tests, implement, gates) → Phase 3 (evidence capture + portal upload) → Phase 4 (PR open, request UAT review). Halts at Phase 4 with a UAT review waiting for the human on the portal. Resumed by `"resume REQ-XXX"`: if UAT approved → Phase 5 (merge, monitor post-deploy, capture prod smoke evidence, mark Released); if changes requested → re-runs Phase 2 + 3, re-submits for UAT re-review. **MUST invoke** [`e2e-test-engineer`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/skills/e2e-test-engineer/SKILL.md) for end-to-end and visual-regression test work in Phase 2 — the orchestrator never authors e2e tests directly. Unit-test work stays with the orchestrator until a counterpart unit-test skill ships. Enforces six architectural compliance constraints: never skip UAT gate, never act as UAT approver for HIGH/CRITICAL, plan checkpoint mandatory for HIGH/CRITICAL, change-request loop triggers UAT re-review, AI disclosure on every commit, all portal mutations through audit-logged APIs. Tracked at [`metasession-dev/DevAudit-Installer#29`](https://github.com/metasession-dev/DevAudit-Installer/issues/29). |
369
+
370
+ After Phase C smoke completes against `wawagardenbar-app`, the skill will appear in every onboarded consumer's `~/.config/devaudit/skills/` on the next `devaudit update`, become discoverable to Claude Code by name (`Skill(name: "sdlc-implementer", …)`), and get a row moved from **Planned** to **Integrated today** above.
371
+
372
+ ### Why skills (vs. just prompts)
373
+
374
+ Prompts are recipes — useful, but they don't ship. Skills are versioned, testable, discoverable artefacts that:
375
+
376
+ - Show up in Claude Code's skill picker by trigger phrase (`"add e2e tests for this issue"`, `"classify risk for #123"`, …)
377
+ - Carry their own references (sub-pages under `references/` for deep-dive content the SKILL.md links to rather than inlines)
378
+ - Validate against `skill.schema.json` so the frontmatter is consistent across the catalogue
379
+ - Update centrally — a SKILL.md change in DevAudit-Installer reaches every consumer on next `devaudit update`
380
+
381
+ The sample prompts in this doc are a stopgap that lets us run the SDLC manually until each skill lands.
382
+
383
+ ---
384
+
385
+ ## Troubleshooting
386
+
387
+ | Symptom | Likely cause | Fix |
388
+ | ---------------------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
389
+ | `devaudit push` returns 401 | Token expired or wrong account | `devaudit auth status` → `devaudit auth login` if needed |
390
+ | `devaudit push` returns 403 | Project key missing or wrong | Verify `DEVAUDIT_API_KEY` is set; re-issue from the portal `/settings/api-keys` if rotated |
391
+ | `gh pr checks` shows `DevAudit Release Approval` red | UAT review not granted or release not registered | Visit `https://devaudit.metasession.co/projects/<slug>/releases/<version>` → request approval; if release missing, `ci.yml` registers it on `develop` push |
392
+ | Production smoke flaky on the same test repeatedly | Test flake, not a real defect | File the flake as a separate issue tagged `flaky-test`; do NOT mark the release failed |
393
+ | Forgot to add `Ref: REQ-XXX` to commits | RTM traceability gap | Amend the commit (if local) or add a follow-up commit with the trailer; CI's compliance-validation workflow will flag it on PR |
394
+ | Stage 1 plan deviates significantly mid-stage-2 | Implementation discovered a gap in the plan | Update the plan IN PLACE; note the deviation in a new `## Plan deviation` section. The plan is the source of truth, not a one-shot artefact |
395
+
396
+ For anything not covered here, open a `task` issue tagged `sdlc-feedback` against this repo — the portal repo is the central reference and is where the SDLC docs evolve.
397
+
398
+ ---
399
+
400
+ ## See also
401
+
402
+ - [`AGENT.md`](../AGENT.md) — canonical portal standards
403
+ - [`docs/architecture.md`](./architecture.md) — portal architecture (post-v3)
404
+ - [`docs/ci-integration.md`](./ci-integration.md) — how consumer CI uploads evidence to the portal
405
+ - DevAudit-Installer canonical SDLC docs:
406
+ - [`sdlc/files/_common/1-plan-requirement.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/1-plan-requirement.md)
407
+ - [`sdlc/files/_common/2-implement-and-test.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/2-implement-and-test.md)
408
+ - [`sdlc/files/_common/3-compile-evidence.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/3-compile-evidence.md)
409
+ - [`sdlc/files/_common/4-submit-for-review.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/4-submit-for-review.md)
410
+ - [`sdlc/files/_common/5-deploy-main.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/5-deploy-main.md)
411
+ - [`sdlc/files/_common/Test_Policy.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/Test_Policy.md)
412
+ - [`sdlc/files/_common/Test_Architecture.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/files/_common/Test_Architecture.md)
413
+ - [`sdlc/SKILLS.md`](https://github.com/metasession-dev/DevAudit-Installer/blob/main/sdlc/SKILLS.md)
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bash
2
+ # derive-release-version.sh — Pick the release version for CI uploads from
3
+ # the latest commit's REQ tag, falling back to a bare date.
4
+ #
5
+ # Usage:
6
+ # VERSION=$(./scripts/derive-release-version.sh)
7
+ #
8
+ # Priority:
9
+ # 1. REQ tag in commit subject: "[REQ-037] feat(kitchen): ..." -> REQ-037
10
+ # 2. Ref in commit body: "Ref: REQ-037" -> REQ-037
11
+ # 3. Fallback: bare date -> v2026.05.17
12
+ #
13
+ # Multi-REQ commits: first match wins; subject takes priority over body.
14
+ # Output: single line on stdout. Exit 0 in all normal cases.
15
+ #
16
+ # This ties a release record (project_id, version) to the feature the
17
+ # commits belong to, so all CI uploads for one REQ converge on one
18
+ # release container — fixing the fragmentation described in DevAudit #310.
19
+ #
20
+ # Install: cp this file to your project's scripts/ directory && chmod +x scripts/derive-release-version.sh
21
+
22
+ set -euo pipefail
23
+
24
+ SUBJECT=$(git log -1 --format='%s' 2>/dev/null || echo '')
25
+ BODY=$(git log -1 --format='%b' 2>/dev/null || echo '')
26
+
27
+ # 1. Subject: [REQ-XXX]
28
+ if echo "$SUBJECT" | grep -qE '\[REQ-[0-9]+\]'; then
29
+ echo "$SUBJECT" | grep -oE 'REQ-[0-9]+' | head -1
30
+ exit 0
31
+ fi
32
+
33
+ # 2. Body: Ref: REQ-XXX (case-insensitive on "Ref" and "REQ")
34
+ if echo "$BODY" | grep -qiE 'Ref:[[:space:]]*REQ-[0-9]+'; then
35
+ echo "$BODY" | grep -ioE 'REQ-[0-9]+' | head -1 | tr '[:lower:]' '[:upper:]'
36
+ exit 0
37
+ fi
38
+
39
+ # 3. Fallback: bare date in UTC
40
+ echo "v$(date -u +%Y.%m.%d)"
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env bash
2
+ # derive-release-version.test.sh — Tests for derive-release-version.sh.
3
+ #
4
+ # Builds a throwaway git repo per case, makes one crafted commit, runs
5
+ # the helper against it, asserts on the exact stdout. Hermetic: runs
6
+ # inside mktemp'd directories that are torn down at the end.
7
+ #
8
+ # Usage:
9
+ # ./scripts/derive-release-version.test.sh
10
+
11
+ set -euo pipefail
12
+
13
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
14
+ HELPER="$SCRIPT_DIR/derive-release-version.sh"
15
+ [ -x "$HELPER" ] || chmod +x "$HELPER"
16
+
17
+ PASS=0
18
+ FAIL=0
19
+ TODAY="v$(date -u +%Y.%m.%d)"
20
+
21
+ # Build a fresh git fixture under $1, cd into it, then commit a file
22
+ # with the message passed as $2 (multi-line OK via heredoc-style strings).
23
+ make_fixture() {
24
+ local dir="$1" msg="$2"
25
+ rm -rf "$dir"
26
+ mkdir -p "$dir"
27
+ cd "$dir"
28
+ git init -q --initial-branch=main
29
+ git config user.email "test@example.com"
30
+ git config user.name "test"
31
+ echo "x" > f.txt
32
+ git add f.txt
33
+ git commit -q -m "$msg"
34
+ }
35
+
36
+ assert_eq() {
37
+ local desc="$1" want="$2" got="$3"
38
+ if [ "$got" = "$want" ]; then
39
+ echo " PASS: $desc"
40
+ PASS=$((PASS + 1))
41
+ else
42
+ echo " FAIL: $desc"
43
+ echo " want: $want"
44
+ echo " got: $got"
45
+ FAIL=$((FAIL + 1))
46
+ fi
47
+ }
48
+
49
+ run_helper() {
50
+ bash "$HELPER"
51
+ }
52
+
53
+ WORK=$(mktemp -d)
54
+ trap 'rm -rf "$WORK"' EXIT
55
+
56
+ echo "=== derive-release-version.sh tests ==="
57
+
58
+ # Each case: build fixture in its own dir, cd in, run helper, assert.
59
+ # No subshells around the assertion so the PASS/FAIL counters update.
60
+
61
+ # Case 1: subject tag
62
+ make_fixture "$WORK/c1" "[REQ-037] feat(kitchen): inventory CRUD"
63
+ assert_eq "subject [REQ-037] -> REQ-037" "REQ-037" "$(run_helper)"
64
+
65
+ # Case 2: body ref
66
+ make_fixture "$WORK/c2" "feat(kitchen): inventory CRUD
67
+
68
+ Some details.
69
+
70
+ Ref: REQ-037"
71
+ assert_eq "body Ref: REQ-037 -> REQ-037" "REQ-037" "$(run_helper)"
72
+
73
+ # Case 3: body lowercase
74
+ make_fixture "$WORK/c3" "chore: misc cleanup
75
+
76
+ ref: req-037"
77
+ assert_eq "body lowercase ref/req normalised -> REQ-037" "REQ-037" "$(run_helper)"
78
+
79
+ # Case 4: multi-REQ subject — first wins
80
+ make_fixture "$WORK/c4" "[REQ-037][REQ-038] feat: combined feature"
81
+ assert_eq "subject [REQ-037][REQ-038] -> REQ-037 (first)" "REQ-037" "$(run_helper)"
82
+
83
+ # Case 5: subject overrides body
84
+ make_fixture "$WORK/c5" "[REQ-037] feat: subject wins
85
+
86
+ Ref: REQ-099"
87
+ assert_eq "subject overrides body conflict -> REQ-037" "REQ-037" "$(run_helper)"
88
+
89
+ # Case 6: no tag — fallback to bare date
90
+ make_fixture "$WORK/c6" "chore: bump deps"
91
+ assert_eq "no tag -> bare date $TODAY" "$TODAY" "$(run_helper)"
92
+
93
+ echo ""
94
+ echo "=== Summary: $PASS pass / $FAIL fail ==="
95
+
96
+ if [ "$FAIL" -gt 0 ]; then
97
+ exit 1
98
+ fi