(directory, sessionID, args = {})
| 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 | |
| 1076 | async 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) |
no test coverage detected