speccrew 0.6.42 → 0.6.44

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.
@@ -60,391 +60,475 @@ flowchart TD
60
60
 
61
61
  > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `docs/rules/xml-workflow-spec.md`
62
62
 
63
- <workflow>
64
- <!-- Input Block: Define workflow inputs -->
65
- <input name="modules_path" type="string" required="true" />
66
- <input name="output_path" type="string" required="true" />
67
- <input name="language" type="string" required="true" />
63
+ <workflow id="system-summarize-main" status="pending" version="1.0" desc="System summarization workflow">
64
+ <!-- ============================================================
65
+ Input Parameters Definition
66
+ ============================================================ -->
67
+ <block type="input" id="I1" desc="System summarization input parameters">
68
+ <field name="modules_path" required="true" type="string" desc="Path to modules directory"/>
69
+ <field name="output_path" required="true" type="string" desc="Output path for system-overview.md"/>
70
+ <field name="language" required="true" type="string" desc="Target language for generated content"/>
71
+ </block>
72
+
73
+ <!-- ============================================================
74
+ Global Continuous Execution Rules
75
+ ============================================================ -->
76
+ <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
77
+ <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" during execution</field>
78
+ <field name="text">DO NOT offer options like "Full execution / Partial / Stop" — always execute ALL tasks to completion</field>
79
+ <field name="text">DO NOT suggest "Due to context window limits, let me pause" — complete current task, use checkpoint for resumption</field>
80
+ <field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL items in sequence</field>
81
+ <field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
82
+ <field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
83
+ </block>
84
+
85
+ <!-- ============================================================
86
+ Edge Case Rules
87
+ ============================================================ -->
88
+ <block type="rule" id="R-NOTE1" level="note" desc="Edge case handling">
89
+ <field name="text">Empty modules directory: Generate skeleton with warning status if no *-overview.md files found</field>
90
+ </block>
91
+ <block type="rule" id="R-NOTE2" level="note" desc="Incomplete data handling">
92
+ <field name="text">Incomplete module overviews: Use available data and mark gaps with <!-- DATA INCOMPLETE --></field>
93
+ </block>
94
+ <block type="rule" id="R-NOTE3" level="note" desc="Module name conflict handling">
95
+ <field name="text">Same module name from different platforms: Treat as separate modules with platform annotation</field>
96
+ </block>
68
97
 
69
98
  <!-- Prerequisites Verification -->
70
- <event action="log" level="info">Starting system summarization workflow</event>
71
-
72
- <!-- Edge Case Rules -->
73
- <rule level="note">Empty modules directory: Generate skeleton with warning status if no *-overview.md files found</rule>
74
- <rule level="note">Incomplete module overviews: Use available data and mark gaps with <!-- DATA INCOMPLETE --></rule>
75
- <rule level="note">Same module name from different platforms: Treat as separate modules with platform annotation</rule>
99
+ <block type="event" id="E1" action="log" level="info" desc="Log workflow start">
100
+ Starting system summarization workflow
101
+ </block>
76
102
 
77
103
  <!-- Step 0: Read System Overview Template -->
78
- <task name="read_template" action="run-skill" skill="Read">
79
- <param name="file_path">../speccrew-knowledge-system-summarize/templates/SYSTEM-OVERVIEW-TEMPLATE.md</param>
80
- <output name="template_content" />
81
- </task>
104
+ <block type="task" id="B0" action="run-skill" desc="Read system overview template">
105
+ <field name="skill">Read</field>
106
+ <field name="file_path" value="../speccrew-knowledge-system-summarize/templates/SYSTEM-OVERVIEW-TEMPLATE.md"/>
107
+ <field name="output" var="template_content"/>
108
+ </block>
82
109
 
83
110
  <!-- Checkpoint: Template loaded -->
84
- <checkpoint name="template_loaded" verify="template_content != null" />
111
+ <block type="checkpoint" id="CP0" name="template_loaded" desc="Template loaded successfully">
112
+ <field name="verify" value="${template_content} != null"/>
113
+ </block>
85
114
 
86
115
  <!-- Step 1: Discover All Modules -->
87
- <task name="discover_modules" action="run-skill" skill="Glob">
88
- <param name="pattern">{{modules_path}}/**/*-overview.md</param>
89
- <output name="module_files" />
90
- </task>
116
+ <block type="task" id="B1" action="run-skill" desc="Discover all module overview files">
117
+ <field name="skill">Glob</field>
118
+ <field name="pattern" value="${modules_path}/**/*-overview.md"/>
119
+ <field name="output" var="module_files"/>
120
+ </block>
91
121
 
92
122
  <!-- Gateway: Handle empty modules directory -->
