speccrew 0.2.0 → 0.2.2

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.
@@ -221,9 +221,9 @@ When there is only one Feature Spec and one platform:
221
221
 
222
222
  ### 5.4 Parallel Execution (Feature × Platform)
223
223
 
224
- > **IMPORTANT**: Use the **Skill tool** (not the Agent tool) to invoke each design skill.
224
+ > **IMPORTANT**: Dispatch `speccrew-task-worker` agents (via Agent tool) for parallel design execution. Do NOT call design skills directly — each Feature×Platform combination MUST run in an independent Worker Agent for progress visibility and error isolation.
225
225
 
226
- When multiple Feature Specs and/or multiple platforms exist, create a matrix of **Feature × Platform** and use the **Skill tool** to invoke per-platform design skills in parallel:
226
+ When multiple Feature Specs and/or multiple platforms exist, create a matrix of **Feature × Platform** and dispatch `speccrew-task-worker` agents in parallel:
227
227
 
228
228
  **Worker Matrix:**
229
229
 
@@ -245,19 +245,19 @@ Each worker receives:
245
245
 
246
246
  **Before dispatch**: Update each task status to `in_progress` with `started_at` timestamp.
247
247
 
248
- **Parallel execution example** (2 features × 3 platforms = 6 skill invocations):
249
- - Skill 1: speccrew-sd-frontend for Feature A on web-vue → 03.system-design/web-vue/
250
- - Skill 2: speccrew-sd-backend for Feature A on backend-spring → 03.system-design/backend-spring/
251
- - Skill 3: speccrew-sd-mobile for Feature A on mobile-uniapp → 03.system-design/mobile-uniapp/
252
- - Skill 4: speccrew-sd-frontend for Feature B on web-vue → 03.system-design/web-vue/
253
- - Skill 5: speccrew-sd-backend for Feature B on backend-spring → 03.system-design/backend-spring/
254
- - Skill 6: speccrew-sd-mobile for Feature B on mobile-uniapp → 03.system-design/mobile-uniapp/
248
+ **Parallel execution example** (2 features × 3 platforms = 6 workers):
249
+ - Worker 1: speccrew-sd-frontend for Feature A on web-vue → 03.system-design/web-vue/
250
+ - Worker 2: speccrew-sd-backend for Feature A on backend-spring → 03.system-design/backend-spring/
251
+ - Worker 3: speccrew-sd-mobile for Feature A on mobile-uniapp → 03.system-design/mobile-uniapp/
252
+ - Worker 4: speccrew-sd-frontend for Feature B on web-vue → 03.system-design/web-vue/
253
+ - Worker 5: speccrew-sd-backend for Feature B on backend-spring → 03.system-design/backend-spring/
254
+ - Worker 6: speccrew-sd-mobile for Feature B on mobile-uniapp → 03.system-design/mobile-uniapp/
255
255
 
256
- All skills execute simultaneously to maximize efficiency.
256
+ All workers execute simultaneously to maximize efficiency.
257
257
 
258
258
  ### 5.5 Update DISPATCH-PROGRESS.json
259
259
 
260
- After each skill completes, parse its **Task Completion Report** and update:
260
+ After each worker completes, parse its **Task Completion Report** and update:
261
261
 
262
262
  ```json
263
263
  {
@@ -275,7 +275,7 @@ After each skill completes, parse its **Task Completion Report** and update:
275
275
  }
276
276
  ```
277
277
 
278
- Wait for all skills to complete before proceeding to Phase 6.
278
+ Wait for all workers to complete before proceeding to Phase 6.
279
279
 
280
280
  ## Phase 6: Joint Confirmation
281
281
 
@@ -184,7 +184,7 @@ If any pre-check fails:
184
184
 
185
185
  ## Step 4: Dispatch Per-Module Dev Skills
186
186
 
187
- > **IMPORTANT**: Use the **Skill tool** to dispatch dev skills for parallel execution.
187
+ > **IMPORTANT**: Dispatch `speccrew-task-worker` agents (via Agent tool) for parallel module development. Do NOT call dev skills directly — each module MUST run in an independent Worker Agent for progress visibility and error isolation.
188
188
 
189
189
  ### 4.0 Initialize DISPATCH-PROGRESS.json
190
190
 
@@ -282,11 +282,11 @@ for each platform_id:
282
282
  }
283
283
  ```
284
284
 
285
- ### 4.3 Dispatch Skills with Concurrency Limit
285
+ ### 4.3 Dispatch Workers with Concurrency Limit
286
286
 
287
- **Max concurrent child agents: 10**
287
+ **Max concurrent workers: 10**
288
288
 
289
- Process `task_list` using a queue-based concurrency limit model:
289
+ Process `task_list` using a queue-based concurrency limit model. Each task runs in an independent `speccrew-task-worker` agent:
290
290
 
291
291
  ```
292
292
  MAX_CONCURRENT = 10
@@ -303,24 +303,24 @@ while pending is not empty or running is not empty:
303
303
  - Set task.status = "in_progress"
304
304
  - Set task.started_at = current timestamp
305
305
 
306
- // Use Skill tool (not Agent tool)
307
- skill_result = invoke Skill tool with:
308
- - skill: {task.skill_name}
309
- - args: |
310
- platform_id: {task.platform_id}
311
- iteration_path: {task.iteration_path}
312
- design_doc_path: {task.module_design_path}
313
- api_contract_path: {task.api_contract_path}
314
- techs_knowledge_paths: {task.techs_knowledge_paths}
315
- task_id: {task.id} // Pass task ID for completion report
306
+ // Dispatch speccrew-task-worker agent (NOT Skill tool directly)
307
+ Invoke `speccrew-task-worker` agent with:
308
+ - skill_name: {task.skill_name}
309
+ - context:
310
+ - platform_id: {task.platform_id}
311
+ - iteration_path: {task.iteration_path}
312
+ - design_doc_path: {task.module_design_path}
313
+ - api_contract_path: {task.api_contract_path}
314
+ - techs_knowledge_paths: {task.techs_knowledge_paths}
315
+ - task_id: {task.id} // Pass task ID for completion report
316
316
 
