install_git_hooks.sh 586 B

1234567891011
  1. #!/usr/bin/env bash
  2. # 安装仓库级 git hooks:将 core.hooksPath 指向 .githooks/,启用提交前校验:
  3. # 1) 知识库校验(docs/参考资料/知识库 变更)
  4. # 2) 后端循环依赖强约束(cfc-backend/ 或 tools/check_circular_deps.py 变更,eager 环阻断)
  5. # 幂等,可重复执行。
  6. set -euo pipefail
  7. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
  8. git -C "$ROOT" config core.hooksPath .githooks
  9. echo "hooksPath -> $(git -C "$ROOT" config core.hooksPath)"
  10. echo "已启用: $ROOT/.githooks/pre-commit (知识库 + 循环依赖 提交前校验)"