speccrew 0.7.60 → 0.7.62

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.
@@ -5,12 +5,17 @@
5
5
  Input Parameters Definition
6
6
  ============================================================ -->
7
7
  <block type="input" id="I1" desc="Workflow input parameters">
8
- <field name="feature_id" required="false" type="string" desc="Feature identifier, e.g., F-CRM-01"/>
8
+ <field name="feature_id" required="false" type="string" desc="Feature identifier, e.g., F-CRM-01. If provided, use new naming format"/>
9
9
  <field name="feature_name" required="true" type="string" desc="Feature name, e.g., customer-list"/>
10
10
  <field name="platform_id" required="true" type="string" desc="Target platform, e.g., backend-spring, backend-nestjs"/>
11
11
  <field name="iteration_path" required="true" type="string" desc="Absolute path to iteration directory"/>
12
12
  <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace"/>
13
- <field name="task_id" required="false" type="string" desc="Task ID from dispatch context"/>
13
+ <field name="task_id" required="false" type="string" desc="Task identifier in DISPATCH-PROGRESS.json. Used for status tracking"/>
14
+ <field name="skip_confirmation" required="false" type="boolean" default="false" desc="When true, skip Checkpoint A user confirmation (used in batch dispatch mode)"/>
15
+ <field name="skip_index_generation" required="false" type="boolean" default="false" desc="When true, skip Step 5 INDEX.md generation (INDEX.md will be generated by orchestrator after all workers complete)"/>
16
+ <field name="index_only" required="false" type="boolean" default="false" desc="When true, skip Steps 1-4 and ONLY execute Step 5 (INDEX.md generation). Used after all platform workers complete"/>
17
+ <field name="dispatch_progress_file" required="false" type="string" desc="Path to DISPATCH-PROGRESS.json. If provided, worker updates its own task status on completion"/>
18
+ <field name="update_progress_script" required="false" type="string" desc="Path to update-progress.js script"/>
14
19
  </block>
15
20
 
16
21
  <!-- ============================================================
@@ -18,7 +23,8 @@
18
23
  ============================================================ -->
19
24
  <block type="rule" id="R1" level="forbidden" desc="Document creation constraints">
20
25
  <field name="text">NEVER use create_file to write design documents or INDEX directly</field>
21
- <field name="text">MUST create by copying template then filling with search_replace</field>
26
+ <field name="text">Documents MUST be created by copying template then filling with search_replace</field>
27
+ <field name="text">create_file produces truncated output on large files</field>
22
28
  </block>
23
29
 
24
30
  <block type="rule" id="R2" level="forbidden" desc="Full-file rewrite prohibition">
@@ -34,6 +40,72 @@
34
40
  <block type="rule" id="R4" level="mandatory" desc="Actual framework syntax">
35
41
  <field name="text">All pseudo-code MUST use actual framework/library syntax from techs knowledge</field>
36
42
  <field name="text">NOT generic pseudo-code</field>
