// ---------------------------------------------------------------------------
// Lockfile migration — normalize legacy entries on read
// ---------------------------------------------------------------------------
/**
 * Migrate a single lock entry.
 * - Replaces empty or "0.0.0" versions with "1.0.0".
 * - Returns a new object (no mutation).
 */
export function migrateLockEntry(entry) {
    const version = !entry.version || entry.version === "0.0.0" ? "1.0.0" : entry.version;
    // Normalize tier values from external tools (e.g., specweave migration uses "free")
    const validTiers = ["CERTIFIED", "VERIFIED", "SCANNED"];
    const tier = validTiers.includes(entry.tier) ? entry.tier : "VERIFIED";
    return { ...entry, version, tier };
}
/**
 * Migrate an entire lockfile, applying migrateLockEntry to every skill.
 * Returns a new VskillLock (no mutation).
 */
export function migrateLock(lock) {
    const skills = {};
    for (const [name, entry] of Object.entries(lock.skills)) {
        skills[name] = migrateLockEntry(entry);
    }
    return { ...lock, skills };
}
//# sourceMappingURL=migration.js.map