317
- running.add({task_id: task.id, skill_handle: skill_result})
317
+ running.add({task_id: task.id})
318
318
 
319
- wait until at least one skill in running completes
319
+ wait until at least one worker in running completes
320
320
 
321
- // Process completed skill result
322
- for each finished skill in running:
323
- Parse Task Completion Report from skill output
321
+ // Process completed worker result
322
+ for each finished worker in running:
323
+ Parse Task Completion Report from worker output
324
324
 
325
325
  if report.status == "SUCCESS":
326
326
  Update DISPATCH-PROGRESS.json:
@@ -339,17 +339,17 @@ while pending is not empty or running is not empty:
339
339
  ```
340
340
 
341
341
  **Dispatch rules:**
342
- - Each skill invocation handles **one module** on **one platform** (not all modules)
342
+ - Each worker handles **one module** on **one platform** (not all modules)
343
343
  - Pass complete context including `design_doc_path`, `skill_name`, platform info, and `task_id`
344
- - Up to 10 skills execute simultaneously (concurrency limit)
344
+ - Up to 10 workers execute simultaneously (concurrency limit)
345
345
  - Update DISPATCH-PROGRESS.json **before** dispatch (status → "in_progress")
346
346
  - Update DISPATCH-PROGRESS.json **after** completion based on Task Completion Report
347
347
  - Track all dispatched tasks: completed / failed / pending counts
348
- - If a skill fails, log the failure and continue with remaining tasks
349
- - Wait for all skills to complete before proceeding to Step 5 (Integration Check)
348
+ - If a worker fails, log the failure and continue with remaining tasks
349
+ - Wait for all workers to complete before proceeding to Step 5 (Integration Check)
350
350
 
351
351
  **Progress Update After Each Batch:**
352
- After processing a batch of completed skills:
352
+ After processing a batch of completed workers:
353
353
  1. Read current DISPATCH-PROGRESS.json
354
354
  2. Update counts: `completed`, `failed`, `pending`
355
355
  3. Write updated DISPATCH-PROGRESS.json
@@ -163,7 +163,7 @@ Design test cases based on loaded knowledge:
163
163
 
164
164
  After reading `DESIGN-OVERVIEW.md`:
165
165
  - **Single Platform**: Invoke Skill directly
166
- - **Multiple Platforms**: Use **Skill tool** to invoke per-platform skills in parallel
166
+ - **Multiple Platforms**: Dispatch `speccrew-task-worker` agents in parallel (via Agent tool)
167
167
 
168
168
  ### 3.2 Single Platform Execution
169
169
 
@@ -177,7 +177,7 @@ Invoke Skill directly with parameters:
177
177
 
178
178
  ### 3.3 Multi-Platform Parallel Execution
179
179
 
180
- > **IMPORTANT**: Use the **Skill tool** (not the Agent tool) to invoke each test skill.
180
+ > **IMPORTANT**: Dispatch `speccrew-task-worker` agents (via Agent tool) for parallel test execution. Do NOT call test skills directly — each platform MUST run in an independent Worker Agent for progress visibility and error isolation.
181
181
 
182
182
  > **DISPATCH-PROGRESS Strategy**: Append mode — each test phase appends its tasks to the existing DISPATCH-PROGRESS.json with a distinct `phase` field. Previous phase records are preserved for full traceability.
183
183
 
@@ -210,7 +210,7 @@ Before dispatching, create or update `DISPATCH-PROGRESS.json`:
210
210
 
211
211
  **Dispatch Workers:**
212
212
 
213
- Use the **Skill tool** to invoke `speccrew-test-case-design` for each platform in parallel:
213
+ Dispatch `speccrew-task-worker` agents for `speccrew-test-case-design` for each platform in parallel:
214
214
  - Each worker receives:
215
215
  - `skill_name`: `speccrew-test-case-design`
216
216
  - `context`:
@@ -321,7 +321,7 @@ Update `DISPATCH-PROGRESS.json` with new phase:
321
321
 
322
322
  **Dispatch Workers:**
323
323
 
324
- Use the **Skill tool** to invoke `speccrew-test-code-gen` for each platform in parallel:
324
+ Dispatch `speccrew-task-worker` agents for `speccrew-test-code-gen` for each platform in parallel:
325
325
  - `context`:
326
326
  - `test_cases_path`: Path to the platform-specific test cases document
327
327
  - `system_design_path`: Path to the platform system design document
@@ -430,7 +430,7 @@ Update `DISPATCH-PROGRESS.json` with new phase:
430
430
 
431
431
  **Dispatch Workers:**
432
432
 
433
- Use the **Skill tool** to invoke `speccrew-test-execute` for each platform in parallel:
433
+ Dispatch `speccrew-task-worker` agents for `speccrew-test-execute` for each platform in parallel:
434
434
  - `context`:
435
435
  - `test_code_path`: Path to the platform test code directory
436
436
  - `platform_id`: Platform identifier
@@ -575,7 +575,7 @@ Update `WORKFLOW-PROGRESS.json`:
575
575
  **Must do:**
576
576
  - Execute three phases in strict order: test case design → code generation → test execution
577
577
  - Each phase must have a Checkpoint with user confirmation before proceeding
578
- - Multi-platform scenarios must use the **Skill tool** to invoke per-platform skills in parallel
578
+ - Multi-platform scenarios must dispatch `speccrew-task-worker` agents (via Agent tool) for parallel execution per platform
579
579
  - Test cases must be traceable to Feature Spec requirements
580
580
  - Bug reports must reference specific test case IDs
581
581
  - Use platform_id from design overview as directory names
@@ -76,8 +76,8 @@ This skill operates in **strict sequential execution mode**:
76
76
 
77
77
  **Generated Files:**
78
78
  1. `{{documentPath}}` - Controller documentation file
79
- 2. `{{completed_dir}}/{{fileName}}.done.json` - Completion status marker
80
- 3. `{{completed_dir}}/{{fileName}}.graph.json` - Graph data marker
79
+ 2. `{{completed_dir}}/{module}-{subpath}-{fileName}.done.json` - Completion status marker
80
+ 3. `{{completed_dir}}/{module}-{subpath}-{fileName}.graph.json` - Graph data marker
81
81
 
82
82
  **Return Value:**
83
83
  ```json