43
+ <field name="text">Include actual import statements</field>
44
+ <field name="text">Use actual ORM and transaction patterns from conventions</field>
45
+ </block>
46
+
47
+ <block type="rule" id="R5" level="forbidden" desc="TODO/FIXME placeholders">
48
+ <field name="text">Design documents MUST contain complete implementation logic</field>
49
+ <field name="text">Do NOT use TODO, FIXME, HACK, or any placeholder comments</field>
50
+ <field name="text">Every method, validation rule, and business logic MUST be fully specified with actual pseudocode</field>
51
+ </block>
52
+
53
+ <block type="rule" id="R6" level="mandatory" desc="Output filename pattern">
54
+ <field name="text">Output filename MUST follow pattern: {feature_id}-{feature_name}-design.md</field>
55
+ <field name="text">Omitting feature_id or using alternative naming is FORBIDDEN</field>
56
+ </block>
57
+
58
+ <block type="rule" id="R7" level="mandatory" desc="Mermaid for all diagrams">
59
+ <field name="text">ALL module structures, interaction flows, and entity relationship diagrams MUST use Mermaid syntax</field>
60
+ <field name="text">Use graph TB, sequenceDiagram, flowchart, erDiagram</field>
61
+ <field name="text">Plain text ASCII diagrams are FORBIDDEN for these sections</field>
62
+ </block>
63
+
64
+ <block type="rule" id="R8" level="mandatory" desc="API route consistency">
65
+ <field name="text">All API routes in design document MUST exactly match routes defined in API Contract</field>
66
+ <field name="text">Before writing any route, READ the API Contract and copy routes verbatim</field>
67
+ <field name="text">Do NOT invent or modify routes</field>
68
+ </block>
69
+
70
+ <block type="rule" id="R9" level="mandatory" desc="Cross-feature dependency marking">
71
+ <field name="text">When referencing functionality from another Feature, MUST explicitly mark as [DEPENDENCY: F-XXX-NNN]</field>
72
+ <field name="text">Define a degradation strategy for when that Feature is not yet implemented</field>
73
+ </block>
74
+
75
+ <block type="rule" id="R10" level="mandatory" desc="Status markers required">
76
+ <field name="text">Use [EXISTING], [MODIFIED], [NEW] markers for all modules, services, and entities</field>
77
+ </block>
78
+
79
+ <block type="rule" id="R11" level="mandatory" desc="Follow techs conventions">
80
+ <field name="text">Naming, directory structure, patterns must follow techs knowledge</field>
81
+ <field name="text">Layer structure follows conventions-design.md</field>
82
+ <field name="text">ORM patterns follow conventions-data.md</field>
83
+ </block>
84
+
85
+ <block type="rule" id="R12" level="mandatory" desc="API Contract is READ-ONLY">
86
+ <field name="text">Do NOT modify API Contract</field>
87
+ <field name="text">Stop and report if issues found in API Contract</field>
88
+ </block>
89
+
90
+ <block type="rule" id="R13" level="mandatory" desc="Migration strategy required">
91
+ <field name="text">Database design must include migration strategy, not just final schema</field>
92
+ <field name="text">Document migration files and rollback plans</field>
93
+ </block>
94
+
95
+ <block type="rule" id="R14" level="mandatory" desc="Explicit transaction boundaries">
96
+ <field name="text">Transaction boundaries must be explicitly marked in design</field>
97
+ <field name="text">Use actual framework transaction annotations from conventions-data.md</field>
98
+ </block>
99
+
100
+ <block type="rule" id="R15" level="mandatory" desc="Exception code mapping">
101
+ <field name="text">Exception handling must map to API Contract error codes</field>
102
+ <field name="text">Use actual exception classes from techs knowledge</field>
103
+ </block>
104
+
105
+ <block type="rule" id="R16" level="mandatory" desc="Mermaid compatibility">
106
+ <field name="text">Use only basic node definitions: A[text content]</field>
107
+ <field name="text">No HTML tags, no nested subgraphs, no direction keyword, no style definitions</field>
108
+ <field name="text">Use standard graph TB/LR, flowchart TD/LR, or erDiagram syntax only</field>
37
109
  </block>
38
110
 
39
111
  <!-- ============================================================
@@ -41,6 +113,15 @@
41
113
  ============================================================ -->
42
114
  <sequence id="S1" name="Backend System Design" status="pending" desc="Generate backend detailed design documents">
43
115
 
116
+ <!-- Gateway: index_only conditional -->
117
+ <block type="gateway" id="G0" mode="exclusive" desc="Check if index_only mode">
118
+ <branch test="${index_only} == true" name="Index only - skip to Step 5">
119
+ <block type="event" id="E0" action="log" level="info" desc="index_only mode active">
120
+ <field name="message">index_only=true, skipping Steps 1-4 and jumping directly to Step 5 (INDEX.md generation)</field>
121
+ </block>
122
+ </branch>
123
+ <branch default="true" name="Full workflow">
124
+
44
125
  <!-- Step 1: Read Inputs -->
