@lunora/cli 1.0.0-alpha.457 → 1.0.0-alpha.459
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/dist/packem_chunks/handler24.mjs +1 -1
- package/package.json +11 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdirSync as
|
|
1
|
+
import{readdirSync as E,lstatSync as S,existsSync as y}from"node:fs";import{join as m,basename as $}from"node:path";import{d as w}from"../packem_shared/command-B6vu47iR.mjs";import{EXIT_CODE as h}from"../packem_shared/EXIT_CODE-DVjUgIaG.mjs";const l=".eval.ts",F=new Set([".git","_generated","dist","node_modules"]),p=(e,s=[])=>{let r;try{r=E(e)}catch{return s}for(const t of r){const n=m(e,t);let o;try{o=S(n)}catch{continue}if(o.isDirectory()){if(F.has(t))continue;p(n,s)}else o.isFile()&&t.endsWith(l)&&s.push(n)}return s.toSorted((t,n)=>t.localeCompare(n))},b=e=>typeof e=="object"&&e!==null&&typeof e.run=="function",g=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,R="evals";let u;const T=async()=>(u??=import("jiti").then(({createJiti:e})=>e(import.meta.url,{interopDefault:!1})),u),f=e=>$(e,l),x=e=>({average:e.result?.average,error:e.error,items:e.result?.items,name:e.name,passed:e.passed,path:e.path,threshold:e.threshold}),A=e=>({evals:e.evals.map(s=>x(s))}),v=(e,s,r)=>(e.error(s),{code:r,error:s,evals:[]}),L=(e,s,r)=>{if(!y(e))return r.info(`eval: no "${s}" directory — nothing to run`),[];const t=p(e);return t.length===0&&r.info(`eval: no ${l} files found under "${s}"`),t},I=async e=>{const t=(await(await T()).import(e)).default;if(!b(t))throw new Error("does not default-export an eval module (expected `{ run(): Promise<EvalResult>, name?, threshold? }`)");return t},O=async(e,s)=>{let r;try{r=await I(e)}catch(o){return{error:o instanceof Error?o.message:String(o),name:f(e),passed:!1,path:e}}const t=r.name??f(e);if(r.threshold!==void 0&&!g(r.threshold))return{error:`invalid \`threshold\` export: must be a number in [0, 1] — received ${JSON.stringify(r.threshold)}`,name:t,passed:!1,path:e};const n=r.threshold??s;try{const o=await r.run(),a=n===void 0||o.average>=n;return{name:t,passed:a,path:e,result:o,threshold:n}}catch(o){return{error:o instanceof Error?o.message:String(o),name:t,passed:!1,path:e,threshold:n}}},_=async(e,s)=>{const r=[];for(const t of e)r.push(await O(t,s));return r},D=e=>{if(e.error!==void 0)return`ERROR: ${e.error}`;const s=e.passed?"pass":"FAIL",r=e.result?.items.length??0;return`${s} (${String(r)} cases)`},C=e=>{if(e.length===0)return[];const s=Math.max(4,...e.map(t=>t.name.length)),r=[`${"NAME".padEnd(s)} SCORE THRESHOLD STATUS`];for(const t of e){const n=t.result===void 0?"—":t.result.average.toFixed(3),o=t.threshold===void 0?"—":t.threshold.toFixed(3);r.push(`${t.name.padEnd(s)} ${n.padEnd(6)} ${o.padEnd(9)} ${D(t)}`)}return r},M=async e=>{const s=e.cwd??process.cwd(),{logger:r}=e;if(e.threshold!==void 0&&!g(e.threshold))return v(r,`eval: --threshold must be a number in [0, 1] — received "${String(e.threshold)}"`,h.USAGE);const t=e.dir??R,n=m(s,t),o=L(n,t,r),a=await _(o,e.threshold);if(e.threshold!==void 0&&a.length===0){const d=`eval: --threshold ${String(e.threshold)} was set but 0 eval files were discovered under "${t}" — nothing was gated`;return v(r,d,h.USAGE)}for(const d of C(a))r.info(d);const i=a.filter(d=>!d.passed),c=i.length>0?1:0;return c===0?r.success(`eval: ${String(a.length)} eval(s) passed`):r.error(`eval: ${String(i.length)}/${String(a.length)} eval(s) failed`),{code:c,evals:a}},N=w(async({cwd:e,format:s,logger:r,options:t})=>{const n=await M({cwd:e,dir:t.dir,format:s,logger:r,threshold:t.threshold});return{code:n.code,data:A(n),error:n.error}});export{N as execute,M as runEvalCommand};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.459",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, migrate, seed, doctor, insights, logs, registry, and the rest of the project commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@bomb.sh/tab": "0.0.22",
|
|
59
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
60
|
-
"@lunora/bindings": "1.0.0-alpha.
|
|
61
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
62
|
-
"@lunora/config": "1.0.0-alpha.
|
|
63
|
-
"@lunora/container": "1.0.0-alpha.
|
|
64
|
-
"@lunora/d1": "1.0.0-alpha.
|
|
59
|
+
"@lunora/advisor": "1.0.0-alpha.277",
|
|
60
|
+
"@lunora/bindings": "1.0.0-alpha.144",
|
|
61
|
+
"@lunora/codegen": "1.0.0-alpha.379",
|
|
62
|
+
"@lunora/config": "1.0.0-alpha.434",
|
|
63
|
+
"@lunora/container": "1.0.0-alpha.102",
|
|
64
|
+
"@lunora/d1": "1.0.0-alpha.224",
|
|
65
65
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
66
|
-
"@lunora/mcp": "1.0.0-alpha.
|
|
67
|
-
"@lunora/runtime": "1.0.0-alpha.
|
|
68
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
66
|
+
"@lunora/mcp": "1.0.0-alpha.279",
|
|
67
|
+
"@lunora/runtime": "1.0.0-alpha.262",
|
|
68
|
+
"@lunora/seed": "1.0.0-alpha.272",
|
|
69
69
|
"@visulima/cerebro": "4.0.1",
|
|
70
70
|
"@visulima/error": "6.1.0",
|
|
71
71
|
"@visulima/fs": "7.0.0",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"adm-zip": "0.6.1",
|
|
78
78
|
"csv-parse": "7.0.3",
|
|
79
79
|
"giget": "3.3.1",
|
|
80
|
+
"jiti": "2.7.0",
|
|
80
81
|
"jsonc-parser": "^3.3.1",
|
|
81
82
|
"magic-string": "^1.4.2",
|
|
82
83
|
"react": "^19.3.0",
|