speccrew 0.3.11 → 0.3.13

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.
@@ -50,9 +50,9 @@ Before starting work, check the workflow progress state:
50
50
  3. **If WORKFLOW-PROGRESS.json does not exist**:
51
51
  - **MUST use script to initialize:**
52
52
  ```bash
53
- node speccrew-workspace/scripts/update-progress.js init-workflow \
53
+ node speccrew-workspace/scripts/update-progress.js update-workflow \
54
54
  --file speccrew-workspace/iterations/{iteration}/WORKFLOW-PROGRESS.json \
55
- --iteration {iteration}
55
+ --stage 01_prd --status in_progress
56
56
  ```
57
57
  - **Fallback** (ONLY if script file does not exist):
58
58
  Create manually with the following structure:
@@ -241,6 +241,13 @@ complexity_notes: <if complex, note affected modules>
241
241
 
242
242
  ## Phase 3: Invoke Skill
243
243
 
244
+ > ⚠️ **PM AGENT ORCHESTRATION PRINCIPLE (Phase 3-5)**
245
+ > You are the ORCHESTRATOR, NOT the WRITER:
246
+ > - Phase 3: DO NOT generate Master PRD yourself → Skill generates it
247
+ > - Phase 4: DO NOT generate Sub-PRD yourself → Workers generate them
248
+ > - Phase 5: DO NOT modify PRD content yourself → Only verify and present
249
+ > - **If Skill fails: STOP and report error to user. DO NOT generate content as fallback.**
250
+
244
251
  Based on the complexity assessment in Phase 1, invoke the appropriate skill:
245
252
 
246
253
  **For Simple Requirements:**
@@ -257,25 +264,89 @@ Pass the following context to the Skill:
257
264
 
258
265
  ### After Skill Completes
259
266
 
260
- When the invoked skill returns:
267
+ **Step A: Check Skill Execution Status**
268
+
269
+ - IF Skill FAILED or returned error → Go to **Phase 3a: Error Recovery**
270
+ - IF Skill SUCCEEDED → Go to **Phase 3b: Validate & Route**
261
271
 
262
- 1. **Check if Master-Sub structure was selected** (from skill Step 8 output)
263
- 2. **If Master-Sub**: Skill will output a Sub-PRD Dispatch Plan → **MANDATORY: Execute Phase 4**
264
- 3. **If Single PRD**: Skill completed the entire PRD → **Skip Phase 4, go to Phase 5**
272
+ ### Phase 3a: Error Recovery (Skill Failed)
273
+
274
+ > ⚠️ **ABORT CONDITIONS Execution MUST STOP:**
275
+ > - Skill reported execution failure or was interrupted
276
+ > - No PRD document was generated
277
+ > - PRD file exists but is incomplete or malformed
278
+ >
279
+ > **FORBIDDEN ACTIONS:**
280
+ > - DO NOT generate Master PRD as fallback
281
+ > - DO NOT generate Sub-PRDs as fallback
282
+ > - DO NOT create partial PRD documents
283
+ > - DO NOT proceed to Phase 4 or Phase 5
284
+
285
+ Actions:
286
+ 1. Report error to user: "Skill execution failed: [specific reason]"
287
+ 2. Ask user: "Retry with additional clarification?" or "Abort current workflow?"
288
+ 3. IF retry → Return to Phase 2, gather more context, then retry Phase 3
289
+ 4. IF abort → END workflow
290
+
291
+ ### Phase 3b: Validate & Route (Skill Succeeded)
292
+
293
+ 1. **Identify PRD structure type** (from Skill output):
294
+ - Master-Sub structure → Validate Dispatch Plan (Step 2)
295
+ - Single PRD → Skip to Phase 5
296
+
297
+ 2. **Validate Dispatch Plan (Master-Sub only)**:
298
+ - [ ] Master PRD file exists and is readable
299
+ - [ ] Dispatch Plan contains module list (count ≥ 2)
300
+ - [ ] Each module has: module_name, module_key, module_scope, module_entities
301
+ - [ ] template_path and output_dir are defined
302
+
303
+ IF ANY validation fails:
304
+ → STOP. Report: "Dispatch Plan incomplete: [missing items]"
305
+ → Ask user to retry Skill execution
306
+ → DO NOT proceed to Phase 4
307
+
308
+ 3. **Route**:
309
+ - Master-Sub + Dispatch Plan valid → **MANDATORY: Execute Phase 4**
310
+ - Single PRD → **Skip Phase 4, go to Phase 5**
265
311
 
266
312
  > ⚠️ **DO NOT present results to user before Phase 4 completes (for complex requirements).**
267
313
  > The Master PRD alone is incomplete without Sub-PRDs.
268
314
 
269
315
  ---
270
316
 
