speccrew 0.6.69 → 0.7.1
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-task-worker.md +1 -1
- package/.speccrew/agents/speccrew-team-leader.md +336 -189
- package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
- package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
- package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
- package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
- package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
- package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
- package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
- package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
- package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
- package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
- package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
- package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
- package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
- package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
- package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
- package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
- package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
- package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
- package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
- package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
- package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
- package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
- package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
- package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
- package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
- package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
- package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
- package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
- package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
- package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
- package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
- package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
- package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
- package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
- package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
- package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
- package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
- package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
- package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
- package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
- package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
- package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
- package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
- package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
- package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
- package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
- package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
- package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
- package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
- package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
- package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
- package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
- package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
- package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
- package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
- package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
- package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
- package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
- package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
- package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
- package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
- package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
- package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
- package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
- package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
- package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
- package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
- package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
- package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
- package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
- package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
- package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
- package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
- package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
- package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
- package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
- package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
- package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
- package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
- package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
- package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
- package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
- package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
- package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
- package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
- package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
- package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
- package/bin/cli.js +8 -1
- package/lib/commands/init.js +11 -3
- package/lib/commands/update.js +11 -3
- package/lib/commands/validate.js +565 -0
- package/lib/utils.js +43 -0
- package/package.json +1 -1
- package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
- package/workspace-template/scripts/validate-agentflow.js +637 -0
- package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
- package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1087
- package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
- package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
|
@@ -1,35 +1,92 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: speccrew-knowledge-bizs-dispatch
|
|
3
|
-
description: Dispatch bizs knowledge base generation tasks with 5-stage pipeline. Handles feature inventory, feature analysis with skill routing, graph data writing, module summarization, UI style pattern extraction, and system summary.
|
|
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
4
|
tools: Read, Write, Task, Bash
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
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.
|
|
8
48
|
|
|
9
|
-
|
|
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.
|
|
10
62
|
|
|
11
63
|
## Quick Reference — Execution Flow
|
|
12
64
|
|
|
13
65
|
```
|
|
14
66
|
Stage 0: Platform Detection
|
|
15
|
-
└─
|
|
67
|
+
└─ Detect platforms → Confirm platform list
|
|
16
68
|
↓
|
|
17
69
|
Stage 1: Feature Inventory Init
|
|
18
|
-
└─ 1a:
|
|
19
|
-
└─ 1b:
|
|
20
|
-
└─ 1c:
|
|
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
|
|
21
81
|
↓
|
|
22
|
-
Stage
|
|
23
|
-
└─
|
|
24
|
-
└─ After analyze completes → prepare corresponding graph worker task specification
|
|
25
|
-
└─ Monitor completion markers
|
|
82
|
+
Stage 3: Module Summarize
|
|
83
|
+
└─ Generate module overview for each module
|
|
26
84
|
↓
|
|
27
|
-
Stage 3:
|
|
28
|
-
└─
|
|
29
|
-
└─ 3.5: Prepare UI style extraction task specifications
|
|
85
|
+
Stage 3.5: UI Style Pattern Extract
|
|
86
|
+
└─ Extract UI style patterns for frontend platforms
|
|
30
87
|
↓
|
|
31
|
-
Stage 4: System Summary
|
|
32
|
-
└─
|
|
88
|
+
Stage 4: System Summary
|
|
89
|
+
└─ Generate system-level business knowledge summary
|
|
33
90
|
```
|
|
34
91
|
|
|
35
92
|
## Language Adaptation
|
|
@@ -50,304 +107,827 @@ Stage 4: System Summary (Task Preparation)
|
|
|
50
107
|
- "Generate knowledge base from src/views directory"
|
|
51
108
|
- "Analyze this subdirectory for knowledge base"
|
|
52
109
|
|
|
53
|
-
## Input
|
|
54
|
-
|
|
55
|
-
| Variable | Description | Default |
|
|
56
|
-
|----------|-------------|---------|
|
|
57
|
-
| `source_path` | Source code path (can be a subdirectory; auto-detects platform root by traversing upward) | project root |
|
|
58
|
-
| `language` | User's language code (e.g., "zh", "en") | **REQUIRED** |
|
|
59
|
-
| `sync_mode` | `"full"` or `"incremental"` | `"full"` |
|
|
60
|
-
| `base_commit` | (incremental only) Git base commit hash | — |
|
|
61
|
-
| `head_commit` | (incremental only) Git HEAD commit hash | `HEAD` |
|
|
62
|
-
| `changed_files` | (incremental only) Pre-computed changed file list | — |
|
|
63
|
-
| `max_concurrent_workers` | Maximum parallel Worker Agents | `5` |
|
|
64
|
-
| `workspace_path` | **(required)** Absolute path to speccrew-workspace directory | — |
|
|
65
|
-
| `sync_state_bizs_dir` | **(required)** Absolute path to `knowledges/base/sync-state/knowledge-bizs/` | — |
|
|
66
|
-
| `ide_skills_dir` | **(required)** Absolute path to IDE skills directory (e.g., `.qoder/skills`, `.cursor/skills`) | — |
|
|
67
|
-
| `configs_dir` | **(required)** Absolute path to `docs/configs/` directory | — |
|
|
68
|
-
| `graph_root` | Graph data output root path (absolute path preferred) | `{workspace_path}/knowledges/bizs/graph` |
|
|
69
|
-
| `completed_dir` | Marker file output directory for Worker results (absolute path required) | `{sync_state_bizs_dir}/completed` |
|
|
70
|
-
|
|
71
|
-
> **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.
|
|
72
|
-
|
|
73
|
-
> **Note**: Ensure `graph_root` directory exists before first execution. If it does not exist, create it: `mkdir -p "{graph_root}"` (or equivalent on Windows: `New-Item -ItemType Directory -Path "{graph_root}" -Force`).
|
|
74
|
-
|
|
75
|
-
## Output
|
|
76
|
-
|
|
77
|
-
- Entry directories: `{sync_state_bizs_dir}/entry-dirs-{platform}.json`
|
|
78
|
-
- Feature inventory: `{sync_state_bizs_dir}/features-{platform}.json`
|
|
79
|
-
- Feature docs: `{workspace_path}/knowledges/bizs/{platform}/{module}/features/*.md`
|
|
80
|
-
- Module overviews: `{workspace_path}/knowledges/bizs/{platform}/{module}/*-overview.md`
|
|
81
|
-
- UI style patterns: `{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/` (page-types/, components/, layouts/)
|
|
82
|
-
- System overview: `{workspace_path}/knowledges/bizs/system-overview.md`
|
|
83
|
-
- Graph data: `{workspace_path}/knowledges/bizs/graph/`
|
|
84
|
-
|
|
85
|
-
## Workflow Overview
|
|
86
|
-
|
|
87
|
-
**Execution Pseudocode:**
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
INPUT: source_path, language, sync_mode, max_concurrent_workers
|
|
91
|
-
|
|
92
|
-
STAGE 0: Platform Detection
|
|
93
|
-
FOR each detected platform:
|
|
94
|
-
Identify platform_type, platform_subtype, tech_stack
|
|
95
|
-
Present platform list for user confirmation
|
|
96
|
-
|
|
97
|
-
STAGE 1: Feature Inventory
|
|
98
|
-
Stage 1a: Entry Directory Recognition → Generate entry-dirs-{platform}.json
|
|
99
|
-
Stage 1b: Feature Inventory → Generate features-{platform}.json
|
|
100
|
-
Stage 1c (incremental only): Merge features with existing state
|
|
101
|
-
|
|
102
|
-
STAGE 2: Feature Analysis (REPEAT until all features processed)
|
|
103
|
-
Step 0: Ensure completed_dir exists
|
|
104
|
-
Step 1: Get next batch of pending features
|
|
105
|
-
Step 2: Prepare analysis task specifications (API or UI analysis)
|
|
106
|
-
Step 3: Process batch results, update features.json, write graph
|
|
107
|
-
|
|
108
|
-
STAGE 3: Module Summarize (task preparation per module)
|
|
109
|
-
FOR each module:
|
|
110
|
-
Prepare module-summarize task specification
|
|
111
|
-
|
|
112
|
-
STAGE 3.5: UI Style Pattern Extract (task preparation per frontend platform)
|
|
113
|
-
FOR each frontend platform:
|
|
114
|
-
Prepare ui-style-extract task specification
|
|
115
|
-
|
|
116
|
-
STAGE 4: System Summary (task preparation)
|
|
117
|
-
Prepare system-summarize task specification
|
|
118
|
-
|
|
119
|
-
OUTPUT: system-overview.md, graph data, module overviews
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**Stage Sequence:**
|
|
123
|
-
|
|
124
|
-
```mermaid
|
|
125
|
-
flowchart TB
|
|
126
|
-
S0[Stage 0: Platform Detection] --> S1a[Stage 1a: Entry Directory Recognition]
|
|
127
|
-
S1a --> S1b[Stage 1b: Feature Inventory]
|
|
128
|
-
S1b --> S1c[Stage 1c: Feature Merge]
|
|
129
|
-
S1c --> S2[Stage 2: Feature Analysis + Graph Write]
|
|
130
|
-
S2 --> S3[Stage 3: Module Summarize]
|
|
131
|
-
S3 --> S3_5[Stage 3.5: UI Style Pattern Extract]
|
|
132
|
-
S3_5 --> S4[Stage 4: System Summary]
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Stage 0: Platform Detection
|
|
138
|
-
|
|
139
|
-
**Objective**: Automatically discover ALL platforms in the project. Do NOT hardcode platform lists.
|
|
140
|
-
|
|
141
|
-
**Detection steps**:
|
|
142
|
-
|
|
143
|
-
1. **Scan for backend modules**:
|
|
144
|
-
```
|
|
145
|
-
# Look for all backend module directories
|
|
146
|
-
Get-ChildItem -Path "{project_root}" -Filter "yudao-module-*" -Directory
|
|
147
|
-
# Or for other project structures:
|
|
148
|
-
Get-ChildItem -Path "{project_root}" -Directory | Where-Object { $_.Name -match "^(module-|service-|api-)" }
|
|
149
|
-
```
|
|
150
|
-
Each discovered module becomes a `backend-{module_name}` platform (e.g., `yudao-module-system` → `backend-system`).
|
|
151
|
-
|
|
152
|
-
2. **Scan for frontend projects**:
|
|
153
|
-
```
|
|
154
|
-
# Look for UI/frontend directories
|
|
155
|
-
Get-ChildItem -Path "{project_root}" -Directory | Where-Object { $_.Name -match "ui|frontend|web|app" }
|
|
156
|
-
# Then check each for actual source code (package.json, src/ directory)
|
|
157
|
-
```
|
|
158
|
-
Classify by tech stack: Vue → `web-vue`, UniApp → `mobile-uniapp`, React → `web-react`, etc.
|
|
159
|
-
|
|
160
|
-
3. **Validate each platform**:
|
|
161
|
-
- Has actual source code files (not empty placeholder directories)
|
|
162
|
-
- Has a recognizable project structure (package.json for frontend, pom.xml/build.gradle for backend)
|
|
163
|
-
|
|
164
|
-
4. **Present platform list to user for confirmation** before proceeding to Stage 1a.
|
|
165
|
-
|
|
166
|
-
**Output**: A confirmed list of platforms with:
|
|
167
|
-
|
|
168
|
-
| Platform ID | Source Path | Platform Type | Tech Stack |
|
|
169
|
-
|---|---|---|---|
|
|
170
|
-
| `web-vue` | `yudao-ui/yudao-ui-admin-vue3` | web | vue, vite, element-plus |
|
|
171
|
-
| `backend-system` | `yudao-module-system/src/main/java/.../system` | backend | spring-boot, mybatis-plus |
|
|
172
|
-
| ... | ... | ... | ... |
|
|
173
|
-
|
|
174
|
-
> **CRITICAL**: NEVER hardcode a fixed number of platforms. Always scan the project directory to discover ALL modules. Missing a platform means incomplete knowledge base generation.
|
|
175
|
-
|
|
176
|
-
> ✅ **Stage 0 Milestone**: Platform detection complete. Platforms: {platform_list}. → Proceed to Stage 1.
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## Stage 1a: Entry Directory Recognition
|
|
181
|
-
|
|
182
|
-
**Goal**: For each detected platform, analyze the source directory tree and identify all entry directories (API controllers for backend, views/pages for frontend), then classify them into business modules.
|
|
183
|
-
|
|
184
|
-
> **IMPORTANT**: This stage is executed **directly by the dispatch agent (Leader)**, NOT delegated to a Worker Agent.
|
|
185
|
-
|
|
186
|
-
**Prerequisite**: Stage 0 completed. Platform list confirmed with `platformId`, `sourcePath`, `platformType`, `platformSubtype`, and `techIdentifier` for each platform.
|
|
187
|
-
|
|
188
|
-
**Execution**: Follow the `speccrew-knowledge-bizs-identify-entries` skill workflow:
|
|
189
|
-
|
|
190
|
-
1. For each platform, read the source directory tree (3 levels deep)
|
|
191
|
-
2. Identify entry directories based on platform type:
|
|
192
|
-
- **Backend (Spring/Java/Kotlin)**: Find directories containing `*Controller.java` or `*Controller.kt` files. Module name = business package name of the entry directory
|
|
193
|
-
- **Frontend (Vue/React)**: Find `views/` or `pages/` directories. First-level subdirectories = business modules
|
|
194
|
-
- **Mobile (UniApp)**: Find first-level subdirectories under `pages/` + top-level `pages-*` directories
|
|
195
|
-
- **Mobile (Mini Program)**: Find first-level subdirectories under `pages/`
|
|
196
|
-
3. Apply exclusion rules from `tech-stack-mappings.json` (technical dirs, build dirs, test dirs, config dirs)
|
|
197
|
-
4. Generate `entry-dirs-{platform_id}.json` files
|
|
198
|
-
5. Validate: modules array non-empty, module names are business-meaningful
|
|
199
|
-
|
|
200
|
-
> For detailed entry identification logic, exclusion rules, JSON format, and validation rules, refer to the `speccrew-knowledge-bizs-identify-entries` skill documentation.
|
|
201
|
-
|
|
202
|
-
**Output**: `{sync_state_bizs_dir}/entry-dirs-{platform_id}.json`
|
|
203
|
-
|
|
204
|
-
**JSON Format**:
|
|
205
|
-
```json
|
|
206
|
-
{
|
|
207
|
-
"platformId": "backend-ai",
|
|
208
|
-
"platformName": "AI Module Backend",
|
|
209
|
-
"platformType": "backend",
|
|
210
|
-
"platformSubtype": "ai",
|
|
211
|
-
"sourcePath": "yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai",
|
|
212
|
-
"techStack": ["spring-boot", "mybatis-plus"],
|
|
213
|
-
"modules": [
|
|
214
|
-
{ "name": "chat", "entryDirs": ["controller/admin/chat"] },
|
|
215
|
-
{ "name": "image", "entryDirs": ["controller/admin/image"] }
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
**Error handling**: If entry directory recognition fails for a platform, STOP and report the error with platform details. Do NOT proceed to Stage 1b for that platform.
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## Stage 1b: Generate Feature Inventory (Direct Execution)
|
|
225
|
-
|
|
226
|
-
**Goal**: Based on the entry-dirs JSON generated in Stage 1a, generate per-platform feature inventory files.
|
|
227
|
-
|
|
228
|
-
> **IMPORTANT**: This stage is executed **directly by the dispatch agent (Leader)**, NOT delegated to a Worker Agent.
|
|
229
|
-
> Worker Agents do not have `run_in_terminal` capability, which is required for script execution.
|
|
230
|
-
|
|
231
|
-
**Prerequisite**: Stage 1a completed. `entry-dirs-{platform_id}.json` files exist in `{sync_state_bizs_dir}/`.
|
|
232
|
-
|
|
233
|
-
**Action** (dispatch executes directly via `run_in_terminal`):
|
|
234
|
-
|
|
235
|
-
1. **Read platform mapping**: Read `{configs_dir}/platform-mapping.json` and `{configs_dir}/tech-stack-mappings.json` for platform configuration
|
|
236
|
-
2. **Execute inventory script** for each platform:
|
|
237
|
-
```
|
|
238
|
-
node "{ide_skills_dir}/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js" --entryDirsFile "{sync_state_bizs_dir}/entry-dirs-{platform_id}.json"
|
|
239
|
-
```
|
|
240
|
-
- Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js`
|
|
241
|
-
- The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
|
|
242
|
-
|
|
243
|
-
**Script Parameters**:
|
|
244
|
-
- `--entryDirsFile`: Path to the `entry-dirs-{platform_id}.json` file generated in Stage 1a (required)
|
|
245
|
-
|
|
246
|
-
**Note**: `platformId` and `sourcePath` are read from the entry-dirs JSON file. Platform mapping and output directory are automatically derived by the script.
|
|
247
|
-
|
|
248
|
-
**Optional Parameters**:
|
|
249
|
-
- `--techIdentifier`: Technology identifier for tech-stack lookup (auto-detected from platform mapping if omitted)
|
|
250
|
-
- `--fileExtensions`: Comma-separated list of file extensions to include (e.g., `.java,.kt`)
|
|
251
|
-
- `--excludeDirs`: Additional directories to exclude
|
|
252
|
-
|
|
253
|
-
**Output**:
|
|
254
|
-
- `{sync_state_bizs_dir}/features-{platform_id}.json` — Per-platform feature inventory files
|
|
255
|
-
- Each file contains: platform metadata, modules list, and flat features array with `analyzed` status
|
|
256
|
-
|
|
257
|
-
**Features JSON Structure**:
|
|
258
|
-
```json
|
|
259
|
-
{
|
|
260
|
-
"platformId": "backend-ai",
|
|
261
|
-
"platformName": "AI Module",
|
|
262
|
-
"platformType": "backend",
|
|
263
|
-
"platformSubtype": "ai",
|
|
264
|
-
"techIdentifier": "spring",
|
|
265
|
-
"sourcePath": "yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai",
|
|
266
|
-
"modules": [
|
|
267
|
-
{ "name": "chat", "featureCount": 12 },
|
|
268
|
-
{ "name": "image", "featureCount": 8 },
|
|
269
|
-
{ "name": "knowledge", "featureCount": 15 }
|
|
270
|
-
],
|
|
271
|
-
"features": [
|
|
272
|
-
{
|
|
273
|
-
"fileName": "ChatConversationController",
|
|
274
|
-
"sourcePath": "controller/admin/chat/ChatConversationController.java",
|
|
275
|
-
"module": "chat",
|
|
276
|
-
"documentPath": "speccrew-workspace/knowledges/bizs/backend-ai/chat/ChatConversationController.md",
|
|
277
|
-
"platformType": "backend",
|
|
278
|
-
"platformSubtype": "ai",
|
|
279
|
-
"analyzed": false
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
**Error handling**: If the script exits with non-zero code, STOP and report the error. Do NOT create workaround scripts.
|
|
286
|
-
|
|
287
110
|
---
|
|
288
111
|
|
|
289
|
-
##
|
|
290
|
-
|
|
291
|
-
**Goal**: If incremental inventory files (`features-*.new.json`) are detected, merge them with existing `features-*.json` files. Identifies added/removed/changed features, resets changed features for re-analysis, and cleans up artifacts for removed features.
|
|
292
|
-
|
|
293
|
-
> **IMPORTANT**: This stage is executed **directly by the dispatch agent (Leader)** via `run_in_terminal`. NOT delegated to a Worker Agent.
|
|
294
|
-
|
|
295
|
-
**Prerequisite**: Stage 1b completed.
|
|
296
|
-
|
|
297
|
-
**Skip condition**: If no `features-*.new.json` files exist in `{sync_state_bizs_dir}/`, skip this Stage entirely and proceed to Stage 2.
|
|
112
|
+
## AgentFlow Definition
|
|
298
113
|
|
|
299
|
-
|
|
114
|
+
<!-- @agentflow: workflow.agentflow.xml -->
|
|
300
115
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
>
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
>
|
|
338
|
-
>
|
|
339
|
-
>
|
|
340
|
-
>
|
|
116
|
+
> **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
|
|
117
|
+
>
|
|
118
|
+
> 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.
|
|
119
|
+
|
|
120
|
+
<!-- ============================================================
|
|
121
|
+
Input Parameters Definition
|
|
122
|
+
============================================================ -->
|
|
123
|
+
<block type="input" id="I1" desc="bizs knowledge base generation input parameters">
|
|
124
|
+
<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)"/>
|
|
125
|
+
<field name="language" required="true" type="string" desc="User's language code (e.g., zh, en)"/>
|
|
126
|
+
<field name="sync_mode" required="false" type="string" default="full" desc="full=complete | incremental=incremental"/>
|
|
127
|
+
<field name="base_commit" required="false" type="string" desc="(incremental only) Git base commit hash"/>
|
|
128
|
+
<field name="head_commit" required="false" type="string" default="HEAD" desc="(incremental only) Git HEAD commit hash"/>
|
|
129
|
+
<field name="changed_files" required="false" type="array" desc="(incremental only) Pre-computed changed file list"/>
|
|
130
|
+
<field name="max_concurrent_workers" required="false" type="number" default="5" desc="Maximum parallel Worker count"/>
|
|
131
|
+
<field name="workspace_path" required="true" type="string" desc="Absolute path to speccrew-workspace directory"/>
|
|
132
|
+
<field name="sync_state_bizs_dir" required="true" type="string" desc="Absolute path to knowledges/base/sync-state/knowledge-bizs/"/>
|
|
133
|
+
<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"/>
|
|
134
|
+
<field name="configs_dir" required="true" type="string" desc="Absolute path to docs/configs/ directory"/>
|
|
135
|
+
<field name="graph_root" required="false" type="string" desc="Graph data output root path (absolute path preferred)" default="${workspace_path}/knowledges/bizs/graph"/>
|
|
136
|
+
<field name="completed_dir" required="true" type="string" desc="Marker file output directory for Worker results (absolute path required)"/>
|
|
137
|
+
</block>
|
|
138
|
+
|
|
139
|
+
<!-- ============================================================
|
|
140
|
+
Global Invocation Rules
|
|
141
|
+
============================================================ -->
|
|
142
|
+
<block type="rule" id="GLOBAL-R-INVOCATION" level="forbidden" desc="Invocation constraints — NEVER violate">
|
|
143
|
+
<field name="text">This skill is an ORCHESTRATION PLAYBOOK — it MUST be loaded directly by Team Leader via Skill tool</field>
|
|
144
|
+
<field name="text">Worker Agents MUST NOT execute this dispatch skill — if loaded by a Worker, report error and abort</field>
|
|
145
|
+
<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>
|
|
146
|
+
</block>
|
|
147
|
+
|
|
148
|
+
<!-- ============================================================
|
|
149
|
+
Global Continuous Execution Rules
|
|
150
|
+
============================================================ -->
|
|
151
|
+
<block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
|
|
152
|
+
<field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" between stages</field>
|
|
153
|
+
<field name="text">DO NOT offer options like "Full execution / Sample execution / Pause" — always execute ALL stages to completion</field>
|
|
154
|
+
<field name="text">DO NOT suggest "Let me split this into batches" or "Let's do this in parts" — process ALL features sequentially</field>
|
|
155
|
+
<field name="text">DO NOT pause to list what you plan to do next — just do it</field>
|
|
156
|
+
<field name="text">DO NOT ask for confirmation before generating output files</field>
|
|
157
|
+
<field name="text">DO NOT warn about "large number of files" or "this may take a while" — proceed with generation</field>
|
|
158
|
+
<field name="text">ONLY pause at explicit <event action="confirm"> blocks defined in the workflow</field>
|
|
159
|
+
<field name="text">DO NOT offer "continue/pause/partial" options — EVER</field>
|
|
160
|
+
<field name="text">DO NOT estimate workload and suggest breaking it into phases — execute ALL phases in sequence</field>
|
|
161
|
+
<field name="text">When many features need analysis, dispatch ALL of them — do NOT skip or defer any</field>
|
|
162
|
+
<field name="text">Context window management: if approaching limit, save progress to checkpoint file and resume — do NOT ask user for guidance</field>
|
|
163
|
+
</block>
|
|
164
|
+
|
|
165
|
+
<!-- ============================================================
|
|
166
|
+
Global Technology Stack Constraints
|
|
167
|
+
============================================================ -->
|
|
168
|
+
<block type="rule" id="GLOBAL-R-TECHSTACK" level="forbidden" desc="Technology stack constraints — NEVER violate">
|
|
169
|
+
<field name="text">FORBIDDEN: Python, Ruby, Perl, compiled binaries, or any runtime requiring separate installation</field>
|
|
170
|
+
<field name="text">PERMITTED scripting: PowerShell (Windows) and Bash (Linux/Mac) ONLY</field>
|
|
171
|
+
<field name="text">PERMITTED Node.js: ONLY for existing project scripts (e.g., node scripts/update-progress.js)</field>
|
|
172
|
+
<field name="text">For JSON validation use: node -e "JSON.parse(require('fs').readFileSync('file.json','utf8'))"</field>
|
|
173
|
+
<field name="text">For JSON creation use: node -e with inline script, or PowerShell ConvertTo-Json</field>
|
|
174
|
+
<field name="text">DO NOT create temporary .py, .rb, .pl, .bat files — use inline commands via run_in_terminal</field>
|
|
175
|
+
</block>
|
|
176
|
+
|
|
177
|
+
<!-- ============================================================
|
|
178
|
+
Stage 0: Platform Detection
|
|
179
|
+
============================================================ -->
|
|
180
|
+
<sequence id="S0" name="Stage 0: Platform Detection" status="pending" desc="Automatically discover ALL platforms in the project">
|
|
181
|
+
|
|
182
|
+
<block type="rule" id="S0-R1" level="mandatory" desc="Stage 0 mandatory rules">
|
|
183
|
+
<field name="text">MUST scan project directory to discover ALL platforms — NEVER hardcode a fixed number of platforms</field>
|
|
184
|
+
<field name="text">Missing a platform means incomplete knowledge base generation</field>
|
|
185
|
+
</block>
|
|
186
|
+
|
|
187
|
+
<!-- Step 1: Scan backend modules -->
|
|
188
|
+
<block type="task" id="S0-B1" action="run-script" status="pending" desc="Scan backend module directories">
|
|
189
|
+
<field name="command">Get-ChildItem -Path "${source_path}" -Filter "yudao-module-*" -Directory</field>
|
|
190
|
+
<field name="alt_command">Get-ChildItem -Path "${source_path}" -Directory | Where-Object { $_.Name -match "^(module-|service-|api-)" }</field>
|
|
191
|
+
<field name="output" var="backend_modules"/>
|
|
192
|
+
</block>
|
|
193
|
+
|
|
194
|
+
<!-- Step 2: Scan frontend projects -->
|
|
195
|
+
<block type="task" id="S0-B2" action="run-script" status="pending" desc="Scan frontend/UI project directories">
|
|
196
|
+
<field name="command">Get-ChildItem -Path "${source_path}" -Directory | Where-Object { $_.Name -match "ui|frontend|web|app" }</field>
|
|
197
|
+
<field name="output" var="frontend_dirs"/>
|
|
198
|
+
</block>
|
|
199
|
+
|
|
200
|
+
<!-- Step 3: Validate each platform -->
|
|
201
|
+
<block type="loop" id="S0-L1" over="${backend_modules}" as="module" desc="Validate backend modules">
|
|
202
|
+
<block type="gateway" id="S0-G1" mode="guard" test="${module.hasSourceCode} == true" fail-action="skip" desc="Verify module has actual source code">
|
|
203
|
+
<field name="message">Skipping empty directory: ${module.name}</field>
|
|
204
|
+
</block>
|
|
205
|
+
<block type="event" id="S0-E1" action="log" level="info" desc="Log backend module">
|
|
206
|
+
<field name="message">Discovered backend module: ${module.name} → Platform type: backend-${module.business_name}</field>
|
|
207
|
+
</block>
|
|
208
|
+
</block>
|
|
209
|
+
|
|
210
|
+
<block type="loop" id="S0-L2" over="${frontend_dirs}" as="frontend" desc="Validate frontend projects">
|
|
211
|
+
<block type="task" id="S0-B3" action="run-script" status="pending" desc="Check frontend project structure">
|
|
212
|
+
<field name="command">Test-Path "${frontend.path}/package.json"</field>
|
|
213
|
+
<field name="output" var="has_package_json"/>
|
|
214
|
+
</block>
|
|
215
|
+
<block type="gateway" id="S0-G2" mode="guard" test="${has_package_json} == true" fail-action="skip" desc="Verify frontend project validity">
|
|
216
|
+
<field name="message">Skipping non-frontend directory: ${frontend.name}</field>
|
|
217
|
+
</block>
|
|
218
|
+
<block type="event" id="S0-E2" action="log" level="info" desc="Log frontend platform">
|
|
219
|
+
<field name="message">Discovered frontend platform: ${frontend.name} → Tech stack: Vue/React/UniApp</field>
|
|
220
|
+
</block>
|
|
221
|
+
</block>
|
|
222
|
+
|
|
223
|
+
<!-- Step 4: Generate platform list JSON -->
|
|
224
|
+
<block type="task" id="S0-B4" action="run-script" status="pending" desc="Generate platforms.json from discovered modules and frontends">
|
|
225
|
+
<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>
|
|
226
|
+
<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>
|
|
227
|
+
<field name="arg">${platforms_json_string}</field>
|
|
228
|
+
<field name="arg">${sync_state_bizs_dir}</field>
|
|
229
|
+
<field name="output" var="platforms" from="${sync_state_bizs_dir}/platforms.json"/>
|
|
230
|
+
</block>
|
|
231
|
+
|
|
232
|
+
<!-- Step 5: Gate - Confirm platforms detected -->
|
|
233
|
+
<block type="gateway" id="S0-G3" mode="guard" test="${platforms.length} > 0" fail-action="stop" desc="Confirm at least one platform detected">
|
|
234
|
+
<field name="message">No platforms detected, please check source_path and platform-mapping.json</field>
|
|
235
|
+
</block>
|
|
236
|
+
|
|
237
|
+
<!-- Step 6: User confirmation -->
|
|
238
|
+
<block type="event" id="S0-E3" action="confirm" title="Confirm Platform List" type="yesno" desc="Wait for user to confirm detected platform list">
|
|
239
|
+
<field name="preview">
|
|
240
|
+
Detected ${platforms.length} platforms:
|
|
241
|
+
(For each platform in ${platforms}, display: ${platform.platformId}: ${sourcePath} (${platformType}/${platformSubtype}))
|
|
242
|
+
|
|
243
|
+
Continue with knowledge base generation?
|
|
244
|
+
</field>
|
|
245
|
+
<on-confirm>
|
|
246
|
+
<block type="event" action="log" level="info" desc="User confirmed">
|
|
247
|
+
<field name="message">User confirmed platform list, continuing</field>
|
|
248
|
+
</block>
|
|
249
|
+
</on-confirm>
|
|
250
|
+
<on-cancel>
|
|
251
|
+
<block type="event" action="log" level="warn" desc="User cancelled">
|
|
252
|
+
<field name="message">User cancelled, terminating workflow</field>
|
|
253
|
+
</block>
|
|
254
|
+
<field name="workflow.status" value="cancelled"/>
|
|
255
|
+
</on-cancel>
|
|
256
|
+
</block>
|
|
257
|
+
|
|
258
|
+
<!-- Checkpoint: Platform detection complete -->
|
|
259
|
+
<block type="checkpoint" id="S0-CP1" name="platforms_detected" desc="Platform detection complete">
|
|
260
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
261
|
+
<field name="verify" value="${platforms.length} > 0"/>
|
|
262
|
+
</block>
|
|
263
|
+
|
|
264
|
+
<block type="task" id="S0-B5" action="run-script" status="pending" desc="Update Stage 0 progress to completed">
|
|
265
|
+
<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>
|
|
266
|
+
</block>
|
|
267
|
+
|
|
268
|
+
<block type="event" id="S0-E4" action="log" level="info" desc="Report detected platform list">
|
|
269
|
+
<field name="message">Detected ${platforms.length} platforms: ${platforms.names}</field>
|
|
270
|
+
</block>
|
|
271
|
+
</sequence>
|
|
272
|
+
|
|
273
|
+
<!-- ============================================================
|
|
274
|
+
Stage 1a: Entry Directory Recognition
|
|
275
|
+
============================================================ -->
|
|
276
|
+
<sequence id="S1a" name="Stage 1a: Entry Directory Recognition" status="pending" desc="Identify entry directories for each platform and classify into business modules">
|
|
277
|
+
|
|
278
|
+
<block type="rule" id="S1a-R1" level="mandatory" desc="Stage 1a mandatory rules">
|
|
279
|
+
<field name="text">ALL platform entry directory recognition tasks MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
|
|
280
|
+
<field name="text">ALL Worker dispatch calls in S1a-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
|
|
281
|
+
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
|
|
282
|
+
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
|
|
283
|
+
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
|
|
284
|
+
</block>
|
|
285
|
+
|
|
286
|
+
<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">
|
|
287
|
+
<!-- Step 1: Read source directory tree -->
|
|
288
|
+
<block type="task" id="S1a-B1" action="dispatch-to-worker" status="pending" desc="Dispatch entry identification to Worker">
|
|
289
|
+
<field name="worker">speccrew-knowledge-bizs-identify-entries</field>
|
|
290
|
+
<field name="source_path" value="${platform.sourcePath}"/>
|
|
291
|
+
<field name="platform_id" value="${platform.platformId}"/>
|
|
292
|
+
<field name="platform_type" value="${platform.platformType}"/>
|
|
293
|
+
<field name="platform_subtype" value="${platform.platformSubtype}"/>
|
|
294
|
+
<field name="tech_identifier" value="${platform.techIdentifier}"/>
|
|
295
|
+
<field name="configs_dir" value="${configs_dir}"/>
|
|
296
|
+
<field name="output_path" value="${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json"/>
|
|
297
|
+
<field name="output" var="entries_${platform.platformId}"/>
|
|
298
|
+
</block>
|
|
299
|
+
|
|
300
|
+
<!-- Step 2: Validate entry directories -->
|
|
301
|
+
<block type="gateway" id="S1a-G1" mode="guard" test="${entries_${platform.platformId}.modules.length} > 0" fail-action="stop" desc="Validate entry directory recognition result">
|
|
302
|
+
<field name="message">Platform ${platform.platformId} did not identify any entry directories</field>
|
|
303
|
+
</block>
|
|
304
|
+
</block>
|
|
305
|
+
|
|
306
|
+
<block type="checkpoint" id="S1a-CP1" name="entry_dirs_recognized" desc="Entry directory recognition complete">
|
|
307
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
308
|
+
<field name="verify" value="true"/>
|
|
309
|
+
</block>
|
|
310
|
+
|
|
311
|
+
<block type="task" id="S1a-B2" action="run-script" status="pending" desc="Update Stage 1a progress to completed">
|
|
312
|
+
<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>
|
|
313
|
+
</block>
|
|
314
|
+
</sequence>
|
|
315
|
+
|
|
316
|
+
<!-- ============================================================
|
|
317
|
+
Stage 1b: Generate Feature Inventory
|
|
318
|
+
============================================================ -->
|
|
319
|
+
<sequence id="S1b" name="Stage 1b: Generate Feature Inventory" status="pending" desc="Generate Feature inventory for each platform">
|
|
320
|
+
|
|
321
|
+
<block type="rule" id="S1b-R1" level="mandatory" desc="Stage 1b mandatory rules">
|
|
322
|
+
<field name="text">ALL platform feature inventory generation tasks MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
|
|
323
|
+
<field name="text">ALL Worker dispatch calls in S1b-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
|
|
324
|
+
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
|
|
325
|
+
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
|
|
326
|
+
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
|
|
327
|
+
<field name="text">Worker Agents do not have run_in_terminal capability, which is required for script execution</field>
|
|
328
|
+
</block>
|
|
329
|
+
|
|
330
|
+
<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">
|
|
331
|
+
<!-- Step 1: Dispatch Worker to generate feature inventory -->
|
|
332
|
+
<block type="task" id="S1b-B1" action="dispatch-to-worker" status="pending" desc="Dispatch Worker to generate feature inventory">
|
|
333
|
+
<field name="worker">speccrew-knowledge-bizs-init-features</field>
|
|
334
|
+
<field name="instructions">
|
|
335
|
+
Generate feature inventory for the specified platform by analyzing entry directories.
|
|
336
|
+
|
|
337
|
+
Requirements:
|
|
338
|
+
- Read entry-dirs JSON file to get module entry directories
|
|
339
|
+
- Scan source files in each entry directory
|
|
340
|
+
- Generate features JSON with feature metadata
|
|
341
|
+
- Output to features-{platformId}.json in sync_state_bizs_dir
|
|
342
|
+
</field>
|
|
343
|
+
<field name="context">{
|
|
344
|
+
"platformId": "${platform.platformId}",
|
|
345
|
+
"platformName": "${platform.platformName}",
|
|
346
|
+
"platformType": "${platform.platformType}",
|
|
347
|
+
"platformSubtype": "${platform.platformSubtype}",
|
|
348
|
+
"sourcePath": "${platform.sourcePath}",
|
|
349
|
+
"techIdentifier": "${platform.techIdentifier}",
|
|
350
|
+
"entryDirsFile": "${sync_state_bizs_dir}/entry-dirs-${platform.platformId}.json",
|
|
351
|
+
"outputDir": "${sync_state_bizs_dir}",
|
|
352
|
+
"workspace_path": "${workspace_path}",
|
|
353
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
354
|
+
"language": "${language}"
|
|
355
|
+
}</field>
|
|
356
|
+
<field name="output" var="features_${platform.platformId}"/>
|
|
357
|
+
</block>
|
|
358
|
+
|
|
359
|
+
<!-- Step 2: Validate Feature inventory -->
|
|
360
|
+
<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">
|
|
361
|
+
<field name="message">Platform ${platform.platformId} did not generate any Features</field>
|
|
362
|
+
</block>
|
|
363
|
+
</block>
|
|
364
|
+
|
|
365
|
+
<block type="checkpoint" id="S1b-CP1" name="features_generated" desc="Feature inventory generation complete">
|
|
366
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
367
|
+
<field name="verify" value="${all_features.length} > 0"/>
|
|
368
|
+
</block>
|
|
369
|
+
|
|
370
|
+
<block type="task" id="S1b-B2" action="run-script" status="pending" desc="Update Stage 1b progress to completed">
|
|
371
|
+
<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>
|
|
372
|
+
</block>
|
|
373
|
+
|
|
374
|
+
<block type="event" id="S1b-E1" action="log" level="info" desc="Report Feature inventory statistics">
|
|
375
|
+
<field name="message">Feature inventory initialized. ${feature_count} features across ${platform_count} platforms.</field>
|
|
376
|
+
</block>
|
|
377
|
+
</sequence>
|
|
378
|
+
|
|
379
|
+
<!-- ============================================================
|
|
380
|
+
Stage 1c: Feature Merge (Incremental Mode)
|
|
381
|
+
============================================================ -->
|
|
382
|
+
<sequence id="S1c" name="Stage 1c: Feature Merge" status="pending" desc="Merge new and existing Feature inventories in incremental mode">
|
|
383
|
+
|
|
384
|
+
<block type="rule" id="S1c-R1" level="mandatory" desc="Stage 1c mandatory rules">
|
|
385
|
+
<field name="text">This stage is executed DIRECTLY by the dispatch agent (Leader) via run_in_terminal, NOT delegated to a Worker Agent</field>
|
|
386
|
+
</block>
|
|
387
|
+
|
|
388
|
+
<!-- Conditional: Incremental mode -->
|
|
389
|
+
<block type="gateway" id="S1c-G1" mode="exclusive" desc="Determine execution mode">
|
|
390
|
+
<branch test="${sync_mode} == 'incremental'" name="Incremental mode">
|
|
391
|
+
<!-- Step 1: Execute Feature merge -->
|
|
392
|
+
<block type="task" id="S1c-B1" action="run-script" status="pending" desc="Merge new and existing Feature inventories">
|
|
393
|
+
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js"</field>
|
|
394
|
+
<field name="arg">--syncStatePath</field>
|
|
395
|
+
<field name="arg">${sync_state_bizs_dir}</field>
|
|
396
|
+
<field name="arg">--completedDir</field>
|
|
397
|
+
<field name="arg">${completed_dir}</field>
|
|
398
|
+
<field name="arg">--projectRoot</field>
|
|
399
|
+
<field name="arg">${source_path}</field>
|
|
400
|
+
<field name="output" var="merge_result"/>
|
|
401
|
+
</block>
|
|
402
|
+
|
|
403
|
+
<!-- Step 2: Report merge result -->
|
|
404
|
+
<block type="event" id="S1c-E1" action="log" level="info" desc="Report merge result">
|
|
405
|
+
<field name="message">Feature merge complete:
|
|
406
|
+
- Added: ${merge_result.added}
|
|
407
|
+
- Removed: ${merge_result.removed}
|
|
408
|
+
- Changed: ${merge_result.changed} (reset for re-analysis)
|
|
409
|
+
- Unchanged: ${merge_result.unchanged} (analysis state preserved)</field>
|
|
410
|
+
</block>
|
|
411
|
+
|
|
412
|
+
<!-- Step 3: Mark stale Features -->
|
|
413
|
+
<block type="task" id="S1c-B2" action="run-script" status="pending" desc="Clean up documents and markers for deleted Features">
|
|
414
|
+
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js"</field>
|
|
415
|
+
<field name="arg">--syncStatePath</field>
|
|
416
|
+
<field name="arg">${sync_state_bizs_dir}</field>
|
|
417
|
+
<field name="arg">--completedDir</field>
|
|
418
|
+
<field name="arg">${completed_dir}</field>
|
|
419
|
+
</block>
|
|
420
|
+
</branch>
|
|
421
|
+
<branch default="true" name="Full mode">
|
|
422
|
+
<block type="event" id="S1c-E2" action="log" level="info" desc="Full mode skip merge">
|
|
423
|
+
<field name="message">Full mode, skipping Feature merge step</field>
|
|
424
|
+
</block>
|
|
425
|
+
</branch>
|
|
426
|
+
</block>
|
|
427
|
+
|
|
428
|
+
<block type="checkpoint" id="S1c-CP1" name="feature_merge_complete" desc="Feature merge complete">
|
|
429
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
430
|
+
<field name="passed" value="true"/>
|
|
431
|
+
</block>
|
|
432
|
+
|
|
433
|
+
<block type="task" id="S1c-B3" action="run-script" status="pending" desc="Update Stage 1c progress to completed">
|
|
434
|
+
<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>
|
|
435
|
+
</block>
|
|
436
|
+
</sequence>
|
|
437
|
+
|
|
438
|
+
<!-- ============================================================
|
|
439
|
+
Stage 2: Feature Analysis (Batch Processing)
|
|
440
|
+
============================================================ -->
|
|
441
|
+
<sequence id="S2" name="Stage 2: Feature Analysis" status="pending" desc="Batch process Feature analysis, dispatch Workers to execute">
|
|
442
|
+
|
|
443
|
+
<block type="task" id="S2-B-Start" action="run-script" status="pending" desc="Update Stage 2 progress to in_progress">
|
|
444
|
+
<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>
|
|
445
|
+
</block>
|
|
446
|
+
|
|
447
|
+
<block type="rule" id="S2-R1" level="mandatory" desc="Stage 2 mandatory rules">
|
|
448
|
+
<field name="text">MUST use batch-orchestrator for batch management — DO NOT manually track batches</field>
|
|
449
|
+
<field name="text">MUST dispatch Workers for feature analysis — DO NOT analyze features yourself</field>
|
|
450
|
+
<field name="text">ALL workers for the same stage MUST be dispatched in PARALLEL — sequential execution is FORBIDDEN</field>
|
|
451
|
+
<field name="text">ALL Worker dispatch calls in S2-L2 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
|
|
452
|
+
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
|
|
453
|
+
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
|
|
454
|
+
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
|
|
455
|
+
<field name="text">Monitor completion via marker files, NOT by polling worker status</field>
|
|
456
|
+
</block>
|
|
457
|
+
|
|
458
|
+
<block type="rule" id="S2-R2" level="forbidden" desc="Stage 2 forbidden actions">
|
|
459
|
+
<field name="text">DO NOT skip pending features — every feature must be analyzed</field>
|
|
460
|
+
<field name="text">DO NOT generate feature analysis content yourself — always dispatch to Worker</field>
|
|
461
|
+
<field name="text">DO NOT proceed to next Stage until ALL workers in current Stage have completed or failed</field>
|
|
462
|
+
</block>
|
|
463
|
+
|
|
464
|
+
<!-- Step 0: Ensure completed_dir exists (MANDATORY) -->
|
|
465
|
+
<block type="task" id="S2-B0" action="run-script" status="pending" desc="Ensure completed_dir directory exists">
|
|
466
|
+
<field name="command">node -e "require('fs').mkdirSync('${completed_dir}', {recursive: true}); console.log('completed dir ready')"</field>
|
|
467
|
+
</block>
|
|
468
|
+
|
|
469
|
+
<block type="rule" id="S2-R3" level="mandatory" desc="completed_dir path rules">
|
|
470
|
+
<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>
|
|
471
|
+
<field name="text">Relative paths will cause Worker marker file writes to fail silently</field>
|
|
472
|
+
</block>
|
|
473
|
+
|
|
474
|
+
<!-- Batch Loop: Step 1→2→2.5→3 loop until all features processed -->
|
|
475
|
+
<block type="loop" id="S2-L-Main" over="${batches}" as="batch_iteration" desc="Batch loop to process Features">
|
|
476
|
+
|
|
477
|
+
<!-- Step 1: Get next batch -->
|
|
478
|
+
<block type="task" id="S2-B1" action="run-script" status="pending" desc="Get next batch of pending Features">
|
|
479
|
+
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" get-batch</field>
|
|
480
|
+
<field name="arg">--syncStatePath</field>
|
|
481
|
+
<field name="arg">${sync_state_bizs_dir}</field>
|
|
482
|
+
<field name="arg">--batchSize</field>
|
|
483
|
+
<field name="arg">${max_concurrent_workers}</field>
|
|
484
|
+
<field name="output" var="batch_response"/>
|
|
485
|
+
</block>
|
|
486
|
+
|
|
487
|
+
<!-- Determine if complete -->
|
|
488
|
+
<block type="gateway" id="S2-G0" mode="exclusive" desc="Determine batch response">
|
|
489
|
+
<branch test="${batch_response.action} == 'done'" name="All Features processed">
|
|
490
|
+
<block type="event" id="S2-E-Done" action="log" level="info" desc="All Features processed">
|
|
491
|
+
<field name="message">All Features analyzed, exiting Stage 2 loop</field>
|
|
492
|
+
</block>
|
|
493
|
+
<field name="stage2_complete" value="true"/>
|
|
494
|
+
</branch>
|
|
495
|
+
<branch test="${batch_response.action} == 'process'" name="Process current batch">
|
|
496
|
+
|
|
497
|
+
<!-- Step 2: Prepare analysis task specifications -->
|
|
498
|
+
<block type="event" id="S2-E-Batch" action="log" level="info" desc="Report current batch">
|
|
499
|
+
<field name="message">Processing batch: ${batch_response.batch.length} Features</field>
|
|
500
|
+
</block>
|
|
501
|
+
|
|
502
|
+
<!-- Step 2: Dispatch Worker for each Feature -->
|
|
503
|
+
<!-- PARALLEL EXECUTION MANDATORY: All Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
|
|
504
|
+
<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">
|
|
505
|
+
|
|
506
|
+
<!-- Route to different Skill based on platformType -->
|
|
507
|
+
<block type="gateway" id="S2-G1" mode="exclusive" desc="Route analysis Skill based on platform type">
|
|
508
|
+
<branch test="${feature.platformType} == 'web' or ${feature.platformType} == 'mobile' or ${feature.platformType} == 'desktop'" name="UI platform">
|
|
509
|
+
<block type="task" id="S2-B2a" action="dispatch-to-worker" status="pending" desc="Dispatch UI Feature analysis Worker">
|
|
510
|
+
<field name="worker">speccrew-knowledge-bizs-ui-analyze</field>
|
|
511
|
+
<field name="instructions">
|
|
512
|
+
Analyze the following source code file and generate detailed feature documentation.
|
|
513
|
+
|
|
514
|
+
CRITICAL - Template Fill-in Workflow (MANDATORY):
|
|
515
|
+
1. First, copy the analysis template to documentPath (template structure = document skeleton)
|
|
516
|
+
2. Then fill each Section using search_replace to replace placeholders with actual data
|
|
517
|
+
3. NEVER use create_file to rewrite the entire document — this destroys template structure
|
|
518
|
+
4. NEVER delete or skip any template Section — if no data available, fill with "N/A"
|
|
519
|
+
5. NEVER create custom Section structures — use ONLY the template's predefined Sections
|
|
520
|
+
|
|
521
|
+
Requirements:
|
|
522
|
+
- Read source code file, understand related functionality interfaces
|
|
523
|
+
- Generate detailed documentation to documentPath
|
|
524
|
+
- Create two marker files to completed_dir
|
|
525
|
+
- Use speccrew-knowledge-bizs-ui-analyze skill to complete this task
|
|
526
|
+
</field>
|
|
527
|
+
<field name="context">{
|
|
528
|
+
"fileName": "${feature.fileName}",
|
|
529
|
+
"sourcePath": "${feature.sourcePath}",
|
|
530
|
+
"module": "${feature.module}",
|
|
531
|
+
"documentPath": "${feature.documentPath}",
|
|
532
|
+
"platformType": "${feature.platformType}",
|
|
533
|
+
"platformSubtype": "${feature.platformSubtype}",
|
|
534
|
+
"language": "${language}",
|
|
535
|
+
"completed_dir": "${completed_dir}",
|
|
536
|
+
"workspace_path": "${workspace_path}",
|
|
537
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
538
|
+
"sourceFile": "${feature.sourceFile}"
|
|
539
|
+
}</field>
|
|
540
|
+
<field name="output" var="analyze_result_${feature.id}"/>
|
|
541
|
+
</block>
|
|
542
|
+
</branch>
|
|
543
|
+
<branch default="true" name="Backend platform">
|
|
544
|
+
<block type="task" id="S2-B2b" action="dispatch-to-worker" status="pending" desc="Dispatch API Feature analysis Worker">
|
|
545
|
+
<field name="worker">speccrew-knowledge-bizs-api-analyze</field>
|
|
546
|
+
<field name="instructions">
|
|
547
|
+
Analyze the following source code file and generate detailed API feature documentation.
|
|
548
|
+
|
|
549
|
+
CRITICAL - Template Fill-in Workflow (MANDATORY):
|
|
550
|
+
1. First, copy the analysis template to documentPath
|
|
551
|
+
2. Then fill each Section using search_replace
|
|
552
|
+
3. NEVER use create_file to rewrite the entire document
|
|
553
|
+
4. NEVER delete or skip any template Section
|
|
554
|
+
|
|
555
|
+
Requirements:
|
|
556
|
+
- Read API Controller source code
|
|
557
|
+
- Extract API endpoints, request/response structures
|
|
558
|
+
- Generate detailed documentation to documentPath
|
|
559
|
+
- Create .done.json and .graph.json marker files
|
|
560
|
+
</field>
|
|
561
|
+
<field name="context">{
|
|
562
|
+
"fileName": "${feature.fileName}",
|
|
563
|
+
"sourcePath": "${feature.sourcePath}",
|
|
564
|
+
"module": "${feature.module}",
|
|
565
|
+
"documentPath": "${feature.documentPath}",
|
|
566
|
+
"platformType": "${feature.platformType}",
|
|
567
|
+
"platformSubtype": "${feature.platformSubtype}",
|
|
568
|
+
"language": "${language}",
|
|
569
|
+
"completed_dir": "${completed_dir}",
|
|
570
|
+
"workspace_path": "${workspace_path}",
|
|
571
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
572
|
+
"sourceFile": "${feature.sourceFile}"
|
|
573
|
+
}</field>
|
|
574
|
+
<field name="output" var="analyze_result_${feature.id}"/>
|
|
575
|
+
</block>
|
|
576
|
+
</branch>
|
|
577
|
+
</block>
|
|
578
|
+
</block>
|
|
579
|
+
|
|
580
|
+
<!-- Step 2.5: Graph Worker Task Preparation -->
|
|
581
|
+
<block type="event" id="S2-E-Graph" action="log" level="info" desc="Prepare Graph Worker tasks">
|
|
582
|
+
<field name="message">Preparing Graph data generation for completed Features</field>
|
|
583
|
+
</block>
|
|
584
|
+
|
|
585
|
+
<!-- Step 2.5: Dispatch Graph Worker -->
|
|
586
|
+
<!-- PARALLEL EXECUTION MANDATORY: All Graph Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
|
|
587
|
+
<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">
|
|
588
|
+
<block type="gateway" id="S2-G2" mode="exclusive" desc="Route Graph Worker based on analysis type">
|
|
589
|
+
<branch test="${feature.platformType} == 'backend'" name="API Graph">
|
|
590
|
+
<block type="task" id="S2-B25a" action="dispatch-to-worker" status="pending" desc="Dispatch API Graph Worker">
|
|
591
|
+
<field name="worker">speccrew-knowledge-bizs-api-graph</field>
|
|
592
|
+
<field name="instructions">
|
|
593
|
+
Generate graph data nodes and edges from the analyzed API feature document.
|
|
594
|
+
|
|
595
|
+
Requirements:
|
|
596
|
+
- Read the API analysis document at api_analysis_path
|
|
597
|
+
- Extract entities (APIs, services, tables, DTOs)
|
|
598
|
+
- Generate graph nodes and edges
|
|
599
|
+
- Write graph JSON to output_dir
|
|
600
|
+
- Create .graph-done.json completion marker at output_dir
|
|
601
|
+
</field>
|
|
602
|
+
<field name="context">{
|
|
603
|
+
"api_analysis_path": "${feature.documentPath}",
|
|
604
|
+
"platform_id": "${feature.platformId}",
|
|
605
|
+
"output_dir": "${completed_dir}",
|
|
606
|
+
"workspace_path": "${workspace_path}",
|
|
607
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
608
|
+
"module": "${feature.module}",
|
|
609
|
+
"fileName": "${feature.fileName}",
|
|
610
|
+
"sourcePath": "${feature.sourcePath}",
|
|
611
|
+
"sourceFile": "${feature.sourceFile}",
|
|
612
|
+
"language": "${language}",
|
|
613
|
+
"subpath": "${feature.subpath}"
|
|
614
|
+
}</field>
|
|
615
|
+
<field name="output" var="graph_result_${feature.id}"/>
|
|
616
|
+
</block>
|
|
617
|
+
</branch>
|
|
618
|
+
<branch default="true" name="UI Graph">
|
|
619
|
+
<block type="task" id="S2-B25b" action="dispatch-to-worker" status="pending" desc="Dispatch UI Graph Worker">
|
|
620
|
+
<field name="worker">speccrew-knowledge-bizs-ui-graph</field>
|
|
621
|
+
<field name="instructions">
|
|
622
|
+
Generate graph data nodes and edges from the analyzed UI feature document.
|
|
623
|
+
|
|
624
|
+
Requirements:
|
|
625
|
+
- Read the UI analysis document at documentPath
|
|
626
|
+
- Extract entities (pages, components, API calls, navigations)
|
|
627
|
+
- Generate graph nodes and edges
|
|
628
|
+
- Write graph JSON to completed_dir
|
|
629
|
+
- Create .graph-done.json completion marker at completed_dir
|
|
630
|
+
</field>
|
|
631
|
+
<field name="context">{
|
|
632
|
+
"feature": "${feature}",
|
|
633
|
+
"fileName": "${feature.fileName}",
|
|
634
|
+
"sourcePath": "${feature.sourcePath}",
|
|
635
|
+
"documentPath": "${feature.documentPath}",
|
|
636
|
+
"module": "${feature.module}",
|
|
637
|
+
"platform_type": "${feature.platformType}",
|
|
638
|
+
"platform_subtype": "${feature.platformSubtype}",
|
|
639
|
+
"completed_dir": "${completed_dir}",
|
|
640
|
+
"workspace_path": "${workspace_path}",
|
|
641
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
642
|
+
"sourceFile": "${feature.sourceFile}",
|
|
643
|
+
"language": "${language}"
|
|
644
|
+
}</field>
|
|
645
|
+
<field name="output" var="graph_result_${feature.id}"/>
|
|
646
|
+
</block>
|
|
647
|
+
</branch>
|
|
648
|
+
</block>
|
|
649
|
+
</block>
|
|
650
|
+
|
|
651
|
+
<!-- Step 3: Process batch results -->
|
|
652
|
+
<block type="task" id="S2-B3" action="run-script" status="pending" desc="Collect and process batch Worker results">
|
|
653
|
+
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" process-results</field>
|
|
654
|
+
<field name="arg">--syncStatePath</field>
|
|
655
|
+
<field name="arg">${sync_state_bizs_dir}</field>
|
|
656
|
+
<field name="arg">--graphRoot</field>
|
|
657
|
+
<field name="arg">${graph_root}</field>
|
|
658
|
+
<field name="arg">--completedDir</field>
|
|
659
|
+
<field name="arg">${completed_dir}</field>
|
|
660
|
+
<field name="output" var="batch_result"/>
|
|
661
|
+
</block>
|
|
662
|
+
|
|
663
|
+
<block type="event" id="S2-E-Result" action="log" level="info" desc="Report batch processing result">
|
|
664
|
+
<field name="message">Batch processing complete: ${batch_result.success} succeeded, ${batch_result.failed} failed</field>
|
|
665
|
+
</block>
|
|
666
|
+
</branch>
|
|
667
|
+
</block>
|
|
668
|
+
</block>
|
|
669
|
+
|
|
670
|
+
<block type="checkpoint" id="S2-CP1" name="feature_analysis_complete" desc="All Feature analysis complete">
|
|
671
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
672
|
+
<field name="verify" value="${pending_features.length} == 0"/>
|
|
673
|
+
</block>
|
|
674
|
+
|
|
675
|
+
<block type="task" id="S2-B-End" action="run-script" status="pending" desc="Update Stage 2 progress to completed">
|
|
676
|
+
<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>
|
|
677
|
+
</block>
|
|
678
|
+
|
|
679
|
+
<block type="event" id="S2-E-Final" action="log" level="info" desc="Stage 2 complete">
|
|
680
|
+
<field name="message">Stage 2 Milestone: Feature analysis complete. ${analyzed_count} features analyzed, ${failed_count} failed. ${graph_count} graph data files generated.</field>
|
|
681
|
+
</block>
|
|
682
|
+
</sequence>
|
|
683
|
+
|
|
684
|
+
<!-- ============================================================
|
|
685
|
+
Stage 3: Module Summarize
|
|
686
|
+
============================================================ -->
|
|
687
|
+
<sequence id="S3" name="Stage 3: Module Summarize" status="pending" desc="Generate module overview for each module">
|
|
688
|
+
|
|
689
|
+
<block type="rule" id="S3-R1" level="mandatory" desc="Stage 3 mandatory rules">
|
|
690
|
+
<field name="text">Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.</field>
|
|
691
|
+
<field name="text">ALL module summary workers MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
|
|
692
|
+
<field name="text">ALL Worker dispatch calls in S3-L2 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
|
|
693
|
+
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
|
|
694
|
+
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
|
|
695
|
+
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
|
|
696
|
+
<field name="text">Workers MUST NOT create any temporary scripts or workaround files</field>
|
|
697
|
+
</block>
|
|
698
|
+
|
|
699
|
+
<!-- Step 1: Read all features JSON -->
|
|
700
|
+
<block type="task" id="S3-B1" action="run-script" status="pending" desc="Read all platform features JSON">
|
|
701
|
+
<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>
|
|
702
|
+
<field name="output" var="features_files"/>
|
|
703
|
+
</block>
|
|
704
|
+
|
|
705
|
+
<!-- Step 2: Prepare module summary tasks for each platform -->
|
|
706
|
+
<block type="loop" id="S3-L1" over="${platforms}" as="platform" parallel="true" max-concurrency="${max_concurrent_workers}" desc="Prepare module summary tasks for each platform IN PARALLEL">
|
|
707
|
+
<!-- Step 2.1: Read platform features -->
|
|
708
|
+
<block type="task" id="S3-B2" action="run-script" status="pending" desc="Read platform features">
|
|
709
|
+
<field name="command">node -e "console.log(require('fs').readFileSync('${sync_state_bizs_dir}/features-${platform.platformId}.json', 'utf8'))"</field>
|
|
710
|
+
<field name="output" var="platform_features"/>
|
|
711
|
+
</block>
|
|
712
|
+
|
|
713
|
+
<!-- Step 2.2: Extract module list -->
|
|
714
|
+
<block type="task" id="S3-B3" action="run-script" status="pending" desc="Extract module list">
|
|
715
|
+
<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>
|
|
716
|
+
<field name="output" var="platform_modules"/>
|
|
717
|
+
</block>
|
|
718
|
+
|
|
719
|
+
<!-- Step 2.3: Dispatch Worker for each module -->
|
|
720
|
+
<!-- PARALLEL EXECUTION MANDATORY: All Module Summary Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
|
|
721
|
+
<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">
|
|
722
|
+
<block type="task" id="S3-B4" action="dispatch-to-worker" status="pending" desc="Dispatch module summary Worker">
|
|
723
|
+
<field name="worker">speccrew-knowledge-module-summarize</field>
|
|
724
|
+
<field name="instructions">
|
|
725
|
+
Generate complete module overview documentation for the specified module.
|
|
726
|
+
|
|
727
|
+
Requirements:
|
|
728
|
+
- Read all Feature documents under the module
|
|
729
|
+
- Aggregate and generate module-level overview
|
|
730
|
+
- Output to {module_path}/{module_name}-overview.md
|
|
731
|
+
</field>
|
|
732
|
+
<field name="context">{
|
|
733
|
+
"module_name": "${module_name}",
|
|
734
|
+
"module_path": "${workspace_path}/knowledges/bizs/${platform.platformId}/${module_name}/",
|
|
735
|
+
"workspace_path": "${workspace_path}",
|
|
736
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
737
|
+
"language": "${language}"
|
|
738
|
+
}</field>
|
|
739
|
+
<field name="output" var="module_result_${platform.platformId}_${module_name}"/>
|
|
740
|
+
</block>
|
|
741
|
+
</block>
|
|
742
|
+
</block>
|
|
743
|
+
|
|
744
|
+
<block type="checkpoint" id="S3-CP1" name="module_summarize_complete" desc="Module summary generation complete">
|
|
745
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
746
|
+
<field name="passed" value="true"/>
|
|
747
|
+
</block>
|
|
748
|
+
|
|
749
|
+
<block type="task" id="S3-B5" action="run-script" status="pending" desc="Update Stage 3 progress to completed">
|
|
750
|
+
<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>
|
|
751
|
+
</block>
|
|
752
|
+
|
|
753
|
+
<block type="event" id="S3-E1" action="log" level="info" desc="Stage 3 complete">
|
|
754
|
+
<field name="message">Stage 3 Milestone: Module summaries complete. ${module_count} modules summarized.</field>
|
|
755
|
+
</block>
|
|
756
|
+
</sequence>
|
|
757
|
+
|
|
758
|
+
<!-- ============================================================
|
|
759
|
+
Stage 3.5: UI Style Pattern Extract
|
|
760
|
+
============================================================ -->
|
|
761
|
+
<sequence id="S3.5" name="Stage 3.5: UI Style Pattern Extract" status="pending" desc="Extract UI style patterns for frontend platforms">
|
|
762
|
+
|
|
763
|
+
<block type="rule" id="S35-R1" level="mandatory" desc="Stage 3.5 mandatory rules">
|
|
764
|
+
<field name="text">Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.</field>
|
|
765
|
+
<field name="text">ALL UI style extraction workers MUST be dispatched IN PARALLEL — sequential execution is FORBIDDEN</field>
|
|
766
|
+
<field name="text">ALL Worker dispatch calls in S35-L1 MUST be issued SIMULTANEOUSLY in a SINGLE orchestration turn</field>
|
|
767
|
+
<field name="text">DO NOT wait for any Worker to complete before dispatching the next Worker</field>
|
|
768
|
+
<field name="text">Dispatch all ${max_concurrent_workers} workers at once, then wait for ALL to complete</field>
|
|
769
|
+
<field name="text">Sequential one-by-one dispatch is STRICTLY FORBIDDEN</field>
|
|
770
|
+
<field name="text">This stage writes to techs knowledge base, not bizs knowledge base</field>
|
|
771
|
+
</block>
|
|
772
|
+
|
|
773
|
+
<!-- Dispatch UI Style Extract Worker for each frontend platform -->
|
|
774
|
+
<!-- PARALLEL EXECUTION MANDATORY: All UI Style Workers MUST be dispatched SIMULTANEOUSLY in ONE turn -->
|
|
775
|
+
<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">
|
|
776
|
+
<block type="gateway" id="S35-G1" mode="exclusive" desc="Execute for UI platforms only">
|
|
777
|
+
<branch test="${platform.platformType} in ['web', 'mobile', 'desktop']" name="UI platform">
|
|
778
|
+
<block type="task" id="S35-B1" action="dispatch-to-worker" status="pending" desc="Dispatch UI style extraction Worker">
|
|
779
|
+
<field name="worker">speccrew-knowledge-bizs-ui-style-extract</field>
|
|
780
|
+
<field name="instructions">
|
|
781
|
+
Extract UI design patterns from frontend platform Feature documents.
|
|
782
|
+
|
|
783
|
+
Requirements:
|
|
784
|
+
- Analyze Feature documents for page types, component patterns, layout patterns
|
|
785
|
+
- Generate pattern documents under page-types/, components/, layouts/ directories
|
|
786
|
+
- Output to {workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/
|
|
787
|
+
</field>
|
|
788
|
+
<field name="context">{
|
|
789
|
+
"platform_id": "${platform.platformId}",
|
|
790
|
+
"platform_type": "${platform.platformType}",
|
|
791
|
+
"feature_docs_path": "${workspace_path}/knowledges/bizs/${platform.platformId}",
|
|
792
|
+
"features_manifest_path": "${sync_state_bizs_dir}/features-${platform.platformId}.json",
|
|
793
|
+
"module_overviews_path": "${workspace_path}/knowledges/bizs/${platform.platformId}/",
|
|
794
|
+
"output_path": "${workspace_path}/knowledges/techs/${platform.platformId}/ui-style-patterns/",
|
|
795
|
+
"workspace_path": "${workspace_path}",
|
|
796
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
797
|
+
"language": "${language}"
|
|
798
|
+
}</field>
|
|
799
|
+
<field name="output" var="ui_style_result_${platform.platformId}"/>
|
|
800
|
+
</block>
|
|
801
|
+
</branch>
|
|
802
|
+
<branch default="true" name="Non-UI platform">
|
|
803
|
+
<block type="event" id="S35-E1" action="log" level="info" desc="Backend platform skip style extraction">
|
|
804
|
+
<field name="message">Backend platform ${platform.platformId} skipping UI style extraction</field>
|
|
805
|
+
</block>
|
|
806
|
+
</branch>
|
|
807
|
+
</block>
|
|
808
|
+
</block>
|
|
809
|
+
|
|
810
|
+
<block type="event" id="S35-E2" action="log" level="info" desc="Stage 3.5 complete">
|
|
811
|
+
<field name="message">Stage 3.5 Milestone: UI style patterns extracted. ${pattern_count} patterns extracted from ${frontend_platform_count} platforms.</field>
|
|
812
|
+
</block>
|
|
813
|
+
|
|
814
|
+
<block type="task" id="S35-B2" action="run-script" status="pending" desc="Update Stage 3.5 progress to completed">
|
|
815
|
+
<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>
|
|
816
|
+
</block>
|
|
817
|
+
</sequence>
|
|
818
|
+
|
|
819
|
+
<!-- ============================================================
|
|
820
|
+
Stage 4: System Summarize
|
|
821
|
+
============================================================ -->
|
|
822
|
+
<sequence id="S4" name="Stage 4: System Summarize" status="pending" desc="Generate system-level business knowledge summary">
|
|
823
|
+
|
|
824
|
+
<block type="rule" id="S4-R1" level="mandatory" desc="Stage 4 prerequisites">
|
|
825
|
+
<field name="text">ALL platform modules must be summarized before system summarize</field>
|
|
826
|
+
<field name="text">MUST include cross-platform analysis if multiple platforms exist</field>
|
|
827
|
+
<field name="text">Worker dispatch is handled by the calling Agent (Team Leader)</field>
|
|
828
|
+
</block>
|
|
829
|
+
|
|
830
|
+
<!-- Step 1: Read all platform structures -->
|
|
831
|
+
<block type="task" id="S4-B1" action="run-script" status="pending" desc="Read all platform features JSON">
|
|
832
|
+
<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>
|
|
833
|
+
<field name="output" var="all_platforms_data"/>
|
|
834
|
+
</block>
|
|
835
|
+
|
|
836
|
+
<!-- Step 2: Dispatch System Summarize Worker -->
|
|
837
|
+
<block type="task" id="S4-B2" action="dispatch-to-worker" status="pending" desc="Dispatch system summary Worker">
|
|
838
|
+
<field name="worker">speccrew-knowledge-system-summarize</field>
|
|
839
|
+
<field name="instructions">
|
|
840
|
+
Generate complete system-level business knowledge summary.
|
|
841
|
+
|
|
842
|
+
Requirements:
|
|
843
|
+
- Aggregate business knowledge from all platforms and modules
|
|
844
|
+
- Generate platform index and module hierarchy
|
|
845
|
+
- Include cross-platform analysis (if multiple platforms exist)
|
|
846
|
+
- Output to {workspace_path}/knowledges/bizs/system-overview.md
|
|
847
|
+
</field>
|
|
848
|
+
<field name="context">{
|
|
849
|
+
"modules_path": "${workspace_path}/knowledges/bizs/",
|
|
850
|
+
"output_path": "${workspace_path}/knowledges/bizs/",
|
|
851
|
+
"workspace_path": "${workspace_path}",
|
|
852
|
+
"sync_state_bizs_dir": "${sync_state_bizs_dir}",
|
|
853
|
+
"language": "${language}",
|
|
854
|
+
"platforms": "${all_platforms_data}"
|
|
855
|
+
}</field>
|
|
856
|
+
<field name="output" var="system_summary"/>
|
|
857
|
+
</block>
|
|
858
|
+
|
|
859
|
+
<block type="checkpoint" id="S4-CP1" name="system_summarize_complete" desc="System summary generation complete">
|
|
860
|
+
<field name="file" value="${sync_state_bizs_dir}/.progress.json"/>
|
|
861
|
+
<field name="passed" value="true"/>
|
|
862
|
+
</block>
|
|
863
|
+
|
|
864
|
+
<block type="task" id="S4-B3" action="run-script" status="pending" desc="Update Stage 4 progress to completed">
|
|
865
|
+
<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>
|
|
866
|
+
</block>
|
|
867
|
+
|
|
868
|
+
<block type="event" id="S4-E1" action="log" level="info" desc="Stage 4 complete">
|
|
869
|
+
<field name="message">Stage 4 Milestone: System overview generated. All stages complete. Pipeline finished successfully.</field>
|
|
870
|
+
</block>
|
|
871
|
+
</sequence>
|
|
872
|
+
|
|
873
|
+
<!-- ============================================================
|
|
874
|
+
Error Handling
|
|
875
|
+
============================================================ -->
|
|
876
|
+
<block type="error-handler" id="EH1" desc="Global error handling">
|
|
877
|
+
<try>
|
|
878
|
+
<!-- Main workflow defined in sequences above -->
|
|
879
|
+
</try>
|
|
880
|
+
<catch on="worker_failed">
|
|
881
|
+
<block type="event" id="EH1-E1" action="log" level="warn" desc="Worker failed, log error and continue">
|
|
882
|
+
<field name="message">Worker ${error.worker} failed: ${error.message}</field>
|
|
883
|
+
</block>
|
|
884
|
+
<block type="task" id="EH1-B1" action="run-script" desc="Update failed status">
|
|
885
|
+
<field name="command">node "${ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js"</field>
|
|
886
|
+
<field name="arg">--featureId</field>
|
|
887
|
+
<field name="arg">${error.feature_id}</field>
|
|
888
|
+
<field name="arg">--status</field>
|
|
889
|
+
<field name="arg">failed</field>
|
|
890
|
+
<field name="arg">--error</field>
|
|
891
|
+
<field name="arg">${error.message}</field>
|
|
892
|
+
</block>
|
|
893
|
+
</catch>
|
|
894
|
+
<catch on="script_error">
|
|
895
|
+
<block type="event" id="EH1-E2" action="log" level="error" desc="Script execution failed">
|
|
896
|
+
<field name="message">Script ${error.script} execution failed: ${error.message}</field>
|
|
897
|
+
</block>
|
|
898
|
+
</catch>
|
|
899
|
+
<catch on="stage_abort">
|
|
900
|
+
<block type="event" id="EH1-E3" action="log" level="error" desc="Stage aborted">
|
|
901
|
+
<field name="message">Stage ${error.stage} execution aborted: ${error.message}</field>
|
|
902
|
+
</block>
|
|
903
|
+
<block type="event" id="EH1-E4" action="log" level="warn" desc="High failure rate">
|
|
904
|
+
<field name="message">Failure rate exceeds 50%, terminating entire pipeline</field>
|
|
905
|
+
</block>
|
|
906
|
+
</catch>
|
|
907
|
+
</block>
|
|
908
|
+
|
|
909
|
+
<!-- ============================================================
|
|
910
|
+
Output Results
|
|
911
|
+
============================================================ -->
|
|
912
|
+
<block type="output" id="O1" desc="bizs knowledge base generation results">
|
|
913
|
+
<field name="platforms_processed" from="${platforms}" type="array" desc="List of processed platforms"/>
|
|
914
|
+
<field name="features_total" from="${all_features.length}" type="number" desc="Total Feature count"/>
|
|
915
|
+
<field name="features_success" from="${success_count}" type="number" desc="Successfully analyzed Feature count"/>
|
|
916
|
+
<field name="features_failed" from="${failed_count}" type="number" desc="Failed Feature count"/>
|
|
917
|
+
<field name="modules_summarized" from="${module_count}" type="number" desc="Summarized module count"/>
|
|
918
|
+
<field name="ui_patterns_extracted" from="${pattern_count}" type="number" desc="Extracted UI style pattern count"/>
|
|
919
|
+
<field name="system_summary" from="${system_summary.path}" type="string" desc="System summary file path"/>
|
|
920
|
+
<field name="graph_root" from="${graph_root}" type="string" desc="Graph data output directory"/>
|
|
921
|
+
</block>
|
|
922
|
+
</workflow>
|
|
341
923
|
|
|
342
924
|
---
|
|
343
925
|
|
|
344
|
-
##
|
|
926
|
+
## Appendix: Reference
|
|
345
927
|
|
|
346
|
-
|
|
928
|
+
### Skill Routing Table (Stage 2)
|
|
347
929
|
|
|
348
|
-
> **
|
|
349
|
-
|
|
350
|
-
**Skill Routing Table (by platformType):**
|
|
930
|
+
> **Note**: Detailed routing logic is defined in XML Stage 2 gateway (S2-G1).
|
|
351
931
|
|
|
352
932
|
| platformType | skill_name | Description |
|
|
353
933
|
|--------------|------------|-------------|
|
|
@@ -356,167 +936,22 @@ flowchart TB
|
|
|
356
936
|
| `desktop` | `speccrew-knowledge-bizs-ui-analyze` | Desktop apps (Electron/WPF) |
|
|
357
937
|
| `backend` | `speccrew-knowledge-bizs-api-analyze` | Backend APIs (Java/Python/Node.js) |
|
|
358
938
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
#### Execution Flow
|
|
362
|
-
|
|
363
|
-
Repeat the following 3 steps until all features are processed:
|
|
364
|
-
|
|
365
|
-
**Step 0: Ensure completed directory exists (MANDATORY)**
|
|
366
|
-
|
|
367
|
-
Before any Workers are dispatched by the calling Agent, you MUST ensure the `completed_dir` directory exists using Node.js (cross-platform compatible):
|
|
368
|
-
|
|
369
|
-
```bash
|
|
370
|
-
node -e "require('fs').mkdirSync('{completed_dir}', {recursive: true}); console.log('completed dir ready')"
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
> **Note**: Using Node.js ensures cross-platform compatibility (Windows/macOS/Linux).
|
|
374
|
-
|
|
375
|
-
> **⚠️ CRITICAL**: The `completed_dir` MUST be an **absolute path** (e.g., `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed`). Relative paths will cause Worker marker file writes to fail silently.
|
|
376
|
-
|
|
377
|
-
**Step 1: Get Next Batch**
|
|
378
|
-
|
|
379
|
-
1. **Execute get-batch**:
|
|
380
|
-
```
|
|
381
|
-
node "{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" get-batch --syncStatePath "{sync_state_bizs_dir}" --batchSize 5
|
|
382
|
-
```
|
|
383
|
-
- Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js`
|
|
384
|
-
- The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
|
|
385
|
-
|
|
386
|
-
- If output `action` is `"done"` → All features processed. Exit Stage 2, proceed to Stage 3.
|
|
387
|
-
- If output `action` is `"process"` → The `batch` array contains features to analyze. Proceed to Step 2.
|
|
388
|
-
|
|
389
|
-
**Step 2: Prepare Analysis Task Specifications**
|
|
390
|
-
|
|
391
|
-
> **NOTE**: Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
|
|
392
|
-
|
|
393
|
-
For each feature in the `batch` array, prepare a task specification:
|
|
394
|
-
- **Select skill** using the routing table at Stage 2 start
|
|
395
|
-
- **Task parameters**: Prepare all feature fields plus `language`, `completed_dir`, `sourceFile`, `skill_path`
|
|
396
|
-
- **Behavior constraint**: Workers MUST NOT create any temporary scripts
|
|
397
|
-
|
|
398
|
-
**Task Preparation sequence**:
|
|
399
|
-
1. Prepare ALL task specifications for the current batch
|
|
400
|
-
2. Output the task specifications to the calling Agent
|
|
401
|
-
3. The calling Agent will dispatch Workers based on these specifications
|
|
402
|
-
4. Each Worker writes `.done` and `.graph.json` marker files to `completed_dir` upon completion
|
|
403
|
-
|
|
404
|
-
> **NOTE**: This Skill does NOT dispatch analyze workers. The calling Agent (Team Leader) dispatches workers based on the prepared task specifications.
|
|
405
|
-
|
|
406
|
-
**Step 2.5: Graph Worker Task Preparation**
|
|
407
|
-
|
|
408
|
-
> **NOTE**: Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
|
|
409
|
-
|
|
410
|
-
After each analyze worker completes (writes `.done.json` marker), the calling Agent will dispatch the corresponding graph worker. This Skill prepares the task specifications:
|
|
411
|
-
|
|
412
|
-
| Analyze Worker | Graph Worker | Input |
|
|
413
|
-
|----------------|--------------|-------|
|
|
414
|
-
| `speccrew-knowledge-bizs-api-analyze` | `speccrew-knowledge-bizs-api-graph` | `documentPath` from analyze output |
|
|
415
|
-
| `speccrew-knowledge-bizs-ui-analyze` | `speccrew-knowledge-bizs-ui-graph` | `documentPath` from analyze output |
|
|
416
|
-
|
|
417
|
-
**Graph Worker Task Specification Format**:
|
|
418
|
-
|
|
419
|
-
**For API Graph Worker**:
|
|
420
|
-
```json
|
|
421
|
-
{
|
|
422
|
-
"skill_name": "speccrew-knowledge-bizs-api-graph",
|
|
423
|
-
"instructions": "Generate graph data nodes and edges from the analyzed API feature document.\\n\\nRequirements:\\n- Read the API analysis document at api_analysis_path\\n- Extract entities (APIs, services, tables, DTOs)\\n- Generate graph nodes and edges\\n- Write graph JSON to output_dir\\n- Create .graph-done.json completion marker at output_dir",
|
|
424
|
-
"context": {
|
|
425
|
-
"api_analysis_path": "<feature.documentPath>",
|
|
426
|
-
"platform_id": "<feature.platform_id>",
|
|
427
|
-
"output_dir": "<completed_dir_absolute_path>",
|
|
428
|
-
"workspace_path": "<workspace_path_absolute_path>",
|
|
429
|
-
"sync_state_bizs_dir": "<sync_state_bizs_dir_absolute_path>",
|
|
430
|
-
"module": "<feature.module>",
|
|
431
|
-
"fileName": "<feature.fileName>",
|
|
432
|
-
"sourcePath": "<feature.sourcePath>",
|
|
433
|
-
"sourceFile": "<feature.sourceFile>",
|
|
434
|
-
"language": "<user language>",
|
|
435
|
-
"subpath": "<computed_subpath_from_sourcePath>"
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
**For UI Graph Worker**:
|
|
441
|
-
```json
|
|
442
|
-
{
|
|
443
|
-
"skill_name": "speccrew-knowledge-bizs-ui-graph",
|
|
444
|
-
"instructions": "Generate graph data nodes and edges from the analyzed UI feature document.\\n\\nRequirements:\\n- Read the UI analysis document at documentPath\\n- Extract entities (pages, components, API calls, navigations)\\n- Generate graph nodes and edges\\n- Write graph JSON to completed_dir\\n- Create .graph-done.json completion marker at completed_dir",
|
|
445
|
-
"context": {
|
|
446
|
-
"feature": "<complete_feature_object>",
|
|
447
|
-
"fileName": "<feature.fileName>",
|
|
448
|
-
"sourcePath": "<feature.sourcePath>",
|
|
449
|
-
"documentPath": "<feature.documentPath>",
|
|
450
|
-
"module": "<feature.module>",
|
|
451
|
-
"platform_type": "<feature.platform_type>",
|
|
452
|
-
"platform_subtype": "<feature.platform_subtype>",
|
|
453
|
-
"completed_dir": "<completed_dir_absolute_path>",
|
|
454
|
-
"workspace_path": "<workspace_path_absolute_path>",
|
|
455
|
-
"sync_state_bizs_dir": "<sync_state_bizs_dir_absolute_path>",
|
|
456
|
-
"sourceFile": "<feature.sourceFile>",
|
|
457
|
-
"status": "<analysis_status>",
|
|
458
|
-
"analysisNotes": "<analysis_notes>",
|
|
459
|
-
"language": "<user language>"
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
**Task Preparation Sequence**:
|
|
465
|
-
1. Scan `completed_dir` for new `.done.json` files from Step 2
|
|
466
|
-
2. For each completed analyze worker, prepare corresponding graph worker task specification
|
|
467
|
-
3. Output the task specifications to the calling Agent
|
|
468
|
-
4. The calling Agent will dispatch graph workers based on these specifications
|
|
469
|
-
5. Each graph worker writes `.graph-done.json` marker to `completed_dir` upon completion
|
|
470
|
-
|
|
471
|
-
> **NOTE**: This Skill does NOT dispatch graph workers. The calling Agent (Team Leader) scans for `.done.json` markers and dispatches corresponding graph workers.
|
|
472
|
-
|
|
473
|
-
**Worker Task Prompt Format**:
|
|
474
|
-
|
|
475
|
-
```json
|
|
476
|
-
{
|
|
477
|
-
"skill_name": "speccrew-knowledge-bizs-ui-analyze",
|
|
478
|
-
"instructions": "请分析以下源代码文件,生成详细的功能文档。\n\n⚠️ CRITICAL - Template Fill-in Workflow (MANDATORY):\n1. First, copy the analysis template to documentPath (template structure = document skeleton)\n2. Then fill each Section using search_replace to replace placeholders with actual data\n3. NEVER use create_file to rewrite the entire document — this destroys template structure\n4. NEVER delete or skip any template Section — if no data available, fill with "N/A"\n5. NEVER create custom Section structures — use ONLY the template's predefined Sections\n\n要求:\n- 读取源代码文件,理解相关功能接口\n- 生成详细的文档到 documentPath\n- 创建两个标记文件到 completed_dir\n- 使用 {skill_name} 技能完成此任务",
|
|
479
|
-
"context": {
|
|
480
|
-
"fileName": "<feature.fileName>",
|
|
481
|
-
"sourcePath": "<feature.sourcePath>",
|
|
482
|
-
"module": "<feature.module>",
|
|
483
|
-
"documentPath": "<feature.documentPath>",
|
|
484
|
-
"platformType": "<feature.platformType>",
|
|
485
|
-
"platformSubtype": "<feature.platformSubtype>",
|
|
486
|
-
"language": "<user language>",
|
|
487
|
-
"completed_dir": "<completed_dir_absolute_path>",
|
|
488
|
-
"workspace_path": "<workspace_path_absolute_path>",
|
|
489
|
-
"sync_state_bizs_dir": "<sync_state_bizs_dir_absolute_path>",
|
|
490
|
-
"sourceFile": "<feature.sourceFile>"
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
```
|
|
939
|
+
---
|
|
494
940
|
|
|
495
|
-
|
|
941
|
+
### Platform Types
|
|
496
942
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
> "fileName": "<class name without extension>",
|
|
504
|
-
> "sourcePath": "<relative source file path>",
|
|
505
|
-
> "sourceFile": "<features JSON filename, e.g. features-backend-ai.json>",
|
|
506
|
-
> "module": "<business module name>",
|
|
507
|
-
> "status": "success|partial|failed",
|
|
508
|
-
> "analysisNotes": "<brief notes>"
|
|
509
|
-
> }
|
|
510
|
-
> ```
|
|
511
|
-
>
|
|
512
|
-
> ❌ **WRONG**: Writing plain text like "COMPLETED" or "Analysis done"
|
|
513
|
-
> ✅ **CORRECT**: Writing valid JSON with all required fields
|
|
943
|
+
| Platform Type | Platform Subtype | Description |
|
|
944
|
+
|---------------|------------------|-------------|
|
|
945
|
+
| `web` | `vue`, `react`, `angular` | Web frontend applications |
|
|
946
|
+
| `mobile` | `uniapp`, `flutter`, `react-native` | Mobile applications |
|
|
947
|
+
| `desktop` | `electron`, `wpf` | Desktop applications |
|
|
948
|
+
| `backend` | `spring`, `nodejs`, `python` | Backend services |
|
|
514
949
|
|
|
515
950
|
---
|
|
516
951
|
|
|
517
|
-
###
|
|
952
|
+
### Worker Completion Marker Format
|
|
518
953
|
|
|
519
|
-
####
|
|
954
|
+
#### Marker File Naming Convention
|
|
520
955
|
|
|
521
956
|
**Pattern**: `{module}-{subpath}-{fileName}.{type}.json`
|
|
522
957
|
|
|
@@ -528,376 +963,71 @@ After each analyze worker completes (writes `.done.json` marker), the calling Ag
|
|
|
528
963
|
| `type` | Marker type: `done`, `error`, or `skip` | `done` |
|
|
529
964
|
|
|
530
965
|
**Examples**:
|
|
966
|
+
|
|
531
967
|
| Source File Path | Marker File Name |
|
|
532
|
-
|
|
968
|
+
|------------------|------------------|
|
|
533
969
|
| `chat/ChatController.java` | `chat-ChatController.done.json` |
|
|
534
970
|
| `user/admin/UserController.java` | `user-admin-UserController.done.json` |
|
|
535
971
|
| `order/api/v2/OrderService.java` | `order-api-v2-OrderService.done.json` |
|
|
536
972
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
#### Full Path Format
|
|
542
|
-
|
|
543
|
-
**✅ CORRECT Format - MUST USE:**
|
|
544
|
-
```
|
|
545
|
-
{completed_dir}/{module}-{subpath}-{fileName}.done.json ← Completion status marker (JSON format)
|
|
546
|
-
{completed_dir}/{module}-{subpath}-{fileName}.graph.json ← Graph data marker (JSON format)
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
**Naming Rule Explanation:**
|
|
550
|
-
|
|
551
|
-
The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{fileName}` to prevent conflicts between same-named source files.
|
|
552
|
-
|
|
553
|
-
**How Workers Generate the Filename:**
|
|
973
|
+
#### .done.json Required Fields
|
|
554
974
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
**Examples:**
|
|
566
|
-
|
|
567
|
-
| Source File | module | subpath | fileName | Marker Filename |
|
|
568
|
-
|-------------|--------|---------|----------|-----------------|
|
|
569
|
-
| `yudao-ui/.../views/system/notify/message/index.vue` | `system` | `notify-message` | `index` | `system-notify-message-index.done.json` |
|
|
570
|
-
| `yudao-ui/.../views/system/user/index.vue` | `system` | `user` | `index` | `system-user-index.done.json` |
|
|
571
|
-
| `yudao-module-system/.../controller/admin/user/UserController.java` | `system` | `controller-admin-user` | `UserController` | `system-controller-admin-user-UserController.done.json` |
|
|
572
|
-
|
|
573
|
-
**Full Path Examples:**
|
|
574
|
-
- `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-notify-message-index.done.json`
|
|
575
|
-
- `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-user-UserController.graph.json`
|
|
576
|
-
|
|
577
|
-
**❌ WRONG Format - NEVER USE:**
|
|
578
|
-
```
|
|
579
|
-
{fileName}.done.json ← WRONG: missing module and subpath (causes conflicts)
|
|
580
|
-
{fileName}.graph.json ← WRONG: missing module and subpath (causes conflicts)
|
|
581
|
-
{fileName}.completed.json ← WRONG extension
|
|
582
|
-
{fileName}.done ← WRONG extension (missing .json)
|
|
583
|
-
{fileName}_done.json ← WRONG separator and extension
|
|
975
|
+
```json
|
|
976
|
+
{
|
|
977
|
+
"fileName": "<class name without extension>",
|
|
978
|
+
"sourcePath": "<relative source file path>",
|
|
979
|
+
"sourceFile": "<features JSON filename, e.g. features-backend-ai.json>",
|
|
980
|
+
"module": "<business module name>",
|
|
981
|
+
"status": "success|partial|failed",
|
|
982
|
+
"analysisNotes": "<brief notes>"
|
|
983
|
+
}
|
|
584
984
|
```
|
|
585
985
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
- `UserController.done.json` - WRONG: missing module and subpath (conflicts with other controllers)
|
|
589
|
-
- `UserController.completed.json` - WRONG: uses `.completed.json` instead of `.done.json`
|
|
590
|
-
- `UserController_done.json` - WRONG: uses underscore and wrong extension
|
|
986
|
+
> WRONG: Writing plain text like "COMPLETED" or "Analysis done"
|
|
987
|
+
> CORRECT: Writing valid JSON with all required fields
|
|
591
988
|
|
|
592
989
|
---
|
|
593
990
|
|
|
594
|
-
###
|
|
595
|
-
|
|
596
|
-
**Path Variables:**
|
|
597
|
-
- `completed_dir` - Absolute path to marker files directory (passed to Worker)
|
|
598
|
-
- `sourcePath` - Relative path to source file (from features JSON, passed to Worker)
|
|
599
|
-
- `documentPath` - Relative path to generated document (from features JSON, passed to Worker)
|
|
600
|
-
|
|
601
|
-
**Path Format Requirements:**
|
|
991
|
+
### Batch Processing Details
|
|
602
992
|
|
|
603
|
-
|
|
604
|
-
|-------|--------|---------|
|
|
605
|
-
| `sourcePath` in `.done` | Project-root-relative path | `yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java` |
|
|
606
|
-
| `documentPath` in `.done` | Relative path (as-is from input) | `speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md` |
|
|
607
|
-
| `sourcePath` in `.graph.json` nodes | Project-root-relative path | `yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java` |
|
|
608
|
-
| `documentPath` in `.graph.json` nodes | Relative path (as-is from input) | `speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md` |
|
|
993
|
+
#### get-batch Script Output Format
|
|
609
994
|
|
|
610
|
-
**⚠️ CRITICAL - sourcePath Validation Rules:**
|
|
611
|
-
- `sourcePath` MUST be a project-root-relative path (e.g., `yudao-ui/yudao-ui-admin-uniapp/src/pages/bpm/index.vue`, `yudao-module-system/src/main/java/.../UserController.java`)
|
|
612
|
-
- NEVER use platform-source-relative short paths (e.g., `pages/bpm/index.vue`, `pages-bpm/category/index.vue`, `controller/admin/user/UserController.java`)
|
|
613
|
-
- Exception: `node_modules/` and third-party library paths are kept as-is (e.g., `node_modules/wot-design-uni/components/wd-icon/wd-icon.vue`)
|
|
614
|
-
|
|
615
|
-
**⚠️ CRITICAL - documentPath Rules:**
|
|
616
|
-
- When no corresponding document exists for a component/API, `documentPath` MUST be `"N/A"`
|
|
617
|
-
- NEVER use empty string `""` for `documentPath` — this causes downstream processing issues
|
|
618
|
-
|
|
619
|
-
**⚠️ CRITICAL: NEVER convert relative paths to absolute paths in the JSON content!**
|
|
620
|
-
|
|
621
|
-
**Correct vs Wrong Example:**
|
|
622
995
|
```json
|
|
623
|
-
// ✅ CORRECT - .done file content:
|
|
624
|
-
{
|
|
625
|
-
"fileName": "UserController",
|
|
626
|
-
"sourcePath": "yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java",
|
|
627
|
-
"sourceFile": "features-admin-api.json",
|
|
628
|
-
"module": "system",
|
|
629
|
-
"status": "success",
|
|
630
|
-
"analysisNotes": "Successfully analyzed UserController"
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// ❌ WRONG - .done file content (DO NOT DO THIS):
|
|
634
996
|
{
|
|
635
|
-
"
|
|
636
|
-
"
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
997
|
+
"action": "process|done",
|
|
998
|
+
"batch": [
|
|
999
|
+
{
|
|
1000
|
+
"id": "feature-001",
|
|
1001
|
+
"fileName": "UserController",
|
|
1002
|
+
"sourcePath": "controller/admin/user/UserController.java",
|
|
1003
|
+
"module": "user",
|
|
1004
|
+
"documentPath": "speccrew-workspace/knowledges/bizs/backend-system/user/UserController.md",
|
|
1005
|
+
"platformType": "backend",
|
|
1006
|
+
"platformSubtype": "spring",
|
|
1007
|
+
"platformId": "backend-system",
|
|
1008
|
+
"sourceFile": "features-backend-system.json"
|
|
1009
|
+
}
|
|
1010
|
+
]
|
|
640
1011
|
}
|
|
641
1012
|
```
|
|
642
1013
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
**Marker File Naming Convention Summary:**
|
|
1014
|
+
#### process-results Script Behavior
|
|
646
1015
|
|
|
647
|
-
> **Reference**: See [Marker File Naming Convention Formula](#critical---marker-file-naming-convention-strict-rules) for the complete formula and examples.
|
|
648
|
-
> **Implementation**: `getMarkerFileName()` in `workspace-template/scripts/path-utils.js`
|
|
649
|
-
|
|
650
|
-
| Marker Type | File Name Format | Example |
|
|
651
|
-
|-------------|------------------|---------|
|
|
652
|
-
| Completion marker | `{module}-{subpath}-{fileName}.done.json` | `system-notify-message-index.done.json`, `system-controller-admin-user-UserController.done.json` |
|
|
653
|
-
| Graph data | `{module}-{subpath}-{fileName}.graph.json` | `system-notify-message-index.graph.json`, `system-controller-admin-user-UserController.graph.json` |
|
|
654
|
-
|
|
655
|
-
**Worker Completion Requirements:**
|
|
656
|
-
|
|
657
|
-
- Worker MUST create **both** `.done.json` (JSON) and `.graph.json` (JSON) marker files
|
|
658
|
-
- **Both files must be valid JSON format** — plain text content will cause processing failures
|
|
659
|
-
- Task is considered **incomplete** if either file is missing or contains invalid JSON
|
|
660
|
-
- The `.done.json` file must include all required fields: `fileName`, `sourcePath`, `sourceFile`, `module`, `status`, `analysisNotes`
|
|
661
|
-
- The `.graph.json` file must follow the graph data schema defined in `speccrew-knowledge-graph-write/SKILL.md`
|
|
662
|
-
- **sourcePath and documentPath MUST be relative paths** (as received from features JSON), NEVER convert to absolute paths
|
|
663
|
-
- **documentPath MUST NOT be empty string** — use `"N/A"` when no corresponding document exists
|
|
664
|
-
|
|
665
|
-
**Step 3: Process Batch Results**
|
|
666
|
-
|
|
667
|
-
1. **Execute process-results**:
|
|
668
|
-
```
|
|
669
|
-
node "{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" process-results --syncStatePath "{sync_state_bizs_dir}" --graphRoot "{graph_root}" --platformId "{platformId}"
|
|
670
|
-
```
|
|
671
|
-
- Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js`
|
|
672
|
-
- The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
|
|
673
|
-
|
|
674
|
-
This script:
|
|
675
1016
|
- Scans `.done.json` files → updates feature status to `completed` in features-*.json
|
|
676
|
-
- Scans `.graph-done.json` files → confirms graph data generation
|
|
1017
|
+
- Scans `.graph-done.json` files → confirms graph data generation complete
|
|
677
1018
|
- Scans `.graph.json` files → writes graph data (nodes + edges) grouped by module
|
|
678
1019
|
- Cleans up all marker files
|
|
679
1020
|
|
|
680
|
-
After Step 3 completes, return to Step 1.
|
|
681
|
-
|
|
682
|
-
#### Context Recovery (Stateless Design)
|
|
683
|
-
|
|
684
|
-
Dispatch 采用完全无状态的文件驱动设计。如果执行过程中发生上下文压缩或中断:
|
|
685
|
-
- 无需记忆任何批次状态或 Worker 输出
|
|
686
|
-
- 重新执行循环:`get-batch` 会自动从文件状态恢复,跳过已完成和正在处理中的 features
|
|
687
|
-
- `process-results` 会处理所有未清理的标记文件
|
|
688
|
-
- 整个流程可安全重入
|
|
689
|
-
|
|
690
|
-
#### Stage 2 Output
|
|
691
|
-
|
|
692
|
-
- Generated by Analyze Workers: Feature documentation at `feature.documentPath` (one .md per feature); marker files (`.done.json`) in `completed_dir`
|
|
693
|
-
- Generated by Graph Workers: Graph data files (`.graph.json`) in `completed_dir`; consolidated graph data in `{workspace_path}/knowledges/bizs/graph/`
|
|
694
|
-
- Updated by `process-results`: Each `features-{platform}.json` updated with analysis timestamps and status
|
|
695
|
-
- Marker files cleaned up after each batch
|
|
696
|
-
|
|
697
|
-
**Stage 2 Completion Condition**: ALL analyze workers AND ALL graph workers completed (both `.done.json` and `.graph-done.json` markers present)
|
|
698
|
-
|
|
699
|
-
**Feature Status Flow**: `pending` → `in_progress` → `completed` / `failed`
|
|
700
|
-
|
|
701
|
-
### Large-Scale Scenario Guidance
|
|
702
|
-
|
|
703
|
-
When dealing with modules containing more than **20 features**, consider the following:
|
|
704
|
-
|
|
705
|
-
- **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.
|
|
706
|
-
- **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 (e.g., by batch index range).
|
|
707
|
-
- **Resume Support**: The `get-next-batch` script naturally supports resume across sessions — it skips features that already have `.done` files. To resume after a session break, simply restart the Stage 2 loop.
|
|
708
|
-
- **Validation After Completion**: After all features are marked `analyzed=true`, run `process-batch-results` with `--validateDocs --syncStatePath "{sync_state_path}"` to verify document completeness.
|
|
709
|
-
|
|
710
|
-
> ✅ **Stage 2 Milestone**: Feature analysis complete. {analyzed_count} features analyzed, {failed_count} failed. {graph_count} graph data files generated. → Proceed to Stage 3.
|
|
711
|
-
|
|
712
|
-
---
|
|
713
|
-
|
|
714
|
-
## Stage 3: Module Summarize (Task Preparation)
|
|
715
|
-
|
|
716
|
-
> **NOTE**: Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
|
|
717
|
-
|
|
718
|
-
**Goal**: Prepare task specifications for each module overview based on feature details.
|
|
719
|
-
|
|
720
|
-
**Prerequisite**: Stage 2 completed for the module (in full or incremental mode).
|
|
721
|
-
|
|
722
|
-
**Action (full mode)**:
|
|
723
|
-
- Read all `features-{platform}.json` files from `{sync_state_bizs_dir}/`
|
|
724
|
-
- For each platform, group features by `module` to identify unique modules
|
|
725
|
-
- For each module, prepare a task specification for `skill_name: speccrew-knowledge-module-summarize`
|
|
726
|
-
- Parameters to include in task specification:
|
|
727
|
-
- `module_name`: Module code_name
|
|
728
|
-
- `module_path`: Path to module directory (e.g., `{workspace_path}/knowledges/bizs/{platform_id}/{module_name}/`)
|
|
729
|
-
- `workspace_path`: Absolute path to speccrew-workspace directory — **REQUIRED**
|
|
730
|
-
- `sync_state_bizs_dir`: Absolute path to sync-state/knowledge-bizs directory — **REQUIRED**
|
|
731
|
-
- `language`: User's language — **REQUIRED**
|
|
732
|
-
- **Behavior constraint**: Workers MUST NOT create any temporary scripts or workaround files
|
|
733
|
-
|
|
734
|
-
**Action (incremental mode)**:
|
|
735
|
-
- Reuse module status from Stage 2 (NEW / CHANGED / DELETED / UNMODIFIED).
|
|
736
|
-
- Only prepare task specifications for modules with status **NEW** or **CHANGED**.
|
|
737
|
-
|
|
738
|
-
**Task Specifications** (grouped by platform):
|
|
739
|
-
```
|
|
740
|
-
Platform: Web Frontend (web)
|
|
741
|
-
Task 1: module="order", module_path="speccrew-workspace/knowledges/bizs/web/order/"
|
|
742
|
-
Task 2: module="payment", module_path="speccrew-workspace/knowledges/bizs/web/payment/"
|
|
743
|
-
|
|
744
|
-
Platform: Mobile App (mobile-flutter)
|
|
745
|
-
Task 3: module="order", module_path="speccrew-workspace/knowledges/bizs/mobile-flutter/order/"
|
|
746
|
-
Task 4: module="payment", module_path="speccrew-workspace/knowledges/bizs/mobile-flutter/payment/"
|
|
747
|
-
```
|
|
748
|
-
|
|
749
|
-
> **NOTE**: This Skill does NOT dispatch module summarize workers. The calling Agent (Team Leader) dispatches workers based on the prepared task specifications.
|
|
750
|
-
|
|
751
|
-
**Output per Module**:
|
|
752
|
-
- `{{module_name}}-overview.md` (complete version)
|
|
753
|
-
|
|
754
|
-
---
|
|
755
|
-
|
|
756
|
-
## Stage 3.5: UI Style Pattern Extract (Task Preparation)
|
|
757
|
-
|
|
758
|
-
> **NOTE**: Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
|
|
759
|
-
|
|
760
|
-
**Goal**: Prepare task specifications for extracting UI design patterns (page types, component patterns, layout patterns) from analyzed feature documents.
|
|
761
|
-
|
|
762
|
-
**Prerequisite**: All Stage 3 tasks completed.
|
|
763
|
-
|
|
764
|
-
**Platform Filter**: Only execute for frontend platforms (platformType = web, mobile, desktop). Backend platforms skip this stage.
|
|
765
|
-
|
|
766
|
-
**Directory Creation**: The `ui-style-extract` skill automatically creates the output directory (`{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/`) if it does not exist. No pre-check required.
|
|
767
|
-
|
|
768
|
-
**Action**:
|
|
769
|
-
- Read all `features-{platform}.json` files from `{sync_state_bizs_dir}/`
|
|
770
|
-
- Filter platforms where platformType is web/mobile/desktop
|
|
771
|
-
- Determine platform_id (format: `{platformType}-{platformSubtype}`, e.g., `web-vue`, `mobile-uniapp`, `backend-system`)
|
|
772
|
-
- For each qualifying platform, prepare a task specification for `skill_name: speccrew-knowledge-bizs-ui-style-extract`
|
|
773
|
-
- Parameters to include in task specification:
|
|
774
|
-
- `platform_id`: Platform identifier
|
|
775
|
-
- `platform_type`: Platform type
|
|
776
|
-
- `feature_docs_path`: Feature document base path for that platform (e.g., `{workspace_path}/knowledges/bizs/{platform_id}`)
|
|
777
|
-
- `features_manifest_path`: Path to the corresponding `{sync_state_bizs_dir}/features-{platform}.json`
|
|
778
|
-
- `module_overviews_path`: **Parent directory** containing all module overview subdirectories for that platform (e.g., `{workspace_path}/knowledges/bizs/web-vue/`). This directory contains `{module}/module-overview.md` or `{module}/{module}-overview.md` files. **NOT** a specific module directory.
|
|
779
|
-
- `output_path`: `{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/`
|
|
780
|
-
- `workspace_path`: Absolute path to speccrew-workspace directory — **REQUIRED**
|
|
781
|
-
- `sync_state_bizs_dir`: Absolute path to sync-state/knowledge-bizs directory — **REQUIRED**
|
|
782
|
-
- `language`: User's language
|
|
783
|
-
- **Behavior constraint**: Workers MUST NOT create any temporary scripts or workaround files
|
|
784
|
-
|
|
785
|
-
**Cross-Pipeline Output**:
|
|
786
|
-
- This stage writes to techs knowledge base, not bizs knowledge base
|
|
787
|
-
- Output location: `speccrew-workspace/knowledges/techs/{platform_id}/ui-style-patterns/`
|
|
788
|
-
- Subdirectories: `page-types/`, `components/`, `layouts/`
|
|
789
|
-
- `ui-style-guide.md` and `styles/` are managed by techs pipeline, this stage does not modify them
|
|
790
|
-
|
|
791
|
-
**Task Specifications**: One task specification per frontend platform.
|
|
792
|
-
|
|
793
|
-
> **NOTE**: This Skill does NOT dispatch UI style extract workers. The calling Agent (Team Leader) dispatches workers based on the prepared task specifications.
|
|
794
|
-
|
|
795
|
-
**Output per Platform**:
|
|
796
|
-
```
|
|
797
|
-
{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/
|
|
798
|
-
├── page-types/
|
|
799
|
-
│ └── {pattern-name}.md
|
|
800
|
-
├── components/
|
|
801
|
-
│ └── {pattern-name}.md
|
|
802
|
-
└── layouts/
|
|
803
|
-
└── {pattern-name}.md
|
|
804
|
-
```
|
|
805
|
-
|
|
806
|
-
> ✅ **Stage 3 & 3.5 Milestone**: Module summaries and UI style patterns complete. {module_count} modules summarized, {pattern_count} patterns extracted. → Proceed to Stage 4.
|
|
807
|
-
|
|
808
|
-
---
|
|
809
|
-
|
|
810
|
-
## Stage 4: System Summarize (Task Preparation)
|
|
811
|
-
|
|
812
|
-
> **NOTE**: Worker dispatch is handled by the calling Agent (Team Leader). This Skill only prepares the task plan and parameters.
|
|
813
|
-
|
|
814
|
-
**Goal**: Prepare task specification for generating complete system-overview.md aggregating all platforms and modules.
|
|
815
|
-
|
|
816
|
-
**Prerequisite**: All Stage 3 tasks completed.
|
|
817
|
-
|
|
818
|
-
**Action**:
|
|
819
|
-
- Read all `features-{platform}.json` files from `{sync_state_bizs_dir}/` to get platform structure
|
|
820
|
-
- Prepare a task specification for `skill_name: speccrew-knowledge-system-summarize`
|
|
821
|
-
- Parameters to include in task specification:
|
|
822
|
-
- `modules_path`: Path to knowledge base directory containing all platform modules (e.g., `{workspace_path}/knowledges/bizs/`)
|
|
823
|
-
- `output_path`: Output path for system-overview.md (e.g., `{workspace_path}/knowledges/bizs/`)
|
|
824
|
-
- `workspace_path`: Absolute path to speccrew-workspace directory — **REQUIRED**
|
|
825
|
-
- `sync_state_bizs_dir`: Absolute path to sync-state/knowledge-bizs directory — **REQUIRED**
|
|
826
|
-
- `language`: User's language — **REQUIRED**
|
|
827
|
-
- **Behavior constraint**: Workers MUST NOT create any temporary scripts or workaround files
|
|
828
|
-
|
|
829
|
-
> **NOTE**: This Skill does NOT dispatch system summarize workers. The calling Agent (Team Leader) dispatches workers based on the prepared task specification.
|
|
830
|
-
|
|
831
|
-
**Output**:
|
|
832
|
-
- `{workspace_path}/knowledges/bizs/system-overview.md` (complete with platform index and module hierarchy)
|
|
833
|
-
|
|
834
|
-
> ✅ **Stage 4 Milestone**: System overview generated. All stages complete. Pipeline finished successfully.
|
|
835
|
-
|
|
836
1021
|
---
|
|
837
1022
|
|
|
838
|
-
|
|
1023
|
+
### Stateless Design
|
|
839
1024
|
|
|
840
|
-
|
|
841
|
-
|-------|-----------------|----------|-------|
|
|
842
|
-
| Stage 1a | Entry directory recognition fails | Abort pipeline, report error with platform details | No retry |
|
|
843
|
-
| Stage 1b | Script execution fails | Abort pipeline, report error | No retry |
|
|
844
|
-
| Stage 2 | Single Worker fails | Mark feature as `failed`, continue other Workers | No auto-retry |
|
|
845
|
-
| Stage 2 | Failure rate > 50% | Abort pipeline, report all failures | — |
|
|
846
|
-
| Stage 3 | Single Worker fails | Skip that module, continue others | Retry once |
|
|
847
|
-
| Stage 3.5 | Continue pipeline even if pattern extraction fails; report warning | — | — |
|
|
848
|
-
| Stage 4 | Worker fails | Abort, preserve all generated content | Retry once |
|
|
849
|
-
|
|
850
|
-
**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.
|
|
1025
|
+
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.
|
|
851
1026
|
|
|
852
1027
|
---
|
|
853
1028
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
Upon completing all stages, output the following structured report:
|
|
857
|
-
|
|
858
|
-
```json
|
|
859
|
-
{
|
|
860
|
-
"status": "success | partial | failed",
|
|
861
|
-
"skill": "speccrew-knowledge-bizs-dispatch",
|
|
862
|
-
"stages_completed": ["stage_0", "stage_1", "stage_2", "stage_3", "stage_4"],
|
|
863
|
-
"stages_failed": [],
|
|
864
|
-
"output_summary": {
|
|
865
|
-
"platforms_processed": ["frontend", "backend"],
|
|
866
|
-
"features_analyzed": 32,
|
|
867
|
-
"modules_summarized": 8,
|
|
868
|
-
"system_overview_generated": true
|
|
869
|
-
},
|
|
870
|
-
"output_files": [
|
|
871
|
-
"knowledges/bizs/{platform}/features/",
|
|
872
|
-
"knowledges/bizs/{platform}/modules/",
|
|
873
|
-
"knowledges/bizs/system-overview.md"
|
|
874
|
-
],
|
|
875
|
-
"errors": [],
|
|
876
|
-
"next_steps": ["Initialize techs knowledge base"]
|
|
877
|
-
}
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
---
|
|
1029
|
+
### Large-Scale Scenario Guidance
|
|
881
1030
|
|
|
882
|
-
|
|
1031
|
+
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.
|
|
883
1032
|
|
|
884
|
-
After all 5 stages complete, return a summary object to the caller:
|
|
885
1033
|
|
|
886
|
-
```json
|
|
887
|
-
{
|
|
888
|
-
"status": "completed",
|
|
889
|
-
"pipeline": "bizs",
|
|
890
|
-
"stages": {
|
|
891
|
-
"stage1a": { "status": "completed", "platforms": 2, "modules": 12 },
|
|
892
|
-
"stage1b": { "status": "completed", "platforms": 2, "features": 32 },
|
|
893
|
-
"stage2": { "status": "completed", "analyzed": 32, "failed": 0, "graphWritten": 32 },
|
|
894
|
-
"stage3": { "status": "completed", "modules": 8, "failed": 0 },
|
|
895
|
-
"stage3_5": { "status": "completed", "platforms": 2, "patterns": 15 },
|
|
896
|
-
"stage4": { "status": "completed" }
|
|
897
|
-
},
|
|
898
|
-
"output": {
|
|
899
|
-
"system_overview": "{workspace_path}/knowledges/bizs/system-overview.md",
|
|
900
|
-
"graph_root": "{workspace_path}/knowledges/bizs/graph/"
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
```
|