diff --git a/sdk/typescript/src/cli.ts b/sdk/typescript/src/cli.ts index 30dc6f4..7161517 100644 --- a/sdk/typescript/src/cli.ts +++ b/sdk/typescript/src/cli.ts @@ -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( diff --git a/sdk/typescript/tests-ts/cli.test.ts b/sdk/typescript/tests-ts/cli.test.ts index d16b6db..656c7af 100644 --- a/sdk/typescript/tests-ts/cli.test.ts +++ b/sdk/typescript/tests-ts/cli.test.ts @@ -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(); @@ -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,