ripplo 0.9.7 → 0.9.8

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.
Files changed (40) hide show
  1. package/dist/{chunk-V4CLXOCP.js → chunk-2GFHB4LD.js} +1 -1
  2. package/dist/{chunk-IG7J452B.js → chunk-3UZZBLVA.js} +1 -1
  3. package/dist/{chunk-2Q7VXQYN.js → chunk-64OQXBRG.js} +1 -1
  4. package/dist/{chunk-TPCKMDWU.js → chunk-7EL64XR6.js} +1 -1
  5. package/dist/{chunk-5DT43ABQ.js → chunk-7IIRERCW.js} +1 -1
  6. package/dist/{chunk-FJPJDGSS.js → chunk-7VGCLQGP.js} +1 -1
  7. package/dist/{chunk-BJWGAKKD.js → chunk-7YQOAAKF.js} +1 -1
  8. package/dist/{chunk-L2ZJK7MP.js → chunk-AWPZTNYU.js} +1 -1
  9. package/dist/chunk-CTTC4KKQ.js +83 -0
  10. package/dist/{chunk-GFKK7K6T.js → chunk-GI65FUDI.js} +1 -1
  11. package/dist/{chunk-BNMS3N54.js → chunk-GZ3M7PNW.js} +1 -1
  12. package/dist/{chunk-CAS7MBA7.js → chunk-IDPJESOE.js} +1 -1
  13. package/dist/{chunk-XJJDHGK4.js → chunk-IKYR3UCU.js} +9 -9
  14. package/dist/{chunk-RIVHBABX.js → chunk-NY6EIQR4.js} +1 -1
  15. package/dist/{chunk-7CELUIVK.js → chunk-OQ4TDIP3.js} +1 -1
  16. package/dist/{chunk-6VUSLPQD.js → chunk-OQS63V7U.js} +2 -2
  17. package/dist/{chunk-GZPE7I7U.js → chunk-TOBC3SQA.js} +1 -1
  18. package/dist/{cli-error-OIG4RO4E.js → cli-error-TS4FNZ6F.js} +1 -1
  19. package/dist/{compile-write-OLP4DB4P.js → compile-write-BLJH647I.js} +1 -1
  20. package/dist/{daemon-WEKGUIRK.js → daemon-QKBWYQJA.js} +1 -1
  21. package/dist/{daemon-3IWI7VQT.js → daemon-UMZJZ7BY.js} +1 -1
  22. package/dist/{dsl-loader-IRBKYLNW.js → dsl-loader-NGW4V4A3.js} +1 -1
  23. package/dist/hook.js +1 -1
  24. package/dist/index.js +2 -2
  25. package/dist/{plan-reminder-FZSSUVNB.js → plan-reminder-RBCRBCKC.js} +1 -1
  26. package/dist/post-edit-MVGQGAW4.js +4 -0
  27. package/dist/post-edit-analyze-XWTZMQCB.js +4 -0
  28. package/dist/post-edit-flag-stubs-4MQZATJE.js +4 -0
  29. package/dist/{pre-edit-WZJVD3J4.js → pre-edit-YF6WNE6G.js} +1 -1
  30. package/dist/{pre-edit-watch-gate-GQZYMDOC.js → pre-edit-watch-gate-SJ3RCYH5.js} +1 -1
  31. package/dist/{prompt-submit-LE5LR62B.js → prompt-submit-YX7GMTC4.js} +1 -1
  32. package/dist/solve-worker.js +1 -1
  33. package/dist/status-HPMHJBKH.js +4 -0
  34. package/dist/{stop-enforce-EH2SC7ND.js → stop-enforce-VWOM5EZY.js} +1 -1
  35. package/package.json +3 -3
  36. package/dist/chunk-4GA5662U.js +0 -83
  37. package/dist/post-edit-333UCJ6G.js +0 -4
  38. package/dist/post-edit-analyze-JFWA223C.js +0 -4
  39. package/dist/post-edit-flag-stubs-IZSAIM4O.js +0 -4
  40. package/dist/status-H5WYYH4J.js +0 -4
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as o}from"./chunk-5DT43ABQ.js";import{a as t}from"./chunk-MHNGR6M7.js";var r=class extends Error{failure;constructor(i){super(i.kind),this.name="CliError",this.failure=i}};function u(e){return e instanceof r?a(e.failure):e instanceof Error?e.message:String(e)}function a(e){switch(e.kind){case"project-file-missing":return[`Missing ${e.path} \u2014 this directory is not a Ripplo project.`,"Run `npx ripplo init` to create it (or cd into the project root).",t("setup")].join(`
4
+ import{a as o}from"./chunk-7IIRERCW.js";import{a as t}from"./chunk-MHNGR6M7.js";var r=class extends Error{failure;constructor(i){super(i.kind),this.name="CliError",this.failure=i}};function u(e){return e instanceof r?a(e.failure):e instanceof Error?e.message:String(e)}function a(e){switch(e.kind){case"project-file-missing":return[`Missing ${e.path} \u2014 this directory is not a Ripplo project.`,"Run `npx ripplo init` to create it (or cd into the project root).",t("setup")].join(`
5
5
  `);case"project-file-invalid":return[`${e.path} is invalid:`,...e.issues.map(i=>` ${i}`),"Fix the file by hand or re-run `npx ripplo init`."].join(`
6
6
  `);case"not-authenticated":return["Not signed in. Run `npx ripplo auth login`.","(Claude Code: run it yourself in the background \u2014 the user just approves in the browser.)"].join(`
7
7
  `);case"env-invalid":return s(e);case"playwright-install-failed":return["Playwright browser install failed \u2014 Chromium is still missing.","Run `npx playwright install chromium` and check its output for network, proxy, or disk-space errors."].join(`
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{f as a}from"./chunk-OES7HGNF.js";import{a as n}from"./chunk-5DT43ABQ.js";import{i}from"./chunk-RIVHBABX.js";import{n as e}from"./chunk-L2ZJK7MP.js";import{i as u}from"./chunk-GFKK7K6T.js";async function x(m){let o=process.cwd(),r=await e(o);r.isErr()&&(process.stderr.write(`${n(r.error)}
4
+ import{f as a}from"./chunk-OES7HGNF.js";import{a as n}from"./chunk-7IIRERCW.js";import{i}from"./chunk-NY6EIQR4.js";import{n as e}from"./chunk-AWPZTNYU.js";import{i as u}from"./chunk-GI65FUDI.js";async function x(m){let o=process.cwd(),r=await e(o);r.isErr()&&(process.stderr.write(`${n(r.error)}
5
5
  `),process.exit(1));let s=i(r.value),t=await a(o);if(m.format==="summary"){s.length>0&&process.stdout.write(`stub workflows: ${s.join(", ")}
6
6
  `),process.stdout.write(`${u(t)}
7
7
  `);return}let p={daemon:t.kind==="running"?{active:t.status.active,explorer:t.status.explorer,exploring:t.status.exploring,progress:t.status.progress,queued:t.status.queued,running:!0}:{running:t.kind==="unresponsive",state:t.kind},tests:s.map(d=>({id:d,implemented:!1}))};process.stdout.write(`${JSON.stringify(p,null,2)}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as r}from"./chunk-7WZ3VIUU.js";import{f as n}from"./chunk-TPHOSZAK.js";var m=async o=>{if(o.permission_mode!=="plan"||!r(o.cwd)||!n(o.cwd))return;let{loadRipplo:s}=await import("./dsl-loader-IRBKYLNW.js"),{stubbedWorkflows:a}=await import("./compile-write-OLP4DB4P.js"),t=await s(o.cwd);if(t.isErr())return;let e=a(t.value),i=['Plan must include "Tests to implement" with a .ripplo/workflows/ file per affected flow (ExitPlanMode blocks otherwise). Stub each with `workflow("Intent")` (no body).'];return e.length>0&&i.push(`Existing stubs: ${e.join(", ")}`),{hookSpecificOutput:{additionalContext:i.join(`
4
+ import{a as r}from"./chunk-7WZ3VIUU.js";import{f as n}from"./chunk-TPHOSZAK.js";var m=async o=>{if(o.permission_mode!=="plan"||!r(o.cwd)||!n(o.cwd))return;let{loadRipplo:s}=await import("./dsl-loader-NGW4V4A3.js"),{stubbedWorkflows:a}=await import("./compile-write-BLJH647I.js"),t=await s(o.cwd);if(t.isErr())return;let e=a(t.value),i=['Plan must include "Tests to implement" with a .ripplo/workflows/ file per affected flow (ExitPlanMode blocks otherwise). Stub each with `workflow("Intent")` (no body).'];return e.length>0&&i.push(`Existing stubs: ${e.join(", ")}`),{hookSpecificOutput:{additionalContext:i.join(`
5
5
  `),hookEventName:"UserPromptSubmit"}}};export{m as a};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as s}from"./chunk-7WZ3VIUU.js";import{e as p}from"./chunk-TPHOSZAK.js";import{a as i}from"./chunk-MHNGR6M7.js";import{n}from"./chunk-L2ZJK7MP.js";import{c as a}from"./chunk-R3DZ6JPY.js";import l from"fs";import d from"path";import*as r from"zod/mini";var c=new Set(["Edit","Write","NotebookEdit"]),u=r.looseObject({file_path:r.string()}),D=async t=>{if(!c.has(t.tool_name))return;let e=m(t);if(e==null)return;let{cwd:o}=t;return l.existsSync(p(o))||a(o)?void 0:(await n(o)).isErr()?{hookSpecificOutput:{additionalContext:`\`ripplo daemon\` isn't running and the DSL isn't compiling, so this edit is allowed through without dev-mode guardrails. Run \`npx ripplo compile\` to see the errors, or \`/ripplo:start\` to bring the daemon up. ${i("create","DSL authoring rules")}`,hookEventName:"PreToolUse"}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo daemon\` is not running \u2014 this edit to \`${e}\` won't sync and dev-mode guardrails won't fire. Run \`/ripplo:start\`, then retry (\`npx ripplo doctor\` checks the daemon and dev server). If the daemon can't start, the user can bypass with \`npx ripplo hooks pause\`. ${i("start")}`}}};function m(t){let e=u.safeParse(t.tool_input);if(!e.success||!s(t.cwd))return null;let o=d.relative(t.cwd,e.data.file_path);return o.startsWith("..")||o!==".ripplo"&&!o.startsWith(".ripplo/")?null:o}export{D as a};
4
+ import{a as s}from"./chunk-7WZ3VIUU.js";import{e as p}from"./chunk-TPHOSZAK.js";import{a as i}from"./chunk-MHNGR6M7.js";import{n}from"./chunk-AWPZTNYU.js";import{c as a}from"./chunk-R3DZ6JPY.js";import l from"fs";import d from"path";import*as r from"zod/mini";var c=new Set(["Edit","Write","NotebookEdit"]),u=r.looseObject({file_path:r.string()}),D=async t=>{if(!c.has(t.tool_name))return;let e=m(t);if(e==null)return;let{cwd:o}=t;return l.existsSync(p(o))||a(o)?void 0:(await n(o)).isErr()?{hookSpecificOutput:{additionalContext:`\`ripplo daemon\` isn't running and the DSL isn't compiling, so this edit is allowed through without dev-mode guardrails. Run \`npx ripplo compile\` to see the errors, or \`/ripplo:start\` to bring the daemon up. ${i("create","DSL authoring rules")}`,hookEventName:"PreToolUse"}}:{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`\`ripplo daemon\` is not running \u2014 this edit to \`${e}\` won't sync and dev-mode guardrails won't fire. Run \`/ripplo:start\`, then retry (\`npx ripplo doctor\` checks the daemon and dev server). If the daemon can't start, the user can bypass with \`npx ripplo hooks pause\`. ${i("start")}`}}};function m(t){let e=u.safeParse(t.tool_input);if(!e.success||!s(t.cwd))return null;let o=d.relative(t.cwd,e.data.file_path);return o.startsWith("..")||o!==".ripplo"&&!o.startsWith(".ripplo/")?null:o}export{D as a};
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as n}from"./chunk-MHNGR6M7.js";import{h as o,i as a,k as i}from"./chunk-L2ZJK7MP.js";function c(e){return[`Compilation failed: ${s(e)}`,n("create","DSL authoring rules")].join(`
4
+ import{a as n}from"./chunk-MHNGR6M7.js";import{h as o,i as a,k as i}from"./chunk-AWPZTNYU.js";function c(e){return[`Compilation failed: ${s(e)}`,n("create","DSL authoring rules")].join(`
5
5
  `)}function m(){return`${i} is up to date`}function g(e){return[`${i} is ${e==="missing"?"missing":"out of date"} \u2014 run \`npx ripplo compile\` and commit it`,n("setup")].join(`
6
6
  `)}function x(){return`Wrote ${i}`}function s(e){switch(e.kind){case"typecheck-failed":return["TypeScript errors in .ripplo/:",...l(e.diagnostics)].join(`
7
7
  `);case"not-ripplo":return`${e.entryPath} must default-export createRipplo({ entities, singletons, workflows }).`;case"invalid-lockfile":return["Lockfile failed schema validation (stale or hand-edited .ripplo/ripplo.lock):",...l(e.issues),"Regenerate with `npx ripplo compile`."].join(`
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as r}from"./chunk-OQ6KNYPG.js";import{a as s}from"./chunk-MHNGR6M7.js";import{a as k,b as C,c as F,d as b}from"./chunk-RIVHBABX.js";import{A as v,E as $,c as u,g as o,q as c,s as f,u as m,v as p,w as g,x as y,y as h,z as S}from"./chunk-4GA5662U.js";import{K as d,R as l}from"./chunk-XJJDHGK4.js";async function P({cwd:e,lockfile:n}){let i=c(n),a=b(d(l,n));if(C({context:i,cwd:e})===a)return[];k({context:i,cwd:e});let t=await x(n);return F({cleanLockfileHash:t.length===0?a:null,context:i,cwd:e}),t}async function x(e){let n=u(e),i=await f(e),a=await m({context:c(e),facts:i.facts});return[...g(e).map(t=>({kind:"missing-precondition",missing:t})),...p(n,i.dataRules).map(t=>({gap:t,kind:"cascade-gap"})),...a.map(t=>({conflict:t,kind:"fact-conflict"})),...y(e).map(t=>({kind:"unreachable-interaction",violation:t})),...h(e).map(t=>({kind:"redundant-assertion",redundancy:t})),...S(e).map(t=>({kind:"unmodeled-surface",surface:t})),...v(e).map(t=>({content:t,kind:"unpinned-surface-content"}))]}function U(e){return`${o.good("ok")} \u2014 no static model violations (${r(e,"test")})`}function O(e){let i=e.some(a=>a.kind==="unmodeled-surface")?[`Elements that hide together are one surface. ${s("create","surfaces")}`]:[];return[`${o.bad("fail")} \u2014 ${r(e.length,"static model violation")}:`,...e.map(a=>$(a)),...i].join(`
4
+ import{a as r}from"./chunk-OQ6KNYPG.js";import{a as s}from"./chunk-MHNGR6M7.js";import{a as k,b as C,c as F,d as b}from"./chunk-NY6EIQR4.js";import{A as v,E as $,c as u,g as o,q as c,s as f,u as m,v as p,w as g,x as y,y as h,z as S}from"./chunk-CTTC4KKQ.js";import{J as d,Q as l}from"./chunk-IKYR3UCU.js";async function P({cwd:e,lockfile:n}){let i=c(n),a=b(d(l,n));if(C({context:i,cwd:e})===a)return[];k({context:i,cwd:e});let t=await x(n);return F({cleanLockfileHash:t.length===0?a:null,context:i,cwd:e}),t}async function x(e){let n=u(e),i=await f(e),a=await m({context:c(e),facts:i.facts});return[...g(e).map(t=>({kind:"missing-precondition",missing:t})),...p(n,i.dataRules).map(t=>({gap:t,kind:"cascade-gap"})),...a.map(t=>({conflict:t,kind:"fact-conflict"})),...y(e).map(t=>({kind:"unreachable-interaction",violation:t})),...h(e).map(t=>({kind:"redundant-assertion",redundancy:t})),...S(e).map(t=>({kind:"unmodeled-surface",surface:t})),...v(e).map(t=>({content:t,kind:"unpinned-surface-content"}))]}function U(e){return`${o.good("ok")} \u2014 no static model violations (${r(e,"test")})`}function O(e){let i=e.some(a=>a.kind==="unmodeled-surface")?[`Elements that hide together are one surface. ${s("create","surfaces")}`]:[];return[`${o.bad("fail")} \u2014 ${r(e.length,"static model violation")}:`,...e.map(a=>$(a)),...i].join(`
5
5
 
6
6
  `)}function E(e){return[`${o.warn("warn")} \u2014 ${r(e.length,"model coverage gap")} (not blocking):`,...e.map(n=>` ${A(n)}`),`Stub the missing flows. ${s("discover")}`].join(`
7
7
  `)}function A(e){switch(e.kind){case"entity-never-given":return`${e.entity} \u2014 declared but no test seeds it`;case"entity-never-mutated":return`${e.entity} \u2014 seeded but never asserted created/updated/deleted`;case"unmatchable-delete-key":return`test ${e.workflow}/${e.testSlug} asserts ${e.entity} deleted with literal ${e.field} but no seeded ${e.entity} sets ${e.field} \u2014 solver treats it as no-match`}}export{P as a,U as b,O as c,E as d};
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{a as Ne,f as qe,g as Le,j as He,n as _e,o as We,p as Be,q as Ke,r as Ve}from"./chunk-22JUAYHM.js";import{c as Qe,e as Je,f as ze}from"./chunk-7CELUIVK.js";import{c as O}from"./chunk-7W237JFM.js";import{d as Ue}from"./chunk-TPHOSZAK.js";import{a as $}from"./chunk-R4ZTRVDQ.js";import{d as me}from"./chunk-FEHVIHVA.js";import{b as xe}from"./chunk-V4CLXOCP.js";import{a as ve}from"./chunk-5DT43ABQ.js";import{g as Fe}from"./chunk-RIVHBABX.js";import{g as Re,l as ke,m as Se,n as we}from"./chunk-L2ZJK7MP.js";import{c as D}from"./chunk-R3DZ6JPY.js";import{a as ge,d as u,f,g as I}from"./chunk-IPSXNIXC.js";import{D as Ae,G as Me,S as $e,T as je,W as Oe,X as De,a as R,b as T,c as Ee,d as be,e as Ie,f as j,j as Te,k as Ce,m as Pe,p as v}from"./chunk-4GA5662U.js";import{W as M,X as h,i as A,l as G,q as he}from"./chunk-XJJDHGK4.js";import Wn from"p-queue";var Bn=4,Kn={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},F=new Wn({concurrency:Bn}),k={headedActive:0,interactiveActive:0,interactiveQueued:0},Ge={current:null};function ro({headed:e,task:n,workClass:r}){let t=Kn[r];return r==="p3-explore"?F.add(n,{priority:t}):(k.interactiveQueued+=1,U(),F.add(()=>Vn({headed:e,task:n}),{priority:t}))}function to(e){!Number.isFinite(e)||e<1||(F.concurrency=Math.floor(e),U())}function Y(){return{active:k.interactiveActive,headedActive:k.headedActive,poolSize:F.concurrency,queued:k.interactiveQueued}}function oo(e){Ge.current=e}async function Vn({headed:e,task:n}){k.interactiveQueued-=1,k.interactiveActive+=1,k.headedActive+=e?1:0,U();try{return await n()}finally{k.interactiveActive-=1,k.headedActive-=e?1:0,U()}}function U(){Ge.current?.()}async function Ye(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(2e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}async function Xe(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(25e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}import{graphql as Qn}from"gql.tada";async function Ze(e,n){let t=(await u({config:e,document:Jn,variables:{cwd:n,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(t.flatMap(o=>o.tests.map(i=>[`${o.slug}/${i.slug}`,{testId:i.id,workflowId:o.id}])))}var Jn=Qn(`
4
+ import{a as Ne,f as qe,g as Le,j as He,n as _e,o as We,p as Be,q as Ke,r as Ve}from"./chunk-22JUAYHM.js";import{c as Qe,e as Je,f as ze}from"./chunk-OQ4TDIP3.js";import{c as O}from"./chunk-7W237JFM.js";import{d as Ue}from"./chunk-TPHOSZAK.js";import{a as $}from"./chunk-R4ZTRVDQ.js";import{d as me}from"./chunk-FEHVIHVA.js";import{b as xe}from"./chunk-2GFHB4LD.js";import{a as ve}from"./chunk-7IIRERCW.js";import{g as Fe}from"./chunk-NY6EIQR4.js";import{g as Re,l as ke,m as Se,n as we}from"./chunk-AWPZTNYU.js";import{c as D}from"./chunk-R3DZ6JPY.js";import{a as ge,d as u,f,g as I}from"./chunk-IPSXNIXC.js";import{D as Ae,G as Me,S as $e,T as je,W as Oe,X as De,a as R,b as T,c as Ee,d as be,e as Ie,f as j,j as Te,k as Ce,m as Pe,p as v}from"./chunk-CTTC4KKQ.js";import{V as M,W as h,i as A,k as G,p as he}from"./chunk-IKYR3UCU.js";import Wn from"p-queue";var Bn=4,Kn={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},F=new Wn({concurrency:Bn}),k={headedActive:0,interactiveActive:0,interactiveQueued:0},Ge={current:null};function ro({headed:e,task:n,workClass:r}){let t=Kn[r];return r==="p3-explore"?F.add(n,{priority:t}):(k.interactiveQueued+=1,U(),F.add(()=>Vn({headed:e,task:n}),{priority:t}))}function to(e){!Number.isFinite(e)||e<1||(F.concurrency=Math.floor(e),U())}function Y(){return{active:k.interactiveActive,headedActive:k.headedActive,poolSize:F.concurrency,queued:k.interactiveQueued}}function oo(e){Ge.current=e}async function Vn({headed:e,task:n}){k.interactiveQueued-=1,k.interactiveActive+=1,k.headedActive+=e?1:0,U();try{return await n()}finally{k.interactiveActive-=1,k.headedActive-=e?1:0,U()}}function U(){Ge.current?.()}async function Ye(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(2e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}async function Xe(e){try{return await fetch(e,{method:"HEAD",signal:AbortSignal.timeout(25e3)}),null}catch(n){return n instanceof Error?n.message:String(n)}}import{graphql as Qn}from"gql.tada";async function Ze(e,n){let t=(await u({config:e,document:Jn,variables:{cwd:n,projectId:e.projectId}})).project?.devSession?.workflows??[];return new Map(t.flatMap(o=>o.tests.map(i=>[`${o.slug}/${i.slug}`,{testId:i.id,workflowId:o.id}])))}var Jn=Qn(`
5
5
  query DaemonWorkflows($projectId: String!, $cwd: String!) {
6
6
  project(id: $projectId) {
7
7
  id
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
- import{K as T,L as S,Q as j,R as g,ca as B}from"./chunk-XJJDHGK4.js";import c from"fs";import l from"path";import{createHash as be}from"crypto";import{pathToFileURL as Fe}from"url";import{build as Pe}from"esbuild";import{err as L,ok as v,ResultAsync as ve}from"neverthrow";import ee from"fs";import y from"path";import u from"typescript";function M(e){let n=y.join(e,"index.ts"),t=re(e);ee.mkdirSync(y.dirname(t.tsBuildInfoFile??""),{recursive:!0});let r=u.createIncrementalCompilerHost(t),o=u.createIncrementalProgram({host:r,options:t,rootNames:[n]}),i=[...o.getSyntacticDiagnostics(),...o.getSemanticDiagnostics()];o.emit();let s=i.filter(a=>ne(a,e));if(s.length===0)return{diagnostics:[],ok:!0};let C={getCanonicalFileName:a=>a,getCurrentDirectory:()=>y.dirname(e),getNewLine:()=>`
4
+ import{J as T,K as S,P as j,Q as g,ba as B}from"./chunk-IKYR3UCU.js";import c from"fs";import l from"path";import{createHash as be}from"crypto";import{pathToFileURL as Fe}from"url";import{build as Pe}from"esbuild";import{err as L,ok as v,ResultAsync as ve}from"neverthrow";import ee from"fs";import y from"path";import u from"typescript";function M(e){let n=y.join(e,"index.ts"),t=re(e);ee.mkdirSync(y.dirname(t.tsBuildInfoFile??""),{recursive:!0});let r=u.createIncrementalCompilerHost(t),o=u.createIncrementalProgram({host:r,options:t,rootNames:[n]}),i=[...o.getSyntacticDiagnostics(),...o.getSemanticDiagnostics()];o.emit();let s=i.filter(a=>ne(a,e));if(s.length===0)return{diagnostics:[],ok:!0};let C={getCanonicalFileName:a=>a,getCurrentDirectory:()=>y.dirname(e),getNewLine:()=>`
5
5
  `};return{diagnostics:u.formatDiagnosticsWithColorAndContext(s,C).split(`
6
6
  `).filter(a=>a.length>0),ok:!1}}function ne(e,n){let t=e.file?.fileName;return t==null?!0:t.startsWith(n)}var te=y.join(".local","tsbuildinfo");function re(e){return{allowImportingTsExtensions:!0,allowJs:!1,esModuleInterop:!0,incremental:!0,module:u.ModuleKind.Preserve,moduleResolution:u.ModuleResolutionKind.Bundler,noEmit:!0,resolveJsonModule:!0,skipLibCheck:!0,strict:!1,target:u.ScriptTarget.ES2022,tsBuildInfoFile:y.join(e,te)}}import z from"fs";import ae from"safe-stable-stringify";import{err as le,ok as N,Result as ce}from"neverthrow";import H from"safe-stable-stringify";import{createHash as oe}from"crypto";import A from"fs";function h(){return E===void 0&&(E=ie()),E}var E;function ie(){let e=process.argv[1];if(e==null)return null;try{let n=A.readFileSync(A.realpathSync(e));return oe("sha256").update(n).digest("hex")}catch{return null}}function I(e){return{...e,checks:void 0,solved:{cosat:{},subsume:{}}}}function Ye(e,n){return H(I(e))===H(I(n))}function O(e){return _(e.checks?.expanderHash,h())}function _(e,n){return e!=null&&n!=null&&e===n}function W(e){return _(e??void 0,h())}import se from"safe-stable-stringify";function R(e){return U(e.entities,e.singletons,e.valueSpaces)}function Qe(e){return U(e.entities,e.singletonSchemas,e.valueSpaces)}function U(e,n,t){let r=se({entities:e,singletons:n,valueSpaces:t});if(r==null)throw new Error("solve-model: model is not serializable");return r}async function D(e,n){let t={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces},r=de(n),o=pe(e,r),i=await Promise.all(e.workflows.map(s=>fe({context:t,reusable:o,workflow:s})));return ce.combine(i).map(s=>({...e,workflows:[...s]}))}function de(e){let n=ue(e);if(!(n==null||!O(n)))return n}function ue(e){if(z.existsSync(e))try{return S(g,z.readFileSync(e,"utf8"))}catch{return}}async function fe({context:e,reusable:n,workflow:t}){let r=n.get($(t));if(r!=null)return N({...t,tests:r.tests});try{return N(await B({context:e,workflow:t}))}catch(o){let i=o instanceof Error?o.message:String(o);return le({kind:"expand-failed",message:i,workflow:t.name})}}function $(e){let n=ae({...e,tests:[]});if(n==null)throw new Error("solver: workflow is not serializable");return n}function pe(e,n){return n==null||R(n)!==R(e)?new Map:new Map(n.workflows.map(t=>[$(t),t]))}import{createHash as me}from"crypto";import J from"fs/promises";import b from"path";import{err as f,ok as F,Result as ge}from"neverthrow";var ye=".ripplo/fixtures",he=10*1024*1024,ke=50*1024*1024;async function K(e,n){let t=xe(n);if(t.length===0)return F({});let r=b.join(e,ye),o=await Promise.all(t.map(i=>Le({fixturesRoot:r,name:i})));return ge.combine(o).andThen(Se)}function xe(e){let t=e.workflows.flatMap(r=>[...r.steps,...r.tests.flatMap(o=>o.steps)]).flatMap(r=>r.action.kind==="upload"?r.action.files:[]);return[...new Set(t)].toSorted((r,o)=>r.localeCompare(o))}async function Le({fixturesRoot:e,name:n}){if(n.includes("..")||b.isAbsolute(n))return f({kind:"fixture-invalid-name",name:n});let t=b.join(e,n),r=await J.lstat(t).catch(()=>null);if(r==null)return f({kind:"fixture-missing",name:n,path:t});if(r.isSymbolicLink())return f({kind:"fixture-symlink",name:n});if(!r.isFile())return f({kind:"fixture-not-file",name:n});let o=await J.readFile(t);if(o.byteLength>he)return f({kind:"fixture-too-large",name:n,size:o.byteLength});let i=me("sha256").update(o).digest("hex");return F([n,{sha256:i,size:o.byteLength}])}function Se(e){let n=e.reduce((t,[,r])=>t+r.size,0);return n>ke?f({kind:"fixtures-total-too-large",total:n}):F(Object.fromEntries(e))}import{createHash as we}from"crypto";function k(e){return we("sha256").update(e).digest("base64")}import p from"fs";import P from"path";import{z as w}from"zod";function X({cwd:e,fingerprint:n}){let t=Re(e);if(t==null||t.fingerprint!==k(n))return;let r=P.join(e,".ripplo","ripplo.lock");if(!p.existsSync(r))return;let o=p.readFileSync(r,"utf8");if(k(o)===t.lockfileHash)try{return S(g,o)}catch{return}}function V({cwd:e,fingerprint:n,lockfile:t}){let r={bundle:h(),fingerprint:k(n),lockfileHash:k(T(g,t))},o=Y(e);p.mkdirSync(P.dirname(o),{recursive:!0}),p.writeFileSync(o,JSON.stringify(r))}var Ee=w.object({bundle:w.string().nullable(),fingerprint:w.string(),lockfileHash:w.string()});function Re(e){let n=Y(e);if(p.existsSync(n))try{let t=Ee.safeParse(JSON.parse(p.readFileSync(n,"utf8")));return!t.success||!W(t.data.bundle)?void 0:t.data}catch{return}}function Y(e){return P.join(e,".ripplo",".local","load-cache.json")}var Ce=".ripplo/ripplo.lock",x;async function Hn(e){let{result:n}=await Te(e);return n}async function Te(e){let n=q(l.join(e,".ripplo"));if(x!=null&&x.fingerprint===n&&x.result.isOk())return{fingerprint:n,result:x.result};let t=await je(e);return x={fingerprint:n,result:t},{fingerprint:n,result:t}}async function je(e){let n=l.join(e,".ripplo"),t=l.join(n,"index.ts"),r=q(n),o=X({cwd:e,fingerprint:r});if(o!=null)return v(o);let i=Ae(t);i.catch(()=>{});let s=M(n);if(!s.ok)return L({diagnostics:s.diagnostics,kind:"typecheck-failed"});let a=await(await He(t,i)).andThen(d=>_e({entryPath:t,exported:d})).match(async d=>(await K(e,d)).map(m=>({...d,fixtures:m})).mapErr(m=>({error:m,kind:"fixture-failed"})).asyncAndThen(m=>new ve(D(m,l.join(e,Ce))).mapErr(Z=>Z)),d=>Promise.resolve(L(d)));return a.isOk()&&V({cwd:e,fingerprint:r,lockfile:a.value}),a}var Be=new Set([".local","debug","node_modules","ripplo.lock"]);function q(e){let n=l.join(e,"..","node_modules","@ripplo","testing","package.json");return[...G(e),...Me(n)].toSorted((t,r)=>t.localeCompare(r)).join("|")}function G(e){return(c.existsSync(e)?c.readdirSync(e,{withFileTypes:!0}):[]).flatMap(t=>{if(Be.has(t.name))return[];let r=l.join(e,t.name);if(t.isDirectory())return G(r);let o=c.statSync(r);return[`${r}:${String(o.mtimeMs)}:${String(o.size)}`]})}function Me(e){if(!c.existsSync(e))return[];let n=c.statSync(e);return[`${e}:${String(n.mtimeMs)}:${String(n.size)}`]}async function Ae(e){let t=(await Pe({bundle:!0,entryPoints:[e],format:"esm",logLevel:"silent",platform:"node",sourcemap:"inline",target:"node22",write:!1})).outputFiles[0];if(t==null)throw new Error("dsl bundle produced no output");return t.text}async function He(e,n){try{let t=await n;process.setSourceMapsEnabled(!0);let r=await import(Ie(e,t)),o=r!=null&&typeof r=="object"&&"default"in r?Reflect.get(r,"default"):r;return v(o)}catch(t){return L({kind:"load-threw",message:Oe(t)})}}function Ie(e,n){let t=l.join(l.dirname(e),".local");c.mkdirSync(t,{recursive:!0});let r=be("sha256").update(n).digest("hex").slice(0,16),o=l.join(t,`dsl-bundle-${r}.mjs`);return c.writeFileSync(o,n),Fe(o).href}function Oe(e){return e instanceof Error?e.message:String(e)}function _e({entryPath:e,exported:n}){if(n==null||typeof n!="object"||!("lockfile"in n))return L({entryPath:e,kind:"not-ripplo"});let t=j.safeParse(Reflect.get(n,"lockfile"));return t.success?v(t.data):L({issues:t.error.issues.map(r=>`${r.path.join(".")}: ${r.message}`),kind:"invalid-lockfile"})}export{h as a,Ye as b,O as c,W as d,R as e,Qe as f,ye as g,he as h,ke as i,k as j,Ce as k,Hn as l,Te as m,je as n};