docs: clarify GOOSE_TERMINAL requires ~/.zshenv for zsh users (#6297)

This commit is contained in:
Rizel Scarlett
2025-12-29 17:35:09 -05:00
committed by GitHub
parent 31eaa47209
commit c5b9163967
@@ -419,17 +419,30 @@ These variables are automatically set by goose during command execution.
### Customizing Shell Behavior
Sometimes you want goose to use different commands or have different shell behavior than your normal terminal usage. For example, you might want goose to use a different tool, or prevent goose from running long-running development servers that could hang the AI agent. This is most useful when using goose CLI, where shell commands are executed directly in your terminal environment.
Sometimes you want goose to use different commands or have different shell behavior than your normal terminal usage. For example, you might want goose to use a different tool, prevent goose from running `git commit`, or block long-running development servers that could hang the AI agent. This is most useful when using goose CLI, where shell commands are executed directly in your terminal environment.
**How it works:**
1. When goose runs commands, `GOOSE_TERMINAL` is automatically set to "1"
2. Your shell configuration can detect this and direct goose to change its default behavior while keeping your normal terminal usage unchanged
2. Your shell configuration can detect this and change behavior while keeping your normal terminal usage unchanged
**Example:**
**Examples:**
```bash
# In your ~/.bashrc or ~/.zshrc
# In ~/.zshenv (for zsh users) or ~/.bashrc (for bash users)
# Block git commit when run by goose
if [[ -n "$GOOSE_TERMINAL" ]]; then
git() {
if [[ "$1" == "commit" ]]; then
echo "❌ BLOCKED: git commit is not allowed when run by goose"
return 1
fi
command git "$@"
}
fi
```
```bash
# Guide goose toward better tool choices
if [[ -n "$GOOSE_TERMINAL" ]]; then
alias find="echo 'Use rg instead: rg --files | rg <pattern> for filenames, or rg <pattern> for content search'"