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.
@@ -78,401 +78,350 @@ Analyze one specific UI feature from source code, extract business functionality
78
78
 
79
79
  > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `docs/rules/xml-workflow-spec.md`
80
80
 
81
- ```xml
82
- <workflow name="ui-feature-analysis" version="1.0">
83
-
84
- <!-- ==================== INPUT PARAMETERS ==================== -->
85
- <input name="feature" type="object" required="true" description="Complete feature object from features.json"/>
86
- <input name="fileName" type="string" required="true" description="Feature file name"/>
87
- <input name="sourcePath" type="string" required="true" description="Relative path to source file"/>
88
- <input name="documentPath" type="string" required="true" description="Target path for generated document"/>
89
- <input name="module" type="string" required="true" description="Business module name"/>
90
- <input name="analyzed" type="boolean" required="true" description="Analysis status flag"/>
91
- <input name="platform_type" type="string" required="true" description="Platform type: web, mobile, etc."/>
92
- <input name="platform_subtype" type="string" required="true" description="Platform subtype: vue, react, etc."/>
93
- <input name="tech_stack" type="array" required="true" description="Platform tech stack"/>
94
- <input name="language" type="string" required="true" description="Target language for generated content"/>
95
-
96
- <!-- ==================== CONSTRAINT RULES ==================== -->
97
- <rule level="forbidden" id="no-create-file-for-docs">
98
- NEVER use create_file to rewrite entire document. Documents MUST be created by copying template then filling with search_replace.
99
- </rule>
100
- <rule level="forbidden" id="no-file-deletion">
101
- NEVER delete generated files. If a file is malformed, fix it with search_replace.
102
- </rule>
103
- <rule level="forbidden" id="no-full-rewrite">
104
- NEVER rewrite entire document. Always use targeted search_replace on specific sections.
105
- </rule>
106
- <rule level="mandatory" id="template-first">
107
- Template copying (Step 5a) MUST execute before section filling (Step 5b).
108
- </rule>
109
- <rule level="mandatory" id="all-sections-filled">
110
- ALL sections in the template must be filled. Use "N/A" for unavailable data, never skip a section.
111
- </rule>
112
- <rule level="mandatory" id="language-compliance">
113
- ALL content MUST be generated in the language specified by {{language}} parameter.
114
- </rule>
115
-
116
- <!-- ==================== STEP 0: CHECK ANALYSIS STATUS ==================== -->
117
- <gateway name="check-analyzed-status" mode="exclusive">
118
- <branch condition="{{analyzed}} == true">
119
- <event action="log" level="info" message="Step 0 Status: SKIPPED (already analyzed)"/>
120
- <output name="status" value="skipped"/>
121
- <output name="message" value="Feature already analyzed, skipping"/>
122
- <checkpoint name="skip-complete" verify="true"/>
123
- </branch>
124
- <branch condition="{{analyzed}} == false">
125
- <event action="log" level="info" message="Step 0 Status: PROCEEDING (analysis required)"/>
126
- </branch>
127
- </gateway>
128
-
129
- <!-- ==================== STEP 1: READ ANALYSIS TEMPLATE ==================== -->
130
- <task name="step1-read-template" action="run-skill">
131
- <description>Read the appropriate template based on platform type</description>
132
- <parameter name="platform_type">{{platform_type}}</parameter>
133
- <parameter name="platform_subtype">{{platform_subtype}}</parameter>
134
- <script>
135
- <!-- Template Selection Logic -->
136
- <gateway name="template-selection" mode="exclusive">
137
- <branch condition="{{platform_type}} == 'mobile'">
138
- <output name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md"/>
139
- </branch>
140
- <branch condition="{{platform_type}} == 'miniapp'">
141
- <output name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MINIAPP.md"/>
142
- </branch>
143
- <branch condition="{{platform_type}} == 'desktop' AND {{platform_subtype}} == 'electron'">
144
- <output name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md"/>
145
- </branch>
146
- <branch condition="{{platform_type}} == 'desktop'">
147
- <output name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md"/>
148
- </branch>
149
- <branch condition="default">
150
- <output name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI.md"/>
151
- </branch>
152
- </gateway>
153
-
154
- <!-- Read Template Content -->
155
- <task action="read-file" target="{{templateFile}}">
156
- <output name="templateContent" from="file.content"/>
157
- </task>
158
-
159
- <!-- Validate Template Structure -->
160
- <checkpoint name="template-loaded" verify="{{templateContent}} != null AND {{templateContent}} != ''"/>
161
- <event action="log" level="info" message="Step 1 Status: COMPLETED - Read template for {{platform_type}}/{{platform_subtype}}"/>
162
- </script>
163
- </task>
164
-
165
- <!-- ==================== STEP 2: READ FEATURE FILE AND ANALYZE UI STRUCTURE ==================== -->
166
- <task name="step2-read-source" action="run-skill">
167
- <description>Read feature file and analyze UI structure, components, props, state management</description>
168
- <parameter name="sourcePath">{{sourcePath}}</parameter>
169
- <script>
170
- <!-- Read Source File -->
171
- <task action="read-file" target="{{sourcePath}}">
172
- <output name="sourceContent" from="file.content"/>
173
- <output name="lineCount" from="file.lineCount"/>
174
- </task>
175
-
176
- <!-- Analyze UI Structure -->
177
- <task action="analyze-ui">
178
- <input name="content">{{sourceContent}}</input>
179
- <input name="tech_stack">{{tech_stack}}</input>
180
- <output name="componentCount" from="analysis.components"/>
181
- <output name="eventCount" from="analysis.events"/>
182
- <output name="apiCalls" from="analysis.apis"/>
183
- <output name="stateFields" from="analysis.state"/>
184
- <output name="formFields" from="analysis.forms"/>
185
- </task>
186
-
187
- <checkpoint name="source-analyzed" verify="{{sourceContent}} != null"/>
188
- <event action="log" level="info" message="Step 2 Status: COMPLETED - Read {{sourcePath}} ({{lineCount}} lines), Analyzed {{componentCount}} components, {{eventCount}} events"/>
189
- </script>
190
- </task>
191
-
192
- <!-- ==================== STEP 3: EXTRACT BUSINESS FEATURES ==================== -->
193
- <task name="step3-extract-features" action="run-skill">
194
- <description>Extract business features, wireframes, and business flows from source analysis</description>
195
- <parameter name="sourceContent">{{sourceContent}}</parameter>
196
- <parameter name="language">{{language}}</parameter>
197
- <script>
198
- <!-- Read Mermaid Rules -->
199
- <task action="read-file" target="speccrew-workspace/docs/rules/mermaid-rule.md">
200
- <output name="mermaidRules" from="file.content"/>
201
- </task>
202
-
203
- <!-- Extract Wireframes -->
204
- <task action="extract-wireframes">
205
- <input name="content">{{sourceContent}}</input>
206
- <input name="platform">{{platform_type}}</input>
207
- <output name="wireframes" from="extraction.wireframes"/>
208
- <output name="wireframeCount" from="extraction.count"/>
209
- </task>
210
-
211
- <!-- Extract Business Flows -->
212
- <task action="extract-flows">
213
- <input name="content">{{sourceContent}}</input>
214
- <input name="events">{{eventCount}}</input>
215
- <output name="flows" from="extraction.flows"/>
216
- <output name="flowCount" from="extraction.count"/>
217
- <output name="sequenceAnalysis" from="extraction.sequences"/>
218
- <output name="boundaryScenarios" from="extraction.boundaries"/>
219
- </task>
220
-
221
- <!-- Extract Data Bindings -->
222
- <task action="extract-data-bindings">
223
- <input name="stateFields">{{stateFields}}</input>
224
- <input name="formFields">{{formFields}}</input>
225
- <output name="dataBindingMap" from="extraction.bindings"/>
226
- <output name="reactiveDependencies" from="extraction.dependencies"/>
227
- </task>
228
-
229
- <checkpoint name="features-extracted" verify="{{flowCount}} &gt; 0 OR {{wireframeCount}} &gt; 0"/>
230
- <event action="log" level="info" message="Step 3 Status: COMPLETED - Extracted {{wireframeCount}} wireframes, {{flowCount}} business flows"/>
231
- </script>
232
- </task>
233
-
234
- <!-- ==================== STEP 4: FIND REFERENCING PAGES ==================== -->
235
- <task name="step4-find-references" action="run-skill">
236
- <description>Search other page files to find which pages reference/navigate to this page</description>
237
- <parameter name="fileName">{{fileName}}</parameter>
238
- <parameter name="sourcePath">{{sourcePath}}</parameter>
239
- <script>
240
- <!-- Search for Router Navigation -->
241
- <task action="grep-search">
242
- <input name="pattern">{{fileName}}</input>
243
- <input name="glob">*.{vue,tsx,jsx}</input>
244
- <output name="routerMatches" from="search.results"/>
245
- </task>
246
-
247
- <!-- Search for Component Imports -->
248
- <task action="grep-search">
249
- <input name="pattern">import.*{{fileName}}</input>
250
- <input name="glob">*.{vue,tsx,jsx,ts,js}</input>
251
- <output name="importMatches" from="search.results"/>
252
- </task>
253
-
254
- <!-- Compile Referencing Pages -->
255
- <task action="compile-references">
256
- <input name="routerMatches">{{routerMatches}}</input>
257
- <input name="importMatches">{{importMatches}}</input>
258
- <output name="referencingPages" from="compilation.pages"/>
259
- <output name="referenceCount" from="compilation.count"/>
260
- </task>
261
-
262
- <event action="log" level="info" message="Step 4 Status: COMPLETED - Found {{referenceCount}} referencing pages"/>
263
- </script>
264
- </task>
265
-
266
- <!-- ==================== STEP 5A: COPY TEMPLATE TO DOCUMENT PATH ==================== -->
267
- <task name="step5a-copy-template" action="run-skill">
268
- <description>Copy the appropriate template file to the target document path, replacing top-level placeholders</description>
269
- <parameter name="templateContent">{{templateContent}}</parameter>
270
- <parameter name="documentPath">{{documentPath}}</parameter>
271
- <parameter name="fileName">{{fileName}}</parameter>
272
- <parameter name="sourcePath">{{sourcePath}}</parameter>
273
- <parameter name="language">{{language}}</parameter>
274
- <script>
275
- <!-- Prepare Placeholder Replacements -->
276
- <task action="prepare-replacements">
277
- <output name="featureName" from="i18n.featureName"/>
278
- <output name="currentDate" from="date.now"/>
279
- </task>
280
-
281
- <!-- Replace Top-Level Placeholders -->
282
- <task action="replace-placeholders">
283
- <input name="template">{{templateContent}}</input>
284
- <replacements>
285
- <replacement from="{Feature Name}" to="{{featureName}}"/>
286
- <replacement from="{documentPath}" to="{{documentPath}}"/>
287
- <replacement from="{sourcePath}" to="{{sourcePath}}"/>
288
- <replacement from="{Date}" to="{{currentDate}}"/>
289
- <replacement from="{FeatureFile}.vue" to="{{fileName}}.vue"/>
290
- </replacements>
291
- <output name="documentSkeleton" from="result.content"/>
292
- </task>
293
-
294
- <!-- Write Document Skeleton -->
295
- <task action="create-file" target="{{documentPath}}">
296
- <content>{{documentSkeleton}}</content>
297
- </task>
298
-
299
- <checkpoint name="template-copied" verify="file.exists({{documentPath}})"/>
300
- <event action="log" level="info" message="Step 5a Status: COMPLETED - Template copied to {{documentPath}}"/>
301
- </script>
302
- </task>
303
-
304
- <!-- ==================== STEP 5B: FILL EACH SECTION USING SEARCH_REPLACE ==================== -->
305
- <task name="step5b-fill-sections" action="run-skill">
306
- <description>Fill each section of the copied template document using search_replace</description>
307
- <parameter name="documentPath">{{documentPath}}</parameter>
308
- <parameter name="analysisData">{{analysisData}}</parameter>
309
- <parameter name="language">{{language}}</parameter>
310
- <script>
311
- <!-- Section 1: Content Overview -->
312
- <task action="search_replace" target="{{documentPath}}">
313
- <search>## 1. Content Overview.*?(?=## 2.|$)</search>
314
- <replace>## 1. Content Overview
315
-
316
- {{section1Content}}</replace>
317
- </task>
318
-
319
- <!-- Section 2: Interface Prototype -->
320
- <task action="search_replace" target="{{documentPath}}">
321
- <search>## 2. Interface Prototype.*?(?=## 3.|$)</search>
322
- <replace>## 2. Interface Prototype
323
-
324
- {{wireframes}}
325
-
326
- ### Interface Element Description
327
-
328
- {{elementDescriptions}}</replace>
329
- </task>
330
-
331
- <!-- Section 3: Business Flow -->
332
- <task action="search_replace" target="{{documentPath}}">
333
- <search>## 3. Business Flow.*?(?=## 4.|$)</search>
334
- <replace>## 3. Business Flow
335
-
336
- {{businessFlows}}
337
-
338
- ### API Call Sequence Analysis
339
-
340
- {{sequenceAnalysis}}
341
-
342
- ### Boundary Scenarios
343
-
344
- {{boundaryScenarios}}</replace>
345
- </task>
346
-
347
- <!-- Section 4: Data Field Definition -->
348
- <task action="search_replace" target="{{documentPath}}">
349
- <search>## 4. Data Field Definition.*?(?=## 5.|$)</search>
350
- <replace>## 4. Data Field Definition
351
-
352
- ### Page State Fields
353
-
354
- {{stateFieldsTable}}
355
-
356
- ### Form Fields
357
-
358
- {{formFieldsTable}}
359
-
360
- ### Data Binding Mapping
361
-
362
- {{dataBindingMap}}
81
+ <workflow id="ui-feature-analysis" version="1.0" status="pending" desc="UI feature analysis workflow">
363
82
 
364
- ### Reactive Dependency Chain
365
-
366
- {{reactiveDependencies}}</replace>
367
- </task>
368
-
369
- <!-- Section 5: References -->
370
- <task action="search_replace" target="{{documentPath}}">
371
- <search>## 5. References.*?(?=## 6.|$)</search>
372
- <replace>## 5. References
373
-
374
- ### APIs
375
-
376
- {{apiReferences}}
377
-
378
- ### Shared Methods
379
-
380
- {{sharedMethods}}
381
-
382
- ### Shared Components
383
-
384
- {{sharedComponents}}
385
-
386
- ### Other Pages
387
-
388
- {{otherPages}}
389
-
390
- ### Referenced By
391
-
392
- {{referencedBy}}</replace>
393
- </task>
394
-
395
- <!-- Section 6: Business Rule Constraints -->
396
- <task action="search_replace" target="{{documentPath}}">
397
- <search>## 6. Business Rule Constraints.*?(?=## 7.|$)</search>
398
- <replace>## 6. Business Rule Constraints
83
+ <!-- ==================== INPUT PARAMETERS ==================== -->
84
+ <block type="input" id="I1" desc="UI feature analysis input parameters">
85
+ <field name="feature" required="true" type="object" desc="Complete feature object from features.json"/>
86
+ <field name="fileName" required="true" type="string" desc="Feature file name"/>
87
+ <field name="sourcePath" required="true" type="string" desc="Relative path to source file"/>
88
+ <field name="documentPath" required="true" type="string" desc="Target path for generated document"/>
89
+ <field name="module" required="true" type="string" desc="Business module name"/>
90
+ <field name="analyzed" required="true" type="boolean" desc="Analysis status flag"/>
91
+ <field name="platform_type" required="true" type="string" desc="Platform type: web, mobile, etc."/>
92
+ <field name="platform_subtype" required="true" type="string" desc="Platform subtype: vue, react, etc."/>
93
+ <field name="tech_stack" required="true" type="array" desc="Platform tech stack"/>
94
+ <field name="language" required="true" type="string" desc="Target language for generated content"/>
95
+ <field name="completed_dir" required="true" type="string" desc="Marker file output directory"/>
96
+ <field name="workspace_path" required="true" type="string" desc="Workspace root path"/>
97
+ <field name="sync_state_bizs_dir" required="true" type="string" desc="Sync state directory path"/>
98
+ <field name="sourceFile" required="true" type="string" desc="Source features JSON filename"/>
99
+ </block>
399
100
 
400
- ### Permission Rules
101
+ <!-- ==================== CONSTRAINT RULES ==================== -->
102
+ <block type="rule" id="R1" level="forbidden" desc="Document generation constraints">
103
+ <field name="text">NEVER use create_file to rewrite entire document. Documents MUST be created by copying template then filling with search_replace.</field>
104
+ </block>
105
+ <block type="rule" id="R2" level="forbidden" desc="File deletion constraint">
106
+ <field name="text">NEVER delete generated files. If a file is malformed, fix it with search_replace.</field>
107
+ </block>
108
+ <block type="rule" id="R3" level="forbidden" desc="Full rewrite constraint">
109
+ <field name="text">NEVER rewrite entire document. Always use targeted search_replace on specific sections.</field>
110
+ </block>
111
+ <block type="rule" id="R4" level="mandatory" desc="Template-first workflow">
112
+ <field name="text">Template copying (Step 5a) MUST execute before section filling (Step 5b).</field>
113
+ </block>
114
+ <block type="rule" id="R5" level="mandatory" desc="All sections filled">
115
+ <field name="text">ALL sections in the template must be filled. Use "N/A" for unavailable data, never skip a section.</field>
116
+ </block>
117
+ <block type="rule" id="R6" level="mandatory" desc="Language compliance">
118
+ <field name="text">ALL content MUST be generated in the language specified by {{language}} parameter.</field>
119
+ </block>
120
+
121
+ <!-- ==================== GLOBAL CONTINUOUS EXECUTION RULES ==================== -->
122
+ <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
123
+ <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" during execution</field>
124
+ <field name="text">DO NOT offer options like "Full execution / Partial / Stop" — always execute ALL tasks to completion</field>
125
+ <field name="text">DO NOT suggest "Due to context window limits, let me pause" — complete current task, use checkpoint for resumption</field>
126
+ <field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL items in sequence</field>
127
+ <field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
128
+ <field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
129
+ </block>
401
130
 
402
- {{permissionRules}}
131
+ <!-- ==================== STEP 0: CHECK ANALYSIS STATUS ==================== -->
132
+ <sequence id="S0" name="Step 0: Check Analysis Status" status="pending" desc="Check if feature has already been analyzed">
133
+ <block type="gateway" id="G0" mode="exclusive" desc="Check analyzed status">
134
+ <branch test="${analyzed} == true" name="Already analyzed">
135
+ <block type="event" id="E0a" action="log" level="info" desc="Skip already analyzed feature">
136
+ Step 0 Status: SKIPPED (already analyzed)
137
+ </block>
138
+ <block type="output" id="O0a" desc="Skip output">
139
+ <field name="status" value="skipped"/>
140
+ <field name="message" value="Feature already analyzed, skipping"/>
141
+ </block>
142
+ <block type="checkpoint" id="CP0" name="skip-complete" desc="Skip checkpoint">
143
+ <field name="verify" value="true"/>
144
+ </block>
145
+ </branch>
146
+ <branch test="${analyzed} == false" name="Proceed with analysis">
147
+ <block type="event" id="E0b" action="log" level="info" desc="Proceed with analysis">
148
+ Step 0 Status: PROCEEDING (analysis required)
149
+ </block>
150
+ </branch>
151
+ </block>
152
+ </sequence>
403
153
 
404
- ### Business Logic Rules
154
+ <!-- ==================== STEP 1: READ ANALYSIS TEMPLATE ==================== -->
155
+ <sequence id="S1" name="Step 1: Read Template" status="pending" desc="Read the appropriate template based on platform type">
156
+ <!-- Template Selection Logic -->
157
+ <block type="gateway" id="G1" mode="exclusive" desc="Select template based on platform type">
158
+ <branch test="${platform_type} == 'mobile'" name="Mobile template">
159
+ <field name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md"/>
160
+ </branch>
161
+ <branch test="${platform_type} == 'miniapp'" name="Miniapp template">
162
+ <field name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-MINIAPP.md"/>
163
+ </branch>
164
+ <branch test="${platform_type} == 'desktop' AND ${platform_subtype} == 'electron'" name="Electron template">
165
+ <field name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md"/>
166
+ </branch>
167
+ <branch test="${platform_type} == 'desktop'" name="Desktop template">
168
+ <field name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md"/>
169
+ </branch>
170
+ <branch default="true" name="Default Web template">
171
+ <field name="templateFile" value="../speccrew-knowledge-bizs-ui-analyze/templates/FEATURE-DETAIL-TEMPLATE-UI.md"/>
172
+ </branch>
173
+ </block>
174
+
175
+ <!-- Read Template Content -->
176
+ <block type="task" id="B1" action="read-file" desc="Read template content">
177
+ <field name="path" value="${templateFile}"/>
178
+ <field name="output" var="templateContent"/>
179
+ </block>
180
+
181
+ <!-- Validate Template Structure -->
182
+ <block type="checkpoint" id="CP1" name="template-loaded" desc="Template loaded checkpoint">
183
+ <field name="verify" value="${templateContent} != null AND ${templateContent} != ''"/>
184
+ </block>
185
+ <block type="event" id="E1" action="log" level="info" desc="Log template read">
186
+ Step 1 Status: COMPLETED - Read template for ${platform_type}/${platform_subtype}
187
+ </block>
188
+ </sequence>
405
189
 
406
- {{businessRules}}
190
+ <!-- ==================== STEP 2: READ FEATURE FILE AND ANALYZE UI STRUCTURE ==================== -->
191
+ <sequence id="S2" name="Step 2: Read Source" status="pending" desc="Read feature file and analyze UI structure">
192
+ <!-- Read Source File -->
193
+ <block type="task" id="B2" action="read-file" desc="Read source file">
194
+ <field name="path" value="${sourcePath}"/>
195
+ <field name="output" var="sourceContent"/>
196
+ </block>
197
+
198
+ <!-- Analyze UI Structure -->
199
+ <block type="task" id="B2b" action="analyze" desc="Analyze UI structure">
200
+ <field name="content" value="${sourceContent}"/>
201
+ <field name="tech_stack" value="${tech_stack}"/>
202
+ <field name="output" var="analysisResult"/>
203
+ <field name="componentCount" from="${analysisResult.components.length}"/>
204
+ <field name="eventCount" from="${analysisResult.events.length}"/>
205
+ <field name="apiCalls" from="${analysisResult.apis}"/>
206
+ <field name="stateFields" from="${analysisResult.state}"/>
207
+ <field name="formFields" from="${analysisResult.forms}"/>
208
+ </block>
209
+
210
+ <block type="checkpoint" id="CP2" name="source-analyzed" desc="Source analyzed checkpoint">
211
+ <field name="verify" value="${sourceContent} != null"/>
212
+ </block>
213
+ <block type="event" id="E2" action="log" level="info" desc="Log source analysis">
214
+ Step 2 Status: COMPLETED - Read ${sourcePath}, Analyzed ${componentCount} components, ${eventCount} events
215
+ </block>
216
+ </sequence>
407
217
 
408
- ### Validation Rules
218
+ <!-- ==================== STEP 3: EXTRACT BUSINESS FEATURES ==================== -->
219
+ <sequence id="S3" name="Step 3: Extract Features" status="pending" desc="Extract business features and flows">
220
+ <!-- Read Mermaid Rules -->
221
+ <block type="task" id="B3a" action="read-file" desc="Read Mermaid rules">
222
+ <field name="path" value="speccrew-workspace/docs/rules/mermaid-rule.md"/>
223
+ <field name="output" var="mermaidRules"/>
224
+ </block>
225
+
226
+ <!-- Extract Wireframes -->
227
+ <block type="task" id="B3b" action="analyze" desc="Extract wireframes">
228
+ <field name="content" value="${sourceContent}"/>
229
+ <field name="platform" value="${platform_type}"/>
230
+ <field name="output" var="wireframes"/>
231
+ </block>
232
+
233
+ <!-- Extract Business Flows -->
234
+ <block type="task" id="B3c" action="analyze" desc="Extract business flows">
235
+ <field name="content" value="${sourceContent}"/>
236
+ <field name="events" value="${eventCount}"/>
237
+ <field name="output" var="flows"/>
238
+ <field name="sequenceAnalysis" from="${flows.sequences}"/>
239
+ <field name="boundaryScenarios" from="${flows.boundaries}"/>
240
+ </block>
241
+
242
+ <!-- Extract Data Bindings -->
243
+ <block type="task" id="B3d" action="analyze" desc="Extract data bindings">
244
+ <field name="stateFields" value="${stateFields}"/>
245
+ <field name="formFields" value="${formFields}"/>
246
+ <field name="output" var="dataBindingMap"/>
247
+ <field name="reactiveDependencies" from="${dataBindingMap.dependencies}"/>
248
+ </block>
249
+
250
+ <block type="checkpoint" id="CP3" name="features-extracted" desc="Features extracted checkpoint">
251
+ <field name="verify" value="${flows.length} > 0 OR ${wireframes.length} > 0"/>
252
+ </block>
253
+ <block type="event" id="E3" action="log" level="info" desc="Log feature extraction">
254
+ Step 3 Status: COMPLETED - Extracted ${wireframes.length} wireframes, ${flows.length} business flows
255
+ </block>
256
+ </sequence>
409
257
 
410
- {{validationRules}}</replace>
411
- </task>
412
-
413
- <!-- Section 7: Notes and Additional Information -->
414
- <task action="search_replace" target="{{documentPath}}">
415
- <search>## 7. Notes and Additional Information.*?(?=$)</search>
416
- <replace>## 7. Notes and Additional Information
258
+ <!-- ==================== STEP 4: FIND REFERENCING PAGES ==================== -->
259
+ <sequence id="S4" name="Step 4: Find References" status="pending" desc="Find referencing pages">
260
+ <!-- Search for Router Navigation -->
261
+ <block type="task" id="B4a" action="run-script" desc="Search router references">
262
+ <field name="command">grep -r "${fileName}" --include="*.{vue,tsx,jsx}" "${sourcePath}/.."</field>
263
+ <field name="output" var="routerMatches"/>
264
+ </block>
265
+
266
+ <!-- Search for Component Imports -->
267
+ <block type="task" id="B4b" action="run-script" desc="Search import references">
268
+ <field name="command">grep -r "import.*${fileName}" --include="*.{vue,tsx,jsx,ts,js}" "${sourcePath}/.."</field>
269
+ <field name="output" var="importMatches"/>
270
+ </block>
271
+
272
+ <!-- Compile Referencing Pages -->
273
+ <block type="task" id="B4c" action="analyze" desc="Compile references">
274
+ <field name="routerMatches" value="${routerMatches}"/>
275
+ <field name="importMatches" value="${importMatches}"/>
276
+ <field name="output" var="referencingPages"/>
277
+ </block>
278
+
279
+ <block type="event" id="E4" action="log" level="info" desc="Log reference search">
280
+ Step 4 Status: COMPLETED - Found ${referencingPages.length} referencing pages
281
+ </block>
282
+ </sequence>
417
283
 
418
- {{notes}}
284
+ <!-- ==================== STEP 5A: COPY TEMPLATE TO DOCUMENT PATH ==================== -->
285
+ <sequence id="S5a" name="Step 5a: Copy Template" status="pending" desc="Copy template to document path">
286
+ <!-- Prepare Placeholder Replacements -->
287
+ <block type="task" id="B5a1" action="analyze" desc="Prepare replacements">
288
+ <field name="language" value="${language}"/>
289
+ <field name="fileName" value="${fileName}"/>
290
+ <field name="output" var="replacements"/>
291
+ </block>
292
+
293
+ <!-- Replace Top-Level Placeholders and Write Document Skeleton -->
294
+ <block type="task" id="B5a2" action="write-file" desc="Write document skeleton">
295
+ <field name="path" value="${documentPath}"/>
296
+ <field name="content" value="${templateContent}"/>
297
+ <field name="note">Replace placeholders {Feature Name}, {documentPath}, {sourcePath}, {Date}, {FeatureFile}.vue with actual values</field>
298
+ </block>
299
+
300
+ <block type="checkpoint" id="CP5a" name="template-copied" desc="Template copied checkpoint">
301
+ <field name="verify" value="file.exists(${documentPath})"/>
302
+ </block>
303
+ <block type="event" id="E5a" action="log" level="info" desc="Log template copy">
304
+ Step 5a Status: COMPLETED - Template copied to ${documentPath}
305
+ </block>
306
+ </sequence>
419
307
 
420
- ### Performance and Scalability Analysis
308
+ <!-- ==================== STEP 5B: FILL EACH SECTION USING SEARCH_REPLACE ==================== -->
309
+ <sequence id="S5b" name="Step 5b: Fill Sections" status="pending" desc="Fill document sections">
310
+ <!-- Section 1: Content Overview -->
311
+ <block type="task" id="B5b1" action="run-skill" desc="Fill Section 1">
312
+ <field name="skill">search_replace</field>
313
+ <field name="file_path" value="${documentPath}"/>
314
+ <field name="search" value="## 1. Content Overview.*?(?=## 2.|$)"/>
315
+ <field name="replace" value="## 1. Content Overview\n\n${section1Content}"/>
316
+ </block>
317
+
318
+ <!-- Section 2: Interface Prototype -->
319
+ <block type="task" id="B5b2" action="run-skill" desc="Fill Section 2">
320
+ <field name="skill">search_replace</field>
321
+ <field name="file_path" value="${documentPath}"/>
322
+ <field name="search" value="## 2. Interface Prototype.*?(?=## 3.|$)"/>
323
+ <field name="replace" value="## 2. Interface Prototype\n\n${wireframes}\n\n### Interface Element Description\n\n${elementDescriptions}"/>
324
+ </block>
325
+
326
+ <!-- Section 3: Business Flow -->
327
+ <block type="task" id="B5b3" action="run-skill" desc="Fill Section 3">
328
+ <field name="skill">search_replace</field>
329
+ <field name="file_path" value="${documentPath}"/>
330
+ <field name="search" value="## 3. Business Flow.*?(?=## 4.|$)"/>
331
+ <field name="replace" value="## 3. Business Flow\n\n${businessFlows}\n\n### API Call Sequence Analysis\n\n${sequenceAnalysis}\n\n### Boundary Scenarios\n\n${boundaryScenarios}"/>
332
+ </block>
333
+
334
+ <!-- Section 4: Data Field Definition -->
335
+ <block type="task" id="B5b4" action="run-skill" desc="Fill Section 4">
336
+ <field name="skill">search_replace</field>
337
+ <field name="file_path" value="${documentPath}"/>
338
+ <field name="search" value="## 4. Data Field Definition.*?(?=## 5.|$)"/>
339
+ <field name="replace" value="## 4. Data Field Definition\n\n### Page State Fields\n\n${stateFieldsTable}\n\n### Form Fields\n\n${formFieldsTable}\n\n### Data Binding Mapping\n\n${dataBindingMap}\n\n### Reactive Dependency Chain\n\n${reactiveDependencies}"/>
340
+ </block>
341
+
342
+ <!-- Section 5: References -->
343
+ <block type="task" id="B5b5" action="run-skill" desc="Fill Section 5">
344
+ <field name="skill">search_replace</field>
345
+ <field name="file_path" value="${documentPath}"/>
346
+ <field name="search" value="## 5. References.*?(?=## 6.|$)"/>
347
+ <field name="replace" value="## 5. References\n\n### APIs\n\n${apiReferences}\n\n### Shared Methods\n\n${sharedMethods}\n\n### Shared Components\n\n${sharedComponents}\n\n### Other Pages\n\n${otherPages}\n\n### Referenced By\n\n${referencedBy}"/>
348
+ </block>
349
+
350
+ <!-- Section 6: Business Rule Constraints -->
351
+ <block type="task" id="B5b6" action="run-skill" desc="Fill Section 6">
352
+ <field name="skill">search_replace</field>
353
+ <field name="file_path" value="${documentPath}"/>
354
+ <field name="search" value="## 6. Business Rule Constraints.*?(?=## 7.|$)"/>
355
+ <field name="replace" value="## 6. Business Rule Constraints\n\n### Permission Rules\n\n${permissionRules}\n\n### Business Logic Rules\n\n${businessRules}\n\n### Validation Rules\n\n${validationRules}"/>
356
+ </block>
357
+
358
+ <!-- Section 7: Notes and Additional Information -->
359
+ <block type="task" id="B5b7" action="run-skill" desc="Fill Section 7">
360
+ <field name="skill">search_replace</field>
361
+ <field name="file_path" value="${documentPath}"/>
362
+ <field name="search" value="## 7. Notes and Additional Information.*?(?=$)"/>
363
+ <field name="replace" value="## 7. Notes and Additional Information\n\n${notes}\n\n### Performance and Scalability Analysis\n\n${performanceAnalysis}"/>
364
+ </block>
365
+
366
+ <block type="checkpoint" id="CP5b" name="all-sections-filled" desc="All sections filled checkpoint">
367
+ <field name="verify" value="all.sections.filled"/>
368
+ </block>
369
+ <block type="event" id="E5b" action="log" level="info" desc="Log section filling">
370
+ Step 5b Status: COMPLETED - All sections filled using search_replace
371
+ </block>
372
+ </sequence>
421
373
 
422
- {{performanceAnalysis}}</replace>
423
- </task>
424
-
425
- <checkpoint name="all-sections-filled" verify="all.sections.filled"/>
426
- <event action="log" level="info" message="Step 5b Status: COMPLETED - All sections filled using search_replace"/>
427
- </script>
428
- </task>
429
-
430
374
  <!-- ==================== STEP 6: REPORT RESULTS ==================== -->
431
- <task name="step6-report" action="run-skill">
432
- <description>Return analysis result summary</description>
433
- <script>
434
- <output name="status" value="success"/>
435
- <output name="feature_name" value="{{fileName}}"/>
436
- <output name="generated_file" value="{{documentPath}}"/>
437
- <output name="message" value="Successfully analyzed {{fileName}} feature from {{sourcePath}}"/>
438
-
439
- <event action="log" level="info" message="Step 6 Status: COMPLETED - Analysis {{status}}: {{message}}"/>
440
- </script>
441
- </task>
442
-
375
+ <sequence id="S6" name="Step 6: Report Results" status="pending" desc="Report analysis results">
376
+ <block type="event" id="E6" action="log" level="info" desc="Log final status">
377
+ Step 6 Status: COMPLETED - Analysis success: Successfully analyzed ${fileName} feature from ${sourcePath}
378
+ </block>
379
+ </sequence>
380
+
443
381
  <!-- ==================== FINAL OUTPUT ==================== -->
444
- <output name="status" from="step6-report.status"/>
445
- <output name="feature" from="step6-report.feature"/>
446
- <output name="platformType" from="input.platform_type"/>
447
- <output name="module" from="input.module"/>
448
- <output name="featureName" from="step6-report.feature_name"/>
449
- <output name="generatedFile" from="step6-report.generated_file"/>
450
- <output name="message" from="step6-report.message"/>
451
-
382
+ <block type="output" id="O1" desc="UI feature analysis output results">
383
+ <field name="status" value="success"/>
384
+ <field name="feature_name" from="${fileName}"/>
385
+ <field name="generated_file" from="${documentPath}"/>
386
+ <field name="message" value="Successfully analyzed ${fileName} feature from ${sourcePath}"/>
387
+ <field name="platformType" from="${platform_type}"/>
388
+ <field name="module" from="${module}"/>
389
+ </block>
390
+
452
391
  <!-- ==================== ERROR HANDLING ==================== -->
453
- <error-handler>
454
- <catch type="file-not-found">
455
- <event action="log" level="error" message="Source file not found: {{sourcePath}}"/>
456
- <output name="status" value="failed"/>
457
- <output name="message" value="Source file not found: {{sourcePath}}"/>
392
+ <block type="error-handler" id="EH1" desc="Handle workflow errors">
393
+ <try>
394
+ <!-- Main workflow defined in sequences above -->
395
+ </try>
396
+ <catch error-type="file-not-found">
397
+ <block type="event" id="EH1-E1" action="log" level="error" desc="File not found error">
398
+ Source file not found: ${sourcePath}
399
+ </block>
400
+ <field name="status" value="failed"/>
401
+ <field name="message" value="Source file not found: ${sourcePath}"/>
458
402
  </catch>
459
- <catch type="template-error">
460
- <event action="log" level="error" message="Template processing error"/>
461
- <output name="status" value="failed"/>
462
- <output name="message" value="Failed to process template"/>
403
+ <catch error-type="template-error">
404
+ <block type="event" id="EH1-E2" action="log" level="error" desc="Template error">
405
+ Template processing error
406
+ </block>
407
+ <field name="status" value="failed"/>
408
+ <field name="message" value="Failed to process template"/>
463
409
  </catch>
464
- <catch type="validation-error">
465
- <event action="log" level="error" message="Validation failed: {{error.message}}"/>
466
- <output name="status" value="partial"/>
467
- <output name="message" value="Analysis completed with validation errors"/>
410
+ <catch error-type="validation-error">
411
+ <block type="event" id="EH1-E3" action="log" level="error" desc="Validation error">
412
+ Validation failed: ${error.message}
413
+ </block>
414
+ <field name="status" value="partial"/>
415
+ <field name="message" value="Analysis completed with validation errors"/>
468
416
  </catch>
469
417
  <finally>
470
- <event action="log" level="info" message="Workflow execution completed"/>
418
+ <block type="event" id="EH1-E4" action="log" level="info" desc="Workflow completed">
419
+ Workflow execution completed
420
+ </block>
471
421
  </finally>
472
- </error-handler>
473
-
422
+ </block>
423
+
474
424
  </workflow>
475
- ```
476
425
 
477
426
  ## Constraints
478
427