ci: refuse CLAUDE.md files by hook and keep every AGENTS.md out of the Collection tarball #330
No files matched your search
@@ -87,7 +87,7 @@ jobs:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
||||||
- name: ci
|
- name: ci
|
||||||
version: 0.2.36
|
version: 0.2.37
|
||||||
subpath: ""
|
subpath: ""
|
||||||
dockerfile: images/ci/Dockerfile
|
dockerfile: images/ci/Dockerfile
|
||||||
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
job_image: ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da069b5d76db
|
||||||
|
|||||||
@@ -126,6 +126,16 @@ repos:
|
|||||||
require_serial: true
|
require_serial: true
|
||||||
fail_fast: true
|
fail_fast: true
|
||||||
|
|
||||||
|
# apm compile (target claude), a tool's project init or a skill can create a CLAUDE.md, and
|
||||||
|
# the failure is silent: the agent gets no guidance and no error.
|
||||||
|
- id: refuse-claude-md
|
||||||
|
name: Refuse CLAUDE.md files
|
||||||
|
description: refuse CLAUDE.md, CLAUDE.local.md and .claude/CLAUDE.md at any depth
|
||||||
|
entry: a CLAUDE.md file makes Claude Code ignore every AGENTS.md; delete it
|
||||||
|
language: fail
|
||||||
|
files: (^|/)(\.claude/)?CLAUDE(\.local)?\.md$
|
||||||
|
stages: ['pre-commit']
|
||||||
|
|
||||||
- repo: meta
|
- repo: meta
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-hooks-apply
|
- id: check-hooks-apply
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ FORBIDDEN = [
|
|||||||
"*.env.*",
|
"*.env.*",
|
||||||
"*/.env*",
|
"*/.env*",
|
||||||
".env*",
|
".env*",
|
||||||
|
# Contributor rules: a consumer's agent reading an installed role would load them.
|
||||||
|
"*/agents.md",
|
||||||
]
|
]
|
||||||
# Names Windows treats as devices, with or without an extension (and with trailing spaces).
|
# Names Windows treats as devices, with or without an extension (and with trailing spaces).
|
||||||
WINDOWS_RESERVED = {
|
WINDOWS_RESERVED = {
|
||||||
|
|||||||
@@ -70,6 +70,22 @@ class TarballTest(unittest.TestCase):
|
|||||||
self.assertEqual(len(found), 1, name)
|
self.assertEqual(len(found), 1, name)
|
||||||
self.assertIn("forbidden pattern", found[0], name)
|
self.assertIn("forbidden pattern", found[0], name)
|
||||||
|
|
||||||
|
def test_agents_md_is_refused_at_any_depth(self):
|
||||||
|
for name in (
|
||||||
|
"roles/AGENTS.md",
|
||||||
|
"roles/x/AGENTS.md",
|
||||||
|
"roles/x/templates/Agents.md",
|
||||||
|
):
|
||||||
|
found = check_tarball.problems([name])
|
||||||
|
self.assertEqual(len(found), 1, name)
|
||||||
|
self.assertIn("forbidden pattern", found[0], name)
|
||||||
|
self.assertEqual(
|
||||||
|
check_tarball.problems(
|
||||||
|
["roles/x/README.md", "roles/x/files/agents_notes.md"]
|
||||||
|
),
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
|
||||||
def test_ambiguous_names_are_rejected(self):
|
def test_ambiguous_names_are_rejected(self):
|
||||||
cases = {
|
cases = {
|
||||||
"roles/a/x ": "ends in a space or a dot",
|
"roles/a/x ": "ends in a space or a dot",
|
||||||
|
|||||||
Reference in new issue
Block a user