Skip to content

Commit df0f3c5

Browse files
committed
test: add JUnit tests (>=90% coverage); docs: comprehensive English JavaDoc
1 parent 1a4aa88 commit df0f3c5

154 files changed

Lines changed: 4205 additions & 911 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/main/java/io/github/easy4j/opencli/OpenCliClient.java‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,18 @@
2323
import lombok.Getter;
2424

2525
/**
26-
* OpenCLI Java SDK 入口:持有一组运行时配置与共享 {@link OpenCliExecutor}。
27-
*/
28-
public class OpenCliClient {
26+
* Entry point for the OpenCLI Java SDK. Holds a set of runtime configuration properties
27+
and a shared {@link OpenCliExecutor}.
28+
*
29+
* <p>Usage example:</p>
30+
* <pre>{@code
31+
* OpenCliClient client = new OpenCliClient();
32+
* OpenCliResult result = client.chatgpt().ask("hello", null, null);
33+
* }</pre>
34+
*
35+
* @author [@Loong Wan](https://github.com/loong10k)
36+
* @since 3.0.0
37+
*/public class OpenCliClient {
2938

3039
@Getter
3140
private final OpenCliProperties properties;
@@ -34,7 +43,7 @@ public class OpenCliClient {
3443
private final OpenCliExecutor executor;
3544

3645
/**
37-
* 使用默认配置构造(可执行文件假定名为 {@code opencli})。
46+
* Constructs with default configuration (executable assumed to be {@code opencli} on PATH).
3847
*/
3948
public OpenCliClient() {
4049
this(new OpenCliProperties());

‎src/main/java/io/github/easy4j/opencli/OpenCliExecutionTarget.java‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package io.github.easy4j.opencli;
22

33
/**
4-
* OpenCLI 命令实际执行位置:本机子进程或与 opencli-admin 兼容的远端 Agent HTTP API。
5-
*/
6-
public enum OpenCliExecutionTarget {
4+
* Determines where an OpenCLI command is executed: as a local subprocess or via a remote
5+
Agent HTTP API compatible with opencli-admin.
6+
*
7+
* @author [@Loong Wan](https://github.com/loong10k)
8+
* @since 3.0.0
9+
*/public enum OpenCliExecutionTarget {
710

811
/**
9-
* 在本机通过 {@link OpenCliProperties} 的 {@code executable} 配置启动子进程(默认)。
12+
* Launch a subprocess on the local machine using the {@code executable} configured in {@link OpenCliProperties} (default).
1013
*/
1114
LOCAL_PROCESS,
1215

‎src/main/java/io/github/easy4j/opencli/OpenCliProperties.java‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import lombok.Data;
88

99
/**
10-
* OpenCLI 运行时配置(纯 POJO,无 Spring 耦合)。
10+
* OpenCLI runtime configuration POJO with no Spring dependency.
1111
* <p>
1212
* 描述可执行文件、工作目录、超时、全局 argv 前缀、远端 Agent 以及需要注入子进程的环境变量
1313
*(例如 {@code OPENCLI_CDP_ENDPOINT})。Spring Boot 可由上层以
@@ -18,7 +18,26 @@
1818
* {@link OpenCliExecutionTarget#REMOTE_AGENT_HTTP} 模式下用作 HTTP 客户端超时上限。
1919
* </p>
2020
*/
21-
@Data
21+
@Data/**
22+
23+
* OpenCLI runtime configuration POJO with no Spring dependency.
24+
*
25+
* <p>Describes the executable path, working directory, timeout, global argv prefix,
26+
* remote Agent settings, and environment variables injected into the subprocess
27+
* (e.g.&nbsp;{@code OPENCLI_CDP_ENDPOINT}). Spring Boot applications can bind these
28+
* fields via {@code @ConfigurationProperties(prefix = "opencli")}.</p>
29+
*
30+
* <p>{@link #commandTimeoutMillis} is used as the subprocess watchdog timeout in local
31+
* mode and as the HTTP client timeout in {@link OpenCliExecutionTarget#REMOTE_AGENT_HTTP} mode.</p>
32+
33+
*
34+
35+
* @author [@Loong Wan](https://github.com/loong10k)
36+
37+
* @since 3.0.0
38+
39+
*/
40+
2241
public class OpenCliProperties {
2342

2443
/**

‎src/main/java/io/github/easy4j/opencli/adapter/browser/chatgpt/ChatgptOpenCliClient.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,21 @@
1818
/**
1919
* OpenCLI {@code chatgpt}(ChatGPT Web)浏览器适配器。
2020
*/
21-
@RequiredArgsConstructor
21+
@RequiredArgsConstructor/**
22+
23+
* OpenCLI {@code chatgpt} (ChatGPT Web) browser adapter client.
24+
*
25+
* <p>Provides typed methods for ChatGPT Web interactions such as {@code ask}, {@code send},
26+
* {@code history}, {@code image}, and session management.</p>
27+
28+
*
29+
30+
* @author [@Loong Wan](https://github.com/loong10k)
31+
32+
* @since 3.0.0
33+
34+
*/
35+
2236
public final class ChatgptOpenCliClient {
2337

2438
private final OpenCliExecutor executor;

‎src/main/java/io/github/easy4j/opencli/adapter/browser/claude/ClaudeOpenCliClient.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,21 @@
1919
/**
2020
* OpenCLI {@code claude} 浏览器适配器。
2121
*/
22-
@RequiredArgsConstructor
22+
@RequiredArgsConstructor/**
23+
24+
* OpenCLI {@code claude} browser adapter client.
25+
*
26+
* <p>Provides typed methods for Claude Web interactions such as {@code ask}, {@code send},
27+
* {@code history}, {@code detail}, and session management.</p>
28+
29+
*
30+
31+
* @author [@Loong Wan](https://github.com/loong10k)
32+
33+
* @since 3.0.0
34+
35+
*/
36+
2337
public final class ClaudeOpenCliClient {
2438

2539
private final OpenCliExecutor executor;

‎src/main/java/io/github/easy4j/opencli/adapter/browser/deepseek/DeepseekOpenCliClient.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,21 @@
1818
/**
1919
* OpenCLI {@code deepseek} 浏览器适配器。
2020
*/
21-
@RequiredArgsConstructor
21+
@RequiredArgsConstructor/**
22+
23+
* OpenCLI {@code deepseek} browser adapter client.
24+
*
25+
* <p>Provides typed methods for DeepSeek Web interactions such as {@code ask}, {@code send},
26+
* {@code history}, {@code detail}, and session management.</p>
27+
28+
*
29+
30+
* @author [@Loong Wan](https://github.com/loong10k)
31+
32+
* @since 3.0.0
33+
34+
*/
35+
2236
public final class DeepseekOpenCliClient {
2337

2438
private final OpenCliExecutor executor;

‎src/main/java/io/github/easy4j/opencli/adapter/browser/gemini/GeminiOpenCliClient.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,21 @@
1616
/**
1717
* OpenCLI {@code gemini} 浏览器适配器。
1818
*/
19-
@RequiredArgsConstructor
19+
@RequiredArgsConstructor/**
20+
21+
* OpenCLI {@code gemini} browser adapter client.
22+
*
23+
* <p>Provides typed methods for Gemini Web interactions such as {@code ask}, {@code image},
24+
* {@code deepResearch}, {@code history}, and session management.</p>
25+
26+
*
27+
28+
* @author [@Loong Wan](https://github.com/loong10k)
29+
30+
* @since 3.0.0
31+
32+
*/
33+
2034
public final class GeminiOpenCliClient {
2135

2236
private final OpenCliExecutor executor;

‎src/main/java/io/github/easy4j/opencli/adapter/browser/jimeng/JimengOpenCliClient.java‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,22 @@
1515
/**
1616
* OpenCLI {@code jimeng}(即梦)浏览器适配器。
1717
*/
18-
@RequiredArgsConstructor
18+
@RequiredArgsConstructor/**
19+
20+
* OpenCLI {@code jimeng} (Jimeng/JiMeng) browser adapter client.
21+
*
22+
* <p>Provides typed methods for Jimeng generative media interactions including
23+
* text-to-image, image-to-image, text-to-video, image-to-video, audio generation,
24+
* digital human, and action copy.</p>
25+
26+
*
27+
28+
* @author [@Loong Wan](https://github.com/loong10k)
29+
30+
* @since 3.0.0
31+
32+
*/
33+
1934
public final class JimengOpenCliClient {
2035

2136
private final OpenCliExecutor executor;

‎src/main/java/io/github/easy4j/opencli/adapter/browser/support/BrowserLlmOptions.java‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@
99
* 浏览器侧 LLM 适配器常用的超时、是否新开会话、JSON 输出等选项。
1010
*/
1111
@Data
12-
@Builder
12+
@Builder/**
13+
14+
* Common options shared across browser-based LLM adapters (timeout, model selection,
15+
* new-chat toggle, JSON output, etc.).
16+
17+
*
18+
19+
* @author [@Loong Wan](https://github.com/loong10k)
20+
21+
* @since 3.0.0
22+
23+
*/
24+
1325
public class BrowserLlmOptions {
1426

1527
private Integer timeoutSeconds;

‎src/main/java/io/github/easy4j/opencli/adapter/desktop/codex/CodexOpenCliClient.java‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,21 @@
1414
/**
1515
* OpenCLI {@code codex} 桌面适配器封装(Chrome DevTools / Electron)。
1616
*/
17-
@RequiredArgsConstructor
17+
@RequiredArgsConstructor/**
18+
19+
* OpenCLI {@code codex} desktop adapter client (Chrome DevTools / Electron).
20+
*
21+
* <p>Provides typed methods for Codex desktop interactions such as {@code send}, {@code ask},
22+
* {@code read}, {@code projects}, {@code history}, model management, and conversation export.</p>
23+
24+
*
25+
26+
* @author [@Loong Wan](https://github.com/loong10k)
27+
28+
* @since 3.0.0
29+
30+
*/
31+
1832
public final class CodexOpenCliClient {
1933

2034
private final OpenCliExecutor executor;

0 commit comments

Comments
 (0)