#!/bin/sh # pre-commit — 验证被修改的 wiki 页面 frontmatter CHANGED=$(git diff --cached --name-only --diff-filter=ACM | grep '^wiki/.*\.md$') if [ -z "$CHANGED" ]; then exit 0; fi python tools/scripts/validate-frontmatter.py --git-hook if [ $? -ne 0 ]; then echo "ERROR: Frontmatter validation failed. Commit rejected." echo "Run 'python tools/scripts/validate-frontmatter.py --files ' to check." exit 1 fi