Repository navigation
fix(shell): skip Windows Terminal's wt in the PowerShell integration - #4786
Merged
Merged
Conversation
The PowerShell wrapper, and the completion step that runs while the integration loads, both took the first `wt` application on PATH. Windows Terminal installs its own `wt.exe` app-execution alias in `%LOCALAPPDATA%\Microsoft\WindowsApps`, which is on PATH and often ahead of worktrunk. A profile that loads the integration from a worktrunk further down PATH still got a wrapper that ran Windows Terminal: every call opened Terminal instead of reaching worktrunk, and the completion step launched it at startup and registered no completer. Both sites now skip a `wt` under a `WindowsApps` directory, the rule that `plugins/worktrunk/hooks/wt.sh` and the pi, omp and OpenCode plugins (#4698) already apply. When no other `wt` is on PATH, the wrapper reports that worktrunk wasn't found and sets `$LASTEXITCODE` to 127, rather than running Windows Terminal or failing on an empty call. The binary is still looked up by name on each call, as in the other shells, rather than baked in from `current_exe()` when the init is generated. A baked path goes stale in every open shell after an upgrade that moves the binary (on Linux, `current_exe()` resolves Homebrew and Nix symlinks to versioned paths) and in any profile that caches the init output. The profile line that `wt config shell install` writes still runs the first `wt` on PATH, so with Windows Terminal first it never reaches worktrunk's init; this change covers an init loaded from worktrunk itself. The new test puts a logging fake `wt` in a `WindowsApps` directory ahead of a fake worktrunk, and checks that the completion step and the wrapper reach worktrunk, and that with only the fake Terminal on PATH the wrapper fails with exit 127. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Nov 14, 2026
1 task
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.
The PowerShell wrapper, and the completion step that runs while the integration loads, both took the first
wtapplication on PATH. Windows Terminal'swt.exealias lives inWindowsApps, often ahead of worktrunk, so a profile that loaded the integration from a worktrunk further down PATH got a wrapper that opened Windows Terminal on every call, and no completer. Both sites now skip awtunderWindowsApps, the ruleplugins/worktrunk/hooks/wt.shand the pi, omp and OpenCode plugins already apply; with no otherwton PATH the wrapper fails with exit 127 instead of running Windows Terminal.Worth weighing: the binary is still looked up by name on each call, as in the other shells, rather than baked in from
current_exe(), which would go stale in open shells after an upgrade moves the binary. The profile linewt config shell installwrites still runs the firstwton PATH, so a standard install with Windows Terminal first never loads the integration; this fixes an init loaded from worktrunk itself, as in the report.kurone-kito reported this in dotfiles#716. Requested by max-sixty. A new test puts a logging fake
wtin aWindowsAppsdirectory ahead of a fake worktrunk and fails on the old template; it passes locally under pwsh on macOS, and its Windows half runs in CI. Loading the real init in pwsh with the fake first on PATH,wt --versionand tab completion reach worktrunk.