mcpField
G
gitee-pr

gitee-pr

github.com/bioshaun开发036 次安装36 周前更新
代码仓库

关于 gitee-pr

gitee-pr 是从 Git 仓库创建 Gitee 拉取请求的脚本工作流。它会在推送和创建 PR 前,按团队规则检查分支名、提交主题、工作区状态及中文 PR 内容。

主要功能

  1. 01校验分支命名与提交
  2. 02检查工作区状态
  3. 03强制中文 PR 内容模板
  4. 04推送分支并创建 Gitee PR
  5. 05试运行检查与正文预览

适用场景

  1. 01准备仓库分支以创建 Gitee PR
  2. 02按团队规范检查提交
  3. 03预览 PR 检查及生成内容
  4. 04在 PR 检查前自动提交本地改动

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/bioshaun/tc-skills --skill gitee-pr

安装后在 Claude Code 中输入/gitee-pr确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

gitee-pr-rules.md
agents/
openai.yaml
scripts/
create_gitee_pr.py

详细介绍

Gitee PR

使用 scripts/create_gitee_pr.py 执行规则优先的 PR 工作流。 创建 PR 前,先应用团队规则 gitee-pr-rules.md。

规则文件

  • 主要规则:gitee-pr-rules.md

必需输入

  • 设置 Gitee 令牌:GITEE_TOKEN 或 --token。
  • 确保远程仓库是 Gitee 仓库,或提供 --repo owner/repo。
  • 在 Git 仓库内运行命令。

工作流

  1. 确定 head 和 base 分支。
  2. 强制使用分支命名格式:member/verb-description。
  3. 创建 PR 前确保工作区干净(或在启用 --auto-commit 时自动提交)。
  4. 使用允许的前缀验证 remote/base..head 中的所有提交主题:
    • feat:
    • fix:
    • docs:
    • refactor:
    • style:
    • test:
    • chore:
  5. 修改多个核心文件时发出警告(不阻止操作)。
  6. 强制 PR 内容使用中文:标题和正文必须包含中文文本。
  7. 强制 PR 正文模板遵循以下章节及顺序:
    • ## 改动了什么?
    • ## 为什么改动?
    • ## 测试结果?
    • ## 注意事项
  8. 推送分支,除非指定 --no-push。
  9. 通过 Gitee API 创建 PR,并打印 PR URL。

推荐命令

export GITEE_TOKEN="<token>"
python3 scripts/create_gitee_pr.py \
  --base main \
  --title "修复:优化过滤逻辑"
# Auto-commit local changes before PR checks
python3 scripts/create_gitee_pr.py \
  --auto-commit \
  --commit-message "chore: prepare gitee pr changes" \
  --base main
# Validate checks and preview generated PR body without API call
python3 scripts/create_gitee_pr.py --base main --dry-run --no-push
# Keep custom body (must follow required template sections)
python3 scripts/create_gitee_pr.py \
  --base main \
  --body "$(cat pr-body.md)"

默认 PR 正文模板

未提供 --body 时,脚本会生成:

## 改动了什么?
- <commit summaries>

## 为什么改动?
- 请补充本次改动的业务背景和目标。

## 测试结果?
- 已检查提交前工作区为干净状态。
- 请补充本地测试命令与结果。

## 注意事项
- 无

合并后清理

PR 合并后,清理分支:

git branch -d <branch-name>
git push origin --delete <branch-name>

评论

支持 Markdown