@@ -169,13 +169,40 @@ export async function runBuffBench(options: {
169169 agents : string [ ]
170170 taskConcurrency ?: number
171171 client ?: CodebuffClient
172+ taskIds ?: string [ ]
172173} ) {
173- const { evalDataPath, agents, taskConcurrency = 1 } = options
174+ const { evalDataPath, agents, taskConcurrency = 1 , taskIds } = options
174175
175176 const evalData : EvalDataV2 = JSON . parse (
176177 fs . readFileSync ( evalDataPath , 'utf-8' ) ,
177178 )
178- const commitsToRun = evalData . evalCommits
179+
180+ let commitsToRun : EvalDataV2 [ 'evalCommits' ]
181+ if ( taskIds && taskIds . length > 0 ) {
182+ const foundCommits : EvalDataV2 [ 'evalCommits' ] = [ ]
183+ const notFoundIds : string [ ] = [ ]
184+
185+ for ( const taskId of taskIds ) {
186+ const foundCommit = evalData . evalCommits . find ( ( c ) => c . id === taskId )
187+ if ( foundCommit ) {
188+ foundCommits . push ( foundCommit )
189+ } else {
190+ notFoundIds . push ( taskId )
191+ }
192+ }
193+
194+ if ( notFoundIds . length > 0 ) {
195+ const availableIds = evalData . evalCommits . map ( ( c ) => c . id ) . join ( ', ' )
196+ throw new Error (
197+ `Task ID(s) not found: ${ notFoundIds . join ( ', ' ) } . Available task IDs: ${ availableIds } ` ,
198+ )
199+ }
200+
201+ commitsToRun = foundCommits
202+ console . log ( `Running ${ foundCommits . length } task(s): ${ taskIds . join ( ', ' ) } ` )
203+ } else {
204+ commitsToRun = evalData . evalCommits
205+ }
179206
180207 const client =
181208 options . client ??
0 commit comments