speccrew 0.6.68 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.speccrew/agents/speccrew-task-worker.md +1 -1
  2. package/.speccrew/agents/speccrew-team-leader.md +336 -189
  3. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
  4. package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
  5. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
  6. package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
  7. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
  8. package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
  9. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
  10. package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
  11. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
  12. package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
  14. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
  15. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
  16. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
  17. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
  18. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
  19. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
  20. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
  21. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
  22. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
  23. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
  24. package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
  25. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
  26. package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
  27. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
  28. package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
  29. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
  30. package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
  31. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
  32. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
  33. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
  34. package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
  35. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
  36. package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
  37. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
  38. package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
  40. package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
  41. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
  42. package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
  43. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
  44. package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
  45. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
  46. package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
  47. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
  48. package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
  49. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
  50. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
  52. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
  54. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
  56. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
  57. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
  61. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
  62. package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
  63. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
  64. package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
  65. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
  66. package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
  67. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
  68. package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
  70. package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
  72. package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
  74. package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
  75. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
  76. package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
  77. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
  78. package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
  79. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
  80. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
  81. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
  82. package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
  83. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
  84. package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
  85. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
  86. package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
  87. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
  88. package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
  89. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
  90. package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
  91. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
  92. package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
  93. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
  94. package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
  95. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
  96. package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
  97. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
  98. package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
  99. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
  100. package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
  101. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
  102. package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
  103. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
  104. package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
  105. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
  106. package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
  107. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
  108. package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
  109. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
  110. package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
  111. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
  112. package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
  113. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
  114. package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
  115. package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
  116. package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
  117. package/bin/cli.js +8 -1
  118. package/lib/commands/validate.js +565 -0
  119. package/package.json +1 -1
  120. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  121. package/workspace-template/scripts/validate-agentflow.js +637 -0
  122. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  123. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  124. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  125. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  131. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  132. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1071
  133. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  134. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: speccrew-knowledge-bizs-ui-analyze
3
- description: Analyze a single UI feature from source code to extract business functionality and generate feature documentation. Used by Worker Agent in parallel execution during knowledge base initialization Stage 2. Each worker analyzes one feature (e.g., one Vue/React page component).
3
+ description: Analyze a single UI feature from source code to extract business functionality and generate feature documentation using XML Block workflow. Used by Worker Agent in parallel execution during knowledge base initialization Stage 2. Each worker analyzes one feature (e.g., one Vue/React page component).
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash
5
5
  ---
6
6
 
7
- # UI Feature Analysis - Single Feature
7
+ # UI Feature Analysis - Single Feature (XML Block Workflow)
8
8
 
9
9
  > **CRITICAL CONSTRAINT**: DO NOT create temporary scripts, batch files, or workaround code files (`.py`, `.bat`, `.sh`, `.ps1`, etc.) under any circumstances. If execution encounters errors, STOP and report the exact error. Fixes must be applied to the Skill definition or source scripts — not patched at runtime.
10
10
 
@@ -72,324 +72,447 @@ Analyze one specific UI feature from source code, extract business functionality
72
72
  }
