worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

`wt config show` flags any line in `~.zshrc` containing `alias`, then `/`, then `wt`

Open nicolasff opened this issue 8 months ago • 3 comments

Hello,

wt config show seems to find any line in ~/.zshrc starting with alias and containing a / followed by the letters wt and flags them as related to worktrunk's config.

If you have an alias like this in ~/.zshrc:

alias gravity=/path/to/newton.bin
# 1^         2^         3^^
  1. starts with alias
  2. contains a /
  3. contains wt after the /

then running wt config show prints a warning and suggests a change:

▲ Alias gravity bypasses shell integration — won't auto-cd
  alias gravity=/path/to/newton.bin
↳ Change to alias gravity="wt" @ ~/.zshrc:153

The line is not relevant, and the suggestion is incorrect.

All 3 conditions are required, i.e. alias weld=blowtorch start does not get flagged, but alias weld=/blowtorch start does.

This happens with wt version 0.33.0, the latest release at this time.

nicolasff avatar Mar 27 '26 19:03 nicolasff

Thanks for reporting this! I was able to reproduce the issue and identified the root cause: detect_bypass_alias() used a substring match (target.contains("wt")) on the full alias target path, so any path containing "wt" as part of another word (like "newton") triggered a false positive.

I've opened #1773 with a fix that extracts the filename component from the path and matches it exactly instead. A maintainer will review it shortly.

worktrunk-bot avatar Mar 27 '26 19:03 worktrunk-bot

thanks @nicolasff !

max-sixty avatar Mar 27 '26 19:03 max-sixty

Thanks for the quick fix @max-sixty!

nicolasff avatar Mar 30 '26 04:03 nicolasff