@@ -856,7 +856,7 @@ Or in case of failure:
856
856
  > **ASSUMPTION**: The `completed_dir` directory already exists (pre-created by dispatch Stage 2). If write fails, report error — do NOT attempt to create directories.
857
857
 
858
858
  ### Pre-write Checklist (VERIFY before writing each file):
859
- - [ ] Filename follows `{fileName}` pattern (Java class name only)
859
+ - [ ] Filename follows `{module}-{subpath}-{fileName}` pattern (see naming convention below)
860
860
  - [ ] File content is valid JSON (not empty)
861
861
  - [ ] All required fields are present and non-empty
862
862
  - [ ] File is written with UTF-8 encoding
@@ -875,30 +875,57 @@ Or in case of failure:
875
875
 
876
876
  **✅ CORRECT Format - MUST USE:**
877
877
  ```
878
- {completed_dir}/{fileName}.done.json ← Completion status marker (JSON format)
879
- {completed_dir}/{fileName}.graph.json ← Graph data marker (JSON format)
878
+ {completed_dir}/{module}-{subpath}-{fileName}.done.json ← Completion status marker (JSON format)
879
+ {completed_dir}/{module}-{subpath}-{fileName}.graph.json ← Graph data marker (JSON format)
880
880
  ```
881
881
 
882
+ **Naming Rule Explanation:**
883
+
884
+ The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{fileName}` to prevent conflicts between same-named source files.
885
+
886
+ **How to Extract Each Component from `{{sourcePath}}`:**
887
+
888
+ 1. **module**: Use `{{module}}` input variable directly (e.g., `system`, `trade`, `ai`)
889
+
890
+ 2. **subpath**: Extract the middle path between the module package root and the controller file:
891
+ - For Java: Remove package prefix up to the business layer (e.g., `controller/admin/`, `controller/app/`)
892
+ - Remove the file name at the end
893
+ - Replace path separators (`/`) with hyphens (`-`)
894
+ - If the file is at the module root directory, subpath will be empty → omit from filename
895
+
896
+ 3. **fileName**: Use `{{fileName}}` input variable (Java class name WITHOUT `.java` extension)
897
+
882
898
  **Examples:**
883
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/UserController.done.json`
884
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/UserController.graph.json`
899
+
900
+ | sourcePath | module | subpath | fileName | Marker Filename |
901
+ |------------|--------|---------|----------|-----------------|
902
+ | `yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java` | `system` | `controller-admin-notify` | `NotifyMessageController` | `system-controller-admin-notify-NotifyMessageController.done.json` |
903
+ | `yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java` | `system` | `controller-admin-user` | `UserController` | `system-controller-admin-user-UserController.done.json` |
904
+ | `yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/chat/ChatConversationController.java` | `ai` | `controller-admin-chat` | `ChatConversationController` | `ai-controller-admin-chat-ChatConversationController.done.json` |
905
+
906
+ **Special Case - Empty subpath:**
907
+ - If the controller is directly in the controller root directory (no subpath), use format: `{module}-{fileName}.done.json`
908
+ - Example: `.../controller/admin/SystemController.java` → `system-SystemController.done.json`
909
+
910
+ **Full Path Examples:**
911
+ - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-notify-NotifyMessageController.done.json`
912
+ - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/ai-controller-admin-chat-ChatConversationController.graph.json`
885
913
 
886
914
  **❌ WRONG Format - NEVER USE:**
887
915
  ```
888
- {fileName}.completed.json ← WRONG extension
889
- {fileName}.done ← WRONG extension (missing .json)
890
- {fileName}.done.txt ← WRONG extension
891
- {fileName}_done.json ← WRONG separator and extension
892
- {fileName}-completed.json ← WRONG separator and extension
916
+ {fileName}.done.json ← WRONG: missing module and subpath (causes conflicts)
917
+ {fileName}.graph.json ← WRONG: missing module and subpath (causes conflicts)
918
+ {module}-{fileName}.done.json ← WRONG: missing subpath (may still conflict)
919
+ {fileName}.completed.json ← WRONG extension
920
+ {fileName}.done ← WRONG extension (missing .json)
921
+ {fileName}_done.json ← WRONG separator and extension
893
922
  ```
894
923
 
895
924
  **❌ WRONG Filename Examples - NEVER USE:**
925
+ - `UserController.done.json` - WRONG: missing module and subpath (conflicts with other `UserController.java` files)
926
+ - `system-UserController.done.json` - WRONG: missing subpath (if file is in `controller/admin/user/`)
896
927
  - `UserController.completed.json` - WRONG: uses `.completed.json` instead of `.done.json`
897
- - `UserController.done` - WRONG: uses `.done` instead of `.done.json`
898
- - `UserController.done.txt` - WRONG: uses `.done.txt` instead of `.done.json`
899
928
  - `UserController_done.json` - WRONG: uses underscore and wrong extension
900
- - `dict-UserController.done.json` - WRONG: has module prefix
901
- - `system-UserController.done.json` - WRONG: has module prefix
902
929
 
903
930
  ---
904
931
 
@@ -959,9 +986,9 @@ Or in case of failure:
959
986
  > {"fileName": "UserController", "status": "success", ...}
960
987
  > ```
