bug: OPENCODE_CONFIG_DIR is not respected by sidekick.nvim
Did you check docs and existing issues?
- [x] I have read all the sidekick.nvim docs
- [x] I have updated the plugin to the latest version before submitting this issue
- [x] I have searched the existing issues of sidekick.nvim
- [x] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.11.4
Operating system/version
MacOS
Describe the bug
I am using opencode's custom directory flag (https://opencode.ai/docs/config/#custom-directory). I can see it works great when opencode is opened through the terminal, but no when opened through sidekick within nvim. Specifically, agents defined under the custom directory (.../agent/...) are not found by opencode when opened via sidekick.
I find this behavior a bug. But also, sidekick documentation is unclear why would this happen so working around this is difficult as well.
Also, this brings up a bigger point, of whether other OPENCODE_* (existing or future) will not be respected by sidekick (i.e., not passed to the opencode process).
Thanks!
Steps To Reproduce
- create a custom directory (e.g., ~/.config/opencode_test_conf/)
- add an environment variable as such:
OPENCODE_CONFIG_DIR = ~/.config/opencode_test_conf/) - make sure this env variable is set (either in zshrc, export, or otherwise)
- add agents dir (e.g., /opencode_test_conf/agent/)
- add a dummy agent (e.g., /opencode_test_conf/agent/doc.md) - see below for content
- open nvim, and through sidekick trigger opencode, use
to see if agent is being picked up
for reference, you can open opencode without sidekick (terminal only) and see it works well.
doc agent for example:
---
description: Writes and maintains project documentation
mode: primary
tools:
bash: false
---
You are a technical writer. Create clear, comprehensive documentation.
Focus on:
- Clear explanations
- Proper structure
- Code examples
- User-friendly language
Expected Behavior
opencode picks up custom direcotry
Repro
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{ "folke/sidekick.nvim", opts = {} },
-- add any other plugins here
},
})
workaround for now:
cli = {
tools = {
opencode = {
cmd = { 'opencode' },
env = {
OPENCODE_CONFIG_DIR = vim.fn.expand('~/path/to/custom/dir'),
},
},
},
...
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.