INNER CODE UNIT · TypeScript
sourceHash
runvendo/vendo · packages/vendo/src/actions/sync/index.ts:205
async function sourceHash(root: string, srcPath: string, cache: Map<string, string | undefined>): Promise<string | undefined> {
if (!cache.has(srcPath)) {
try {
const text = await fs.readFile(path.resolve(root, srcPath), "utf8");
cache.set(srcPath, `sha256:${createHash("sha256").update(text.replace(/\r\n/g, "\n"), "utf8").digest("hex")}`);
} catch {
cache.set(srcPath, undefined);
}
}
return cache.get(srcPath);
}
/** Read for ONE reason: to report standing judgments this extraction stranded.
* Fail-soft, unlike `readOverrides` — a malformed judgments file is the judgment
* pass's own loud failure, the same call the runtime and doctor readers make, and
* sync must not refuse to extract because the AI layer's cache is unreadable. */
async function readJudgments(file: string): Promise<JudgmentsFile | null> {
let raw: string;