local-frontier / scripts /build-profile-data.mjs
Onur Solmaz
feat: add audited model profile bounds
04b48d1
Raw
History Blame Contribute Delete
903 Bytes
import fs from "node:fs";
import path from "node:path";
import { root, validateProfiles } from "./profile-utils.mjs";
const result = validateProfiles();
if (result.errors.length) {
console.error(result.errors.join("\n"));
process.exit(1);
}
const payload = {
schema_version: "1.0.0",
generated_at: generatedAt(result.profiles),
profiles: result.profiles,
};
const target = path.join(root, "assets", "local-frontier-profile-data.js");
const source = `window.LOCAL_FRONTIER_PROFILE_DATA = ${JSON.stringify(payload, null, 2)};\n`;
fs.writeFileSync(target, source);
console.log(
`wrote ${path.relative(root, target)} with ${result.profiles.length} profiles`,
);
function generatedAt(profiles) {
const dates = profiles
.map((profile) => profile.review?.reviewed_at)
.filter(Boolean)
.sort();
const latest = dates.at(-1) || "1970-01-01";
return `${latest}T00:00:00.000Z`;
}