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
# Pre-commit hooks shipped by alef.
#
# All hooks use `language: script` and dispatch through `hooks/alef_hook.py`,
# which:
# 1. Prefers a pre-installed `alef` binary on PATH whose version matches the
# hook's pinned `alef.toml` version (zero-cost when you've already done
# `cargo install --path .`).
# 2. Falls back to the sha256-verified release tarball download under
# `~/.cache/alef-hooks/{version}/` (ideal for CI without a Rust
# toolchain).
#
# DO NOT override `entry:` on these hooks. `language: script` resolves the
# entry as a path relative to the hook repo, so a consumer-side override like
# `entry: alef verify` makes prek look for a file named `alef` inside the hook
# repo and fail with "No such file or directory".
- id: alef-verify
name: alef verify
language: script
entry: hooks/alef_hook.py verify --exit-code
files: '\.(rs|toml)$'
pass_filenames: false
description: "Check that all alef-generated bindings, stubs, docs, and scaffolding are up to date"
- id: alef-generate
name: alef generate
language: script
entry: hooks/alef_hook.py all
files: '\.(rs|toml)$'
pass_filenames: false
description: "Regenerate all alef output (bindings, stubs, docs, readme, scaffold)"
- id: alef-sync-versions
name: alef sync versions
language: script
# `--no-regen` so the hook only writes version-stamped manifest files; without
# the flag, sync-versions also fires a full `alef generate` pass — desirable
# for `task set-version` but the wrong shape for a per-commit hook (slow, and
# any unrelated regen drift surfaces as "files modified" on every commit).
entry: hooks/alef_hook.py sync-versions --no-regen
files: 'Cargo\.toml$'
pass_filenames: false
description: "Sync version from Cargo.toml to all package manifests (pyproject.toml, package.json, etc.)"
- id: alef-readme
name: alef readme
language: script
entry: hooks/alef_hook.py readme
files: '\.(rs|toml)$'
pass_filenames: false
description: "Regenerate README files for all configured languages"