BMAD-METHOD/bmad-core/workflows/brownfield-fullstack.yaml

298 lines
11 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# <!-- 由 BMAD™ 核心驱动 -->
workflow:
id: brownfield-fullstack
name: 棕地全栈增强
description: >-
用于通过新功能、现代化或重大更改来增强现有全栈应用程序的代理工作流程。处理现有系统分析和安全集成。
type: brownfield
project_types:
- feature-addition
- refactoring
- modernization
- integration-enhancement
sequence:
- step: enhancement_classification
agent: analyst
action: 对增强范围进行分类
notes: |
确定增强复杂性以路由到适当的路径:
- 单个故事(< 4 小时)→ 使用 brownfield-create-story 任务
- 小功能1-3 个故事)→ 使用 brownfield-create-epic 任务
- 重大增强(多个史诗)→ 继续执行完整工作流程
询问用户:“您能描述一下增强范围吗?这是一个小修复、一个功能添加,还是需要架构更改的重大增强?”
- step: routing_decision
condition: based_on_classification
routes:
single_story:
agent: pm
uses: brownfield-create-story
notes: "为立即实施创建单个故事。故事创建后退出工作流程。"
small_feature:
agent: pm
uses: brownfield-create-epic
notes: "创建包含 1-3 个故事的重点史诗。史诗创建后退出工作流程。"
major_enhancement:
continue: to_next_step
notes: "继续执行下面的综合规划工作流程。"
- step: documentation_check
agent: analyst
action: 检查现有文档
condition: major_enhancement_path
notes: |
检查是否存在足够的项目文档:
- 查找现有的架构文档、API 规范、编码标准
- 评估文档是否最新且全面
- 如果足够:跳过 document-project直接进入 PRD
- 如果不足:首先运行 document-project
- step: project_analysis
agent: architect
action: 分析现有项目并使用任务 document-project
creates: brownfield-architecture.md (或多个文档)
condition: documentation_inadequate
notes: "运行 document-project 以捕获当前系统状态、技术债务和限制。将调查结果传递给 PRD 创建。"
- agent: pm
creates: prd.md
uses: brownfield-prd-tmpl
requires: existing_documentation_or_analysis
notes: |
为重大增强创建 PRD。如果已运行 document-project请引用其输出以避免重复分析。
如果跳过,请使用现有的项目文档。
保存输出:将最终的 prd.md 复制到您项目的 docs/ 文件夹中。
- step: architecture_decision
agent: pm/architect
action: 确定是否需要架构文档
condition: after_prd_creation
notes: |
审查 PRD 以确定是否需要进行架构规划:
- 新的架构模式 → 创建架构文档
- 新的库/框架 → 创建架构文档
- 平台/基础设施更改 → 创建架构文档
- 遵循现有模式 → 跳到故事创建
- agent: architect
creates: architecture.md
uses: brownfield-architecture-tmpl
requires: prd.md
condition: architecture_changes_needed
notes: "仅为重大的架构更改创建架构。保存输出:将最终的 architecture.md 复制到您项目的 docs/ 文件夹中。"
- agent: po
validates: all_artifacts
uses: po-master-checklist
notes: "验证所有文档的集成安全性和完整性。可能需要更新任何文档。"
- agent: various
updates: any_flagged_documents
condition: po_checklist_issues
notes: "如果 PO 发现问题,请返回相关代理进行修复,并将更新后的文档重新导出到 docs/ 文件夹。"
- agent: po
action: shard_documents
creates: sharded_docs
requires: all_artifacts_in_project
notes: |
为 IDE 开发分片文档:
- 选项 A使用 PO 代理分片:@po 然后要求分片 docs/prd.md
- 选项 B手动将 shard-doc 任务 + docs/prd.md 拖到聊天中
- 创建包含分片内容的 docs/prd/ 和 docs/architecture/ 文件夹
- agent: sm
action: create_story
creates: story.md
requires: sharded_docs_or_brownfield_docs
repeats: for_each_epic_or_enhancement
notes: |
故事创建周期:
- 对于分片的 PRD@sm → *create (使用 create-next-story)
- 对于棕地文档:@sm → 使用 create-brownfield-story 任务
- 从可用文档创建故事
- 故事以“草稿”状态开始
- 对于棕地项目,可能需要收集更多上下文
- agent: analyst/pm
action: review_draft_story
updates: story.md
requires: story.md
optional: true
condition: user_wants_story_review
notes: |
可选:审查并批准故事草稿
- 注意story-review 任务即将推出
- 审查故事的完整性和一致性
- 更新故事状态:草稿 → 已批准
- agent: dev
action: implement_story
creates: implementation_files
requires: story.md
notes: |
开发代理(新聊天):@dev
- 实施已批准的故事
- 使用所有更改更新文件列表
- 完成后将故事标记为“审查”
- agent: qa
action: review_implementation
updates: implementation_files
requires: implementation_files
optional: true
notes: |
可选QA 代理(新聊天):@qa → review-story
- 具有重构能力的高级开发人员审查
- 直接修复小问题
- 为剩余项目留下清单
- 更新故事状态(审查 → 完成或保持审查)
- agent: dev
action: address_qa_feedback
updates: implementation_files
condition: qa_left_unchecked_items
notes: |
如果 QA 留下未检查的项目:
- 开发代理(新聊天):处理剩余项目
- 返回 QA 进行最终批准
- repeat_development_cycle:
action: continue_for_all_stories
notes: |
对所有史诗故事重复故事周期SM → 开发 → QA
继续直到 PRD 中的所有故事都完成
- agent: po
action: epic_retrospective
creates: epic-retrospective.md
condition: epic_complete
optional: true
notes: |
可选:史诗完成后
- 注意epic-retrospective 任务即将推出
- 验证史诗是否正确完成
- 记录经验教训和改进
- workflow_end:
action: project_complete
notes: |
所有故事都已实施和审查!
项目开发阶段完成。
参考:{root}/data/bmad-kb.md#IDE Development Workflow
flow_diagram: |
```mermaid
graph TD
A[开始:棕地增强] --> B[分析师:对增强范围进行分类]
B --> C{增强规模?}
C -->|单个故事| D[项目经理brownfield-create-story]
C -->|1-3 个故事| E[项目经理brownfield-create-epic]
C -->|重大增强| F[分析师:检查文档]
D --> END1[到开发实施]
E --> END2[到故事创建]
F --> G{文档是否足够?}
G -->|否| H[架构师document-project]
G -->|是| I[项目经理:棕地 PRD]
H --> I
I --> J{是否需要架构?}
J -->|是| K[架构师architecture.md]
J -->|否| L[产品负责人:验证工件]
K --> L
L --> M{产品负责人发现问题?}
M -->|是| N[修复问题]
M -->|否| O[产品负责人:分片文档]
N --> L
O --> P[Scrum Master创建故事]
P --> Q{故事类型?}
Q -->|分片的 PRD| R[create-next-story]
Q -->|棕地文档| S[create-brownfield-story]
R --> T{审查草稿?}
S --> T
T -->|是| U[审查并批准]
T -->|否| V[开发人员:实施]
U --> V
V --> W{QA 审查?}
W -->|是| X[QA审查]
W -->|否| Y{更多故事?}
X --> Z{有问题?}
Z -->|是| AA[开发人员:修复]
Z -->|否| Y
AA --> X
Y -->|是| P
Y -->|否| AB{回顾?}
AB -->|是| AC[产品负责人:回顾]
AB -->|否| AD[完成]
AC --> AD
style AD fill:#90EE90
style END1 fill:#90EE90
style END2 fill:#90EE90
style D fill:#87CEEB
style E fill:#87CEEB
style I fill:#FFE4B5
style K fill:#FFE4B5
style O fill:#ADD8E6
style P fill:#ADD8E6
style V fill:#ADD8E6
style U fill:#F0E68C
style X fill:#F0E68C
style AC fill:#F0E68C
```
decision_guidance:
when_to_use:
- 增强需要协调的故事
- 需要进行架构更改
- 需要大量的集成工作
- 需要风险评估和缓解规划
- 多个团队成员将参与相关的更改
handoff_prompts:
classification_complete: |
增强分类为:{{enhancement_type}}
{{if single_story}}:继续执行 brownfield-create-story 任务以立即实施。
{{if small_feature}}:使用 brownfield-create-epic 任务创建重点史诗。
{{if major_enhancement}}:继续执行综合规划工作流程。
documentation_assessment: |
文档评估完成:
{{if adequate}}:现有文档足够。直接进入 PRD 创建。
{{if inadequate}}:在 PRD 之前运行 document-project 以捕获当前系统状态。
document_project_to_pm: |
项目分析完成。主要调查结果记录在:
- {{document_list}}
使用这些调查结果来为 PRD 创建提供信息,并避免重复分析相同的方面。
pm_to_architect_decision: |
PRD 已完成并另存为 docs/prd.md。
已识别的架构更改:{{yes/no}}
{{if yes}}:继续为以下内容创建架构文档:{{specific_changes}}
{{if no}}:无需架构更改。继续进行验证。
architect_to_po: "架构已完成。将其另存为 docs/architecture.md。请验证所有工件的集成安全性。"
po_to_sm: |
所有工件都已验证。
可用的文档类型:{{sharded_prd / brownfield_docs}}
{{if sharded}}:使用标准的 create-next-story 任务。
{{if brownfield}}:使用 create-brownfield-story 任务来处理各种文档格式。
sm_story_creation: |
从 {{documentation_type}} 创建故事。
{{if missing_context}}:在故事创建期间可能需要从用户那里收集更多上下文。
complete: "所有规划工件都已验证,可以开始开发。将根据可用的文档格式创建故事。"