import { importSkillApplyAuditJsonlIfNeeded, openKitAuditDatabase } from "../../core/state/kit-audit-sqlite.js";
export function appendSkillApplyAudit(workspacePath, line, effectiveConfig) {
    const db = openKitAuditDatabase(workspacePath, effectiveConfig);
    try {
        importSkillApplyAuditJsonlIfNeeded(db, workspacePath);
        db.prepare(`INSERT INTO kit_skill_apply_audit (recorded_at, skill_id, actor, dry_run, record_audit)
       VALUES (@recorded_at, @skill_id, @actor, @dry_run, @record_audit)`).run({
            recorded_at: line.at,
            skill_id: line.skillId,
            actor: line.actor,
            dry_run: line.dryRun ? 1 : 0,
            record_audit: line.recordAudit ? 1 : 0
        });
    }
    finally {
        db.close();
    }
}
