ripplo 0.7.23 → 0.7.24
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{G as Qe,J as Xe,K as Ye,L as Ze,M as er,N as ae,O as D,P as H,Q as U,R as rr,T as nr,U as tr,V as or,W as ir,X as ar,Z as sr,_ as lr,a as We,b as O,e as qe,f as Be,h as N,i as Ve,j as Ke,k as h,l as ze,m as Je,n as C,o as A,p as Ge,s as R}from"./chunk-
|
|
2
|
+
import{G as Qe,J as Xe,K as Ye,L as Ze,M as er,N as ae,O as D,P as H,Q as U,R as rr,T as nr,U as tr,V as or,W as ir,X as ar,Z as sr,_ as lr,a as We,b as O,e as qe,f as Be,h as N,i as Ve,j as Ke,k as h,l as ze,m as Je,n as C,o as A,p as Ge,s as R}from"./chunk-E4ODIHV7.js";import{b as Oe,d as m,e as y,g as Ne,h as S,i as De,j as He,k as Ue}from"./chunk-EVYYSTR7.js";import ur from"fs";import K from"path";import{config as Qn}from"dotenv";import{z as B}from"zod";import{err as Xn,ok as pr}from"neverthrow";import q from"fs";import ce from"path";import{err as se,ok as cr}from"neverthrow";import{z as W}from"zod";var Kn=ce.join(".ripplo","project.json"),le=[".env",".env.local"],zn=W.object({envFiles:W.array(W.string().min(1)).optional(),projectId:W.string().min(1)});function dr(e){return ce.join(e,Kn)}function de(e){let r=dr(e);return q.existsSync(r)?Jn(r).andThen(n=>{let t=zn.safeParse(n);return t.success?cr({envFiles:t.data.envFiles??le,projectId:t.data.projectId}):se({issues:t.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`),kind:"project-file-invalid",path:r})}):se({kind:"project-file-missing",path:r})}function ue(e){return de(e).match(r=>r,()=>{})}function Jn(e){try{return cr(JSON.parse(q.readFileSync(e,"utf8")))}catch(r){return se({issues:[r instanceof Error?r.message:String(r)],kind:"project-file-invalid",path:e})}}function La({cwd:e,envFiles:r,projectId:n}){let t=dr(e);q.mkdirSync(ce.dirname(t),{recursive:!0});let o={projectId:n};r!=null&&!Gn(r)&&(o.envFiles=[...r]),q.writeFileSync(t,JSON.stringify(o,null,2)+`
|
|
3
3
|
`)}function Gn(e){return e.length!==le.length?!1:e.every((r,n)=>r===le[n])}function Ua(e){let n=ue(e)?.envFiles??[".env",".env.local"],t=K.join(e,".ripplo");n.forEach(o=>{let i=K.resolve(t,o);ur.existsSync(i)&&Qn({override:!0,path:i,quiet:!0})}),V=void 0}var Yn=B.object({RIPPLO_APP_URL:B.url(),RIPPLO_ENGINE_URL:B.url(),RIPPLO_WEBHOOK_SECRET:B.string().min(1)}),V;function z(){return V!=null?pr(V):et().map(e=>(V=e,e))}function Zn(e){let n=ue(e)?.envFiles??[],t=K.join(e,".ripplo");return n.map(o=>K.resolve(t,o)).filter(o=>!ur.existsSync(o))}function et(){let e=Yn.safeParse(process.env);if(!e.success)return Xn({issues:e.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`),kind:"env-invalid",missingEnvFiles:Zn(process.cwd())});let r=e.data;return pr({appUrl:r.RIPPLO_APP_URL,engineUrl:r.RIPPLO_ENGINE_URL,webhookSecret:r.RIPPLO_WEBHOOK_SECRET})}import{readFileSync as rt}from"fs";import{z as fr}from"zod";var nt=fr.object({version:fr.string()});function J(){let e=rt(new URL("../package.json",import.meta.url),"utf8");return nt.parse(JSON.parse(e)).version}import ge from"fs";import G from"path";import{createJiti as pt}from"jiti";import{err as L,ok as hr}from"neverthrow";import tt from"fs";import T from"path";import b from"typescript";function mr(e){let r=T.join(e,"index.ts"),n=at(e);tt.mkdirSync(T.dirname(n.tsBuildInfoFile??""),{recursive:!0});let t=b.createIncrementalCompilerHost(n),o=b.createIncrementalProgram({host:t,options:n,rootNames:[r]}),i=[...o.getSyntacticDiagnostics(),...o.getSemanticDiagnostics()];o.emit();let s=i.filter(d=>ot(d,e));if(s.length===0)return{diagnostics:[],ok:!0};let l={getCanonicalFileName:d=>d,getCurrentDirectory:()=>T.dirname(e),getNewLine:()=>`
|
|
4
4
|
`};return{diagnostics:b.formatDiagnosticsWithColorAndContext(s,l).split(`
|
|
5
5
|
`).filter(d=>d.length>0),ok:!1}}function ot(e,r){let n=e.file?.fileName;return n==null?!0:n.startsWith(r)}var it=T.join(".local","tsbuildinfo");function at(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:b.ModuleKind.Preserve,moduleResolution:b.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:b.ScriptTarget.ES2022,tsBuildInfoFile:T.join(e,it)}}import{createHash as st}from"crypto";import yr from"fs/promises";import pe from"path";import{err as v,ok as fe,Result as lt}from"neverthrow";var j=".ripplo/fixtures",me=10*1024*1024,ye=50*1024*1024;async function gr(e,r){let n=ct(r);if(n.length===0)return fe({});let t=pe.join(e,j),o=await Promise.all(n.map(i=>dt({fixturesRoot:t,name:i})));return lt.combine(o).andThen(ut)}function ct(e){let n=e.workflows.flatMap(t=>[...t.steps,...t.tests.flatMap(o=>o.steps)]).flatMap(t=>t.action.kind==="upload"?t.action.files:[]);return[...new Set(n)].toSorted((t,o)=>t.localeCompare(o))}async function dt({fixturesRoot:e,name:r}){if(r.includes("..")||pe.isAbsolute(r))return v({kind:"fixture-invalid-name",name:r});let n=pe.join(e,r),t=await yr.lstat(n).catch(()=>null);if(t==null)return v({kind:"fixture-missing",name:r,path:n});if(t.isSymbolicLink())return v({kind:"fixture-symlink",name:r});if(!t.isFile())return v({kind:"fixture-not-file",name:r});let o=await yr.readFile(n);if(o.byteLength>me)return v({kind:"fixture-too-large",name:r,size:o.byteLength});let i=st("sha256").update(o).digest("hex");return fe([r,{sha256:i,size:o.byteLength}])}function ut(e){let r=e.reduce((n,[,t])=>n+t.size,0);return r>ye?v({kind:"fixtures-total-too-large",total:r}):fe(Object.fromEntries(e))}var E=".ripplo/ripplo.lock",F;async function kr(e){let{result:r}=await he(e);return r}async function he(e){let r=mt(G.join(e,".ripplo"));if(F!=null&&F.fingerprint===r&&F.result.isOk())return{fingerprint:r,result:F.result};let n=await M(e);return F={fingerprint:r,result:n},{fingerprint:r,result:n}}async function M(e){let r=G.join(e,".ripplo"),n=G.join(r,"index.ts"),t=mr(r);return t.ok?(await yt(n)).andThen(s=>ht({entryPath:n,exported:s})).match(async s=>(await gr(e,s)).map(u=>({...s,fixtures:u})).mapErr(u=>({error:u,kind:"fixture-failed"})),s=>Promise.resolve(L(s))):L({diagnostics:t.diagnostics,kind:"typecheck-failed"})}var ft=new Set([".local","debug","node_modules"]);function mt(e){return Sr(e).toSorted((r,n)=>r.localeCompare(n)).join("|")}function Sr(e){return(ge.existsSync(e)?ge.readdirSync(e,{withFileTypes:!0}):[]).flatMap(n=>{if(ft.has(n.name))return[];let t=G.join(e,n.name);if(n.isDirectory())return Sr(t);let o=ge.statSync(t);return[`${t}:${String(o.mtimeMs)}:${String(o.size)}`]})}async function yt(e){try{let n=await pt(import.meta.url,{fsCache:!1,moduleCache:!1,sourceMaps:!0}).import(e),t=n!=null&&typeof n=="object"&&"default"in n?Reflect.get(n,"default"):n;return hr(t)}catch(r){return L({kind:"load-threw",message:gt(r)})}}function gt(e){return e instanceof Error?e.message:String(e)}function ht({entryPath:e,exported:r}){if(r==null||typeof r!="object"||!("lockfile"in r))return L({entryPath:e,kind:"not-ripplo"});let n=Be.safeParse(Reflect.get(r,"lockfile"));return n.success?hr(n.data):L({issues:n.error.issues.map(t=>`${t.path.join(".")}: ${t.message}`),kind:"invalid-lockfile"})}function w(e,r){return r==null?`Load \`/ripplo:${e}\` skill for instructions.`:`Load \`/ripplo:${e}\` skill for instructions on ${r}.`}function cs(e){return e.length===1?w(e[0]):`Before proceeding, load the ${e.map(n=>`\`/ripplo:${n}\``).join(" and ")} skills \u2014 every one, each carries rules the others don't.`}function X(e){return[`Compilation failed: ${kt(e)}`,w("create","DSL authoring + lint rules")].join(`
|