@@ -3,7 +3,7 @@ import * as path from "path"
33
44import pWaitFor from "p-wait-for"
55import { execa , parseCommandString } from "execa"
6- import { build , GluegunToolbox } from "gluegun "
6+ import { command , run , number , positional } from "cmd-ts "
77import psTree from "ps-tree"
88
99import { RooCodeEventName , IpcOrigin , IpcMessageType , TaskCommandName } from "@roo-code/types"
@@ -20,7 +20,7 @@ import {
2020 updateTaskMetrics ,
2121 createToolError ,
2222} from "../db/index.js"
23- import { __dirname , extensionDevelopmentPath , exercisesPath , type ExerciseLanguage } from "../exercises/index.js"
23+ import { type ExerciseLanguage , exercisesPath } from "../exercises/index.js"
2424
2525type TaskResult = { success : boolean }
2626type TaskPromise = Promise < TaskResult >
@@ -37,14 +37,7 @@ const testCommands: Record<ExerciseLanguage, { commands: string[]; timeout?: num
3737 rust : { commands : [ "cargo test" ] } , // timeout 15s bash -c "cd '$dir' && cargo test > /dev/null 2>&1"
3838}
3939
40- const run = async ( toolbox : GluegunToolbox ) => {
41- const { config } = toolbox
42- const id = config . runId ? Number ( config . runId ) : undefined
43-
44- if ( ! id ) {
45- throw new Error ( "Run ID is required." )
46- }
47-
40+ const runEvals = async ( id : number ) => {
4841 const run = await findRun ( id )
4942 const tasks = await getTasks ( run . id )
5043
@@ -425,43 +418,23 @@ const runUnitTest = async ({ task }: { task: Task }) => {
425418}
426419
427420const main = async ( ) => {
428- const cli = build ( )
429- . brand ( "cli" )
430- . src ( __dirname )
431- . help ( )
432- . version ( )
433- . command ( {
434- name : "run" ,
435- description : "Run an eval" ,
436- run : ( { config, parameters } ) => {
437- config . language = parameters . first
438- config . exercise = parameters . second
439-
440- if ( parameters . options [ "runId" ] ) {
441- config . runId = parameters . options [ "runId" ]
442- }
421+ const result = await run (
422+ command ( {
423+ name : "cli" ,
424+ description : "Execute an eval run." ,
425+ version : "0.0.0" ,
426+ args : {
427+ runId : positional ( { type : number , displayName : "runId" } ) ,
443428 } ,
444- } )
445- . defaultCommand ( )
446- . create ( )
447-
448- const toolbox = await cli . run ( process . argv )
449- const { command } = toolbox
450-
451- switch ( command ?. name ) {
452- case "run" :
453- await run ( toolbox )
454- break
455- }
429+ handler : ( args ) => runEvals ( args . runId ) ,
430+ } ) ,
431+ process . argv . slice ( 2 ) ,
432+ )
456433
434+ console . log ( result )
457435 process . exit ( 0 )
458436}
459437
460- if ( ! fs . existsSync ( extensionDevelopmentPath ) ) {
461- console . error ( `"extensionDevelopmentPath" does not exist.` )
462- process . exit ( 1 )
463- }
464-
465438if ( ! fs . existsSync ( exercisesPath ) ) {
466439 console . error (
467440 `Exercises do not exist at ${ exercisesPath } . Please run "git clone https://github.com/RooCodeInc/Roo-Code-Evals.git evals".` ,
0 commit comments