github jdx/hk v1.45.0
v1.45.0: Buildifier built-ins and smarter auto-batching

4 hours ago

A small feature release: Bazel users get first-class buildifier built-ins, and hk's auto-batching is now smart enough to leave steps alone when their commands don't actually reference the file list.

Added

  • buildifier_format and buildifier_lint built-ins (@plx) #896. Two new built-ins for Bazel projects, modeled on buf_format / buf_lint. They cover BUILD, BUILD.bazel, WORKSPACE, WORKSPACE.bazel, MODULE.bazel, *.bzl, *.star, and *.sky files, and ship with the usual project-indicator metadata so they're auto-suggested for Bazel repos.

    import "package://github.com/jdx/hk/releases/download/v1.45.0/hk@1.45.0#/Builtins.pkl"
    
    hooks {
      ["pre-commit"] {
        steps = new {
          ["buildifier-format"] = Builtins.buildifier_format
          ["buildifier-lint"] = Builtins.buildifier_lint
        }
      }
    }

Fixed

  • Auto-batching no longer splits jobs whose command doesn't reference {{files}} (@jdx) #901. Previously, hk decided whether to split a step into multiple ARG_MAX-safe batches purely from the size of the file-list expansion. On Windows — where ARG_MAX falls back to 128KB — a step like:

    local vscodeCommitHint = new Step {
      exclusive = true
      check = "echo If you see this message in a pop-up, the pre-commit steps failed."
    }

    …against a ~20K-file repo would be fanned out into ~29 jobs, printing the message 29 times even though the command never used {{files}}. Auto-batching now happens at execution time with the full tera context available, renders the real run command for each candidate batch, and only splits when the rendered command exceeds the safe limit. Byte estimation is kept as a fallback if rendering fails. The split path also now correctly preserves check_first and workspace_indicator across batches (the old code dropped them with a TODO).

Documentation

New Contributors

  • @plx made their first contribution in #896

Full Changelog: v1.44.3...v1.45.0

💚 Sponsor hk

hk is developed by @jdx at en.dev — a small independent studio behind developer tools like mise, aube, hk, and more. Work on hk is funded by sponsorships.

If hk has sped up your pre-commit loop or made linting feel less painful, please consider sponsoring at en.dev. Sponsorships are what keep hk moving and the project independent.

Don't miss a new hk release

NewReleases is sending notifications on new releases.