ripplo 0.14.0 → 0.15.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.
Files changed (41) hide show
  1. package/dist/{chunk-BQ25IGJS.js → chunk-5JXP37ET.js} +1 -1
  2. package/dist/{chunk-3ZQRLG7C.js → chunk-5PICILBD.js} +1 -1
  3. package/dist/{chunk-U4LFIMDP.js → chunk-ANAQCK5G.js} +1 -1
  4. package/dist/{chunk-ULIHURY6.js → chunk-AUXGLJ3J.js} +1 -1
  5. package/dist/{chunk-GTB7NYDE.js → chunk-BTIQ5H3K.js} +1 -1
  6. package/dist/{chunk-R3FZ2JEW.js → chunk-EVEITUJH.js} +1 -1
  7. package/dist/{chunk-PWDBRLJP.js → chunk-EYILCSW6.js} +1 -1
  8. package/dist/chunk-F4UCCW7Q.js +83 -0
  9. package/dist/chunk-IRT6UHD3.js +61 -0
  10. package/dist/{chunk-AVBTPZUU.js → chunk-IVW5DUE4.js} +1 -1
  11. package/dist/{chunk-B5HDXHPI.js → chunk-JPXTGKSB.js} +2 -2
  12. package/dist/{chunk-ZGWV564Y.js → chunk-KL6TIUNF.js} +1 -1
  13. package/dist/{chunk-NXKOUVSC.js → chunk-KOZTQJBB.js} +18 -18
  14. package/dist/{chunk-75T33SK5.js → chunk-NUBMOTH6.js} +1 -1
  15. package/dist/{chunk-6JXOIP2T.js → chunk-O4A5UISQ.js} +1 -1
  16. package/dist/{chunk-LEYSGMW2.js → chunk-QQ6VKZ6A.js} +1 -1
  17. package/dist/{chunk-56MARCN3.js → chunk-QSKOYBDO.js} +1 -1
  18. package/dist/{chunk-EOBWMMVC.js → chunk-RXLDAR2J.js} +1 -1
  19. package/dist/{chunk-Q7FIZGKZ.js → chunk-XPOOWIRL.js} +1 -1
  20. package/dist/{cli-error-N7X2CREI.js → cli-error-7LCAN3Z5.js} +1 -1
  21. package/dist/{compile-write-XMVD5PX2.js → compile-write-Y5III4OM.js} +1 -1
  22. package/dist/daemon-6UYMYGPI.js +175 -0
  23. package/dist/{daemon-DARMT5AV.js → daemon-EITBDEP7.js} +1 -1
  24. package/dist/{dsl-loader-SSXMC5EE.js → dsl-loader-ASNZDV7E.js} +1 -1
  25. package/dist/hook.js +1 -1
  26. package/dist/index.js +2 -2
  27. package/dist/{plan-reminder-K7HOFGJN.js → plan-reminder-6VWOS6HD.js} +1 -1
  28. package/dist/{post-edit-OI6DDU25.js → post-edit-A5Y26UH5.js} +1 -1
  29. package/dist/post-edit-analyze-2SBNWX6Y.js +4 -0
  30. package/dist/{post-edit-flag-stubs-IKIH5DAH.js → post-edit-flag-stubs-I43B5QPO.js} +1 -1
  31. package/dist/{pre-edit-IOWNUOZY.js → pre-edit-HJVNM7U5.js} +1 -1
  32. package/dist/{pre-edit-watch-gate-N7FI5HBA.js → pre-edit-watch-gate-G6BVWIDL.js} +1 -1
  33. package/dist/{prompt-submit-ZU466ET5.js → prompt-submit-OXYVNXHK.js} +1 -1
  34. package/dist/status-XUIBJXNP.js +4 -0
  35. package/dist/{stop-enforce-4UUK36YU.js → stop-enforce-BP6IIW3D.js} +1 -1
  36. package/package.json +5 -5
  37. package/dist/chunk-NIC2DOQW.js +0 -51
  38. package/dist/chunk-PVRM4YWS.js +0 -83
  39. package/dist/daemon-ZUDQ7ERI.js +0 -152
  40. package/dist/post-edit-analyze-6V5YI3CR.js +0 -4
  41. package/dist/status-OSHZ3JGU.js +0 -4
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __ripploCreateRequire } from "node:module";
3
+ const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
+ import{c as x}from"./chunk-JS3DLVVI.js";import{f as I,j as R,m as v}from"./chunk-5JXP37ET.js";import{Ka as P,Ma as k,U as h,sa as w}from"./chunk-KOZTQJBB.js";import{a as S,f as m}from"./chunk-KH4QH23U.js";import{d as l,f}from"./chunk-C7SV6AR2.js";import y from"fs";import p from"path";function D(e){try{let o=L(e);if(o==null)return;let t=p.join(o,"HEAD"),n=y.readFileSync(t,"utf8").trim(),r="ref: refs/heads/";return n.startsWith(r)?n.slice(r.length):n.length===0?void 0:n.slice(0,7)}catch{return}}function L(e){let o=p.join(e,".git");if(y.statSync(o).isDirectory())return o;let n=y.readFileSync(o,"utf8").trim(),r="gitdir:";if(!n.startsWith(r))return;let i=n.slice(r.length).trim();if(i.length!==0)return p.resolve(e,i)}import C from"crypto";import{readFile as $}from"fs/promises";import j from"path";import{graphql as g}from"gql.tada";import{err as _,ok as F}from"neverthrow";var W=g(`
5
+ mutation SyncDevSession(
6
+ $projectId: String!
7
+ $cwd: String!
8
+ $branch: String
9
+ $lockfileContent: String
10
+ $fixtures: [SyncDevFixtureInput!]
11
+ $teleportProtocolVersion: Int!
12
+ $workflows: [SyncDevWorkflowInput!]!
13
+ ) {
14
+ syncDevSession(
15
+ projectId: $projectId
16
+ cwd: $cwd
17
+ branch: $branch
18
+ lockfileContent: $lockfileContent
19
+ fixtures: $fixtures
20
+ teleportProtocolVersion: $teleportProtocolVersion
21
+ workflows: $workflows
22
+ ) {
23
+ id
24
+ hooksPaused
25
+ }
26
+ }
27
+ `);async function ue(e,o){let t=await v(e);if(t.isErr())return _({error:t.error,kind:"compilation-failed"});let n=await u({config:o,cwd:e,lockfile:t.value});return F({devSessionId:n.devSessionId,lockfile:t.value})}async function u(e){let o=P(e.lockfile);return M({config:e.config,cwd:e.cwd,fixtures:e.lockfile.fixtures,payload:o})}var V=g(`
28
+ query DevSessionSyncState($projectId: String!, $cwd: String!) {
29
+ project(id: $projectId) {
30
+ devSession(cwd: $cwd) {
31
+ id
32
+ hooksPaused
33
+ lockfileHash
34
+ }
35
+ }
36
+ }
37
+ `),H=g(`
38
+ mutation AnnounceDevSessionActive(
39
+ $projectId: String!
40
+ $cwd: String!
41
+ $teleportProtocolVersion: Int!
42
+ ) {
43
+ announceDevSessionActive(
44
+ projectId: $projectId
45
+ cwd: $cwd
46
+ teleportProtocolVersion: $teleportProtocolVersion
47
+ )
48
+ }
49
+ `);async function fe(e){let o=await q(e.cwd);if(o!=null){let n=(await l({config:e.config,document:V,variables:{cwd:e.cwd,projectId:e.config.projectId}}).catch(()=>null))?.project?.devSession;if(n!=null&&n.lockfileHash===o)return await l({config:e.config,document:H,variables:{cwd:e.cwd,projectId:e.config.projectId,teleportProtocolVersion:2}}).catch(()=>null),{devSessionId:n.id,hooksPaused:n.hooksPaused}}return u(e)}async function q(e){let o=await b(e);return o==null?null:T(o)}function ye(e){return T(h(w,e))}function T(e){return C.createHash("sha256").update(e).digest("hex")}async function M({config:e,cwd:o,fixtures:t,payload:n}){let r=D(o),i=await b(o),a=await N(o,t),s=await l({config:e,document:W,variables:{branch:r??null,cwd:o,fixtures:a,lockfileContent:i,projectId:e.projectId,teleportProtocolVersion:2,workflows:n.workflows.map(c=>({expectedOutcome:c.expectedOutcome,name:c.name,slug:c.slug,sourcePath:c.sourcePath,spec:JSON.stringify(c.spec)}))}});if(s.syncDevSession==null)throw new Error("syncDevSession returned null");return{devSessionId:s.syncDevSession.id,hooksPaused:s.syncDevSession.hooksPaused}}async function N(e,o){let t=Object.entries(o);return Promise.all(t.map(async([n,r])=>({contentBase64:(await $(j.join(e,I,n))).toString("base64"),sha256:r.sha256})))}async function b(e){try{return await $(j.join(e,R),"utf8")}catch{return null}}import{graphql as B}from"gql.tada";var G=B(`
50
+ mutation AutoScopeAddDirty($projectId: String!, $cwd: String!, $workflowSlugs: [String!]!) {
51
+ addDirtyTestsToScope(projectId: $projectId, cwd: $cwd, workflowSlugs: $workflowSlugs) {
52
+ __typename
53
+ ... on MutationAddDirtyTestsToScopeSuccess {
54
+ data {
55
+ id
56
+ }
57
+ }
58
+ }
59
+ }
60
+ `);async function Ie({cwd:e,editedPath:o,lockfile:t,requireHooks:n,syncFirst:r}){if(n&&!m(e))return{addedSlugs:[]};let i=new Set(K(e)),a=t.workflows.filter(d=>d.sourcePath!=null&&J({dirtySet:i,editedPath:o,sourcePath:d.sourcePath})).map(d=>k(d.name));if(a.length===0)return{addedSlugs:[]};let s=x(e).unwrapOr(void 0);return s==null?{addedSlugs:[]}:r&&!await U({cfg:s,cwd:e,lockfile:t})?{addedSlugs:[]}:{addedSlugs:await X({cfg:s,slugs:a})?a:[]}}async function U({cfg:e,cwd:o,lockfile:t}){return await u({config:e,cwd:o,lockfile:t}).catch(r=>(f.warn("auto-sync failed: %s",r instanceof Error?r.message:String(r)),null))!=null}async function X({cfg:e,slugs:o}){let n=(await l({config:e,document:G,variables:{cwd:e.cwd,projectId:e.projectId,workflowSlugs:[...o]}}).catch(r=>(f.warn("auto-scope failed: %s",r instanceof Error?r.message:String(r)),null)))?.addDirtyTestsToScope;return n?.__typename!=="MutationAddDirtyTestsToScopeSuccess"?!1:n.data.length>0}function J({dirtySet:e,editedPath:o,sourcePath:t}){return e.has(t)||o!=null&&o.endsWith(t)}var A=".ripplo/workflows/",O=" -> ";function K(e){let o;try{o=S(["status","--porcelain","-uall","--",".ripplo/workflows"],e)}catch{return[]}return o.split(`
61
+ `).map(t=>t.slice(3).trim()).map(t=>t.includes(O)?t.split(O)[1]:t).filter(t=>t!=null).filter(t=>t.startsWith(A)&&t.endsWith(".ts")).map(t=>t.slice(A.length)).filter(t=>t!=="index.ts"&&!t.endsWith("/index.ts"))}export{D as a,ue as b,u as c,fe as d,q as e,ye as f,Ie as g};
@@ -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 sn,f as ln,g as dn,j as un,n as cn,o as pn,p as gn,q as fn,r as yn}from"./chunk-U4LFIMDP.js";import{b as mn}from"./chunk-PWDBRLJP.js";import{c as rn,e as tn,g as on}from"./chunk-NIC2DOQW.js";import{a as an}from"./chunk-EOBWMMVC.js";import{c as L}from"./chunk-JS3DLVVI.js";import{a as U}from"./chunk-R4ZTRVDQ.js";import{d as be}from"./chunk-FEHVIHVA.js";import{i as en,j as nn}from"./chunk-GTB7NYDE.js";import{F as Ke,I as oe,L as Je,M as Qe,Q as ze,R as Ge,V as Xe,a as te,aa as Ye,b as Ne,ba as Ze,c as Le,d as He,e as I,i as _e,j as Be,l as We,n as M,o as O,p as Ve,r as C}from"./chunk-PVRM4YWS.js";import{f as je,k as Ue,l as De,m as qe}from"./chunk-BQ25IGJS.js";import{Ia as $e,L as Ae,La as Fe,Ma as k,N as re,W as N,X as Te,Y as Me,Z as Oe,a as ne,t as q}from"./chunk-NXKOUVSC.js";import{d as Ce}from"./chunk-KH4QH23U.js";import{c as D}from"./chunk-RIASQHPG.js";import{a as Ie,d as u,f as g,g as T}from"./chunk-C7SV6AR2.js";import wr from"p-queue";var vr=4,Er={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},H=new wr({concurrency:vr}),w={headedActive:0,interactiveActive:0,interactiveQueued:0},Rn={current:null};function hi({headed:e,task:n,workClass:r}){let t=Er[r];return r==="p3-explore"?H.add(n,{priority:t}):(w.interactiveQueued+=1,_(),H.add(()=>xr({headed:e,task:n}),{priority:t}))}function ki(e){!Number.isFinite(e)||e<1||(H.concurrency=Math.floor(e),_())}function ie(){return{active:w.interactiveActive,headedActive:w.headedActive,poolSize:H.concurrency,queued:w.interactiveQueued}}function Si(e){Rn.current=e}async function xr({headed:e,task:n}){w.interactiveQueued-=1,w.interactiveActive+=1,w.headedActive+=e?1:0,_();try{return await n()}finally{w.interactiveActive-=1,w.headedActive-=e?1:0,_()}}function _(){Rn.current?.()}async function hn(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 kn(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 Pr}from"gql.tada";async function Sn(e,n){let t=(await u({config:e,document:br,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 br=Pr(`
4
+ import{a as sn,f as ln,g as dn,j as un,n as cn,o as pn,p as gn,q as fn,r as yn}from"./chunk-ANAQCK5G.js";import{b as mn}from"./chunk-EYILCSW6.js";import{c as rn,e as tn,g as on}from"./chunk-IRT6UHD3.js";import{a as an}from"./chunk-RXLDAR2J.js";import{c as L}from"./chunk-JS3DLVVI.js";import{a as U}from"./chunk-R4ZTRVDQ.js";import{d as be}from"./chunk-FEHVIHVA.js";import{i as en,j as nn}from"./chunk-BTIQ5H3K.js";import{F as Ke,I as oe,L as Je,M as Qe,Q as ze,R as Ge,V as Xe,a as te,aa as Ye,b as Ne,ba as Ze,c as Le,d as He,e as I,i as _e,j as Be,l as We,n as M,o as O,p as Ve,r as C}from"./chunk-F4UCCW7Q.js";import{f as je,k as Ue,l as De,m as qe}from"./chunk-5JXP37ET.js";import{Ia as $e,L as Ae,La as Fe,Ma as k,N as re,W as N,X as Te,Y as Me,Z as Oe,a as ne,t as q}from"./chunk-KOZTQJBB.js";import{d as Ce}from"./chunk-KH4QH23U.js";import{c as D}from"./chunk-RIASQHPG.js";import{a as Ie,d as u,f as g,g as T}from"./chunk-C7SV6AR2.js";import wr from"p-queue";var vr=4,Er={"p0-ui":3,"p1-cli":2,"p2-cover":1,"p3-explore":0},H=new wr({concurrency:vr}),w={headedActive:0,interactiveActive:0,interactiveQueued:0},Rn={current:null};function hi({headed:e,task:n,workClass:r}){let t=Er[r];return r==="p3-explore"?H.add(n,{priority:t}):(w.interactiveQueued+=1,_(),H.add(()=>xr({headed:e,task:n}),{priority:t}))}function ki(e){!Number.isFinite(e)||e<1||(H.concurrency=Math.floor(e),_())}function ie(){return{active:w.interactiveActive,headedActive:w.headedActive,poolSize:H.concurrency,queued:w.interactiveQueued}}function Si(e){Rn.current=e}async function xr({headed:e,task:n}){w.interactiveQueued-=1,w.interactiveActive+=1,w.headedActive+=e?1:0,_();try{return await n()}finally{w.interactiveActive-=1,w.headedActive-=e?1:0,_()}}function _(){Rn.current?.()}async function hn(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 kn(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 Pr}from"gql.tada";async function Sn(e,n){let t=(await u({config:e,document:br,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 br=Pr(`
5
5
  query DaemonWorkflows($projectId: String!, $cwd: String!) {
6
6
  project(id: $projectId) {
7
7
  id
@@ -2,6 +2,6 @@
2
2
  import { createRequire as __ripploCreateRequire } from "node:module";
3
3
  const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
4
  import{a as p,c as t}from"./chunk-KOKEEAEF.js";import{a as s}from"./chunk-HEOMRXZE.js";function l(){let o=process.cwd(),e=s(o);e!=null&&e!==o&&(process.chdir(e),process.stderr.write(`ripplo: resolved .ripplo/ at ${e}
5
- `))}var d={"exit-plan-gate":()=>import("./exit-plan-gate-44YWEKYS.js").then(o=>o.exitPlanGateHook),"plan-reminder":()=>import("./plan-reminder-K7HOFGJN.js").then(o=>t("UserPromptSubmit",o.planReminder)),"post-edit":()=>import("./post-edit-OI6DDU25.js").then(o=>o.postEditHook),"post-edit-analyze":()=>import("./post-edit-analyze-6V5YI3CR.js").then(o=>t("PostToolUse",o.postEditAnalyze)),"post-edit-flag-stubs":()=>import("./post-edit-flag-stubs-IKIH5DAH.js").then(o=>t("PostToolUse",o.postEditFlagStubs)),"pre-bash-run-gate":()=>import("./pre-bash-run-gate-CDFNAIK3.js").then(o=>o.preBashRunGateHook),"pre-edit":()=>import("./pre-edit-IOWNUOZY.js").then(o=>o.preEditHook),"pre-edit-ripplo-skill-gate":()=>import("./pre-edit-ripplo-skill-gate-A6ETC3QN.js").then(o=>t("PreToolUse",o.preEditRipploSkillGate)),"pre-edit-scope-gate":()=>import("./pre-edit-scope-gate-HNIQ7KOQ.js").then(o=>t("PreToolUse",o.preEditScopeGate)),"pre-edit-watch-gate":()=>import("./pre-edit-watch-gate-N7FI5HBA.js").then(o=>t("PreToolUse",o.preEditWatchGate)),"prompt-submit":()=>import("./prompt-submit-ZU466ET5.js").then(o=>o.promptSubmitHook),"scope-reminder":()=>import("./scope-reminder-A6GVTTVE.js").then(o=>t("UserPromptSubmit",o.scopeReminder)),"session-preamble":()=>import("./session-preamble-IZQPIWST.js").then(o=>o.sessionPreambleHook),"stop-enforce":()=>import("./stop-enforce-4UUK36YU.js").then(o=>o.stopEnforceHook),"tasks-reminder":()=>import("./tasks-reminder-TDWPD3KV.js").then(o=>t("UserPromptSubmit",o.tasksReminder)),"tasks-reminder-tool":()=>Promise.resolve(t("PostToolUse",()=>{})),"track-skill-load":()=>import("./track-skill-load-SXSDMHFO.js").then(o=>o.trackSkillLoadHook),"track-skill-prompt":()=>import("./track-skill-prompt-7N4TQAD2.js").then(o=>t("UserPromptSubmit",o.trackSkillPrompt))},n=d;async function P(o){let e=n[o];e==null&&(process.stderr.write(`Unknown hook: ${o}
6
- `),process.exit(1));let i=await m(),r=await p(await e(),i);if(r.kind==="crash"){let{renderHookCrash:a}=await import("./cli-error-N7X2CREI.js");process.stderr.write(`${a(o,r.error)}
5
+ `))}var d={"exit-plan-gate":()=>import("./exit-plan-gate-44YWEKYS.js").then(o=>o.exitPlanGateHook),"plan-reminder":()=>import("./plan-reminder-6VWOS6HD.js").then(o=>t("UserPromptSubmit",o.planReminder)),"post-edit":()=>import("./post-edit-A5Y26UH5.js").then(o=>o.postEditHook),"post-edit-analyze":()=>import("./post-edit-analyze-2SBNWX6Y.js").then(o=>t("PostToolUse",o.postEditAnalyze)),"post-edit-flag-stubs":()=>import("./post-edit-flag-stubs-I43B5QPO.js").then(o=>t("PostToolUse",o.postEditFlagStubs)),"pre-bash-run-gate":()=>import("./pre-bash-run-gate-CDFNAIK3.js").then(o=>o.preBashRunGateHook),"pre-edit":()=>import("./pre-edit-HJVNM7U5.js").then(o=>o.preEditHook),"pre-edit-ripplo-skill-gate":()=>import("./pre-edit-ripplo-skill-gate-A6ETC3QN.js").then(o=>t("PreToolUse",o.preEditRipploSkillGate)),"pre-edit-scope-gate":()=>import("./pre-edit-scope-gate-HNIQ7KOQ.js").then(o=>t("PreToolUse",o.preEditScopeGate)),"pre-edit-watch-gate":()=>import("./pre-edit-watch-gate-G6BVWIDL.js").then(o=>t("PreToolUse",o.preEditWatchGate)),"prompt-submit":()=>import("./prompt-submit-OXYVNXHK.js").then(o=>o.promptSubmitHook),"scope-reminder":()=>import("./scope-reminder-A6GVTTVE.js").then(o=>t("UserPromptSubmit",o.scopeReminder)),"session-preamble":()=>import("./session-preamble-IZQPIWST.js").then(o=>o.sessionPreambleHook),"stop-enforce":()=>import("./stop-enforce-BP6IIW3D.js").then(o=>o.stopEnforceHook),"tasks-reminder":()=>import("./tasks-reminder-TDWPD3KV.js").then(o=>t("UserPromptSubmit",o.tasksReminder)),"tasks-reminder-tool":()=>Promise.resolve(t("PostToolUse",()=>{})),"track-skill-load":()=>import("./track-skill-load-SXSDMHFO.js").then(o=>o.trackSkillLoadHook),"track-skill-prompt":()=>import("./track-skill-prompt-7N4TQAD2.js").then(o=>t("UserPromptSubmit",o.trackSkillPrompt))},n=d;async function P(o){let e=n[o];e==null&&(process.stderr.write(`Unknown hook: ${o}
6
+ `),process.exit(1));let i=await m(),r=await p(await e(),i);if(r.kind==="crash"){let{renderHookCrash:a}=await import("./cli-error-7LCAN3Z5.js");process.stderr.write(`${a(o,r.error)}
7
7
  `),process.exit(0)}r.stdout!=null&&process.stdout.write(r.stdout),process.exit(0)}function m(){return new Promise((o,e)=>{if(process.stdin.isTTY){o("");return}let i=[];process.stdin.on("data",r=>i.push(r)),process.stdin.on("end",()=>{o(Buffer.concat(i).toString("utf8"))}),process.stdin.on("error",e)})}export{l as a,n as b,P as c};
@@ -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,d as u,e as y,f as E,h as w,i as C,k as b,l as g,m as R,n as h,o as v,p as m,q as M,r as N}from"./chunk-U4LFIMDP.js";import{a as D}from"./chunk-R4ZTRVDQ.js";import{i as P}from"./chunk-C7SV6AR2.js";import{spawn as L}from"child_process";import q from"fs";import V from"net";import{setTimeout as p}from"timers/promises";import{err as d,ok as f}from"neverthrow";import{ResponseError as j}from"vscode-jsonrpc/node";var I=12e4,_=300,x=5e3;async function an({cliEntry:o,cwd:n}){let e=u(n),t=await s(e);return t!=null?A({cliEntry:o,connection:l(t,!1),cwd:n}):T({cliEntry:o,cwd:n,versionNote:void 0})}async function sn({cliEntry:o,cwd:n}){let e=await s(u(n));return e==null?d({kind:"not-running"}):A({cliEntry:o,connection:l(e,!1),cwd:n})}async function T({cliEntry:o,cwd:n,versionNote:e}){let t=H({cliEntry:o,cwd:n});if(t!=null)return d(t);let r=await Q(u(n));return r==null?d({deadlineMs:I,kind:"connect-timeout",logPath:y(n)}):f({...l(r,!0),versionNote:e})}async function A({cliEntry:o,connection:n,cwd:e}){let t=await O(n);if(t==null||t.version===D()&&!G(t))return f(n);let r={daemonVersion:t.version};return await J(n)?(n.socket.destroy(),await B(u(e))?T({cliEntry:o,cwd:e,versionNote:{...r,kind:"restarted"}}):d({kind:"connection-lost"})):f({...n,versionNote:{...r,kind:"stale-busy"}})}var U=1e3;function G(o){let n=S(process.argv[1]);return n==null||o.bundleMtimeMs==null?!1:n>o.bundleMtimeMs+U}async function J(o){try{return await o.rpc.sendRequest(m)}catch{return!1}}var K=1e4;async function B(o){let n=Date.now()+K,e=await s(o);for(;e!=null&&Date.now()<n;)e.destroy(),await p(_),e=await s(o);return e?.destroy(),e==null}async function cn({connection:o,onEvent:n,request:e,token:t}){let r=await F({connection:o,onEvent:n,request:e,token:t});return r.kind==="transport"?d(r.error):f(r)}async function un(o){let n=await s(u(o));if(n==null)return!1;let e=l(n,!1);try{return await e.rpc.sendRequest(m)}catch{return!1}finally{n.destroy()}}async function dn(o){try{await o.rpc.sendRequest(m)}catch{}}async function ln(o){let n=await s(u(o));if(n==null)return{kind:"not-running"};let e=l(n,!1),t=await Promise.race([O(e),p(x).then(()=>null)]);return n.destroy(),t==null?{kind:"unresponsive",timeoutMs:x}:{kind:"running",status:t}}async function O(o){try{let n=await o.rpc.sendRequest(v),e=C.safeParse(n);return e.success?e.data:null}catch{return null}}function F({connection:o,onEvent:n,request:e,token:t}){let{rpc:r}=o;return new Promise(k=>{let i=a=>{k(a)};r.onNotification(M,a=>{let c=b.safeParse(a);if(!c.success){i({error:{kind:"bad-frame"},kind:"transport"});return}n(c.data.event)}),r.onNotification(N,a=>{let c=g.safeParse(a);if(!c.success){i({error:{kind:"bad-frame"},kind:"transport"});return}i({failed:c.data.failed,kind:"done",notRun:c.data.notRun,passed:c.data.passed})}),r.onClose(()=>{i({error:{kind:"connection-lost"},kind:"transport"})}),r.sendRequest(h,e,t).then(a=>{w.safeParse(a).success||i({error:{kind:"bad-frame"},kind:"transport"})}).catch(a=>{i(z(a))})})}function z(o){if(o instanceof j){let n=R.safeParse(o.data);return n.success?{error:n.data,kind:"daemon-error"}:{error:{kind:"bad-frame"},kind:"transport"}}return{error:{kind:"connection-lost"},kind:"transport"}}function l(o,n){let e=E(o);return e.listen(),{rpc:e,socket:o,spawned:n,versionNote:void 0}}function s(o){return new Promise(n=>{let e=V.connect(o);e.once("connect",()=>{n(e)}),e.once("error",()=>{n(null)})})}function H({cliEntry:o,cwd:n}){try{P(n);let e=q.openSync(y(n),"a");return L(process.execPath,[o,"daemon"],{cwd:n,detached:!0,stdio:["ignore",e,e]}).unref(),q.closeSync(e),null}catch(e){return{kind:"spawn-failed",message:e instanceof Error?e.message:String(e)}}}async function Q(o){let n=Date.now()+I,e=await s(o);for(;e==null&&Date.now()<n;)await p(_),e=await s(o);return e}export{an as a,sn as b,cn as c,un as d,dn as e,ln as f};
4
+ import{a as S,d as u,e as y,f as E,h as w,i as C,k as b,l as g,m as R,n as h,o as v,p as m,q as M,r as N}from"./chunk-ANAQCK5G.js";import{a as D}from"./chunk-R4ZTRVDQ.js";import{i as P}from"./chunk-C7SV6AR2.js";import{spawn as L}from"child_process";import q from"fs";import V from"net";import{setTimeout as p}from"timers/promises";import{err as d,ok as f}from"neverthrow";import{ResponseError as j}from"vscode-jsonrpc/node";var I=12e4,_=300,x=5e3;async function an({cliEntry:o,cwd:n}){let e=u(n),t=await s(e);return t!=null?A({cliEntry:o,connection:l(t,!1),cwd:n}):T({cliEntry:o,cwd:n,versionNote:void 0})}async function sn({cliEntry:o,cwd:n}){let e=await s(u(n));return e==null?d({kind:"not-running"}):A({cliEntry:o,connection:l(e,!1),cwd:n})}async function T({cliEntry:o,cwd:n,versionNote:e}){let t=H({cliEntry:o,cwd:n});if(t!=null)return d(t);let r=await Q(u(n));return r==null?d({deadlineMs:I,kind:"connect-timeout",logPath:y(n)}):f({...l(r,!0),versionNote:e})}async function A({cliEntry:o,connection:n,cwd:e}){let t=await O(n);if(t==null||t.version===D()&&!G(t))return f(n);let r={daemonVersion:t.version};return await J(n)?(n.socket.destroy(),await B(u(e))?T({cliEntry:o,cwd:e,versionNote:{...r,kind:"restarted"}}):d({kind:"connection-lost"})):f({...n,versionNote:{...r,kind:"stale-busy"}})}var U=1e3;function G(o){let n=S(process.argv[1]);return n==null||o.bundleMtimeMs==null?!1:n>o.bundleMtimeMs+U}async function J(o){try{return await o.rpc.sendRequest(m)}catch{return!1}}var K=1e4;async function B(o){let n=Date.now()+K,e=await s(o);for(;e!=null&&Date.now()<n;)e.destroy(),await p(_),e=await s(o);return e?.destroy(),e==null}async function cn({connection:o,onEvent:n,request:e,token:t}){let r=await F({connection:o,onEvent:n,request:e,token:t});return r.kind==="transport"?d(r.error):f(r)}async function un(o){let n=await s(u(o));if(n==null)return!1;let e=l(n,!1);try{return await e.rpc.sendRequest(m)}catch{return!1}finally{n.destroy()}}async function dn(o){try{await o.rpc.sendRequest(m)}catch{}}async function ln(o){let n=await s(u(o));if(n==null)return{kind:"not-running"};let e=l(n,!1),t=await Promise.race([O(e),p(x).then(()=>null)]);return n.destroy(),t==null?{kind:"unresponsive",timeoutMs:x}:{kind:"running",status:t}}async function O(o){try{let n=await o.rpc.sendRequest(v),e=C.safeParse(n);return e.success?e.data:null}catch{return null}}function F({connection:o,onEvent:n,request:e,token:t}){let{rpc:r}=o;return new Promise(k=>{let i=a=>{k(a)};r.onNotification(M,a=>{let c=b.safeParse(a);if(!c.success){i({error:{kind:"bad-frame"},kind:"transport"});return}n(c.data.event)}),r.onNotification(N,a=>{let c=g.safeParse(a);if(!c.success){i({error:{kind:"bad-frame"},kind:"transport"});return}i({failed:c.data.failed,kind:"done",notRun:c.data.notRun,passed:c.data.passed})}),r.onClose(()=>{i({error:{kind:"connection-lost"},kind:"transport"})}),r.sendRequest(h,e,t).then(a=>{w.safeParse(a).success||i({error:{kind:"bad-frame"},kind:"transport"})}).catch(a=>{i(z(a))})})}function z(o){if(o instanceof j){let n=R.safeParse(o.data);return n.success?{error:n.data,kind:"daemon-error"}:{error:{kind:"bad-frame"},kind:"transport"}}return{error:{kind:"connection-lost"},kind:"transport"}}function l(o,n){let e=E(o);return e.listen(),{rpc:e,socket:o,spawned:n,versionNote:void 0}}function s(o){return new Promise(n=>{let e=V.connect(o);e.once("connect",()=>{n(e)}),e.once("error",()=>{n(null)})})}function H({cliEntry:o,cwd:n}){try{P(n);let e=q.openSync(y(n),"a");return L(process.execPath,[o,"daemon"],{cwd:n,detached:!0,stdio:["ignore",e,e]}).unref(),q.closeSync(e),null}catch(e){return{kind:"spawn-failed",message:e instanceof Error?e.message:String(e)}}}async function Q(o){let n=Date.now()+I,e=await s(o);for(;e==null&&Date.now()<n;)await p(_),e=await s(o);return e}export{an as a,sn as b,cn as c,un as d,dn as e,ln as f};