Skip to content

Commit 096432e

Browse files
committed
test(cli): cover the exec credential default and pinned-config flags
1 parent 236a6bd commit 096432e

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

‎src/cli/program/register.agent.test.ts‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,37 @@ describe("agent command registration", () => {
213213
codeMode: "code",
214214
localModelLean: true,
215215
fallback: ["anthropic/claude-sonnet-4-6", "google/gemini-3.1-pro-preview"],
216-
authEnvOnly: true,
216+
// Stored credentials are the default so exec reaches the same logins as
217+
// the rest of the CLI; --auth-env-only is the opt-in restriction.
218+
authEnvOnly: false,
219+
isolated: false,
217220
timeout: "600",
218221
json: true,
219222
}),
220223
runtime,
221224
);
222225
});
223226

227+
it("restricts credentials and config to the process environment with --auth-env-only", async () => {
228+
await runCli(["agent", "exec", "fix it", "--auth-env-only"]);
229+
230+
expect(agentExecCommandMock).toHaveBeenCalledWith(
231+
"fix it",
232+
expect.objectContaining({ authEnvOnly: true }),
233+
runtime,
234+
);
235+
});
236+
237+
it("forwards the pinned-config and isolated run flags", async () => {
238+
await runCli(["agent", "exec", "fix it", "--config", "/tmp/ci.json", "--isolated"]);
239+
240+
expect(agentExecCommandMock).toHaveBeenCalledWith(
241+
"fix it",
242+
expect.objectContaining({ config: "/tmp/ci.json", isolated: true }),
243+
runtime,
244+
);
245+
});
246+
224247
it("accepts parent options before the nested exec command", async () => {
225248
await runCli(["agent", "--model", "openai/gpt-5.6-sol", "exec", "fix it", "--json"]);
226249

0 commit comments

Comments
 (0)