speccrew 0.6.2 → 0.6.4

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.
@@ -441,8 +441,20 @@ If only **1 Feature** in registry:
441
441
  If **2+ Features** in registry:
442
442
 
443
443
  1. **Initialize DISPATCH-PROGRESS.json**:
444
+
445
+ > ⚠️ Use `--tasks-file` instead of `--tasks` to avoid PowerShell JSON parsing issues.
446
+
444
447
  ```bash
445
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_analyze --tasks "[{\"id\":\"F-CRM-01\"},{\"id\":\"F-CRM-02\"},{\"id\":\"F-CRM-03\"}]"
448
+ # Step 1: Write tasks JSON to temp file inside iteration directory
449
+ # Create .tasks-temp.json with the task array content
450
+ # Step 2: Initialize with --tasks-file
451
+ node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_analyze --tasks-file speccrew-workspace/iterations/{iteration}/02.feature-design/.tasks-temp.json
452
+ # Step 3: Delete .tasks-temp.json after successful init
453
+ ```
454
+
455
+ Example `.tasks-temp.json` content:
456
+ ```json
457
+ [{"id":"F-CRM-01"},{"id":"F-CRM-02"},{"id":"F-CRM-03"}]
446
458
  ```
447
459
 
448
460
  2. **Dispatch Workers** (batch of 6):
@@ -494,8 +506,20 @@ If only **1 Feature** in registry:
494
506
  #### Multiple Features (Worker Dispatch)
495
507
 
496
508
  1. **Initialize DISPATCH-PROGRESS.json for Design & Generate stage**:
509
+
510
+ > ⚠️ Use `--tasks-file` instead of `--tasks` to avoid PowerShell JSON parsing issues.
511
+
497
512
  ```bash
498
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_spec --tasks "[{\"id\":\"F-CRM-01\"},{\"id\":\"F-CRM-02\"},{\"id\":\"F-CRM-03\"}]"
513
+ # Step 1: Write tasks JSON to temp file inside iteration directory
514
+ # Create .tasks-temp.json with the task array content
515
+ # Step 2: Initialize with --tasks-file
516
+ node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json --stage 02_feature_design_spec --tasks-file speccrew-workspace/iterations/{iteration}/02.feature-design/.tasks-temp.json
517
+ # Step 3: Delete .tasks-temp.json after successful init
518
+ ```
519
+
520
+ Example `.tasks-temp.json` content:
521
+ ```json
522
+ [{"id":"F-CRM-01"},{"id":"F-CRM-02"},{"id":"F-CRM-03"}]
499
523
  ```
500
524
 
501
525
  2. **Dispatch Workers** (batch of 6):
@@ -38,6 +38,54 @@ When involving related domains:
38
38
 
39
39
  Before starting work, check the workflow progress state:
40
40
 
41
+ ### 0.1.0 Create or Locate Iteration Directory
42
+
43
+ Before checking workflow progress, ensure an iteration directory exists with proper naming.
44
+
45
+ > ⚠️ **MANDATORY**: Iteration directories MUST follow the naming convention `{number}-{type}-{name}`.
46
+ > Example: `001-feature-litemes`, `002-bugfix-payment`, `003-refactor-auth`
47
+
48
+ **Step 1: Search for active iteration**
49
+
50
+ Use Glob to search `speccrew-workspace/iterations/*/WORKFLOW-PROGRESS.json`
51
+
52
+ - **IF found** an iteration with `01_prd.status == "in_progress"` → Use that iteration directory, skip to Step 0.1.1
53
+ - **IF found** but all iterations are `completed` or `confirmed` → Create new iteration (Step 2)
54
+ - **IF not found** → Create new iteration (Step 2)
55
+
56
+ **Step 2: Create new iteration directory**
57
+
58
+ 1. **Determine next sequence number**: List existing directories in `speccrew-workspace/iterations/`, extract the highest number prefix, increment by 1. Format: 3-digit zero-padded (001, 002, 003...)
59
+ - If no existing iterations → Start with `001`
60
+
61
+ 2. **Determine iteration type** from user's requirement:
62
+ - New feature / new system → `feature`
63
+ - Bug fix → `bugfix`
64
+ - Refactoring → `refactor`
65
+ - If unclear → default to `feature`
66
+
67
+ 3. **Extract short name**: Derive a concise English name (1-3 words, kebab-case) from:
68
+ - The requirement document filename (e.g., `litemes.md` → `litemes`)
69
+ - Or the main subject of the requirement
70
+
71
+ 4. **Create directory structure**:
72
+ ```bash
73
+ # Create iteration directory with subdirectories
74
+ mkdir -p speccrew-workspace/iterations/{number}-{type}-{name}/00.docs
75
+ mkdir -p speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement
76
+ ```
77
+
78
+ 5. **Copy requirement document**: Copy user's requirement document to `{iteration}/00.docs/`
79
+ ```bash
80
+ cp {user_requirement_file} speccrew-workspace/iterations/{number}-{type}-{name}/00.docs/
81
+ ```
82
+
83
+ 6. **Store iteration path** for use in subsequent phases:
84
+ - `iteration_path` = `speccrew-workspace/iterations/{number}-{type}-{name}`
85
+ - `iteration_name` = `{number}-{type}-{name}`
86
+
87
+ ### 0.1.1 Load or Initialize Workflow Progress
88
+
41
89
  1. **Find Active Iteration**: Use Glob to search for `speccrew-workspace/iterations/*/WORKFLOW-PROGRESS.json`
