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
- Most reliable path: type niu in a terminal to enter a session, then start opencode from there ($SHELL is visible automatically)
- 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
- The opencode binary contains zero niu-specific code — $SHELL is the entire mechanism
- Its self-updater probes for bin\bash.exe three levels above git --exec-path and refuses to update when missing (niubash#376) — the niubash installer already places that file
Sources
agents.md#opencodeniubash#376- agents.md (the complete probe-mechanism document) ↗
Chinese edition of this page: /agents/opencode/