This release adds four new builtin linter/formatter configurations, introduces corporate proxy support for Pkl config loading, and fixes several important correctness issues -- most notably binary file corruption during the stash/unstash cycle and broken hooks in git worktrees.
Highlights
- Binary file preservation in stash: Binary files (images, compiled assets, etc.) were silently corrupted to 0 bytes when hk stashed and unstashed changes during pre-commit hooks with partial staging. This is now fixed with binary-safe blob handling.
- Git worktree support: The
commit-msgandprepare-commit-msghooks now resolve file paths correctly in git worktrees, where.gitis a file pointing to the main repo rather than a directory. - Four new builtins:
just_format,knip,knip_strict, andcontextlintjoin the growing library of built-in linter configurations. - Corporate proxy support: The new
HK_PKL_CA_CERTIFICATESenv var lets hk work behind SSL-intercepting proxies without manual workarounds.
Added
-
just_formatbuiltin: Format Justfiles usingjust --fmt. Matches**/justfileand**/*.justglobs. (@matdibu) #729 -
knipandknip_strictbuiltins: Find unused files, dependencies, and exports in JavaScript/TypeScript projects using Knip. Theknip_strictvariant enables--strict(implies--production) for stricter analysis. (@hituzi-no-sippo) #713 -
contextlintbuiltin: Rule-based linting for structured Markdown documents using contextlint. Automatically detected viacontextlint.config.json. (@hituzi-no-sippo) #747 -
HK_PKL_CA_CERTIFICATESenv var: Pass a custom CA certificates file to Pkl via--ca-certificates, enabling hk to work in corporate environments with SSL-intercepting proxies. (@jdx) #760export HK_PKL_CA_CERTIFICATES=/path/to/ca-bundle.pem
Fixed
-
Binary files preserved during stash/unstash: Binary files (PNG, JPG, etc.) were silently corrupted to 0 bytes during the stash/unstash cycle when committing with partial staged changes. The root cause was that
git_read_raw()converted blob output to a UTF-8 string, which fails silently for binary content. Binary files are now detected and restored directly from raw bytes, bypassing the text merge path. (@jdx) #759 -
Commit message hooks work in git worktrees: In git worktrees,
.gitis a file (not a directory), so the.git/COMMIT_EDITMSGpath passed by git tocommit-msgandprepare-commit-msghooks would fail with "Not a directory". hk now resolves these paths through the actual git directory. (@jdx) #761 -
Batch splitting honored in workspace jobs: When both
workspace_indicatorandbatch = truewere set, the batch splitting logic was bypassed entirely, producing one large job per workspace. Files are now properly chunked into parallel jobs within each workspace. (@jdx) #757 -
trailing-whitespace --fixhandles CRLF correctly: The fix and check modes usedBufReader::lines()which silently strips\rfrom CRLF line endings, making carriage returns invisible to detection. This is now consistent with--diffmode, which already handled CRLF correctly. (@jdx) #758 -
Regex patterns no longer break config cache:
Regex()file patterns caused "failed to parse cache file" warnings on subsequent runs because the serde discriminator field was skipped during serialization. (@jdx) #740 -
nixfmtgracefully skips on Windows: Since nixfmt doesn't support Windows, the builtin now cleanly no-ops on that platform instead of failing. (@azais-corentin) #741
New Contributors
- @azais-corentin made their first contribution in #741
Full Changelog: v1.38.0...v1.39.0