Skip to content
Open
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
23 changes: 2 additions & 21 deletions sdk/typescript/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1292,28 +1292,9 @@ export async function main(
let outputDir: string;
let githubHost: string | undefined;
if (args.input === undefined) {
let optionIndex = 1;
while (optionIndex < argv.length) {
const argument = argv[optionIndex]!;
if (
argument === "--model" ||
argument === "--effort" ||
argument === "--codex"
) {
optionIndex += 2;
} else if (
argument.startsWith("--model=") ||
argument.startsWith("--effort=") ||
argument.startsWith("--codex=")
) {
optionIndex += 1;
} else {
break;
}
}
if (argv[0] !== "bulk-scan" || optionIndex !== argv.length) {
if (options.outputDir !== undefined) {
throw new Error(
"Run 'codex-security bulk-scan [--model MODEL] [--effort EFFORT] [--codex KEY=VALUE]' to discover repositories, or provide a CSV and --output-dir.",
"--output-dir can only be used with a repository CSV; omit it to choose an output directory interactively.",
);
}
const wizard = await runBulkScanWizard(
Expand Down
24 changes: 24 additions & 0 deletions sdk/typescript/tests-ts/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,12 @@ describe("CLI", () => {
["bulk-scan", "--codex", 'model_reasoning_effort="high"'],
["bulk-scan", '--codex=model_reasoning_effort="high"'],
["bulk-scan", "--model", "gpt-5.6-terra", "--effort", "high"],
["bulk-scan", "--workers", "8"],
["bulk-scan", "--workers=8"],
["bulk-scan", "--mode", "deep"],
["bulk-scan", "--max-attempts=3"],
["bulk-scan", "--plugin-path", "./plugin"],
["bulk-scan", "--python=python3"],
] as const) {
const stdout = capture();
const stderr = capture();
Expand Down Expand Up @@ -791,6 +797,24 @@ describe("CLI", () => {
expect(stdout.text()).toBe("");
});

test("lets the discovery wizard choose its output directory", async () => {
const stdout = capture();
const stderr = capture();

expect(
await main(
["bulk-scan", "--output-dir", "results"],
stdout.stream,
stderr.stream,
dependencies(),
),
).toBe(2);
expect(stderr.text()).toContain(
"--output-dir can only be used with a repository CSV",
);
expect(stdout.text()).toBe("");
});

test("exposes only typed, read-only SDK metadata over MCP", () => {
const child = spawnSync(
process.execPath,
Expand Down