ci: refuse CLAUDE.md files by hook and keep every AGENTS.md out of the Collection tarball #330

Merged
Defame1297 merged 6 commits from ci/244-refuse-claude-md into main 2026-11-23 19:55:36 +00:00
Owner

What and why

Closes #244

  • .pre-commit-config.yaml: a local refuse-claude-md hook (language: fail, files: (^|/)(\.claude/)?CLAUDE(\.local)?\.md$, stage pre-commit). Any CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md makes Claude Code ignore every AGENTS.md, silently; Lint runs the hook through pre-commit run --all-files.
  • .gitea/workflows/image.yml: ci image 0.2.36 → 0.2.37, because .pre-commit-config.yaml is an image input (main took 0.2.36 for its own hook bump). The digest-pin pull request follows after the image builds.
  • scripts/check_tarball.py: */agents.md in FORBIDDEN (compared case-folded), so an AGENTS.md under any directory fails the Build; a root AGENTS.md was already refused by ALLOWED_TOP. Test added in tests/scripts/test_check_tarball.py.
  • galaxy.yml: unchanged. AGENTS.md and roles/AGENTS.md are already in build_ignore, and CLAUDE.md is no longer listed.
  • No changelog fragment: no consumer-visible change.

Verified

  • New test failed first (0 != 1 : roles/AGENTS.md), then passed with the pattern.
  • python3 -m unittest discover -s tests/scripts: all pass on a copy of the tracked files. In the working clone test_real_build_passes fails on an untracked, git-ignored local directory and fails identically on main; unrelated to this change.
  • pre-commit run refuse-claude-md --files …: fails on CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md, roles/x/CLAUDE.md, .claude/CLAUDE.local.md; skips docs/CLAUDE-notes.md.
  • A real ansible-galaxy collection build with roles/AGENTS.md in the tree leaves it out of the tarball, and check_tarball.py passes it.
  • pre-commit run --all-files passes; check_image_versions.py bump origin/main and pins print ok after the merge of main; pre-push ansible-test sanity passed.
  • CI on the first head: Lint, Build and Molecule passed (Lint).

Not verified

  • The 0.2.37 ci image build after merge; the follow-up digest-pin pull request.
  • The hook is case-sensitive, as the spec's regex is: a claude.md or CLAUDE.MD passes it. Whether Claude Code reads such a name on a case-insensitive file system was not checked.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Closes #244 - **`.pre-commit-config.yaml`**: a local `refuse-claude-md` hook (`language: fail`, `files: (^|/)(\.claude/)?CLAUDE(\.local)?\.md$`, stage `pre-commit`). Any `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` makes Claude Code ignore every `AGENTS.md`, silently; Lint runs the hook through `pre-commit run --all-files`. - **`.gitea/workflows/image.yml`**: `ci` image 0.2.36 → 0.2.37, because `.pre-commit-config.yaml` is an image input (`main` took 0.2.36 for its own hook bump). The digest-pin pull request follows after the image builds. - **`scripts/check_tarball.py`**: `*/agents.md` in `FORBIDDEN` (compared case-folded), so an `AGENTS.md` under any directory fails the Build; a root `AGENTS.md` was already refused by `ALLOWED_TOP`. Test added in `tests/scripts/test_check_tarball.py`. - **`galaxy.yml`**: unchanged. `AGENTS.md` and `roles/AGENTS.md` are already in `build_ignore`, and `CLAUDE.md` is no longer listed. - No changelog fragment: no consumer-visible change. ## Verified - New test failed first (`0 != 1 : roles/AGENTS.md`), then passed with the pattern. - `python3 -m unittest discover -s tests/scripts`: all pass on a copy of the tracked files. In the working clone `test_real_build_passes` fails on an untracked, git-ignored local directory and fails identically on `main`; unrelated to this change. - `pre-commit run refuse-claude-md --files …`: fails on `CLAUDE.md`, `.claude/CLAUDE.md`, `CLAUDE.local.md`, `roles/x/CLAUDE.md`, `.claude/CLAUDE.local.md`; skips `docs/CLAUDE-notes.md`. - A real `ansible-galaxy collection build` with `roles/AGENTS.md` in the tree leaves it out of the tarball, and `check_tarball.py` passes it. - `pre-commit run --all-files` passes; `check_image_versions.py bump origin/main` and `pins` print ok after the merge of `main`; pre-push `ansible-test sanity` passed. - CI on the first head: Lint, Build and Molecule passed ([Lint](https://git.rkdr.net/Mortis/Kamino/actions/runs/5137)). ## Not verified - The 0.2.37 `ci` image build after merge; the follow-up digest-pin pull request. - The hook is case-sensitive, as the spec's regex is: a `claude.md` or `CLAUDE.MD` passes it. Whether Claude Code reads such a name on a case-insensitive file system was not checked. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Claude added this to the Open to contributors milestone 2026-11-23 19:20:26 +00:00
Defame1297 was assigned by Claude 2026-11-23 19:20:26 +00:00
Claude added 3 commits 2026-11-23 19:20:26 +00:00
Claude Code reads CLAUDE.md in place of AGENTS.md, so a stray CLAUDE.md,
CLAUDE.local.md or .claude/CLAUDE.md at any depth leaves an agent without
this repository's guidance, and nothing reports it. A language: fail hook
refuses such a file at commit time.

Refs: #244

Assisted-by: Claude Code
.pre-commit-config.yaml is an input of the ci image, so the new hook
needs a new image version (0.2.35 -> 0.2.36).

Refs: #244

Assisted-by: Claude Code
ci(check_tarball): refuse AGENTS.md at any depth
Build / build (pull_request) Successful in 18s
Lint / lint (pull_request) Successful in 1m21s
Molecule / molecule (pull_request) Successful in 1s
35e780cf79
An AGENTS.md under roles/ holds contributor rules; shipped in the
Collection, a consumer's agent reading an installed role would load
them. galaxy.yml build_ignore lists the current ones, and the archive
check now refuses any AGENTS.md, compared case-insensitively, as the
allow list behind that deny list. A root AGENTS.md was already refused
by ALLOWED_TOP.

Refs: #244

Assisted-by: Claude Code
CODEOWNERS rules requested review from Defame1297 2026-11-23 19:20:26 +00:00
Defame1297 approved these changes 2026-11-23 19:27:28 +00:00
Dismissed
Defame1297 added 1 commit 2026-11-23 19:27:59 +00:00
Merge branch 'main' into ci/244-refuse-claude-md
Build / build (pull_request) Successful in 15s
Lint / lint (pull_request) Failing after 1m3s
Molecule / molecule (pull_request) Successful in 2s
d8f044740a
Defame1297 dismissed Defame1297's review 2026-11-23 19:27:59 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

CODEOWNERS rules requested review from Defame1297 2026-11-23 19:27:59 +00:00
Defame1297 approved these changes 2026-11-23 19:28:06 +00:00
Dismissed
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-11-23 19:28:10 +00:00
Defame1297 added 1 commit 2026-11-23 19:49:11 +00:00
ci(images): bump the ci image past main's 0.2.36
Build / build (pull_request) Successful in 16s
Molecule / molecule (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 13s
161e5bff63
main raised ci to 0.2.36 for its own .pre-commit-config.yaml change, so
the hook change here needs 0.2.37.

Refs: #244

Assisted-by: Claude Code
Defame1297 dismissed Defame1297's review 2026-11-23 19:49:11 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

CODEOWNERS rules requested review from Defame1297 2026-11-23 19:49:11 +00:00
Defame1297 added 1 commit 2026-11-23 19:53:13 +00:00
Merge branch 'main' into ci/244-refuse-claude-md
Build / build (pull_request) Successful in 16s
Molecule / molecule (pull_request) Successful in 2s
Lint / lint (pull_request) Successful in 1m23s
5d2f6ffad2
Defame1297 approved these changes 2026-11-23 19:53:18 +00:00
Defame1297 merged commit ff000857a9 into main 2026-11-23 19:55:36 +00:00
Defame1297 deleted branch ci/244-refuse-claude-md 2026-11-23 19:55:37 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#330