Skip to content
This repository was archived by the owner on Jul 2, 2026. It is now read-only.

Commit 6a965fa

Browse files
committed
feat: consolidate shared hook wrappers
1 parent 3f8463e commit 6a965fa

12 files changed

Lines changed: 575 additions & 90 deletions

File tree

.pre-commit-config.yaml

Lines changed: 59 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,62 @@
11
default_install_hook_types:
2-
- pre-commit
3-
- commit-msg
2+
- pre-commit
3+
- commit-msg
44
default_stages:
5-
- pre-commit
5+
- pre-commit
66
repos:
7-
- repo: https://github.com/Goldziher/gitfluff
8-
rev: v0.8.0
9-
hooks:
10-
- id: gitfluff-lint
11-
args:
12-
- --write
13-
stages:
14-
- commit-msg
15-
- repo: https://github.com/Goldziher/ai-rulez
16-
rev: v4.2.1
17-
hooks:
18-
- id: ai-rulez-generate
19-
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v6.0.0
21-
hooks:
22-
- id: trailing-whitespace
23-
- id: end-of-file-fixer
24-
- id: check-merge-conflict
25-
- id: check-added-large-files
26-
- id: detect-private-key
27-
- id: check-json
28-
- id: check-yaml
29-
args:
30-
- --allow-multiple-documents
31-
- --unsafe
32-
exclude: ^hooks/helm-lint/tests/.*\.ya?ml$
33-
- id: check-toml
34-
- id: check-case-conflict
35-
- repo: https://github.com/tox-dev/pyproject-fmt
36-
rev: v2.21.2
37-
hooks:
38-
- id: pyproject-fmt
39-
- repo: https://github.com/astral-sh/ruff-pre-commit
40-
rev: v0.15.13
41-
hooks:
42-
- id: ruff
43-
args:
44-
- --fix
45-
- id: ruff-format
46-
- repo: https://github.com/crate-ci/typos
47-
rev: v1.46.2
48-
hooks:
49-
- id: typos
50-
args:
51-
- --force-exclude
52-
- repo: https://github.com/rhysd/actionlint
53-
rev: v1.7.12
54-
hooks:
55-
- id: actionlint
56-
- repo: https://github.com/Goldziher/gh-actions-updater
57-
rev: v0.1.3
58-
hooks:
59-
- id: gh-actions-updater
60-
- repo: local
61-
hooks:
62-
- id: shfmt-local
63-
name: shfmt (local)
64-
entry: bash hooks/shfmt/run.sh -w -i 2
65-
language: system
66-
types:
67-
- shell
68-
exclude: ^hooks/.*/tests/bad\.
69-
- repo: https://github.com/kreuzberg-dev/pre-commit-hooks
70-
rev: v1.1.16
71-
hooks:
72-
- id: oxfmt
73-
exclude: ^hooks/oxfmt/tests/bad\.ts$
74-
- id: mypy
75-
args:
76-
- --strict
77-
- lib
78-
- tests
79-
- scripts
80-
pass_filenames: false
81-
- id: shellcheck
82-
exclude: ^hooks/.*/tests/bad\.
83-
- id: rumdl-fmt
7+
- repo: https://github.com/Goldziher/gitfluff
8+
rev: v0.8.0
9+
hooks:
10+
- id: gitfluff-lint
11+
args:
12+
- --write
13+
stages:
14+
- commit-msg
15+
- repo: https://github.com/kreuzberg-dev/pre-commit-hooks
16+
rev: v1.2.0
17+
hooks:
18+
- id: ai-rulez-generate
19+
- id: trailing-whitespace
20+
- id: end-of-file-fixer
21+
- id: check-merge-conflict
22+
- id: check-added-large-files
23+
- id: detect-private-key
24+
- id: check-json
25+
- id: check-yaml
26+
args:
27+
- --allow-multiple-documents
28+
- --unsafe
29+
exclude: ^hooks/helm-lint/tests/.*\.ya?ml$
30+
- id: check-toml
31+
- id: check-case-conflict
32+
- id: pyproject-fmt
33+
- id: ruff
34+
args:
35+
- --fix
36+
- id: ruff-format
37+
- id: typos
38+
args:
39+
- --force-exclude
40+
- id: actionlint
41+
- id: gh-actions-updater
42+
- id: oxfmt
43+
exclude: ^hooks/oxfmt/tests/bad\.ts$
44+
- id: mypy
45+
args:
46+
- --strict
47+
- lib
48+
- tests
49+
- scripts
50+
pass_filenames: false
51+
- id: shellcheck
52+
exclude: ^hooks/.*/tests/bad\.
53+
- id: rumdl-fmt
54+
- repo: local
55+
hooks:
56+
- id: shfmt-local
57+
name: shfmt (local)
58+
entry: bash hooks/shfmt/run.sh -w -i 2
59+
language: system
60+
types:
61+
- shell
62+
exclude: ^hooks/.*/tests/bad\.

.pre-commit-hooks.yaml

Lines changed: 178 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,181 @@
1818
types: [shell]
1919
args: ["-x"]
2020

21+
- id: trailing-whitespace
22+
name: trailing-whitespace
23+
description: Trim trailing whitespace and stage fixed files.
24+
entry: python -m kreuzberg_hooks._autofix -- trailing-whitespace-fixer
25+
language: python
26+
types: [text]
27+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
28+
29+
- id: end-of-file-fixer
30+
name: end-of-file-fixer
31+
description: Ensure files end with one newline and stage fixed files.
32+
entry: python -m kreuzberg_hooks._autofix -- end-of-file-fixer
33+
language: python
34+
types: [text]
35+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
36+
37+
- id: check-merge-conflict
38+
name: check-merge-conflict
39+
description: Check for merge conflict markers.
40+
entry: check-merge-conflict
41+
language: python
42+
types: [text]
43+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
44+
45+
- id: check-added-large-files
46+
name: check-added-large-files
47+
description: Prevent accidentally committing large files.
48+
entry: check-added-large-files
49+
language: python
50+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
51+
52+
- id: detect-private-key
53+
name: detect-private-key
54+
description: Detect private keys before commit.
55+
entry: detect-private-key
56+
language: python
57+
types: [text]
58+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
59+
60+
- id: check-json
61+
name: check-json
62+
description: Validate JSON syntax.
63+
entry: check-json
64+
language: python
65+
types: [json]
66+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
67+
68+
- id: check-yaml
69+
name: check-yaml
70+
description: Validate YAML syntax.
71+
entry: check-yaml
72+
language: python
73+
types: [yaml]
74+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
75+
76+
- id: check-toml
77+
name: check-toml
78+
description: Validate TOML syntax.
79+
entry: check-toml
80+
language: python
81+
types: [toml]
82+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
83+
84+
- id: check-case-conflict
85+
name: check-case-conflict
86+
description: Check for files that conflict on case-insensitive filesystems.
87+
entry: check-case-conflict
88+
language: python
89+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
90+
91+
- id: check-executables-have-shebangs
92+
name: check-executables-have-shebangs
93+
description: Check executable files have shebangs.
94+
entry: check-executables-have-shebangs
95+
language: python
96+
types: [text, executable]
97+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
98+
99+
- id: check-shebang-scripts-are-executable
100+
name: check-shebang-scripts-are-executable
101+
description: Check shebang scripts are executable.
102+
entry: check-shebang-scripts-are-executable
103+
language: python
104+
types: [text]
105+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
106+
107+
- id: mixed-line-ending
108+
name: mixed-line-ending
109+
description: Normalize mixed line endings and stage fixed files.
110+
entry: python -m kreuzberg_hooks._autofix -- mixed-line-ending
111+
language: python
112+
types: [text]
113+
args: ["--fix=lf"]
114+
additional_dependencies: ["pre-commit-hooks==6.0.0"]
115+
116+
- id: pyproject-fmt
117+
name: pyproject-fmt
118+
description: Format pyproject.toml and stage fixed files.
119+
entry: python -m kreuzberg_hooks._autofix -- pyproject-fmt
120+
language: python
121+
files: (^|/)pyproject\.toml$
122+
additional_dependencies: ["pyproject-fmt==2.21.2"]
123+
124+
- id: ruff
125+
name: ruff
126+
description: Lint and autofix Python files with Ruff, staging fixed files.
127+
entry: python -m kreuzberg_hooks._autofix -- ruff check --fix
128+
language: python
129+
types_or: [python, pyi]
130+
additional_dependencies: ["ruff==0.15.14"]
131+
132+
- id: ruff-format
133+
name: ruff-format
134+
description: Format Python files with Ruff, staging fixed files.
135+
entry: python -m kreuzberg_hooks._autofix -- ruff format
136+
language: python
137+
types_or: [python, pyi]
138+
additional_dependencies: ["ruff==0.15.14"]
139+
140+
- id: actionlint
141+
name: actionlint
142+
description: Lint GitHub Actions workflow files.
143+
entry: hooks/actionlint/run.sh
144+
language: script
145+
files: ^\.github/workflows/.*\.ya?ml$
146+
147+
- id: gh-actions-updater
148+
name: gh-actions-updater
149+
description: Update GitHub Actions versions and stage changed workflows.
150+
entry: python -m kreuzberg_hooks._autofix --stage-all -- gh-actions-updater --update .
151+
language: python
152+
pass_filenames: false
153+
files: ^\.github/workflows/.*\.ya?ml$
154+
additional_dependencies: ["gh-actions-updater==0.1.5"]
155+
156+
- id: typos
157+
name: typos
158+
description: Fix source typos and stage changed files.
159+
entry: hooks/typos/run.sh
160+
language: script
161+
types: [text]
162+
args: ["--force-exclude"]
163+
164+
- id: ai-rulez-generate
165+
name: ai-rulez generate
166+
description: Regenerate AI governance files and stage changed outputs.
167+
entry: hooks/ai-rulez/run.sh generate
168+
language: script
169+
pass_filenames: false
170+
always_run: true
171+
172+
- id: ai-rulez-validate
173+
name: ai-rulez validate
174+
description: Validate AI governance files.
175+
entry: hooks/ai-rulez/run.sh validate
176+
language: script
177+
pass_filenames: false
178+
always_run: true
179+
180+
- id: alef-verify
181+
name: alef verify
182+
description: Verify Alef-generated files are fresh.
183+
entry: hooks/alef/run.sh verify
184+
language: script
185+
pass_filenames: false
186+
files: alef\.toml$
187+
188+
- id: alef-sync-versions
189+
name: alef sync-versions
190+
description: Sync Alef binding versions and stage changed files.
191+
entry: hooks/alef/run.sh sync-versions
192+
language: script
193+
pass_filenames: false
194+
files: alef\.toml$
195+
21196
- id: cargo-fmt
22197
name: cargo fmt
23198
description: Format Rust workspaces using the consumer repo's Rust toolchain.
@@ -429,7 +604,7 @@
429604
- id: clang-format
430605
name: clang-format (C/C++ formatter)
431606
description: Format C/C++ source files using clang-format from a pinned PyPI wrapper.
432-
entry: clang-format
607+
entry: python -m kreuzberg_hooks._autofix -- clang-format
433608
language: python
434609
types_or: [c, c++]
435610
args: ["-i"]
@@ -457,7 +632,7 @@
457632
- id: rumdl-fmt
458633
name: rumdl fmt (Markdown formatter)
459634
description: Format Markdown files in place with rumdl.
460-
entry: rumdl fmt
635+
entry: python -m kreuzberg_hooks._autofix -- rumdl fmt
461636
language: python
462637
types: [markdown]
463638
require_serial: true
@@ -598,7 +773,7 @@
598773
# textlint v15 requires either a .textlintrc or explicit --rule flags. We pass
599774
# --rule for each package in additional_dependencies so consumers don't need a
600775
# local .textlintrc just to use this hook.
601-
entry: textlint
776+
entry: python -m kreuzberg_hooks._autofix -- textlint
602777
language: node
603778
types: [markdown]
604779
files: ^docs/.*\.md$

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.0] - 2026-05-26
11+
12+
### Added
13+
14+
- Shared wrappers for duplicated polyrepo hooks: pre-commit core checks,
15+
Ruff, pyproject-fmt, actionlint, gh-actions-updater, typos, ai-rulez, and
16+
Alef maintenance hooks. Consumer repos can now source these from
17+
`kreuzberg-dev/pre-commit-hooks` instead of repeating third-party repo
18+
blocks in every `.pre-commit-config.yaml`.
19+
20+
### Changed
21+
22+
- Autofixing and update hooks now use a shared runner that stages changed files
23+
and only leaves a non-zero exit for remaining non-autofixable errors. This
24+
covers new shared wrappers and manifest-backed formatters such as
25+
`clang-format`, `rumdl-fmt`, and `textlint`.
26+
1027
## [1.1.20] - 2026-05-26
1128

1229
### Fixed

0 commit comments

Comments
 (0)