Skip to content

gh vibe shell-setup

Prints a shell snippet that wraps gh so that gh vibe review <PR> will cd your shell into the freshly-created worktree on success.

Terminal window
gh vibe shell-setup [--shell=<bash|zsh|fish|pwsh>]

Without --shell, the calling shell is auto-detected from $SHELL (or $PSModulePath for PowerShell). Pass --shell= explicitly when generating a snippet to commit to a different shell’s rc file.

Terminal window
# ~/.bashrc or ~/.zshrc
eval "$(gh vibe shell-setup)"
~/.config/fish/config.fish
gh vibe shell-setup --shell=fish | source
Terminal window
# $PROFILE
gh vibe shell-setup --shell=pwsh | Out-String | Invoke-Expression

After reloading the shell:

Terminal window
gh vibe review 123 # creates the worktree AND cd's you into it
ShellTested
bashbash -n parse-check + end-to-end
zshzsh -n parse-check
fishfish -n parse-check
pwsh (PowerShell 7+)[scriptblock]::Create parse-check

bash and zsh share one POSIX-compatible snippet; fish and pwsh get shell-specific wrappers.

The shell-setup snippets are designed not to compromise your interactive shell:

  • The wrapper detects an existing user-defined gh function or alias and refuses to install in that case (prints a warning to stderr).
  • The wrapper only evaluates output fenced by the # __ghvibe_v1_begin__# __ghvibe_v1_end__ sentinels (regular # comments in every supported shell), so unrelated gh stdout can never be executed as shell code.
  • The binary itself only emits shell commands when invoked via the wrapper (it looks for GH_VIBE_SHELL=v1 in env) and stdout is not a TTY. If you set the env var manually in an interactive shell, gh-vibe falls back to normal mode with a warning.

Remove the corresponding line from your shell rc / profile file and reload the shell.