github jdx/hk v2.6.0
v2.6.0: Typst and jactionlint builtins, more shebang file types

4 hours ago

hk 2.6.0 adds builtins for Typst and jactionlint, detects more script types from their shebang, and ends passing runs with a success line when step output is shown. The agent stop hook no longer blocks in projects that don't use hk.

Added

  • Typst builtins (#1646, @jdx). Builtins.typstyle formats .typ files and Builtins.tinymist lints them. hk init detects both in Typst projects. In fix mode, hk applies the diff that typstyle prints. tinymist needs version 0.14.20 or newer. It checks each file separately, and the step still fails if an earlier file fails even when later files pass.

    hooks {
      ["pre-commit"] {
        fix = true
        steps {
          ["typstyle"] = Builtins.typstyle
          ["tinymist"] = Builtins.tinymist
        }
      }
    }
  • jactionlint builtin (#1663, @jdx). Builtins.jactionlint lints .github/workflows/*.yml and *.yaml with jdx/jactionlint, a maintained fork of actionlint. Its findings appear in hk check --sarif. The actionlint builtin is unchanged.

  • Success line after passing runs that show step output (#1678, @jdx). If every step passes but the end-of-run summary prints step output, such as stderr from a passing test, hk now ends with a line like ✔ check passed. The line isn't printed on failure or cancellation, with --quiet or --silent, in machine-output modes, or when no summary was shown.

  • More file types from shebangs (@jdx). These changes affect extensionless scripts selected with types:

    • Lua scripts are now typed lua, so stylua, selene and luacheck pick them up. Version numbers at the end of interpreter names are ignored, and luajit, pypy and nodejs map to their languages. For example, lua5.4 and luajit become lua, pypy3 becomes python, perl5 becomes perl and php8.2 becomes php (#1676).
    • Scripts with a deno or bun shebang are now typed deno or bun. They don't get a javascript or typescript tag, so a step needs to select them by name, for example types = List("deno", "bun"). node scripts are still typed javascript and node (#1680).

Fixed

  • hk agent stop-hook no longer blocks in projects without hk (#1649, @jdx). Claude Code and Codex Stop hooks set in user-level settings run in every project. In a project with no hk config, the hook used to block the agent's turn and tell it to run hk init. Now, if there's no config or the config has no check hook, the stop hook passes: it prints nothing for Claude Code and {} for Codex. A config that fails to load still blocks with its error.
  • The ryl builtin no longer prints a deprecation warning (#1655, @jdx). The builtin now runs ryl check for its check, diff, list-files and fix commands. ryl 0.20.0 doesn't have the check subcommand, so this needs a newer ryl. It was tested with 0.22.0 and 0.23.0.

Changed

  • Pkl config loading moved to pklr v5 (#1650, @jdx). Some config errors are worded differently. For example, some invalid regex patterns now fail while Pkl evaluates the config, with a message like "Syntax error in regex", instead of with hk's old validation message.
  • Documentation now explains when generated files are staged, how that relates to step output allowlists, and a limitation with HK_STASH_UNTRACKED=false for newly generated files (#1652, @zeitlinger).

Breaking Changes

  • If you use Builtins.ryl, upgrade ryl past 0.20.0 (0.22.0 or newer is verified). Older versions don't have ryl check, so the builtin fails with them.

Full Changelog: v2.5.0...v2.6.0

💚 Sponsor hk

hk is built and maintained by @jdx, an open source developer at entire.io, the title sponsor of his open source work.

If hk speeds up your pre-commit loop or makes linting less painful, please consider becoming an individual or company sponsor. Your support funds ongoing development and helps keep hk fast, free, and independent.

Don't miss a new hk release

NewReleases is sending notifications on new releases.