93
- <gateway name="check_modules" mode="exclusive">
94
- <branch condition="module_files.length == 0">
95
- <event action="log" level="warning">No module overview files found in {{modules_path}}</event>
96
- <task name="generate_skeleton" action="run-script">
97
- <param name="script">generate-skeleton.js</param>
98
- <param name="template">{{template_content}}</param>
99
- <output name="skeleton_doc" />
100
- </task>
101
- <task name="write_skeleton" action="run-skill" skill="Write">
102
- <param name="file_path">{{output_path}}/system-overview.md</param>
103
- <param name="content">{{skeleton_doc}}</param>
104
- </task>
105
- <output name="status" from="warning" />
106
- <event action="signal">workflow_complete_with_warning</event>
123
+ <block type="gateway" id="G1" mode="exclusive" desc="Check if modules discovered">
124
+ <branch test="${module_files.length} == 0" name="No modules">
125
+ <block type="event" id="E2" action="log" level="warning" desc="Log no modules found">
126
+ No module overview files found in ${modules_path}
127
+ </block>
128
+ <block type="task" id="B2" action="run-script" desc="Generate skeleton document">
129
+ <field name="script" value="generate-skeleton.js"/>
130
+ <field name="template" value="${template_content}"/>
131
+ <field name="output" var="skeleton_doc"/>
132
+ </block>
133
+ <block type="task" id="B3" action="run-skill" desc="Write skeleton document">
134
+ <field name="skill">Write</field>
135
+ <field name="file_path" value="${output_path}/system-overview.md"/>
136
+ <field name="content" value="${skeleton_doc}"/>
137
+ </block>
138
+ <block type="output" id="O-early" desc="Early output for empty case">
139
+ <field name="status" value="warning"/>
140
+ </block>
141
+ <block type="event" id="E3" action="signal" desc="Signal workflow complete">
142
+ <field name="signal" value="workflow_complete_with_warning"/>
143
+ </block>
107
144
  </branch>
108
- <branch condition="module_files.length > 0">
109
- <event action="log" level="info">Discovered {{module_files.length}} module overview files</event>
145
+ <branch test="${module_files.length} > 0" name="Modules found">
146
+ <block type="event" id="E4" action="log" level="info" desc="Log modules discovered">
147
+ Discovered ${module_files.length} module overview files
148
+ </block>
110
149
  </branch>
111
- </gateway>
150
+ </block>
112
151
 
113
152
  <!-- Extract platform types from paths -->
114
- <loop name="extract_platforms" over="module_files" as="module_file">
115
- <task name="parse_platform" action="run-script">
116
- <param name="script">extract-platform.js</param>
117
- <param name="file_path">{{module_file}}</param>
118
- <output name="platform_info" />
119
- </task>
120
- </loop>
153
+ <block type="loop" id="L1" over="${module_files}" as="module_file" desc="Extract platform types from paths">
154
+ <block type="task" id="B4" action="run-script" desc="Parse platform from file path">
155
+ <field name="script" value="extract-platform.js"/>
156
+ <field name="file_path" value="${module_file}"/>
157
+ <field name="output" var="platform_info"/>
158
+ </block>
159
+ </block>
121
160
 
122
161
  <!-- Checkpoint: Modules discovered -->
123
- <checkpoint name="modules_discovered" verify="module_files.length > 0" />
162
+ <block type="checkpoint" id="CP1" name="modules_discovered" desc="Modules discovery complete">
163
+ <field name="verify" value="${module_files.length} > 0"/>
164
+ </block>
124
165
 
125
166
  <!-- Step 2: Read All Module Overviews -->
126
- <loop name="read_modules" over="module_files" as="module_file">
127
- <task name="read_module" action="run-skill" skill="Read">
128
- <param name="file_path">{{module_file}}</param>
129
- <output name="module_content" />
130
- </task>
131
- <task name="extract_module_info" action="run-script">
132
- <param name="script">extract-module-info.js</param>
133
- <param name="content">{{module_content}}</param>
134
- <param name="file_path">{{module_file}}</param>
135
- <output name="module_info" />
136
- </task>
137
- </loop>
167
+ <block type="loop" id="L2" over="${module_files}" as="module_file" desc="Read all module overview files">
168
+ <block type="task" id="B5" action="run-skill" desc="Read module overview">
169
+ <field name="skill">Read</field>
170
+ <field name="file_path" value="${module_file}"/>
171
+ <field name="output" var="module_content"/>
172
+ </block>
173
+ <block type="task" id="B6" action="run-script" desc="Extract module info">
174
+ <field name="script" value="extract-module-info.js"/>
175
+ <field name="content" value="${module_content}"/>
176
+ <field name="file_path" value="${module_file}"/>
177
+ <field name="output" var="module_info"/>
178
+ </block>
179
+ </block>
138
180
 
139
181
  <!-- Checkpoint: Module info extracted -->
140
- <checkpoint name="modules_read" verify="module_infos.length == module_files.length" />
182
+ <block type="checkpoint" id="CP2" name="modules_read" desc="All modules read successfully">
183
+ <field name="verify" value="${module_infos.length} == ${module_files.length}"/>
184
+ </block>
141
185
 
