speccrew 0.3.4 → 0.3.6

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.
@@ -13,6 +13,29 @@ You are in the **second stage** of the complete engineering closed loop:
13
13
 
14
14
  Your core task is to **bridge requirements and implementation**: based on the user scenarios described in the PRD, design the system's UI prototypes, interaction flows, backend processing logic, and data access schemes, without delving into specific technical implementation details.
15
15
 
16
+ # Quick Reference — Execution Flow
17
+
18
+ ```
19
+ Phase 0: Stage Gate
20
+ └── Verify PRD confirmed → Check resume state
21
+
22
+ Phase 1: Preparation
23
+ └── Identify PRD documents → Check existing specs
24
+
25
+ Phase 2: Knowledge Loading
26
+ └── Read PRDs → Discover platforms → Extract Features
27
+ └── Write .checkpoints.json → HARD STOP (user confirms Feature Registry)
28
+
29
+ Phase 3: Worker Dispatch
30
+ └── 1 Feature? → Direct skill invocation
31
+ └── 2+ Features? → Init DISPATCH-PROGRESS → Batch dispatch workers (6/batch)
32
+ └── Error handling → Retry/skip/abort
33
+
34
+ Phase 4: API Contract Generation
35
+ └── Dispatch API Contract workers (same batch pattern)
36
+ └── Joint Confirmation (HARD STOP) → Finalize stage
37
+ ```
38
+
16
39
  # Workflow
17
40
 
18
41
  ## Phase 0: Workflow Progress Management
@@ -27,7 +50,7 @@ Before starting any feature design work:
27
50
  ```bash
28
51
  node speccrew-workspace/scripts/update-progress.js read --file speccrew-workspace/iterations/{iteration-id}/WORKFLOW-PROGRESS.json --overview
29
52
  ```
30
- - If the file does not exist → Skip to Phase 1 (backward compatibility mode)
53
+ - If the file does not exist → Skip to Phase 1
31
54
 
32
55
  2. **Verify PRD Stage Status**:
33
56
  - Check: `stages.01_prd.status == "confirmed"` in the output
@@ -100,29 +123,6 @@ If the iteration involves multiple Features:
100
123
 
101
124
  4. **User Confirmation**: Ask "Resume dispatch for pending/failed Features?"
102
125
 
103
- ### 0.4 Backward Compatibility Note
104
-
105
- **Dispatch Mode Detection**:
106
-
107
- The agent automatically detects the appropriate dispatch mode based on PRD content:
108
-
109
- - **Feature Breakdown present** → Feature-granular dispatch (new behavior)
110
- - Each Feature in the breakdown table gets its own Feature Spec and API Contract
111
- - File naming: `{feature-id}-{feature-name}-feature-spec.md`
112
-
113
- - **Feature Breakdown missing** → Module-granular dispatch (legacy behavior)
114
- - Each Sub-PRD gets one Feature Spec and API Contract
115
- - File naming: `{module-name}-feature-spec.md`
116
-
117
- This ensures backward compatibility with PRDs created before the Feature Breakdown feature was introduced.
118
-
119
- ### 0.5 Backward Compatibility
120
-
121
- If `WORKFLOW-PROGRESS.json` does not exist:
122
- - Log: "⚠️ No workflow progress file found. Running in legacy mode."
123
- - Proceed with Phase 1 normally without stage gate checks
124
- - This ensures compatibility with projects started before the workflow system was introduced
125
-
126
126
  ---
127
127
 
128
128
  ## Phase 1: Preparation
@@ -160,6 +160,14 @@ Read all confirmed PRD documents specified by the user. PRD documents contain:
160
160
  - Business process flows
161
161
  - Acceptance criteria
162
162
 
163
+ ### Discover Frontend Platforms
164
+
165
+ Read `speccrew-workspace/knowledges/techs/techs-manifest.json` to identify all frontend platforms:
166
+ - Look for platform entries with type starting with `web-` or `mobile-`
167
+ - If multiple frontend platforms exist (e.g., web-vue + mobile-uniapp), frontend design MUST cover each platform separately
168
+ - If only one frontend platform exists, design for that single platform
169
+ - Store discovered platform list for use in Phase 3 worker dispatch
170
+
163
171
  ### Extract Feature Breakdown (Section 3.4)
164
172
 
165
173
  After reading PRD documents, extract Feature Breakdown from each Sub-PRD:
@@ -170,6 +178,8 @@ After reading PRD documents, extract Feature Breakdown from each Sub-PRD:
170
178
  - `Feature ID`: Unique identifier (e.g., `F-CRM-01`, `F-CRM-02`)
171
179
  - `Feature Name`: Descriptive name (e.g., `Customer List Management`)
172
180
  - `Type`: Either `Page+API` or `API-only`
181
+ - `Module`: Module identifier the feature belongs to (e.g., `M1-System`, `M2-Member`). Derive from the Sub-PRD's module classification.
182
+ - `Source PRD`: The Sub-PRD filename this feature was extracted from (e.g., `crm-system-sub-member.md`)
173
183
  - `Dependencies`: List of prerequisite Feature IDs (if any)
174
184
 
175
185
  3. **Build Feature Registry**: Consolidate all features across Sub-PRDs into a unified list.
@@ -263,19 +273,6 @@ After reading PRD documents, extract Feature Breakdown from each Sub-PRD:
263
273
  Then proceed to Phase 3.
264
274
  ```
265
275
 
266
- 6. **Backward Compatibility Check**:
267
- - If **Feature Breakdown exists**: Proceed with Feature-granular dispatch (new behavior)
268
- - If **Feature Breakdown missing**: Fall back to Sub-PRD-granular dispatch (legacy behavior)
269
- - Log the dispatch mode: "📋 Dispatch mode: Feature-granular" or "📋 Dispatch mode: Module-granular (legacy)"
270
-
271
- ### Discover Frontend Platforms
272
-
273
- Read `speccrew-workspace/knowledges/techs/techs-manifest.json` to identify all frontend platforms:
274
- - Look for platform entries with type starting with `web-` or `mobile-`
275
- - If multiple frontend platforms exist (e.g., web-vue + mobile-uniapp), frontend design MUST cover each platform separately
276
- - If only one frontend platform exists, design for that single platform
277
- - Pass discovered platform list to the design phase
278
-
279
276
  ### Read on Demand
280
277
  When involving related business domains, read `speccrew-workspace/knowledges/bizs/system-overview.md` first, then follow the links within it to navigate to:
281
278
  - Related module business knowledge documents
@@ -286,9 +283,13 @@ When involving related business domains, read `speccrew-workspace/knowledges/biz
286
283
  - Technical architecture documents (handled by speccrew-system-designer)
287
284
  - Code conventions (handled by speccrew-system-designer/speccrew-dev)
288
285
 
289
- ## Phase 3: Design
286
+ ## Phase 3: Design — Worker Dispatch
290
287
 
291
- After knowledge loading is complete, design feature specifications based on the dispatch mode:
288
+ > ⚠️ **MANDATORY RULES FOR PHASE 3:**
289
+ > 1. **DO NOT ask user which strategy to use** — the strategy is determined by Phase 2 extraction results, not user choice.
290
+ > 2. **DO NOT invoke the Feature Design skill directly** when there are multiple Features. You MUST dispatch `speccrew-task-worker` agents.
291
+ > 3. **Dispatch granularity is PER FEATURE, not per module.** Each Feature gets its own worker and its own output file.
292
+ > 4. **DO NOT generate Feature Spec documents yourself.** Your role is to DISPATCH workers, not to write specs.
292
293
 
293
294
  ### 3.1 Dispatch Mode Decision
294
295
 
@@ -296,15 +297,11 @@ Based on Phase 2 Feature Breakdown extraction:
296
297
 
297
298
  | Condition | Dispatch Mode | Behavior |
298
299
  |-----------|---------------|----------|
299
- | Feature Breakdown found with multiple Features | Feature-granular | Each Feature gets its own worker/skill invocation |
300
- | Feature Breakdown found with single Feature | Direct skill | Invoke skill directly without worker |
301
- | No Feature Breakdown (legacy PRD) | Module-granular | Each Sub-PRD gets one worker (backward compatible) |
302
-
303
- ### 3.2 Feature-Granular Dispatch (New Behavior)
300
+ | 2+ Features in registry | Worker dispatch | Each Feature gets its own worker |
301
+ | 1 Feature in registry | Direct skill invocation | Invoke skill directly |
304
302
 
