add nushell terminal and completion support (#8628)

Signed-off-by: Can H. Tartanoglu <gpg@rotas.mozmail.com>
This commit is contained in:
Can H. Tartanoglu
2026-05-13 01:39:28 +02:00
committed by GitHub
parent ba60b597fa
commit 80cac3626f
7 changed files with 375 additions and 34 deletions
@@ -104,7 +104,7 @@ Once installed, you can:
- Discover options without checking `--help`
**Arguments:**
- **`<SHELL>`**: The shell to generate completions for. Supported shells: `bash`, `elvish`, `fish`, `powershell`, `zsh`
- **`<SHELL>`**: The shell to generate completions for. Supported shells: `bash`, `elvish`, `fish`, `nu`, `powershell`, `zsh`
**Usage:**
```bash
@@ -112,6 +112,7 @@ Once installed, you can:
goose completion bash
goose completion zsh
goose completion fish
goose completion nu
```
**Installation by Shell:**
@@ -153,6 +154,20 @@ goose completion fish > ~/.config/fish/completions/goose.fish
Then restart your terminal or run `exec fish`.
</TabItem>
<TabItem value="nu" label="Nushell">
```nu
let autoload_dir = ($nu.user-autoload-dirs | first)
mkdir $autoload_dir
goose completion nu | save --force ($autoload_dir | path join "goose.nu")
```
Then restart Nushell or run:
```nu
source (($nu.user-autoload-dirs | first) | path join "goose.nu")
```
</TabItem>
<TabItem value="powershell" label="PowerShell">
@@ -31,6 +31,16 @@ Add to `~/.config/fish/config.fish`:
goose term init fish | source
```
</TabItem>
<TabItem value="nu" label="Nushell">
Add to `~/.config/nushell/config.nu`:
```nu
let goose_term_init = ($nu.cache-dir | path join "goose-term-init.nu")
^goose term init nu | save --force $goose_term_init
source $goose_term_init
```
</TabItem>
<TabItem value="powershell" label="PowerShell">
@@ -87,6 +97,15 @@ eval "$(goose term init bash --name my-project)"
goose term init fish --name my-project | source
```
</TabItem>
<TabItem value="nu" label="Nushell">
```nu
let goose_term_init = ($nu.cache-dir | path join "goose-term-init.nu")
^goose term init nu --name my-project | save --force $goose_term_init
source $goose_term_init
```
</TabItem>
<TabItem value="powershell" label="PowerShell">
@@ -110,6 +129,36 @@ eval "$(goose term init zsh --name auth-bug)"
# Continues the same conversation with context
```
## Default Handler
Use `--default` if you want goose to answer commands your shell cannot resolve.
<Tabs groupId="default-shells">
<TabItem value="zsh" label="zsh" default>
```bash
eval "$(goose term init zsh --default)"
```
</TabItem>
<TabItem value="bash" label="bash">
```bash
eval "$(goose term init bash --default)"
```
</TabItem>
<TabItem value="nu" label="Nushell">
```nu
let goose_term_init = ($nu.cache-dir | path join "goose-term-init.nu")
^goose term init nu --default | save --force $goose_term_init
source $goose_term_init
```
</TabItem>
</Tabs>
## Show Context Status in Your Prompt
Add `goose term info` to your prompt to see how much context you've used and which model is active during a terminal goose session.
@@ -138,6 +187,13 @@ function fish_prompt
end
```
</TabItem>
<TabItem value="nu" label="Nushell">
```nu
$env.PROMPT_COMMAND = {|| $"(goose term info) (pwd)> " }
```
</TabItem>
<TabItem value="powershell" label="PowerShell">
@@ -170,6 +226,11 @@ You can also check the id of the goose session in your current terminal:
echo $AGENT_SESSION_ID
# Should show something like: 20251209_151730
```
```nu
# Nushell
$env.AGENT_SESSION_ID
# Should show something like: 20251209_151730
```
To share context across terminal windows, use a [named session](#named-sessions) instead.
**Session getting too full** (prompt shows `●●●●●`):
@@ -178,3 +239,9 @@ If goose's responses are getting slow or hitting context limits, start a fresh g
# Start a new goose session in the same shell
eval "$(goose term init zsh)"
```
```nu
# Nushell
let goose_term_init = ($nu.cache-dir | path join "goose-term-init.nu")
^goose term init nu | save --force $goose_term_init
source $goose_term_init
```