← Agent directory

opencode

Ready $SHELL env var Windows macOS Linux Difficulty Easy

Zero-config support: launch it from a niu session and it just works; a persisted SHELL covers every launch method.

PowerShell · persist SHELL to the user environment (then every launch method picks it up)
[Environment]::SetEnvironmentVariable('SHELL', "$env:LOCALAPPDATA\Programs\Niubash\niu.exe", 'User')

Steps

  1. Most reliable path: type niu in a terminal to enter a session, then start opencode from there ($SHELL is visible automatically)
  2. To also cover Start-menu/desktop launches: run the persistence command above, then reopen the terminal

Verify

echo "SHELL=$SHELL"; uname -s — expect uname -s to start with MSYS_NT-

Rollback

[Environment]::SetEnvironmentVariable('SHELL', $null, 'User')

Notes & pitfalls

Sources

Chinese edition of this page: /agents/opencode/