142
186
  <!-- Step 3: Build Module Index -->
143
- <task name="build_index" action="run-script">
144
- <param name="script">build-module-index.js</param>
145
- <param name="modules">{{module_infos}}</param>
146
- <output name="module_index" />
147
- </task>
187
+ <block type="task" id="B7" action="run-script" desc="Build module index">
188
+ <field name="script" value="build-module-index.js"/>
189
+ <field name="modules" value="${module_infos}"/>
190
+ <field name="output" var="module_index"/>
191
+ </block>
148
192
 
149
193
  <!-- Create index table rows -->
150
- <loop name="create_index_rows" over="module_infos" as="module_info">
151
- <task name="create_index_row" action="run-script">
152
- <param name="script">create-index-row.js</param>
153
- <param name="module">{{module_info}}</param>
154
- <param name="language">{{language}}</param>
155
- <output name="index_row" />
156
- </task>
157
- </loop>
194
+ <block type="loop" id="L3" over="${module_infos}" as="module_info" desc="Create index table rows">
195
+ <block type="task" id="B8" action="run-script" desc="Create index row">
196
+ <field name="script" value="create-index-row.js"/>
197
+ <field name="module" value="${module_info}"/>
198
+ <field name="language" value="${language}"/>
199
+ <field name="output" var="index_row"/>
200
+ </block>
201
+ </block>
158
202
 
159
203
  <!-- Checkpoint: Index built -->
160
- <checkpoint name="index_built" verify="module_index != null" />
204
+ <block type="checkpoint" id="CP3" name="index_built" desc="Module index built">
205
+ <field name="verify" value="${module_index} != null"/>
206
+ </block>
161
207
 
162
208
  <!-- Step 4: Build Dependency Graph -->
163
- <task name="extract_dependencies" action="run-script">
164
- <param name="script">extract-all-dependencies.js</param>
165
- <param name="modules">{{module_infos}}</param>
166
- <output name="all_dependencies" />
167
- </task>
209
+ <block type="task" id="B9" action="run-script" desc="Extract all dependencies">
210
+ <field name="script" value="extract-all-dependencies.js"/>
211
+ <field name="modules" value="${module_infos}"/>
212
+ <field name="output" var="all_dependencies"/>
213
+ </block>
168
214
 
169
215
  <!-- Classify dependencies -->
170
- <loop name="classify_dependencies" over="all_dependencies" as="dependency">
171
- <gateway name="dep_type" mode="exclusive">
172
- <branch condition="dependency.type == 'internal'">
173
- <output name="internal_deps" append="{{dependency}}" />
216
+ <block type="loop" id="L4" over="${all_dependencies}" as="dependency" desc="Classify dependencies by type">
217
+ <block type="gateway" id="G2" mode="exclusive" desc="Classify dependency type">
218
+ <branch test="${dependency.type} == 'internal'" name="Internal dependency">
219
+ <block type="output" id="O-int" desc="Add to internal deps">
220
+ <field name="internal_deps" append="${dependency}"/>
221
+ </block>
174
222
  </branch>
175
- <branch condition="dependency.type == 'external'">
176
- <output name="external_deps" append="{{dependency}}" />
223
+ <branch test="${dependency.type} == 'external'" name="External dependency">
224
+ <block type="output" id="O-ext" desc="Add to external deps">
225
+ <field name="external_deps" append="${dependency}"/>
226
+ </block>
177
227
  </branch>
178
- <branch condition="dependency.type == 'cross_platform'">
179
- <output name="cross_platform_deps" append="{{dependency}}" />
228
+ <branch test="${dependency.type} == 'cross_platform'" name="Cross-platform dependency">
229
+ <block type="output" id="O-cross" desc="Add to cross-platform deps">
230
+ <field name="cross_platform_deps" append="${dependency}"/>
231
+ </block>
180
232
  </branch>
181
- </gateway>
182
- </loop>
233
+ </block>
234
+ </block>
183
235
 
184
236
  <!-- Build directed graph -->
185
- <task name="build_dependency_graph" action="run-script">
186
- <param name="script">build-dep-graph.js</param>
187
- <param name="internal_deps">{{internal_deps}}</param>
188
- <param name="cross_platform_deps">{{cross_platform_deps}}</param>
189
- <output name="dependency_graph" />
190
- </task>
237
+ <block type="task" id="B10" action="run-script" desc="Build dependency graph">
238
+ <field name="script" value="build-dep-graph.js"/>
239
+ <field name="internal_deps" value="${internal_deps}"/>
240
+ <field name="cross_platform_deps" value="${cross_platform_deps}"/>
241
+ <field name="output" var="dependency_graph"/>
242
+ </block>
191
243
 
192
244
  <!-- Generate Mermaid diagram -->
