Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1600 +/- ##
==========================================
+ Coverage 91.67% 91.68% +0.01%
==========================================
Files 93 94 +1
Lines 18333 18366 +33
==========================================
+ Hits 16806 16839 +33
Misses 1527 1527 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (23.7 MiB → 23.7 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
Fix misleading help text that says 'List available hooks' when it actually lists hooks configured in the current project. Add `prek list-builtins` command that lists all built-in hooks bundled with prek, with support for verbose and JSON output formats. Works from any directory without requiring a config file. Closes j178#1599
198d12f to
b5c395e
Compare
prek list help text and add list-builtins commandlist-builtins command
j178
added a commit
that referenced
this pull request
Feb 8, 2026
# Conflicts: # crates/prek/src/cli/mod.rs # crates/prek/tests/run.rs # docs/cli.md
587d37a to
08a2e4c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix misleading
prek listhelp text and addprek list-builtinscommandSummary
prek listsays "List available hooks" but actually lists hooks configured in the current project. This PR fixes the wording and adds a newlist-builtinscommand so users can discover all built-in hooks from the CLI.Motivation
The
listsubcommand's help text reads:This is misleading.
prek listdoes not list hooks that are available to use — it lists hooks that are currently configured in the project's.pre-commit-config.yaml. "Available" implies a catalog of all possible hooks (especially builtins), when the actual behavior is scoped to the current config.How this causes confusion
prek listin Project A, which has a local hook namedno-commit-to-main.:no-commit-to-main— reads like an "available" hookid: no-commit-to-mainunderrepo: builtinin Project Bprek runfails:unknown builtin hook id "no-commit-to-main"The user reasonably assumed
prek listwas showing hooks they could use anywhere, because the help text says "available."After this PR
Verbose mode shows descriptions:
JSON output is also supported via
--output-format=json.What changed
crates/prek/src/cli/mod.rsListdoc comment from "List available hooks" to "List hooks configured in the current project"ListBuiltins(ListBuiltinsArgs)command variant with--output-formatoptioncrates/prek/src/cli/list_builtins.rs(new)BuiltinHooksvariants viastrum::EnumIterand outputs their ID, name, and descriptioncrates/prek/src/hooks/builtin_hooks/mod.rsstrum::EnumIterderive toBuiltinHooksenumcrates/prek/src/main.rsCommand::ListBuiltinsdispatchcrates/prek/tests/list_builtins.rs(new)list_builtins_basic: verifies plain text output lists all 16 builtin hook IDslist_builtins_verbose: verifies verbose output includes descriptionslist_builtins_json: verifies JSON output structuredocs/cli.mdlist-builtinscommandCloses #1599