Replies: 2 comments 3 replies
|
I maintain a shared Pkl preset (risu729/hk-config) that wraps the builtins catalog for my repos, and migrated it against the branch schemas to see how the changes hold up in practice: risu729/hk-config#83. Overall the direction is great — the implicit Bug: top-level
|
|
I think top level steps can introduce some confusion if its not clearly conveyed what hooks they create. Builtins having options instead of duplicating them for specific flows is a welcomed change. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
hk v2 will include a coordinated set of breaking changes. I’d really appreciate feedback on the direction, especially on anything that feels surprising, unclear, or unnecessarily difficult to migrate.
I don't do big breaking changes like this in CLIs very often at all, but early design decisions have come home to roost, and I think one big break—this likely would be the only big change to the design ever—is necessary. The goal is to address those design issues together so hk has a cleaner, more consistent foundation going forward, rather than asking users to work through a series of smaller breaking changes over time.
Major changes at a glance
Define shared steps once
In v1, the same steps often had to be repeated across hooks:
In v2, top-level steps automatically create the usual
check,fix, andpre-commitbehavior:You can still define explicit hooks when you need to override those defaults, and
enabled = falsedisables an implicit hook.Configure builtins through stable factories
Default builtin references stay the same:
Special-purpose builtin names become options on the main builtin. For example:
Generic step customization moves under
step, leaving room for builtin-specific options:Stage fixes only when intended
In v2,
pre-commitcontinues to fix and stage changes by default. Manualhk fixand other hooks leave changes unstaged unless requested:A step-level
stagepattern now filters which paths are staged; it no longer turns staging on by itself.Use the canonical config and command names
hk.toml,hk.yaml,hk.yml, orhk.jsonhk.pkl.hkrc.pklhk.local.pkl~/.hkrc.pkl~/.config/hk/config.pkl--hkrc <PATH>UserConfig.pklConfig.pklenvironment { ... }env { ... }hk generatehk initHK_PKL_BACKENDRemoved v1 entry points will produce targeted migration errors rather than failing without context.
Implementation
The implementation is split across a few stacked PRs, which are intended to merge in this order:
feat(builtins)!: expose configurable builtin factoriesfeat(config)!: add shared top-level stepsfeat(hook)!: make staging contextualrefactor(config)!: remove deprecated v1 interfacesrefactor(config)!: remove pkl CLI fallbackhk install --legacywill remain supported because it controls Git-hook installation compatibility, not v1 configuration compatibility.If you use hk today, please share your thoughts below. Feedback on the proposed syntax, migration pain points, error messages, or anything else that would make this transition friendlier would be especially helpful.
Release sequencing
For maintainers: all breaking PRs should merge in order before the release-plz v2 release PR. Feature branches will not set
2.0.0; release-plz will derive the major release from the Conventional Commit!titles.AI-assisted — Tool: Codex; model: unavailable/unavailable; version: unavailable.
All reactions