193
- <task name="generate_mermaid_deps" action="run-script">
194
- <param name="script">generate-mermaid-diagram.js</param>
195
- <param name="graph">{{dependency_graph}}</param>
196
- <param name="diagram_type">graph LR</param>
197
- <output name="mermaid_deps" />
198
- </task>
245
+ <block type="task" id="B11" action="run-script" desc="Generate Mermaid dependency diagram">
246
+ <field name="script" value="generate-mermaid-diagram.js"/>
247
+ <field name="graph" value="${dependency_graph}"/>
248
+ <field name="diagram_type" value="graph LR"/>
249
+ <field name="output" var="mermaid_deps"/>
250
+ </block>
199
251
 
200
252
  <!-- Checkpoint: Dependency graph built -->
201
- <checkpoint name="deps_built" verify="dependency_graph.nodes.length > 0" />
253
+ <block type="checkpoint" id="CP4" name="deps_built" desc="Dependency graph built">
254
+ <field name="verify" value="${dependency_graph.nodes.length} > 0"/>
255
+ </block>
202
256
 
203
257
  <!-- Step 5: Identify Business Domains -->
204
- <task name="extract_domains" action="run-script">
205
- <param name="script">extract-domains.js</param>
206
- <param name="modules">{{module_infos}}</param>
207
- <output name="business_domains" />
208
- </task>
258
+ <block type="task" id="B12" action="run-script" desc="Extract business domains">
259
+ <field name="script" value="extract-domains.js"/>
260
+ <field name="modules" value="${module_infos}"/>
261
+ <field name="output" var="business_domains"/>
262
+ </block>
209
263
 
210
264
  <!-- Group modules by domain -->
211
- <loop name="group_by_domain" over="business_domains" as="domain">
212
- <task name="find_domain_modules" action="run-script">
213
- <param name="script">find-domain-modules.js</param>
214
- <param name="domain">{{domain}}</param>
215
- <param name="modules">{{module_infos}}</param>
216
- <output name="domain_modules" />
217
- </task>
218
- </loop>
265
+ <block type="loop" id="L5" over="${business_domains}" as="domain" desc="Group modules by domain">
266
+ <block type="task" id="B13" action="run-script" desc="Find domain modules">
267
+ <field name="script" value="find-domain-modules.js"/>
268
+ <field name="domain" value="${domain}"/>
269
+ <field name="modules" value="${module_infos}"/>
270
+ <field name="output" var="domain_modules"/>
271
+ </block>
272
+ </block>
219
273
 
220
274
  <!-- Generate domain diagram -->
221
- <task name="generate_domain_diagram" action="run-script">
222
- <param name="script">generate-domain-diagram.js</param>
223
- <param name="domains">{{business_domains}}</param>
224
- <param name="module_groups">{{domain_module_groups}}</param>
225
- <output name="domain_diagram" />
226
- </task>
275
+ <block type="task" id="B14" action="run-script" desc="Generate domain diagram">
276
+ <field name="script" value="generate-domain-diagram.js"/>
277
+ <field name="domains" value="${business_domains}"/>
278
+ <field name="module_groups" value="${domain_module_groups}"/>
279
+ <field name="output" var="domain_diagram"/>
280
+ </block>
227
281
 
228
282
  <!-- Checkpoint: Domains identified -->
229
- <checkpoint name="domains_identified" verify="business_domains.length > 0" />
283
+ <block type="checkpoint" id="CP5" name="domains_identified" desc="Business domains identified">
284
+ <field name="verify" value="${business_domains.length} > 0"/>
285
+ </block>
230
286
 
231
287
  <!-- Step 6: Identify End-to-End Flows -->
232
- <task name="analyze_flows" action="run-script">
233
- <param name="script">analyze-cross-module-flows.js</param>
234
- <param name="dependencies">{{all_dependencies}}</param>
235
- <param name="modules">{{module_infos}}</param>
236
- <output name="end_to_end_flows" />
237
- </task>
288
+ <block type="task" id="B15" action="run-script" desc="Analyze cross-module flows">
289
+ <field name="script" value="analyze-cross-module-flows.js"/>
290
+ <field name="dependencies" value="${all_dependencies}"/>
291
+ <field name="modules" value="${module_infos}"/>
292
+ <field name="output" var="end_to_end_flows"/>
293
+ </block>
238
294
 
239
295
  <!-- Create flow-module mapping matrix -->
240
- <loop name="build_flow_matrix" over="end_to_end_flows" as="flow">
241
- <task name="map_flow_modules" action="run-script">
242
- <param name="script">map-flow-modules.js</param>
243
- <param name="flow">{{flow}}</param>
244
- <param name="modules">{{module_infos}}</param>
245
- <output name="flow_mapping" />
246
- </task>
247
- </loop>
296
+ <block type="loop" id="L6" over="${end_to_end_flows}" as="flow" desc="Build flow-module matrix">
297
+ <block type="task" id="B16" action="run-script" desc="Map flow to modules">
298
+ <field name="script" value="map-flow-modules.js"/>
299
+ <field name="flow" value="${flow}"/>
300
+ <field name="modules" value="${module_infos}"/>
301
+ <field name="output" var="flow_mapping"/>
302
+ </block>
303
+ </block>
248
304
 
249
305
  <!-- Checkpoint: Flows identified -->
250
- <checkpoint name="flows_identified" verify="end_to_end_flows.length >= 0" />
306
+ <block type="checkpoint" id="CP6" name="flows_identified" desc="End-to-end flows identified">
307
+ <field name="verify" value="${end_to_end_flows.length} >= 0"/>
308
+ </block>
251
309
 
252
310
  <!-- Step 7: Generate system-overview.md -->
253
311
  <!-- Phase A: Skeleton Construction -->
254
- <task name="count_modules" action="run-script">
255
- <param name="script">count-items.js</param>
256
- <param name="items">{{module_infos}}</param>
257
- <output name="module_count" />
258
- </task>
259
-
260
- <task name="count_flows" action="run-script">
261
- <param name="script">count-items.js</param>
262
- <param name="items">{{end_to_end_flows}}</param>
263
- <output name="flow_count" />
264
- </task>
265
-
266
- <task name="count_integrations" action="run-script">
267
- <param name="script">count-items.js</param>
268
- <param name="items">{{external_deps}}</param>
269
- <output name="integration_count" />
270
- </task>
312
+ <block type="task" id="B17" action="run-script" desc="Count modules">
313
+ <field name="script" value="count-items.js"/>
314
+ <field name="items" value="${module_infos}"/>
315
+ <field name="output" var="module_count"/>
316
+ </block>
317
+
318
+ <block type="task" id="B18" action="run-script" desc="Count flows">
319
+ <field name="script" value="count-items.js"/>
320
+ <field name="items" value="${end_to_end_flows}"/>
321
+ <field name="output" var="flow_count"/>
322
+ </block>
323
+
324
+ <block type="task" id="B19" action="run-script" desc="Count integrations">
325
+ <field name="script" value="count-items.js"/>
326
+ <field name="items" value="${external_deps}"/>
327
+ <field name="output" var="integration_count"/>
328
+ </block>
271
329
 
272
330
  <!-- Read tech stack mappings -->
273
- <task name="read_tech_mappings" action="run-skill" skill="Read">
274
- <param name="file_path">speccrew-workspace/docs/configs/tech-stack-mappings.json</param>
275
- <output name="tech_mappings" />
276
- </task>
331
+ <block type="task" id="B20" action="run-skill" desc="Read tech stack mappings">
332
+ <field name="skill">Read</field>
333
+ <field name="file_path" value="speccrew-workspace/docs/configs/tech-stack-mappings.json"/>
334
+ <field name="output" var="tech_mappings"/>
335
+ </block>
277
336
 
278
337
  <!-- Read Mermaid rules -->
279
- <task name="read_mermaid_rules" action="run-skill" skill="Read">
280
- <param name="file_path">speccrew-workspace/docs/rules/mermaid-rule.md</param>
281
- <output name="mermaid_rules" />
282
- </task>
338
+ <block type="task" id="B21" action="run-skill" desc="Read Mermaid rules">
339
+ <field name="skill">Read</field>
340
+ <field name="file_path" value="speccrew-workspace/docs/rules/mermaid-rule.md"/>
341
+ <field name="output" var="mermaid_rules"/>
342
+ </block>
283
343
 
284
344
  <!-- Get timestamp via script -->
285
- <task name="get_timestamp" action="run-script" description="Get current timestamp">
286
- <run-script script="scripts/get-timestamp.js" output="timestamp" />
287
- </task>
345
+ <block type="task" id="B22" action="run-script" desc="Get current timestamp">
346
+ <field name="script" value="scripts/get-timestamp.js"/>
347
+ <field name="output" var="timestamp"/>
348
+ </block>
288
349
 
289
350
  <!-- Gateway: Fallback for timestamp -->
290
- <gateway name="check_timestamp" mode="exclusive">
291
- <branch condition="timestamp == null">
292
- <task name="fallback_timestamp" action="run-script">
293
- <param name="script">get-system-time.js</param>
294
- <output name="timestamp" />
295
- </task>
296
- <event action="log" level="warning">Using system fallback timestamp</event>
351
+ <block type="gateway" id="G3" mode="exclusive" desc="Check timestamp">
352
+ <branch test="${timestamp} == null" name="No timestamp">
353
+ <block type="task" id="B23" action="run-script" desc="Get system fallback timestamp">
354
+ <field name="script" value="get-system-time.js"/>
355
+ <field name="output" var="timestamp"/>
356
+ </block>
357
+ <block type="event" id="E5" action="log" level="warning" desc="Log fallback">
358
+ Using system fallback timestamp
359
+ </block>
297
360
  </branch>
298
- </gateway>
361
+ </block>
299
362
 
300
363
  <!-- Determine technology stack -->
301
- <task name="determine_tech_stack" action="run-script">
302
- <param name="script">determine-tech-stack.js</param>
303
- <param name="platforms">{{extracted_platforms}}</param>
304
- <param name="mappings">{{tech_mappings}}</param>
305
- <output name="tech_stack" />
306
- </task>
364
+ <block type="task" id="B24" action="run-script" desc="Determine tech stack">
365
+ <field name="script" value="determine-tech-stack.js"/>
366
+ <field name="platforms" value="${extracted_platforms}"/>
367
+ <field name="mappings" value="${tech_mappings}"/>
368
+ <field name="output" var="tech_stack"/>
369
+ </block>
307
370
 
308
371
  <!-- Create skeleton structure -->
309
- <task name="create_skeleton" action="run-script">
310
- <param name="script">create-system-skeleton.js</param>
311
- <param name="template">{{template_content}}</param>
312
- <param name="module_count">{{module_count}}</param>
313
- <param name="flow_count">{{flow_count}}</param>
314
- <param name="integration_count">{{integration_count}}</param>
315
- <param name="timestamp">{{timestamp}}</param>
316
- <param name="tech_stack">{{tech_stack}}</param>
317
- <param name="language">{{language}}</param>
318
- <output name="document_skeleton" />
319
- </task>
372
+ <block type="task" id="B25" action="run-script" desc="Create document skeleton">
373
+ <field name="script" value="create-system-skeleton.js"/>
374
+ <field name="template" value="${template_content}"/>
375
+ <field name="module_count" value="${module_count}"/>
376
+ <field name="flow_count" value="${flow_count}"/>
377
+ <field name="integration_count" value="${integration_count}"/>
378
+ <field name="timestamp" value="${timestamp}"/>
379
+ <field name="tech_stack" value="${tech_stack}"/>
380
+ <field name="language" value="${language}"/>
381
+ <field name="output" var="document_skeleton"/>
382
+ </block>
320
383
 
321
384
  <!-- Rule: Skeleton must be complete before filling -->
322
- <rule level="mandatory">DO NOT start filling content until the complete skeleton is verified</rule>
385
+ <block type="rule" id="R-MAND1" level="mandatory" desc="Skeleton completion rule">
386
+ <field name="text">DO NOT start filling content until the complete skeleton is verified</field>
387
+ </block>
323
388
 
324
389
  <!-- Checkpoint: Skeleton ready -->
325
- <checkpoint name="skeleton_ready" verify="document_skeleton != null AND document_skeleton.contains('[TO BE FILLED]')" />
390
+ <block type="checkpoint" id="CP7" name="skeleton_ready" desc="Document skeleton ready">
391
+ <field name="verify" value="${document_skeleton} != null AND ${document_skeleton}.contains('[TO BE FILLED]')"/>
392
+ </block>
326
393
 
327
394
  <!-- Phase B: Content Filling -->
328
395
  <!-- Fill Index and Overview section -->
329
- <task name="fill_index_section" action="run-script">
330
- <param name="script">fill-index-section.js</param>
331
- <param name="skeleton">{{document_skeleton}}</param>
332
- <param name="timestamp">{{timestamp}}</param>
333
- <param name="tech_stack">{{tech_stack}}</param>
334
- <param name="statistics">{{aggregated_stats}}</param>
335
- <param name="module_index">{{module_index}}</param>
336
- <output name="filled_index" />
337
- </task>
396
+ <block type="task" id="B26" action="run-script" desc="Fill index section">
397
+ <field name="script" value="fill-index-section.js"/>
398
+ <field name="skeleton" value="${document_skeleton}"/>
399
+ <field name="timestamp" value="${timestamp}"/>
400
+ <field name="tech_stack" value="${tech_stack}"/>
401
+ <field name="statistics" value="${aggregated_stats}"/>
402
+ <field name="module_index" value="${module_index}"/>
403
+ <field name="output" var="filled_index"/>
404
+ </block>
338
405
 
339
406
  <!-- Fill Section 1: System Overview -->
340
- <task name="fill_system_overview" action="run-script">
341
- <param name="script">fill-system-overview.js</param>
342
- <param name="skeleton">{{filled_index}}</param>
343
- <param name="modules">{{module_infos}}</param>
344
- <param name="language">{{language}}</param>
345
- <output name="filled_section1" />
346
- </task>
407
+ <block type="task" id="B27" action="run-script" desc="Fill system overview section">
408
+ <field name="script" value="fill-system-overview.js"/>
409
+ <field name="skeleton" value="${filled_index}"/>
410
+ <field name="modules" value="${module_infos}"/>
411
+ <field name="language" value="${language}"/>
412
+ <field name="output" var="filled_section1"/>
413
+ </block>
347
414
 
348
415
  <!-- Fill Section 2: Module Topology -->
