github jdx/hk v1.41.0
v1.41.0: Per-worktree hooks, XDG config path fix, and Go multi-package fixes

5 hours ago

This release adds support for per-worktree git hook configurations, fixes the global config path to consistently use XDG_CONFIG_HOME across all platforms, and resolves a common issue where Go package-level analysis tools would fail in multi-package projects.

Added

  • Per-worktree hook support: When extensions.worktreeConfig is enabled and a per-worktree core.hooksPath is set, hk install and hk uninstall now respect that worktree-local directory instead of always using the shared hooks directory. This allows different worktrees to have independent hook configurations without conflicting with each other. (@nkakouros) #789

    # Enable per-worktree config in the main repo
    git config extensions.worktreeConfig true
    
    # In each worktree, point hooks to a worktree-local directory
    cd /path/to/worktree
    git config --worktree core.hooksPath "$(git rev-parse --git-dir)/hooks"
    hk install

Fixed

  • Config path now uses XDG_CONFIG_HOME on all platforms: Previously, hk used dirs::config_dir() which resolves to ~/Library/Application Support/ on macOS, meaning the documented path ~/.config/hk/config.pkl would not be found. hk now uses $XDG_CONFIG_HOME (defaulting to ~/.config) on all platforms, consistent with mise and matching what the documentation describes. (@fukuchancat) #801

  • Go package-level builtins work in multi-package projects: Seven Go analysis builtins (go_vet, golangci_lint, go_sec, go_vuln_check, staticcheck, revive, err_check) now use workspace_indicator = "go.mod" and run ./... from the module root instead of passing individual file paths. This fixes the "named files must all be in one directory" error that occurred when staged .go files spanned multiple packages -- a Go toolchain constraint that affects any tool built on go/packages. File-level formatters (go_fmt, go_fumpt, go_imports, go_lines) are unchanged. (@jdx) #803

Breaking Changes

  • macOS config path changed: On macOS, hk now looks for global config at ~/.config/hk/config.pkl instead of ~/Library/Application Support/hk/config.pkl. If you had a config file at the old macOS-specific path, move it to ~/.config/hk/config.pkl (or set HK_CONFIG_DIR to point to your preferred location). This was never documented or intended behavior.

New Contributors

Full Changelog: v1.40.0...v1.41.0

Don't miss a new hk release

NewReleases is sending notifications on new releases.