42
90
  2. **If WORKFLOW-PROGRESS.json exists**:
43
91
  - Read the file to get current stage and status
@@ -96,7 +144,8 @@ If `01_prd.status` is `in_progress` or resuming from an interrupted session:
96
144
 
97
145
  | Checkpoint | If Passed | Resume Point |
98
146
  |------------|-----------|--------------|
99
- | `requirement_clarification.passed == true` | Skip Phase 3 | Start from Phase 4 (PRD Skill) |
147
+ | `requirement_clarification.passed == true` | Clarification done, needs user confirmation | **Start from Phase 3.7 (User Confirmation Gate)** |
148
+ | `requirement_clarification_confirmed.passed == true` | Clarification confirmed by user | Start from Phase 4 (PRD Skill) |
100
149
  | `requirement_modeling.passed == true` | Skip Phase 4a | Start from Phase 4b (PRD generation) |
101
150
  | `sub_prd_dispatch.passed == true` | Skip Phase 5 | Start from Phase 6 (Verification) |
102
151
  | `prd_review.passed == true` | All complete | Ask user: "PRD stage already confirmed. Redo?" |
@@ -247,25 +296,43 @@ Feature inventory exists but detailed analysis may be incomplete.
247
296
 
248
297
  #### Path C: No Knowledge (status = "none")
249
298
 
299
+ > 🛑 **MANDATORY: Auto-initialization MUST be executed when status is "none".**
300
+ > **DO NOT skip initialization and proceed directly to Phase 2.**
301
+ > **DO NOT ask user whether to initialize — this is AUTOMATIC.**
302
+ >
303
+ > ⚠️ FORBIDDEN ACTIONS:
304
+ > - DO NOT skip to Phase 2 when status is "none"
305
+ > - DO NOT proceed without attempting initialization
306
+ > - DO NOT expose internal concepts (Stage 0, Stage 1) to user
307
+
250
308
  No knowledge base exists. Automatic initialization is triggered.
251
309
 
252
310
  1. **Inform user**: "No business knowledge base detected. Automatically analyzing project structure..."
253
311
 
254
- > ⚠️ Do NOT ask user about "Stage 0+1" or any internal concepts.
255
- > Just show: "Analyzing project structure..." with progress indication.
312
+ > Show progress indication to user. Do NOT mention "Stage 0+1" or any internal concepts.
256
313
 
257
- 2. **Dispatch Worker** to execute feature inventory initialization:
258
- - Use `speccrew-knowledge-bizs-init-features` skill for each platform detected
259
- - This performs platform detection + feature inventory generation
260
- - Worker writes features-*.json to sync-state directory
314
+ 2. **MANDATORY: Dispatch Worker** to execute feature inventory initialization:
315
+
316
+ | Parameter | Value |
317
+ |-----------|-------|
318
+ | `skill` | `speccrew-knowledge-bizs-init-features` |
319
+ | `workspace_path` | `speccrew-workspace` |
320
+ | `language` | Detected user language |
261
321
 
262
- 3. **After Worker completes**, re-run Step 1.1 (dispatch detector again)
263
- - Status should now be "lite"
264
- - Continue with Path B flow
322
+ - Worker performs platform detection + feature inventory generation
323
+ - Worker writes `features-*.json` to `knowledges/base/sync-state/knowledge-bizs/` directory
324
+ - **Wait for Worker to complete before proceeding**
325
+
326
+ 3. **After Worker completes**: Re-run Step 1.1 (dispatch detector again)
327
+ - **Verify** status changed from "none" to "lite"
328
+ - If status is now "lite" → Continue with **Path B** flow (module matching + optional deep init)
329
+ - If status is still "none" → Initialization failed, proceed to Step 4
265
330
 
266
331
  4. **IF initialization fails**:
267
- - Report to user: "Project structure analysis encountered issues. Continuing without knowledge base."
332
+ - Report to user: "Project structure analysis encountered issues: [specific error]. Continuing without knowledge base context."
333
+ - Log the error details for debugging
268
334
  - Proceed to Phase 2 in degraded mode (no system context)
335
+ - Note: PRD quality will be significantly reduced without knowledge base
269
336
 
270
337
  ### 1.3 Store Knowledge Context
271
338
 
@@ -404,7 +471,71 @@ REQUIRED ACTIONS:
404
471
  **IF validation passes:**
405
472
  1. Read `.clarification-summary.md` to extract complexity level
406
473
  2. Confirm complexity alignment with Phase 2 assessment
407
- 3. Proceed to Phase 4
474
+ 3. Proceed to Phase 3.7 (User Confirmation) — **DO NOT skip to Phase 4 directly**
475
+
476
+ ### 3.7 Present Clarification Results for User Confirmation
477
+
478
+ > 🛑 **GATE: User Confirmation Required Before PRD Generation**
479
+ >
480
+ > **HARD STOP — DO NOT proceed to Phase 4 without explicit user confirmation.**
481
+ > This gate ensures the user has reviewed and approved the clarification results
482
+ > before any PRD content is generated.
483
+ >
484
+ > ⚠️ FORBIDDEN ACTIONS:
485
+ > - DO NOT auto-proceed to Phase 4
486
+ > - DO NOT assume clarification results are accepted without user confirmation
487
+ > - DO NOT update checkpoints for Phase 4 readiness before confirmation
488
+
489
+ After validation passes in Phase 3.6:
490
+
491
+ **1. Present Clarification Summary to User:**
492
+
493
+ ```
494
+ 📋 Requirement Clarification Complete
495
+
496
+ Results:
497
+ ├── Complexity: [simple | complex]
498
+ ├── Knowledge Base: [full | lite | none]
499
+ ├── Identified Modules: [count] modules
500
+ ├── Estimated Features: [count] features
501
+ ├── Sufficiency Checks: 4/4 ✅
502
+
503
+ Key Decisions:
504
+ - [Decision 1 from clarification]
505
+ - [Decision 2 from clarification]
506
+ - ...
507
+
508
+ Clarification File: {iteration_path}/01.product-requirement/.clarification-summary.md
509
+ ```
510
+
511
+ **2. STOP and Request Confirmation:**
512
+
513
+ > 🛑 **AWAITING USER CONFIRMATION**
514
+ >
515
+ > "需求澄清已完成,请审查以上结果。确认无误后将进入 PRD 生成阶段。"
516
+ >
517
+ > Options:
518
+ > - "确认" or "OK" → Proceed to Phase 4
519
+ > - "需要修改" + details → Return to Phase 3 with updated context
520
+ > - "取消" → Abort workflow
521
+ >
522
+ > **I will NOT proceed until you explicitly confirm.**
523
+
524
+ **3. Handle User Response:**
525
+
526
+ - **IF user confirms** (explicit "确认" or "OK"):
527
+ 1. Update checkpoint to record user confirmation:
528
+ ```bash
529
+ node speccrew-workspace/scripts/update-progress.js write-checkpoint \
530
+ --file {iteration_path}/01.product-requirement/.checkpoints.json \
531
+ --stage 01_prd \
532
+ --checkpoint requirement_clarification_confirmed \
533
+ --passed true \
534
+ --description "User confirmed clarification results"
535
+ ```
536
+ 2. Proceed to Phase 4
537
+ - **IF user requests changes** → Return to Phase 3 with user's feedback as additional context
538
+ - **IF user cancels** → Abort workflow, report final status
408
539
 
409
540
  ---
410
541
 
@@ -593,7 +724,7 @@ Step 4b: Invoke speccrew-pm-requirement-analysis
593
724
  >
594
725
  > 1. **DO NOT skip Phase 5 when Master-Sub structure is present** — If the Skill output indicates "Master-Sub PRD structure", Phase 5 MUST execute.
595
726
  > 2. **DO NOT generate Sub-PRDs yourself** — Each Sub-PRD MUST be generated by invoking `speccrew-task-worker` with `speccrew-pm-sub-prd-generate/SKILL.md`. You are the orchestrator, NOT the writer.
596
- > 3. **DO NOT create DISPATCH-PROGRESS.json manually** — Use the script: `node speccrew-workspace/scripts/update-progress.js init --stage sub_prd_dispatch --tasks '<JSON_ARRAY>'`.
727
+ > 3. **DO NOT create DISPATCH-PROGRESS.json manually** — Use the script: `node speccrew-workspace/scripts/update-progress.js init --stage sub_prd_dispatch --tasks-file <TASKS_FILE>`.
597
728
  > 4. **DO NOT dispatch Sub-PRDs sequentially** — All workers MUST execute in parallel (batch of 6 if modules > 6).
598
729
  > 5. **DO NOT proceed to Phase 6 without verification** — After ALL workers complete, execute Phase 6 Verification Checklist before presenting to user.
599
730
  >
@@ -721,11 +852,17 @@ From the Skill's Step 12c output, collect:
721
852
  ### 5.1b Initialize Dispatch Progress Tracking
722
853
 
723
854
  **MANDATORY: Initialize dispatch tracking with script:**
855
+
856
+ > ⚠️ Use --tasks-file instead of --tasks to avoid PowerShell JSON parsing issues.
857
+
724
858
  ```bash
859
+ # Write tasks to temp file inside iteration directory
860
+ # Create .tasks-temp.json with task array content
725
861
  node speccrew-workspace/scripts/update-progress.js init \
726
862
  --file speccrew-workspace/iterations/{iteration}/01.product-requirement/DISPATCH-PROGRESS.json \
727
863
  --stage sub_prd_dispatch \
728
- --tasks '[{"id":"module-key-1","name":"Module 1 Name"},{"id":"module-key-2","name":"Module 2 Name"}]'
864
+ --tasks-file speccrew-workspace/iterations/{iteration}/01.product-requirement/.tasks-temp.json
865
+ # Delete .tasks-temp.json after successful init
729
866
  ```
730
867
 
731
868
  > **PowerShell Compatibility Note:**
@@ -735,7 +872,7 @@ node speccrew-workspace/scripts/update-progress.js init \
735
872
  > 3. Or use: `Get-Content tasks-temp.json | node scripts/update-progress.js init --stage sub_prd_dispatch --tasks -`
736
873
 
737
874
  > 🛑 **HARD STOP: DISPATCH-PROGRESS.json MUST be created by script ONLY**
738
- > - MUST use: `node speccrew-workspace/scripts/update-progress.js init --stage sub_prd_dispatch --tasks '<JSON_ARRAY>'`
875
+ > - MUST use: `node speccrew-workspace/scripts/update-progress.js init --stage sub_prd_dispatch --tasks-file <TASKS_FILE>`
739
876
  > - DO NOT create DISPATCH-PROGRESS.json manually (PowerShell, create_file, or any other method)
740
877
  > - IF script fails → STOP workflow immediately, report error to user, ask "Retry or Abort?"
741
878
  > - DO NOT proceed to Worker dispatch without successful script execution
@@ -1081,6 +1218,48 @@ DO NOT proceed to Feature Design in this conversation.
1081
1218
  | Single PRD (simple) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[feature-name]-prd.md` | Generated by `speccrew-pm-requirement-simple` |
1082
1219
  | Sub-PRD Documents (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[feature-name]-sub-[module].md` | One per module, generated by worker dispatch |
1083
1220
 
1221
+ # Script Usage Reference
1222
+
1223
+ ## update-progress.js Commands
1224
+
1225
+ The `speccrew-workspace/scripts/update-progress.js` script supports the following commands:
1226
+
1227
+ | Command | Purpose | Key Parameters |
1228
+ |---------|---------|----------------|
1229
+ | `init` | Initialize progress file | `--file`, `--stage`, `--tasks` or `--tasks-file` |
1230
+ | `read` | Read progress data | `--file`, `--summary` / `--checkpoints` / `--task-id` / `--status` |
1231
+ | `update-task` | Update single task status | `--file`, `--task-id`, `--status`, `--output` / `--error` |
1232
+ | `update-counts` | Recalculate task counts | `--file` |
1233
+ | `write-checkpoint` | Write checkpoint | `--file`, `--stage`, `--checkpoint`, `--passed` |
1234
+ | `update-workflow` | Update workflow stage status | `--file`, `--stage`, `--status` |
1235
+ | `init-tasks` | Generate tasks from feature-spec files | `--file`, `--stage`, `--features-dir`, `--platforms` |
1236
+
1237
+ ## PowerShell JSON Parameter Handling
1238
+
1239
+ > ⚠️ **CRITICAL: PowerShell cannot reliably pass JSON strings as command-line arguments.**
1240
+ > JSON containing quotes, braces, and special characters will be mangled by PowerShell's argument parser.
1241
+
1242
+ **MANDATORY RULE: When passing JSON data to scripts, ALWAYS use file-based parameters.**
1243
+
1244
+ **For `init --tasks`:**
1245
+
1246
+ ```powershell
1247
+ # ❌ WRONG — PowerShell will mangle the JSON string
1248
+ node speccrew-workspace/scripts/update-progress.js init --file progress.json --stage "01_prd" --tasks '[{"id":"task1"}]'
1249
+
1250
+ # ✅ CORRECT — Write JSON to a temp file first, then use --tasks-file
1251
+ # Step 1: Write tasks to a temp file inside speccrew-workspace
1252
+ # Step 2: Use --tasks-file parameter
1253
+ node speccrew-workspace/scripts/update-progress.js init --file progress.json --stage "sub_prd_dispatch" --tasks-file speccrew-workspace/iterations/{iteration}/01.product-requirement/.tasks-temp.json
1254
+ # Step 3: Delete the temp file after use
1255
+ ```
1256
+
1257
+ **General rules:**
1258
+ - All temp files MUST be created inside `speccrew-workspace/` (never in project root)
1259
+ - Delete temp files immediately after use
1260
+ - Use `--tasks-file` instead of `--tasks` for any non-trivial JSON data
1261
+ - For empty task lists, `--tasks '[]'` is safe in PowerShell (no special characters)
1262
+
1084
1263
  # Constraints
1085
1264
 
1086
1265
  ### MANDATORY Phase Execution Order
@@ -1121,6 +1300,9 @@ Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5 (if complex)
1121
1300
  - **Phase 4a (complex): MUST invoke `speccrew-pm-requirement-model` skill** — do NOT do ISA-95 analysis yourself
1122
1301
  - **Phase 4b: MUST invoke PRD generation skill** (`speccrew-pm-requirement-simple` or `speccrew-pm-requirement-analysis`)
1123
1302
  - Pass clarification context and complexity assessment to the skills
1303
+ - **Phase 0.1: MUST create iteration directory** following naming convention `{number}-{type}-{name}` and copy requirement document to `00.docs/`
1304
+ - **Phase 1 Path C: MUST execute automatic knowledge base initialization** when detector returns status="none" — DO NOT skip to Phase 2
1305
+ - **Phase 3→4 Gate: MUST wait for explicit user confirmation** after clarification before proceeding to Phase 4 PRD generation
1124
1306
  - Perform Complexity Assessment & Skill Routing at Phase 2 to determine simple vs complex workflow
1125
1307
  - For complex requirements (3+ modules), dispatch Sub-PRD generation to parallel workers using `speccrew-pm-sub-prd-generate/SKILL.md`
1126
1308
 
@@ -1136,4 +1318,9 @@ Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5 (if complex)
1136
1318
  - Do not automatically transition to or invoke the next stage agent (Feature Designer). The user will start the next stage in a new conversation window.
1137
1319
  - Do not create WORKFLOW-PROGRESS.json or DISPATCH-PROGRESS.json manually when the script is available
1138
1320
  - Do not search for PRD templates outside the skill's templates/ directory