349
- <task name="fill_module_topology" action="run-script">
350
- <param name="script">fill-module-topology.js</param>
351
- <param name="skeleton">{{filled_section1}}</param>
352
- <param name="domain_diagram">{{domain_diagram}}</param>
353
- <param name="dependency_graph">{{dependency_graph}}</param>
354
- <param name="mermaid_deps">{{mermaid_deps}}</param>
355
- <param name="module_index">{{module_index}}</param>
356
- <param name="language">{{language}}</param>
357
- <output name="filled_section2" />
358
- </task>
416
+ <block type="task" id="B28" action="run-script" desc="Fill module topology section">
417
+ <field name="script" value="fill-module-topology.js"/>
418
+ <field name="skeleton" value="${filled_section1}"/>
419
+ <field name="domain_diagram" value="${domain_diagram}"/>
420
+ <field name="dependency_graph" value="${dependency_graph}"/>
421
+ <field name="mermaid_deps" value="${mermaid_deps}"/>
422
+ <field name="module_index" value="${module_index}"/>
423
+ <field name="language" value="${language}"/>
424
+ <field name="output" var="filled_section2"/>
425
+ </block>
359
426
 
360
427
  <!-- Fill Section 3: End-to-End Business Flows -->
361
- <task name="fill_business_flows" action="run-script">
362
- <param name="script">fill-business-flows.js</param>
363
- <param name="skeleton">{{filled_section2}}</param>
364
- <param name="flows">{{end_to_end_flows}}</param>
365
- <param name="flow_mappings">{{flow_mappings}}</param>
366
- <param name="modules">{{module_infos}}</param>
367
- <param name="language">{{language}}</param>
368
- <output name="filled_section3" />
369
- </task>
428
+ <block type="task" id="B29" action="run-script" desc="Fill business flows section">
429
+ <field name="script" value="fill-business-flows.js"/>
430
+ <field name="skeleton" value="${filled_section2}"/>
431
+ <field name="flows" value="${end_to_end_flows}"/>
432
+ <field name="flow_mappings" value="${flow_mappings}"/>
433
+ <field name="modules" value="${module_infos}"/>
434
+ <field name="language" value="${language}"/>
435
+ <field name="output" var="filled_section3"/>
436
+ </block>
370
437
 
371
438
  <!-- Fill Section 4: System Boundaries and Integration -->
372
- <task name="fill_system_boundaries" action="run-script">
373
- <param name="script">fill-system-boundaries.js</param>
374
- <param name="skeleton">{{filled_section3}}</param>
375
- <param name="external_deps">{{external_deps}}</param>
376
- <param name="language">{{language}}</param>
377
- <output name="filled_section4" />
378
- </task>
439
+ <block type="task" id="B30" action="run-script" desc="Fill system boundaries section">
440
+ <field name="script" value="fill-system-boundaries.js"/>
441
+ <field name="skeleton" value="${filled_section3}"/>
442
+ <field name="external_deps" value="${external_deps}"/>
443
+ <field name="language" value="${language}"/>
444
+ <field name="output" var="filled_section4"/>
445
+ </block>
379
446
 
380
447
  <!-- Fill Section 5: Requirement Assessment Guide -->
381
- <task name="fill_assessment_guide" action="run-script">
382
- <param name="script">fill-assessment-guide.js</param>
383
- <param name="skeleton">{{filled_section4}}</param>
384
- <param name="language">{{language}}</param>
385
- <output name="filled_section5" />
386
- </task>
448
+ <block type="task" id="B31" action="run-script" desc="Fill assessment guide section">
449
+ <field name="script" value="fill-assessment-guide.js"/>
450
+ <field name="skeleton" value="${filled_section4}"/>
451
+ <field name="language" value="${language}"/>
452
+ <field name="output" var="filled_section5"/>
453
+ </block>
387
454
 
388
455
  <!-- Error Handler for document writing -->
389
- <error-handler>
456
+ <block type="error-handler" id="EH1" desc="Document write error handling">
390
457
  <try>
391
458
  <!-- Step 7a: Prepare Document -->
392
- <task name="write_document" action="run-skill" skill="Write">
393
- <param name="file_path">{{output_path}}/system-overview.md</param>
394
- <param name="content">{{filled_section5}}</param>
395
- </task>
459
+ <block type="task" id="B32" action="run-skill" desc="Write document to file">
460
+ <field name="skill">Write</field>
461
+ <field name="file_path" value="${output_path}/system-overview.md"/>
462
+ <field name="content" value="${filled_section5}"/>
463
+ </block>
396
464
  </try>
397
- <catch error="write_error">
398
- <event action="log" level="error">Failed to write system overview: {{write_error.message}}</event>
399
- <output name="status" from="failed" />
465
+ <catch error-type="write_error">
466
+ <block type="event" id="E6" action="log" level="error" desc="Log write error">
467
+ Failed to write system overview: ${write_error.message}
468
+ </block>
469
+ <block type="output" id="O-err" desc="Error output">
470
+ <field name="status" value="failed"/>
471
+ </block>
400
472
  </catch>
401
473
  <finally>
