speccrew 0.5.13 → 0.5.16

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.
Files changed (21) hide show
  1. package/.speccrew/agents/speccrew-team-leader.md +60 -4
  2. package/.speccrew/agents/speccrew-test-manager.md +361 -37
  3. package/.speccrew/skills/speccrew-knowledge-bizs-api-analyze/SKILL.md +63 -626
  4. package/.speccrew/skills/speccrew-knowledge-bizs-api-graph/SKILL.md +505 -0
  5. package/.speccrew/skills/speccrew-knowledge-bizs-dispatch/SKILL.md +165 -31
  6. package/.speccrew/skills/speccrew-knowledge-bizs-ui-analyze/SKILL.md +63 -728
  7. package/.speccrew/skills/speccrew-knowledge-bizs-ui-graph/SKILL.md +389 -0
  8. package/.speccrew/skills/speccrew-knowledge-module-summarize/SKILL.md +26 -0
  9. package/.speccrew/skills/speccrew-knowledge-system-summarize/SKILL.md +27 -0
  10. package/.speccrew/skills/speccrew-knowledge-techs-dispatch/SKILL.md +185 -21
  11. package/.speccrew/skills/speccrew-knowledge-techs-generate/SKILL.md +134 -883
  12. package/.speccrew/skills/speccrew-knowledge-techs-generate-conventions/SKILL.md +36 -0
  13. package/.speccrew/skills/speccrew-knowledge-techs-generate-quality/SKILL.md +414 -0
  14. package/.speccrew/skills/speccrew-knowledge-techs-generate-ui-style/SKILL.md +35 -0
  15. package/.speccrew/skills/speccrew-test-reporter/SKILL.md +297 -0
  16. package/.speccrew/skills/{speccrew-test-execute → speccrew-test-reporter}/templates/BUG-REPORT-TEMPLATE.md +24 -1
  17. package/.speccrew/skills/{speccrew-test-execute → speccrew-test-reporter}/templates/TEST-REPORT-TEMPLATE.md +8 -1
  18. package/.speccrew/skills/{speccrew-test-execute → speccrew-test-runner}/SKILL.md +142 -104
  19. package/.speccrew/skills/speccrew-test-runner/templates/TEST-EXECUTION-RESULT-TEMPLATE.md +80 -0
  20. package/lib/utils.js +1 -0
  21. package/package.json +1 -1
@@ -52,6 +52,27 @@ Read `speccrew-workspace/docs/configs/platform-mapping.json` for standardized pl
52
52
  - Root index: `speccrew-workspace/knowledges/techs/INDEX.md`
53
53
  - Status files: `speccrew-workspace/knowledges/base/sync-state/knowledge-techs/stage{N}-status.json`
54
54
 
55
+ # Quick Reference — Execution Flow
56
+
57
+ ```
58
+ Stage 1: Platform Detection
59
+ └─ Read techs-manifest.json → Identify platforms & tech stacks
60
+
61
+ Stage 2: Tech Doc Generation (PARALLEL)
62
+ └─ Dispatch techs-generate workers per platform
63
+ └─ After each generate worker completes → dispatch quality check worker
64
+ └─ Monitor completion markers
65
+
66
+ Stage 2.5: Completion Verification
67
+ └─ Step A: Scan completion markers
68
+ └─ Step B: Verify output integrity
69
+ └─ Step C: Update dispatch progress
70
+
71
+ Stage 3: Root Index Generation
72
+ └─ Generate techs/README.md root index
73
+ └─ Cross-platform consistency check
74
+ ```
75
+
55
76
  ## Workflow Overview
56
77
 
57
78
  ```mermaid
@@ -86,6 +107,13 @@ See [Platform Status Tracking Fields](#platform-status-tracking-fields) for stat
86
107
 
87
108
  ---
88
109
 
110
+ > **⚠️ MANDATORY RULES FOR PARALLEL EXECUTION (Stage 2)**:
111
+ > 1. ALL platform workers MUST be dispatched in PARALLEL — sequential execution is FORBIDDEN
112
+ > 2. Each platform worker runs independently via techs-generate Skill
113
+ > 3. Monitor completion via marker files in each platform directory
114
+ > 4. Failed workers can be retried independently
115
+ > 5. Do NOT proceed to Stage 2.5 until ALL workers have completed or failed
116
+
89
117
  ## Stage 2: Generate Platform Documents (Parallel)
90
118
 
91
119
  **Goal**: Generate technology documentation for each platform in parallel.
@@ -155,6 +183,38 @@ IF platform.platform_type IN ["web", "mobile", "desktop"]:
155
183
  - WAIT_ALL workers complete
156
184
  - Both workers run in PARALLEL for the same platform
157
185
 
186
+ **Step 2e: Launch Quality Check Workers — PARALLEL per Completed Generate Worker**
187
+
188
+ After each `speccrew-knowledge-techs-generate` worker completes (writes `.done-conventions.json` marker), immediately dispatch the corresponding quality check worker:
189
+
190
+ | Generate Worker | Quality Worker | Input |
191
+ |-----------------|----------------|-------|
192
+ | `speccrew-knowledge-techs-generate-conventions` | `speccrew-knowledge-techs-generate-quality` | `output_path` from generate output |
193
+ | `speccrew-knowledge-techs-generate-ui-style` | `speccrew-knowledge-techs-generate-quality` | `output_path` from generate output |
194
+
195
+ **Quality Worker Task Prompt Format**:
196
+
197
+ ```json
198
+ {
199
+ "skill_name": "speccrew-knowledge-techs-generate-quality",
200
+ "context": {
201
+ "platform_dir": "<platform_output_path>",
202
+ "platform_id": "<platform.platform_id>",
203
+ "platform_type": "<platform.platform_type>",
204
+ "source_path": "<platform.source_path>"
205
+ }
206
+ }
207
+ ```
208
+
209
+ **Execution sequence**:
210
+ 1. Scan `completed_dir` for new `.done-conventions.json` and `.done-ui-style.json` files
211
+ 2. For each completed generate worker, prepare corresponding quality worker task
212
+ 3. Launch ALL quality workers for the current batch in PARALLEL
213
+ 4. Wait for ALL quality workers to complete
214
+ 5. Each quality worker writes `.quality-done.json` marker to `completed_dir`
215
+
216
+ > **Stage 2 Completion Condition**: ALL generate workers AND ALL quality check workers completed (`.done-*.json` and `.quality-done.json` markers present) before proceeding to Stage 2.5
217
+
158
218
  ### Worker Completion Marker (MANDATORY)
159
219
 
160
220
  Each Worker MUST create a completion marker file after generating documents. See [Worker Completion Marker Format](#worker-completion-marker-format) for details.
@@ -211,45 +271,50 @@ speccrew-workspace/knowledges/techs/{platform_id}/
211
271
  - `total_platforms`, `completed`, `failed` counts
212
272
  - Per-platform: `documents_generated` list
213
273
 
214
- **Step 2e: Scan Completion Markers**
274
+ **Step 2f: Scan Completion Markers**
215
275
 
216
276
  For each platform in the manifest:
217
277
  1. Check for `{platform_id}.done-conventions.json` (REQUIRED for all platforms)
218
278
  2. If platform_type IN ["web", "mobile", "desktop"], also check for `{platform_id}.done-ui-style.json`
219
- 3. A platform is "fully completed" only when ALL expected done files are present
220
- 4. If any expected done file is missing mark platform as `failed` (Worker crashed without creating marker)
279
+ 3. Check for `{platform_id}.quality-done.json` (REQUIRED quality check completion marker)
280
+ 4. A platform is "fully completed" only when ALL expected done files AND quality markers are present
281
+ 5. If any expected done file is missing → mark platform as `failed` (Worker crashed without creating marker)
221
282
 
222
- **Step 2f: Verify Document Output**
283
+ **Step 2g: Verify Document Output**
223
284
 
224
285
  For each platform:
225
286
  - **Conventions**: Check that INDEX.md, tech-stack.md, architecture.md, conventions-*.md exist
226
287
  - **UI-Style** (frontend platforms only): Check that ui-style/ directory and required files exist
288
+ - **Quality Report**: Check that `{platform_dir}/quality-report.json` exists (generated by quality worker)
227
289
  - If any required document is missing → downgrade status accordingly
228
290
 
229
- **Step 2g: Read Coverage Reports**
291
+ **Step 2h: Read Coverage and Quality Reports**
230
292
 
231
293
  For each platform:
232
294
  1. Read `{platform_id}.analysis-conventions.json`
233
295
  2. If frontend platform, also read `{platform_id}.analysis-ui-style.json`
234
- 3. Merge coverage data from both reports for manifest update
296
+ 3. Read `{platform_dir}/quality-report.json` for quality metrics
297
+ 4. Merge coverage and quality data from all reports for manifest update
235
298
 
236
- **Step 2h: Update Manifest Status**
299
+ **Step 2i: Update Manifest Status**
237
300
 
238
301
  Update `techs-manifest.json` for each platform:
239
302
  - Set `status` based on worker results:
240
- - `"completed"` — ALL workers succeeded
241
- - `"partial"` — conventions succeeded but ui-style failed (frontend only)
242
- - `"failed"` — conventions worker failed
303
+ - `"completed"` — ALL workers succeeded (including quality check)
304
+ - `"partial"` — conventions succeeded but ui-style or quality failed (frontend only)
305
+ - `"failed"` — conventions worker or quality check failed
243
306
  - Set `completedAt` to current timestamp
244
307
  - Set `workers.conventions.status` from done-conventions.json
245
308
  - Set `workers.ui_style.status` from done-ui-style.json (or `"skipped"` for backend platforms)
309
+ - Set `workers.quality.status` from quality-done.json
246
310
  - Set `analysisLevel` based on:
247
- - `"full"` if coverage_percent >= 60 and all required docs exist
248
- - `"minimal"` if coverage_percent < 60 or some optional docs missing
249
- - `"reference_only"` if critical docs missing or Worker failed
311
+ - `"full"` if coverage_percent >= 60 and all required docs exist and quality passed
312
+ - `"minimal"` if coverage_percent < 60 or some optional docs missing or quality warnings
313
+ - `"reference_only"` if critical docs missing or Worker failed or quality failed
250
314
  - Set `topicsCoverage` from analysis-conventions.json coverage_percent
315
+ - Set `qualityScore` from quality.json if available
251
316
 
252
- **Step 2i: Handle Failures**
317
+ **Step 2j: Handle Failures**
253
318
 
254
319
  For platforms with conventions worker `status: "failed"`:
255
320
  - Mark platform as `failed`
@@ -262,6 +327,11 @@ For frontend platforms with ui-style worker `status: "failed"` but conventions s
262
327
  - Conventions docs are still usable
263
328
  - Log a warning that UI-style analysis failed
264
329
 
330
+ For platforms with quality worker `status: "failed"` but generate succeeded:
331
+ - Mark platform as `partial` (docs generated but quality issues)
332
+ - Log a warning with quality failure details
333
+ - Include quality report in manifest for review
334
+
265
335
  ---
266
336
 
267
337
  ## Stage 2.5: Quality Synchronization
@@ -269,9 +339,58 @@ For frontend platforms with ui-style worker `status: "failed"` but conventions s
269
339
  **Trigger**: After ALL Stage 2 Workers have completed (all platforms processed)
270
340
  **Purpose**: Verify cross-platform consistency and document completeness before indexing
271
341
 
272
- **Steps**:
342
+ **Three-Step Process**:
343
+
344
+ ### Step A: Scan Completion Markers
345
+
346
+ Scan the completion marker files in `{completed_dir}/` for each platform:
347
+
348
+ 1. List all `.done-*.json` files in the sync-status directory
349
+ 2. For each platform in manifest:
350
+ - Check `{platform_id}.done-conventions.json` exists (REQUIRED for ALL platforms)
351
+ - IF `platform_type` IN ["web", "mobile", "desktop"]: check `{platform_id}.done-ui-style.json`
352
+ 3. Categorize platforms:
353
+ - **completed**: All expected done files present with `status: "completed"`
354
+ - **failed**: Missing done file OR `status: "failed"` in done file
355
+ - **partial**: Conventions succeeded but ui-style failed (frontend only)
356
+
357
+ **Output**: `platforms_completed[]`, `platforms_failed[]`, `platforms_partial[]` lists
358
+
359
+ ### Step B: Verify Output Integrity
273
360
 
274
- #### Step 1: Collect Worker Results
361
+ For each platform in `platforms_completed` and `platforms_partial`:
362
+
363
+ 1. Verify required document files exist in `knowledges/techs/{platform_id}/`:
364
+ - `INDEX.md`, `tech-stack.md`, `architecture.md`
365
+ - `conventions-design.md`, `conventions-dev.md`
366
+ - `conventions-unit-test.md`, `conventions-system-test.md`, `conventions-build.md`
367
+ 2. For frontend platforms, verify `ui-style/ui-style-guide.md` exists
368
+ 3. Check each document is non-empty (>= 20 lines minimum)
369
+ 4. Record verification results: `documents_present[]`, `documents_missing[]`
370
+
371
+ **Output**: Per-platform integrity status with document check results
372
+
373
+ ### Step C: Update Dispatch Progress
374
+
375
+ Update the dispatch progress status:
376
+
377
+ 1. Generate `stage2-status.json` with verification results (see format below)
378
+ 2. For failed platforms:
379
+ - Set `error_category` based on failure type:
380
+ - `marker_missing`: Done file not created
381
+ - `output_incomplete`: Required documents missing
382
+ - `worker_crash`: Worker process terminated unexpectedly
383
+ 3. Decision point:
384
+ - IF ALL platforms failed → ABORT pipeline, report error
385
+ - IF ANY platform succeeded → CONTINUE to Stage 3 with successful platforms
386
+
387
+ **Output**: `stage2-status.json` ready, pipeline ready for Stage 3
388
+
389
+ ---
390
+
391
+ ### Detailed Verification Steps
392
+
393
+ #### Document Existence Check
275
394
  For each platform, verify the following required documents exist:
276
395
  - INDEX.md
277
396
  - tech-stack.md
@@ -283,7 +402,7 @@ For each platform, verify the following required documents exist:
283
402
  - conventions-build.md
284
403
  - conventions-data.md (optional - only for backend or platforms with detected data layer)
285
404
 
286
- #### Step 2: Document Completeness Check
405
+ #### Document Completeness Check
287
406
  For each platform directory at `speccrew-workspace/knowledges/techs/{platform_id}/`:
288
407
  1. List all .md files present
289
408
  2. Check against required document list
@@ -329,10 +448,10 @@ SEVERITY: warning (does not block pipeline, but recorded in quality report)
329
448
 
330
449
  #### Check 5: Topic Coverage Verification
331
450
 
332
- Read `{completed_dir}/{platform_id}.analysis.json` (if it exists):
333
- 1. Extract `coverage_summary.coverage_percent`
334
- 2. If `coverage_percent` < 60 → flag as `coverage_warning`
335
- 3. Extract list of topics with `status: "not_found"` → record as `topics_missing`
451
+ Read `{completed_dir}/{platform_id}.analysis-conventions.json` and `{completed_dir}/{platform_id}.analysis-ui-style.json` (if they exist):
452
+ 1. Merge `coverage_summary.coverage_percent` from both reports
453
+ 2. If combined `coverage_percent` < 60 → flag as `coverage_warning`
454
+ 3. Extract list of topics with `status: "not_found"` from both reports → record as `topics_missing`
336
455
  4. If `coverage_percent` < 30 → flag as `coverage_critical` (pipeline should warn but continue)
337
456
 
338
457
  ```
@@ -487,6 +606,23 @@ Write to `speccrew-workspace/knowledges/base/sync-state/knowledge-techs/stage2-s
487
606
  3. **Platform-Specific Document Recommendations**:
488
607
  - Adjust "Agent 重点文档" recommendations based on actual available documents
489
608
 
609
+ ### Cross-Platform Consistency Check
610
+
611
+ ```pseudocode
612
+ FOR EACH platform_pair IN combinations(platforms, 2):
613
+ shared_deps = intersection(platform_a.dependencies, platform_b.dependencies)
614
+ FOR EACH dep IN shared_deps:
615
+ IF platform_a.dep_version != platform_b.dep_version:
616
+ WARN "Version mismatch: {dep} — {platform_a}: {v1}, {platform_b}: {v2}"
617
+
618
+ shared_conventions = intersection(platform_a.conventions, platform_b.conventions)
619
+ FOR EACH convention IN shared_conventions:
620
+ IF platform_a.convention_rule != platform_b.convention_rule:
621
+ WARN "Convention conflict: {convention}"
622
+
623
+ THRESHOLD: warnings > 5 → flag for manual review
624
+ ```
625
+
490
626
  **Output**:
491
627
  - `speccrew-workspace/knowledges/techs/INDEX.md` (complete with platform index and Agent mapping, dynamically generated)
492
628
 
@@ -679,3 +815,31 @@ pending → processing → completed
679
815
  → partial (conventions OK, ui-style failed)
680
816
  → failed
681
817
  ```
818
+
819
+ ---
820
+
821
+ ## Task Completion Report
822
+
823
+ Upon completing all stages, output the following structured report:
824
+
825
+ ```json
826
+ {
827
+ "status": "success | partial | failed",
828
+ "skill": "speccrew-knowledge-techs-dispatch",
829
+ "stages_completed": ["stage_1", "stage_2", "stage_2_5", "stage_3"],
830
+ "stages_failed": [],
831
+ "output_summary": {
832
+ "platforms_processed": ["frontend", "backend"],
833
+ "docs_generated_per_platform": {"frontend": 5, "backend": 4},
834
+ "root_index_generated": true,
835
+ "cross_platform_check_passed": true
836
+ },
837
+ "output_files": [
838
+ "knowledges/techs/{platform}/README.md",
839
+ "knowledges/techs/{platform}/conventions.md",
840
+ "knowledges/techs/README.md"
841
+ ],
842
+ "errors": [],
843
+ "next_steps": ["Review generated tech documentation"]
844
+ }
845
+ ```