[AI] Add project-level hook to enforce PR creation rules (#7471)

* [AI] Add project-level hook to enforce PR creation rules

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* [AI] Fix hook JSON output format to use hookSpecificOutput

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* Rename 7470.md to 7471.md

* Update upcoming-release-notes/7471.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Matiss Janis Aboltins
2026-04-11 15:37:26 +00:00
committed by GitHub
co-authored by Claude Opus 4.6 coderabbitai[bot]
parent 5220dff75b
commit d6253c86eb
2 changed files with 23 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"if": "Bash(gh pr create*)",
"command": "echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"ask\",\"permissionDecisionReason\":\"STOP: Read .github/agents/pr-and-commit-rules.md FIRST, then create the PR following its rules (title prefix, labels, blank template).\"}}'",
"statusMessage": "Checking PR creation rules..."
}
]
}
]
}
}
+6
View File
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MatissJanis]
---
AI: force Claude Code to read PR creation rules