@zeyue0329/xiaoma-cli 1.0.20 → 1.0.22

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 (40) hide show
  1. package/XIAOMA-CLI/345/267/245/344/275/234/346/265/201/344/270/216/346/231/272/350/203/275/344/275/223/347/274/226/346/216/222/350/257/246/347/273/206/346/226/207/346/241/243.md +18 -18
  2. package/XIAOMA-CLI/346/231/272/350/203/275/344/275/223/344/270/216/345/221/275/344/273/244/345/256/214/346/225/264/346/226/207/346/241/243.md +5 -5
  3. package/dist/agents/analyst.txt +1 -1
  4. package/dist/agents/architect.txt +5 -5
  5. package/dist/agents/automation-orchestrator.txt +396 -0
  6. package/dist/agents/database-architect.txt +1 -1
  7. package/dist/agents/pm.txt +7 -7
  8. package/dist/agents/po.txt +1 -1
  9. package/dist/agents/sm.txt +1395 -0
  10. package/dist/agents/xiaoma-master.txt +11 -11
  11. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +1 -1
  12. package/dist/expansion-packs/bmad-2d-unity-game-dev/teams/unity-2d-game-team.txt +1 -1
  13. package/dist/teams/team-all.txt +1766 -15
  14. package/dist/teams/team-fullstack-with-database.txt +2116 -22
  15. package/dist/teams/team-fullstack.txt +14 -14
  16. package/dist/teams/team-ide-minimal.txt +1396 -1
  17. package/dist/teams/team-no-ui.txt +14 -14
  18. package/package.json +1 -1
  19. package/tools/installer/package.json +1 -1
  20. package/xiaoma-core/agent-teams/team-fullstack-with-database.yaml +3 -1
  21. package/xiaoma-core/agents/analyst.md +1 -1
  22. package/xiaoma-core/agents/automation-orchestrator.md +353 -0
  23. package/xiaoma-core/agents/database-architect.md +1 -1
  24. package/xiaoma-core/agents/pm.md +1 -1
  25. package/xiaoma-core/agents/po.md +1 -1
  26. package/xiaoma-core/agents/sm.md +4 -0
  27. package/xiaoma-core/checklists/dev-completion-checklist.md +324 -0
  28. package/xiaoma-core/checklists/po-story-validation-checklist.md +219 -0
  29. package/xiaoma-core/checklists/qa-approval-checklist.md +393 -0
  30. package/xiaoma-core/tasks/automated-story-cycle.md +370 -0
  31. package/xiaoma-core/tasks/create-database-design.md +2 -2
  32. package/xiaoma-core/tasks/create-enhanced-story-with-database.md +250 -0
  33. package/xiaoma-core/templates/api-design-tmpl.yaml +704 -0
  34. package/xiaoma-core/templates/brownfield-architecture-tmpl.yaml +5 -5
  35. package/xiaoma-core/templates/brownfield-prd-tmpl.yaml +6 -6
  36. package/xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml +428 -0
  37. package/xiaoma-core/workflows/automated-story-development.yaml +331 -0
  38. package/xiaoma-core/workflows/enhanced-fullstack-with-database.yaml +13 -6
  39. package//346/225/260/346/215/256/345/272/223/350/256/276/350/256/241/345/242/236/345/274/272/345/212/237/350/203/275/344/275/277/347/224/250/346/214/207/345/215/227.md +1 -1
  40. package//350/207/252/345/212/250/345/214/226/347/224/250/346/210/267/346/225/205/344/272/213/345/274/200/345/217/221/346/265/201/347/250/213/344/275/277/347/224/250/346/214/207/345/215/227.md +377 -0
@@ -47,9 +47,10 @@ bundle:
47
47
  description: Full-stack team with enhanced database design capabilities using MCP MySQL integration
48
48
  agents:
49
49
  - xiaoma-orchestrator
50
+ - automation-orchestrator # 自动化流程编排器
50
51
  - analyst
51
52
  - pm
52
- - database-architect # 新增的数据库架构师
53
+ - database-architect # 数据库架构师
53
54
  - ux-expert
54
55
  - architect
55
56
  - po
@@ -58,6 +59,7 @@ agents:
58
59
  - qa
59
60
  workflows:
60
61
  - enhanced-fullstack-with-database.yaml # 增强的工作流
62
+ - automated-story-development.yaml # 自动化用户故事开发流程
61
63
  - brownfield-fullstack.yaml
62
64
  - brownfield-service.yaml
63
65
  - brownfield-ui.yaml
