#!/usr/bin/env node
import {f,o,p}from'./chunk-JIXHEBGK.js';import'./chunk-XHJ27CER.js';import*as l from'path';import e from'chalk';import P from'ora';async function E(u){let i=process.cwd(),h=l.resolve(i,u);console.log(e.blue(`
\u{1F50D} Validating Purpose Files...
`));let a=P("Finding purpose files...").start();try{let s=await f(h);a.succeed(`Found ${s.length} purpose file(s)`);let c=!1,r=0,p$1=0;for(let{filePath:m,data:w}of s){let t=l.relative(i,m),o$1=o(w,t),$=o$1.issues.filter(n=>n.type==="error").length,v=o$1.issues.filter(n=>n.type==="warning").length;p$1+=$,r+=v,o$1.valid||(c=!0),o$1.issues.length>0?(console.log(e.white(`
${t}`)),console.log(p(o$1))):console.log(e.green(`  \u2713 ${t}`));}console.log(e.white(`
`+"\u2500".repeat(50))),c?(console.log(e.red(`
\u274C Validation failed: ${p$1} error(s), ${r} warning(s)
`)),process.exit(1)):r>0?console.log(e.yellow(`
\u2713 Valid with ${r} warning(s)
`)):console.log(e.green(`
\u2713 All purpose files are valid
`));}catch(s){a.fail("Validation failed"),console.log(e.red(`Error: ${s.message}
`)),process.exit(1);}}export{E as purposeValidateCommand};