pub struct OpenCodeConfig {
pub cli_path: PathBuf,
pub model: String,
pub mcp_server_path: Option<PathBuf>,
pub timeout: Duration,
pub working_dir: Option<PathBuf>,
pub env_vars: Vec<(String, String)>,
pub platform: Option<String>,
}Expand description
Configuration for OpenCode CLI integration
Fields§
§cli_path: PathBufPath to the OpenCode CLI binary
model: StringModel to use (e.g., “zai-coding-plan/glm-4.7”)
mcp_server_path: Option<PathBuf>Path to the MCP server binary (for RAG integration)
timeout: DurationTimeout for CLI operations
working_dir: Option<PathBuf>Working directory for OpenCode (defaults to codebase path)
env_vars: Vec<(String, String)>Additional environment variables to pass to OpenCode
platform: Option<String>Platform name for prompt customization (e.g., “Shopify”, “WordPress”, “Salesforce”) Loaded from GATEKPR_PLATFORM or SHOPIFY_APPROVER_PLATFORM env var. Defaults to “Shopify” if not set.
Implementations§
Source§impl OpenCodeConfig
impl OpenCodeConfig
Sourcepub fn with_cli_path(cli_path: PathBuf) -> Self
pub fn with_cli_path(cli_path: PathBuf) -> Self
Create configuration with explicit CLI path
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create configuration from environment variables
Environment variables:
OPENCODE_CLI_PATH: Path to opencode binaryOPENCODE_MODEL: Model to use (default: zai-coding-plan/glm-4.7)OPENCODE_TIMEOUT: Timeout in seconds (default: 120)MCP_SERVER_PATH: Path to gatekpr-mcp-server binaryGATEKPR_PLATFORMorSHOPIFY_APPROVER_PLATFORM: Platform name (default: “Shopify”)
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model to use
Sourcepub fn with_mcp_server(self, path: PathBuf) -> Self
pub fn with_mcp_server(self, path: PathBuf) -> Self
Set the MCP server path
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the timeout
Sourcepub fn with_working_dir(self, dir: PathBuf) -> Self
pub fn with_working_dir(self, dir: PathBuf) -> Self
Set the working directory
Trait Implementations§
Source§impl Clone for OpenCodeConfig
impl Clone for OpenCodeConfig
Source§fn clone(&self) -> OpenCodeConfig
fn clone(&self) -> OpenCodeConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenCodeConfig
impl Debug for OpenCodeConfig
Source§impl Default for OpenCodeConfig
impl Default for OpenCodeConfig
Source§impl<'de> Deserialize<'de> for OpenCodeConfig
impl<'de> Deserialize<'de> for OpenCodeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OpenCodeConfig
impl RefUnwindSafe for OpenCodeConfig
impl Send for OpenCodeConfig
impl Sync for OpenCodeConfig
impl Unpin for OpenCodeConfig
impl UnwindSafe for OpenCodeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more