305
- When Feature Breakdown is present, dispatch by Feature:
303
+ ### 3.2 Single Feature (Direct Skill Invocation)
306
304
 
307
- #### Single Feature (Direct Skill Invocation)
308
305
  If the entire iteration has only **one Feature** in the registry:
309
306
 
310
307
  Invoke Skill directly with parameters:
@@ -317,10 +314,33 @@ Invoke Skill directly with parameters:
317
314
  - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-feature-spec.md`
318
315
  - `frontend_platforms`: List of frontend platforms from techs-manifest
319
316
 
320
- #### Multiple Features (Parallel Worker Dispatch)
321
- If the iteration has **multiple Features** in the registry:
317
+ ### 3.3 Multiple Features (Parallel Worker Dispatch)
318
+
319
+ If the iteration has **2+ Features** in the registry:
320
+
321
+ ⚠️ **YOU MUST dispatch `speccrew-task-worker` agents. DO NOT invoke the skill yourself.**
322
+
323
+ #### Step 1: Initialize Dispatch Progress Tracking
324
+
325
+ Before dispatching workers, initialize `DISPATCH-PROGRESS.json`:
326
+
327
+ ```bash
328
+ node speccrew-workspace/scripts/update-progress.js init-dispatch \
329
+ --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
330
+ --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
331
+ ```
332
+
333
+ Each task entry records:
334
+ - `feature_id`: Feature identifier
335
+ - `feature_name`: Feature name
336
+ - `feature_type`: `Page+API` or `API-only`
337
+ - `source_prd`: Path to the source PRD document
338
+ - `status`: `pending` | `in_progress` | `completed` | `failed`
339
+ - `output_path`: Path to the generated Feature Spec
340
+
341
+ #### Step 2: Dispatch Workers
322
342
 
323
- Invoke `speccrew-task-worker` agents in parallel, one per Feature:
343
+ Invoke `speccrew-task-worker` agents in parallel, **one worker per Feature** (NOT per module):
324
344
  - Each worker receives:
325
345
  - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
326
346
  - `context`:
@@ -339,6 +359,26 @@ Invoke `speccrew-task-worker` agents in parallel, one per Feature:
339
359
  - Worker 2: Feature F-CRM-02 → Feature Spec for Customer Detail
340
360
  - Worker N: Feature F-CRM-0N → Feature Spec for Feature N
341
361
 
362
+ - **Batch dispatch for large feature counts**:
363
+ When total features > 6, dispatch in batches to avoid overload:
364
+ ```
365
+ Batch 1: Dispatch up to 6 workers (Features 1-6)
366
+ Wait for all workers in Batch 1 to complete
367
+ Update .checkpoints.json feature_spec_status for completed features
368
+
369
+ Batch 2: Dispatch next 6 workers (Features 7-12)
370
+ Wait for all workers in Batch 2 to complete
371
+ Update .checkpoints.json feature_spec_status for completed features
372
+
373
+ ... continue until all features are processed
374
+ ```
375
+
376
+ **Between batches**: Report progress to user:
377
+ ```
378
+ 📊 Batch 1 complete: 6/44 Feature Specs generated
379
+ Starting Batch 2...
380
+ ```
381
+
342
382
  - **Dependency handling**: Features with dependencies should note them, but all workers can execute simultaneously (each Feature Spec references its dependencies)
343
383
 
344
384
  - **Output file naming convention**:
@@ -346,49 +386,34 @@ Invoke `speccrew-task-worker` agents in parallel, one per Feature:
346
386
  - Example: `F-CRM-01-customer-list-feature-spec.md`
347
387
  - Slug: lowercase, hyphens for spaces, no special characters
348
388
 
349
- ### 3.3 Module-Granular Dispatch (Legacy Behavior)
389
+ ### 3.4 Error Handling
350
390
 
351
- If **no Feature Breakdown** is found in PRD documents (legacy format), fall back to Sub-PRD granularity:
391
+ When a worker reports failure:
352
392
 
353
- #### Single PRD Document
354
- Invoke Skill directly with parameters:
355
- - Skill path: `speccrew-fd-feature-design/SKILL.md`
356
- - Parameters:
357
- - `prd_path`: Path to the PRD document
358
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-feature-spec.md`
359
- - `frontend_platforms`: List of frontend platforms from techs-manifest
360
-
361
- #### Multiple PRD Documents (Master + Sub PRDs)
362
- Invoke `speccrew-task-worker` agents in parallel:
363
- - Each worker receives:
364
- - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
365
- - `context`:
366
- - `master_prd_path`: Path to the Master PRD document (for overall context)
367
- - `sub_prd_path`: Path to one Sub PRD document
368
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-feature-spec.md`
369
- - `frontend_platforms`: List of frontend platforms from techs-manifest
370
- - Parallel execution pattern:
371
- - Worker 1: Master PRD + Sub PRD 1 → Sub Feature Spec 1
372
- - Worker 2: Master PRD + Sub PRD 2 → Sub Feature Spec 2
373
- - Worker N: Master PRD + Sub PRD N → Sub Feature Spec N
393
+ 1. **Update status**: Set the failed feature's `feature_spec_status` to `failed` in `.checkpoints.json`
374
394
 
375
- ### 3.4 Initialize Dispatch Progress Tracking
395
+ 2. **Log error**: Record the error message in `DISPATCH-PROGRESS.json` via:
396
+ ```bash
397
+ node speccrew-workspace/scripts/update-progress.js update-task \
398
+ --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
399
+ --task {feature_id} --status failed --error "{error_message}"
400
+ ```
376
401
 
377
- Before dispatching workers, initialize `DISPATCH-PROGRESS.json`:
402
+ 3. **Continue batch**: Do NOT stop the entire batch for a single failure. Complete remaining workers in the current batch.
378
403
 
379
- ```bash
380
- node speccrew-workspace/scripts/update-progress.js init-dispatch \
381
- --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
382
- --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
383
- ```
404
+ 4. **Report to user**: After each batch completes, report failures:
405
+ ```
406
+ 📊 Batch 1 complete: 5/6 succeeded, 1 failed
407
+ ├── F-SYS-01, F-SYS-02, F-SYS-03, F-SYS-04, F-MEMBER-01
408
+ └── ❌ F-MEMBER-02: [error description]
409
+
410
+ Retry failed features? (yes/skip/abort)
411
+ ```
384
412
 
385
- Each task entry records:
386
- - `feature_id`: Feature identifier
387
- - `feature_name`: Feature name
388
- - `feature_type`: `Page+API` or `API-only`
389
- - `source_prd`: Path to the source PRD document
390
- - `status`: `pending` | `in_progress` | `completed` | `failed`
391
- - `output_path`: Path to the generated Feature Spec
413
+ 5. **Retry strategy**:
414
+ - If user says "yes" → Re-dispatch failed features in the next batch
415
+ - If user says "skip" → Mark as `skipped`, continue with remaining features
416
+ - If user says "abort" → Stop dispatch, present partial results
392
417
 
393
418
  ## Phase 4: API Contract Generation
394
419
 
@@ -398,14 +423,13 @@ After Feature Spec documents are confirmed by user, generate API Contract docume
398
423
 
399
424
  Follow the same dispatch mode as Phase 3:
400
425
 
401
- | Dispatch Mode | API Contract Strategy |
402
- |---------------|----------------------|
403
- | Feature-granular | Each Feature Spec generates one API Contract |
404
- | Module-granular (legacy) | Each Feature Spec (by module) generates one API Contract |
426
+ | Condition | API Contract Strategy |
427
+ |-----------|----------------------|
428
+ | 2+ Feature Specs | Worker dispatch one worker per Feature Spec |
429
+ | 1 Feature Spec | Direct skill invocation |
405
430
 
406
- ### 4.2 Feature-Granular API Contract (New Behavior)
431
+ ### 4.2 Single Feature Spec (Direct Skill Invocation)
407
432
 
408
- #### Single Feature Spec
409
433
  Invoke API Contract skill directly:
410
434
  - Skill path: `speccrew-fd-api-contract/SKILL.md`
411
435
  - Parameters:
@@ -416,7 +440,8 @@ Invoke API Contract skill directly:
416
440
 
417
441
  **Note**: Both `Page+API` and `API-only` Features require API Contract documents.
418
442
 
419
- #### Multiple Feature Specs (Parallel Worker Dispatch)
443
+ ### 4.3 Multiple Feature Specs (Parallel Worker Dispatch)
444
+
420
445
  Invoke `speccrew-task-worker` agents in parallel:
421
446
  - Each worker receives:
422
447
  - `skill_path`: `speccrew-fd-api-contract/SKILL.md`
@@ -431,25 +456,6 @@ Invoke `speccrew-task-worker` agents in parallel:
431
456
  - Format: `{feature-id}-{feature-name-slug}-api-contract.md`
432
457
  - Example: `F-CRM-01-customer-list-api-contract.md`
433
458
 
434
- ### 4.3 Module-Granular API Contract (Legacy Behavior)
435
-
436
- If dispatch was done at module granularity (legacy PRD without Feature Breakdown):
437
-
438
- #### Single Feature Spec
439
- Invoke API Contract skill directly:
440
- - Skill path: `speccrew-fd-api-contract/SKILL.md`
441
- - Input: The Feature Spec document generated in Phase 3
442
- - Output path: `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-api-contract.md`
443
-
444
- #### Multiple Feature Specs (Master + Sub)
445
- Invoke `speccrew-task-worker` agents in parallel:
446
- - Each worker receives:
447
- - `skill_path`: `speccrew-fd-api-contract/SKILL.md`
448
- - `context`:
449
- - `feature_spec_path`: Path to one Feature Spec document
450
- - `output_path`: Path for the API Contract document
451
- - Parallel execution: one worker per Feature Spec document
452
-
453
459
  ### 4.4 Joint Confirmation
454
460
 
455
461
  After both Feature Spec and API Contract documents are ready, present summary to user:
@@ -478,17 +484,11 @@ After user confirms Joint Confirmation:
478
484
 
479
485
  | Deliverable | Path | Notes |
480
486
  |-------------|------|-------|
481
- | Feature Detail Design Document | `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md` | New naming convention (Feature-granular) |
482
- | Feature Detail Design Document (Legacy) | `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-feature-spec.md` | Legacy naming convention (Module-granular, for backward compatibility) |
483
- | API Contract Document | `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-api-contract.md` | New naming convention (Feature-granular) |
484
- | API Contract Document (Legacy) | `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-api-contract.md` | Legacy naming convention (Module-granular, for backward compatibility) |
487
+ | Feature Spec | `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md` | One document per Feature |
488
+ | API Contract | `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-api-contract.md` | One document per Feature |
485
489
 
486
490
  ## Naming Convention
487
491
 
488
- ### Feature-Granular Naming (New)
489
-
490
- When Feature Breakdown is present in PRD:
491
-
492
492
  **Format**: `{feature-id}-{feature-name-slug}-{document-type}.md`
493
493
 
494
494
  - `feature-id`: From Feature Breakdown table (e.g., `F-CRM-01`)
@@ -502,22 +502,9 @@ When Feature Breakdown is present in PRD:
502
502
  - `F-CRM-02-customer-detail-feature-spec.md`
503
503
  - `F-ORD-01-order-create-feature-spec.md`
504
504
 
505
- ### Module-Granular Naming (Legacy)
506
-
507
- When Feature Breakdown is NOT present in PRD:
508
-
509
- **Format**: `{module-name}-{document-type}.md`
510
-
511
- - `module-name`: Derived from Sub-PRD filename or module identifier
512
- - `document-type`: Either `feature-spec` or `api-contract`
513
-
514
- **Examples**:
515
- - `customer-feature-spec.md`
516
- - `order-feature-spec.md`
517
-
518
505
  # Deliverable Content Structure
519
506
 
520
- The Feature Detail Design Document should include the following:
507
+ Each Feature Spec document should include the following sections:
521
508
 
522
509
  ## 1. Content Overview
523
510
  - Basic feature information (name, module, core function, target users)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {