speccrew 0.6.26 → 0.6.27

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.
@@ -22,9 +22,9 @@ Phase 0: Stage Gate
22
22
  Phase 1: Preparation
23
23
  └── Identify PRD documents → Check existing specs
24
24
 
25
- Phase 2: Knowledge Loading
26
- └── Read PRDsDiscover platforms → Extract Features
27
- └── Write .checkpoints.json → HARD STOP (user confirms Feature Registry)
25
+ Phase 2: Load Feature List
26
+ └── Read .prd-feature-list.jsonVerify structure
27
+ └── Write .checkpoints.json → HARD STOP (user confirms Feature List)
28
28
 
29
29
  Phase 3: Feature Design — Two-Stage Pipeline
30
30
  └── 3a: Analyze (fd-feature-analyze)
@@ -51,7 +51,8 @@ Phase 4: API Contract Generation
51
51
  | Phase | Rule | Description |
52
52
  |-------|------|-------------|
53
53
  | Phase 0 | STAGE GATE | PRD must be confirmed before starting. If not → STOP |
54
- | Phase 2 | HARD STOP | Feature Registry must be confirmed by user before Phase 3 |
54
+ | Phase 2 | HARD STOP | Feature List must be confirmed by user before Phase 3 |
55
+ | Phase 2 | FILE REQUIRED | `.prd-feature-list.json` must exist. If missing → STOP |
55
56
  | Phase 3a | SKILL-ONLY | Analyze workers MUST use speccrew-fd-feature-analyze skill. Agent MUST NOT perform function decomposition itself |
56
57
  | Phase 3b | SKILL-ONLY | Design & Generate workers MUST use speccrew-fd-feature-design skill. Agent MUST NOT design features or write Feature Spec documents itself |
57
58
  | Phase 3c | HARD STOP (multi) | For 2+ Features: Agent MUST present batch summary and wait for user confirmation after Feature Specs are generated |
@@ -59,7 +60,7 @@ Phase 4: API Contract Generation
59
60
  | Phase 4 | HARD STOP | Joint Confirmation must be confirmed by user before finalizing |
60
61
  | ALL | ABORT ON FAILURE | If any skill invocation fails → STOP and report. Do NOT attempt to generate content manually as fallback |
61
62
  | ALL | SCRIPT ENFORCEMENT | All .checkpoints.json and WORKFLOW-PROGRESS.json updates via update-progress.js script. Manual JSON creation FORBIDDEN |
62
- | ALL | NAME LOCK | After Phase 2 Feature Registry is confirmed, feature_name is immutable. All Skills MUST use the exact parameter value for output filenames. Name translation or substitution is FORBIDDEN |
63
+ | ALL | NAME LOCK | After Phase 2 Feature List is confirmed, feature_name is immutable. All Skills MUST use the exact parameter value for output filenames. Name translation or substitution is FORBIDDEN |
63
64
 
64
65
  ## MANDATORY WORKER ENFORCEMENT
65
66
 
@@ -131,7 +132,7 @@ This agent MUST execute tasks continuously without unnecessary interruptions.
131
132
  1. **Skill Invocation Failure**: Any skill call returns error → STOP. Do NOT generate content manually.
132
133
  2. **Script Execution Failure**: `node ... update-progress.js` fails → STOP. Do NOT manually create/edit JSON files.
133
134
  3. **Missing Intermediate Artifacts**: `.feature-analysis.md` missing before Phase 3b → STOP.
134
- 4. **User Rejection**: User rejects Feature Registry, batch design summary, or Joint Confirmation → STOP, ask for specific revision requirements.
135
+ 4. **User Rejection**: User rejects Feature List, batch design summary, or Joint Confirmation → STOP, ask for specific revision requirements.
135
136
  5. **Worker Batch Failure**: If >50% workers in a batch fail → STOP entire batch, report to user.
136
137
 
137
138
  ## TIMESTAMP INTEGRITY
@@ -261,15 +262,13 @@ Check if feature specification documents already exist in the current iteration:
261
262
  - If feature specification documents already exist → Ask user whether to overwrite or create a new version
262
263
  - If no feature specification documents exist → Proceed directly to design phase
263
264
 
264
- ## Phase 2: Feature Registry Initialization
265
+ ## Phase 2: Load Feature List
265
266
 
266
267
  > 🛑 **ORCHESTRATOR RULES — Phase 2**
267
- > - ❌ DO NOT read PRD files directly — dispatch Worker
268
+ > - ❌ DO NOT read PRD files directly
268
269
  > - ❌ DO NOT parse Feature Breakdown tables yourself
