speccrew 0.6.68 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/.speccrew/agents/speccrew-task-worker.md +1 -1
  2. package/.speccrew/agents/speccrew-team-leader.md +336 -189
  3. package/.speccrew/skills/speccrew-agentflow-manager/SKILL.md +161 -0
  4. package/.speccrew/skills/speccrew-agentflow-manager/workflow.agentflow.xml +347 -0
  5. package/.speccrew/skills/speccrew-deploy-build/SKILL.md +3 -56
  6. package/.speccrew/skills/speccrew-deploy-build/workflow.agentflow.xml +125 -0
  7. package/.speccrew/skills/speccrew-deploy-migrate/SKILL.md +3 -64
  8. package/.speccrew/skills/speccrew-deploy-migrate/workflow.agentflow.xml +135 -0
  9. package/.speccrew/skills/speccrew-deploy-smoke-test/SKILL.md +4 -156
  10. package/.speccrew/skills/speccrew-deploy-smoke-test/workflow.agentflow.xml +178 -0
  11. package/.speccrew/skills/speccrew-deploy-startup/SKILL.md +3 -135
  12. package/.speccrew/skills/speccrew-deploy-startup/workflow.agentflow.xml +223 -0
  13. package/.speccrew/skills/speccrew-dev-backend/SKILL.md +10 -2
  14. package/.speccrew/skills/speccrew-dev-backend/workflow.agentflow.xml +254 -0
  15. package/.speccrew/skills/speccrew-dev-desktop-electron/SKILL.md +10 -2
  16. package/.speccrew/skills/speccrew-dev-desktop-electron/workflow.agentflow.xml +259 -0
  17. package/.speccrew/skills/speccrew-dev-desktop-tauri/SKILL.md +10 -2
  18. package/.speccrew/skills/speccrew-dev-desktop-tauri/workflow.agentflow.xml +245 -0
  19. package/.speccrew/skills/speccrew-dev-frontend/SKILL.md +10 -2
  20. package/.speccrew/skills/speccrew-dev-frontend/workflow.agentflow.xml +262 -0
  21. package/.speccrew/skills/speccrew-dev-mobile/SKILL.md +10 -2
  22. package/.speccrew/skills/speccrew-dev-mobile/workflow.agentflow.xml +244 -0
  23. package/.speccrew/skills/speccrew-dev-review-backend/SKILL.md +10 -2
  24. package/.speccrew/skills/speccrew-dev-review-backend/workflow.agentflow.xml +251 -0
  25. package/.speccrew/skills/speccrew-dev-review-desktop/SKILL.md +10 -2
  26. package/.speccrew/skills/speccrew-dev-review-desktop/workflow.agentflow.xml +214 -0
  27. package/.speccrew/skills/speccrew-dev-review-frontend/SKILL.md +10 -2
  28. package/.speccrew/skills/speccrew-dev-review-frontend/workflow.agentflow.xml +213 -0
  29. package/.speccrew/skills/speccrew-dev-review-mobile/SKILL.md +10 -2
  30. package/.speccrew/skills/speccrew-dev-review-mobile/workflow.agentflow.xml +214 -0
  31. package/.speccrew/skills/speccrew-fd-api-contract/SKILL.md +7 -1
  32. package/.speccrew/skills/speccrew-fd-api-contract/workflow.agentflow.xml +222 -0
  33. package/.speccrew/skills/speccrew-fd-feature-analyze/SKILL.md +7 -1
  34. package/.speccrew/skills/speccrew-fd-feature-analyze/workflow.agentflow.xml +223 -0
  35. package/.speccrew/skills/speccrew-fd-feature-design/SKILL.md +7 -1
  36. package/.speccrew/skills/speccrew-fd-feature-design/workflow.agentflow.xml +322 -0
  37. package/.speccrew/skills/speccrew-get-timestamp/SKILL.md +3 -39
  38. package/.speccrew/skills/speccrew-get-timestamp/workflow.agentflow.xml +43 -0
  39. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +57 -508
  40. package/.speccrew/skills/{speccrew-knowledge-bizs-api-analyze-xml/SKILL.md → speccrew-knowledge-bizs-api-analyze/workflow.agentflow.xml} +1 -154
  41. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +73 -283
  42. package/.speccrew/skills/{speccrew-knowledge-bizs-api-graph-xml/SKILL.md → speccrew-knowledge-bizs-api-graph/workflow.agentflow.xml} +0 -298
  43. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +931 -801
  44. package/.speccrew/skills/{speccrew-knowledge-bizs-dispatch-xml/SKILL.md → speccrew-knowledge-bizs-dispatch/workflow.agentflow.xml} +42 -272
  45. package/.speccrew/skills/speccrew-knowledge-bizs-identify-entries/SKILL.md +263 -71
  46. package/.speccrew/skills/{speccrew-knowledge-bizs-identify-entries-xml/SKILL.md → speccrew-knowledge-bizs-identify-entries/workflow.agentflow.xml} +8 -184
  47. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/SKILL.md +200 -181
  48. package/.speccrew/skills/{speccrew-knowledge-bizs-init-features-xml/SKILL.md → speccrew-knowledge-bizs-init-features/workflow.agentflow.xml} +7 -134
  49. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/SKILL.md +5 -89
  50. package/.speccrew/skills/speccrew-knowledge-bizs-module-classify/workflow.agentflow.xml +129 -0
  51. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +454 -326
  52. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-analyze-xml/SKILL.md → speccrew-knowledge-bizs-ui-analyze/workflow.agentflow.xml} +8 -128
  53. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +302 -247
  54. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-graph-xml/SKILL.md → speccrew-knowledge-bizs-ui-graph/workflow.agentflow.xml} +7 -199
  55. package/.speccrew/skills/speccrew-knowledge-bizs-ui-style-extract/SKILL.md +267 -156
  56. package/.speccrew/skills/{speccrew-knowledge-bizs-ui-style-extract-xml/SKILL.md → speccrew-knowledge-bizs-ui-style-extract/workflow.agentflow.xml} +7 -151
  57. package/.speccrew/skills/speccrew-knowledge-graph-query/SKILL.md +3 -122
  58. package/.speccrew/skills/speccrew-knowledge-graph-query/workflow.agentflow.xml +106 -0
  59. package/.speccrew/skills/speccrew-knowledge-graph-write/SKILL.md +3 -80
  60. package/.speccrew/skills/speccrew-knowledge-graph-write/workflow.agentflow.xml +152 -0
  61. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +371 -265
  62. package/.speccrew/skills/{speccrew-knowledge-module-summarize-xml/SKILL.md → speccrew-knowledge-module-summarize/workflow.agentflow.xml} +7 -197
  63. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +45 -333
  64. package/.speccrew/skills/{speccrew-knowledge-system-summarize-xml/SKILL.md → speccrew-knowledge-system-summarize/workflow.agentflow.xml} +0 -177
  65. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +174 -727
  66. package/.speccrew/skills/{speccrew-knowledge-techs-dispatch-xml/SKILL.md → speccrew-knowledge-techs-dispatch/workflow.agentflow.xml} +10 -351
  67. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +20 -150
  68. package/.speccrew/skills/{speccrew-knowledge-techs-generate-xml/SKILL.md → speccrew-knowledge-techs-generate/workflow.agentflow.xml} +0 -169
  69. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +75 -587
  70. package/.speccrew/skills/{speccrew-knowledge-techs-generate-conventions-xml/SKILL.md → speccrew-knowledge-techs-generate-conventions/workflow.agentflow.xml} +0 -153
  71. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +463 -297
  72. package/.speccrew/skills/{speccrew-knowledge-techs-generate-quality-xml/SKILL.md → speccrew-knowledge-techs-generate-quality/workflow.agentflow.xml} +0 -164
  73. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +57 -292
  74. package/.speccrew/skills/{speccrew-knowledge-techs-generate-ui-style-xml/SKILL.md → speccrew-knowledge-techs-generate-ui-style/workflow.agentflow.xml} +2 -193
  75. package/.speccrew/skills/speccrew-knowledge-techs-index/SKILL.md +49 -335
  76. package/.speccrew/skills/{speccrew-knowledge-techs-index-xml/SKILL.md → speccrew-knowledge-techs-index/workflow.agentflow.xml} +0 -167
  77. package/.speccrew/skills/speccrew-knowledge-techs-init/SKILL.md +28 -109
  78. package/.speccrew/skills/{speccrew-knowledge-techs-init-xml/SKILL.md → speccrew-knowledge-techs-init/workflow.agentflow.xml} +0 -189
  79. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/SKILL.md +3 -487
  80. package/.speccrew/skills/speccrew-knowledge-techs-ui-analyze/workflow.agentflow.xml +278 -0
  81. package/.speccrew/skills/speccrew-pm-knowledge-detector/SKILL.md +3 -71
  82. package/.speccrew/skills/speccrew-pm-knowledge-detector/workflow.agentflow.xml +108 -0
  83. package/.speccrew/skills/speccrew-pm-module-initializer/SKILL.md +3 -107
  84. package/.speccrew/skills/speccrew-pm-module-initializer/workflow.agentflow.xml +139 -0
  85. package/.speccrew/skills/speccrew-pm-module-matcher/SKILL.md +3 -115
  86. package/.speccrew/skills/speccrew-pm-module-matcher/workflow.agentflow.xml +146 -0
  87. package/.speccrew/skills/speccrew-pm-requirement-analysis/SKILL.md +3 -343
  88. package/.speccrew/skills/speccrew-pm-requirement-analysis/workflow.agentflow.xml +174 -0
  89. package/.speccrew/skills/speccrew-pm-requirement-assess/SKILL.md +3 -91
  90. package/.speccrew/skills/speccrew-pm-requirement-assess/workflow.agentflow.xml +173 -0
  91. package/.speccrew/skills/speccrew-pm-requirement-clarify/SKILL.md +3 -224
  92. package/.speccrew/skills/speccrew-pm-requirement-clarify/workflow.agentflow.xml +159 -0
  93. package/.speccrew/skills/speccrew-pm-requirement-model/SKILL.md +3 -275
  94. package/.speccrew/skills/speccrew-pm-requirement-model/workflow.agentflow.xml +210 -0
  95. package/.speccrew/skills/speccrew-pm-requirement-simple/SKILL.md +3 -76
  96. package/.speccrew/skills/speccrew-pm-requirement-simple/workflow.agentflow.xml +120 -0
  97. package/.speccrew/skills/speccrew-pm-sub-prd-generate/SKILL.md +7 -1
  98. package/.speccrew/skills/speccrew-pm-sub-prd-generate/workflow.agentflow.xml +218 -0
  99. package/.speccrew/skills/speccrew-sd-backend/SKILL.md +7 -1
  100. package/.speccrew/skills/speccrew-sd-backend/workflow.agentflow.xml +264 -0
  101. package/.speccrew/skills/speccrew-sd-desktop/SKILL.md +7 -1
  102. package/.speccrew/skills/speccrew-sd-desktop/workflow.agentflow.xml +288 -0
  103. package/.speccrew/skills/speccrew-sd-framework-evaluate/SKILL.md +7 -1
  104. package/.speccrew/skills/speccrew-sd-framework-evaluate/workflow.agentflow.xml +235 -0
  105. package/.speccrew/skills/speccrew-sd-frontend/SKILL.md +7 -1
  106. package/.speccrew/skills/speccrew-sd-frontend/workflow.agentflow.xml +299 -0
  107. package/.speccrew/skills/speccrew-sd-mobile/SKILL.md +7 -1
  108. package/.speccrew/skills/speccrew-sd-mobile/workflow.agentflow.xml +301 -0
  109. package/.speccrew/skills/speccrew-test-case-design/SKILL.md +165 -284
  110. package/.speccrew/skills/speccrew-test-case-design/workflow.agentflow.xml +210 -0
  111. package/.speccrew/skills/speccrew-test-code-gen/SKILL.md +204 -324
  112. package/.speccrew/skills/speccrew-test-code-gen/workflow.agentflow.xml +265 -0
  113. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +205 -184
  114. package/.speccrew/skills/speccrew-test-reporter/workflow.agentflow.xml +284 -0
  115. package/.speccrew/skills/speccrew-test-runner/SKILL.md +242 -241
  116. package/.speccrew/skills/speccrew-test-runner/workflow.agentflow.xml +314 -0
  117. package/bin/cli.js +8 -1
  118. package/lib/commands/validate.js +565 -0
  119. package/package.json +1 -1
  120. package/workspace-template/docs/rules/{xml-workflow-spec.md → agentflow-spec.md} +5 -5
  121. package/workspace-template/scripts/validate-agentflow.js +637 -0
  122. package/.speccrew/agents/speccrew-team-leader-xml.md +0 -480
  123. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/STATUS-FORMATS.md +0 -99
  124. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js +0 -176
  125. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-next-batch.js +0 -150
  126. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/get-pending-features.js +0 -106
  127. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/mark-stale.js +0 -249
  128. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js +0 -300
  129. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/process-batch-results.js +0 -915
  130. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/scripts/update-feature-status.js +0 -226
  131. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/examples/features.json +0 -34
  132. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js +0 -1071
  133. package/.speccrew/skills/speccrew-knowledge-bizs-init-features/scripts/test-inventory.js +0 -26
  134. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/STATUS-FORMATS.md +0 -550
