// storage/compliance-score-store.ts — Compliance score persistence (SPEC-406)
// Layout: data/projects/{projectId}/compliance-scores.json
import { readJson, writeJson, projectDataDir } from './base-store.js';
function dataFile(projectId) {
    return `${projectDataDir(projectId)}/compliance-scores.json`;
}
/**
 * Saves a compliance score for a spec in a project.
 * Overwrites any previous score for the same specId.
 */
export async function saveComplianceScore(projectId, score) {
    const all = await getAllComplianceScores(projectId);
    all[score.specId] = score;
    await writeJson(dataFile(projectId), all);
}
/**
 * Retrieves a compliance score for a specific spec, or null if not found.
 */
export async function getComplianceScore(projectId, specId) {
    const all = await getAllComplianceScores(projectId);
    return all[specId] ?? null;
}
/**
 * Returns all compliance scores for a project.
 * Returns an empty record if no scores have been saved yet.
 */
export async function getAllComplianceScores(projectId) {
    return readJson(dataFile(projectId), {});
}
//# sourceMappingURL=compliance-score-store.js.map