@andrueandersoncs/lint-anything 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -289,8 +289,8 @@ Each feature has an intended purpose, an eval that measures it, and a result. Ch
289
289
  | `limit` | Count rules judged reliably | `counts.ts` | Holds: 100% vs 92% (79% at the boundary) | yes |
290
290
  | Per-policy cut-offs | Better verdicts than global cut-offs | `cutoffs.ts` | Fails: surfaced violations fall from 72% to 52% for +0.002 F1 | no |
291
291
  | Policy file sent whole as the rule | Clef reads the rule with its frontmatter | `evals/.cache/research/ident/ablate.ts` (2026-10-22) | Replaced: with the excerpt framing, sending the body without the frontmatter (selector code) raised dev AUROC 0.910 → 0.919; the body alone is now the request's text | no |
292
- | `ask` routing step | Drop items a rule doesn't govern, cutting false alarms | (commit `c825cff`) | Fails: dev false alarms rose, violations dropped | no |
293
- | `check` subcommand, `--baseline` / `--changed-since`, `--sarif` | Example checks; adoption on existing code; code scanning | (commits `d4d5052` to `1eddf4d`) | Each measured; see below | no: removed, because the CLI takes no subcommands and no flags but `--debug` |
292
+ | `ask` routing step | Drop items a rule doesn't govern, cutting false alarms | (commit `a4caa7c`) | Fails: dev false alarms rose, violations dropped | no |
293
+ | `check` subcommand, `--baseline` / `--changed-since`, `--sarif` | Example checks; adoption on existing code; code scanning | (commits `47705a7` to `cfab4c3`) | Each measured; see below | no: removed, because the CLI takes no subcommands and no flags but `--debug` |
294
294
 
295
295
  #### Context from outside the file
296
296
 
@@ -387,10 +387,10 @@ Either default passes a clean checkout that has violations, and changed-since fa
387
387
 
388
388
  These were built and measured with new flags and subcommands, then removed because the CLI takes no arguments. The code and evals are in the git history.
389
389
 
390
- - `lint-anything check` (commit `d4d5052`): judged each policy's examples against the rule without them. It caught a rule about the wrong thing (examples agreeing fell from 90% to 48%) but not an inverted one (87%), and it failed two semantic policies in their own wording.
391
- - `--baseline` and `--changed-since` (commit `d43f246`): on a generated repository, all five adoption scenarios behaved as expected; a baseline keyed by item text survived line shifts (one keyed by line would have called 7 of 11 accepted findings new).
392
- - `--sarif` (commit `1eddf4d`): the log validated against the SARIF 2.1.0 schema and every finding mapped to one result.
393
- - `ask` routing step (commit `c825cff`): routing the comments policy's items through "is this exempt?" raised dev false alarms from 8.2% to 11.5% and dropped 3 of 36 violating comments.
390
+ - `lint-anything check` (commit `47705a7`): judged each policy's examples against the rule without them. It caught a rule about the wrong thing (examples agreeing fell from 90% to 48%) but not an inverted one (87%), and it failed two semantic policies in their own wording.
391
+ - `--baseline` and `--changed-since` (commit `9ddefd2`): on a generated repository, all five adoption scenarios behaved as expected; a baseline keyed by item text survived line shifts (one keyed by line would have called 7 of 11 accepted findings new).
392
+ - `--sarif` (commit `cfab4c3`): the log validated against the SARIF 2.1.0 schema and every finding mapped to one result.
393
+ - `ask` routing step (commit `a4caa7c`): routing the comments policy's items through "is this exempt?" raised dev false alarms from 8.2% to 11.5% and dropped 3 of 36 violating comments.
394
394
 
395
395
  #### Counting with `limit`
396
396
 