317
+ > ⚠️ **MANDATORY RULES FOR PHASE 3:**
318
+ > 1. DO NOT generate Master PRD yourself — it MUST be generated by Skill
319
+ > 2. DO NOT generate any PRD content as fallback if Skill fails
320
+ > 3. DO NOT skip Skill failure validation
321
+ > 4. MUST validate Dispatch Plan completeness before entering Phase 4
322
+ >
323
+ > **ABORT CONDITIONS:**
324
+ > - IF Skill execution failed → STOP and report to user
325
+ > - IF PRD output is missing or incomplete → STOP and report to user
326
+ > - IF PM Agent attempts to generate PRD content itself → STOP (ORCHESTRATOR ONLY)
327
+
328
+ ---
329
+
271
330
  > ⚠️ **MANDATORY RULES FOR PHASE 4 (Sub-PRD Worker Dispatch):**
272
331
  > These rules apply to ALL complex requirements (3+ modules). Violation = workflow failure.
273
332
  >
274
333
  > 1. **DO NOT skip Phase 4 when Master-Sub structure is present** — If the Skill output indicates "Master-Sub PRD structure", Phase 4 MUST execute.
275
334
  > 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.
276
- > 3. **DO NOT create DISPATCH-PROGRESS.json manually** — Use the script: `node speccrew-workspace/scripts/update-progress.js init-dispatch`.
335
+ > 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>'`.
277
336
  > 4. **DO NOT dispatch Sub-PRDs sequentially** — All workers MUST execute in parallel (batch of 6 if modules > 6).
278
337
  > 5. **DO NOT proceed to Phase 5 without verification** — After ALL workers complete, execute Phase 5 Verification Checklist before presenting to user.
338
+ >
339
+ > **ABORT CONDITIONS for Phase 4:**
340
+ > - IF Dispatch Plan was not generated by Skill → STOP and return to Skill
341
+ > - IF DISPATCH-PROGRESS.json initialization failed → STOP and report error
342
+ > - IF PM Agent attempts to generate Sub-PRD content itself → STOP (you are ORCHESTRATOR, not WRITER)
343
+ >
344
+ > **FORBIDDEN ACTIONS in Phase 4:**
345
+ > - DO NOT ask user to select which modules to generate first
346
+ > - DO NOT ask user to provide or select templates (template path comes from Skill output)
347
+ > - DO NOT offer strategy choices (generate all / generate 3 first / pick priority)
348
+ > - DO NOT generate any Sub-PRD document content directly
349
+ > - JUST DISPATCH ALL WORKERS AND WAIT FOR COMPLETION
279
350
 
280
351
  ## Phase 4: Sub-PRD Worker Dispatch (Master-Sub Structure Only)
281
352
 
@@ -300,11 +371,18 @@ From the Skill's Step 12c output, collect:
300
371
 
301
372
  **MANDATORY: Initialize dispatch tracking with script:**
302
373
  ```bash
303
- node speccrew-workspace/scripts/update-progress.js init-dispatch \
374
+ node speccrew-workspace/scripts/update-progress.js init \
304
375
  --file speccrew-workspace/iterations/{iteration}/01.product-requirement/DISPATCH-PROGRESS.json \
305
- --tasks "module-key-1,module-key-2,module-key-3,..."
376
+ --stage sub_prd_dispatch \
377
+ --tasks '[{"id":"module-key-1","name":"Module 1 Name"},{"id":"module-key-2","name":"Module 2 Name"}]'
306
378
  ```
307
379
 
380
+ > **PowerShell Compatibility Note:**
381
+ > PowerShell cannot properly parse JSON in command-line arguments. Use file-based approach:
382
+ > 1. Write tasks JSON to a temporary file (e.g., `tasks-temp.json`)
383
+ > 2. Read file content in the command: `node scripts/update-progress.js init --stage sub_prd_dispatch --tasks (Get-Content tasks-temp.json -Raw)`
384
+ > 3. Or use: `Get-Content tasks-temp.json | node scripts/update-progress.js init --stage sub_prd_dispatch --tasks -`
385
+
308
386
  > ⚠️ DO NOT create DISPATCH-PROGRESS.json manually with PowerShell or any other method.
309
387
  > If the script fails, STOP and report the error to the user.
310
388
 
@@ -324,7 +402,24 @@ node speccrew-workspace/scripts/update-progress.js update-task \
324
402
 
325
403
  ### 4.3 Dispatch Workers
326
404
 
327
- Invoke `speccrew-task-worker` agents in parallel, one per module:
405
+ **PM Agent Role: ORCHESTRATOR ONLY**
406
+
407
+ You are the dispatcher, NOT the writer. Your job is to:
408
+ 1. Invoke `speccrew-task-worker` for EACH module
409
+ 2. Pass the correct skill_path and context
410
+ 3. Wait for all workers to complete
411
+ 4. Collect results
412
+
413
+ **Implementation:**
414
+
415
+ For EACH module in the dispatch plan, invoke a new `speccrew-task-worker` agent:
416
+ - **skill_path**: Search with glob `**/speccrew-pm-sub-prd-generate/SKILL.md`
417
+ - **context**:
418
+ - `module_name`: from dispatch plan
419
+ - `module_key`: from dispatch plan
420
+ - `master_prd_path`: path to Master PRD
421
+ - `template_path`: PRD template path (from Step 7 glob search result)
422
+ - `output_dir`: `speccrew-workspace/iterations/{iteration}/01.product-requirement/`
328
423
 