45
126
  <block type="task" id="B1" action="read-file" desc="Read Feature Spec document">
46
127
  <field name="path">${iteration_path}/02.feature-design/${feature_id}-${feature_name}-feature-spec.md</field>
@@ -81,25 +162,26 @@
81
162
  </block>
82
163
 
83
164
  <!-- Step 2: Analyze Existing Code Structure -->
84
- <block type="task" id="B8" action="analyze" desc="Analyze codebase structure">
165
+ <block type="task" id="B8" action="analyze" desc="Analyze backend codebase structure">
85
166
  <field name="analysis_targets">
86
- - Controller/Router layer structure
87
- - Service layer organization
88
- - Repository/DAO layer patterns
89
- - Entity/Model definitions
90
- - Middleware stack
91
- - Exception handling patterns
92
- - Database migration structure
93
- - Naming conventions
167
+ - Controller/Router layer structure — Understand routing patterns and naming conventions
168
+ - Service layer organization — Identify service boundaries and reuse opportunities
169
+ - Repository/DAO layer patterns — Review data access patterns
170
+ - Entity/Model definitions — Understand existing data models
171
+ - Middleware stack — Identify cross-cutting concerns
172
+ - Exception handling patterns — Review error handling approach
173
+ - Database migration structure — Understand migration naming and structure
174
+ - Naming conventions — Ensure consistency with existing code
94
175
  </field>
95
176
  <field name="output" var="codebase_analysis"/>
96
177
  </block>
97
178
 
98
179
  <!-- Step 3: Extract Functions from Feature Spec -->
99
- <block type="task" id="B9" action="analyze" desc="Extract backend functions">
180
+ <block type="task" id="B9" action="analyze" desc="Extract backend functions from Feature Spec">
100
181
  <field name="input" value="${feature_spec}">${api_contract}</field>
101
182
  <field name="extraction_rules">
102
183
  - Parse Feature Spec Section 2.N pattern
184
+ - Each Feature Spec typically contains 3-8 functions (fine-grained format)
103
185
  - Extract API interfaces from backend part
104
186
  - Extract data access requirements
105
187
  - Extract business logic flow
@@ -109,20 +191,29 @@
109
191
  <field name="output" var="extracted_functions"/>
110
192
  </block>
111
193
 
112
- <!-- Checkpoint A: Present function list for confirmation -->
113
- <block type="event" id="E1" action="confirm" title="Function List Confirmation" type="yesno" desc="Present function extraction summary">
114
- <field name="preview">Backend Functions Extracted for: ${feature_name}
194
+ <!-- Checkpoint A: Function Extraction Confirmation -->
195
+ <block type="gateway" id="G1" mode="exclusive" desc="Handle Checkpoint A - skip_confirmation gateway">
196
+ <branch test="${skip_confirmation} == true" name="Skip confirmation - auto proceed">
197
+ <block type="event" id="E1_skip" action="log" level="info" desc="Skipping Checkpoint A">
198
+ <field name="message">skip_confirmation=true, logging function extraction summary and proceeding automatically</field>
199
+ </block>
200
+ </branch>
201
+ <branch default="true" name="Request user confirmation">
202
+ <block type="event" id="E1" action="confirm" title="Function Extraction Confirmation - Checkpoint A" type="yesno" desc="Present function extraction summary">
203
+ <field name="preview">Backend Functions Extracted for: ${feature_name}
115
204
  Platform: ${platform_id}
116
205
 
117
- Function List:
206
+ Function Extraction Summary:
118
207
  ${extracted_functions.summary}
119
208
 
120
- Markers:
209
+ Component Markers:
121
210
  - [NEW]: ${extracted_functions.new_count} modules
122
211
  - [MODIFIED]: ${extracted_functions.modified_count} modules
123
- - [EXISTING]: ${extracted_functions.existing_count} modules (no design needed)
212
+ - [EXISTING]: ${extracted_functions.existing_count} modules
124
213
 
125
- Confirm function list before proceeding?</field>
214
+ Confirm function extraction before proceeding?</field>
215
+ </block>
216
+ </branch>
126
217
  </block>
127
218
 
128
219
  <!-- Step 4: Generate Module Design Documents -->
@@ -133,102 +224,209 @@ Confirm function list before proceeding?</field>
133
224
 
134
225
  <!-- Loop: Generate design for each function -->
135
226
  <block type="loop" id="L1" over="${extracted_functions.functions}" as="function" desc="Generate module design documents">
136
- <block type="task" id="B11" action="generate" desc="Copy template and create document">
137
- <field name="template" value="${design_template}"/>
138
- <field name="placeholders">
139
- - {Module Name} ${function.module_name}
140
- - {Feature Name} → ${feature_name}
141
- - {Platform ID} → ${platform_id}
142
- </field>
143
- <field name="output_path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
144
- <field name="output" var="module_doc_created"/>
227
+ <!-- Gateway: Determine output path based on feature_id -->
228
+ <block type="gateway" id="G2" mode="exclusive" desc="Determine output path">
229
+ <branch test="${feature_id} != null" name="With feature_id">
230
+ <block type="task" id="B11" action="generate" desc="Copy template and create document with feature_id">
231
+ <field name="template" value="${design_template}"/>
232
+ <field name="placeholders">
233
+ - {Module Name} → ${function.module_name}
234
+ - {Feature Name} → ${feature_name}
235
+ - {Platform ID} → ${platform_id}
236
+ </field>
237
+ <field name="output_path">${iteration_path}/03.system-design/${platform_id}/${feature_id}-${feature_name}-design.md</field>
238
+ <field name="output" var="module_doc_created"/>
239
+ </block>
240
+ </branch>
241
+ <branch default="true" name="Without feature_id (backward compatibility)">
242
+ <block type="task" id="B12" action="generate" desc="Copy template and create document without feature_id">
243
+ <field name="template" value="${design_template}"/>
244
+ <field name="placeholders">
245
+ - {Module Name} → ${function.module_name}
246
+ - {Feature Name} → ${feature_name}
247
+ - {Platform ID} → ${platform_id}
248
+ </field>
249
+ <field name="output_path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
250
+ <field name="output" var="module_doc_created"/>
251
+ </block>
252
+ </branch>
145
253
  </block>
146
254
 
147
- <block type="task" id="B12" action="edit-file" desc="Fill Module Structure section">
148
- <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
255
+ <!-- Fill each section using search_replace -->
256
+ <block type="task" id="B13" action="edit-file" desc="Fill Module Structure section">
257
+ <field name="path">${module_doc_created.path}</field>
149
258
  <field name="operation">search_replace</field>
150
259
  <field name="content_source">${tech_stack}${conventions_design}</field>
151
260
  <field name="section">Module Structure</field>
261
+ <field name="rules">
262
+ - Use actual framework layering from techs knowledge
263
+ - ALL module structure diagrams MUST use Mermaid syntax
264
+ - Mark each module as [EXISTING], [MODIFIED], or [NEW]
265
+ </field>
152
266
  </block>
153
267
 
154
- <block type="task" id="B13" action="edit-file" desc="Fill Interface Pseudo-code section">
155
- <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
268
+ <block type="task" id="B14" action="edit-file" desc="Fill Interface Pseudo-code section">
269
+ <field name="path">${module_doc_created.path}</field>
156
270
  <field name="operation">search_replace</field>
157
271
  <field name="content_source">${api_contract}${conventions_dev}</field>
158
272
  <field name="section">Interface Pseudo-code</field>
273
+ <field name="rules">
274
+ - Use actual framework decorators/annotations
275
+ - Spring Boot: @RestController, @PostMapping, @Valid, etc.
276
+ - NestJS: @Controller, @Post, @Body, @UseGuards, etc.
277
+ - Go: gin.Context, echo.Context, etc.
278
+ </field>
159
279
  </block>
160
280
 
