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