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

Function setGoalBlocked

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

Source from the content-addressed store, hash-verified

1067 const full = path.join(current, entry.name)
1068 if (entry.isDirectory()) { if (await walk(full)) return true }
1069 else if (entry.isFile() && /\.(md|txt|json|yaml|yml)$/i.test(entry.name)) { scanned++; if (await fileContains(full, job.until)) return true }
1070 }
1071 return false
1072 }
1073 return await walk(directory)
1074}
1075
1076async function createCheckpoint(directory, sessionID, job, client) {
1077 if (!job.checkpointOnly && !job.gitCheckpoint) return
1078 const inRepo = await runProcess("git", ["rev-parse", "--is-inside-work-tree"], directory, 10_000)
1079 if (inRepo.code !== 0) return
1080 const status = await runProcess("git", ["status", "--short"], directory, 30_000)
1081 if (!status.stdout.trim()) return
1082 const timestamp = new Date().toISOString().replace(/[:.]/g, "-")
1083 const checkpointDir = path.join(stateDir(directory), "checkpoints", safeID(sessionID))
1084 await ensureDir(checkpointDir)
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)

Callers 2

blockGoalCommandFunction · 0.85
goalToolsFunction · 0.85

Calls 7

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

Tested by

no test coverage detected