speccrew 0.6.29 → 0.6.31

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.
@@ -0,0 +1,288 @@
1
+ ---
2
+ name: speccrew-knowledge-bizs-identify-entries-xml
3
+ description: Analyze source directory structures to identify business module entry directories for each platform using XML workflow blocks. Use when initializing or updating business knowledge base to determine which directories contain user-facing entry points.
4
+ tools: Read, Write, Glob, Grep, Bash
5
+ ---
6
+
7
+ # speccrew-knowledge-bizs-identify-entries-xml
8
+
9
+ Analyze source directory structures to identify business module entry directories for each platform using XML workflow blocks.
10
+
11
+ ## Language Adaptation
12
+
13
+ All generated documents must match the user's language. Detect the language from the user's input and generate content accordingly.
14
+
15
+ - User writes in 中文 → Generate Chinese documents, use `language: "zh"`
16
+ - User writes in English → Generate English documents, use `language: "en"`
17
+ - User writes in other languages → Use appropriate language code
18
+
19
+ ## Trigger Scenarios
20
+
21
+ - Called by `speccrew-knowledge-bizs-dispatch` Stage 1
22
+ - "Identify business module entry directories"
23
+ - "Analyze source structure for business modules"
24
+
25
+ ## Input Parameters
26
+
27
+ | Parameter | Type | Required | Description |
28
+ |-----------|------|----------|-------------|
29
+ | `{platforms}` | array | Yes | Platform list from detection phase. Each item: `{platformId, sourcePath, platformType, platformSubtype, techStack}` |
30
+ | `{workspace_path}` | string | Yes | Absolute path to speccrew-workspace directory |
31
+ | `{sync_state_bizs_dir}` | string | Yes | Absolute path to entry-dirs JSON output directory |
32
+ | `{configs_dir}` | string | Yes | Absolute path to configuration files directory (for `tech-stack-mappings.json`) |
33
+
34
+ ## Output
35
+
36
+ For each platform, generates:
37
+ - `{sync_state_bizs_dir}/entry-dirs-{platform_id}.json`
38
+
39
+ ## Workflow
40
+
41
+ <!--
42
+ == Block Types ==
43
+ input : Workflow input parameters (required=mandatory, default=default value)
44
+ output : Workflow output results (from=data source variable)
45
+ task : Execute action (action: run-skill | run-script | dispatch-to-worker)
46
+ gateway : Conditional branch/gate (mode: exclusive | guard | parallel)
47
+ loop : Iterate over collection (over=collection, as=current item)
48
+ event : Log/confirm/signal (action: log | confirm | signal)
49
+ error-handler : Exception handling (try > catch > finally)
50
+ checkpoint : Persistent milestone (name=checkpoint name, verify=verification condition)
51
+ rule : Constraint declaration (level: forbidden | mandatory | note)
52
+ -->
53
+
54
+ <workflow>
55
+
56
+ <!-- Input Block -->
57
+ <input name="platforms" type="array" required="true" description="Platform list from detection phase" />
58
+ <input name="workspace_path" type="string" required="true" description="Absolute path to speccrew-workspace directory" />
59
+ <input name="sync_state_bizs_dir" type="string" required="true" description="Absolute path to entry-dirs JSON output directory" />
60
+ <input name="configs_dir" type="string" required="true" description="Absolute path to configuration files directory" />
61
+
62
+ <!-- Rule Block: Constraints -->
63
+ <rule level="mandatory">Use the provided absolute paths directly. DO NOT construct or derive paths yourself.</rule>
64
+ <rule level="mandatory">All entryDirs paths must use forward slashes / as path separators (even on Windows)</rule>
65
+ <rule level="mandatory">Do not include leading or trailing slashes in entryDirs paths</rule>
66
+
67
+ <!-- Loop: Process Each Platform -->
68
+ <loop over="platforms" as="platform">
69
+
70
+ <!-- Step 1: Read Directory Tree -->
71
+ <task name="read-directory-tree" action="run-script">
72
+ <description>Read each platform's sourcePath directory structure (3 levels deep)</description>
73
+ <script type="bash">
74
+ <platform-type>windows</platform-type>
75
+ <command>tree /F /A "{platform.sourcePath}" | Select-Object -First 100</command>
76
+ </script>
77
+ <script type="bash">
78
+ <platform-type>unix</platform-type>
79
+ <command>tree -L 3 "{platform.sourcePath}"</command>
80
+ </script>
81
+ <output name="directory_tree" />
82
+ </task>
83
+
84
+ <!-- Step 2: LLM Analysis - Identify Entry Directories -->
85
+ <task name="analyze-entry-dirs" action="run-skill">
86
+ <description>Analyze directory tree and identify entry directories based on platform type</description>
87
+ <input ref="directory_tree" />
88
+ <input ref="platform.platformType" />
89
+ <input ref="platform.platformSubtype" />
90
+ <input ref="platform.techStack" />
91
+ <logic>
92
+ <backend>
93
+ - Find all directories containing *Controller.java or *Controller.kt files
94
+ - These are API entry directories
95
+ - Module name = the business package name of the entry directory
96
+ </backend>
97
+ <frontend-vue-react>
98
+ - Find views/ or pages/ directories
99
+ - First-level subdirectories under these directories are business modules
100
+ </frontend-vue-react>
101
+ <mobile-uniapp>
102
+ - Find first-level subdirectories under pages/
103
+ - Plus top-level pages-* directories (module name = directory name without pages- prefix)
104
+ </mobile-uniapp>
105
+ <mobile-miniprogram>
106
+ - Find first-level subdirectories under pages/ as modules
107
+ </mobile-miniprogram>
108
+ </logic>
109
+ <output name="identified_entries" />
110
+ </task>
111
+
112
+ <!-- Step 3: Load Exclusion Rules -->
113
+ <task name="load-exclusion-rules" action="run-script">
114
+ <description>Read tech-stack-mappings.json to load exclusion patterns</description>
115
+ <script type="read-file">
116
+ <path>{configs_dir}/tech-stack-mappings.json</path>
117
+ </script>
118
+ <output name="exclusion_rules" />
119
+ </task>
120
+
121
+ <!-- Gateway: Apply Exclusion Rules -->
122
+ <gateway mode="guard">
123
+ <condition>identified_entries is not empty</condition>
124
+ <then>
125
+ <task name="filter-entries" action="run-skill">
126
+ <description>Apply exclusion rules to filter out technical directories</description>
127
+ <input ref="identified_entries" />
128
+ <input ref="exclusion_rules" />
129
+ <exclusions>
130
+ <pure-technical>config, framework, enums, exception, util, utils, common, constant, constants, type, types, dto, vo, entity, model, mapper, repository, dao, service, impl</pure-technical>
131
+ <build-output>dist, build, target, out, node_modules</build-output>
132
+ <test-directories>test, tests, spec, __tests__, e2e</test-directories>
133
+ <config-directories>.git, .idea, .vscode, .speccrew</config-directories>
134
+ </exclusions>
135
+ <root-handling>Assign entry files not under any subdirectory to _root module</root-handling>
136
+ <output name="filtered_entries" />
137
+ </task>
138
+ </then>
139
+ </gateway>
140
+
141
+ <!-- Step 4: Generate entry-dirs JSON -->
142
+ <task name="generate-entry-dirs-json" action="run-script">
143
+ <description>Generate entry-dirs JSON file for the platform</description>
144
+ <output-path>{sync_state_bizs_dir}/entry-dirs-{platform.platformId}.json</output-path>
145
+ <content>
146
+ <json-structure>
147
+ {
148
+ "platformId": "{platform.platformId}",
149
+ "platformName": "{platform.platformName}",
150
+ "platformType": "{platform.platformType}",
151
+ "platformSubtype": "{platform.platformSubtype}",
152
+ "sourcePath": "{platform.sourcePath}",
153
+ "techStack": "{platform.techStack}",
154
+ "modules": [
155
+ { "name": "module-name", "entryDirs": ["relative/path/to/entry"] }
156
+ ]
157
+ }
158
+ </json-structure>
159
+ </content>
160
+ <output name="generated_json_path" />
161
+ </task>
162
+
163
+ <!-- Checkpoint: Persist Generated JSON -->
164
+ <checkpoint name="entry-dirs-generated" verify="file_exists({sync_state_bizs_dir}/entry-dirs-{platform.platformId}.json)" />
165
+
166
+ <!-- Step 5: Validation -->
167
+ <task name="validate-output" action="run-skill">
168
+ <description>Validate the generated entry-dirs JSON</description>
169
+ <input ref="generated_json_path" />
170
+ <validation-rules>
171
+ <rule>modules array is not empty</rule>
172
+ <rule>each module has at least one entry directory</rule>
173
+ <rule>module names are business-meaningful (not technical terms like config, util)</rule>
174
+ <rule>entryDirs paths are correct and accessible</rule>
175
+ <rule>JSON format is valid</rule>
176
+ </validation-rules>
177
+ <output name="validation_result" />
178
+ </task>
179
+
180
+ <!-- Gateway: Validation Result -->
181
+ <gateway mode="exclusive">
182
+ <branch condition="validation_result.status == 'failed'">
183
+ <error-handler>
184
+ <catch>
185
+ <event action="log">Entry directory recognition failed for platform {platform.platformId}</event>
186
+ <task name="re-analyze" action="run-skill">
187
+ <description>Re-analyze the directory tree due to validation failure</description>
188
+ <input ref="directory_tree" />
189
+ <output name="re_analyzed_entries" />
190
+ </task>
191
+ </catch>
192
+ </error-handler>
193
+ </branch>
194
+ <branch condition="validation_result.status == 'passed'">
195
+ <event action="log">Platform {platform.platformId} entry-dirs validation passed</event>
196
+ </branch>
197
+ </gateway>
198
+
199
+ </loop>
200
+
201
+ <!-- Output Block -->
202
+ <output name="generated_files" from="generated_json_path" description="List of all generated entry-dirs JSON files" />
203
+ <output name="validation_summary" from="validation_result" description="Summary of validation results for all platforms" />
204
+
205
+ </workflow>
206
+
207
+ ## Output JSON Format
208
+
209
+ ```json
210
+ {
211
+ "platformId": "backend-ai",
212
+ "platformName": "AI Module Backend",
213
+ "platformType": "backend",
214
+ "platformSubtype": "ai",
215
+ "sourcePath": "yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai",
216
+ "techStack": ["spring-boot", "mybatis-plus"],
217
+ "modules": [
218
+ { "name": "chat", "entryDirs": ["controller/admin/chat"] },
219
+ { "name": "image", "entryDirs": ["controller/admin/image"] },
220
+ { "name": "knowledge", "entryDirs": ["controller/admin/knowledge"] },
221
+ { "name": "_root", "entryDirs": ["controller/admin"] }
222
+ ]
223
+ }
224
+ ```
225
+
226
+ ### Field Definitions
227
+
228
+ - `platformId`: Platform identifier (e.g., `backend-ai`, `web-vue`, `mobile-uniapp`)
229
+ - `platformName`: (Optional) Human-readable platform name. Auto-generated as `{platform_type}-{platform_subtype}` if missing
230
+ - `platformType`: (Optional) Platform type: `backend`, `web`, `mobile`, `desktop`. Inferred from platform_id if missing
231
+ - `platformSubtype`: (Optional) Platform subtype (e.g., `ai`, `vue`, `uniapp`). Inferred from platform_id if missing
232
+ - `sourcePath`: Absolute path to the platform source root
233
+ - `techStack`: (Optional) Array of tech stack names (e.g., `["spring-boot", "mybatis-plus"]`). Default inferred from platform_type
234
+ - `modules`: Array of business modules
235
+ - `name`: Module name (business-meaningful, e.g., `chat`, `system`, `order`)
236
+ - `entryDirs`: Array of entry directory paths (relative to `{source_path}`)
237
+
238
+ ### Path Rules
239
+
240
+ - All `entryDirs` paths must be relative to `{sourcePath}`
241
+ - Use forward slashes `/` as path separators (even on Windows)
242
+ - Do not include leading or trailing slashes
243
+
244
+ ## Error Handling
245
+
246
+ | Scenario | Handling |
247
+ |----------|----------|
248
+ | Entry directory recognition fails | STOP and report error with platform details. Do NOT continue processing that platform. |
249
+ | Validation fails | Re-analyze the directory tree and regenerate |
250
+ | Config file not found | Use default exclusion rules and log warning |
251
+
252
+ ## Checklist
253
+
254
+ - [ ] All platforms' entry-dirs JSON files have been generated
255
+ - [ ] Each platform's `modules` array is non-empty
256
+ - [ ] Module names have business meaning (not technical terms like config, util)
257
+ - [ ] `entryDirs` paths are correct and accessible
258
+ - [ ] JSON format is valid
259
+ - [ ] All paths use forward slashes as separators
260
+ - [ ] No leading or trailing slashes in entryDirs paths
261
+
262
+ > **MANDATORY**: Use the provided absolute paths directly. DO NOT construct or derive paths yourself.
263
+
264
+ ## Example Usage
265
+
266
+ ```
267
+ Skill: speccrew-knowledge-bizs-identify-entries-xml
268
+ Args:
269
+ platforms: [
270
+ {
271
+ "platformId": "backend-ai",
272
+ "sourcePath": "/path/to/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai",
273
+ "platformType": "backend",
274
+ "platformSubtype": "ai",
275
+ "techStack": ["spring-boot", "mybatis-plus"]
276
+ },
277
+ {
278
+ "platformId": "web-vue",
279
+ "sourcePath": "/path/to/yudao-ui-admin/src",
280
+ "platformType": "web",
281
+ "platformSubtype": "vue",
282
+ "techStack": ["vue3", "element-plus"]
283
+ }
284
+ ]
285
+ workspace_path: "/path/to/speccrew-workspace"
286
+ sync_state_bizs_dir: "/path/to/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs"
287
+ configs_dir: "/path/to/speccrew-workspace/docs/configs"
288
+ ```