MCPcopy Create free account
hub / github.com/ByBrawe/opencode-loop / runGoalChecks

Function runGoalChecks

src/index.js:1102–1136  ·  view source on GitHub ↗
(directory, sessionID, job, client)

Source from the content-addressed store, hash-verified

1100 const completed = TERMINAL_COMPLETION_PATTERNS.some((pattern) => pattern.test(text));
1101 const noWork = TERMINAL_NO_WORK_PATTERNS.some((pattern) => pattern.test(text));
1102 return completed && noWork;
1103}
1104function continuationProjectInstruction(value) {
1105 if (!isContinuationShorthand(value) && !isCompletionBoundedContinuation(value))
1106 return "";
1107 const finish = isCompletionBoundedContinuation(value) ? " If you believe the project is finished, perform a fresh verification pass before declaring completion; report both that the project is complete and that no work remains only when you have concrete current evidence." : "";
1108 return `Treat this as continuation of the current project and conversation, not a fresh task. Inspect the repository state, relevant files, TODO/progress notes, recent changes, and git status as needed to identify the next unfinished step. Continue from existing work, do not redo completed work, and verify meaningful changes when practical.${finish}`;
1109}
1110
1111// src/source/core/jobs.js
1112function presetDefaults(name) {
1113 if (name === "loop-compact")
1114 return { intervalMs: parseDuration("200m"), action: "/compact", kind: "compact", name: "compact", immediate: false };
1115 if (name === "loop-command" || name === "loop-cmd")
1116 return { intervalMs: 0, kind: "command", name: "command", immediate: false };
1117 if (name === "loop-prompt")
1118 return { intervalMs: 0, kind: "prompt", name: "prompt", immediate: true };
1119 if (name === "loop-ask")
1120 return { intervalMs: 0, kind: "prompt", name: "ask", immediate: false };
1121 if (name === "loop-shell")
1122 return { intervalMs: 0, kind: "shell", name: "shell", immediate: false };
1123 if (name === "loop-testfix")
1124 return { intervalMs: 0, name: "testfix", safe: true, askNever: true, verifyCommand: "npm test", testfixPreset: true, action: "Run the project tests. Fix failures. Re-run the tests. Test command hint: npm test" };
1125 if (name === "loop-progress")
1126 return { intervalMs: 0, name: "progress", safe: true, askNever: true, progressFile: "progress.md", action: "Read progress.md and continue the next unfinished TODO. Mark completed TODOs with [x]. Add useful TODOs when you discover them." };
1127 if (name === "loop-safe-dev")
1128 return { intervalMs: 0, name: "safe-dev", safe: true, askNever: true, noOverlap: true, checkpointOnly: true, batch: 5, progressFile: "progress.md", action: "Develop the project from progress.md. Work in small safe batches. Mark completed TODOs with [x]. Add new ideas to progress.md. Run tests/lint/build if available." };
1129 return { intervalMs: 0, name: "dev", askNever: true, progressFile: "progress.md", action: "Continue developing the project from progress.md. Mark completed TODOs with [x]. Add new ideas to progress.md. Run tests/lint/build if available." };
1130}
1131function jobLabel(job) {
1132 const title = job.name ? `${job.name}: ` : "";
1133 const kind = job.kind ? ` [${job.kind}]` : "";
1134 const limit = job.maxRuns > 0 ? `, max ${job.maxRuns}` : "";
1135 const runtime = job.maxRuntimeMs > 0 ? `, runtime ${durationToText(job.maxRuntimeMs)}` : "";
1136 const timeout = job.timeoutMs > 0 ? `, timeout ${durationToText(job.timeoutMs)}` : "";
1137 const compact = job.compactEveryRuns > 0 ? `, compact every ${job.compactEveryRuns} runs` : job.compactEveryMs > 0 ? `, compact every ${durationToText(job.compactEveryMs)}` : "";
1138 const verify = job.verifyCommand ? ", verify" : "";
1139 const preflight = job.preflightCommand ? ", preflight" : "";

Callers 1

finalizeActiveRunFunction · 0.85

Calls 6

isGoalJobFunction · 0.85
dangerousShellFunction · 0.85
runShellCommandFunction · 0.85
nowFunction · 0.85
toastFunction · 0.85
appendLoopLogFunction · 0.85

Tested by

no test coverage detected