Skip to content

feature request: use builtin toolchains without upstream .pre-commit-hooks.yaml #1213

@jmelahman

Description

@jmelahman

I would like a way to automate the hook bootstrapping without needing to upstream a .pre-commit-hooks.yaml. Most maintainers rightful don't want a .pre-commit-hooks.yaml in their repo just to define the entry-point for a tool they're unfamiliar with. Conversely, I don't want to hassle with installation or compatibility issues while managing locally installed tools.

Effectively the equivalent of,

repos:
  - repo: local
    hooks:
      - id: go-build-and-run
        language: system
        entry: bash -c 'set -euo pipefail; go build github.com/me/my-app@v1.0.0 -o /tmp/my-app && /tmp/my-app'

But using the builtin go toolchain + pin a revision to ensure compatibility across users.
Something along the lines of,

repos:
  - repo: github.com/me/my-app
    rev: v1.0.0
    hooks:
      - id: go-build-and-run
        name: My app
        language: golang
        entry: my-app

Also, I think this would improve existing pre-commit providers. Cases like uv-pre-commit where the tool version is frozen in the repository. This allows those tools to be kept fresh with prek auto-update (rather than keeping the hook implementation fresh and maybe implicitly the tool). These provider repos (like uv-pre-commit) may even become mostly obsolete?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaJust an idea

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions