e1a4fec22b
撤 .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
30 lines
1.0 KiB
Bash
Executable File
30 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# 原型设计系统守门闸(本地 pre-commit)。
|
|
# 仅当本次提交动了原型(.superpowers/prototype/)时跑 check-ds.mjs 的 12 道检查;
|
|
# 任一违规 → 阻止提交。临时跳过:git commit --no-verify。
|
|
#
|
|
# 安装(每台机器一次,把仓库内本脚本接到 git 钩子):
|
|
# sh scripts/hooks/install.sh
|
|
root="$(git rev-parse --show-toplevel)"
|
|
gate="$root/.superpowers/prototype/tools/check-ds.mjs"
|
|
|
|
# 没动原型 → 直接放行
|
|
if ! git diff --cached --name-only | grep -q '^\.superpowers/prototype/'; then
|
|
exit 0
|
|
fi
|
|
|
|
if [ ! -f "$gate" ]; then
|
|
echo "[ds-gate] ⚠ 找不到 $gate,跳过设计系统检查。"
|
|
exit 0
|
|
fi
|
|
|
|
echo "[ds-gate] 原型有改动,跑设计系统守门闸(12 道)…"
|
|
if ! node "$gate" >/dev/null 2>&1; then
|
|
echo "[ds-gate] ✗ 设计系统检查未通过,提交已阻止。"
|
|
echo "[ds-gate] 详情:node .superpowers/prototype/tools/check-ds.mjs"
|
|
echo "[ds-gate] 跳过:git commit --no-verify"
|
|
exit 1
|
|
fi
|
|
echo "[ds-gate] ✓ 设计系统 12 道闸全过。"
|
|
exit 0
|