dev-workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Development Workflow

开发工作流

Overview

概述

Orchestrates complete feature development from issue to merge: Issue → Branch → Worktree → Implement → Test → Review → PR → Merge → Close.
编排从Issue到合并的完整功能开发流程:Issue → 分支 → Worktree → 开发实现 → 测试 → 评审 → PR → 合并 → 关闭。

Prerequisites

前置条件

  1. Git repository initialized
  2. Issue tracker MCP available (Gitea:
    mcp__gitea__*
    , GitHub:
    mcp__github__*
    )
  3. Codex CLI installed (
    codex --version
    )
  4. Repository owner/name confirmed
  1. 已初始化Git仓库
  2. 具备Issue跟踪器MCP(Gitea:
    mcp__gitea__*
    , GitHub:
    mcp__github__*
  3. 已安装Codex CLI(
    codex --version
  4. 已确认仓库所有者/名称

Workflow Steps

工作流步骤

1. Get Issue Details

1. 获取Issue详情

Gitea MCP:
mcp__gitea__get_issue_by_index(owner, repo, index)
GitHub MCP:
mcp__MCP_DOCKER__get_issue(owner, repo, issue_number)
GitHub CLI:
bash
gh issue view {issue_number} --repo {owner}/{repo}
Gitea MCP:
mcp__gitea__get_issue_by_index(owner, repo, index)
GitHub MCP:
mcp__MCP_DOCKER__get_issue(owner, repo, issue_number)
GitHub CLI:
bash
gh issue view {issue_number} --repo {owner}/{repo}

2. Create Branch

2. 创建分支

bash
git checkout main && git pull origin main
git checkout -b feature/{issue-number}-{slug}
bash
git checkout main && git pull origin main
git checkout -b feature/{issue-number}-{slug}

3. Create Worktree

3. 创建Worktree

bash
git worktree add ../worktrees/feature-{issue}-{slug} feature/{issue}-{slug}
Copy vendor dependencies if present:
bash
cp -R Vendor ../worktrees/feature-{slug}/
bash
git worktree add ../worktrees/feature-{issue}-{slug} feature/{issue}-{slug}
若存在依赖包,复制到Worktree:
bash
cp -R Vendor ../worktrees/feature-{slug}/

4. Implement Feature

4. 开发实现功能

Work in worktree. For complex tasks, use Task tool with sub-agents.
在Worktree中进行开发。对于复杂任务,可使用Task工具结合子Agent完成。

5. Write Integration Tests

5. 编写集成测试

Add tests for new functionality. See TESTING.md for testing patterns.
为新功能添加测试。测试模式可参考TESTING.md

6. Run Tests

6. 运行测试

Project-specific test command (e.g.,
xcodebuild test
,
npm test
).
执行项目专属测试命令(例如:
xcodebuild test
,
npm test
)。

7. Code Review

7. 代码评审

Ask user which tool to use if not specified:
  • Codex CLI:
    codex review --base main
  • Gemini CLI:
    gemini -p "/code-review"
  • GitHub Copilot:
    gh copilot
    (interactive, ask for review)
  • OpenCode:
    opencode -p "review changes"
    (provider-agnostic)
Run exactly once per review cycle:
bash
undefined
若未指定工具,询问用户使用哪款工具
  • Codex CLI
    codex review --base main
  • Gemini CLI
    gemini -p "/code-review"
  • GitHub Copilot
    gh copilot
    (交互式,请求评审)
  • OpenCode
    opencode -p "review changes"
    (兼容多LLM提供商)
每个评审周期仅运行一次
bash
undefined

Codex (detailed P1-P4 findings)

Codex(提供P1-P4级详细问题)

codex review --base main
codex review --base main

OR Gemini (quick quality analysis)

或 Gemini(快速质量分析)

gemini -p "/code-review"
gemini -p "/code-review"

OR GitHub Copilot (interactive)

或 GitHub Copilot(交互式)

gh copilot # then ask: "review my changes against main"
gh copilot # 随后输入:"review my changes against main"

OR OpenCode (works with any LLM provider)

或 OpenCode(支持任意LLM提供商)

opencode -p "review my code changes against main branch"

**IMPORTANT:** Wait for the full output. Do NOT run a second review unless you've made code changes to fix issues.

**If critical/high issues found:**
1. Fix all issues in code
2. Commit fixes
3. THEN run review again (this is a new review cycle)

**If no critical issues:** Proceed to commit.

See [CODE-REVIEW.md](CODE-REVIEW.md) for handling specific findings.
opencode -p "review my code changes against main branch"

**重要提示:** 等待完整输出结果。除非已修复代码问题,否则不要运行第二次评审。

**若发现严重/高优先级问题:**
1. 在代码中修复所有问题
2. 提交修复内容
3. **然后**再次运行评审(进入新的评审周期)

**若无严重问题:** 继续提交代码。

特定问题的处理方式可参考[CODE-REVIEW.md](CODE-REVIEW.md)。

8. Commit & Push

8. 提交并推送代码

bash
git add . && git commit -m "feat(scope): description"
git push -u origin feature/{issue}-{slug}
bash
git add . && git commit -m "feat(scope): description"
git push -u origin feature/{issue}-{slug}

9. Create Pull Request

9. 创建Pull Request(PR)

Gitea MCP:
mcp__gitea__create_pull_request(owner, repo, title, body, head, base="main")
GitHub MCP:
mcp__MCP_DOCKER__create_pull_request(owner, repo, title, body, head, base)
GitHub CLI:
bash
gh pr create --title "title" --body "body" --base main --head feature/{issue}-{slug}
Gitea MCP:
mcp__gitea__create_pull_request(owner, repo, title, body, head, base="main")
GitHub MCP:
mcp__MCP_DOCKER__create_pull_request(owner, repo, title, body, head, base)
GitHub CLI:
bash
gh pr create --title "title" --body "body" --base main --head feature/{issue}-{slug}

10. Merge to Main

10. 合并到主分支

bash
git checkout main && git pull origin main
git merge feature/{issue}-{slug} --no-ff && git push origin main
bash
git checkout main && git pull origin main
git merge feature/{issue}-{slug} --no-ff && git push origin main

11. Close Issue

11. 关闭Issue

Gitea MCP:
mcp__gitea__edit_issue(owner, repo, index, state="closed")
GitHub MCP:
mcp__MCP_DOCKER__update_issue(owner, repo, issue_number, state="closed")
GitHub CLI:
bash
gh issue close {issue_number} --repo {owner}/{repo}
Gitea MCP:
mcp__gitea__edit_issue(owner, repo, index, state="closed")
GitHub MCP:
mcp__MCP_DOCKER__update_issue(owner, repo, issue_number, state="closed")
GitHub CLI:
bash
gh issue close {issue_number} --repo {owner}/{repo}

12. Cleanup

12. 清理资源

bash
git worktree remove ../worktrees/feature-{issue}-{slug}
git branch -d feature/{issue}-{slug}
bash
git worktree remove ../worktrees/feature-{issue}-{slug}
git branch -d feature/{issue}-{slug}

Parallel Workflow

并行工作流

For multiple independent issues, see PARALLEL.md.
若需处理多个独立Issue,可参考PARALLEL.md

Error Recovery

错误恢复

See ERRORS.md for handling build failures, Codex P1 issues, and merge conflicts.
构建失败、Codex P1级问题及合并冲突的处理方式可参考ERRORS.md

Examples

示例

Example: Implement Feature from Issue

示例:从Issue到功能实现

Input: "Implement issue #42 - Add user authentication"
Process:
  1. Get issue details via MCP
  2. Create branch
    feature/42-user-auth
  3. Create worktree
  4. Implement authentication feature
  5. Write tests
  6. Run code review
  7. Create PR and merge
Output:
✅ Issue #42 implemented
✅ PR #15 created and merged
✅ Issue #42 closed
输入: "实现Issue #42 - 添加用户认证功能"
流程:
  1. 通过MCP获取Issue详情
  2. 创建分支
    feature/42-user-auth
  3. 创建Worktree
  4. 开发实现认证功能
  5. 编写测试
  6. 执行代码评审
  7. 创建PR并合并
输出:
✅ Issue #42已实现
✅ PR #15已创建并合并
✅ Issue #42已关闭

Guidelines

指南

Do

建议

  • Confirm repository owner/name before starting
  • Create worktree for isolation
  • Run code review before PR
  • Close issue after merge
  • 开始前确认仓库所有者/名称
  • 创建Worktree以隔离开发环境
  • 提交PR前执行代码评审
  • 合并后关闭Issue

Don't

禁止

  • Skip the code review step
  • Work directly on main branch
  • Leave worktrees after merge
  • Forget to push before creating PR
  • 跳过代码评审步骤
  • 直接在主分支上开发
  • 合并后保留Worktree
  • 创建PR前忘记推送代码