# 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
  entry: hooks/alef_hook.py sync-versions
  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"
