pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext
背景信息
- Current branch: !
git branch --show-current - Base branch: !
git rev-parse --verify main >/dev/null 2>&1 && echo main || echo master - Commits on this branch (since base): !
BASE=$(git rev-parse --verify main >/dev/null 2>&1 && echo main || echo master) && git log --oneline $BASE..HEAD - PR for this branch: !
gh pr view --json number,title,url 2>/dev/null || echo "NO_PR"
- 当前分支: !
git branch --show-current - 基准分支: !
git rev-parse --verify main >/dev/null 2>&1 && echo main || echo master - 该分支上的提交(相对于基准分支): !
BASE=$(git rev-parse --verify main >/dev/null 2>&1 && echo main || echo master) && git log --oneline $BASE..HEAD - 该分支对应的PR: !
gh pr view --json number,title,url 2>/dev/null || echo "NO_PR"
Your task
你的任务
Create or update a pull request for the current branch.
为当前分支创建或更新Pull Request。
Pre-flight checks
前置检查
- If the current branch is the base branch, stop and tell the user to switch to a feature branch first. Do nothing else.
- If there are no commits ahead of the base branch, stop and tell the user to commit changes first. Do nothing else.
- Never run or
git add. Only manage the PR.git commit
- 如果当前分支是基准分支,请停止操作并告知用户先切换到功能分支,不执行其他操作。
- 如果该分支相对于基准分支没有任何提交,请停止操作并告知用户先提交变更,不执行其他操作。
- 绝不执行或
git add命令,仅负责管理PR。git commit
Analysis
分析步骤
- Run to get the full diff of all changes on this branch.
git diff <base>...HEAD - Run to get all commit messages.
git log <base>..HEAD --format="%h %s" - Identify the main topic, group specific changes logically.
- 执行获取该分支所有变更的完整差异。
git diff <base>...HEAD - 执行获取所有提交信息。
git log <base>..HEAD --format="%h %s" - 确定核心主题,将具体变更进行逻辑分组。
Decide: create or update
决策:创建或更新
- If the PR context above shows → create a new PR.
NO_PR - If a PR is found for the current branch → update that PR.
- 如果上述PR背景信息显示→ 创建新的PR。
NO_PR - 如果找到当前分支对应的PR → 更新该PR。
PR title
PR标题
Follow Conventional Commits format: .
<type>: <description>Types: feat, fix, docs, refactor, test, chore, build, perf, ci. Append for breaking changes.
!When updating, keep the existing title unless it is generic (e.g. "Update"), outdated, or does not follow Conventional Commits.
遵循Conventional Commits格式:。
<type>: <description>类型包括:feat, fix, docs, refactor, test, chore, build, perf, ci。若为破坏性变更,需在类型后追加。
!更新PR时,保留现有标题,除非标题过于通用(例如"Update")、已过时或不符合Conventional Commits规范。
PR body format
PR正文格式
undefinedundefinedSummary
摘要
<1-2 sentence high-level description of what this PR does and why>
<1-2句话的高层级描述,说明本PR的作用及原因>
Changes
变更内容
<bulleted list of all meaningful changes, grouped logically>
<所有重要变更的项目符号列表,按逻辑分组>
Test plan
测试计划
<bulleted checklist of how to verify these changes>
```
<用于验证这些变更的可操作检查清单>
undefinedExecution
执行流程
Create flow:
- Push the branch to origin: .
git push -u origin <branch> - Create the PR: .
gh pr create --title "<title>" --body "<body>"
Update flow:
- Update the PR: .
gh pr edit --title "<title>" --body "<body>"
创建流程:
- 将分支推送到远程仓库:。
git push -u origin <branch> - 创建PR:。
gh pr create --title "<title>" --body "<body>"
更新流程:
- 更新PR:。
gh pr edit --title "<title>" --body "<body>"
Rules
规则
- Write the summary in plain English, focusing on the why and the what.
- List changes as concise bullet points. Group related items under sub-headers if the PR touches multiple areas.
- The test plan should contain actionable verification steps relevant to the changes. If a check was already run and passed, mark it as done.
- Use a HEREDOC to pass the body to or
gh pr create.gh pr edit - Do not send any text besides the tool calls.
- 摘要使用简洁明了的英文撰写,重点说明原因和内容。
- 变更内容以简洁的项目符号列表呈现,如果PR涉及多个领域,可将相关项归类到子标题下。
- 测试计划应包含与变更相关的可操作验证步骤。如果某项检查已执行并通过,标记为已完成。
- 使用HEREDOC将正文内容传递给或
gh pr create命令。gh pr edit - 除工具调用命令外,不得发送任何其他文本。