kernel / core / alchemy / src / kernel-commit.tsmain at 949894f
// kernel-commit.ts — WHICH KERNEL A DEPLOY BUILDS: the commit of the checkout that the deploy
// runs in, and whether that checkout has changes that no commit holds. The mind Worker gets both
// in its config and records them on the mind's log (`mind/configured`), so a mind can always say
// which commit of its kernel repo it runs.
import { execFileSync } from "node:child_process";
export function kernelCommit(): { commit: string; dirty: boolean } {
const git = (...args: string[]) =>
execFileSync("git", args, { cwd: import.meta.dirname, encoding: "utf8" }).trim();
return { commit: git("rev-parse", "HEAD"), dirty: git("status", "--porcelain") !== "" };
}