feat(pre-commit): let a repo exempt vendored trees from the fixer hooks #1159

Merged
coilysiren merged 1 commit from feat/vendored-tree-exclude into main 2026-08-20 08:41:47 +00:00
Owner

A consumer lists upstream-owned path prefixes under [tool.agentic-os.managed-hooks] vendored, and the generated block puts an exclude: on the three hooks that rewrite file content: trailing-whitespace, end-of-file-fixer, mixed-line-ending.

Reporting hooks are deliberately untouched, so a secret or a broken JSON inside a vendored tree is still caught. The secret scan is unaffected either way, since both trufflehog hooks are pass_filenames: false and scan the git repo directly rather than pre-commit's file list.

Why

Two repos need it, and eco-ops needs it badly.

  • eco-ops tracks ~140 third-party Eco mod source files under mods/Mods/ against upstream (mod.io, GitHub, Discord) via just check-drift. A pre-commit run --all-files there rewrites all of them to strip trailing whitespace, which is permanent drift against upstream and turns every future mod re-sync into a conflict. This is not hypothetical: that sweep is sitting uncommitted in the checkout right now, 777 lines across 172 files.
  • eco-ops also has configs/scripts/configs.py writing json.dumps(...) with no trailing newline at all three write sites. end-of-file-fixer adds one, the next just show-diffs strips it, forever, across 20 files. (That one also deserves a generator fix, handled in eco-ops.)
  • eco-app vendors the en-US-trimmed Eco recipe graph.

Shape

PRECOMMIT_HOOKS entries carry a rewrites flag; vendored_exclude() reads the consumer's pyproject.toml through the existing cfg.load_str_list, symmetric with how actionlint_args() already keys off a consumer file. No declaration means no exclude: line, so every existing consumer's generated block is byte-identical.

Two tests cover both directions: that the three fixers get the exclude and the reporting hooks do not, and that an undeclared repo's block stays bare.

Refs coilyco-gaming/eco-ops#91

A consumer lists upstream-owned path prefixes under `[tool.agentic-os.managed-hooks] vendored`, and the generated block puts an `exclude:` on the three hooks that rewrite file content: `trailing-whitespace`, `end-of-file-fixer`, `mixed-line-ending`. Reporting hooks are deliberately untouched, so a secret or a broken JSON inside a vendored tree is still caught. The secret scan is unaffected either way, since both trufflehog hooks are `pass_filenames: false` and scan the git repo directly rather than pre-commit's file list. ## Why Two repos need it, and eco-ops needs it badly. * **eco-ops** tracks ~140 third-party Eco mod source files under `mods/Mods/` against upstream (mod.io, GitHub, Discord) via `just check-drift`. A `pre-commit run --all-files` there rewrites all of them to strip trailing whitespace, which is permanent drift against upstream and turns every future mod re-sync into a conflict. This is not hypothetical: that sweep is sitting uncommitted in the checkout right now, 777 lines across 172 files. * **eco-ops** also has `configs/scripts/configs.py` writing `json.dumps(...)` with no trailing newline at all three write sites. `end-of-file-fixer` adds one, the next `just show-diffs` strips it, forever, across 20 files. (That one also deserves a generator fix, handled in eco-ops.) * **eco-app** vendors the en-US-trimmed Eco recipe graph. ## Shape `PRECOMMIT_HOOKS` entries carry a `rewrites` flag; `vendored_exclude()` reads the consumer's `pyproject.toml` through the existing `cfg.load_str_list`, symmetric with how `actionlint_args()` already keys off a consumer file. No declaration means no `exclude:` line, so every existing consumer's generated block is byte-identical. Two tests cover both directions: that the three fixers get the exclude and the reporting hooks do not, and that an undeclared repo's block stays bare. Refs coilyco-gaming/eco-ops#91
feat(pre-commit): let a repo exempt vendored trees from the fixer hooks
All checks were successful
ci / aos-eval-tests (pull_request) Successful in 4s
ci / ward-doctor (pull_request) Successful in 14s
ci / aos-cli-tests (pull_request) Successful in 20s
ci / gate (pull_request) Successful in 1m21s
6acbbd90f7
A consumer lists upstream-owned path prefixes under
`[tool.agentic-os.managed-hooks] vendored`, and the generated block puts an
`exclude:` on the three hooks that rewrite file content:
trailing-whitespace, end-of-file-fixer, and mixed-line-ending. Reporting
hooks are untouched, so a secret or a broken JSON in a vendored tree is
still caught, and the secret scan is unaffected either way since both
trufflehog hooks pass_filenames: false.

Two repos need this. eco-ops tracks ~140 third-party Eco mod source files
under mods/Mods/ against upstream via `just check-drift`, and a whitespace
sweep there is permanent drift that turns each re-sync into a conflict.
eco-ops also has configs/scripts/configs.py writing json.dumps() with no
trailing newline, so end-of-file-fixer and the generator would ping-pong
over the same 20 files forever. eco-app vendors the Eco recipe graph.

Refs coilyco-gaming/eco-ops#91
coilysiren deleted branch feat/vendored-tree-exclude 2026-08-20 08:41:48 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-flight-deck/agentic-os!1159
No description provided.