github jdx/hk v1.47.0
v1.47.0: pklr by default, sturdier stash restores

10 hours ago

hk now ships with the built-in pklr evaluator as the default config backend — no pkl CLI required — plus three stash, merge-base, and Windows batching fixes that close out reported regressions, and a handful of builtin improvements from @hituzi-no-sippo.

Added

  • pklr is now the default pkl backend (@jdx) #976. hk.pkl is evaluated with the embedded pklr interpreter out of the box, so the Apple pkl CLI is no longer required to use hk. The CLI backend is still available via HK_PKL_BACKEND=pkl; unrecognized values now warn and fall through to pklr. The config cache also switched from mtime comparisons to hashing file contents, so edits to imported .pkl files reliably invalidate the cache.

    # Default (no setup required)
    hk check
    
    # Opt back into the pkl CLI
    HK_PKL_BACKEND=pkl hk check
  • ryl builtin gains fix and check_list_files (@hituzi-no-sippo) #967. Bumps the underlying ryl to v0.13.0 and wires in the new commands. The yamllint config dependency is dropped.

  • ryl_markdown builtin (@hituzi-no-sippo) #968. Lints YAML embedded inside Markdown documents using ryl's markdown support.

  • hk_test builtin (@hituzi-no-sippo) #973. Runs hk test --quiet whenever your hk configuration file changes so step-defined inline tests catch regressions automatically.

  • hk sponsors command (@jdx) #961. A small no-config subcommand that prints the projects and companies sponsoring hk and the en.dev project family. Works without hk.pkl.

Fixed

  • Last-line edits of partially-staged files no longer get corrupted on restore (@ad1269) #966. The "pure tail insertion" special case in the manual stash restore had a newline-tolerant fallback that stripped the index snapshot's trailing newline before the prefix check, so a last-line edit like l3: taill3: tail UNSTAGED was misclassified as a tail insertion and re-emitted as fixer content + " UNSTAGED\n". The fallback now only accepts an empty remainder (the original case from #304); real last-line edits fall through to the three-way merge, which handles them correctly. The recovery patch written under the state dir also restores the trailing newline that cmd.read() strips, so git apply --check no longer fails with corrupt patch at line N. Fixes #965.

  • hk check works when there is no merge base (@jdx) #975. files_between_refs previously bailed when libgit2 or git couldn't find a common ancestor (e.g. shallow clones or unrelated histories). It now falls back to a shell git merge-base, then to a direct from..to tree/shell diff. Both the libgit2 and shell-git paths use the same range logic, covered by new bats tests with HK_LIBGIT2=1 and HK_LIBGIT2=0. Refs #972.

  • Auto-batching respects the cmd.exe command-line limit (@jdx) #974. auto_batch_jobs now selects a shell-specific safe length: 4095 bytes (half of Windows' ~8191-character cap) for cmd.exe, and ARG_MAX / 2 for everything else. Medium-sized {{files}} expansions that fit under Unix ARG_MAX no longer blow past the cmd limit unbatched. Fixes #971.

  • git2 updated to 0.21 (#956).

  • Remove singular sponsor link from docs footer (@jdx) #962.

Documentation

  • Add a sponsor footer to the docs site (@jdx) #960.

Full Changelog: v1.46.0...v1.47.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.