worktrunk icon indicating copy to clipboard operation
worktrunk copied to clipboard

`wt step` confusion

Open nixpulvis opened this issue 3 weeks ago • 4 comments

I'm new to worktrunk and keep tripping over wt step. Its help says "Run individual operations", and the examples describe the manual merge workflow (commit → squash → rebase → push). Those four subcommands fit that description well. The other eight don't: they're unrelated tools that seem to have ended up under step because they had no other home.

Here's what wt step contains today (v0.81.0), grouped by what each command actually does:

Kind Subcommands
Parts of the wt merge pipeline commit, squash, rebase, push
Looking at a branch diff
Moving files between worktrees copy-ignored
Templates and scripting eval, for-each
Maintaining worktrees in bulk prune, relocate, promote
Supervising processes tether

wt step <alias> also runs a configured alias, even though wt <alias> already works at the top level.

Rational

  • The name doesn't help you find things. If I want to remove merged worktrees, I'd look under wt remove, not wt step prune. If I want to see a branch's changes, wt step diff isn't where I'd look either.
  • It hides how the merge pipeline works. wt step would be a clear way to explain wt merge (run its stages one at a time) if those four commands weren't mixed in with eight others.

Proposal

Make wt step mean only "the stages of wt merge", and move everything else out:

  1. Keep commit, squash, rebase, push under wt step.
  2. Move commands to an existing verb where one fits. For example, prune could become wt remove --merged.
  3. Move commands to top-level or new verb for other commands (relocate, promote, for-each, eval, tether, copy-ignored, and possibly diff). For example wt foreach mirrors git submodule foreach nicely.
  4. Stop accepting aliases under wt step, since they already work as wt <alias>.

nixpulvis avatar Nov 08 '26 05:11 nixpulvis

The help text agrees with your reading. wt step's long help calls it "the building blocks of wt merge — commit, squash, rebase, push — plus standalone utilities" (src/cli/mod.rs), so the mix you describe is how the command is documented. This isn't the first time it has caused trouble: in #3004 a user looked for a merged-worktree cleanup command under wt --help and wt remove --help, never found wt step prune, and suggested wt prune or wt remove --all as the obvious names.

Some things a maintainer will need to weigh:

  • Compatibility. The project treats CLI arguments as a protected interface. A move would most likely add the new names and keep every wt step <x> working, hidden or with a deprecation warning, rather than drop the old ones. Your item 4 (no aliases under wt step) breaks existing invocations the same way.
  • Experimental commands are the cheapest to move. promote, relocate and tether are all marked [experimental], so their names aren't settled yet. prune, diff, copy-ignored, eval and for-each are stable, so moving them needs the compatibility path above.
  • prune → wt remove --merged fits well, because prune already uses the same integration checks as wt remove. The open question is how a bulk mode fits next to wt remove's positional worktree arguments.

Choosing names and deciding which commands move is for the maintainers, so I'm leaving this open for them. Until then, a user-config alias gives you the name you'd reach for. wt <name> checks built-ins first and then aliases:

[aliases]
prune = "wt step prune {{ args }}"
foreach = "wt step for-each {{ args }}"

worktrunk-bot avatar Nov 08 '26 05:11 worktrunk-bot

wt isn't 1.0, so I would think now's the time to get this right.

nixpulvis avatar Nov 08 '26 05:11 nixpulvis

Fair point. Being pre-1.0 doesn't stop renames, and the project has already made one without breaking scripts: wt select was folded into wt switch, and the old command still works as a hidden alias marked "Deprecated: use wt switch instead" (src/cli/mod.rs). If wt step is narrowed, its other subcommands could move the same way. The new names become the documented ones, and wt step prune and the rest keep running for a while with a warning.

So compatibility probably isn't what decides this. What's left is choosing the new names and which commands move, and that's the part I'm leaving to the maintainers.

worktrunk-bot avatar Nov 08 '26 05:11 worktrunk-bot

the intention of step was to allow lots of commands without gunking up the simplicity of the main namespace

I agree step isn't perfect, but it's not terrible (all of those things are steps, in a way!), and there are aliases for folks' common commands

happy to leave this open and see if it gains 👍

max-sixty avatar Nov 08 '26 06:11 max-sixty