sidekick.nvim icon indicating copy to clipboard operation
sidekick.nvim copied to clipboard

bug: OPENCODE_CONFIG_DIR is not respected by sidekick.nvim

Open oribarilan opened this issue 5 months ago • 2 comments

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

  1. create a custom directory (e.g., ~/.config/opencode_test_conf/)
  2. add an environment variable as such: OPENCODE_CONFIG_DIR = ~/.config/opencode_test_conf/)
  3. make sure this env variable is set (either in zshrc, export, or otherwise)
  4. add agents dir (e.g., /opencode_test_conf/agent/)
  5. add a dummy agent (e.g., /opencode_test_conf/agent/doc.md) - see below for content
  6. 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
  },
})

oribarilan avatar Oct 30 '25 12:10 oribarilan

workaround for now:

    cli = {
      tools = {
        opencode = {
          cmd = { 'opencode' },
          env = {
            OPENCODE_CONFIG_DIR = vim.fn.expand('~/path/to/custom/dir'),
          },
        },
      },
...

oribarilan avatar Oct 30 '25 12:10 oribarilan

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.

github-actions[bot] avatar Nov 30 '25 02:11 github-actions[bot]