Skip to content

Commit 05cdd77

Browse files
committed
feat(cli): model auto and interactive run flags
1 parent 0fcf55b commit 05cdd77

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/main/java/io/github/easy4j/opencode/cli/OpenCodeRunOptions.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
* {@code --continue/-c}, {@code --session/-s}, {@code --fork}, {@code --share},
2727
* {@code --model/-m}, {@code --agent}, {@code --file/-f}, {@code --format},
2828
* {@code --title}, {@code --attach}, {@code --username/-u}, {@code --password/-p},
29-
* {@code --dir}, {@code --variant}, {@code --thinking} and {@code --port}.
29+
* {@code --dir}, {@code --variant}, {@code --thinking}, {@code --auto},
30+
* {@code --interactive} and {@code --port}.
3031
* The message is always emitted last as the positional argument.</p>
3132
*
3233
* @author <a href="https://github.com/loong10k">Loong Wan</a>
@@ -52,6 +53,8 @@ public class OpenCodeRunOptions {
5253
private String dir;
5354
private String variant;
5455
private boolean thinking;
56+
private boolean auto;
57+
private boolean interactive;
5558
private Integer port;
5659

5760
/**
@@ -121,6 +124,18 @@ public OpenCodeRunOptions(String message) {
121124
/** Sets the {@code --thinking} flag — show thinking blocks in output. */
122125
public OpenCodeRunOptions thinking(boolean v) { this.thinking = v; return this; }
123126

127+
/**
128+
* Sets the dangerous {@code --auto} permission auto-approval flag.
129+
* Disabled by default and must be opted into explicitly.
130+
*/
131+
public OpenCodeRunOptions auto(boolean v) { this.auto = v; return this; }
132+
133+
/**
134+
* Sets {@code --interactive}. This models the upstream flag only; terminal/PTY
135+
* lifecycle is handled separately from ordinary captured execution.
136+
*/
137+
public OpenCodeRunOptions interactive(boolean v) { this.interactive = v; return this; }
138+
124139
/** Sets the {@code --port} flag — port of the attached server. */
125140
public OpenCodeRunOptions port(Integer v) { this.port = v; return this; }
126141

@@ -151,6 +166,8 @@ public String[] toArgs() {
151166
if (dir != null) { args.add("--dir"); args.add(dir); }
152167
if (variant != null) { args.add("--variant"); args.add(variant); }
153168
if (thinking) { args.add("--thinking"); }
169+
if (auto) { args.add("--auto"); }
170+
if (interactive) { args.add("--interactive"); }
154171
if (port != null) { args.add("--port"); args.add(String.valueOf(port)); }
155172
if (message != null) { args.add(message); }
156173
return args.toArray(new String[0]);

0 commit comments

Comments
 (0)