create-pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Note: If you have
mcporter
installed locally, you should use
mcporter
to invoke the MCP tool instead of directly calling the MCP tool. The
mcporter
CLI provides a more convenient interface and better error handling.
注意:如果您本地安装了
mcporter
,应使用
mcporter
调用MCP工具,而非直接调用MCP工具。
mcporter
CLI提供了更便捷的界面和更完善的错误处理。

Create PR via Gitee MCP

通过Gitee MCP创建PR

Generate a well-structured Pull Request description based on the current changes and submit it to Gitee.
基于当前变更生成结构清晰的Pull Request描述,并提交至Gitee。

Prerequisites

前提条件

  • Gitee MCP Server configured (tools:
    create_pull
    ,
    get_file_content
    ,
    list_repo_issues
    ,
    compare_branches_tags
    )
  • User must provide: repository owner, repository name, source branch, target branch (usually main/master)
  • Optional: linked Issue number
  • 已配置Gitee MCP Server(工具:
    create_pull
    get_file_content
    list_repo_issues
    compare_branches_tags
  • 用户必须提供:仓库所有者、仓库名称、源分支、目标分支(通常为main/master)
  • 可选:关联的Issue编号

Steps

步骤

Step 1: Gather Information

步骤1:收集信息

Confirm with the user or infer from context:
  • Source branch (head branch)
  • Target branch (base branch, default: master or main)
  • Core purpose of this PR (if not stated, infer from commit messages or file changes)
  • Whether to link an Issue (optional)
与用户确认或从上下文推断:
  • 源分支(head分支)
  • 目标分支(base分支,默认:master或main)
  • 此PR的核心目的(如果未说明,从提交信息或文件变更中推断)
  • 是否关联Issue(可选)

Step 2: Analyze the Changes

步骤2:分析变更

Use
compare_branches_tags
to fetch the diff between the source branch and target branch:
  • base
    : target branch (e.g.,
    main
    or
    master
    )
  • head
    : source branch
Analyze the returned diff to determine:
  • Which core files were changed
  • What functionality was added or modified
  • Whether there are any breaking changes
使用
compare_branches_tags
获取源分支与目标分支之间的差异:
  • base
    :目标分支(例如:
    main
    master
  • head
    :源分支
分析返回的差异以确定:
  • 哪些核心文件被修改
  • 添加或修改了哪些功能
  • 是否存在破坏性变更

Step 3: Generate PR Title

步骤3:生成PR标题

Follow the Conventional Commits format:
<type>(<scope>): <subject>
Available types:
  • feat
    : New feature
  • fix
    : Bug fix
  • refactor
    : Code refactoring
  • docs
    : Documentation update
  • test
    : Test-related changes
  • chore
    : Build / dependency / toolchain changes
Example:
feat(auth): add OAuth2 login support
遵循Conventional Commits格式:
<type>(<scope>): <subject>
可用类型:
  • feat
    :新功能
  • fix
    :修复Bug
  • refactor
    :代码重构
  • docs
    :文档更新
  • test
    :测试相关变更
  • chore
    :构建/依赖/工具链变更
示例:
feat(auth): add OAuth2 login support

Step 4: Generate PR Description

步骤4:生成PR描述

Use the following template for a structured description:
markdown
undefined
使用以下模板生成结构化描述:
markdown
undefined

Summary

Summary

[Clear description of the purpose of this PR and the problem it solves]
[Clear description of the purpose of this PR and the problem it solves]

Changes

Changes

  • [Change 1]
  • [Change 2]
  • [Change 3]
  • [Change 1]
  • [Change 2]
  • [Change 3]

Testing

Testing

  • Unit tests pass
  • Functional tests pass
  • [Completed test item]
  • Unit tests pass
  • Functional tests pass
  • [Completed test item]

Related Issue

Related Issue

closes #[issue number] (if applicable)
closes #[issue number] (if applicable)

Notes

Notes

[Breaking changes, dependency upgrades, deployment considerations, etc. (if any)]
undefined
[Breaking changes, dependency upgrades, deployment considerations, etc. (if any)]
undefined

Step 5: Create the PR

步骤5:创建PR

Use
create_pull
to create the PR with these parameters:
  • title
    : title generated in Step 3
  • body
    : description generated in Step 4
  • head
    : source branch
  • base
    : target branch
After successful creation, output the PR link for the user.
使用
create_pull
工具,传入以下参数创建PR:
  • title
    :步骤3生成的标题
  • body
    :步骤4生成的描述
  • head
    :源分支
  • base
    :目标分支
创建成功后,向用户输出PR链接。

Notes

注意事项

  • If the user specifies a linked Issue, append
    closes #N
    to the description so the Issue is automatically closed when the PR is merged
  • Keep the PR title concise (under 50 characters) — put details in the description
  • If the user hasn't provided enough information, ask before creating, to avoid opening a PR with an empty description
  • 如果用户指定了关联的Issue,在描述中添加
    closes #N
    ,这样PR合并后Issue会自动关闭
  • PR标题需简洁(50字符以内)——详细信息放在描述中
  • 如果用户未提供足够信息,创建前先询问,避免创建描述为空的PR