opencode-direnvOpenCode plugin that integrates direnv environment loading into shell commands
0
143
33 in 7 days
26.6
Multi-signal model
4 months ago
2026-04-15
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-direnv@1.1.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-direnv@1.1.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-direnvopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
OpenCode plugin that loads direnv environments into shell commands.
What it does
- Injects
direnv exportvars into every shell command via theshell.envhook - Provides a
direnv_allowtool that prompts for user approval before allowing.envrcfiles - Blocks direct
direnv allowin bash to enforce the approval flow - Loads direnv env into
process.envat startup for LSP servers
Install
Add to your opencode.json:
{
"plugin": ["opencode-direnv"]
}
Requires direnv to be installed on the host.
License
MIT