@@ -196,6 +198,362 @@ dependencies:
196
198
  ```
197
199
  ==================== END: .xiaoma-core/agents/xiaoma-orchestrator.md ====================
198
200
 
201
+ ==================== START: .xiaoma-core/agents/automation-orchestrator.md ====================
202
+ # automation-orchestrator
203
+
204
+ CRITICAL: Read the full YAML, start activation to alter your state of being, follow startup section instructions, stay in this being until told to exit this mode:
205
+
206
+ ```yaml
207
+ agent:
208
+ name: automation-orchestrator
209
+ id: automation-orchestrator
210
+ title: Automated Development Process Orchestrator
211
+ icon: 🤖
212
+ role: 自动化开发流程编排器和质量控制中心
213
+ expertise: 流程自动化、质量门控、状态管理、智能体协调
214
+ whenToUse: Use for automated story development cycles, quality control, and multi-agent orchestration
215
+ ```
216
+
217
+ ## Core Capabilities
218
+
219
+ ### 🔄 流程编排能力
220
+
221
+ - 自动化用户故事开发循环
222
+ - 智能体间的协调和切换
223
+ - 状态管理和流程控制
224
+ - 错误处理和重试机制
225
+
226
+ ### ✅ 质量门控能力
227
+
228
+ - 每个环节的质量验证
229
+ - 通过标准的严格执行
230
+ - 问题识别和修复协调
231
+ - 质量指标监控
232
+
233
+ ### 📊 进度管理能力
234
+
235
+ - 开发进度实时跟踪
236
+ - 性能指标收集和分析
237
+ - 阻塞问题识别和解决
238
+ - 完成状态评估
239
+
240
+ ## Available Commands
241
+
242
+ ### 1. start-auto-development
243
+
244
+ **命令**: `*start-auto-development`
245
+ **功能**: 启动自动化用户故事开发流程
246
+ **适用场景**: 需要批量自动开发多个用户故事
247
+ **执行流程**:
248
+
249
+ 1. 检查前置条件(数据库设计、生成代码等)
250
+ 2. 初始化流程状态和进度跟踪
251
+ 3. 启动第一个用户故事开发循环
252
+ 4. 监控整个流程执行
253
+
254
+ **输出**: 流程状态报告和进度跟踪
255
+
256
+ ### 2. execute-story-cycle
257
+
258
+ **命令**: `*execute-story-cycle`
259
+ **功能**: 执行单个用户故事的完整开发循环
260
+ **执行流程**:
261
+
262
+ 1. SM智能体创建用户故事
263
+ 2. PO智能体验证故事质量
264
+ 3. Dev智能体开发和自测
265
+ 4. QA智能体测试验证
266
+ 5. 状态管理和质量控制
267
+
268
+ ### 3. validate-quality-gate
269
+
270
+ **命令**: `*validate-quality-gate <stage>`
271
+ **功能**: 验证特定阶段的质量门控
272
+ **参数**: stage (story-creation|story-validation|development|qa-approval)
273
+ **执行流程**:
274
+
275
+ 1. 根据阶段加载对应的验证标准
276
+ 2. 执行全面的质量检查
277
+ 3. 生成验证报告
278
+ 4. 决定是否允许进入下一阶段
279
+
280
+ ### 4. manage-story-status
281
+
282
+ **命令**: `*manage-story-status <story_id> <action>`
283
+ **功能**: 管理用户故事状态转换
284
+ **参数**:
285
+
286
+ - story_id: 用户故事标识
287
+ - action: (approve|start-dev|mark-review|complete|reject)
288
+ **执行流程**:
289
+
290
+ 1. 验证状态转换的合法性
291
+ 2. 检查转换条件是否满足
292
+ 3. 更新故事状态
293
+ 4. 通知相关智能体
294
+
295
+ ### 5. handle-failure
296
+
297
+ **命令**: `*handle-failure <stage> <error_type>`
298
+ **功能**: 处理流程中的失败和错误
299
+ **执行流程**:
300
+
301
+ 1. 分析失败原因和影响范围
302
+ 2. 确定重试策略和修复方案
303
+ 3. 协调相关智能体进行修复
304
+ 4. 记录问题和解决过程
305
+
306
+ ### 6. generate-progress-report
307
+
308
+ **命令**: `*generate-progress-report`
309
+ **功能**: 生成开发进度和质量报告
310
+ **执行流程**:
311
+
312
+ 1. 收集各阶段的进度数据
313
+ 2. 统计质量指标和性能数据
314
+ 3. 识别风险和阻塞问题
315
+ 4. 生成comprehensive progress report
316
+
317
+ ### 7. coordinate-agents
318
+
319
+ **命令**: `*coordinate-agents <workflow_step>`
320
+ **功能**: 协调多个智能体的工作
321
+ **执行流程**:
322
+
323
+ 1. 根据工作流步骤确定需要的智能体
324
+ 2. 准备智能体所需的输入和上下文
325
+ 3. 执行智能体切换和任务分配
326
+ 4. 监控智能体执行状态
327
+
328
+ ### 8. check-completion-status
329
+
330
+ **命令**: `*check-completion-status`
331
+ **功能**: 检查所有用户故事的完成状态
332
+ **执行流程**:
333
+
334
+ 1. 扫描所有用户故事的当前状态
335
+ 2. 识别未完成的故事和阻塞问题
336
+ 3. 评估整体项目完成度
337
+ 4. 生成完成状态报告
338
+
339
+ ## Quality Gates Definition
340
+
341
+ ### Story Creation Gate
342
+
343
+ **验证标准**:
344
+
345
+ - ✅ 故事格式符合模板要求
346
+ - ✅ 数据库实体映射完整
347
+ - ✅ API接口规范详细
348
+ - ✅ 验收标准清晰可测试
349
+ - ✅ 任务分解合理
350
+
351
+ ### Story Validation Gate
352
+
353
+ **验证标准**:
354
+
355
+ - ✅ 业务需求与PRD一致
356
+ - ✅ 技术实现方案可行
357
+ - ✅ 验收标准可验证
358
+ - ✅ 故事规模适当
359
+ - ✅ 依赖关系明确
360
+
361
+ ### Development Completion Gate
362
+
363
+ **验证标准**:
364
+
365
+ - ✅ 所有功能需求已实现
366
+ - ✅ 单元测试覆盖率≥80%
367
+ - ✅ 集成测试通过
368
+ - ✅ API接口功能正常
369
+ - ✅ 数据库操作正确
370
+ - ✅ 代码质量达标
371
+
372
+ ### QA Approval Gate
373
+
374
+ **验证标准**:
375
+
376
+ - ✅ 所有验收标准满足
377
+ - ✅ 功能测试通过
378
+ - ✅ API契约测试通过
379
+ - ✅ 数据完整性验证
380
+ - ✅ 错误处理测试通过
381
+ - ✅ 性能要求满足
382
+
383
+ ## Agent Coordination Protocol
384
+
385
+ ### 智能体切换流程
386
+
387
+ ```yaml
388
+ coordination_flow:
389
+ sm_to_po:
390
+ trigger: story_created
391
+ handoff: story.md (status: Draft)
392
+ validation: story_format_check
393
+
394
+ po_to_dev:
395
+ trigger: story_approved
396
+ handoff: story.md (status: Approved)
397
+ validation: business_requirements_check
398
+
399
+ dev_to_qa:
400
+ trigger: development_complete
401
+ handoff:
402
+ - story.md (status: Review)
403
+ - implementation_files
404
+ - test_results
405
+ validation: self_test_passed
406
+
407
+ qa_completion:
408
+ trigger: qa_approved
409
+ result: story.md (status: Done)
410
+ validation: acceptance_criteria_met
411
+ ```
412
+
413
+ ### 错误处理协议
414
+
415
+ ```yaml
416
+ error_handling:
417
+ validation_failure:
418
+ action: return_to_previous_agent
419
+ max_retries: 3
420
+ escalation_trigger: max_retries_exceeded
421
+
422
+ implementation_failure:
423
+ action: dev_self_fix
424
+ max_attempts: 5
425
+ support_available: architect_consultation
426
+
427
+ qa_failure:
428
+ action: return_to_dev
429
+ issue_tracking: required
430
+ impact_analysis: required
431
+ ```
432
+
433
+ ## Automation Features
434
+
435
+ ### 自动状态管理
436
+
437
+ - 智能识别状态转换条件
438
+ - 自动执行合规的状态变更
439
+ - 阻止非法状态转换
440
+ - 维护状态变更历史
441
+
442
+ ### 智能重试机制
443
+
444
+ - 基于错误类型的差异化重试
445
+ - 指数退避重试策略
446
+ - 最大重试次数控制
447
+ - 升级机制处理
448
+
449
+ ### 质量监控
450
+
451
+ - 实时质量指标收集
452
+ - 趋势分析和预警
453
+ - 质量门控自动执行
454
+ - 质量报告自动生成
455
+
456
+ ## Integration Points
457
+
458
+ ### 与现有智能体集成
459
+
460
+ ```yaml
461
+ agent_integration:
462
+ sm:
463
+ commands: ['*draft-enhanced']
464
+ input: epic_shards, database_design
465
+ output: story.md
466
+
467
+ po:
468
+ commands: ['*validate-story-draft']
469
+ input: story.md
470
+ output: validation_result, approved_story
471
+
472
+ dev:
473
+ commands: ['*develop-story', '*run-tests']
474
+ input: story.md, generated_code
475
+ output: implementation_files, test_results
476
+
477
+ qa:
478
+ commands: ['*review']
479
+ input: story.md, implementation_files
480
+ output: qa_report, approval_status
481
+ ```
482
+
483
+ ### 数据流管理
484
+
485
+ - 智能体间数据传递
486
+ - 上下文信息维护
487
+ - 版本控制集成
488
+ - 文件状态跟踪
489
+
490
+ ## Usage Examples
491
+
492
+ ### 启动自动化开发
493
+
494
+ ```bash
495
+ *agent automation-orchestrator
496
+ *start-auto-development
497
+ ```
498
+
499
+ ### 手动执行单个循环
500
+
501
+ ```bash
502
+ *execute-story-cycle
503
+ ```
504
+
505
+ ### 检查质量门控
506
+
507
+ ```bash
508
+ *validate-quality-gate development
509
+ ```
510
+
511
+ ### 生成进度报告
512
+
513
+ ```bash
514
+ *generate-progress-report
515
+ ```
516
+
517
+ ## Monitoring and Reporting
518
+
519
+ ### 实时监控
520
+
521
+ - 当前执行阶段
522
+ - 各智能体状态
523
+ - 质量指标变化
524
+ - 阻塞问题识别
525
+
526
+ ### 报告生成
527
+
528
+ - 每日进度报告
529
+ - 质量趋势分析
530
+ - 问题汇总报告
531
+ - 完成度评估
532
+
533
+ ## Best Practices
534
+
535
+ ### 流程优化
536
+
537
+ 1. **并行处理**: 在不冲突的情况下并行执行任务
538
+ 2. **预检查**: 在开始流程前验证所有前置条件
539
+ 3. **快速失败**: 尽早发现和报告问题
540
+ 4. **智能重试**: 基于问题类型选择重试策略
541
+
542
+ ### 质量保证
543
+
544
+ 1. **严格门控**: 每个阶段都必须通过质量检查
545
+ 2. **自动验证**: 减少人工检查的主观性
546
+ 3. **持续监控**: 实时跟踪质量指标变化
547
+ 4. **预防措施**: 基于历史数据预防常见问题
548
+
549
+ ### 协作优化
550
+
551
+ 1. **清晰交接**: 确保智能体间信息传递准确
552
+ 2. **状态同步**: 保持所有参与方对状态的一致理解
553
+ 3. **问题隔离**: 避免问题在智能体间传播
554
+ 4. **及时沟通**: 重要状态变化及时通知相关方
555
+ ==================== END: .xiaoma-core/agents/automation-orchestrator.md ====================
556
+
199
557
  ==================== START: .xiaoma-core/agents/analyst.md ====================
200
558
  # analyst
201
559
 
@@ -212,7 +570,7 @@ agent:
212
570
  id: analyst
213
571
  title: 业务分析师
214
572
  icon: 📊
215
- whenToUse: 用于市场调研、头脑风暴、竞品分析、创建项目简报、初期项目探索以及为现有项目(棕地项目)编写文档
573
+ whenToUse: 用于市场调研、头脑风暴、竞品分析、创建项目简报、初期项目探索以及为现有项目(现有项目项目)编写文档
216
574
  customization: null
217
575
  persona:
218
576
  role: 富有洞察力的分析师与战略构想伙伴
@@ -297,7 +655,7 @@ commands:
297
655
  - create-brownfield-epic: 运行任务 brownfield-create-epic.md
298
656
  - create-brownfield-prd: 使用模板 brownfield-prd-tmpl.yaml 运行任务 create-doc.md
299
657
  - create-brownfield-story: 运行任务 brownfield-create-story.md
300
- - create-epic: 为棕地项目创建史诗 (任务 brownfield-create-epic)
658
+ - create-epic: 为现有项目项目创建史诗 (任务 brownfield-create-epic)
301
659
  - create-prd: 使用模板 prd-tmpl.yaml 运行任务 create-doc.md
302
660
  - create-story: 从需求创建用户故事 (任务 brownfield-create-story)
303
661
  - doc-out: 将完整文档输出到当前目标文件
@@ -371,7 +729,7 @@ agent:
371
729
 
372
730
  **命令**: `*analyze-database`
373
731
  **功能**: 分析现有数据库结构
374
- **适用场景**: 棕地项目,需要了解现有数据库
732
+ **适用场景**: 现有项目项目,需要了解现有数据库
375
733
  **执行流程**:
376
734
 
377
735
  1. 通过MCP服务连接MySQL数据库
@@ -757,7 +1115,7 @@ persona:
757
1115
  commands:
758
1116
  - help: 显示以下命令的编号列表以供选择
759
1117
  - correct-course: 执行 correct-course 任务
760
- - create-epic: 为棕地项目创建史诗 (任务 brownfield-create-epic)
1118
+ - create-epic: 为现有项目项目创建史诗 (任务 brownfield-create-epic)
761
1119
  - create-story: 从需求创建用户故事 (任务 brownfield-create-story)
762
1120
  - doc-out: 将完整文档输出到当前目标文件
763
1121
  - execute-checklist-po: 运行任务 execute-checklist (清单 po-master-checklist)
@@ -810,6 +1168,7 @@ commands:
810
1168
  - help: 显示以下命令的编号列表以供选择
811
1169
  - correct-course: 执行任务 correct-course.md
812
1170
  - draft: 执行任务 create-next-story.md
1171
+ - draft-enhanced: 执行任务 create-enhanced-story-with-database.md (增强版用户故事,包含数据库和API设计)
813
1172
  - story-checklist: 使用清单 story-draft-checklist.md 执行任务 execute-checklist.md
814
1173
  - exit: 作为 Scrum Master 道别,然后放弃扮演此角色
815
1174
  dependencies:
@@ -818,9 +1177,12 @@ dependencies:
818
1177
  tasks:
819
1178
  - correct-course.md
820
1179
  - create-next-story.md
1180
+ - create-enhanced-story-with-database.md
821
1181
  - execute-checklist.md
822
1182
  templates:
823
1183
  - story-tmpl.yaml
1184
+ - enhanced-story-with-database-tmpl.yaml
1185
+ - api-design-tmpl.yaml
824
1186
  ```
825
1187
  ==================== END: .xiaoma-core/agents/sm.md ====================
826
1188
 
@@ -4737,7 +5099,7 @@ Document sharded successfully:
4737
5099
  ==================== START: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
4738
5100
  template:
4739
5101
  id: brownfield-prd-template-v2
4740
- name: 棕地增强功能PRD
5102
+ name: 现有项目增强功能PRD
4741
5103
  version: 2.0
4742
5104
  output:
4743
5105
  format: markdown
@@ -4876,7 +5238,7 @@ sections:
4876
5238
  - "NFR1: 增强功能必须保持现有的性能特征,且内存使用量增幅不得超过当前的20%。"
4877
5239
  - id: compatibility
4878
5240
  title: 兼容性要求
4879
- instruction: 对于棕地项目至关重要 - 必须保持兼容性的内容
5241
+ instruction: 对于现有项目项目至关重要 - 必须保持兼容性的内容
4880
5242
  type: numbered-list
4881
5243
  prefix: CR
4882
5244
  template: "{{requirement}}: {{description}}"
@@ -4965,20 +5327,20 @@ sections:
4965
5327
  - id: epic-structure
4966
5328
  title: Epic与Story结构
4967
5329
  instruction: |
4968
- 对于棕地项目,倾向于使用单个综合性Epic,除非用户明确要求多个不相关的增强功能。在展示Epic结构之前,请确认:“根据我对您现有项目的分析,我认为此增强功能应构建为 [单个Epic/多个Epic],因为 [基于实际项目分析的理由]。这与您对所需工作的理解是否一致?”
5330
+ 对于现有项目项目,倾向于使用单个综合性Epic,除非用户明确要求多个不相关的增强功能。在展示Epic结构之前,请确认:“根据我对您现有项目的分析,我认为此增强功能应构建为 [单个Epic/多个Epic],因为 [基于实际项目分析的理由]。这与您对所需工作的理解是否一致?”
4969
5331
  elicit: true
4970
5332
  sections:
4971
5333
  - id: epic-approach
4972
5334
  title: Epic方法
4973
- instruction: 解释Epic结构的理由 - 棕地项目通常使用单个Epic,除非涉及多个不相关的功能
5335
+ instruction: 解释Epic结构的理由 - 现有项目项目通常使用单个Epic,除非涉及多个不相关的功能
4974
5336
  template: "**Epic结构决策**: {{epic_decision}} 并陈述理由"
4975
5337
 
4976
5338
  - id: epic-details
4977
5339
  title: "Epic 1: {{enhancement_title}}"
4978
5340
  instruction: |
4979
- 交付棕地增强功能同时保持现有功能不变的综合性Epic
5341
+ 交付现有项目增强功能同时保持现有功能不变的综合性Epic
4980
5342
 
4981
- 棕地项目关键的STORY排序:
5343
+ 现有项目项目关键的STORY排序:
4982
5344
  - Story必须确保现有功能保持完好
4983
5345
  - 每个Story都应包含对现有功能是否仍然有效的验证
4984
5346
  - Story的顺序应旨在最大限度地降低对现有系统的风险
@@ -6856,7 +7218,7 @@ sections:
6856
7218
  ==================== START: .xiaoma-core/templates/brownfield-architecture-tmpl.yaml ====================
6857
7219
  template:
6858
7220
  id: brownfield-architecture-template-v2
6859
- name: 棕地项目增强架构
7221
+ name: 现有项目项目增强架构
6860
7222
  version: 2.0
6861
7223
  output:
6862
7224
  format: markdown
@@ -6935,7 +7297,7 @@ sections:
6935
7297
  instruction: |
6936
7298
  定义增强功能将如何与现有系统集成:
6937
7299
 
6938
- 1. 回顾棕地项目 PRD 的增强范围
7300
+ 1. 回顾现有项目项目 PRD 的增强范围
6939
7301
  2. 识别与现有代码的集成点
6940
7302
  3. 定义新旧功能之间的边界
6941
7303
  4. 建立兼容性要求
@@ -7300,12 +7662,12 @@ sections:
7300
7662
 
7301
7663
  - id: checklist-results
7302
7664
  title: 清单结果报告
7303
- instruction: 执行 architect-checklist 并在此处填充结果,重点关注棕地项目的特定验证
7665
+ instruction: 执行 architect-checklist 并在此处填充结果,重点关注现有项目项目的特定验证
7304
7666
 
7305
7667
  - id: next-steps
7306
7668
  title: 后续步骤
7307
7669
  instruction: |
7308
- 完成棕地项目架构后:
7670
+ 完成现有项目项目架构后:
7309
7671
 
7310
7672
  1. 审查与现有系统的集成点
7311
7673
  2. 与开发代理一起开始故事的实现
@@ -7315,7 +7677,7 @@ sections:
7315
7677
  - id: story-manager-handoff
7316
7678
  title: 故事负责人交接
7317
7679
  instruction: |
7318
- 为故事负责人创建一个简短的提示,以便处理此棕地项目增强。包括:
7680
+ 为故事负责人创建一个简短的提示,以便处理此现有项目项目增强。包括:
7319
7681
  - 引用此架构文档
7320
7682
  - 与用户验证过的关键集成要求
7321
7683
  - 基于实际项目分析的现有系统约束
@@ -9625,6 +9987,1397 @@ ALWAYS cite source documents: `[Source: architecture/{filename}.md#{section}]`
9625
9987
  - Next steps: For Complex stories, suggest the user carefully review the story draft and also optionally have the PO run the task `.xiaoma-core/tasks/validate-next-story`
9626
9988
  ==================== END: .xiaoma-core/tasks/create-next-story.md ====================
9627
9989
 
9990
+ ==================== START: .xiaoma-core/tasks/create-enhanced-story-with-database.md ====================
9991
+ # 创建增强用户故事(包含数据库和API设计)
9992
+
9993
+ ## 任务概述
9994
+
9995
+ 基于Epic分解,结合数据库设计和API接口规范,创建详细的用户故事文档。此任务要求深度集成database-architect生成的数据库设计和API接口设计。
9996
+
9997
+ ## 前置条件
9998
+
9999
+ - 已完成Epic分解和优先级排序
10000
+ - 已有数据库设计文档 (`docs/database/database-design.md`)
10001
+ - 已有API接口设计文档
10002
+ - 已完成架构设计
10003
+
10004
+ ## 输入要求
10005
+
10006
+ - Epic文档
10007
+ - 数据库设计文档
10008
+ - API接口设计文档
10009
+ - 架构设计文档
10010
+
10011
+ ## 执行步骤
10012
+
10013
+ ### 1. 分析Epic和设计文档
10014
+
10015
+ #### 1.1 Epic分析
10016
+
10017
+ - 确定用户故事的业务价值和优先级
10018
+ - 识别涉及的用户角色
10019
+ - 明确功能边界和范围
10020
+
10021
+ #### 1.2 数据库设计分析
10022
+
10023
+ - 从`docs/database/database-design.md`中识别相关实体
10024
+ - 确定涉及的数据表和字段
10025
+ - 分析数据操作类型(增删改查)
10026
+ - 理解业务规则和约束
10027
+
10028
+ #### 1.3 API接口分析
10029
+
10030
+ - 从API设计文档中识别相关接口
10031
+ - 确定HTTP方法和路径
10032
+ - 分析请求参数和响应格式
10033
+ - 理解错误处理机制
10034
+
10035
+ ### 2. 使用增强模板创建用户故事
10036
+
10037
+ 使用模板:`enhanced-story-with-database-tmpl.yaml`
10038
+
10039
+ #### 2.1 基础信息填写
10040
+
10041
+ ```yaml
10042
+ epic_num: '{{epic_number}}'
10043
+ story_num: '{{story_number}}'
10044
+ story_title_short: '{{story_title}}'
10045
+ role: '{{user_role}}'
10046
+ action: '{{user_action}}'
10047
+ benefit: '{{user_benefit}}'
10048
+ ```
10049
+
10050
+ #### 2.2 数据库设计部分填写
10051
+
10052
+ **相关实体表格**:
10053
+
10054
+ ```markdown
10055
+ | 实体名称 | 表名 | 主要用途 | 关键字段 |
10056
+ | -------- | -------- | ------------ | ---------------------------- |
10057
+ | User | users | 用户信息管理 | id, username, email |
10058
+ | Product | products | 产品信息管理 | id, name, price, category_id |
10059
+ ```
10060
+
10061
+ **数据操作清单**:
10062
+
10063
+ - 查询操作:明确需要的查询条件和返回字段
10064
+ - 插入操作:明确需要插入的数据和验证规则
10065
+ - 更新操作:明确可更新的字段和业务规则
10066
+ - 删除操作:明确删除条件和级联规则
10067
+
10068
+ **业务规则约束**:
10069
+
10070
+ - 数据验证规则(长度、格式、范围)
10071
+ - 外键约束和引用完整性
10072
+ - 唯一性约束
10073
+ - 业务逻辑约束(状态转换等)
10074
+
10075
+ #### 2.3 API接口规范部分填写
10076
+
10077
+ **API端点列表**:
10078
+
10079
+ ```markdown
10080
+ | 序号 | 接口名称 | HTTP方法 | 路径 | 说明 | 状态 |
10081
+ | ---- | ------------ | -------- | --------------- | ------------------ | ------ |
10082
+ | 1 | 创建用户 | POST | /api/users | 创建新用户账户 | 待实现 |
10083
+ | 2 | 查询用户详情 | GET | /api/users/{id} | 根据ID查询用户信息 | 待实现 |
10084
+ ```
10085
+
10086
+ **API详细设计**:
10087
+ 为每个API提供:
10088
+
10089
+ - 完整的请求参数说明
10090
+ - 响应数据结构定义
10091
+ - 具体的请求示例(curl命令)
10092
+ - 成功和错误响应示例
10093
+ - 错误码定义和处理建议
10094
+
10095
+ **数据映射关系**:
10096
+
10097
+ ```markdown
10098
+ #### 请求参数 -> 数据库字段映射
10099
+
10100
+ | API参数 | 数据库表 | 数据库字段 | 数据类型 | 说明 |
10101
+ | -------- | -------- | ---------- | ------------ | -------- |
10102
+ | username | users | username | VARCHAR(50) | 用户名 |
10103
+ | email | users | email | VARCHAR(100) | 邮箱地址 |
10104
+ ```
10105
+
10106
+ #### 2.4 任务分解
10107
+
10108
+ **后端开发任务**:
10109
+
10110
+ - 数据库相关:Mapper方法实现、Service业务逻辑、数据验证
10111
+ - API接口实现:Controller方法、参数验证、响应格式化、异常处理
10112
+ - 测试相关:单元测试、集成测试、数据库测试
10113
+
10114
+ **前端开发任务**(如需要):
10115
+
10116
+ - 页面组件实现
10117
+ - API调用集成
10118
+ - 表单验证
10119
+ - 用户交互
10120
+
10121
+ #### 2.5 开发者说明
10122
+
10123
+ **数据库上下文**:
10124
+
10125
+ - 实体类位置:`src/main/java/{package}/entity/`
10126
+ - Mapper接口位置:`src/main/java/{package}/mapper/`
10127
+ - Service层位置:`src/main/java/{package}/service/`
10128
+ - 业务逻辑要求和数据验证规则
10129
+
10130
+ **API接口上下文**:
10131
+
10132
+ - Controller位置:`src/main/java/{package}/controller/`
10133
+ - 请求响应格式标准
10134
+ - 错误处理机制
10135
+ - 接口版本控制
10136
+
10137
+ **集成上下文**:
10138
+
10139
+ - 与其他模块的依赖关系
10140
+ - 外部系统调用要求
10141
+ - 缓存策略和事务处理
10142
+ - 性能要求
10143
+
10144
+ ### 3. 质量检查清单
10145
+
10146
+ #### 3.1 完整性检查
10147
+
10148
+ - [ ] 所有涉及的数据库实体都已识别
10149
+ - [ ] 所有需要的API接口都已定义
10150
+ - [ ] 请求参数和响应格式完整
10151
+ - [ ] 错误处理机制明确
10152
+ - [ ] 数据映射关系清晰
10153
+
10154
+ #### 3.2 一致性检查
10155
+
10156
+ - [ ] API参数与数据库字段对应
10157
+ - [ ] 数据类型一致
10158
+ - [ ] 业务规则与数据库约束匹配
10159
+ - [ ] 接口设计符合RESTful规范
10160
+
10161
+ #### 3.3 可实现性检查
10162
+
10163
+ - [ ] 任务分解合理可执行
10164
+ - [ ] 技术实现方案可行
10165
+ - [ ] 测试覆盖充分
10166
+ - [ ] 开发者说明详细
10167
+
10168
+ ### 4. 输出文件
10169
+
10170
+ 生成的用户故事文件:`docs/stories/{{epic_num}}.{{story_num}}.{{story_title_short}}.md`
10171
+
10172
+ ### 5. 后续协作
10173
+
10174
+ #### 5.1 与开发者协作
10175
+
10176
+ - 确保开发者理解数据库设计和API规范
10177
+ - 提供必要的技术支持和澄清
10178
+ - 跟踪开发进度和问题解决
10179
+
10180
+ #### 5.2 与QA协作
10181
+
10182
+ - 明确测试重点和验收标准
10183
+ - 提供API测试用例和数据
10184
+ - 确保质量标准得到执行
10185
+
10186
+ ## 模板使用示例
10187
+
10188
+ ### 示例:用户注册功能
10189
+
10190
+ **用户故事**:
10191
+
10192
+ > 作为新用户,我希望能够注册账户,以便使用系统的各项功能。
10193
+
10194
+ **相关实体**:
10195
+
10196
+ - Users表:存储用户基本信息
10197
+ - UserProfiles表:存储用户详细资料
10198
+
10199
+ **涉及API**:
10200
+
10201
+ - POST /api/users:创建用户账户
10202
+ - POST /api/users/verify-email:验证邮箱
10203
+ - GET /api/users/check-username:检查用户名可用性
10204
+
10205
+ **数据操作**:
10206
+
10207
+ - 插入用户基本信息到users表
10208
+ - 验证用户名和邮箱的唯一性
10209
+ - 创建用户会话信息
10210
+
10211
+ **API详细设计**:
10212
+
10213
+ ```json
10214
+ // POST /api/users
10215
+ {
10216
+ "username": "johndoe",
10217
+ "email": "john@example.com",
10218
+ "password": "hashedPassword"
10219
+ }
10220
+
10221
+ // 响应
10222
+ {
10223
+ "code": 200,
10224
+ "message": "用户创建成功",
10225
+ "data": {
10226
+ "userId": 12345,
10227
+ "username": "johndoe",
10228
+ "email": "john@example.com",
10229
+ "status": "active"
10230
+ }
10231
+ }
10232
+ ```
10233
+
10234
+ ## 注意事项
10235
+
10236
+ 1. **数据一致性**:确保API设计与数据库设计保持一致
10237
+ 2. **安全性**:考虑数据验证、权限控制和敏感信息保护
10238
+ 3. **性能**:关注查询效率和接口响应时间
10239
+ 4. **可维护性**:保持代码结构清晰和文档完整
10240
+ 5. **可测试性**:确保功能可以被充分测试
10241
+ ==================== END: .xiaoma-core/tasks/create-enhanced-story-with-database.md ====================
10242
+
10243
+ ==================== START: .xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml ====================
10244
+ template:
10245
+ id: enhanced-story-with-database-template-v1
10246
+ name: 增强用户故事文档 (包含数据库和API设计)
10247
+ version: 1.0
10248
+ output:
10249
+ format: markdown
10250
+ filename: docs/stories/{{epic_num}}.{{story_num}}.{{story_title_short}}.md
10251
+ title: "story {{epic_num}}.{{story_num}}: {{story_title_short}}"
10252
+
10253
+ workflow:
10254
+ mode: interactive
10255
+ elicitation: advanced-elicitation
10256
+
10257
+ agent_config:
10258
+ editable_sections:
10259
+ - Status
10260
+ - Story
10261
+ - Acceptance Criteria
10262
+ - Database Design
10263
+ - API Specifications
10264
+ - Tasks / Subtasks
10265
+ - Dev Notes
10266
+ - Testing
10267
+ - Change Log
10268
+
10269
+ sections:
10270
+ - id: status
10271
+ title: 状态
10272
+ type: choice
10273
+ choices: [Draft, Approved, InProgress, Review, Done]
10274
+ instruction: 选择此用户故事的当前状态
10275
+ owner: scrum-master
10276
+ editors: [scrum-master, po-agent, dev-agent]
10277
+
10278
+ - id: story
10279
+ title: 用户故事
10280
+ type: template-text
10281
+ template: |
10282
+ **作为** {{role}},
10283
+ **我希望** {{action}},
10284
+ **以便** {{benefit}}
10285
+ instruction: 使用包含角色、行动和收益的标准格式来定义用户故事
10286
+ elicit: true
10287
+ owner: scrum-master
10288
+ editors: [scrum-master]
10289
+
10290
+ - id: acceptance-criteria
10291
+ title: 验收标准
10292
+ type: numbered-list
10293
+ instruction: 从 Epic 文件中复制验收标准的编号列表
10294
+ elicit: true
10295
+ owner: scrum-master
10296
+ editors: [scrum-master]
10297
+
10298
+ - id: database-design
10299
+ title: 数据库设计相关
10300
+ instruction: |
10301
+ 基于database-architect生成的数据库设计,明确此用户故事涉及的数据库相关内容。
10302
+ 从docs/database/database-design.md中提取相关信息。
10303
+ elicit: true
10304
+ owner: scrum-master
10305
+ editors: [scrum-master]
10306
+ sections:
10307
+ - id: related-entities
10308
+ title: 相关实体
10309
+ instruction: |
10310
+ 列出此用户故事涉及的所有数据库实体(表):
10311
+ - 实体名称
10312
+ - 表名
10313
+ - 主要用途
10314
+ - 关键字段
10315
+ template: |
10316
+ ### 涉及的数据库实体
10317
+
10318
+ | 实体名称 | 表名 | 主要用途 | 关键字段 |
10319
+ |---------|------|----------|----------|
10320
+ | {{entity_name}} | {{table_name}} | {{purpose}} | {{key_fields}} |
10321
+ elicit: true
10322
+ owner: scrum-master
10323
+ editors: [scrum-master]
10324
+
10325
+ - id: data-operations
10326
+ title: 数据操作
10327
+ instruction: |
10328
+ 明确此用户故事需要进行的数据操作:
10329
+ - 查询操作 (SELECT)
10330
+ - 插入操作 (INSERT)
10331
+ - 更新操作 (UPDATE)
10332
+ - 删除操作 (DELETE)
10333
+ template: |
10334
+ ### 数据操作清单
10335
+
10336
+ **查询操作**:
10337
+ - [ ] {{query_description}} (表: {{table_name}})
10338
+
10339
+ **插入操作**:
10340
+ - [ ] {{insert_description}} (表: {{table_name}})
10341
+
10342
+ **更新操作**:
10343
+ - [ ] {{update_description}} (表: {{table_name}})
10344
+
10345
+ **删除操作**:
10346
+ - [ ] {{delete_description}} (表: {{table_name}})
10347
+ elicit: true
10348
+ owner: scrum-master
10349
+ editors: [scrum-master]
10350
+
10351
+ - id: business-rules
10352
+ title: 业务规则约束
10353
+ instruction: |
10354
+ 列出此用户故事涉及的数据业务规则和约束:
10355
+ - 数据验证规则
10356
+ - 外键约束
10357
+ - 唯一性约束
10358
+ - 业务逻辑约束
10359
+ elicit: true
10360
+ owner: scrum-master
10361
+ editors: [scrum-master]
10362
+
10363
+ - id: api-specifications
10364
+ title: API接口规范
10365
+ instruction: |
10366
+ 基于database-architect创建的API设计,详细定义此用户故事涉及的API接口。
10367
+ 每个接口必须包含完整的接口名称、入参、出参、传参示例和响应示例。
10368
+ elicit: true
10369
+ owner: scrum-master
10370
+ editors: [scrum-master]
10371
+ sections:
10372
+ - id: api-endpoints
10373
+ title: API端点列表
10374
+ instruction: |
10375
+ 列出此用户故事需要实现或调用的所有API端点
10376
+ template: |
10377
+ ### API端点清单
10378
+
10379
+ | 序号 | 接口名称 | HTTP方法 | 路径 | 说明 | 状态 |
10380
+ |------|----------|----------|------|------|------|
10381
+ | 1 | {{api_name}} | {{http_method}} | {{api_path}} | {{description}} | {{status}} |
10382
+ elicit: true
10383
+ owner: scrum-master
10384
+ editors: [scrum-master]
10385
+
10386
+ - id: api-details
10387
+ title: API详细设计
10388
+ instruction: |
10389
+ 为每个API端点提供详细的接口设计,包括:
10390
+ - 接口名称和描述
10391
+ - 请求参数详细说明
10392
+ - 响应数据结构
10393
+ - 请求示例
10394
+ - 响应示例
10395
+ - 错误码定义
10396
+ template: |
10397
+ ### API详细设计
10398
+
10399
+ #### {{api_name}}
10400
+
10401
+ **接口描述**: {{api_description}}
10402
+ **HTTP方法**: {{http_method}}
10403
+ **请求路径**: {{api_path}}
10404
+
10405
+ **请求参数**:
10406
+ ```json
10407
+ {
10408
+ "param1": "string // 参数说明",
10409
+ "param2": "integer // 参数说明",
10410
+ "param3": {
10411
+ "nested_param": "string // 嵌套参数说明"
10412
+ }
10413
+ }
10414
+ ```
10415
+
10416
+ **响应数据结构**:
10417
+ ```json
10418
+ {
10419
+ "code": "integer // 状态码",
10420
+ "message": "string // 响应消息",
10421
+ "data": {
10422
+ "field1": "string // 字段说明",
10423
+ "field2": "integer // 字段说明"
10424
+ }
10425
+ }
10426
+ ```
10427
+
10428
+ **请求示例**:
10429
+ ```bash
10430
+ curl -X {{http_method}} "{{base_url}}{{api_path}}" \
10431
+ -H "Content-Type: application/json" \
10432
+ -H "Authorization: Bearer {{token}}" \
10433
+ -d '{
10434
+ "param1": "示例值",
10435
+ "param2": 123
10436
+ }'
10437
+ ```
10438
+
10439
+ **成功响应示例**:
10440
+ ```json
10441
+ {
10442
+ "code": 200,
10443
+ "message": "操作成功",
10444
+ "data": {
10445
+ "field1": "返回值示例",
10446
+ "field2": 456
10447
+ }
10448
+ }
10449
+ ```
10450
+
10451
+ **错误响应示例**:
10452
+ ```json
10453
+ {
10454
+ "code": 400,
10455
+ "message": "参数错误",
10456
+ "data": null
10457
+ }
10458
+ ```
10459
+
10460
+ **错误码定义**:
10461
+ | 错误码 | 说明 | 处理建议 |
10462
+ |--------|------|----------|
10463
+ | 400 | 参数错误 | 检查请求参数格式 |
10464
+ | 401 | 未授权 | 检查token有效性 |
10465
+ | 404 | 资源不存在 | 检查资源ID |
10466
+ | 500 | 服务器错误 | 联系技术支持 |
10467
+ elicit: true
10468
+ owner: scrum-master
10469
+ editors: [scrum-master]
10470
+
10471
+ - id: data-mapping
10472
+ title: 数据映射关系
10473
+ instruction: |
10474
+ 定义API参数与数据库字段的映射关系
10475
+ template: |
10476
+ ### 数据映射关系
10477
+
10478
+ #### 请求参数 -> 数据库字段映射
10479
+ | API参数 | 数据库表 | 数据库字段 | 数据类型 | 说明 |
10480
+ |---------|----------|------------|----------|------|
10481
+ | {{api_param}} | {{table_name}} | {{db_field}} | {{data_type}} | {{description}} |
10482
+
10483
+ #### 数据库字段 -> 响应参数映射
10484
+ | 数据库表 | 数据库字段 | API响应字段 | 数据类型 | 说明 |
10485
+ |----------|------------|-------------|----------|------|
10486
+ | {{table_name}} | {{db_field}} | {{api_field}} | {{data_type}} | {{description}} |
10487
+ elicit: true
10488
+ owner: scrum-master
10489
+ editors: [scrum-master]
10490
+
10491
+ - id: tasks-subtasks
10492
+ title: 任务 / 子任务
10493
+ type: bullet-list
10494
+ instruction: |
10495
+ 将用户故事分解为实施所需的具体任务和子任务。
10496
+ 在相关处引用适用的验收标准编号。
10497
+ 结合数据库设计和API规范,确保任务覆盖:
10498
+ - 数据库相关操作(Mapper、Service层)
10499
+ - API接口实现(Controller层)
10500
+ - 数据验证和业务逻辑
10501
+ - 单元测试和集成测试
10502
+ template: |
10503
+ ### 后端开发任务
10504
+ - [ ] 数据库相关 (AC: # 如果适用)
10505
+ - [ ] 实现{{entity_name}}Mapper接口方法
10506
+ - [ ] 编写{{entity_name}}Service业务逻辑
10507
+ - [ ] 添加数据验证和业务规则
10508
+ - [ ] API接口实现 (AC: # 如果适用)
10509
+ - [ ] 实现{{api_name}}接口 ({{http_method}} {{api_path}})
10510
+ - [ ] 添加请求参数验证
10511
+ - [ ] 实现响应数据格式化
10512
+ - [ ] 添加异常处理和错误码
10513
+ - [ ] 测试相关 (AC: # 如果适用)
10514
+ - [ ] 编写Service层单元测试
10515
+ - [ ] 编写API接口集成测试
10516
+ - [ ] 数据库操作测试
10517
+ - [ ] 边界条件和异常测试
10518
+
10519
+ ### 前端开发任务(如果需要)
10520
+ - [ ] 前端界面 (AC: # 如果适用)
10521
+ - [ ] 实现相关页面组件
10522
+ - [ ] 集成API调用
10523
+ - [ ] 添加表单验证
10524
+ - [ ] 用户交互和反馈
10525
+ elicit: true
10526
+ owner: scrum-master
10527
+ editors: [scrum-master, dev-agent]
10528
+
10529
+ - id: dev-notes
10530
+ title: 开发者说明
10531
+ instruction: |
10532
+ 填充相关信息,且仅限从 docs 文件夹中的实际工件中提取的、与此用户故事相关的内容:
10533
+ - 数据库设计文档的相关部分
10534
+ - 生成的Entity、Mapper、Service代码位置
10535
+ - API接口设计的相关规范
10536
+ - 架构设计中的相关约束
10537
+ - 与前一个用户故事的关联信息
10538
+ 在此部分提供足够的信息,以确保开发者代理永远不需要阅读完整的设计文档。
10539
+ elicit: true
10540
+ owner: scrum-master
10541
+ editors: [scrum-master]
10542
+ sections:
10543
+ - id: database-context
10544
+ title: 数据库上下文
10545
+ instruction: |
10546
+ 提供数据库相关的开发上下文:
10547
+ - 相关实体类的位置和结构
10548
+ - Mapper接口需要实现的方法
10549
+ - Service层的业务逻辑要求
10550
+ - 数据验证规则
10551
+ elicit: true
10552
+ owner: scrum-master
10553
+ editors: [scrum-master]
10554
+
10555
+ - id: api-context
10556
+ title: API接口上下文
10557
+ instruction: |
10558
+ 提供API接口相关的开发上下文:
10559
+ - Controller类的位置和结构
10560
+ - 接口路径和HTTP方法
10561
+ - 请求响应的数据格式
10562
+ - 错误处理要求
10563
+ elicit: true
10564
+ owner: scrum-master
10565
+ editors: [scrum-master]
10566
+
10567
+ - id: integration-context
10568
+ title: 集成上下文
10569
+ instruction: |
10570
+ 提供系统集成相关的开发上下文:
10571
+ - 与其他模块的接口依赖
10572
+ - 外部系统调用要求
10573
+ - 缓存策略
10574
+ - 事务处理要求
10575
+ elicit: true
10576
+ owner: scrum-master
10577
+ editors: [scrum-master]
10578
+
10579
+ - id: testing-standards
10580
+ title: 测试
10581
+ instruction: |
10582
+ 列出开发者需要遵守的、源自架构文档的相关测试标准:
10583
+ - 测试文件位置
10584
+ - 测试标准
10585
+ - 要使用的测试框架和模式
10586
+ - 针对此用户故事的特定测试要求
10587
+ - 数据库测试和API测试要求
10588
+ elicit: true
10589
+ owner: scrum-master
10590
+ editors: [scrum-master]
10591
+
10592
+ - id: change-log
10593
+ title: 变更日志
10594
+ type: table
10595
+ columns: [日期, 版本, 描述, 作者]
10596
+ instruction: 跟踪此用户故事文档的变更
10597
+ owner: scrum-master
10598
+ editors: [scrum-master, dev-agent, qa-agent]
10599
+
10600
+ - id: dev-agent-record
10601
+ title: 开发者代理记录
10602
+ instruction: 此部分由开发代理在实施过程中填充
10603
+ owner: dev-agent
10604
+ editors: [dev-agent]
10605
+ sections:
10606
+ - id: agent-model
10607
+ title: 使用的代理模型
10608
+ template: "{{agent_model_name_version}}"
10609
+ instruction: 记录用于开发的特定 AI 代理模型和版本
10610
+ owner: dev-agent
10611
+ editors: [dev-agent]
10612
+
10613
+ - id: database-implementation
10614
+ title: 数据库实现记录
10615
+ instruction: |
10616
+ 记录数据库相关的实现细节:
10617
+ - 实现的Mapper方法
10618
+ - Service层业务逻辑
10619
+ - 数据验证实现
10620
+ - 数据库测试结果
10621
+ owner: dev-agent
10622
+ editors: [dev-agent]
10623
+
10624
+ - id: api-implementation
10625
+ title: API实现记录
10626
+ instruction: |
10627
+ 记录API接口的实现细节:
10628
+ - 实现的Controller方法
10629
+ - 参数验证逻辑
10630
+ - 响应格式处理
10631
+ - 错误处理实现
10632
+ - API测试结果
10633
+ owner: dev-agent
10634
+ editors: [dev-agent]
10635
+
10636
+ - id: debug-log-references
10637
+ title: 调试日志参考
10638
+ instruction: 引用开发过程中生成的任何调试日志或跟踪信息
10639
+ owner: dev-agent
10640
+ editors: [dev-agent]
10641
+
10642
+ - id: completion-notes
10643
+ title: 完成说明列表
10644
+ instruction: 关于任务完成情况和遇到的任何问题的说明
10645
+ owner: dev-agent
10646
+ editors: [dev-agent]
10647
+
10648
+ - id: file-list
10649
+ title: 文件列表
10650
+ instruction: |
10651
+ 列出在用户故事实施过程中创建、修改或影响的所有文件,
10652
+ 特别注意数据库和API相关文件:
10653
+ - Entity类文件
10654
+ - Mapper接口和XML文件
10655
+ - Service接口和实现文件
10656
+ - Controller文件
10657
+ - 测试文件
10658
+ owner: dev-agent
10659
+ editors: [dev-agent]
10660
+
10661
+ - id: qa-results
10662
+ title: QA 结果
10663
+ instruction: |
10664
+ QA 代理对已完成的用户故事实施进行 QA 审查的结果,
10665
+ 特别关注:
10666
+ - 数据库操作的正确性
10667
+ - API接口的功能性
10668
+ - 数据一致性验证
10669
+ - 性能测试结果
10670
+ owner: qa-agent
10671
+ editors: [qa-agent]
10672
+ ==================== END: .xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml ====================
10673
+
10674
+ ==================== START: .xiaoma-core/templates/api-design-tmpl.yaml ====================
10675
+ name: API接口设计文档模板
10676
+ version: 1.0.0
10677
+ description: 基于数据库设计的RESTful API接口规范模板
10678
+
10679
+ sections:
10680
+ - id: overview
10681
+ title: API设计概述
10682
+ required: true
10683
+ template: |
10684
+ ## API设计概述
10685
+
10686
+ ### 项目信息
10687
+ - **项目名称**: {project_name}
10688
+ - **API版本**: {api_version}
10689
+ - **设计日期**: {design_date}
10690
+ - **设计人员**: Database Architect
10691
+ - **基础URL**: {base_url}
10692
+
10693
+ ### 设计原则
10694
+ - **RESTful**: 遵循REST架构风格
10695
+ - **统一响应**: 统一的响应数据格式
10696
+ - **版本控制**: 支持API版本管理
10697
+ - **安全性**: 完整的认证和授权机制
10698
+ - **文档化**: 完整的接口文档和示例
10699
+
10700
+ - id: global_standards
10701
+ title: 全局规范
10702
+ required: true
10703
+ template: |
10704
+ ## 全局规范
10705
+
10706
+ ### HTTP状态码规范
10707
+ | 状态码 | 含义 | 使用场景 |
10708
+ |--------|------|----------|
10709
+ | 200 | OK | 请求成功 |
10710
+ | 201 | Created | 资源创建成功 |
10711
+ | 204 | No Content | 删除成功,无返回内容 |
10712
+ | 400 | Bad Request | 请求参数错误 |
10713
+ | 401 | Unauthorized | 未认证 |
10714
+ | 403 | Forbidden | 无权限 |
10715
+ | 404 | Not Found | 资源不存在 |
10716
+ | 409 | Conflict | 资源冲突 |
10717
+ | 422 | Unprocessable Entity | 参数验证失败 |
10718
+ | 500 | Internal Server Error | 服务器内部错误 |
10719
+
10720
+ ### 统一响应格式
10721
+ ```json
10722
+ {
10723
+ "code": "integer // HTTP状态码",
10724
+ "message": "string // 响应消息",
10725
+ "data": "object|array|null // 响应数据",
10726
+ "timestamp": "string // 时间戳",
10727
+ "path": "string // 请求路径"
10728
+ }
10729
+ ```
10730
+
10731
+ ### 分页响应格式
10732
+ ```json
10733
+ {
10734
+ "code": 200,
10735
+ "message": "查询成功",
10736
+ "data": {
10737
+ "records": [], // 数据列表
10738
+ "total": 100, // 总记录数
10739
+ "size": 10, // 每页大小
10740
+ "current": 1, // 当前页码
10741
+ "pages": 10 // 总页数
10742
+ }
10743
+ }
10744
+ ```
10745
+
10746
+ ### 请求头规范
10747
+ | 请求头 | 必填 | 说明 |
10748
+ |--------|------|------|
10749
+ | Content-Type | 是 | application/json |
10750
+ | Authorization | 是 | Bearer {token} |
10751
+ | X-Request-ID | 否 | 请求追踪ID |
10752
+ | Accept-Language | 否 | 语言偏好 |
10753
+
10754
+ ### 错误响应格式
10755
+ ```json
10756
+ {
10757
+ "code": 400,
10758
+ "message": "参数验证失败",
10759
+ "data": {
10760
+ "errors": [
10761
+ {
10762
+ "field": "username",
10763
+ "message": "用户名不能为空"
10764
+ }
10765
+ ]
10766
+ },
10767
+ "timestamp": "2024-01-01T12:00:00Z",
10768
+ "path": "/api/users"
10769
+ }
10770
+ ```
10771
+
10772
+ - id: authentication
10773
+ title: 认证授权
10774
+ required: true
10775
+ template: |
10776
+ ## 认证授权
10777
+
10778
+ ### JWT Token规范
10779
+ ```
10780
+ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
10781
+ ```
10782
+
10783
+ ### Token结构
10784
+ ```json
10785
+ {
10786
+ "header": {
10787
+ "alg": "HS256",
10788
+ "typ": "JWT"
10789
+ },
10790
+ "payload": {
10791
+ "sub": "user_id",
10792
+ "username": "johndoe",
10793
+ "roles": ["USER", "ADMIN"],
10794
+ "exp": 1640995200,
10795
+ "iat": 1640908800
10796
+ }
10797
+ }
10798
+ ```
10799
+
10800
+ ### 权限控制
10801
+ | 角色 | 权限描述 | 可访问资源 |
10802
+ |------|----------|------------|
10803
+ | ADMIN | 管理员权限 | 所有资源 |
10804
+ | USER | 普通用户权限 | 用户相关资源 |
10805
+ | GUEST | 访客权限 | 公开资源 |
10806
+
10807
+ - id: api_endpoints
10808
+ title: API端点设计
10809
+ required: true
10810
+ template: |
10811
+ ## API端点设计
10812
+
10813
+ {for_each_entity}
10814
+ ### {entity_name} API
10815
+
10816
+ #### 基础信息
10817
+ - **资源名称**: {entity_name}
10818
+ - **数据库表**: {table_name}
10819
+ - **基础路径**: /api/{entity_lowercase}
10820
+
10821
+ #### 端点列表
10822
+ | HTTP方法 | 路径 | 操作 | 说明 |
10823
+ |----------|------|------|------|
10824
+ | GET | /api/{entity_lowercase} | 查询列表 | 分页查询{entity_name}列表 |
10825
+ | GET | /api/{entity_lowercase}/{id} | 查询详情 | 根据ID查询{entity_name}详情 |
10826
+ | POST | /api/{entity_lowercase} | 创建 | 创建新的{entity_name} |
10827
+ | PUT | /api/{entity_lowercase}/{id} | 更新 | 更新{entity_name}信息 |
10828
+ | DELETE | /api/{entity_lowercase}/{id} | 删除 | 删除{entity_name} |
10829
+
10830
+ #### 1. 查询{entity_name}列表
10831
+
10832
+ **接口描述**: 分页查询{entity_name}列表,支持条件筛选
10833
+ **HTTP方法**: GET
10834
+ **请求路径**: /api/{entity_lowercase}
10835
+ **权限要求**: {required_permissions}
10836
+
10837
+ **请求参数**:
10838
+ ```
10839
+ Query Parameters:
10840
+ - page: integer (可选, 默认1) // 页码
10841
+ - size: integer (可选, 默认10) // 每页大小
10842
+ - sort: string (可选) // 排序字段,格式:field,direction
10843
+ {query_parameters}
10844
+ ```
10845
+
10846
+ **请求示例**:
10847
+ ```bash
10848
+ curl -X GET "{base_url}/api/{entity_lowercase}?page=1&size=10&sort=createdAt,desc" \
10849
+ -H "Authorization: Bearer {token}" \
10850
+ -H "Content-Type: application/json"
10851
+ ```
10852
+
10853
+ **成功响应** (200):
10854
+ ```json
10855
+ {
10856
+ "code": 200,
10857
+ "message": "查询成功",
10858
+ "data": {
10859
+ "records": [
10860
+ {
10861
+ {response_fields}
10862
+ }
10863
+ ],
10864
+ "total": 100,
10865
+ "size": 10,
10866
+ "current": 1,
10867
+ "pages": 10
10868
+ },
10869
+ "timestamp": "2024-01-01T12:00:00Z",
10870
+ "path": "/api/{entity_lowercase}"
10871
+ }
10872
+ ```
10873
+
10874
+ #### 2. 查询{entity_name}详情
10875
+
10876
+ **接口描述**: 根据ID查询{entity_name}详细信息
10877
+ **HTTP方法**: GET
10878
+ **请求路径**: /api/{entity_lowercase}/{id}
10879
+ **权限要求**: {required_permissions}
10880
+
10881
+ **路径参数**:
10882
+ ```
10883
+ - id: integer (必填) // {entity_name}的唯一标识
10884
+ ```
10885
+
10886
+ **请求示例**:
10887
+ ```bash
10888
+ curl -X GET "{base_url}/api/{entity_lowercase}/123" \
10889
+ -H "Authorization: Bearer {token}" \
10890
+ -H "Content-Type: application/json"
10891
+ ```
10892
+
10893
+ **成功响应** (200):
10894
+ ```json
10895
+ {
10896
+ "code": 200,
10897
+ "message": "查询成功",
10898
+ "data": {
10899
+ {detail_response_fields}
10900
+ },
10901
+ "timestamp": "2024-01-01T12:00:00Z",
10902
+ "path": "/api/{entity_lowercase}/123"
10903
+ }
10904
+ ```
10905
+
10906
+ **错误响应** (404):
10907
+ ```json
10908
+ {
10909
+ "code": 404,
10910
+ "message": "{entity_name}不存在",
10911
+ "data": null,
10912
+ "timestamp": "2024-01-01T12:00:00Z",
10913
+ "path": "/api/{entity_lowercase}/123"
10914
+ }
10915
+ ```
10916
+
10917
+ #### 3. 创建{entity_name}
10918
+
10919
+ **接口描述**: 创建新的{entity_name}记录
10920
+ **HTTP方法**: POST
10921
+ **请求路径**: /api/{entity_lowercase}
10922
+ **权限要求**: {required_permissions}
10923
+
10924
+ **请求体**:
10925
+ ```json
10926
+ {
10927
+ {create_request_fields}
10928
+ }
10929
+ ```
10930
+
10931
+ **请求示例**:
10932
+ ```bash
10933
+ curl -X POST "{base_url}/api/{entity_lowercase}" \
10934
+ -H "Authorization: Bearer {token}" \
10935
+ -H "Content-Type: application/json" \
10936
+ -d '{
10937
+ {create_request_example}
10938
+ }'
10939
+ ```
10940
+
10941
+ **成功响应** (201):
10942
+ ```json
10943
+ {
10944
+ "code": 201,
10945
+ "message": "创建成功",
10946
+ "data": {
10947
+ {create_response_fields}
10948
+ },
10949
+ "timestamp": "2024-01-01T12:00:00Z",
10950
+ "path": "/api/{entity_lowercase}"
10951
+ }
10952
+ ```
10953
+
10954
+ **参数验证失败** (422):
10955
+ ```json
10956
+ {
10957
+ "code": 422,
10958
+ "message": "参数验证失败",
10959
+ "data": {
10960
+ "errors": [
10961
+ {
10962
+ "field": "{field_name}",
10963
+ "message": "{validation_message}"
10964
+ }
10965
+ ]
10966
+ },
10967
+ "timestamp": "2024-01-01T12:00:00Z",
10968
+ "path": "/api/{entity_lowercase}"
10969
+ }
10970
+ ```
10971
+
10972
+ #### 4. 更新{entity_name}
10973
+
10974
+ **接口描述**: 更新{entity_name}信息
10975
+ **HTTP方法**: PUT
10976
+ **请求路径**: /api/{entity_lowercase}/{id}
10977
+ **权限要求**: {required_permissions}
10978
+
10979
+ **路径参数**:
10980
+ ```
10981
+ - id: integer (必填) // {entity_name}的唯一标识
10982
+ ```
10983
+
10984
+ **请求体**:
10985
+ ```json
10986
+ {
10987
+ {update_request_fields}
10988
+ }
10989
+ ```
10990
+
10991
+ **请求示例**:
10992
+ ```bash
10993
+ curl -X PUT "{base_url}/api/{entity_lowercase}/123" \
10994
+ -H "Authorization: Bearer {token}" \
10995
+ -H "Content-Type: application/json" \
10996
+ -d '{
10997
+ {update_request_example}
10998
+ }'
10999
+ ```
11000
+
11001
+ **成功响应** (200):
11002
+ ```json
11003
+ {
11004
+ "code": 200,
11005
+ "message": "更新成功",
11006
+ "data": {
11007
+ {update_response_fields}
11008
+ },
11009
+ "timestamp": "2024-01-01T12:00:00Z",
11010
+ "path": "/api/{entity_lowercase}/123"
11011
+ }
11012
+ ```
11013
+
11014
+ #### 5. 删除{entity_name}
11015
+
11016
+ **接口描述**: 删除{entity_name}记录(软删除)
11017
+ **HTTP方法**: DELETE
11018
+ **请求路径**: /api/{entity_lowercase}/{id}
11019
+ **权限要求**: {required_permissions}
11020
+
11021
+ **路径参数**:
11022
+ ```
11023
+ - id: integer (必填) // {entity_name}的唯一标识
11024
+ ```
11025
+
11026
+ **请求示例**:
11027
+ ```bash
11028
+ curl -X DELETE "{base_url}/api/{entity_lowercase}/123" \
11029
+ -H "Authorization: Bearer {token}" \
11030
+ -H "Content-Type: application/json"
11031
+ ```
11032
+
11033
+ **成功响应** (204):
11034
+ ```
11035
+ HTTP/1.1 204 No Content
11036
+ ```
11037
+
11038
+ **错误响应** (404):
11039
+ ```json
11040
+ {
11041
+ "code": 404,
11042
+ "message": "{entity_name}不存在",
11043
+ "data": null,
11044
+ "timestamp": "2024-01-01T12:00:00Z",
11045
+ "path": "/api/{entity_lowercase}/123"
11046
+ }
11047
+ ```
11048
+
11049
+ #### 数据字段映射
11050
+
11051
+ **数据库字段 -> API响应字段映射**:
11052
+ | 数据库字段 | API字段 | 数据类型 | 说明 |
11053
+ |------------|---------|----------|------|
11054
+ {field_mappings}
11055
+
11056
+ **API请求字段 -> 数据库字段映射**:
11057
+ | API字段 | 数据库字段 | 数据类型 | 验证规则 |
11058
+ |---------|------------|----------|----------|
11059
+ {request_field_mappings}
11060
+
11061
+ #### 业务规则说明
11062
+ {business_rules}
11063
+
11064
+ {end_for_each}
11065
+
11066
+ - id: data_types
11067
+ title: 数据类型规范
11068
+ required: true
11069
+ template: |
11070
+ ## 数据类型规范
11071
+
11072
+ ### 基础数据类型
11073
+ | API类型 | JSON类型 | 数据库类型 | 说明 | 示例 |
11074
+ |---------|----------|------------|------|------|
11075
+ | integer | number | INT/BIGINT | 整数 | 123 |
11076
+ | decimal | number | DECIMAL | 小数 | 123.45 |
11077
+ | string | string | VARCHAR/TEXT | 字符串 | "hello" |
11078
+ | boolean | boolean | TINYINT | 布尔值 | true/false |
11079
+ | datetime | string | DATETIME | 日期时间 | "2024-01-01T12:00:00Z" |
11080
+ | date | string | DATE | 日期 | "2024-01-01" |
11081
+ | time | string | TIME | 时间 | "12:00:00" |
11082
+ | array | array | JSON | 数组 | [1,2,3] |
11083
+ | object | object | JSON | 对象 | {"key":"value"} |
11084
+
11085
+ ### 特殊字段规范
11086
+ | 字段类型 | 字段名 | 数据类型 | 说明 |
11087
+ |----------|--------|----------|------|
11088
+ | 主键 | id | integer | 自增主键 |
11089
+ | 创建时间 | createdAt | datetime | 记录创建时间 |
11090
+ | 更新时间 | updatedAt | datetime | 记录更新时间 |
11091
+ | 删除时间 | deletedAt | datetime | 软删除时间 |
11092
+ | 版本号 | version | integer | 乐观锁版本 |
11093
+
11094
+ ### 日期时间格式
11095
+ - **标准格式**: ISO 8601 (2024-01-01T12:00:00Z)
11096
+ - **时区**: UTC时间
11097
+ - **精度**: 秒级
11098
+
11099
+ - id: validation_rules
11100
+ title: 参数验证规则
11101
+ required: true
11102
+ template: |
11103
+ ## 参数验证规则
11104
+
11105
+ ### 通用验证规则
11106
+ | 规则类型 | 说明 | 示例 |
11107
+ |----------|------|------|
11108
+ | required | 必填字段 | @NotNull, @NotBlank |
11109
+ | length | 长度限制 | @Size(min=1, max=50) |
11110
+ | pattern | 格式验证 | @Pattern(regexp="^[a-zA-Z0-9]+$") |
11111
+ | range | 数值范围 | @Min(0), @Max(100) |
11112
+ | email | 邮箱格式 | @Email |
11113
+ | phone | 手机号格式 | @Pattern(regexp="^1[3-9]\\d{9}$") |
11114
+
11115
+ ### 业务验证规则
11116
+ {business_validation_rules}
11117
+
11118
+ ### 错误信息国际化
11119
+ ```properties
11120
+ validation.required=字段不能为空
11121
+ validation.length=字段长度必须在{min}到{max}之间
11122
+ validation.pattern=字段格式不正确
11123
+ validation.email=邮箱格式不正确
11124
+ validation.phone=手机号格式不正确
11125
+ ```
11126
+
11127
+ - id: error_codes
11128
+ title: 错误码定义
11129
+ required: true
11130
+ template: |
11131
+ ## 错误码定义
11132
+
11133
+ ### 系统级错误码 (1000-1999)
11134
+ | 错误码 | 错误信息 | 说明 | 处理建议 |
11135
+ |--------|----------|------|----------|
11136
+ | 1000 | 系统错误 | 未知系统错误 | 联系技术支持 |
11137
+ | 1001 | 参数错误 | 请求参数不正确 | 检查参数格式 |
11138
+ | 1002 | 认证失败 | 身份认证失败 | 重新登录 |
11139
+ | 1003 | 权限不足 | 无访问权限 | 联系管理员 |
11140
+ | 1004 | 资源不存在 | 请求的资源不存在 | 检查资源ID |
11141
+ | 1005 | 资源冲突 | 资源已存在或冲突 | 检查数据唯一性 |
11142
+
11143
+ ### 业务级错误码 (2000+)
11144
+ {business_error_codes}
11145
+
11146
+ ### 错误响应示例
11147
+ ```json
11148
+ {
11149
+ "code": 1001,
11150
+ "message": "参数错误",
11151
+ "data": {
11152
+ "errorCode": "PARAM_INVALID",
11153
+ "errorDetails": "用户名格式不正确"
11154
+ },
11155
+ "timestamp": "2024-01-01T12:00:00Z",
11156
+ "path": "/api/users"
11157
+ }
11158
+ ```
11159
+
11160
+ - id: performance
11161
+ title: 性能规范
11162
+ required: true
11163
+ template: |
11164
+ ## 性能规范
11165
+
11166
+ ### 响应时间要求
11167
+ | 接口类型 | 响应时间要求 | 说明 |
11168
+ |----------|--------------|------|
11169
+ | 查询接口 | < 200ms | 简单查询 |
11170
+ | 复杂查询 | < 1s | 包含关联查询 |
11171
+ | 创建接口 | < 500ms | 数据创建 |
11172
+ | 更新接口 | < 500ms | 数据更新 |
11173
+ | 删除接口 | < 300ms | 数据删除 |
11174
+
11175
+ ### 分页限制
11176
+ - 默认页大小: 10
11177
+ - 最大页大小: 100
11178
+ - 支持的排序字段: {sortable_fields}
11179
+
11180
+ ### 缓存策略
11181
+ | 数据类型 | 缓存时间 | 缓存键规则 |
11182
+ |----------|----------|------------|
11183
+ | 用户信息 | 30分钟 | user:{user_id} |
11184
+ | 配置信息 | 1小时 | config:{config_key} |
11185
+ | 静态数据 | 24小时 | static:{data_type} |
11186
+
11187
+ - id: security
11188
+ title: 安全规范
11189
+ required: true
11190
+ template: |
11191
+ ## 安全规范
11192
+
11193
+ ### 数据安全
11194
+ - **敏感数据加密**: 密码、身份证号等
11195
+ - **数据脱敏**: 日志中的敏感信息
11196
+ - **SQL注入防护**: 使用参数化查询
11197
+ - **XSS防护**: 输入数据过滤和转义
11198
+
11199
+ ### 接口安全
11200
+ - **HTTPS传输**: 强制使用HTTPS
11201
+ - **请求签名**: 关键接口要求签名验证
11202
+ - **频率限制**: 防止恶意请求
11203
+ - **IP白名单**: 敏感接口IP限制
11204
+
11205
+ ### 认证安全
11206
+ - **Token过期**: JWT token有效期控制
11207
+ - **刷新机制**: Token自动刷新
11208
+ - **会话管理**: 用户会话状态管理
11209
+ - **密码策略**: 密码复杂度要求
11210
+
11211
+ - id: testing
11212
+ title: 测试规范
11213
+ required: true
11214
+ template: |
11215
+ ## 测试规范
11216
+
11217
+ ### API测试用例
11218
+
11219
+ **测试用例模板**:
11220
+ ```yaml
11221
+ test_case:
11222
+ name: "创建用户成功"
11223
+ method: POST
11224
+ url: "/api/users"
11225
+ headers:
11226
+ Authorization: "Bearer {valid_token}"
11227
+ Content-Type: "application/json"
11228
+ body:
11229
+ username: "testuser"
11230
+ email: "test@example.com"
11231
+ password: "Test123456!"
11232
+ expected:
11233
+ status: 201
11234
+ body:
11235
+ code: 201
11236
+ message: "创建成功"
11237
+ data:
11238
+ id: "{integer}"
11239
+ username: "testuser"
11240
+ email: "test@example.com"
11241
+ ```
11242
+
11243
+ ### 测试数据
11244
+ ```yaml
11245
+ test_data:
11246
+ valid_user:
11247
+ username: "validuser"
11248
+ email: "valid@example.com"
11249
+ password: "Valid123456!"
11250
+ invalid_user:
11251
+ username: "" # 空用户名
11252
+ email: "invalid-email" # 无效邮箱
11253
+ password: "123" # 密码过短
11254
+ ```
11255
+
11256
+ ### 性能测试
11257
+ - **并发用户数**: 100
11258
+ - **测试时长**: 10分钟
11259
+ - **响应时间**: 95%请求 < 1s
11260
+ - **成功率**: > 99.9%
11261
+
11262
+ - id: documentation
11263
+ title: 文档规范
11264
+ required: true
11265
+ template: |
11266
+ ## 文档规范
11267
+
11268
+ ### Swagger/OpenAPI规范
11269
+ ```yaml
11270
+ openapi: 3.0.0
11271
+ info:
11272
+ title: {project_name} API
11273
+ version: {api_version}
11274
+ description: {project_description}
11275
+ servers:
11276
+ - url: {base_url}
11277
+ description: 生产环境
11278
+ paths:
11279
+ /api/{entity_lowercase}:
11280
+ get:
11281
+ summary: 查询{entity_name}列表
11282
+ tags: [{entity_name}]
11283
+ parameters:
11284
+ - name: page
11285
+ in: query
11286
+ schema:
11287
+ type: integer
11288
+ default: 1
11289
+ responses:
11290
+ '200':
11291
+ description: 查询成功
11292
+ content:
11293
+ application/json:
11294
+ schema:
11295
+ $ref: '#/components/schemas/PageResult'
11296
+ ```
11297
+
11298
+ ### 接口文档要求
11299
+ - **完整性**: 包含所有接口信息
11300
+ - **准确性**: 与实际实现保持一致
11301
+ - **实时性**: 及时更新文档内容
11302
+ - **可读性**: 清晰的描述和示例
11303
+
11304
+ ### 示例代码
11305
+ ```javascript
11306
+ // JavaScript调用示例
11307
+ const response = await fetch('/api/users', {
11308
+ method: 'POST',
11309
+ headers: {
11310
+ 'Content-Type': 'application/json',
11311
+ 'Authorization': 'Bearer ' + token
11312
+ },
11313
+ body: JSON.stringify({
11314
+ username: 'johndoe',
11315
+ email: 'john@example.com'
11316
+ })
11317
+ });
11318
+ const result = await response.json();
11319
+ ```
11320
+
11321
+ - id: versioning
11322
+ title: 版本管理
11323
+ required: true
11324
+ template: |
11325
+ ## 版本管理
11326
+
11327
+ ### 版本号规范
11328
+ - **格式**: v{major}.{minor}.{patch}
11329
+ - **示例**: v1.0.0, v1.1.0, v2.0.0
11330
+
11331
+ ### 版本策略
11332
+ | 版本类型 | 变更说明 | 兼容性 |
11333
+ |----------|----------|--------|
11334
+ | Major | 重大功能变更,API不兼容 | 不兼容 |
11335
+ | Minor | 新增功能,向后兼容 | 向后兼容 |
11336
+ | Patch | Bug修复,向后兼容 | 向后兼容 |
11337
+
11338
+ ### 版本控制方式
11339
+ 1. **URL路径版本**: /api/v1/users
11340
+ 2. **请求头版本**: API-Version: v1
11341
+ 3. **参数版本**: /api/users?version=v1
11342
+
11343
+ ### 版本生命周期
11344
+ - **开发版本**: v1.0.0-dev
11345
+ - **测试版本**: v1.0.0-beta
11346
+ - **发布版本**: v1.0.0
11347
+ - **废弃版本**: 提前3个月通知
11348
+
11349
+ - id: changelog
11350
+ title: 变更记录
11351
+ required: true
11352
+ template: |
11353
+ ## 变更记录
11354
+
11355
+ ### v1.0.0 (2024-01-01)
11356
+ **新增功能**:
11357
+ - 初始API设计
11358
+ - 用户管理接口
11359
+ - 认证授权机制
11360
+
11361
+ **修复问题**:
11362
+ - 无
11363
+
11364
+ **破坏性变更**:
11365
+ - 无
11366
+
11367
+ ### 变更记录模板
11368
+ ```markdown
11369
+ ### v{version} ({date})
11370
+ **新增功能**:
11371
+ - 功能描述
11372
+
11373
+ **修复问题**:
11374
+ - 问题描述
11375
+
11376
+ **破坏性变更**:
11377
+ - 变更描述
11378
+ ```
11379
+ ==================== END: .xiaoma-core/templates/api-design-tmpl.yaml ====================
11380
+
9628
11381
  ==================== START: .xiaoma-core/checklists/story-draft-checklist.md ====================
9629
11382
  <!-- Powered by XiaoMa™ Core -->
9630
11383
 
@@ -11924,15 +13677,22 @@ workflow:
11924
13677
  Creates organized story structure.
11925
13678
 
11926
13679
  - agent: sm
11927
- action: create_story
13680
+ action: create_enhanced_story_with_database
11928
13681
  creates: story.md
11929
- requires: sharded_docs
13682
+ requires:
13683
+ - sharded_docs
13684
+ - database-design.md
13685
+ - generated-code/
11930
13686
  repeats: for_each_epic
13687
+ template: enhanced-story-with-database-tmpl.yaml
11931
13688
  notes: |
11932
- Story creation with database context:
11933
- - Include relevant database tables
11934
- - Reference generated code
11935
- - Include API endpoints
13689
+ Enhanced story creation with comprehensive database and API integration:
13690
+ - Use enhanced-story-with-database-tmpl.yaml template
13691
+ - Include detailed database entity mappings
13692
+ - Define complete API specifications with request/response examples
13693
+ - Reference generated entity classes and mappers
13694
+ - Provide data mapping relationships
13695
+ - Include comprehensive testing requirements
11936
13696
  Story starts in "Draft" status
11937
13697
 
11938
13698
  - agent: dev
@@ -12039,6 +13799,340 @@ workflow:
12039
13799
  complete: "Project planning complete with database design and code generation. Ready for development."
12040
13800
  ==================== END: .xiaoma-core/workflows/enhanced-fullstack-with-database.yaml ====================
12041
13801
 
13802
+ ==================== START: .xiaoma-core/workflows/automated-story-development.yaml ====================
13803
+ # <!-- Powered by XIAOMA™ Core -->
13804
+ workflow:
13805
+ id: automated-story-development
13806
+ name: 自动化用户故事开发流程
13807
+ description: >-
13808
+ 完全自动化的用户故事开发流程,从故事创建到测试完成的端到端自动化。
13809
+ 包含故事验证、代码开发、自测、QA测试等完整环节,每个环节都有严格的通过标准。
13810
+ type: automated-development
13811
+ project_types:
13812
+ - web-app
13813
+ - saas
13814
+ - enterprise-app
13815
+ - api-first
13816
+
13817
+ sequence:
13818
+ - step: story_development_cycle
13819
+ action: repeat_until_all_stories_complete
13820
+ condition: has_pending_stories
13821
+ notes: "重复执行用户故事开发循环直到所有故事开发完成"
13822
+
13823
+ cycle_steps:
13824
+ # 第1步:SM创建用户故事
13825
+ - agent: sm
13826
+ action: create_next_story
13827
+ creates: story.md
13828
+ requires:
13829
+ - epic-shards
13830
+ - database-design.md
13831
+ - generated-code/
13832
+ validation_criteria:
13833
+ - story_format_valid
13834
+ - database_entities_defined
13835
+ - api_specifications_complete
13836
+ - acceptance_criteria_clear
13837
+ on_failure:
13838
+ action: retry_creation
13839
+ max_retries: 3
13840
+ on_success:
13841
+ action: proceed_to_validation
13842
+ notes: |
13843
+ 创建下一个用户故事:
13844
+ - 使用enhanced-story-with-database模板
13845
+ - 包含完整的数据库和API设计
13846
+ - 设置故事状态为 "Draft"
13847
+ - 必须通过格式和完整性验证
13848
+
13849
+ # 第2步:PO验证用户故事
13850
+ - agent: po
13851
+ action: validate_story_draft
13852
+ requires: story.md
13853
+ validation_criteria:
13854
+ - business_requirements_met
13855
+ - acceptance_criteria_testable
13856
+ - database_design_consistent
13857
+ - api_specifications_complete
13858
+ - story_estimation_reasonable
13859
+ on_failure:
13860
+ action: fix_story_issues
13861
+ retry_with: sm
13862
+ max_iterations: 3
13863
+ on_success:
13864
+ action: approve_story
13865
+ status_change: "Draft -> Approved"
13866
+ notes: |
13867
+ 验证用户故事质量:
13868
+ - 业务需求符合PRD要求
13869
+ - 验收标准可测试
13870
+ - 数据库设计一致性
13871
+ - API规范完整性
13872
+ - 故事规模合理性
13873
+ - 验证通过后状态变更为 "Approved"
13874
+
13875
+ # 第3步:Dev开发用户故事
13876
+ - agent: dev
13877
+ action: develop_story
13878
+ requires:
13879
+ - story.md (status: Approved)
13880
+ - database-design.md
13881
+ - generated-code/
13882
+ validation_criteria:
13883
+ - code_implementation_complete
13884
+ - database_operations_working
13885
+ - api_endpoints_functional
13886
+ - business_logic_correct
13887
+ - unit_tests_passing
13888
+ sub_steps:
13889
+ - implement_database_layer
13890
+ - implement_business_logic
13891
+ - implement_api_endpoints
13892
+ - write_unit_tests
13893
+ - run_self_tests
13894
+ on_failure:
13895
+ action: fix_implementation
13896
+ max_iterations: 5
13897
+ on_success:
13898
+ action: mark_for_review
13899
+ status_change: "Approved -> InProgress -> Review"
13900
+ notes: |
13901
+ 开发用户故事实现:
13902
+ - 实现数据库操作层(Mapper/Repository)
13903
+ - 实现业务逻辑层(Service)
13904
+ - 实现API接口层(Controller)
13905
+ - 编写单元测试
13906
+ - 执行自测验证
13907
+ - 所有测试通过后状态变更为 "Review"
13908
+
13909
+ # 第4步:Dev自测验证
13910
+ - agent: dev
13911
+ action: run_self_tests
13912
+ requires: implementation_files
13913
+ test_types:
13914
+ - unit_tests
13915
+ - integration_tests
13916
+ - api_tests
13917
+ - database_tests
13918
+ validation_criteria:
13919
+ - all_tests_passing
13920
+ - code_coverage_adequate
13921
+ - performance_acceptable
13922
+ - no_critical_issues
13923
+ on_failure:
13924
+ action: fix_and_retest
13925
+ loop_until: all_tests_pass
13926
+ on_success:
13927
+ action: ready_for_qa
13928
+ notes: |
13929
+ 开发者自测验证:
13930
+ - 运行所有单元测试
13931
+ - 运行集成测试
13932
+ - 验证API功能
13933
+ - 测试数据库操作
13934
+ - 检查代码覆盖率
13935
+ - 性能基准测试
13936
+
13937
+ # 第5步:QA测试验证
13938
+ - agent: qa
13939
+ action: review_story_implementation
13940
+ requires:
13941
+ - story.md (status: Review)
13942
+ - implementation_files
13943
+ - test_results
13944
+ validation_criteria:
13945
+ - functional_requirements_met
13946
+ - acceptance_criteria_satisfied
13947
+ - api_contracts_valid
13948
+ - data_integrity_maintained
13949
+ - error_handling_proper
13950
+ - performance_requirements_met
13951
+ test_types:
13952
+ - functional_testing
13953
+ - api_contract_testing
13954
+ - data_validation_testing
13955
+ - error_scenario_testing
13956
+ - performance_testing
13957
+ on_failure:
13958
+ action: report_issues_to_dev
13959
+ assign_to: dev
13960
+ status_change: "Review -> InProgress"
13961
+ loop_until: issues_resolved
13962
+ on_success:
13963
+ action: mark_story_complete
13964
+ status_change: "Review -> Done"
13965
+ notes: |
13966
+ QA测试验证:
13967
+ - 功能需求验证
13968
+ - 验收标准检查
13969
+ - API契约测试
13970
+ - 数据完整性测试
13971
+ - 错误处理测试
13972
+ - 性能要求验证
13973
+ - 通过后状态变更为 "Done"
13974
+
13975
+ # 循环条件检查
13976
+ - step: check_completion
13977
+ action: evaluate_project_status
13978
+ conditions:
13979
+ all_stories_done: "所有用户故事状态为Done"
13980
+ no_blocking_issues: "没有阻塞性问题"
13981
+ on_complete:
13982
+ action: finalize_development
13983
+ create: development-completion-report.md
13984
+ on_continue:
13985
+ action: start_next_cycle
13986
+ notes: "检查是否所有故事都已完成开发"
13987
+
13988
+ # 状态管理
13989
+ story_states:
13990
+ - Draft: "故事已创建,等待验证"
13991
+ - Approved: "故事已验证,可以开发"
13992
+ - InProgress: "正在开发中"
13993
+ - Review: "开发完成,等待测试"
13994
+ - Done: "所有工作完成"
13995
+
13996
+ # 质量门控
13997
+ quality_gates:
13998
+ story_creation:
13999
+ required_sections:
14000
+ - 用户故事
14001
+ - 验收标准
14002
+ - 数据库设计相关
14003
+ - API接口规范
14004
+ - 任务分解
14005
+ validation_rules:
14006
+ - 所有必填字段完整
14007
+ - API规范包含完整示例
14008
+ - 数据库实体映射正确
14009
+ - 验收标准可测试
14010
+
14011
+ story_validation:
14012
+ criteria:
14013
+ - business_alignment: "与业务需求对齐"
14014
+ - technical_feasibility: "技术实现可行"
14015
+ - testability: "可测试性充分"
14016
+ - scope_appropriate: "范围适当"
14017
+ validation_checklist: po-story-validation-checklist.md
14018
+
14019
+ development_completion:
14020
+ criteria:
14021
+ - functionality_implemented: "功能完全实现"
14022
+ - tests_passing: "所有测试通过"
14023
+ - code_quality: "代码质量达标"
14024
+ - documentation_updated: "文档已更新"
14025
+ validation_checklist: dev-completion-checklist.md
14026
+
14027
+ qa_approval:
14028
+ criteria:
14029
+ - acceptance_criteria_met: "验收标准满足"
14030
+ - regression_tests_passed: "回归测试通过"
14031
+ - performance_acceptable: "性能可接受"
14032
+ - security_validated: "安全性验证"
14033
+ validation_checklist: qa-approval-checklist.md
14034
+
14035
+ # 错误处理和重试策略
14036
+ error_handling:
14037
+ story_creation_failure:
14038
+ max_retries: 3
14039
+ escalation: "通知项目经理"
14040
+
14041
+ validation_failure:
14042
+ action: "返回SM修正故事"
14043
+ tracking: "记录问题详情"
14044
+
14045
+ development_failure:
14046
+ action: "开发者自行修复"
14047
+ max_attempts: 5
14048
+ escalation: "超过尝试次数通知架构师"
14049
+
14050
+ qa_failure:
14051
+ action: "返回开发者修复"
14052
+ impact_analysis: "评估对其他故事的影响"
14053
+
14054
+ # 进度追踪
14055
+ progress_tracking:
14056
+ metrics:
14057
+ - stories_created
14058
+ - stories_approved
14059
+ - stories_in_development
14060
+ - stories_in_review
14061
+ - stories_completed
14062
+ - cycle_time_per_story
14063
+ - defect_rate
14064
+ - rework_rate
14065
+
14066
+ reporting:
14067
+ frequency: "每个故事完成后"
14068
+ format: "markdown报告"
14069
+ location: "docs/reports/"
14070
+
14071
+ # 自动化流程图
14072
+ flow_diagram: |
14073
+ ```mermaid
14074
+ graph TD
14075
+ A[开始] --> B[SM: 创建用户故事]
14076
+ B --> C{故事格式验证}
14077
+ C -->|失败| B
14078
+ C -->|通过| D[PO: 验证故事草稿]
14079
+ D --> E{业务验证}
14080
+ E -->|失败| F[修复故事]
14081
+ F --> D
14082
+ E -->|通过| G[状态: Draft -> Approved]
14083
+ G --> H[Dev: 开发用户故事]
14084
+ H --> I[实现数据库层]
14085
+ I --> J[实现业务逻辑]
14086
+ J --> K[实现API接口]
14087
+ K --> L[编写单元测试]
14088
+ L --> M[Dev: 运行自测]
14089
+ M --> N{自测结果}
14090
+ N -->|失败| O[修复代码]
14091
+ O --> M
14092
+ N -->|通过| P[状态: Approved -> Review]
14093
+ P --> Q[QA: 测试验证]
14094
+ Q --> R{QA测试结果}
14095
+ R -->|失败| S[报告问题给Dev]
14096
+ S --> T[状态: Review -> InProgress]
14097
+ T --> H
14098
+ R -->|通过| U[状态: Review -> Done]
14099
+ U --> V{还有待开发故事?}
14100
+ V -->|是| B
14101
+ V -->|否| W[完成所有开发]
14102
+
14103
+ style B fill:#FFE4B5
14104
+ style D fill:#ADD8E6
14105
+ style H fill:#98FB98
14106
+ style M fill:#F0E68C
14107
+ style Q fill:#DDA0DD
14108
+ style W fill:#90EE90
14109
+ ```
14110
+
14111
+ # 决策指导
14112
+ decision_guidance:
14113
+ when_to_use:
14114
+ - 需要完全自动化的开发流程
14115
+ - 多个用户故事需要批量开发
14116
+ - 严格的质量控制要求
14117
+ - 团队协作需要标准化流程
14118
+
14119
+ prerequisites:
14120
+ - 已完成数据库设计
14121
+ - 已生成基础代码框架
14122
+ - 已定义完整的Epic和故事
14123
+ - 测试环境已准备就绪
14124
+
14125
+ # 流程交接提示
14126
+ handoff_prompts:
14127
+ start_automation: "开始自动化用户故事开发流程..."
14128
+ story_created: "用户故事已创建,等待PO验证..."
14129
+ story_approved: "用户故事已通过验证,开始开发..."
14130
+ development_complete: "开发完成,开始QA测试..."
14131
+ qa_passed: "QA测试通过,故事开发完成。"
14132
+ cycle_complete: "当前故事完成,检查是否有下一个故事..."
14133
+ all_complete: "🎉 所有用户故事开发完成!项目开发阶段结束。"
14134
+ ==================== END: .xiaoma-core/workflows/automated-story-development.yaml ====================
14135
+
12042
14136
  ==================== START: .xiaoma-core/workflows/brownfield-fullstack.yaml ====================
12043
14137
  # <!-- Powered by XIAOMA™ Core -->
12044
14138
  workflow: