Skip to content

Comments

feat: add yamlfmt config to hk builtin config#505

Merged
jdx merged 1 commit intojdx:mainfrom
hituzi-no-sippo:feat/add-yamlfmt-to-builtin
Dec 11, 2025
Merged

feat: add yamlfmt config to hk builtin config#505
jdx merged 1 commit intojdx:mainfrom
hituzi-no-sippo:feat/add-yamlfmt-to-builtin

Conversation

@hituzi-no-sippo
Copy link
Contributor

@hituzi-no-sippo hituzi-no-sippo commented Dec 8, 2025

Add yamlfmt as a new builtin linter/formatter for YAML files.

There is no documentation about pull requests in CONTRIBUTING.md, and this is my first contribution to hk, so I apologize if I'm doing something wrong.


Note

Introduce yamlfmt builtin with check/fix commands and tests; register it in Builtins.pkl.

  • Builtins:
    • Register yamlfmt in pkl/Builtins.pkl.
  • New builtin pkl/builtins/yamlfmt.pkl:
    • YAML formatter step with glob for **/*.yml and **/*.yaml.
    • Commands: check (yamlfmt -lint -quiet), check_diff (-lint), and fix.
    • Metadata: category "Data Formats", description "YAML formatter".
    • Tests covering lint failure/success and auto-fix, with local yamlfmt.yaml to avoid system config.

Written by Cursor Bugbot for commit 3a57adb. This will update automatically on new commits. Configure here.

@jdx
Copy link
Owner

jdx commented Dec 8, 2025

bugbot run

glob = List("**/*.yml", "**/*.yaml")
stage = "<JOB_FILES>"
check = "yamlfmt -lint -quiet {{ files }}"
check_diff = "yamlfmt -lint {{ files }}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: check_diff command may not produce actual diff output

The check_diff command is yamlfmt -lint {{ files }}, which just removes -quiet from the check command. However, all other builtins that define check_diff use an explicit diff flag (like --diff or -d). The check_diff field is documented as "A command that shows the diff of what would be changed" - simply removing -quiet likely produces more verbose error messages rather than an actual unified diff. The command may need yamlfmt's -d flag (dry run with diff output) to match the expected behavior.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yamlfmt outputs diff by default. Therefore, the -d flag or similar is not needed.

Example:

$ cat a.yml
---
a: 1
$ yamlfmt --lint a.yml 
The following formatting differences were found:

a.yml:
- ---   
 a: 1  a: 1
       

$ yamlfmt --lint --quiet a.yml
The following files had formatting differences:

a.yml

@hituzi-no-sippo hituzi-no-sippo marked this pull request as draft December 9, 2025 23:19
@hituzi-no-sippo hituzi-no-sippo force-pushed the feat/add-yamlfmt-to-builtin branch 2 times, most recently from c7912dc to 44422c9 Compare December 10, 2025 09:36
@hituzi-no-sippo hituzi-no-sippo marked this pull request as ready for review December 10, 2025 09:49
yamlfmt = new Config.Step {
glob = List("**/*.yml", "**/*.yaml")
stage = "<JOB_FILES>"
check = "yamlfmt -lint -quiet {{ files }}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't include a check command if there is check_diff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hituzi-no-sippo hituzi-no-sippo force-pushed the feat/add-yamlfmt-to-builtin branch from 44422c9 to 26cf929 Compare December 10, 2025 19:18
@jdx jdx merged commit 27cfc5c into jdx:main Dec 11, 2025
14 checks passed
@hituzi-no-sippo hituzi-no-sippo deleted the feat/add-yamlfmt-to-builtin branch December 11, 2025 02:03
@jdx jdx mentioned this pull request Dec 12, 2025
jdx added a commit that referenced this pull request Dec 12, 2025
## [1.27.0](https://github.com/jdx/hk/compare/v1.26.0..v1.27.0) -
2025-12-12

### 🚀 Features

- **(lychee)** new builtin by [@scop](https://github.com/scop) in
[#510](#510)
- **(tombi)** add tombi config to hk builtin config by
[@hituzi-no-sippo](https://github.com/hituzi-no-sippo) in
[#511](#511)
- Apply the step glob to the test files fallback by
[@thejcannon](https://github.com/thejcannon) in
[#498](#498)
- Support `hk.local.pkl` by [@thejcannon](https://github.com/thejcannon)
in [#504](#504)
- add yamlfmt config to hk builtin config by
[@hituzi-no-sippo](https://github.com/hituzi-no-sippo) in
[#505](#505)
- add `HK_PKL_HTTP_REWRITE` envvar by
[@thejcannon](https://github.com/thejcannon) in
[#512](#512)

### 🐛 Bug Fixes

- **(builtins)** use `stage = "<JOB_FILES>"` for fix_smart_quotes
builtin by [@joonas](https://github.com/joonas) in
[#503](#503)
- add new mise builtin to Builtins.pkl by
[@hisaac](https://github.com/hisaac) in
[#492](#492)
- preserve file permissions in fix-smart-quotes util by
[@joonas](https://github.com/joonas) in
[#506](#506)

### 🚜 Refactor

- Turn on `taplo-format` by [@thejcannon](https://github.com/thejcannon)
in [#501](#501)

### 📚 Documentation

- Generate config docs from the pkl by
[@thejcannon](https://github.com/thejcannon) in
[#499](#499)

### 🧪 Testing

- Move `ruff` to tool stub and fix up tests by
[@thejcannon](https://github.com/thejcannon) in
[#487](#487)
- Do some test gardening by [@thejcannon](https://github.com/thejcannon)
in [#497](#497)
- Clean up `test/pkl_config_errors.bats` by
[@thejcannon](https://github.com/thejcannon) in
[#500](#500)
- add yamllint tests by [@thejcannon](https://github.com/thejcannon) in
[#509](#509)

### 📦️ Dependency Updates

- update swatinem/rust-cache digest to 779680d by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#495](#495)
- update anthropics/claude-code-action digest to 6337623 by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#494](#494)
- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#502](#502)

### New Contributors

- @hituzi-no-sippo made their first contribution in
[#511](#511)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Bumps project to v1.27.0, updates docs/examples and CLI metadata,
refreshes init template and changelog, and updates dependency lockfile.
> 
> - **Release/versioning**
> - Bump version to `1.27.0` in `Cargo.toml`, `hk.usage.kdl`,
`docs/cli/commands.json`, and across docs/examples (`amends`/`import`
URLs).
>   - Add `1.27.0` section to `CHANGELOG.md`.
> - **Docs**
> - Update pkl import references to `v1.27.0` throughout `docs/*` and
`pkl/Config.pkl` docstrings.
> - **CLI/init**
>   - Update `src/cli/init.rs` template to reference `v1.27.0`.
>   - Adjust error hint in `src/config.rs` to new versioned URL.
> - **Dependencies**
> - Refresh `Cargo.lock` with crate updates (e.g., `reqwest`, `git2`,
`libgit2-sys`, `tower-http`, compression libs).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
342dc3f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: mise-en-dev <[email protected]>
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Dec 16, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [hk](https://github.com/jdx/hk) | minor | `1.26.0` -> `1.27.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jdx/hk (hk)</summary>

### [`v1.27.0`](https://github.com/jdx/hk/blob/HEAD/CHANGELOG.md#1270---2025-12-12)

[Compare Source](jdx/hk@v1.26.0...v1.27.0)

##### 🚀 Features

- **(lychee)** new builtin by [@&#8203;scop](https://github.com/scop) in [#&#8203;510](jdx/hk#510)
- **(tombi)** add tombi config to hk builtin config by [@&#8203;hituzi-no-sippo](https://github.com/hituzi-no-sippo) in [#&#8203;511](jdx/hk#511)
- Apply the step glob to the test files fallback by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;498](jdx/hk#498)
- Support `hk.local.pkl` by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;504](jdx/hk#504)
- add yamlfmt config to hk builtin config by [@&#8203;hituzi-no-sippo](https://github.com/hituzi-no-sippo) in [#&#8203;505](jdx/hk#505)
- add `HK_PKL_HTTP_REWRITE` envvar by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;512](jdx/hk#512)

##### 🐛 Bug Fixes

- **(builtins)** use `stage = "<JOB_FILES>"` for fix\_smart\_quotes builtin by [@&#8203;joonas](https://github.com/joonas) in [#&#8203;503](jdx/hk#503)
- add new mise builtin to Builtins.pkl by [@&#8203;hisaac](https://github.com/hisaac) in [#&#8203;492](jdx/hk#492)
- preserve file permissions in fix-smart-quotes util by [@&#8203;joonas](https://github.com/joonas) in [#&#8203;506](jdx/hk#506)

##### 🚜 Refactor

- Turn on `taplo-format` by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;501](jdx/hk#501)

##### 📚 Documentation

- Generate config docs from the pkl by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;499](jdx/hk#499)

##### 🧪 Testing

- Move `ruff` to tool stub and fix up tests by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;487](jdx/hk#487)
- Do some test gardening by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;497](jdx/hk#497)
- Clean up `test/pkl_config_errors.bats` by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;500](jdx/hk#500)
- add yamllint tests by [@&#8203;thejcannon](https://github.com/thejcannon) in [#&#8203;509](jdx/hk#509)

##### 📦️ Dependency Updates

- update swatinem/rust-cache digest to [`779680d`](jdx/hk@779680d) by [@&#8203;renovate\[bot\]](https://github.com/renovate\[bot]) in [#&#8203;495](jdx/hk#495)
- update anthropics/claude-code-action digest to [`6337623`](jdx/hk@6337623) by [@&#8203;renovate\[bot\]](https://github.com/renovate\[bot]) in [#&#8203;494](jdx/hk#494)
- lock file maintenance by [@&#8203;renovate\[bot\]](https://github.com/renovate\[bot]) in [#&#8203;502](jdx/hk#502)

##### New Contributors

- [@&#8203;hituzi-no-sippo](https://github.com/hituzi-no-sippo) made their first contribution in [#&#8203;511](jdx/hk#511)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40OC4wIiwidXBkYXRlZEluVmVyIjoiNDIuNDguMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants