Skip to content

shell-integration: invoke resolved Ghostty CLI path - #115

Merged
austinywang merged 1 commit into
mainfrom
issue-8093-ssh-ghostty-binary-path
Jul 14, 2026
Merged

austinywang merged 1 commit into
mainfrom
issue-8093-ssh-ghostty-binary-path

Conversation

@austinywang

@austinywang austinywang commented Jul 14, 2026 •

Copy link
Copy Markdown

Summary

  • export an exact GHOSTTY_BIN executable path for shell integration
  • let embedded hosts provide a CLI helper outside the GUI executable directory
  • make zsh, bash, fish, nushell, and elvish SSH wrappers invoke the resolved path
  • skip installing a broken SSH wrapper when an embedded host has no helper

This fixes manaflow-ai/cmux#8093, where embedded Ghostty derived /Applications/cmux.app/Contents/MacOS/ghostty from the cmux GUI executable even though the CLI helper lives in Contents/Resources/bin.

Verification

  • zsh, bash, and fish syntax checks
  • cmux behavioral zsh/bash wrapper regression
  • focused Zig resolver tests added (cold full test graph deferred to parent CI)

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Export and use the exact Ghostty CLI path for shell integration so SSH wrappers call the correct binary, including when Ghostty runs inside an embedded host app. Prevents wrong-path derivation and disables the SSH wrapper when no helper is available.

  • Bug Fixes
    • Export GHOSTTY_BIN (exact CLI path) and keep GHOSTTY_BIN_DIR; append its directory to PATH.
    • Update zsh/bash/fish/nushell/elvish SSH wrappers to invoke GHOSTTY_BIN and only install when it’s set.
    • Add a resolver and tests to choose the native ghostty or an embedded helper, fixing incorrect paths in hosts like cmux.

Written for commit b4b6d69. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Improved SSH integration across supported shells by reliably locating and launching Ghostty.
    • Added support for embedded runtime environments when enabling Ghostty’s SSH features.
  • Bug Fixes

    • SSH commands now fall back to the system SSH client when Ghostty’s executable is unavailable.
    • Improved executable path and environment handling for shell integrations.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bbb79f27-af0b-49d8-9793-66c7943386be

📥 Commits

Reviewing files that changed from the base of the PR and between a630590 and b4b6d69.

📒 Files selected for processing (6)
  • src/shell-integration/bash/ghostty.bash
  • src/shell-integration/elvish/lib/ghostty-integration.elv
  • src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish
  • src/shell-integration/nushell/vendor/autoload/ghostty.nu
  • src/shell-integration/zsh/ghostty-integration
  • src/termio/Exec.zig

📝 Walkthrough

Walkthrough

Ghostty now resolves and exports an exact CLI executable path, including embedded-runtime helpers. Shell SSH integrations require GHOSTTY_BIN and invoke that path directly across Bash, Elvish, Fish, Nushell, and Zsh.

Changes

SSH CLI integration

Layer / File(s) Summary
Resolve and export the Ghostty CLI path
src/termio/Exec.zig
Resolves native or embedded Ghostty executables, exports GHOSTTY_BIN and GHOSTTY_BIN_DIR, updates PATH, and tests resolution outcomes.
Use the resolved path in shell SSH wrappers
src/shell-integration/{bash,elvish,fish,nushell,zsh}/*
Requires GHOSTTY_BIN before installing SSH integration and invokes that executable while preserving feature-derived flags.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: jparise, mitchellh

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8093-ssh-ghostty-binary-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@austinywang
austinywang merged commit 67b388b into main Jul 14, 2026
103 of 104 checks passed
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes shell integration use Ghostty’s resolved CLI path. The main changes are:

  • Exports GHOSTTY_BIN from the subprocess environment setup.
  • Keeps GHOSTTY_BIN_DIR for PATH-related shell integration.
  • Updates bash, zsh, fish, nushell, and elvish SSH wrappers to call the resolved binary.
  • Adds resolver tests for native Ghostty and embedded hosts.

Confidence Score: 4/5

The fish SSH wrapper gate needs a fix before merging.

  • ssh-env-only fish sessions can skip the wrapper even when GHOSTTY_BIN is set.
  • The other changed wrappers follow the resolved binary path without a concrete issue found.
  • The Zig resolver changes keep the old directory export while adding the exact binary path.

src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish

Important Files Changed

Filename Overview
src/termio/Exec.zig Adds exact CLI path resolution, exports GHOSTTY_BIN, preserves GHOSTTY_BIN_DIR, and updates PATH from the resolved binary directory.
src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish Switches the SSH wrapper to GHOSTTY_BIN, but the changed feature gate can skip the wrapper for ssh-env-only setups.
src/shell-integration/bash/ghostty.bash Switches the SSH wrapper to GHOSTTY_BIN and skips wrapper installation when no resolved binary is available.
src/shell-integration/zsh/ghostty-integration Switches the deferred SSH wrapper to GHOSTTY_BIN with a non-empty binary guard.
src/shell-integration/nushell/vendor/autoload/ghostty.nu Falls back to native ssh unless SSH integration is enabled and GHOSTTY_BIN is present.
src/shell-integration/elvish/lib/ghostty-integration.elv Uses GHOSTTY_BIN for the SSH integration helper and only registers the wrapper when the variable exists.

Reviews (1): Last reviewed commit: "shell-integration: invoke resolved Ghost..." | Re-trigger Greptile

# feature flags into command options.
set -l features (string split ',' -- "$GHOSTTY_SHELL_FEATURES")
if contains ssh-env $features; or contains ssh-terminfo $features
if test -n "$GHOSTTY_BIN"; and contains ssh-env $features; or test -n "$GHOSTTY_BIN"; and contains ssh-terminfo $features

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Fish Feature Gate Skips Wrapper

When GHOSTTY_BIN is set and only ssh-env is enabled, this fish chain can still continue into the trailing and contains ssh-terminfo $features check and leave the whole if false. That skips installing the SSH wrapper, so ssh-env users silently get plain ssh instead of ghostty +ssh.

Suggested change
if test -n "$GHOSTTY_BIN"; and contains ssh-env $features; or test -n "$GHOSTTY_BIN"; and contains ssh-terminfo $features
if test -n "$GHOSTTY_BIN"; and begin; contains ssh-env $features; or contains ssh-terminfo $features; end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ghostty binary missing from application bundle?

1 participant