Add AGENTS.md and SKILL.md governance check gates
This commit is contained in:
1 parent
219be61585
commit
f5b66be85f
10 files changed
+609
-5
No files matched your search
+26
-3
@@ -1,6 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Git pre-commit hook: enforce the device branch-prefix rule
|
||||
# (.agents/rules/branch-naming.md) via .githooks/branch-guard.sh
|
||||
# Git pre-commit hook:
|
||||
# 1. Enforce the device branch-prefix rule (.agents/rules/branch-naming.md)
|
||||
# via .githooks/branch-guard.sh.
|
||||
# 2. Route staged governance documents to their dedicated checkers — each
|
||||
# document class has its own verifier (no all-in-one gate):
|
||||
# AGENTS.md, .agents/rules/*.md -> bun run verify:agents-md
|
||||
# SKILL.md, skills references -> bun run verify:skill-md
|
||||
# Local gates fail open when bun is unavailable; CI re-runs both.
|
||||
source "$(dirname "$0")/branch-guard.sh"
|
||||
|
||||
guard_branch_name "$(git branch --show-current)"
|
||||
guard_branch_name "$(git branch --show-current)" || exit 1
|
||||
|
||||
staged="$(git diff --cached --name-only --diff-filter=ACMR)"
|
||||
|
||||
if ! command -v bun >/dev/null 2>&1; then
|
||||
echo "⚠️ [pre-commit] bun 未找到,跳过治理文档校验(CI 会重新执行)。" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$staged" | grep -qx "AGENTS.md" || printf '%s\n' "$staged" | grep -q "^\.agents/rules/"; then
|
||||
bun run verify:agents-md || exit 1
|
||||
fi
|
||||
|
||||
if printf '%s\n' "$staged" | grep -qE "^skills/seal-use/(SKILL\.md|references/[^/]+\.md)$"; then
|
||||
bun run verify:skill-md || exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user