lychee icon indicating copy to clipboard operation
lychee copied to clipboard

pre-commit doesn't maintain a version

Open max-sixty opened this issue 1 month ago • 0 comments

it seems like the pre-commit hook uses whichever version is installed, rather than locking the version to the pre-commit version, is that correct?

here's a full description, written with the help of Claude Code

thank you!


Pre-commit hook doesn't pin lychee version

Problem

The pre-commit hook uses language: script, so the rev field only pins the hook script—not the lychee binary version.

# .pre-commit-hooks.yaml
- id: lychee
  entry: scripts/lychee_pre_commit.sh
  language: script  # <-- uses system lychee or downloads latest

With rev: lychee-v0.18.0, users expect lychee 0.18.0, but actually get whatever's installed locally or the latest download.

Reproduction

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/lycheeverse/lychee
    rev: lychee-v0.18.0
    hooks:
      - id: lychee
$ lychee --version
lychee 0.22.0  # system version, not 0.18.0
$ pre-commit run lychee --all-files
# runs 0.22.0, not 0.18.0

Suggestion

Use language: rust with the crate version matching the tag:

- id: lychee
  entry: lychee
  language: rust
  additional_dependencies: []  # version derived from rev tag

This would install the correct version via cargo, matching user expectations.

Workaround

Users can define a local hook with pinned version:

- repo: local
  hooks:
    - id: lychee
      name: lychee
      language: rust
      entry: lychee
      types: [markdown]
      additional_dependencies: ["cli:lychee:0.22.0"]

max-sixty avatar Dec 05 '25 23:12 max-sixty