@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.
- 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
- 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
- package/dist/agents/analyst.txt +1 -1
- package/dist/agents/architect.txt +5 -5
- package/dist/agents/automation-orchestrator.txt +396 -0
- package/dist/agents/database-architect.txt +1 -1
- package/dist/agents/pm.txt +7 -7
- package/dist/agents/po.txt +1 -1
- package/dist/agents/sm.txt +1395 -0
- package/dist/agents/xiaoma-master.txt +11 -11
- package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +1 -1
- package/dist/expansion-packs/bmad-2d-unity-game-dev/teams/unity-2d-game-team.txt +1 -1
- package/dist/teams/team-all.txt +1766 -15
- package/dist/teams/team-fullstack-with-database.txt +2116 -22
- package/dist/teams/team-fullstack.txt +14 -14
- package/dist/teams/team-ide-minimal.txt +1396 -1
- package/dist/teams/team-no-ui.txt +14 -14
- package/package.json +1 -1
- package/tools/installer/package.json +1 -1
- package/xiaoma-core/agent-teams/team-fullstack-with-database.yaml +3 -1
- package/xiaoma-core/agents/analyst.md +1 -1
- package/xiaoma-core/agents/automation-orchestrator.md +353 -0
- package/xiaoma-core/agents/database-architect.md +1 -1
- package/xiaoma-core/agents/pm.md +1 -1
- package/xiaoma-core/agents/po.md +1 -1
- package/xiaoma-core/agents/sm.md +4 -0
- package/xiaoma-core/checklists/dev-completion-checklist.md +324 -0
- package/xiaoma-core/checklists/po-story-validation-checklist.md +219 -0
- package/xiaoma-core/checklists/qa-approval-checklist.md +393 -0
- package/xiaoma-core/tasks/automated-story-cycle.md +370 -0
- package/xiaoma-core/tasks/create-database-design.md +2 -2
- package/xiaoma-core/tasks/create-enhanced-story-with-database.md +250 -0
- package/xiaoma-core/templates/api-design-tmpl.yaml +704 -0
- package/xiaoma-core/templates/brownfield-architecture-tmpl.yaml +5 -5
- package/xiaoma-core/templates/brownfield-prd-tmpl.yaml +6 -6
- package/xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml +428 -0
- package/xiaoma-core/workflows/automated-story-development.yaml +331 -0
- package/xiaoma-core/workflows/enhanced-fullstack-with-database.yaml +13 -6
- 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
- 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
package/dist/teams/team-all.txt
CHANGED
|
@@ -203,7 +203,7 @@ agent:
|
|
|
203
203
|
id: analyst
|
|
204
204
|
title: 业务分析师
|
|
205
205
|
icon: 📊
|
|
206
|
-
whenToUse:
|
|
206
|
+
whenToUse: 用于市场调研、头脑风暴、竞品分析、创建项目简报、初期项目探索以及为现有项目(现有项目项目)编写文档
|
|
207
207
|
customization: null
|
|
208
208
|
persona:
|
|
209
209
|
role: 富有洞察力的分析师与战略构想伙伴
|
|
@@ -316,6 +316,362 @@ dependencies:
|
|
|
316
316
|
```
|
|
317
317
|
==================== END: .xiaoma-core/agents/architect.md ====================
|
|
318
318
|
|
|
319
|
+
==================== START: .xiaoma-core/agents/automation-orchestrator.md ====================
|
|
320
|
+
# automation-orchestrator
|
|
321
|
+
|
|
322
|
+
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:
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
agent:
|
|
326
|
+
name: automation-orchestrator
|
|
327
|
+
id: automation-orchestrator
|
|
328
|
+
title: Automated Development Process Orchestrator
|
|
329
|
+
icon: 🤖
|
|
330
|
+
role: 自动化开发流程编排器和质量控制中心
|
|
331
|
+
expertise: 流程自动化、质量门控、状态管理、智能体协调
|
|
332
|
+
whenToUse: Use for automated story development cycles, quality control, and multi-agent orchestration
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Core Capabilities
|
|
336
|
+
|
|
337
|
+
### 🔄 流程编排能力
|
|
338
|
+
|
|
339
|
+
- 自动化用户故事开发循环
|
|
340
|
+
- 智能体间的协调和切换
|
|
341
|
+
- 状态管理和流程控制
|
|
342
|
+
- 错误处理和重试机制
|
|
343
|
+
|
|
344
|
+
### ✅ 质量门控能力
|
|
345
|
+
|
|
346
|
+
- 每个环节的质量验证
|
|
347
|
+
- 通过标准的严格执行
|
|
348
|
+
- 问题识别和修复协调
|
|
349
|
+
- 质量指标监控
|
|
350
|
+
|
|
351
|
+
### 📊 进度管理能力
|
|
352
|
+
|
|
353
|
+
- 开发进度实时跟踪
|
|
354
|
+
- 性能指标收集和分析
|
|
355
|
+
- 阻塞问题识别和解决
|
|
356
|
+
- 完成状态评估
|
|
357
|
+
|
|
358
|
+
## Available Commands
|
|
359
|
+
|
|
360
|
+
### 1. start-auto-development
|
|
361
|
+
|
|
362
|
+
**命令**: `*start-auto-development`
|
|
363
|
+
**功能**: 启动自动化用户故事开发流程
|
|
364
|
+
**适用场景**: 需要批量自动开发多个用户故事
|
|
365
|
+
**执行流程**:
|
|
366
|
+
|
|
367
|
+
1. 检查前置条件(数据库设计、生成代码等)
|
|
368
|
+
2. 初始化流程状态和进度跟踪
|
|
369
|
+
3. 启动第一个用户故事开发循环
|
|
370
|
+
4. 监控整个流程执行
|
|
371
|
+
|
|
372
|
+
**输出**: 流程状态报告和进度跟踪
|
|
373
|
+
|
|
374
|
+
### 2. execute-story-cycle
|
|
375
|
+
|
|
376
|
+
**命令**: `*execute-story-cycle`
|
|
377
|
+
**功能**: 执行单个用户故事的完整开发循环
|
|
378
|
+
**执行流程**:
|
|
379
|
+
|
|
380
|
+
1. SM智能体创建用户故事
|
|
381
|
+
2. PO智能体验证故事质量
|
|
382
|
+
3. Dev智能体开发和自测
|
|
383
|
+
4. QA智能体测试验证
|
|
384
|
+
5. 状态管理和质量控制
|
|
385
|
+
|
|
386
|
+
### 3. validate-quality-gate
|
|
387
|
+
|
|
388
|
+
**命令**: `*validate-quality-gate <stage>`
|
|
389
|
+
**功能**: 验证特定阶段的质量门控
|
|
390
|
+
**参数**: stage (story-creation|story-validation|development|qa-approval)
|
|
391
|
+
**执行流程**:
|
|
392
|
+
|
|
393
|
+
1. 根据阶段加载对应的验证标准
|
|
394
|
+
2. 执行全面的质量检查
|
|
395
|
+
3. 生成验证报告
|
|
396
|
+
4. 决定是否允许进入下一阶段
|
|
397
|
+
|
|
398
|
+
### 4. manage-story-status
|
|
399
|
+
|
|
400
|
+
**命令**: `*manage-story-status <story_id> <action>`
|
|
401
|
+
**功能**: 管理用户故事状态转换
|
|
402
|
+
**参数**:
|
|
403
|
+
|
|
404
|
+
- story_id: 用户故事标识
|
|
405
|
+
- action: (approve|start-dev|mark-review|complete|reject)
|
|
406
|
+
**执行流程**:
|
|
407
|
+
|
|
408
|
+
1. 验证状态转换的合法性
|
|
409
|
+
2. 检查转换条件是否满足
|
|
410
|
+
3. 更新故事状态
|
|
411
|
+
4. 通知相关智能体
|
|
412
|
+
|
|
413
|
+
### 5. handle-failure
|
|
414
|
+
|
|
415
|
+
**命令**: `*handle-failure <stage> <error_type>`
|
|
416
|
+
**功能**: 处理流程中的失败和错误
|
|
417
|
+
**执行流程**:
|
|
418
|
+
|
|
419
|
+
1. 分析失败原因和影响范围
|
|
420
|
+
2. 确定重试策略和修复方案
|
|
421
|
+
3. 协调相关智能体进行修复
|
|
422
|
+
4. 记录问题和解决过程
|
|
423
|
+
|
|
424
|
+
### 6. generate-progress-report
|
|
425
|
+
|
|
426
|
+
**命令**: `*generate-progress-report`
|
|
427
|
+
**功能**: 生成开发进度和质量报告
|
|
428
|
+
**执行流程**:
|
|
429
|
+
|
|
430
|
+
1. 收集各阶段的进度数据
|
|
431
|
+
2. 统计质量指标和性能数据
|
|
432
|
+
3. 识别风险和阻塞问题
|
|
433
|
+
4. 生成comprehensive progress report
|
|
434
|
+
|
|
435
|
+
### 7. coordinate-agents
|
|
436
|
+
|
|
437
|
+
**命令**: `*coordinate-agents <workflow_step>`
|
|
438
|
+
**功能**: 协调多个智能体的工作
|
|
439
|
+
**执行流程**:
|
|
440
|
+
|
|
441
|
+
1. 根据工作流步骤确定需要的智能体
|
|
442
|
+
2. 准备智能体所需的输入和上下文
|
|
443
|
+
3. 执行智能体切换和任务分配
|
|
444
|
+
4. 监控智能体执行状态
|
|
445
|
+
|
|
446
|
+
### 8. check-completion-status
|
|
447
|
+
|
|
448
|
+
**命令**: `*check-completion-status`
|
|
449
|
+
**功能**: 检查所有用户故事的完成状态
|
|
450
|
+
**执行流程**:
|
|
451
|
+
|
|
452
|
+
1. 扫描所有用户故事的当前状态
|
|
453
|
+
2. 识别未完成的故事和阻塞问题
|
|
454
|
+
3. 评估整体项目完成度
|
|
455
|
+
4. 生成完成状态报告
|
|
456
|
+
|
|
457
|
+
## Quality Gates Definition
|
|
458
|
+
|
|
459
|
+
### Story Creation Gate
|
|
460
|
+
|
|
461
|
+
**验证标准**:
|
|
462
|
+
|
|
463
|
+
- ✅ 故事格式符合模板要求
|
|
464
|
+
- ✅ 数据库实体映射完整
|
|
465
|
+
- ✅ API接口规范详细
|
|
466
|
+
- ✅ 验收标准清晰可测试
|
|
467
|
+
- ✅ 任务分解合理
|
|
468
|
+
|
|
469
|
+
### Story Validation Gate
|
|
470
|
+
|
|
471
|
+
**验证标准**:
|
|
472
|
+
|
|
473
|
+
- ✅ 业务需求与PRD一致
|
|
474
|
+
- ✅ 技术实现方案可行
|
|
475
|
+
- ✅ 验收标准可验证
|
|
476
|
+
- ✅ 故事规模适当
|
|
477
|
+
- ✅ 依赖关系明确
|
|
478
|
+
|
|
479
|
+
### Development Completion Gate
|
|
480
|
+
|
|
481
|
+
**验证标准**:
|
|
482
|
+
|
|
483
|
+
- ✅ 所有功能需求已实现
|
|
484
|
+
- ✅ 单元测试覆盖率≥80%
|
|
485
|
+
- ✅ 集成测试通过
|
|
486
|
+
- ✅ API接口功能正常
|
|
487
|
+
- ✅ 数据库操作正确
|
|
488
|
+
- ✅ 代码质量达标
|
|
489
|
+
|
|
490
|
+
### QA Approval Gate
|
|
491
|
+
|
|
492
|
+
**验证标准**:
|
|
493
|
+
|
|
494
|
+
- ✅ 所有验收标准满足
|
|
495
|
+
- ✅ 功能测试通过
|
|
496
|
+
- ✅ API契约测试通过
|
|
497
|
+
- ✅ 数据完整性验证
|
|
498
|
+
- ✅ 错误处理测试通过
|
|
499
|
+
- ✅ 性能要求满足
|
|
500
|
+
|
|
501
|
+
## Agent Coordination Protocol
|
|
502
|
+
|
|
503
|
+
### 智能体切换流程
|
|
504
|
+
|
|
505
|
+
```yaml
|
|
506
|
+
coordination_flow:
|
|
507
|
+
sm_to_po:
|
|
508
|
+
trigger: story_created
|
|
509
|
+
handoff: story.md (status: Draft)
|
|
510
|
+
validation: story_format_check
|
|
511
|
+
|
|
512
|
+
po_to_dev:
|
|
513
|
+
trigger: story_approved
|
|
514
|
+
handoff: story.md (status: Approved)
|
|
515
|
+
validation: business_requirements_check
|
|
516
|
+
|
|
517
|
+
dev_to_qa:
|
|
518
|
+
trigger: development_complete
|
|
519
|
+
handoff:
|
|
520
|
+
- story.md (status: Review)
|
|
521
|
+
- implementation_files
|
|
522
|
+
- test_results
|
|
523
|
+
validation: self_test_passed
|
|
524
|
+
|
|
525
|
+
qa_completion:
|
|
526
|
+
trigger: qa_approved
|
|
527
|
+
result: story.md (status: Done)
|
|
528
|
+
validation: acceptance_criteria_met
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### 错误处理协议
|
|
532
|
+
|
|
533
|
+
```yaml
|
|
534
|
+
error_handling:
|
|
535
|
+
validation_failure:
|
|
536
|
+
action: return_to_previous_agent
|
|
537
|
+
max_retries: 3
|
|
538
|
+
escalation_trigger: max_retries_exceeded
|
|
539
|
+
|
|
540
|
+
implementation_failure:
|
|
541
|
+
action: dev_self_fix
|
|
542
|
+
max_attempts: 5
|
|
543
|
+
support_available: architect_consultation
|
|
544
|
+
|
|
545
|
+
qa_failure:
|
|
546
|
+
action: return_to_dev
|
|
547
|
+
issue_tracking: required
|
|
548
|
+
impact_analysis: required
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
## Automation Features
|
|
552
|
+
|
|
553
|
+
### 自动状态管理
|
|
554
|
+
|
|
555
|
+
- 智能识别状态转换条件
|
|
556
|
+
- 自动执行合规的状态变更
|
|
557
|
+
- 阻止非法状态转换
|
|
558
|
+
- 维护状态变更历史
|
|
559
|
+
|
|
560
|
+
### 智能重试机制
|
|
561
|
+
|
|
562
|
+
- 基于错误类型的差异化重试
|
|
563
|
+
- 指数退避重试策略
|
|
564
|
+
- 最大重试次数控制
|
|
565
|
+
- 升级机制处理
|
|
566
|
+
|
|
567
|
+
### 质量监控
|
|
568
|
+
|
|
569
|
+
- 实时质量指标收集
|
|
570
|
+
- 趋势分析和预警
|
|
571
|
+
- 质量门控自动执行
|
|
572
|
+
- 质量报告自动生成
|
|
573
|
+
|
|
574
|
+
## Integration Points
|
|
575
|
+
|
|
576
|
+
### 与现有智能体集成
|
|
577
|
+
|
|
578
|
+
```yaml
|
|
579
|
+
agent_integration:
|
|
580
|
+
sm:
|
|
581
|
+
commands: ['*draft-enhanced']
|
|
582
|
+
input: epic_shards, database_design
|
|
583
|
+
output: story.md
|
|
584
|
+
|
|
585
|
+
po:
|
|
586
|
+
commands: ['*validate-story-draft']
|
|
587
|
+
input: story.md
|
|
588
|
+
output: validation_result, approved_story
|
|
589
|
+
|
|
590
|
+
dev:
|
|
591
|
+
commands: ['*develop-story', '*run-tests']
|
|
592
|
+
input: story.md, generated_code
|
|
593
|
+
output: implementation_files, test_results
|
|
594
|
+
|
|
595
|
+
qa:
|
|
596
|
+
commands: ['*review']
|
|
597
|
+
input: story.md, implementation_files
|
|
598
|
+
output: qa_report, approval_status
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### 数据流管理
|
|
602
|
+
|
|
603
|
+
- 智能体间数据传递
|
|
604
|
+
- 上下文信息维护
|
|
605
|
+
- 版本控制集成
|
|
606
|
+
- 文件状态跟踪
|
|
607
|
+
|
|
608
|
+
## Usage Examples
|
|
609
|
+
|
|
610
|
+
### 启动自动化开发
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
*agent automation-orchestrator
|
|
614
|
+
*start-auto-development
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### 手动执行单个循环
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
*execute-story-cycle
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### 检查质量门控
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
*validate-quality-gate development
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### 生成进度报告
|
|
630
|
+
|
|
631
|
+
```bash
|
|
632
|
+
*generate-progress-report
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
## Monitoring and Reporting
|
|
636
|
+
|
|
637
|
+
### 实时监控
|
|
638
|
+
|
|
639
|
+
- 当前执行阶段
|
|
640
|
+
- 各智能体状态
|
|
641
|
+
- 质量指标变化
|
|
642
|
+
- 阻塞问题识别
|
|
643
|
+
|
|
644
|
+
### 报告生成
|
|
645
|
+
|
|
646
|
+
- 每日进度报告
|
|
647
|
+
- 质量趋势分析
|
|
648
|
+
- 问题汇总报告
|
|
649
|
+
- 完成度评估
|
|
650
|
+
|
|
651
|
+
## Best Practices
|
|
652
|
+
|
|
653
|
+
### 流程优化
|
|
654
|
+
|
|
655
|
+
1. **并行处理**: 在不冲突的情况下并行执行任务
|
|
656
|
+
2. **预检查**: 在开始流程前验证所有前置条件
|
|
657
|
+
3. **快速失败**: 尽早发现和报告问题
|
|
658
|
+
4. **智能重试**: 基于问题类型选择重试策略
|
|
659
|
+
|
|
660
|
+
### 质量保证
|
|
661
|
+
|
|
662
|
+
1. **严格门控**: 每个阶段都必须通过质量检查
|
|
663
|
+
2. **自动验证**: 减少人工检查的主观性
|
|
664
|
+
3. **持续监控**: 实时跟踪质量指标变化
|
|
665
|
+
4. **预防措施**: 基于历史数据预防常见问题
|
|
666
|
+
|
|
667
|
+
### 协作优化
|
|
668
|
+
|
|
669
|
+
1. **清晰交接**: 确保智能体间信息传递准确
|
|
670
|
+
2. **状态同步**: 保持所有参与方对状态的一致理解
|
|
671
|
+
3. **问题隔离**: 避免问题在智能体间传播
|
|
672
|
+
4. **及时沟通**: 重要状态变化及时通知相关方
|
|
673
|
+
==================== END: .xiaoma-core/agents/automation-orchestrator.md ====================
|
|
674
|
+
|
|
319
675
|
==================== START: .xiaoma-core/agents/database-architect.md ====================
|
|
320
676
|
# database-architect
|
|
321
677
|
|
|
@@ -363,7 +719,7 @@ agent:
|
|
|
363
719
|
|
|
364
720
|
**命令**: `*analyze-database`
|
|
365
721
|
**功能**: 分析现有数据库结构
|
|
366
|
-
**适用场景**:
|
|
722
|
+
**适用场景**: 现有项目项目,需要了解现有数据库
|
|
367
723
|
**执行流程**:
|
|
368
724
|
|
|
369
725
|
1. 通过MCP服务连接MySQL数据库
|
|
@@ -689,7 +1045,7 @@ commands:
|
|
|
689
1045
|
- create-brownfield-epic: 运行任务 brownfield-create-epic.md
|
|
690
1046
|
- create-brownfield-prd: 使用模板 brownfield-prd-tmpl.yaml 运行任务 create-doc.md
|
|
691
1047
|
- create-brownfield-story: 运行任务 brownfield-create-story.md
|
|
692
|
-
- create-epic:
|
|
1048
|
+
- create-epic: 为现有项目项目创建史诗 (任务 brownfield-create-epic)
|
|
693
1049
|
- create-prd: 使用模板 prd-tmpl.yaml 运行任务 create-doc.md
|
|
694
1050
|
- create-story: 从需求创建用户故事 (任务 brownfield-create-story)
|
|
695
1051
|
- doc-out: 将完整文档输出到当前目标文件
|
|
@@ -753,7 +1109,7 @@ persona:
|
|
|
753
1109
|
commands:
|
|
754
1110
|
- help: 显示以下命令的编号列表以供选择
|
|
755
1111
|
- correct-course: 执行 correct-course 任务
|
|
756
|
-
- create-epic:
|
|
1112
|
+
- create-epic: 为现有项目项目创建史诗 (任务 brownfield-create-epic)
|
|
757
1113
|
- create-story: 从需求创建用户故事 (任务 brownfield-create-story)
|
|
758
1114
|
- doc-out: 将完整文档输出到当前目标文件
|
|
759
1115
|
- execute-checklist-po: 运行任务 execute-checklist (清单 po-master-checklist)
|
|
@@ -876,6 +1232,7 @@ commands:
|
|
|
876
1232
|
- help: 显示以下命令的编号列表以供选择
|
|
877
1233
|
- correct-course: 执行任务 correct-course.md
|
|
878
1234
|
- draft: 执行任务 create-next-story.md
|
|
1235
|
+
- draft-enhanced: 执行任务 create-enhanced-story-with-database.md (增强版用户故事,包含数据库和API设计)
|
|
879
1236
|
- story-checklist: 使用清单 story-draft-checklist.md 执行任务 execute-checklist.md
|
|
880
1237
|
- exit: 作为 Scrum Master 道别,然后放弃扮演此角色
|
|
881
1238
|
dependencies:
|
|
@@ -884,9 +1241,12 @@ dependencies:
|
|
|
884
1241
|
tasks:
|
|
885
1242
|
- correct-course.md
|
|
886
1243
|
- create-next-story.md
|
|
1244
|
+
- create-enhanced-story-with-database.md
|
|
887
1245
|
- execute-checklist.md
|
|
888
1246
|
templates:
|
|
889
1247
|
- story-tmpl.yaml
|
|
1248
|
+
- enhanced-story-with-database-tmpl.yaml
|
|
1249
|
+
- api-design-tmpl.yaml
|
|
890
1250
|
```
|
|
891
1251
|
==================== END: .xiaoma-core/agents/sm.md ====================
|
|
892
1252
|
|
|
@@ -4799,7 +5159,7 @@ sections:
|
|
|
4799
5159
|
==================== START: .xiaoma-core/templates/brownfield-architecture-tmpl.yaml ====================
|
|
4800
5160
|
template:
|
|
4801
5161
|
id: brownfield-architecture-template-v2
|
|
4802
|
-
name:
|
|
5162
|
+
name: 现有项目项目增强架构
|
|
4803
5163
|
version: 2.0
|
|
4804
5164
|
output:
|
|
4805
5165
|
format: markdown
|
|
@@ -4878,7 +5238,7 @@ sections:
|
|
|
4878
5238
|
instruction: |
|
|
4879
5239
|
定义增强功能将如何与现有系统集成:
|
|
4880
5240
|
|
|
4881
|
-
1.
|
|
5241
|
+
1. 回顾现有项目项目 PRD 的增强范围
|
|
4882
5242
|
2. 识别与现有代码的集成点
|
|
4883
5243
|
3. 定义新旧功能之间的边界
|
|
4884
5244
|
4. 建立兼容性要求
|
|
@@ -5243,12 +5603,12 @@ sections:
|
|
|
5243
5603
|
|
|
5244
5604
|
- id: checklist-results
|
|
5245
5605
|
title: 清单结果报告
|
|
5246
|
-
instruction: 执行 architect-checklist
|
|
5606
|
+
instruction: 执行 architect-checklist 并在此处填充结果,重点关注现有项目项目的特定验证
|
|
5247
5607
|
|
|
5248
5608
|
- id: next-steps
|
|
5249
5609
|
title: 后续步骤
|
|
5250
5610
|
instruction: |
|
|
5251
|
-
|
|
5611
|
+
完成现有项目项目架构后:
|
|
5252
5612
|
|
|
5253
5613
|
1. 审查与现有系统的集成点
|
|
5254
5614
|
2. 与开发代理一起开始故事的实现
|
|
@@ -5258,7 +5618,7 @@ sections:
|
|
|
5258
5618
|
- id: story-manager-handoff
|
|
5259
5619
|
title: 故事负责人交接
|
|
5260
5620
|
instruction: |
|
|
5261
|
-
|
|
5621
|
+
为故事负责人创建一个简短的提示,以便处理此现有项目项目增强。包括:
|
|
5262
5622
|
- 引用此架构文档
|
|
5263
5623
|
- 与用户验证过的关键集成要求
|
|
5264
5624
|
- 基于实际项目分析的现有系统约束
|
|
@@ -7719,7 +8079,7 @@ Document sharded successfully:
|
|
|
7719
8079
|
==================== START: .xiaoma-core/templates/brownfield-prd-tmpl.yaml ====================
|
|
7720
8080
|
template:
|
|
7721
8081
|
id: brownfield-prd-template-v2
|
|
7722
|
-
name:
|
|
8082
|
+
name: 现有项目增强功能PRD
|
|
7723
8083
|
version: 2.0
|
|
7724
8084
|
output:
|
|
7725
8085
|
format: markdown
|
|
@@ -7858,7 +8218,7 @@ sections:
|
|
|
7858
8218
|
- "NFR1: 增强功能必须保持现有的性能特征,且内存使用量增幅不得超过当前的20%。"
|
|
7859
8219
|
- id: compatibility
|
|
7860
8220
|
title: 兼容性要求
|
|
7861
|
-
instruction:
|
|
8221
|
+
instruction: 对于现有项目项目至关重要 - 必须保持兼容性的内容
|
|
7862
8222
|
type: numbered-list
|
|
7863
8223
|
prefix: CR
|
|
7864
8224
|
template: "{{requirement}}: {{description}}"
|
|
@@ -7947,20 +8307,20 @@ sections:
|
|
|
7947
8307
|
- id: epic-structure
|
|
7948
8308
|
title: Epic与Story结构
|
|
7949
8309
|
instruction: |
|
|
7950
|
-
|
|
8310
|
+
对于现有项目项目,倾向于使用单个综合性Epic,除非用户明确要求多个不相关的增强功能。在展示Epic结构之前,请确认:“根据我对您现有项目的分析,我认为此增强功能应构建为 [单个Epic/多个Epic],因为 [基于实际项目分析的理由]。这与您对所需工作的理解是否一致?”
|
|
7951
8311
|
elicit: true
|
|
7952
8312
|
sections:
|
|
7953
8313
|
- id: epic-approach
|
|
7954
8314
|
title: Epic方法
|
|
7955
|
-
instruction: 解释Epic结构的理由 -
|
|
8315
|
+
instruction: 解释Epic结构的理由 - 现有项目项目通常使用单个Epic,除非涉及多个不相关的功能
|
|
7956
8316
|
template: "**Epic结构决策**: {{epic_decision}} 并陈述理由"
|
|
7957
8317
|
|
|
7958
8318
|
- id: epic-details
|
|
7959
8319
|
title: "Epic 1: {{enhancement_title}}"
|
|
7960
8320
|
instruction: |
|
|
7961
|
-
|
|
8321
|
+
交付现有项目增强功能同时保持现有功能不变的综合性Epic
|
|
7962
8322
|
|
|
7963
|
-
|
|
8323
|
+
现有项目项目关键的STORY排序:
|
|
7964
8324
|
- Story必须确保现有功能保持完好
|
|
7965
8325
|
- 每个Story都应包含对现有功能是否仍然有效的验证
|
|
7966
8326
|
- Story的顺序应旨在最大限度地降低对现有系统的风险
|
|
@@ -11204,6 +11564,1397 @@ ALWAYS cite source documents: `[Source: architecture/{filename}.md#{section}]`
|
|
|
11204
11564
|
- 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`
|
|
11205
11565
|
==================== END: .xiaoma-core/tasks/create-next-story.md ====================
|
|
11206
11566
|
|
|
11567
|
+
==================== START: .xiaoma-core/tasks/create-enhanced-story-with-database.md ====================
|
|
11568
|
+
# 创建增强用户故事(包含数据库和API设计)
|
|
11569
|
+
|
|
11570
|
+
## 任务概述
|
|
11571
|
+
|
|
11572
|
+
基于Epic分解,结合数据库设计和API接口规范,创建详细的用户故事文档。此任务要求深度集成database-architect生成的数据库设计和API接口设计。
|
|
11573
|
+
|
|
11574
|
+
## 前置条件
|
|
11575
|
+
|
|
11576
|
+
- 已完成Epic分解和优先级排序
|
|
11577
|
+
- 已有数据库设计文档 (`docs/database/database-design.md`)
|
|
11578
|
+
- 已有API接口设计文档
|
|
11579
|
+
- 已完成架构设计
|
|
11580
|
+
|
|
11581
|
+
## 输入要求
|
|
11582
|
+
|
|
11583
|
+
- Epic文档
|
|
11584
|
+
- 数据库设计文档
|
|
11585
|
+
- API接口设计文档
|
|
11586
|
+
- 架构设计文档
|
|
11587
|
+
|
|
11588
|
+
## 执行步骤
|
|
11589
|
+
|
|
11590
|
+
### 1. 分析Epic和设计文档
|
|
11591
|
+
|
|
11592
|
+
#### 1.1 Epic分析
|
|
11593
|
+
|
|
11594
|
+
- 确定用户故事的业务价值和优先级
|
|
11595
|
+
- 识别涉及的用户角色
|
|
11596
|
+
- 明确功能边界和范围
|
|
11597
|
+
|
|
11598
|
+
#### 1.2 数据库设计分析
|
|
11599
|
+
|
|
11600
|
+
- 从`docs/database/database-design.md`中识别相关实体
|
|
11601
|
+
- 确定涉及的数据表和字段
|
|
11602
|
+
- 分析数据操作类型(增删改查)
|
|
11603
|
+
- 理解业务规则和约束
|
|
11604
|
+
|
|
11605
|
+
#### 1.3 API接口分析
|
|
11606
|
+
|
|
11607
|
+
- 从API设计文档中识别相关接口
|
|
11608
|
+
- 确定HTTP方法和路径
|
|
11609
|
+
- 分析请求参数和响应格式
|
|
11610
|
+
- 理解错误处理机制
|
|
11611
|
+
|
|
11612
|
+
### 2. 使用增强模板创建用户故事
|
|
11613
|
+
|
|
11614
|
+
使用模板:`enhanced-story-with-database-tmpl.yaml`
|
|
11615
|
+
|
|
11616
|
+
#### 2.1 基础信息填写
|
|
11617
|
+
|
|
11618
|
+
```yaml
|
|
11619
|
+
epic_num: '{{epic_number}}'
|
|
11620
|
+
story_num: '{{story_number}}'
|
|
11621
|
+
story_title_short: '{{story_title}}'
|
|
11622
|
+
role: '{{user_role}}'
|
|
11623
|
+
action: '{{user_action}}'
|
|
11624
|
+
benefit: '{{user_benefit}}'
|
|
11625
|
+
```
|
|
11626
|
+
|
|
11627
|
+
#### 2.2 数据库设计部分填写
|
|
11628
|
+
|
|
11629
|
+
**相关实体表格**:
|
|
11630
|
+
|
|
11631
|
+
```markdown
|
|
11632
|
+
| 实体名称 | 表名 | 主要用途 | 关键字段 |
|
|
11633
|
+
| -------- | -------- | ------------ | ---------------------------- |
|
|
11634
|
+
| User | users | 用户信息管理 | id, username, email |
|
|
11635
|
+
| Product | products | 产品信息管理 | id, name, price, category_id |
|
|
11636
|
+
```
|
|
11637
|
+
|
|
11638
|
+
**数据操作清单**:
|
|
11639
|
+
|
|
11640
|
+
- 查询操作:明确需要的查询条件和返回字段
|
|
11641
|
+
- 插入操作:明确需要插入的数据和验证规则
|
|
11642
|
+
- 更新操作:明确可更新的字段和业务规则
|
|
11643
|
+
- 删除操作:明确删除条件和级联规则
|
|
11644
|
+
|
|
11645
|
+
**业务规则约束**:
|
|
11646
|
+
|
|
11647
|
+
- 数据验证规则(长度、格式、范围)
|
|
11648
|
+
- 外键约束和引用完整性
|
|
11649
|
+
- 唯一性约束
|
|
11650
|
+
- 业务逻辑约束(状态转换等)
|
|
11651
|
+
|
|
11652
|
+
#### 2.3 API接口规范部分填写
|
|
11653
|
+
|
|
11654
|
+
**API端点列表**:
|
|
11655
|
+
|
|
11656
|
+
```markdown
|
|
11657
|
+
| 序号 | 接口名称 | HTTP方法 | 路径 | 说明 | 状态 |
|
|
11658
|
+
| ---- | ------------ | -------- | --------------- | ------------------ | ------ |
|
|
11659
|
+
| 1 | 创建用户 | POST | /api/users | 创建新用户账户 | 待实现 |
|
|
11660
|
+
| 2 | 查询用户详情 | GET | /api/users/{id} | 根据ID查询用户信息 | 待实现 |
|
|
11661
|
+
```
|
|
11662
|
+
|
|
11663
|
+
**API详细设计**:
|
|
11664
|
+
为每个API提供:
|
|
11665
|
+
|
|
11666
|
+
- 完整的请求参数说明
|
|
11667
|
+
- 响应数据结构定义
|
|
11668
|
+
- 具体的请求示例(curl命令)
|
|
11669
|
+
- 成功和错误响应示例
|
|
11670
|
+
- 错误码定义和处理建议
|
|
11671
|
+
|
|
11672
|
+
**数据映射关系**:
|
|
11673
|
+
|
|
11674
|
+
```markdown
|
|
11675
|
+
#### 请求参数 -> 数据库字段映射
|
|
11676
|
+
|
|
11677
|
+
| API参数 | 数据库表 | 数据库字段 | 数据类型 | 说明 |
|
|
11678
|
+
| -------- | -------- | ---------- | ------------ | -------- |
|
|
11679
|
+
| username | users | username | VARCHAR(50) | 用户名 |
|
|
11680
|
+
| email | users | email | VARCHAR(100) | 邮箱地址 |
|
|
11681
|
+
```
|
|
11682
|
+
|
|
11683
|
+
#### 2.4 任务分解
|
|
11684
|
+
|
|
11685
|
+
**后端开发任务**:
|
|
11686
|
+
|
|
11687
|
+
- 数据库相关:Mapper方法实现、Service业务逻辑、数据验证
|
|
11688
|
+
- API接口实现:Controller方法、参数验证、响应格式化、异常处理
|
|
11689
|
+
- 测试相关:单元测试、集成测试、数据库测试
|
|
11690
|
+
|
|
11691
|
+
**前端开发任务**(如需要):
|
|
11692
|
+
|
|
11693
|
+
- 页面组件实现
|
|
11694
|
+
- API调用集成
|
|
11695
|
+
- 表单验证
|
|
11696
|
+
- 用户交互
|
|
11697
|
+
|
|
11698
|
+
#### 2.5 开发者说明
|
|
11699
|
+
|
|
11700
|
+
**数据库上下文**:
|
|
11701
|
+
|
|
11702
|
+
- 实体类位置:`src/main/java/{package}/entity/`
|
|
11703
|
+
- Mapper接口位置:`src/main/java/{package}/mapper/`
|
|
11704
|
+
- Service层位置:`src/main/java/{package}/service/`
|
|
11705
|
+
- 业务逻辑要求和数据验证规则
|
|
11706
|
+
|
|
11707
|
+
**API接口上下文**:
|
|
11708
|
+
|
|
11709
|
+
- Controller位置:`src/main/java/{package}/controller/`
|
|
11710
|
+
- 请求响应格式标准
|
|
11711
|
+
- 错误处理机制
|
|
11712
|
+
- 接口版本控制
|
|
11713
|
+
|
|
11714
|
+
**集成上下文**:
|
|
11715
|
+
|
|
11716
|
+
- 与其他模块的依赖关系
|
|
11717
|
+
- 外部系统调用要求
|
|
11718
|
+
- 缓存策略和事务处理
|
|
11719
|
+
- 性能要求
|
|
11720
|
+
|
|
11721
|
+
### 3. 质量检查清单
|
|
11722
|
+
|
|
11723
|
+
#### 3.1 完整性检查
|
|
11724
|
+
|
|
11725
|
+
- [ ] 所有涉及的数据库实体都已识别
|
|
11726
|
+
- [ ] 所有需要的API接口都已定义
|
|
11727
|
+
- [ ] 请求参数和响应格式完整
|
|
11728
|
+
- [ ] 错误处理机制明确
|
|
11729
|
+
- [ ] 数据映射关系清晰
|
|
11730
|
+
|
|
11731
|
+
#### 3.2 一致性检查
|
|
11732
|
+
|
|
11733
|
+
- [ ] API参数与数据库字段对应
|
|
11734
|
+
- [ ] 数据类型一致
|
|
11735
|
+
- [ ] 业务规则与数据库约束匹配
|
|
11736
|
+
- [ ] 接口设计符合RESTful规范
|
|
11737
|
+
|
|
11738
|
+
#### 3.3 可实现性检查
|
|
11739
|
+
|
|
11740
|
+
- [ ] 任务分解合理可执行
|
|
11741
|
+
- [ ] 技术实现方案可行
|
|
11742
|
+
- [ ] 测试覆盖充分
|
|
11743
|
+
- [ ] 开发者说明详细
|
|
11744
|
+
|
|
11745
|
+
### 4. 输出文件
|
|
11746
|
+
|
|
11747
|
+
生成的用户故事文件:`docs/stories/{{epic_num}}.{{story_num}}.{{story_title_short}}.md`
|
|
11748
|
+
|
|
11749
|
+
### 5. 后续协作
|
|
11750
|
+
|
|
11751
|
+
#### 5.1 与开发者协作
|
|
11752
|
+
|
|
11753
|
+
- 确保开发者理解数据库设计和API规范
|
|
11754
|
+
- 提供必要的技术支持和澄清
|
|
11755
|
+
- 跟踪开发进度和问题解决
|
|
11756
|
+
|
|
11757
|
+
#### 5.2 与QA协作
|
|
11758
|
+
|
|
11759
|
+
- 明确测试重点和验收标准
|
|
11760
|
+
- 提供API测试用例和数据
|
|
11761
|
+
- 确保质量标准得到执行
|
|
11762
|
+
|
|
11763
|
+
## 模板使用示例
|
|
11764
|
+
|
|
11765
|
+
### 示例:用户注册功能
|
|
11766
|
+
|
|
11767
|
+
**用户故事**:
|
|
11768
|
+
|
|
11769
|
+
> 作为新用户,我希望能够注册账户,以便使用系统的各项功能。
|
|
11770
|
+
|
|
11771
|
+
**相关实体**:
|
|
11772
|
+
|
|
11773
|
+
- Users表:存储用户基本信息
|
|
11774
|
+
- UserProfiles表:存储用户详细资料
|
|
11775
|
+
|
|
11776
|
+
**涉及API**:
|
|
11777
|
+
|
|
11778
|
+
- POST /api/users:创建用户账户
|
|
11779
|
+
- POST /api/users/verify-email:验证邮箱
|
|
11780
|
+
- GET /api/users/check-username:检查用户名可用性
|
|
11781
|
+
|
|
11782
|
+
**数据操作**:
|
|
11783
|
+
|
|
11784
|
+
- 插入用户基本信息到users表
|
|
11785
|
+
- 验证用户名和邮箱的唯一性
|
|
11786
|
+
- 创建用户会话信息
|
|
11787
|
+
|
|
11788
|
+
**API详细设计**:
|
|
11789
|
+
|
|
11790
|
+
```json
|
|
11791
|
+
// POST /api/users
|
|
11792
|
+
{
|
|
11793
|
+
"username": "johndoe",
|
|
11794
|
+
"email": "john@example.com",
|
|
11795
|
+
"password": "hashedPassword"
|
|
11796
|
+
}
|
|
11797
|
+
|
|
11798
|
+
// 响应
|
|
11799
|
+
{
|
|
11800
|
+
"code": 200,
|
|
11801
|
+
"message": "用户创建成功",
|
|
11802
|
+
"data": {
|
|
11803
|
+
"userId": 12345,
|
|
11804
|
+
"username": "johndoe",
|
|
11805
|
+
"email": "john@example.com",
|
|
11806
|
+
"status": "active"
|
|
11807
|
+
}
|
|
11808
|
+
}
|
|
11809
|
+
```
|
|
11810
|
+
|
|
11811
|
+
## 注意事项
|
|
11812
|
+
|
|
11813
|
+
1. **数据一致性**:确保API设计与数据库设计保持一致
|
|
11814
|
+
2. **安全性**:考虑数据验证、权限控制和敏感信息保护
|
|
11815
|
+
3. **性能**:关注查询效率和接口响应时间
|
|
11816
|
+
4. **可维护性**:保持代码结构清晰和文档完整
|
|
11817
|
+
5. **可测试性**:确保功能可以被充分测试
|
|
11818
|
+
==================== END: .xiaoma-core/tasks/create-enhanced-story-with-database.md ====================
|
|
11819
|
+
|
|
11820
|
+
==================== START: .xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml ====================
|
|
11821
|
+
template:
|
|
11822
|
+
id: enhanced-story-with-database-template-v1
|
|
11823
|
+
name: 增强用户故事文档 (包含数据库和API设计)
|
|
11824
|
+
version: 1.0
|
|
11825
|
+
output:
|
|
11826
|
+
format: markdown
|
|
11827
|
+
filename: docs/stories/{{epic_num}}.{{story_num}}.{{story_title_short}}.md
|
|
11828
|
+
title: "story {{epic_num}}.{{story_num}}: {{story_title_short}}"
|
|
11829
|
+
|
|
11830
|
+
workflow:
|
|
11831
|
+
mode: interactive
|
|
11832
|
+
elicitation: advanced-elicitation
|
|
11833
|
+
|
|
11834
|
+
agent_config:
|
|
11835
|
+
editable_sections:
|
|
11836
|
+
- Status
|
|
11837
|
+
- Story
|
|
11838
|
+
- Acceptance Criteria
|
|
11839
|
+
- Database Design
|
|
11840
|
+
- API Specifications
|
|
11841
|
+
- Tasks / Subtasks
|
|
11842
|
+
- Dev Notes
|
|
11843
|
+
- Testing
|
|
11844
|
+
- Change Log
|
|
11845
|
+
|
|
11846
|
+
sections:
|
|
11847
|
+
- id: status
|
|
11848
|
+
title: 状态
|
|
11849
|
+
type: choice
|
|
11850
|
+
choices: [Draft, Approved, InProgress, Review, Done]
|
|
11851
|
+
instruction: 选择此用户故事的当前状态
|
|
11852
|
+
owner: scrum-master
|
|
11853
|
+
editors: [scrum-master, po-agent, dev-agent]
|
|
11854
|
+
|
|
11855
|
+
- id: story
|
|
11856
|
+
title: 用户故事
|
|
11857
|
+
type: template-text
|
|
11858
|
+
template: |
|
|
11859
|
+
**作为** {{role}},
|
|
11860
|
+
**我希望** {{action}},
|
|
11861
|
+
**以便** {{benefit}}
|
|
11862
|
+
instruction: 使用包含角色、行动和收益的标准格式来定义用户故事
|
|
11863
|
+
elicit: true
|
|
11864
|
+
owner: scrum-master
|
|
11865
|
+
editors: [scrum-master]
|
|
11866
|
+
|
|
11867
|
+
- id: acceptance-criteria
|
|
11868
|
+
title: 验收标准
|
|
11869
|
+
type: numbered-list
|
|
11870
|
+
instruction: 从 Epic 文件中复制验收标准的编号列表
|
|
11871
|
+
elicit: true
|
|
11872
|
+
owner: scrum-master
|
|
11873
|
+
editors: [scrum-master]
|
|
11874
|
+
|
|
11875
|
+
- id: database-design
|
|
11876
|
+
title: 数据库设计相关
|
|
11877
|
+
instruction: |
|
|
11878
|
+
基于database-architect生成的数据库设计,明确此用户故事涉及的数据库相关内容。
|
|
11879
|
+
从docs/database/database-design.md中提取相关信息。
|
|
11880
|
+
elicit: true
|
|
11881
|
+
owner: scrum-master
|
|
11882
|
+
editors: [scrum-master]
|
|
11883
|
+
sections:
|
|
11884
|
+
- id: related-entities
|
|
11885
|
+
title: 相关实体
|
|
11886
|
+
instruction: |
|
|
11887
|
+
列出此用户故事涉及的所有数据库实体(表):
|
|
11888
|
+
- 实体名称
|
|
11889
|
+
- 表名
|
|
11890
|
+
- 主要用途
|
|
11891
|
+
- 关键字段
|
|
11892
|
+
template: |
|
|
11893
|
+
### 涉及的数据库实体
|
|
11894
|
+
|
|
11895
|
+
| 实体名称 | 表名 | 主要用途 | 关键字段 |
|
|
11896
|
+
|---------|------|----------|----------|
|
|
11897
|
+
| {{entity_name}} | {{table_name}} | {{purpose}} | {{key_fields}} |
|
|
11898
|
+
elicit: true
|
|
11899
|
+
owner: scrum-master
|
|
11900
|
+
editors: [scrum-master]
|
|
11901
|
+
|
|
11902
|
+
- id: data-operations
|
|
11903
|
+
title: 数据操作
|
|
11904
|
+
instruction: |
|
|
11905
|
+
明确此用户故事需要进行的数据操作:
|
|
11906
|
+
- 查询操作 (SELECT)
|
|
11907
|
+
- 插入操作 (INSERT)
|
|
11908
|
+
- 更新操作 (UPDATE)
|
|
11909
|
+
- 删除操作 (DELETE)
|
|
11910
|
+
template: |
|
|
11911
|
+
### 数据操作清单
|
|
11912
|
+
|
|
11913
|
+
**查询操作**:
|
|
11914
|
+
- [ ] {{query_description}} (表: {{table_name}})
|
|
11915
|
+
|
|
11916
|
+
**插入操作**:
|
|
11917
|
+
- [ ] {{insert_description}} (表: {{table_name}})
|
|
11918
|
+
|
|
11919
|
+
**更新操作**:
|
|
11920
|
+
- [ ] {{update_description}} (表: {{table_name}})
|
|
11921
|
+
|
|
11922
|
+
**删除操作**:
|
|
11923
|
+
- [ ] {{delete_description}} (表: {{table_name}})
|
|
11924
|
+
elicit: true
|
|
11925
|
+
owner: scrum-master
|
|
11926
|
+
editors: [scrum-master]
|
|
11927
|
+
|
|
11928
|
+
- id: business-rules
|
|
11929
|
+
title: 业务规则约束
|
|
11930
|
+
instruction: |
|
|
11931
|
+
列出此用户故事涉及的数据业务规则和约束:
|
|
11932
|
+
- 数据验证规则
|
|
11933
|
+
- 外键约束
|
|
11934
|
+
- 唯一性约束
|
|
11935
|
+
- 业务逻辑约束
|
|
11936
|
+
elicit: true
|
|
11937
|
+
owner: scrum-master
|
|
11938
|
+
editors: [scrum-master]
|
|
11939
|
+
|
|
11940
|
+
- id: api-specifications
|
|
11941
|
+
title: API接口规范
|
|
11942
|
+
instruction: |
|
|
11943
|
+
基于database-architect创建的API设计,详细定义此用户故事涉及的API接口。
|
|
11944
|
+
每个接口必须包含完整的接口名称、入参、出参、传参示例和响应示例。
|
|
11945
|
+
elicit: true
|
|
11946
|
+
owner: scrum-master
|
|
11947
|
+
editors: [scrum-master]
|
|
11948
|
+
sections:
|
|
11949
|
+
- id: api-endpoints
|
|
11950
|
+
title: API端点列表
|
|
11951
|
+
instruction: |
|
|
11952
|
+
列出此用户故事需要实现或调用的所有API端点
|
|
11953
|
+
template: |
|
|
11954
|
+
### API端点清单
|
|
11955
|
+
|
|
11956
|
+
| 序号 | 接口名称 | HTTP方法 | 路径 | 说明 | 状态 |
|
|
11957
|
+
|------|----------|----------|------|------|------|
|
|
11958
|
+
| 1 | {{api_name}} | {{http_method}} | {{api_path}} | {{description}} | {{status}} |
|
|
11959
|
+
elicit: true
|
|
11960
|
+
owner: scrum-master
|
|
11961
|
+
editors: [scrum-master]
|
|
11962
|
+
|
|
11963
|
+
- id: api-details
|
|
11964
|
+
title: API详细设计
|
|
11965
|
+
instruction: |
|
|
11966
|
+
为每个API端点提供详细的接口设计,包括:
|
|
11967
|
+
- 接口名称和描述
|
|
11968
|
+
- 请求参数详细说明
|
|
11969
|
+
- 响应数据结构
|
|
11970
|
+
- 请求示例
|
|
11971
|
+
- 响应示例
|
|
11972
|
+
- 错误码定义
|
|
11973
|
+
template: |
|
|
11974
|
+
### API详细设计
|
|
11975
|
+
|
|
11976
|
+
#### {{api_name}}
|
|
11977
|
+
|
|
11978
|
+
**接口描述**: {{api_description}}
|
|
11979
|
+
**HTTP方法**: {{http_method}}
|
|
11980
|
+
**请求路径**: {{api_path}}
|
|
11981
|
+
|
|
11982
|
+
**请求参数**:
|
|
11983
|
+
```json
|
|
11984
|
+
{
|
|
11985
|
+
"param1": "string // 参数说明",
|
|
11986
|
+
"param2": "integer // 参数说明",
|
|
11987
|
+
"param3": {
|
|
11988
|
+
"nested_param": "string // 嵌套参数说明"
|
|
11989
|
+
}
|
|
11990
|
+
}
|
|
11991
|
+
```
|
|
11992
|
+
|
|
11993
|
+
**响应数据结构**:
|
|
11994
|
+
```json
|
|
11995
|
+
{
|
|
11996
|
+
"code": "integer // 状态码",
|
|
11997
|
+
"message": "string // 响应消息",
|
|
11998
|
+
"data": {
|
|
11999
|
+
"field1": "string // 字段说明",
|
|
12000
|
+
"field2": "integer // 字段说明"
|
|
12001
|
+
}
|
|
12002
|
+
}
|
|
12003
|
+
```
|
|
12004
|
+
|
|
12005
|
+
**请求示例**:
|
|
12006
|
+
```bash
|
|
12007
|
+
curl -X {{http_method}} "{{base_url}}{{api_path}}" \
|
|
12008
|
+
-H "Content-Type: application/json" \
|
|
12009
|
+
-H "Authorization: Bearer {{token}}" \
|
|
12010
|
+
-d '{
|
|
12011
|
+
"param1": "示例值",
|
|
12012
|
+
"param2": 123
|
|
12013
|
+
}'
|
|
12014
|
+
```
|
|
12015
|
+
|
|
12016
|
+
**成功响应示例**:
|
|
12017
|
+
```json
|
|
12018
|
+
{
|
|
12019
|
+
"code": 200,
|
|
12020
|
+
"message": "操作成功",
|
|
12021
|
+
"data": {
|
|
12022
|
+
"field1": "返回值示例",
|
|
12023
|
+
"field2": 456
|
|
12024
|
+
}
|
|
12025
|
+
}
|
|
12026
|
+
```
|
|
12027
|
+
|
|
12028
|
+
**错误响应示例**:
|
|
12029
|
+
```json
|
|
12030
|
+
{
|
|
12031
|
+
"code": 400,
|
|
12032
|
+
"message": "参数错误",
|
|
12033
|
+
"data": null
|
|
12034
|
+
}
|
|
12035
|
+
```
|
|
12036
|
+
|
|
12037
|
+
**错误码定义**:
|
|
12038
|
+
| 错误码 | 说明 | 处理建议 |
|
|
12039
|
+
|--------|------|----------|
|
|
12040
|
+
| 400 | 参数错误 | 检查请求参数格式 |
|
|
12041
|
+
| 401 | 未授权 | 检查token有效性 |
|
|
12042
|
+
| 404 | 资源不存在 | 检查资源ID |
|
|
12043
|
+
| 500 | 服务器错误 | 联系技术支持 |
|
|
12044
|
+
elicit: true
|
|
12045
|
+
owner: scrum-master
|
|
12046
|
+
editors: [scrum-master]
|
|
12047
|
+
|
|
12048
|
+
- id: data-mapping
|
|
12049
|
+
title: 数据映射关系
|
|
12050
|
+
instruction: |
|
|
12051
|
+
定义API参数与数据库字段的映射关系
|
|
12052
|
+
template: |
|
|
12053
|
+
### 数据映射关系
|
|
12054
|
+
|
|
12055
|
+
#### 请求参数 -> 数据库字段映射
|
|
12056
|
+
| API参数 | 数据库表 | 数据库字段 | 数据类型 | 说明 |
|
|
12057
|
+
|---------|----------|------------|----------|------|
|
|
12058
|
+
| {{api_param}} | {{table_name}} | {{db_field}} | {{data_type}} | {{description}} |
|
|
12059
|
+
|
|
12060
|
+
#### 数据库字段 -> 响应参数映射
|
|
12061
|
+
| 数据库表 | 数据库字段 | API响应字段 | 数据类型 | 说明 |
|
|
12062
|
+
|----------|------------|-------------|----------|------|
|
|
12063
|
+
| {{table_name}} | {{db_field}} | {{api_field}} | {{data_type}} | {{description}} |
|
|
12064
|
+
elicit: true
|
|
12065
|
+
owner: scrum-master
|
|
12066
|
+
editors: [scrum-master]
|
|
12067
|
+
|
|
12068
|
+
- id: tasks-subtasks
|
|
12069
|
+
title: 任务 / 子任务
|
|
12070
|
+
type: bullet-list
|
|
12071
|
+
instruction: |
|
|
12072
|
+
将用户故事分解为实施所需的具体任务和子任务。
|
|
12073
|
+
在相关处引用适用的验收标准编号。
|
|
12074
|
+
结合数据库设计和API规范,确保任务覆盖:
|
|
12075
|
+
- 数据库相关操作(Mapper、Service层)
|
|
12076
|
+
- API接口实现(Controller层)
|
|
12077
|
+
- 数据验证和业务逻辑
|
|
12078
|
+
- 单元测试和集成测试
|
|
12079
|
+
template: |
|
|
12080
|
+
### 后端开发任务
|
|
12081
|
+
- [ ] 数据库相关 (AC: # 如果适用)
|
|
12082
|
+
- [ ] 实现{{entity_name}}Mapper接口方法
|
|
12083
|
+
- [ ] 编写{{entity_name}}Service业务逻辑
|
|
12084
|
+
- [ ] 添加数据验证和业务规则
|
|
12085
|
+
- [ ] API接口实现 (AC: # 如果适用)
|
|
12086
|
+
- [ ] 实现{{api_name}}接口 ({{http_method}} {{api_path}})
|
|
12087
|
+
- [ ] 添加请求参数验证
|
|
12088
|
+
- [ ] 实现响应数据格式化
|
|
12089
|
+
- [ ] 添加异常处理和错误码
|
|
12090
|
+
- [ ] 测试相关 (AC: # 如果适用)
|
|
12091
|
+
- [ ] 编写Service层单元测试
|
|
12092
|
+
- [ ] 编写API接口集成测试
|
|
12093
|
+
- [ ] 数据库操作测试
|
|
12094
|
+
- [ ] 边界条件和异常测试
|
|
12095
|
+
|
|
12096
|
+
### 前端开发任务(如果需要)
|
|
12097
|
+
- [ ] 前端界面 (AC: # 如果适用)
|
|
12098
|
+
- [ ] 实现相关页面组件
|
|
12099
|
+
- [ ] 集成API调用
|
|
12100
|
+
- [ ] 添加表单验证
|
|
12101
|
+
- [ ] 用户交互和反馈
|
|
12102
|
+
elicit: true
|
|
12103
|
+
owner: scrum-master
|
|
12104
|
+
editors: [scrum-master, dev-agent]
|
|
12105
|
+
|
|
12106
|
+
- id: dev-notes
|
|
12107
|
+
title: 开发者说明
|
|
12108
|
+
instruction: |
|
|
12109
|
+
填充相关信息,且仅限从 docs 文件夹中的实际工件中提取的、与此用户故事相关的内容:
|
|
12110
|
+
- 数据库设计文档的相关部分
|
|
12111
|
+
- 生成的Entity、Mapper、Service代码位置
|
|
12112
|
+
- API接口设计的相关规范
|
|
12113
|
+
- 架构设计中的相关约束
|
|
12114
|
+
- 与前一个用户故事的关联信息
|
|
12115
|
+
在此部分提供足够的信息,以确保开发者代理永远不需要阅读完整的设计文档。
|
|
12116
|
+
elicit: true
|
|
12117
|
+
owner: scrum-master
|
|
12118
|
+
editors: [scrum-master]
|
|
12119
|
+
sections:
|
|
12120
|
+
- id: database-context
|
|
12121
|
+
title: 数据库上下文
|
|
12122
|
+
instruction: |
|
|
12123
|
+
提供数据库相关的开发上下文:
|
|
12124
|
+
- 相关实体类的位置和结构
|
|
12125
|
+
- Mapper接口需要实现的方法
|
|
12126
|
+
- Service层的业务逻辑要求
|
|
12127
|
+
- 数据验证规则
|
|
12128
|
+
elicit: true
|
|
12129
|
+
owner: scrum-master
|
|
12130
|
+
editors: [scrum-master]
|
|
12131
|
+
|
|
12132
|
+
- id: api-context
|
|
12133
|
+
title: API接口上下文
|
|
12134
|
+
instruction: |
|
|
12135
|
+
提供API接口相关的开发上下文:
|
|
12136
|
+
- Controller类的位置和结构
|
|
12137
|
+
- 接口路径和HTTP方法
|
|
12138
|
+
- 请求响应的数据格式
|
|
12139
|
+
- 错误处理要求
|
|
12140
|
+
elicit: true
|
|
12141
|
+
owner: scrum-master
|
|
12142
|
+
editors: [scrum-master]
|
|
12143
|
+
|
|
12144
|
+
- id: integration-context
|
|
12145
|
+
title: 集成上下文
|
|
12146
|
+
instruction: |
|
|
12147
|
+
提供系统集成相关的开发上下文:
|
|
12148
|
+
- 与其他模块的接口依赖
|
|
12149
|
+
- 外部系统调用要求
|
|
12150
|
+
- 缓存策略
|
|
12151
|
+
- 事务处理要求
|
|
12152
|
+
elicit: true
|
|
12153
|
+
owner: scrum-master
|
|
12154
|
+
editors: [scrum-master]
|
|
12155
|
+
|
|
12156
|
+
- id: testing-standards
|
|
12157
|
+
title: 测试
|
|
12158
|
+
instruction: |
|
|
12159
|
+
列出开发者需要遵守的、源自架构文档的相关测试标准:
|
|
12160
|
+
- 测试文件位置
|
|
12161
|
+
- 测试标准
|
|
12162
|
+
- 要使用的测试框架和模式
|
|
12163
|
+
- 针对此用户故事的特定测试要求
|
|
12164
|
+
- 数据库测试和API测试要求
|
|
12165
|
+
elicit: true
|
|
12166
|
+
owner: scrum-master
|
|
12167
|
+
editors: [scrum-master]
|
|
12168
|
+
|
|
12169
|
+
- id: change-log
|
|
12170
|
+
title: 变更日志
|
|
12171
|
+
type: table
|
|
12172
|
+
columns: [日期, 版本, 描述, 作者]
|
|
12173
|
+
instruction: 跟踪此用户故事文档的变更
|
|
12174
|
+
owner: scrum-master
|
|
12175
|
+
editors: [scrum-master, dev-agent, qa-agent]
|
|
12176
|
+
|
|
12177
|
+
- id: dev-agent-record
|
|
12178
|
+
title: 开发者代理记录
|
|
12179
|
+
instruction: 此部分由开发代理在实施过程中填充
|
|
12180
|
+
owner: dev-agent
|
|
12181
|
+
editors: [dev-agent]
|
|
12182
|
+
sections:
|
|
12183
|
+
- id: agent-model
|
|
12184
|
+
title: 使用的代理模型
|
|
12185
|
+
template: "{{agent_model_name_version}}"
|
|
12186
|
+
instruction: 记录用于开发的特定 AI 代理模型和版本
|
|
12187
|
+
owner: dev-agent
|
|
12188
|
+
editors: [dev-agent]
|
|
12189
|
+
|
|
12190
|
+
- id: database-implementation
|
|
12191
|
+
title: 数据库实现记录
|
|
12192
|
+
instruction: |
|
|
12193
|
+
记录数据库相关的实现细节:
|
|
12194
|
+
- 实现的Mapper方法
|
|
12195
|
+
- Service层业务逻辑
|
|
12196
|
+
- 数据验证实现
|
|
12197
|
+
- 数据库测试结果
|
|
12198
|
+
owner: dev-agent
|
|
12199
|
+
editors: [dev-agent]
|
|
12200
|
+
|
|
12201
|
+
- id: api-implementation
|
|
12202
|
+
title: API实现记录
|
|
12203
|
+
instruction: |
|
|
12204
|
+
记录API接口的实现细节:
|
|
12205
|
+
- 实现的Controller方法
|
|
12206
|
+
- 参数验证逻辑
|
|
12207
|
+
- 响应格式处理
|
|
12208
|
+
- 错误处理实现
|
|
12209
|
+
- API测试结果
|
|
12210
|
+
owner: dev-agent
|
|
12211
|
+
editors: [dev-agent]
|
|
12212
|
+
|
|
12213
|
+
- id: debug-log-references
|
|
12214
|
+
title: 调试日志参考
|
|
12215
|
+
instruction: 引用开发过程中生成的任何调试日志或跟踪信息
|
|
12216
|
+
owner: dev-agent
|
|
12217
|
+
editors: [dev-agent]
|
|
12218
|
+
|
|
12219
|
+
- id: completion-notes
|
|
12220
|
+
title: 完成说明列表
|
|
12221
|
+
instruction: 关于任务完成情况和遇到的任何问题的说明
|
|
12222
|
+
owner: dev-agent
|
|
12223
|
+
editors: [dev-agent]
|
|
12224
|
+
|
|
12225
|
+
- id: file-list
|
|
12226
|
+
title: 文件列表
|
|
12227
|
+
instruction: |
|
|
12228
|
+
列出在用户故事实施过程中创建、修改或影响的所有文件,
|
|
12229
|
+
特别注意数据库和API相关文件:
|
|
12230
|
+
- Entity类文件
|
|
12231
|
+
- Mapper接口和XML文件
|
|
12232
|
+
- Service接口和实现文件
|
|
12233
|
+
- Controller文件
|
|
12234
|
+
- 测试文件
|
|
12235
|
+
owner: dev-agent
|
|
12236
|
+
editors: [dev-agent]
|
|
12237
|
+
|
|
12238
|
+
- id: qa-results
|
|
12239
|
+
title: QA 结果
|
|
12240
|
+
instruction: |
|
|
12241
|
+
QA 代理对已完成的用户故事实施进行 QA 审查的结果,
|
|
12242
|
+
特别关注:
|
|
12243
|
+
- 数据库操作的正确性
|
|
12244
|
+
- API接口的功能性
|
|
12245
|
+
- 数据一致性验证
|
|
12246
|
+
- 性能测试结果
|
|
12247
|
+
owner: qa-agent
|
|
12248
|
+
editors: [qa-agent]
|
|
12249
|
+
==================== END: .xiaoma-core/templates/enhanced-story-with-database-tmpl.yaml ====================
|
|
12250
|
+
|
|
12251
|
+
==================== START: .xiaoma-core/templates/api-design-tmpl.yaml ====================
|
|
12252
|
+
name: API接口设计文档模板
|
|
12253
|
+
version: 1.0.0
|
|
12254
|
+
description: 基于数据库设计的RESTful API接口规范模板
|
|
12255
|
+
|
|
12256
|
+
sections:
|
|
12257
|
+
- id: overview
|
|
12258
|
+
title: API设计概述
|
|
12259
|
+
required: true
|
|
12260
|
+
template: |
|
|
12261
|
+
## API设计概述
|
|
12262
|
+
|
|
12263
|
+
### 项目信息
|
|
12264
|
+
- **项目名称**: {project_name}
|
|
12265
|
+
- **API版本**: {api_version}
|
|
12266
|
+
- **设计日期**: {design_date}
|
|
12267
|
+
- **设计人员**: Database Architect
|
|
12268
|
+
- **基础URL**: {base_url}
|
|
12269
|
+
|
|
12270
|
+
### 设计原则
|
|
12271
|
+
- **RESTful**: 遵循REST架构风格
|
|
12272
|
+
- **统一响应**: 统一的响应数据格式
|
|
12273
|
+
- **版本控制**: 支持API版本管理
|
|
12274
|
+
- **安全性**: 完整的认证和授权机制
|
|
12275
|
+
- **文档化**: 完整的接口文档和示例
|
|
12276
|
+
|
|
12277
|
+
- id: global_standards
|
|
12278
|
+
title: 全局规范
|
|
12279
|
+
required: true
|
|
12280
|
+
template: |
|
|
12281
|
+
## 全局规范
|
|
12282
|
+
|
|
12283
|
+
### HTTP状态码规范
|
|
12284
|
+
| 状态码 | 含义 | 使用场景 |
|
|
12285
|
+
|--------|------|----------|
|
|
12286
|
+
| 200 | OK | 请求成功 |
|
|
12287
|
+
| 201 | Created | 资源创建成功 |
|
|
12288
|
+
| 204 | No Content | 删除成功,无返回内容 |
|
|
12289
|
+
| 400 | Bad Request | 请求参数错误 |
|
|
12290
|
+
| 401 | Unauthorized | 未认证 |
|
|
12291
|
+
| 403 | Forbidden | 无权限 |
|
|
12292
|
+
| 404 | Not Found | 资源不存在 |
|
|
12293
|
+
| 409 | Conflict | 资源冲突 |
|
|
12294
|
+
| 422 | Unprocessable Entity | 参数验证失败 |
|
|
12295
|
+
| 500 | Internal Server Error | 服务器内部错误 |
|
|
12296
|
+
|
|
12297
|
+
### 统一响应格式
|
|
12298
|
+
```json
|
|
12299
|
+
{
|
|
12300
|
+
"code": "integer // HTTP状态码",
|
|
12301
|
+
"message": "string // 响应消息",
|
|
12302
|
+
"data": "object|array|null // 响应数据",
|
|
12303
|
+
"timestamp": "string // 时间戳",
|
|
12304
|
+
"path": "string // 请求路径"
|
|
12305
|
+
}
|
|
12306
|
+
```
|
|
12307
|
+
|
|
12308
|
+
### 分页响应格式
|
|
12309
|
+
```json
|
|
12310
|
+
{
|
|
12311
|
+
"code": 200,
|
|
12312
|
+
"message": "查询成功",
|
|
12313
|
+
"data": {
|
|
12314
|
+
"records": [], // 数据列表
|
|
12315
|
+
"total": 100, // 总记录数
|
|
12316
|
+
"size": 10, // 每页大小
|
|
12317
|
+
"current": 1, // 当前页码
|
|
12318
|
+
"pages": 10 // 总页数
|
|
12319
|
+
}
|
|
12320
|
+
}
|
|
12321
|
+
```
|
|
12322
|
+
|
|
12323
|
+
### 请求头规范
|
|
12324
|
+
| 请求头 | 必填 | 说明 |
|
|
12325
|
+
|--------|------|------|
|
|
12326
|
+
| Content-Type | 是 | application/json |
|
|
12327
|
+
| Authorization | 是 | Bearer {token} |
|
|
12328
|
+
| X-Request-ID | 否 | 请求追踪ID |
|
|
12329
|
+
| Accept-Language | 否 | 语言偏好 |
|
|
12330
|
+
|
|
12331
|
+
### 错误响应格式
|
|
12332
|
+
```json
|
|
12333
|
+
{
|
|
12334
|
+
"code": 400,
|
|
12335
|
+
"message": "参数验证失败",
|
|
12336
|
+
"data": {
|
|
12337
|
+
"errors": [
|
|
12338
|
+
{
|
|
12339
|
+
"field": "username",
|
|
12340
|
+
"message": "用户名不能为空"
|
|
12341
|
+
}
|
|
12342
|
+
]
|
|
12343
|
+
},
|
|
12344
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12345
|
+
"path": "/api/users"
|
|
12346
|
+
}
|
|
12347
|
+
```
|
|
12348
|
+
|
|
12349
|
+
- id: authentication
|
|
12350
|
+
title: 认证授权
|
|
12351
|
+
required: true
|
|
12352
|
+
template: |
|
|
12353
|
+
## 认证授权
|
|
12354
|
+
|
|
12355
|
+
### JWT Token规范
|
|
12356
|
+
```
|
|
12357
|
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
|
12358
|
+
```
|
|
12359
|
+
|
|
12360
|
+
### Token结构
|
|
12361
|
+
```json
|
|
12362
|
+
{
|
|
12363
|
+
"header": {
|
|
12364
|
+
"alg": "HS256",
|
|
12365
|
+
"typ": "JWT"
|
|
12366
|
+
},
|
|
12367
|
+
"payload": {
|
|
12368
|
+
"sub": "user_id",
|
|
12369
|
+
"username": "johndoe",
|
|
12370
|
+
"roles": ["USER", "ADMIN"],
|
|
12371
|
+
"exp": 1640995200,
|
|
12372
|
+
"iat": 1640908800
|
|
12373
|
+
}
|
|
12374
|
+
}
|
|
12375
|
+
```
|
|
12376
|
+
|
|
12377
|
+
### 权限控制
|
|
12378
|
+
| 角色 | 权限描述 | 可访问资源 |
|
|
12379
|
+
|------|----------|------------|
|
|
12380
|
+
| ADMIN | 管理员权限 | 所有资源 |
|
|
12381
|
+
| USER | 普通用户权限 | 用户相关资源 |
|
|
12382
|
+
| GUEST | 访客权限 | 公开资源 |
|
|
12383
|
+
|
|
12384
|
+
- id: api_endpoints
|
|
12385
|
+
title: API端点设计
|
|
12386
|
+
required: true
|
|
12387
|
+
template: |
|
|
12388
|
+
## API端点设计
|
|
12389
|
+
|
|
12390
|
+
{for_each_entity}
|
|
12391
|
+
### {entity_name} API
|
|
12392
|
+
|
|
12393
|
+
#### 基础信息
|
|
12394
|
+
- **资源名称**: {entity_name}
|
|
12395
|
+
- **数据库表**: {table_name}
|
|
12396
|
+
- **基础路径**: /api/{entity_lowercase}
|
|
12397
|
+
|
|
12398
|
+
#### 端点列表
|
|
12399
|
+
| HTTP方法 | 路径 | 操作 | 说明 |
|
|
12400
|
+
|----------|------|------|------|
|
|
12401
|
+
| GET | /api/{entity_lowercase} | 查询列表 | 分页查询{entity_name}列表 |
|
|
12402
|
+
| GET | /api/{entity_lowercase}/{id} | 查询详情 | 根据ID查询{entity_name}详情 |
|
|
12403
|
+
| POST | /api/{entity_lowercase} | 创建 | 创建新的{entity_name} |
|
|
12404
|
+
| PUT | /api/{entity_lowercase}/{id} | 更新 | 更新{entity_name}信息 |
|
|
12405
|
+
| DELETE | /api/{entity_lowercase}/{id} | 删除 | 删除{entity_name} |
|
|
12406
|
+
|
|
12407
|
+
#### 1. 查询{entity_name}列表
|
|
12408
|
+
|
|
12409
|
+
**接口描述**: 分页查询{entity_name}列表,支持条件筛选
|
|
12410
|
+
**HTTP方法**: GET
|
|
12411
|
+
**请求路径**: /api/{entity_lowercase}
|
|
12412
|
+
**权限要求**: {required_permissions}
|
|
12413
|
+
|
|
12414
|
+
**请求参数**:
|
|
12415
|
+
```
|
|
12416
|
+
Query Parameters:
|
|
12417
|
+
- page: integer (可选, 默认1) // 页码
|
|
12418
|
+
- size: integer (可选, 默认10) // 每页大小
|
|
12419
|
+
- sort: string (可选) // 排序字段,格式:field,direction
|
|
12420
|
+
{query_parameters}
|
|
12421
|
+
```
|
|
12422
|
+
|
|
12423
|
+
**请求示例**:
|
|
12424
|
+
```bash
|
|
12425
|
+
curl -X GET "{base_url}/api/{entity_lowercase}?page=1&size=10&sort=createdAt,desc" \
|
|
12426
|
+
-H "Authorization: Bearer {token}" \
|
|
12427
|
+
-H "Content-Type: application/json"
|
|
12428
|
+
```
|
|
12429
|
+
|
|
12430
|
+
**成功响应** (200):
|
|
12431
|
+
```json
|
|
12432
|
+
{
|
|
12433
|
+
"code": 200,
|
|
12434
|
+
"message": "查询成功",
|
|
12435
|
+
"data": {
|
|
12436
|
+
"records": [
|
|
12437
|
+
{
|
|
12438
|
+
{response_fields}
|
|
12439
|
+
}
|
|
12440
|
+
],
|
|
12441
|
+
"total": 100,
|
|
12442
|
+
"size": 10,
|
|
12443
|
+
"current": 1,
|
|
12444
|
+
"pages": 10
|
|
12445
|
+
},
|
|
12446
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12447
|
+
"path": "/api/{entity_lowercase}"
|
|
12448
|
+
}
|
|
12449
|
+
```
|
|
12450
|
+
|
|
12451
|
+
#### 2. 查询{entity_name}详情
|
|
12452
|
+
|
|
12453
|
+
**接口描述**: 根据ID查询{entity_name}详细信息
|
|
12454
|
+
**HTTP方法**: GET
|
|
12455
|
+
**请求路径**: /api/{entity_lowercase}/{id}
|
|
12456
|
+
**权限要求**: {required_permissions}
|
|
12457
|
+
|
|
12458
|
+
**路径参数**:
|
|
12459
|
+
```
|
|
12460
|
+
- id: integer (必填) // {entity_name}的唯一标识
|
|
12461
|
+
```
|
|
12462
|
+
|
|
12463
|
+
**请求示例**:
|
|
12464
|
+
```bash
|
|
12465
|
+
curl -X GET "{base_url}/api/{entity_lowercase}/123" \
|
|
12466
|
+
-H "Authorization: Bearer {token}" \
|
|
12467
|
+
-H "Content-Type: application/json"
|
|
12468
|
+
```
|
|
12469
|
+
|
|
12470
|
+
**成功响应** (200):
|
|
12471
|
+
```json
|
|
12472
|
+
{
|
|
12473
|
+
"code": 200,
|
|
12474
|
+
"message": "查询成功",
|
|
12475
|
+
"data": {
|
|
12476
|
+
{detail_response_fields}
|
|
12477
|
+
},
|
|
12478
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12479
|
+
"path": "/api/{entity_lowercase}/123"
|
|
12480
|
+
}
|
|
12481
|
+
```
|
|
12482
|
+
|
|
12483
|
+
**错误响应** (404):
|
|
12484
|
+
```json
|
|
12485
|
+
{
|
|
12486
|
+
"code": 404,
|
|
12487
|
+
"message": "{entity_name}不存在",
|
|
12488
|
+
"data": null,
|
|
12489
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12490
|
+
"path": "/api/{entity_lowercase}/123"
|
|
12491
|
+
}
|
|
12492
|
+
```
|
|
12493
|
+
|
|
12494
|
+
#### 3. 创建{entity_name}
|
|
12495
|
+
|
|
12496
|
+
**接口描述**: 创建新的{entity_name}记录
|
|
12497
|
+
**HTTP方法**: POST
|
|
12498
|
+
**请求路径**: /api/{entity_lowercase}
|
|
12499
|
+
**权限要求**: {required_permissions}
|
|
12500
|
+
|
|
12501
|
+
**请求体**:
|
|
12502
|
+
```json
|
|
12503
|
+
{
|
|
12504
|
+
{create_request_fields}
|
|
12505
|
+
}
|
|
12506
|
+
```
|
|
12507
|
+
|
|
12508
|
+
**请求示例**:
|
|
12509
|
+
```bash
|
|
12510
|
+
curl -X POST "{base_url}/api/{entity_lowercase}" \
|
|
12511
|
+
-H "Authorization: Bearer {token}" \
|
|
12512
|
+
-H "Content-Type: application/json" \
|
|
12513
|
+
-d '{
|
|
12514
|
+
{create_request_example}
|
|
12515
|
+
}'
|
|
12516
|
+
```
|
|
12517
|
+
|
|
12518
|
+
**成功响应** (201):
|
|
12519
|
+
```json
|
|
12520
|
+
{
|
|
12521
|
+
"code": 201,
|
|
12522
|
+
"message": "创建成功",
|
|
12523
|
+
"data": {
|
|
12524
|
+
{create_response_fields}
|
|
12525
|
+
},
|
|
12526
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12527
|
+
"path": "/api/{entity_lowercase}"
|
|
12528
|
+
}
|
|
12529
|
+
```
|
|
12530
|
+
|
|
12531
|
+
**参数验证失败** (422):
|
|
12532
|
+
```json
|
|
12533
|
+
{
|
|
12534
|
+
"code": 422,
|
|
12535
|
+
"message": "参数验证失败",
|
|
12536
|
+
"data": {
|
|
12537
|
+
"errors": [
|
|
12538
|
+
{
|
|
12539
|
+
"field": "{field_name}",
|
|
12540
|
+
"message": "{validation_message}"
|
|
12541
|
+
}
|
|
12542
|
+
]
|
|
12543
|
+
},
|
|
12544
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12545
|
+
"path": "/api/{entity_lowercase}"
|
|
12546
|
+
}
|
|
12547
|
+
```
|
|
12548
|
+
|
|
12549
|
+
#### 4. 更新{entity_name}
|
|
12550
|
+
|
|
12551
|
+
**接口描述**: 更新{entity_name}信息
|
|
12552
|
+
**HTTP方法**: PUT
|
|
12553
|
+
**请求路径**: /api/{entity_lowercase}/{id}
|
|
12554
|
+
**权限要求**: {required_permissions}
|
|
12555
|
+
|
|
12556
|
+
**路径参数**:
|
|
12557
|
+
```
|
|
12558
|
+
- id: integer (必填) // {entity_name}的唯一标识
|
|
12559
|
+
```
|
|
12560
|
+
|
|
12561
|
+
**请求体**:
|
|
12562
|
+
```json
|
|
12563
|
+
{
|
|
12564
|
+
{update_request_fields}
|
|
12565
|
+
}
|
|
12566
|
+
```
|
|
12567
|
+
|
|
12568
|
+
**请求示例**:
|
|
12569
|
+
```bash
|
|
12570
|
+
curl -X PUT "{base_url}/api/{entity_lowercase}/123" \
|
|
12571
|
+
-H "Authorization: Bearer {token}" \
|
|
12572
|
+
-H "Content-Type: application/json" \
|
|
12573
|
+
-d '{
|
|
12574
|
+
{update_request_example}
|
|
12575
|
+
}'
|
|
12576
|
+
```
|
|
12577
|
+
|
|
12578
|
+
**成功响应** (200):
|
|
12579
|
+
```json
|
|
12580
|
+
{
|
|
12581
|
+
"code": 200,
|
|
12582
|
+
"message": "更新成功",
|
|
12583
|
+
"data": {
|
|
12584
|
+
{update_response_fields}
|
|
12585
|
+
},
|
|
12586
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12587
|
+
"path": "/api/{entity_lowercase}/123"
|
|
12588
|
+
}
|
|
12589
|
+
```
|
|
12590
|
+
|
|
12591
|
+
#### 5. 删除{entity_name}
|
|
12592
|
+
|
|
12593
|
+
**接口描述**: 删除{entity_name}记录(软删除)
|
|
12594
|
+
**HTTP方法**: DELETE
|
|
12595
|
+
**请求路径**: /api/{entity_lowercase}/{id}
|
|
12596
|
+
**权限要求**: {required_permissions}
|
|
12597
|
+
|
|
12598
|
+
**路径参数**:
|
|
12599
|
+
```
|
|
12600
|
+
- id: integer (必填) // {entity_name}的唯一标识
|
|
12601
|
+
```
|
|
12602
|
+
|
|
12603
|
+
**请求示例**:
|
|
12604
|
+
```bash
|
|
12605
|
+
curl -X DELETE "{base_url}/api/{entity_lowercase}/123" \
|
|
12606
|
+
-H "Authorization: Bearer {token}" \
|
|
12607
|
+
-H "Content-Type: application/json"
|
|
12608
|
+
```
|
|
12609
|
+
|
|
12610
|
+
**成功响应** (204):
|
|
12611
|
+
```
|
|
12612
|
+
HTTP/1.1 204 No Content
|
|
12613
|
+
```
|
|
12614
|
+
|
|
12615
|
+
**错误响应** (404):
|
|
12616
|
+
```json
|
|
12617
|
+
{
|
|
12618
|
+
"code": 404,
|
|
12619
|
+
"message": "{entity_name}不存在",
|
|
12620
|
+
"data": null,
|
|
12621
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12622
|
+
"path": "/api/{entity_lowercase}/123"
|
|
12623
|
+
}
|
|
12624
|
+
```
|
|
12625
|
+
|
|
12626
|
+
#### 数据字段映射
|
|
12627
|
+
|
|
12628
|
+
**数据库字段 -> API响应字段映射**:
|
|
12629
|
+
| 数据库字段 | API字段 | 数据类型 | 说明 |
|
|
12630
|
+
|------------|---------|----------|------|
|
|
12631
|
+
{field_mappings}
|
|
12632
|
+
|
|
12633
|
+
**API请求字段 -> 数据库字段映射**:
|
|
12634
|
+
| API字段 | 数据库字段 | 数据类型 | 验证规则 |
|
|
12635
|
+
|---------|------------|----------|----------|
|
|
12636
|
+
{request_field_mappings}
|
|
12637
|
+
|
|
12638
|
+
#### 业务规则说明
|
|
12639
|
+
{business_rules}
|
|
12640
|
+
|
|
12641
|
+
{end_for_each}
|
|
12642
|
+
|
|
12643
|
+
- id: data_types
|
|
12644
|
+
title: 数据类型规范
|
|
12645
|
+
required: true
|
|
12646
|
+
template: |
|
|
12647
|
+
## 数据类型规范
|
|
12648
|
+
|
|
12649
|
+
### 基础数据类型
|
|
12650
|
+
| API类型 | JSON类型 | 数据库类型 | 说明 | 示例 |
|
|
12651
|
+
|---------|----------|------------|------|------|
|
|
12652
|
+
| integer | number | INT/BIGINT | 整数 | 123 |
|
|
12653
|
+
| decimal | number | DECIMAL | 小数 | 123.45 |
|
|
12654
|
+
| string | string | VARCHAR/TEXT | 字符串 | "hello" |
|
|
12655
|
+
| boolean | boolean | TINYINT | 布尔值 | true/false |
|
|
12656
|
+
| datetime | string | DATETIME | 日期时间 | "2024-01-01T12:00:00Z" |
|
|
12657
|
+
| date | string | DATE | 日期 | "2024-01-01" |
|
|
12658
|
+
| time | string | TIME | 时间 | "12:00:00" |
|
|
12659
|
+
| array | array | JSON | 数组 | [1,2,3] |
|
|
12660
|
+
| object | object | JSON | 对象 | {"key":"value"} |
|
|
12661
|
+
|
|
12662
|
+
### 特殊字段规范
|
|
12663
|
+
| 字段类型 | 字段名 | 数据类型 | 说明 |
|
|
12664
|
+
|----------|--------|----------|------|
|
|
12665
|
+
| 主键 | id | integer | 自增主键 |
|
|
12666
|
+
| 创建时间 | createdAt | datetime | 记录创建时间 |
|
|
12667
|
+
| 更新时间 | updatedAt | datetime | 记录更新时间 |
|
|
12668
|
+
| 删除时间 | deletedAt | datetime | 软删除时间 |
|
|
12669
|
+
| 版本号 | version | integer | 乐观锁版本 |
|
|
12670
|
+
|
|
12671
|
+
### 日期时间格式
|
|
12672
|
+
- **标准格式**: ISO 8601 (2024-01-01T12:00:00Z)
|
|
12673
|
+
- **时区**: UTC时间
|
|
12674
|
+
- **精度**: 秒级
|
|
12675
|
+
|
|
12676
|
+
- id: validation_rules
|
|
12677
|
+
title: 参数验证规则
|
|
12678
|
+
required: true
|
|
12679
|
+
template: |
|
|
12680
|
+
## 参数验证规则
|
|
12681
|
+
|
|
12682
|
+
### 通用验证规则
|
|
12683
|
+
| 规则类型 | 说明 | 示例 |
|
|
12684
|
+
|----------|------|------|
|
|
12685
|
+
| required | 必填字段 | @NotNull, @NotBlank |
|
|
12686
|
+
| length | 长度限制 | @Size(min=1, max=50) |
|
|
12687
|
+
| pattern | 格式验证 | @Pattern(regexp="^[a-zA-Z0-9]+$") |
|
|
12688
|
+
| range | 数值范围 | @Min(0), @Max(100) |
|
|
12689
|
+
| email | 邮箱格式 | @Email |
|
|
12690
|
+
| phone | 手机号格式 | @Pattern(regexp="^1[3-9]\\d{9}$") |
|
|
12691
|
+
|
|
12692
|
+
### 业务验证规则
|
|
12693
|
+
{business_validation_rules}
|
|
12694
|
+
|
|
12695
|
+
### 错误信息国际化
|
|
12696
|
+
```properties
|
|
12697
|
+
validation.required=字段不能为空
|
|
12698
|
+
validation.length=字段长度必须在{min}到{max}之间
|
|
12699
|
+
validation.pattern=字段格式不正确
|
|
12700
|
+
validation.email=邮箱格式不正确
|
|
12701
|
+
validation.phone=手机号格式不正确
|
|
12702
|
+
```
|
|
12703
|
+
|
|
12704
|
+
- id: error_codes
|
|
12705
|
+
title: 错误码定义
|
|
12706
|
+
required: true
|
|
12707
|
+
template: |
|
|
12708
|
+
## 错误码定义
|
|
12709
|
+
|
|
12710
|
+
### 系统级错误码 (1000-1999)
|
|
12711
|
+
| 错误码 | 错误信息 | 说明 | 处理建议 |
|
|
12712
|
+
|--------|----------|------|----------|
|
|
12713
|
+
| 1000 | 系统错误 | 未知系统错误 | 联系技术支持 |
|
|
12714
|
+
| 1001 | 参数错误 | 请求参数不正确 | 检查参数格式 |
|
|
12715
|
+
| 1002 | 认证失败 | 身份认证失败 | 重新登录 |
|
|
12716
|
+
| 1003 | 权限不足 | 无访问权限 | 联系管理员 |
|
|
12717
|
+
| 1004 | 资源不存在 | 请求的资源不存在 | 检查资源ID |
|
|
12718
|
+
| 1005 | 资源冲突 | 资源已存在或冲突 | 检查数据唯一性 |
|
|
12719
|
+
|
|
12720
|
+
### 业务级错误码 (2000+)
|
|
12721
|
+
{business_error_codes}
|
|
12722
|
+
|
|
12723
|
+
### 错误响应示例
|
|
12724
|
+
```json
|
|
12725
|
+
{
|
|
12726
|
+
"code": 1001,
|
|
12727
|
+
"message": "参数错误",
|
|
12728
|
+
"data": {
|
|
12729
|
+
"errorCode": "PARAM_INVALID",
|
|
12730
|
+
"errorDetails": "用户名格式不正确"
|
|
12731
|
+
},
|
|
12732
|
+
"timestamp": "2024-01-01T12:00:00Z",
|
|
12733
|
+
"path": "/api/users"
|
|
12734
|
+
}
|
|
12735
|
+
```
|
|
12736
|
+
|
|
12737
|
+
- id: performance
|
|
12738
|
+
title: 性能规范
|
|
12739
|
+
required: true
|
|
12740
|
+
template: |
|
|
12741
|
+
## 性能规范
|
|
12742
|
+
|
|
12743
|
+
### 响应时间要求
|
|
12744
|
+
| 接口类型 | 响应时间要求 | 说明 |
|
|
12745
|
+
|----------|--------------|------|
|
|
12746
|
+
| 查询接口 | < 200ms | 简单查询 |
|
|
12747
|
+
| 复杂查询 | < 1s | 包含关联查询 |
|
|
12748
|
+
| 创建接口 | < 500ms | 数据创建 |
|
|
12749
|
+
| 更新接口 | < 500ms | 数据更新 |
|
|
12750
|
+
| 删除接口 | < 300ms | 数据删除 |
|
|
12751
|
+
|
|
12752
|
+
### 分页限制
|
|
12753
|
+
- 默认页大小: 10
|
|
12754
|
+
- 最大页大小: 100
|
|
12755
|
+
- 支持的排序字段: {sortable_fields}
|
|
12756
|
+
|
|
12757
|
+
### 缓存策略
|
|
12758
|
+
| 数据类型 | 缓存时间 | 缓存键规则 |
|
|
12759
|
+
|----------|----------|------------|
|
|
12760
|
+
| 用户信息 | 30分钟 | user:{user_id} |
|
|
12761
|
+
| 配置信息 | 1小时 | config:{config_key} |
|
|
12762
|
+
| 静态数据 | 24小时 | static:{data_type} |
|
|
12763
|
+
|
|
12764
|
+
- id: security
|
|
12765
|
+
title: 安全规范
|
|
12766
|
+
required: true
|
|
12767
|
+
template: |
|
|
12768
|
+
## 安全规范
|
|
12769
|
+
|
|
12770
|
+
### 数据安全
|
|
12771
|
+
- **敏感数据加密**: 密码、身份证号等
|
|
12772
|
+
- **数据脱敏**: 日志中的敏感信息
|
|
12773
|
+
- **SQL注入防护**: 使用参数化查询
|
|
12774
|
+
- **XSS防护**: 输入数据过滤和转义
|
|
12775
|
+
|
|
12776
|
+
### 接口安全
|
|
12777
|
+
- **HTTPS传输**: 强制使用HTTPS
|
|
12778
|
+
- **请求签名**: 关键接口要求签名验证
|
|
12779
|
+
- **频率限制**: 防止恶意请求
|
|
12780
|
+
- **IP白名单**: 敏感接口IP限制
|
|
12781
|
+
|
|
12782
|
+
### 认证安全
|
|
12783
|
+
- **Token过期**: JWT token有效期控制
|
|
12784
|
+
- **刷新机制**: Token自动刷新
|
|
12785
|
+
- **会话管理**: 用户会话状态管理
|
|
12786
|
+
- **密码策略**: 密码复杂度要求
|
|
12787
|
+
|
|
12788
|
+
- id: testing
|
|
12789
|
+
title: 测试规范
|
|
12790
|
+
required: true
|
|
12791
|
+
template: |
|
|
12792
|
+
## 测试规范
|
|
12793
|
+
|
|
12794
|
+
### API测试用例
|
|
12795
|
+
|
|
12796
|
+
**测试用例模板**:
|
|
12797
|
+
```yaml
|
|
12798
|
+
test_case:
|
|
12799
|
+
name: "创建用户成功"
|
|
12800
|
+
method: POST
|
|
12801
|
+
url: "/api/users"
|
|
12802
|
+
headers:
|
|
12803
|
+
Authorization: "Bearer {valid_token}"
|
|
12804
|
+
Content-Type: "application/json"
|
|
12805
|
+
body:
|
|
12806
|
+
username: "testuser"
|
|
12807
|
+
email: "test@example.com"
|
|
12808
|
+
password: "Test123456!"
|
|
12809
|
+
expected:
|
|
12810
|
+
status: 201
|
|
12811
|
+
body:
|
|
12812
|
+
code: 201
|
|
12813
|
+
message: "创建成功"
|
|
12814
|
+
data:
|
|
12815
|
+
id: "{integer}"
|
|
12816
|
+
username: "testuser"
|
|
12817
|
+
email: "test@example.com"
|
|
12818
|
+
```
|
|
12819
|
+
|
|
12820
|
+
### 测试数据
|
|
12821
|
+
```yaml
|
|
12822
|
+
test_data:
|
|
12823
|
+
valid_user:
|
|
12824
|
+
username: "validuser"
|
|
12825
|
+
email: "valid@example.com"
|
|
12826
|
+
password: "Valid123456!"
|
|
12827
|
+
invalid_user:
|
|
12828
|
+
username: "" # 空用户名
|
|
12829
|
+
email: "invalid-email" # 无效邮箱
|
|
12830
|
+
password: "123" # 密码过短
|
|
12831
|
+
```
|
|
12832
|
+
|
|
12833
|
+
### 性能测试
|
|
12834
|
+
- **并发用户数**: 100
|
|
12835
|
+
- **测试时长**: 10分钟
|
|
12836
|
+
- **响应时间**: 95%请求 < 1s
|
|
12837
|
+
- **成功率**: > 99.9%
|
|
12838
|
+
|
|
12839
|
+
- id: documentation
|
|
12840
|
+
title: 文档规范
|
|
12841
|
+
required: true
|
|
12842
|
+
template: |
|
|
12843
|
+
## 文档规范
|
|
12844
|
+
|
|
12845
|
+
### Swagger/OpenAPI规范
|
|
12846
|
+
```yaml
|
|
12847
|
+
openapi: 3.0.0
|
|
12848
|
+
info:
|
|
12849
|
+
title: {project_name} API
|
|
12850
|
+
version: {api_version}
|
|
12851
|
+
description: {project_description}
|
|
12852
|
+
servers:
|
|
12853
|
+
- url: {base_url}
|
|
12854
|
+
description: 生产环境
|
|
12855
|
+
paths:
|
|
12856
|
+
/api/{entity_lowercase}:
|
|
12857
|
+
get:
|
|
12858
|
+
summary: 查询{entity_name}列表
|
|
12859
|
+
tags: [{entity_name}]
|
|
12860
|
+
parameters:
|
|
12861
|
+
- name: page
|
|
12862
|
+
in: query
|
|
12863
|
+
schema:
|
|
12864
|
+
type: integer
|
|
12865
|
+
default: 1
|
|
12866
|
+
responses:
|
|
12867
|
+
'200':
|
|
12868
|
+
description: 查询成功
|
|
12869
|
+
content:
|
|
12870
|
+
application/json:
|
|
12871
|
+
schema:
|
|
12872
|
+
$ref: '#/components/schemas/PageResult'
|
|
12873
|
+
```
|
|
12874
|
+
|
|
12875
|
+
### 接口文档要求
|
|
12876
|
+
- **完整性**: 包含所有接口信息
|
|
12877
|
+
- **准确性**: 与实际实现保持一致
|
|
12878
|
+
- **实时性**: 及时更新文档内容
|
|
12879
|
+
- **可读性**: 清晰的描述和示例
|
|
12880
|
+
|
|
12881
|
+
### 示例代码
|
|
12882
|
+
```javascript
|
|
12883
|
+
// JavaScript调用示例
|
|
12884
|
+
const response = await fetch('/api/users', {
|
|
12885
|
+
method: 'POST',
|
|
12886
|
+
headers: {
|
|
12887
|
+
'Content-Type': 'application/json',
|
|
12888
|
+
'Authorization': 'Bearer ' + token
|
|
12889
|
+
},
|
|
12890
|
+
body: JSON.stringify({
|
|
12891
|
+
username: 'johndoe',
|
|
12892
|
+
email: 'john@example.com'
|
|
12893
|
+
})
|
|
12894
|
+
});
|
|
12895
|
+
const result = await response.json();
|
|
12896
|
+
```
|
|
12897
|
+
|
|
12898
|
+
- id: versioning
|
|
12899
|
+
title: 版本管理
|
|
12900
|
+
required: true
|
|
12901
|
+
template: |
|
|
12902
|
+
## 版本管理
|
|
12903
|
+
|
|
12904
|
+
### 版本号规范
|
|
12905
|
+
- **格式**: v{major}.{minor}.{patch}
|
|
12906
|
+
- **示例**: v1.0.0, v1.1.0, v2.0.0
|
|
12907
|
+
|
|
12908
|
+
### 版本策略
|
|
12909
|
+
| 版本类型 | 变更说明 | 兼容性 |
|
|
12910
|
+
|----------|----------|--------|
|
|
12911
|
+
| Major | 重大功能变更,API不兼容 | 不兼容 |
|
|
12912
|
+
| Minor | 新增功能,向后兼容 | 向后兼容 |
|
|
12913
|
+
| Patch | Bug修复,向后兼容 | 向后兼容 |
|
|
12914
|
+
|
|
12915
|
+
### 版本控制方式
|
|
12916
|
+
1. **URL路径版本**: /api/v1/users
|
|
12917
|
+
2. **请求头版本**: API-Version: v1
|
|
12918
|
+
3. **参数版本**: /api/users?version=v1
|
|
12919
|
+
|
|
12920
|
+
### 版本生命周期
|
|
12921
|
+
- **开发版本**: v1.0.0-dev
|
|
12922
|
+
- **测试版本**: v1.0.0-beta
|
|
12923
|
+
- **发布版本**: v1.0.0
|
|
12924
|
+
- **废弃版本**: 提前3个月通知
|
|
12925
|
+
|
|
12926
|
+
- id: changelog
|
|
12927
|
+
title: 变更记录
|
|
12928
|
+
required: true
|
|
12929
|
+
template: |
|
|
12930
|
+
## 变更记录
|
|
12931
|
+
|
|
12932
|
+
### v1.0.0 (2024-01-01)
|
|
12933
|
+
**新增功能**:
|
|
12934
|
+
- 初始API设计
|
|
12935
|
+
- 用户管理接口
|
|
12936
|
+
- 认证授权机制
|
|
12937
|
+
|
|
12938
|
+
**修复问题**:
|
|
12939
|
+
- 无
|
|
12940
|
+
|
|
12941
|
+
**破坏性变更**:
|
|
12942
|
+
- 无
|
|
12943
|
+
|
|
12944
|
+
### 变更记录模板
|
|
12945
|
+
```markdown
|
|
12946
|
+
### v{version} ({date})
|
|
12947
|
+
**新增功能**:
|
|
12948
|
+
- 功能描述
|
|
12949
|
+
|
|
12950
|
+
**修复问题**:
|
|
12951
|
+
- 问题描述
|
|
12952
|
+
|
|
12953
|
+
**破坏性变更**:
|
|
12954
|
+
- 变更描述
|
|
12955
|
+
```
|
|
12956
|
+
==================== END: .xiaoma-core/templates/api-design-tmpl.yaml ====================
|
|
12957
|
+
|
|
11207
12958
|
==================== START: .xiaoma-core/checklists/story-draft-checklist.md ====================
|
|
11208
12959
|
<!-- Powered by XiaoMa™ Core -->
|
|
11209
12960
|
|