speccrew 0.6.5 → 0.6.8

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.
@@ -61,21 +61,26 @@ Stage 4: System Summary
61
61
  | `head_commit` | (incremental only) Git HEAD commit hash | `HEAD` |
62
62
  | `changed_files` | (incremental only) Pre-computed changed file list | — |
63
63
  | `max_concurrent_workers` | Maximum parallel Worker Agents | `5` |
64
- | `graph_root` | Graph data output root path | `speccrew-workspace/knowledges/bizs/graph` |
65
- | `graph_write_script_path` | Path to graph-write script file | `{graph_write_skill_path}/scripts/graph-write.js` |
66
- | `completed_dir` | Marker file output directory for Worker results | `{sync_state_path}/completed` |
64
+ | `workspace_path` | **(required)** Absolute path to speccrew-workspace directory | — |
65
+ | `sync_state_bizs_dir` | **(required)** Absolute path to `knowledges/base/sync-state/knowledge-bizs/` | — |
66
+ | `ide_skills_dir` | **(required)** Absolute path to IDE skills directory (e.g., `.qoder/skills`, `.cursor/skills`) | — |
67
+ | `configs_dir` | **(required)** Absolute path to `docs/configs/` directory | — |
68
+ | `graph_root` | Graph data output root path (absolute path preferred) | `{workspace_path}/knowledges/bizs/graph` |
69
+ | `completed_dir` | Marker file output directory for Worker results (absolute path required) | `{sync_state_bizs_dir}/completed` |
70
+
71
+ > **MANDATORY**: All path parameters MUST be absolute paths provided by the caller. DO NOT use ListDir to search for script locations. DO NOT construct paths by guessing or relative path resolution.
67
72
 
68
73
  > **Note**: Ensure `graph_root` directory exists before first execution. If it does not exist, create it: `mkdir -p "{graph_root}"` (or equivalent on Windows: `New-Item -ItemType Directory -Path "{graph_root}" -Force`).
69
74
 
70
75
  ## Output
71
76
 
72
- - Entry directories: `speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/entry-dirs-{platform}.json`
73
- - Feature inventory: `speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/features-{platform}.json`
74
- - Feature docs: `speccrew-workspace/knowledges/bizs/{platform}/{module}/features/*.md`
75
- - Module overviews: `speccrew-workspace/knowledges/bizs/{platform}/{module}/*-overview.md`
76
- - UI style patterns: `speccrew-workspace/knowledges/techs/{platform_id}/ui-style-patterns/` (page-types/, components/, layouts/)
77
- - System overview: `speccrew-workspace/knowledges/bizs/system-overview.md`
78
- - Graph data: `speccrew-workspace/knowledges/bizs/graph/`
77
+ - Entry directories: `{sync_state_bizs_dir}/entry-dirs-{platform}.json`
78
+ - Feature inventory: `{sync_state_bizs_dir}/features-{platform}.json`
79
+ - Feature docs: `{workspace_path}/knowledges/bizs/{platform}/{module}/features/*.md`
80
+ - Module overviews: `{workspace_path}/knowledges/bizs/{platform}/{module}/*-overview.md`
81
+ - UI style patterns: `{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/` (page-types/, components/, layouts/)
82
+ - System overview: `{workspace_path}/knowledges/bizs/system-overview.md`
83
+ - Graph data: `{workspace_path}/knowledges/bizs/graph/`
79
84
 
80
85
  ## Workflow Overview
81
86
 
@@ -172,61 +177,29 @@ flowchart TB
172
177
 
173
178
  ---
174
179
 
175
- ## Stage 1a: Entry Directory Recognition (LLM-Driven)
180
+ ## Stage 1a: Entry Directory Recognition
176
181
 
177
- **Goal**: For each detected platform, use LLM to analyze the source directory tree and identify all entry directories (API controllers for backend, views/pages for frontend), then classify them into business modules.
182
+ **Goal**: For each detected platform, analyze the source directory tree and identify all entry directories (API controllers for backend, views/pages for frontend), then classify them into business modules.
178
183
 
179
- > **IMPORTANT**: This stage is executed **directly by the dispatch agent (Leader)** using LLM analysis capabilities (Read/ListDir/Grep), NOT delegated to a Worker Agent.
184
+ > **IMPORTANT**: This stage is executed **directly by the dispatch agent (Leader)**, NOT delegated to a Worker Agent.
180
185
 
181
186
  **Prerequisite**: Stage 0 completed. Platform list confirmed with `platformId`, `sourcePath`, `platformType`, `platformSubtype`, and `techIdentifier` for each platform.
182
187
 
183
- **Execution Flow** (for each platform):
184
-
185
- ### Step 1: Read Directory Tree
186
-
187
- Use `ListDir` or `Bash(tree)` to read the platform's `{source_path}` directory structure (3 levels deep):
188
-
189
- ```bash
190
- # Windows (PowerShell)
191
- tree /F /A "{source_path}" | Select-Object -First 100
192
-
193
- # Unix/Linux/Mac
194
- tree -L 3 "{source_path}"
195
- ```
196
-
197
- ### Step 2: LLM Analysis - Identify Entry Directories
188
+ **Execution**: Follow the `speccrew-knowledge-bizs-identify-entries` skill workflow:
198
189
 
