speccrew 0.6.11 → 0.6.13

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.
@@ -1,18 +1,20 @@
1
1
  ---
2
2
  name: speccrew-pm-module-initializer
3
- description: Initialize knowledge base for a single business module by analyzing its features. Dispatches api-analyze or ui-analyze based on platform type, then generates module summary. Used by Worker Agent, invoked by PM Agent for on-demand module initialization.
3
+ description: Generate analyze task plan for a single business module. Reads features-*.json, filters matched module's pending features, and outputs a task plan JSON (list of features to analyze with analyzer parameters). Used by Worker Agent, invoked by PM Agent for on-demand module task planning.
4
4
  tools: Read, Write, Skill, Bash
5
5
  ---
6
6
 
7
- # Module Initializer
7
+ # Module Initializer (Task Plan Generator)
8
8
 
9
- Initialize knowledge base for a single business module by analyzing its features. Dispatches api-analyze or ui-analyze based on platform type, then generates module summary. Used by Worker Agent, invoked by PM Agent for on-demand module initialization.
9
+ Generate analyze task plan for a single business module. Reads features-*.json, filters matched module's pending features, and outputs a task plan JSON (list of features to analyze with analyzer parameters). Used by Worker Agent, invoked by PM Agent for on-demand module task planning.
10
+
11
+ > **Positioning**: Task plan generator for PM phase. Generates task list for PM Agent to orchestrate. Does NOT execute analyze or summarize directly — PM Agent handles Worker dispatch based on task plan output.
10
12
 
11
13
  ## Language Adaptation
12
14
 
13
15
  **CRITICAL**: Generate all content in the language specified by the `language` parameter.
14
16
 
15
- - `language: "zh"` → Generate all content in 中文
17
+ - `language: "zh"` → Generate all content in Chinese
16
18
  - `language: "en"` → Generate all content in English
17
19
  - Other languages → Use the specified language
18
20
 
@@ -20,47 +22,66 @@ Initialize knowledge base for a single business module by analyzing its features
20
22
 
21
23
  ## Trigger Scenarios
22
24
 
23
- - "Initialize module {name}"
24
- - "Deep analyze module {name}"
25
- - "Generate knowledge for module {name}"
26
- - "Start module analysis"
25
+ - "Generate task plan for module {name}"
26
+ - "Plan module {name} initialization"
27
+ - "List pending features for module {name}"
27
28
 
28
29
  ## Input
29
30
 
30
31
  | Parameter | Type | Required | Description |
31
32
  |-----------|------|----------|-------------|
32
- | `source_path` | string | Yes | 项目源码根路径 |
33
- | `module_name` | string | Yes | 模块名称 |
34
- | `platform_id` | string | Yes | 平台 ID (e.g., "web-vue3", "admin-api") |
33
+ | `source_path` | string | Yes | Project source code root path |
34
+ | `module_name` | string | Yes | Module name |
35
+ | `platform_id` | string | Yes | Platform ID (e.g., "web-vue", "admin-api") |
35
36
  | `platform_type` | string | Yes | web / mobile / backend / desktop |
36
37
  | `platform_subtype` | string | No | Platform subtype (e.g., "vue", "spring-boot") |
37
38
  | `tech_stack` | array | No | Platform tech stack (e.g., ["java", "spring-boot"]) |
38
- | `features_file` | string | Yes | 该平台的 features-{platform}.json 路径 |
39
- | `output_path` | string | Yes | 知识库输出根路径 (e.g., speccrew-workspace/knowledges) |
40
- | `language` | string | Yes | 输出语言 (zh / en) |
39
+ | `features_file` | string | Yes | Path to the platform's features-{platform}.json file |
40
+ | `output_path` | string | Yes | Knowledge base output root path (e.g., speccrew-workspace/knowledges) |
41
+ | `completed_dir` | string | Yes | Marker file output directory for api-analyze .done.json markers. Value from PM Agent: `{sync_state_bizs_dir}/completed` |
42
+ | `sourceFile` | string | Yes | Features JSON filename (e.g., "features-backend-system.json"), used for api-analyze marking |
43
+ | `language` | string | Yes | Output language (zh / en) |
44
+ | `workspace_path` | string | Yes | Workspace root path for constructing absolute paths |
41
45
 
42
46
  ## Output JSON
43
47
 
