pre-commit 653 B

1234567891011121314
  1. #!/bin/sh
  2. # 核心代码变更没有同时暂存协作文档时给出提醒,但不阻止提交。
  3. staged_files="$(git -c core.quotepath=false diff --cached --name-only --diff-filter=ACMR)"
  4. if printf '%s\n' "$staged_files" | grep -Eq '^(src/app/services/|server/routes/|cloud-functions/)'; then
  5. if ! printf '%s\n' "$staged_files" | grep -Eq '^(AGENTS\.md|docs/AI助手必读规范/.*\.md)$'; then
  6. printf '\n%s\n%s\n\n' \
  7. '============================================================' \
  8. '⚠️ 你改了核心代码但没更新协作文档,请确认 AGENTS.md 或 docs/AI助手必读规范/ 是否需要同步。'
  9. fi
  10. fi
  11. exit 0