Review-korjausluuppi: DevOps tarkistaa korjaukset, max 2 kierrosta
Pipeline: 1. DevOps review → löytää virheitä 2. Koodari korjaa → päivittää files-objektin 3. DevOps review (kierros 2) → tarkistaa korjaukset 4. Jos yhä virheitä → Koodari korjaa uudelleen 5. LGTM tai max 2 kierrosta → eteenpäin Terminaalissa näkyy kierrosnumero: "koodikatselmointi (kierros 2)" LGTM merkitään vihreällä ✓-merkillä. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -792,22 +792,37 @@ OUTPUT FORMAT:
|
|||||||
const allCode = Object.entries(files).map(([n,c]) => `--- ${n} ---\n${c}`).join('\n\n');
|
const allCode = Object.entries(files).map(([n,c]) => `--- ${n} ---\n${c}`).join('\n\n');
|
||||||
let stepN = template.order.length + 1;
|
let stepN = template.order.length + 1;
|
||||||
|
|
||||||
// DevOps/Testaaja: koodikatselmointi
|
// Review-korjausluuppi: max 2 kierrosta
|
||||||
const tst = agents.tester || Object.values(agents)[4];
|
const tst = agents.tester || Object.values(agents)[4];
|
||||||
termLog(`\n<span style="color:var(--accent);font-weight:bold">[${stepN}] ${esc(tst.name)}</span> — koodikatselmointi`);
|
const MAX_REVIEW_ROUNDS = 2;
|
||||||
highlightAgent('tester');
|
|
||||||
explainStep('Koodikatselmointi', `${tst.name} tarkistaa importit, nimeämiset, virheenkäsittelyn ja tiedostojen yhteensopivuuden.`);
|
|
||||||
const tstPrompt = (tst.prompt ? tst.prompt+'\n\n' : '') + `Review this project:\n\n${allCode}`;
|
|
||||||
const review = await kpnRun(tst.model, tstPrompt);
|
|
||||||
stepN++;
|
|
||||||
|
|
||||||
// Korjausluuppi (jos tarpeen) — korjatut tiedostot päivitetään files-objektiin
|
for (let round = 0; round < MAX_REVIEW_ROUNDS; round++) {
|
||||||
if (review && !review.toLowerCase().includes('lgtm')) {
|
const currentCode = Object.entries(files).map(([n,c]) => `--- ${n} ---\n${c}`).join('\n\n');
|
||||||
termLog(`\n<span style="color:#d29922;font-weight:bold">[${stepN}] ${esc(cdr.name)}</span> — korjaukset`);
|
|
||||||
|
// DevOps review
|
||||||
|
termLog(`\n<span style="color:var(--accent);font-weight:bold">[${stepN}] ${esc(tst.name)}</span> — koodikatselmointi${round > 0 ? ' (kierros '+(round+1)+')' : ''}`);
|
||||||
|
highlightAgent('tester');
|
||||||
|
if (round === 0) explainStep('Koodikatselmointi', `${tst.name} analysoi koodin rivi riviltä: importit, nimeämiset, virheenkäsittely, tietoturva.`);
|
||||||
|
else explainStep('Uudelleentarkistus', `${tst.name} tarkistaa korjaukset.`);
|
||||||
|
|
||||||
|
const reviewPrompt = (tst.prompt ? tst.prompt+'\n\n' : '') + `Review this project:\n\n${currentCode}`;
|
||||||
|
const review = await kpnRun(tst.model, reviewPrompt);
|
||||||
|
stepN++;
|
||||||
|
|
||||||
|
// LGTM → ei korjauksia tarvita
|
||||||
|
if (!review || review.toLowerCase().includes('lgtm')) {
|
||||||
|
termLog(` <span style="color:#3fb950">✓ ${esc(tst.name)}: LGTM</span>`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Korjaukset
|
||||||
|
termLog(`\n<span style="color:#d29922;font-weight:bold">[${stepN}] ${esc(cdr.name)}</span> — korjaukset${round > 0 ? ' (kierros '+(round+1)+')' : ''}`);
|
||||||
highlightAgent('coder');
|
highlightAgent('coder');
|
||||||
explainStep('Korjausluuppi', `${tst.name} löysi ongelmia. ${cdr.name} korjaa ja palauttaa päivitetyt tiedostot.`);
|
explainStep('Korjaus', `${tst.name} löysi ongelmia. ${cdr.name} saa palautteen ja korjaa.`);
|
||||||
const fixPrompt = `${cdr.prompt ? cdr.prompt+'\n\n' : ''}Fix these issues:\n${review}\n\nCurrent code:\n${allCode}\n\nWrite ALL corrected files. Start each file with: --- filename.py ---`;
|
|
||||||
|
const fixPrompt = `${cdr.prompt ? cdr.prompt+'\n\n' : ''}Fix these issues:\n${review}\n\nCurrent code:\n${currentCode}\n\nWrite ALL corrected files. Start each file with: --- filename.py ---`;
|
||||||
const fixedCode = await kpnRun(cdr.model, fixPrompt);
|
const fixedCode = await kpnRun(cdr.model, fixPrompt);
|
||||||
|
|
||||||
// Parsitaan korjatut tiedostot takaisin files-objektiin
|
// Parsitaan korjatut tiedostot takaisin files-objektiin
|
||||||
if (fixedCode) {
|
if (fixedCode) {
|
||||||
const fixedParts = fixedCode.split(/^---\s*(\S+)\s*---$/m);
|
const fixedParts = fixedCode.split(/^---\s*(\S+)\s*---$/m);
|
||||||
@@ -820,7 +835,7 @@ OUTPUT FORMAT:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stepN++;
|
stepN++;
|
||||||
}
|
} // for review round
|
||||||
|
|
||||||
// Päivitetään allCode korjausten jälkeen
|
// Päivitetään allCode korjausten jälkeen
|
||||||
const updatedCode = Object.entries(files).map(([n,c]) => `--- ${n} ---\n${c}`).join('\n\n');
|
const updatedCode = Object.entries(files).map(([n,c]) => `--- ${n} ---\n${c}`).join('\n\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user