-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-hooks.yaml
More file actions
55 lines (53 loc) · 1.95 KB
/
Copy path.pre-commit-hooks.yaml
File metadata and controls
55 lines (53 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# agentfile as a pre-commit hook.
#
# Two hooks rather than one, because no single command covers both halves.
# `check` runs the structural and resolution layers; `audit` runs the security
# layer. A repository that wants the permission analysis has to ask for it.
#
# Both read the repository rather than a list of files, so `pass_filenames` is
# false and `files` is only a trigger: editing one skill can break a reference
# in another file, and a per-file hook would miss that.
#
# The leading `(.*/)?` in `files` is deliberate. A monorepo carries a CLAUDE.md
# or a .claude/ directory per package, and agentfile discovers all of them.
#
# The version is pinned to the tag that carries this file, so a consumer who
# pins `rev: v2.7.0` gets 2.5.0 and not whatever `latest` becomes tomorrow.
# Bumping it is part of cutting a release.
- id: agentfile
name: agentfile
description: Structural and resolution checks on the agent configuration this repository already has.
entry: npx --yes @agentfile/cli@2.7.0 check
language: system
pass_filenames: false
files: >-
(?x)^(.*/)?(
AGENTS\.md|
CLAUDE\.md|
\.mcp\.json|
\.agentfile\.(json|ya?ml)|
\.claude/.*|
\.cursor/.*|
\.github/copilot-instructions\.md
)$
# `audit` exits 0 on warnings, and every permission finding is a warning, so
# without `--strict` this hook would pass on a rule that grants arbitrary
# command execution. A hook that cannot fail is worse than no hook: it reports
# assurance it has not earned. Override `args` to relax it.
- id: agentfile-audit
name: agentfile audit
description: Security analysis of permission rules, hooks and MCP servers.
entry: npx --yes @agentfile/cli@2.7.0 audit
args: [--strict]
language: system
pass_filenames: false
files: >-
(?x)^(.*/)?(
AGENTS\.md|
CLAUDE\.md|
\.mcp\.json|
\.agentfile\.(json|ya?ml)|
\.claude/.*|
\.cursor/.*|
\.github/copilot-instructions\.md
)$