Moshi CLI
The short moshi command — a project tmux launcher and one-shot diff viewer that ships with moshi-hook.
When you install moshi-hook, the package also exposes a shorter moshi alias. It points at the same binary, so every moshi-hook subcommand works under either name — moshi pair, moshi install, moshi serve, moshi status, and so on.
The alias adds one extra behavior: if you pass a single directory as the only argument, moshi treats it as "open a tmux session for this project" instead of looking for a subcommand. That makes the two things you reach for most from a shell — project tmux sessions and the git diff viewer — fit in a single short word.
Project tmux sessions
Pass a single directory argument and moshi resolves it, names the tmux session after the directory basename, and replaces itself with the equivalent tmux new-session -A command:
$moshi .$moshi ~/projects/app-ios$moshi ~/a/b/name
For example, moshi ~/a/b/name becomes:
$tmux new-session -A -s name -c /Users/you/a/b/name
A few things to note:
- The session name is the directory basename. Running
moshiagain on the same path attaches; running it on a sibling path with the same basename collides — pass a fuller path or rename one of them. - Because
moshiusesexec, no wrapper process stays around. From the shell's point of view, you started tmux normally. - The working directory is set with
-cso new windows inside the session default to that path.
See tmux for windows, panes, and reattach patterns.
Git diff viewer
moshi diff starts the embedded git diff viewer for a local repository and opens it in your default browser:
$moshi diff .$moshi diff ~/projects/some-repo$moshi diff ~/projects/some-repo --no-open
The viewer is served by moshi-hook, binds to 127.0.0.1 only, and uses a stable port (24543 by default). Running moshi diff again for a different workspace re-points the same server at the new repo and reopens the existing local URL — you don't accumulate browser tabs.
Useful flags:
If the daemon gateway already owns port 24543, the CLI falls back to a free ephemeral port and prints the URL it chose.
For everything else the viewer can do — staged/unstaged/untracked sections, side-by-side rendering, in-app integration — see Diff viewer.
Every other subcommand
Because moshi is the same binary, you can drop the -hook suffix anywhere:
The one disambiguation rule: a single directory argument routes to the tmux launcher, not a subcommand. Subcommands like pair, install, diff, status are still dispatched normally because they aren't paths. If you ever need to be explicit, moshi-hook always means the underlying binary with no alias behavior.
If moshi is not on your PATH after brew install moshi-hook, make sure your shell has Homebrew's bin directory loaded, or call the absolute path printed by which moshi-hook.