199
- Based on the directory tree and technology stack, analyze and identify entry directories:
190
+ 1. For each platform, read the source directory tree (3 levels deep)
191
+ 2. Identify entry directories based on platform type:
192
+ - **Backend (Spring/Java/Kotlin)**: Find directories containing `*Controller.java` or `*Controller.kt` files. Module name = business package name of the entry directory
193
+ - **Frontend (Vue/React)**: Find `views/` or `pages/` directories. First-level subdirectories = business modules
194
+ - **Mobile (UniApp)**: Find first-level subdirectories under `pages/` + top-level `pages-*` directories
195
+ - **Mobile (Mini Program)**: Find first-level subdirectories under `pages/`
196
+ 3. Apply exclusion rules from `tech-stack-mappings.json` (technical dirs, build dirs, test dirs, config dirs)
197
+ 4. Generate `entry-dirs-{platform_id}.json` files
198
+ 5. Validate: modules array non-empty, module names are business-meaningful
200
199
 
201
- **Backend (Spring/Java/Kotlin)**:
202
- - Find all directories containing `*Controller.java` or `*Controller.kt` files
203
- - These are API entry directories
204
- - Module name = the business package name of the entry directory (e.g., `controller/admin/chat` → module `chat`)
200
+ > For detailed entry identification logic, exclusion rules, JSON format, and validation rules, refer to the `speccrew-knowledge-bizs-identify-entries` skill documentation.
205
201
 
206
- **Frontend (Vue/React)**:
207
- - Find `views/` or `pages/` directories
208
- - First-level subdirectories under these directories are business modules
209
- - Each subdirectory is an entry directory (e.g., `views/system/` → module `system`)
210
-
211
- **Mobile (UniApp)**:
212
- - Find first-level subdirectories under `pages/`
213
- - Plus top-level `pages-*` directories (module name = directory name without `pages-` prefix, e.g., `pages-bpm` → module `bpm`)
214
-
215
- **Mobile (Mini Program)**:
216
- - Find first-level subdirectories under `pages/` as modules
217
-
218
- **Exclusion Rules** (directories to ignore):
219
- - Pure technical directories: `config`, `framework`, `enums`, `exception`, `util`, `utils`, `common`, `constant`, `constants`, `type`, `types`, `dto`, `vo`, `entity`, `model`, `mapper`, `repository`, `dao`, `service`, `impl`
220
- - Build/output directories: `dist`, `build`, `target`, `out`, `node_modules`
221
- - Test directories: `test`, `tests`, `spec`, `__tests__`, `e2e`
222
- - Configuration directories: `.git`, `.idea`, `.vscode`, `.speccrew`
223
-
224
- **Root Module Handling**:
225
- - If an entry file is not under any subdirectory (directly under `{source_path}`), assign it to the `_root` module
226
-
227
- ### Step 3: Generate entry-dirs JSON
228
-
229
- Output file: `{speccrew_workspace}/knowledges/base/sync-state/knowledge-bizs/entry-dirs-{platform_id}.json`
202
+ **Output**: `{sync_state_bizs_dir}/entry-dirs-{platform_id}.json`
230
203
 
231
204
  **JSON Format**:
232
205
  ```json
@@ -239,37 +212,11 @@ Output file: `{speccrew_workspace}/knowledges/base/sync-state/knowledge-bizs/ent
239
212
  "techStack": ["spring-boot", "mybatis-plus"],
240
213
  "modules": [
241
214
  { "name": "chat", "entryDirs": ["controller/admin/chat"] },
242
- { "name": "image", "entryDirs": ["controller/admin/image"] },
243
- { "name": "knowledge", "entryDirs": ["controller/admin/knowledge"] },
244
- { "name": "_root", "entryDirs": ["controller/admin"] }
215
+ { "name": "image", "entryDirs": ["controller/admin/image"] }
245
216
  ]
246
217
  }
247
218
  ```
248
219
 
249
- **Field Definitions**:
250
- - `platformId`: Platform identifier (e.g., `backend-ai`, `web-vue`, `mobile-uniapp`)
251
- - `platformName`: (Optional) Human-readable platform name. Auto-generated as `{platform_type}-{platform_subtype}` if missing
252
- - `platformType`: (Optional) Platform type: `backend`, `web`, `mobile`, `desktop`. Inferred from platform_id if missing
253
- - `platformSubtype`: (Optional) Platform subtype (e.g., `ai`, `vue`, `uniapp`). Inferred from platform_id if missing
254
- - `sourcePath`: Absolute path to the platform source root
255
- - `techStack`: (Optional) Array of tech stack names (e.g., `["spring-boot", "mybatis-plus"]`). Default inferred from platform_type
256
- - `modules`: Array of business modules
257
- - `name`: Module name (business-meaningful, e.g., `chat`, `system`, `order`)
258
- - `entryDirs`: Array of entry directory paths (relative to `{source_path}`)
259
-
260
- **Path Rules**:
261
- - All `entryDirs` paths must be relative to `{source_path}`
262
- - Use forward slashes `/` as path separators (even on Windows)
263
- - Do not include leading or trailing slashes
264
-
265
- ### Step 4: Validation
266
-
267
- After generating the entry-dirs JSON:
268
- 1. Verify that `modules` array is not empty
269
- 2. Verify that each module has at least one entry directory
270
- 3. Verify that module names are business-meaningful (not technical terms like `config`, `util`)
271
- 4. If validation fails, re-analyze the directory tree
272
-
273
220
  **Error handling**: If entry directory recognition fails for a platform, STOP and report the error with platform details. Do NOT proceed to Stage 1b for that platform.
274
221
 
275
222
  ---
@@ -281,19 +228,17 @@ After generating the entry-dirs JSON:
281
228
  > **IMPORTANT**: This stage is executed **directly by the dispatch agent (Leader)**, NOT delegated to a Worker Agent.
282
229
  > Worker Agents do not have `run_in_terminal` capability, which is required for script execution.
283
230
 
284
- **Prerequisite**: Stage 1a completed. `entry-dirs-{platform_id}.json` files exist in `{sync_state_path}/knowledge-bizs/`.
231
+ **Prerequisite**: Stage 1a completed. `entry-dirs-{platform_id}.json` files exist in `{sync_state_bizs_dir}/`.
285
232
 
286
233
  **Action** (dispatch executes directly via `run_in_terminal`):
287
234
 
288
- 1. **Read platform mapping**: Read `speccrew-workspace/docs/configs/platform-mapping.json` and `tech-stack-mappings.json` for platform configuration
289
- 2. **Locate the inventory script**: Find `generate-inventory.js` in the `speccrew-knowledge-bizs-init-features` skill's scripts directory:
290
- - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js`
291
- - Where `{ide_skills_dir}` is the IDE-specific skills directory (e.g., `.qoder/skills/`, `.cursor/skills/`, `.vscode/skills/`, `.speccrew/skills/`)
292
- - Use `ListDir` to locate the script if the exact path is unknown
293
- 3. **Execute inventory script** for each platform:
235
+ 1. **Read platform mapping**: Read `{configs_dir}/platform-mapping.json` and `{configs_dir}/tech-stack-mappings.json` for platform configuration
236
+ 2. **Execute inventory script** for each platform:
294
237
  ```
295
- node "{path_to_generate_inventory_js}" --entryDirsFile "{entry_dirs_file_path}"
238
+ node "{ide_skills_dir}/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js" --entryDirsFile "{sync_state_bizs_dir}/entry-dirs-{platform_id}.json"
296
239
  ```
240
+ - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-init-features/scripts/generate-inventory.js`
241
+ - The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
297
242
 
298
243
  **Script Parameters**:
299
244
  - `--entryDirsFile`: Path to the `entry-dirs-{platform_id}.json` file generated in Stage 1a (required)
@@ -306,7 +251,7 @@ After generating the entry-dirs JSON:
306
251
  - `--excludeDirs`: Additional directories to exclude
307
252
 
308
253
  **Output**:
309
- - `{speccrew_workspace}/knowledges/base/sync-state/knowledge-bizs/features-{platform_id}.json` — Per-platform feature inventory files
254
+ - `{sync_state_bizs_dir}/features-{platform_id}.json` — Per-platform feature inventory files
310
255
  - Each file contains: platform metadata, modules list, and flat features array with `analyzed` status
311
256
 
312
257
  **Features JSON Structure**:
@@ -349,17 +294,16 @@ After generating the entry-dirs JSON:
349
294
 
350
295
  **Prerequisite**: Stage 1b completed.
351
296
 
352
- **Skip condition**: If no `features-*.new.json` files exist in `{sync_state_path}/knowledge-bizs/`, skip this Stage entirely and proceed to Stage 2.
297
+ **Skip condition**: If no `features-*.new.json` files exist in `{sync_state_bizs_dir}/`, skip this Stage entirely and proceed to Stage 2.
353
298
 
354
299
  **Action** (dispatch executes directly via `run_in_terminal`):
355
300
 
356
- 1. **Locate the merge script**: Find `merge-features.js` in the `speccrew-knowledge-bizs-dispatch` skill's scripts directory:
357
- - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js`
358
-
359
- 2. **Execute merge script**:
301
+ 1. **Execute merge script**:
360
302
  ```
361
- node "{path_to_merge_features_js}" --syncStatePath "{sync_state_path}/knowledge-bizs" --completedDir "{completed_dir}" --projectRoot "{project_root}"
303
+ node "{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js" --syncStatePath "{sync_state_bizs_dir}" --completedDir "{completed_dir}" --projectRoot "{source_path}"
362
304
  ```
305
+ - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/merge-features.js`
306
+ - The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
363
307
 
364
308
  3. **Read output JSON** from stdout and report merge results:
365
309
  - Added features: new source files discovered
@@ -432,15 +376,12 @@ node -e "require('fs').mkdirSync('{completed_dir}', {recursive: true}); console.
432
376
 
433
377
  **Step 1: Get Next Batch**
434
378
 
435
- 1. **Locate the script**: Find `batch-orchestrator.js` in the `speccrew-knowledge-bizs-dispatch` skill's scripts directory:
436
- - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js`
437
- - Where `{ide_skills_dir}` is the IDE-specific skills directory (e.g., `.qoder/skills/`, `.cursor/skills/`, `.vscode/skills/`, `.speccrew/skills/`)
438
- - Use `ListDir` to locate the script if the exact path is unknown
439
-
440
- 2. **Execute get-batch**:
379
+ 1. **Execute get-batch**:
441
380
  ```
442
- node "{path_to_batch_orchestrator_js}" get-batch --syncStatePath "{sync_state_path}" --batchSize 5
381
+ node "{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" get-batch --syncStatePath "{sync_state_bizs_dir}" --batchSize 5
443
382
  ```
383
+ - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js`
384
+ - The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
444
385
 
445
386
  - If output `action` is `"done"` → All features processed. Exit Stage 2, proceed to Stage 3.
446
387
  - If output `action` is `"process"` → The `batch` array contains features to analyze. Proceed to Step 2.
@@ -480,6 +421,8 @@ After each analyze worker completes (writes `.done.json` marker), immediately di
480
421
  "api_analysis_path": "<feature.documentPath>",
481
422
  "platform_id": "<feature.platform_id>",
482
423
  "output_dir": "<completed_dir_absolute_path>",
424
+ "workspace_path": "<workspace_path_absolute_path>",
425
+ "sync_state_bizs_dir": "<sync_state_bizs_dir_absolute_path>",
483
426
  "module": "<feature.module>",
484
427
  "fileName": "<feature.fileName>",
485
428
  "sourcePath": "<feature.sourcePath>",
@@ -504,6 +447,8 @@ After each analyze worker completes (writes `.done.json` marker), immediately di
504
447
  "platform_type": "<feature.platform_type>",
505
448
  "platform_subtype": "<feature.platform_subtype>",
506
449
  "completed_dir": "<completed_dir_absolute_path>",
450
+ "workspace_path": "<workspace_path_absolute_path>",
451
+ "sync_state_bizs_dir": "<sync_state_bizs_dir_absolute_path>",
507
452
  "sourceFile": "<feature.sourceFile>",
508
453
  "status": "<analysis_status>",
509
454
  "analysisNotes": "<analysis_notes>",
@@ -526,7 +471,7 @@ Example: If batch has 5 features → create and launch 5 Worker Tasks simultaneo
526
471
  ```json
527
472
  {
528
473
  "skill_name": "speccrew-knowledge-bizs-ui-analyze",
529
- "instructions": "请分析以下源代码文件,生成详细的功能文档。\n\n⚠️ CRITICAL - Template Fill-in Workflow (MANDATORY):\n1. First, copy the analysis template to documentPath (template structure = document skeleton)\n2. Then fill each Section using search_replace to replace placeholders with actual data\n3. NEVER use create_file to rewrite the entire document — this destroys template structure\n4. NEVER delete or skip any template Section — if no data available, fill with \"N/A\"\n5. NEVER create custom Section structures — use ONLY the template's predefined Sections\n\n要求:\n- 读取源代码文件,理解相关功能接口\n- 生成详细的文档到 documentPath\n- 创建两个标记文件到 completed_dir\n- 使用 {skill_name} 技能完成此任务",
474
+ "instructions": "请分析以下源代码文件,生成详细的功能文档。\n\n⚠️ CRITICAL - Template Fill-in Workflow (MANDATORY):\n1. First, copy the analysis template to documentPath (template structure = document skeleton)\n2. Then fill each Section using search_replace to replace placeholders with actual data\n3. NEVER use create_file to rewrite the entire document — this destroys template structure\n4. NEVER delete or skip any template Section — if no data available, fill with "N/A"\n5. NEVER create custom Section structures — use ONLY the template's predefined Sections\n\n要求:\n- 读取源代码文件,理解相关功能接口\n- 生成详细的文档到 documentPath\n- 创建两个标记文件到 completed_dir\n- 使用 {skill_name} 技能完成此任务",
530
475
  "context": {
531
476
  "fileName": "<feature.fileName>",
532
477
  "sourcePath": "<feature.sourcePath>",
@@ -536,6 +481,8 @@ Example: If batch has 5 features → create and launch 5 Worker Tasks simultaneo
536
481
  "platformSubtype": "<feature.platformSubtype>",
537
482
  "language": "<user language>",
538
483
  "completed_dir": "<completed_dir_absolute_path>",
484
+ "workspace_path": "<workspace_path_absolute_path>",
485
+ "sync_state_bizs_dir": "<sync_state_bizs_dir_absolute_path>",
539
486
  "sourceFile": "<feature.sourceFile>"
540
487
  }
541
488
  }
@@ -565,32 +512,56 @@ Example: If batch has 5 features → create and launch 5 Worker Tasks simultaneo
565
512
 
566
513
  ### **CRITICAL - Marker File Naming Convention (STRICT RULES)**
567
514
 
515
+ #### Formula
516
+
517
+ **Pattern**: `{module}-{subpath}-{fileName}.{type}.json`
518
+
519
+ | Component | Description | Example |
520
+ |-----------|-------------|---------|
521
+ | `module` | Business module name | `chat`, `user`, `order` |
522
+ | `subpath` | Sub-path within module, `/` replaced with `-`. Empty if file is directly under module | `admin`, `api-v2` |
523
+ | `fileName` | Source file name WITHOUT extension | `UserController`, `ChatService` |
524
+ | `type` | Marker type: `done`, `error`, or `skip` | `done` |
525
+
526
+ **Examples**:
527
+ | Source File Path | Marker File Name |
528
+ |-----------------|------------------|
529
+ | `chat/ChatController.java` | `chat-ChatController.done.json` |
530
+ | `user/admin/UserController.java` | `user-admin-UserController.done.json` |
531
+ | `order/api/v2/OrderService.java` | `order-api-v2-OrderService.done.json` |
532
+
533
+ > **NOTE**: This naming convention is implemented in `workspace-template/scripts/path-utils.js` via the `getMarkerFileName(moduleName, subpath, fileName, type)` function.
534
+
535
+ ---
536
+
537
+ #### Full Path Format
538
+
568
539
  **✅ CORRECT Format - MUST USE:**
