speccrew 0.7.74 → 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 (66) hide show
  1. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +6 -149
  2. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +2 -59
  3. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +2 -64
  4. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +2 -75
  5. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +2 -70
  6. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +2 -381
  7. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +2 -369
  8. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +2 -362
  9. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +2 -304
  10. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +2 -294
  11. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +2 -204
  12. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +2 -173
  13. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +2 -169
  14. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +2 -173
  15. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +2 -251
  16. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +2 -254
  17. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +2 -748
  18. package/.speccrew/skills/speccrew-feature-designer-orchestration/SKILL.md +6 -105
  19. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +6 -33
  20. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +3 -138
  21. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +3 -283
  22. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +3 -1014
  23. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +4 -343
  24. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +4 -235
  25. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +6 -72
  26. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +3 -534
  27. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +3 -432
  28. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +4 -391
  29. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -98
  30. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -92
  31. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +3 -181
  32. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +3 -148
  33. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +3 -330
  34. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +6 -159
  35. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +3 -142
  36. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +3 -568
  37. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +3 -180
  38. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +3 -154
  39. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +3 -176
  40. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -135
  41. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +4 -88
  42. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +4 -178
  43. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -102
  44. package/.speccrew/skills/speccrew-pm-phase0-init/SKILL.md +5 -78
  45. package/.speccrew/skills/speccrew-pm-phase1-knowledge-check/SKILL.md +5 -85
  46. package/.speccrew/skills/speccrew-pm-phase2-complexity-assess/SKILL.md +4 -100
  47. package/.speccrew/skills/speccrew-pm-phase5-subprd-dispatch/SKILL.md +14 -106
  48. package/.speccrew/skills/speccrew-pm-phase6-verify-confirm/SKILL.md +7 -84
  49. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +6 -66
  50. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +4 -96
  51. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +4 -131
  52. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +6 -79
  53. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +4 -76
  54. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +3 -281
  55. package/.speccrew/skills/speccrew-product-manager-orchestration/SKILL.md +6 -165
  56. package/.speccrew/skills/speccrew-system-deployer-orchestration/SKILL.md +6 -79
  57. package/.speccrew/skills/speccrew-system-designer-orchestration/SKILL.md +2 -35
  58. package/.speccrew/skills/speccrew-system-developer-orchestration/SKILL.md +6 -98
  59. package/.speccrew/skills/speccrew-task-worker-execution/SKILL.md +6 -94
  60. package/.speccrew/skills/speccrew-team-leader-routing/SKILL.md +6 -79
  61. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +2 -58
  62. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +2 -61
  63. package/.speccrew/skills/speccrew-test-manager-orchestration/SKILL.md +6 -94
  64. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +2 -102
  65. package/.speccrew/skills/speccrew-test-runner/SKILL.md +3 -121
  66. package/package.json +1 -1
@@ -4,1023 +4,12 @@ description: Dispatch bizs knowledge base generation tasks with 5-stage pipeline
4
4
  tools: Read, Write, Task, Bash
5
5
  ---
6
6
 
7
- > **⚠️ MANDATORY EXECUTION PROTOCOL — READ BEFORE EXECUTING ANY BLOCK**
8
- >
9
- > **Step 1**: Load XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md` — this defines all block types and action-to-tool mappings
10
- >
11
- > **Step 2**: Execute this SKILL.md's XML workflow **block by block in document order**. For EVERY block, you MUST follow this 3-step cycle:
12
- >
13
- > ```
14
- > 🏷️ Block [ID] (action=[action]) — [desc]
15
- > 🔧 Tool: [which IDE tool to call]
16
- > ✅ Result: [output or status]
17
- > ```
18
- >
19
- > Action-to-tool mapping:
20
- > - `action="run-script"` → Execute via **Terminal tool** (pass the `<field name="command">` value EXACTLY)
21
- > - `action="run-skill"` → Invoke via **Skill tool** (pass the `<field name="skill">` value EXACTLY)
22
- > - `action="dispatch-to-worker"` → Create **Task** via **Task tool** for `speccrew-task-worker` (Worker loads and executes the skill, NOT you)
23
- > - `action="confirm"` (event) → Present to user and wait for response
24
- >
25
- > **Step 3**: Execute ALL stages sequentially without pausing (only stop at explicit `<event action="confirm">` blocks)
26
- >
27
- > **FORBIDDEN**:
28
- > - Do NOT skip the block announcement format above — every block must be announced before execution
29
- > - Do NOT run terminal commands as substitute for Skill tool calls
30
- > - Do NOT do Worker's job yourself — when `action="dispatch-to-worker"`, create a Task and let Worker handle it
31
- > - Do NOT skip blocks or improvise your own commands
32
- > - Do NOT read a skill's SKILL.md file yourself — use the Skill tool which resolves paths automatically
33
-
34
- # Bizs Knowledge Dispatch (XML Block Version)
35
-
36
- Orchestrate **bizs knowledge base generation** with a 5-stage pipeline using **XML Block system**: Feature Inventory → Feature Analysis + Graph Write → Module Summarize → UI Style Pattern Extract → System Summary.
37
-
38
- ## Invocation Method
39
-
40
- **CRITICAL**: This skill is an **orchestration playbook** — it MUST be loaded directly by Team Leader via Skill tool (NOT via Worker Agent).
41
-
42
- ```
43
- Correct: Leader uses Skill tool to load this playbook directly
44
- Incorrect: Dispatch this skill to speccrew-task-worker
45
- ```
46
-
47
- **Why?** This skill defines the orchestration workflow and prepares task plans for downstream workers. The Team Leader reads this playbook and dispatches individual worker tasks via Task tool → speccrew-task-worker for each stage.
48
-
49
- **Correct Invocation Pattern**:
50
- ```xml
51
- <block type="task" action="run-skill" desc="Leader directly invokes bizs-dispatch as orchestration playbook">
52
- <field name="skill">speccrew-knowledge-bizs-dispatch</field>
53
- <field name="note">Leader directly calls this dispatch skill as an orchestration playbook. The dispatch skill defines the workflow; Leader dispatches downstream workers via Task tool → speccrew-task-worker for each stage.</field>
54
- </block>
55
- ```
56
-
57
- **Worker Dispatch Rule**:
58
- - Dispatch skills (bizs-dispatch, techs-dispatch): Leader calls directly via Skill tool
59
- - Downstream worker skills (identify-entries, init-features, ui-analyze, module-summarize, etc.): Leader dispatches via Task tool → speccrew-task-worker
60
-
61
- **FORBIDDEN**: Worker Agents MUST NOT execute this dispatch skill. If a Worker Agent loads this skill, it must report error and abort.
62
-
63
- ## Quick Reference — Execution Flow
64
-
65
- ```
66
- Stage 0: Platform Detection
67
- └─ Detect platforms → Confirm platform list
68
-
69
- Stage 1: Feature Inventory Init
70
- └─ 1a: Entry directory recognition (identify-entries)
71
- └─ 1b: Feature inventory generation (init-features)
72
- └─ 1c: Feature merge (incremental mode)
73
-
74
- Stage 2: Feature Analysis (Batch Loop)
75
- └─ Step 0: Ensure completed_dir exists
76
- └─ Step 1: Get next batch of pending features
77
- └─ Step 2: Dispatch Worker for analysis (UI/API routing)
78
- └─ Step 2.5: Dispatch Graph Worker
79
- └─ Step 3: Process batch results → Update status
80
- └─ Loop until all features complete
81
-
82
- Stage 3: Module Summarize
83
- └─ Step 1: Collect all platform-module pairs in one batch
84
- └─ Step 2: Dispatch ALL module summary Workers in ONE parallel batch across ALL platforms
85
-
86
- Stage 3.5: UI Style Pattern Extract
87
- └─ Extract UI style patterns for frontend platforms
88
-
89
- Stage 4: System Summary
90
- └─ Generate system-level business knowledge summary
91
- ```
92
-
93
- ## Language Adaptation
94
-
95
- **CRITICAL**: All generated documents must match the user's language. Detect the language from the user's input and pass it to all downstream Worker Agents.
96
-
97
- - User writes in 中文 → Generate Chinese documents, pass `language: "zh"` to workers
98
- - User writes in English → Generate English documents, pass `language: "en"` to workers
99
- - User writes in other languages → Use appropriate language code
100
-
101
- **All downstream skills must receive the `language` parameter and generate content in that language only.**
102
-
103
- ## Trigger Scenarios
104
-
7
+ # Trigger Scenarios
105
8
  - "Initialize bizs knowledge base"
106
9
  - "Generate business knowledge from source code"
107
10
  - "Dispatch bizs knowledge generation"
108
- - "Generate knowledge base from src/views directory"
109
- - "Analyze this subdirectory for knowledge base"
110
-
111
- ---
112
11
 
113
12
  ## AgentFlow Definition
114
-
115
13
  <!-- @agentflow: SKILL.xml -->
116
-
117
- > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
118
- >
119
- > After reading the specification, parse the XML workflow and **strictly execute each `<block>` in document order**. Every `<block type="task">` is a literal tool-call instruction — use the `action` attribute to determine which IDE tool to invoke, and pass the `<field name="command">` or `<field name="skill">` value **exactly as written**. Do NOT interpret the workflow as a goal description or improvise your own approach.
120
-
121
- <!-- ============================================================
122
- Input Parameters Definition
123
- ============================================================ -->
124
- <block type="input" id="I1" desc="bizs knowledge base generation input parameters">
125
- <field name="source_path" required="true" type="string" desc="Source code root directory path (can be a subdirectory; auto-detects platform root by traversing upward)"/>
126
- <field name="language" required="true" type="string" desc="User's language code (e.g., zh, en)"/>
127
- <field name="sync_mode" required="false" type="string" default="full" desc="full=complete | incremental=incremental"/>
128
- <field name="base_commit" required="false" type="string" desc="(incremental only) Git base commit hash"/>
129
- <field name="head_commit" required="false" type="string" default="HEAD" desc="(incremental only) Git HEAD commit hash"/>
130
- <field name="changed_files" required="false" type="array" desc="(incremental only) Pre-computed changed file list"/>
131
- <field name="max_concurrent_workers" required="false" type="number" default="5" desc="Maximum parallel Worker count"/>
132
- <field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace directory"/>
133
- <field name="sync_state_bizs_dir" required="true" type="string" desc="Absolute path to knowledges/base/sync-state/knowledge-bizs/ (✓ correct: .../knowledges/base/sync-state/knowledge-bizs/ | ✗ wrong: .../knowledges/bizs/sync-state/knowledge-bizs/)"/>
134
- <field name="ide_skills_dir" required="true" type="string" desc="Absolute path to IDE-specific skills directory (e.g., .qoder/skills/, .cursor/skills/, .claude/skills/) where skill scripts are deployed"/>
135
- <field name="configs_dir" required="true" type="string" desc="Absolute path to docs/configs/ directory"/>
136
- <field name="graph_root" required="false" type="string" desc="Graph data output root path (absolute path preferred)" default="${workspace_path}/knowledges/bizs/graph"/>
137
- <field name="completed_dir" required="true" type="string" desc="Marker file output directory for Worker results (absolute path required)"/>
138
- </block>
139
-
140
- <!-- ============================================================
141
- Global Invocation Rules
142
- ============================================================ -->
143
- <block type="rule" id="GLOBAL-R-INVOCATION" level="forbidden" desc="Invocation constraints — NEVER violate">
144
- <field name="text">This skill is an ORCHESTRATION PLAYBOOK — it MUST be loaded directly by Team Leader via Skill tool</field>
145
- <field name="text">Worker Agents MUST NOT execute this dispatch skill — if loaded by a Worker, report error and abort</field>
146
- <field name="text">Downstream worker skills (identify-entries, init-features, ui-analyze, module-summarize, etc.) MUST be dispatched via Task tool → speccrew-task-worker</field>
147
- </block>
148
-
149
- <!-- ============================================================
150
- Global Continuous Execution Rules
151
- ============================================================ -->
152
- <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
153
- <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" between stages</field>
154
- <field name="text">DO NOT offer options like "Full execution / Sample execution / Pause" — always execute ALL stages to completion</field>
155
- <field name="text">DO NOT suggest "Let me split this into batches" or "Let's do this in parts" — process ALL features sequentially</field>
156
- <field name="text">DO NOT pause to list what you plan to do next — just do it</field>
157
- <field name="text">DO NOT ask for confirmation before generating output files</field>
158
- <field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
159
- <field name="text">ONLY pause at explicit &lt;event action="confirm"&gt; blocks defined in the workflow</field>
160
- <field name="text">DO NOT offer "continue/pause/partial" options — EVER</field>
161
- <field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL phases in sequence</field>
162
- <field name="text">When many features need analysis, dispatch ALL of them — do NOT skip or defer any</field>
163
- <field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
164
- </block>
165
-
166
- <!-- ============================================================
167
- Global Technology Stack Constraints
168
- ============================================================ -->
169
- <block type="rule" id="GLOBAL-R-TECHSTACK" level="forbidden" desc="Technology stack constraints — NEVER violate">
170
- <field name="text">FORBIDDEN: Python, Ruby, Perl, compiled binaries, or any runtime requiring separate installation</field>
171
- <field name="text">PERMITTED scripting: PowerShell (Windows) and Bash (Linux/Mac) ONLY</field>
172
- <field name="text">PERMITTED Node.js: ONLY for existing project scripts (e.g., node scripts/update-progress.js)</field>
173
- <field name="text">For JSON validation use: node -e "JSON.parse(require('fs').readFileSync('file.json','utf8'))"</field>
174
- <field name="text">For JSON creation use: node -e with inline script, or PowerShell ConvertTo-Json</field>
175
- <field name="text">DO NOT create temporary .py, .rb, .pl, .bat files — use inline commands via run_in_terminal</field>
176
- </block>
177
-
178
- <!-- ============================================================
179
- Stage 0: Platform Detection
180
- ============================================================ -->
181
- <sequence id="S0" name="Stage 0: Platform Detection" status="pending" desc="Automatically discover ALL platforms in the project">
182
-
183
- <block type="rule" id="S0-R1" level="mandatory" desc="Stage 0 mandatory rules">
184
- <field name="text">MUST scan project directory to discover ALL platforms — NEVER hardcode a fixed number of platforms</field>
185
- <field name="text">Missing a platform means incomplete knowledge base generation</field>
186
- </block>
187
-
188
- <block type="rule" id="S0-R2" level="mandatory" desc="platformId format constraints">
189
- <field name="text">platformId MUST use format: {platformType}-{techStack}</field>
190
- <field name="text">platformType values: web (NOT frontend), mobile, desktop, backend</field>
191
- <field name="text">✓ Correct: backend-fastapi, web-vue3, mobile-uniapp, desktop-electron</field>
192
- <field name="text">✗ Wrong: backend-system, frontend-web, mobile-app, frontend-vue3</field>
193
- </block>
194
-
195
- <!-- Step 1: Scan backend modules -->
196
- <block type="task" id="S0-B1" action="run-script" status="pending" desc="Scan backend module directories">
197
- <field name="command">Get-ChildItem -Path "${source_path}" -Filter "yudao-module-*" -Directory</field>
198
- <field name="alt_command">Get-ChildItem -Path "${source_path}" -Directory | Where-Object { $_.Name -match "^(module-|service-|api-)" }</field>
199
- <field name="output" var="backend_modules"/>
200
- </block>
201
-
202
- <!-- Step 2: Scan frontend projects -->
203
- <block type="task" id="S0-B2" action="run-script" status="pending" desc="Scan frontend/UI project directories">
204
- <field name="command">Get-ChildItem -Path "${source_path}" -Directory | Where-Object { $_.Name -match "ui|frontend|web|app" }</field>
205
- <field name="output" var="frontend_dirs"/>
206
- </block>
207
-
208
- <!-- Step 3: Validate each platform -->
209
- <block type="loop" id="S0-L1" over="${backend_modules}" as="module" desc="Validate backend modules">
210
- <block type="gateway" id="S0-G1" mode="guard" test="${module.hasSourceCode} == true" fail-action="skip" desc="Verify module has actual source code">
211
- <field name="message">Skipping empty directory: ${module.name}</field>
212
- </block>
213
- <block type="event" id="S0-E1" action="log" level="info" desc="Log backend module">
214
- <field name="message">Discovered backend module: ${module.name} → Platform type: backend-${module.business_name}</field>
215
- </block>
216
- </block>
217
-
218
- <block type="loop" id="S0-L2" over="${frontend_dirs}" as="frontend" desc="Validate frontend projects">
219
- <block type="task" id="S0-B3" action="run-script" status="pending" desc="Check frontend project structure">
220
- <field name="command">Test-Path "${frontend.path}/package.json"</field>
221
- <field name="output" var="has_package_json"/>
222
- </block>
223
- <block type="gateway" id="S0-G2" mode="guard" test="${has_package_json} == true" fail-action="skip" desc="Verify frontend project validity">
224
- <field name="message">Skipping non-frontend directory: ${frontend.name}</field>
225
- </block>
226
- <block type="event" id="S0-E2" action="log" level="info" desc="Log frontend platform">
227
- <field name="message">Discovered frontend platform: ${frontend.name} → Tech stack: Vue/React/UniApp</field>
228
- </block>
229
- </block>
230
-
231
- <!-- Step 4: Generate platform list JSON -->
232
- <block type="task" id="S0-B4" action="run-script" status="pending" desc="Generate platforms.json from discovered modules and frontends">
233
- <field name="command">node -e "const fs=require('fs'); const data=JSON.parse(process.argv[1]); fs.mkdirSync(process.argv[2], {recursive:true}); fs.writeFileSync(process.argv[2]+'/platforms.json', JSON.stringify(data,null,2)); console.log('platforms.json written')"</field>
234
- <field name="note">The LLM constructs the platforms array from S0-L1 and S0-L2 discovery results, then writes it via this inline script. No external platform-detector.js is needed.</field>
235
- <field name="arg">${platforms_json_string}</field>
236
- <field name="arg">${sync_state_bizs_dir}</field>
237
- <field name="output" var="platforms" from="${sync_state_bizs_dir}/platforms.json"/>
238
- </block>
239
-
240
- <!-- Step 5: Gate - Confirm platforms detected -->
241
- <block type="gateway" id="S0-G3" mode="guard" test="${platforms.length} > 0" fail-action="stop" desc="Confirm at least one platform detected">
242
- <field name="message">No platforms detected, please check source_path and platform-mapping.json</field>
243
- </block>
244
-
245
- <!-- Step 6: User confirmation -->
246
- <block type="event" id="S0-E3" action="confirm" title="Confirm Platform List" type="yesno" desc="Wait for user to confirm detected platform list">
247
- <field name="preview">
248
- Detected ${platforms.length} platforms:
249
- (For each platform in ${platforms}, display: ${platform.platformId}: ${sourcePath} (${platformType}/${platformSubtype}))
250
-
251
- Continue with knowledge base generation?
252
- </field>
253
- <on-confirm>
254
- <block type="event" action="log" level="info" desc="User confirmed">
255
- <field name="message">User confirmed platform list, continuing</field>
256
- </block>
257
- </on-confirm>
258
- <on-cancel>
259
- <block type="event" action="log" level="warn" desc="User cancelled">
260
- <field name="message">User cancelled, terminating workflow</field>
261
- </block>
262
- <field name="workflow.status" value="cancelled"/>
263
- </on-cancel>
264
- </block>
265
-
266
- <!-- Checkpoint: Platform detection complete -->
267
- <block type="checkpoint" id="S0-CP1" name="platforms_detected" desc="Platform detection complete">
268
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
269
- <field name="verify" value="${platforms.length} > 0"/>
270
- </block>
271
-
272
- <block type="task" id="S0-B5" action="run-script" status="pending" desc="Update Stage 0 progress to completed">
273
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage0 --status completed --output "Detected ${platforms.length} platforms"</field>
274
- </block>
275
-
276
- <block type="event" id="S0-E4" action="log" level="info" desc="Report detected platform list">
277
- <field name="message">Detected ${platforms.length} platforms: ${platforms.names}</field>
278
- </block>
279
- </sequence>
280
-
281
- <!-- ============================================================
282
- Stage 1a: Entry Directory Recognition
283
- ============================================================ -->
284
- <sequence id="S1a" name="Stage 1a: Entry Directory Recognition" status="pending" desc="Identify entry directories for each platform and classify into business modules">
285
-
286
- <block type="rule" id="S1a-R1" level="mandatory" desc="Stage 1a mandatory rules">
287
- <field name="text">ALL platform entry directory recognition tasks MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
288
- <field name="text">ALL Worker dispatch calls in S1a-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
289
- <field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
290
- <field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
291
- <field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
292
- </block>
293
-
294
- <block type="loop" id="S1a-L1" over="${platforms}" as="platform" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch entry directory recognition for each platform IN PARALLEL">
295
- <!-- Step 1: Read source directory tree -->
296
- <block type="task" id="S1a-B1" action="dispatch-to-worker" status="pending" desc="Dispatch entry identification to Worker">
297
- <field name="worker">speccrew-knowledge-bizs-identify-entries</field>
298
- <field name="source_path" value="${platform.sourcePath}"/>
299
- <field name="platform_id" value="${platform.platformId}"/>
300
- <field name="platform_type" value="${platform.platformType}"/>
301
- <field name="platform_subtype" value="${platform.platformSubtype}"/>
302
- <field name="tech_identifier" value="${platform.techIdentifier}"/>
303
- <field name="configs_dir" value="${configs_dir}"/>
304
- <field name="output_path" value="${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json"/>
305
- <field name="output" var="entries_${platform.platformId}"/>
306
- </block>
307
-
308
- <!-- Step 2: Validate entry directories -->
309
- <block type="gateway" id="S1a-G1" mode="guard" test="${entries_${platform.platformId}.modules.length} > 0" fail-action="stop" desc="Validate entry directory recognition result">
310
- <field name="message">Platform ${platform.platformId} did not identify any entry directories</field>
311
- </block>
312
- </block>
313
-
314
- <block type="checkpoint" id="S1a-CP1" name="entry_dirs_recognized" desc="Entry directory recognition complete">
315
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
316
- <field name="verify" value="true"/>
317
- </block>
318
-
319
- <block type="task" id="S1a-B2" action="run-script" status="pending" desc="Update Stage 1a progress to completed">
320
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage1a --status completed --output "Entry directories recognized for all platforms"</field>
321
- </block>
322
- </sequence>
323
-
324
- <!-- ============================================================
325
- Stage 1b: Generate Feature Inventory
326
- ============================================================ -->
327
- <sequence id="S1b" name="Stage 1b: Generate Feature Inventory" status="pending" desc="Generate Feature inventory for each platform">
328
-
329
- <block type="rule" id="S1b-R1" level="mandatory" desc="Stage 1b mandatory rules">
330
- <field name="text">ALL platform feature inventory generation tasks MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
331
- <field name="text">ALL Worker dispatch calls in S1b-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
332
- <field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
333
- <field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
334
- <field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
335
- <field name="text">Worker Agents do not have run_in_terminal capability, which is required for script execution</field>
336
- </block>
337
-
338
- <block type="loop" id="S1b-L1" over="${platforms}" as="platform" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Generate Feature inventory for each platform IN PARALLEL">
339
- <!-- Step 1: Dispatch Worker to generate feature inventory -->
340
- <block type="task" id="S1b-B1" action="dispatch-to-worker" status="pending" desc="Dispatch Worker to generate feature inventory">
341
- <field name="worker">speccrew-knowledge-bizs-init-features</field>
342
- <field name="instructions">
343
- Generate feature inventory for the specified platform by analyzing entry directories.
344
-
345
- Requirements:
346
- - Read entry-dirs JSON file to get module entry directories
347
- - Scan source files in each entry directory
348
- - Generate features JSON with feature metadata
349
- - Output to features-{platformId}.json in sync_state_bizs_dir
350
- </field>
351
- <field name="context">{
352
- "platformId": "${platform.platformId}",
353
- "platformName": "${platform.platformName}",
354
- "platformType": "${platform.platformType}",
355
- "platformSubtype": "${platform.platformSubtype}",
356
- "sourcePath": "${platform.sourcePath}",
357
- "techIdentifier": "${platform.techIdentifier}",
358
- "entryDirsFile": "${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json",
359
- "outputDir": "${sync_state_bizs_dir}",
360
- "workspace_path": "${workspace_path}",
361
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
362
- "language": "${language}"
363
- }</field>
364
- <field name="output" var="features_${platform.platformId}"/>
365
- </block>
366
-
367
- <!-- Step 2: Validate Feature inventory -->
368
- <block type="gateway" id="S1b-G1" mode="guard" test="${features_${platform.platformId}.features.length} > 0" fail-action="stop" desc="Validate Feature inventory is not empty">
369
- <field name="message">Platform ${platform.platformId} did not generate any Features</field>
370
- </block>
371
- </block>
372
-
373
- <block type="checkpoint" id="S1b-CP1" name="features_generated" desc="Feature inventory generation complete">
374
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
375
- <field name="verify" value="${all_features.length} > 0"/>
376
- </block>
377
-
378
- <block type="task" id="S1b-B2" action="run-script" status="pending" desc="Update Stage 1b progress to completed">
379
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage1b --status completed --output "${feature_count} features across ${platform_count} platforms"</field>
380
- </block>
381
-
382
- <block type="event" id="S1b-E1" action="log" level="info" desc="Report Feature inventory statistics">
383
- <field name="message">Feature inventory initialized. ${feature_count} features across ${platform_count} platforms.</field>
384
- </block>
385
- </sequence>
386
-
387
- <!-- ============================================================
388
- Stage 1c: Feature Merge (Incremental Mode)
389
- ============================================================ -->
390
- <sequence id="S1c" name="Stage 1c: Feature Merge" status="pending" desc="Merge new and existing Feature inventories in incremental mode">
391
-
392
- <block type="rule" id="S1c-R1" level="mandatory" desc="Stage 1c mandatory rules">
393
- <field name="text">This stage is executed DIRECTLY by the dispatch agent (Leader) via run_in_terminal, NOT delegated to a Worker Agent</field>
394
- </block>
395
-
396
- <!-- Conditional: Incremental mode -->
397
- <block type="gateway" id="S1c-G1" mode="exclusive" desc="Determine execution mode">
398
- <branch test="${sync_mode} == 'incremental'" name="Incremental mode">
399
- <!-- Step 1: Execute Feature merge -->
400
- <block type="task" id="S1c-B1" action="run-script" status="pending" desc="Merge new and existing Feature inventories">
401
- <field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js"</field>
402
- <field name="arg">--syncStatePath</field>
403
- <field name="arg">${sync_state_bizs_dir}</field>
404
- <field name="arg">--completedDir</field>
405
- <field name="arg">${completed_dir}</field>
406
- <field name="arg">--projectRoot</field>
407
- <field name="arg">${source_path}</field>
408
- <field name="output" var="merge_result"/>
409
- </block>
410
-
411
- <!-- Step 2: Report merge result -->
412
- <block type="event" id="S1c-E1" action="log" level="info" desc="Report merge result">
413
- <field name="message">Feature merge complete:
414
- - Added: ${merge_result.added}
415
- - Removed: ${merge_result.removed}
416
- - Changed: ${merge_result.changed} (reset for re-analysis)
417
- - Unchanged: ${merge_result.unchanged} (analysis state preserved)</field>
418
- </block>
419
-
420
- <!-- Step 3: Mark stale Features -->
421
- <block type="task" id="S1c-B2" action="run-script" status="pending" desc="Clean up documents and markers for deleted Features">
422
- <field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js"</field>
423
- <field name="arg">--syncStatePath</field>
424
- <field name="arg">${sync_state_bizs_dir}</field>
425
- <field name="arg">--completedDir</field>
426
- <field name="arg">${completed_dir}</field>
427
- </block>
428
- </branch>
429
- <branch default="true" name="Full mode">
430
- <block type="event" id="S1c-E2" action="log" level="info" desc="Full mode skip merge">
431
- <field name="message">Full mode, skipping Feature merge step</field>
432
- </block>
433
- </branch>
434
- </block>
435
-
436
- <block type="checkpoint" id="S1c-CP1" name="feature_merge_complete" desc="Feature merge complete">
437
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
438
- <field name="passed" value="true"/>
439
- </block>
440
-
441
- <block type="task" id="S1c-B3" action="run-script" status="pending" desc="Update Stage 1c progress to completed">
442
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage1c --status completed</field>
443
- </block>
444
- </sequence>
445
-
446
- <!-- ============================================================
447
- Stage 2: Feature Analysis (Batch Processing)
448
- ============================================================ -->
449
- <sequence id="S2" name="Stage 2: Feature Analysis" status="pending" desc="Batch process Feature analysis, dispatch Workers to execute">
450
-
451
- <block type="task" id="S2-B-Start" action="run-script" status="pending" desc="Update Stage 2 progress to in_progress">
452
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage2 --status in_progress</field>
453
- </block>
454
-
455
- <block type="rule" id="S2-R1" level="mandatory" desc="Stage 2 mandatory rules">
456
- <field name="text">MUST use batch-orchestrator for batch management — DO NOT manually track batches</field>
457
- <field name="text">MUST dispatch Workers for feature analysis — DO NOT analyze features yourself</field>
458
- <field name="text">ALL workers for the same stage MUST be dispatched in PARALLEL — sequential execution is FORBIDDEN</field>
459
- <field name="text">ALL Worker dispatch calls in S2-L2 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
460
- <field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
461
- <field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
462
- <field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
463
- <field name="text">Monitor completion via marker files, NOT by polling worker status</field>
464
- </block>
465
-
466
- <block type="rule" id="S2-R2" level="forbidden" desc="Stage 2 forbidden actions">
467
- <field name="text">DO NOT skip pending features — every feature must be analyzed</field>
468
- <field name="text">DO NOT generate feature analysis content yourself — always dispatch to Worker</field>
469
- <field name="text">DO NOT proceed to next Stage until ALL workers in current Stage have completed or failed</field>
470
- </block>
471
-
472
- <!-- Step 0: Ensure completed_dir exists (MANDATORY) -->
473
- <block type="task" id="S2-B0" action="run-script" status="pending" desc="Ensure completed_dir directory exists">
474
- <field name="command">node -e "require('fs').mkdirSync('${completed_dir}', {recursive: true}); console.log('completed dir ready')"</field>
475
- </block>
476
-
477
- <block type="rule" id="S2-R3" level="mandatory" desc="completed_dir path rules">
478
- <field name="text">completed_dir MUST be an ABSOLUTE path (e.g., d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed)</field>
479
- <field name="text">Relative paths will cause Worker marker file writes to fail silently</field>
480
- </block>
481
-
482
- <!-- Batch Loop: Step 1→2→2.5→3 loop until all features processed -->
483
- <block type="loop" id="S2-L-Main" over="${batches}" as="batch_iteration" desc="Batch loop to process Features">
484
-
485
- <!-- Step 1: Get next batch -->
486
- <block type="task" id="S2-B1" action="run-script" status="pending" desc="Get next batch of pending Features">
487
- <field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" get-batch</field>
488
- <field name="arg">--syncStatePath</field>
489
- <field name="arg">${sync_state_bizs_dir}</field>
490
- <field name="arg">--batchSize</field>
491
- <field name="arg">${max_concurrent_workers}</field>
492
- <field name="output" var="batch_response"/>
493
- </block>
494
-
495
- <!-- Determine if complete -->
496
- <block type="gateway" id="S2-G0" mode="exclusive" desc="Determine batch response">
497
- <branch test="${batch_response.action} == 'done'" name="All Features processed">
498
- <block type="event" id="S2-E-Done" action="log" level="info" desc="All Features processed">
499
- <field name="message">All Features analyzed, exiting Stage 2 loop</field>
500
- </block>
501
- <field name="stage2_complete" value="true"/>
502
- </branch>
503
- <branch test="${batch_response.action} == 'process'" name="Process current batch">
504
-
505
- <!-- Step 2: Prepare analysis task specifications -->
506
- <block type="event" id="S2-E-Batch" action="log" level="info" desc="Report current batch">
507
- <field name="message">Processing batch: ${batch_response.batch.length} Features</field>
508
- </block>
509
-
510
- <!-- Step 2: Dispatch Worker for each Feature -->
511
- <!-- PARALLEL EXECUTION MANDATORY: All Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
512
- <block type="loop" id="S2-L2" over="${batch_response.batch}" as="feature" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch analysis Worker for each Feature">
513
-
514
- <!-- Route to different Skill based on platformType -->
515
- <block type="gateway" id="S2-G1" mode="exclusive" desc="Route analysis Skill based on platform type">
516
- <branch test="${feature.platformType} == 'web' or ${feature.platformType} == 'mobile' or ${feature.platformType} == 'desktop'" name="UI platform">
517
- <block type="task" id="S2-B2a" action="dispatch-to-worker" status="pending" desc="Dispatch UI Feature analysis Worker">
518
- <field name="worker">speccrew-knowledge-bizs-ui-analyze</field>
519
- <field name="instructions">
520
- Analyze the following source code file and generate detailed feature documentation.
521
-
522
- CRITICAL - Template Fill-in Workflow (MANDATORY):
523
- 1. First, copy the analysis template to documentPath (template structure = document skeleton)
524
- 2. Then fill each Section using search_replace to replace placeholders with actual data
525
- 3. NEVER use create_file to rewrite the entire document — this destroys template structure
526
- 4. NEVER delete or skip any template Section — if no data available, fill with "N/A"
527
- 5. NEVER create custom Section structures — use ONLY the template's predefined Sections
528
-
529
- Requirements:
530
- - Read source code file, understand related functionality interfaces
531
- - Generate detailed documentation to documentPath
532
- - Create two marker files to completed_dir
533
- - Use speccrew-knowledge-bizs-ui-analyze skill to complete this task
534
- </field>
535
- <field name="context">{
536
- "fileName": "${feature.fileName}",
537
- "sourcePath": "${feature.sourcePath}",
538
- "module": "${feature.module}",
539
- "documentPath": "${feature.documentPath}",
540
- "platformType": "${feature.platformType}",
541
- "platformSubtype": "${feature.platformSubtype}",
542
- "language": "${language}",
543
- "completed_dir": "${completed_dir}",
544
- "workspace_path": "${workspace_path}",
545
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
546
- "sourceFile": "${feature.sourceFile}"
547
- }</field>
548
- <field name="output" var="analyze_result_${feature.id}"/>
549
- </block>
550
- </branch>
551
- <branch default="true" name="Backend platform">
552
- <block type="task" id="S2-B2b" action="dispatch-to-worker" status="pending" desc="Dispatch API Feature analysis Worker">
553
- <field name="worker">speccrew-knowledge-bizs-api-analyze</field>
554
- <field name="instructions">
555
- Analyze the following source code file and generate detailed API feature documentation.
556
-
557
- CRITICAL - Template Fill-in Workflow (MANDATORY):
558
- 1. First, copy the analysis template to documentPath
559
- 2. Then fill each Section using search_replace
560
- 3. NEVER use create_file to rewrite the entire document
561
- 4. NEVER delete or skip any template Section
562
-
563
- Requirements:
564
- - Read API Controller source code
565
- - Extract API endpoints, request/response structures
566
- - Generate detailed documentation to documentPath
567
- - Create .done.json and .graph.json marker files
568
- </field>
569
- <field name="context">{
570
- "fileName": "${feature.fileName}",
571
- "sourcePath": "${feature.sourcePath}",
572
- "module": "${feature.module}",
573
- "documentPath": "${feature.documentPath}",
574
- "platformType": "${feature.platformType}",
575
- "platformSubtype": "${feature.platformSubtype}",
576
- "language": "${language}",
577
- "completed_dir": "${completed_dir}",
578
- "workspace_path": "${workspace_path}",
579
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
580
- "sourceFile": "${feature.sourceFile}"
581
- }</field>
582
- <field name="output" var="analyze_result_${feature.id}"/>
583
- </block>
584
- </branch>
585
- </block>
586
- </block>
587
-
588
- <!-- Step 2.5: Graph Worker Task Preparation -->
589
- <block type="event" id="S2-E-Graph" action="log" level="info" desc="Prepare Graph Worker tasks">
590
- <field name="message">Preparing Graph data generation for completed Features</field>
591
- </block>
592
-
593
- <!-- Step 2.5: Dispatch Graph Worker -->
594
- <!-- PARALLEL EXECUTION MANDATORY: All Graph Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
595
- <block type="loop" id="S2-L25" over="${batch_response.batch}" as="feature" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch Graph Worker for each Feature IN PARALLEL">
596
- <block type="gateway" id="S2-G2" mode="exclusive" desc="Route Graph Worker based on analysis type">
597
- <branch test="${feature.platformType} == 'backend'" name="API Graph">
598
- <block type="task" id="S2-B25a" action="dispatch-to-worker" status="pending" desc="Dispatch API Graph Worker">
599
- <field name="worker">speccrew-knowledge-bizs-api-graph</field>
600
- <field name="instructions">
601
- Generate graph data nodes and edges from the analyzed API feature document.
602
-
603
- Requirements:
604
- - Read the API analysis document at api_analysis_path
605
- - Extract entities (APIs, services, tables, DTOs)
606
- - Generate graph nodes and edges
607
- - Write graph JSON to output_dir
608
- - Create .graph-done.json completion marker at output_dir
609
- </field>
610
- <field name="context">{
611
- "api_analysis_path": "${feature.documentPath}",
612
- "platform_id": "${feature.platformId}",
613
- "output_dir": "${completed_dir}",
614
- "workspace_path": "${workspace_path}",
615
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
616
- "module": "${feature.module}",
617
- "fileName": "${feature.fileName}",
618
- "sourcePath": "${feature.sourcePath}",
619
- "sourceFile": "${feature.sourceFile}",
620
- "language": "${language}",
621
- "subpath": "${feature.subpath}"
622
- }</field>
623
- <field name="output" var="graph_result_${feature.id}"/>
624
- </block>
625
- </branch>
626
- <branch default="true" name="UI Graph">
627
- <block type="task" id="S2-B25b" action="dispatch-to-worker" status="pending" desc="Dispatch UI Graph Worker">
628
- <field name="worker">speccrew-knowledge-bizs-ui-graph</field>
629
- <field name="instructions">
630
- Generate graph data nodes and edges from the analyzed UI feature document.
631
-
632
- Requirements:
633
- - Read the UI analysis document at documentPath
634
- - Extract entities (pages, components, API calls, navigations)
635
- - Generate graph nodes and edges
636
- - Write graph JSON to completed_dir
637
- - Create .graph-done.json completion marker at completed_dir
638
- </field>
639
- <field name="context">{
640
- "feature": "${feature}",
641
- "fileName": "${feature.fileName}",
642
- "sourcePath": "${feature.sourcePath}",
643
- "documentPath": "${feature.documentPath}",
644
- "module": "${feature.module}",
645
- "platform_type": "${feature.platformType}",
646
- "platform_subtype": "${feature.platformSubtype}",
647
- "completed_dir": "${completed_dir}",
648
- "workspace_path": "${workspace_path}",
649
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
650
- "sourceFile": "${feature.sourceFile}",
651
- "language": "${language}"
652
- }</field>
653
- <field name="output" var="graph_result_${feature.id}"/>
654
- </block>
655
- </branch>
656
- </block>
657
- </block>
658
-
659
- <!-- Step 3: Process batch results -->
660
- <block type="task" id="S2-B3" action="run-script" status="pending" desc="Collect and process batch Worker results">
661
- <field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" process-results</field>
662
- <field name="arg">--syncStatePath</field>
663
- <field name="arg">${sync_state_bizs_dir}</field>
664
- <field name="arg">--graphRoot</field>
665
- <field name="arg">${graph_root}</field>
666
- <field name="arg">--completedDir</field>
667
- <field name="arg">${completed_dir}</field>
668
- <field name="output" var="batch_result"/>
669
- </block>
670
-
671
- <block type="event" id="S2-E-Result" action="log" level="info" desc="Report batch processing result">
672
- <field name="message">Batch processing complete: ${batch_result.success} succeeded, ${batch_result.failed} failed</field>
673
- </block>
674
- </branch>
675
- </block>
676
- </block>
677
-
678
- <block type="checkpoint" id="S2-CP1" name="feature_analysis_complete" desc="All Feature analysis complete">
679
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
680
- <field name="verify" value="${pending_features.length} == 0"/>
681
- </block>
682
-
683
- <block type="task" id="S2-B-End" action="run-script" status="pending" desc="Update Stage 2 progress to completed">
684
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage2 --status completed --output "${analyzed_count} features analyzed"</field>
685
- </block>
686
-
687
- <block type="event" id="S2-E-Final" action="log" level="info" desc="Stage 2 complete">
688
- <field name="message">Stage 2 Milestone: Feature analysis complete. ${analyzed_count} features analyzed, ${failed_count} failed. ${graph_count} graph data files generated.</field>
689
- </block>
690
- </sequence>
691
-
692
- <!-- ============================================================
693
- Stage 3: Module Summarize
694
- ============================================================ -->
695
- <sequence id="S3" name="Stage 3: Module Summarize" status="pending" desc="Generate module overview for each module">
696
-
697
- <block type="rule" id="S3-R1" level="mandatory" desc="Stage 3 mandatory rules">
698
- <field name="text">Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.</field>
699
- <field name="text">ALL module summary workers MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
700
- <field name="text">ALL Worker dispatch calls in S3-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
701
- <field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
702
- <field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
703
- <field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
704
- <field name="text">Workers MUST NOT create any temporary scripts or workaround files</field>
705
- </block>
706
-
707
- <!-- Step 1: Collect all module pairs across ALL platforms in ONE batch -->
708
- <block type="task" id="S3-B1" action="run-script" status="pending" desc="Collect all platform-module pairs for global parallel dispatch">
709
- <field name="command">node -e "const fs=require('fs'); const path=require('path'); const syncDir='${sync_state_bizs_dir}'; const files=fs.readdirSync(syncDir).filter(f=>f.startsWith('features-')&amp;&amp;f.endsWith('.json')); const pairs=[]; files.forEach(f=>{const platformId=f.replace('features-','').replace('.json',''); const data=JSON.parse(fs.readFileSync(path.join(syncDir,f),'utf8')); const modules=[...new Set(data.features.map(x=>x.module))]; modules.forEach(m=>pairs.push({platformId,moduleName:m})); }); console.log(JSON.stringify(pairs));"</field>
710
- <field name="output" var="all_module_pairs"/>
711
- </block>
712
-
713
- <!-- Step 2: Dispatch ALL module summary Workers in ONE parallel batch across ALL platforms -->
714
- <!-- PARALLEL EXECUTION MANDATORY: All Module Summary Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
715
- <block type="loop" id="S3-L1" over="${all_module_pairs}" as="pair" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch ALL module summary Workers in ONE parallel batch across ALL platforms">
716
- <block type="task" id="S3-B2" action="dispatch-to-worker" status="pending" desc="Dispatch module summary Worker">
717
- <field name="worker">speccrew-knowledge-module-summarize</field>
718
- <field name="instructions">
719
- Generate complete module overview documentation for the specified module.
720
-
721
- Requirements:
722
- - Read all Feature documents under the module
723
- - Aggregate and generate module-level overview
724
- - Output to {module_path}/{module_name}-overview.md
725
- </field>
726
- <field name="context">{
727
- "module_name": "${pair.moduleName}",
728
- "module_path": "${workspace_path}/knowledges/bizs/${pair.platformId}/${pair.moduleName}/",
729
- "workspace_path": "${workspace_path}",
730
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
731
- "language": "${language}"
732
- }</field>
733
- <field name="output" var="module_result_${pair.platformId}_${pair.moduleName}"/>
734
- </block>
735
- </block>
736
-
737
- <block type="checkpoint" id="S3-CP1" name="module_summarize_complete" desc="Module summary generation complete">
738
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
739
- <field name="passed" value="true"/>
740
- </block>
741
-
742
- <block type="task" id="S3-B5" action="run-script" status="pending" desc="Update Stage 3 progress to completed">
743
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage3 --status completed --output "${module_count} modules summarized"</field>
744
- </block>
745
-
746
- <block type="event" id="S3-E1" action="log" level="info" desc="Stage 3 complete">
747
- <field name="message">Stage 3 Milestone: Module summaries complete. ${module_count} modules summarized.</field>
748
- </block>
749
- </sequence>
750
-
751
- <!-- ============================================================
752
- Stage 3.5: UI Style Pattern Extract
753
- ============================================================ -->
754
- <sequence id="S3.5" name="Stage 3.5: UI Style Pattern Extract" status="pending" desc="Extract UI style patterns for frontend platforms">
755
-
756
- <block type="rule" id="S35-R1" level="mandatory" desc="Stage 3.5 mandatory rules">
757
- <field name="text">Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.</field>
758
- <field name="text">ALL UI style extraction workers MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
759
- <field name="text">ALL Worker dispatch calls in S35-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
760
- <field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
761
- <field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
762
- <field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
763
- <field name="text">This stage writes to techs knowledge base, not bizs knowledge base</field>
764
- </block>
765
-
766
- <!-- Dispatch UI Style Extract Worker for each frontend platform -->
767
- <!-- PARALLEL EXECUTION MANDATORY: All UI Style Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
768
- <block type="loop" id="S35-L1" over="${platforms}" as="platform" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Dispatch UI style extraction Workers for frontend platforms IN PARALLEL">
769
- <block type="gateway" id="S35-G1" mode="exclusive" desc="Execute for UI platforms only">
770
- <branch test="${platform.platformType} in ['web', 'mobile', 'desktop']" name="UI platform">
771
- <block type="task" id="S35-B1" action="dispatch-to-worker" status="pending" desc="Dispatch UI style extraction Worker">
772
- <field name="worker">speccrew-knowledge-bizs-ui-style-extract</field>
773
- <field name="instructions">
774
- Extract UI design patterns from frontend platform Feature documents.
775
-
776
- Requirements:
777
- - Analyze Feature documents for page types, component patterns, layout patterns
778
- - Generate pattern documents under page-types/, components/, layouts/ directories
779
- - Output to {workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/
780
- </field>
781
- <field name="context">{
782
- "platform_id": "${platform.platformId}",
783
- "platform_type": "${platform.platformType}",
784
- "feature_docs_path": "${workspace_path}/knowledges/bizs/${platform.platformId}",
785
- "features_manifest_path": "${sync_state_bizs_dir}/features-${platform.platformId}.json",
786
- "module_overviews_path": "${workspace_path}/knowledges/bizs/${platform.platformId}/",
787
- "output_path": "${workspace_path}/knowledges/techs/${platform.platformId}/ui-style-patterns/",
788
- "workspace_path": "${workspace_path}",
789
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
790
- "language": "${language}"
791
- }</field>
792
- <field name="output" var="ui_style_result_${platform.platformId}"/>
793
- </block>
794
- </branch>
795
- <branch default="true" name="Non-UI platform">
796
- <block type="event" id="S35-E1" action="log" level="info" desc="Backend platform skip style extraction">
797
- <field name="message">Backend platform ${platform.platformId} skipping UI style extraction</field>
798
- </block>
799
- </branch>
800
- </block>
801
- </block>
802
-
803
- <block type="event" id="S35-E2" action="log" level="info" desc="Stage 3.5 complete">
804
- <field name="message">Stage 3.5 Milestone: UI style patterns extracted. ${pattern_count} patterns extracted from ${frontend_platform_count} platforms.</field>
805
- </block>
806
-
807
- <block type="task" id="S35-B2" action="run-script" status="pending" desc="Update Stage 3.5 progress to completed">
808
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage3.5 --status completed --output "${pattern_count} patterns extracted"</field>
809
- </block>
810
- </sequence>
811
-
812
- <!-- ============================================================
813
- Stage 4: System Summarize
814
- ============================================================ -->
815
- <sequence id="S4" name="Stage 4: System Summarize" status="pending" desc="Generate system-level business knowledge summary">
816
-
817
- <block type="rule" id="S4-R1" level="mandatory" desc="Stage 4 prerequisites">
818
- <field name="text">ALL platform modules must be summarized before system summarize</field>
819
- <field name="text">MUST include cross-platform analysis if multiple platforms exist</field>
820
- <field name="text">Worker dispatch is handled by the calling Agent (Team Leader)</field>
821
- </block>
822
-
823
- <!-- Step 1: Read all platform structures -->
824
- <block type="task" id="S4-B1" action="run-script" status="pending" desc="Read all platform features JSON">
825
- <field name="command">node -e "const fs=require('fs'); const files=fs.readdirSync('${sync_state_bizs_dir}').filter(f=>f.startsWith('features-')); const platforms=files.map(f=>JSON.parse(fs.readFileSync('${sync_state_bizs_dir}/'+f))); console.log(JSON.stringify(platforms))"</field>
826
- <field name="output" var="all_platforms_data"/>
827
- </block>
828
-
829
- <!-- Step 2: Dispatch System Summarize Worker -->
830
- <block type="task" id="S4-B2" action="dispatch-to-worker" status="pending" desc="Dispatch system summary Worker">
831
- <field name="worker">speccrew-knowledge-system-summarize</field>
832
- <field name="instructions">
833
- Generate complete system-level business knowledge summary.
834
-
835
- Requirements:
836
- - Aggregate business knowledge from all platforms and modules
837
- - Generate platform index and module hierarchy
838
- - Include cross-platform analysis (if multiple platforms exist)
839
- - Output to {workspace_path}/knowledges/bizs/system-overview.md
840
- </field>
841
- <field name="context">{
842
- "modules_path": "${workspace_path}/knowledges/bizs/",
843
- "output_path": "${workspace_path}/knowledges/bizs/",
844
- "workspace_path": "${workspace_path}",
845
- "sync_state_bizs_dir": "${sync_state_bizs_dir}",
846
- "language": "${language}",
847
- "platforms": "${all_platforms_data}"
848
- }</field>
849
- <field name="output" var="system_summary"/>
850
- </block>
851
-
852
- <block type="checkpoint" id="S4-CP1" name="system_summarize_complete" desc="System summary generation complete">
853
- <field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
854
- <field name="passed" value="true"/>
855
- </block>
856
-
857
- <block type="task" id="S4-B3" action="run-script" status="pending" desc="Update Stage 4 progress to completed">
858
- <field name="command">node "${workspace_path}/scripts/update-progress.js" update-workflow --file "${sync_state_bizs_dir}/WORKFLOW-PROGRESS.json" --stage Stage4 --status completed --output "System overview generated"</field>
859
- </block>
860
-
861
- <block type="event" id="S4-E1" action="log" level="info" desc="Stage 4 complete">
862
- <field name="message">Stage 4 Milestone: System overview generated. All stages complete. Pipeline finished successfully.</field>
863
- </block>
864
- </sequence>
865
-
866
- <!-- ============================================================
867
- Error Handling
868
- ============================================================ -->
869
- <block type="error-handler" id="EH1" desc="Global error handling">
870
- <try>
871
- <!-- Main workflow defined in sequences above -->
872
- </try>
873
- <catch on="worker_failed">
874
- <block type="event" id="EH1-E1" action="log" level="warn" desc="Worker failed, log error and continue">
875
- <field name="message">Worker ${error.worker} failed: ${error.message}</field>
876
- </block>
877
- <block type="task" id="EH1-B1" action="run-script" desc="Update failed status">
878
- <field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js"</field>
879
- <field name="arg">--featureId</field>
880
- <field name="arg">${error.feature_id}</field>
881
- <field name="arg">--status</field>
882
- <field name="arg">failed</field>
883
- <field name="arg">--error</field>
884
- <field name="arg">${error.message}</field>
885
- </block>
886
- </catch>
887
- <catch on="script_error">
888
- <block type="event" id="EH1-E2" action="log" level="error" desc="Script execution failed">
889
- <field name="message">Script ${error.script} execution failed: ${error.message}</field>
890
- </block>
891
- </catch>
892
- <catch on="stage_abort">
893
- <block type="event" id="EH1-E3" action="log" level="error" desc="Stage aborted">
894
- <field name="message">Stage ${error.stage} execution aborted: ${error.message}</field>
895
- </block>
896
- <block type="event" id="EH1-E4" action="log" level="warn" desc="High failure rate">
897
- <field name="message">Failure rate exceeds 50%, terminating entire pipeline</field>
898
- </block>
899
- </catch>
900
- </block>
901
-
902
- <!-- ============================================================
903
- Output Results
904
- ============================================================ -->
905
- <block type="output" id="O1" desc="bizs knowledge base generation results">
906
- <field name="platforms_processed" from="${platforms}" type="array" desc="List of processed platforms"/>
907
- <field name="features_total" from="${all_features.length}" type="number" desc="Total Feature count"/>
908
- <field name="features_success" from="${success_count}" type="number" desc="Successfully analyzed Feature count"/>
909
- <field name="features_failed" from="${failed_count}" type="number" desc="Failed Feature count"/>
910
- <field name="modules_summarized" from="${module_count}" type="number" desc="Summarized module count"/>
911
- <field name="ui_patterns_extracted" from="${pattern_count}" type="number" desc="Extracted UI style pattern count"/>
912
- <field name="system_summary" from="${system_summary.path}" type="string" desc="System summary file path"/>
913
- <field name="graph_root" from="${graph_root}" type="string" desc="Graph data output directory"/>
914
- </block>
915
- </workflow>
916
-
917
- ---
918
-
919
- ## Appendix: Reference
920
-
921
- ### Skill Routing Table (Stage 2)
922
-
923
- > **Note**: Detailed routing logic is defined in XML Stage 2 gateway (S2-G1).
924
-
925
- | platformType | skill_name | Description |
926
- |--------------|------------|-------------|
927
- | `web` | `speccrew-knowledge-bizs-ui-analyze` | Web frontend (Vue/React/Angular) |
928
- | `mobile` | `speccrew-knowledge-bizs-ui-analyze` | Mobile apps (Flutter/React Native/UniApp) |
929
- | `desktop` | `speccrew-knowledge-bizs-ui-analyze` | Desktop apps (Electron/WPF) |
930
- | `backend` | `speccrew-knowledge-bizs-api-analyze` | Backend APIs (Java/Python/Node.js) |
931
-
932
- ---
933
-
934
- ### Platform Types
935
-
936
- | Platform Type | Platform Subtype | Description |
937
- |---------------|------------------|-------------|
938
- | `web` | `vue`, `react`, `angular` | Web frontend applications |
939
- | `mobile` | `uniapp`, `flutter`, `react-native` | Mobile applications |
940
- | `desktop` | `electron`, `wpf` | Desktop applications |
941
- | `backend` | `spring`, `nodejs`, `python` | Backend services |
942
-
943
- ---
944
-
945
- ### Worker Completion Marker Format
946
-
947
- #### Marker File Naming Convention
948
-
949
- **Pattern**: `{module}-{subpath}-{fileName}.{type}.json`
950
-
951
- | Component | Description | Example |
952
- |-----------|-------------|---------|
953
- | `module` | Business module name | `chat`, `user`, `order` |
954
- | `subpath` | Sub-path within module, `/` replaced with `-`. Empty if file is directly under module | `admin`, `api-v2` |
955
- | `fileName` | Source file name WITHOUT extension | `UserController`, `ChatService` |
956
- | `type` | Marker type: `done`, `error`, or `skip` | `done` |
957
-
958
- **Examples**:
959
-
960
- | Source File Path | Marker File Name |
961
- |------------------|------------------|
962
- | `chat/ChatController.java` | `chat-ChatController.done.json` |
963
- | `user/admin/UserController.java` | `user-admin-UserController.done.json` |
964
- | `order/api/v2/OrderService.java` | `order-api-v2-OrderService.done.json` |
965
-
966
- #### .done.json Required Fields
967
-
968
- ```json
969
- {
970
- "fileName": "<class name without extension>",
971
- "sourcePath": "<relative source file path>",
972
- "sourceFile": "<features JSON filename, e.g. features-backend-ai.json>",
973
- "module": "<business module name>",
974
- "status": "success|partial|failed",
975
- "analysisNotes": "<brief notes>"
976
- }
977
- ```
978
-
979
- > WRONG: Writing plain text like "COMPLETED" or "Analysis done"
980
- > CORRECT: Writing valid JSON with all required fields
981
-
982
- ---
983
-
984
- ### Batch Processing Details
985
-
986
- #### get-batch Script Output Format
987
-
988
- ```json
989
- {
990
- "action": "process|done",
991
- "batch": [
992
- {
993
- "id": "feature-001",
994
- "fileName": "UserController",
995
- "sourcePath": "controller/admin/user/UserController.java",
996
- "module": "user",
997
- "documentPath": "speccrew-workspace/knowledges/bizs/backend-spring/user/UserController.md",
998
- "platformType": "backend",
999
- "platformSubtype": "spring",
1000
- "platformId": "backend-spring",
1001
- "sourceFile": "features-backend-spring.json"
1002
- }
1003
- ]
1004
- }
1005
- ```
1006
-
1007
- #### process-results Script Behavior
1008
-
1009
- - Scans `.done.json` files → updates feature status to `completed` in features-*.json
1010
- - Scans `.graph-done.json` files → confirms graph data generation complete
1011
- - Scans `.graph.json` files → writes graph data (nodes + edges) grouped by module
1012
- - Cleans up all marker files
1013
-
1014
- ---
1015
-
1016
- ### Stateless Design
1017
-
1018
- Dispatch adopts a fully stateless file-driven design. Re-execute loop to recover: `get-batch` auto-recovers from file state; `process-results` handles uncleaned markers. The entire flow is safely re-entrant.
1019
-
1020
- ---
1021
-
1022
- ### Large-Scale Scenario Guidance
1023
-
1024
- For modules with >20 features: dispatch multiple Worker Agents in parallel (each handles a subset). Use `get-next-batch` for resume support across sessions. Run `process-batch-results --validateDocs` after completion to verify.
1025
-
1026
-
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.