speccrew 0.7.73 → 0.7.75

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 (74) hide show
  1. package/.speccrew/agents/speccrew-feature-designer.md +96 -0
  2. package/.speccrew/agents/speccrew-product-manager.md +55 -0
  3. package/.speccrew/agents/speccrew-system-deployer.md +178 -0
  4. package/.speccrew/agents/speccrew-system-developer.md +177 -0
  5. package/.speccrew/agents/speccrew-task-worker.md +18 -0
  6. package/.speccrew/agents/speccrew-team-leader.md +56 -0
  7. package/.speccrew/agents/speccrew-test-manager.md +167 -0
  8. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +6 -149
  9. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +2 -59
  10. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +2 -64
  11. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +2 -75
  12. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +2 -70
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +2 -381
  14. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +2 -369
  15. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +2 -362
  16. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +2 -304
  17. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +2 -294
  18. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +2 -204
  19. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +2 -173
  20. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +2 -169
  21. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +2 -173
  22. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +2 -251
  23. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +2 -254
  24. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +2 -748
  25. package/.speccrew/skills/speccrew-feature-designer-orchestration/SKILL.md +6 -105
  26. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +6 -33
  27. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +3 -138
  28. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +3 -283
  29. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +3 -1014
  30. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +4 -343
  31. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +4 -235
  32. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +6 -72
  33. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +3 -534
  34. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +3 -432
  35. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +4 -391
  36. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -98
  37. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -92
  38. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +3 -181
  39. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +3 -148
  40. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +3 -330
  41. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +6 -159
  42. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +3 -142
  43. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +3 -568
  44. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +3 -180
  45. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +3 -154
  46. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +3 -176
  47. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -135
  48. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +4 -88
  49. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +4 -178
  50. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -102
  51. package/.speccrew/skills/speccrew-pm-phase0-init/SKILL.md +5 -78
  52. package/.speccrew/skills/speccrew-pm-phase1-knowledge-check/SKILL.md +5 -85
  53. package/.speccrew/skills/speccrew-pm-phase2-complexity-assess/SKILL.md +4 -100
  54. package/.speccrew/skills/speccrew-pm-phase5-subprd-dispatch/SKILL.md +14 -106
  55. package/.speccrew/skills/speccrew-pm-phase6-verify-confirm/SKILL.md +7 -84
  56. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +6 -66
  57. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +4 -96
  58. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +4 -131
  59. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +6 -79
  60. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +4 -76
  61. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +3 -281
  62. package/.speccrew/skills/speccrew-product-manager-orchestration/SKILL.md +6 -165
  63. package/.speccrew/skills/speccrew-system-deployer-orchestration/SKILL.md +6 -79
  64. package/.speccrew/skills/speccrew-system-designer-orchestration/SKILL.md +2 -35
  65. package/.speccrew/skills/speccrew-system-developer-orchestration/SKILL.md +6 -98
  66. package/.speccrew/skills/speccrew-task-worker-execution/SKILL.md +6 -94
  67. package/.speccrew/skills/speccrew-team-leader-routing/SKILL.md +6 -79
  68. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +2 -58
  69. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +2 -61
  70. package/.speccrew/skills/speccrew-test-manager-orchestration/SKILL.md +6 -94
  71. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +2 -102
  72. package/.speccrew/skills/speccrew-test-runner/SKILL.md +3 -121
  73. package/package.json +1 -1
  74. package/workspace-template/docs/rules/agentflow-spec.md +56 -8
@@ -4,78 +4,12 @@ description: Classify features into business modules by analyzing source code st
4
4
  tools: None
5
5
  ---
6
6
 
7
- # Bizs Module Classify
8
-
9
- Reclassify features in `features-{platform}.json` files into proper business modules based on source code analysis.
10
-
11
- ## Language Adaptation
12
-
13
- **CRITICAL**: All generated documents must match the user's language. Detect the language from the user's input and use it consistently.
14
-
15
- - User writes in 中文 → Generate Chinese content, use `language: "zh"`
16
- - User writes in English → Generate English content, use `language: "en"`
17
- - User writes in other languages → Use appropriate language code
18
-
19
- ## Input
20
-
21
- | Variable | Description | Default |
22
- |----------|-------------|---------|
23
- | `features_file` | Path to features-{platform}.json file (for reference only, Worker should NOT read it) | **REQUIRED** |
24
- | `source_path` | Source code root path for context | **REQUIRED** |
25
- | `module_summary` | JSON string containing module names, feature counts, and sample source paths (provided by dispatch via extract-module-summary.js) | **REQUIRED** |
26
- | `language` | User's language code (e.g., "zh", "en") | **REQUIRED** |
27
-
28
- ## Output
29
-
30
- Worker MUST return a JSON result containing the module mapping (NOT modify the features file directly):
31
-
32
- ```json
33
- {
34
- "status": "success|failed",
35
- "message": "description of reclassification",
36
- "mapping": {
37
- "old_module_1": "new_module_1",
38
- "old_module_2": "new_module_2"
39
- },
40
- "modules_reclassified": N
41
- }
42
- ```
43
-
44
- **IMPORTANT**:
45
- - Only include modules that need to change in the `mapping` object
46
- - Modules that remain the same should NOT be listed
47
- - The `mapping` will be passed to `apply-module-mapping.js` by the dispatch agent to batch-update the features file
48
- - Worker MUST NOT modify the features file directly
7
+ # Trigger Scenarios
8
+ - "Classify features into business modules"
9
+ - "Reclassify directory modules to business modules"
10
+ - "Analyze feature module assignments"
49
11
 
50
12
  ## AgentFlow Definition
51
-
52
13
  <!-- @agentflow: SKILL.xml -->
53
-
54
- > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
55
-
56
- ## Return
57
-
58
- ```json
59
- {
60
- "status": "success",
61
- "message": "Reclassified 12 features from 5 directory modules to 4 business modules",
62
- "mapping": {
63
- "Error": "_common",
64
- "Home": "_common",
65
- "Login": "system",
66
- "Profile": "_common",
67
- "Redirect": "_common"
68
- },
69
- "modules_reclassified": 12
70
- }
71
- ```
72
-
73
- ## Checklist
74
-
75
- - [ ] All modules from `module_summary` are analyzed
76
- - [ ] No page-type module names remain in mapping values (Error, Login, Home, Profile, Redirect)
77
- - [ ] All new module names in mapping are lowercase or kebab-case
78
- - [ ] Only modules that need to change are included in the `mapping` object
79
- - [ ] `modules_reclassified` count is accurate
80
- - [ ] Worker did NOT use any tools (Read, Write, Bash, terminal)
81
- - [ ] Worker did NOT modify any files directly
14
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: speccrew-workspace/docs/rules/agentflow-spec.md
15
+ > Then read and execute the XML workflow in SKILL.xml block-by-block as the authoritative execution plan.
@@ -4,543 +4,12 @@ description: Analyze a single UI feature from source code to extract business fu
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash
5
5
  ---
6
6
 
7
- # UI Feature Analysis - Single Feature (XML Block Workflow)
8
-
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
-
11
- Analyze one specific UI feature from source code, extract business functionality, and generate feature documentation. This skill operates at feature granularity - one worker per feature file.
12
-
13
- ## Trigger Scenarios
14
-
7
+ # Trigger Scenarios
15
8
  - "Analyze feature {fileName} from source code"
16
9
  - "Extract UI functionality from feature {fileName}"
17
10
  - "Generate documentation for feature {fileName}"
18
- - "Analyze UI feature from features.json"
19
-
20
- ## Input Variables
21
-
22
- | Variable | Type | Description | Example |
23
- |----------|------|-------------|---------|
24
- | `{{feature}}` | object | Complete feature object from features.json | - |
25
- | `{{fileName}}` | string | Feature file name | `"index"`, `"UserForm"` |
26
- | `{{sourcePath}}` | string | Relative path to source file | `"frontend-web/src/views/system/user/index.vue"` |
27
- | `{{documentPath}}` | string | Target path for generated document | `"speccrew-workspace/knowledges/bizs/web-vue/src/views/system/user/index.md"` |
28
- | `{{module}}` | string | Business module name (from feature.module) | `"system"`, `"trade"`, `"_root"` |
29
- | `{{analyzed}}` | boolean | Analysis status flag | `true` / `false` |
30
- | `{{platform_type}}` | string | Platform type | `"web"`, `"mobile"` |
31
- | `{{platform_subtype}}` | string | Platform subtype | `"vue"`, `"react"` |
32
- | `{{tech_stack}}` | array | Platform tech stack | `["vue", "typescript"]` |
33
- | `{{language}}` | string | **REQUIRED** - Target language for generated content | `"zh"`, `"en"` |
34
-
35
- ## Language Adaptation
36
-
37
- **CRITICAL**: Generate all content in the language specified by the `{{language}}` parameter.
38
-
39
- - `{{language}} == "zh"` → Generate all content in 中文
40
- - `{{language}} == "en"` → Generate all content in English
41
- - Other languages → Use the specified language
42
-
43
- **All output content (feature names, descriptions, business rules) must be in the target language only.**
44
-
45
- ## Output Variables
46
-
47
- | Variable | Type | Description |
48
- |----------|------|-------------|
49
- | `{{status}}` | string | Analysis status: `"success"`, `"partial"`, or `"failed"` |
50
- | `{{feature_name}}` | string | Name of the analyzed feature |
51
- | `{{generated_file}}` | string | Path to the generated documentation file |
52
- | `{{message}}` | string | Summary message for status update |
53
-
54
- ## Output
55
-
56
- **Generated Files (MANDATORY - Task is NOT complete until all files are written):**
57
- 1. `{{documentPath}}` - Feature documentation file
58
-
59
- **Return Value (JSON format):**
60
- ```json
61
- {
62
- "status": "success|partial|failed",
63
- "feature": {
64
- "fileName": "index",
65
- "sourcePath": "frontend-web/src/views/system/user/index.vue"
66
- },
67
- "platformType": "web",
68
- "module": "system",
69
- "featureName": "user-management",
70
- "generatedFile": "speccrew-workspace/knowledges/bizs/web-vue/src/views/system/user/index.md",
71
- "message": "Successfully analyzed user-management feature from index.vue"
72
- }
73
- ```
74
-
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
11
 
77
12
  ## AgentFlow Definition
78
-
79
13
  <!-- @agentflow: SKILL.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>
507
-
508
- ## Constraints
509
-
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**
516
-
517
- ## Task Completion Report
518
-
519
- When the task is complete, report the following:
520
-
521
- **Status:** `success` | `partial` | `failed`
522
-
523
- **Summary:**
524
- - Feature analyzed: `{{feature_name}}`
525
- - Document generated: `{{documentPath}}`
526
- - Platform: `{{platform_type}}/{{platform_subtype}}`
527
- - Module: `{{module}}`
528
-
529
- **Files Generated:**
530
- - `{{documentPath}}` - Feature documentation
531
- - `completed_dir/markerName.done.json` - Completion marker
532
-
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.
534
-
535
- ## Checklist
536
-
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
14
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: speccrew-workspace/docs/rules/agentflow-spec.md
15
+ > Then read and execute the XML workflow in SKILL.xml block-by-block as the authoritative execution plan.