402
- <event action="log" level="info">Document write operation completed</event>
474
+ <block type="event" id="E7" action="log" level="info" desc="Log write complete">
475
+ Document write operation completed
476
+ </block>
403
477
  </finally>
404
- </error-handler>
478
+ </block>
405
479
 
406
480
  <!-- Rule: Critical constraints -->
407
- <rule level="forbidden">FORBIDDEN: create_file for documents - Document MUST be created by copying template then filling with search_replace</rule>
408
- <rule level="forbidden">FORBIDDEN: Full-file rewrite - Always use targeted search_replace on specific sections</rule>
409
- <rule level="mandatory">MANDATORY: Template-first workflow - Step 7a MUST execute before Step 7b</rule>
481
+ <block type="rule" id="R-FORB1" level="forbidden" desc="Document creation constraint">
482
+ <field name="text">FORBIDDEN: create_file for documents - Document MUST be created by copying template then filling with search_replace</field>
483
+ </block>
484
+ <block type="rule" id="R-FORB2" level="forbidden" desc="Full rewrite constraint">
485
+ <field name="text">FORBIDDEN: Full-file rewrite - Always use targeted search_replace on specific sections</field>
486
+ </block>
487
+ <block type="rule" id="R-MAND2" level="mandatory" desc="Template-first constraint">
488
+ <field name="text">MANDATORY: Template-first workflow - Step 7a MUST execute before Step 7b</field>
489
+ </block>
410
490
 
411
491
  <!-- Checkpoint: Document generated -->
412
- <checkpoint name="document_generated" verify="output_file_exists == true" />
492
+ <block type="checkpoint" id="CP8" name="document_generated" desc="Document generated successfully">
493
+ <field name="verify" value="${output_file_exists} == true"/>
494
+ </block>
413
495
 
414
496
  <!-- Step 8: Report Results -->
415
- <task name="calculate_metrics" action="run-script">
416
- <param name="script">calculate-metrics.js</param>
417
- <param name="modules">{{module_infos}}</param>
418
- <param name="platforms">{{extracted_platforms}}</param>
419
- <output name="metrics" />
420
- </task>
421
-
422
- <task name="generate_report" action="run-script">
423
- <param name="script">generate-system-report.js</param>
424
- <param name="module_count">{{module_count}}</param>
425
- <param name="entity_count">{{metrics.entity_count}}</param>
426
- <param name="api_count">{{metrics.api_count}}</param>
427
- <param name="dependency_count">{{all_dependencies.length}}</param>
428
- <param name="flow_count">{{flow_count}}</param>
429
- <output name="completion_report" />
430
- </task>
497
+ <block type="task" id="B33" action="run-script" desc="Calculate metrics">
498
+ <field name="script" value="calculate-metrics.js"/>
499
+ <field name="modules" value="${module_infos}"/>
500
+ <field name="platforms" value="${extracted_platforms}"/>
501
+ <field name="output" var="metrics"/>
502
+ </block>
503
+
504
+ <block type="task" id="B34" action="run-script" desc="Generate system report">
505
+ <field name="script" value="generate-system-report.js"/>
506
+ <field name="module_count" value="${module_count}"/>
507
+ <field name="entity_count" value="${metrics.entity_count}"/>
508
+ <field name="api_count" value="${metrics.api_count}"/>
509
+ <field name="dependency_count" value="${all_dependencies.length}"/>
510
+ <field name="flow_count" value="${flow_count}"/>
511
+ <field name="output" var="completion_report"/>
512
+ </block>
431
513
 
432
514
  <!-- Event: Log completion -->
433
- <event action="log" level="info">
515
+ <block type="event" id="E8" action="log" level="info" desc="Log completion summary">
434
516
  System summarization completed:
435
- - Modules Processed: {{module_count}}
436
- - Entities Aggregated: {{metrics.entity_count}}
437
- - APIs Counted: {{metrics.api_count}}
438
- - Dependencies Mapped: {{all_dependencies.length}}
439
- - Business Flows Identified: {{flow_count}}
517
+ - Modules Processed: ${module_count}
518
+ - Entities Aggregated: ${metrics.entity_count}
519
+ - APIs Counted: ${metrics.api_count}
520
+ - Dependencies Mapped: ${all_dependencies.length}
521
+ - Business Flows Identified: ${flow_count}
440
522
  - Output: system-overview.md (complete)
441
523
  - Status: success
442
- </event>
524
+ </block>
443
525
 
444
526
  <!-- Output Block: Define workflow outputs -->
445
- <output name="status" from="success" />
446
- <output name="output_file" from="system-overview.md" />
447
- <output name="message" from="System summarization completed with {{module_count}} modules processed" />
527
+ <block type="output" id="O1" desc="System summarization results">
528
+ <field name="status" value="success"/>
529
+ <field name="output_file" value="system-overview.md"/>
530
+ <field name="message" value="System summarization completed with ${module_count} modules processed"/>
531
+ </block>
448
532
  </workflow>
449
533
 
450
534
  ## Constraints