github jdx/hk v1.44.0
v1.44.0: Install Globally, Plan Before You Run

5 hours ago

This release is all about understanding and controlling where hk runs. hk check --plan lets you dry-run a hook and see exactly which steps would execute and why, hk install --global registers hk against every repo on your machine using Git 2.54's new config-based hooks, and bare-repo dotfile managers like YADM are now supported via GIT_DIR/GIT_WORK_TREE.

Highlights

  • hk check --plan / --why / --json — dry-run any hook to see which steps would run, which would skip, and why, with JSON output for tooling
  • hk install --global — install hooks once in ~/.gitconfig and have hk apply to every repo (Git 2.54+)
  • Bare-repo dotfile support — hk now respects GIT_DIR and GIT_WORK_TREE, so YADM and similar setups work out of the box
  • New cocogitto_commit_msg builtin for Conventional Commits validation

Added

  • hk check --plan / -P, --why [STEP] / -W, --json / -J: You can now dry-run a hook to see what hk would do without executing any commands. --plan prints the parallel groups, matched file counts, and included/skipped steps with reasons; --why drills into the skip reasons for every step (or a specific one); --json emits the plan as structured JSON for tooling. (@jdx) #848

    $ hk check --plan
    Plan: check
    Run type: check
    
      [parallel group] group_0
        ○ actionlint  (no files matched filters)
        ✓ cargo-fmt  (6 files matched)
        ○ cargo-clippy  (required profile(s) not enabled: slow)
        ✓ cargo-check  (6 files matched)

    The planner reuses hk's real job-building and skip-evaluation logic, so the plan accurately reflects what would happen — including filter matches, profile gating, condition evaluation, dependsOn, and --step/--skip-step selections. It never executes step commands.

  • Git 2.54 config-based hook installation with --global: On Git 2.54+, hk install now writes config-based hooks (hook.hk-<event>.command / .event) instead of shell shims in .git/hooks/. The hooks directory is left untouched, and hk composes cleanly with other hook managers. Use --legacy to force the old shim behavior; older Git falls back automatically. (@jdx) #853

    More importantly, hk install --global writes those entries to your ~/.gitconfig so hk runs in every repository on your machine:

    $ hk install --global

    In repos without an hk.pkl (or without a matching event), the invocation is a silent no-op via a new hidden hk run --from-hook flag — install once, forget, and repos that don't use hk are unaffected. hk uninstall now cleans up both script shims and config entries regardless of current Git version, and hk uninstall --global removes the global entries.

  • GIT_DIR / GIT_WORK_TREE support for bare-repo dotfile managers: hk now honors these environment variables during repository discovery, so it works with YADM and similar bare-repo dotfile setups where there is no .git directory in the work tree. When libgit2 opens a bare repo, hk falls back to shell git for status/diff operations (libgit2 refuses those on bare repos). As a bonus, hk builtins no longer loads project settings, so it runs outside a repo instead of panicking. Fixes #831. (@jdx) #847

  • cocogitto_commit_msg builtin: A new builtin linter that validates commit messages against the Conventional Commits spec using cocogitto's cog verify. Uses the {{commit_msg_file}} template variable, making it a drop-in for the commit-msg hook. (@hituzi-no-sippo) #838

Fixed

  • Text progress in CI: Some CI systems allocate a pseudo-TTY, which made console::user_attended_stderr() report an interactive stderr while the log collector stripped cursor-control escapes and recorded spinner frames as noisy log rows. hk now detects CI environments via is_ci and forces clx progress into text mode, while leaving local interactive behavior unchanged. (@jdx) #845

Changed

  • Bumped communique to 1.0.1 (#850) and updated clx to v2 (#836).

Full Changelog: v1.43.0...v1.44.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.