Package io.github.easy4j.opencode.cli
Class OpenCodeCliExecutor
java.lang.Object
io.github.easy4j.opencode.cli.OpenCodeCliExecutor
Executor for the local
opencode CLI subprocess.
Uses Apache Commons Exec to launch the opencode binary with the configured
arguments, capturing stdout and stderr. Supports timeout via ExecuteWatchdog
and working directory configuration.
- Since:
- 1.0.0
- Author:
- Loong Wan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenCodeCliExecutor(OpenCodeCliConfig config) 创建 open code cli executor 实例,并按传入依赖确定资源所有权。 -
Method Summary
Modifier and TypeMethodDescription同步执行 CLI 命令,返回执行结果。booleanprobe()探测 CLI 是否可用(执行opencode --version)。
-
Constructor Details
-
OpenCodeCliExecutor
创建 open code cli executor 实例,并按传入依赖确定资源所有权。- Parameters:
config- 客户端配置;不得为null
-
-
Method Details
-
execute
同步执行 CLI 命令,返回执行结果。- Parameters:
args- 传递给 OpenCode CLI 的参数数组;每项独立转义- Returns:
- CLI 的退出状态、标准输出和错误输出
-
probe
public boolean probe()探测 CLI 是否可用(执行opencode --version)。- Returns:
- 操作成功返回
true,否则返回false
-