2026-03-13 19:25:03 -07:00
|
|
|
import { spawnSync } from 'child_process';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
|
|
|
|
|
export async function runFixPlaybook(prNumber: string, targetDir: string, policyPath: string, geminiBin: string) {
|
2026-03-18 11:18:53 -07:00
|
|
|
console.log(`🚀 Workspace | FIX | PR #${prNumber}`);
|
2026-03-13 19:25:03 -07:00
|
|
|
console.log('Switching to agentic fix loop inside Gemini CLI...');
|
|
|
|
|
|
|
|
|
|
// Use the nightly gemini binary to activate the fix-pr skill and iterate
|
2026-03-18 12:16:59 -07:00
|
|
|
// Note: Gemini doesn't support --cwd, so the caller (worker.ts) must ensure we are already in targetDir
|
2026-03-13 19:25:03 -07:00
|
|
|
const result = spawnSync(geminiBin, [
|
|
|
|
|
'--policy', policyPath,
|
|
|
|
|
'-p', `Please activate the 'fix-pr' skill and use it to iteratively fix PR #${prNumber}.
|
|
|
|
|
Ensure you handle CI failures, merge conflicts, and unaddressed review comments
|
|
|
|
|
until the PR is fully passing and mergeable.`
|
|
|
|
|
], { stdio: 'inherit' });
|
|
|
|
|
|
2026-03-16 15:33:40 -07:00
|
|
|
return result?.status ?? 1;
|
2026-03-13 19:25:03 -07:00
|
|
|
}
|