961
988
 
962
- Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.done.json`:
989
+ Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{fileName}.done.json`:
963
990
 
964
- **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/UserController.done.json`
991
+ **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-user-UserController.done.json`
965
992
 
966
993
  **Complete JSON Template (ALL fields required):**
967
994
  ```json
@@ -998,12 +1025,13 @@ Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.done.json`:
998
1025
 
999
1026
  > **⚠️ CRITICAL**: The `documentPath` field is MANDATORY. It MUST match the `{{documentPath}}` variable from Step 5a. This is used to verify the document was created successfully.
1000
1027
 
1001
- ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{fileName}.done.json`, where `fileName` is the Java class name (e.g., `UserController`, `AiKnowledgeDocumentCreateListReqVO`).
1002
- - ✅ CORRECT: `UserController.done.json` (using Java class name directly)
1003
- - ✅ CORRECT: `AiKnowledgeDocumentCreateListReqVO.done.json` (using Java class name directly)
1028
+ ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{module}-{subpath}-{fileName}.done.json` to prevent conflicts between same-named files.
1029
+ - ✅ CORRECT: `system-controller-admin-user-UserController.done.json` (full composite naming)
1030
+ - ✅ CORRECT: `ai-controller-admin-chat-ChatConversationController.done.json` (full composite naming)
1031
+ - ✅ CORRECT: `system-SystemController.done.json` (when subpath is empty, controller at root)
1032
+ - ❌ WRONG: `UserController.done.json` (missing module and subpath - will conflict)
1004
1033
  - ❌ WRONG: `UserController.done` (missing .json extension)
1005
- - ❌ WRONG: `dict-UserController.done.json` (using old featureId format)
1006
- - ❌ WRONG: `system-UserController.done.json` (using module prefix)
1034
+ - ❌ WRONG: `system-UserController.done.json` (missing subpath when controller is in nested package)
1007
1035
 
1008
1036
  ⚠️ **CRITICAL:** The file MUST contain valid JSON content. Empty files or files with only whitespace will cause processing failures.
1009
1037
 
@@ -1011,9 +1039,9 @@ Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.done.json`:
1011
1039
 
1012
1040
  > **⚠️ CRITICAL FORMAT REQUIREMENT**: The `.graph.json` file MUST be valid JSON and **MUST include the root-level `module` field**. Do NOT rely on scripts to infer the module from `.done` file - the `module` field MUST be explicitly present at the root level of `.graph.json`.
1013
1041
 
1014
- Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.graph.json`:
1042
+ Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{fileName}.graph.json`:
1015
1043
 
1016
- **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/UserController.graph.json`
1044
+ **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-user-UserController.graph.json`
1017
1045
 
1018
1046
  ```json
