import fs from 'node:fs'; import path from 'node:path'; import { execFileSync } from 'node:child_process'; export function inspectGooseBaseline(root, expectedVersion) { const manifest = fs.readFileSync(path.join(root, 'Cargo.toml'), 'utf8'); const version = manifest.match(/^version\s*=\s*"([^"]+)"/m)?.[1]; if (version !== expectedVersion) { throw new Error(`Baseline version mismatch: ${root} is ${version ?? 'unknown'}, expected ${expectedVersion}`); } const git = (...args) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8' }).trim(); return { root, version, commit: git('rev-parse', 'HEAD'), dirty: Boolean(git('status', '--porcelain', '--untracked-files=no')) }; }