1321
+ - Do not skip the user confirmation gate between Phase 3 (Clarification) and Phase 4 (PRD Generation) — user MUST explicitly confirm clarification results
1322
+ - Do not skip knowledge base initialization when detector returns status="none" — automatic initialization via Worker is MANDATORY
1323
+ - Do not create iteration directories without following the naming convention `{number}-{type}-{name}`
1324
+ - Do not create any files (including temporary files) outside `speccrew-workspace/` directory — all file operations MUST stay within the workspace boundary
1325
+ - Do not pass complex JSON strings directly as command-line arguments — use file-based parameters (e.g., `--tasks-file`) to avoid PowerShell parsing issues
1139
1326
 
@@ -621,10 +621,21 @@ Based on platform types in techs-manifest:
621
621
  Before dispatching, create or update dispatch tracking:
622
622
 
623
623
  1. **Initialize dispatch progress file with task list**:
624
+
625
+ > ⚠️ Use `--tasks-file` instead of `--tasks` to avoid PowerShell JSON parsing issues.
626
+
624
627
  ```bash
625
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{current}/03.system-design/DISPATCH-PROGRESS.json --stage 03_system_design --tasks '[{"id":"sd-{platform_id}-{feature_id}","platform":"{platform_id}","feature_id":"{feature_id}","feature_name":"{feature_name}","skill":"speccrew-sd-{type}","status":"pending"}]'
628
+ # Step 1: Write tasks JSON to temp file inside iteration directory
629
+ # Create .tasks-temp.json with the task array content
630
+ # Step 2: Initialize with --tasks-file
631
+ node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{current}/03.system-design/DISPATCH-PROGRESS.json --stage 03_system_design --tasks-file speccrew-workspace/iterations/{current}/03.system-design/.tasks-temp.json
632
+ # Step 3: Delete .tasks-temp.json after successful init
633
+ ```
634
+
635
+ Example `.tasks-temp.json` content:
636
+ ```json
637
+ [{"id":"sd-web-vue-F-CRM-01","platform":"web-vue","feature_id":"F-CRM-01","feature_name":"customer-list","skill":"speccrew-sd-frontend","status":"pending"}]
626
638
  ```
627
- Or use `--tasks-file` to load from a JSON file.
628
639
 
629
640
  **Task ID 格式更新**:
630
641
  - 旧格式: `sd-{platform}-{feature}`(如 `sd-web-vue-customer-list`)
@@ -493,9 +493,18 @@ Before dispatching tasks, create or read dispatch progress file:
493
493
 
494
494
  Note: `feature_id` is extracted from design doc filename. For new format `{feature-id}-{feature-name}-design.md`, use `{feature-id}`. For legacy format `{module}-design.md`, use `{module}` as feature_id.
495
495
 
496
- 3. **Alternatively, pass tasks JSON directly**:
496
+ 3. **Alternatively, use --tasks-file for direct task initialization**:
497
+
498
+ > ⚠️ Use --tasks-file instead of --tasks to avoid PowerShell JSON parsing issues.
499
+
497
500
  ```bash
498
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{current}/04.development/DISPATCH-PROGRESS.json --stage 04_development --tasks '[{"id":"dev-web-vue-crm","platform":"web-vue","module":"crm","skill":"speccrew-dev-frontend","status":"pending"}]'
501
+ # Write tasks to temp file, then use --tasks-file
502
+ # Create .tasks-temp.json with task array content inside iteration directory
503
+ node speccrew-workspace/scripts/update-progress.js init \
504
+ --file speccrew-workspace/iterations/{current}/04.development/DISPATCH-PROGRESS.json \
505
+ --stage 04_development \
506
+ --tasks-file speccrew-workspace/iterations/{current}/04.development/.tasks-temp.json
507
+ # Delete .tasks-temp.json after successful init
499
508
  ```
500
509
 
501
510
  ### 4.0a Task Entry Format
@@ -1014,9 +1023,44 @@ Assess readiness for test phase:
1014
1023
  - ⚠️ Conditional: Minor issues to resolve before testing
1015
1024
  - ❌ Not ready: Blockers must be resolved first
1016
1025
 
