@@ -125,6 +125,7 @@ const VALUE_OPTIONS = new Set([
125125 "--head" ,
126126 "--base" ,
127127 "--mode" ,
128+ "--model" ,
128129 "--output-dir" ,
129130 "--plugin-path" ,
130131 "--python" ,
@@ -155,6 +156,7 @@ interface ScanArguments {
155156 head ? : string ;
156157 base ? : string ;
157158 mode: ScanMode ;
159+ model ? : string ;
158160 outputDir ? : string ;
159161 archiveExisting: boolean ;
160162 pluginPath ? : string ;
@@ -796,6 +798,9 @@ export async function main(
796798 . enum ( [ "standard" , "deep" ] )
797799 . default ( "standard" )
798800 . describe ( "Scan mode." ) ,
801+ model : optionValue ( "--model" )
802+ . optional ( )
803+ . describe ( "Model to use for the scan." ) ,
799804 outputDir : optionValue ( "--output-dir" )
800805 . optional ( )
801806 . describe ( "Write scan artifacts to DIR." ) ,
@@ -852,6 +857,7 @@ export async function main(
852857 ) ,
853858 examples : [
854859 { args : { repository : "." } } ,
860+ { args : { repository : "." } , options : { model : "gpt-5.6-terra" } } ,
855861 { args : { repository : "." } , options : { path : [ "src" , "tests" ] } } ,
856862 { args : { repository : "." } , options : { diff : "origin/main" } } ,
857863 ] ,
@@ -874,6 +880,7 @@ export async function main(
874880 head : options . head ,
875881 base : options . base ,
876882 mode : options . mode ,
883+ model : options . model ,
877884 outputDir : options . outputDir ,
878885 archiveExisting : options . archiveExisting ,
879886 pluginPath : options . pluginPath ,
@@ -918,6 +925,9 @@ export async function main(
918925 . describe ( "Directory for scan artifacts and resumable results." ) ,
919926 workers : z . number ( ) . int ( ) . positive ( ) . default ( 4 ) ,
920927 mode : z . enum ( [ "standard" , "deep" ] ) . default ( "standard" ) ,
928+ model : optionValue ( "--model" )
929+ . optional ( )
930+ . describe ( "Model to use for each repository." ) ,
921931 maxAttempts : z
922932 . number ( )
923933 . int ( )
@@ -947,9 +957,16 @@ export async function main(
947957 let outputDir : string ;
948958 let githubHost : string | undefined ;
949959 if ( args . input === undefined ) {
950- if ( argv . length !== 1 || argv [ 0 ] !== "bulk-scan" ) {
960+ if (
961+ argv [ 0 ] !== "bulk-scan" ||
962+ ! (
963+ argv . length === 1 ||
964+ ( argv . length === 3 && argv [ 1 ] === "--model" ) ||
965+ ( argv . length === 2 && argv [ 1 ] === `--model=${ options . model } ` )
966+ )
967+ ) {
951968 throw new Error (
952- "Run 'codex-security bulk-scan' without options to discover repositories, or provide a CSV and --output-dir." ,
969+ "Run 'codex-security bulk-scan [--model MODEL]' to discover repositories, or provide a CSV and --output-dir." ,
953970 ) ;
954971 }
955972 const wizard = await runBulkScanWizard (
@@ -984,7 +1001,7 @@ export async function main(
9841001 config : {
9851002 pluginPath : options . pluginPath ,
9861003 pythonPath : options . python ,
987- codexOverrides : parseCodexOverrides ( options . codex ) ,
1004+ codexOverrides : parseCodexOverrides ( options . codex , options . model ) ,
9881005 } ,
9891006 createSecurity : dependencies . createSecurity ,
9901007 signal : controller . signal ,
@@ -2021,7 +2038,8 @@ async function runScan(
20212038 pluginPath : arguments_ . pluginPath ,
20222039 pythonPath : arguments_ . pythonPath ,
20232040 codexOverrides :
2024- arguments_ . codexOverrides ?? parseCodexOverrides ( arguments_ . codex ) ,
2041+ arguments_ . codexOverrides ??
2042+ parseCodexOverrides ( arguments_ . codex , arguments_ . model ) ,
20252043 } ;
20262044 progress = new Progress ( errorOutput , dependencies , interactive ) ;
20272045 const scope = scanScope ( arguments_ ) ;
@@ -2402,8 +2420,12 @@ function targetFromArguments(arguments_: ScanArguments): ScanTarget {
24022420 return "repository" ;
24032421}
24042422
2405- export function parseCodexOverrides ( values : readonly string [ ] ) : JsonObject {
2423+ export function parseCodexOverrides (
2424+ values : readonly string [ ] ,
2425+ model ?: string ,
2426+ ) : JsonObject {
24062427 const result = Object . create ( null ) as JsonObject ;
2428+ if ( model !== undefined ) result [ "model" ] = model ;
24072429 for ( const value of values ) {
24082430 const separator = value . indexOf ( "=" ) ;
24092431 const key = separator < 0 ? "" : value . slice ( 0 , separator ) ;
@@ -2451,7 +2473,11 @@ export function parseCodexOverrides(values: readonly string[]): JsonObject {
24512473 }
24522474 const final = parts . at ( - 1 ) ! ;
24532475 if ( Object . hasOwn ( cursor , final ) ) {
2454- throw new CodexSecurityError ( "Duplicate --codex key" ) ;
2476+ throw new CodexSecurityError (
2477+ model !== undefined && key === "model"
2478+ ? "--model conflicts with --codex model"
2479+ : "Duplicate --codex key" ,
2480+ ) ;
24552481 }
24562482 cursor [ final ] = parsed ;
24572483 }
0 commit comments