Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/spark/src/coding-tools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export {
buildClaudeCommandForTest,
buildClaudeSmokeCommandForTest,
buildCodexCommandForTest,
buildCodexSmokeCommandForTest,
codingToolLabel,
discoverCodingTools,
parseClaudeEventForTest,
Expand Down
4 changes: 4 additions & 0 deletions packages/spark/src/coding-tools/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export const claudeAdapter: Adapter = {
command: commandPath,
args: [
"-p",
"--model",
"haiku",
"--effort",
"low",
"--verbose",
"--output-format",
"stream-json",
Expand Down
13 changes: 10 additions & 3 deletions packages/spark/src/coding-tools/codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ import {
stringField,
} from "./utils";

const CODEX_MODEL_ARGS = [
const CODEX_SMOKE_MODEL_ARGS = [
"--model",
"gpt-5.4-mini",
"-c",
'model_reasoning_effort="low"',
] as const;

const CODEX_RUN_MODEL_ARGS = [
"--model",
"gpt-5.5",
"-c",
Expand All @@ -33,7 +40,7 @@ export const codexAdapter: Adapter = {
"--json",
"--ephemeral",
"--skip-git-repo-check",
...CODEX_MODEL_ARGS,
...CODEX_SMOKE_MODEL_ARGS,
"-s",
"read-only",
"-C",
Expand All @@ -50,7 +57,7 @@ export const codexAdapter: Adapter = {
"--json",
"--ephemeral",
"--skip-git-repo-check",
...CODEX_MODEL_ARGS,
...CODEX_RUN_MODEL_ARGS,
"-s",
"danger-full-access",
"--dangerously-bypass-approvals-and-sandbox",
Expand Down
16 changes: 16 additions & 0 deletions packages/spark/src/coding-tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ export function buildClaudeCommandForTest(args: {
return adapterFor("claude").runCommand(args);
}

export function buildClaudeSmokeCommandForTest(args: {
readonly commandPath: string;
readonly cwd: string;
readonly prompt: string;
}): CommandSpec {
return adapterFor("claude").smokeCommand(args);
}

export function buildCodexCommandForTest(args: {
readonly commandPath: string;
readonly cwd: string;
Expand All @@ -109,6 +117,14 @@ export function buildCodexCommandForTest(args: {
return adapterFor("codex").runCommand(args);
}

export function buildCodexSmokeCommandForTest(args: {
readonly commandPath: string;
readonly cwd: string;
readonly prompt: string;
}): CommandSpec {
return adapterFor("codex").smokeCommand(args);
}

export function parseClaudeEventForTest(
value: unknown,
cwd: string,
Expand Down
42 changes: 42 additions & 0 deletions packages/spark/test/coding-tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { describe, expect, it } from "vitest";

import {
buildClaudeCommandForTest,
buildClaudeSmokeCommandForTest,
buildCodexCommandForTest,
buildCodexSmokeCommandForTest,
parseClaudeEventForTest,
parseClaudeEventsForTest,
parseClaudeStatusForTest,
Expand Down Expand Up @@ -115,6 +117,25 @@ describe("coding tool command construction", () => {
expect(spec.stdin).toBe("prompt");
});

it("builds low-cost Claude Code smoke command", () => {
const spec = buildClaudeSmokeCommandForTest({
commandPath: "/bin/claude",
cwd: CWD,
prompt: "prompt",
});

expect(spec.command).toBe("/bin/claude");
expect(spec.args).toContain("--model");
expect(spec.args).toContain("haiku");
expect(spec.args).toContain("--effort");
expect(spec.args).toContain("low");
expect(spec.args).toContain("--tools");
expect(spec.args).toContain("");
expect(spec.args).not.toContain("bypassPermissions");
expect(spec.args).not.toContain("--dangerously-skip-permissions");
expect(spec.stdin).toBe("prompt");
});

it("builds autonomous Codex command", () => {
const spec = buildCodexCommandForTest({
commandPath: "/bin/codex",
Expand All @@ -134,6 +155,27 @@ describe("coding tool command construction", () => {
expect(spec.args.at(-1)).toBe("-");
expect(spec.stdin).toBe("prompt");
});

it("builds low-cost Codex smoke command", () => {
const spec = buildCodexSmokeCommandForTest({
commandPath: "/bin/codex",
cwd: CWD,
prompt: "prompt",
});

expect(spec.command).toBe("/bin/codex");
expect(spec.args).toContain("--json");
expect(spec.args).toContain("--model");
expect(spec.args).toContain("gpt-5.4-mini");
expect(spec.args).toContain('model_reasoning_effort="low"');
expect(spec.args).toContain("read-only");
expect(spec.args).not.toContain("danger-full-access");
expect(spec.args).not.toContain(
"--dangerously-bypass-approvals-and-sandbox",
);
expect(spec.args.at(-1)).toBe("-");
expect(spec.stdin).toBe("prompt");
});
});

describe("coding tool event normalization", () => {
Expand Down
Loading