chore: 设计系统闸改本地 pre-commit(撤 CI)
撤 .gitea/workflows/ds-gate.yml,改本地钩子: - scripts/hooks/pre-commit:提交动了 .superpowers/prototype/ 才跑 check-ds.mjs (12 道),违规即 exit 1 阻止;--no-verify 可跳过。 - scripts/hooks/install.sh:每台机器跑一次,装 worktree-aware shim 到 git hooks。 原型仍入库(上一提交),仅执行处从 CI 移到本地。已测:违规阻止/无关跳过均正确。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# 安装本地 git 钩子(每台机器跑一次)。把 git 的 pre-commit 接到仓库内
|
||||
# scripts/hooks/pre-commit(设计系统守门闸)。钩子是本地的,不随 git 同步——
|
||||
# 故需各机器各跑一次本脚本。
|
||||
set -e
|
||||
|
||||
hooks_dir="$(git rev-parse --git-path hooks)"
|
||||
mkdir -p "$hooks_dir"
|
||||
target="$hooks_dir/pre-commit"
|
||||
|
||||
cat > "$target" <<'SH'
|
||||
#!/bin/sh
|
||||
# 委托到仓库内 scripts/hooks/pre-commit(随当前 worktree 的 checkout 走;
|
||||
# 不存在则放行,便于尚未合入该脚本的分支/worktree)。
|
||||
hook="$(git rev-parse --show-toplevel)/scripts/hooks/pre-commit"
|
||||
[ -x "$hook" ] && exec "$hook"
|
||||
exit 0
|
||||
SH
|
||||
chmod +x "$target"
|
||||
|
||||
echo "[ds-gate] ✓ 已安装 pre-commit 钩子 → $target"
|
||||
echo "[ds-gate] 今后提交若动了 .superpowers/prototype/ 会自动跑 12 道设计系统闸。"
|
||||
Reference in New Issue
Block a user