pub struct OpenCodeClient { /* private fields */ }Expand description
OpenCode CLI client for validation enrichment
This client invokes opencode run to process findings through
GLM 4.7 with access to the RAG-powered MCP server.
Implementations§
Source§impl OpenCodeClient
impl OpenCodeClient
Sourcepub fn new(config: OpenCodeConfig) -> Result<Self>
pub fn new(config: OpenCodeConfig) -> Result<Self>
Create a new OpenCode client
Sourcepub fn with_platform(self, platform: &str) -> Self
pub fn with_platform(self, platform: &str) -> Self
Set platform for prompt customization
Sourcepub async fn enrich_finding(
&self,
finding: &RawFinding,
file_context: &FileContext,
) -> Result<EnrichedFinding>
pub async fn enrich_finding( &self, finding: &RawFinding, file_context: &FileContext, ) -> Result<EnrichedFinding>
Enrich a single finding with RAG context
Invokes OpenCode with the finding details and file context. OpenCode will use MCP tools (search_docs_for_rule) to fetch relevant documentation and provide a detailed analysis.
Sourcepub async fn enrich_findings(
&self,
findings: Vec<RawFinding>,
codebase_path: &Path,
) -> Result<Vec<EnrichedFinding>>
pub async fn enrich_findings( &self, findings: Vec<RawFinding>, codebase_path: &Path, ) -> Result<Vec<EnrichedFinding>>
Enrich multiple findings in a SINGLE OpenCode call
Batches all findings together and sends them to OpenCode once, which analyzes the codebase and returns enriched results for all. This is much faster than processing findings one-by-one.
Sourcepub async fn analyze_file(
&self,
file_path: &Path,
categories: &[&str],
) -> Result<Vec<RawFinding>>
pub async fn analyze_file( &self, file_path: &Path, categories: &[&str], ) -> Result<Vec<RawFinding>>
Analyze a file for potential issues
Uses OpenCode to scan a file and identify any marketplace-related issues that the local pipeline might have missed.
Auto Trait Implementations§
impl Freeze for OpenCodeClient
impl RefUnwindSafe for OpenCodeClient
impl Send for OpenCodeClient
impl Sync for OpenCodeClient
impl Unpin for OpenCodeClient
impl UnwindSafe for OpenCodeClient
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
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>
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>
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