Skip to main content

looprs_core/ports/
plugin_executor.rs

1//! PluginExecutor port — abstraction over named CLI tool execution.
2
3use std::ffi::OsString;
4use std::process::Output;
5
6/// Port: Execute named CLI tools (plugins).
7///
8/// Abstracts plugin execution so the domain layer can request tool
9/// execution without knowing about subprocess details or PATH resolution.
10pub trait PluginExecutor: Send + Sync {
11    fn has_tool(&self, tool: &str) -> bool;
12    fn execute_tool(&self, tool: &str, args: Vec<OsString>) -> std::io::Result<Output>;
13    fn execute_tool_if_available(&self, tool: &str, args: Vec<OsString>) -> Option<Output>;
14    fn probe_tool_success(&self, tool: &str, args: Vec<OsString>) -> bool;
15}