You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Vladislav Forsh, Hugo Baraúna, Wlad Paiva, ziv-nagish, Matt Perpick, Tom Roshko, Colton Padden, Kieran Pilkington, Adrian, Irving A. Bermúdez S. and 2 more
Hmm, not quite the same. Shell command aliases requires engineers to edit their own .zshrc. While having built in alias support in worktrunk means the worktrunk config in the git repo can apply to everyone when they are in the project. Would prefer native and top level support for aliases within a project rather than asking engineers to go make changes to their global shell.
Drop this into either user config (~/.config/worktrunk/config.toml, trusted, applies everywhere) or project config (.config/wt.toml, shared with teammates, approval prompt on first run):
Then wt ls, wt rm, wt sw all work. See Aliases for docs.
One caveat: aliases don't forward bare positional arguments — wt rm my-branch errors with Unexpected argument 'my-branch'. Flags-as-vars work, so you can do wt rm --branch=my-branch if you template it as rm = "wt remove {{ branch }}", but there's no way today to make wt rm my-branch route through. For those cases stick with the full command name.
One caveat: aliases don't forward bare positional arguments — wt rm my-branch errors with Unexpected argument 'my-branch'. Flags-as-vars work, so you can do wt rm --branch=my-branch if you template it as rm = "wt remove {{ branch }}", but there's no way today to make wt rm my-branch route through. For those cases stick with the full command name.
erm, OK, sorry. I will think about this before declaring victory. Need to consider how to have wt CLI options work; possibly will force them to be before the alias
Confirmed — 0.40 closes that gap. Smart routing (#2304) sends --KEY=VALUE tokens to matching {{ KEY }} vars and forwards everything else — including bare positionals — as {{ args }}. The shorthand config now looks like:
[aliases]
ls = "wt list {{ args }}"rm = "wt remove {{ args }}"sw = "wt switch {{ args }}"
With {{ args }} in the template, wt rm feature, wt sw other-branch, and wt ls --format=json all route through. Preview any invocation with wt config alias dry-run <name> -- <args>.
Real bug — thanks for the report, and apologies for the half-victory lap. Alias execution pipes the template context (branch, repo, args, ...) as JSON to each child command's stdin, which displaces the controlling terminal. The picker's stdin().is_terminal() check in src/commands/picker/mod.rs then fails. Same pipe would break skim's keyboard input even if the guard were removed.
Only sw needs it (the other two are non-interactive). /dev/tty always refers to the controlling terminal of the session, regardless of how stdin was redirected into wt.
@max-sixty — worth a proper fix on the alias side (don't pipe stdin when the child is a wt subcommand, or make it opt-in). Happy to file an issue to track.
@max-sixty — worth a proper fix on the alias side (don't pipe stdin when the child is a wt subcommand, or make it opt-in). Happy to file an issue to track.
we don't want to track whether it's a subcommand, or add configs. Is there an uncomplicated option to attach stdin? Otherwise we could remove the json piping, I have heard exactly zero people using it (at least in aliases)
Good news — the hook/alias split already exists in code, so no subcommand sniffing or new configs needed. The JSON-on-stdin is a documented feature for hooks (docs/content/hook.md has a "JSON context" section with a Python example, and there are tests test_post_create_json_stdin / test_post_start_json_stdin asserting it), but not for aliases — it just leaked into aliases because they share the executor path.
At the single call site in src/commands/command_executor.rs:450-456, run_one_command already knows the origin (CommandOrigin::Hook vs CommandOrigin::Alias). The uncomplicated fix is:
let stdin_json = match origin {CommandOrigin::Hook{ .. } => Some(cmd.context_json.as_str()),CommandOrigin::Alias{ .. } => None,};let result = execute_shell_command(wt_path, command_str, stdin_json, ...);
Then in execute_shell_command (src/output/handlers.rs:1440), if stdin_content is None set .stdin(Stdio::inherit()) instead of leaving it as the current null default. That's what gives the picker back its terminal.
Net: hooks keep their documented JSON-on-stdin contract, aliases inherit the tty. Want me to put up a PR?
Opened #2380 with the fix: hooks keep the documented JSON-on-stdin contract, aliases inherit stdin so wt sw (and any other interactive alias) keeps its tty. Once it lands the < /dev/tty workaround won't be needed.
@max-sixty Just had a chance to test this. It seems to freeze. "wt switch" opens the interactive switcher as expected but "wt sw" (aliased) does nothing, blank screen. So something still not quite right here.
Reproduced — apologies, the prior fix only got half the bug. The blank screen is a job-control issue separate from the stdin one.
Aliases run their child shell with forward_signals(), which calls cmd.process_group(0) to put the inner shell (and its wt switch grandchild) in a new process group. That new pgroup never becomes the controlling terminal's foreground pgroup, so when skim's tuikit calls tcsetattr on /dev/tty to enter raw mode (here), POSIX requires the kernel to send SIGTTOU to that pgroup, which stops it. The picker initializes, then freezes mid-render — exactly what KieranP saw.
Proof from ps while a wt sw is hung:
PID PGID SID STAT WCHAN COMM
366 366 366 Ssl+ hrtime wt ← parent: foreground pgroup (the +)
379 378 366 Tl do_sig wt switch ← child: STOPPED (T), parked in signal handler
The T state plus do_sig wchan is the diagnostic — the inner wt switch is suspended on SIGTTOU inside tcsetattr. Direct wt switch runs in the parent process, shares the foreground pgroup, and never hits this path.
Verified by patching out the cmd.process_group(0) line and rebuilding: wt sw then renders the picker normally (escape-sequence stream goes from 0 bytes to 1KB+ in the captured PTY).
Proposed fix: when an alias inherits stdin (the interactive case we already detect for the JSON-on-stdin gating), skip the new pgroup. Parent and child share the foreground pgroup, the user's Ctrl-C reaches both via the kernel, and tcsetattr succeeds. The new-pgroup isolation only matters when wt needs kill(child_pgid) to take down a tree — for interactive aliases that's redundant since the kernel already sends SIGINT to the shared pgroup.
Alternative is the standard shell job-control pattern (tcsetpgrp to make the new pgroup foreground, restore on exit), but that's more moving parts for the same outcome.
Opened #2444 with the fix. Cmd::inherit_stdin() now keeps the child in wt's process group when the alias body inherits stdin, so skim's tcsetattr on /dev/tty no longer raises SIGTTOU mid-render. Concurrent aliases still get their own pgroups (separate executor in output/concurrent.rs), so the existing wt step tear-down behaviour is unchanged.
Once it lands, wt sw (aliased to wt switch {{ args }}) should render the picker normally — no < /dev/tty workaround needed. @KieranP if you're up for it, a fresh test on your config after the PR merges would be valuable.
Activity
max-sixty commentedon Jan 4, 2026
my sense is that these can be local aliases, but quite open-minded
one downside of shorthands is that
wt r<tab>doesn't complete towt remove(though we could likely exclude shorthand from completions to handle this)let's leave this open for a bit and see what others think
vforsh commentedon Jan 5, 2026
+1
ls and rm were the 1st things i tried after installing and playing with
wtrazor-x commentedon Jan 15, 2026
This could be packaged as a shell plugin, similar to https://github.com/jhillyerd/plugin-git and https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git/ either part of this repo or maintained separately (or even PRed into those plugins, however they may not accept scope outside of
git)feat: add shorthand aliases for list and remove commands
KieranP commentedon Apr 6, 2026
Hello. Just started using Worktrunk and similarly hoping that we can get native short aliases, either built in or via git style alias mapping/
max-sixty commentedon Apr 7, 2026
we have aliases! They are currently on
wt step foo, but it's viable to aliaswstowt stepand thenws lscould bewt step lsetc...KieranP commentedon Apr 7, 2026
Hmm, not quite the same. Shell command aliases requires engineers to edit their own .zshrc. While having built in alias support in worktrunk means the worktrunk config in the git repo can apply to everyone when they are in the project. Would prefer native and top level support for aliases within a project rather than asking engineers to go make changes to their global shell.
markjaquith commentedon Apr 9, 2026
I fairly immediately tried to do both
rmandlsand grumbled a bit when they didn't work.Having this as silent (not auto-completed, maybe not even advertised) shortcuts would be a nice QOL improvement, without much downside.
jrdncstr commentedon Apr 17, 2026
I'll try using shell aliases to see whether they stick.
max-sixty commentedon Apr 17, 2026
We now have aliases support at the root!
@worktrunk-bot can you write out the config that would let folks have the shorthand please?
worktrunk-bot commentedon Apr 17, 2026
Drop this into either user config (
~/.config/worktrunk/config.toml, trusted, applies everywhere) or project config (.config/wt.toml, shared with teammates, approval prompt on first run):Then
wt ls,wt rm,wt swall work. See Aliases for docs.One caveat: aliases don't forward bare positional arguments —
wt rm my-brancherrors withUnexpected argument 'my-branch'. Flags-as-vars work, so you can dowt rm --branch=my-branchif you template it asrm = "wt remove {{ branch }}", but there's no way today to makewt rm my-branchroute through. For those cases stick with the full command name.max-sixty commentedon Apr 17, 2026
erm, OK, sorry. I will think about this before declaring victory. Need to consider how to have
wtCLI options work; possibly will force them to be before the aliasmax-sixty commentedon Apr 19, 2026
I think with 0.40 this should be ready! @worktrunk-bot please confirm?
worktrunk-bot commentedon Apr 19, 2026
Confirmed — 0.40 closes that gap. Smart routing (#2304) sends
--KEY=VALUEtokens to matching{{ KEY }}vars and forwards everything else — including bare positionals — as{{ args }}. The shorthand config now looks like:With
{{ args }}in the template,wt rm feature,wt sw other-branch, andwt ls --format=jsonall route through. Preview any invocation withwt config alias dry-run <name> -- <args>.max-sixty commentedon Apr 19, 2026
great! feel free to post here for any issues / problems / hints / questions for @worktrunk-bot / etc. Will close.
thanks for the ideas!
KieranP commentedon Apr 21, 2026
@max-sixty Aliases don't like commands that need interaction :-(
~/.config/worktrunk/config.toml
Shell:
worktrunk-bot commentedon Apr 21, 2026
Real bug — thanks for the report, and apologies for the half-victory lap. Alias execution pipes the template context (branch, repo, args, ...) as JSON to each child command's stdin, which displaces the controlling terminal. The picker's
stdin().is_terminal()check insrc/commands/picker/mod.rsthen fails. Same pipe would break skim's keyboard input even if the guard were removed.Verified with a diag alias:
Workaround until this is fixed properly: reopen
/dev/ttyon stdin in the alias body so the child sees the real terminal again:Only
swneeds it (the other two are non-interactive)./dev/ttyalways refers to the controlling terminal of the session, regardless of how stdin was redirected into wt.@max-sixty — worth a proper fix on the alias side (don't pipe stdin when the child is a wt subcommand, or make it opt-in). Happy to file an issue to track.
max-sixty commentedon Apr 22, 2026
we don't want to track whether it's a subcommand, or add configs. Is there an uncomplicated option to attach stdin? Otherwise we could remove the json piping, I have heard exactly zero people using it (at least in aliases)
worktrunk-bot commentedon Apr 22, 2026
Good news — the hook/alias split already exists in code, so no subcommand sniffing or new configs needed. The JSON-on-stdin is a documented feature for hooks (
docs/content/hook.mdhas a "JSON context" section with a Python example, and there are teststest_post_create_json_stdin/test_post_start_json_stdinasserting it), but not for aliases — it just leaked into aliases because they share the executor path.At the single call site in
src/commands/command_executor.rs:450-456,run_one_commandalready knows the origin (CommandOrigin::HookvsCommandOrigin::Alias). The uncomplicated fix is:Then in
execute_shell_command(src/output/handlers.rs:1440), ifstdin_contentisNoneset.stdin(Stdio::inherit())instead of leaving it as the currentnulldefault. That's what gives the picker back its terminal.Net: hooks keep their documented JSON-on-stdin contract, aliases inherit the tty. Want me to put up a PR?
max-sixty commentedon Apr 22, 2026
yes please
worktrunk-bot commentedon Apr 22, 2026
Opened #2380 with the fix: hooks keep the documented JSON-on-stdin contract, aliases inherit stdin so
wt sw(and any other interactive alias) keeps its tty. Once it lands the< /dev/ttyworkaround won't be needed.fix(alias): inherit stdin so interactive children keep the tty (#2380)
max-sixty commentedon Apr 22, 2026
I think this should be good now! I've also really optimized away any excess commands to prepare the context, so it should be down to 30ms overhead.
I'll close but let me know any final things that aren't quite up to scratch.
KieranP commentedon Apr 27, 2026
@max-sixty Just had a chance to test this. It seems to freeze. "wt switch" opens the interactive switcher as expected but "wt sw" (aliased) does nothing, blank screen. So something still not quite right here.
worktrunk-bot commentedon Apr 27, 2026
Reproduced — apologies, the prior fix only got half the bug. The blank screen is a job-control issue separate from the stdin one.
Aliases run their child shell with
forward_signals(), which callscmd.process_group(0)to put the inner shell (and itswt switchgrandchild) in a new process group. That new pgroup never becomes the controlling terminal's foreground pgroup, so when skim'stuikitcallstcsetattron/dev/ttyto enter raw mode (here), POSIX requires the kernel to sendSIGTTOUto that pgroup, which stops it. The picker initializes, then freezes mid-render — exactly what KieranP saw.Proof from
pswhile awt swis hung:The
Tstate plusdo_sigwchan is the diagnostic — the innerwt switchis suspended onSIGTTOUinsidetcsetattr. Directwt switchruns in the parent process, shares the foreground pgroup, and never hits this path.Verified by patching out the
cmd.process_group(0)line and rebuilding:wt swthen renders the picker normally (escape-sequence stream goes from 0 bytes to 1KB+ in the captured PTY).Proposed fix: when an alias inherits stdin (the interactive case we already detect for the JSON-on-stdin gating), skip the new pgroup. Parent and child share the foreground pgroup, the user's Ctrl-C reaches both via the kernel, and
tcsetattrsucceeds. The new-pgroup isolation only matters when wt needskill(child_pgid)to take down a tree — for interactive aliases that's redundant since the kernel already sends SIGINT to the shared pgroup.Alternative is the standard shell job-control pattern (
tcsetpgrpto make the new pgroup foreground, restore on exit), but that's more moving parts for the same outcome.@max-sixty want me to put up a PR for option 1?
max-sixty commentedon Apr 27, 2026
yes please @worktrunk-bot
@KieranP thanks for the report, and your patience
worktrunk-bot commentedon Apr 28, 2026
Opened #2444 with the fix.
Cmd::inherit_stdin()now keeps the child in wt's process group when the alias body inherits stdin, so skim'stcsetattron/dev/ttyno longer raises SIGTTOU mid-render. Concurrent aliases still get their own pgroups (separate executor inoutput/concurrent.rs), so the existingwt steptear-down behaviour is unchanged.Once it lands,
wt sw(aliased towt switch {{ args }}) should render the picker normally — no< /dev/ttyworkaround needed. @KieranP if you're up for it, a fresh test on your config after the PR merges would be valuable.