(repoUrl: string)
| 7 | import { pickCommits } from './pick-commits' |
| 8 | |
| 9 | export async function generateRepoEvalV2(repoUrl: string): Promise<void> { |
| 10 | console.log(`\n=== Git Evals V2: Generating Eval for ${repoUrl} ===\n`) |
| 11 | |
| 12 | console.log(`STEP 1: Picking commits for ${repoUrl}`) |
| 13 | const tmpDir = fs.mkdtempSync( |
| 14 | path.join(require('os').tmpdir(), 'git-evals2-'), |
| 15 | ) |
| 16 | const selectedCommitsOutputPath = path.join(tmpDir, 'selected-commits.json') |
| 17 | const clientSessionId = `gen-repo-eval-v2-${repoUrl}-${Date.now()}` |
| 18 | |
| 19 | await pickCommits({ |
| 20 | repoUrl, |
| 21 | outputPath: selectedCommitsOutputPath, |
| 22 | clientSessionId, |
| 23 | }) |
| 24 | |
| 25 | const selectedCommitsData = JSON.parse( |
| 26 | fs.readFileSync(selectedCommitsOutputPath, 'utf8'), |
| 27 | ) |
| 28 | const { repoUrl: gitRepoUrl, selectedCommits, repoName } = selectedCommitsData |
| 29 | |
| 30 | const commitShas = selectedCommits.map((c: any) => c.sha) |
| 31 | |
| 32 | console.log( |
| 33 | `\nSTEP 2: Generating V2 eval file for ${repoUrl} with ${commitShas.length} commits`, |
| 34 | ) |
| 35 | |
| 36 | const outputPath = path.join(__dirname, `eval-${repoName}-v2.json`) |
| 37 | |
| 38 | await generateEvalFileV2({ |
| 39 | repoUrl: gitRepoUrl, |
| 40 | commitShas, |
| 41 | outputPath, |
| 42 | }) |
| 43 | |
| 44 | console.log(`\n=== Eval Generation Complete ===`) |
| 45 | console.log(`Selected commits: ${selectedCommitsOutputPath}`) |
| 46 | console.log(`Final eval file: ${outputPath}`) |
| 47 | |
| 48 | fs.rmSync(tmpDir, { recursive: true, force: true }) |
| 49 | } |
| 50 | |
| 51 | if (require.main === module) { |
| 52 | const repoUrl = process.argv[2] |
no test coverage detected