({
repoUrl,
outputPath,
clientSessionId,
limit = 200,
afterCommit,
}: {
repoUrl: string
outputPath?: string
clientSessionId: string
limit?: number
afterCommit?: string
})
| 473 | return selectedCommits |
| 474 | } |
| 475 | export async function pickCommits({ |
| 476 | repoUrl, |
| 477 | outputPath, |
| 478 | clientSessionId, |
| 479 | limit = 200, |
| 480 | afterCommit, |
| 481 | }: { |
| 482 | repoUrl: string |
| 483 | outputPath?: string |
| 484 | clientSessionId: string |
| 485 | limit?: number |
| 486 | afterCommit?: string |
| 487 | }): Promise<void> { |
| 488 | const repoName = extractRepoNameFromUrl(repoUrl) |
| 489 | console.log(`Picking commits from repository: ${repoName}`) |
| 490 | console.log(`Repository URL: ${repoUrl}`) |
| 491 | console.log(`Commit limit: ${limit}`) |
| 492 | |
| 493 | // Setup the test repository |
| 494 | console.log('Cloning repository...') |
| 495 | const repoPath = await setupTestRepo(repoUrl, repoName) |
| 496 | |
| 497 | // Get commits |
| 498 | if (afterCommit) { |
| 499 | console.log(`Fetching ${limit} commits after ${afterCommit}...`) |
| 500 | } else { |
| 501 | console.log(`Fetching last ${limit} commits...`) |
| 502 | } |
| 503 | const allCommits = getCommits(repoPath, limit, afterCommit) |
| 504 | console.log(`Found ${allCommits.length} commits`) |
| 505 | |
| 506 | // Apply basic filtering |
| 507 | console.log('Applying basic filters...') |
| 508 | const filteredCommits = basicFilter(allCommits) |
| 509 | console.log( |
| 510 | `${filteredCommits.length} commits remaining after basic filtering`, |
| 511 | ) |
| 512 | |
| 513 | if (filteredCommits.length === 0) { |
| 514 | console.log('No commits passed basic filtering. Exiting.') |
| 515 | return |
| 516 | } |
| 517 | |
| 518 | // Screen commits with GPT-5 |
| 519 | console.log('Screening commits with GPT-5...') |
| 520 | const selectedCommits = await screenCommitsWithGpt5( |
| 521 | filteredCommits, |
| 522 | repoUrl, |
| 523 | repoPath, |
| 524 | clientSessionId, |
| 525 | ) |
| 526 | console.log(`\nFinal selection: ${selectedCommits.length} commits`) |
| 527 | |
| 528 | // Create result object |
| 529 | const result: CommitPickerResult = { |
| 530 | repoUrl, |
| 531 | repoName, |
| 532 | generationDate: new Date().toISOString(), |
no test coverage detected