#!/usr/bin/env node
import'./chunk-5TAVYPOV.js';import*as i from'fs';import*as c from'path';var p=".paradigm/events/compliance-history.jsonl",s=10;function C(t,n){try{let e=c.join(t,p),r=c.dirname(e);i.existsSync(r)||i.mkdirSync(r,{recursive:!0});let o={timestamp:new Date().toISOString(),...n},a=JSON.stringify(o)+`
`;i.appendFileSync(e,a,"utf8");}catch{}}function d(t,n){try{let e=c.join(t,p);if(!i.existsSync(e))return [];let r=i.readFileSync(e,"utf8").trim().split(`
`).filter(o=>o.trim()).map(o=>{try{return JSON.parse(o)}catch{return null}}).filter(o=>o!==null);return n&&n>0?r.slice(-n):r}catch{return []}}function l(t){let n=t.reduce((r,o)=>r+o.checks,0),e=t.reduce((r,o)=>r+o.violations,0);return n===0?0:e/n}function g(t,n=s){let e=d(t,n);if(e.length<2)return null;let r=Math.floor(e.length/2),o=e.slice(0,r),a=e.slice(r),f=l(o),u=l(a)-f,m=.05;return u<-m?"improving":u>m?"degrading":"stable"}function h(t,n){if(!t)return "yellow";if(t==="improving")return "green";let e=0;if(n){let r=d(n,Math.ceil(s/2));e=l(r);}return t==="stable"?e===0?"green":"yellow":e>.2?"red":"orange"}function R(t,n=s){let e=g(t,n);return e?{trend:e,dot:h(e,t)}:null}export{R as getComplianceHealthSummary,g as getComplianceTrend,h as getHealthDot,C as recordComplianceSnapshot};