`wt config show` reports zsh as "Not configured" when init line is in a sourced file
Summary
wt config show reports zsh: Not configured shell extension & completions even though shell integration is correctly set up and working — because the eval "$(wt config shell init zsh)" line lives in a file sourced from ~/.zshrc rather than in ~/.zshrc directly.
Reproduction
# ~/.zshrc
source $HOME/.zsh/config.d/init.zsh
# ~/.zsh/config.d/init.zsh
if command -v wt >/dev/null 2>&1; then eval "$(command wt config shell init zsh)"; fi
$ wt config show
...
zsh: Not configured shell extension & completions
Shell integration works fine in interactive sessions — type wt shows the function, wt switch changes directory correctly. The detection in wt config show is a false negative.
Expected behavior
wt config show either:
- Detects the init line in sourced files (recursive grep / follow
sourcedirectives) - Or shows "configured" when the shell wrapper function is actually loaded in the current session (runtime check)
Context
This pattern is common with dotfile managers (stow, chezmoi, yadm) that split shell config across multiple sourced files rather than putting everything in ~/.zshrc directly. Applies to bash as well (sourcing from ~/.bashrc).
Version
wt v0.28.2, zsh 5.9
Thanks for reporting this! I was able to confirm the root cause in the codebase.
The detection in wt config show scans a hardcoded list of config files — for zsh, only ~/.zshrc (and $ZDOTDIR/.zshrc if set). It never follows source directives to check sourced files.
Code details
The detection happens in two places:
-
scan_for_detection_details— used bywt config showto display shell status. It scans a fixed list of paths (~/.bashrc,~/.bash_profile,~/.profile,~/.zshrc, fish/nushell/PowerShell paths) but never followssource/.directives. -
Shell::is_shell_configured— used by the shell integration warning system to determine "configured but not active" vs "not installed". Same limitation: only checks shell-specific config paths, not sourced files. -
configure_shell_file— used bywt config shell installto check if the init line already exists. Also only checks the target config file.
As noted in the issue, this pattern is common with dotfile managers (stow, chezmoi, yadm) that split shell config across sourced files. The same issue applies to bash (~/.bashrc sourcing other files).
I'll leave it for a maintainer to evaluate the best approach. Two potential strategies mentioned in the issue:
- Follow source directives — parse
source/.lines and recurse into referenced files (more comprehensive but fragile with variable expansion like$HOME) - Runtime check — spawn an interactive shell and check if the wrapper function exists, similar to how
check_zsh_compinit_missingalready works for compinit detection
#2066 silences this warning in a fairly naive way
it's not perfect, but it avoids shelling out, and a quasi-parser/walker for zsh
hope that's reasonable — please reopen with cases that this doesn't fix