161
- <block type="task" id="B14" action="edit-file" desc="Fill Database Design section">
162
- <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
281
+ <block type="task" id="B15" action="edit-file" desc="Fill Database Design section">
282
+ <field name="path">${module_doc_created.path}</field>
163
283
  <field name="operation">search_replace</field>
164
284
  <field name="content_source">${feature_spec}${conventions_data}</field>
165
285
  <field name="section">Database Design</field>
286
+ <field name="rules">
287
+ - Use actual ORM entity definitions from conventions-data.md
288
+ - Include migration strategy, not just final schema
289
+ - Document new tables, modified tables, entity relationships
290
+ </field>
166
291
  </block>
167
292
 
168
- <block type="task" id="B15" action="edit-file" desc="Fill Transaction Boundaries section">
169
- <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
293
+ <block type="task" id="B16" action="edit-file" desc="Fill Transaction Boundaries section">
294
+ <field name="path">${module_doc_created.path}</field>
170
295
  <field name="operation">search_replace</field>
171
296
  <field name="content_source">${conventions_data}</field>
172
297
  <field name="section">Transaction Boundaries</field>
298
+ <field name="rules">
299
+ - Use actual framework transaction mechanism
300
+ - Explicitly mark transaction boundaries for multi-step operations
301
+ - Use actual transaction annotations from conventions-data.md
302
+ </field>
173
303
  </block>
174
304
 
175
- <block type="task" id="B16" action="edit-file" desc="Fill Exception Handling section">
176
- <field name="path">${iteration_path}/03.system-design/${platform_id}/${function.module_name}-design.md</field>
305
+ <block type="task" id="B17" action="edit-file" desc="Fill Exception Handling section">
306
+ <field name="path">${module_doc_created.path}</field>
177
307
  <field name="operation">search_replace</field>
178
308
  <field name="content_source">${api_contract}${conventions_dev}</field>
179
309
  <field name="section">Exception Handling</field>
310
+ <field name="rules">
311
+ - Use actual exception classes and error codes
312
+ - Exception handling must map to API Contract error codes
313
+ - Use actual framework exception patterns from techs knowledge
314
+ </field>
315
+ </block>
316
+
317
+ <!-- Step 4.3: Verify Output -->
318
+ <block type="task" id="B18" action="verify" desc="Verify completed design document">
319
+ <field name="verification_rules">
320
+ - All sections filled with actual content (no remaining placeholders)
321
+ - Mermaid diagrams render correctly
322
+ - Pseudo-code uses actual framework syntax from techs knowledge
323
+ - Transaction boundaries explicitly marked
324
+ - Exception types map to API Contract error codes
325
+ - If a section has no applicable content, section title kept with "N/A"
326
+ - All section titles and numbering preserved
327
+ </field>
328
+ <field name="output" var="design_doc_verified"/>
180
329
  </block>
181
330
  </block>
182
331
 
332
+ </branch>
333
+ </block>
334
+
335
+ <!-- Gateway: skip_index_generation conditional -->
336
+ <block type="gateway" id="G3" mode="exclusive" desc="Check if skip_index_generation">
337
+ <branch test="${skip_index_generation} == true" name="Skip INDEX.md generation">
338
+ <block type="event" id="E2_skip" action="log" level="info" desc="Skipping INDEX.md generation">
339
+ <field name="message">skip_index_generation=true, skipping Step 5 (INDEX.md will be generated by orchestrator after all workers complete)</field>
340
+ </block>
341
+ </branch>
342
+ <branch default="true" name="Generate INDEX.md">
343
+
183
344
  <!-- Step 5: Generate Platform INDEX.md -->
184
- <block type="task" id="B17" action="read-file" desc="Read index template">
345
+ <block type="task" id="B19" action="read-file" desc="Read index template">
185
346
  <field name="path">speccrew-sd-backend/templates/INDEX-TEMPLATE.md</field>
186
347
  <field name="output" var="index_template"/>
187
348
  </block>
188
349
 
189
- <block type="task" id="B18" action="generate" desc="Create INDEX.md from template">
350
+ <block type="task" id="B20" action="generate" desc="Create INDEX.md from template">
190
351
  <field name="template" value="${index_template}"/>
191
352
  <field name="placeholders">
192
353
  - {Platform Name} → ${platform_id}
193
354
  - {Feature Name} → ${feature_name}
194
355
  </field>
195
356
  <field name="output_path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
357
+ <field name="output" var="index_doc_created"/>
196
358
  </block>
197
359
 
198
- <block type="task" id="B19" action="edit-file" desc="Fill Tech Stack Summary">
360
+ <block type="task" id="B21" action="edit-file" desc="Fill Tech Stack Summary">
199
361
  <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
200
362
  <field name="operation">search_replace</field>
201
363
  <field name="content_source">${tech_stack}</field>
202
364
  <field name="section">Tech Stack Summary</field>
203
365
  </block>
204
366
 
205
- <block type="task" id="B20" action="edit-file" desc="Fill Shared Design Decisions">
367
+ <block type="task" id="B22" action="edit-file" desc="Fill Shared Design Decisions">
206
368
  <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
207
369
  <field name="operation">search_replace</field>
208
370
  <field name="content_source">${architecture}${conventions_design}</field>
209
371
  <field name="section">Shared Design Decisions</field>
210
372
  </block>
211
373
 
212
- <block type="task" id="B21" action="edit-file" desc="Fill Module List Table">
374
+ <block type="task" id="B23" action="edit-file" desc="Fill Module List Table">
213
375
  <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
214
376
  <field name="operation">search_replace</field>
215
377
  <field name="content_source">${extracted_functions}</field>
216
378
  <field name="section">Module List Table</field>
379
+ <field name="module_list_rules">
380
+ - Column ID: Use feature_id if available (e.g., F-CRM-01), otherwise use module name
381
+ - Column Name: Feature or module name
382
+ - Column Document: Link to design file (e.g., F-CRM-01-customer-list-design.md)
383
+ - Column Status: [NEW], [MODIFIED], or [EXISTING]
384
+ - Example row: | F-CRM-01 | Customer List | F-CRM-01-customer-list-design.md | NEW |
385
+ </field>
217
386
  </block>
218
387
 
219
- <block type="task" id="B22" action="edit-file" desc="Fill Database Schema Overview">
388
+ <block type="task" id="B24" action="edit-file" desc="Fill Cross-Module Interaction Notes">
220
389
  <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
221
390
  <field name="operation">search_replace</field>
222
- <field name="content_source">${extracted_functions}</field>
391
+ <field name="content_source">${architecture}${extracted_functions}</field>
392
+ <field name="section">Cross-Module Interaction Notes</field>
393
+ <field name="rules">
394
+ - Shared services, event-driven patterns, dependencies
395
+ - Cross-Feature dependencies explicitly marked as [DEPENDENCY: F-XXX-NNN]
396
+ </field>
397
+ </block>
398
+
399
+ <block type="task" id="B25" action="edit-file" desc="Fill Database Schema Overview">
400
+ <field name="path">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
401
+ <field name="operation">search_replace</field>
402
+ <field name="content_source">${conventions_data}${extracted_functions}</field>
223
403
  <field name="section">Database Schema Overview</field>
404
+ <field name="rules">
405
+ - New tables, modified tables, entity relationships
406
+ - Migration files and rollback plans
407
+ </field>
408
+ </block>
409
+
410
+ <!-- Step 5.4: Verify INDEX.md Output -->
411
+ <block type="task" id="B26" action="verify" desc="Verify completed INDEX.md">
412
+ <field name="verification_rules">
413
+ - All sections filled with actual content (no remaining placeholders)
414
+ - All module design documents are correctly linked
415
+ - Database schema overview is complete
416
+ - Platform-level summary is complete
417
+ </field>
418
+ <field name="output" var="index_doc_verified"/>
419
+ </block>
420
+
421
+ </branch>
224
422
  </block>
225
423
 
226
424
  <!-- Step 6: Present Summary -->