73
73
  ```
74
74
 
75
- > **Note**: Graph data construction (nodes, edges, marker files) is handled by `speccrew-knowledge-bizs-ui-graph` Skill. This Skill only generates feature documentation.
76
-
77
- ## Workflow
78
-
79
- > **⚠️ CRITICAL CONSTRAINTS (apply to ALL steps):**
80
- > 1. **FORBIDDEN: `create_file` for documents** — Documents MUST be created by copying template (Step 5a) then filling with `search_replace` (Step 5b)
81
- > 2. **FORBIDDEN: File deletion** If a file is malformed, fix it with `search_replace`
82
- > 3. **FORBIDDEN: Full-file rewrite** — Always use targeted `search_replace` on specific sections
83
- > 4. **MANDATORY: Template-first workflow** — Step 5a MUST execute before Step 5b
84
-
85
- ```mermaid
86
- graph TB
87
- Start([Start]) --> Step1[Step 1 Read Analysis Template]
88
- Step1 --> Step2[Step 2 Read Feature File and Analyze UI Structure]
89
- Step2 --> Step3[Step 3 Extract Business Features]
90
- Step3 --> Step4[Step 4 Find Referencing Pages]
91
- Step4 --> Step5a[Step 5a Copy Template to Document Path]
92
- Step5a --> Step5b[Step 5b Fill Each Section Using search_replace]
93
- Step5b --> Step6[Step 6 Report Results]
94
- Step6 --> End([End])
95
- ```
96
-
97
- ---
98
-
99
- ### Step 1: Read Analysis Template (Required before workflow starts)
100
-
101
- **Step 1 Status: 🔄 IN PROGRESS**
102
-
103
- 1. **Check Analysis Status:**
104
- ```
105
- IF {{analyzed}} == true THEN
106
- Output "Step 1 Status: ⏭️ SKIPPED (already analyzed)"
107
- Skip to Step 6 with status="skipped"
108
- ELSE
109
- Proceed to next step
110
- END IF
111
- ```
112
-
113
- 2. **Read the appropriate template based on platform type:**
114
-
115
- **Template Selection:**
116
-
117
- | Platform Type | Template File | Description |
118
- |--------------|---------------|-------------|
119
- | Web (Vue/React/Angular) | `templates/FEATURE-DETAIL-TEMPLATE-UI.md` | Default/Generic web template |
120
- | Mobile Native (iOS/Android) | `templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md` | Swift/Kotlin/React Native/Flutter |
121
- | Mini Program | `templates/FEATURE-DETAIL-TEMPLATE-UI-MINIAPP.md` | WeChat/Alipay/ByteDance |
122
- | Desktop (WinForms/WPF) | `templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md` | C# .NET Desktop |
123
- | Desktop (Electron) | `templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md` | HTML/JS Desktop |
124
- | Unknown/Other | `templates/FEATURE-DETAIL-TEMPLATE-UI.md` | Default to generic web template |
125
-
126
- Select template based on `{{platform_type}}` and `{{platform_subtype}}` parameters.
127
-
128
- 3. **Understand template structure:**
129
- - Read the template content
130
- - Understand the required information dimensions and sections
131
- - Note the analysis requirements for each section
132
- - Output: "Step 1 Status: COMPLETED - Read template for {{platform_type}}/{{platform_subtype}}"
133
-
134
- > ⚠️ CRITICAL: The template defines the EXACT output structure. You MUST:
135
- > - Generate ALL sections listed in the template, in the SAME order
136
- > - Fill ALL tables defined in the template (use "N/A" for unavailable data, never skip a table)
137
- > - Follow the EXACT heading hierarchy and numbering from the template
138
- > - Do NOT invent your own section structure or reorganize sections
139
-
140
- ### Step 2: Read Feature File and Analyze UI Structure
141
-
142
- **Step 2 Status: 🔄 IN PROGRESS**
143
-
144
- **Prerequisites:**
145
- - Template has been read and understood
146
- - Feature file is a page/component file (e.g., `frontend-web/src/views/system/user/index.vue`)
147
-
148
- **Actions:**
149
- 1. **Locate and Read the feature file:**
150
- - Use `{{sourcePath}}` as the relative file path from project root
151
- - Read the feature file content
152
-
153
- 2. **Analyze page/screen/window structure, components, props, state management** guided by the template requirements
154
-
155
- > ⚠️ When analyzing, systematically gather information for EVERY section in the template:
156
- > - For each template section, identify what source code information is needed
157
- > - If source code doesn't provide enough info for a section, note it for "N/A" filling later
158
- > - Do NOT skip gathering info just because it seems minor
159
-
160
- 3. **Deep Analysis Requirements:**
161
- - Analyze complete component interfaces: props, events, slots
162
- - Trace API call chains and data flow paths
163
- - Analyze routing configuration and state management integration
164
- - Document component dependencies and injection patterns
165
-
166
- **Analysis Scope:**
167
-
168
- | Template Section | Information to Extract | Source |
169
- |------------------|------------------------|--------|
170
- | 1. Content Overview | Feature name, document path, source path, description | `{{fileName}}`, `{{documentPath}}`, `{{sourcePath}}` |
171
- | 2. Interface Prototype | Main page and embedded modals ASCII wireframes, element descriptions | Component template, JSX/Vue template |
172
- | 3. Business Flow | Page initialization, component events (onClick/onChange/etc), timer/websocket, page close flows | Event handlers, lifecycle hooks, timers |
173
- | 4. Data Field Definition | Page state fields, form fields with validation | State definitions, form schemas, v-model bindings |
174
- | 5. References | APIs, shared methods, shared components, other pages | API calls, imports, navigation |
175
- | 6. Business Rules | Permission rules, business logic rules, validation rules | Code logic, comments |
176
- | 7. Notes and Additional Info | Compatibility, pending confirmations, extension notes | Full source analysis |
177
-
178
- **Enhanced Analysis Requirements:**
179
-
180
- #### A. API Call Sequence Analysis (MUST include in Section 3 Business Flow)
181
-
182
- For EVERY business flow that involves multiple API calls, analyze:
183
- - Whether API calls are executed **serially** or **in parallel** (Promise.all vs sequential await)
184
- - The timing logic inside `try/catch/finally` blocks
185
- - Whether **race conditions** exist between multiple API calls
186
- - If one API fails, whether subsequent APIs will still execute
187
-
188
- Add a **Sequence Analysis** note block after each multi-API flow.
189
-
190
- #### B. Boundary Scenario Flows (MUST include in Section 3 Business Flow)
191
-
192
- Document key boundary scenarios:
193
- - **Empty data / empty list**: What is displayed when API returns empty results?
194
- - **Error / exception branches**: What happens on API failure, network timeout?
195
- - **State reset / cleanup**: When and how is form/state reset?
196
- - **Concurrent operation scenarios**: What happens on rapid consecutive clicks?
197
-
198
- #### C. Data Binding Relationship (MUST include in Section 4 Data Field Definition)
199
-
200
- **Data Binding Mapping Table** — trace full binding chain for each reactive field.
201
- **Reactive Dependency Chain** — document all `watch` and `computed` dependencies.
202
-
203
- #### D. Performance and Scalability Analysis (MUST include in Section 7 Notes)
204
-
205
- - **Full-load performance risks**: Dropdowns/selectors that load ALL records without pagination
206
- - **Large-data UI performance risks**: UI component behavior under large datasets
207
- - **Scalability limitations**: Hardcoded assumptions that limit extensibility
208
- - **Pending confirmations**: Design questions and improvement suggestions
209
-
210
- **Output:** "Step 2 Status: ✅ COMPLETED - Read {{sourcePath}} ({{lineCount}} lines), Analyzed {{componentCount}} components, {{eventCount}} events"
211
-
212
- ### Step 3: Extract Business Features
213
-
214
- **Step 3 Status: 🔄 IN PROGRESS**
215
-
216
- Each user interaction or page initialization in the feature file = one business feature.
217
-
218
- **CRITICAL - Analysis Scope Limitation:**
219
-
220
- - **ONLY analyze the single feature file specified by `{{sourcePath}}`**
221
- - **DO NOT analyze or generate documentation for other files in the same directory**
222
- - **DO NOT generate separate documents for embedded components/modals**
223
-
224
- **Extraction Guidelines:**
225
-
226
- - Draw ASCII wireframes for **main page only** and **embedded modals/dialogs that are defined within the same file**
227
- - For **external pages/components** (imported from other files):
228
- - Only add reference links in Section 5.4 (Other Pages) or 5.3 (Shared Components)
229
- - DO NOT draw wireframes for them
230
- - DO NOT analyze their internal implementation
231
- - Document ALL business flows: page init, component events, timers, websocket, page close
232
- - **Read Configuration**: Read `speccrew-workspace/docs/rules/mermaid-rule.md` for Mermaid diagram guidelines
233
- - **Generate Mermaid flowcharts** following the configuration:
234
- - Use `graph TB` or `graph LR` syntax (not `flowchart`)
235
- - No parentheses `()` in node text
236
- - No HTML tags like `<br/>`
237
- - No `style` definitions
238
- - No nested `subgraph`
239
- - Use `{{language}}` for all extracted content naming
240
-
241
- **Output:** "Step 3 Status: ✅ COMPLETED - Extracted {{wireframeCount}} wireframes, {{flowCount}} business flows"
242
-
243
- ### Step 4: Find Referencing Pages
244
-
245
- **Step 4 Status: 🔄 IN PROGRESS**
246
-
247
- Search other page files in the codebase to find which pages reference/navigate to this page.
248
-
249
- **Search Methods:**
250
- - Search for router navigation calls containing this page's route path
251
- - Search for imports of this page component
252
- - Search for links/buttons that navigate to this page
253
-
254
- **For Each Referencing Page, Record:**
255
- | Field | Description |
256
- |-------|-------------|
257
- | Page Name | Name of the page that references this page |
258
- | Function Description | How/why it references this page |
259
- | Source Path | Relative path to the referencing page source file |
260
- | Document Path | Path to the referencing page's generated document |
261
-
262
- **Output:** "Step 4 Status: ✅ COMPLETED - Found {{referenceCount}} referencing pages"
263
-
264
- ### Step 5a: Copy Template to Document Path
265
-
266
- **Step 5a Status: 🔄 IN PROGRESS**
267
-
268
- **Objective:** Copy the appropriate template file to the target document path, replacing top-level placeholders.
269
-
270
- **Actions:**
271
-
272
- 1. **Select Template Based on Platform Type:**
273
-
274
- | Platform Type | Template File |
275
- |--------------|---------------|
276
- | `web` | `templates/FEATURE-DETAIL-TEMPLATE-UI.md` |
277
- | `mobile` | `templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md` |
278
- | `miniapp` | `templates/FEATURE-DETAIL-TEMPLATE-UI-MINIAPP.md` |
279
- | `desktop` | `templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md` |
280
- | `electron` | `templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md` |
281
- | Unknown/Other | `templates/FEATURE-DETAIL-TEMPLATE-UI.md` |
282
-
283
- 2. **Read the Selected Template File:**
284
- - Read the template file content from the skill's templates directory
285
-
286
- 3. **Replace Top-Level Placeholders:**
287
-
288
- | Placeholder | Replacement | Example |
289
- |-------------|-------------|---------|
290
- | `{Feature Name}` | Human-readable feature name | `"用户管理列表"` |
291
- | `{documentPath}` | `{{documentPath}}` input variable | `"speccrew-workspace/knowledges/bizs/web-vue/..."` |
292
- | `{sourcePath}` | `{{sourcePath}}` input variable | `"frontend-web/src/views/system/user/index.vue"` |
293
- | `{Date}` | Current date | `"2026-04-04"` |
294
- | `{FeatureFile}.vue` | `{{fileName}}` with appropriate extension | `"index.vue"` |
295
-
296
- 4. **Write the Document Using create_file:**
297
- Use `create_file` to write the placeholder-replaced template content to `{{documentPath}}`.
298
-
299
- **Pre-write Checklist:**
300
- - [ ] Template file selected based on `{{platform_type}}`
301
- - [ ] Template content read successfully
302
- - [ ] All top-level placeholders replaced
303
- - [ ] Document path is valid
304
-
305
- **Output:** "Step 5a Status: ✅ COMPLETED - Template copied to {{documentPath}}"
306
-
307
- ---
75
+ > **Note**: Graph data (.graph.json) is handled by `speccrew-knowledge-bizs-ui-graph` Skill. This Skill generates feature documentation AND writes `.done.json` completion marker.
76
+
77
+ ## AgentFlow Definition
78
+
79
+ <!-- @agentflow: workflow.agentflow.xml -->
80
+
81
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
82
+
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>
100
+
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>
130
+
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
+ <field name="message">Step 0 Status: SKIPPED (already analyzed)</field>
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
+ <field name="message">Step 0 Status: PROCEEDING (analysis required)</field>
149
+ </block>
150
+ </branch>
151
+ </block>
152
+ </sequence>
153
+
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="./templates/FEATURE-DETAIL-TEMPLATE-UI-MOBILE.md"/>
160
+ </branch>
161
+ <branch test="${platform_type} == 'miniapp'" name="Miniapp template">
162
+ <field name="templateFile" value="./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="./templates/FEATURE-DETAIL-TEMPLATE-UI-ELECTRON.md"/>
166
+ </branch>
167
+ <branch test="${platform_type} == 'desktop'" name="Desktop template">
168
+ <field name="templateFile" value="./templates/FEATURE-DETAIL-TEMPLATE-UI-DESKTOP.md"/>
169
+ </branch>
170
+ <branch default="true" name="Default Web template">
171
+ <field name="templateFile" value="./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
+ <field name="message">Step 1 Status: COMPLETED - Read template for ${platform_type}/${platform_subtype}</field>
187
+ </block>
188
+ </sequence>
189
+
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
+ <field name="message">Step 2 Status: COMPLETED - Read ${sourcePath}, Analyzed ${componentCount} components, ${eventCount} events</field>
215
+ </block>
216
+ </sequence>
217
+
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
+ <field name="message">Step 3 Status: COMPLETED - Extracted ${wireframes.length} wireframes, ${flows.length} business flows</field>
255
+ </block>
256
+ </sequence>
257
+
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
+ <field name="message">Step 4 Status: COMPLETED - Found ${referencingPages.length} referencing pages</field>
281
+ </block>
282
+ </sequence>
283
+
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
+ <!-- Document Output Path Rule -->
287
+ <block type="rule" id="R-DOCPATH" level="mandatory" desc="Document output path MUST use documentPath parameter">
288
+ <field name="text">
289
+ The output document file MUST be created at the EXACT path specified by ${documentPath} input parameter.
290
+ DO NOT use the template file name (e.g., FEATURE-DETAIL-TEMPLATE-*.md) as the output file name.
291
+ The documentPath already contains the correct target path including file name (e.g., speccrew-workspace/knowledges/bizs/web-vue/src/views/system/user/index.md).
292
+ Before creating the file, ensure the parent directory exists (create if necessary).
293
+ </field>
294
+ </block>
295
+
296
+ <!-- Ensure Document Output Directory Exists -->
297
+ <block type="task" id="B5a0" action="run-script" desc="Ensure document output directory exists">
298
+ <field name="command">node -e "require('fs').mkdirSync(require('path').dirname('${documentPath}'), {recursive: true})"</field>
299
+ </block>
300
+
301
+ <!-- Prepare Placeholder Replacements -->
302
+ <block type="task" id="B5a1" action="analyze" desc="Prepare replacements">
303
+ <field name="language" value="${language}"/>
304
+ <field name="fileName" value="${fileName}"/>
305
+ <field name="output" var="replacements"/>
306
+ </block>
307
+
308
+ <!-- Replace Top-Level Placeholders and Write Document Skeleton -->
309
+ <block type="task" id="B5a2" action="write-file" desc="Write document skeleton">
310
+ <field name="path" value="${documentPath}"/>
311
+ <field name="content" value="${templateContent}"/>
312
+ <field name="note">Replace placeholders {Feature Name}, {documentPath}, {sourcePath}, {Date}, {FeatureFile}.vue with actual values</field>
313
+ </block>
314
+
315
+ <block type="checkpoint" id="CP5a" name="template-copied" desc="Template copied checkpoint">
316
+ <field name="verify" value="file.exists(${documentPath})"/>
317
+ </block>
318
+ <block type="event" id="E5a" action="log" level="info" desc="Log template copy">
319
+ <field name="message">Step 5a Status: COMPLETED - Template copied to ${documentPath}</field>
320
+ </block>
321
+ </sequence>
322
+
323
+ <!-- ==================== STEP 5-MID: DYNAMIC SECTION GENERATION ==================== -->
324
+ <!-- Rule: Dynamic section generation before filling fixed sections -->
325
+ <block type="rule" id="R-DYNAMIC-SECTIONS" level="mandatory" desc="Dynamic section generation rule">
326
+ <field name="text">BEFORE filling template sections, you MUST first count identified UI components and dynamically create the corresponding number of sections in the document.</field>
327
+ <field name="text">Step 1: Copy template skeleton to target path</field>
328
+ <field name="text">Step 2: For each identified UI component/area, insert a new numbered sub-section (e.g., 2.1, 2.2, 2.3...) into the document</field>
329
+ <field name="text">Step 3: Fill each sub-section with the specific component details (wireframe, interactions, events)</field>
330
+ <field name="text">NEVER rely on fixed template sections alone — the number of sections MUST match the number of identified UI components</field>
331
+ </block>
332
+
333
+ <!-- Loop: Dynamically generate a section for each UI component -->
334
+ <block type="loop" id="L-COMPONENT-SECTIONS" over="${analysisResult.components}" as="component" desc="Dynamically generate a section for each UI component">
335
+ <block type="task" id="B-COMP-SECTION" action="generate" desc="Insert component sub-section into document">
336
+ <field name="target" value="${documentPath}"/>
337
+ <field name="content">For component ${component.name} (type: ${component.type}): insert a ## 2.X sub-section containing Component Wireframe, Props/Events table, Interaction Flow, and State Management</field>
338
+ <field name="output" var="section_${component.index}"/>
339
+ </block>
340
+ </block>
341
+
342
+ <!-- Checkpoint: Verify section count matches component count -->
343
+ <block type="checkpoint" id="CP-SECTIONS-COUNT" desc="Verify section count matches component count">
344
+ <field name="verify">Number of generated 2.X sections == ${analysisResult.components.length}</field>
345
+ </block>
346
+
347
+ <!-- ==================== STEP 5B: FILL EACH SECTION USING SEARCH_REPLACE ==================== -->
348
+ <sequence id="S5b" name="Step 5b: Fill Sections" status="pending" desc="Fill document sections">
349
+ <!-- Section 1: Content Overview -->
350
+ <block type="task" id="B5b1" action="run-skill" desc="Fill Section 1">
351
+ <field name="skill">search_replace</field>
352
+ <field name="file_path" value="${documentPath}"/>
353
+ <field name="search" value="## 1. Content Overview.*?(?=## 2.|$)"/>
354
+ <field name="replace" value="## 1. Content Overview\n\n${section1Content}"/>
355
+ </block>
356
+
357
+ <!-- Section 2: Interface Prototype -->
358
+ <block type="task" id="B5b2" action="run-skill" desc="Fill Section 2">
359
+ <field name="skill">search_replace</field>
360
+ <field name="file_path" value="${documentPath}"/>
361
+ <field name="search" value="## 2. Interface Prototype.*?(?=## 3.|$)"/>
362
+ <field name="replace" value="## 2. Interface Prototype\n\n${wireframes}\n\n### Interface Element Description\n\n${elementDescriptions}"/>
363
+ </block>
364
+
365
+ <!-- Section 3: Business Flow -->
366
+ <block type="task" id="B5b3" action="run-skill" desc="Fill Section 3">
367
+ <field name="skill">search_replace</field>
368
+ <field name="file_path" value="${documentPath}"/>
369
+ <field name="search" value="## 3. Business Flow.*?(?=## 4.|$)"/>
370
+ <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}"/>
371
+ </block>
372
+
373
+ <!-- Section 4: Data Field Definition -->
374
+ <block type="task" id="B5b4" action="run-skill" desc="Fill Section 4">
375
+ <field name="skill">search_replace</field>
376
+ <field name="file_path" value="${documentPath}"/>
377
+ <field name="search" value="## 4. Data Field Definition.*?(?=## 5.|$)"/>
378
+ <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}"/>
379
+ </block>
380
+
381
+ <!-- Section 5: References -->
382
+ <block type="task" id="B5b5" action="run-skill" desc="Fill Section 5">
383
+ <field name="skill">search_replace</field>
384
+ <field name="file_path" value="${documentPath}"/>
385
+ <field name="search" value="## 5. References.*?(?=## 6.|$)"/>
386
+ <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}"/>
387
+ </block>
388
+
389
+ <!-- Section 6: Business Rule Constraints -->
390
+ <block type="task" id="B5b6" action="run-skill" desc="Fill Section 6">
391
+ <field name="skill">search_replace</field>
392
+ <field name="file_path" value="${documentPath}"/>
393
+ <field name="search" value="## 6. Business Rule Constraints.*?(?=## 7.|$)"/>
394
+ <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}"/>
395
+ </block>
396
+
397
+ <!-- Section 7: Notes and Additional Information -->
398
+ <block type="task" id="B5b7" action="run-skill" desc="Fill Section 7">
399
+ <field name="skill">search_replace</field>
400
+ <field name="file_path" value="${documentPath}"/>
401
+ <field name="search" value="## 7. Notes and Additional Information.*?(?=$)"/>
402
+ <field name="replace" value="## 7. Notes and Additional Information\n\n${notes}\n\n### Performance and Scalability Analysis\n\n${performanceAnalysis}"/>
403
+ </block>
404
+
405
+ <block type="checkpoint" id="CP5b" name="all-sections-filled" desc="All sections filled checkpoint">
406
+ <field name="verify" value="all.sections.filled"/>
407
+ </block>
408
+ <block type="event" id="E5b" action="log" level="info" desc="Log section filling">
409
+ <field name="message">Step 5b Status: COMPLETED - All sections filled using search_replace</field>
410
+ </block>
411
+ </sequence>
412
+
413
+ <!-- ==================== STEP 6: REPORT RESULTS ==================== -->
414
+ <sequence id="S6" name="Step 6: Report Results" status="pending" desc="Report analysis results">
415
+ <block type="event" id="E6" action="log" level="info" desc="Log final status">
416
+ <field name="message">Step 6 Status: COMPLETED - Analysis success: Successfully analyzed ${fileName} feature from ${sourcePath}</field>
417
+ </block>
418
+ </sequence>
419
+
420
+ <!-- ==================== STEP 7: WRITE COMPLETION MARKERS ==================== -->
421
+ <!-- Calculate Subpath from Source Path -->
422
+ <block type="task" id="B29" action="calculate-subpath" desc="Calculate subpath">
423
+ <field name="sourcePath" value="${sourcePath}"/>
424
+ <field name="output" var="subpath" from="calculation.subpath"/>
425
+ </block>
426
+
427
+ <!-- Generate Marker File Name -->
428
+ <block type="task" id="B30" action="generate-marker-name" desc="Generate marker name">
429
+ <field name="module" value="${module}"/>
430
+ <field name="subpath" value="${subpath}"/>
431
+ <field name="fileName" value="${fileName}"/>
432
+ <field name="output" var="markerName" from="generation.name"/>
433
+ </block>
434
+
435
+ <!-- Pre-write Verification -->
436
+ <block type="checkpoint" id="CP6" name="pre-write-check" desc="Pre-write verification">
437
+ <field name="verify" value="${fileName} does-not-contain '.' AND ${sourceFile} matches 'features-*.json'"/>
438
+ </block>
439
+
440
+ <!-- Write .done.json File -->
441
+ <block type="task" id="B31" action="create-file" desc="Write done marker file">
442
+ <field name="target" value="${completed_dir}/${markerName}.done.json"/>
443
+ <field name="content" value="{
444
+ &quot;fileName&quot;: &quot;${fileName}&quot;,
445
+ &quot;sourcePath&quot;: &quot;${sourcePath}&quot;,
446
+ &quot;sourceFile&quot;: &quot;${sourceFile}&quot;,
447
+ &quot;module&quot;: &quot;${module}&quot;,
448
+ &quot;documentPath&quot;: &quot;${documentPath}&quot;,
449
+ &quot;status&quot;: &quot;${status}&quot;,
450
+ &quot;analysisNotes&quot;: &quot;${message}&quot;
451
+ }"/>
452
+ </block>
453
+
454
+ <!-- Verify Marker File Written -->
455
+ <block type="checkpoint" id="CP7" name="marker-written" desc="Marker file written">
456
+ <field name="verify" value="file.exists(${completed_dir}/${markerName}.done.json)"/>
457
+ </block>
458
+
459
+ <block type="event" id="E10" action="log" level="info" desc="Log marker status">
460
+ <field name="message" value="Step 7 Status: COMPLETED - Done marker file written to ${completed_dir}/${markerName}.done.json"/>
461
+ </block>
462
+
463
+ <!-- ==================== FINAL OUTPUT ==================== -->
464
+ <block type="output" id="O1" desc="UI feature analysis output results">
465
+ <field name="status" value="success"/>
466
+ <field name="feature_name" from="${fileName}"/>
467
+ <field name="generated_file" from="${documentPath}"/>
468
+ <field name="message" value="Successfully analyzed ${fileName} feature from ${sourcePath}"/>
469
+ <field name="platformType" from="${platform_type}"/>
470
+ <field name="module" from="${module}"/>
471
+ </block>
472
+
473
+ <!-- ==================== ERROR HANDLING ==================== -->
474
+ <block type="error-handler" id="EH1" desc="Handle workflow errors">
475
+ <try>
476
+ <!-- Main workflow defined in sequences above -->
477
+ </try>
478
+ <catch error-type="file-not-found">
479
+ <block type="event" id="EH1-E1" action="log" level="error" desc="File not found error">
480
+ <field name="message">Source file not found: ${sourcePath}</field>
481
+ </block>
482
+ <field name="status" value="failed"/>
483
+ <field name="message" value="Source file not found: ${sourcePath}"/>
484
+ </catch>
485
+ <catch error-type="template-error">
486
+ <block type="event" id="EH1-E2" action="log" level="error" desc="Template error">
487
+ <field name="message">Template processing error</field>
488
+ </block>
489
+ <field name="status" value="failed"/>
490
+ <field name="message" value="Failed to process template"/>
491
+ </catch>
492
+ <catch error-type="validation-error">
493
+ <block type="event" id="EH1-E3" action="log" level="error" desc="Validation error">
494
+ <field name="message">Validation failed: ${error.message}</field>
495
+ </block>
496
+ <field name="status" value="partial"/>
497
+ <field name="message" value="Analysis completed with validation errors"/>
498
+ </catch>
499
+ <finally>
500
+ <block type="event" id="EH1-E4" action="log" level="info" desc="Workflow completed">
501
+ <field name="message">Workflow execution completed</field>
502
+ </block>
503
+ </finally>
504
+ </block>
505
+
506
+ </workflow>
308
507
 
309
- ### Step 5b: Fill Each Section Using search_replace
310
-
311
- **Step 5b Status: 🔄 IN PROGRESS**
312
-
313
- **Objective:** Fill each section of the copied template document using `search_replace`, preserving section structure.
314
-
315
- **CRITICAL Rules:**
316
- - ⚠️ **NEVER use `create_file` to rewrite the entire document**
317
- - ⚠️ **ALWAYS use `search_replace` to update specific sections**
318
- - ⚠️ **Section titles and numbering MUST be preserved**
319
- - ⚠️ **If a section has no corresponding information, replace placeholder content with "N/A"**
320
-
321
- **Section Filling Order:**
322
-
323
- #### 1. Section 1 - Content Overview
324
- Replace the placeholder description with actual feature description.
325
-
326
- #### 2. Section 2 - Interface Prototype
327
- Replace the example ASCII wireframe with actual wireframe drawn in Step 3.
328
-
329
- #### 3. Section 3 - Business Flow
330
- Replace example Mermaid diagrams with actual flow diagrams from Step 3. Add **Sequence Analysis** and **Boundary Scenarios** tables.
331
-
332
- #### 4. Section 4 - Data Field Definition
333
- Replace example field rows with actual field definitions. Add **Data Binding Mapping** and **Reactive Dependency Chain**.
334
-
335
- #### 5. Section 5 - References
336
- Fill all reference tables (APIs, Shared Methods, Shared Components, Other Pages, Referenced By).
337
-
338
- #### 6. Section 6 - Business Rule Constraints
339
- Fill permission rules, business logic rules, and validation rules.
340
-
341
- #### 7. Section 7 - Notes and Additional Information
342
- Fill notes and add **Performance and Scalability Analysis** subsection.
343
-
344
- **Section Filling Checklist:**
345
- - [ ] Section 1: Content Overview — description filled
346
- - [ ] Section 2: Interface Prototype — ASCII wireframes replaced
347
- - [ ] Section 2: Interface Element Description table filled
348
- - [ ] Section 3: All flows — diagrams and descriptions filled
349
- - [ ] Section 3: API call sequence analysis added
350
- - [ ] Section 3: Boundary scenarios documented
351
- - [ ] Section 4: Page State Fields and Form Fields tables filled
352
- - [ ] Section 4: Data binding mapping and reactive dependency chain added
353
- - [ ] Section 5: All reference tables filled
354
- - [ ] Section 6: All business rules tables filled
355
- - [ ] Section 7: Notes and performance analysis filled
356
-
357
- **Output:** "Step 5b Status: ✅ COMPLETED - All sections filled using search_replace"
358
-
359
- ---
360
-
361
- **CRITICAL - Link Format Rules:**
362
-
363
- ❌ **NEVER use `file://` protocol in links** — This breaks Markdown preview
364
- ✅ **ALWAYS use relative paths** — Markdown links work correctly
365
-
366
- **Dynamic Path Calculation:**
367
- 1. Count the number of directory separators in `{{documentPath}}` from project root
368
- 2. For each level, add one `../`
369
- 3. Construct the final link: `[Source]({pathPrefix}{sourcePath})`
370
-
371
- ### Step 6: Report Results
372
-
373
- **Step 6 Status: 🔄 IN PROGRESS**
374
-
375
- Return analysis result summary:
376
-
377
- ```json
378
- {
379
- "status": "{{status}}",
380
- "feature": {
381
- "fileName": "{{fileName}}",
382
- "sourcePath": "{{sourcePath}}"
383
- },
384
- "platformType": "{{platform_type}}",
385
- "module": "{{module}}",
386
- "featureName": "{{feature_name}}",
387
- "generatedFile": "{{generated_file}}",
388
- "message": "{{message}}"
389
- }
390
- ```
508
+ ## Constraints
391
509
 
