opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Allow separate config directory and working directory in SDK

Open gilisho opened this issue 1 week ago • 1 comments

Problem

When using the OpenCode SDK programmatically, there's no clean way to specify where custom tools, plugins, and agent files are located when they're in a different directory from where code is being generated.

Use Case

I'm building a code generation service that:

  • Has custom tools, plugins, and agents in my package's .opencode/ directory
  • Generates code into other given output directories

I need the SDK to load config (tools+agents+plugins) from one location while writing generated code to another.

Proposed Solution

Add an explicit outputPath option to createOpencodeServer():

const server = await sdk.createOpencodeServer({ outputPath: "/path/to/where/my/code/should/be/generated", });

Environment

  • OpenCode SDK version: 1.0.184

gilisho avatar Jan 06 '26 09:01 gilisho