269
- > - DO NOT read techs-manifest.json directly
270
- > - DO NOT build Feature Registry manually
271
- > - ✅ ONLY dispatch Worker with `speccrew-fd-feature-registry-init` skill
272
- > - ✅ ONLY read `.feature-registry.json` after Worker completes
270
+ > - ONLY read `.prd-feature-list.json` generated by PM Agent
271
+ > - Verify file structure and content completeness
273
272
  > - ✅ ONLY present summary and collect user confirmation
274
273
 
275
274
  ### Step 1: Confirm PRD Path
@@ -277,63 +276,85 @@ Check if feature specification documents already exist in the current iteration:
277
276
  Confirm the PRD directory path with user. The PRD directory should contain:
278
277
  - Master PRD (`*-master-prd.md`)
279
278
  - Sub-PRD files (`*-sub-*.md`)
279
+ - Feature list (`.prd-feature-list.json`)
280
280
 
281
281
  Default path: `{iteration_path}/01.product-requirement`
282
282
 
283
- ### Step 2: Dispatch Feature Registry Worker
283
+ ### Step 2: Read Feature List
284
284
 
285
- Dispatch a Worker to execute `speccrew-fd-feature-registry-init` skill:
285
+ Read `.prd-feature-list.json` from the PRD directory:
286
286
 
287
+ ```bash
288
+ Get-Content "{iteration_path}/01.product-requirement/.prd-feature-list.json" | ConvertFrom-Json
287
289
  ```
288
- Worker dispatch parameters:
289
- - skill: speccrew-fd-feature-registry-init
290
- - prd_dir: {iteration_path}/01.product-requirement
291
- - workspace_path: {workspace_path}
292
- - language: {language}
290
+
291
+ **If file does not exist:**
292
+
293
293
  ```
294
+ ❌ ERROR: Feature list file not found
295
+ ├── Expected path: {iteration_path}/01.product-requirement/.prd-feature-list.json
296
+ └── This file should be generated by PM Agent during Sub-PRD dispatch
294
297
 
295
- Worker will:
296
- - Read all PRD files and techs-manifest.json
297
- - Extract Feature Breakdown from each Sub-PRD Section 3.4
298
- - Generate `.feature-registry.json`
299
- - Return summary statistics
298
+ 🛑 HARD STOP
299
+ Please ensure PRD phase completed successfully before starting Feature Design.
300
+ ```
300
301
 
301
- ### Step 3: Verify Feature Registry
302
+ **Verify file structure:**
303
+ - File exists and is valid JSON
304
+ - Contains `modules` array
305
+ - Each module has:
306
+ - `module_id`: Unique identifier
307
+ - `module_name`: Display name
308
+ - `features`: Array of feature objects
309
+ - Each feature has:
310
+ - `feature_id`: Feature identifier (e.g., `F-CRM-01`)
311
+ - `feature_name`: Feature name
312
+ - `feature_type`: `Page+API` or `API-only`
313
+ - `dependencies`: Array of prerequisite Feature IDs
302
314
 
303
- After Worker completes:
304
- 1. Read `{prd_dir}/.feature-registry.json` — verify it exists and contains valid data
305
- 2. Extract the following for each Feature:
306
- - `Feature ID`: Unique identifier (e.g., `F-CRM-01`, `F-CRM-02`)
307
- - `Feature Name`: Descriptive name (e.g., `Customer List Management`)
308
- - `Type`: Either `Page+API` or `API-only`
309
- - `Module`: Module identifier the feature belongs to
310
- - `Source PRD`: The Sub-PRD filename this feature was extracted from
311
- - `Dependencies`: List of prerequisite Feature IDs (if any)
315
+ ### Step 3: Extract Feature Statistics
312
316
 
313
- 3. **Write Feature Registry to `.checkpoints.json`**:
317
+ From the feature list, extract:
314
318
 
315
- ```bash
316
- node {update_progress_script} write-checkpoint \
317
- --file {iterations_dir}/{iteration}/02.feature-design/.checkpoints.json \
318
- --stage 02_feature_design \
319
- --checkpoint function_decomposition \
320
- --data '{"features": [...], "total_features": N, "total_modules": M}'
321
- ```
319
+ ```
320
+ 📊 Feature List Summary
321
+ ├── Total Modules: {module_count}
322
+ ├── Total Features: {total_feature_count}
323
+ ├── Features by Type:
324
+ │ ├── Page+API: {page_api_count}
325
+ └── API-only: {api_only_count}
326
+ └── Features by Module:
327
+ ├── {module_1}: {count} features
328
+ ├── {module_2}: {count} features
329
+ └── ...
330
+ ```
331
+
332
+ ### Step 4: Write Checkpoint
333
+
334
+ Write feature statistics to `.checkpoints.json`:
335
+
336
+ ```bash
337
+ node {update_progress_script} write-checkpoint `
338
+ --file {iterations_dir}/{iteration}/02.feature-design/.checkpoints.json `
339
+ --stage 02_feature_design `
340
+ --checkpoint function_decomposition `
341
+ --data '{"features": [...], "total_features": N, "total_modules": M}'
342
+ ```
322
343
 
323
- **Feature status values:**
324
- - `pending`: Not started
325
- - `in_progress`: Worker dispatched
326
- - `completed`: Worker finished successfully
327
- - `failed`: Worker failed (needs retry)
328
- - `confirmed`: User confirmed the output
344
+ **Feature status values:**
345
+ - `pending`: Not started
346
+ - `in_progress`: Worker dispatched
347
+ - `completed`: Worker finished successfully
348
+ - `failed`: Worker failed (needs retry)
349
+ - `confirmed`: User confirmed the output
329
350
 
330
- **After each worker completes**, update the corresponding feature's status:
331
- - Feature Spec worker done → set `feature_spec_status` = `completed`
332
- - API Contract worker done → set `api_contract_status` = `completed`
351
+ **After each worker completes**, update the corresponding feature's status:
352
+ - Feature Spec worker done → set `feature_spec_status` = `completed`
353
+ - API Contract worker done → set `api_contract_status` = `completed`
333
354
 
334
- ### Step 4: HARD STOP — User Confirmation
355
+ ### Step 5: HARD STOP — User Confirmation
335
356
 
336
- Present the Feature Registry to user and wait for confirmation before proceeding:
357
+ Present the Feature List to user and wait for confirmation before proceeding:
337
358
 
338
359
  Display the full feature table:
339
360
 
@@ -346,13 +367,13 @@ Display the full feature table:
346
367
  ⚠️ **HARD STOP — WAIT FOR USER CONFIRMATION**
347
368
 
348
369
  ```
349
- DO NOT dispatch Feature Spec workers until user explicitly confirms the Feature Registry.
370
+ DO NOT dispatch Feature Spec workers until user explicitly confirms the Feature List.
350
371
  Ask user:
351
372
  - Is the feature decomposition granularity appropriate?
352
373
  - Are Feature IDs, Types, and dependencies correct?
353
374
  - Any features to add, remove, or merge?
354
375
 
355
- IF user requests changes → update .checkpoints.json, then re-present.
376
+ IF user requests changes → report error: Feature List is read-only (generated by PM Agent)
356
377
  ONLY after user confirms → update function_decomposition.passed = true.
357
378
  Then proceed to Phase 3.
358
379
  ```