569
540
  ```
570
- {completed_dir}/{module}-{subpath}-{file_name}.done.json ← Completion status marker (JSON format)
571
- {completed_dir}/{module}-{subpath}-{file_name}.graph.json ← Graph data marker (JSON format)
541
+ {completed_dir}/{module}-{subpath}-{fileName}.done.json ← Completion status marker (JSON format)
542
+ {completed_dir}/{module}-{subpath}-{fileName}.graph.json ← Graph data marker (JSON format)
572
543
  ```
573
544
 
574
545
  **Naming Rule Explanation:**
575
546
 
576
- The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{file_name}` to prevent conflicts between same-named source files.
547
+ The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{fileName}` to prevent conflicts between same-named source files.
577
548
 
578
549
  **How Workers Generate the Filename:**
579
550
 
580
551
  1. **module**: Use the `{{module}}` input variable directly
581
552
 
582
- 2. **subpath**: Extract from `{{source_path}}`:
553
+ 2. **subpath**: Extract from `{{sourcePath}}`:
583
554
  - For UI (Vue/React): Middle path between `views/` or `pages/` and the file name
584
555
  - For API (Java): Middle path between controller root and the file name
585
556
  - Replace path separators (`/`) with hyphens (`-`)
586
557
  - Omit if file is at module root (empty subpath)
587
558
 
588
- 3. **file_name**: Use `{{file_name}}` input variable (file name WITHOUT extension)
559
+ 3. **fileName**: Use `{{fileName}}` input variable (file name WITHOUT extension)
589
560
 
590
561
  **Examples:**
591
562
 
592
- | Source File | module | subpath | file_name | Marker Filename |
593
- |-------------|--------|---------|-----------|-----------------|
563
+ | Source File | module | subpath | fileName | Marker Filename |
564
+ |-------------|--------|---------|----------|-----------------|
594
565
  | `yudao-ui/.../views/system/notify/message/index.vue` | `system` | `notify-message` | `index` | `system-notify-message-index.done.json` |
595
566
  | `yudao-ui/.../views/system/user/index.vue` | `system` | `user` | `index` | `system-user-index.done.json` |
596
567
  | `yudao-module-system/.../controller/admin/user/UserController.java` | `system` | `controller-admin-user` | `UserController` | `system-controller-admin-user-UserController.done.json` |
@@ -601,11 +572,11 @@ The marker filename MUST follow the composite naming pattern `{module}-{subpath}
601
572
 
602
573
  **❌ WRONG Format - NEVER USE:**
603
574
  ```
604
- {file_name}.done.json ← WRONG: missing module and subpath (causes conflicts)
605
- {file_name}.graph.json ← WRONG: missing module and subpath (causes conflicts)
606
- {file_name}.completed.json ← WRONG extension
607
- {file_name}.done ← WRONG extension (missing .json)
608
- {file_name}_done.json ← WRONG separator and extension
575
+ {fileName}.done.json ← WRONG: missing module and subpath (causes conflicts)
576
+ {fileName}.graph.json ← WRONG: missing module and subpath (causes conflicts)
577
+ {fileName}.completed.json ← WRONG extension
578
+ {fileName}.done ← WRONG extension (missing .json)
579
+ {fileName}_done.json ← WRONG separator and extension
609
580
  ```
610
581
 
611
582
  **❌ WRONG Filename Examples - NEVER USE:**
@@ -669,6 +640,9 @@ The marker filename MUST follow the composite naming pattern `{module}-{subpath}
669
640
 
670
641
  **Marker File Naming Convention Summary:**
671
642
 
643
+ > **Reference**: See [Marker File Naming Convention Formula](#critical---marker-file-naming-convention-strict-rules) for the complete formula and examples.
644
+ > **Implementation**: `getMarkerFileName()` in `workspace-template/scripts/path-utils.js`
645
+
672
646
  | Marker Type | File Name Format | Example |
673
647
  |-------------|------------------|---------|
674
648
  | Completion marker | `{module}-{subpath}-{fileName}.done.json` | `system-notify-message-index.done.json`, `system-controller-admin-user-UserController.done.json` |
@@ -686,15 +660,12 @@ The marker filename MUST follow the composite naming pattern `{module}-{subpath}
686
660
 
687
661
  **Step 3: Process Batch Results**
688
662
 
689
- 1. **Locate the script**: Find `batch-orchestrator.js` in the `speccrew-knowledge-bizs-dispatch` skill's scripts directory:
690
- - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js`
691
- - Where `{ide_skills_dir}` is the IDE-specific skills directory (e.g., `.qoder/skills/`, `.cursor/skills/`, `.vscode/skills/`, `.speccrew/skills/`)
692
- - Use `ListDir` to locate the script if the exact path is unknown
693
-
694
- 2. **Execute process-results**:
663
+ 1. **Execute process-results**:
695
664
  ```
696
- node "{path_to_batch_orchestrator_js}" process-results --syncStatePath "{sync_state_path}" --graphRoot "{graph_root}" --platformId "{platformId}"
665
+ node "{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js" process-results --syncStatePath "{sync_state_bizs_dir}" --graphRoot "{graph_root}" --platformId "{platformId}"
697
666
  ```
667
+ - Script location: `{ide_skills_dir}/speccrew-knowledge-bizs-dispatch/scripts/batch-orchestrator.js`
668
+ - The `{ide_skills_dir}` parameter is passed by the caller as an absolute path
698
669
 
699
670
  This script:
700
671
  - Scans `.done.json` files → updates feature status to `completed` in features-*.json
@@ -715,7 +686,7 @@ Dispatch 采用完全无状态的文件驱动设计。如果执行过程中发
715
686
  #### Stage 2 Output
716
687
 
717
688
  - Generated by Analyze Workers: Feature documentation at `feature.documentPath` (one .md per feature); marker files (`.done.json`) in `completed_dir`
718
- - Generated by Graph Workers: Graph data files (`.graph.json`) in `completed_dir`; consolidated graph data in `speccrew-workspace/knowledges/bizs/graph/`
689
+ - Generated by Graph Workers: Graph data files (`.graph.json`) in `completed_dir`; consolidated graph data in `{workspace_path}/knowledges/bizs/graph/`
719
690
  - Updated by `process-results`: Each `features-{platform}.json` updated with analysis timestamps and status
720
691
  - Marker files cleaned up after each batch
721
692
 
@@ -743,12 +714,14 @@ When dealing with modules containing more than **20 features**, consider the fol
743
714
  **Prerequisite**: Stage 2 completed for the module (in full or incremental mode).
744
715
 
745
716
  **Action (full mode)**:
746
- - Read all `features-{platform}.json` files from `speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/`
717
+ - Read all `features-{platform}.json` files from `{sync_state_bizs_dir}/`
747
718
  - For each platform, group features by `module` to identify unique modules
748
719
  - For each module, invoke 1 Worker Agent (`speccrew-task-worker.md`) with `skill_name: speccrew-knowledge-module-summarize`
749
720
  - Parameters to pass to skill:
750
721
  - `module_name`: Module code_name
751
- - `module_path`: Path to module directory (e.g., `speccrew-workspace/knowledges/bizs/{platform_id}/{module_name}/`)
722
+ - `module_path`: Path to module directory (e.g., `{workspace_path}/knowledges/bizs/{platform_id}/{module_name}/`)
723
+ - `workspace_path`: Absolute path to speccrew-workspace directory — **REQUIRED**
724
+ - `sync_state_bizs_dir`: Absolute path to sync-state/knowledge-bizs directory — **REQUIRED**
752
725
  - `language`: User's language — **REQUIRED**
753
726
  - **Behavior constraint**: Worker MUST NOT create any temporary scripts or workaround files. If execution fails, STOP and report error immediately.
754
727
 
@@ -782,20 +755,22 @@ Platform: Mobile App (mobile-flutter)
782
755
 
783
756
  **Platform Filter**: Only execute for frontend platforms (platformType = web, mobile, desktop). Backend platforms skip this stage.
784
757
 
785
- **Directory Creation**: The `ui-style-extract` skill automatically creates the output directory (`knowledges/techs/{platform_id}/ui-style-patterns/`) if it does not exist. No pre-check required.
758
+ **Directory Creation**: The `ui-style-extract` skill automatically creates the output directory (`{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/`) if it does not exist. No pre-check required.
786
759
 
787
760
  **Action**:
788
- - Read all `features-{platform}.json` files
761
+ - Read all `features-{platform}.json` files from `{sync_state_bizs_dir}/`
789
762
  - Filter platforms where platformType is web/mobile/desktop
790
763
  - Determine platform_id (format: `{platformType}-{platformSubtype}`, e.g., `web-vue`, `mobile-uniapp`, `backend-system`)
791
764
  - For each qualifying platform, launch 1 Worker Agent (`speccrew-task-worker`) with `skill_name: speccrew-knowledge-bizs-ui-style-extract`
792
765
  - Parameters to pass:
793
766
  - `platform_id`: Platform identifier
794
767
  - `platform_type`: Platform type
795
- - `feature_docs_path`: Feature document base path for that platform
796
- - `features_manifest_path`: Path to the corresponding `features-{platform}.json`
797
- - `module_overviews_path`: **Parent directory** containing all module overview subdirectories for that platform (e.g., `knowledges/bizs/web-vue/`). This directory contains `{module}/module-overview.md` or `{module}/{module}-overview.md` files. **NOT** a specific module directory.
798
- - `output_path`: `speccrew-workspace/knowledges/techs/{platform_id}/ui-style-patterns/`
768
+ - `feature_docs_path`: Feature document base path for that platform (e.g., `{workspace_path}/knowledges/bizs/{platform_id}`)
769
+ - `features_manifest_path`: Path to the corresponding `{sync_state_bizs_dir}/features-{platform}.json`
770
+ - `module_overviews_path`: **Parent directory** containing all module overview subdirectories for that platform (e.g., `{workspace_path}/knowledges/bizs/web-vue/`). This directory contains `{module}/module-overview.md` or `{module}/{module}-overview.md` files. **NOT** a specific module directory.
771
+ - `output_path`: `{workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/`
772
+ - `workspace_path`: Absolute path to speccrew-workspace directory — **REQUIRED**
773
+ - `sync_state_bizs_dir`: Absolute path to sync-state/knowledge-bizs directory — **REQUIRED**
799
774
  - `language`: User's language
800
775
  - **Behavior constraint**: Worker MUST NOT create any temporary scripts or workaround files. If execution fails, STOP and report error immediately.
801
776
 
@@ -809,7 +784,7 @@ Platform: Mobile App (mobile-flutter)
809
784
 
810
785
  **Output per Platform**:
811
786
  ```
812
- speccrew-workspace/knowledges/techs/{platform_id}/ui-style-patterns/
787
+ {workspace_path}/knowledges/techs/{platform_id}/ui-style-patterns/
813
788
  ├── page-types/
814
789
  │ └── {pattern-name}.md
815
790
  ├── components/
@@ -829,18 +804,20 @@ speccrew-workspace/knowledges/techs/{platform_id}/ui-style-patterns/
829
804
  **Prerequisite**: All Stage 3 tasks completed.
830
805
 
831
806
  **Action**:
832
- - Read all `features-{platform}.json` files from `speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/` to get platform structure
807
+ - Read all `features-{platform}.json` files from `{sync_state_bizs_dir}/` to get platform structure
833
808
  - Invoke 1 Worker Agent (`speccrew-task-worker.md`) with `skill_name: speccrew-knowledge-system-summarize`
834
809
  - Parameters to pass to skill:
835
- - `modules_path`: Path to knowledge base directory containing all platform modules (e.g., `speccrew-workspace/knowledges/bizs/`)
836
- - `output_path`: Output path for system-overview.md (e.g., `speccrew-workspace/knowledges/bizs/`)
810
+ - `modules_path`: Path to knowledge base directory containing all platform modules (e.g., `{workspace_path}/knowledges/bizs/`)
811
+ - `output_path`: Output path for system-overview.md (e.g., `{workspace_path}/knowledges/bizs/`)
812
+ - `workspace_path`: Absolute path to speccrew-workspace directory — **REQUIRED**
813
+ - `sync_state_bizs_dir`: Absolute path to sync-state/knowledge-bizs directory — **REQUIRED**
837
814
  - `language`: User's language — **REQUIRED**
838
815
  - **Behavior constraint**: Worker MUST NOT create any temporary scripts or workaround files. If execution fails, STOP and report error immediately.
839
816
 
840
817
  Expected Worker Return: `{ "status": "success|failed", "output_file": "system-overview.md", "message": "..." }`
841
818
 
842
819
  **Output**:
843
- - `speccrew-workspace/knowledges/bizs/system-overview.md` (complete with platform index and module hierarchy)
820
+ - `{workspace_path}/knowledges/bizs/system-overview.md` (complete with platform index and module hierarchy)
844
821
 
845
822
  > ✅ **Stage 4 Milestone**: System overview generated. All stages complete. Pipeline finished successfully.
846
823
 
@@ -907,8 +884,8 @@ After all 5 stages complete, return a summary object to the caller:
907
884
  "stage4": { "status": "completed" }
908
885
  },
909
886
  "output": {
910
- "system_overview": "speccrew-workspace/knowledges/bizs/system-overview.md",
911
- "graph_root": "speccrew-workspace/knowledges/bizs/graph/"
887
+ "system_overview": "{workspace_path}/knowledges/bizs/system-overview.md",
888
+ "graph_root": "{workspace_path}/knowledges/bizs/graph/"
912
889
  }
913
890
  }
914
891
  ```
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: speccrew-knowledge-bizs-identify-entries
3
+ description: Analyze source directory structures to identify business module entry directories for each platform. 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
8
+
9
+ Analyze source directory structures to identify business module entry directories for each platform.
10
+
11
+ ## Input Parameters
12
+
13
+ | Parameter | Type | Required | Description |
14
+ |-----------|------|----------|-------------|
15
+ | `{platforms}` | array | Yes | Platform list from detection phase. Each item: `{platformId, sourcePath, platformType, platformSubtype, techStack}` |
16
+ | `{workspace_path}` | string | Yes | Absolute path to speccrew-workspace directory |
17
+ | `{sync_state_bizs_dir}` | string | Yes | Absolute path to entry-dirs JSON output directory |
18
+ | `{configs_dir}` | string | Yes | Absolute path to configuration files directory (for `tech-stack-mappings.json`) |
19
+
20
+ ## Output
21
+
22
+ For each platform, generates:
23
+ - `{sync_state_bizs_dir}/entry-dirs-{platform_id}.json`
24
+
25
+ ## Workflow
26
+
27
+ ### Step 1: Read Directory Tree
28
+
29
+ Use `Glob` or `Bash(tree)` to read each platform's `{sourcePath}` directory structure (3 levels deep):
30
+
31
+ ```bash
32
+ # Windows (PowerShell)
33
+ tree /F /A "{source_path}" | Select-Object -First 100
34
+
35
+ # Unix/Linux/Mac
36
+ tree -L 3 "{source_path}"
37
+ ```
38
+
39
+ ### Step 2: LLM Analysis - Identify Entry Directories
40
+
41
+ Based on the directory tree and technology stack, analyze and identify entry directories for each platform type:
42
+
43
+ **Backend (Spring/Java/Kotlin)**:
44
+ - Find all directories containing `*Controller.java` or `*Controller.kt` files
45
+ - These are API entry directories
46
+ - Module name = the business package name of the entry directory (e.g., `controller/admin/chat` → module `chat`)
47
+
48
+ **Frontend (Vue/React)**:
49
+ - Find `views/` or `pages/` directories
50
+ - First-level subdirectories under these directories are business modules
51
+ - Each subdirectory is an entry directory (e.g., `views/system/` → module `system`)
52
+
53
+ **Mobile (UniApp)**:
54
+ - Find first-level subdirectories under `pages/`
55
+ - Plus top-level `pages-*` directories (module name = directory name without `pages-` prefix, e.g., `pages-bpm` → module `bpm`)
56
+
57
+ **Mobile (Mini Program)**:
58
+ - Find first-level subdirectories under `pages/` as modules
59
+
60
+ ### Step 3: Load Exclusion Rules
61
+
62
+ Read `{configs_dir}/tech-stack-mappings.json` to load exclusion patterns. Apply the following exclusion rules:
63
+
64
+ **Pure Technical Directories**:
65
+ `config`, `framework`, `enums`, `exception`, `util`, `utils`, `common`, `constant`, `constants`, `type`, `types`, `dto`, `vo`, `entity`, `model`, `mapper`, `repository`, `dao`, `service`, `impl`
66
+
67
+ **Build/Output Directories**:
68
+ `dist`, `build`, `target`, `out`, `node_modules`
69
+
70
+ **Test Directories**:
71
+ `test`, `tests`, `spec`, `__tests__`, `e2e`
72
+
73
+ **Configuration Directories**:
74
+ `.git`, `.idea`, `.vscode`, `.speccrew`
75
+
76
+ **Root Module Handling**:
77
+ - If an entry file is not under any subdirectory (directly under `{sourcePath}`), assign it to the `_root` module
78
+
79
+ ### Step 4: Generate entry-dirs JSON
80
+
81
+ Output file: `{sync_state_bizs_dir}/entry-dirs-{platform_id}.json`
82
+
83
+ **JSON Format**:
84
+ ```json
85
+ {
86
+ "platformId": "backend-ai",
87
+ "platformName": "AI Module Backend",
88
+ "platformType": "backend",
89
+ "platformSubtype": "ai",
90
+ "sourcePath": "yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai",
91
+ "techStack": ["spring-boot", "mybatis-plus"],
92
+ "modules": [
93
+ { "name": "chat", "entryDirs": ["controller/admin/chat"] },
94
+ { "name": "image", "entryDirs": ["controller/admin/image"] },
95
+ { "name": "knowledge", "entryDirs": ["controller/admin/knowledge"] },
96
+ { "name": "_root", "entryDirs": ["controller/admin"] }
97
+ ]
98
+ }
99
+ ```
100
+
101
+ **Field Definitions**:
102
+ - `platformId`: Platform identifier (e.g., `backend-ai`, `web-vue`, `mobile-uniapp`)
103
+ - `platformName`: (Optional) Human-readable platform name. Auto-generated as `{platform_type}-{platform_subtype}` if missing
104
+ - `platformType`: (Optional) Platform type: `backend`, `web`, `mobile`, `desktop`. Inferred from platform_id if missing
105
+ - `platformSubtype`: (Optional) Platform subtype (e.g., `ai`, `vue`, `uniapp`). Inferred from platform_id if missing
106
+ - `sourcePath`: Absolute path to the platform source root
107
+ - `techStack`: (Optional) Array of tech stack names (e.g., `["spring-boot", "mybatis-plus"]`). Default inferred from platform_type
108
+ - `modules`: Array of business modules
109
+ - `name`: Module name (business-meaningful, e.g., `chat`, `system`, `order`)
110
+ - `entryDirs`: Array of entry directory paths (relative to `{source_path}`)
111
+
112
+ **Path Rules**:
113
+ - All `entryDirs` paths must be relative to `{sourcePath}`
114
+ - Use forward slashes `/` as path separators (even on Windows)
115
+ - Do not include leading or trailing slashes
116
+
117
+ ### Step 5: Validation
118
+
119
+ After generating the entry-dirs JSON for each platform:
120
+ 1. Verify that `modules` array is not empty
121
+ 2. Verify that each module has at least one entry directory
122
+ 3. Verify that module names are business-meaningful (not technical terms like `config`, `util`)
123
+ 4. If validation fails, re-analyze the directory tree
124
+
125
+ **Error Handling**:
126
+ If entry directory recognition fails for a platform, STOP and report the error with platform details. Do NOT continue processing that platform.
127
+
128
+ ## Checklist
129
+
130
+ - [ ] All platforms' entry-dirs JSON files have been generated
131
+ - [ ] Each platform's `modules` array is non-empty
132
+ - [ ] Module names have business meaning (not technical terms like config, util)
133
+ - [ ] `entryDirs` paths are correct and accessible
134
+ - [ ] JSON format is valid
135
+
136
+ > **MANDATORY**: Use the provided absolute paths directly. DO NOT construct or derive paths yourself.
137
+
138
+ ## Example Usage
139
+
140
+ ```
141
+ Skill: speccrew-knowledge-bizs-identify-entries
142
+ Args:
143
+ platforms: [
144
+ {
145
+ "platformId": "backend-ai",
146
+ "sourcePath": "/path/to/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai",
147
+ "platformType": "backend",
148
+ "platformSubtype": "ai",
149
+ "techStack": ["spring-boot", "mybatis-plus"]
150
+ },
151
+ {
152
+ "platformId": "web-vue",
153
+ "sourcePath": "/path/to/yudao-ui-admin/src",
154
+ "platformType": "web",
155
+ "platformSubtype": "vue",
156
+ "techStack": ["vue3", "element-plus"]
157
+ }
158
+ ]
159
+ workspace_path: "/path/to/speccrew-workspace"
160
+ sync_state_bizs_dir: "/path/to/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs"
161
+ configs_dir: "/path/to/speccrew-workspace/docs/configs"
162
+ ```