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,379 @@
1
+ <purpose>Create a detailed specification through structured clarification and task decomposition. This is the MOST IMPORTANT workflow — a bad spec cascades failures through implementation, verification, and review. Never guess. Always ask. Always recommend.</purpose>
2
+ <when_to_use>Run after /sdlc:init (first spec) or after /sdlc:close (next loop iteration). STATE.md must show next_required_action = /sdlc:spec.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, .sdlc/ROADMAP.md, .sdlc/LAWS.md, .sdlc/PROJECT.md, any prior SUMMARY.md files in the current phase</required_reading>
4
+ <loop_context>
5
+ expected_phase: SPEC (active)
6
+ prior_phase: CLOSE (or INIT for first spec)
7
+ next_phase: IMPL
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="validate_state" priority="first">
12
+ Read .sdlc/STATE.md.
13
+
14
+ CHECK: Is next_required_action set to /sdlc:spec?
15
+
16
+ IF YES: Proceed.
17
+ IF NO: STOP. Display: "Cannot start spec. Current state requires: {next_required_action}. Complete that step first."
18
+
19
+ CHECK: Is the prior loop closed? Look at loop_position:
20
+ - If "INIT ✓" → this is the first spec, proceed
21
+ - If "CLOSE ✓" → prior loop is done, proceed
22
+ - If anything else (e.g., "IMPL ✓" or "VERIFY ✓") → STOP. The prior loop is not closed.
23
+
24
+ WHY: The state machine prevents skipping steps. If you skip review, bugs ship. If you skip verify, untested code ships. The loop is non-negotiable.
25
+ </step>
26
+
27
+ <step name="load_context" priority="second">
28
+ Read .sdlc/ROADMAP.md to identify:
29
+ - Current milestone number and name
30
+ - Current phase number and name
31
+ - How many plans have been completed in this phase
32
+
33
+ Calculate the next plan number:
34
+ - List files in .sdlc/phases/{current-phase}/ matching *-SPEC.md
35
+ - Next plan = count + 1, zero-padded to 2 digits (01, 02, 03...)
36
+
37
+ Read .sdlc/PROJECT.md to load:
38
+ - Tech stack (needed for implementation guidance)
39
+ - Architecture patterns (needed for task decomposition)
40
+ - Conventions (needed for consistency)
41
+
42
+ Read any SUMMARY.md files from prior plans in this phase:
43
+ - These contain decisions, lessons learned, and context
44
+ - Summarize key points that might affect this spec
45
+ - Present relevant context to user: "From prior work in this phase: {summary}"
46
+
47
+ WHY: Context continuity prevents re-litigating decisions and ensures consistency. Without reading prior summaries, each spec starts from zero and may contradict earlier work.
48
+ </step>
49
+
50
+ <step name="clarification_phase" priority="third">
51
+ THIS STEP IS CRITICAL. DO NOT SKIP OR SHORTCUT.
52
+
53
+ Start with an open-ended prompt:
54
+ "What do you want to build in this plan? Describe the feature, fix, or change."
55
+
56
+ LISTEN to the response. Do NOT immediately start writing code or specs.
57
+
58
+ Then ask 3-5 TARGETED clarification questions. Each question MUST:
59
+ - Be specific to what the user described (not generic)
60
+ - Include a RECOMMENDATION with reasoning
61
+ - Present trade-offs when multiple approaches exist
62
+
63
+ Categories to cover (pick the most relevant 3-5):
64
+
65
+ A. SCOPE BOUNDARIES:
66
+ "You mentioned {X}. Does this include {Y}? I recommend excluding {Y} for now because {reason}. We can add it in a follow-up plan."
67
+
68
+ B. TECHNICAL APPROACH:
69
+ "For implementing {feature}, I see these options:
70
+ Option A: {approach} — Pros: {pros}. Cons: {cons}. Effort: {estimate}.
71
+ Option B: {approach} — Pros: {pros}. Cons: {cons}. Effort: {estimate}.
72
+ I recommend Option {X} because {reason}."
73
+
74
+ C. EDGE CASES AND ERRORS:
75
+ "What should happen when {edge case}? For example: empty input, network failure, concurrent access, missing data. I recommend {approach} because {reason}."
76
+
77
+ D. INTEGRATION POINTS:
78
+ "This will touch {existing module/file}. I found {pattern} already in use there. Should we follow the same pattern or is there a reason to diverge?"
79
+
80
+ E. TESTING STRATEGY:
81
+ "How should we verify this works? I recommend {unit tests for logic, Playwright for UI, curl for API} because {reason}."
82
+
83
+ WAIT for the user to answer ALL questions before proceeding.
84
+
85
+ IF the user's answers reveal more ambiguity, ask follow-up questions. Do NOT proceed with ambiguity.
86
+
87
+ WHY: Guessing is the #1 cause of rework. A 5-minute clarification saves hours of implementation in the wrong direction. The recommendations save the user from having to research options themselves.
88
+ </step>
89
+
90
+ <step name="task_decomposition" priority="fourth">
91
+ Break the work into discrete, independently verifiable tasks.
92
+
93
+ TARGET: 2-5 tasks per spec. If you have more than 5, the spec is too large — suggest splitting into multiple plans.
94
+
95
+ For EACH task, define:
96
+ ```
97
+ Task: {task-name} (kebab-case, descriptive)
98
+ Action: {what to do — imperative voice, specific}
99
+ Files to modify: {list of file paths}
100
+ Files to create: {list of new file paths, if any}
101
+ Verification: {how to confirm this task is done correctly}
102
+ Done criteria: {observable outcome — "the test passes", "the endpoint returns 200", etc.}
103
+ Estimated complexity: LOW (<20 lines) | MEDIUM (20-60 lines) | HIGH (60+ lines)
104
+ ```
105
+
106
+ DEPENDENCY ANALYSIS — build a directed acyclic graph (DAG):
107
+
108
+ For each task, ask: "Does this task depend on another task's output?"
109
+ - If task-3 needs a function created by task-1 → task-3 depends on task-1
110
+ - If task-2 needs a type defined by task-1 → task-2 depends on task-1
111
+ - If task-1 and task-2 touch different files with no shared types → they are INDEPENDENT
112
+
113
+ Group tasks into PARALLEL WAVES:
114
+ - Wave 1: all tasks with no dependencies (can run simultaneously)
115
+ - Wave 2: tasks that depend only on Wave 1 tasks
116
+ - Wave 3: tasks that depend on Wave 2 tasks
117
+ - And so on
118
+
119
+ Present the dependency graph to the user:
120
+ ```
121
+ Wave 1 (parallel): task-1, task-2
122
+ Wave 2 (after wave 1): task-3 (depends on task-1, task-2)
123
+ Wave 3 (after wave 2): task-4 (depends on task-3)
124
+ ```
125
+
126
+ Ask: "Does this task breakdown and ordering look right? Any tasks missing or misplaced?"
127
+
128
+ WHY: Parallel execution dramatically speeds up implementation. But wrong dependency ordering causes race conditions where an agent tries to use code that does not exist yet. The DAG prevents this.
129
+ </step>
130
+
131
+ <step name="write_acceptance_criteria" priority="fifth">
132
+ For each piece of observable behavior, write a BDD acceptance criterion:
133
+
134
+ ```
135
+ AC-{N}: {short description}
136
+ GIVEN {initial state or precondition}
137
+ WHEN {action or trigger}
138
+ THEN {expected outcome}
139
+ ```
140
+
141
+ Rules for writing good ACs:
142
+ - Each AC tests ONE behavior (not multiple things)
143
+ - The GIVEN sets up a specific, reproducible state
144
+ - The WHEN is a single action (not a sequence)
145
+ - The THEN is observable and verifiable (not "works correctly" — specify WHAT is correct)
146
+ - Include at least one AC for the "happy path" and one for an error/edge case
147
+
148
+ Example (good):
149
+ ```
150
+ AC-1: User login with valid credentials
151
+ GIVEN a registered user with email "test@example.com" and password "ValidPass123"
152
+ WHEN the user submits the login form with those credentials
153
+ THEN a JWT token is returned with status 200 and the response body contains { "token": "<jwt>" }
154
+ ```
155
+
156
+ Example (bad — too vague):
157
+ ```
158
+ AC-1: Login works
159
+ GIVEN a user
160
+ WHEN they log in
161
+ THEN it works
162
+ ```
163
+
164
+ WHY: The verify phase translates ACs directly into test actions. Vague ACs produce vague tests that pass even when the code is broken. Specific ACs catch real bugs.
165
+ </step>
166
+
167
+ <step name="define_boundaries" priority="sixth">
168
+ List what this spec does NOT cover. Be explicit.
169
+
170
+ ```
171
+ ## Boundaries — Do NOT Change
172
+ - {file or module}: {reason it is out of scope}
173
+ - {feature}: {reason it is deferred}
174
+ ```
175
+
176
+ Also list any existing patterns that MUST be followed:
177
+ ```
178
+ ## Required Patterns
179
+ - Error handling: use {existing pattern} from {file}
180
+ - Naming: follow {convention} as seen in {file}
181
+ - Testing: use {test helper/factory} from {file}
182
+ ```
183
+
184
+ WHY: Without boundaries, sub-agents during implementation will "helpfully" refactor nearby code, breaking things outside the spec scope. Boundaries are guardrails.
185
+ </step>
186
+
187
+ <step name="write_spec_file" priority="seventh">
188
+ Write the spec to: .sdlc/phases/{phase-dir}/{plan-number}-SPEC.md
189
+
190
+ Format:
191
+ ```markdown
192
+ ---
193
+ phase: {phase-number}-{phase-name}
194
+ plan: {plan-number}
195
+ type: execute
196
+ autonomous: true
197
+ task_graph:
198
+ parallel_groups:
199
+ - [{wave-1-tasks}]
200
+ - [{wave-2-tasks}]
201
+ dependencies:
202
+ {task}: [{dependency-tasks}]
203
+ files_modified: []
204
+ files_created: []
205
+ ---
206
+
207
+ # Plan {plan-number}: {title}
208
+
209
+ ## Context
210
+ {What this plan accomplishes and why it matters in the broader phase}
211
+
212
+ ## Prior Decisions
213
+ {Relevant decisions from prior plans, or "First plan in phase" if none}
214
+
215
+ ## Tasks
216
+
217
+ ### Task 1: {task-name}
218
+ - **Action**: {what to do}
219
+ - **Files**: {files to modify/create}
220
+ - **Verification**: {how to verify}
221
+ - **Done criteria**: {observable outcome}
222
+ - **Complexity**: {LOW|MEDIUM|HIGH}
223
+
224
+ ### Task 2: {task-name}
225
+ ...
226
+
227
+ ## Dependency Graph
228
+ ```
229
+ Wave 1 (parallel): {tasks}
230
+ Wave 2 (sequential after wave 1): {tasks}
231
+ ```
232
+
233
+ ## Acceptance Criteria
234
+
235
+ AC-1: {description}
236
+ GIVEN {precondition}
237
+ WHEN {action}
238
+ THEN {outcome}
239
+
240
+ AC-2: ...
241
+
242
+ ## Boundaries
243
+ - DO NOT modify: {files/modules}
244
+ - DO NOT implement: {out-of-scope features}
245
+
246
+ ## Required Patterns
247
+ - {pattern}: {source file}
248
+
249
+ ## Engineering Laws
250
+ Enforced per .sdlc/LAWS.md. Key reminders for this plan:
251
+ - {most relevant law for this specific work}
252
+ - {second most relevant law}
253
+ ```
254
+
255
+ WHY: The YAML frontmatter is machine-readable — the impl phase parses it to build the execution plan. The markdown body is human-readable — developers can review it. Both are needed.
256
+ </step>
257
+
258
+ <step name="spec_integrity_review" priority="eighth">
259
+ BEFORE updating state, perform a self-review of the spec for completeness and correctness.
260
+
261
+ CHECK 1 — COMPLETENESS:
262
+ - Every task has: name, action, files, verification, done criteria, complexity ✓ or ✗
263
+ - Every AC has: GIVEN, WHEN, THEN with specific values (not vague) ✓ or ✗
264
+ - Dependency graph accounts for all tasks ✓ or ✗
265
+ - Boundaries section is non-empty ✓ or ✗
266
+ - Required patterns section references actual existing files ✓ or ✗
267
+
268
+ CHECK 2 — CONSISTENCY:
269
+ - Every task links to at least one AC (no orphan tasks)
270
+ - Every AC is covered by at least one task (no orphan ACs)
271
+ - File lists in tasks do not overlap with boundaries (no protected file modification)
272
+ - Task dependency graph has no cycles
273
+ - Parallel groups contain only truly independent tasks (no shared file writes)
274
+
275
+ CHECK 3 — FEASIBILITY:
276
+ - No single task exceeds HIGH complexity (60+ lines) — if so, suggest splitting
277
+ - Total task count is 2-5 per spec — if more, suggest splitting into multiple plans
278
+ - Estimated total change stays under ~300 lines — if more, warn user
279
+
280
+ IF ANY CHECK FAILS: Fix the spec before presenting for approval. Do not present a broken spec.
281
+
282
+ Present the integrity review results:
283
+ ```
284
+ Spec Integrity Review:
285
+ ✓ Completeness: All {N} tasks fully defined, {N} ACs with Given/When/Then
286
+ ✓ Consistency: All tasks linked to ACs, no boundary violations, no cycles
287
+ ✓ Feasibility: {N} tasks across {N} waves, estimated ~{N} lines of change
288
+
289
+ Issues found: {count}
290
+ {list any issues with suggested fixes}
291
+ ```
292
+
293
+ WHY: A broken spec cascades failures through every downstream step. Catching spec issues here is 10x cheaper than catching them in review. This is the cheapest point to fix problems.
294
+ </step>
295
+
296
+ <step name="user_approval_gate" priority="ninth">
297
+ THIS IS A BLOCKING GATE. The spec does NOT proceed without explicit user approval.
298
+
299
+ Present the complete spec summary to the user:
300
+ ```
301
+ ══════════════════════════════════════
302
+ SPEC REVIEW — Approval Required
303
+ ══════════════════════════════════════
304
+
305
+ Plan: {plan-number} — {title}
306
+ Phase: {phase-name}
307
+
308
+ Tasks ({N}):
309
+ {numbered list of task names with complexity}
310
+
311
+ Execution Order:
312
+ Wave 1 (parallel): {tasks}
313
+ Wave 2 (after wave 1): {tasks}
314
+
315
+ Acceptance Criteria ({N}):
316
+ {numbered list of AC descriptions}
317
+
318
+ Boundaries:
319
+ {list of protected files/modules}
320
+
321
+ Spec file: .sdlc/phases/{phase}/{plan}-SPEC.md
322
+ ══════════════════════════════════════
323
+
324
+ Review the spec above. Your options:
325
+ 1. APPROVE — Proceed to implementation
326
+ 2. REVISE — Tell me what to change (I will update the spec and re-present)
327
+ 3. REJECT — Discard this spec and start over
328
+ ```
329
+
330
+ Wait for user response using AskUserQuestion.
331
+
332
+ IF "APPROVE" (or "1", "yes", "looks good", "go", "lgtm"):
333
+ Proceed to update_state step.
334
+
335
+ IF "REVISE" (or "2", or user provides specific feedback):
336
+ Apply the requested changes to the SPEC.md file.
337
+ Re-run spec_integrity_review on the updated spec.
338
+ Re-present for approval (loop back to this step).
339
+ Do NOT proceed until approved.
340
+
341
+ IF "REJECT" (or "3", "start over", "scrap it"):
342
+ Delete the spec file.
343
+ Display: "Spec discarded. Run /sdlc:spec to start a new spec."
344
+ Do NOT update STATE.md.
345
+ STOP.
346
+
347
+ WHY: Implementation is expensive. Building the wrong thing wastes hours. A 30-second review of the spec catches misunderstandings before they become code. The user MUST see and approve the plan before sub-agents start writing code.
348
+ </step>
349
+
350
+ <step name="update_state" priority="tenth">
351
+ ONLY REACHED AFTER USER APPROVES THE SPEC.
352
+
353
+ Update .sdlc/STATE.md:
354
+ - loop_position: SPEC ✓
355
+ - current_plan: {plan-number}
356
+ - current_phase: {phase-number}
357
+ - next_required_action: /sdlc:impl
358
+ - Add history entry: "{timestamp} | spec | Plan {N} spec approved: {title}"
359
+
360
+ Update .sdlc/ROADMAP.md:
361
+ - Increment plan count for current phase
362
+ - Set phase status to IN PROGRESS if not already
363
+
364
+ Display to user:
365
+ ```
366
+ Spec approved: .sdlc/phases/{phase}/{plan}-SPEC.md
367
+
368
+ Tasks: {N} ({N} parallel waves)
369
+ Acceptance Criteria: {N}
370
+ Boundaries: {N} files protected
371
+
372
+ NEXT ACTION REQUIRED: /sdlc:impl
373
+ Run /sdlc:impl to begin sub-agent implementation.
374
+ ```
375
+
376
+ WHY: The forcing function ensures the user moves to implementation. Without it, specs pile up without being built.
377
+ </step>
378
+
379
+ </process>
@@ -0,0 +1,203 @@
1
+ <purpose>Transition from one phase to the next within a milestone. Called automatically by close-phase when the last plan in a phase completes. Verifies completeness, updates project state, and commits the phase.</purpose>
2
+ <when_to_use>Triggered automatically when /sdlc:close detects the last plan in a phase is done. Can also be run manually via /sdlc:transition to force a phase transition.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, .sdlc/ROADMAP.md, .sdlc/PROJECT.md, all SUMMARY.md files in the completing phase</required_reading>
4
+ <loop_context>
5
+ expected_phase: TRANSITION (between phases)
6
+ prior_phase: CLOSE ✓ (last plan in phase)
7
+ next_phase: first SPEC of the next phase, or milestone completion
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="verify_phase_completeness" priority="first">
12
+ Read .sdlc/STATE.md. Extract the current phase.
13
+ Read .sdlc/ROADMAP.md. Get the current phase's plan count.
14
+
15
+ List all files in .sdlc/phases/{current_phase}/:
16
+ - Count *-SPEC.md files (plans created)
17
+ - Count *-SUMMARY.md files (plans completed)
18
+ - Count HOTFIX-*-SUMMARY.md files (hotfixes applied)
19
+
20
+ VERIFY: Every SPEC.md has a corresponding SUMMARY.md.
21
+ - If a SPEC exists without a SUMMARY: that plan was not completed.
22
+ - STOP. Display: "Phase transition blocked. Plan {N} has a spec but no summary. Complete it first."
23
+
24
+ VERIFY: Every SUMMARY.md shows all ACs passed.
25
+ - Read each SUMMARY.md. Check the AC results table.
26
+ - If any AC is FAIL: STOP. Display: "Phase transition blocked. Plan {N} has failing ACs."
27
+
28
+ Display:
29
+ ```
30
+ Phase {phase} completeness check:
31
+ Plans: {N} created, {N} completed
32
+ Hotfixes: {N}
33
+ All ACs: PASSED
34
+ Phase is ready for transition.
35
+ ```
36
+
37
+ WHY: Transitioning with incomplete work means skipping it forever. The completeness check prevents accidental abandonment.
38
+ </step>
39
+
40
+ <step name="verify_state_consistency" priority="second">
41
+ Cross-check three state files for consistency:
42
+
43
+ STATE.MD:
44
+ - current_milestone should match ROADMAP.md's in-progress milestone
45
+ - current_phase should match the phase being completed
46
+ - loop_position should be CLOSE ✓
47
+
48
+ PROJECT.MD:
49
+ - Tech stack should still be accurate (ask user if uncertain)
50
+ - Requirements section should reflect what was built
51
+
52
+ ROADMAP.MD:
53
+ - Current phase should show correct plan count
54
+ - Prior phases in this milestone should all be COMPLETE
55
+
56
+ IF INCONSISTENCY FOUND:
57
+ Display: "State inconsistency: {detail}. Recommend fixing before transitioning."
58
+ Offer to auto-fix obvious inconsistencies (e.g., plan count mismatch).
59
+ Ask for user confirmation before applying fixes.
60
+
61
+ WHY: State drift accumulates silently. Catching it at phase boundaries prevents compounding errors.
62
+ </step>
63
+
64
+ <step name="update_project_md" priority="third">
65
+ Read .sdlc/PROJECT.md.
66
+
67
+ Based on the completed phase's summaries:
68
+
69
+ A. VALIDATE EXISTING REQUIREMENTS:
70
+ For each requirement listed in PROJECT.md:
71
+ - Was it addressed in this phase? (search summaries for related work)
72
+ - If addressed: mark as IMPLEMENTED with reference to plan number
73
+ - If not addressed: leave as-is (future phase responsibility)
74
+
75
+ B. INVALIDATE OUTDATED REQUIREMENTS:
76
+ For each requirement:
77
+ - Does the implementation contradict or supersede it?
78
+ - If yes: mark as SUPERSEDED with explanation
79
+
80
+ C. ADD NEW REQUIREMENTS:
81
+ From decisions and lessons learned in summaries:
82
+ - Were new requirements discovered during implementation?
83
+ - If yes: add them to PROJECT.md with status NOT STARTED
84
+
85
+ Display changes to user before writing:
86
+ ```
87
+ PROJECT.md updates:
88
+ - IMPLEMENTED: {requirement} (Plan {N})
89
+ - SUPERSEDED: {requirement} (replaced by {new approach})
90
+ - NEW: {requirement} (discovered in Plan {N})
91
+
92
+ Apply these changes? (yes/no)
93
+ ```
94
+
95
+ WHY: PROJECT.md must stay current. Stale requirements mislead future specs. New requirements discovered during implementation must be captured or they are forgotten.
96
+ </step>
97
+
98
+ <step name="update_state_for_next_phase" priority="fourth">
99
+ Read .sdlc/ROADMAP.md. Identify the next phase in the current milestone.
100
+
101
+ IF NEXT PHASE EXISTS:
102
+ Update .sdlc/STATE.md:
103
+ - current_phase: {next phase number and name}
104
+ - current_plan: cleared
105
+ - loop_position: TRANSITION ✓
106
+ - next_required_action: /sdlc:spec
107
+ - Add history entry: "{timestamp} | transition | Phase {old} complete. Transitioning to phase {new}."
108
+
109
+ Update .sdlc/ROADMAP.md:
110
+ - Set completed phase status to COMPLETE with date
111
+ - Set next phase status to IN PROGRESS
112
+
113
+ IF NO NEXT PHASE (this was the last phase in the milestone):
114
+ Update .sdlc/STATE.md:
115
+ - loop_position: TRANSITION ✓
116
+ - next_required_action: /sdlc:milestone complete
117
+ - Add history entry: "{timestamp} | transition | Phase {current} complete. Last phase in milestone. Trigger milestone completion."
118
+
119
+ Update .sdlc/ROADMAP.md:
120
+ - Set completed phase status to COMPLETE with date
121
+
122
+ WHY: The state machine must always point to exactly one next action. Whether that is the next phase or milestone completion depends on the roadmap.
123
+ </step>
124
+
125
+ <step name="update_roadmap" priority="fifth">
126
+ Update .sdlc/ROADMAP.md with phase completion details:
127
+
128
+ For the completed phase, update the row:
129
+ ```
130
+ | {phase-num} | {name} | COMPLETE ({date}) | {plan-count} |
131
+ ```
132
+
133
+ Add a phase summary note under the milestone:
134
+ ```
135
+ #### Phase {number} Summary
136
+ - Plans executed: {N}
137
+ - Hotfixes: {N}
138
+ - Key deliverables: {from summaries}
139
+ - Duration: {first spec date} to {completion date}
140
+ ```
141
+
142
+ WHY: The roadmap is the high-level progress tracker. Completion details help stakeholders understand velocity and scope.
143
+ </step>
144
+
145
+ <step name="create_git_commit" priority="sixth">
146
+ IF the project is a git repository:
147
+
148
+ Check: git status for uncommitted changes.
149
+
150
+ IF UNCOMMITTED CHANGES EXIST:
151
+ Stage all .sdlc/ files: git add .sdlc/
152
+ Stage any source files that were part of the phase
153
+
154
+ Create commit:
155
+ ```
156
+ feat({phase-name}): complete phase {number}
157
+
158
+ Phase {number} ({phase-name}) of milestone {milestone-number} is complete.
159
+
160
+ Plans executed: {N}
161
+ Key deliverables:
162
+ - {deliverable 1}
163
+ - {deliverable 2}
164
+ ```
165
+
166
+ Display: "Git commit created: {hash}"
167
+
168
+ IF NO UNCOMMITTED CHANGES:
169
+ Display: "No uncommitted changes to commit."
170
+
171
+ WHY: Phase completion is a natural commit point. The commit message documents what was accomplished, making git log useful as a project history.
172
+ </step>
173
+
174
+ <step name="display_result" priority="seventh">
175
+ IF NEXT PHASE EXISTS:
176
+ Display:
177
+ ```
178
+ Phase transition complete.
179
+
180
+ Completed: Phase {old-number} — {old-name}
181
+ Plans: {N} executed
182
+ Starting: Phase {new-number} — {new-name}
183
+
184
+ NEXT ACTION REQUIRED: /sdlc:spec
185
+ Run /sdlc:spec to create the first specification for Phase {new-number}.
186
+ ```
187
+
188
+ IF MILESTONE COMPLETE (no next phase):
189
+ Display:
190
+ ```
191
+ Phase transition complete.
192
+
193
+ Completed: Phase {number} — {name} (LAST PHASE)
194
+ Milestone {milestone-number} — {milestone-name}: ALL PHASES COMPLETE
195
+
196
+ NEXT ACTION REQUIRED: /sdlc:milestone complete
197
+ Run /sdlc:milestone complete to finalize the milestone.
198
+ ```
199
+
200
+ WHY: The display makes the transition visible. Moving to a new phase is a significant moment — the user should know where they are in the broader plan.
201
+ </step>
202
+
203
+ </process>