Skip to content

v1.50.0: Staged pre-commit, everywhere

Latest

Choose a tag to compare

@github-actions github-actions released this 06 Jul 21:29
Immutable release. Only release title and notes can be modified.
e9cc098

A cluster of pre-commit correctness fixes so hk run pre-commit (and installed hooks) really only see staged files, plus a textlint builtin, a content-addressed config cache, and a docs accuracy pass.

Added

  • textlint builtin (@smasato) #1036. Adds textlint as a batched natural-language linter for Markdown and plain text. check runs textlint {{ files }}, fix runs textlint --fix {{ files }}, and it auto-suggests when .textlintrc* or a "textlint" entry in package.json is present.

    ["textlint"] = Builtins.textlint

Fixed

  • Pre-commit is staged-only, even without stashing (@jdx) #1023. The default file selection for pre-commit steps now stays scoped to staged paths when stash = false, matching the "only what you're committing" expectation instead of also picking up unstaged and untracked matches.

  • Installed global pre-commit hooks pass --staged (@jdx) #1043. hk install --global now generates pre-commit hook commands as hk run pre-commit --from-hook --staged, so an env override like HK_STASH=git can't defeat a repo-level stash = "none" policy. Local config hooks and legacy .git/hooks/ shims are unchanged. Fixes discussion #1030.

  • Git string settings actually apply (@jdx) #1042. String, enum, and path settings from git config are now read via Config::get_string, which works on the live config that Repository::config() returns. Previously libgit2 rejected the borrow-returning read, so values like hk.stash silently fell back to defaults even though hk config explain listed git as their source. Fixes discussion #1031.

  • Rename-only commits no longer bypass pre-commit (@smasato) #1035. Under the default libgit2 backend, git mv commits were reporting "Fetching staged files (0 files)" and skipping every step, because git2's StatusEntry::path() returns the old path for renamed entries — which no longer exists in the worktree and got filtered out. hk now resolves the new path from the head-to-index delta for INDEX_RENAMED entries. The shell-git porcelain parser is also fixed to consume the trailing original-path field on R/C records instead of misparsing it as another status entry. Regressed since rename detection was enabled in #347.

  • check_first prefers check_list_files over check (@risu729) #1038. Restores the pre-#547 ordering for the fix-mode prepass: check_diff -> check_list_files -> check. For steps that define both check and check_list_files, the prepass can now narrow the subsequent fix to just the files that need writes, taking fewer write locks and keeping <JOB_FILES> scoped to files that were actually processed. Normal hk check still prefers check first — this only changes the fix-mode check_first path. Empty platform-specific scripts are also skipped when choosing the check-first command.

Performance

  • Resolved config cache shared by content (@jdx) #1044. When a hk.pkl (and all of its imports) resolves purely from local files, the resolved-config cache now keys off content instead of the absolute config path, so byte-identical configs in different directories share one cache entry. Configs that pull in remote http or package imports keep the previous path-keyed behavior since hk can't hash those.

Changed

  • tera bumped to v2 (#1028).

Documentation

  • Docs accuracy pass (@jdx) #1022. Audits the docs against src/env.rs, settings.toml, and pkl/Config.pkl and fixes the drift. Notably: HK_STASH default is documented as none (not git), patch-file is described as an alias of git, environment_variables.md is reorganized alphabetically with previously undocumented vars added (HK_CACHE, HK_CHECK, HK_CONFIG_DIR, HK_JSON, HK_PKL_BACKEND, HK_PKL_CA_CERTIFICATES, HK_PKL_HTTP_REWRITE, HK_STASH_BACKUP_COUNT, HK_TERMINAL_PROGRESS, HK_TRACE, HK_WALK_IGNORE, HK_WARNINGS, and the env aliases from settings.toml), pkl_introduction.md examples use the real Step class with valid pkl syntax, logging.md uses --plan (not the nonexistent --dry-run) and the correct info default level, and builtin counts move to 140+.

  • New vector logo (@jdx) #1041. Replaces the raster hook illustration with a stroke-based "hk" wordmark whose descender curls into a fishing hook, plus a bare hook glyph for the navbar and favicons. Scales cleanly down to 16px and to monochrome.

Full Changelog: v1.49.0...v1.50.0

💚 Sponsor hk

hk is maintained by @jdx, an open source developer for entire.io, the title sponsor of the jdx.dev open source tools including mise, aube, 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 jdx.dev. Sponsorships are what keep hk moving and the project independent.