@@ -0,0 +1,139 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="module-initializer-main" status="pending" version="1.0" desc="Generate analyze task plan for a single business module">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="source_path" required="true" type="string" desc="Project source code root path"/>
9
+ <field name="module_name" required="true" type="string" desc="Module name"/>
10
+ <field name="platform_id" required="true" type="string" desc="Platform ID (e.g., web-vue, admin-api)"/>
11
+ <field name="platform_type" required="true" type="string" desc="web / mobile / backend / desktop"/>
12
+ <field name="platform_subtype" required="false" type="string" desc="Platform subtype (e.g., vue, spring-boot)"/>
13
+ <field name="tech_stack" required="false" type="array" desc="Platform tech stack (e.g., [java, spring-boot])"/>
14
+ <field name="features_file" required="true" type="string" desc="Path to the platform's features-{platform}.json file"/>
15
+ <field name="output_path" required="true" type="string" desc="Knowledge base output root path"/>
16
+ <field name="completed_dir" required="true" type="string" desc="Marker file output directory for api-analyze .done.json markers"/>
17
+ <field name="sourceFile" required="true" type="string" desc="Features JSON filename (e.g., features-backend-system.json)"/>
18
+ <field name="language" required="true" type="string" desc="Output language (zh / en)"/>
19
+ <field name="workspace_path" required="true" type="string" desc="Workspace root path for constructing absolute paths"/>
20
+ </block>
21
+
22
+ <!-- ============================================================
23
+ Global Constraints
24
+ ============================================================ -->
25
+ <block type="rule" id="R1" level="mandatory" desc="Path constraints">
26
+ <field name="text">Use the provided absolute paths directly. DO NOT construct or derive paths yourself.</field>
27
+ <field name="text">All paths must use forward slashes / as path separators (even on Windows)</field>
28
+ </block>
29
+
30
+ <block type="rule" id="R2" level="forbidden" desc="Execution constraints">
31
+ <field name="text">This skill generates task plan ONLY - do NOT execute analyzer skills</field>
32
+ <field name="text">Do NOT update features.json analyzed field</field>
33
+ <field name="text">All execution is handled by PM Agent based on task plan output</field>
34
+ </block>
35
+
36
+ <!-- ============================================================
37
+ Main Processing Sequence
38
+ ============================================================ -->
39
+ <sequence id="S1" name="Task Plan Generation" status="pending" desc="Generate task plan for module initialization">
40
+
41
+ <!-- Step 1: Read and filter features -->
42
+ <block type="task" id="B1" action="read-file" desc="Read features file and parse JSON">
43
+ <field name="path" value="${features_file}"/>
44
+ <field name="output" var="features_data"/>
45
+ </block>
46
+
47
+ <!-- Gateway: Validate features file -->
48
+ <block type="gateway" id="G1" mode="guard" desc="Verify features file exists and is valid"
49
+ test="${features_data} != null"
50
+ fail-action="stop">
51
+ <field name="message">Features file not found or invalid: ${features_file}</field>
52
+ </block>
53
+
54
+ <!-- Step 2: Filter features by module and pending status -->
55
+ <block type="task" id="B2" action="analyze" desc="Filter features by module and analyzed=false">
56
+ <field name="input" value="${features_data}"/>
57
+ <field name="filter">
58
+ - module == ${module_name}
59
+ - analyzed == false
60
+ </field>
61
+ <field name="output" var="pending_features"/>
62
+ </block>
63
+
64
+ <!-- Step 3: Select analyzer by platform type -->
65
+ <block type="task" id="B3" action="analyze" desc="Select analyzer skill based on platform_type">
66
+ <field name="input" value="${platform_type}"/>
67
+ <field name="logic">
68
+ IF platform_type IN [web, mobile, desktop] THEN analyzer_skill = "speccrew-knowledge-bizs-ui-analyze"
69
+ ELSE IF platform_type == backend THEN analyzer_skill = "speccrew-knowledge-bizs-api-analyze"
70
+ </field>
71
+ <field name="output" var="analyzer_skill"/>
72
+ </block>
73
+
74
+ <!-- Step 4: Build task list -->
75
+ <block type="loop" id="L1" over="${pending_features}" as="feature" desc="Build task list for each pending feature">
76
+ <block type="task" id="B4" action="analyze" desc="Build task object for feature">
77
+ <field name="input" value="${feature}"/>
78
+ <field name="build_task">
79
+ id: "ki-${platform_id}-${feature.module}-${feature.fileName}"
80
+ fileName: ${feature.fileName}
81
+ sourcePath: ${feature.sourcePath}
82
+ documentPath: ${output_path}/bizs/${platform_id}/${feature.module}/features
83
+ module: ${feature.module}
84
+ platform_type: ${platform_type}
85
+ platform_subtype: ${platform_subtype}
86
+ tech_stack: ${tech_stack}
87
+ language: ${language}
88
+ status: "pending"
89
+ </field>
90
+ <field name="condition">IF platform_type == backend THEN include completed_dir and sourceFile</field>
91
+ <field name="output" var="task_entry"/>
92
+ </block>
93
+ </block>
94
+
95
+ <!-- Step 5: Build summarize parameters -->
96
+ <block type="task" id="B5" action="analyze" desc="Build summarize_params object">
97
+ <field name="build_object">
98
+ skill: "speccrew-knowledge-module-summarize"
99
+ module_name: ${module_name}
100
+ module_path: ${output_path}/bizs/${platform_id}/${module_name}
101
+ language: ${language}
102
+ </field>
103
+ <field name="output" var="summarize_params"/>
104
+ </block>
105
+
106
+ <!-- Step 6: Compile task plan JSON -->
107
+ <block type="task" id="B6" action="analyze" desc="Compile final task plan JSON">
108
+ <field name="compile">
109
+ module_name: ${module_name}
110
+ platform_id: ${platform_id}
111
+ analyzer_skill: ${analyzer_skill}
112
+ tasks: ${task_entries}
113
+ total_pending: ${task_entries.length}
114
+ summarize_params: ${summarize_params}
115
+ </field>
116
+ <field name="output" var="task_plan"/>
117
+ </block>
118
+
119
+ <!-- Checkpoint: Verify task plan generated -->
120
+ <block type="checkpoint" id="CP1" name="task-plan-generated" desc="Verify task plan is valid">
121
+ <field name="verify" value="${task_plan.module_name} != null AND ${task_plan.tasks} != null"/>
122
+ </block>
123
+
124
+ </sequence>
125
+
126
+ <!-- ============================================================
127
+ Output Results
128
+ ============================================================ -->
129
+ <block type="output" id="O1" desc="Workflow output results">
130
+ <field name="module_name" from="${task_plan.module_name}" type="string" desc="Module being processed"/>
131
+ <field name="platform_id" from="${task_plan.platform_id}" type="string" desc="Platform identifier"/>
132
+ <field name="analyzer_skill" from="${task_plan.analyzer_skill}" type="string" desc="Selected analyzer skill name"/>
133
+ <field name="tasks" from="${task_plan.tasks}" type="array" desc="Array of pending features to analyze"/>
134
+ <field name="total_pending" from="${task_plan.total_pending}" type="number" desc="Count of pending features"/>
135
+ <field name="summarize_params" from="${task_plan.summarize_params}" type="object" desc="Parameters for module-summarize skill"/>
136
+ <field name="task_plan" from="${task_plan}" type="object" desc="Complete task plan JSON"/>
137
+ </block>
138
+
139
+ </workflow>
@@ -65,123 +65,11 @@ Match user requirement text against business knowledge base features to identify
65
65
  | `medium` | Partial match or synonym match |
66
66
  | `low` | Related concept match only |
67
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**
68
+ ## AgentFlow Definition
178
69
 
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"
70
+ <!-- @agentflow: workflow.agentflow.xml -->
183
71
 
184
- **Output**: "Step 4 Status: COMPLETED - Generated recommendation"
72
+ > **REQUIRED**: Before executing this workflow, read the XML workflow specification: `speccrew-workspace/docs/rules/agentflow-spec.md`
185
73
 
186
74
  ## Constraints
187
75
 
@@ -0,0 +1,146 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <workflow id="module-matcher-main" status="pending" version="1.0" desc="Match user requirement text against business knowledge base features">
3
+
4
+ <!-- ============================================================
5
+ Input Parameters Definition
6
+ ============================================================ -->
7
+ <block type="input" id="I1" desc="Workflow input parameters">
8
+ <field name="requirement_text" required="true" type="string" desc="User requirement text to match"/>
9
+ <field name="features_files" required="true" type="array" desc="Array of paths to features-*.json files"/>
10
+ <field name="language" required="true" type="string" desc="Target language for output"/>
11
+ </block>
12
+
13
+ <!-- ============================================================
14
+ Global Constraints
15
+ ============================================================ -->
16
+ <block type="rule" id="R1" level="mandatory" desc="Execution constraints">
17
+ <field name="text">This skill is READ-ONLY - do not modify any files</field>
18
+ <field name="text">Handle Chinese+English mixed text matching</field>
19
+ <field name="text">Skip unreadable files - continue processing others</field>
20
+ </block>
21
+
22
+ <!-- ============================================================
23
+ Main Processing Sequence
24
+ ============================================================ -->
25
+ <sequence id="S1" name="Module Matching" status="pending" desc="Match requirement to knowledge base modules">
26
+
27
+ <!-- Step 1: Parse requirement text -->
28
+ <block type="task" id="B1" action="analyze" desc="Parse requirement and extract keywords">
29
+ <field name="input" value="${requirement_text}"/>
30
+ <field name="operations">
31
+ - Tokenize: Split text into words/phrases
32
+ - Extract entities: Identify nouns, technical terms, business concepts
33
+ - Normalize: Convert to lowercase, handle Chinese/English mixed text
34
+ - Build keyword list: Create array of searchable terms
35
+ </field>
36
+ <field name="chinese_handling">
37
+ - Use character-level matching for Chinese terms
38
+ - Consider common abbreviations (e.g., "用户" matches "user")
39
+ - Support both simplified and traditional characters
40
+ </field>
41
+ <field name="output" var="keywords"/>
42
+ </block>
43
+
44
+ <!-- Step 2: Read features files and build index -->
45
+ <block type="loop" id="L1" over="${features_files}" as="features_file" desc="Process each features file">
46
+ <block type="error-handler" id="EH1" desc="Handle file read errors gracefully">
47
+ <try>
48
+ <block type="task" id="B2" action="read-file" desc="Read features file">
49
+ <field name="path" value="${features_file}"/>
50
+ <field name="output" var="file_content"/>
51
+ </block>
52
+ <block type="task" id="B3" action="analyze" desc="Extract platform and module info">
53
+ <field name="input" value="${file_content}"/>
54
+ <field name="extract">
55
+ - platformId
56
+ - platformType
57
+ - modules (grouped by module name)
58
+ - features (with fileName, sourcePath)
59
+ </field>
60
+ <field name="output" var="platform_data"/>
61
+ </block>
62
+ </try>
63
+ <catch>
64
+ <block type="event" id="E1" action="log" level="warn" desc="Log file skip">
65
+ <field name="message">Skipping unreadable file: ${features_file}</field>
66
+ </block>
67
+ </catch>
68
+ </block>
69
+ </block>
70
+
71
+ <!-- Step 3: Perform semantic matching -->
72
+ <block type="task" id="B4" action="analyze" desc="Match keywords against module-feature index">
73
+ <field name="input">
74
+ keywords: ${keywords}
75
+ platform_data: ${platform_data}
76
+ </field>
77
+ <field name="matching_algorithm">
78
+ FOR each platform IN platforms:
79
+ FOR each module IN platform.modules:
80
+ score = 0
81
+ matching_features = []
82
+
83
+ FOR each keyword IN keywords:
84
+ IF keyword matches module.name THEN
85
+ score += 3 // high confidence boost
86
+ END IF
87
+
88
+ FOR each feature IN module.features:
89
+ IF keyword matches feature.fileName THEN
90
+ score += 1
91
+ matching_features.add(feature)
92
+ END IF
93
+ END FOR
94
+ END FOR
95
+
96
+ IF score > 0 THEN
97
+ confidence = calculate_confidence(score, keyword_count)
98
+ matched_modules.add(module with confidence)
99
+ END IF
100
+ END FOR
101
+ END FOR
102
+ </field>
103
+ <field name="confidence_levels">
104
+ - high: Direct keyword match with module name or feature fileName
105
+ - medium: Partial match or synonym match
106
+ - low: Related concept match only
107
+ </field>
108
+ <field name="output" var="matched_modules"/>
109
+ </block>
110
+
111
+ <!-- Step 4: Sort and generate recommendation -->
112
+ <block type="task" id="B5" action="analyze" desc="Sort results and generate recommendation">
113
+ <field name="input" value="${matched_modules}"/>
114
+ <field name="operations">
115
+ - Sort matched modules by confidence (high → medium → low)
116
+ - Generate recommendation text based on top matches
117
+ - Collect unmatched keywords for user awareness
118
+ </field>
119
+ <field name="recommendation_template">
120
+ - High confidence: "Module '{name}' is highly relevant for this requirement"
121
+ - Medium confidence: "Module '{name}' may be relevant"
122
+ - Low confidence: "Module '{name}' has partial relevance"
123
+ </field>
124
+ <field name="output" var="final_result"/>
125
+ </block>
126
+
127
+ <!-- Checkpoint: Verify matching complete -->
128
+ <block type="checkpoint" id="CP1" name="matching-complete" desc="Verify matching completed">
129
+ <field name="verify" value="${final_result.matched_modules} != null"/>
130
+ </block>
131
+
132
+ </sequence>
133
+
134
+ <!-- ============================================================
135
+ Output Results
136
+ ============================================================ -->
137
+ <block type="output" id="O1" desc="Workflow output results">
138
+ <field name="matched_modules" from="${final_result.matched_modules}" type="array" desc="List of matched modules with confidence"/>
139
+ <field name="unmatched_keywords" from="${final_result.unmatched_keywords}" type="array" desc="Keywords that didn't match any module"/>
140
+ <field name="recommendation" from="${final_result.recommendation}" type="string" desc="Suggested modules based on requirement analysis"/>
141
+ <field name="total_platforms_scanned" from="${final_result.total_platforms_scanned}" type="number" desc="Number of platforms scanned"/>
142
+ <field name="total_modules_scanned" from="${final_result.total_modules_scanned}" type="number" desc="Number of modules scanned"/>
143
+ <field name="message" value="Matching completed" type="string" desc="Status message"/>
144
+ </block>
145
+
146
+ </workflow>