@zeyue0329/xiaoma-cli 1.0.40 → 1.0.42

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 (29) hide show
  1. package/.idea/workspace.xml +8 -1
  2. package/.xiaoma-core/.coordinator-state.json +19 -0
  3. package/dist/agents/architect.txt +192 -0
  4. package/dist/agents/workflow-executor.txt +151 -1
  5. package/dist/agents/workflow-helper.txt +93 -0
  6. package/dist/teams/team-all.txt +396 -191
  7. package/dist/teams/team-fullstack-with-database.txt +2 -0
  8. package/dist/teams/team-fullstack.txt +2 -0
  9. package/dist/teams/team-no-ui.txt +2 -0
  10. package/docs/architecture/workflow-coordinator-implementation.md +1188 -0
  11. package/docs/prd/workflow-coordinator-prd.md +1214 -0
  12. package/package.json +6 -1
  13. package/tools/api-server.js +367 -0
  14. package/tools/installer/package.json +1 -1
  15. package/tools/workflow-coordinator/README.md +38 -0
  16. package/tools/workflow-coordinator/USAGE.md +548 -0
  17. package/tools/workflow-coordinator/package-lock.json +4868 -0
  18. package/tools/workflow-coordinator/package.json +35 -0
  19. package/tools/workflow-coordinator/src/api/server.js +207 -0
  20. package/tools/workflow-coordinator/src/controller/workflow-controller.js +263 -0
  21. package/tools/workflow-coordinator/src/index.js +113 -0
  22. package/tools/workflow-coordinator/src/parser/workflow-parser.js +144 -0
  23. package/tools/workflow-coordinator/src/utils/state-manager.js +59 -0
  24. package/tools/workflow-coordinator/src/utils/validator.js +86 -0
  25. package/tools/workflow-coordinator/test/integration-test.js +266 -0
  26. package/tools/workflow-coordinator/test/quick-test.js +127 -0
  27. package/xiaoma-core/agents/workflow-executor.md +155 -1
  28. package/xiaoma-core/agents/workflow-helper.md +481 -0
  29. package/xiaoma-core/workflows/automated-requirements-development.yaml +739 -0
@@ -0,0 +1,739 @@
1
+ # <!-- Powered by XIAOMA™ Core -->
2
+ workflow:
3
+ id: automated-requirements-development
4
+ name: 自动化需求分析到开发完成的端到端流程
5
+ description: >-
6
+ 完全自动化的端到端工作流,从 req.txt 需求文档到用户故事开发完成的全流程自动化。
7
+ 整合了 automated-requirements-analysis 和 automated-story-development 两个工作流,
8
+ 实现从需求分析 → PRD → Epic → 架构设计 → 用户故事开发 → 测试完成的完整自动化流程。
9
+ 适用于现有 Java 后端项目的迭代需求开发(Brownfield 项目)。
10
+ type: end-to-end-automation
11
+ project_types:
12
+ - java-backend
13
+ - brownfield-project
14
+ - enterprise-app
15
+ - api-first
16
+
17
+ # 工作流增强特性(继承两个子工作流的优势)
18
+ optimizations:
19
+ # 来自 requirements-analysis
20
+ - existing_architecture_analysis: true
21
+ - brownfield_prd_creation: true
22
+ - automatic_epic_sharding: true
23
+ - incremental_architecture_design: true
24
+ - quality_self_validation: true
25
+ # 来自 story-development
26
+ - pre_development_build_check: true
27
+ - progressive_validation: true
28
+ - fast_feedback_loops: true
29
+ - error_prevention_protocols: true
30
+ - enhanced_quality_gates: true
31
+ # 端到端特有
32
+ - seamless_workflow_transition: true
33
+ - unified_progress_tracking: true
34
+ - comprehensive_quality_control: true
35
+
36
+ # 🎯 完整的端到端执行序列
37
+ sequence:
38
+ # ================================
39
+ # 阶段 1: 需求分析工作流
40
+ # ================================
41
+ - phase: requirements_analysis
42
+ workflow_reference: automated-requirements-analysis.yaml
43
+ description: "执行完整的需求分析工作流(6个步骤)"
44
+ duration: "1.5-2.5 hours"
45
+
46
+ steps:
47
+ # 步骤 0: 前置环境验证
48
+ - step: pre_workflow_validation
49
+ action: validate_environment_and_dependencies
50
+ duration: 1m
51
+ checks:
52
+ - req_file_exists: "docs/req.txt"
53
+ - project_structure_valid: "Java Maven项目"
54
+ - xiaoma_core_installed: ".xiaoma-core/"
55
+ - required_directories_exist_or_created
56
+ on_success:
57
+ message: "✅ 环境验证通过,开始需求分析阶段"
58
+ on_failure:
59
+ action: halt_with_instructions
60
+
61
+ # 步骤 1: Analyst 需求分析
62
+ - step: requirements_analysis_and_elicitation
63
+ agent: analyst
64
+ action: analyze_and_clarify_requirements
65
+ duration: 15-25m
66
+ output: "docs/requirements/requirements-analysis.md"
67
+ notes: "Analyst 深度分析 req.txt,生成结构化需求分析报告"
68
+
69
+ # 步骤 2: Architect 架构分析
70
+ - step: analyze_existing_architecture
71
+ agent: architect
72
+ action: analyze_current_system_architecture
73
+ duration: 10-20m
74
+ output: "docs/architecture/current-architecture-analysis.md"
75
+ notes: "Architect 扫描现有代码,识别技术栈和架构模式"
76
+
77
+ # 步骤 3: PM 创建 PRD
78
+ - step: create_brownfield_prd
79
+ agent: pm
80
+ action: create_product_requirements_document
81
+ duration: 20-30m
82
+ command: "*create-brownfield-prd"
83
+ output: "docs/prd/brownfield-iteration-prd.md"
84
+ notes: "PM 基于需求分析和架构约束创建 Brownfield PRD"
85
+
86
+ # 步骤 4: PM 拆分史诗
87
+ - step: epic_sharding_cycle
88
+ agent: pm
89
+ action: create_epics_from_prd
90
+ duration: "变动,取决于史诗数量"
91
+ command: "*create-epic"
92
+ output: "docs/epics/史诗-*.md"
93
+ notes: "PM 循环创建每个史诗文档"
94
+
95
+ # 步骤 5: Architect 架构设计
96
+ - step: design_incremental_backend_architecture
97
+ agent: architect
98
+ action: create_incremental_architecture_design
99
+ duration: 30-40m
100
+ command: "*create-backend-architecture"
101
+ outputs:
102
+ - "docs/architecture/iteration-backend-design.md"
103
+ - "docs/architecture/db-migration-scripts.sql"
104
+ - "docs/architecture/database-design.md"
105
+ - "docs/architecture/api-design.md"
106
+ - "docs/architecture/service-integration.md"
107
+ - "docs/architecture/migration-plan.md"
108
+ - "docs/architecture/coding-standards.md"
109
+ - "docs/architecture/tech-stack.md"
110
+ - "docs/architecture/project-structure.md"
111
+ notes: "Architect 设计增量架构并切分为模块文档"
112
+
113
+ # 步骤 6: 生成完成报告
114
+ - step: finalize_requirements_analysis_workflow
115
+ action: generate_completion_report
116
+ output: "docs/requirements-analysis-completion-report.md"
117
+ notes: "生成需求分析阶段完成报告"
118
+
119
+ validation_criteria:
120
+ - all_requirements_analyzed
121
+ - architecture_documented
122
+ - prd_created_and_validated
123
+ - all_epics_created
124
+ - architecture_design_complete
125
+ - architecture_sharding_complete
126
+
127
+ on_success:
128
+ action: proceed_to_story_development
129
+ message: "✅ 需求分析阶段完成,准备进入用户故事开发阶段"
130
+
131
+ on_failure:
132
+ action: halt_and_review
133
+ escalation: "需求分析阶段失败,需要人工审查"
134
+
135
+ # ================================
136
+ # 🔄 阶段间无缝衔接
137
+ # ================================
138
+ - step: phase_transition_validation
139
+ action: validate_story_development_prerequisites
140
+ duration: 1m
141
+ checks:
142
+ - epic_documents_exist: "docs/epics/史诗-*.md"
143
+ - database_design_exists: "docs/architecture/iteration-backend-design.md"
144
+ - architecture_analysis_exists: "docs/architecture/current-architecture-analysis.md"
145
+ - stories_directory_created: "docs/stories/"
146
+ on_success:
147
+ message: "✅ 前置条件满足,自动进入用户故事开发阶段"
148
+ on_failure:
149
+ action: halt_workflow
150
+ message: "❌ 用户故事开发前置条件不满足"
151
+
152
+ # ================================
153
+ # 阶段 2: 用户故事开发工作流
154
+ # ================================
155
+ - phase: story_development
156
+ workflow_reference: automated-story-development.yaml
157
+ description: "循环执行用户故事开发(SM → PO → Dev → QA)"
158
+ duration: "40-70分钟 × 用户故事数量"
159
+
160
+ cycle:
161
+ condition: has_pending_stories
162
+ description: "重复执行直到所有用户故事完成"
163
+
164
+ cycle_steps:
165
+ # 步骤 1: SM 创建用户故事
166
+ - step: sm_create_story
167
+ agent: sm
168
+ action: create_next_story
169
+ duration: 5-10m
170
+ command: "*draft"
171
+ output: "docs/stories/epic{X}-story{Y}.md"
172
+ status_change: "null → Draft"
173
+ notes: "SM 从 Epic 识别下一个待开发故事并创建"
174
+
175
+ # 步骤 1.5: 快速构建验证
176
+ - step: quick_build_validation
177
+ agent: automation
178
+ action: quick_build_validation
179
+ duration: 30s
180
+ validation_criteria:
181
+ - template_compliance
182
+ - api_specs_completeness
183
+ - database_mapping_validity
184
+ notes: "快速验证防止后续构建问题"
185
+
186
+ # 步骤 2: PO 验证用户故事
187
+ - step: po_validate_story
188
+ agent: po
189
+ action: validate_story_draft
190
+ duration: 3-5m
191
+ command: "*validate-story-draft {story_file}"
192
+ validation_steps:
193
+ - template_completeness_validation
194
+ - file_structure_validation
195
+ - ui_frontend_completeness
196
+ - acceptance_criteria_satisfaction
197
+ - validation_testing_instructions
198
+ - security_considerations
199
+ - tasks_subtasks_sequence
200
+ - anti_hallucination_verification
201
+ - dev_agent_implementation_readiness
202
+ - generate_validation_report
203
+ decision: "GO/NO-GO"
204
+ on_approved:
205
+ status_change: "Draft → Approved"
206
+ on_rejected:
207
+ action: return_to_sm_for_fixes
208
+ notes: "PO 10步验证流程确保故事质量"
209
+
210
+ # 步骤 2.5: 预开发构建检查
211
+ - step: pre_development_build_check
212
+ agent: automation
213
+ action: pre_development_build_check
214
+ duration: 2m
215
+ validation_criteria:
216
+ - maven_compilation_success
217
+ - dependency_analysis_pass
218
+ - lombok_configuration_valid
219
+ - java_version_compatible
220
+ notes: "预开发构建验证,确保环境就绪"
221
+
222
+ # 步骤 3: Dev 开发用户故事
223
+ - step: dev_develop_story
224
+ agent: dev
225
+ action: develop_story
226
+ duration: 20-40m
227
+ commands:
228
+ - "*develop-story {story_file}"
229
+ - "*run-tests"
230
+ implementation_tasks:
231
+ - implement_database_layer
232
+ - implement_business_logic
233
+ - implement_api_endpoints
234
+ - write_unit_tests
235
+ self_test_validation:
236
+ - maven_clean_compile
237
+ - all_tests_passing
238
+ - code_coverage_target: ">=80%"
239
+ - no_critical_issues
240
+ status_change: "Approved → InProgress → Review"
241
+ notes: "Dev 完整实现用户故事并通过自测"
242
+
243
+ # 步骤 4: QA 测试验证
244
+ - step: qa_review_story
245
+ agent: qa
246
+ action: review_story_implementation
247
+ duration: 10-15m
248
+ command: "*review {story_file}"
249
+
250
+ # ⚠️ 核心测试原则:真实数据测试
251
+ testing_principles:
252
+ real_data_testing: "所有测试必须使用真实数据库数据,禁止mock"
253
+ functional_testing_focus: "以功能测试为主(HIGHEST)"
254
+
255
+ test_sequence:
256
+ 1: "功能需求验证(所有验收标准)"
257
+ 2: "真实数据库操作测试(CRUD验证)"
258
+ 3: "API契约测试(真实请求/响应)"
259
+ 4: "业务流程端到端测试"
260
+ 5: "边界条件和异常场景测试"
261
+ 6: "数据完整性和一致性验证"
262
+
263
+ gate_decision: "PASS/CONCERNS/FAIL/WAIVED"
264
+
265
+ on_pass:
266
+ status_change: "Review → Done"
267
+ message: "✅ 用户故事完成,进入下一个故事"
268
+
269
+ on_fail:
270
+ action: return_to_dev_for_fixes
271
+ command: "*review-qa {story_file}"
272
+ status_change: "Review → InProgress"
273
+ notes: "Dev 应用 QA 修复建议并重新测试"
274
+
275
+ notes: "QA 全面功能测试和质量审查(真实数据验证)"
276
+
277
+ # 步骤 5: 质量门控决策
278
+ - step: quality_gate_decision
279
+ action: evaluate_story_completion
280
+ criteria:
281
+ - qa_gate_pass
282
+ - all_ac_satisfied
283
+ - no_blocking_issues
284
+ decision: "Done → 进入下一个故事"
285
+
286
+ validation_criteria:
287
+ - all_stories_completed
288
+ - all_qa_gates_passed
289
+ - no_blocking_issues
290
+
291
+ on_success:
292
+ action: finalize_development
293
+ message: "✅ 所有用户故事开发完成"
294
+
295
+ on_failure:
296
+ action: identify_blocking_stories
297
+ escalation: "用户故事开发遇到阻塞"
298
+
299
+ # ================================
300
+ # 完成:端到端工作流结束
301
+ # ================================
302
+ - step: finalize_end_to_end_workflow
303
+ action: generate_comprehensive_completion_report
304
+ output_file: "docs/end-to-end-completion-report.md"
305
+
306
+ report_structure:
307
+ section_1_executive_summary:
308
+ - 工作流执行概况
309
+ - 总耗时(需求分析 + 用户故事开发)
310
+ - 成功完成的阶段和步骤
311
+
312
+ section_2_requirements_analysis_outputs:
313
+ - 需求分析报告: "docs/requirements/requirements-analysis.md"
314
+ - 架构分析报告: "docs/architecture/current-architecture-analysis.md"
315
+ - PRD 文档: "docs/prd/brownfield-iteration-prd.md"
316
+ - Epic 文档清单: "docs/epics/史诗-*.md ({epic_count} 个)"
317
+ - 架构设计文档: "docs/architecture/iteration-backend-design.md"
318
+ - 数据库脚本: "docs/architecture/db-migration-scripts.sql"
319
+ - 架构模块文档: "7个技术模块子文档"
320
+
321
+ section_3_story_development_outputs:
322
+ - 已完成的用户故事: "docs/stories/epic{X}-story{Y}.md (status: Done)"
323
+ - 实现代码: "src/ 目录下的完整实现"
324
+ - 测试代码: "单元测试 + 集成测试"
325
+ - QA 测试报告: "qa.qaLocation/gates/ 目录下的 gate 文件"
326
+
327
+ section_4_metrics:
328
+ - 识别的 Epic 数量
329
+ - 完成的用户故事数量
330
+ - 识别的数据表数量
331
+ - 识别的 API 端点数量
332
+ - 代码测试覆盖率
333
+ - QA 通过率
334
+
335
+ section_5_quality_assessment:
336
+ - 需求分析质量评分
337
+ - 架构设计质量评分
338
+ - 代码质量评分
339
+ - 测试覆盖率达标情况
340
+ - QA 质量门控通过情况
341
+
342
+ section_6_next_steps:
343
+ - 建议:准备进入集成测试和部署阶段
344
+ - 数据库迁移脚本已就绪
345
+ - 所有验收标准已满足
346
+ - 代码质量达标
347
+
348
+ notification_message: |
349
+ 🎉🎉🎉 端到端自动化工作流完成!
350
+
351
+ 📊 工作流执行摘要:
352
+ ==========================================
353
+ 【阶段 1: 需求分析】(✅ 完成)
354
+ - 需求分析和澄清
355
+ - 现有架构分析
356
+ - Brownfield PRD 创建
357
+ - Epic 史诗拆分({epic_count} 个史诗)
358
+ - 后端架构增量设计
359
+ - 架构文档模块化切分(7个模块)
360
+
361
+ 【阶段 2: 用户故事开发】(✅ 完成)
362
+ - 用户故事创建和验证({story_count} 个故事)
363
+ - 代码开发和自测(所有故事)
364
+ - QA 测试和验收(所有故事)
365
+ - 质量门控决策(全部通过)
366
+
367
+ 📄 生成的关键文档:
368
+ ==========================================
369
+ 需求分析文档: {requirements_analysis_count} 个
370
+ 架构设计文档: {architecture_design_count} 个
371
+ Epic 文档: {epic_count} 个
372
+ 用户故事: {story_count} 个 (状态: Done)
373
+ QA Gate 文件: {gate_count} 个
374
+
375
+ 📈 质量指标:
376
+ ==========================================
377
+ 需求覆盖率: 100%
378
+ 测试覆盖率: {average_coverage}%
379
+ QA 通过率: {qa_pass_rate}%
380
+ 代码质量评分: {code_quality_score}/10
381
+
382
+ 🚀 下一步建议:
383
+ ==========================================
384
+ ✅ 所有功能已开发完成并通过测试
385
+ ✅ 数据库迁移脚本已准备就绪
386
+ ✅ 所有验收标准已满足
387
+ ✅ 代码质量达标
388
+
389
+ 👉 可以进入集成测试和部署准备阶段
390
+
391
+ 📁 详细报告:docs/end-to-end-completion-report.md
392
+
393
+ on_success:
394
+ message: "✅ 端到端工作流成功完成"
395
+
396
+ # ================================
397
+ # 质量门控(继承并增强)
398
+ # ================================
399
+ quality_gates:
400
+ # 需求分析阶段质量门控
401
+ requirements_analysis_phase:
402
+ architecture_analysis:
403
+ required_content:
404
+ - 技术栈清单
405
+ - 数据库实体清单
406
+ - API 模块清单
407
+ - 架构模式说明
408
+
409
+ prd_creation:
410
+ validation_rules:
411
+ - 所有需求已覆盖
412
+ - 技术约束与架构一致
413
+ - 数据库变更明确
414
+ - API 接口清晰
415
+ - 验收标准可测试
416
+
417
+ epic_sharding:
418
+ validation_rules:
419
+ - 史诗范围适中
420
+ - 用户故事数量合理
421
+ - 技术设计一致
422
+
423
+ architecture_design:
424
+ validation_rules:
425
+ - 与现有架构一致
426
+ - 数据模型合理
427
+ - API 设计符合规范
428
+ - 技术风险已识别
429
+
430
+ # 用户故事开发阶段质量门控
431
+ story_development_phase:
432
+ pre_development:
433
+ checks:
434
+ - maven_clean_compile
435
+ - dependency_analysis
436
+ - lombok_processor_config
437
+
438
+ story_creation:
439
+ validation_rules:
440
+ - 所有必填字段完整
441
+ - API 规范完整
442
+ - 数据库实体映射正确
443
+ - 验收标准可测试
444
+
445
+ po_validation:
446
+ criteria:
447
+ - business_alignment
448
+ - technical_feasibility
449
+ - testability
450
+ - no_hallucination
451
+
452
+ development_completion:
453
+ criteria:
454
+ - functionality_implemented
455
+ - all_tests_passing
456
+ - code_coverage_target: ">=80%"
457
+ - build_validation_passed
458
+
459
+ qa_approval:
460
+ criteria:
461
+ - acceptance_criteria_met
462
+ - real_data_testing_passed
463
+ - functional_requirements_met
464
+ - performance_acceptable
465
+
466
+ # ================================
467
+ # 错误处理和重试策略
468
+ # ================================
469
+ error_handling:
470
+ # 需求分析阶段错误处理
471
+ requirements_analysis_failures:
472
+ requirements_analysis_failure:
473
+ max_retries: 2
474
+ escalation: "需求分析失败,需要人工审查 req.txt"
475
+
476
+ prd_creation_failure:
477
+ max_retries: 2
478
+ escalation: "PRD 创建失败,需要审查需求分析质量"
479
+
480
+ epic_sharding_failure:
481
+ max_retries: 2
482
+ escalation: "Epic 拆分失败,需要审查 PRD"
483
+
484
+ architecture_design_failure:
485
+ max_retries: 2
486
+ escalation: "架构设计失败,需要人工审查兼容性"
487
+
488
+ # 用户故事开发阶段错误处理
489
+ story_development_failures:
490
+ compilation_failure:
491
+ action: block_and_fix
492
+ max_retries: 2
493
+ escalation: "技术负责人介入"
494
+
495
+ story_creation_failure:
496
+ max_retries: 3
497
+ escalation: "通知项目经理"
498
+
499
+ validation_failure:
500
+ action: "返回 SM 修正故事"
501
+ tracking: "记录问题详情"
502
+
503
+ development_failure:
504
+ action: "开发者自行修复"
505
+ max_attempts: 5
506
+ escalation: "超过尝试次数通知架构师"
507
+
508
+ qa_failure:
509
+ action: "返回开发者修复"
510
+ impact_analysis: "评估对其他故事的影响"
511
+
512
+ # ================================
513
+ # 进度追踪
514
+ # ================================
515
+ progress_tracking:
516
+ phase_1_metrics:
517
+ - architecture_analysis_completed
518
+ - prd_created
519
+ - epics_created_count
520
+ - architecture_design_completed
521
+ - architecture_sharding_completed
522
+
523
+ phase_2_metrics:
524
+ - stories_created
525
+ - stories_approved
526
+ - stories_in_development
527
+ - stories_in_review
528
+ - stories_completed
529
+ - cycle_time_per_story
530
+
531
+ overall_metrics:
532
+ - total_duration
533
+ - phase_1_duration
534
+ - phase_2_duration
535
+ - identified_tables_count
536
+ - identified_apis_count
537
+ - implemented_stories_count
538
+ - test_coverage_average
539
+ - qa_pass_rate
540
+
541
+ reporting:
542
+ frequency: "每个主要步骤完成后 + 阶段完成后"
543
+ format: "markdown报告"
544
+ locations:
545
+ - "docs/requirements-analysis-completion-report.md"
546
+ - "docs/story-development-progress-report.md"
547
+ - "docs/end-to-end-completion-report.md"
548
+
549
+ # ================================
550
+ # 自动化流程图
551
+ # ================================
552
+ flow_diagram: |
553
+ ```mermaid
554
+ graph TD
555
+ START[🚀 开始: 端到端自动化] --> PHASE1[📋 阶段1: 需求分析]
556
+
557
+ PHASE1 --> P1S0{前置验证}
558
+ P1S0 -->|失败| P1HALT[提示缺失依赖]
559
+ P1S0 -->|通过| P1S1[Analyst: 需求分析]
560
+
561
+ P1S1 --> P1S2[Architect: 架构分析]
562
+ P1S2 --> P1S3[PM: 创建 PRD]
563
+ P1S3 --> P1S4[PM: 拆分史诗]
564
+ P1S4 --> P1S5[Architect: 架构设计]
565
+ P1S5 --> P1S6[生成需求分析报告]
566
+
567
+ P1S6 --> TRANSITION{阶段间验证}
568
+ TRANSITION -->|失败| THALT[阻塞工作流]
569
+ TRANSITION -->|通过| PHASE2[💻 阶段2: 用户故事开发]
570
+
571
+ PHASE2 --> P2LOOP{有待开发故事?}
572
+
573
+ P2LOOP -->|是| P2S1[SM: 创建用户故事]
574
+ P2S1 --> P2S1_5[快速构建验证]
575
+ P2S1_5 --> P2S2[PO: 验证故事]
576
+
577
+ P2S2 --> P2V{验证结果}
578
+ P2V -->|拒绝| P2FIX1[修复故事]
579
+ P2FIX1 --> P2S2
580
+ P2V -->|批准| P2S2_5[预开发构建检查]
581
+
582
+ P2S2_5 --> P2S3[Dev: 开发故事]
583
+ P2S3 --> P2S3T[Dev: 运行自测]
584
+
585
+ P2S3T --> P2T{自测结果}
586
+ P2T -->|失败| P2FIX2[修复代码]
587
+ P2FIX2 --> P2S3T
588
+ P2T -->|通过| P2S4[QA: 测试验证]
589
+
590
+ P2S4 --> P2QA{QA 结果}
591
+ P2QA -->|失败| P2FIX3[应用 QA 修复]
592
+ P2FIX3 --> P2S3T
593
+ P2QA -->|通过| P2DONE[故事状态: Done]
594
+
595
+ P2DONE --> P2LOOP
596
+
597
+ P2LOOP -->|否| FINAL[📊 生成完成报告]
598
+ FINAL --> END[🎉 端到端工作流完成]
599
+
600
+ style PHASE1 fill:#E6E6FA
601
+ style PHASE2 fill:#98FB98
602
+ style TRANSITION fill:#FFE4B5
603
+ style END fill:#90EE90
604
+ ```
605
+
606
+ # ================================
607
+ # 决策指导
608
+ # ================================
609
+ decision_guidance:
610
+ when_to_use:
611
+ - "🎯 需要从 req.txt 到代码完成的完整自动化"
612
+ - "🎯 现有 Java 后端项目的迭代需求开发"
613
+ - "🎯 需要标准化的端到端开发流程"
614
+ - "🎯 团队希望最小化人工干预"
615
+ - "🎯 需要高质量的需求分析和代码实现"
616
+
617
+ when_not_to_use:
618
+ - "❌ 需求文档不清晰或不完整"
619
+ - "❌ 项目不是 Java 后端项目"
620
+ - "❌ 需要频繁的人工决策和干预"
621
+ - "❌ 测试环境未准备就绪"
622
+
623
+ prerequisites:
624
+ - "✅ 现有的 Java 项目代码库"
625
+ - "✅ req.txt 需求文档(由 PM 提供)"
626
+ - "✅ xiaoma-core 已安装"
627
+ - "✅ 项目基本目录结构存在"
628
+ - "✅ 数据库环境已配置(用于 QA 真实数据测试)"
629
+
630
+ expected_outcomes:
631
+ - "📄 完整的需求分析和架构设计文档"
632
+ - "📄 所有 Epic 和用户故事文档"
633
+ - "💻 所有用户故事的完整代码实现"
634
+ - "✅ 所有测试通过,代码质量达标"
635
+ - "📊 详细的执行报告和质量指标"
636
+
637
+ estimated_duration:
638
+ phase_1_requirements_analysis: "1.5-2.5 小时"
639
+ phase_2_story_development: "40-70 分钟 × 用户故事数量"
640
+ typical_total_for_small_project: "4-8 小时(假设 5-10 个用户故事)"
641
+ typical_total_for_medium_project: "8-16 小时(假设 10-20 个用户故事)"
642
+
643
+ # ================================
644
+ # 流程交接提示
645
+ # ================================
646
+ handoff_prompts:
647
+ workflow_start: "🚀 开始端到端自动化工作流..."
648
+
649
+ phase_1_start: "📋 阶段 1/2: 需求分析阶段开始..."
650
+ phase_1_step_1: "Analyst 需求分析中..."
651
+ phase_1_step_2: "Architect 架构分析中..."
652
+ phase_1_step_3: "PM 创建 PRD 中..."
653
+ phase_1_step_4: "PM 拆分史诗中..."
654
+ phase_1_step_5: "Architect 架构设计中..."
655
+ phase_1_complete: "✅ 阶段 1/2 完成: 需求分析阶段({duration})"
656
+
657
+ phase_transition: "🔄 阶段间验证通过,自动进入用户故事开发阶段..."
658
+
659
+ phase_2_start: "💻 阶段 2/2: 用户故事开发阶段开始..."
660
+ phase_2_story_start: "开始开发用户故事 {story_index}/{total_stories}..."
661
+ phase_2_story_sm: "SM 创建用户故事..."
662
+ phase_2_story_po: "PO 验证用户故事..."
663
+ phase_2_story_dev: "Dev 开发用户故事..."
664
+ phase_2_story_qa: "QA 测试用户故事..."
665
+ phase_2_story_done: "✅ 用户故事 {story_index}/{total_stories} 完成"
666
+ phase_2_complete: "✅ 阶段 2/2 完成: 用户故事开发阶段({story_count} 个故事,{duration})"
667
+
668
+ workflow_complete: |
669
+ 🎉🎉🎉 端到端自动化工作流完成!
670
+
671
+ 总耗时: {total_duration}
672
+ - 阶段 1 (需求分析): {phase_1_duration}
673
+ - 阶段 2 (用户故事开发): {phase_2_duration}
674
+
675
+ 完成成果:
676
+ - {epic_count} 个 Epic
677
+ - {story_count} 个用户故事(全部 Done)
678
+ - {table_count} 个数据表设计
679
+ - {api_count} 个 API 端点
680
+ - 平均测试覆盖率: {coverage}%
681
+ - QA 通过率: {qa_pass_rate}%
682
+
683
+ 📁 详细报告: docs/end-to-end-completion-report.md
684
+
685
+ # ================================
686
+ # 最佳实践和注意事项
687
+ # ================================
688
+ best_practices:
689
+ before_starting:
690
+ - "✅ 确保 req.txt 文件内容完整清晰"
691
+ - "✅ 确保项目是有效的 Java 项目"
692
+ - "✅ 安装 xiaoma-core 到项目"
693
+ - "✅ 配置数据库环境(用于 QA 真实数据测试)"
694
+ - "✅ 预留足够的执行时间(建议半天到一天)"
695
+
696
+ during_execution:
697
+ - "✅ 信任自动化流程,避免不必要的中断"
698
+ - "✅ 监控每个阶段的质量门控结果"
699
+ - "✅ 关注错误和警告信息"
700
+ - "✅ 允许自动化工作流自我修正和优化"
701
+
702
+ quality_focus:
703
+ - "✅ 需求分析阶段:关注需求完整性和架构一致性"
704
+ - "✅ 用户故事开发阶段:关注代码质量和测试覆盖率"
705
+ - "✅ QA 阶段:确保真实数据测试,严禁 mock 数据"
706
+ - "✅ 全流程:严格执行质量门控,不跳过验证步骤"
707
+
708
+ after_completion:
709
+ - "✅ 审查端到端完成报告"
710
+ - "✅ 验证所有生成的文档和代码"
711
+ - "✅ 确认数据库迁移脚本的正确性"
712
+ - "✅ 准备进入集成测试和部署阶段"
713
+
714
+ # ================================
715
+ # 成功标准
716
+ # ================================
717
+ success_criteria:
718
+ phase_1_success:
719
+ - all_requirements_analyzed
720
+ - architecture_documented
721
+ - prd_created_and_validated
722
+ - all_epics_created
723
+ - architecture_design_complete
724
+ - all_quality_gates_passed
725
+
726
+ phase_2_success:
727
+ - all_stories_created_and_approved
728
+ - all_stories_developed_and_tested
729
+ - all_qa_gates_passed
730
+ - test_coverage_target_met: ">=80%"
731
+ - no_blocking_issues
732
+
733
+ overall_success:
734
+ - both_phases_completed
735
+ - comprehensive_documentation_generated
736
+ - high_quality_code_implemented
737
+ - all_acceptance_criteria_met
738
+ - ready_for_integration_testing
739
+ - total_duration_within_estimate