ci(pre-commit): refuse a plugins/ directory and agent co-author trailers
Two local hooks hold rules that review held until now: - refuse-plugins (language: fail, ^plugins/): the Collection holds roles only; a plugin needs an ADR first, whose pull request removes the hook. It runs before ansible-lint so that hook's fail_fast cannot hide it. - refuse-agent-trailers (pygrep, commit-msg stage): refuses Claude-Session: and Co-Authored-By: lines naming a known agent identity. A human co-author passes, including one whose first name is Claude. The hook name carries the rule, since pygrep prints no other message. AGENTS.md and ai-assistance.md name the hook as a partial control of the trailer rule; other AI trailers stay held by review. Closes #272 Assisted-by: Claude Code
This commit is contained in:
1 parent
e951008182
commit
aba119ddd2
3 files changed
+25
-4
No files matched your search
@@ -114,6 +114,16 @@ repos:
|
||||
require_serial: true
|
||||
stages: ['pre-push']
|
||||
|
||||
# SECURITY.md's accepted risks rest on the Collection shipping roles only. It sits before
|
||||
# ansible-lint, whose fail_fast would otherwise hide this message.
|
||||
- id: refuse-plugins
|
||||
name: Refuse a plugins/ directory
|
||||
description: refuse any file under plugins/
|
||||
entry: the Collection holds roles only; a plugin needs an ADR in docs/adr/ first, and that ADR's pull request removes this hook
|
||||
language: fail
|
||||
files: ^plugins/
|
||||
stages: ['pre-commit']
|
||||
|
||||
- id: ansible-lint
|
||||
name: ansible-lint
|
||||
description: ansible-lint production profile, offline
|
||||
@@ -136,6 +146,17 @@ repos:
|
||||
files: (?i)(^|/)(\.claude/)?claude(\.local)?\.md$
|
||||
stages: ['pre-commit']
|
||||
|
||||
# Agent tools write these trailers by default. pygrep prints only the hook's name and the
|
||||
# matching line, so the name carries the rule. Claude is also a person's name, so it matches
|
||||
# only as a trailer's whole name ("Claude <"); a human Co-Authored-By: stays allowed.
|
||||
- id: refuse-agent-trailers
|
||||
name: "Agent work carries Assisted-by: <tool>[:<model>], never an agent Co-Authored-By: or a session link (docs/contributing/ai-assistance.md)"
|
||||
description: refuse Claude-Session and Co-Authored-By lines naming a known agent identity
|
||||
entry: '^(claude-session:|co-authored-by:\s*claude\s*<|co-authored-by:.*(noreply@anthropic\.com|\b(copilot|cursor|gemini|codex)\b))'
|
||||
language: pygrep
|
||||
args: [--ignore-case]
|
||||
stages: [commit-msg]
|
||||
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: check-hooks-apply
|
||||
|
||||
Reference in new issue
Block a user