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