| name | push |
| source | ../../../../skills/push/SKILL.md |
| source_version | 2.0.0 |
| translation_version | 2.0.0 |
| last_synced | "2026-07-16T00:00:00.000Z" |
| source_hash | cb3cc9fb2313 |
| scope | universal |
| description | [UDS] AI 辅助 git push 安全层:质量门禁 + 协作护栏。
Use when: pushing commits, force pushing, pushing to protected branches, pushing feature branches.
Keywords: git push, force push, protected branch, quality gate, push receipt, PR automation, 推送, 保护分支, 质量门禁.
|
| allowed-tools | Read, Bash(git:*), Bash(npm:*), Bash(pnpm:*), Bash(yarn:*), Bash(bun:*) |
| argument-hint | [--force] [--target <branch>] [--skip-gates] [--no-pr] |
推送助手
语言: English | 简体中文
版本:2.0.0
创建日期:2026-04-23
适用范围:Claude Code Skills
git push 的 AI 辅助安全层。检测保护分支、强制 force-push 护栏、执行 pre-push 质量门禁、输出结构化推送收据,并集成 PR 自动化。
核心标准
本 Skill 实现 .standards/push-standards.ai.yaml。
执行工作流程
调用 /push 后,Claude 原生依序执行以下步骤:
Step 1:检测保护分支
执行 git rev-parse --abbrev-ref HEAD 获取当前分支。
比对 protected_branches 列表(默认:main、master、release/、hotfix/)。
若为保护分支:显示警告 + 待推送的 commit 列表,需用户明确确认才能继续。
Step 2:检测 Force Push
若检测到 --force 或 --force-with-lease:
执行 git log origin/<branch>..HEAD --oneline 找出将被覆盖的 commits。
显示数量与作者列表。需要用户输入 yes, force push 才能继续。
Step 3:执行 Pre-Push 质量门禁
依序使用 Bash tool 执行每个已设置的门禁:
lint:检测并执行项目 lint 命令
test:检测并执行项目测试命令
type-check(可选):TypeScript 类型检查
ac-coverage(可选):验收条件覆盖率
security-scan(可选):安全漏洞扫描
若任何必需门禁失败:中止并显示错误信息。
Step 4:执行推送
执行 git push <remote> <branch> [--force]。
若推送失败:显示 git 错误并建议修正方式。
Step 5:发出推送收据
将结构化收据输出到 console(可选择写入 ~/.uds/push-history.jsonl):
{
"branch": "<branch>",
"commit_sha": "<sha>",
"gates_passed": ["lint", "test"],