Repository navigation
Conversation
Fix detection of shell integration when invoked as `git wt` (with space)
vs `git-wt` (with hyphen). The old detection only looked for the exact
pattern `{cmd} config shell init`, so `git-wt` detection missed lines like:
eval "$(command git wt config shell init bash)"
Now `git-wt` detection matches both `git-wt` and `git wt` patterns, since
git dispatches `git wt` to the `git-wt` binary.
Also adds prefix exclusion for `wt` detection so it doesn't false-positive
on `git wt` lines, and function marker detection for Fish conf.d files.
Fixes #348
Co-Authored-By: Claude <[email protected]>
Run 4 rounds of adversarial testing with subagents to find false positives and false negatives in the detection logic. ## Bugs Fixed - `git-wt` bypassed position checks: `my-git-wt` incorrectly matched - `git wt` space form had no boundary check: `agit wt` incorrectly matched - `_wt_lazy_complete` used simple contains(): `my_wt_lazy_complete` matched - `WORKTRUNK_BIN:-wt}` had no prefix check: `MY_WORKTRUNK_BIN:-wt}` matched ## Documented Acceptable Limitations False negatives (detection only used when wrapper inactive): - POSIX `.` command, zsh `=()`, PowerShell `iex` alias - Path-prefixed binaries, line continuations, heredoc context False positive risks (rare in practice): - PowerShell block comments, subshell execution, uncalled wrapper functions Added 15 new tests covering the fixed bugs and edge cases. Co-Authored-By: Claude <[email protected]>
…ig show Add urlencoding crate to support generating GitHub issue URLs with pre-filled content for shell integration detection false negatives. Introduce `scan_for_detection_details()` function that returns matched integration lines and unmatched candidates (lines containing the command but not detected). Use this in `wt config show` to: - Display matched shell integration lines inline under configured shells - Identify and report potential false negatives with a GitHub issue link - Help users debug shell integration problems Add `format_bash_with_gutter()` styling function for displaying shell code snippets.
- Remove function marker detection (~300 lines) - only eval/source patterns needed - Consolidate file scanning into single scan_file() helper - Add line numbers to shell integration output (file:line format) - Use urlencoding crate instead of hand-rolled encoder Output now shows clickable locations like: ○ Already configured shell extension & completions for zsh @ ~/.zshrc:5 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Covers the code path that shows warnings when shell config contains `wt` but it's not detected as valid integration (potential false negative). 🤖 Generated with [Claude Code](https://claude.com/claude-code) 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.
Summary
git wtvsgit-wtcommand patterns (fixes Unable to change directory on Windows GitBash with chell integration enabled #348)Changes
First commit: Fix
git wtdetection (#348)The old detection searched for
git-wt config shell initbut missedgit wt config shell init(with space). User NikiforovAll hadeval "$(command git wt config shell init bash)"which wasn't detected, causing incorrect "restart shell to activate" messages.Second commit: Adversarial testing
Ran 4 rounds of adversarial testing with 8 subagents to find edge cases:
Bugs fixed:
git-wtbypassed ALL position checks →my-git-wtmatched incorrectlygit wtspace form had no boundary check →agit wtmatched incorrectly_wt_lazy_completeused simplecontains()→my_wt_lazy_completematchedWORKTRUNK_BIN:-wt}had no prefix check →MY_WORKTRUNK_BIN:-wt}matchedDocumented acceptable limitations:
Detection is only used when shell wrapper is NOT active. Once the shell is restarted,
WORKTRUNK_DIRECTIVE_FILEis set and no detection is needed. False negatives only affect:wt config showstatus displaywt config shell uninstall(lines might not be found)Test plan
🤖 Generated with Claude Code