@systemfsoftware/omp-claude-compat 1.1.5 → 1.1.6

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.
@@ -0,0 +1,3 @@
1
+ import{A as e,An as t,B as n,C as r,D as i,Dn as a,E as o,En as s,F as c,H as l,I as u,Mn as d,Mt as f,N as p,Nn as m,O as ee,On as h,P as g,Pt as _,S as te,St as v,T as y,U as b,V as x,b as S,bt as C,jn as w,k as T,kn as ne,mt as re,pt as ie,r as E,s as D,w as O,wn as k,xt as A,y as j,z as M,zt as ae}from"./esm-DBTIrgAu.js";import{f as oe,l as se,o as ce,p as le,s as ue,t as de,u as fe}from"./CommandExecutor-DYErWuMr.js";import{a as N,d as pe,i as P,o as F,r as I,s as L}from"./dist-DO_QG0qW.js";import{homedir as R}from"node:os";o({code:r,stdout:y,stderr:y});var z=class extends i()(`Block`,{reason:y}){},B=class extends i()(`Allow`,{}){},V=class extends i()(`Warning`,{message:y}){};T(z,B,V);var H=class extends i()(`Blocked`,{reason:y}){},U=class extends i()(`Continue`,{warning:g(y),updatedInput:g(O({key:y,value:e}))}){};T(H,U);const W=p(u(o({decision:g(y),reason:g(y),hookSpecificOutput:g(o({permissionDecision:g(y),permissionDecisionReason:g(y),updatedInput:g(O({key:y,value:e}))}))}))),me=o({type:te(`command`),command:y,async:g(S),timeout:g(r)}),G=o({matcher:g(y),hooks:j(me)}),K=o({PreToolUse:c(j(G),{exact:!0,default:()=>[]}),PostToolUse:c(j(G),{exact:!0,default:()=>[]}),UserPromptSubmit:c(j(G),{exact:!0,default:()=>[]}),Stop:c(j(G),{exact:!0,default:()=>[]}),SessionStart:c(j(G),{exact:!0,default:()=>[]}),SessionEnd:c(j(G),{exact:!0,default:()=>[]})}),he=p(T(o({hooks:K,disableAllHooks:g(S)}),o({...K.fields,disableAllHooks:g(S)})));function ge(e){return w(he(e),e=>{if(`hooks`in e)return e;let{disableAllHooks:t,...n}=e;return{hooks:n,disableAllHooks:t}})}const _e=[`PreToolUse`,`PostToolUse`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`];function ve(e){let t={hooks:{PreToolUse:[],PostToolUse:[],UserPromptSubmit:[],SessionStart:[],SessionEnd:[],Stop:[]}};for(let n of e){for(let e of _e)t.hooks[e]=(t.hooks[e]??[]).concat(Array.from(n.hooks[e]));n.disableAllHooks!==void 0&&(t.disableAllHooks=n.disableAllHooks)}return t}function q(e){return e.disableAllHooks===!0}var ye=class extends ee()(`HookVerdictError`,{raw:y}){},J=class extends i()(`ExitBlock`,{}){},Y=class extends i()(`ExitParse`,{}){},X=class extends i()(`ExitOther`,{}){};T(J,Y,X);const be=e=>l(e).pipe(b(2,()=>new J({})),b(0,()=>new Y({})),n(()=>new X({}))),xe=(e,t)=>l(e.trim()).pipe(b(``,()=>`Blocked by ${t} hook`),n(e=>e)),Se=(e,t)=>l(e.hookSpecificOutput?.permissionDecision??e.decision).pipe(b(`deny`,()=>new z({reason:e.hookSpecificOutput?.permissionDecisionReason??`Blocked by ${t} hook`})),b(`block`,()=>new z({reason:e.reason??`Blocked by ${t} hook`})),n(()=>new B({}))),Ce=e=>l(e.trim()).pipe(b(``,()=>new B({})),n(e=>new V({message:e}))),we=(e,n)=>l(be(e.code)).pipe(x(`ExitBlock`,()=>m(new z({reason:xe(e.stderr,n)}))),x(`ExitParse`,()=>d(W(e.stdout),{onLeft:()=>t(new ye({raw:e.stdout})),onRight:e=>m(Se(e,n))})),x(`ExitOther`,()=>m(Ce(e.stderr))),M);function Te(e,t){let n=e.replace(/"\$OMP_PROJECT_DIR"|'\$OMP_PROJECT_DIR'/g,JSON.stringify(t)).replace(/"\$\{OMP_PROJECT_DIR\}"|'\$\{OMP_PROJECT_DIR\}'/g,JSON.stringify(t)).replace(/"\$CLAUDE_PROJECT_DIR"|'\$CLAUDE_PROJECT_DIR'/g,JSON.stringify(t)).replace(/"\$\{CLAUDE_PROJECT_DIR\}"|'\$\{CLAUDE_PROJECT_DIR\}'/g,JSON.stringify(t)).replace(/\$OMP_PROJECT_DIR|\$\{OMP_PROJECT_DIR\}/g,JSON.stringify(t)).replace(/\$CLAUDE_PROJECT_DIR|\$\{CLAUDE_PROJECT_DIR\}/g,JSON.stringify(t)).trim();return{cmd:`sh`,args:[`-c`,n.startsWith(`"`)&&n.endsWith(`"`)?n.slice(1,-1):n]}}const Z=C(`loadSettingsFile`)(function*(t){let n=yield*(yield*pe).readFileString(t).pipe(ie(()=>_(``)));if(n===``)return null;let r=p(u(O({key:y,value:e})))(n);if(h(r))return null;let i=r.right,a=ge(i);return h(a)?null:a.right}),Ee=C(`loadSettings`)(function*(e){let t=[`${R()}/.claude/settings.json`,`${e}/.claude/settings.json`,`${e}/.claude/settings.local.json`,`/etc/claude-code/managed-settings.json`];return yield*De(t)}),De=C(`loadSettingsWithPaths`)(function*(e){let t=[];for(let n of e){let e=yield*Z(n);e!==null&&t.push(e)}return t.length===0?null:ve(t)}),Q=C(`runHookScript`)(function*(e,t,n,r){let i=yield*de,{cmd:a,args:o}=Te(e,n),s=JSON.stringify(t),c=se(a,...o).pipe(le(n),ce({OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n}),ue(s),oe(`pipe`),fe(`pipe`));return yield*f(v(function*(){let e=yield*i.start(c),t=yield*e.stdout.pipe(E(),D),n=yield*e.stderr.pipe(E(),D),r=yield*e.exitCode;return{code:typeof r==`number`?r:Number(r),stdout:t,stderr:n}})).pipe(ae(r),re(`TimeoutException`,()=>_({code:-1,stdout:``,stderr:`timeout after ${r}ms`})))}),$=C(`runHooksForEvent`)(function*(e,t,n,r,i){let o=r.cwd,c,u=!1,f=n;for(let n of e)if(P(t,n.matcher))for(let e of n.hooks){let t=(e.timeout??10)*1e3;if(e.async){yield*A(Q(e.command,f,o,t));continue}let n=yield*Q(e.command,f,o,t),r=l(l(d(we(n,i),{onLeft:e=>l(e).pipe(x(`HookVerdictError`,e=>new V({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`})),M),onRight:e=>e})).pipe(x(`Block`,e=>new H({reason:e.reason})),x(`Warning`,e=>new U({warning:e.message})),x(`Allow`,()=>{let e=W(n.stdout);return new U({updatedInput:ne(e)?e.right.hookSpecificOutput?.updatedInput:void 0})}),M)).pipe(x(`Blocked`,e=>a({block:!0,reason:e.reason})),x(`Continue`,e=>(e.warning!==void 0&&c===void 0&&(c=e.warning),e.updatedInput!==void 0&&(f={...f,...e.updatedInput},u=!0),s())),M);if(k(r))return r.value}return{...u?{updatedInput:f}:{},...c===void 0?{}:{warning:c}}}),Oe=C(`runPreToolUseHooks`)(function*(e,t,n){if(q(e))return;let r=F(t.toolName),i=L(()=>n.sessionManager.getSessionId()),a={...i,tool_name:r,tool_input:N(r,t.input),tool_call_id:t.toolCallId},o=I(t.toolName,t.input);if(o!==void 0&&o.length>0){let r={...i,tool_name:`Bash`,tool_input:{command:o},tool_call_id:t.toolCallId},a=yield*$(e.hooks.PreToolUse,`Bash`,r,n,`PreToolUse`);if(a.block)return a.reason===void 0?{block:!0}:{block:!0,reason:a.reason}}let s=yield*$(e.hooks.PreToolUse,r,a,n,`PreToolUse`);if(s.block)return s.reason===void 0?{block:!0}:{block:!0,reason:s.reason};if(s.updatedInput&&typeof s.updatedInput==`object`&&`tool_input`in s.updatedInput&&s.updatedInput.tool_input&&typeof s.updatedInput.tool_input==`object`){let e=s.updatedInput.tool_input;for(let[n,r]of Object.entries(e))t.input[n]=r}}),ke=C(`runPostToolUseHooks`)(function*(e,t,n){let r=F(t.toolName);if(q(e))return;let i={...L(()=>n.sessionManager.getSessionId()),tool_name:r,tool_input:N(r,t.input),tool_call_id:t.toolCallId,output:t.content,is_error:t.isError??!1};return yield*$(e.hooks.PostToolUse,r,i,n,`PostToolUse`)}),Ae=C(`runUserPromptSubmitHooks`)(function*(e,t,n){let r=e.hooks.UserPromptSubmit;if(q(e)||r.length===0)return;let i=n.cwd,a=``,o={...L(()=>n.sessionManager.getSessionId()),prompt:t.text,source:t.source};for(let e of r)for(let t of e.hooks){let e=yield*Q(t.command,o,i,(t.timeout??10)*1e3);if(e.code!==0)continue;let n=e.stdout.trim();n.length>0&&(a+=(a.length>0?`
2
+
3
+ `:``)+n)}if(a.length===0)return;let s={text:`${a}\n\n${t.text}`};return t.images!==void 0&&(s.images=t.images),s}),je=C(`runSessionStartHooks`)(function*(e,t,n){if(q(e))return;let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...L(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher&&!P(t,e.matcher)))for(let t of e.hooks){let e=(t.timeout??10)*1e3;if(t.async){yield*A(Q(t.command,a,i,e));continue}yield*Q(t.command,a,i,e)}}),Me=C(`runLifecycleHooks`)(function*(e,t){if(e.length===0)return;let n=t.cwd,r={...L(()=>t.sessionManager.getSessionId())};for(let t of e)for(let e of t.hooks){let t=(e.timeout??10)*1e3;e.async?yield*A(Q(e.command,r,n,t)):yield*Q(e.command,r,n,t)}});export{Ee as loadSettings,Me as runLifecycleHooks,ke as runPostToolUseHooks,Oe as runPreToolUseHooks,je as runSessionStartHooks,Ae as runUserPromptSubmitHooks};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- const e=e=>{let t=async e=>{let[t,n]=await Promise.all([import(`./runtime-DwpyNRPD.js`).then(e=>e.default),import(`effect`)]),{Cause:r,Effect:i,Exit:a}=n,o=e.pipe(i.exit),s=await t.runPromise(o);if(a.isFailure(s))throw r.squash(s.cause);return s.value};e.on(`tool_call`,async(e,n)=>{let{loadSettings:r,runPreToolUseHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(t)return yield*i(t,e,n)}))}),e.on(`tool_result`,async(e,n)=>{let{loadSettings:r,runPostToolUseHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(!t)return;let a=yield*i(t,e,n);if(a?.block)return{isError:!0,content:[{type:`text`,text:a.reason??`Blocked by PostToolUse hook`}]};if(a?.warning)return{content:[...e.content??[],{type:`text`,text:a.warning}],isError:e.isError}}))}),e.on(`input`,async(e,n)=>{let{loadSettings:r,runUserPromptSubmitHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(t)return yield*i(t,e,n)}))}),e.on(`session_start`,async(e,n)=>{let{loadSettings:r,runSessionStartHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e,`start`,n))}))}),e.on(`session_compact`,async(e,n)=>{let{loadSettings:r,runSessionStartHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e,`compact`,n))}))}),e.on(`agent_start`,async(e,n)=>{let{loadSettings:r,runSessionStartHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e,`resume`,n))}))}),e.on(`session_shutdown`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(e.disableAllHooks||(yield*i(e.hooks.SessionEnd,n)))}))}),e.on(`session_stop`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i}=await import(`./hook-dispatcher.executor-ZebBJ5Sk.js`),{Effect:a}=await import(`effect`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(e.disableAllHooks||(yield*i(e.hooks.Stop,n)))}))})},t=e=>{e.on(`before_agent_start`,async(e,t)=>{let n=await import(`./runtime-DwpyNRPD.js`).then(e=>e.default),{loadReferencedContent:r}=await import(`./inject-instructions.executor-CwW6M_qL.js`),{Cause:i,Config:a,Effect:o,Exit:s}=await import(`effect`),c=await n.runPromise(o.gen(function*(){let e=yield*a.string(`CLAUDE_PROJECT_DIR`).pipe(a.withDefault(process.cwd()));return yield*r(e)}).pipe(o.exit));if(s.isFailure(c))throw i.squash(c.cause);let l=c.value;if(l!==``)return{systemPrompt:[...e.systemPrompt,``,l]}})};function n(n){import(`./runtime-DwpyNRPD.js`),e(n),t(n),process.on(`SIGINT`,()=>{import(`./runtime-DwpyNRPD.js`).then(({default:e})=>e.dispose())}),process.on(`SIGTERM`,()=>{import(`./runtime-DwpyNRPD.js`).then(({default:e})=>e.dispose())})}export{n as default};
1
+ const e=(e,t)=>{e(e=>{e.setTimeout(()=>{t()},0)});let n=()=>{t().then(({default:e})=>e.dispose())};process.on(`SIGINT`,n),process.on(`SIGTERM`,n)},t=e=>{let t=async e=>{let[t,n]=await Promise.all([import(`./runtime-CMq7fttJ.js`).then(e=>e.default),import(`./esm-DBTIrgAu.js`)]),{Cause:r,Effect:i,Exit:a}=n,o=e.pipe(i.exit),s=await t.runPromise(o);if(a.isFailure(s))throw r.squash(s.cause);return s.value};e.on(`tool_call`,async(e,n)=>{let{loadSettings:r,runPreToolUseHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(t)return yield*i(t,e,n)}))}),e.on(`tool_result`,async(e,n)=>{let{loadSettings:r,runPostToolUseHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(!t)return;let a=yield*i(t,e,n);if(a?.block)return{isError:!0,content:[{type:`text`,text:a.reason??`Blocked by PostToolUse hook`}]};if(a?.warning)return{content:[...e.content??[],{type:`text`,text:a.warning}],isError:e.isError}}))}),e.on(`input`,async(e,n)=>{let{loadSettings:r,runUserPromptSubmitHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let t=yield*r(n.cwd);if(t)return yield*i(t,e,n)}))}),e.on(`session_start`,async(e,n)=>{let{loadSettings:r,runSessionStartHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e,`start`,n))}))}),e.on(`session_compact`,async(e,n)=>{let{loadSettings:r,runSessionStartHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e,`compact`,n))}))}),e.on(`agent_start`,async(e,n)=>{let{loadSettings:r,runSessionStartHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(yield*i(e,`resume`,n))}))}),e.on(`session_shutdown`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(e.disableAllHooks||(yield*i(e.hooks.SessionEnd,n)))}))}),e.on(`session_stop`,async(e,n)=>{let{loadSettings:r,runLifecycleHooks:i}=await import(`./hook-dispatcher.executor-B6Jon79H.js`),{Effect:a}=await import(`./esm-DBTIrgAu.js`);return t(a.gen(function*(){let e=yield*r(n.cwd);e&&(e.disableAllHooks||(yield*i(e.hooks.Stop,n)))}))})},n=e=>{e.on(`before_agent_start`,async(e,t)=>{let n=await import(`./runtime-CMq7fttJ.js`).then(e=>e.default),{loadReferencedContent:r}=await import(`./inject-instructions.executor-C0s4_7XL.js`),{Cause:i,Config:a,Effect:o,Exit:s}=await import(`./esm-DBTIrgAu.js`),c=await n.runPromise(o.gen(function*(){let e=yield*a.string(`CLAUDE_PROJECT_DIR`).pipe(a.withDefault(process.cwd()));return yield*r(e)}).pipe(o.exit));if(s.isFailure(c))throw i.squash(c.cause);let l=c.value;if(l!==``)return{systemPrompt:[...e.systemPrompt,``,l]}})};function r(r){t(r),n(r),e(e=>r.on(`session_start`,(t,n)=>e(n)),()=>import(`./runtime-CMq7fttJ.js`))}export{r as default};
@@ -0,0 +1,3 @@
1
+ import{D as e,Dn as t,E as n,En as r,Et as i,H as a,On as o,Pt as s,Rt as c,Sn as l,T as u,Tt as d,V as f,bt as p,gt as m,kn as h,pt as g,wn as _,y as v,z as y}from"./esm-DBTIrgAu.js";import{c as b,d as x,t as S}from"./dist-DO_QG0qW.js";const C=[`AGENTS.md`];var w=class extends e()(`Inject`,{}){},T=class extends e()(`Skip`,{matched:u}){};n({baseName:u,skipList:v(u)});const E=e=>l(e.skipList.find(t=>t===e.baseName)),D=e=>a(E(e)).pipe(f(`None`,()=>new w),f(`Some`,e=>new T({matched:e.value})),y),O=p(`extractRefs`)(function*(e,t,n){let r=yield*x,i=yield*b,a=[];for(let o of e.split(`
2
+ `)){let e=o.trim().replace(/^[-*+]\s+/,``);if(!e.startsWith(`@`))continue;let s=e.slice(1).trim();if(!s||s.includes(` `)||i.isAbsolute(s))continue;let c=i.resolve(t,s);if(c.startsWith(n+`/`)||c===n){let e=yield*m(r.exists(c));if(h(e)&&e.right){a.push({sourcePath:t,resolvedPath:c});continue}}let l=i.resolve(n,s);(l.startsWith(n+`/`)||l===n)&&l!==c&&a.push({sourcePath:n,resolvedPath:l})}return a}),k=p(`loadReferencedContent`)(function*(e){let n=yield*x,l=yield*b,u=yield*S,p=[l.resolve(e,`CLAUDE.md`),l.resolve(e,`.claude`,`CLAUDE.md`)],v=[];for(let t of p){let r=yield*m(n.readFileString(t,`utf-8`));if(h(r)){let n=yield*O(r.right,l.dirname(t),e);v.push(...n)}}let w=new Set,T=[];for(let e of v)w.has(e.resolvedPath)||(w.add(e.resolvedPath),T.push(e));let E=(yield*u.load(e).pipe(c(t=>i(`[omp-claude-compat] could not read systemfsoftware.toml in ${e}; using the default skip list`,t)),g(()=>s(void 0))))?.no_inject_refs??C,k=[];for(let s of T){let c=s.resolvedPath.slice(e.length+1),u=a(D({baseName:l.basename(s.resolvedPath),skipList:E})).pipe(f(`Skip`,e=>t(e.matched)),f(`Inject`,()=>r()),y);if(_(u)){yield*d(`[omp-claude-compat] skipped @-ref ${c}: host already provides ${u.value}`);continue}let p=yield*m(n.readFileString(s.resolvedPath,`utf-8`));if(o(p)){yield*i(`[omp-claude-compat] could not read @-ref ${c}; skipping it`);continue}k.push(`## ${c}\n${p.right}\n`)}return k.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...k].join(`
3
+ `)});export{k as loadReferencedContent};
@@ -0,0 +1 @@
1
+ import{$ as e,At as t,Cn as n,Ct as r,Dn as i,Dt as a,En as o,Fn as s,Ft as c,Gt as l,Ht as u,In as d,It as f,Kt as p,Lt as m,Mt as ee,Nt as te,Ot as ne,Pt as h,Q as re,Sn as g,Tn as ie,Ut as ae,Vt as oe,W as se,Wt as ce,_ as le,_n as ue,_t as de,an as _,at as v,c as fe,ct as y,d as pe,dn as me,dt as he,en as ge,et as b,f as _e,ft as x,ht as ve,i as ye,identity as be,in as xe,it as Se,jt as S,kt as Ce,lt as C,m as we,nn as w,nt as T,on as E,ot as D,p as O,pipe as k,rn as Te,rt as Ee,sn as A,t as De,tn as Oe,tt as ke,vt as j,xn as Ae,xt as je,yt as M}from"./esm-DBTIrgAu.js";import{a as Me,c as Ne,d as N,i as P,n as Pe,r as Fe,t as Ie}from"./CommandExecutor-DYErWuMr.js";import{_ as Le,b as F,d as I,f as L,g as Re,h as ze,l as Be,m as Ve,n as He,p as R,u as Ue,v as We,y as Ge}from"./dist-DO_QG0qW.js";import*as Ke from"node:os";import*as qe from"node:crypto";import*as z from"node:path";import*as B from"node:fs";import*as V from"node:child_process";const H=(e,t,n)=>(...r)=>x(i=>{try{e(...r,(e,n)=>{i(e?j(t?t(e,r):e):h(n))})}catch(e){i(n?j(n(e,r)):ve(e))}}),U=(e,t,n)=>ye(Je(e,t,n)),Je=(e,t,n)=>T(()=>Ze(e(),t,me(void 0),n)),Ye=(e,t,{encoding:n,endOnDone:r=!0}={},i=y)=>{let a=Xe(e,n),o=r?x(t=>{`closed`in e&&e.closed?t(y):(e.once(`finish`,()=>t(y)),e.end())}):y;return{awaitRead:()=>y,emit:a,error:e=>p(o,t(e)),done:e=>p(o,i)}},Xe=(e,t)=>n=>n.length===0?y:x(r=>{let i=n[Symbol.iterator](),a=i.next();function o(){let n=a;a=i.next();let s=e.write(n.value,t);a.done?r(y):s?o():e.once(`drain`,o)}o()}),Ze=(t,n,r,i)=>{if(!t.readable)return Ee;let a=ae(!1);function o(){a.unsafeOpen()}function s(e){r.current=ge(n(e)),a.unsafeOpen()}function c(){r.current=Oe,a.unsafeOpen()}t.on(`readable`,o),t.on(`error`,s),t.on(`end`,c);let l=i?.chunkSize?Number(i.chunkSize):void 0;return e(T(function e(){let n=t.read(l);if(n===null)return r.current?ke(r.current):(a.unsafeClose(),b(a.await,e));let i=[n];for(;;){if(n=t.read(l),n===null)return b(Se(ue(i)),e);i.push(n)}}),f(()=>{t.off(`readable`,o),t.off(`error`,s),t.off(`end`,c),i?.closeOnDone!==!1&&`closed`in t&&!t.closed&&t.destroy()}))},Qe=(e,t,n)=>le($e(e,t,n)),$e=(e,t,n)=>b(l(f(()=>e()),E()),([e,r])=>re(et(e,r,t),Ye(e,e=>xe(r,e),n,Te(r,y)))),et=(e,t,n)=>c(()=>{function r(e){A(t,j(n(e)))}return e.on(`error`,r),de(w(t),f(()=>{e.removeListener(`error`,r)}))}),W=(e,t)=>(n,[r])=>{let i=`Unknown`;switch(n.code){case`ENOENT`:i=`NotFound`;break;case`EACCES`:i=`PermissionDenied`;break;case`EEXIST`:i=`AlreadyExists`;break;case`EISDIR`:i=`BadResource`;break;case`ENOTDIR`:i=`BadResource`;break;case`EBUSY`:i=`Busy`;break;case`ELOOP`:i=`BadResource`;break}return new F({reason:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,description:n.message,cause:n})},tt=e=>typeof e==`string`?e:`pipe`,G=e=>typeof e==`string`?e:`pipe`,K=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),q=(e,t,n)=>{let r=Ne(n).reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return W(`Command`,e)(t,[r])},nt={[P]:P,...s,toJSON(){return{_id:`@effect/platform/CommandExecutor/Process`,pid:this.pid}}},J=e=>t=>{switch(t._tag){case`StandardCommand`:{let i=M(E(),e=>x(r=>{let i=V.spawn(t.command,t.args,{stdio:[tt(t.stdin),G(t.stdout),G(t.stderr)],cwd:n(t.cwd,d),shell:t.shell,env:{...process.env,...Object.fromEntries(t.env)},detached:process.platform!==`win32`});return i.on(`error`,e=>{r(j(q(`spawn`,e,t)))}),i.on(`exit`,(...t)=>{A(e,h(t))}),i.on(`spawn`,()=>{r(h([i,e]))}),f(()=>{i.kill(`SIGTERM`)})})),o=process.platform===`win32`?(e,n)=>x(n=>{V.exec(`taskkill /pid ${e.pid} /T /F`,e=>{n(e?j(q(`kill`,K(e),t)):y)})}):(e,n)=>u({try:()=>process.kill(-e.pid,n),catch:e=>q(`kill`,K(e),t)}),s=(e,n)=>c(()=>e.kill(n)?y:j(q(`kill`,new globalThis.Error(`Failed to kill process`),t)));return k(ie(t.cwd,{onNone:()=>y,onSome:t=>e.access(t)}),p(C(i,([e,t])=>M(_(t),n=>n?M(w(t),([t])=>t!==0&&t!==null?o(e,`SIGTERM`).pipe(r):y):o(e,`SIGTERM`).pipe(S(()=>s(e,`SIGTERM`)),p(w(t)),r)))),a(([e,n])=>{let r=we;e.stdin!==null&&(r=Qe(()=>e.stdin,e=>q(`toWritable`,K(e),t)));let i=M(w(n),([e,n])=>e===null?j(q(`exitCode`,new globalThis.Error(`Process interrupted due to receipt of signal: ${n}`),t)):h(Pe(e))),a=Ce(_(n)),c=(t=`SIGTERM`)=>o(e,t).pipe(S(()=>s(e,t)),p(he(w(n)))),l=Fe(e.pid),u=U(()=>e.stderr,e=>q(`fromReadable(stderr)`,K(e),t)),d=U(()=>e.stdout,e=>q(`fromReadable(stdout)`,K(e),t));return typeof t.stdout!=`string`&&(d=pe(d,t.stdout)),Object.assign(Object.create(nt),{pid:l,exitCode:i,isRunning:a,kill:c,stdin:r,stderr:u,stdout:d})}),typeof t.stdin==`string`?be:m(e=>je(fe(t.stdin,e.stdin))))}case`PipedCommand`:{let n=Ne(t);if(n.length===1)return k(n[0],J(e));let r=n[0],i=n.slice(1),o=i.slice(0,i.length-1),s=i[i.length-1];return k(N(s,o.reduce((t,n)=>k(N(n,t),J(e),a(e=>e.stdout),O),k(J(e)(r),a(e=>e.stdout),O))),J(e))}}},rt=v(Ie,k(I,a(e=>Me(J(e))))),Y=e=>t=>new Ge({module:`FileSystem`,method:e,cause:t}),it=(()=>{let e=H(B.access,W(`FileSystem`,`access`),Y(`access`));return(t,n)=>{let r=B.constants.F_OK;return n?.readable&&(r|=B.constants.R_OK),n?.writable&&(r|=B.constants.W_OK),e(t,r)}})(),at=(()=>{let e=H(B.cp,W(`FileSystem`,`copy`),Y(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),ot=(()=>{let e=H(B.copyFile,W(`FileSystem`,`copyFile`),Y(`copyFile`));return(t,n)=>e(t,n)})(),st=(()=>{let e=H(B.chmod,W(`FileSystem`,`chmod`),Y(`chmod`));return(t,n)=>e(t,n)})(),ct=(()=>{let e=H(B.chown,W(`FileSystem`,`chown`),Y(`chown`));return(t,n,r)=>e(t,n,r)})(),lt=(()=>{let e=H(B.link,W(`FileSystem`,`link`),Y(`link`));return(t,n)=>e(t,n)})(),ut=(()=>{let e=H(B.mkdir,W(`FileSystem`,`makeDirectory`),Y(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),X=e=>{let t=H(B.mkdtemp,W(`FileSystem`,e),Y(e));return e=>c(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?z.join(e.directory,`.`):Ke.tmpdir();return t(n?z.join(r,n):r+`/`)})},dt=X(`makeTempDirectory`),Z=e=>{let t=H(B.rm,W(`FileSystem`,e),Y(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},ft=Z(`remove`),pt=(()=>{let e=X(`makeTempDirectoryScoped`),n=Z(`makeTempDirectoryScoped`);return r=>C(e(r),e=>t(n(e,{recursive:!0})))})(),Q=e=>{let n=H(B.open,W(`FileSystem`,e),Y(e)),r=H(B.close,W(`FileSystem`,e),Y(e));return(e,i)=>k(C(n(e,i?.flag??`r`,i?.mode),e=>t(r(e))),a(e=>ht(Ue(e),i?.flag?.startsWith(`a`)??!1)))},mt=Q(`open`),ht=(()=>{let e=e=>H(B.read,W(`FileSystem`,e),Y(e)),t=e(`read`),n=e(`readAlloc`),r=H(B.fstat,W(`FileSystem`,`stat`),Y(`stat`)),s=H(B.ftruncate,W(`FileSystem`,`truncate`),Y(`truncate`)),l=H(B.fsync,W(`FileSystem`,`sync`),Y(`sync`)),u=e=>H(B.write,W(`FileSystem`,e),Y(e)),d=u(`write`),p=u(`writeAll`);class m{fd;append;[L];semaphore=ce(1);position=0n;constructor(e,t){this.fd=e,this.append=t,this[L]=L}get stat(){return a(r(this.fd),wt)}get sync(){return l(this.fd)}seek(e,t){let n=R(e);return this.semaphore.withPermits(1)(f(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),this.position)))}read(e){return this.semaphore.withPermits(1)(a(c(()=>t(this.fd,{buffer:e,position:this.position})),e=>{let t=R(e);return this.position+=t,t}))}readAlloc(e){let t=Number(e);return this.semaphore.withPermits(1)(M(f(()=>Buffer.allocUnsafeSlow(t)),e=>a(n(this.fd,{buffer:e,position:this.position}),n=>{if(n===0)return o();if(this.position+=BigInt(n),n===t)return i(e);let r=Buffer.allocUnsafeSlow(n);return e.copy(r,0,0,n),i(r)})))}truncate(e){return this.semaphore.withPermits(1)(a(s(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}}))}write(e){return this.semaphore.withPermits(1)(a(c(()=>d(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),e=>{let t=R(e);return this.append||(this.position+=t),t}))}writeAllChunk(e){return M(c(()=>p(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),t=>t===0?j(new F({module:`FileSystem`,method:`writeAll`,reason:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position+=BigInt(t)),t<e.length?this.writeAllChunk(e.subarray(t)):y))}writeAll(e){return this.semaphore.withPermits(1)(this.writeAllChunk(e))}}return(e,t)=>new m(e,t)})(),gt=e=>{let t=X(e),n=Q(e),r=e=>f(()=>qe.randomBytes(e).toString(`hex`));return e=>k(l(t(e),r(6)),a(([t,n])=>z.join(t,n+(e?.suffix??``))),m(e=>ee(n(e,{flag:`w+`}))))},_t=gt(`makeTempFile`),vt=(()=>{let e=gt(`makeTempFileScoped`),n=Z(`makeTempFileScoped`);return r=>C(e(r),e=>t(n(z.dirname(e),{recursive:!0})))})(),yt=(e,t)=>oe({try:()=>B.promises.readdir(e,t),catch:t=>W(`FileSystem`,`readDirectory`)(t,[e])}),bt=e=>x((t,n)=>{try{B.readFile(e,{signal:n},(n,r)=>{t(n?j(W(`FileSystem`,`readFile`)(n,[e])):h(r))})}catch(e){t(j(Y(`readFile`)(e)))}}),xt=(()=>{let e=H(B.readlink,W(`FileSystem`,`readLink`),Y(`readLink`));return t=>e(t)})(),St=(()=>{let e=H(B.realpath,W(`FileSystem`,`realPath`),Y(`realPath`));return t=>e(t)})(),Ct=(()=>{let e=H(B.rename,W(`FileSystem`,`rename`),Y(`rename`));return(t,n)=>e(t,n)})(),wt=e=>({type:e.isFile()?`File`:e.isDirectory()?`Directory`:e.isSymbolicLink()?`SymbolicLink`:e.isBlockDevice()?`BlockDevice`:e.isCharacterDevice()?`CharacterDevice`:e.isFIFO()?`FIFO`:e.isSocket()?`Socket`:`Unknown`,mtime:g(e.mtime),atime:g(e.atime),birthtime:g(e.birthtime),dev:e.dev,rdev:g(e.rdev),ino:g(e.ino),mode:e.mode,nlink:g(e.nlink),uid:g(e.uid),gid:g(e.gid),size:R(e.size),blksize:g(R(e.blksize)),blocks:g(e.blocks)}),$=(()=>{let e=H(B.stat,W(`FileSystem`,`stat`),Y(`stat`));return t=>a(e(t),wt)})(),Tt=(()=>{let e=H(B.symlink,W(`FileSystem`,`symlink`),Y(`symlink`));return(t,n)=>e(t,n)})(),Et=(()=>{let e=H(B.truncate,W(`FileSystem`,`truncate`),Y(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),Dt=(()=>{let e=H(B.utimes,W(`FileSystem`,`utime`),Y(`utime`));return(t,n,r)=>e(t,n,r)})(),Ot=(e,t)=>De(n=>C(f(()=>{let r=B.watch(e,{recursive:t?.recursive},(e,t)=>{if(t)switch(e){case`rename`:n.fromEffect(ne($(t),{onSuccess:e=>h(ze({path:t})),onFailure:e=>e._tag===`SystemError`&&e.reason===`NotFound`?h(Re({path:t})):j(e)}));return;case`change`:n.single(Le({path:t}));return}});return r.on(`error`,t=>{n.fail(new F({module:`FileSystem`,reason:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t}))}),r.on(`close`,()=>{n.end()}),r}),e=>f(()=>e.close()))),kt=(e,t,r)=>$(t).pipe(a(i=>e.pipe(Ae(e=>e.register(t,i,r)),n(()=>Ot(t,r)))),_e),At=(e,t,n)=>x((r,i)=>{try{B.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?j(W(`FileSystem`,`writeFile`)(t,[e])):y)})}catch(e){r(j(Y(`writeFile`)(e)))}}),jt=v(I,a(te(Ve),e=>We({access:it,chmod:st,chown:ct,copy:at,copyFile:ot,link:lt,makeDirectory:ut,makeTempDirectory:dt,makeTempDirectoryScoped:pt,makeTempFile:_t,makeTempFileScoped:vt,open:mt,readDirectory:yt,readFile:bt,readLink:xt,realPath:St,remove:ft,rename:Ct,stat:$,symlink:Tt,truncate:Et,utimes:Dt,watch(t,n){return kt(e,t,n)},writeFile:At}))),Mt=rt.pipe(D(jt),D(Be)),Nt=se(He.pipe(D(Mt)));export{Nt as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/omp-claude-compat",
3
3
  "license": "MIT",
4
- "version": "1.1.5",
4
+ "version": "1.1.6",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "description": "OMP Claude Code compatibility: dispatch .claude/settings.json hooks + inject CLAUDE.md @-references",
7
7
  "type": "module",
@@ -31,10 +31,10 @@
31
31
  "typescript": "^7",
32
32
  "vitest": "^4",
33
33
  "@systemfsoftware/effect-gherkin-spec": "^0.3.6",
34
- "@systemfsoftware/effect-memfs": "^1.0.6",
35
- "@systemfsoftware/omp-utils": "^0.0.0",
34
+ "@systemfsoftware/oxlint-config": "^0.1.0",
36
35
  "@systemfsoftware/tsconfig": "^1.2.5",
37
- "@systemfsoftware/oxlint-config": "^0.1.0"
36
+ "@systemfsoftware/omp-utils": "^0.0.0",
37
+ "@systemfsoftware/effect-memfs": "^1.0.6"
38
38
  },
39
39
  "omp": {
40
40
  "extensions": [
@@ -45,8 +45,14 @@
45
45
  "provenance": true
46
46
  },
47
47
  "inlinedDependencies": {
48
+ "@effect/platform": "0.97.0",
49
+ "@effect/platform-node": "0.97.1",
50
+ "@effect/platform-node-shared": "0.50.1",
48
51
  "@jsr/std__collections": "1.3.0",
49
- "@jsr/std__toml": "1.0.11"
52
+ "@jsr/std__toml": "1.0.11",
53
+ "effect": "3.22.0",
54
+ "fast-check": "3.23.2",
55
+ "pure-rand": "6.1.0"
50
56
  },
51
57
  "repository": {
52
58
  "type": "git",
@@ -1,17 +0,0 @@
1
- import{FileSystem as e}from"@effect/platform/FileSystem";import{Context as t,Effect as n,Layer as r,MutableHashMap as i,Option as a,ParseResult as o,Ref as s,Schema as c}from"effect";import{Path as l}from"@effect/platform/Path";const u={arrays:`merge`,sets:`merge`,maps:`merge`};function d(e,t,n){return f(e,t,new Set,n??u)}function f(e,t,n,r){let i={},a=new Set([...g(e),...g(t)]);for(let o of a){if(o===`__proto__`)continue;let a=e[o];if(!Object.hasOwn(t,o)){i[o]=a;continue}let s=t[o];if(h(a)&&h(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=ee(a,s,n,r);continue}i[o]=s}return i}function ee(e,t,n,r){if(p(e)&&p(t))return f(e,t,n,r);if(m(e)&&m(t)){if(Array.isArray(e)&&Array.isArray(t))return r.arrays===`merge`?e.concat(t):t;if(e instanceof Map&&t instanceof Map){if(r.maps===`merge`){let n=new Map(e);for(let[e,r]of t)n.set(e,r);return n}return t}if(e instanceof Set&&t instanceof Set){if(r.sets===`merge`){let n=new Set(e);for(let e of t)n.add(e);return n}return t}}return t}function p(e){return Object.getPrototypeOf(e)===Object.prototype}function m(e){return typeof e[Symbol.iterator]==`function`}function h(e){return typeof e==`object`&&!!e}function g(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n)Object.prototype.propertyIsEnumerable.call(e,r)&&t.push(r);return t}function te(e){return e%4==0&&e%100!=0||e%400==0}var _=class{#e=/[ \t]/;#t=0;#n;constructor(e){this.#n=e}get position(){return this.#t}get source(){return this.#n}char(e=0){return this.#n[this.#t+e]??``}slice(e,t){return this.#n.slice(this.#t+e,this.#t+t)}next(e=1){this.#t+=e}skipWhitespaces(){for(;this.#e.test(this.char())&&!this.eof();)this.next();if(!this.isCurrentCharEOL()&&/\s/.test(this.char())){let e=`\\u`+this.char().charCodeAt(0).toString(16),t=this.#t;throw SyntaxError(`Cannot parse the TOML: It contains invalid whitespace at position '${t}': \`${e}\``)}}nextUntilChar(e={skipComments:!0}){for(;!this.eof();){let t=this.char();if(this.#e.test(t)||this.isCurrentCharEOL())this.next();else if(e.skipComments&&this.char()===`#`)for(;!this.isCurrentCharEOL()&&!this.eof();)this.next();else break}}eof(){return this.#t>=this.#n.length}isCurrentCharEOL(){return this.char()===`
2
- `||this.startsWith(`\r
3
- `)}startsWith(e){return this.#n.startsWith(e,this.#t)}match(e){if(!e.sticky)throw Error(`RegExp ${e} does not have a sticky 'y' flag`);return e.lastIndex=this.#t,this.#n.match(e)}};function v(e){return{ok:!0,body:e}}function y(){return{ok:!1}}function b(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function x(e){return typeof e==`object`&&!!e}function S(e,t){let n=t[0];if(!n)throw Error(`Cannot parse the TOML: key length is not a positive number`);return e[n]}function ne(e,t){let{keys:n,type:r,value:i}=t,a=S(e,n);if(a===void 0)return Object.assign(e,b(n,i));if(Array.isArray(a))return C(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(x(a))return C(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function re(e,t){let{type:n,keys:r,value:i}=t,a=S(e,r);if(a===void 0)return Object.assign(e,b(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):C(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(x(a))return C(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function C(e,t){switch(t.type){case`Block`:return d(e,t.value);case`Table`:return ne(e,t);case`TableArray`:return re(e,t)}}function w(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return y()}}function ie(e,t){let n=D(t);return r=>{let i=[],a=e(r);if(!a.ok)return v(i);for(i.push(a.body);!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);i.push(n.body)}return v(i)}}function ae(e,t){let n=D(t);return r=>{let i=e(r);if(!i.ok)return y();let a=[i.body];for(;!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);a.push(n.body)}return v(a)}}function oe(e,t,n){let r=D(t);return i=>{let a=i.position,o=e(i);if(!o.ok)return y();if(!r(i).ok)throw SyntaxError(`key/value pair doesn't have "${t}"`);let s=n(i);if(!s.ok){let e=i.source.indexOf(`
4
- `,i.position),t=e>0?e:i.source.length,n=i.source.slice(a,t);throw SyntaxError(`Cannot parse value on line '${n}'`)}return v(b(o.body,s.body))}}function se(e){return t=>{let n=e(t);if(!n.ok)return y();let r={__proto__:null};for(let e of n.body)typeof e==`object`&&e&&(r=d(r,e));return v(r)}}function T(e){return t=>{let n=[];for(;!t.eof();){let r=e(t);if(!r.ok)break;n.push(r.body),t.nextUntilChar()}return n.length===0?y():v(n)}}function E(e,t,n){let r=D(e),i=D(n);return a=>{if(!r(a).ok)return y();let o=t(a);if(!o.ok)throw SyntaxError(`Invalid token after "${e}"`);if(!i(a).ok)throw SyntaxError(`Not closed by "${n}" after started with "${e}"`);return v(o.body)}}function D(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),v(void 0)):y())}const ce=/[A-Za-z0-9_-]+/y;function le(e){e.skipWhitespaces();let t=e.match(ce)?.[0];return t?(e.next(t.length),v(t)):y()}function O(e){if(e.char()!==`\\`)return y();switch(e.next(),e.char()){case`b`:return e.next(),v(`\b`);case`t`:return e.next(),v(` `);case`n`:return e.next(),v(`
5
- `);case`f`:return e.next(),v(`\f`);case`r`:return e.next(),v(`\r`);case`u`:case`U`:{let t=e.char()===`u`?4:6,n=parseInt(`0x`+e.slice(1,1+t),16),r=String.fromCodePoint(n);return e.next(t+1),v(r)}case`"`:return e.next(),v(`"`);case`\\`:return e.next(),v(`\\`);default:throw SyntaxError(`Invalid escape sequence: \\${e.char()}`)}}function k(e){if(e.skipWhitespaces(),e.char()!==`"`)return y();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
6
- `)throw SyntaxError(`Single-line string cannot contain EOL`);let n=O(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),v(t.join(``))}function A(e){if(e.skipWhitespaces(),e.char()!==`'`)return y();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
7
- `)throw SyntaxError(`Single-line string cannot contain EOL`);t.push(e.char()),e.next()}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),v(t.join(``))}function ue(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return y();e.next(3),e.char()===`
8
- `?e.next():e.startsWith(`\r
9
- `)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
10
- `)){e.next(),e.nextUntilChar({skipComments:!1});continue}else if(e.startsWith(`\\\r
11
- `)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=O(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`"`&&(t.push(`"`),e.next()),e.next(3),v(t.join(``))}function j(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return y();e.next(3),e.char()===`
12
- `?e.next():e.startsWith(`\r
13
- `)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),v(t.join(``))}const M=/(?:true|false)\b/y;function N(e){e.skipWhitespaces();let t=e.match(M);if(!t)return y();let n=t[0];return e.next(n.length),v(n===`true`)}const P=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),F=/[+-]?inf\b/y;function I(e){e.skipWhitespaces();let t=e.match(F);if(!t)return y();let n=t[0];return e.next(n.length),v(P.get(n))}const L=/[+-]?nan\b/y;function R(e){e.skipWhitespaces();let t=e.match(L);if(!t)return y();let n=t[0];return e.next(n.length),v(NaN)}const z=ae(w([le,k,A]),`.`),B=/0b[01]+(?:_[01]+)*\b/y;function V(e){e.skipWhitespaces();let t=e.match(B)?.[0];if(!t)return y();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?y():v(r)}const H=/0o[0-7]+(?:_[0-7]+)*\b/y;function U(e){e.skipWhitespaces();let t=e.match(H)?.[0];if(!t)return y();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?y():v(r)}const de=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function fe(e){e.skipWhitespaces();let t=e.match(de)?.[0];if(!t)return y();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?y():v(r)}const pe=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function me(e){e.skipWhitespaces();let t=e.match(pe)?.[0];if(!t)return y();e.next(t.length);let n=t.replaceAll(`_`,``);return v(parseInt(n,10))}const he=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function ge(e){e.skipWhitespaces();let t=e.match(he)?.[0];if(!t)return y();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?y():v(r)}const _e=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function W(e){e.skipWhitespaces();let t=e.match(_e);if(!t)return y();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!te(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return v(i)}const ve=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function ye(e){e.skipWhitespaces();let t=e.match(ve)?.[0];return t?(e.next(t.length),v(t)):y()}function be(e){if(e.skipWhitespaces(),e.char()!==`[`)return y();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=G(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),v(t)}function xe(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),v({__proto__:null});let t=E(`{`,ie(K,`,`),`}`)(e);if(!t.ok)return y();let n={__proto__:null};for(let e of t.body)n=d(n,e);return v(n)}const G=w([ue,j,k,A,N,I,R,W,ye,V,U,fe,ge,me,be,xe]),K=oe(z,`=`,G);function q(e){e.nextUntilChar();let t=se(T(K))(e);return t.ok?v({type:`Block`,value:t.body}):y()}const Se=E(`[`,z,`]`);function Ce(e){e.nextUntilChar();let t=Se(e);if(!t.ok)return y();e.nextUntilChar();let n=q(e);return v({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const we=E(`[[`,z,`]]`);function Te(e){e.nextUntilChar();let t=we(e);if(!t.ok)return y();e.nextUntilChar();let n=q(e);return v({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function Ee(e){let t=T(w([q,Te,Ce]))(e);return t.ok?v(t.body.reduce(C,{__proto__:null})):v({__proto__:null})}function J(e,t){let n=e.source.slice(0,e.position).split(`
14
- `);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function De(e){return t=>{let n=new _(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(J(n,r))}catch(e){throw e instanceof Error?SyntaxError(J(n,e.message)):SyntaxError(J(n,`Invalid error type caught`))}}}function Oe(e){return De(Ee)(e)}const ke={ctx_execute:!0,ctx_batch_execute:!0};function Ae(e,t){return ke[e]?e!==`ctx_execute`||t.language===`shell`:!1}function je(e,t){if(Ae(e,t)){if(e===`ctx_execute`)return typeof t.code==`string`?t.code:void 0;if(Array.isArray(t.commands))return t.commands.map(e=>typeof e==`object`&&e?e.command:``).filter(e=>typeof e==`string`).join(`
15
- `)}}const Y=new Map;function Me(e,t){if(!t||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=Y.get(n);if(r!==void 0)return r.test(e);let i=RegExp(`^(?:${n})$`);return Y.set(n,i),i.test(e)}function Ne(e){return{session_id:e(),agent_id:null}}const X=c.Record({key:c.String,value:c.Array(c.String)}).pipe(c.brand(`TomlConfig`)),Pe=c.transformOrFail(c.String,c.typeSchema(X),{strict:!0,decode:e=>o.try({try:()=>Oe(e),catch:e=>new o.Unexpected(e,`TOML parse error`)}).pipe(o.flatMap(e=>o.decodeUnknown(X)(e))),encode:(e,t,n)=>o.fail(new o.Forbidden(n,e,`TomlConfigFromText is decode-only`))}),Z=`systemfsoftware.toml`,Q=c.decodeSync(X)({});var $=class extends t.Tag(`TomlLoader`)(){};const Fe=r.effect($,n.gen(function*(){let t=yield*s.make(i.empty()),r=yield*e,o=yield*l;return $.of({load:n.fn(`TomlLoader.load`)(function*(e){let l=yield*s.get(t),u=i.get(l,e);if(a.isSome(u))return u.value;let d=o.join(e,Z);if(!(yield*r.exists(d)))return yield*s.update(t,t=>(i.set(t,e,Q),t)),Q;let f=yield*r.readFileString(d).pipe(n.flatMap(c.decodeUnknown(Pe)),n.tapError(e=>n.logError(`[toml-loader] malformed ${Z} at ${d} — failing open, which voids EVERY key in the file, not just the malformed one`,e)),n.catchAll(()=>n.succeed(Q)));return yield*s.update(t,t=>(i.set(t,e,f),t)),f})})})),Ie={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},Le={Edit:!0,MultiEdit:!0,Update:!0};function Re(e){return Array.isArray(e)&&e.length>0&&e.every(e=>typeof e==`object`&&!!e&&(`new_text`in e||`old_text`in e))}function ze(e,t){let n=t;if(Ie[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(Le[e]===!0&&`edits`in n&&Re(n.edits)&&!(`new_string`in n)){let e=n.edits.map(e=>({old_string:typeof e.old_text==`string`?e.old_text:``,new_string:typeof e.new_text==`string`?e.new_text:``}));n={...n,edits:e,old_string:e.map(e=>e.old_string).join(`
16
- `),new_string:e.map(e=>e.new_string).join(`
17
- `)}}return n}function Be(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}export{ze as a,Me as i,Fe as n,Be as o,je as r,Ne as s,$ as t};
@@ -1,3 +0,0 @@
1
- import{a as e,i as t,o as n,r,s as i}from"./dist-spu_CyKU.js";import{Command as a}from"@effect/platform";import{CommandExecutor as o}from"@effect/platform/CommandExecutor";import{FileSystem as s}from"@effect/platform/FileSystem";import{Effect as c,Either as l,Match as u,Option as d,Schema as f,Stream as p}from"effect";import{homedir as m}from"node:os";f.Struct({code:f.Number,stdout:f.String,stderr:f.String});var h=class extends f.TaggedClass()(`Block`,{reason:f.String}){},g=class extends f.TaggedClass()(`Allow`,{}){},_=class extends f.TaggedClass()(`Warning`,{message:f.String}){};f.Union(h,g,_);var v=class extends f.TaggedClass()(`Blocked`,{reason:f.String}){},y=class extends f.TaggedClass()(`Continue`,{warning:f.optional(f.String),updatedInput:f.optional(f.Record({key:f.String,value:f.Unknown}))}){};f.Union(v,y);const b=f.Struct({decision:f.optional(f.String),reason:f.optional(f.String),hookSpecificOutput:f.optional(f.Struct({permissionDecision:f.optional(f.String),permissionDecisionReason:f.optional(f.String),updatedInput:f.optional(f.Record({key:f.String,value:f.Unknown}))}))}),x=f.decodeUnknownEither(f.parseJson(b)),S=f.Struct({type:f.Literal(`command`),command:f.String,async:f.optional(f.Boolean),timeout:f.optional(f.Number)}),C=f.Struct({matcher:f.optional(f.String),hooks:f.Array(S)}),w=f.Struct({PreToolUse:f.optionalWith(f.Array(C),{exact:!0,default:()=>[]}),PostToolUse:f.optionalWith(f.Array(C),{exact:!0,default:()=>[]}),UserPromptSubmit:f.optionalWith(f.Array(C),{exact:!0,default:()=>[]}),Stop:f.optionalWith(f.Array(C),{exact:!0,default:()=>[]}),SessionStart:f.optionalWith(f.Array(C),{exact:!0,default:()=>[]}),SessionEnd:f.optionalWith(f.Array(C),{exact:!0,default:()=>[]})}),T=f.Struct({hooks:w,disableAllHooks:f.optional(f.Boolean)}),E=f.Struct({...w.fields,disableAllHooks:f.optional(f.Boolean)}),D=f.Union(T,E),O=f.decodeUnknownEither(D);function k(e){return l.map(O(e),e=>{if(`hooks`in e)return e;let{disableAllHooks:t,...n}=e;return{hooks:n,disableAllHooks:t}})}const A=[`PreToolUse`,`PostToolUse`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`];function j(e){let t={hooks:{PreToolUse:[],PostToolUse:[],UserPromptSubmit:[],SessionStart:[],SessionEnd:[],Stop:[]}};for(let n of e){for(let e of A)t.hooks[e]=(t.hooks[e]??[]).concat(Array.from(n.hooks[e]));n.disableAllHooks!==void 0&&(t.disableAllHooks=n.disableAllHooks)}return t}function M(e){return e.disableAllHooks===!0}var N=class extends f.TaggedError()(`HookVerdictError`,{raw:f.String}){},P=class extends f.TaggedClass()(`ExitBlock`,{}){},F=class extends f.TaggedClass()(`ExitParse`,{}){},I=class extends f.TaggedClass()(`ExitOther`,{}){};f.Union(P,F,I);const L=e=>u.value(e).pipe(u.when(2,()=>new P({})),u.when(0,()=>new F({})),u.orElse(()=>new I({}))),R=(e,t)=>u.value(e.trim()).pipe(u.when(``,()=>`Blocked by ${t} hook`),u.orElse(e=>e)),z=(e,t)=>u.value(e.hookSpecificOutput?.permissionDecision??e.decision).pipe(u.when(`deny`,()=>new h({reason:e.hookSpecificOutput?.permissionDecisionReason??`Blocked by ${t} hook`})),u.when(`block`,()=>new h({reason:e.reason??`Blocked by ${t} hook`})),u.orElse(()=>new g({}))),B=e=>u.value(e.trim()).pipe(u.when(``,()=>new g({})),u.orElse(e=>new _({message:e}))),V=(e,t)=>u.value(L(e.code)).pipe(u.tag(`ExitBlock`,()=>l.right(new h({reason:R(e.stderr,t)}))),u.tag(`ExitParse`,()=>l.match(x(e.stdout),{onLeft:()=>l.left(new N({raw:e.stdout})),onRight:e=>l.right(z(e,t))})),u.tag(`ExitOther`,()=>l.right(B(e.stderr))),u.exhaustive);function H(e,t){let n=e.replace(/"\$OMP_PROJECT_DIR"|'\$OMP_PROJECT_DIR'/g,JSON.stringify(t)).replace(/"\$\{OMP_PROJECT_DIR\}"|'\$\{OMP_PROJECT_DIR\}'/g,JSON.stringify(t)).replace(/"\$CLAUDE_PROJECT_DIR"|'\$CLAUDE_PROJECT_DIR'/g,JSON.stringify(t)).replace(/"\$\{CLAUDE_PROJECT_DIR\}"|'\$\{CLAUDE_PROJECT_DIR\}'/g,JSON.stringify(t)).replace(/\$OMP_PROJECT_DIR|\$\{OMP_PROJECT_DIR\}/g,JSON.stringify(t)).replace(/\$CLAUDE_PROJECT_DIR|\$\{CLAUDE_PROJECT_DIR\}/g,JSON.stringify(t)).trim();return{cmd:`sh`,args:[`-c`,n.startsWith(`"`)&&n.endsWith(`"`)?n.slice(1,-1):n]}}const U=c.fn(`loadSettingsFile`)(function*(e){let t=yield*(yield*s).readFileString(e).pipe(c.catchAll(()=>c.succeed(``)));if(t===``)return null;let n=f.decodeUnknownEither(f.parseJson(f.Record({key:f.String,value:f.Unknown})))(t);if(l.isLeft(n))return null;let r=n.right,i=k(r);return l.isLeft(i)?null:i.right}),W=c.fn(`loadSettings`)(function*(e){let t=[`${m()}/.claude/settings.json`,`${e}/.claude/settings.json`,`${e}/.claude/settings.local.json`,`/etc/claude-code/managed-settings.json`];return yield*G(t)}),G=c.fn(`loadSettingsWithPaths`)(function*(e){let t=[];for(let n of e){let e=yield*U(n);e!==null&&t.push(e)}return t.length===0?null:j(t)}),K=c.fn(`runHookScript`)(function*(e,t,n,r){let i=yield*o,{cmd:s,args:l}=H(e,n),u=JSON.stringify(t),d=a.make(s,...l).pipe(a.workingDirectory(n),a.env({OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n}),a.feed(u),a.stdout(`pipe`),a.stderr(`pipe`));return yield*c.scoped(c.gen(function*(){let e=yield*i.start(d),t=yield*e.stdout.pipe(p.decodeText(),p.mkString),n=yield*e.stderr.pipe(p.decodeText(),p.mkString),r=yield*e.exitCode;return{code:typeof r==`number`?r:Number(r),stdout:t,stderr:n}})).pipe(c.timeout(r),c.catchTag(`TimeoutException`,()=>c.succeed({code:-1,stdout:``,stderr:`timeout after ${r}ms`})))}),q=c.fn(`runHooksForEvent`)(function*(e,n,r,i,a){let o=i.cwd,s,f=!1,p=r;for(let r of e)if(t(n,r.matcher))for(let e of r.hooks){let t=(e.timeout??10)*1e3;if(e.async){yield*c.forkDaemon(K(e.command,p,o,t));continue}let n=yield*K(e.command,p,o,t),r=V(n,a),i=l.match(r,{onLeft:e=>u.value(e).pipe(u.tag(`HookVerdictError`,e=>new _({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`})),u.exhaustive),onRight:e=>e}),m=u.value(i).pipe(u.tag(`Block`,e=>new v({reason:e.reason})),u.tag(`Warning`,e=>new y({warning:e.message})),u.tag(`Allow`,()=>{let e=x(n.stdout);return new y({updatedInput:l.isRight(e)?e.right.hookSpecificOutput?.updatedInput:void 0})}),u.exhaustive),h=u.value(m).pipe(u.tag(`Blocked`,e=>d.some({block:!0,reason:e.reason})),u.tag(`Continue`,e=>(e.warning!==void 0&&s===void 0&&(s=e.warning),e.updatedInput!==void 0&&(p={...p,...e.updatedInput},f=!0),d.none())),u.exhaustive);if(d.isSome(h))return h.value}return{...f?{updatedInput:p}:{},...s===void 0?{}:{warning:s}}}),J=c.fn(`runPreToolUseHooks`)(function*(t,a,o){if(M(t))return;let s=n(a.toolName),c=i(()=>o.sessionManager.getSessionId()),l={...c,tool_name:s,tool_input:e(s,a.input),tool_call_id:a.toolCallId},u=r(a.toolName,a.input);if(u!==void 0&&u.length>0){let e={...c,tool_name:`Bash`,tool_input:{command:u},tool_call_id:a.toolCallId},n=yield*q(t.hooks.PreToolUse,`Bash`,e,o,`PreToolUse`);if(n.block)return n.reason===void 0?{block:!0}:{block:!0,reason:n.reason}}let d=yield*q(t.hooks.PreToolUse,s,l,o,`PreToolUse`);if(d.block)return d.reason===void 0?{block:!0}:{block:!0,reason:d.reason};if(d.updatedInput&&typeof d.updatedInput==`object`&&`tool_input`in d.updatedInput&&d.updatedInput.tool_input&&typeof d.updatedInput.tool_input==`object`){let e=d.updatedInput.tool_input;for(let[t,n]of Object.entries(e))a.input[t]=n}}),Y=c.fn(`runPostToolUseHooks`)(function*(t,r,a){let o=n(r.toolName);if(M(t))return;let s={...i(()=>a.sessionManager.getSessionId()),tool_name:o,tool_input:e(o,r.input),tool_call_id:r.toolCallId,output:r.content,is_error:r.isError??!1};return yield*q(t.hooks.PostToolUse,o,s,a,`PostToolUse`)}),X=c.fn(`runUserPromptSubmitHooks`)(function*(e,t,n){let r=e.hooks.UserPromptSubmit;if(M(e)||r.length===0)return;let a=n.cwd,o=``,s={...i(()=>n.sessionManager.getSessionId()),prompt:t.text,source:t.source};for(let e of r)for(let t of e.hooks){let e=yield*K(t.command,s,a,(t.timeout??10)*1e3);if(e.code!==0)continue;let n=e.stdout.trim();n.length>0&&(o+=(o.length>0?`
2
-
3
- `:``)+n)}if(o.length===0)return;let c={text:`${o}\n\n${t.text}`};return t.images!==void 0&&(c.images=t.images),c}),Z=c.fn(`runSessionStartHooks`)(function*(e,n,r){if(M(e))return;let a=e.hooks.SessionStart;if(a.length===0)return;let o=r.cwd,s={...i(()=>r.sessionManager.getSessionId()),reason:n};for(let e of a)if(!(e.matcher&&!t(n,e.matcher)))for(let t of e.hooks){let e=(t.timeout??10)*1e3;if(t.async){yield*c.forkDaemon(K(t.command,s,o,e));continue}yield*K(t.command,s,o,e)}}),Q=c.fn(`runLifecycleHooks`)(function*(e,t){if(e.length===0)return;let n=t.cwd,r={...i(()=>t.sessionManager.getSessionId())};for(let t of e)for(let e of t.hooks){let t=(e.timeout??10)*1e3;e.async?yield*c.forkDaemon(K(e.command,r,n,t)):yield*K(e.command,r,n,t)}});export{W as loadSettings,Q as runLifecycleHooks,Y as runPostToolUseHooks,J as runPreToolUseHooks,Z as runSessionStartHooks,X as runUserPromptSubmitHooks};
@@ -1,3 +0,0 @@
1
- import{t as e}from"./dist-spu_CyKU.js";import{FileSystem as t}from"@effect/platform/FileSystem";import{Effect as n,Either as r,Match as i,Option as a,Schema as o}from"effect";import*as s from"@effect/platform/Path";const c=[`AGENTS.md`];var l=class extends o.TaggedClass()(`Inject`,{}){},u=class extends o.TaggedClass()(`Skip`,{matched:o.String}){};o.Struct({baseName:o.String,skipList:o.Array(o.String)});const d=e=>a.fromNullable(e.skipList.find(t=>t===e.baseName)),f=e=>i.value(d(e)).pipe(i.tag(`None`,()=>new l),i.tag(`Some`,e=>new u({matched:e.value})),i.exhaustive),p=n.fn(`extractRefs`)(function*(e,i,a){let o=yield*t,c=yield*s.Path,l=[];for(let t of e.split(`
2
- `)){let e=t.trim().replace(/^[-*+]\s+/,``);if(!e.startsWith(`@`))continue;let s=e.slice(1).trim();if(!s||s.includes(` `)||c.isAbsolute(s))continue;let u=c.resolve(i,s);if(u.startsWith(a+`/`)||u===a){let e=yield*n.either(o.exists(u));if(r.isRight(e)&&e.right){l.push({sourcePath:i,resolvedPath:u});continue}}let d=c.resolve(a,s);(d.startsWith(a+`/`)||d===a)&&d!==u&&l.push({sourcePath:a,resolvedPath:d})}return l}),m=n.fn(`loadReferencedContent`)(function*(o){let l=yield*t,u=yield*s.Path,d=yield*e,m=[u.resolve(o,`CLAUDE.md`),u.resolve(o,`.claude`,`CLAUDE.md`)],h=[];for(let e of m){let t=yield*n.either(l.readFileString(e,`utf-8`));if(r.isRight(t)){let n=yield*p(t.right,u.dirname(e),o);h.push(...n)}}let g=new Set,_=[];for(let e of h)g.has(e.resolvedPath)||(g.add(e.resolvedPath),_.push(e));let v=(yield*d.load(o).pipe(n.tapError(e=>n.logWarning(`[omp-claude-compat] could not read systemfsoftware.toml in ${o}; using the default skip list`,e)),n.catchAll(()=>n.succeed(void 0))))?.no_inject_refs??c,y=[];for(let e of _){let t=e.resolvedPath.slice(o.length+1),s=i.value(f({baseName:u.basename(e.resolvedPath),skipList:v})).pipe(i.tag(`Skip`,e=>a.some(e.matched)),i.tag(`Inject`,()=>a.none()),i.exhaustive);if(a.isSome(s)){yield*n.logInfo(`[omp-claude-compat] skipped @-ref ${t}: host already provides ${s.value}`);continue}let c=yield*n.either(l.readFileString(e.resolvedPath,`utf-8`));if(r.isLeft(c)){yield*n.logWarning(`[omp-claude-compat] could not read @-ref ${t}; skipping it`);continue}y.push(`## ${t}\n${c.right}\n`)}return y.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...y].join(`
3
- `)});export{m as loadReferencedContent};
@@ -1 +0,0 @@
1
- import{n as e}from"./dist-spu_CyKU.js";import{Layer as t,ManagedRuntime as n}from"effect";import*as r from"@effect/platform/Path";import{NodeCommandExecutor as i,NodeFileSystem as a}from"@effect/platform-node";const o=i.layer.pipe(t.provideMerge(a.layer),t.provideMerge(r.layer)),s=n.make(e.pipe(t.provideMerge(o)));export{s as default};