技能介绍
SkillDev toolsManual trigger: handles commits, pre-PR rebase, push, and PR creation for the LinaPro main repository and the apps/lina-plugins submodule, the main-repo CI fix loop, and after PR merge, restores the original branch and syncs main. Automatic triggering is forbidden.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the 技能介绍 skill
What this skill tells your AI
The instructions your AI receives, as published by linaproai/linapro in .agents/skills/lina-community-commit-push-and-pr/SKILL.md and read by ahel’s review.
串联主仓库与apps/lina-plugins的提交、推送、PR与收尾。子模块有变更时先合子模块PR,再更新主仓库子模块指针并开主仓库PR。主仓库PR存活期间子模块修复走 fix 分支,禁止在子模块main上改代码。
核心规则
- 主仓库默认当前工作目录,远端默认
linaproai/linapro。 - 子模块远端从
.gitmodules和git -C apps/lina-plugins remote -v读取,通常是linaproai/official-plugins。 - 子模块与主仓库
PR目标分支均固定为各自main。 - 创建任何
PR前:提交当前变更 →PR前rebase门禁 → 推送 → 创建PR。 - 不静默丢弃工作区变更;无关变更先报告,仅能限定到目标路径时才继续。
- 除本技能要求的
PR前rebase外,不使用--force、--force-with-lease、git reset --hard等历史重写,除非用户明确要求。 - 子模块
main只读对齐,禁止在其上commit/push修复。 若当前在main且需改子模块,必须先switch -c fix/<main-branch>(或等价任务分支)。 - 子模块
PR创建后停止,等用户已合并/继续;主仓库PR创建后停止。用户说继续后用gh pr view或远端main确认已合并,未合并则停止。 - 主仓库
PR未合并前若需改子模块,走阶段 2.5,不得进入阶段三。 - 两个
PR均MERGED后,切回流程开始时的原始分支并包含最新origin/main。 - 合并/
rebase/子模块指针冲突时立即停止交用户;禁止自行解冲突或继续rebase。
前置检查
git status --short --branch
git branch --show-current
cat .gitmodules
git submodule status apps/lina-plugins
git -C apps/lina-plugins status --short --branch
git remote -v
git -C apps/lina-plugins remote -v
gh auth status
记录原始分支(收尾必用):
original_main_branch=$(git branch --show-current)
original_sub_branch=$(git -C apps/lina-plugins branch --show-current)
主仓库或子模块处于分离HEAD,或任一原始分支为空时停止,除非用户明确要求继续。
PR 前 rebase 门禁
顺序:提交 → fetch origin main → rebase origin/main → 检查origin/main..HEAD → 推送 → 创建PR。不得用merge origin/main代替。
子模块:
git -C apps/lina-plugins fetch origin main
git -C apps/lina-plugins rebase origin/main
git -C apps/lina-plugins merge-base --is-ancestor origin/main HEAD
git -C apps/lina-plugins log --oneline --decorate origin/main..HEAD
主仓库:
git fetch origin main
git rebase origin/main
git merge-base --is-ancestor origin/main HEAD
git log --oneline --decorate origin/main..HEAD
origin/main..HEAD含无关/异常提交时不得开PR,报告后等用户决定。- 普通
push非快进被拒时不得自动强推;需用户授权或改用新分支名。 rebase冲突:停止,不推送、不开PR;禁止add/commit/rebase --continue|--skip|--abort,除非用户明确要求。
冲突处理
可合并性先只读检查:
git merge-tree --write-tree HEAD origin/main
可自动合并时:
git merge --no-edit origin/main
git push origin "$(git branch --show-current)"
冲突则停止并报告;工作区已冲突时保留现场,不自动merge --abort,除非用户要求。
阶段一:子模块 PR
git -C apps/lina-plugins status --short --branch
git -C apps/lina-plugins diff --stat
git -C apps/lina-plugins diff --cached --stat
无内容更新则跳过,进入阶段二。
有更新时:
- 若在
main,先切任务分支:
sub_branch=$(git -C apps/lina-plugins branch --show-current)
if [ "$sub_branch" = "main" ]; then
git -C apps/lina-plugins switch -c "<task-branch>"
sub_branch=$(git -C apps/lina-plugins branch --show-current)
fi
- 提交(
<类型>[可选作用域]: <描述>):
git -C apps/lina-plugins add -A
git -C apps/lina-plugins commit -m "<submodule-subject>"
PR前rebase门禁。- 推送并创建
PR;记录sub_pr_url/sub_branch。
git -C apps/lina-plugins push origin "$sub_branch"
gh pr create \
--repo "<submodule-owner>/<submodule-repo>" \
--base main \
--head "$sub_branch" \
--title "<title>" \
--body-file -
- 输出
PR地址后停止:
请先 review 并合并该 submodule PR。合并完成后回复“已合并”或“继续”,我再更新主仓库 submodule 指针并创建主仓库 PR。
创建后不得进入阶段二。
阶段二:主仓库 PR
条件:子模块无更新,或阶段一PR已确认MERGED。
- 拉取远端
main。
git fetch origin main
git -C apps/lina-plugins fetch origin main
- 若有子模块
PR,确认已合并;未合并则停止。
gh pr view "<submodule-pr-number-or-url>" \
--repo "<submodule-owner>/<submodule-repo>" \
--json number,state,mergeCommit,url,baseRefName,headRefName
- 子模块对齐
origin/main(仅取指针,非修复工作区):
git -C apps/lina-plugins switch main
git -C apps/lina-plugins merge --ff-only origin/main
- 确认主仓库仅含预期变更;无关差异先报告。
git status --short --branch
git diff --submodule=log -- apps/lina-plugins
git diff --stat
- 提交主仓库(指针与其它任务变更分开语义清晰即可):
main_branch=$(git branch --show-current)
git add apps/lina-plugins
# 已确认属于本次任务的其它路径再 git add
git commit -m "chore(plugins): update lina-plugins submodule"
PR前rebase门禁。- 推送并创建主仓库
PR;记录main_pr_url/main_branch。
git push origin "$main_branch"
gh pr create \
--repo linaproai/linapro \
--base main \
--head "$main_branch" \
--title "<title>" \
--body-file -
-
若
PR状态为CONFLICTING,按冲突处理;能自动合则合入origin/main并推送,否则停止。 -
主仓 PR 创建后:子模块切到 fix 分支,禁止停在
main等待。
git -C apps/lina-plugins fetch origin main
git -C apps/lina-plugins switch main
git -C apps/lina-plugins merge --ff-only origin/main
sub_fix_branch="fix/${main_branch}"
git -C apps/lina-plugins switch -c "$sub_fix_branch"
若fix/${main_branch}已存在,则switch该分支并rebase origin/main(冲突则停)。
阶段二完成后停止:
请 review 主仓库 PR。若 CI/评审需改子模块:在 fix/<主仓分支> 上修改并走阶段 2.5,禁止在子模块 main 上提交。
主仓库 PR 合并后回复“已合并”或“继续收尾”。
阶段 2.5:主仓 PR 存活期修复(可选)
触发:主仓库PR已开未合,且 CI/评审需要改代码。
门禁:
- 子模块当前分支为
main且要改内容 → 先切/建fix/<main_branch>,禁止在main上commit/push。 - 主仓库修复提交到已有
main_branch并push更新同一PR(用户要求新开PR除外)。
子模块需改时:
- 确保在
fix/<main_branch>(基于最新origin/main)。 - 提交 →
PR前rebase→ 推送 → 创建子模块 follow-upPR。 - 停止,等用户合并该子模块
PR。 - 确认
MERGED后:
git -C apps/lina-plugins fetch origin main
git -C apps/lina-plugins switch main
git -C apps/lina-plugins merge --ff-only origin/main
# 主仓库任务分支上更新指针
git switch "$main_branch"
git add apps/lina-plugins
git commit -m "chore(plugins): update lina-plugins submodule"
# PR 前 rebase 门禁后
git push origin "$main_branch"
# 子模块回到 fix 分支待命
git -C apps/lina-plugins switch -c "fix/${main_branch}" 2>/dev/null \
|| git -C apps/lina-plugins switch "fix/${main_branch}"
git -C apps/lina-plugins merge --ff-only origin/main
- 仅改主仓库时:在
main_branch提交、rebase、push即可。 - 仍失败则重复本阶段;通过后仍等用户合并主仓库
PR,不得提前阶段三。
阶段三:合并后恢复分支
条件:本流程创建过的子模块/follow-up与主仓库PR均已MERGED;original_*非空;无未提交修复。
- 再确认
MERGED。
gh pr view "<submodule-pr-or-followup>" \
--repo "<submodule-owner>/<submodule-repo>" \
--json number,state,mergeCommit,url
gh pr view "<framework-pr-number-or-url>" \
--repo linaproai/linapro \
--json number,state,mergeCommit,url
- 刷新
main。
git fetch origin main
git -C apps/lina-plugins fetch origin main
- 子模块回原始分支并包含
origin/main。
git -C apps/lina-plugins switch "$original_sub_branch"
git -C apps/lina-plugins merge --ff-only origin/main
--ff-only失败则按冲突处理;需人工选择时停止。
- 主仓库同理。
git switch "$original_main_branch"
git merge --ff-only origin/main
- 校验。
git status --short --branch
git merge-base --is-ancestor origin/main HEAD
git -C apps/lina-plugins status --short --branch
git -C apps/lina-plugins merge-base --is-ancestor origin/main HEAD
- 相对远端领先则推送;无上游用
-u;落后或分叉则停止。
git rev-list --left-right --count "origin/$original_main_branch"...HEAD
git -C apps/lina-plugins rev-list --left-right --count "origin/$original_sub_branch"...HEAD
git push origin "$original_main_branch"
git -C apps/lina-plugins push origin "$original_sub_branch"
PR 正文
通用:Summary、Tests(未跑则写Not run by this PR creation step.)、Related Issue(识别到用Resolves ...,否则说明无关联且不阻塞)。
主仓库另加Submodule:apps/lina-plugins从何 SHA 更新到何 SHA。
输出
阶段一: 子模块分支/主题/推送目标、rebase与origin/main..HEAD、PR地址、等待合并提醒。
阶段二: 子模块对齐的main SHA、主仓库分支/主题、rebase检查、PR地址与可合并性、子模块当前 fix 分支、工作区是否干净、测试是否运行。
阶段 2.5: 修复落在哪一仓库/分支、子模块 follow-upPR(如有)、主仓库是否已 bump 指针并 push、下一步等待项。
阶段三: 已合并PR与 merge commit、两侧当前分支与是否含最新main/是否已推送、工作区是否干净、测试是否运行。
Signals
- GitHub stars
- 153
- Forks
- 29
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
lina-community-commit-push-and-pr- Source
- github.com/linaproai/linapro