1026
+ ### 6.6.5 Present Delivery Report for User Confirmation
1027
+
1028
+ > 🛑 **HARD STOP — User Confirmation Required Before Finalizing**
1029
+ >
1030
+ > **DO NOT update WORKFLOW-PROGRESS.json to "completed" or "confirmed" before user explicitly confirms.**
1031
+ > **DO NOT assume user silence means confirmation.**
1032
+
1033
+ Present the delivery report summary to user:
1034
+
1035
+ ```
1036
+ 📋 Development Stage Delivery Report
1037
+
1038
+ Results:
1039
+ ├── Total Tasks: {count}
1040
+ ├── Completed: {count}
1041
+ ├── Failed: {count} (if any)
1042
+ ├── Code Review: {passed/failed}
1043
+ └── Cross-Platform Integration: {verified/skipped}
1044
+
1045
+ Delivery Report: {path}/delivery-report.md
1046
+ ```
1047
+
1048
+ **STOP and Request Confirmation:**
1049
+
1050
+ > 🛑 **AWAITING USER CONFIRMATION**
1051
+ >
1052
+ > "开发阶段已完成,请审查交付报告。确认无误后将更新工作流状态。"
1053
+ >
1054
+ > Options:
1055
+ > - "确认" or "OK" → Proceed to finalize (update workflow status)
1056
+ > - "需要修改" + details → Address issues before finalizing
1057
+ > - "取消" → Keep current status, do not finalize
1058
+ >
1059
+ > **I will NOT proceed until you explicitly confirm.**
1060
+
1017
1061
  ### 6.7 User Confirmation and Checkpoint Update
1018
1062
 
1019
- **Present delivery report to user and request confirmation.**
1063
+ **Prerequisite**: This step can ONLY proceed AFTER user explicitly confirms in step 6.6.5.
1020
1064
 
1021
1065
  **After user confirms delivery**:
1022
1066
 
@@ -466,13 +466,24 @@ Each task entry in DISPATCH-PROGRESS.json contains:
466
466
  | `partial` | Review found incomplete, awaiting re-dispatch |
467
467
  | `failed` | Task failed after max re-dispatch attempts |
468
468
 
469
+ > ⚠️ Use --tasks-file instead of --tasks to avoid PowerShell JSON parsing issues.
470
+
469
471
  **Initialize Dispatch Progress File:**
470
472
 
471
473
  Before dispatching, create dispatch tracking:
472
474
  ```bash
473
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json --stage 06_system_test --tasks '[{"id":"test-case-{platform_id}","platform":"{platform_id}","phase":"test_case_design","skill":"speccrew-test-case-design","status":"pending"}]'
475
+ # Write tasks to temp file, then use --tasks-file
476
+ # Create .tasks-temp.json with task array content inside iteration directory
477
+ echo '[{"id":"test-case-{platform_id}","platform":"{platform_id}","phase":"test_case_design","skill":"speccrew-test-case-design","status":"pending"}]' > speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.tasks-temp.json
478
+
479
+ node speccrew-workspace/scripts/update-progress.js init \
480
+ --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS.json \
481
+ --stage 06_system_test \
482
+ --tasks-file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.tasks-temp.json
483
+
484
+ # Delete .tasks-temp.json after successful init
485
+ rm speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.tasks-temp.json
474
486
  ```
475
- Or use `--tasks-file` to load from a JSON file.
476
487
 
477
488
  > **Note**: For subsequent phases (test_code_gen, test_execution), append tasks to the same file by reading the existing file and adding new tasks with the appropriate `phase` field.
478
489
 
@@ -580,11 +591,23 @@ Invoke Skill directly:
580
591
 
581
592
  > **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.
582
593
 
594
+ > ⚠️ Use --tasks-file instead of --tasks to avoid PowerShell JSON parsing issues.
595
+
583
596
  **Initialize Dispatch Progress File:**
584
597
 
585
598
  Append new tasks for test_code_gen phase by reading existing file and adding tasks:
586
599
  ```bash
587
- node speccrew-workspace/scripts/update-progress.js init --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS-test-code-gen.json --stage 06_system_test --tasks '[{"id":"test-code-{platform_id}","platform":"{platform_id}","phase":"test_code_gen","skill":"speccrew-test-code-gen","status":"pending"}]'
600
+ # Write tasks to temp file, then use --tasks-file
601
+ # Create .tasks-temp.json with task array content inside iteration directory
602
+ echo '[{"id":"test-code-{platform_id}","platform":"{platform_id}","phase":"test_code_gen","skill":"speccrew-test-code-gen","status":"pending"}]' > speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.tasks-temp.json
603
+
604
+ node speccrew-workspace/scripts/update-progress.js init \
605
+ --file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/DISPATCH-PROGRESS-test-code-gen.json \
606
+ --stage 06_system_test \
607
+ --tasks-file speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.tasks-temp.json
608
+
609
+ # Delete .tasks-temp.json after successful init
610
+ rm speccrew-workspace/iterations/{number}-{type}-{name}/06.system-test/.tasks-temp.json
588
611
  ```
