review our update ability for nu shell integration
@worktrunk-bot review the comment and source's discussion
- how do we check whether the nushell integration is current? what would
wt config showhave shown in this case? - why do we put so much in the file we write for nushell? in the other shells we have a very short function which means we can update easily. but maybe for nushell that's harder?
The broken pipe fix (#1081) shipped in v0.26.0, but it lives in the shell wrapper script, not the binary. Updating wt alone won't pick it up — the wrapper installed in your Nushell config needs to be regenerated:
The broken pipe fix (#1081) shipped in v0.26.0, but it lives in the shell wrapper script, not the binary. Updating wt alone won't pick it up — the wrapper installed in your Nushell config needs to be regenerated:
wt config shell install
You can verify the fix is in place by checking whether your wrapper has the list passthrough path (the if ... ($args | first) == "list" branch). The installed wrapper location is typically $nu.default-config-dir/vendor/autoload/wt.nu.
Also a small note: the flag is --format json, not --output json — though if --output were unrecognized, clap would error rather than silently misbehave, so that may just be a typo in the comment.
Originally posted by @worktrunk-bot in https://github.com/max-sixty/worktrunk/issues/1215#issuecomment-3971699064
Good questions. Dug into this — here's what I found.
1. How do we check whether the nushell integration is current?
wt config show would detect the mismatch, but displays it poorly for nushell. The detection works like this:
configure_wrapper_file()compares the installed file's code lines against what the current binary would generate- If they differ and the file exists, it returns
ConfigAction::WouldAdd - For Fish, there's specific handling that shows
"Outdated shell extension"with an update hint - For Nushell, it falls through to the generic
"Not configured"message
So in the user's case, wt config show would have shown "Nushell: Not configured shell extension & completions" — technically correct (the installed wrapper doesn't match), but misleading since it was configured, just outdated. We should extend the Fish outdated-detection branch to also cover Nushell (simple fix — change matches!(shell, Shell::Fish) to matches!(shell, Shell::Fish | Shell::Nushell) on line 808).
2. Why is the nushell wrapper so large?
The core constraint is on line 7 of nushell.nu:
Nushell's
sourceis parse-time only, so we can't source dynamic paths.
This is the fundamental difference from other shells:
| Shell | Install mechanism | Auto-updates on binary upgrade? |
|---|---|---|
| Bash/Zsh | One-liner in rc: eval "$(wt config shell init bash)" |
Yes — regenerated every shell startup |
| Fish | 15-line thin wrapper that calls command wt config shell init fish | source at runtime |
Yes — sources from binary on first use |
| Nushell | Full 113-line script written to vendor/autoload/wt.nu |
No — static file on disk |
In bash/zsh, the rc file evals the binary's output on every startup. In fish, source works at runtime so a thin wrapper can load the full function from the binary. In nushell, source is parse-time only — you can't do ^wt config shell init nu | source because nushell won't evaluate it dynamically.
Beyond that, the nushell wrapper is also inherently more complex because of the pipeline workaround (nushell/nushell#12643): nushell's function output is its return value, not fd1 bytes, so we need separate code paths for list (streaming passthrough) vs everything else (buffered + directive processing).
Could we make it auto-update?
Interestingly, config_line() for nushell already generates a self-updating line:
if (which wt | is-not-empty) { wt config shell init nu | save --force ($nu.default-config-dir | path join vendor/autoload/wt.nu) }
If this went in env.nu (which runs before vendor/autoload/), it would regenerate the wrapper before nushell loads it — giving us the bash/zsh auto-update behavior. But I'm not 100% sure about nushell's load ordering across all setups, and this line isn't actually written during wt config shell install today (it's only used for detection).
Minimal improvements
Two concrete things we could do:
- Show "Outdated" instead of "Not configured" for nushell in
config show— same as Fish (one-line fix) - Add the regeneration line to
env.nuduringwt config shell install, so the wrapper auto-updates on binary upgrades (needs verification of nushell load ordering)