44
48
  ```json
45
49
  {
46
- "status": "success | partial | failed",
47
50
  "module_name": "system",
48
- "platform_id": "web-vue3",
49
- "features_analyzed": 12,
50
- "features_failed": 0,
51
- "output_dir": "speccrew-workspace/knowledges/bizs/web-vue3/system/",
52
- "overview_file": "system-overview.md",
53
- "errors": []
51
+ "platform_id": "web-vue",
52
+ "analyzer_skill": "speccrew-knowledge-bizs-ui-analyze",
53
+ "tasks": [
54
+ {
55
+ "fileName": "index",
56
+ "sourcePath": "src/views/system/user/index.vue",
57
+ "documentPath": "knowledges/bizs/web-vue/system/features",
58
+ "module": "system",
59
+ "platform_type": "web",
60
+ "platform_subtype": "vue",
61
+ "tech_stack": ["vue", "typescript"],
62
+ "language": "zh"
63
+ }
64
+ ],
65
+ "total_pending": 90,
66
+ "summarize_params": {
67
+ "skill": "speccrew-knowledge-module-summarize",
68
+ "module_name": "system",
69
+ "module_path": "knowledges/bizs/web-vue/system",
70
+ "language": "zh"
71
+ }
54
72
  }
55
73
  ```
56
74
 
57
- **Status Definitions**:
75
+ **Field Definitions**:
58
76
 
59
- | Status | Condition |
60
- |--------|-----------|
61
- | `success` | All features analyzed successfully, overview generated |
62
- | `partial` | Some features analyzed or overview generated with warnings |
63
- | `failed` | No features analyzed or critical error occurred |
77
+ | Field | Description |
78
+ |-------|-------------|
79
+ | `module_name` | Module being processed |
80
+ | `platform_id` | Platform identifier |
81
+ | `analyzer_skill` | Selected analyzer skill name |
82
+ | `tasks` | Array of pending features to analyze |
83
+ | `total_pending` | Count of pending features |
84
+ | `summarize_params` | Parameters for module-summarize skill (to be executed after all analyze tasks complete) |
64
85
 
65
86
  ## Workflow
66
87
 
@@ -68,9 +89,9 @@ Initialize knowledge base for a single business module by analyzing its features
68
89
  flowchart TD
69
90
  Start([Start]) --> Step1[Step 1: Read and filter features]
70
91
  Step1 --> Step2[Step 2: Select analyzer by platform_type]
71
- Step2 --> Step3[Step 3: Analyze each pending feature]
72
- Step3 --> Step4[Step 4: Generate module summary]
73
- Step4 --> Step5[Step 5: Return result]
92
+ Step2 --> Step3[Step 3: Build task list]
93
+ Step3 --> Step4[Step 4: Build summarize params]
94
+ Step4 --> Step5[Step 5: Output task plan JSON]
74
95
  Step5 --> End([End])
75
96
  ```
76
97
 
@@ -83,7 +104,6 @@ flowchart TD
83
104
  3. **Record counts**:
84
105
  - Total features for this module
85
106
  - Pending features (analyzed = false)
86
- - If no pending features found, skip to Step 4 (still generate/update module summary)
87
107
 
88
108
  **Output**: "Step 1 Status: ✅ COMPLETED - Found {total} total features, {pending} pending for analysis"
89
109
 
@@ -100,82 +120,74 @@ Based on `platform_type`, select the appropriate analyzer Skill:
100
120
 
101
121
  **Output**: "Step 2 Status: ✅ COMPLETED - Selected analyzer: {skill_name}"
102
122
 
103
- ### Step 3: Analyze Each Pending Feature
123
+ ### Step 3: Build Task List
104
124
 
105
125
  **Step 3 Status: 🔄 IN PROGRESS**
106
126
 
107
- For each pending feature, invoke the selected analyzer Skill.
108
-
109
- **Important**: Process features sequentially (not parallel) since this Skill runs inside a single Worker Agent. The PM Agent handles parallelism at the module level (multiple Workers for different modules).
110
-
111
- #### Input Variables Preparation
127
+ For each pending feature from Step 1, build a task object with analyzer parameters.
112
128
 
113
- Prepare input variables matching the analyzer Skill's Input Variables format:
129
+ > 🛑 **IMPORTANT**: This Skill does NOT execute analyze. It ONLY generates the task list. PM Agent will dispatch Workers based on this task plan.
114
130
 
115
- | Variable | Value Source |
116
- |----------|--------------|
117
- | `feature` | The complete feature object from features.json |
118
- | `fileName` | feature's fileName field |
119
- | `sourcePath` | feature's sourcePath field |
120
- | `documentPath` | Computed as `{output_path}/bizs/{platform_id}/{module_name}/{fileName}.md` |
121
- | `module` | module_name |
122
- | `analyzed` | false |
123
- | `platform_type` | From input |
124
- | `platform_subtype` | From input (if available) |
125
- | `tech_stack` | From input (if available) |
126
- | `language` | From input |
127
- | `completed_dir` | `{output_path}/base/sync-state/knowledge-bizs/completed/` |
128
- | `sourceFile` | Features JSON filename (e.g., "features-web-vue3.json") |
131
+ #### Task object structure for each pending feature:
129
132
 
130
- #### Execution for Each Feature
133
+ ```json
134
+ {
135
+ "fileName": "{feature.fileName}",
136
+ "sourcePath": "{feature.sourcePath}",
137
+ "documentPath": "{output_path}/bizs/{platform_id}/{feature.module}/features",
138
+ "module": "{feature.module}",
139
+ "platform_type": "{platform_type}",
140
+ "platform_subtype": "{platform_subtype}",
141
+ "tech_stack": "{tech_stack}",
142
+ "language": "{language}"
143
+ }
144
+ ```
131
145
 
132
- 1. Invoke the selected analyzer Skill with prepared parameters
133
- 2. Track success/failure count
134
- 3. On success, update the feature's `analyzed` field to `true` in features_file
146
+ For backend features (api-analyze), also include:
147
+ ```json
148
+ {
149
+ "completed_dir": "{completed_dir}",
150
+ "sourceFile": "{sourceFile}"
151
+ }
152
+ ```
135
153
 
136
- **Output**: "Step 3 Status: ✅ COMPLETED - Analyzed {success} features, {failed} failed"
154
+ **Output**: "Step 3 Status: ✅ COMPLETED - Built {count} task entries"
137
155
 
138
- ### Step 4: Generate Module Summary
156
+ ### Step 4: Build Summarize Parameters
139
157
 
140
158
  **Step 4 Status: 🔄 IN PROGRESS**
141
159
 
142
- Invoke `speccrew-knowledge-module-summarize` Skill to generate/update the module overview document.
143
-
144
- **Input Parameters**:
160
+ Build the summarize_params object for module-summarize skill. This will be used by PM Agent after all analyze tasks complete.
145
161
 
146
- | Variable | Value |
147
- |----------|-------|
148
- | `module_name` | module_name |
149
- | `module_path` | `{output_path}/bizs/{platform_id}/{module_name}/` |
150
- | `language` | From input |
162
+ ```json
163
+ {
164
+ "skill": "speccrew-knowledge-module-summarize",
165
+ "module_name": "{module_name}",
166
+ "module_path": "{output_path}/bizs/{platform_id}/{module_name}",
167
+ "language": "{language}"
168
+ }
169
+ ```
151
170
 
152
- **Output**: "Step 4 Status: ✅ COMPLETED - Module overview generated at {module_path}/{module_name}-overview.md"
171
+ **Output**: "Step 4 Status: ✅ COMPLETED - Summarize params ready"
153
172
 
154
- ### Step 5: Return Result
173
+ ### Step 5: Output Task Plan JSON
155
174
 
156
175
  **Step 5 Status: 🔄 IN PROGRESS**
157
176
 
158
- Compile and return the final result:
177
+ Compile and output the final task plan:
159
178
 
160
179
  ```json
161
180
  {
162
- "status": "success | partial | failed",
163
181
  "module_name": "...",
164
182
  "platform_id": "...",
165
- "features_analyzed": <count>,
166
- "features_failed": <count>,
167
- "output_dir": "...",
168
- "overview_file": "...",
169
- "errors": [...]
183
+ "analyzer_skill": "...",
184
+ "tasks": [...],
185
+ "total_pending": <count>,
186
+ "summarize_params": {...}
170
187
  }
171
188
  ```
172
189
 
173
- **Status determination**:
174
- - `success`: All features analyzed successfully, overview generated
175
- - `partial`: Some features failed but overview generated, or no pending features but overview updated
176
- - `failed`: All features failed or critical error prevented overview generation
177
-
178
- **Output**: "Step 5 Status: ✅ COMPLETED - Module initialization {status}"
190
+ **Output**: "Step 5 Status: ✅ COMPLETED - Task plan generated with {count} pending features"
179
191
 
180
192
  ## Constraints
181
193
 
@@ -187,21 +199,21 @@ Compile and return the final result:
187
199
 
188
200
  3. **Worker context**: This Skill runs in Worker Agent context, invoked by PM Agent
189
201
 
190
- 4. **Sequential execution**: Process features sequentially within this Worker (PM Agent handles module-level parallelism)
202
+ 4. **NO execution**: This Skill generates task plan ONLY. It does NOT:
203
+ - Execute analyzer skills
204
+ - Execute summarize skills
205
+ - Update features.json analyzed field
206
+ - All execution is handled by PM Agent based on task plan output
191
207
 
192
- 5. **No sync-state modification**: Do not directly create or modify sync-state directory files (that's dispatch's responsibility), but can update features.json analyzed markers
193
-
194
- 6. **Mutual exclusion with full dispatch**: Do not run simultaneously with full dispatch process
208
+ 5. **Mutual exclusion with full dispatch**: Do not run simultaneously with full dispatch process
195
209
 
196
210
  ## Error Handling
197
211
 
198
212
  | Scenario | Action |
199
213
  |----------|--------|
200
- | Features file not found | Return `status: failed` with error message |
201
- | No features for module | Skip to Step 4, generate overview if possible |
202
- | No pending features | Skip to Step 4, update existing overview |
203
- | Analyzer fails for feature | Record in errors array, continue with next feature |
204
- | Module summarize fails | Return `status: partial` with error details |
214
+ | Features file not found | Return error with message |
215
+ | No features for module | Return empty tasks array with summarize_params |
216
+ | No pending features | Return empty tasks array with summarize_params |
205
217
 
206
218
  ## Reference: Analyzer Input Parameters
207
219
 
@@ -209,10 +221,9 @@ Compile and return the final result:
209
221
 
210
222
  | Variable | Type | Description | Example |
211
223
  |----------|------|-------------|---------|
212
- | `feature` | object | Complete feature object from features.json | - |
213
224
  | `fileName` | string | Controller file name | `"UserController"` |
214
225
  | `sourcePath` | string | Relative path to source file | `"src/.../UserController.java"` |
215
- | `documentPath` | string | Target path for generated document | `"knowledges/bizs/.../UserController.md"` |
226
+ | `documentPath` | string | Target path for generated document | `"knowledges/bizs/.../features"` |
216
227
  | `module` | string | Business module name | `"system"` |
217
228
  | `analyzed` | boolean | Analysis status flag | `false` |
218
229
  | `platform_type` | string | Platform type | `"backend"` |
@@ -226,18 +237,15 @@ Compile and return the final result:
226
237
 
227
238
  | Variable | Type | Description | Example |
228
239
  |----------|------|-------------|---------|
229
- | `feature` | object | Complete feature object from features.json | - |
230
240
  | `fileName` | string | Feature file name | `"index"` |
231
241
  | `sourcePath` | string | Relative path to source file | `"src/views/system/user/index.vue"` |
232
- | `documentPath` | string | Target path for generated document | `"knowledges/bizs/.../index.md"` |
242
+ | `documentPath` | string | Target path for generated document | `"knowledges/bizs/.../features"` |
233
243
  | `module` | string | Business module name | `"system"` |
234
244
  | `analyzed` | boolean | Analysis status flag | `false` |
235
245
  | `platform_type` | string | Platform type | `"web"` |
236
246
  | `platform_subtype` | string | Platform subtype | `"vue"` |
237
247
  | `tech_stack` | array | Platform tech stack | `["vue", "typescript"]` |
238
248
  | `language` | string | Target language | `"zh"` |
239
- | `completed_dir` | string | Marker output directory (absolute path) | `".../knowledges/base/sync-state/completed"` |
240
- | `sourceFile` | string | Source features JSON filename | `"features-web-vue3.json"` |
241
249
 
242
250
  ## Task Completion Report
243
251
 
@@ -245,25 +253,16 @@ When the task is complete, report:
245
253
 
246
254
  ```json
247
255
  {
248
- "status": "success | failed",
256
+ "status": "success",
249
257
  "skill": "speccrew-pm-module-initializer",
250
258
  "output": {
251
- "status": "success | partial | failed",
252
259
  "module_name": "...",
253
260
  "platform_id": "...",
254
- "features_analyzed": 12,
255
- "features_failed": 0,
256
- "output_dir": "...",
257
- "overview_file": "...",
258
- "errors": []
259
- },
260
- "metrics": {
261
- "features_total": 15,
262
- "features_analyzed": 12,
263
- "features_skipped": 3,
264
- "features_failed": 0
265
- },
266
- "errors": []
261
+ "analyzer_skill": "...",
262
+ "tasks": [...],
263
+ "total_pending": <count>,
264
+ "summarize_params": {...}
265
+ }
267
266
  }
268
267
  ```
269
268
 
@@ -271,6 +270,6 @@ When the task is complete, report:
271
270
 
272
271
  - [ ] Step 1: Read features file and filtered by module
273
272
  - [ ] Step 2: Selected analyzer type based on platform_type
274
- - [ ] Step 3: Analyzed each pending feature sequentially
275
- - [ ] Step 4: Generated module summary via module-summarize
276
- - [ ] Step 5: Returned aggregated result with correct status
273
+ - [ ] Step 3: Built task list with analyzer parameters
274
+ - [ ] Step 4: Built summarize parameters
275
+ - [ ] Step 5: Output task plan JSON
@@ -8,7 +8,7 @@ function run(projectRoot, args) {
8
8
 
9
9
  const results = [];
10
10
 
11
- // 1. Node.js 版本检查
11
+ // 1. Node.js version check
12
12
  const nodeVersion = process.version;
13
13
  const majorVersion = parseInt(nodeVersion.slice(1).split('.')[0], 10);
14
14
  if (majorVersion >= 16) {
@@ -17,7 +17,7 @@ function run(projectRoot, args) {
17
17
  results.push({ status: 'FAIL', message: `Node.js ${nodeVersion} (< 16.0.0)` });
18
18
  }
19
19
 
20
- // 2. SpecCrew 安装状态
20
+ // 2. SpecCrew installation status
21
21
  const rc = readSpeccrewRC(projectRoot);
22
22
  const version = getPackageVersion();
23
23
  if (rc) {
@@ -26,7 +26,7 @@ function run(projectRoot, args) {
26
26
  results.push({ status: 'WARN', message: 'Not initialized, run speccrew init' });
27
27
  }
28
28
 
29
- // 3. IDE 目录检查
29
+ // 3. IDE directory check
30
30
  const detectedIDEs = detectIDE(projectRoot);
31
31
  if (detectedIDEs.length > 0) {
32
32
  const ideNames = detectedIDEs.map(ide => `${ide.name} (${ide.baseDir}/)`).join(', ');
@@ -35,7 +35,7 @@ function run(projectRoot, args) {
35
35
  results.push({ status: 'WARN', message: 'No supported IDE detected' });
36
36
  }
37
37
 
38
- // 4. Agents 完整性检查
38
+ // 4. Agents integrity check
39
39
  const sourceRoot = getSourceRoot();
40
40
  const sourceAgentsDir = path.join(sourceRoot, 'agents');
41
41
  let sourceAgentCount = 0;
@@ -70,7 +70,7 @@ function run(projectRoot, args) {
70
70
  results.push({ status: 'WARN', message: 'Agents: source not found' });
71
71
  }
72
72
 
73
- // 5. Skills 完整性检查
73
+ // 5. Skills integrity check
74
74
  const sourceSkillsDir = path.join(sourceRoot, 'skills');
75
75
  let sourceSkillCount = 0;
76
76
  let installedSkillCount = 0;
@@ -103,7 +103,7 @@ function run(projectRoot, args) {
103
103
  results.push({ status: 'WARN', message: 'Skills: source not found' });
104
104
  }
105
105
 
106
- // 6. Workspace 目录检查
106
+ // 6. Workspace directory check
107
107
  const workspaceDir = path.join(projectRoot, 'speccrew-workspace');
108
108
  const docsDir = path.join(workspaceDir, 'docs');
109
109
  if (fs.existsSync(workspaceDir) && fs.existsSync(docsDir)) {
@@ -114,7 +114,7 @@ function run(projectRoot, args) {
114
114
  results.push({ status: 'WARN', message: 'Workspace: speccrew-workspace/ not found' });
115
115
  }
116
116
 
117
- // 输出结果
117
+ // Output results
118
118
  let passCount = 0;
119
119
  let warnCount = 0;
120
120
  let failCount = 0;