a22db0874f
.githooks/pre-commit 在原有(红线/SQL/codegen-drift)基础上增挂三道 ds-flow 闸,
条件触发、秒级:
- 原型校验(check-ds):动了 design/prototype/ 才跑
- 跨端同源(check-l1-sync):动了 prototype/ 或 web/{website,usercenter}/ 才跑
- Flutter 颜色单源(check_ds_code --changed):动了 client/lib/*.dart 才跑(只扫改动)
install-hooks.sh 说明同步更新。启用仍是每台机一次性 `bash ci/install-hooks.sh`
(不代跑,改本机 git config;CLAUDE.md 治理章节已注明)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
757 B
Bash
Executable File
20 lines
757 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# install-hooks.sh — 启用本地 git hooks(闸 3:提交前把关)。
|
|
#
|
|
# 一次性运行即可;之后每次 git commit 会自动跑 .githooks/pre-commit
|
|
# (红线词 + 可移植 SQL + codegen 漂移)。失败会中止提交。
|
|
#
|
|
# 卸载: git config --unset core.hooksPath
|
|
set -euo pipefail
|
|
|
|
ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "$ROOT"
|
|
|
|
git config core.hooksPath .githooks
|
|
chmod +x .githooks/* 2>/dev/null || true
|
|
|
|
echo "✓ 已启用 git hooks(core.hooksPath=.githooks)"
|
|
echo " pre-commit 将跑:红线词扫描 · 可移植 SQL 扫描 · codegen 漂移检查"
|
|
echo " + ds-flow 条件闸(动了原型/web/client 才跑):原型校验 · 跨端同源 · Flutter 颜色单源"
|
|
echo " 卸载:git config --unset core.hooksPath"
|