@@ -380,7 +401,7 @@ When involving related business domains, read `{workspace_path}/knowledges/bizs/
380
401
  > 4. **DO NOT generate Feature Spec documents yourself.** Your role is to DISPATCH workers.
381
402
  > 5. **Phase 3a → 3b → 3c is STRICTLY SERIAL.** Each phase must complete before the next begins.
382
403
  > 6. **Intermediate artifacts are MANDATORY.** .feature-analysis.md must exist before Phase 3b.
383
- > 7. **Feature name is LOCKED after Phase 2 confirmation.** All Worker dispatch parameters MUST use the exact `feature_name` from `.checkpoints.json`. DO NOT derive, translate, or modify feature names at any point after the Feature Registry is confirmed.
404
+ > 7. **Feature name is LOCKED after Phase 2 confirmation.** All Worker dispatch parameters MUST use the exact `feature_name` from `.checkpoints.json`. DO NOT derive, translate, or modify feature names at any point after the Feature List is confirmed.
384
405
 
385
406
  ---
386
407
 
@@ -546,6 +546,62 @@ No knowledge base exists. A lightweight feature inventory scan is triggered to d
546
546
  > The scope was already determined by the matcher in Step 1.
547
547
  > Asking "do you want to continue?" mid-way is FORBIDDEN.
548
548
  >
549
+ > **Path B Step 3.5: Generate Graph Data**
550
+ >
551
+ > After ALL feature analysis Workers in Step 3 complete, dispatch Graph Workers for each completed analysis task:
552
+ >
553
+ > **For each completed API analysis task** (analyzer_skill = speccrew-knowledge-bizs-api-analyze):
554
+ > - Dispatch Worker with skill: `speccrew-knowledge-bizs-api-graph`
555
+ > - Input: the generated analysis document from Step 3
556
+ > - Output: `.graph.json` file with nodes (api, service, table, dto) and edges (operates, invokes, references, depends-on, maps-to)
557
+ >
558
+ > **Agent Tool Invocation for API Graph Worker**:
559
+ > ```
560
+ > Use the Agent tool to invoke speccrew-task-worker:
561
+ > - agent: speccrew-task-worker
562
+ > - task: Execute speccrew-knowledge-bizs-api-graph for feature "{task.fileName}"
563
+ > - context:
564
+ > skill: speccrew-knowledge-bizs-api-graph
565
+ > api_analysis_path: {workspace_path}/{task.documentPath}
566
+ > platform_id: {task.platform_id}
567
+ > output_dir: {sync_state_bizs_dir}/completed
568
+ > module: {task.module}
569
+ > fileName: {task.fileName}
570
+ > sourcePath: {task.sourcePath}
571
+ > sourceFile: features-{task.platform_id}.json
572
+ > language: {language}
573
+ > subpath: {task.subpath}
574
+ > ```
575
+ >
576
+ > **For each completed UI analysis task** (analyzer_skill = speccrew-knowledge-bizs-ui-analyze):
577
+ > - Dispatch Worker with skill: `speccrew-knowledge-bizs-ui-graph`
578
+ > - Input: the generated UI analysis document from Step 3
579
+ > - Output: `.graph.json` file with UI component nodes and relationships
580
+ >
581
+ > **Agent Tool Invocation for UI Graph Worker**:
582
+ > ```
583
+ > Use the Agent tool to invoke speccrew-task-worker:
584
+ > - agent: speccrew-task-worker
585
+ > - task: Execute speccrew-knowledge-bizs-ui-graph for feature "{task.fileName}"
586
+ > - context:
587
+ > skill: speccrew-knowledge-bizs-ui-graph
588
+ > fileName: {task.fileName}
589
+ > sourcePath: {source_path}/{task.sourcePath}
590
+ > documentPath: {workspace_path}/{task.documentPath}
591
+ > module: {task.module}
592
+ > platform_type: {task.platform_type}
593
+ > platform_subtype: {task.platform_subtype}
594
+ > completed_dir: {sync_state_bizs_dir}/completed
595
+ > sourceFile: features-{task.platform_id}.json
596
+ > status: success
597
+ > analysisNotes: "Graph data generation from UI analysis"
598
+ > language: {language}
599
+ > ```
600
+ >
601
+ > **Dispatch Strategy**: Same batch parallel strategy as Step 3 (max 5 Workers per batch).
602
+ >
603
+ > ⚠️ Step 3.5 MUST complete before Step 4 (Module Summaries). Graph data enriches module summaries.
604
+ >
549
605
  > **Path B Step 4: Generate Module Summaries**
550
606
  > For each matched module, dispatch Worker with `speccrew-knowledge-module-summarize` skill:
551
607
  > ```
@@ -1187,10 +1243,13 @@ From the Skill's Step 12c output, collect:
1187
1243
  - `module_design_file`: Path to `.module-design.md`
1188
1244
  - `output_dir`: Directory for Sub-PRD files (same as Master PRD directory)
1189
1245
  - Module list with context for each module:
1246
+ - `module_id`: Unique identifier for the module (used for feature list indexing)
1190
1247
  - `module_name`, `module_key`, `module_scope`, `module_entities`
1191
- - `module_user_stories`, `module_requirements`, `module_features`
1248
+ - `module_user_stories`, `module_requirements`
1192
1249
  - `module_dependencies`
1193
1250
 
1251
+ > **Note**: The dispatch plan now contains only scheduling fields (module metadata, dependencies). Feature data (`module_features`) is stored separately in `.prd-feature-list.json`, which will be used by FD Agent for Feature Registry initialization.
1252
+
1194
1253
  **Store these values as workflow context variables for use in Worker dispatches.**
1195
1254
 
1196
1255
  ---
@@ -1327,6 +1386,7 @@ Use the Agent tool to invoke speccrew-task-worker:
1327
1386
  - task: Generate Sub-PRD for module "{module_name}"
1328
1387
  - context:
1329
1388
  skill: speccrew-pm-sub-prd-generate
1389
+ module_id: {module_id}
1330
1390
  module_name: {module_name}
1331
1391
  module_key: {module_key}
1332
1392
  module_scope: {module_scope}
@@ -1349,13 +1409,14 @@ Use the Agent tool to invoke speccrew-task-worker:
1349
1409
  | Parameter | Source | Description |
1350
1410
  |-----------|--------|-------------|
1351
1411
  | `skill` | Fixed | `speccrew-pm-sub-prd-generate` |
1412
+ | `module_id` | Dispatch Plan | Unique identifier for the module (used for feature list indexing) |
1352
1413
  | `module_name` | Dispatch Plan | Display name (e.g., "Customer Management") |
1353
1414
  | `module_key` | Dispatch Plan | Identifier for file naming (e.g., "customer") |
1354
1415
  | `module_scope` | Dispatch Plan | What this module covers |
