Skip to content

Commit 0ba7351

Browse files
committed
Allow scan options during bulk discovery
1 parent 3bf2621 commit 0ba7351

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

sdk/typescript/src/cli.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,28 +1292,9 @@ export async function main(
12921292
let outputDir: string;
12931293
let githubHost: string | undefined;
12941294
if (args.input === undefined) {
1295-
let optionIndex = 1;
1296-
while (optionIndex < argv.length) {
1297-
const argument = argv[optionIndex]!;
1298-
if (
1299-
argument === "--model" ||
1300-
argument === "--effort" ||
1301-
argument === "--codex"
1302-
) {
1303-
optionIndex += 2;
1304-
} else if (
1305-
argument.startsWith("--model=") ||
1306-
argument.startsWith("--effort=") ||
1307-
argument.startsWith("--codex=")
1308-
) {
1309-
optionIndex += 1;
1310-
} else {
1311-
break;
1312-
}
1313-
}
1314-
if (argv[0] !== "bulk-scan" || optionIndex !== argv.length) {
1295+
if (options.outputDir !== undefined) {
13151296
throw new Error(
1316-
"Run 'codex-security bulk-scan [--model MODEL] [--effort EFFORT] [--codex KEY=VALUE]' to discover repositories, or provide a CSV and --output-dir.",
1297+
"--output-dir can only be used with a repository CSV; omit it to choose an output directory interactively.",
13171298
);
13181299
}
13191300
const wizard = await runBulkScanWizard(

sdk/typescript/tests-ts/cli.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,12 @@ describe("CLI", () => {
756756
["bulk-scan", "--codex", 'model_reasoning_effort="high"'],
757757
["bulk-scan", '--codex=model_reasoning_effort="high"'],
758758
["bulk-scan", "--model", "gpt-5.6-terra", "--effort", "high"],
759+
["bulk-scan", "--workers", "8"],
760+
["bulk-scan", "--workers=8"],
761+
["bulk-scan", "--mode", "deep"],
762+
["bulk-scan", "--max-attempts=3"],
763+
["bulk-scan", "--plugin-path", "./plugin"],
764+
["bulk-scan", "--python=python3"],
759765
] as const) {
760766
const stdout = capture();
761767
const stderr = capture();
@@ -791,6 +797,24 @@ describe("CLI", () => {
791797
expect(stdout.text()).toBe("");
792798
});
793799

800+
test("lets the discovery wizard choose its output directory", async () => {
801+
const stdout = capture();
802+
const stderr = capture();
803+
804+
expect(
805+
await main(
806+
["bulk-scan", "--output-dir", "results"],
807+
stdout.stream,
808+
stderr.stream,
809+
dependencies(),
810+
),
811+
).toBe(2);
812+
expect(stderr.text()).toContain(
813+
"--output-dir can only be used with a repository CSV",
814+
);
815+
expect(stdout.text()).toBe("");
816+
});
817+
794818
test("exposes only typed, read-only SDK metadata over MCP", () => {
795819
const child = spawnSync(
796820
process.execPath,

0 commit comments

Comments
 (0)