| name | push |
| source | ../../../../skills/push/SKILL.md |
| source_version | 2.0.0 |
| translation_version | 2.0.0 |
| last_synced | "2026-06-02T00:00:00.000Z" |
| source_hash | b7812535483c |
| 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"],