hk.pkl can now assemble steps from a glob of Pkl files with the expression form of import*, and hk's config cache finally notices when glob-matched or transitively imported modules change. Three new builtin capabilities land for Kubernetes manifests, .NET projects, and EditorConfig fixes, plus fixes for typos under custom shells and pre-push crashing on unexpected stdin.
Added
-
Glob imports in hk configuration (#1423, @jdx). The expression form
import*("generated/*.pkl")now evaluates; hk previously rejected it at parse time withunexpected token in expression: KwImportStar, which kept projects that generate step definitions on hk 1.x. The declaration formimport* "generated/*.pkl" as generatedcontinues to work. Support comes from upgrading hk's bundled Pkl evaluator to pklr 3.0.local generated = import*("generated/*.pkl") hooks { ["check"] { steps = new Mapping<String, Step> { for (_, mod in generated) { ...mod.STEPS } } } }
Each matched file exports its own
STEPS: Mapping<String, Config.Step>. See the new "Import many files at once" section in the Pkl introduction docs. -
Builtins.kube_linter(#1394, @zeitlinger). Runskube-linter lint --fail-if-no-objects-foundon plain Kubernetes manifests in conventionalk8s,kubernetes,manifests,deploy, anddeploymentsdirectories, excluding Helmtemplates/,values*.yaml, andkustomization.yaml. It checks deployment policy rather than schemas, so it complementskubeconform; native.kube-linter.yaml/.kube-linter.ymlconfig is discovered automatically. Overrideglobfor other layouts. Helm charts are out of scope and there is no fix command because the tool has none. -
Builtins.dotnet_format(#1393, @zeitlinger). Checks and fixes C# and Visual Basic formatting withdotnet format, passing hk's selected files via--includeand relying on dotnet's project/solution discovery in the working directory. Setdir = "src/app"for a nested project or solution and use separate steps for independent directories. The step is exclusive and both commands declare a write effect because restore can touchobj/. Requires .NET SDK 6+ and trusted project code, as with runningdotnet formatdirectly.steps { ["dotnet-format"] = Builtins.dotnet_format }
-
editorconfig-checkercan now fix (#1397, @lucacome). The builtin gains afixcommand usingeditorconfig-checker --fixwhenversion = "4"(the default); version 3 remains check-only.
Fixed
- Config cache picks up import changes it used to miss (#1422, @jdx). hk keyed its cached module-graph analysis on the root
hk.pklalone, so adding or removing a file matched by animport*glob, or an imported module gaining a new import, was ignored until you editedhk.pklor ranhk cache clear. The analysis now records glob patterns and a digest of every source in the graph and re-validates both before reuse. No settings or config changes are needed; caches from older hk versions are not reused. #1423 also fixes untracked-import detection so a remote module loaded with an expression-formimport(...), with its URI on a following line, or after a comment is no longer mistakenly served from the shared cache. typosno longer reports success on failure under custom shells (#1398, @zeitlinger). With a shell that does not enableerrexit(for exampleshell = "sh -c"), a failingtyposrun such as an unreadable or invalidtypos.tomlcould fall through to the empty-output success path. The builtin now preserves the command's exit status. The default hk shell was already unaffected.pre-pushwarns on malformed stdin instead of panicking (#1352, @connormharris). When hk inherits a non-terminal stdin, for example inside awhile read branchloop, lines that are not<local ref> <local sha> <remote ref> <remote sha>crashed withindex out of bounds. Such lines are now skipped withIgnoring malformed stdin line "...": <reason>, and the two SHA fields must be full 40- or 64-character lowercase hashes.
New Contributors
- @connormharris made their first contribution in #1352
- @zeitlinger made their first contribution in #1398
- @lucacome made their first contribution in #1397
Full Changelog: v2.0.1...v2.1.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.