227
- <block type="event" id="E2" action="log" level="info" desc="Present design summary">
425
+ <block type="event" id="E3" action="log" level="info" desc="Present design summary">
228
426
  <field name="message">Backend System Design Summary for: ${feature_name}
229
427
  Platform: ${platform_id}
230
428
 
231
- Module Designs: ${extracted_functions.design_count}
429
+ Module Design Documents: ${extracted_functions.design_count}
232
430
  ├── [NEW] ${extracted_functions.new_count} modules
233
431
  ├── [MODIFIED] ${extracted_functions.modified_count} modules
234
432
  └── [EXISTING] ${extracted_functions.existing_count} modules (no design needed)
@@ -238,9 +436,45 @@ Database Changes:
238
436
  ├── Modified Tables: ${extracted_functions.modified_tables_count}
239
437
  └── Migration Files: ${extracted_functions.migration_count}
240
438
 
439
+ Key Design Decisions:
440
+ - Data Access: ${conventions_data.orm_pattern}
441
+ - Layer Structure: ${conventions_design.layer_structure}
442
+ - Transaction Strategy: ${conventions_data.transaction_strategy}
443
+
241
444
  Files Generated:
242
445
  - ${iteration_path}/03.system-design/${platform_id}/INDEX.md
243
- ${extracted_functions.file_list}</field>
446
+ ${extracted_functions.file_list}
447
+
448
+ Please confirm:
449
+ 1. Are the module architectures appropriate?
450
+ 2. Is the database design complete with migrations?
451
+ 3. Do the pseudo-code patterns match project conventions?
452
+ 4. Are all API routes from API Contract covered?</field>
453
+ </block>
454
+
455
+ <!-- Step 7: Update Task Status (conditional) -->
456
+ <block type="gateway" id="G4" mode="exclusive" desc="Check if dispatch_progress_file provided">
457
+ <branch test="${dispatch_progress_file} != null AND ${task_id} != null" name="Update task status">
458
+ <block type="gateway" id="G4a" mode="exclusive" desc="Determine success or failure">
459
+ <branch test="${workflow_status} == 'SUCCESS'" name="Mark completed">
460
+ <block type="task" id="B27" action="run-script" desc="Update task status to completed">
461
+ <field name="command">node "${update_progress_script}" update-task --file "${dispatch_progress_file}" --task-id "${task_id}" --status completed</field>
462
+ <field name="output" var="status_update_result"/>
463
+ </block>
464
+ </branch>
465
+ <branch default="true" name="Mark failed">
466
+ <block type="task" id="B28" action="run-script" desc="Update task status to failed">
467
+ <field name="command">node "${update_progress_script}" update-task --file "${dispatch_progress_file}" --task-id "${task_id}" --status failed</field>
468
+ <field name="output" var="status_update_result"/>
469
+ </block>
470
+ </branch>
471
+ </block>
472
+ </branch>
473
+ <branch default="true" name="No status update needed">
474
+ <block type="event" id="E4" action="log" level="info" desc="No dispatch_progress_file provided">
475
+ <field name="message">dispatch_progress_file or task_id not provided, skipping status update</field>
476
+ </block>
477
+ </branch>
244
478
  </block>
245
479
 
246
480
  </sequence>
@@ -248,9 +482,9 @@ ${extracted_functions.file_list}</field>
248
482
  <!-- ============================================================
249
483
  Output Results
250
484
  ============================================================ -->
251
- <block type="output" id="O1" desc="Workflow output results">
485
+ <block type="output" id="O1" desc="Workflow output results - SUCCESS scenario">
252
486
  <field name="status" value="SUCCESS" type="string" desc="Task completion status"/>
253
- <field name="task_id" from="${task_id}" type="string" desc="Task ID"/>
487
+ <field name="task_id" from="${task_id}" type="string" desc="Task ID from context"/>
254
488
  <field name="platform" value="${platform_id}" type="string" desc="Target platform"/>
255
489
  <field name="feature_id" from="${feature_id}" type="string" desc="Feature ID"/>
256
490
  <field name="feature" value="${feature_name}" type="string" desc="Feature name"/>
@@ -258,7 +492,51 @@ ${extracted_functions.file_list}</field>
258
492
  <field name="file">${iteration_path}/03.system-design/${platform_id}/INDEX.md</field>
259
493
  <field name="files" from="${extracted_functions.output_files}"/>
260
494
  </field>
261
- <field name="summary" value="Backend system design completed for ${feature_name} on ${platform_id}" type="string" desc="Completion summary"/>
495
+ <field name="database_changes" type="object" desc="Database change summary">
496
+ <field name="new_tables" from="${extracted_functions.new_tables_count}" type="number"/>
497
+ <field name="modified_tables" from="${extracted_functions.modified_tables_count}" type="number"/>
498
+ <field name="migration_files" from="${extracted_functions.migration_count}" type="number"/>
499
+ </field>
500
+ <field name="summary" value="Backend system design completed for ${feature_name} on ${platform_id} with ${extracted_functions.design_count} module designs" type="string" desc="Completion summary"/>
501
+ </block>
502
+
503
+ <block type="output" id="O2" desc="Workflow output results - FAILED scenario">
504
+ <field name="status" value="FAILED" type="string" desc="Task completion status"/>
505
+ <field name="task_id" from="${task_id}" type="string" desc="Task ID from context"/>
506
+ <field name="platform" value="${platform_id}" type="string" desc="Target platform"/>
507
+ <field name="feature_id" from="${feature_id}" type="string" desc="Feature ID"/>
508
+ <field name="feature" value="${feature_name}" type="string" desc="Feature name"/>
509
+ <field name="output_files" value="[]" type="array" desc="No output files generated"/>
510
+ <field name="error" type="string" desc="Description of what went wrong"/>
511
+ <field name="error_category" type="string" desc="DEPENDENCY_MISSING | VALIDATION_ERROR | BLOCKED"/>
512
+ <field name="recovery_hint" type="string" desc="Suggestion for how to resolve or retry"/>
513
+ </block>
514
+
515
+ <!-- ============================================================
516
+ Quality Verification Checklist
517
+ ============================================================ -->
518
+ <block type="checklist" id="CK1" desc="Quality verification checklist">
519
+ <field name="item">All techs knowledge documents loaded before design</field>
520
+ <field name="item">Feature Spec and API Contract read and understood</field>
521
+ <field name="item">Existing codebase structure analyzed (Glob/Grep)</field>
522
+ <field name="item">Every Feature Spec function covered in a module design</field>
523
+ <field name="item">All API routes from API Contract referenced correctly</field>
524
+ <field name="item">Pseudo-code uses actual framework syntax (not generic)</field>
525
+ <field name="item">Module naming follows conventions-design.md</field>
526
+ <field name="item">Layer structure follows conventions-design.md</field>
527
+ <field name="item">ORM patterns follow conventions-data.md</field>
528
+ <field name="item">Database entities cover all data requirements from Feature Spec</field>
529
+ <field name="item">Transaction boundaries defined for multi-step operations</field>
530
+ <field name="item">Exception types map to API Contract error codes</field>
531
+ <field name="item">Migration requirements documented</field>
532
+ <field name="item">INDEX.md generated with complete module list</field>
533
+ <field name="item">All files written to correct paths under 03.system-design/{platform_id}/</field>
534
+ <field name="item">Output file named as {feature_id}-{feature_name}-design.md</field>
535
+ <field name="item">Checkpoint A passed (or skipped via skip_confirmation)</field>
536
+ <field name="item">No TODO/FIXME placeholders - all methods have complete pseudocode</field>
537
+ <field name="item">API routes match API Contract exactly</field>
538
+ <field name="item">Cross-Feature dependencies explicitly marked</field>
539
+ <field name="item">All Mermaid diagrams follow compatibility guidelines</field>
262
540
  </block>
263
541
 
264
542
  </workflow>