feat: /optimize --continue überspringt Implementierungsphase

This commit is contained in:
Dieter Schlüter 2026-05-20 01:42:26 +02:00
commit 7cb299ff66
5 changed files with 43 additions and 14 deletions

View file

@ -547,31 +547,36 @@ export default function (pi: ExtensionAPI) {
// ── Automatische Optimierungsschleife ────────────────────────────────────
pi.registerCommand("optimize", {
description: "Coder→Judge→Fix-Schleife bis PASS + optional Doku. /optimize <auftrag> [--rounds N] [--with-doku]",
description: "Coder→Judge→Fix-Schleife bis PASS + optional Doku. /optimize <auftrag> [--rounds N] [--with-doku] [--continue]",
handler: async function (args: string, ctx: ExtensionCommandContext) {
const roundsMatch = (args || "").match(/--rounds\s+(\d+)/);
const maxRounds = roundsMatch ? Math.max(1, parseInt(roundsMatch[1], 10)) : 3;
const withDoku = /--with-doku/.test(args || "");
const continueMode = /--continue/.test(args || "");
const task = (args || "")
.replace(/--rounds\s+\d+/, "")
.replace(/--with-doku/, "")
.replace(/--continue/, "")
.trim();
if (!task) {
ctx.ui.notify("Benutzung: /optimize <auftrag> [--rounds N] [--with-doku]", "error");
if (!continueMode && !task) {
ctx.ui.notify("Benutzung: /optimize <auftrag> [--rounds N] [--with-doku] [--continue]", "error");
return;
}
// TASK.md anlegen
await writeTaskMd(pi, ctx, task);
ctx.ui.setStatus("optimize", `Starte Optimierung (max ${maxRounds} Runden)…`);
// Phase 1: Initiale Implementierung
ctx.ui.setStatus("optimize", "Phase 1: Coder implementiert…");
await switchModel(pi, ctx, "llama-cpp-coder", "qwen3.5-coder");
await sendAndWait(pi, ctx, coderKickoff(task));
await tickTaskMdStatus(pi, ctx, "Implementierung");
if (continueMode) {
// --continue: Implementierungsphase überspringen, direkt in Judge→Fix-Schleife
ctx.ui.setStatus("optimize", `Setze fort (max ${maxRounds} Runden Judge→Fix)…`);
ctx.ui.notify("--continue: Überspringe Implementierung, starte direkt mit Judge-Prüfung.", "info");
} else {
// TASK.md anlegen und Implementierung starten
await writeTaskMd(pi, ctx, task);
ctx.ui.setStatus("optimize", `Starte Optimierung (max ${maxRounds} Runden)…`);
ctx.ui.setStatus("optimize", "Phase 1: Coder implementiert…");
await switchModel(pi, ctx, "llama-cpp-coder", "qwen3.5-coder");
await sendAndWait(pi, ctx, coderKickoff(task));
await tickTaskMdStatus(pi, ctx, "Implementierung");
}
let lastBlockers = "";
let verdict = "";