392
- ---
510
+ 1. **DO NOT analyze files outside the specified `{{sourcePath}}`**
511
+ 2. **DO NOT generate separate documents for embedded components**
512
+ 3. **All content MUST be in the language specified by `{{language}}`**
513
+ 4. **Use `search_replace` for section filling, NEVER rewrite entire document**
514
+ 5. **Mermaid diagrams MUST follow the rules in `mermaid-rule.md`**
515
+ 6. **All links MUST use relative paths, NEVER `file://` protocol**
393
516
 
394
517
  ## Task Completion Report
395
518
 
@@ -405,14 +528,19 @@ When the task is complete, report the following:
405
528
 
406
529
  **Files Generated:**
407
530
  - `{{documentPath}}` - Feature documentation
531
+ - `completed_dir/markerName.done.json` - Completion marker
408
532
 
409
- **Note:** Graph data construction (nodes, edges, marker files) is handled by `speccrew-knowledge-bizs-ui-graph` Skill.
533
+ **Note:** Graph data (.graph.json) is handled by `speccrew-knowledge-bizs-ui-graph` Skill. The `.done.json` completion marker is written by this Skill in Step 7.
410
534
 
411
- ## Constraints
535
+ ## Checklist
412
536
 
413
- 1. **DO NOT analyze files outside the specified `{{sourcePath}}`**
414
- 2. **DO NOT generate separate documents for embedded components**
415
- 3. **All content MUST be in the language specified by `{{language}}`**
416
- 4. **Use `search_replace` for section filling, NEVER rewrite entire document**
417
- 5. **Mermaid diagrams MUST follow the rules in `mermaid-rule.md`**
418
- 6. **All links MUST use relative paths, NEVER `file://` protocol**
537
+ - [ ] Template file selected based on `{{platform_type}}`
538
+ - [ ] Template content read successfully
539
+ - [ ] Source file read and analyzed
540
+ - [ ] Business features extracted with wireframes
541
+ - [ ] Referencing pages found
542
+ - [ ] Template copied to document path
543
+ - [ ] All sections filled using search_replace
544
+ - [ ] All content in target language (`{{language}}`)
545
+ - [ ] Results reported in JSON format
546
+ - [ ] Done marker file written to completed_dir