329
424
  Each worker receives:
330
425
  - `skill_path`: `speccrew-pm-sub-prd-generate/SKILL.md`
@@ -342,6 +437,10 @@ Each worker receives:
342
437
  - `template_path`: Path to PRD-TEMPLATE.md
343
438
  - `output_path`: `{output_dir}/{feature_name}-sub-{module_key}.md`
344
439
 
440
+ **Batch Strategy:**
441
+ - If modules ≤ 6: dispatch ALL in parallel
442
+ - If modules > 6: dispatch in batches of 6, wait for batch completion before next batch
443
+
345
444
  **Parallel execution pattern:**
346
445
  ```
347
446
  Worker 1: Module "customer" → crm-system-sub-customer.md
@@ -351,7 +450,12 @@ Worker 3: Module "opportunity" → crm-system-sub-opportunity.md
351
450
  Worker N: Module "{module-N}" → crm-system-sub-{module-N}.md
352
451
  ```
353
452
 
354
- **All workers execute simultaneously.** Wait for all workers to complete before proceeding.
453
+ **All workers execute simultaneously (or in batches).** Wait for all workers to complete before proceeding.
454
+
455
+ **Before proceeding to Phase 5, verify:**
456
+ - [ ] All workers were dispatched via speccrew-task-worker
457
+ - [ ] No Sub-PRD was generated by PM Agent directly
458
+ - [ ] All workers completed (check DISPATCH-PROGRESS.json)
355
459
 
356
460
  ### 4.4 Collect Results
357
461
 
@@ -435,9 +539,9 @@ After user confirms (HARD STOP passed), update `.checkpoints.json`:
435
539
 
436
540
  | Deliverable | Path | Notes |
437
541
  |-------------|------|-------|
438
- | PRD Document | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-prd.md` | Based on template from `speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md` |
439
- | Business Modeling (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-bizs-modeling.md` | ISA-95 six-stage modeling, only for complex requirements |
440
- | Sub-PRD Documents (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.prd/[feature-name]-sub-[module].md` | One per module, generated by worker dispatch |
542
+ | PRD Document | `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[feature-name]-prd.md` | Based on template from `speccrew-pm-requirement-analysis/templates/PRD-TEMPLATE.md` |
543
+ | Business Modeling (complex) | `speccrew-workspace/iterations/{number}-{type}-{name}/01.product-requirement/[feature-name]-bizs-modeling.md` | ISA-95 six-stage modeling, only for complex requirements |
544
+ | 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 |
441
545
 
442
546
  # Constraints
443
547
 
@@ -663,17 +663,17 @@ Before writing any file, create a complete list of ALL files to generate:
663
663
 
664
664
  | # | File | Path |
665
665
  |---|------|------|
666
- | 1 | PRD | {iteration}/01.prd/{feature-name}-prd.md |
666
+ | 1 | PRD | {iteration}/01.product-requirement/{feature-name}-prd.md |
667
667
 
668
668
  **For Master-Sub Structure (present this table to user):**
669
669
 
670
670
  | # | File Type | Module | Path |
671
671
  |---|-----------|--------|------|
672
- | 1 | Master PRD | (system overview) | {iteration}/01.prd/{feature-name}-prd.md |
673
- | 2 | Sub-PRD | {module-1-name} | {iteration}/01.prd/{feature-name}-sub-{module-1-key}.md |
674
- | 3 | Sub-PRD | {module-2-name} | {iteration}/01.prd/{feature-name}-sub-{module-2-key}.md |
672
+ | 1 | Master PRD | (system overview) | {iteration}/01.product-requirement/{feature-name}-prd.md |
673
+ | 2 | Sub-PRD | {module-1-name} | {iteration}/01.product-requirement/{feature-name}-sub-{module-1-key}.md |
674
+ | 3 | Sub-PRD | {module-2-name} | {iteration}/01.product-requirement/{feature-name}-sub-{module-2-key}.md |
675
675
  | ... | ... | ... | ... |
676
- | N+1 | Sub-PRD | {module-N-name} | {iteration}/01.prd/{feature-name}-sub-{module-N-key}.md |
676
+ | N+1 | Sub-PRD | {module-N-name} | {iteration}/01.product-requirement/{feature-name}-sub-{module-N-key}.md |
677
677
 
678
678
  Total files: 1 (Master) + N (Sub-PRDs) = N+1 files.
679
679
 
@@ -684,7 +684,7 @@ Total files: 1 (Master) + N (Sub-PRDs) = N+1 files.
684
684
  ### Step 12b: Generate Master PRD
685
685
 
686
686
  1. Read `templates/PRD-TEMPLATE.md` (already loaded in Step 7)
687
- 2. Create document using `create_file` at: `{iteration}/01.prd/{feature-name}-prd.md`
687
+ 2. Create document using `create_file` at: `{iteration}/01.product-requirement/{feature-name}-prd.md`
688
688
 
689
689
  3. Fill content using `search_replace` per section:
690
690
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {