@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.
- package/README.md +13 -10
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
- package/scripts/upload-evidence.sh +225 -0
- package/sdlc/.claude/settings.local.json +11 -0
- package/sdlc/CLAUDE.md +73 -0
- package/sdlc/HOST_ADAPTER.md +127 -0
- package/sdlc/SKILLS.md +137 -0
- package/sdlc/STACK_ADAPTER.md +130 -0
- package/sdlc/ai-rules/INSTRUCTIONS-SDLC.md +172 -0
- package/sdlc/ai-rules/README.md +103 -0
- package/sdlc/ai-rules/SDLC_RULES.md +584 -0
- package/sdlc/ai-rules/claude/CLAUDE.md +192 -0
- package/sdlc/ai-rules/cursor/.cursorrules +167 -0
- package/sdlc/ai-rules/windsurf/.windsurfrules +167 -0
- package/sdlc/article.md +219 -0
- package/sdlc/files/_common/0-project-setup.md +410 -0
- package/sdlc/files/_common/1-plan-requirement.md +381 -0
- package/sdlc/files/_common/2-implement-and-test.md +276 -0
- package/sdlc/files/_common/3-compile-evidence.md +603 -0
- package/sdlc/files/_common/4-submit-for-review.md +362 -0
- package/sdlc/files/_common/5-deploy-main.md +251 -0
- package/sdlc/files/_common/Periodic_Security_Review_Schedule.md +169 -0
- package/sdlc/files/_common/README_TEMPLATE.md +441 -0
- package/sdlc/files/_common/Test_Architecture.md +461 -0
- package/sdlc/files/_common/Test_Plan_TEMPLATE.md +311 -0
- package/sdlc/files/_common/Test_Policy.md +277 -0
- package/sdlc/files/_common/Test_Strategy.md +359 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/bug.yml +75 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/config.yml +11 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/requirement.yml +75 -0
- package/sdlc/files/_common/github/ISSUE_TEMPLATE/task.yml +48 -0
- package/sdlc/files/_common/github/pull_request_template.md +69 -0
- package/sdlc/files/_common/implementing-an-sdlc-issue.md +413 -0
- package/sdlc/files/_common/scripts/derive-release-version.sh +40 -0
- package/sdlc/files/_common/scripts/derive-release-version.test.sh +98 -0
- package/sdlc/files/_common/scripts/submit-for-uat-review.sh +162 -0
- package/sdlc/files/_common/scripts/validate-commits.sh +83 -0
- package/sdlc/files/_common/scripts/validate-compliance-artifacts.sh +202 -0
- package/sdlc/files/_common/scripts/validate-compliance-artifacts.test.sh +202 -0
- package/sdlc/files/_common/skills/_schema/skill.schema.json +36 -0
- package/sdlc/files/_common/skills/e2e-test-engineer/SKILL.md +254 -0
- package/sdlc/files/_common/skills/e2e-test-engineer/references/bootstrap.md +244 -0
- package/sdlc/files/_common/skills/e2e-test-engineer/references/evidence.ts +40 -0
- package/sdlc/files/_common/skills/sdlc-implementer/SKILL.md +189 -0
- package/sdlc/files/_common/skills/sdlc-implementer/references/call-graph.md +64 -0
- package/sdlc/files/_common/skills/sdlc-implementer/references/change-request-loop.md +192 -0
- package/sdlc/files/_common/skills/sdlc-implementer/references/compliance-constraints.md +81 -0
- package/sdlc/files/ci/check-release-approval.yml.template +201 -0
- package/sdlc/files/ci/ci-status-fallback.yml.template +41 -0
- package/sdlc/files/ci/ci.yml.template +390 -0
- package/sdlc/files/ci/compliance-evidence.yml.template +161 -0
- package/sdlc/files/ci/compliance-validation.yml.template +34 -0
- package/sdlc/files/ci/post-deploy-prod.yml.template +159 -0
- package/sdlc/files/ci/python/ci.yml.template +335 -0
- package/sdlc/files/hosts/_schema/adapter.schema.json +103 -0
- package/sdlc/files/hosts/railway/adapter.json +32 -0
- package/sdlc/files/sdlc-config.example.json +74 -0
- package/sdlc/files/stacks/_schema/adapter.schema.json +151 -0
- package/sdlc/files/stacks/node/adapter.json +54 -0
- package/sdlc/files/stacks/node/hooks/.prettierrc.json +9 -0
- package/sdlc/files/stacks/node/hooks/commit-msg +7 -0
- package/sdlc/files/stacks/node/hooks/commitlint.config.mjs +64 -0
- package/sdlc/files/stacks/node/hooks/lint-staged.config.mjs +16 -0
- package/sdlc/files/stacks/node/hooks/pre-commit +13 -0
- package/sdlc/files/stacks/node/hooks/pre-push +15 -0
- package/sdlc/files/stacks/node/scripts/check-requirement-jsdoc.sh +54 -0
- package/sdlc/files/stacks/python/adapter.json +36 -0
- package/sdlc/files/stacks/python/hooks/.pre-commit-config.yaml +51 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
# SDLC Compliance Rules for AI Assistants
|
|
2
|
+
|
|
3
|
+
These rules enforce the Metasession SDLC process. They MUST be followed for every code change. These rules OVERRIDE default behaviour.
|
|
4
|
+
|
|
5
|
+
## SDLC Workflow Files
|
|
6
|
+
|
|
7
|
+
This project contains detailed SDLC workflow files in its `SDLC/` directory (copied from DevAudit during project setup). **You MUST read the relevant workflow file before executing each stage.** The summaries in this document are not a substitute for the full workflow — they are guardrails. The workflow files contain exact commands, templates, checklists, and edge cases.
|
|
8
|
+
|
|
9
|
+
| Stage | File to read | When |
|
|
10
|
+
|-------|-------------|------|
|
|
11
|
+
| 0 | `SDLC/0-project-setup.md` | One-time project initialisation |
|
|
12
|
+
| 1 | `SDLC/1-plan-requirement.md` | Before implementing any tracked change |
|
|
13
|
+
| 2 | `SDLC/2-implement-and-test.md` | During coding and testing |
|
|
14
|
+
| 3 | `SDLC/3-compile-evidence.md` | After implementation, before PR |
|
|
15
|
+
| 4 | `SDLC/4-submit-for-review.md` | Creating the PR to main |
|
|
16
|
+
| 5 | `SDLC/5-deploy-main.md` | After PR approval, deploying |
|
|
17
|
+
|
|
18
|
+
Tier 1 reference docs (Test_Policy.md, Test_Strategy.md, Test_Architecture.md, Periodic_Security_Review_Schedule.md) may also be in `SDLC/` or in the DevAudit repository.
|
|
19
|
+
|
|
20
|
+
## CRITICAL: Before Writing Any Code
|
|
21
|
+
|
|
22
|
+
Before implementing ANY change (feature, fix, refactor, or enhancement), you MUST complete these checks:
|
|
23
|
+
|
|
24
|
+
### 1. Identify the GitHub Issue
|
|
25
|
+
|
|
26
|
+
Ask the user: **"Which GitHub Issue is this for?"**
|
|
27
|
+
|
|
28
|
+
- If the user provides an issue number (e.g., `#123`): fetch it with `gh issue view 123` to get context, labels, and description.
|
|
29
|
+
- If the user describes work without an issue: ask **"Is there a GitHub Issue for this, or should we create one?"** Create one with `gh issue create` if needed.
|
|
30
|
+
- If the user says it's trivial (typo, formatting, dependency bump): proceed without an issue or requirement, but still use conventional commit format.
|
|
31
|
+
|
|
32
|
+
### Creating GitHub Issues
|
|
33
|
+
|
|
34
|
+
When creating an issue via `gh issue create`, ALWAYS append the SDLC checklist to the body:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
## SDLC Checklist
|
|
38
|
+
- [ ] Requirement: RTM entry created (or confirmed trivial)
|
|
39
|
+
- [ ] Planning: test-scope.md and test-plan.md created (or confirmed trivial)
|
|
40
|
+
- [ ] Tests: existing tests reviewed, tests updated/added
|
|
41
|
+
- [ ] Gates: all pass locally (tsc, semgrep, audit, playwright)
|
|
42
|
+
- [ ] Evidence: compiled and uploaded (if tracked requirement)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Determine if this change needs a requirement
|
|
46
|
+
|
|
47
|
+
**What needs a REQ entry:**
|
|
48
|
+
- New features → always
|
|
49
|
+
- Bug fixes affecting financial data, user-facing behaviour, access control → always
|
|
50
|
+
- Bug fixes to internal logic → only if MEDIUM/HIGH risk
|
|
51
|
+
- Typos, formatting, dependency bumps → never
|
|
52
|
+
|
|
53
|
+
- If the issue is non-trivial: it needs a requirement.
|
|
54
|
+
- If a REQ-XXX already exists for this issue: verify it exists in `compliance/RTM.md` before proceeding.
|
|
55
|
+
- If no requirement exists yet: **STOP coding and run the planning workflow first** (see "Planning a Requirement" below).
|
|
56
|
+
- If the user is unsure: assume it needs a requirement if it touches security, auth, payments, user-facing features, API changes, or data handling. Use issue labels to help classify.
|
|
57
|
+
|
|
58
|
+
### For ALL Code Changes (including bug fixes)
|
|
59
|
+
|
|
60
|
+
Even if a change doesn't need a REQ entry:
|
|
61
|
+
1. **Review existing tests** that cover the changed code
|
|
62
|
+
2. **Update or add tests BEFORE committing** the fix
|
|
63
|
+
3. **Run all gates locally** — do not push without verifying no regressions
|
|
64
|
+
4. If the change affects financial calculations, user-facing data, or access control — it needs a REQ entry regardless of size
|
|
65
|
+
|
|
66
|
+
### 3. Verify the requirement is planned
|
|
67
|
+
|
|
68
|
+
Before writing code for a tracked requirement, run these checks:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
ls compliance/evidence/REQ-XXX/test-scope.md
|
|
72
|
+
ls compliance/evidence/REQ-XXX/test-plan.md
|
|
73
|
+
grep 'REQ-XXX' compliance/RTM.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
ALL must exist. If any are missing, **STOP** and tell the user: **"REQ-XXX hasn't been fully planned yet. test-scope.md and test-plan.md must both exist before implementation. Let's complete the planning step first."** Then follow "Planning a Requirement" below.
|
|
77
|
+
|
|
78
|
+
For MEDIUM/HIGH risk, also verify:
|
|
79
|
+
```bash
|
|
80
|
+
ls compliance/evidence/REQ-XXX/implementation-plan.md
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 4. Verify you're on the correct branch
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
git branch --show-current
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
All implementation work MUST happen on `develop`. If on a different branch, ask the user before switching.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Planning a Requirement
|
|
94
|
+
|
|
95
|
+
When a new requirement is needed, guide the user through these steps. Do NOT skip any.
|
|
96
|
+
|
|
97
|
+
### Step 1: Confirm the GitHub Issue
|
|
98
|
+
|
|
99
|
+
If not already identified in the pre-coding checks:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
gh issue view NNN
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If no issue exists, create one:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
gh issue create --title "[title]" --body "[description]" --label "[labels]"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use the issue title, description, and labels to inform the requirement description and risk classification below.
|
|
112
|
+
|
|
113
|
+
### Step 2: Get the next requirement ID
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
grep -oP 'REQ-\d+' compliance/RTM.md | sort -t- -k2 -n | tail -1
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The next ID is one higher.
|
|
120
|
+
|
|
121
|
+
### Step 3: Classify risk
|
|
122
|
+
|
|
123
|
+
Ask the user to classify risk, using issue labels as a starting point:
|
|
124
|
+
|
|
125
|
+
| Risk | Criteria |
|
|
126
|
+
|------|----------|
|
|
127
|
+
| LOW | Internal tools, no regulated data, no auth changes |
|
|
128
|
+
| MEDIUM | Touches PII, user-facing features, API changes, new dependencies |
|
|
129
|
+
| HIGH | Security, payments, RBAC, data handling, authentication |
|
|
130
|
+
|
|
131
|
+
Tell the user: **"If AI is generating code for MEDIUM or HIGH risk areas, the risk level is raised by one level."**
|
|
132
|
+
|
|
133
|
+
### Step 4: Add RTM entry
|
|
134
|
+
|
|
135
|
+
Add to `compliance/RTM.md` Part B. The issue provides full context; the RTM is a traceability index.
|
|
136
|
+
|
|
137
|
+
```markdown
|
|
138
|
+
| REQ-XXX | #NNN | [LOW/MEDIUM/HIGH] | compliance/evidence/REQ-XXX/ | DRAFT | -- | -- |
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Step 5: Create evidence directory
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
mkdir -p compliance/evidence/REQ-XXX
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Step 6: Implementation Plan (MEDIUM/HIGH Risk)
|
|
148
|
+
|
|
149
|
+
For MEDIUM and HIGH risk requirements, create an implementation plan **before** test scope. The implementation plan defines what code changes are needed — the test scope is then derived from it.
|
|
150
|
+
|
|
151
|
+
**Skip this for LOW risk** — proceed directly to Step 7.
|
|
152
|
+
|
|
153
|
+
1. Explore the codebase to understand existing patterns relevant to the change
|
|
154
|
+
2. Create `compliance/evidence/REQ-XXX/implementation-plan.md` with:
|
|
155
|
+
- Approach (1-3 sentences)
|
|
156
|
+
- Files to create and modify (with purpose)
|
|
157
|
+
- Architecture decisions and rationale
|
|
158
|
+
- Dependencies (new packages or "None")
|
|
159
|
+
- Risks / considerations
|
|
160
|
+
3. **WAIT CHECKPOINT:** Present the implementation plan to the developer. Do NOT proceed until the developer explicitly approves. If changes are requested, update the plan and re-present.
|
|
161
|
+
4. Commit the plan
|
|
162
|
+
|
|
163
|
+
Tell the user: **"This is MEDIUM/HIGH risk. Let me create an implementation plan before we define the test scope."**
|
|
164
|
+
|
|
165
|
+
### Step 7: Create Test Scope
|
|
166
|
+
|
|
167
|
+
Create `compliance/evidence/REQ-XXX/test-scope.md` with acceptance criteria based on risk level. For MEDIUM/HIGH risk, derive the test scope from the implementation plan — you now know what code is changing and can define what tests are needed.
|
|
168
|
+
|
|
169
|
+
Ask the user what the acceptance criteria are.
|
|
170
|
+
|
|
171
|
+
### WAIT CHECKPOINT — Test Scope Review
|
|
172
|
+
|
|
173
|
+
**Present the test scope to the developer.** Summarize the risk classification, test approach, and acceptance criteria.
|
|
174
|
+
|
|
175
|
+
**Do NOT proceed** until the developer confirms the test scope is complete and correct. If changes are requested, update `test-scope.md` and re-present.
|
|
176
|
+
|
|
177
|
+
### Step 8: Create Test Plan
|
|
178
|
+
|
|
179
|
+
Create `compliance/evidence/REQ-XXX/test-plan.md` — maps acceptance criteria to specific tests, lists tests to add/update/remove, covers functional and non-functional testing. Proportional to risk level.
|
|
180
|
+
|
|
181
|
+
**Distinguish test types by phase:**
|
|
182
|
+
- **Unit tests** (TDD — written before implementation): list under "Tests to Add" with note "(unit, TDD)"
|
|
183
|
+
- **E2E tests** (written after implementation): list under "Tests to Add" with note "(E2E, post-implementation)"
|
|
184
|
+
|
|
185
|
+
Tell the user: **"Let me create a test plan that maps the acceptance criteria to specific tests."**
|
|
186
|
+
|
|
187
|
+
### WAIT CHECKPOINT — Test Plan Review
|
|
188
|
+
|
|
189
|
+
**Present the test plan to the developer.** Summarize tests to add, update, remove, and how criteria map to tests.
|
|
190
|
+
|
|
191
|
+
**Do NOT proceed** until the developer confirms the test plan. If changes are requested, update `test-plan.md` and re-present.
|
|
192
|
+
|
|
193
|
+
### Step 9: Document AI involvement (if applicable)
|
|
194
|
+
|
|
195
|
+
Create `compliance/evidence/REQ-XXX/ai-use-note.md`:
|
|
196
|
+
|
|
197
|
+
```markdown
|
|
198
|
+
AI Tool: [tool name]
|
|
199
|
+
Risk Classification Impact: [original risk] → [adjusted risk if AI involved]
|
|
200
|
+
Areas of AI involvement: [list]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Step 10: Commit the plan
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
git add compliance/RTM.md compliance/evidence/REQ-XXX/
|
|
207
|
+
git commit -m "compliance: [REQ-XXX] define requirement and test scope - [description]
|
|
208
|
+
|
|
209
|
+
Ref: REQ-XXX
|
|
210
|
+
|
|
211
|
+
Co-Authored-By: [AI tool tag]"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Only after this commit should implementation begin.**
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
git add compliance/evidence/REQ-XXX/implementation-plan.md
|
|
218
|
+
git commit -m "chore(compliance): [REQ-XXX] implementation plan
|
|
219
|
+
|
|
220
|
+
Ref: REQ-XXX
|
|
221
|
+
|
|
222
|
+
Co-Authored-By: [AI tool tag]"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## During Implementation
|
|
228
|
+
|
|
229
|
+
### Commit format
|
|
230
|
+
|
|
231
|
+
Every commit MUST follow this format:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
type(scope): description
|
|
235
|
+
|
|
236
|
+
- Key change 1
|
|
237
|
+
- Key change 2
|
|
238
|
+
|
|
239
|
+
Ref: REQ-XXX
|
|
240
|
+
|
|
241
|
+
Co-Authored-By: [AI tool] <noreply@provider.com>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
- `type`: feat, fix, refactor, test, docs, compliance
|
|
245
|
+
- `Ref: REQ-XXX` is REQUIRED for tracked changes
|
|
246
|
+
- `Co-Authored-By` is REQUIRED when AI generates code
|
|
247
|
+
|
|
248
|
+
### JSDoc headers
|
|
249
|
+
|
|
250
|
+
Every new or significantly modified file must include:
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
/**
|
|
254
|
+
* @requirement REQ-XXX - Brief description
|
|
255
|
+
*/
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### AI-generated code logging
|
|
259
|
+
|
|
260
|
+
When generating code for MEDIUM or HIGH risk requirements, append to `compliance/evidence/REQ-XXX/ai-prompts.md`:
|
|
261
|
+
|
|
262
|
+
```markdown
|
|
263
|
+
## [Date]
|
|
264
|
+
Prompt: [summary of what was asked]
|
|
265
|
+
Files: [list of files generated/modified]
|
|
266
|
+
Regenerated: [yes/no — if yes, full retest required]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**MEDIUM/HIGH risk checkpoint:** Before committing AI-generated code, verify `ai-prompts.md` has been updated. This is a required artifact — if missing, create it before staging.
|
|
270
|
+
|
|
271
|
+
### Test review and update
|
|
272
|
+
|
|
273
|
+
Before staging changes, review the test suite to ensure it covers the implementation:
|
|
274
|
+
|
|
275
|
+
1. **Follow the test plan:** Check `compliance/evidence/REQ-XXX/test-plan.md` — add, update, and remove tests as documented.
|
|
276
|
+
2. **Write new tests:** New pages need route protection tests. New API endpoints need auth enforcement tests. New user flows need E2E tests. New business logic needs unit tests.
|
|
277
|
+
3. **Verify test plan coverage:** Are all items in the test plan implemented? Do all acceptance criteria have a corresponding test?
|
|
278
|
+
|
|
279
|
+
Tell the user: **"Before staging, let me review the test suite to make sure it covers the changes we just made."**
|
|
280
|
+
|
|
281
|
+
Gates must run against a test suite that actually covers the new code. A green gate on an unchanged test suite is a false signal.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Before Pushing Code
|
|
286
|
+
|
|
287
|
+
Before pushing to `develop`, ALL of these gates must pass:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# TypeScript — 0 errors required
|
|
291
|
+
npx tsc --noEmit
|
|
292
|
+
|
|
293
|
+
# SAST — 0 high/critical findings required
|
|
294
|
+
semgrep scan --config auto src/ --severity ERROR --severity WARNING
|
|
295
|
+
|
|
296
|
+
# Dependency audit — 0 high/critical vulnerabilities required
|
|
297
|
+
npm audit --audit-level=high
|
|
298
|
+
|
|
299
|
+
# E2E tests — all must pass
|
|
300
|
+
npx playwright test
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
If any gate fails, fix the issue before pushing. Do NOT use `--no-verify` to skip hooks.
|
|
304
|
+
|
|
305
|
+
Tell the user: **"All four compliance gates must pass before pushing. Let me run them."**
|
|
306
|
+
|
|
307
|
+
### Verify test plan tests are written and passing
|
|
308
|
+
|
|
309
|
+
For tracked requirements, before pushing verify that every test listed in `test-plan.md` has been implemented:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Check that test files referenced in the test plan exist
|
|
313
|
+
grep -oP '(?:__tests__/|tests?/|e2e/|spec/|\.test\.|\.spec\.)\S+' compliance/evidence/REQ-XXX/test-plan.md
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
For each test file referenced in `test-plan.md`:
|
|
317
|
+
1. Verify the file exists in the working tree
|
|
318
|
+
2. Verify the tests pass (covered by the gate commands above)
|
|
319
|
+
|
|
320
|
+
If `test-plan.md` lists tests that haven't been written yet, **STOP** — write and run the tests before pushing. A green gate on an unchanged test suite is a false signal.
|
|
321
|
+
|
|
322
|
+
Tell the user: **"Before pushing, let me verify that all tests from the test plan have been written and are passing."**
|
|
323
|
+
|
|
324
|
+
### After Pushing: WAIT CHECKPOINT — Confirm CI Green
|
|
325
|
+
|
|
326
|
+
After pushing to `develop`, wait for CI to complete:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
gh run list --branch develop --limit 1
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Do NOT proceed** to evidence compilation or PR creation until CI is green. If CI fails, diagnose, fix locally, re-run gates, and push again.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## After Implementation is Complete
|
|
337
|
+
|
|
338
|
+
When the user says implementation is done, or when all acceptance criteria from test-scope.md are met, guide them through evidence compilation:
|
|
339
|
+
|
|
340
|
+
### Step 1: Verify all gates pass (run them again)
|
|
341
|
+
|
|
342
|
+
### Step 1a: Generate test execution summary
|
|
343
|
+
|
|
344
|
+
After gates pass, create `compliance/evidence/REQ-XXX/test-execution-summary.md` documenting gate results, test changes, and coverage against the test plan. Include links to evidence locations in DevAudit.
|
|
345
|
+
|
|
346
|
+
Tell the user: **"All gates passed. Let me generate the test execution summary."**
|
|
347
|
+
|
|
348
|
+
### Step 2: Upload binary/JSON evidence to DevAudit
|
|
349
|
+
|
|
350
|
+
**Markdown stays in git. Binary and JSON evidence goes to DevAudit.**
|
|
351
|
+
|
|
352
|
+
Upload these to DevAudit (NEVER commit to git):
|
|
353
|
+
- E2E results (JSON)
|
|
354
|
+
- Screenshots (PNG/JPG)
|
|
355
|
+
- SAST results (JSON)
|
|
356
|
+
- Dependency audit results (JSON)
|
|
357
|
+
- Unit test output (TXT)
|
|
358
|
+
- Test reports (HTML)
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
# Upload E2E results
|
|
362
|
+
./scripts/upload-evidence.sh [PROJECT_SLUG] REQ-XXX e2e_result /tmp/e2e-results.json
|
|
363
|
+
|
|
364
|
+
# Upload SAST results
|
|
365
|
+
semgrep scan --config auto src/ --json > /tmp/sast-results.json
|
|
366
|
+
./scripts/upload-evidence.sh [PROJECT_SLUG] REQ-XXX audit_log /tmp/sast-results.json
|
|
367
|
+
|
|
368
|
+
# Upload dependency audit
|
|
369
|
+
npm audit --json > /tmp/dependency-audit.json
|
|
370
|
+
./scripts/upload-evidence.sh [PROJECT_SLUG] REQ-XXX audit_log /tmp/dependency-audit.json
|
|
371
|
+
|
|
372
|
+
# Upload unit test output
|
|
373
|
+
npm test -- --verbose 2>&1 | tee /tmp/unit-test-results.txt
|
|
374
|
+
./scripts/upload-evidence.sh [PROJECT_SLUG] REQ-XXX test_report /tmp/unit-test-results.txt
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
The upload script is from the DevAudit repository at `scripts/upload-evidence.sh`.
|
|
378
|
+
|
|
379
|
+
### Step 3: Create markdown evidence in git
|
|
380
|
+
|
|
381
|
+
These stay in git (small, reviewable, need version history):
|
|
382
|
+
|
|
383
|
+
Create `compliance/evidence/REQ-XXX/security-summary.md`:
|
|
384
|
+
|
|
385
|
+
```markdown
|
|
386
|
+
SAST scan: 0 findings
|
|
387
|
+
Dependency audit: 0 vulnerabilities
|
|
388
|
+
Evidence uploaded to DevAudit project: [PROJECT_SLUG]
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Verify these also exist in git:
|
|
392
|
+
- `compliance/evidence/REQ-XXX/test-scope.md` (from planning)
|
|
393
|
+
- `compliance/evidence/REQ-XXX/implementation-plan.md` (MEDIUM/HIGH risk — from implementation plan step)
|
|
394
|
+
- `compliance/evidence/REQ-XXX/ai-use-note.md` (if AI was used)
|
|
395
|
+
- `compliance/evidence/REQ-XXX/ai-prompts.md` (if AI was used, MEDIUM/HIGH risk)
|
|
396
|
+
|
|
397
|
+
### Step 4: Update RTM status
|
|
398
|
+
|
|
399
|
+
Change the requirement status from `DRAFT` or `IN PROGRESS` to `TESTED - PENDING SIGN-OFF` in `compliance/RTM.md`.
|
|
400
|
+
|
|
401
|
+
### Step 5: Create release ticket
|
|
402
|
+
|
|
403
|
+
Create `compliance/pending-releases/RELEASE-TICKET-REQ-XXX.md` with:
|
|
404
|
+
- Summary of changes
|
|
405
|
+
- Test changes (which test files were added/modified, what they cover, any gaps)
|
|
406
|
+
- Test evidence table (reference DevAudit portal for binary evidence)
|
|
407
|
+
- Security evidence (reference `security-summary.md` in git)
|
|
408
|
+
- AI involvement summary
|
|
409
|
+
- Post-deploy actions (data migrations, backfill scripts, or "None required")
|
|
410
|
+
- Audit trail
|
|
411
|
+
|
|
412
|
+
When creating the PR, include:
|
|
413
|
+
- A **"Test Changes"** section listing test files added/modified, what they cover, and what's NOT covered
|
|
414
|
+
- A **"Where to Find Test Results"** section pointing reviewers to: CI status icons on commits, automated E2E comment, DevAudit portal link, and compliance evidence files in the PR
|
|
415
|
+
|
|
416
|
+
### Step 6: Commit compliance markdown only (do NOT push yet)
|
|
417
|
+
|
|
418
|
+
Commit locally but **do not push**. UAT verification runs against the prior deployment. We batch all compliance + UAT commits into a single push after Step 7 to avoid duplicate CI runs.
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
# ONLY commit markdown — binary/JSON evidence is in DevAudit
|
|
422
|
+
git add compliance/RTM.md \
|
|
423
|
+
compliance/pending-releases/RELEASE-TICKET-REQ-XXX.md \
|
|
424
|
+
compliance/evidence/REQ-XXX/test-scope.md \
|
|
425
|
+
compliance/evidence/REQ-XXX/test-plan.md \
|
|
426
|
+
compliance/evidence/REQ-XXX/implementation-plan.md \
|
|
427
|
+
compliance/evidence/REQ-XXX/test-execution-summary.md \
|
|
428
|
+
compliance/evidence/REQ-XXX/security-summary.md \
|
|
429
|
+
compliance/evidence/REQ-XXX/ai-use-note.md \
|
|
430
|
+
compliance/evidence/REQ-XXX/ai-prompts.md
|
|
431
|
+
git commit -m "compliance: [REQ-XXX] evidence compiled - awaiting review
|
|
432
|
+
|
|
433
|
+
Ref: REQ-XXX
|
|
434
|
+
|
|
435
|
+
Co-Authored-By: [AI tool tag]"
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**NEVER `git add` JSON, TXT, HTML, PNG, or JPG evidence files. They belong in DevAudit.**
|
|
439
|
+
|
|
440
|
+
### Step 7: WAIT CHECKPOINT — UAT Verification (if UAT configured)
|
|
441
|
+
|
|
442
|
+
If the project has a UAT environment that auto-deploys from `develop`, verify the change works on UAT before creating a PR.
|
|
443
|
+
|
|
444
|
+
**First, confirm both CI and deployment are complete:**
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
gh run list --branch develop --limit 1 # CI must be green
|
|
448
|
+
curl -s [UAT_URL]/[HEALTH_ENDPOINT] # Deployment must be live
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Do NOT test against a stale deployment.** Then:
|
|
452
|
+
|
|
453
|
+
1. Wait for UAT deployment to complete
|
|
454
|
+
2. Run health check against UAT URL
|
|
455
|
+
3. Run smoke test (homepage, key endpoint)
|
|
456
|
+
4. Manually verify the specific feature/fix works on UAT
|
|
457
|
+
5. Record results in `compliance/evidence/REQ-XXX/security-summary.md`
|
|
458
|
+
|
|
459
|
+
```bash
|
|
460
|
+
cat >> compliance/evidence/REQ-XXX/security-summary.md << EOF
|
|
461
|
+
|
|
462
|
+
## UAT Verification — $(date -I)
|
|
463
|
+
- UAT Health check: PASS
|
|
464
|
+
- UAT Smoke test: PASS
|
|
465
|
+
- Feature verification: PASS — [what was verified]
|
|
466
|
+
- UAT URL: [UAT_URL]
|
|
467
|
+
EOF
|
|
468
|
+
|
|
469
|
+
git add compliance/evidence/REQ-XXX/security-summary.md
|
|
470
|
+
git commit -m "compliance: [REQ-XXX] UAT verification passed
|
|
471
|
+
|
|
472
|
+
Ref: REQ-XXX
|
|
473
|
+
|
|
474
|
+
Co-Authored-By: [AI tool tag]"
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**If UAT fails:** Fix on `develop`, re-run local gates, push, and repeat. Do NOT create a PR until UAT is green.
|
|
478
|
+
|
|
479
|
+
### Step 8: Push all compliance commits
|
|
480
|
+
|
|
481
|
+
Push all batched commits (evidence + UAT results) in a single push. This triggers one CI run instead of multiple.
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
git push origin develop
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Tell the user: **"UAT verification passed. Compliance commits pushed. Next step: create a PR from develop to main."**
|
|
488
|
+
|
|
489
|
+
### Step 9: Verify release exists in DevAudit
|
|
490
|
+
|
|
491
|
+
CI auto-creates releases when uploading evidence (using `--create-release-if-missing`). After pushing, verify the release appears in DevAudit:
|
|
492
|
+
|
|
493
|
+
1. Navigate to the project's Releases page in DevAudit
|
|
494
|
+
2. Confirm a release exists with the current version (date-based: `v{YYYY}.{MM}.{DD}` or `v{YYYY}.{MM}.{DD}.{N}` for multiple releases on the same day)
|
|
495
|
+
3. Confirm evidence is linked to the release (not orphaned)
|
|
496
|
+
|
|
497
|
+
If no release exists, CI may not have the `upload-evidence` job configured. See `SDLC/3-compile-evidence.md` CI Integration section.
|
|
498
|
+
|
|
499
|
+
### Step 10: Tell the user what's next
|
|
500
|
+
|
|
501
|
+
**"Evidence is compiled. Markdown artifacts are in git, binary evidence is in DevAudit. Release created and evidence linked. UAT verified. Next step: create a PR from develop to main using the submit-for-review workflow."**
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## After Deployment: Close the GitHub Issue
|
|
506
|
+
|
|
507
|
+
After the PR is merged, production is verified, and compliance artifacts are finalized, close the GitHub Issue:
|
|
508
|
+
|
|
509
|
+
```bash
|
|
510
|
+
gh issue close [ISSUE-NUMBER] --comment "Implemented in PR #[PR-NUMBER] (REQ-XXX). [Brief summary]."
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
This completes the traceability chain: **Issue → Requirement → PR → Deployment → Issue closed.**
|
|
514
|
+
|
|
515
|
+
Tell the user: **"REQ-XXX is complete. Let me close the GitHub Issue."**
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## Review Policy (Risk-Tiered)
|
|
520
|
+
|
|
521
|
+
Review requirements are determined by the risk classification in the RTM:
|
|
522
|
+
|
|
523
|
+
- **LOW risk:** CI provides independent verification. Self-merge is permitted after all CI checks pass.
|
|
524
|
+
- **MEDIUM/HIGH risk:** A second human reviewer MUST approve before merge. Self-merge is NOT permitted.
|
|
525
|
+
|
|
526
|
+
When creating a PR, check the risk level of the requirement(s) included. If any requirement is MEDIUM or HIGH, the entire PR requires a second reviewer. This satisfies separation of duties requirements (ISO 27001 A.5.3, SOC 2 CC6.1/CC8.1) where they apply, while avoiding unnecessary bottlenecks on low-risk changes.
|
|
527
|
+
|
|
528
|
+
Tell the user: **"This PR includes [RISK LEVEL] requirements. [A second reviewer is required / Self-merge is permitted after CI passes]."**
|
|
529
|
+
|
|
530
|
+
## Pre-Flight Checklist (Before Creating PR)
|
|
531
|
+
|
|
532
|
+
**Do NOT create the PR until ready to merge.** Every push to `develop` while a PR is open triggers duplicate CI runs (quality gates + UAT approval check). The PR is the merge request, not the development workspace. Develop on `develop`, iterate until ready, then create the PR as the final step before merge.
|
|
533
|
+
|
|
534
|
+
Before creating a PR from `develop` to `main`, verify ALL of the following:
|
|
535
|
+
|
|
536
|
+
**Pipeline state:**
|
|
537
|
+
- [ ] All development and iteration is complete
|
|
538
|
+
- [ ] Latest CI run on `develop` is green (not stale, not cancelled)
|
|
539
|
+
- [ ] Working tree is clean
|
|
540
|
+
- [ ] UAT verification passed (if configured)
|
|
541
|
+
- [ ] DevAudit UAT approval granted
|
|
542
|
+
|
|
543
|
+
**For tracked requirements (REQ-XXX):**
|
|
544
|
+
- [ ] `compliance/evidence/REQ-XXX/test-scope.md` exists and all items addressed
|
|
545
|
+
- [ ] `compliance/evidence/REQ-XXX/implementation-plan.md` exists (MEDIUM/HIGH risk)
|
|
546
|
+
- [ ] `compliance/evidence/REQ-XXX/ai-prompts.md` exists (MEDIUM/HIGH risk with AI)
|
|
547
|
+
- [ ] RTM status is `TESTED - PENDING SIGN-OFF`
|
|
548
|
+
- [ ] Release ticket exists in `compliance/pending-releases/`
|
|
549
|
+
- [ ] Evidence uploaded to DevAudit
|
|
550
|
+
|
|
551
|
+
If any item fails, resolve it before proceeding.
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
## Enforcement Layers
|
|
556
|
+
|
|
557
|
+
The SDLC is enforced at three levels:
|
|
558
|
+
|
|
559
|
+
| Layer | Mechanism | What It Catches |
|
|
560
|
+
|-------|-----------|-----------------|
|
|
561
|
+
| **Local hooks** | Husky + commitlint (commit-msg, pre-commit, pre-push) | Commit format, lint errors, TypeScript errors before push |
|
|
562
|
+
| **AI enforcement** | These rules + WAIT checkpoints in workflow files | Process sequencing, artifact existence, planning before coding |
|
|
563
|
+
| **CI hard gates** | GitHub Actions required status checks | TypeScript, SAST, dependencies, E2E, compliance artifact validation, commit conventions |
|
|
564
|
+
|
|
565
|
+
Local hooks and AI enforcement are the first line of defense. CI is the backstop — if something slips through locally, CI catches it on the PR.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## Rules You Must NEVER Break
|
|
570
|
+
|
|
571
|
+
1. **NEVER implement a tracked change without a GitHub Issue and requirement entry in RTM.md** — issue first, plan second, code third.
|
|
572
|
+
2. **NEVER commit without running all four gates** (TypeScript, SAST, dependency audit, E2E).
|
|
573
|
+
3. **NEVER self-merge a MEDIUM or HIGH risk PR** — a second human reviewer MUST approve before merge.
|
|
574
|
+
4. **NEVER use `--no-verify`** to skip git hooks.
|
|
575
|
+
5. **NEVER commit secrets** (.env, credentials, API keys) — warn the user if you detect them staged.
|
|
576
|
+
6. **NEVER create a PR to `main` without UAT verification passing first** (if UAT environment is configured).
|
|
577
|
+
7. **NEVER push directly to `main`** — all changes go through `develop` → PR → `main`.
|
|
578
|
+
8. **NEVER skip the `Co-Authored-By` tag** when AI generates code.
|
|
579
|
+
9. **NEVER amend published commits** — create new commits to preserve audit trail.
|
|
580
|
+
10. **NEVER commit binary or JSON evidence to git** (JSON, TXT, HTML, PNG, JPG) — upload to DevAudit portal instead.
|
|
581
|
+
11. **ALWAYS ask which GitHub Issue a change is for** before writing code.
|
|
582
|
+
12. **ALWAYS create evidence artifacts** before marking work as complete.
|
|
583
|
+
13. **ALWAYS use merge commits** (not squash) for `develop` → `main` to preserve audit history.
|
|
584
|
+
14. **ALWAYS commit compliance markdown to git** (RTM, test-scope, implementation-plan, security-summary, ai-use-note, release tickets).
|