anomalyco / anomalyco/opencode
Feature: configurable environment bootstrap for Desktop WSL servers
@Brendonovich is already working on this.
Since Aug 2, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
This appears to affect more than provider environment variables: it also prevents the Desktop-launched WSL server from finding normal developer tools such as node, npm, npx, and pnpm.
The Desktop WSL sidecar currently starts the server with wsl … bash -se, does not source ~/.bashrc, and sanitizes PATH by removing /mnt/* entries. See sidecar.ts.
That is understandable as a safe default, but it differs from an interactive WSL terminal. For example, this works in a normal Bash session:
command -v node npm npx pnpm
But commands run through the Desktop WSL server cannot find them when Node/pnpm setup is initialized in Bash configuration, for example:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
Related bug report: #38241.
Request
Please add a per-WSL-server Environment bootstrap setting in the Desktop app.
Suggested behavior:
- Sanitized environment — default; preserves today's behavior.
- Source an explicit bootstrap file — opt-in, for example
~/.config/opencode/desktop-wsl-env.sh. - Optionally, an advanced choice to source
~/.bashrc.
The selected bootstrap should run once while starting opencode serve, after Desktop applies its safe defaults and before it executes the server. Shell-tool commands would then inherit the resulting environment.
This avoids running every agent command as an interactive shell, preserves a predictable default, and lets users enable only the Node/pnpm initialization they need.
Acceptance criteria
- The option is configurable per WSL distro/server in Desktop.
- Default behavior remains unchanged.
- A configured bootstrap makes
node,npm,npx, andpnpmavailable to commands run by OpenCode. - Bootstrap failures are shown clearly in the Desktop server-startup logs/UI.
- Documentation explains that sourcing
.bashrcis opt-in, since interactive shell configuration can have side effects.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.