sdlc-framework 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +321 -0
  3. package/bin/install.js +193 -0
  4. package/package.json +39 -0
  5. package/src/commands/close.md +200 -0
  6. package/src/commands/debug.md +124 -0
  7. package/src/commands/fast.md +149 -0
  8. package/src/commands/fix.md +104 -0
  9. package/src/commands/help.md +144 -0
  10. package/src/commands/hotfix.md +99 -0
  11. package/src/commands/impl.md +142 -0
  12. package/src/commands/init.md +93 -0
  13. package/src/commands/milestone.md +136 -0
  14. package/src/commands/pause.md +115 -0
  15. package/src/commands/research.md +136 -0
  16. package/src/commands/resume.md +103 -0
  17. package/src/commands/review.md +195 -0
  18. package/src/commands/spec.md +164 -0
  19. package/src/commands/status.md +118 -0
  20. package/src/commands/verify.md +153 -0
  21. package/src/references/clarification-strategy.md +352 -0
  22. package/src/references/engineering-laws.md +374 -0
  23. package/src/references/loop-phases.md +331 -0
  24. package/src/references/playwright-testing.md +298 -0
  25. package/src/references/prompt-detection.md +264 -0
  26. package/src/references/sub-agent-strategy.md +260 -0
  27. package/src/rules/commands.md +180 -0
  28. package/src/rules/style.md +354 -0
  29. package/src/rules/templates.md +238 -0
  30. package/src/rules/workflows.md +314 -0
  31. package/src/templates/HANDOFF.md +121 -0
  32. package/src/templates/LAWS.md +521 -0
  33. package/src/templates/PROJECT.md +112 -0
  34. package/src/templates/REVIEW.md +145 -0
  35. package/src/templates/ROADMAP.md +101 -0
  36. package/src/templates/SPEC.md +231 -0
  37. package/src/templates/STATE.md +106 -0
  38. package/src/templates/SUMMARY.md +126 -0
  39. package/src/workflows/close-phase.md +189 -0
  40. package/src/workflows/debug-flow.md +302 -0
  41. package/src/workflows/fast-forward.md +340 -0
  42. package/src/workflows/fix-findings.md +235 -0
  43. package/src/workflows/hotfix-flow.md +190 -0
  44. package/src/workflows/impl-phase.md +229 -0
  45. package/src/workflows/init-project.md +249 -0
  46. package/src/workflows/milestone-management.md +169 -0
  47. package/src/workflows/pause-work.md +153 -0
  48. package/src/workflows/research.md +219 -0
  49. package/src/workflows/resume-project.md +159 -0
  50. package/src/workflows/review-phase.md +337 -0
  51. package/src/workflows/spec-phase.md +379 -0
  52. package/src/workflows/transition-phase.md +203 -0
  53. package/src/workflows/verify-phase.md +280 -0
@@ -0,0 +1,280 @@
1
+ <purpose>Verify every acceptance criterion from the spec using automated testing. UI interactions use Playwright MCP, API endpoints use HTTP requests, business logic uses the project test suite. Every AC gets a PASS or FAIL with evidence.</purpose>
2
+ <when_to_use>Run after /sdlc:impl completes. STATE.md must show loop_position = IMPL ✓ and next_required_action = /sdlc:verify.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, the current SPEC.md (for acceptance criteria), .sdlc/PROJECT.md (for tech stack and test commands)</required_reading>
4
+ <loop_context>
5
+ expected_phase: VERIFY (active)
6
+ prior_phase: IMPL ✓
7
+ next_phase: REVIEW
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="validate_state" priority="first">
12
+ Read .sdlc/STATE.md.
13
+
14
+ CHECK: loop_position must be "IMPL ✓"
15
+ CHECK: next_required_action must be "/sdlc:verify"
16
+
17
+ IF EITHER CHECK FAILS: STOP. Display: "Cannot verify. State requires: {next_required_action}. Run that first."
18
+
19
+ Extract current_phase and current_plan from STATE.md.
20
+
21
+ WHY: Verifying before implementation is done means testing incomplete code. The results would be meaningless.
22
+ </step>
23
+
24
+ <step name="load_acceptance_criteria" priority="second">
25
+ Read the SPEC.md at .sdlc/phases/{current_phase}/{current_plan}-SPEC.md.
26
+
27
+ Extract every acceptance criterion. Parse each into:
28
+ - AC number (e.g., AC-1)
29
+ - Description (short summary)
30
+ - GIVEN (precondition)
31
+ - WHEN (action)
32
+ - THEN (expected outcome)
33
+
34
+ Count total ACs. This is the denominator for the pass rate.
35
+
36
+ IF NO ACs FOUND: STOP. Display: "Spec has no acceptance criteria. Run /sdlc:spec to add them."
37
+
38
+ WHY: Without acceptance criteria, there is nothing to verify. The spec must define what "done" looks like.
39
+ </step>
40
+
41
+ <step name="classify_acceptance_criteria" priority="third">
42
+ For each AC, classify its verification type based on the GIVEN/WHEN/THEN content:
43
+
44
+ TYPE: UI_INTERACTION
45
+ Indicators: mentions page, form, button, click, navigate, display, render, modal, input field, dropdown
46
+ Method: Playwright MCP (browser_navigate, browser_snapshot, browser_click, browser_fill_form, etc.)
47
+
48
+ TYPE: API_ENDPOINT
49
+ Indicators: mentions endpoint, request, response, status code, JSON body, header, GET/POST/PUT/DELETE
50
+ Method: Bash curl commands
51
+
52
+ TYPE: CLI_BEHAVIOR
53
+ Indicators: mentions command, terminal, output, exit code, stderr, stdout, flag, argument
54
+ Method: Bash command execution
55
+
56
+ TYPE: BUSINESS_LOGIC
57
+ Indicators: mentions function, method, returns, throws, calculates, transforms, validates
58
+ Method: Run project test suite (npm test, bun test, etc.) or execute specific test files
59
+
60
+ TYPE: DATA_INTEGRITY
61
+ Indicators: mentions database, record, row, column, migration, schema, constraint
62
+ Method: Database queries via Bash or ORM commands
63
+
64
+ Present classification to proceed:
65
+ ```
66
+ AC Classification:
67
+ AC-1: {description} → UI_INTERACTION (Playwright)
68
+ AC-2: {description} → API_ENDPOINT (curl)
69
+ AC-3: {description} → BUSINESS_LOGIC (test suite)
70
+ ```
71
+
72
+ WHY: Different AC types need different verification tools. Using curl for a UI test or Playwright for a unit test wastes time and gives unreliable results.
73
+ </step>
74
+
75
+ <step name="verify_ui_interactions" priority="fourth">
76
+ FOR EACH AC classified as UI_INTERACTION:
77
+
78
+ A. SET UP PRECONDITION (GIVEN):
79
+ - Use browser_navigate to go to the relevant page
80
+ - Use browser_snapshot to capture initial state
81
+ - Verify the GIVEN condition is met in the snapshot
82
+ - If the GIVEN requires data setup (e.g., "a registered user"), run setup commands first via Bash
83
+
84
+ B. EXECUTE ACTION (WHEN):
85
+ Translate the WHEN clause into Playwright MCP actions:
86
+ - "clicks the submit button" → browser_click with the button selector
87
+ - "fills in the email field" → browser_fill_form with field and value
88
+ - "selects 'Admin' from the role dropdown" → browser_select_option
89
+ - "presses Enter" → browser_press_key with "Enter"
90
+ - "hovers over the menu" → browser_hover with the menu selector
91
+ - "uploads a file" → browser_file_upload
92
+
93
+ Use browser_snapshot BEFORE the action to confirm the element exists.
94
+ If the element is not found in the snapshot, record FAIL: "Element not found: {selector}"
95
+
96
+ C. VERIFY OUTCOME (THEN):
97
+ - Use browser_snapshot AFTER the action
98
+ - Use browser_take_screenshot for visual evidence
99
+ - Check the snapshot content against the THEN clause:
100
+ - "displays a success message" → search snapshot for the message text
101
+ - "redirects to /dashboard" → check the current URL in snapshot
102
+ - "shows 3 items in the list" → count matching elements in snapshot
103
+ - "hides the modal" → verify modal is absent from snapshot
104
+
105
+ D. RECORD RESULT:
106
+ ```
107
+ AC-{N}: {description}
108
+ Status: PASS | FAIL
109
+ Evidence: {what was observed}
110
+ Screenshot: {if taken}
111
+ ```
112
+
113
+ IF AN ACTION FAILS (element not found, page error, timeout):
114
+ - Record FAIL with the specific error
115
+ - Use browser_console_messages to check for JavaScript errors
116
+ - Include console errors in the evidence
117
+ - Continue to next AC (do not stop on first failure)
118
+
119
+ WHY: Playwright MCP replaces manual UAT. Every UI acceptance criterion gets tested programmatically with screenshot evidence, making verification reproducible and auditable.
120
+ </step>
121
+
122
+ <step name="verify_api_endpoints" priority="fifth">
123
+ FOR EACH AC classified as API_ENDPOINT:
124
+
125
+ A. SET UP PRECONDITION (GIVEN):
126
+ - Run any required setup commands (seed data, create test user, etc.)
127
+ - If GIVEN mentions authentication, obtain a token first
128
+
129
+ B. EXECUTE REQUEST (WHEN):
130
+ Translate the WHEN clause into a curl command:
131
+ ```bash
132
+ curl -s -w "\n%{http_code}" \
133
+ -X {METHOD} \
134
+ -H "Content-Type: application/json" \
135
+ -H "Authorization: Bearer {token}" \
136
+ -d '{request_body}' \
137
+ {base_url}{endpoint}
138
+ ```
139
+
140
+ Capture both response body and status code.
141
+
142
+ C. VERIFY RESPONSE (THEN):
143
+ Check each assertion in the THEN clause:
144
+ - "returns status 200" → compare HTTP status code
145
+ - "response contains { 'token': ... }" → parse JSON and check field existence
146
+ - "response body is an array of 3 items" → parse JSON and check array length
147
+ - "returns error message 'Not found'" → check response body contains string
148
+ - "sets cookie 'session'" → check response headers
149
+
150
+ D. RECORD RESULT:
151
+ ```
152
+ AC-{N}: {description}
153
+ Status: PASS | FAIL
154
+ Evidence: HTTP {status}, Body: {truncated response}
155
+ ```
156
+
157
+ WHY: API tests are fast and deterministic. They verify the contract between frontend and backend without browser overhead.
158
+ </step>
159
+
160
+ <step name="verify_cli_behavior" priority="sixth">
161
+ FOR EACH AC classified as CLI_BEHAVIOR:
162
+
163
+ A. SET UP PRECONDITION (GIVEN):
164
+ - Create any required files, directories, or environment state
165
+
166
+ B. EXECUTE COMMAND (WHEN):
167
+ Run the command via Bash. Capture:
168
+ - stdout
169
+ - stderr
170
+ - exit code
171
+
172
+ C. VERIFY OUTPUT (THEN):
173
+ Check each assertion:
174
+ - "outputs 'Success'" → check stdout contains string
175
+ - "exits with code 0" → check exit code
176
+ - "creates file X" → check file exists
177
+ - "prints error to stderr" → check stderr content
178
+
179
+ D. RECORD RESULT with stdout/stderr as evidence.
180
+
181
+ WHY: CLI tools are verified by running them. The evidence is the actual terminal output.
182
+ </step>
183
+
184
+ <step name="verify_business_logic" priority="seventh">
185
+ FOR EACH AC classified as BUSINESS_LOGIC:
186
+
187
+ A. CHECK IF TESTS EXIST:
188
+ Search for test files related to the AC (look for files matching *.test.ts, *.spec.ts, *.test.js, etc.)
189
+
190
+ B. IF TESTS EXIST:
191
+ Run the specific test file or test suite:
192
+ - npm test -- {test-file} (or bun test, vitest, jest, etc.)
193
+ - Capture output: pass/fail count, error messages
194
+
195
+ C. IF TESTS DO NOT EXIST:
196
+ Record FAIL: "No test file found for AC-{N}. Implementation must include tests per engineering laws."
197
+
198
+ D. CHECK COVERAGE (if tool available):
199
+ Run coverage report. Check that modified files have adequate coverage.
200
+
201
+ E. RECORD RESULT:
202
+ ```
203
+ AC-{N}: {description}
204
+ Status: PASS | FAIL
205
+ Evidence: {test output — pass count, fail count, error messages}
206
+ Coverage: {percentage for relevant files, if available}
207
+ ```
208
+
209
+ WHY: Business logic tests are the fastest feedback loop. They catch logic errors without needing a running server or browser.
210
+ </step>
211
+
212
+ <step name="generate_verification_report" priority="eighth">
213
+ Compile all results into a verification report.
214
+
215
+ Calculate:
216
+ - Total ACs: {N}
217
+ - Passed: {N}
218
+ - Failed: {N}
219
+ - Pass rate: {percentage}
220
+
221
+ Build the report table:
222
+ ```
223
+ | AC | Description | Type | Status | Evidence |
224
+ |----|-------------|------|--------|----------|
225
+ | AC-1 | {desc} | UI | PASS | Screenshot shows success message |
226
+ | AC-2 | {desc} | API | FAIL | Expected 200, got 404 |
227
+ | AC-3 | {desc} | Logic | PASS | 5/5 tests passed |
228
+ ```
229
+
230
+ Save report to: .sdlc/phases/{current_phase}/{current_plan}-VERIFY.md
231
+
232
+ WHY: The report is the evidence trail. During review and close, we can point to specific pass/fail results. Without evidence, "it works" is just an opinion.
233
+ </step>
234
+
235
+ <step name="handle_results" priority="ninth">
236
+ IF ALL ACs PASS (pass rate = 100%):
237
+ Update .sdlc/STATE.md:
238
+ - loop_position: VERIFY ✓
239
+ - next_required_action: /sdlc:review
240
+ - Add history entry: "{timestamp} | verify | All {N} ACs passed"
241
+
242
+ Display:
243
+ ```
244
+ Verification PASSED: {N}/{N} acceptance criteria met.
245
+
246
+ Report: .sdlc/phases/{phase}/{plan}-VERIFY.md
247
+
248
+ NEXT ACTION REQUIRED: /sdlc:review
249
+ Run /sdlc:review for engineering laws compliance check.
250
+ ```
251
+
252
+ IF ANY AC FAILS:
253
+ Do NOT update loop_position. Keep it at "IMPL ✓".
254
+ Update next_required_action to "/sdlc:verify" (stay in verify).
255
+
256
+ Display:
257
+ ```
258
+ Verification FAILED: {passed}/{total} acceptance criteria met.
259
+
260
+ Failed ACs:
261
+ - AC-{N}: {description} — {evidence}
262
+ - AC-{N}: {description} — {evidence}
263
+
264
+ Fix suggestions:
265
+ - AC-{N}: {specific suggestion based on the failure}
266
+
267
+ Fix the failures and re-run /sdlc:verify.
268
+ If the spec is wrong (not the code), run /sdlc:spec to update it.
269
+ ```
270
+
271
+ Provide SPECIFIC fix suggestions for each failure:
272
+ - If HTTP 404 → "Check that the route is registered. Look for typos in the endpoint path."
273
+ - If element not found → "Check that the selector matches the actual DOM. Use browser_snapshot to inspect."
274
+ - If test fails → "Read the test output carefully. The assertion on line {N} expected {X} but got {Y}."
275
+ - If no tests exist → "Create test file at {path}. Use existing test patterns from {similar file}."
276
+
277
+ WHY: Failing fast with specific guidance prevents the user from wasting time guessing what went wrong. Staying in the verify state prevents advancing with broken code.
278
+ </step>
279
+
280
+ </process>