You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(config): support multi-word entries in exclude_commands
Extends exclude_commands matching from first-word-only equality to
whitespace-aware token matching. Entries containing whitespace match
the command's first N tokens (where N is the entry's token count),
enabling subcommand-level exclusion without blocking the parent command.
Example config:
[hooks]
exclude_commands = ["curl", "git diff", "kubectl describe"]
- "curl" behaves exactly as before (excludes all curl invocations)
- "git diff" excludes `git diff` with any args, but NOT `git status`
- Word boundaries use whitespace, so "git diff" never matches
`git difference` or `git diffoo`
- Whitespace in both entry and command is normalized (handled by
split_whitespace on both sides)
Rationale: first-word-only matching forces all-or-nothing exclusion,
making it impossible to exclude diff/patch-producing subcommands
(`git diff`, `git show -p`) while keeping `git status` / `git log`
filtered. Silent output corruption on these subcommands is particularly
harmful for LLM agents that read diffs to make edits, since stripped
context lines can lead to wrong interpretation of file state.
Backward compatible: existing single-word entries unchanged. All
existing tests pass. New tests cover multi-word exclusion, partial
word safety, whitespace normalization, and mixed entry coexistence.
Refs: #1282, #1313
0 commit comments