1019
1047
  {
@@ -1045,11 +1073,13 @@ Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.graph.json`
1045
1073
  > - Do NOT assume scripts will fall back to reading from `.done` file
1046
1074
  > - Missing `module` field will cause the graph merge pipeline to reject this file
1047
1075
 
1048
- ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{fileName}.graph.json`, where `fileName` is the Java class name (e.g., `UserController`, `AiKnowledgeDocumentCreateListReqVO`).
1049
- - ✅ CORRECT: `UserController.graph.json` (using Java class name directly)
1050
- - ✅ CORRECT: `AiKnowledgeDocumentCreateListReqVO.graph.json` (using Java class name directly)
1076
+ ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{module}-{subpath}-{fileName}.graph.json` to prevent conflicts between same-named files.
1077
+ - ✅ CORRECT: `system-controller-admin-user-UserController.graph.json` (full composite naming)
1078
+ - ✅ CORRECT: `ai-controller-admin-chat-ChatConversationController.graph.json` (full composite naming)
1079
+ - ✅ CORRECT: `system-SystemController.graph.json` (when subpath is empty, controller at root)
1080
+ - ❌ WRONG: `UserController.graph.json` (missing module and subpath - will conflict)
1051
1081
  - ❌ WRONG: `dict-UserController.graph.json` (using old featureId format)
1052
- - ❌ WRONG: `system-UserController.graph.json` (using module prefix)
1082
+ - ❌ WRONG: `system-UserController.graph.json` (missing subpath when controller is in nested package)
1053
1083
 
1054
1084
  ⚠️ **CRITICAL:** The file MUST contain valid JSON content. Empty files or files with only whitespace will cause processing failures.
1055
1085
 
@@ -426,30 +426,52 @@ Example: If batch has 5 features → create and launch 5 Worker Tasks simultaneo
426
426
 
427
427
  **✅ CORRECT Format - MUST USE:**
428
428
  ```
429
- {completed_dir}/{fileName}.done.json ← Completion status marker (JSON format)
430
- {completed_dir}/{fileName}.graph.json ← Graph data marker (JSON format)
429
+ {completed_dir}/{module}-{subpath}-{fileName}.done.json ← Completion status marker (JSON format)
430
+ {completed_dir}/{module}-{subpath}-{fileName}.graph.json ← Graph data marker (JSON format)
431
431
  ```
432
432
 
433
+ **Naming Rule Explanation:**
434
+
435
+ The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{fileName}` to prevent conflicts between same-named source files.
436
+
437
+ **How Workers Generate the Filename:**
438
+
439
+ 1. **module**: Use the `{{module}}` input variable directly
440
+
441
+ 2. **subpath**: Extract from `{{sourcePath}}`:
442
+ - For UI (Vue/React): Middle path between `views/` or `pages/` and the file name
443
+ - For API (Java): Middle path between controller root and the file name
444
+ - Replace path separators (`/`) with hyphens (`-`)
445
+ - Omit if file is at module root (empty subpath)
446
+
447
+ 3. **fileName**: Use `{{fileName}}` input variable (file name WITHOUT extension)
448
+
433
449
  **Examples:**
434
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/UserController.done.json`
435
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/UserController.graph.json`
450
+
451
+ | Source File | module | subpath | fileName | Marker Filename |
452
+ |-------------|--------|---------|----------|-----------------|
453
+ | `yudao-ui/.../views/system/notify/message/index.vue` | `system` | `notify-message` | `index` | `system-notify-message-index.done.json` |
454
+ | `yudao-ui/.../views/system/user/index.vue` | `system` | `user` | `index` | `system-user-index.done.json` |
455
+ | `yudao-module-system/.../controller/admin/user/UserController.java` | `system` | `controller-admin-user` | `UserController` | `system-controller-admin-user-UserController.done.json` |
456
+
457
+ **Full Path Examples:**
458
+ - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-notify-message-index.done.json`
459
+ - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-user-UserController.graph.json`
436
460
 
437
461
  **❌ WRONG Format - NEVER USE:**
438
462
  ```
439
- {fileName}.completed.json ← WRONG extension
440
- {fileName}.done ← WRONG extension (missing .json)
441
- {fileName}.done.txt ← WRONG extension
442
- {fileName}_done.json ← WRONG separator and extension
443
- {fileName}-completed.json ← WRONG separator and extension
463
+ {fileName}.done.json ← WRONG: missing module and subpath (causes conflicts)
464
+ {fileName}.graph.json ← WRONG: missing module and subpath (causes conflicts)
465
+ {fileName}.completed.json ← WRONG extension
466
+ {fileName}.done ← WRONG extension (missing .json)
467
+ {fileName}_done.json ← WRONG separator and extension
444
468
  ```
445
469
 
446
470
  **❌ WRONG Filename Examples - NEVER USE:**
471
+ - `index.done.json` - WRONG: missing module and subpath (conflicts with other `index.vue` files)
472
+ - `UserController.done.json` - WRONG: missing module and subpath (conflicts with other controllers)
447
473
  - `UserController.completed.json` - WRONG: uses `.completed.json` instead of `.done.json`
448
- - `UserController.done` - WRONG: uses `.done` instead of `.done.json`
449
- - `UserController.done.txt` - WRONG: uses `.done.txt` instead of `.done.json`
450
474
  - `UserController_done.json` - WRONG: uses underscore and wrong extension
451
- - `dict-UserController.done.json` - WRONG: has module prefix
452
- - `system-UserController.done.json` - WRONG: has module prefix
453
475
 
454
476
  ---
455
477
 
@@ -508,8 +530,8 @@ Example: If batch has 5 features → create and launch 5 Worker Tasks simultaneo
508
530
 
509
531
  | Marker Type | File Name Format | Example |
510
532
  |-------------|------------------|---------|
511
- | Completion marker | `{fileName}.done.json` | `index.done.json`, `UserController.done.json`, `AiKnowledgeDocumentCreateListReqVO.done.json` |
512
- | Graph data | `{fileName}.graph.json` | `index.graph.json`, `UserController.graph.json`, `AiKnowledgeDocumentCreateListReqVO.graph.json` |
533
+ | Completion marker | `{module}-{subpath}-{fileName}.done.json` | `system-notify-message-index.done.json`, `system-controller-admin-user-UserController.done.json` |
534
+ | Graph data | `{module}-{subpath}-{fileName}.graph.json` | `system-notify-message-index.graph.json`, `system-controller-admin-user-UserController.graph.json` |
513
535
 
514
536
  **Worker Completion Requirements:**
515
537
 
@@ -6,6 +6,32 @@ This document defines the status tracking formats for the bizs pipeline.
6
6
 
7
7
  ---
8
8
 
9
+ ## Marker File Naming Convention
10
+
11
+ Marker files (`.done.json` and `.graph.json`) use a composite naming pattern to prevent conflicts between same-named source files.
12
+
13
+ **Format:** `{module}-{subpath}-{fileName}.{type}.json`
14
+
15
+ **Components:**
16
+ - **module**: Business module name (e.g., `system`, `ai`, `bpm`, `trade`)
17
+ - **subpath**: Middle path extracted from sourcePath, with `/` replaced by `-` (e.g., `notify-message`, `controller-admin-user`)
18
+ - **fileName**: Source file name without extension (e.g., `index`, `UserController`)
19
+ - **type**: `done` or `graph`
20
+
21
+ **Examples:**
22
+
23
+ | Source File | Marker Filename |
24
+ |-------------|-----------------|
25
+ | `yudao-ui/.../views/system/notify/message/index.vue` | `system-notify-message-index.done.json` |
26
+ | `yudao-ui/.../views/system/user/index.vue` | `system-user-index.done.json` |
27
+ | `yudao-module-system/.../controller/admin/user/UserController.java` | `system-controller-admin-user-UserController.done.json` |
28
+
29
+ **Special Case:** If subpath is empty (file at module root), use format: `{module}-{fileName}.{type}.json`
30
+
31
+ **Legacy Format Support:** The processing scripts support both new format (`{module}-{subpath}-{fileName}`) and legacy format (`{fileName}`) for backward compatibility.
32
+
33
+ ---
34
+
9
35
  ## Feature Status Tracking (Stage 2)
10
36
 
11
37
  Feature analysis status is tracked directly in `features-{platform}.json` files located at:
@@ -61,11 +87,10 @@ Module summarization status is determined by aggregating feature statuses from `
61
87
 
62
88
  | Field | Type | Description |
63
89
  |-------|------|-------------|
64
- | `features[].id` | string | Unique feature identifier (used for marker file naming) |
65
- | `features[].fileName` | string | Feature file name |
66
- | `features[].sourcePath` | string | Source code file path |
90
+ | `features[].fileName` | string | Feature file name (without extension) - used as part of marker file naming |
91
+ | `features[].sourcePath` | string | Source code file path - used to extract subpath for marker file naming |
67
92
  | `features[].documentPath` | string | Generated documentation path |
68
- | `features[].module` | string | Module code_name |
93
+ | `features[].module` | string | Module code_name - used as prefix for marker file naming |
69
94
  | `features[].analyzed` | boolean | Whether feature has been analyzed |
70
95
  | `features[].status` | string | `pending`, `in_progress`, `completed`, `failed` |
71
96
  | `features[].startedAt` | string | ISO timestamp when analysis started |
@@ -11,6 +11,53 @@ const fs = require('fs');
11
11
  const path = require('path');
12
12
  const { execFileSync } = require('child_process');
13
13
 
14
+ // Helper: Parse marker filename to extract components
15
+ // New format: {module}-{subpath}-{fileName}.done.json
16
+ // Legacy format: {fileName}.done.json
17
+ function parseMarkerFilename(markerFile, fileType) {
18
+ // fileType: 'done' or 'graph'
19
+ const ext = `.${fileType}.json`;
20
+ if (!markerFile.endsWith(ext)) {
21
+ return null;
22
+ }
23
+
24
+ const baseName = markerFile.slice(0, -ext.length);
25
+ const parts = baseName.split('-');
26
+
27
+ // New format: must have at least 3 parts (module-subpath-fileName)
28
+ // But subpath can be empty, so minimum is 2 parts (module-fileName)
29
+ if (parts.length >= 2) {
30
+ // Try to identify if this is new format or legacy format
31
+ // New format has module prefix (known modules are usually short names like 'system', 'ai', 'bpm', 'trade')
32
+ // Legacy format is just fileName (e.g., 'index', 'UserController')
33
+
34
+ // Heuristic: if first part is a known module-like name and there are more parts,
35
+ // treat it as new format
36
+ // For now, we'll return both possible interpretations and let the caller decide
37
+ return {
38
+ baseName: baseName,
39
+ parts: parts,
40
+ // For new format: fileName is the last part
41
+ newFormatFileName: parts[parts.length - 1],
42
+ // For new format: module is the first part
43
+ newFormatModule: parts[0],
44
+ // For new format: subpath is everything in between
45
+ newFormatSubpath: parts.length > 2 ? parts.slice(1, -1).join('-') : '',
46
+ // For legacy format: fileName is the entire baseName
47
+ legacyFileName: baseName,
48
+ // Detect likely format based on pattern
49
+ isLikelyNewFormat: parts.length > 1 && parts[0].length < 20 // module names are usually short
50
+ };
51
+ }
52
+
53
+ return {
54
+ baseName: baseName,
55
+ parts: parts,
56
+ legacyFileName: baseName,
57
+ isLikelyNewFormat: false
58
+ };
59
+ }
60
+
14
61
  // Helper: Validate and normalize .done.json file content
15
62
  function validateAndNormalizeDoneContent(content, doneFile) {
16
63
  // Strip file extensions from fileName if present
@@ -371,12 +418,16 @@ function main() {
371
418
 
372
419
  // Fallback: recover minimal info from filename and context when .done.json is non-JSON
373
420
  function recoverDoneFileFromContext(doneFile, completedDir, syncStatePath) {
374
- const fileName = doneFile.replace(/\.done\.json$/, '');
421
+ const parseResult = parseMarkerFilename(doneFile, 'done');
422
+
423
+ // Determine fileName: prefer content from .done.json, fall back to filename parsing
424
+ let fileName = parseResult ? parseResult.legacyFileName : doneFile.replace(/\.done\.json$/, '');
425
+
375
426
  console.warn(`[WARN] .done.json file is not valid JSON: ${doneFile}. Attempting recovery from filename...`);
376
-
427
+
377
428
  // Try to get module from same-named .graph.json
378
429
  let module = 'unknown';
379
- const graphFilePath = path.join(completedDir, fileName + '.graph.json');
430
+ const graphFilePath = path.join(completedDir, doneFile.replace('.done.json', '.graph.json'));
380
431
  if (fs.existsSync(graphFilePath)) {
381
432
  try {
382
433
  const graphContent = JSON.parse(fs.readFileSync(graphFilePath, 'utf8'));
@@ -387,6 +438,11 @@ function main() {
387
438
  // Ignore parse errors
388
439
  }
389
440
  }
441
+
442
+ // If module is still unknown, try to extract from new-format filename
443
+ if (module === 'unknown' && parseResult && parseResult.isLikelyNewFormat) {
444
+ module = parseResult.newFormatModule;
445
+ }
390
446
 
391
447
  // Try to match sourceFile from features-*.json files
392
448
  let sourceFile = 'unknown';
@@ -399,7 +455,18 @@ function main() {
399
455
  try {
400
456
  const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
401
457
  if (content.features && Array.isArray(content.features)) {
402
- const found = content.features.find(feat => feat.fileName === fileName);
458
+ // Try both new format and legacy format matching
459
+ let found = content.features.find(feat => feat.fileName === fileName);
460
+
461
+ // If not found with legacy fileName and we have new format info,
462
+ // try matching with newFormatFileName
463
+ if (!found && parseResult && parseResult.isLikelyNewFormat) {
464
+ found = content.features.find(feat => feat.fileName === parseResult.newFormatFileName);
465
+ if (found) {
466
+ fileName = parseResult.newFormatFileName;
467
+ }
468
+ }
469
+
403
470
  if (found) {
404
471
  sourceFile = f;
405
472
  break;
@@ -71,8 +71,8 @@ Analyze one specific UI feature from source code, extract business functionality
71
71
 
72
72
  **Generated Files (MANDATORY - Task is NOT complete until all files are written):**
73
73
  1. `{{documentPath}}` - Feature documentation file
74
- 2. `{{completed_dir}}/{{fileName}}.done.json` - Completion status marker
75
- 3. `{{completed_dir}}/{{fileName}}.graph.json` - Graph data marker
74
+ 2. `{{completed_dir}}/{module}-{subpath}-{fileName}.done.json` - Completion status marker
75
+ 3. `{{completed_dir}}/{module}-{subpath}-{fileName}.graph.json` - Graph data marker
76
76
 
77
77
  **Return Value (JSON format):**
78
78
  ```json
@@ -808,7 +808,7 @@ After analysis is complete, write the results to marker files for dispatch to pr
808
808
  > **ASSUMPTION**: The `completed_dir` directory already exists (pre-created by dispatch Stage 2). If write fails, report error — do NOT attempt to create directories.
809
809
 
810
810
  ### Pre-write Checklist (VERIFY before writing each file):
811
- - [ ] Filename follows `{fileName}` pattern (file name only)
811
+ - [ ] Filename follows `{module}-{subpath}-{fileName}` pattern (see naming convention below)
812
812
  - [ ] File content is valid JSON (not empty)
813
813
  - [ ] All required fields are present and non-empty
814
814
  - [ ] File is written with UTF-8 encoding
@@ -829,30 +829,57 @@ After analysis is complete, write the results to marker files for dispatch to pr
829
829
 
830
830
  **✅ CORRECT Format - MUST USE:**
831
831
  ```
832
- {completed_dir}/{fileName}.done.json ← Completion status marker (JSON format)
833
- {completed_dir}/{fileName}.graph.json ← Graph data marker (JSON format)
832
+ {completed_dir}/{module}-{subpath}-{fileName}.done.json ← Completion status marker (JSON format)
833
+ {completed_dir}/{module}-{subpath}-{fileName}.graph.json ← Graph data marker (JSON format)
834
834
  ```
835
835
 
836
+ **Naming Rule Explanation:**
837
+
838
+ The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{fileName}` to prevent conflicts between same-named source files.
839
+
840
+ **How to Extract Each Component from `{{sourcePath}}`:**
841
+
842
+ 1. **module**: Use `{{module}}` input variable directly (e.g., `system`, `trade`, `bpm`)
843
+
844
+ 2. **subpath**: Extract the middle path between the platform source root and the file name:
845
+ - Remove the top-level directory prefix (e.g., `yudao-ui/yudao-ui-admin-vue3/src/views/`)
846
+ - Remove the file name at the end
847
+ - Replace path separators (`/`) with hyphens (`-`)
848
+ - If the file is at the module root directory, subpath will be empty → omit from filename
849
+
850
+ 3. **fileName**: Use `{{fileName}}` input variable (file name WITHOUT extension)
851
+
836
852
  **Examples:**
837
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/index.done.json`
838
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/index.graph.json`
853
+
854
+ | sourcePath | module | subpath | fileName | Marker Filename |
855
+ |------------|--------|---------|----------|-----------------|
856
+ | `yudao-ui/yudao-ui-admin-vue3/src/views/system/notify/message/index.vue` | `system` | `notify-message` | `index` | `system-notify-message-index.done.json` |
857
+ | `yudao-ui/yudao-ui-admin-vue3/src/views/system/user/index.vue` | `system` | `user` | `index` | `system-user-index.done.json` |
858
+ | `yudao-ui/yudao-ui-admin-vue3/src/views/bpm/process-instance/index.vue` | `bpm` | `process-instance` | `index` | `bpm-process-instance-index.done.json` |
859
+
860
+ **Special Case - Empty subpath:**
861
+ - If the file is directly in the module root directory (no subpath), use format: `{module}-{fileName}.done.json`
862
+ - Example: `yudao-ui/yudao-ui-admin-vue3/src/views/system/index.vue` → `system-index.done.json`
863
+
864
+ **Full Path Examples:**
865
+ - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-notify-message-index.done.json`
866
+ - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-user-index.graph.json`
839
867
 
840
868
  **❌ WRONG Format - NEVER USE:**
841
869
  ```
842
- {fileName}.completed.json ← WRONG extension
843
- {fileName}.done ← WRONG extension (missing .json)
844
- {fileName}.done.txt ← WRONG extension
845
- {fileName}_done.json ← WRONG separator and extension
846
- {fileName}-completed.json ← WRONG separator and extension
870
+ {fileName}.done.json ← WRONG: missing module and subpath (causes conflicts)
871
+ {fileName}.graph.json ← WRONG: missing module and subpath (causes conflicts)
872
+ {module}-{fileName}.done.json ← WRONG: missing subpath (may still conflict)
873
+ {fileName}.completed.json ← WRONG extension
874
+ {fileName}.done ← WRONG extension (missing .json)
875
+ {fileName}_done.json ← WRONG separator and extension
847
876
  ```
848
877
 
849
878
  **❌ WRONG Filename Examples - NEVER USE:**
879
+ - `index.done.json` - WRONG: missing module and subpath (conflicts with other `index.vue` files)
880
+ - `system-index.done.json` - WRONG: missing subpath (if file is in `system/notify/message/`)
850
881
  - `index.completed.json` - WRONG: uses `.completed.json` instead of `.done.json`
851
- - `index.done` - WRONG: uses `.done` instead of `.done.json`
852
- - `index.done.txt` - WRONG: uses `.done.txt` instead of `.done.json`
853
882
  - `index_done.json` - WRONG: uses underscore and wrong extension
854
- - `dict-index.done.json` - WRONG: has module prefix
855
- - `system-index.done.json` - WRONG: has module prefix
856
883
 
857
884
  ---
858
885
 
@@ -942,9 +969,9 @@ After analysis is complete, write the results to marker files for dispatch to pr
942
969
  > {"fileName": "index", "status": "success", ...}
943
970
  > ```
944
971
 
945
- Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.done.json`:
972
+ Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{fileName}.done.json`:
946
973
 
947
- **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/index.done.json`
974
+ **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-notify-message-index.done.json`
948
975
 
949
976
  **Complete JSON Template (ALL fields required):**
950
977
  ```json
@@ -981,12 +1008,13 @@ After analysis is complete, write the results to marker files for dispatch to pr
981
1008
 
982
1009
  > **⚠️ CRITICAL**: The `documentPath` field is MANDATORY. It MUST match the `{{documentPath}}` variable from Step 5a. This is used to verify the document was created successfully.
983
1010
 
984
- ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{fileName}.done.json`, where `fileName` is the feature file name (e.g., `index`, `UserForm`, `AiKnowledgeDocumentCreateListReqVO`).
985
- - ✅ CORRECT: `index.done.json` (using file name directly)
986
- - ✅ CORRECT: `UserForm.done.json` (using file name directly)
1011
+ ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{module}-{subpath}-{fileName}.done.json` to prevent conflicts between same-named files.
1012
+ - ✅ CORRECT: `system-notify-message-index.done.json` (full composite naming)
1013
+ - ✅ CORRECT: `system-user-index.done.json` (full composite naming)
1014
+ - ✅ CORRECT: `bpm-index.done.json` (when subpath is empty, file at module root)
1015
+ - ❌ WRONG: `index.done.json` (missing module and subpath - will conflict)
987
1016
  - ❌ WRONG: `index.done` (missing .json extension)
988
- - ❌ WRONG: `dict-index.done.json` (using old featureId format)
989
- - ❌ WRONG: `system-index.done.json` (using module prefix)
1017
+ - ❌ WRONG: `system-index.done.json` (missing subpath when file is in nested directory)
990
1018
 
991
1019
  ⚠️ **CRITICAL:** The file MUST contain valid JSON content. Empty files or files with only whitespace will cause processing failures.
992
1020
 
@@ -994,9 +1022,9 @@ After analysis is complete, write the results to marker files for dispatch to pr
994
1022
 
995
1023
  > **⚠️ CRITICAL FORMAT REQUIREMENT**: The `.graph.json` file MUST be valid JSON and **MUST include the root-level `module` field**. Do NOT rely on scripts to infer the module from `.done` file - the `module` field MUST be explicitly present at the root level of `.graph.json`.
996
1024
 
997
- Use the Write tool to create file at `{{completed_dir}}/{{fileName}}.graph.json`:
1025
+ Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{fileName}.graph.json`:
998
1026
 
999
- **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/index.graph.json`
1027
+ **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-notify-message-index.graph.json`
1000
1028
 
1001
1029
  ```json
1002
1030
  {
@@ -1031,11 +1059,13 @@ After analysis is complete, write the results to marker files for dispatch to pr
1031
1059
  > - Do NOT assume scripts will fall back to reading from `.done` file
1032
1060
  > - Missing `module` field will cause the graph merge pipeline to reject this file
1033
1061
 
1034
- ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{fileName}.graph.json`, where `fileName` is the feature file name (e.g., `index`, `UserForm`, `AiKnowledgeDocumentCreateListReqVO`).
1035
- - ✅ CORRECT: `index.graph.json` (using file name directly)
1036
- - ✅ CORRECT: `UserForm.graph.json` (using file name directly)
1062
+ ⚠️ **CRITICAL NAMING RULE:** Filename MUST be `{module}-{subpath}-{fileName}.graph.json` to prevent conflicts between same-named files.
1063
+ - ✅ CORRECT: `system-notify-message-index.graph.json` (full composite naming)
1064
+ - ✅ CORRECT: `system-user-index.graph.json` (full composite naming)
1065
+ - ✅ CORRECT: `bpm-index.graph.json` (when subpath is empty, file at module root)
1066
+ - ❌ WRONG: `index.graph.json` (missing module and subpath - will conflict)
1037
1067
  - ❌ WRONG: `dict-index.graph.json` (using old featureId format)
1038
- - ❌ WRONG: `system-index.graph.json` (using module prefix)
1068
+ - ❌ WRONG: `system-index.graph.json` (missing subpath when file is in nested directory)
1039
1069
 
1040
1070
  ⚠️ **CRITICAL:** The file MUST contain valid JSON content. Empty files or files with only whitespace will cause processing failures.
1041
1071
 
@@ -1047,7 +1077,7 @@ After analysis is complete, write the results to marker files for dispatch to pr
1047
1077
  - [ ] Each `calls` edge has proper metadata with trigger information
1048
1078
  - [ ] No API import is left without a corresponding edge
1049
1079
 
1050
- **Output:** "Step 7 Status: ✅ COMPLETED - Marker files written ({{completed_dir}}/{{fileName}}.done, .graph.json)"
1080
+ **Output:** "Step 7 Status: ✅ COMPLETED - Marker files written ({{completed_dir}}/{module}-{subpath}-{fileName}.done.json, .graph.json)"
1051
1081
 
1052
1082
  **On Failure:** "Step 7 Status: ⚠️ PARTIAL - Marker file write failed, but analysis completed"
1053
1083
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {