speccrew 0.3.5 → 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
@@ -300,15 +297,11 @@ Based on Phase 2 Feature Breakdown extraction:
300
297
 
301
298
  | Condition | Dispatch Mode | Behavior |
302
299
  |-----------|---------------|----------|
303
- | Feature Breakdown found with 2+ Features | Feature-granular (worker dispatch) | Each Feature gets its own worker |
304
- | Feature Breakdown found with 1 Feature | Direct skill invocation | Invoke skill directly (only case where this is allowed) |
305
- | No Feature Breakdown (legacy PRD) | Module-granular (worker dispatch) | Each Sub-PRD gets one worker (backward compatible) |
300
+ | 2+ Features in registry | Worker dispatch | Each Feature gets its own worker |
301
+ | 1 Feature in registry | Direct skill invocation | Invoke skill directly |
306
302
 
307
- ### 3.2 Feature-Granular Dispatch (New Behavior)
303
+ ### 3.2 Single Feature (Direct Skill Invocation)
308
304
 
309
- When Feature Breakdown is present and has 2+ Features:
310
-
311
- #### Single Feature (Direct Skill Invocation)
312
305
  If the entire iteration has only **one Feature** in the registry:
313
306
 
314
307
  Invoke Skill directly with parameters:
@@ -321,11 +314,32 @@ Invoke Skill directly with parameters:
321
314
  - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature_id}-{feature-name-slug}-feature-spec.md`
322
315
  - `frontend_platforms`: List of frontend platforms from techs-manifest
323
316
 
324
- #### Multiple Features (Parallel Worker Dispatch)
317
+ ### 3.3 Multiple Features (Parallel Worker Dispatch)
318
+
325
319
  If the iteration has **2+ Features** in the registry:
326
320
 
327
321
  ⚠️ **YOU MUST dispatch `speccrew-task-worker` agents. DO NOT invoke the skill yourself.**
328
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
342
+
329
343
  Invoke `speccrew-task-worker` agents in parallel, **one worker per Feature** (NOT per module):
330
344
  - Each worker receives:
331
345
  - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
@@ -372,49 +386,34 @@ Invoke `speccrew-task-worker` agents in parallel, **one worker per Feature** (NO
372
386
  - Example: `F-CRM-01-customer-list-feature-spec.md`
373
387
  - Slug: lowercase, hyphens for spaces, no special characters
374
388
 
375
- ### 3.3 Module-Granular Dispatch (Legacy Behavior)
389
+ ### 3.4 Error Handling
376
390
 
377
- If **no Feature Breakdown** is found in PRD documents (legacy format), fall back to Sub-PRD granularity:
391
+ When a worker reports failure:
378
392
 
379
- #### Single PRD Document
380
- Invoke Skill directly with parameters:
381
- - Skill path: `speccrew-fd-feature-design/SKILL.md`
382
- - Parameters:
383
- - `prd_path`: Path to the PRD document
384
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-feature-spec.md`
385
- - `frontend_platforms`: List of frontend platforms from techs-manifest
393
+ 1. **Update status**: Set the failed feature's `feature_spec_status` to `failed` in `.checkpoints.json`
386
394
 
387
- #### Multiple PRD Documents (Master + Sub PRDs)
388
- Invoke `speccrew-task-worker` agents in parallel:
389
- - Each worker receives:
390
- - `skill_path`: `speccrew-fd-feature-design/SKILL.md`
391
- - `context`:
392
- - `master_prd_path`: Path to the Master PRD document (for overall context)
393
- - `sub_prd_path`: Path to one Sub PRD document
394
- - `output_path`: `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-feature-spec.md`
395
- - `frontend_platforms`: List of frontend platforms from techs-manifest
396
- - Parallel execution pattern:
397
- - Worker 1: Master PRD + Sub PRD 1 → Sub Feature Spec 1
398
- - Worker 2: Master PRD + Sub PRD 2 → Sub Feature Spec 2
399
- - Worker N: Master PRD + Sub PRD N → Sub Feature Spec N
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
+ ```
400
401
 
401
- ### 3.4 Initialize Dispatch Progress Tracking
402
+ 3. **Continue batch**: Do NOT stop the entire batch for a single failure. Complete remaining workers in the current batch.
402
403
 
403
- Before dispatching workers, initialize `DISPATCH-PROGRESS.json`:
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
+ ```
404
412
 