1355
1416
  | `module_entities` | Dispatch Plan | Core business entities |
1356
1417
  | `module_user_stories` | Dispatch Plan | Module-specific user stories |
1357
1418
  | `module_requirements` | Dispatch Plan | Module-specific functional requirements (P0/P1/P2) |
1358
- | `module_features` | Dispatch Plan | Feature Breakdown entries for this module |
1419
+ | `module_features` | Dispatch Plan | Feature Breakdown entries for this module (used by Sub-PRD Skill to generate content and write to feature list) |
1359
1420
  | `module_dependencies` | Dispatch Plan | Dependencies on other modules |
1360
1421
  | `master_prd_path` | Dispatch Plan | Path to the Master PRD |
1361
1422
  | `clarification_file` | Step 5.1 | Path to `.clarification-summary.md` |
@@ -1516,6 +1577,41 @@ node "{update_progress_script}" write-checkpoint `
1516
1577
  --status passed
1517
1578
  ```
1518
1579
 
1580
+ **Step 5.5.5: Verify Feature List Completeness**
1581
+
1582
+ After all Sub-PRDs are generated, verify that `.prd-feature-list.json` contains complete feature data:
1583
+
1584
+ 1. **Read feature list file**:
1585
+ ```bash
1586
+ Get-Content "{iterations_dir}/{iteration}/01.product-requirement/.prd-feature-list.json" | ConvertFrom-Json
1587
+ ```
1588
+
1589
+ 2. **Verify structure**:
1590
+ - File exists and is valid JSON
1591
+ - Contains `modules` array
1592
+ - Each module has `module_id` and `features` array
1593
+
1594
+ 3. **Verify completeness**:
1595
+ - Module count in feature list should equal `totalModules` from dispatch plan
1596
+ - If any module is missing, display WARNING:
1597
+ ```
1598
+ ⚠️ WARNING: Feature list incomplete
1599
+ ├── Expected modules: {expected_count}
1600
+ ├── Found modules: {actual_count}
1601
+ └── Missing modules: {missing_module_ids}
1602
+
1603
+ Feature list will be used by FD Agent for Feature Registry initialization.
1604
+ Missing modules may cause errors in Feature Design phase.
1605
+ ```
1606
+
1607
+ 4. **If verification passes**:
1608
+ ```
1609
+ ✅ Feature list verification passed
1610
+ ├── Modules: {count}
1611
+ ├── Total features: {total_features}
1612
+ └── Ready for Feature Design phase
1613
+ ```
1614
+
1519
1615
  **Before proceeding to Phase 6, verify:**
1520
1616
  - [ ] All workers were dispatched via speccrew-task-worker (one Worker per module)
1521
1617
  - [ ] No Sub-PRD was generated by PM Agent directly
@@ -1761,12 +1857,13 @@ After PRD verification passes and user has confirmed, delete intermediate proces
1761
1857
  - `{iteration_path}/01.product-requirement/.checkpoints.json` (execution checkpoint tracking)
1762
1858
  - `{iteration_path}/01.product-requirement/.prd-generation-report.md` (intermediate generation report)
1763
1859
  - `{iteration_path}/01.product-requirement/.prd-completion-report.md` (completion report)
1764
- - `{iteration_path}/01.product-requirement/.sub-prd-dispatch-plan.json` (Sub-PRD dispatch plan)
1860
+ - `{iteration_path}/01.product-requirement/.sub-prd-dispatch-plan.json` (dispatch plan — no longer needed after dispatch complete)
1765
1861
 
1766
1862
  **Files to KEEP (referenced by downstream phases):**
1767
1863
  - Master PRD and all Sub-PRD documents (`*-prd.md`, `*-sub-*.md`)
1768
1864
  - `.clarification-summary.md`
1769
1865
  - `.module-design.md`
1866
+ - `.prd-feature-list.json` (Feature list for Feature Design phase — used by FD Agent to load Feature Registry)
1770
1867
  - `.clarification-questions-round-*.md` (optional, for reference)
1771
1868
 
1772
1869
  ⚠️ **Only execute cleanup AFTER:**
@@ -30,6 +30,7 @@ tools: Read, Write, Glob, Grep
30
30
 
31
31
  | Parameter | Required | Description |
32
32
  |-----------|----------|-------------|
33
+ | module_id | Yes | Module ID for feature registry (e.g., "M1", "M2") |
33
34
  | module_name | Yes | Human-readable module name (e.g., "Customer Management") |
34
35
  | module_key | Yes | Module identifier for file naming (e.g., "customer") |
35
36
  | module_scope | Yes | What this module covers |
@@ -188,3 +189,90 @@ IF verification fails:
188
189
  → Output: "❌ Sub-PRD verification failed: {reason}"
189
190
  → Attempt to fix the specific issue
190
191
  ```
192
+
193
+ ## Step 5: Write Module Features to Feature List
194
+
195
+ > **Purpose:** Separate feature data from dispatch plan into dedicated `.prd-feature-list.json` file.
196
+ > Each Sub-PRD Worker writes its module's features upon completion.
197
+
198
+ ### 5.1 Determine Feature List File Path
199
+
200
+ ```
201
+ feature_list_path = dirname(output_path) + '/.prd-feature-list.json'
202
+ ```
203
+
204
+ This is the same directory containing `.sub-prd-dispatch-plan.json`.
205
+
206
+ ### 5.2 Read or Initialize Feature List File
207
+
208
+ ```javascript
209
+ IF file exists at feature_list_path:
210
+ feature_list = read_json(feature_list_path)
211
+ ELSE:
212
+ feature_list = {
213
+ "created_at": "{timestamp from update-progress.js}",
214
+ "updated_at": "{timestamp from update-progress.js}",
215
+ "modules": []
216
+ }
217
+ ```
218
+
219
+ > ⚠️ **Timestamp constraint:** Use `node scripts/update-progress.js write-checkpoint` or similar script to get accurate timestamps. DO NOT fabricate timestamps.
220
+
221
+ ### 5.3 Build Current Module Feature Entry
222
+
223
+ Construct the module entry from input parameters:
224
+
225
+ ```json
226
+ {
227
+ "module_id": "{module_id}",
228
+ "module_name": "{module_name}",
229
+ "module_key": "{module_key}",
230
+ "source_prd": "{feature_name}-sub-{module_key}.md",
231
+ "feature_count": {module_features.length},
232
+ "features": [
233
+ // Map each item in module_features to:
234
+ {
235
+ "feature_id": "{item.feature_id}",
236
+ "feature_name": "{item.feature_name}",
237
+ "type": "{item.type}",
238
+ "priority": "{item.priority}",
239
+ "sub_features": "{item.sub_features}",
240
+ "description": "{item.description}"
241
+ }
242
+ ]
243
+ }
244
+ ```
245
+
246
+ ### 5.4 Merge into Feature List
247
+
248
+ ```javascript
249
+ existing_index = find_index(feature_list.modules, m => m.module_key === module_key)
250
+
251
+ IF existing_index >= 0:
252
+ // Retry scenario: replace existing entry
253
+ feature_list.modules[existing_index] = module_entry
254
+ ELSE:
255
+ // New module: append
256
+ feature_list.modules.push(module_entry)
257
+
258
+ // Update timestamp
259
+ feature_list.updated_at = "{current timestamp}"
260
+ ```
261
+
262
+ ### 5.5 Write Feature List File
263
+
264
+ Write the updated `feature_list` to `{feature_list_path}` using `create_file`.
265
+
266
+ ### 5.6 Report Result
267
+
268
+ ```
269
+ IF write succeeds:
270
+ → Output: "✅ Feature list updated: {feature_count} features for module {module_id}"
271
+ IF write fails:
272
+ → Output: "⚠️ Feature list write failed: {error}"
273
+ → Continue without blocking Sub-PRD completion
274
+ ```
275
+
276
+ ---
277
+
278
+ > **Note:** Step 5 is a pure incremental operation. Failure here should NOT affect the Sub-PRD file generation result. The primary deliverable is the Sub-PRD document itself.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.6.26",
3
+ "version": "0.6.27",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -1,249 +0,0 @@
1
- ---
2
- name: speccrew-fd-feature-registry-init
3
- description: Extract Feature Breakdown from Master PRD and Sub-PRD files to generate Feature Registry. Scans PRD directory, parses Feature Breakdown tables from all Sub-PRDs, and outputs .feature-registry.json with module-grouped features and summary statistics.
4
- tools: Read, Write, Glob
5
- ---
6
-
7
- # Feature Registry Initialization
8
-
9
- Extract Feature Breakdown from Master PRD and Sub-PRD files to generate a centralized Feature Registry. This Skill discovers all PRD files, parses Feature Breakdown tables, and produces a structured registry with summary statistics.
10
-
11
- ## Trigger Scenarios
12
-
13
- - "Initialize feature registry from PRDs"
14
- - "Extract features from all Sub-PRDs"
15
- - "Build feature registry for the project"
16
- - "Generate feature breakdown summary"
17
-
18
- ## Input Parameters
19
-
20
- | Parameter | Type | Description | Required |
21
- |-----------|------|-------------|----------|
22
- | `prd_dir` | string | Path to PRD documents directory (contains Master PRD and all Sub-PRDs) | **Yes** |
23
- | `workspace_path` | string | Workspace root path for reading techs-manifest.json | **Yes** |
24
- | `language` | string | Target language for output content | **Yes** |
25
-
26
- ## Output
27
-
28
- - **JSON File**: `{prd_dir}/.feature-registry.json` - Structured feature registry
29
- - **Summary**: Markdown table with module statistics and feature distribution
30
-
31
- ---
32
-
33
- ## Workflow
34
-
35
- ### Step 0: Read Template / Validate Inputs
36
-
37
- 1. **Validate prd_dir exists**
38
- - Check if `{prd_dir}` directory exists
39
- - If not found, report error and stop
40
-
41
- 2. **Validate Sub-PRD files exist**
42
- - Scan for files matching `*-sub-*.md` pattern in `{prd_dir}`
43
- - If no Sub-PRD files found, report error and stop
44
-
45
- 3. **Output**: "Step 0 Status: ✅ COMPLETED - Found {sub_prd_count} Sub-PRD files"
46
-
47
- ### Step 1: Discover PRD Files
48
-
49
- 1. **Scan PRD Directory**
50
- - Find **Master PRD**: files matching `*-master-prd.md`
51
- - Find **Sub-PRDs**: files matching `*-sub-*.md`
52
- - Record file paths and names
53
-
54
- 2. **Discover Frontend Platforms**
55
- - Read `{workspace_path}/knowledges/techs/techs-manifest.json`
56
- - Extract platform list from the manifest
57
- - Platforms typically include: `web-vue`, `mobile-uniapp`, etc.
58
-
59
- 3. **Output**:
60
- - "Step 1 Status: ✅ COMPLETED - Found 1 Master PRD, {count} Sub-PRDs"
61
- - "Frontend Platforms: {platform_list}"
62
-
63
- ### Step 2: Extract Feature Breakdown from Each Sub-PRD
64
-
65
- For each Sub-PRD file:
66
-
67
- 1. **Read Sub-PRD Content**
68
- - Parse the markdown file
69
-
70
- 2. **Locate Section 3.4 "Feature Breakdown"**
71
- - Find the section header (may be in different languages based on `language`)
72
- - Common patterns: "3.4 Feature Breakdown", "3.4 功能分解", etc.
73
-
74
- 3. **Parse Feature Table**
75
- - Extract table rows containing feature information
76
- - For each feature, extract:
77
-
78
- | Field | Description | Example |
79
- |-------|-------------|---------|
80
- | `feature_id` | Feature identifier | F-SYS-01, F-CRM-05 |
81
- | `feature_name` | Human-readable feature name | User Management, Order List |
82
- | `type` | Feature type | User Interaction / Backend Process |
83
- | `priority` | Priority level | P0 / P1 / P2 |
84
- | `sub_features` | List of sub-feature IDs | ["M1-F01-01", "M1-F01-02"] |
85
- | `description` | Brief description | Manage system users and permissions |
86
- | `source_prd` | Source file name | litemes-sub-system-management.md |
87
- | `module_key` | Module identifier | system-management |
88
-
89
- 4. **Extract Module Information**
90
- - Derive `module_id` from PRD (e.g., M1, M2)
91
- - Derive `module_name` from PRD header or content
92
- - Map to `module_key` (kebab-case identifier)
93
-
94
- 5. **Output**: "Step 2 Status: ✅ COMPLETED - Extracted {feature_count} features from {prd_name}"
95
-
96
- ### Step 3: Build Feature Registry
97
-
98
- 1. **Merge All Features**
99
- - Combine features from all Sub-PRDs into a single collection
100
- - Group features by module
101
-
102
- 2. **Calculate Summary Statistics**
103
-
104
- | Statistic | Calculation |
105
- |-----------|-------------|
106
- | `total_modules` | Count of unique modules |
107
- | `total_features` | Total count of all features |
108
- | `by_priority` | Count by priority (P0, P1, P2) |
109
- | `by_type` | Count by type (User Interaction, Backend Process) |
110
- | `frontend_platforms` | List from techs-manifest.json |
111
-
112
- 3. **Organize Registry Structure**
113
- - Group features under their respective modules
114
- - Sort modules by module_id (M1, M2, M3...)
115
- - Sort features by feature_id within each module
116
-
117
- 4. **Output**: "Step 3 Status: ✅ COMPLETED - Registry contains {total_features} features across {total_modules} modules"
118
-
119
- ### Step 4: Write Output Files
120
-
121
- 1. **Write `.feature-registry.json`**
122
-
123
- Output path: `{prd_dir}/.feature-registry.json`
124
-
125
- Structure:
126
- ```json
127
- {
128
- "created_at": "2026-01-15T10:30:00Z",
129
- "summary": {
130
- "total_modules": 8,
131
- "total_features": 42,
132
- "by_priority": {
133
- "P0": 35,
134
- "P1": 5,
135
- "P2": 2
136
- },
137
- "by_type": {
138
- "User Interaction": 30,
139
- "Backend Process": 12
140
- },
141
- "frontend_platforms": ["web-vue", "mobile-uniapp"]
142
- },
143
- "modules": [
144
- {
145
- "module_id": "M1",
146
- "module_name": "System Management",
147
- "module_key": "system-management",
148
- "source_prd": "litemes-sub-system-management.md",
149
- "features": [
150
- {
151
- "feature_id": "F-SYS-01",
152
- "feature_name": "User Management",
153
- "type": "User Interaction",
154
- "priority": "P0",
155
- "sub_features": ["M1-F01-01", "M1-F01-02"],
156
- "description": "Manage system users and permissions"
157
- }
158
- ]
159
- }
160
- ]
161
- }
162
- ```
163
-
164
- 2. **Output**: "Step 4 Status: ✅ COMPLETED - Written .feature-registry.json"
165
-
166
- ### Step 5: Output Summary
167
-
168
- Generate and output a Markdown summary table for Agent display:
169
-
170
- ```markdown
171
- ## Feature Registry Summary
172
-
173
- | Module | Features | P0 | P1 | P2 | Types |
174
- |--------|----------|----|----|----|-------|
175
- | M1 System Management | 4 | 4 | 0 | 0 | UI: 4, Backend: 0 |
176
- | M2 User Center | 6 | 5 | 1 | 0 | UI: 5, Backend: 1 |
177
- | ... | ... | ... | ... | ... | ... |
178
- | **Total** | **42** | **35** | **5** | **2** | **UI: 30, Backend: 12** |
179
-
180
- **Frontend Platforms:** web-vue, mobile-uniapp
181
-
182
- **Registry File:** `{prd_dir}/.feature-registry.json`
183
- ```
184
-
185
- **Output**: "Step 5 Status: ✅ COMPLETED - Summary generated"
186
-
187
- ---
188
-
189
- ## Task Completion Report
190
-
191
- When the task is complete, report:
192
-
193
- ```json
194
- {
195
- "status": "success",
196
- "skill": "speccrew-fd-feature-registry-init",
197
- "result": {
198
- "registry_file": "{prd_dir}/.feature-registry.json",
199
- "total_modules": 8,
200
- "total_features": 42,
201
- "by_priority": {
202
- "P0": 35,
203
- "P1": 5,
204
- "P2": 2
205
- },
206
- "by_type": {
207
- "User Interaction": 30,
208
- "Backend Process": 12
209
- }
210
- },
211
- "message": "Feature registry initialized successfully"
212
- }
213
- ```
214
-
215
- ---
216
-
217
- ## Constraints
218
-
219
- 1. **READ-ONLY on PRDs**: Do not modify any PRD files
220
- 2. **JSON Output**: Registry must be valid JSON
221
- 3. **Feature ID Uniqueness**: Each feature_id should be unique across all modules
222
- 4. **Module Grouping**: Features must be grouped by their source module
223
- 5. **Priority Validation**: Only accept P0, P1, P2 as valid priority values
224
- 6. **Type Validation**: Only accept "User Interaction" or "Backend Process" as valid types
225
-
226
- ## Error Handling
227
-
228
- | Scenario | Action |
229
- |----------|--------|
230
- | prd_dir not found | Report error, stop execution |
231
- | No Sub-PRD files found | Report error, stop execution |
232
- | Master PRD not found | Log warning, continue with Sub-PRDs only |
233
- | techs-manifest.json not found | Use empty platform list, log warning |
234
- | Feature table not found in Sub-PRD | Skip that PRD, log warning |
235
- | Invalid feature data | Skip invalid row, log warning |
236
- | Duplicate feature_id | Keep first occurrence, log warning |
237
-
238
- ## Checklist
239
-
240
- - [ ] Step 0: Validated prd_dir exists
241
- - [ ] Step 0: Found at least one Sub-PRD file
242
- - [ ] Step 1: Discovered Master PRD and all Sub-PRDs
243
- - [ ] Step 1: Read techs-manifest.json for frontend platforms
244
- - [ ] Step 2: All Sub-PRD files scanned
245
- - [ ] Step 2: Feature Breakdown tables parsed from each Sub-PRD
246
- - [ ] Step 3: Features merged and grouped by module
247
- - [ ] Step 3: Summary statistics calculated (total, by_priority, by_type)
248
- - [ ] Step 4: `.feature-registry.json` written to correct path
249
- - [ ] Step 5: Summary table generated and output