var R=Object.defineProperty;var $=(e,t)=>R(e,"name",{value:t,configurable:!0});import{createRequire as T}from"node:module";import{I as f,T as b,E as x,e as _}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{l as V,M as E}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{s as F}from"./config.js";import{enforceProjectConstraints as I}from"@visulima/task-runner";import{C as P,S as z,$ as B,E as J}from"./bin.js";import{c as K}from"../packem_shared/runtime-check-CilFOqUU.js";const w=T(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=$(e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,i]=n.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return n.getBuiltinModule(e)}return w(e)},"__cjs_getBuiltinModule"),{readdirSync:q}=M("node:fs");var N=Object.defineProperty,v=$((e,t)=>N(e,"name",{value:t,configurable:!0}),"h");const r=v(e=>e?f("✓"):b("✗"),"icon"),X=v(async({logger:e,options:t,visConfig:i,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root.");const{config:j,packageJsons:C,workspace:u}=P(s,i),O=z(s,u,C),y=Object.keys(u.projects).length,S=new Set(Object.values(u.projects).flatMap(p=>Object.keys(p.targets??{}))).size,a=K(s);let o=0;j.constraints&&(o=I(O,j.constraints).length);const c=B(s,{minRuns:2});let l;const g=J(s);if(V(g)){const p=q(g).filter(h=>h.endsWith(".json")).sort();let m=0,k=0;for(const h of p.slice(-20))try{const d=F(E(g,h));d.stats&&(m+=d.stats.total??0,k+=d.stats.cached??0)}catch{continue}m>0&&(l=`${(k/m*100).toFixed(0)}%`)}if(t.json){e.info(JSON.stringify({cacheHitRate:l??null,constraintViolations:o,flakyTasks:c.length,projects:y,runtimeIssues:a.length,targets:S},null,2));return}e.info(""),e.info(`  ${x("VIS STATUS")}`),e.info(""),e.info(`  ${r(!0)} ${String(y)} projects · ${String(S)} unique targets`),e.info(`  ${r(a.length===0)} Runtime: ${a.length===0?f("OK"):_(`${String(a.length)} issue(s)`)}`),e.info(`  ${r(o===0)} Constraints: ${o===0?f("OK"):b(`${String(o)} violation(s)`)}`),e.info(`  ${r(c.length===0)} Flaky tasks: ${c.length===0?f("none"):_(String(c.length))}`),l&&e.info(`  ${r(!0)} Cache hit rate: ${l} (last 20 runs)`),e.info("")},"execute");export{X as default};