589
612
  > **Note**: In practice, maintain a single DISPATCH-PROGRESS.json with all phases by merging task arrays.
590
613
 
@@ -804,7 +827,43 @@ Provide clear recommendation:
804
827
  - Confirm to proceed to delivery phase, or
805
828
  - Return to development phase for bug fixes
806
829
 
807
- ### 6.5 Finalize Progress Files
830
+ ### 6.5 Present Test Results for User Confirmation
831
+
832
+ > 🛑 **HARD STOP — Joint Confirmation Required Before Finalizing**
833
+ >
834
+ > **DO NOT update WORKFLOW-PROGRESS.json to "completed" or "confirmed" before user explicitly confirms.**
835
+ > **DO NOT assume user silence means confirmation.**
836
+
837
+ Present comprehensive test execution summary to user:
838
+
839
+ ```
840
+ 📋 Test Stage Delivery Report
841
+
842
+ Results:
843
+ ├── Test Cases Designed: {count}
844
+ ├── Test Code Generated: {count} files
845
+ ├── Tests Executed: {pass}/{total} passed
846
+ ├── Bug Reports: {critical}/{high}/{medium}/{low}
847
+ ├── Coverage: {percentage}%
848
+ └── Overall Status: {PASS/FAIL}
849
+
850
+ Test Report: {path}/test-summary-report.md
851
+ ```
852
+
853
+ **STOP and Request Confirmation:**
854
+
855
+ > 🛑 **AWAITING USER CONFIRMATION**
856
+ >
857
+ > "测试阶段已完成,请审查测试报告。确认无误后将更新工作流状态。"
858
+ >
859
+ > Options:
860
+ > - "确认" or "OK" → Proceed to finalize
861
+ > - "需要修改" + details → Address specific test issues
862
+ > - "取消" → Keep current status
863
+ >
864
+ > **I will NOT proceed until you explicitly confirm.**
865
+
866
+ ### 6.6 Finalize Progress Files
808
867
 
809
868
  **Update Checkpoint File:**
810
869
 
@@ -241,7 +241,7 @@ Key Decisions:
241
241
 
242
242
  Sufficiency Checks: 4/4 ✅
243
243
 
244
- Next: Proceed to PRD generation.
244
+ Next: Return to PM Agent for user confirmation before PRD generation.
245
245
  ```
246
246
 
247
247
  ---
@@ -265,8 +265,10 @@ Next: Proceed to PRD generation.
265
265
  - Use file-based for complex mode or 4+ questions
266
266
  - Pass all 4 Sufficiency Checks
267
267
  - Use `update-progress.js` for JSON files
268
+ - After completion, return control to PM Agent for user confirmation — DO NOT auto-proceed to PRD generation
268
269
 
269
270
  **Must not do:**
270
271
  - Skip clarification based on urgency
271
272
  - Use chat for complex requirements
272
273
  - Manually write JSON files
274
+ - Auto-proceed to Phase 4 (PRD generation) without PM Agent's user confirmation gate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -129,6 +129,21 @@ function acquireLock(filePath) {
129
129
  fs.closeSync(fd);
130
130
  return lockPath;
131
131
  } catch (error) {
132
+ // 检查是否为锁文件已存在的错误
133
+ if (error.code === 'EEXIST') {
134
+ try {
135
+ const lockStat = fs.statSync(lockPath);
136
+ const ageSeconds = (Date.now() - lockStat.mtimeMs) / 1000;
137
+ if (ageSeconds > 60) {
138
+ console.error(`Warning: Stale lock file detected (age: ${Math.round(ageSeconds)}s), removing: ${lockPath}`);
139
+ fs.unlinkSync(lockPath);
140
+ // 不消耗重试次数,继续下一次循环尝试获取锁
141
+ continue;
142
+ }
143
+ } catch (statErr) {
144
+ // 锁文件在 stat 时已被删除,继续重试即可
145
+ }
146
+ }
132
147
  retryCount++;
133
148
  if (retryCount >= maxRetries) {
134
149
  throw new Error(`Failed to acquire file lock for '${filePath}' after ${maxRetries} attempts`);