Loading...
Loading...
Compare original and translation side by side
{ARGUMENT}{ARGUMENT}{ARGUMENT}_bmad-output/implementation-artifacts/sprint-status.yamldocs/sprint/sprint-status.yaml{STORY_ID}X-Y1-12-3STORY_ID = {ARGUMENT}{ARGUMENT}_bmad-output/implementation-artifacts/sprint-status.yamldocs/sprint/sprint-status.yaml{STORY_ID}X-Y1-12-3STORY_ID = {ARGUMENT}| Feature | bmad-story-pipeline | bmad-story-pipeline-worktree |
|---|---|---|
| Working method | Develop on current branch | Develop in isolated worktree |
| Code isolation | None | Complete isolation |
| Merge condition | None enforced | Tests pass + fixes complete |
| Workflow config | workflow-steps.md | workflow-steps.md |
| Safety level | Medium | High |
| 功能 | bmad-story-pipeline | bmad-story-pipeline-worktree |
|---|---|---|
| 工作方式 | 在当前分支开发 | 在隔离worktree中开发 |
| 代码隔离性 | 无 | 完全隔离 |
| 合并条件 | 无强制要求 | 测试通过+修复完成 |
| 工作流配置 | workflow-steps.md | workflow-steps.md |
| 安全等级 | 中等 | 高 |
1. Get current project name, path and branch:
ORIGINAL_REPO_PATH=$(pwd)
PROJECT_NAME=$(basename $(pwd))
CURRENT_BRANCH=$(git branch --show-current)
2. Create new branch name: feature/story-${STORY_ID}
3. Create worktree directory (in sibling directory):
WORKTREE_PATH="../${PROJECT_NAME}-story-${STORY_ID}"
4. Execute git worktree command:
git worktree add -b feature/story-${STORY_ID} "$WORKTREE_PATH" $CURRENT_BRANCH
If branch already exists, use:
git worktree add "$WORKTREE_PATH" feature/story-${STORY_ID}
5. Verify worktree created:
git worktree listORIGINAL_REPO_PATHWORKTREE_PATHSTORY_ID━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Create Worktree
🌿 Branch: feature/story-${STORY_ID}
📁 Path: ${WORKTREE_PATH}
📦 Original: ${ORIGINAL_REPO_PATH}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━1. 获取当前项目名称、路径和分支:
ORIGINAL_REPO_PATH=$(pwd)
PROJECT_NAME=$(basename $(pwd))
CURRENT_BRANCH=$(git branch --show-current)
2. 创建新分支名:feature/story-${STORY_ID}
3. 创建worktree目录(存放在同级目录):
WORKTREE_PATH="../${PROJECT_NAME}-story-${STORY_ID}"
4. 执行git worktree命令:
git worktree add -b feature/story-${STORY_ID} "$WORKTREE_PATH" $CURRENT_BRANCH
如果分支已存在,使用:
git worktree add "$WORKTREE_PATH" feature/story-${STORY_ID}
5. 验证worktree创建成功:
git worktree listORIGINAL_REPO_PATHWORKTREE_PATHSTORY_ID━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ 创建Worktree
🌿 分支: feature/story-${STORY_ID}
📁 路径: ${WORKTREE_PATH}
📦 原始仓库: ${ORIGINAL_REPO_PATH}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Task(
subagent_type: "general-purpose",
description: "<Step description>",
prompt: "Execute the command: <COMMAND_WITH_STORY_ID>
Return: 1) Step completion status 2) Key outputs 3) Any issues to note"
)Task(
subagent_type: "general-purpose",
description: "<步骤描述>",
prompt: "Execute the command: <COMMAND_WITH_STORY_ID>
Return: 1) Step completion status 2) Key outputs 3) Any issues to note"
)Task(
subagent_type: "general-purpose",
description: "Create user story {STORY_ID}",
prompt: "Execute /bmad-bmm-create-story {STORY_ID} yolo to create story file. Return: 1) Story ID and Title 2) Created files 3) Any issues"
)Task(
subagent_type: "general-purpose",
description: "Generate ATDD tests for {STORY_ID}",
prompt: "Execute /bmad-tea-testarch-atdd {STORY_ID} yolo to generate acceptance tests. Return: 1) ATDD checklist 2) Test files created 3) Any issues"
)Task(
subagent_type: "general-purpose",
description: "Develop user story {STORY_ID}",
prompt: "Execute /bmad-bmm-dev-story {STORY_ID} yolo to implement story code. Return: 1) Modified files 2) Summary of changes 3) Any issues"
)Task(
subagent_type: "general-purpose",
description: "Code review for {STORY_ID}",
prompt: "Execute /bmad-bmm-code-review {STORY_ID} yolo for adversarial review. Return: 1) Conclusion (pass/needs-fix) 2) Issues by severity 3) Any blocking issues"
)Task(
subagent_type: "general-purpose",
description: "Trace test coverage for {STORY_ID}",
prompt: "Execute /bmad-tea-testarch-trace {STORY_ID} yolo for traceability matrix. Return: 1) Coverage percentage 2) Gate decision 3) Any gaps"
)Task(
subagent_type: "general-purpose",
description: "Create user story {STORY_ID}",
prompt: "Execute /bmad-bmm-create-story {STORY_ID} yolo to create story file. Return: 1) Story ID and Title 2) Created files 3) Any issues"
)Task(
subagent_type: "general-purpose",
description: "Generate ATDD tests for {STORY_ID}",
prompt: "Execute /bmad-tea-testarch-atdd {STORY_ID} yolo to generate acceptance tests. Return: 1) ATDD checklist 2) Test files created 3) Any issues"
)Task(
subagent_type: "general-purpose",
description: "Develop user story {STORY_ID}",
prompt: "Execute /bmad-bmm-dev-story {STORY_ID} yolo to implement story code. Return: 1) Modified files 2) Summary of changes 3) Any issues"
)Task(
subagent_type: "general-purpose",
description: "Code review for {STORY_ID}",
prompt: "Execute /bmad-bmm-code-review {STORY_ID} yolo for adversarial review. Return: 1) Conclusion (pass/needs-fix) 2) Issues by severity 3) Any blocking issues"
)Task(
subagent_type: "general-purpose",
description: "Trace test coverage for {STORY_ID}",
prompt: "Execute /bmad-tea-testarch-trace {STORY_ID} yolo for traceability matrix. Return: 1) Coverage percentage 2) Gate decision 3) Any gaps"
){STORY_ID}[X/N] Step Name - Status{STORY_ID}[X/N] 步骤名称 - 状态📊 Pipeline Progress: [X/N] ████████░░░░ 40%
✅ Step X: <Step Name>
Result: <Brief result summary>📊 流水线进度: [X/N] ████████░░░░ 40%
✅ 步骤X: <步骤名称>
结果: <简要结果摘要>1. Commit all changes in worktree:
cd ${WORKTREE_PATH}
git add .
git commit -m "feat: complete story ${STORY_ID}"
2. Switch back to main repo:
cd ${ORIGINAL_REPO_PATH}
3. Merge feature branch:
git merge feature/story-${STORY_ID} --no-edit
4. Remove worktree:
git worktree remove ${WORKTREE_PATH}
5. Optionally delete feature branch (if not needed):
git branch -d feature/story-${STORY_ID}
6. Verify cleanup:
git worktree list━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Merge Branch
🔀 Merge: feature/story-${STORY_ID} → [current branch]
🗑️ Cleanup: worktree removed
📝 Commit: [hash]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ Merge Branch
❌ Merge conditions not met, preserving worktree
📁 Path: ${WORKTREE_PATH}
🔧 Manual handling needed:
- [List unmet conditions]
After handling, manually execute:
cd ${WORKTREE_PATH}
git add . && git commit -m "fix: resolve issues"
cd ${ORIGINAL_REPO_PATH}
git merge feature/story-${STORY_ID}
git worktree remove ${WORKTREE_PATH}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━1. 在worktree中提交所有更改:
cd ${WORKTREE_PATH}
git add .
git commit -m "feat: complete story ${STORY_ID}"
2. 切回原仓库:
cd ${ORIGINAL_REPO_PATH}
3. 合并功能分支:
git merge feature/story-${STORY_ID} --no-edit
4. 删除worktree:
git worktree remove ${WORKTREE_PATH}
5. 可选:删除功能分支(如果不需要保留):
git branch -d feature/story-${STORY_ID}
6. 验证清理完成:
git worktree list━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ 合并分支
🔀 合并: feature/story-${STORY_ID} → [当前分支]
🗑️ 清理: worktree已移除
📝 提交哈希: [hash]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ 合并分支
❌ 未满足合并条件,已保留worktree
📁 路径: ${WORKTREE_PATH}
🔧 需要手动处理:
- [列出未满足的条件]
处理完成后,手动执行:
cd ${WORKTREE_PATH}
git add . && git commit -m "fix: resolve issues"
cd ${ORIGINAL_REPO_PATH}
git merge feature/story-${STORY_ID}
git worktree remove ${WORKTREE_PATH}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━File path: _bmad-output/implementation-artifacts/sprint-status.yaml (or docs/sprint/sprint-status.yaml)
Change story status from in-progress to done:
{epic-num}-{story-num}-{story-name}: done文件路径: _bmad-output/implementation-artifacts/sprint-status.yaml (或 docs/sprint/sprint-status.yaml)
将故事状态从in-progress改为done:
{epic-num}-{story-num}-{story-name}: doneFile path: _bmad-output/implementation-artifacts/{epic-num}-{story-num}-{story-name}.md
Update two places:
1. Top status line:
Change "Status: in-progress" to "Status: done"
2. Tasks checklist (if any):
Change all "- [ ]" to "- [x]" to mark tasks complete━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ Update Status
📝 sprint-status.yaml: ${STORY_ID} → done
📄 Story doc: Status: done, Tasks: ✅
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━文件路径: _bmad-output/implementation-artifacts/{epic-num}-{story-num}-{story-name}.md
更新两处内容:
1. 顶部状态行:
将"Status: in-progress"改为"Status: done"
2. 任务清单(如果有):
将所有"- [ ]"改为"- [x]"标记任务完成━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ 更新状态
📝 sprint-status.yaml: ${STORY_ID} → done
📄 故事文档: 状态: done, 任务: ✅
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╔════════════════════════════════════════════════════════╗
║ 🎉 BMAD Story Pipeline Complete! ║
╠════════════════════════════════════════════════════════╣
║ Story: ${STORY_ID} ║
║ ║
║ ✅ Phase 1 - Create Worktree ║
║ ✅ Phase 2 - Configurable Pipeline ║
║ ✅ Phase 3 - Merge Branch ║
║ ✅ Phase 4 - Update Status to Done ║
║ ║
║ 📊 Status: done ║
╚════════════════════════════════════════════════════════╝╔════════════════════════════════════════════════════════╗
║ ⚠️ BMAD Story Pipeline - Manual Intervention ║
╠════════════════════════════════════════════════════════╣
║ Story: ${STORY_ID} ║
║ ║
║ ✅ Phase 1 - Create Worktree ║
║ ❌ Phase 2 - Pipeline [failed at Step X] ║
║ ⏸️ Phase 3 - Merge Branch [not started] ║
║ ⏸️ Phase 4 - Update Status [not started] ║
║ ║
║ 📁 Worktree: ${WORKTREE_PATH} ║
║ 💡 Fix the issue and continue manually ║
╚════════════════════════════════════════════════════════╝╔════════════════════════════════════════════════════════╗
║ 🎉 BMAD故事流水线执行完成! ║
╠════════════════════════════════════════════════════════╣
║ 故事: ${STORY_ID} ║
║ ║
║ ✅ 阶段1 - 创建Worktree ║
║ ✅ 阶段2 - 可配置流水线 ║
║ ✅ 阶段3 - 合并分支 ║
║ ✅ 阶段4 - 更新状态为已完成 ║
║ ║
║ 📊 状态: done ║
╚════════════════════════════════════════════════════════╝╔════════════════════════════════════════════════════════╗
║ ⚠️ BMAD故事流水线 - 需要手动干预 ║
╠════════════════════════════════════════════════════════╣
║ 故事: ${STORY_ID} ║
║ ║
║ ✅ 阶段1 - 创建Worktree ║
║ ❌ 阶段2 - 流水线 [步骤X执行失败] ║
║ ⏸️ 阶段3 - 合并分支 [未启动] ║
║ ⏸️ 阶段4 - 更新状态 [未启动] ║
║ ║
║ 📁 Worktree路径: ${WORKTREE_PATH} ║
║ 💡 修复问题后手动继续执行即可 ║
╚════════════════════════════════════════════════════════╝undefinedundefined
---
---