speccrew 0.5.16 → 0.5.18
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-feature-designer.md +1 -1
- package/.speccrew/agents/speccrew-product-manager.md +232 -120
- package/.speccrew/agents/speccrew-system-designer.md +1 -1
- package/.speccrew/agents/speccrew-test-manager.md +1 -1
- package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +163 -0
- package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +276 -0
- package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +226 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: speccrew-system-designer
|
|
3
3
|
description: SpecCrew System Designer. Reads confirmed Feature Spec and API Contract documents, loads technology knowledge base (techs), evaluates framework needs, and dispatches per-platform detailed design skills to generate system design documents that add technology-specific implementation details to the feature specification skeleton. Supports web, mobile, and desktop platforms. Trigger scenarios: after Feature Spec and API Contract are confirmed, user requests system design.
|
|
4
|
-
tools: Read, Write, Glob, Grep
|
|
4
|
+
tools: Read, Write, Glob, Grep, Bash
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Role Positioning
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: speccrew-test-manager
|
|
3
3
|
description: SpecCrew Test Manager. Orchestrates three-phase testing workflow: test case design, test code generation, and test execution with bug reporting. Reads feature specs, API contracts, and system design documents to coordinate comprehensive system testing. Trigger scenarios: after development phase completes, user requests to start testing.
|
|
4
|
-
tools: Read, Write, Glob, Grep
|
|
4
|
+
tools: Read, Write, Glob, Grep, Bash
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Role Positioning
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: speccrew-pm-knowledge-detector
|
|
3
|
+
description: Detect business knowledge base availability and completeness status. Scans sync-state directory to determine if full knowledge (system-overview.md), lite knowledge (features-*.json), or no knowledge is available.
|
|
4
|
+
tools: Read, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Knowledge Base Detector
|
|
8
|
+
|
|
9
|
+
Detect business knowledge base availability and completeness status. Scans the sync-state directory to determine the current knowledge state.
|
|
10
|
+
|
|
11
|
+
## Language Adaptation
|
|
12
|
+
|
|
13
|
+
**CRITICAL**: Generate all content in the language specified by the `language` parameter.
|
|
14
|
+
|
|
15
|
+
- `language: "zh"` → Generate all content in 中文
|
|
16
|
+
- `language: "en"` → Generate all content in English
|
|
17
|
+
- Other languages → Use the specified language
|
|
18
|
+
|
|
19
|
+
**All output content must be in the target language only.**
|
|
20
|
+
|
|
21
|
+
## Trigger Scenarios
|
|
22
|
+
|
|
23
|
+
- "Check knowledge base status"
|
|
24
|
+
- "Detect if business knowledge exists"
|
|
25
|
+
- "Scan knowledge availability"
|
|
26
|
+
- "What knowledge is available?"
|
|
27
|
+
|
|
28
|
+
## Input
|
|
29
|
+
|
|
30
|
+
| Variable | Type | Description | Required |
|
|
31
|
+
|----------|------|-------------|----------|
|
|
32
|
+
| `workspace_path` | string | Path to speccrew workspace (e.g., `speccrew-workspace`) | **Yes** |
|
|
33
|
+
|
|
34
|
+
## Output JSON
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"status": "full | lite | none",
|
|
39
|
+
"has_system_overview": false,
|
|
40
|
+
"has_features": false,
|
|
41
|
+
"has_entry_dirs": false,
|
|
42
|
+
"available_platforms": ["web-vue3", "backend-spring"],
|
|
43
|
+
"module_count": 0,
|
|
44
|
+
"features_files": ["path/to/features-web-vue3.json"],
|
|
45
|
+
"entry_dirs_files": ["path/to/entry-dirs-web-vue3.json"],
|
|
46
|
+
"system_overview_path": null,
|
|
47
|
+
"message": "Knowledge base status detected"
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Status Definitions**:
|
|
52
|
+
|
|
53
|
+
| Status | Condition |
|
|
54
|
+
|--------|-----------|
|
|
55
|
+
| `full` | has_system_overview = true AND has_features = true |
|
|
56
|
+
| `lite` | has_features = true AND has_system_overview = false |
|
|
57
|
+
| `none` | has_features = false AND has_system_overview = false |
|
|
58
|
+
|
|
59
|
+
## Workflow
|
|
60
|
+
|
|
61
|
+
```mermaid
|
|
62
|
+
flowchart TD
|
|
63
|
+
Start([Start]) --> Step1[Step 1: Check system-overview.md]
|
|
64
|
+
Step1 --> Step2[Step 2: Scan for features files]
|
|
65
|
+
Step2 --> Step3[Step 3: Scan for entry-dirs files]
|
|
66
|
+
Step3 --> Step4[Step 4: Count modules and platforms]
|
|
67
|
+
Step4 --> Step5[Step 5: Determine status and return JSON]
|
|
68
|
+
Step5 --> End([End])
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 1: Check system-overview.md
|
|
72
|
+
|
|
73
|
+
Check if the system overview file exists:
|
|
74
|
+
|
|
75
|
+
1. Construct path: `{workspace_path}/knowledges/bizs/system-overview.md`
|
|
76
|
+
2. Attempt to read the file
|
|
77
|
+
3. Set `has_system_overview` = true if exists, false otherwise
|
|
78
|
+
4. Set `system_overview_path` = path if exists, null otherwise
|
|
79
|
+
|
|
80
|
+
**Output**: "Step 1 Status: ✅ COMPLETED - system-overview.md {exists|not found}"
|
|
81
|
+
|
|
82
|
+
### Step 2: Scan for features files
|
|
83
|
+
|
|
84
|
+
Scan the sync-state directory for feature inventory files:
|
|
85
|
+
|
|
86
|
+
1. Construct path: `{workspace_path}/knowledges/base/sync-state/knowledge-bizs/`
|
|
87
|
+
2. Glob pattern: `features-*.json`
|
|
88
|
+
3. Collect all matching files into `features_files` array
|
|
89
|
+
4. Set `has_features` = true if any files found
|
|
90
|
+
|
|
91
|
+
**Output**: "Step 2 Status: ✅ COMPLETED - Found {count} features files"
|
|
92
|
+
|
|
93
|
+
### Step 3: Scan for entry-dirs files
|
|
94
|
+
|
|
95
|
+
Scan for entry directory configuration files:
|
|
96
|
+
|
|
97
|
+
1. Use same sync-state path
|
|
98
|
+
2. Glob pattern: `entry-dirs-*.json`
|
|
99
|
+
3. Collect all matching files into `entry_dirs_files` array
|
|
100
|
+
4. Set `has_entry_dirs` = true if any files found
|
|
101
|
+
|
|
102
|
+
**Output**: "Step 3 Status: ✅ COMPLETED - Found {count} entry-dirs files"
|
|
103
|
+
|
|
104
|
+
### Step 4: Count modules and platforms
|
|
105
|
+
|
|
106
|
+
For each features file found:
|
|
107
|
+
|
|
108
|
+
1. Read the JSON content
|
|
109
|
+
2. Extract `platformId` and add to `available_platforms` array
|
|
110
|
+
3. Sum up `modules` array length for `module_count`
|
|
111
|
+
4. Extract `features` array length for feature count per platform
|
|
112
|
+
|
|
113
|
+
**Output**: "Step 4 Status: ✅ COMPLETED - {platform_count} platforms, {module_count} modules"
|
|
114
|
+
|
|
115
|
+
### Step 5: Determine status and return JSON
|
|
116
|
+
|
|
117
|
+
Calculate the overall status:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
IF has_system_overview AND has_features THEN
|
|
121
|
+
status = "full"
|
|
122
|
+
ELSE IF has_features THEN
|
|
123
|
+
status = "lite"
|
|
124
|
+
ELSE
|
|
125
|
+
status = "none"
|
|
126
|
+
END IF
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Return the complete JSON output.
|
|
130
|
+
|
|
131
|
+
**Output**: "Step 5 Status: ✅ COMPLETED - Knowledge status: {status}"
|
|
132
|
+
|
|
133
|
+
## Constraints
|
|
134
|
+
|
|
135
|
+
1. **READ-ONLY**: This skill does not modify any files
|
|
136
|
+
2. **Fast execution**: Use Glob for scanning, avoid deep file reads
|
|
137
|
+
3. **Graceful handling**: Return empty arrays if directories don't exist
|
|
138
|
+
4. **Path format**: All returned paths should be relative to workspace_path
|
|
139
|
+
|
|
140
|
+
## Task Completion Report
|
|
141
|
+
|
|
142
|
+
When the task is complete, report:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"status": "success | failed",
|
|
147
|
+
"skill": "speccrew-pm-knowledge-detector",
|
|
148
|
+
"detection_result": {
|
|
149
|
+
"status": "full | lite | none",
|
|
150
|
+
"available_platforms": [...],
|
|
151
|
+
"module_count": 0
|
|
152
|
+
},
|
|
153
|
+
"message": "Knowledge base status detected successfully"
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Checklist
|
|
158
|
+
|
|
159
|
+
- [ ] Step 1: Checked system-overview.md existence
|
|
160
|
+
- [ ] Step 2: Scanned for features-*.json files
|
|
161
|
+
- [ ] Step 3: Scanned for entry-dirs-*.json files
|
|
162
|
+
- [ ] Step 4: Counted platforms and modules
|
|
163
|
+
- [ ] Step 5: Determined overall status and returned JSON
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
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.
|
|
4
|
+
tools: Read, Write, Skill, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Module Initializer
|
|
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.
|
|
10
|
+
|
|
11
|
+
## Language Adaptation
|
|
12
|
+
|
|
13
|
+
**CRITICAL**: Generate all content in the language specified by the `language` parameter.
|
|
14
|
+
|
|
15
|
+
- `language: "zh"` → Generate all content in 中文
|
|
16
|
+
- `language: "en"` → Generate all content in English
|
|
17
|
+
- Other languages → Use the specified language
|
|
18
|
+
|
|
19
|
+
**All output content must be in the target language only.**
|
|
20
|
+
|
|
21
|
+
## Trigger Scenarios
|
|
22
|
+
|
|
23
|
+
- "Initialize module {name}"
|
|
24
|
+
- "Deep analyze module {name}"
|
|
25
|
+
- "Generate knowledge for module {name}"
|
|
26
|
+
- "Start module analysis"
|
|
27
|
+
|
|
28
|
+
## Input
|
|
29
|
+
|
|
30
|
+
| Parameter | Type | Required | Description |
|
|
31
|
+
|-----------|------|----------|-------------|
|
|
32
|
+
| `source_path` | string | Yes | 项目源码根路径 |
|
|
33
|
+
| `module_name` | string | Yes | 模块名称 |
|
|
34
|
+
| `platform_id` | string | Yes | 平台 ID (e.g., "web-vue3", "admin-api") |
|
|
35
|
+
| `platform_type` | string | Yes | web / mobile / backend / desktop |
|
|
36
|
+
| `platform_subtype` | string | No | Platform subtype (e.g., "vue", "spring-boot") |
|
|
37
|
+
| `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) |
|
|
41
|
+
|
|
42
|
+
## Output JSON
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"status": "success | partial | failed",
|
|
47
|
+
"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": []
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Status Definitions**:
|
|
58
|
+
|
|
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 |
|
|
64
|
+
|
|
65
|
+
## Workflow
|
|
66
|
+
|
|
67
|
+
```mermaid
|
|
68
|
+
flowchart TD
|
|
69
|
+
Start([Start]) --> Step1[Step 1: Read and filter features]
|
|
70
|
+
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]
|
|
74
|
+
Step5 --> End([End])
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Step 1: Read and Filter Features
|
|
78
|
+
|
|
79
|
+
**Step 1 Status: 🔄 IN PROGRESS**
|
|
80
|
+
|
|
81
|
+
1. **Read features file**: Parse the `features_file` JSON
|
|
82
|
+
2. **Filter by module**: Select features where `module == module_name` AND `analyzed == false`
|
|
83
|
+
3. **Record counts**:
|
|
84
|
+
- Total features for this module
|
|
85
|
+
- Pending features (analyzed = false)
|
|
86
|
+
- If no pending features found, skip to Step 4 (still generate/update module summary)
|
|
87
|
+
|
|
88
|
+
**Output**: "Step 1 Status: ✅ COMPLETED - Found {total} total features, {pending} pending for analysis"
|
|
89
|
+
|
|
90
|
+
### Step 2: Select Analyzer by Platform Type
|
|
91
|
+
|
|
92
|
+
**Step 2 Status: 🔄 IN PROGRESS**
|
|
93
|
+
|
|
94
|
+
Based on `platform_type`, select the appropriate analyzer Skill:
|
|
95
|
+
|
|
96
|
+
| platform_type | skill_name | Description |
|
|
97
|
+
|---------------|------------|-------------|
|
|
98
|
+
| web, mobile, desktop | `speccrew-knowledge-bizs-ui-analyze` | UI Feature Analysis |
|
|
99
|
+
| backend | `speccrew-knowledge-bizs-api-analyze` | API Controller Analysis |
|
|
100
|
+
|
|
101
|
+
**Output**: "Step 2 Status: ✅ COMPLETED - Selected analyzer: {skill_name}"
|
|
102
|
+
|
|
103
|
+
### Step 3: Analyze Each Pending Feature
|
|
104
|
+
|
|
105
|
+
**Step 3 Status: 🔄 IN PROGRESS**
|
|
106
|
+
|
|
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
|
|
112
|
+
|
|
113
|
+
Prepare input variables matching the analyzer Skill's Input Variables format:
|
|
114
|
+
|
|
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") |
|
|
129
|
+
|
|
130
|
+
#### Execution for Each Feature
|
|
131
|
+
|
|
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
|
|
135
|
+
|
|
136
|
+
**Output**: "Step 3 Status: ✅ COMPLETED - Analyzed {success} features, {failed} failed"
|
|
137
|
+
|
|
138
|
+
### Step 4: Generate Module Summary
|
|
139
|
+
|
|
140
|
+
**Step 4 Status: 🔄 IN PROGRESS**
|
|
141
|
+
|
|
142
|
+
Invoke `speccrew-knowledge-module-summarize` Skill to generate/update the module overview document.
|
|
143
|
+
|
|
144
|
+
**Input Parameters**:
|
|
145
|
+
|
|
146
|
+
| Variable | Value |
|
|
147
|
+
|----------|-------|
|
|
148
|
+
| `module_name` | module_name |
|
|
149
|
+
| `module_path` | `{output_path}/bizs/{platform_id}/{module_name}/` |
|
|
150
|
+
| `language` | From input |
|
|
151
|
+
|
|
152
|
+
**Output**: "Step 4 Status: ✅ COMPLETED - Module overview generated at {module_path}/{module_name}-overview.md"
|
|
153
|
+
|
|
154
|
+
### Step 5: Return Result
|
|
155
|
+
|
|
156
|
+
**Step 5 Status: 🔄 IN PROGRESS**
|
|
157
|
+
|
|
158
|
+
Compile and return the final result:
|
|
159
|
+
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"status": "success | partial | failed",
|
|
163
|
+
"module_name": "...",
|
|
164
|
+
"platform_id": "...",
|
|
165
|
+
"features_analyzed": <count>,
|
|
166
|
+
"features_failed": <count>,
|
|
167
|
+
"output_dir": "...",
|
|
168
|
+
"overview_file": "...",
|
|
169
|
+
"errors": [...]
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
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}"
|
|
179
|
+
|
|
180
|
+
## Constraints
|
|
181
|
+
|
|
182
|
+
1. **Output path format**: Must match bizs-dispatch format: `{output_path}/bizs/{platform_id}/{module_name}/`
|
|
183
|
+
|
|
184
|
+
2. **Use same analyzers as dispatch**:
|
|
185
|
+
- Backend → `speccrew-knowledge-bizs-api-analyze`
|
|
186
|
+
- Web/Mobile/Desktop → `speccrew-knowledge-bizs-ui-analyze`
|
|
187
|
+
|
|
188
|
+
3. **Worker context**: This Skill runs in Worker Agent context, invoked by PM Agent
|
|
189
|
+
|
|
190
|
+
4. **Sequential execution**: Process features sequentially within this Worker (PM Agent handles module-level parallelism)
|
|
191
|
+
|
|
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
|
|
195
|
+
|
|
196
|
+
## Error Handling
|
|
197
|
+
|
|
198
|
+
| Scenario | Action |
|
|
199
|
+
|----------|--------|
|
|
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 |
|
|
205
|
+
|
|
206
|
+
## Reference: Analyzer Input Parameters
|
|
207
|
+
|
|
208
|
+
### API Analyzer (speccrew-knowledge-bizs-api-analyze)
|
|
209
|
+
|
|
210
|
+
| Variable | Type | Description | Example |
|
|
211
|
+
|----------|------|-------------|---------|
|
|
212
|
+
| `feature` | object | Complete feature object from features.json | - |
|
|
213
|
+
| `fileName` | string | Controller file name | `"UserController"` |
|
|
214
|
+
| `sourcePath` | string | Relative path to source file | `"src/.../UserController.java"` |
|
|
215
|
+
| `documentPath` | string | Target path for generated document | `"knowledges/bizs/.../UserController.md"` |
|
|
216
|
+
| `module` | string | Business module name | `"system"` |
|
|
217
|
+
| `analyzed` | boolean | Analysis status flag | `false` |
|
|
218
|
+
| `platform_type` | string | Platform type | `"backend"` |
|
|
219
|
+
| `platform_subtype` | string | Platform subtype | `"spring-boot"` |
|
|
220
|
+
| `tech_stack` | array | Platform tech stack | `["java", "spring-boot"]` |
|
|
221
|
+
| `language` | string | Target language | `"zh"` |
|
|
222
|
+
| `completed_dir` | string | Marker output directory (absolute path) | `".../knowledges/base/sync-state/completed"` |
|
|
223
|
+
| `sourceFile` | string | Source features JSON filename | `"features-admin-api.json"` |
|
|
224
|
+
|
|
225
|
+
### UI Analyzer (speccrew-knowledge-bizs-ui-analyze)
|
|
226
|
+
|
|
227
|
+
| Variable | Type | Description | Example |
|
|
228
|
+
|----------|------|-------------|---------|
|
|
229
|
+
| `feature` | object | Complete feature object from features.json | - |
|
|
230
|
+
| `fileName` | string | Feature file name | `"index"` |
|
|
231
|
+
| `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"` |
|
|
233
|
+
| `module` | string | Business module name | `"system"` |
|
|
234
|
+
| `analyzed` | boolean | Analysis status flag | `false` |
|
|
235
|
+
| `platform_type` | string | Platform type | `"web"` |
|
|
236
|
+
| `platform_subtype` | string | Platform subtype | `"vue"` |
|
|
237
|
+
| `tech_stack` | array | Platform tech stack | `["vue", "typescript"]` |
|
|
238
|
+
| `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
|
+
|
|
242
|
+
## Task Completion Report
|
|
243
|
+
|
|
244
|
+
When the task is complete, report:
|
|
245
|
+
|
|
246
|
+
```json
|
|
247
|
+
{
|
|
248
|
+
"status": "success | failed",
|
|
249
|
+
"skill": "speccrew-pm-module-initializer",
|
|
250
|
+
"output": {
|
|
251
|
+
"status": "success | partial | failed",
|
|
252
|
+
"module_name": "...",
|
|
253
|
+
"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": []
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Checklist
|
|
271
|
+
|
|
272
|
+
- [ ] Step 1: Read features file and filtered by module
|
|
273
|
+
- [ ] 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
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: speccrew-pm-module-matcher
|
|
3
|
+
description: Match user requirement text against business knowledge base features to identify related modules. Reads features-*.json and performs semantic matching.
|
|
4
|
+
tools: Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Module Matcher
|
|
8
|
+
|
|
9
|
+
Match user requirement text against business knowledge base features to identify related modules. Performs semantic matching based on keywords, module names, and feature definitions.
|
|
10
|
+
|
|
11
|
+
## Language Adaptation
|
|
12
|
+
|
|
13
|
+
**CRITICAL**: Generate all content in the language specified by the `language` parameter.
|
|
14
|
+
|
|
15
|
+
- `language: "zh"` → Generate all content in 中文
|
|
16
|
+
- `language: "en"` → Generate all content in English
|
|
17
|
+
- Other languages → Use the specified language
|
|
18
|
+
|
|
19
|
+
**All output content must be in the target language only.**
|
|
20
|
+
|
|
21
|
+
## Trigger Scenarios
|
|
22
|
+
|
|
23
|
+
- "Find modules for requirement X"
|
|
24
|
+
- "Which modules handle user management?"
|
|
25
|
+
- "Match requirement to knowledge base"
|
|
26
|
+
- "Identify relevant modules"
|
|
27
|
+
|
|
28
|
+
## Input
|
|
29
|
+
|
|
30
|
+
| Variable | Type | Description | Required |
|
|
31
|
+
|----------|------|-------------|----------|
|
|
32
|
+
| `requirement_text` | string | User requirement text to match | **Yes** |
|
|
33
|
+
| `features_files` | string[] | Array of paths to features-*.json files | **Yes** |
|
|
34
|
+
| `language` | string | Target language for output | **Yes** |
|
|
35
|
+
|
|
36
|
+
## Output JSON
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"matched_modules": [
|
|
41
|
+
{
|
|
42
|
+
"platform_id": "web-vue3",
|
|
43
|
+
"module_name": "system",
|
|
44
|
+
"platform_type": "web",
|
|
45
|
+
"confidence": "high | medium | low",
|
|
46
|
+
"matching_features": ["user-management", "role-management"],
|
|
47
|
+
"feature_count": 15,
|
|
48
|
+
"analyzed_count": 8,
|
|
49
|
+
"source_path": "src/views/system"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"unmatched_keywords": ["workflow", "approval"],
|
|
53
|
+
"recommendation": "Suggested modules based on requirement analysis",
|
|
54
|
+
"total_platforms_scanned": 3,
|
|
55
|
+
"total_modules_scanned": 12,
|
|
56
|
+
"message": "Matching completed"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Confidence Levels**:
|
|
61
|
+
|
|
62
|
+
| Level | Condition |
|
|
63
|
+
|-------|-----------|
|
|
64
|
+
| `high` | Direct keyword match with module name or feature fileName |
|
|
65
|
+
| `medium` | Partial match or synonym match |
|
|
66
|
+
| `low` | Related concept match only |
|
|
67
|
+
|
|
68
|
+
## Workflow
|
|
69
|
+
|
|
70
|
+
```mermaid
|
|
71
|
+
flowchart TD
|
|
72
|
+
Start([Start]) --> Step1[Step 1: Parse requirement text]
|
|
73
|
+
Step1 --> Step2[Step 2: Read features files and build index]
|
|
74
|
+
Step2 --> Step3[Step 3: Perform semantic matching]
|
|
75
|
+
Step3 --> Step4[Step 4: Sort and generate recommendation]
|
|
76
|
+
Step4 --> End([End])
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Step 1: Parse Requirement Text
|
|
80
|
+
|
|
81
|
+
Extract key entities and domain terms from the requirement:
|
|
82
|
+
|
|
83
|
+
1. **Tokenize**: Split text into words/phrases
|
|
84
|
+
2. **Extract entities**: Identify nouns, technical terms, business concepts
|
|
85
|
+
3. **Normalize**: Convert to lowercase, handle Chinese/English mixed text
|
|
86
|
+
4. **Build keyword list**: Create array of searchable terms
|
|
87
|
+
|
|
88
|
+
**Chinese Text Handling**:
|
|
89
|
+
- Use character-level matching for Chinese terms
|
|
90
|
+
- Consider common abbreviations (e.g., "用户" matches "user")
|
|
91
|
+
- Support both simplified and traditional characters
|
|
92
|
+
|
|
93
|
+
**Output**: "Step 1 Status: ✅ COMPLETED - Extracted {keyword_count} keywords"
|
|
94
|
+
|
|
95
|
+
### Step 2: Read Features Files and Build Index
|
|
96
|
+
|
|
97
|
+
For each features file in the input array:
|
|
98
|
+
|
|
99
|
+
1. **Read JSON**: Parse the features-*.json file
|
|
100
|
+
2. **Extract platform info**: `platformId`, `platformType`
|
|
101
|
+
3. **Build module index**: Group features by `module`
|
|
102
|
+
4. **Build feature index**: Create lookup by `fileName`, `sourcePath`
|
|
103
|
+
|
|
104
|
+
**Index Structure**:
|
|
105
|
+
```
|
|
106
|
+
{
|
|
107
|
+
"platform_id": {
|
|
108
|
+
"modules": {
|
|
109
|
+
"module_name": {
|
|
110
|
+
"features": [...],
|
|
111
|
+
"feature_count": N,
|
|
112
|
+
"analyzed_count": M
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Error Handling**: Skip files that cannot be read or parsed, continue with others.
|
|
120
|
+
|
|
121
|
+
**Output**: "Step 2 Status: ✅ COMPLETED - Built index from {file_count} files, {module_count} modules"
|
|
122
|
+
|
|
123
|
+
### Step 3: Perform Semantic Matching
|
|
124
|
+
|
|
125
|
+
Match keywords against the module-feature index:
|
|
126
|
+
|
|
127
|
+
1. **Direct matching**:
|
|
128
|
+
- Keyword matches module name directly
|
|
129
|
+
- Keyword matches feature fileName
|
|
130
|
+
- Confidence = `high`
|
|
131
|
+
|
|
132
|
+
2. **Partial matching**:
|
|
133
|
+
- Keyword is substring of module/feature name
|
|
134
|
+
- Module/feature name is substring of keyword
|
|
135
|
+
- Confidence = `medium`
|
|
136
|
+
|
|
137
|
+
3. **Conceptual matching**:
|
|
138
|
+
- Keyword relates to known domain concepts
|
|
139
|
+
- Synonym matching (configurable)
|
|
140
|
+
- Confidence = `low`
|
|
141
|
+
|
|
142
|
+
**Matching Algorithm**:
|
|
143
|
+
```
|
|
144
|
+
FOR each platform IN platforms:
|
|
145
|
+
FOR each module IN platform.modules:
|
|
146
|
+
score = 0
|
|
147
|
+
matching_features = []
|
|
148
|
+
|
|
149
|
+
FOR each keyword IN keywords:
|
|
150
|
+
IF keyword matches module.name THEN
|
|
151
|
+
score += 3 // high confidence boost
|
|
152
|
+
END IF
|
|
153
|
+
|
|
154
|
+
FOR each feature IN module.features:
|
|
155
|
+
IF keyword matches feature.fileName THEN
|
|
156
|
+
score += 1
|
|
157
|
+
matching_features.add(feature)
|
|
158
|
+
END IF
|
|
159
|
+
END FOR
|
|
160
|
+
END FOR
|
|
161
|
+
|
|
162
|
+
IF score > 0 THEN
|
|
163
|
+
confidence = calculate_confidence(score, keyword_count)
|
|
164
|
+
matched_modules.add(module with confidence)
|
|
165
|
+
END IF
|
|
166
|
+
END FOR
|
|
167
|
+
END FOR
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Output**: "Step 3 Status: ✅ COMPLETED - Found {match_count} matching modules"
|
|
171
|
+
|
|
172
|
+
### Step 4: Sort and Generate Recommendation
|
|
173
|
+
|
|
174
|
+
1. **Sort matched modules** by confidence (high → medium → low)
|
|
175
|
+
2. **Generate recommendation text** based on top matches
|
|
176
|
+
3. **Collect unmatched keywords** for user awareness
|
|
177
|
+
4. **Return complete JSON result**
|
|
178
|
+
|
|
179
|
+
**Recommendation Template**:
|
|
180
|
+
- High confidence: "Module '{name}' is highly relevant for this requirement"
|
|
181
|
+
- Medium confidence: "Module '{name}' may be relevant"
|
|
182
|
+
- Low confidence: "Module '{name}' has partial relevance"
|
|
183
|
+
|
|
184
|
+
**Output**: "Step 4 Status: ✅ COMPLETED - Generated recommendation"
|
|
185
|
+
|
|
186
|
+
## Constraints
|
|
187
|
+
|
|
188
|
+
1. **READ-ONLY**: This skill does not modify any files
|
|
189
|
+
2. **Handle Chinese+English**: Support bilingual text matching
|
|
190
|
+
3. **Skip unreadable files**: Continue processing even if some files fail
|
|
191
|
+
4. **No external API**: Matching is done locally without LLM calls
|
|
192
|
+
|
|
193
|
+
## Error Handling
|
|
194
|
+
|
|
195
|
+
| Scenario | Action |
|
|
196
|
+
|----------|--------|
|
|
197
|
+
| File not found | Skip file, log warning |
|
|
198
|
+
| Invalid JSON | Skip file, log error |
|
|
199
|
+
| Empty features array | Continue with empty module list |
|
|
200
|
+
| No keywords extracted | Return empty matches with warning |
|
|
201
|
+
|
|
202
|
+
## Task Completion Report
|
|
203
|
+
|
|
204
|
+
When the task is complete, report:
|
|
205
|
+
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"status": "success | partial | failed",
|
|
209
|
+
"skill": "speccrew-pm-module-matcher",
|
|
210
|
+
"matching_result": {
|
|
211
|
+
"matched_count": 3,
|
|
212
|
+
"high_confidence_count": 1,
|
|
213
|
+
"medium_confidence_count": 1,
|
|
214
|
+
"low_confidence_count": 1
|
|
215
|
+
},
|
|
216
|
+
"message": "Module matching completed"
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Checklist
|
|
221
|
+
|
|
222
|
+
- [ ] Step 1: Parsed requirement text and extracted keywords
|
|
223
|
+
- [ ] Step 2: Read all features files and built index
|
|
224
|
+
- [ ] Step 3: Performed semantic matching
|
|
225
|
+
- [ ] Step 4: Sorted results and generated recommendation
|
|
226
|
+
- [ ] Returned complete JSON output
|