Files
upstream-atomic-crm/.claude/hooks/lib/progress-log.mjs
upstream-mirror 93ecc1a6f8
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
snapshot of https://github.com/marmelab/atomic-crm.git (main, 2026-09-18; blobs > 131072B omitted)
2026-09-18 01:48:50 +05:00

33 lines
1.5 KiB
JavaScript

// Append a timestamped line to the #technical-harness progress log, but ONLY when
// that log already exists.
//
// Its existence is the technical-run gate: the orchestrator creates
// <sessionDir>/harness-progress.log under PERSONA: technical, render-status reads it,
// and a web-chat / normal run has none. Enrichers (validate-on-stop) call this to
// fill the otherwise-silent stretches BETWEEN the orchestrator's milestones, e.g.
// the multi-minute validation chain a developer runs on stop, so a `tail -f`, the
// board's "Recent activity", or a Monitor shows what is happening instead of going
// dark. Best-effort: logging must never break a run, and it never CREATES the log
// (creating it would leak a board into a non-technical run).
import { appendFileSync, existsSync } from "node:fs";
import { join } from "node:path";
/**
* @param {string} sessionDir The harness session dir (ctx.sessionDir).
* @param {string} line Event text; a `HH:MM:SS ` UTC stamp is prepended to match
* the orchestrator's own lines.
* @returns {boolean} true if a line was written, false if the log was absent/unwritable.
*/
export function appendProgress(sessionDir, line) {
try {
const file = join(sessionDir, "harness-progress.log");
if (!existsSync(file)) return false; // not a technical run -> stay inert
const stamp = new Date().toISOString().slice(11, 19); // HH:MM:SS UTC
appendFileSync(file, `${stamp} ${line}\n`);
return true;
} catch {
return false;
}
}