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

Function setGoalProgress

src/index.js:1087–1100  ·  view source on GitHub ↗
(directory, sessionID, args = {})

Source from the content-addressed store, hash-verified

1085 const diff = await runProcess("git", ["diff", "--binary"], directory, 120_000)
1086 const staged = await runProcess("git", ["diff", "--cached", "--binary"], directory, 120_000)
1087 const prefix = `${timestamp}-${safeID(job.name || job.id)}`
1088 await fs.writeFile(path.join(checkpointDir, `${prefix}.status.txt`), status.stdout + status.stderr)
1089 await fs.writeFile(path.join(checkpointDir, `${prefix}.patch`), `${diff.stdout}\n${staged.stdout}`)
1090 if (job.gitCheckpoint) {
1091 await runProcess("git", ["add", "-A"], directory, 120_000)
1092 await runProcess("git", ["commit", "-m", `chore: opencode loop checkpoint ${timestamp}`], directory, 120_000)
1093 }
1094 await toast(client, `Loop checkpoint saved: ${prefix}`, "success")
1095}
1096
1097function updateSessionStatusFromEvent(event) {
1098 const sessionID = event?.properties?.sessionID
1099 if (typeof sessionID !== "string") return undefined
1100 if (event?.type === "session.idle") {
1101 sessionStatuses.set(sessionID, "idle")
1102 sessionStatusSeenAt.set(sessionID, now())
1103 return { sessionID, idle: true }

Callers 1

goalToolsFunction · 0.85

Calls 6

readStateFunction · 0.85
pickGoalJobFunction · 0.85
parseGoalToolTextFunction · 0.85
writeStateFunction · 0.85
writeGoalReportFunction · 0.85
appendLoopLogFunction · 0.85

Tested by

no test coverage detected