Repository navigation
feat(builtins): add keep_sorted, cspell and cspell_commit_message builtins - #1898
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> AI-Assisted: Tool: Claude Code; model: unavailable; version: 2.1.330 Entire-Checkpoint: 01M844CV8956JW46Y6KRFN2NN7
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
[Medium impact] The changes since the previous review appear safe to merge. SummaryAdds
Reviews (3) · Last reviewed commit: "fix(builtins): skip only git's chosen ma..." · Reviewed by Greptile |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> AI-Assisted: Tool: Claude Code; model: unavailable; version: 2.1.330 Entire-Checkpoint: 01M844WV6ZG19Z2FXWQ8HS1ZQH
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7c16eea. Configure here.
…_message Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> AI-Assisted: Tool: Claude Code; model: unavailable; version: 2.1.330 Entire-Checkpoint: 01M84526GYBX1K1JAYGPVQR1WE
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> AI-Assisted: Tool: Claude Code; model: unavailable; version: 2.1.330 Entire-Checkpoint: 01M845AH05RD28DB32R0QPG6MP

Adds three builtins requested in #1897, so projects using keep-sorted or cspell no longer have to write these steps by hand:
keep_sortedchecks that lines betweenkeep-sorted startandkeep-sorted endcomments are sorted, and sorts them in fix mode. It runs on every text file, since keep-sorted only touches marked blocks. It also has acheck_diff, sohk fixcan apply its changes as a patch.cspellspell-checks text files. It respects the project's cspell config (words,ignorePaths, and so on). Files are passed with--file, so names with glob characters likenotes[1].mdare checked as literal paths. A batch where every file is inignorePathspasses. cspell has no fixer, so this step is check-only.cspell_commit_messagespell-checks the commit message in acommit-msghook. It ignores git's#comment lines, which would otherwise flag branch and file names. Withgit commit --verbose, it also skips everything below the scissors line. Errors are reported asCOMMIT_EDITMSG:line:colwith the message's own line numbers, and anignorePathsentry like.gitdoesn't skip the message.The tools come from mise as
aqua:google/keep-sorted(not in the mise registry) andcspell(npm:cspell).Validation: 12 new
hk testcases cover check, fix and diff for keep-sorted, and good and bad files, config words,ignorePaths, glob-character filenames and invalid config for cspell. Tool stubs pin keep-sorted 0.11.0 and cspell 10.5.2.test/cspell_commit_message.batscovers a misspelled message, and a message whose comments and verbose diff contain unknown words. All of these pass locally. Intest/builtins_tests.bats, go, ruby, asciidoctor and ktlint builtins failed locally because of toolchain problems on the dev machine, not this change; CI runs them in a clean environment.The discussion also suggests porting more of treefmt-nix's formatters. That's not part of this PR.
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: unavailable.
🤖 Generated with Claude Code
Note
Low Risk
New optional builtins and tests only; no changes to core hook execution, auth, or existing step behavior.
Overview
Adds three Special Purpose builtins so users can drop in
Builtins.keep_sorted,Builtins.cspell, andBuiltins.cspell_commit_messageinstead of hand-writing hook steps.keep_sortedruns on text files withlint/fixand acheck_diffpath viahk util format-diff.cspelllints text with project config support (words,ignorePaths), uses--filefor literal paths, and includes embeddedhk testcases.cspell_commit_messageis commit-msg–only: a shell/awk pipeline strips git comment lines (respectingcore.commentChar/core.commentStringandauto), drops content below the verbose scissors line, then pipes the message tocspell lintasstdin://COMMIT_EDITMSG.Test coverage adds mise tool stubs for cspell 10.5.2 and keep-sorted 0.11.0, plus
test/cspell_commit_message.batsfor misspellings, comment/diff stripping, and comment-marker edge cases.Reviewed by Cursor Bugbot for commit 490aa12. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit