@zeyue0329/xiaoma-cli 1.0.47 → 1.0.49

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.
@@ -0,0 +1,601 @@
1
+ template:
2
+ id: incremental-architecture-template-v1
3
+ name: 架构增量设计文档
4
+ version: 1.0
5
+ description: 基于知识库和PRD进行架构增量设计,识别技术变动并生成增量架构文档
6
+ output:
7
+ format: markdown
8
+ filename: docs/architecture-increment.md
9
+ title: "{{project_name}} 架构增量设计文档"
10
+
11
+ workflow:
12
+ mode: interactive
13
+ elicitation: advanced-elicitation
14
+ upstream:
15
+ agents:
16
+ - analyst # 提供技术知识库
17
+ - pm # 提供PRD文档
18
+ required_files:
19
+ - docs/prd.md
20
+ - docs/rag/technical/architecture.md
21
+ optional_files:
22
+ - docs/rag/technical/tech-stack.md
23
+ - docs/rag/technical/data-model.md
24
+ - docs/rag/technical/module-structure.md
25
+ - docs/rag/technical/coding-standards/*
26
+ - docs/rag/technical/middleware/*
27
+ - docs/rag/constraints/*
28
+
29
+ sections:
30
+ - id: input-validation
31
+ title: 输入验证
32
+ internal: true
33
+ instruction: |
34
+ 在开始架构设计之前,执行以下验证:
35
+
36
+ 1. **检查PRD文档**:
37
+ - docs/prd.md 或 docs/epic-{name}.md 是否存在
38
+ - 提取功能需求(FR)、非功能需求(NFR)、数据实体、技术约束
39
+
40
+ 2. **检查技术知识库**:
41
+ - docs/rag/technical/architecture.md (现有架构)
42
+ - docs/rag/technical/data-model.md (现有数据模型)
43
+ - docs/rag/technical/coding-standards/ (编码规范)
44
+ - docs/rag/technical/middleware/ (中间件规范)
45
+
46
+ 3. **加载现有架构信息**:
47
+ - 架构模式、技术栈、模块结构
48
+ - 现有数据实体和关系
49
+ - 编码规范和中间件使用方式
50
+
51
+ 如果缺少必需文件,提示:
52
+ "⚠️ 缺少必需的输入文件:
53
+ - PRD文档:请先执行 PM 智能体 *create-prd-from-rag
54
+ - 技术知识库:请先执行 Analyst 智能体完善技术知识"
55
+
56
+ - id: document-header
57
+ title: 文档信息
58
+ sections:
59
+ - id: meta-info
60
+ title: 元信息
61
+ template: |
62
+ | 属性 | 值 |
63
+ |------|-----|
64
+ | 文档版本 | {{version}} |
65
+ | 生成时间 | {{timestamp}} |
66
+ | 关联PRD | {{prd_path}} |
67
+ | 技术知识库版本 | {{rag_version}} |
68
+ | 架构师 | Architect Agent |
69
+ - id: changelog
70
+ title: 变更日志
71
+ type: table
72
+ columns: [日期, 版本, 变更内容, 作者]
73
+
74
+ - id: existing-architecture-summary
75
+ title: 现有架构概要
76
+ instruction: |
77
+ 从技术知识库提取现有架构信息,作为增量设计的基线。
78
+
79
+ **来源**:
80
+ - docs/rag/technical/architecture.md
81
+ - docs/rag/technical/tech-stack.md
82
+ - docs/rag/technical/module-structure.md
83
+ sections:
84
+ - id: architecture-pattern
85
+ title: 架构模式
86
+ instruction: 从 architecture.md 提取架构模式描述
87
+ template: |
88
+ **架构类型**: {{architecture_type}}
89
+ **分层结构**: {{layer_structure}}
90
+ **关键特征**: {{key_characteristics}}
91
+ - id: tech-stack-baseline
92
+ title: 技术栈基线
93
+ type: table
94
+ columns: [类别, 技术, 版本, 用途]
95
+ instruction: 从 tech-stack.md 提取当前技术栈
96
+ - id: module-structure-baseline
97
+ title: 模块结构基线
98
+ instruction: 从 module-structure.md 提取现有模块结构
99
+ type: code
100
+ language: plaintext
101
+ - id: data-model-baseline
102
+ title: 数据模型基线
103
+ instruction: |
104
+ 从 data-model.md 提取现有数据实体清单。
105
+ 使用Mermaid ER图展示核心实体关系。
106
+
107
+ - id: requirement-extraction
108
+ title: 需求提取
109
+ instruction: |
110
+ 从PRD文档提取与架构相关的需求。
111
+
112
+ **来源**:
113
+ - docs/prd.md 或 docs/epic-{name}.md
114
+ sections:
115
+ - id: functional-requirements
116
+ title: 功能性需求摘要
117
+ type: table
118
+ columns: [需求ID, 需求描述, 架构影响, 优先级]
119
+ instruction: |
120
+ 提取PRD中的功能性需求(FR),评估每个需求的架构影响:
121
+ - 无影响:完全在现有架构内实现
122
+ - 小影响:需要新增类/方法
123
+ - 中影响:需要新增模块/表
124
+ - 大影响:需要架构调整
125
+ - id: non-functional-requirements
126
+ title: 非功能性需求摘要
127
+ type: table
128
+ columns: [需求ID, 需求描述, 约束类型, 架构影响]
129
+ instruction: 提取PRD中的非功能性需求(NFR),特别关注性能、安全、可用性约束
130
+ - id: data-requirements
131
+ title: 数据需求摘要
132
+ type: table
133
+ columns: [实体名称, 操作类型, 核心属性, 关联实体]
134
+ instruction: |
135
+ 从PRD中提取数据实体需求,标注:
136
+ - 新增:PRD中定义的新实体
137
+ - 修改:需要变更的现有实体
138
+ - 复用:直接使用的现有实体
139
+
140
+ - id: change-analysis
141
+ title: 架构变动分析
142
+ instruction: |
143
+ 对比现有架构与新需求,识别所有技术变动点。
144
+
145
+ **分析维度**:
146
+ 1. 架构层面变动
147
+ 2. 技术栈变动
148
+ 3. 数据模型变动
149
+ 4. 接口变动
150
+ 5. 中间件变动
151
+
152
+ 展示分析结果,请用户确认变动识别是否准确。
153
+ elicit: true
154
+ sections:
155
+ - id: change-overview
156
+ title: 变动总览
157
+ template: |
158
+ | 维度 | 变动等级 | 变动数量 | 主要变动 |
159
+ |------|----------|----------|----------|
160
+ | 架构层面 | {{arch_level}} | {{arch_count}} | {{arch_main}} |
161
+ | 技术栈 | {{tech_level}} | {{tech_count}} | {{tech_main}} |
162
+ | 数据模型 | {{data_level}} | {{data_count}} | {{data_main}} |
163
+ | 接口 | {{api_level}} | {{api_count}} | {{api_main}} |
164
+ | 中间件 | {{mw_level}} | {{mw_count}} | {{mw_main}} |
165
+
166
+ **总体变动等级**: {{overall_level}}
167
+ **风险等级**: {{risk_level}}
168
+ - id: architecture-changes
169
+ title: 架构层面变动
170
+ condition: 存在架构层面变动
171
+ sections:
172
+ - id: new-modules
173
+ title: 新增模块
174
+ type: table
175
+ columns: [模块名称, 职责, 所属层, 关联需求]
176
+ - id: modified-modules
177
+ title: 修改模块
178
+ type: table
179
+ columns: [模块名称, 变更内容, 变更原因, 关联需求]
180
+ - id: tech-stack-changes
181
+ title: 技术栈变动
182
+ condition: 存在技术栈变动
183
+ sections:
184
+ - id: new-technologies
185
+ title: 新增技术
186
+ type: table
187
+ columns: [技术名称, 版本, 用途, 引入理由, 替代方案]
188
+ - id: version-upgrades
189
+ title: 版本升级
190
+ type: table
191
+ columns: [技术名称, 当前版本, 目标版本, 升级原因, 兼容性风险]
192
+ - id: data-model-changes
193
+ title: 数据模型变动
194
+ sections:
195
+ - id: new-entities
196
+ title: 新增实体
197
+ type: table
198
+ columns: [实体名称, 表名, 核心字段, 关联实体, 关联需求]
199
+ - id: modified-entities
200
+ title: 修改实体
201
+ type: table
202
+ columns: [实体名称, 变更字段, 变更类型, 兼容性, 关联需求]
203
+ - id: new-relationships
204
+ title: 新增关系
205
+ type: table
206
+ columns: [源实体, 目标实体, 关系类型, 关联字段, 关联需求]
207
+ - id: api-changes
208
+ title: 接口变动
209
+ condition: 存在接口变动
210
+ sections:
211
+ - id: new-apis
212
+ title: 新增API
213
+ type: table
214
+ columns: [接口路径, 方法, 功能描述, 关联需求]
215
+ - id: modified-apis
216
+ title: 修改API
217
+ type: table
218
+ columns: [接口路径, 变更内容, 兼容性策略, 关联需求]
219
+ - id: middleware-changes
220
+ title: 中间件变动
221
+ condition: 存在中间件变动
222
+ sections:
223
+ - id: redis-changes
224
+ title: Redis变动
225
+ type: table
226
+ columns: [Key名称, 数据结构, 用途, 过期策略, 关联需求]
227
+ - id: mq-changes
228
+ title: 消息队列变动
229
+ type: table
230
+ columns: [Topic/Queue, 消息类型, 生产者, 消费者, 关联需求]
231
+ - id: scheduler-changes
232
+ title: 定时任务变动
233
+ type: table
234
+ columns: [任务名称, 执行周期, 功能描述, 关联需求]
235
+
236
+ - id: incremental-design
237
+ title: 增量设计详情
238
+ instruction: |
239
+ 为每个变动点提供详细的增量设计方案。
240
+ 设计必须遵循知识库中的编码规范和中间件使用规范。
241
+ elicit: true
242
+ sections:
243
+ - id: module-design
244
+ title: 模块增量设计
245
+ repeatable: true
246
+ instruction: |
247
+ 为每个新增/修改的模块提供详细设计。
248
+ 包结构必须遵循 docs/rag/technical/module-structure.md 中的规范。
249
+ sections:
250
+ - id: module-detail
251
+ title: "{{module_name}}"
252
+ template: |
253
+ **模块类型**: 新增 / 修改
254
+ **职责描述**: {{responsibility}}
255
+ **所属层**: {{layer}}
256
+ **关联需求**: {{related_requirements}}
257
+ sections:
258
+ - id: package-structure
259
+ title: 包结构设计
260
+ instruction: 遵循现有模块结构规范设计包结构
261
+ type: code
262
+ language: plaintext
263
+ - id: class-design
264
+ title: 核心类设计
265
+ instruction: |
266
+ 列出核心类及其职责,命名遵循编码规范:
267
+ - Controller: {Module}Controller
268
+ - Service: {Module}Service / {Module}ServiceImpl
269
+ - DAO: {Module}Mapper / {Module}Repository
270
+ type: table
271
+ columns: [类名, 类型, 职责, 依赖]
272
+ - id: integration-points
273
+ title: 集成点
274
+ instruction: 描述与现有模块的集成方式
275
+ type: bullet-list
276
+
277
+ - id: data-model-design
278
+ title: 数据模型增量设计
279
+ repeatable: true
280
+ instruction: |
281
+ 为每个新增/修改的数据实体提供详细设计。
282
+ 设计必须遵循 docs/rag/technical/sql-standards/ 中的规范。
283
+ sections:
284
+ - id: entity-detail
285
+ title: "{{entity_name}}"
286
+ template: |
287
+ **操作类型**: 新增 / 修改
288
+ **表名**: {{table_name}}
289
+ **关联需求**: {{related_requirements}}
290
+ sections:
291
+ - id: field-design
292
+ title: 字段设计
293
+ type: table
294
+ columns: [字段名, 类型, 长度, 约束, 默认值, 说明]
295
+ instruction: 字段命名遵循数据库命名规范
296
+ - id: index-design
297
+ title: 索引设计
298
+ type: table
299
+ columns: [索引名, 类型, 字段, 用途]
300
+ instruction: 索引命名遵循 idx_{表名}_{字段} 规范
301
+ - id: ddl-script
302
+ title: DDL脚本
303
+ type: code
304
+ language: sql
305
+ instruction: |
306
+ 生成DDL脚本,遵循SQL规范:
307
+ - 包含完整的字段定义
308
+ - 包含索引创建
309
+ - 包含注释
310
+ - id: migration-script
311
+ title: 迁移脚本
312
+ condition: 修改现有表
313
+ type: code
314
+ language: sql
315
+ instruction: 生成安全的迁移脚本,考虑向后兼容性
316
+
317
+ - id: api-design
318
+ title: 接口增量设计
319
+ repeatable: true
320
+ condition: 存在接口变动
321
+ instruction: |
322
+ 为每个新增/修改的API提供详细设计。
323
+ 设计必须遵循现有API规范。
324
+ sections:
325
+ - id: api-detail
326
+ title: "{{api_name}}"
327
+ template: |
328
+ **操作类型**: 新增 / 修改
329
+ **接口路径**: {{api_path}}
330
+ **请求方法**: {{http_method}}
331
+ **功能描述**: {{description}}
332
+ **关联需求**: {{related_requirements}}
333
+ sections:
334
+ - id: request-design
335
+ title: 请求设计
336
+ sections:
337
+ - id: request-params
338
+ title: 请求参数
339
+ type: table
340
+ columns: [参数名, 类型, 必填, 说明, 示例]
341
+ - id: request-body
342
+ title: 请求体
343
+ type: code
344
+ language: json
345
+ - id: response-design
346
+ title: 响应设计
347
+ sections:
348
+ - id: success-response
349
+ title: 成功响应
350
+ type: code
351
+ language: json
352
+ - id: error-codes
353
+ title: 错误码
354
+ type: table
355
+ columns: [错误码, 错误信息, 触发场景]
356
+ - id: controller-skeleton
357
+ title: Controller骨架代码
358
+ type: code
359
+ language: java
360
+ instruction: |
361
+ 生成Controller骨架代码,遵循编码规范:
362
+ - 使用正确的注解
363
+ - 参数校验
364
+ - 统一响应格式
365
+
366
+ - id: middleware-design
367
+ title: 中间件增量设计
368
+ condition: 存在中间件变动
369
+ instruction: |
370
+ 为中间件使用提供详细设计。
371
+ 必须参考 docs/rag/technical/middleware/ 中的规范和代码示例。
372
+ sections:
373
+ - id: redis-design
374
+ title: Redis设计
375
+ condition: 存在Redis变动
376
+ repeatable: true
377
+ sections:
378
+ - id: redis-detail
379
+ title: "{{redis_key_name}}"
380
+ template: |
381
+ **Key模式**: {{key_pattern}}
382
+ **数据结构**: {{data_structure}}
383
+ **用途**: {{purpose}}
384
+ **过期策略**: {{expiration}}
385
+ **关联需求**: {{related_requirements}}
386
+ sections:
387
+ - id: redis-code-example
388
+ title: 代码示例
389
+ type: code
390
+ language: java
391
+ instruction: 参考 docs/rag/technical/middleware/redis.md 中的代码示例
392
+ - id: mq-design
393
+ title: 消息队列设计
394
+ condition: 存在MQ变动
395
+ repeatable: true
396
+ sections:
397
+ - id: mq-detail
398
+ title: "{{topic_name}}"
399
+ template: |
400
+ **Topic/Queue**: {{topic_queue}}
401
+ **消息类型**: {{message_type}}
402
+ **生产者**: {{producer}}
403
+ **消费者**: {{consumer}}
404
+ **关联需求**: {{related_requirements}}
405
+ sections:
406
+ - id: message-schema
407
+ title: 消息格式
408
+ type: code
409
+ language: json
410
+ - id: producer-code
411
+ title: 生产者代码示例
412
+ type: code
413
+ language: java
414
+ instruction: 参考 docs/rag/technical/middleware/mq.md 中的代码示例
415
+ - id: consumer-code
416
+ title: 消费者代码示例
417
+ type: code
418
+ language: java
419
+ - id: scheduler-design
420
+ title: 定时任务设计
421
+ condition: 存在定时任务变动
422
+ repeatable: true
423
+ sections:
424
+ - id: scheduler-detail
425
+ title: "{{task_name}}"
426
+ template: |
427
+ **任务名称**: {{task_name}}
428
+ **执行周期**: {{cron_expression}}
429
+ **功能描述**: {{description}}
430
+ **关联需求**: {{related_requirements}}
431
+ sections:
432
+ - id: scheduler-code
433
+ title: 任务代码示例
434
+ type: code
435
+ language: java
436
+ instruction: 参考 docs/rag/technical/middleware/scheduler.md 中的代码示例
437
+
438
+ - id: impact-assessment
439
+ title: 影响评估
440
+ instruction: 评估架构变动的影响范围和风险
441
+ elicit: true
442
+ sections:
443
+ - id: code-impact
444
+ title: 代码影响
445
+ template: |
446
+ **新增代码量估算**: {{new_code_estimate}}
447
+ **修改代码范围**: {{modified_code_scope}}
448
+ **测试代码需求**: {{test_code_requirement}}
449
+ - id: data-impact
450
+ title: 数据影响
451
+ template: |
452
+ **数据迁移需求**: {{migration_requirement}}
453
+ **数据一致性风险**: {{consistency_risk}}
454
+ **备份恢复策略**: {{backup_strategy}}
455
+ - id: performance-impact
456
+ title: 性能影响
457
+ template: |
458
+ **新增负载评估**: {{load_estimate}}
459
+ **资源需求变化**: {{resource_change}}
460
+ **性能测试要求**: {{performance_test_requirement}}
461
+ - id: deployment-impact
462
+ title: 部署影响
463
+ template: |
464
+ **部署步骤变更**: {{deployment_change}}
465
+ **配置变更**: {{config_change}}
466
+ **回滚方案**: {{rollback_plan}}
467
+
468
+ - id: risk-analysis
469
+ title: 风险分析
470
+ sections:
471
+ - id: risk-list
472
+ title: 风险清单
473
+ type: table
474
+ columns: [风险ID, 风险类型, 风险描述, 可能性, 影响, 缓解措施]
475
+ instruction: |
476
+ 识别所有风险,类型包括:
477
+ - 技术风险:新技术引入、兼容性、性能
478
+ - 业务风险:功能影响、数据安全、服务可用性
479
+ - 实施风险:复杂度、技能匹配、时间约束
480
+ - id: critical-risks
481
+ title: 关键风险详述
482
+ instruction: 对高风险项提供详细分析和缓解方案
483
+ repeatable: true
484
+ template: |
485
+ ### {{risk_name}}
486
+
487
+ **风险描述**: {{description}}
488
+ **可能性**: {{probability}}
489
+ **影响程度**: {{impact}}
490
+
491
+ **根因分析**: {{root_cause}}
492
+
493
+ **缓解措施**:
494
+ {{mitigation_measures}}
495
+
496
+ **应急预案**:
497
+ {{contingency_plan}}
498
+
499
+ **监控指标**:
500
+ {{monitoring_metrics}}
501
+
502
+ - id: implementation-guide
503
+ title: 实施指南
504
+ sections:
505
+ - id: implementation-sequence
506
+ title: 实施顺序
507
+ instruction: |
508
+ 基于依赖关系,规划实施顺序。
509
+ 每个阶段对应PRD中的Epic/Story。
510
+ type: numbered-list
511
+ template: |
512
+ 1. **阶段1: {{phase1_name}}**
513
+ - Story: {{story_refs}}
514
+ - 前置条件: {{prerequisites}}
515
+ - 产出物: {{deliverables}}
516
+ - 检查点: {{checkpoints}}
517
+ - id: dependency-diagram
518
+ title: 依赖关系图
519
+ type: mermaid
520
+ mermaid_type: graph
521
+ instruction: 使用Mermaid图展示实施依赖关系
522
+ - id: checkpoints
523
+ title: 关键检查点
524
+ type: table
525
+ columns: [检查点, 阶段, 验证内容, 负责人]
526
+
527
+ - id: knowledge-references
528
+ title: 知识引用索引
529
+ instruction: 列出设计中引用的所有知识库文档
530
+ sections:
531
+ - id: architecture-refs
532
+ title: 架构知识引用
533
+ type: table
534
+ columns: [文件路径, 引用章节, 引用内容]
535
+ - id: coding-standard-refs
536
+ title: 编码规范引用
537
+ type: table
538
+ columns: [文件路径, 引用规范, 应用位置]
539
+ - id: middleware-refs
540
+ title: 中间件规范引用
541
+ type: table
542
+ columns: [文件路径, 引用示例, 应用位置]
543
+
544
+ - id: next-steps
545
+ title: 后续步骤
546
+ sections:
547
+ - id: developer-handoff
548
+ title: 开发者交接
549
+ instruction: |
550
+ 生成给开发者的交接提示,包含:
551
+ - 需要阅读的文档清单
552
+ - 编码规范要点
553
+ - 实施注意事项
554
+ template: |
555
+ **交接给开发者**
556
+
557
+ 请基于本架构增量设计文档进行开发:
558
+
559
+ **必读文档**:
560
+ - 架构增量设计: docs/architecture-increment.md
561
+ - PRD文档: {{prd_path}}
562
+ - 编码规范: docs/rag/technical/coding-standards/
563
+
564
+ **开发重点**:
565
+ - 变动模块: {{changed_modules}}
566
+ - 数据模型变更: {{data_changes}}
567
+ - 接口变更: {{api_changes}}
568
+
569
+ **注意事项**:
570
+ - 严格遵循编码规范
571
+ - 参考中间件代码示例
572
+ - 每个Story完成后进行集成验证
573
+
574
+ **执行命令**: *start-development docs/architecture-increment.md
575
+ - id: qa-handoff
576
+ title: QA交接
577
+ instruction: |
578
+ 生成给QA的交接提示,包含:
579
+ - 测试范围
580
+ - 重点测试项
581
+ - 回归测试要求
582
+ template: |
583
+ **交接给QA**
584
+
585
+ 请基于本架构增量设计制定测试计划:
586
+
587
+ **必读文档**:
588
+ - 架构增量设计: docs/architecture-increment.md (影响评估章节)
589
+ - PRD文档: {{prd_path}} (验收标准)
590
+
591
+ **测试范围**:
592
+ - 新增功能: {{new_features}}
593
+ - 修改功能: {{modified_features}}
594
+ - 回归范围: {{regression_scope}}
595
+
596
+ **重点关注**:
597
+ - 数据迁移验证
598
+ - 接口兼容性测试
599
+ - 性能影响验证
600
+
601
+ **执行命令**: *create-test-plan docs/architecture-increment.md