package/dist/cli.js CHANGED
@@ -261,6 +261,6 @@ ${Ie(e,"Wizard cancelled.",Nl)}`,bv=(e,t,r,n,o=fs)=>{let s=d1(t);return[Ie(r,e,A
261
261
  noul REAL NOT NULL CHECK (noul BETWEEN 0 AND 1),
262
262
  answered INTEGER NOT NULL
263
263
  ) STRICT, WITHOUT ROWID`),r.run("CREATE INDEX IF NOT EXISTS answers_answered ON answers (answered)"),r.run("DELETE FROM answers WHERE answered <= ?",[t-aL]);let n=r.query("SELECT noul FROM answers WHERE key = ?"),o=r.query("INSERT OR REPLACE INTO answers (key, noul, answered) VALUES (?, ?, ?)"),s=(i,f)=>new Bun.CryptoHasher("sha256").update(`${vx}\x00${i}\x00${JSON.stringify(f)}`).digest(),a=r.transaction((i,f)=>{let u=Date.now();for(let{question:l,noul:p}of f)o.run(s(i,l),p,u)}),c=(i)=>new Ss({message:`answer cache ${Xv(e,eA)}: ${i instanceof Error?i.message:String(i)}`});return{get:(i,f)=>xe({try:()=>f.map((u)=>n.get(s(i,u))?.noul),catch:c}),set:(i,f)=>xe({try:()=>a(i,f),catch:c}),close:()=>r.close()}},tu={requests:0,cached:0,inputTokens:0,unmetered:0},Ax=(e)=>{let t=tu;for(let r of e)t={requests:t.requests+r.requests,cached:t.cached+r.cached,inputTokens:t.inputTokens+r.inputTokens,unmetered:t.unmetered+r.unmetered};return t},mL=(e)=>{if(em(e))return h(`Clef did not respond within ${nA}, after ${oA} retries`);if(Kl(e)){let{reason:t}=e;if(t._tag!=="StatusCodeError"){let r="cause"in t&&t.cause instanceof Error?`: ${t.cause.message}`:"";return h(`Clef request failed: ${e.message}${r}`)}return t.response.text.pipe(Ub("5 seconds"),D((r)=>r.trim().slice(0,500)),x_(()=>""),D((r)=>`Clef responded with HTTP ${t.response.status}${r===""?"":`: ${r}`}`))}return h(`Clef sent an unexpected response: ${e instanceof Error?e.message:String(e)}`)};class lo extends de()("lint-anything/Clef"){static layer=(e)=>pn(lo,je(function*(){let t=(d,x)=>x.pipe(Ve(()=>new Ss({message:`${d} is not set; set it in the environment or in .env`}))),r=yield*t("CLOUDFLARE_ACCOUNT_ID",kk("CLOUDFLARE_ACCOUNT_ID")),n=yield*t("CLOUDFLARE_AUTH_TOKEN",CN("CLOUDFLARE_AUTH_TOKEN")),o=yield*kk("CLOUDFLARE_API_BASE_URL").pipe(yN("https://api.cloudflare.com/client/v4"),Ve((d)=>new Ss({message:`CLOUDFLARE_API_BASE_URL: ${d.message}`}))),s=(yield*Gv).pipe(j1(Cs(_1(`${o}/accounts/${r}/ai/run/@cf/cloudflare`),P1(n),$v)),D1,ep(Cs(Nr((d)=>d.text),Ub(nA))),H1({schedule:f_(500),times:oA})),a=e===void 0?void 0:yield*Gt(xe({try:()=>dL(e,Date.now()),catch:(d)=>new Ss({message:`cannot open the answer cache in ${e}: ${d instanceof Error?d.message:String(d)}`})}),(d)=>j(d.close)),c=yield*j_(sL),i=yield*vN(new Map),f=(d,x)=>ON(i,(g)=>new Map(g).set(d,Ax([g.get(d)??tu,{...tu,...x}]))),u=mn("Clef.send")(function*(d,x){let{result:g}=yield*f(d,{requests:1}).pipe(mr(A1(`/${vx}`).pipe(M1(x.body,"application/json"),s.execute)),v(bx(uL)),c.withPermit,Ur((b)=>v(mL(b),(E)=>w(new Ss({message:E})))));yield*f(d,g.usage===void 0?{unmetered:1}:{inputTokens:g.usage.input_tokens});let y=[];for(let{id:b,value:E}of x.questions){let C=g.answers[b];if(C===void 0)return yield*new Ss({message:`Clef returned no answer for question ${b}`});y.push({value:E,noul:C.noul})}return y}),l=mn("Clef.answer")(function*(d,x,g,y,b){let E=[],C=[],I=a===void 0?[]:yield*a.get(x,g.map(y));if(g.forEach((R,U)=>{let F=I[U];if(F===void 0)C.push(R);else E.push({value:R,noul:F})}),E.length>0)yield*f(d,{cached:E.length});let{requests:S,oversized:k}=b(C),T=yield*Mr(S,(R)=>u(d,R).pipe(Nr((U)=>a===void 0?X:a.set(x,U.map(({value:F,noul:q})=>({question:y(F),noul:q}))))),{concurrency:"unbounded"});return E.push(...T.flat()),{answers:E,oversized:k}}),p=mn("Clef.judgeItems")(function*(d,x){let{answers:g,oversized:y}=yield*l(d.name,sA(d),x.map((E,C)=>C),(E)=>aA(d,x[E]),(E)=>{let C=pL(d,E.map((I)=>x[I]));return{requests:C.requests.map(({body:I,questions:S})=>({body:I,questions:S.map(({id:k,value:T})=>({id:k,value:E[T]}))})),oversized:C.oversized.map(({value:I,bytes:S})=>({value:E[I],bytes:S}))}}),b=[];for(let{value:E,bytes:C}of y)b[E]=be(new tA({bytes:C}));for(let{value:E,noul:C}of g)b[E]=Ae({violates:C});return b});return lo.of({judgeItems:p,stats:AN(i)})})).pipe(n_(eL))}var cA=Ct({id:ss,text:ss,path:tr(ss),lines:tr(ek([Fa,Fa]).check(Fi(([e,t])=>1<=e&&e<=t||"lines must be [start, end] with 1 <= start <= end")))}),hL=xF(),iA=mn("parseItem")(function*(e){let t=yield*xe({try:()=>JSON.parse(e),catch:()=>"not valid JSON"});if(typeof t!=="object"||t===null||Array.isArray(t))return yield*w("not an object");let r=Object.keys(t).filter((n)=>!(n in cA.fields));if(r.length>0)return yield*w(`unknown field ${r.join(", ")}; put what Clef should read in text`);return yield*Aa(cA)(t).pipe(Ve((n)=>hL(n.issue).issues.map(({path:o,message:s})=>`${o?.length?`${o.join(".")}: `:""}${s}`).join("; ")))});class ja extends ut()("SelectorError",{message:re}){[Lr]=2}var fA=10,lA=(e)=>{try{process.kill(-e,"SIGKILL")}catch(t){let{code:r}=t;if(r!=="ESRCH"&&r!=="EPERM")throw t}},Ox=new Set,pA=()=>{for(let e of Ox)lA(e)};process.on("exit",pA);process.once("SIGHUP",()=>{pA(),process.kill(process.pid,"SIGHUP")});var uA=async(e,t)=>{let r=Bun.spawn(["sh","-c",e],{cwd:t,env:Object.fromEntries(Object.entries(process.env).filter(([s])=>!s.startsWith("CLOUDFLARE_"))),stdin:"ignore",stdout:"pipe",stderr:"pipe",detached:!0});Ox.add(r.pid);let n=!1,o=setTimeout(()=>{n=!0,lA(r.pid)},fA*60*1000);try{let[s,a,c]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text(),r.exited]);return{exitCode:c,timedOut:n,stdout:s,stderr:a}}finally{clearTimeout(o),Ox.delete(r.pid)}},dA=mn("runSelector")(function*(e,t,r){let n=yield*gm(()=>{if(r===void 0)return uA(e.select,t);let s=JSON.stringify([e.select,t??process.cwd()]),a=r.get(s);if(a===void 0)a=uA(e.select,t),r.set(s,a);return a});if(n.timedOut)return yield*new ja({message:`${e.name}: selector did not finish within ${fA} minutes and was killed`});if(n.exitCode!==0)return yield*new ja({message:`${e.name}: selector exited ${n.exitCode}: ${n.stderr.trim().slice(0,500)}`});let o=n.stdout.split(`
264
- `);return yield*Mr(o.flatMap((s,a)=>s.trim()===""?[]:[{line:s,number:a+1}]),({line:s,number:a})=>iA(s).pipe(Ve((c)=>new ja({message:`${e.name}: selector output line ${a} is not a valid item: ${c}`}))))});var gL=(e,t)=>e.lines===void 0?e.item:`${t?"":`${e.path}:`}${e.lines[0]}-${e.lines[1]}`,xL=(e,t,r)=>{let n=new Map;if(t.per==="run")n.set(void 0,[...r]);else for(let o of r)n.set(o.path,[...n.get(o.path)??[],o]);return[...n].map(([o,s])=>{let a=s.filter((l)=>l.verdict==="violation"),c=s.filter((l)=>l.verdict==="review").length,i=s.filter((l)=>l.verdict==="inconclusive").length,f=a.length>t.max?"violation":a.length+i>t.max?"inconclusive":"pass",u=a.map((l)=>gL(l,o!==void 0)).join(", ");return{policy:e,...o===void 0?{}:{path:o},verdict:f,reason:[`${a.length} of ${s.length} items violate the rule (at most ${t.max} allowed)${u===""?"":`: ${u}`}`,...c>0?[`${c} more in review`]:[],...i>0?[`${i} not judged (request too large)`]:[]].join("; "),violating:a.map((l)=>l.item)}})},yL=0.5,mA=0.65,EL=(e,t,r)=>e<=t?"pass":e>=r?"violation":"review",SL=(e,t,r,n)=>Us(e,{onSuccess:(o)=>{let s=EL(o.violates,yL,n);return{...t,verdict:s,...o,...s==="pass"?{}:{reason:r.criteria.true}}},onFailure:({bytes:o})=>({...t,verdict:"inconclusive",reason:`request is ${o} bytes; Clef would truncate it`})}),bL=(e)=>({item:e.id,...e.path===void 0?{}:{path:e.path},...e.lines===void 0?{}:{lines:e.lines}}),CL=(e,t)=>(e.path??"").localeCompare(t.path??"")||(e.lines?.[0]??0)-(t.lines?.[0]??0)||e.id.localeCompare(t.id),TL=8,hA=mn("lint")(function*(e,t){let r=yield*lo,n=new Map;return(yield*Mr(e,(s)=>dA(s,void 0,n).pipe(D((a)=>a.toSorted(CL)),Nr((a)=>{let c=a.find((i)=>i.path===void 0);return s.limit?.per==="file"&&c!==void 0?w(new ja({message:`${s.name}: item ${c.id} has no path, and limit per file counts items by path; give every item a path or use per: run`})):X}),v((a)=>r.judgeItems(s,a).pipe(D((c)=>{let i=TO(a,c,(f,u)=>SL(u,{policy:s.name,...bL(f)},s,t));return s.limit===void 0?i:xL(s.name,s.limit,i)})))),{concurrency:TL})).flat()});class Zr extends ut()("PolicyError",{message:re}){[Lr]=2}var gA=Ct({select:tr(ss),criteria:tr(Ct({true:tr(ss),false:tr(ss)})),limit:tr(Ct({max:Fa.check(MM(0)),per:tr(Pa(["file","run"]))}))}),wL=/^---\r?\n(.*?)\r?\n---(?:\r?\n|$)/s,IL=mn("parsePolicy")(function*(e,t){let r=wL.exec(t);if(r===null)return yield*new Zr({message:`${e}: missing frontmatter`});let n=t.slice(r[0].length);if(n.trim()==="")return yield*new Zr({message:`${e}: empty policy`});let o=yield*xe(()=>Bun.YAML.parse(r[1]??"")).pipe(Ve((f)=>new Zr({message:`${e}: invalid frontmatter: ${String(f.message??f)}`}))),s=Object.keys(typeof o==="object"&&o!==null?o:{}).filter((f)=>!(f in gA.fields));if(s.length>0)return yield*new Zr({message:`${e}: unknown frontmatter ${s.join(", ")}; a policy has select, criteria, and limit, and its body is everything else Clef reads`});let{select:a,criteria:c,limit:i}=yield*Aa(gA)(o).pipe(Ve((f)=>new Zr({message:`${e}: invalid frontmatter: ${f.message}`})));if(a===void 0)return yield*new Zr({message:`${e}: frontmatter needs a select command that picks what the rule judges`});if(c?.true===void 0||c.false===void 0)return yield*new Zr({message:`${e}: frontmatter needs criteria with "true" (what an item that violates the rule is) and "false" (what one that follows it is)`});return{name:e,body:n,select:a,criteria:{true:c.true,false:c.false},...i===void 0?{}:{limit:{max:i.max,per:i.per??"file"}}}}),xA=mn("loadPolicies")(function*(e){let t=yield*fa,r=yield*Qn,n=()=>new Zr({message:`cannot read policies in ${e}`}),s=(yield*t.readDirectory(e,{recursive:!0}).pipe(Ve(n))).filter((a)=>a.endsWith(".md")).sort();if(s.length===0)return yield*new Zr({message:`no policies in ${e}`});return yield*Mr(s,(a)=>t.readFileString(r.join(e,a)).pipe(Ve(n),v((c)=>IL(a.slice(0,-3),c))))});var yA="0.1.0";class SA extends ut()("ViolationsFound",{count:Oa}){[Lr]=1;[Br]=!1}class bA extends ut()("UsageError",{}){[Lr]=2;[Br]=!1}class CA extends ut()("RunFailed",{}){[Lr]=2;[Br]=!1}var vL=["PolicyError","SelectorError","ClefError"],EA=".lint-anything/rules",AL=".lint-anything/cache",OL=["violation","review","inconclusive","pass"],PL=({path:e,item:t,lines:r})=>e!==void 0&&r!==void 0?`${e}:${r[0]}-${r[1]}`:t??e??"",_L=(e)=>{let t=e.filter((n)=>n.verdict!=="pass").map((n)=>[n.verdict.padEnd(12),(n.violates?.toFixed(2)??"-").padEnd(5),PL(n),n.policy,n.reason??""].join(" ").trimEnd()),r=OL.map((n)=>`${e.filter((o)=>o.verdict===n).length} ${n}`);return[...t,`${e.length} checks: ${r.join(", ")}`].join(`
264
+ `);return yield*Mr(o.flatMap((s,a)=>s.trim()===""?[]:[{line:s,number:a+1}]),({line:s,number:a})=>iA(s).pipe(Ve((c)=>new ja({message:`${e.name}: selector output line ${a} is not a valid item: ${c}`}))))});var gL=(e,t)=>e.lines===void 0?e.item:`${t?"":`${e.path}:`}${e.lines[0]}-${e.lines[1]}`,xL=(e,t,r)=>{let n=new Map;if(t.per==="run")n.set(void 0,[...r]);else for(let o of r)n.set(o.path,[...n.get(o.path)??[],o]);return[...n].map(([o,s])=>{let a=s.filter((l)=>l.verdict==="violation"),c=s.filter((l)=>l.verdict==="review").length,i=s.filter((l)=>l.verdict==="inconclusive").length,f=a.length>t.max?"violation":a.length+i>t.max?"inconclusive":"pass",u=a.map((l)=>gL(l,o!==void 0)).join(", ");return{policy:e,...o===void 0?{}:{path:o},verdict:f,reason:[`${a.length} of ${s.length} items violate the rule (at most ${t.max} allowed)${u===""?"":`: ${u}`}`,...c>0?[`${c} more in review`]:[],...i>0?[`${i} not judged (request too large)`]:[]].join("; "),violating:a.map((l)=>l.item)}})},yL=0.5,mA=0.65,EL=(e,t,r)=>e<=t?"pass":e>=r?"violation":"review",SL=(e,t,r,n)=>Us(e,{onSuccess:(o)=>{let s=EL(o.violates,yL,n);return{...t,verdict:s,...o,...s==="pass"?{}:{reason:r.criteria.true}}},onFailure:({bytes:o})=>({...t,verdict:"inconclusive",reason:`request is ${o} bytes; Clef would truncate it`})}),bL=(e)=>({item:e.id,...e.path===void 0?{}:{path:e.path},...e.lines===void 0?{}:{lines:e.lines}}),CL=(e,t)=>(e.path??"").localeCompare(t.path??"")||(e.lines?.[0]??0)-(t.lines?.[0]??0)||e.id.localeCompare(t.id),TL=8,hA=mn("lint")(function*(e,t){let r=yield*lo,n=new Map;return(yield*Mr(e,(s)=>dA(s,void 0,n).pipe(D((a)=>a.toSorted(CL)),Nr((a)=>{let c=a.find((i)=>i.path===void 0);return s.limit?.per==="file"&&c!==void 0?w(new ja({message:`${s.name}: item ${c.id} has no path, and limit per file counts items by path; give every item a path or use per: run`})):X}),v((a)=>r.judgeItems(s,a).pipe(D((c)=>{let i=TO(a,c,(f,u)=>SL(u,{policy:s.name,...bL(f)},s,t));return s.limit===void 0?i:xL(s.name,s.limit,i)})))),{concurrency:TL})).flat()});class Zr extends ut()("PolicyError",{message:re}){[Lr]=2}var gA=Ct({select:tr(ss),criteria:tr(Ct({true:tr(ss),false:tr(ss)})),limit:tr(Ct({max:Fa.check(MM(0)),per:tr(Pa(["file","run"]))}))}),wL=/^---\r?\n(.*?)\r?\n---(?:\r?\n|$)/s,IL=mn("parsePolicy")(function*(e,t){let r=wL.exec(t);if(r===null)return yield*new Zr({message:`${e}: missing frontmatter`});let n=t.slice(r[0].length);if(n.trim()==="")return yield*new Zr({message:`${e}: empty policy`});let o=yield*xe(()=>Bun.YAML.parse(r[1]??"")).pipe(Ve((f)=>new Zr({message:`${e}: invalid frontmatter: ${String(f.message??f)}`}))),s=Object.keys(typeof o==="object"&&o!==null?o:{}).filter((f)=>!(f in gA.fields));if(s.length>0)return yield*new Zr({message:`${e}: unknown frontmatter ${s.join(", ")}; a policy has select, criteria, and limit, and its body is everything else Clef reads`});let{select:a,criteria:c,limit:i}=yield*Aa(gA)(o).pipe(Ve((f)=>new Zr({message:`${e}: invalid frontmatter: ${f.message}`})));if(a===void 0)return yield*new Zr({message:`${e}: frontmatter needs a select command that picks what the rule judges`});if(c?.true===void 0||c.false===void 0)return yield*new Zr({message:`${e}: frontmatter needs criteria with "true" (what an item that violates the rule is) and "false" (what one that follows it is)`});return{name:e,body:n,select:a,criteria:{true:c.true,false:c.false},...i===void 0?{}:{limit:{max:i.max,per:i.per??"file"}}}}),xA=mn("loadPolicies")(function*(e){let t=yield*fa,r=yield*Qn,n=()=>new Zr({message:`cannot read policies in ${e}`}),s=(yield*t.readDirectory(e,{recursive:!0}).pipe(Ve(n))).filter((a)=>a.endsWith(".md")).sort();if(s.length===0)return yield*new Zr({message:`no policies in ${e}`});return yield*Mr(s,(a)=>t.readFileString(r.join(e,a)).pipe(Ve(n),v((c)=>IL(a.slice(0,-3),c))))});var yA="0.1.1";class SA extends ut()("ViolationsFound",{count:Oa}){[Lr]=1;[Br]=!1}class bA extends ut()("UsageError",{}){[Lr]=2;[Br]=!1}class CA extends ut()("RunFailed",{}){[Lr]=2;[Br]=!1}var vL=["PolicyError","SelectorError","ClefError"],EA=".lint-anything/rules",AL=".lint-anything/cache",OL=["violation","review","inconclusive","pass"],PL=({path:e,item:t,lines:r})=>e!==void 0&&r!==void 0?`${e}:${r[0]}-${r[1]}`:t??e??"",_L=(e)=>{let t=e.filter((n)=>n.verdict!=="pass").map((n)=>[n.verdict.padEnd(12),(n.violates?.toFixed(2)??"-").padEnd(5),PL(n),n.policy,n.reason??""].join(" ").trimEnd()),r=OL.map((n)=>`${e.filter((o)=>o.verdict===n).length} ${n}`);return[...t,`${e.length} checks: ${r.join(", ")}`].join(`
265
265
  `)},FL=(e,t)=>{let r=Ax(t.values()),n=[["policy","requests","cached","input tokens","cost (USD)"],...[...e.map((a)=>[a.name,t.get(a.name)??tu]),["total",r]].map(([a,{requests:c,cached:i,inputTokens:f}])=>[a,String(c),String(i),String(f),`$${(f*rA).toFixed(4)}`])],o=n[0].map((a,c)=>Math.max(...n.map((i)=>i[c].length))),s=n.map((a)=>a.map((c,i)=>i===0?c.padEnd(o[i]):c.padStart(o[i])).join(" "));if(r.unmetered>0)s.push(`${r.unmetered} requests reported no token count; their cost is not included`);return s.join(`
266
266
  `)},RL=g1("lint-anything",{debug:Gi("debug").pipe(Ji(!1),gs("Also print debugging details to stderr: each policy's requests, cached answers, input tokens, and cost"))},mn(function*({debug:e}){let t=yield*xA(EA),n=(yield*je(function*(){let o=yield*lo,s=e?v(o.stats,(c)=>$i(FL(t,c))):X,a=yield*hA(t,mA).pipe(Xs(()=>s));return yield*Ye(_L(a)),yield*s,a}).pipe(bm(lo.layer(AL)))).filter((o)=>o.verdict==="violation").length;if(n>0)return yield*new SA({count:n})})).pipe(x1(`Check every policy in ${EA} with Cloudflare Clef`));RL.pipe(b1({version:yA}),$b((e)=>Pl(e)&&!(e._tag==="ShowHelp"&&e.errors.length===0),()=>w(new bA)),$b((e)=>vL.includes(e._tag),(e)=>$i(`error: ${e.message}`).pipe(mr(w(new CA)))),bm(eN),C_);
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@andrueandersoncs/lint-anything",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Check anything against plain-English policies, judged by Cloudflare's Clef decision model",
5
5
  "license": "MIT",
6
6
  "author": "Andrue Anderson",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/andrueandersoncs/lint-anything.git"
10
+ },
11
+ "homepage": "https://github.com/andrueandersoncs/lint-anything#readme",
12
+ "bugs": "https://github.com/andrueandersoncs/lint-anything/issues",
7
13
  "type": "module",
8
14
  "bin": {
9
15
  "lint-anything": "dist/cli.js"