405
- ```bash
406
- node speccrew-workspace/scripts/update-progress.js init-dispatch \
407
- --file speccrew-workspace/iterations/{iteration}/02.feature-design/DISPATCH-PROGRESS.json \
408
- --tasks "F-CRM-01,F-CRM-02,F-CRM-03"
409
- ```
410
-
411
- Each task entry records:
412
- - `feature_id`: Feature identifier
413
- - `feature_name`: Feature name
414
- - `feature_type`: `Page+API` or `API-only`
415
- - `source_prd`: Path to the source PRD document
416
- - `status`: `pending` | `in_progress` | `completed` | `failed`
417
- - `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
418
417
 
419
418
  ## Phase 4: API Contract Generation
420
419
 
@@ -424,14 +423,13 @@ After Feature Spec documents are confirmed by user, generate API Contract docume
424
423
 
425
424
  Follow the same dispatch mode as Phase 3:
426
425
 
427
- | Dispatch Mode | API Contract Strategy |
428
- |---------------|----------------------|
429
- | Feature-granular | Each Feature Spec generates one API Contract |
430
- | 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 |
431
430
 
432
- ### 4.2 Feature-Granular API Contract (New Behavior)
431
+ ### 4.2 Single Feature Spec (Direct Skill Invocation)
433
432
 
434
- #### Single Feature Spec
435
433
  Invoke API Contract skill directly:
436
434
  - Skill path: `speccrew-fd-api-contract/SKILL.md`
437
435
  - Parameters:
@@ -442,7 +440,8 @@ Invoke API Contract skill directly:
442
440
 
443
441
  **Note**: Both `Page+API` and `API-only` Features require API Contract documents.
444
442
 
445
- #### Multiple Feature Specs (Parallel Worker Dispatch)
443
+ ### 4.3 Multiple Feature Specs (Parallel Worker Dispatch)
444
+
446
445
  Invoke `speccrew-task-worker` agents in parallel:
447
446
  - Each worker receives:
448
447
  - `skill_path`: `speccrew-fd-api-contract/SKILL.md`
@@ -457,25 +456,6 @@ Invoke `speccrew-task-worker` agents in parallel:
457
456
  - Format: `{feature-id}-{feature-name-slug}-api-contract.md`
458
457
  - Example: `F-CRM-01-customer-list-api-contract.md`
459
458
 
460
- ### 4.3 Module-Granular API Contract (Legacy Behavior)
461
-
462
- If dispatch was done at module granularity (legacy PRD without Feature Breakdown):
463
-
464
- #### Single Feature Spec
465
- Invoke API Contract skill directly:
466
- - Skill path: `speccrew-fd-api-contract/SKILL.md`
467
- - Input: The Feature Spec document generated in Phase 3
468
- - Output path: `speccrew-workspace/iterations/{iteration}/02.feature-design/{module-name}-api-contract.md`
469
-
470
- #### Multiple Feature Specs (Master + Sub)
471
- Invoke `speccrew-task-worker` agents in parallel:
472
- - Each worker receives:
473
- - `skill_path`: `speccrew-fd-api-contract/SKILL.md`
474
- - `context`:
475
- - `feature_spec_path`: Path to one Feature Spec document
476
- - `output_path`: Path for the API Contract document
477
- - Parallel execution: one worker per Feature Spec document
478
-
479
459
  ### 4.4 Joint Confirmation
480
460
 
481
461
  After both Feature Spec and API Contract documents are ready, present summary to user:
@@ -504,17 +484,11 @@ After user confirms Joint Confirmation:
504
484
 
505
485
  | Deliverable | Path | Notes |
506
486
  |-------------|------|-------|
507
- | Feature Detail Design Document | `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-feature-spec.md` | New naming convention (Feature-granular) |
508
- | 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) |
509
- | API Contract Document | `speccrew-workspace/iterations/{iteration}/02.feature-design/{feature-id}-{feature-name}-api-contract.md` | New naming convention (Feature-granular) |
510
- | 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 |
511
489
 
512
490
  ## Naming Convention
513
491
 
514
- ### Feature-Granular Naming (New)
515
-
516
- When Feature Breakdown is present in PRD:
517
-
518
492
  **Format**: `{feature-id}-{feature-name-slug}-{document-type}.md`
519
493
 
520
494
  - `feature-id`: From Feature Breakdown table (e.g., `F-CRM-01`)
@@ -528,22 +502,9 @@ When Feature Breakdown is present in PRD:
528
502
  - `F-CRM-02-customer-detail-feature-spec.md`
529
503
  - `F-ORD-01-order-create-feature-spec.md`
530
504
 
531
- ### Module-Granular Naming (Legacy)
532
-
533
- When Feature Breakdown is NOT present in PRD:
534
-
535
- **Format**: `{module-name}-{document-type}.md`
536
-
537
- - `module-name`: Derived from Sub-PRD filename or module identifier
538
- - `document-type`: Either `feature-spec` or `api-contract`
539
-
540
- **Examples**:
541
- - `customer-feature-spec.md`
542
- - `order-feature-spec.md`
543
-
544
505
  # Deliverable Content Structure
545
506
 
546
- The Feature Detail Design Document should include the following:
507
+ Each Feature Spec document should include the following sections:
547
508
 
548
509
  ## 1. Content Overview
549
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.5",
3
+ "version": "0.3.6",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {