Roo-Code/apps/web-evals/src/actions/exercises.ts
2025-06-10 11:01:54 -07:00

22 lines
675 B
TypeScript

"use server"
import * as path from "path"
import { fileURLToPath } from "url"
import { exerciseLanguages, listDirectories } from "@roo-code/evals"
const __dirname = path.dirname(fileURLToPath(import.meta.url)) // <repo>/apps/web-evals/src/actions
const EVALS_REPO_PATH = path.resolve(__dirname, "../../../../../evals")
export const getExercises = async () => {
const result = await Promise.all(
exerciseLanguages.map(async (language) => {
const languagePath = path.join(EVALS_REPO_PATH, language)
const exercises = await listDirectories(__dirname, languagePath)
return exercises.map((exercise) => `${language}/${exercise}`)
}),
)
return result.flat()
}