Repository navigation
fix: remove prefix filtering from HookCommandCompleter for shell consistency - #1627
Merged
Merged
Conversation
Bash's programmable completion (-F) does not filter COMPREPLY by prefix — whatever the completion function puts in the array is displayed as-is. The binary was returning all branch candidates for every shell, expecting each shell to apply its own matching. This works for fish (substring) and zsh (fuzzy), but bash users see all branches regardless of what they've typed. Now the binary filters completions by prefix when the requesting shell is bash (COMPLETE=bash), while still returning all candidates for fish/zsh. Closes #1621 Co-Authored-By: Claude <[email protected]>
Adds test_completion_cross_shell_filtering_contract which verifies the same branches with the same typed prefix produce different results per shell: - bash: only prefix matches (binary filters) - fish/zsh: all candidates (shell does its own matching) This captures the tension between #1468 and #1621 in a single test. Also fixes a stale comment in test_complete_base_flag_all_formats. Co-Authored-By: Claude <[email protected]>
…istency HookCommandCompleter was pre-filtering completions by prefix, preventing fish/zsh users from doing substring matching on hook command names. BranchCompleter was already fixed for this (#1471), but HookCommandCompleter was missed. The bash-specific prefix filter in maybe_handle_env_completion() already handles bash correctly. Also inlines complete_hook_commands() (single call site) and fixes stale docstring (wt step → wt hook). Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Mar 19, 2026
max-sixty
added a commit
that referenced
this pull request
Mar 20, 2026
) Single call site — the free function just forwarded the struct's fields as parameters. Inlining removes a level of indirection, matching the pattern established in #1627 for `HookCommandCompleter`. > _This was written by Claude Code on behalf of @max-sixty_ Co-authored-by: Claude <[email protected]>
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.
HookCommandCompleter::complete()was pre-filtering completions by prefix, preventing fish/zsh users from doing substring matching on hook command names.BranchCompleterwas already fixed for this in #1471, butHookCommandCompleterwas missed.The bash-specific prefix filter in
maybe_handle_env_completion()already handles bash correctly — this just removes the redundant (and harmful) filter from the completer itself, matchingBranchCompleter's approach.Also inlines
complete_hook_commands()(single call site) and fixes a stale docstring (wt step→wt hook).