mcpField
G
graphic-2d-PR

graphic-2d-PR

github.com/openharmonyinsight开发3563 次安装11 周前更新
代码仓库

关于 graphic-2d-PR

面向 OpenHarmony graphic_graphic_2d 贡献者的工作流技能,涵盖签名提交、推送到 Fork,以及通过 Gitcode 管理 Issue 和 PR。

主要功能

  1. 01暂存更改并创建分支
  2. 02要求提交遵循 DCO 签名
  3. 03将分支推送到 Fork
  4. 04创建并关联 Issue 与 PR

适用场景

  1. 01准备代码更改以提交上游审查
  2. 02将 PR 关联到跟踪 Issue

MCP 相关

使用 Gitcode MCP 工具在上游仓库创建 Issue、PR 和 Issue 评论。

安装

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

$npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill graphic-2d-pr

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

详细介绍

前提条件

  • 已配置 Git 远程仓库(使用 git remote -v 检查):
    • 上游仓库(openharmony/graphic_graphic_2d)
    • 用户的复刻仓库(username/graphic_graphic_2d)
  • 可使用 Gitcode MCP 工具(如果尚未安装,请从此仓库安装)
  • 构建成功通过

工作流

1. 暂存并提交更改
# Reset any staged changes and stage everything together
git reset HEAD .
git add .
git status

# Create a new branch from current branch
git checkout -b feature/descriptive-branch-name

# Commit with signoff (required)
git commit -s -m "type: brief description

Detailed explanation of the change.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"

注意:提交时始终使用 -s 标志,以符合 DCO 要求。

2. 推送到复刻仓库
# Push branch to fork (remote 'z')
git push -u z feature/descriptive-branch-name
3. 创建议题

使用 Gitcode MCP 工具在上游仓库中创建议题:

mcp__gitcode__create_issue
- owner: openharmony
- repo: graphic_graphic_2d
- title: Brief issue title
- body: Detailed issue description with:
  - Summary
  - Problem
  - Solution
  - Impact
  - Files Modified

议题正文示例:

## Summary
Brief description of the issue/change.

## Problem
What problem does this solve?

## Solution
How is it solved?

## Impact
- What changes are made?
- Performance impact
- Test results

## Files Modified
- file1.h
- file2.cpp
4. 创建拉取请求

使用 Gitcode MCP 工具在上游仓库中创建 PR:

mcp__gitcode__create_pull_request
- owner: openharmony
- repo: graphic_graphic_2d
- base: master (NOT main - use master)
- head: zhoutianer:feature/descriptive-branch-name
- title: PR title (matches issue title)
- body: Detailed PR description

重要:使用 master 作为目标分支,而不是 main。

PR 正文示例:

## Summary
Brief description.

## Problem
What problem does this solve?

## Solution
Technical details of the implementation.

## Impact
- Code quality improvements
- Performance impact
- Test results

## Test plan
- [x] Build passes
- [x] All tests pass
- [x] No new warnings

## Files Modified
- file1.h
- file2.cpp

Closes #<issue-number>

末尾的 Closes #<issue-number> 会自动将 PR 与议题关联。

5. 将议题关联到 PR

在议题中添加一条评论,引用 PR:

mcp__gitcode__create_issue_comment
- owner: openharmony
- repo: graphic_graphic_2d
- issue_number: <issue-number>
- body: Link to PR and summary

评论示例:

This issue is addressed by PR #<pr-number>: https://gitcode.com/openharmony/graphic_graphic_2d/merge_requests/<pr-number>

The PR implements:
- Key change 1
- Key change 2

Build passes in X:YY time with all tests passing.

重要说明

  1. 目标分支:始终使用 master,而不是 main
  2. 签署提交:始终使用 git commit -s,以符合 DCO 要求
  3. 分支命名:使用描述性名称,例如 refactor/feature-name、fix/bug-description
  4. 议题与 PR 关联:在 PR 正文中包含 Closes #<issue-number>
  5. 远程仓库名称:
    • gitcode - 上游仓库(openharmony/graphic_graphic_2d)
    • z - 复刻仓库(zhoutianer/graphic_graphic_2d)

示例会话

# After making code changes
git reset HEAD .
git add .
git checkout -b refactor/color-picker-common-impl
git commit -s -m "refactor: Extract common implementation

- Add HandleColorUpdate to base interface
- Extract CreateColorPickerInfo helper
- Remove ~200 lines of duplication

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>"

git push -u z refactor/color-picker-common-impl

然后使用 MCP 工具创建议题 #22224、PR #28311,并将它们关联起来。

故障排除

创建 PR 时因 API 错误(400)而失败:

  • 检查目标分支是否为 master,而不是 main
  • 确保已先将分支推送到复刻仓库

议题未与 PR 关联:

  • 确认 PR 正文中包含 Closes #<issue-number>
  • 检查议题编号是否正确
  • 如果自动关联失败,请在议题中手动添加评论

评论

支持 Markdown