Skip to content

cli: add an ssh-wrapping +ssh action#12582

Open
jparise wants to merge 5 commits into
ghostty-org:mainfrom
jparise:ssh-action
Open

cli: add an ssh-wrapping +ssh action#12582
jparise wants to merge 5 commits into
ghostty-org:mainfrom
jparise:ssh-action

Conversation

@jparise
Copy link
Copy Markdown
Contributor

@jparise jparise commented May 5, 2026

Add a drop-in ssh wrapper that sets up the remote environment for Ghostty. Anything not consumed as one of our own flags is forwarded to the real, wrapped ssh binary. It can be used directly (ghostty +ssh user@host), aliased (alias ssh='ghostty +ssh --'), or invoked through Ghostty's shell integration.

Before exec'ing ssh, +ssh:

  • Forwards Ghostty environment to the remote (--forward-env): sets TERM=xterm-256color and requests SendEnv forwarding of COLORTERM, TERM_PROGRAM, and TERM_PROGRAM_VERSION.
  • Installs Ghostty's terminfo on the remote (--terminfo), informed by our existing ssh-cache system and using our internal xterm-ghostty terminfo representation.

A third flag, --cache, controls cache use; --cache=false bypasses both read and write, which is useful for scripting and for debugging install failures without polluting the cache.

For shell integration, this replaces the per-shell logic (which made up roughly a third of our shell integration scripts) with a simple wrapper function that translates GHOSTTY_SHELL_FEATURES into a ghostty +ssh command line.

Add a drop-in `ssh` wrapper that sets up the remote environment for
Ghostty. Anything not consumed as one of our own flags is forwarded to
the real, wrapped `ssh` binary. It can be used directly (`ghostty +ssh
user@host`), aliased (`alias ssh='ghostty +ssh --'`), or invoked through
Ghostty's shell integration.

Before exec'ing ssh, `+ssh`:

- Forwards Ghostty environment to the remote (`--forward-env`): sets
  TERM=xterm-256color and requests SendEnv forwarding of COLORTERM,
  TERM_PROGRAM, and TERM_PROGRAM_VERSION.
- Installs Ghostty's terminfo on the remote (`--terminfo`), informed by
  our existing `ssh-cache` system and using our internal xterm-ghostty
  terminfo representation.

A third flag, `--cache`, controls cache use; `--cache=false` bypasses
both read and write, which is useful for scripting and for debugging
install failures without polluting the cache.

For shell integration, this replaces the per-shell logic (which made up
roughly a third of our shell integration scripts) with a simple wrapper
function that translates GHOSTTY_SHELL_FEATURES into a `ghostty +ssh`
command line. This commit only migrates the bash integration; the other
shells will follow separately.
@jparise jparise requested a review from a team as a code owner May 5, 2026 00:55
@ghostty-bot ghostty-bot Bot added the cli `ghostty` command-line interface label May 5, 2026
@jparise jparise added this to the 1.4.0 milestone May 5, 2026
jparise added 4 commits May 5, 2026 08:30
Replace the inline ssh integration with a thin wrapper that translates
GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line. The shell
wrapper no longer carries terminfo install, ControlMaster wiring, or
cache bookkeeping; it just maps the feature flags to flags on `+ssh`
and forwards everything else.
Replace the inline ssh integration with a thin wrapper that translates
GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line.
Replace the inline ssh integration with a thin wrapper that translates
GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line.
Replace the inline ssh integration with a thin wrapper that translates
GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line. When no
ssh-* feature is enabled, the wrapper falls through to the real `ssh`
binary unchanged so nushell users without ssh integration get plain
ssh behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli `ghostty` command-line interface shell-integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant