From ac1166a609f881faa29a61ce36eed9d0af8c8793 Mon Sep 17 00:00:00 2001 From: sungju Yun Date: Mon, 29 Jun 2026 21:17:23 +0900 Subject: [PATCH] =?UTF-8?q?perf(gate):=20incremental=20TS=20gate=20?= =?UTF-8?q?=E2=80=94=20tsc=20--incremental=20+=20eslint=20--cache=20(F-bfe?= =?UTF-8?q?14aac)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TypeScript type and lint gates re-ran from scratch every gate. They now reuse a build cache: `tsc --noEmit --incremental` (build-info file) and `eslint --cache`, both under `.cladding/cache/` (already gitignored, so a managed project's tree stays clean). Measured on cladding's own repo (unchanged re-run — the local pre-commit/ pre-push loop): tsc 2.7s → 1.1s, eslint 2.5s → 0.6s (~3.4s saved). SOUND, not a shortcut: with a stale build-info present, a newly-introduced type error in an included file is STILL caught (verified — tsc rebuilds the affected program slice; eslint --cache keys on file+config hash). Cold runs (fresh CI checkout) just rebuild the cache — no regression. Test execution is deliberately NOT scoped: a gate must certify the whole tree, so changed-files / test-selection (unsound for a gate) was avoided. The dominant test cost (~20s) and the unit+coverage double-run (~9.5s) are noted as separate follow-ups. Existing toolchain arg-pins updated; blind-authored test (incremental-gate.test.ts, 5). Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 15 ++++ plugins/claude-code/dist/clad.js | 2 +- spec.yaml | 6 +- spec/attestation.yaml | 23 +++--- .../incremental-ts-gate-bfe14aac.yaml | 33 ++++++++ spec/index.yaml | 1 + src/stages/toolchain/detect.ts | 11 ++- tests/stages/incremental-gate.test.ts | 77 +++++++++++++++++++ tests/stages/toolchain.test.ts | 6 +- 9 files changed, 154 insertions(+), 20 deletions(-) create mode 100644 spec/features/incremental-ts-gate-bfe14aac.yaml create mode 100644 tests/stages/incremental-gate.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bad350..5126ba37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,21 @@ Versioning: [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + +- **Incremental TS gate — tsc `--incremental` + eslint `--cache`** (`F-bfe14aac`) — the + TypeScript type and lint gates re-ran from scratch every time. They now reuse a build + cache: `tsc --noEmit --incremental` (build-info file) and `eslint --cache`, both written + under `.cladding/cache/` (already gitignored, so the managed project's tree stays clean). + On an unchanged re-run — the local pre-commit/pre-push loop — measured on cladding's own + repo: **tsc 2.7s → 1.1s, eslint 2.5s → 0.6s (~3.4s saved)**. **Sound, not a shortcut:** a + newly-introduced type error is still caught with a stale build-info present (verified — + `tsc --incremental` rebuilds the affected program slice; `eslint --cache` keys on + file+config hash). Cold runs (fresh CI checkout) just rebuild the cache — no regression. + Test execution is deliberately **not** scoped — a gate must run the whole suite, so + changed-files/test-selection (unsound for a gate) was intentionally avoided. + + ## [0.7.1] — 2026-07-02 — Honest Graph Repairs found by a deep multi-agent review of the 0.7.0 graph capability. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 2ca9cdf2..a8bc7a63 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -232,7 +232,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu `,LF:` `,concatBytes:mO},$_e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},k_e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:$_e}});import{Buffer as E_e}from"node:buffer";var LG,A_e,UG,T_e,O_e,qG,BG=y(()=>{Vr();LG=(t,e)=>t?void 0:A_e.bind(void 0,e),A_e=function*(t,e){if(typeof e!="string"&&!Ft(e)&&!E_e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},UG=(t,e)=>t?T_e.bind(void 0,e):O_e.bind(void 0,e),T_e=function*(t,e){qG(t,e),yield e},O_e=function*(t,e){if(qG(t,e),typeof e!="string"&&!Ft(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},qG=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. Instead, \`yield\` should either be called with a value, or not be called at all. For example: - if (condition) { yield value; }`)}});import{Buffer as I_e}from"node:buffer";import{StringDecoder as P_e}from"node:string_decoder";var v_,R_e,C_e,D_e,gO=y(()=>{Vr();v_=(t,e,r)=>{if(r)return;if(t)return{transform:R_e.bind(void 0,new TextEncoder)};let n=new P_e(e);return{transform:C_e.bind(void 0,n),final:D_e.bind(void 0,n)}},R_e=function*(t,e){I_e.isBuffer(e)?yield Yi(e):typeof e=="string"?yield t.encode(e):yield e},C_e=function*(t,e){yield Ft(e)?t.write(e):e},D_e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as HG}from"node:util";var yO,S_,ZG,N_e,GG,j_e,VG=y(()=>{yO=HG(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),S_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=j_e}=e[r];for await(let i of n(t))yield*S_(i,e,r+1)},ZG=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N_e(r,Number(e),t)},N_e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*S_(n,r,e+1)},GG=HG(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),j_e=function*(t){yield t}});var _O,WG,oa,tf,M_e,F_e,bO=y(()=>{_O=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},WG=(t,e)=>[...e.flatMap(r=>[...oa(r,t,0)]),...tf(t)],oa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=F_e}=e[r];for(let i of n(t))yield*oa(i,e,r+1)},tf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M_e(r,Number(e),t)},M_e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*oa(n,r,e+1)},F_e=function*(t){yield t}});import{Transform as z_e,getDefaultHighWaterMark as KG}from"node:stream";var vO,w_,JG,x_=y(()=>{hr();b_();BG();gO();VG();bO();vO=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=JG(t,s,o),l=ia(e),u=ia(r),d=l?yO.bind(void 0,S_,a):_O.bind(void 0,oa),f=l||u?yO.bind(void 0,ZG,a):_O.bind(void 0,tf),p=l||u?GG.bind(void 0,a):void 0;return{stream:new z_e({writableObjectMode:n,writableHighWaterMark:KG(n),readableObjectMode:i,readableHighWaterMark:KG(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},w_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=JG(s,r,a);t=WG(c,t)}return t},JG=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LG(n,a)},v_(r,s,n),__(r,o,n,c),{transform:t,final:e},{transform:UG(i,a)},zG({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var YG,L_e,U_e,q_e,B_e,XG=y(()=>{x_();Vr();hr();YG=(t,e)=>{for(let r of L_e(t))U_e(t,r,e)},L_e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U_e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ho[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>q_e(a,n));r.input=zd(s)},q_e=(t,e)=>{let r=w_(t,e,"utf8",!0);return B_e(r),zd(r)},B_e=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var $_,H_e,Z_e,QG,e9,G_e,t9,SO=y(()=>{ea();hr();Ac();Lo();$_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ec(r,n)&&!Wr.has(e)&&H_e(n)&&(t.some(({type:i,value:o})=>i==="native"&&Z_e.has(o))||t.every(({type:i})=>gn.has(i))),H_e=t=>t===1||t===2,Z_e=new Set(["pipe","overlapped"]),QG=async(t,e,r,n)=>{for await(let i of t)G_e(e)||t9(i,r,n)},e9=(t,e,r)=>{for(let n of t)t9(n,e,r)},G_e=t=>t._readableState.pipes.length>0,t9=(t,e,r)=>{let n=xy(t);mi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as V_e,appendFileSync as W_e}from"node:fs";var r9,K_e,J_e,Y_e,X_e,Q_e,n9=y(()=>{SO();x_();b_();Vr();hr();na();r9=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>K_e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},K_e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=UZ(t,o,d),p=Yi(f),{stdioItems:m,objectMode:h}=e[r],g=J_e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Y_e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});X_e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&Q_e(b,m,i),S}catch(x){return n.error=x,S}},J_e=(t,e,r,n)=>{try{return w_(t,e,r,!1)}catch(i){return n.error=i,t}},Y_e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zd(t)};let s=P6(t,r);return n[o]?{serializedResult:s,finalResult:hO(s,!i[o],e)}:{serializedResult:s}},X_e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!$_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=hO(t,!1,s);try{e9(a,e,n)}catch(c){r.error??=c}},Q_e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>h_.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?W_e(n,t):(r.add(o),V_e(n,t))}}});var i9,o9=y(()=>{Vr();ef();i9=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ro(e,r,"all")]:Array.isArray(e)?[ro(t,r,"all"),...e]:Ft(t)&&Ft(e)?uT([t,e]):`${t}${e}`}});import{once as wO}from"node:events";var s9,ebe,a9,c9,tbe,xO,$O=y(()=>{Xs();s9=async(t,e)=>{let[r,n]=await ebe(t);return e.isForcefullyTerminated??=!1,[r,n]},ebe=async t=>{let[e,r]=await Promise.allSettled([wO(t,"spawn"),wO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?a9(t):r.value},a9=async t=>{try{return await wO(t,"exit")}catch{return a9(t)}},c9=async t=>{let[e,r]=await t;if(!tbe(e,r)&&xO(e,r))throw new Un;return[e,r]},tbe=(t,e)=>t===void 0&&e===void 0,xO=(t,e)=>t!==0||e!==null});var l9,rbe,u9=y(()=>{Xs();na();$O();l9=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=rbe(t,e,r),s=o?.code==="ETIMEDOUT",a=LZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},rbe=(t,e,r)=>t!==void 0?t:xO(e,r)?new Un:void 0});import{spawnSync as nbe}from"node:child_process";var d9,ibe,obe,sbe,k_,abe,cbe,lbe,ube,f9=y(()=>{bT();VT();WT();Qd();f_();jG();ef();XG();n9();na();o9();u9();d9=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ibe(t,e,r),d=abe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Fc(d,c,l)},ibe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Ey(t,e,r),a=obe(r),{file:c,commandArguments:l,options:u}=Qy(t,e,a);sbe(u);let d=DG(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},obe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,sbe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&k_("ipcInput"),t&&k_("ipc: true"),r&&k_("detached: true"),n&&k_("cancelSignal")},k_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},abe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=cbe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=l9(c,r),{output:m,error:h=l}=r9({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ro(_,r,S)),b=ro(i9(m,r),r,"all");return ube({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},cbe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{YG(o,r);let a=lbe(r);return nbe(...e_(t,e,a))}catch(a){return Mc({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},lbe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:u_(e)}),ube=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?d_({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Xd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as kO,on as dbe}from"node:events";var p9,fbe,pbe,mbe,hbe,m9=y(()=>{Rc();Vd();Gd();p9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ic({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Gy(t)}),fbe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),fbe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{zy(e,i);let o=Bo(t,e,r),s=new AbortController;try{return await Promise.race([pbe(o,n,s),mbe(o,r,s),hbe(o,r,s)])}catch(a){throw Pc(t),a}finally{s.abort(),Ly(e,i)}},pbe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await kO(t,"message",{signal:r});return n}for await(let[n]of dbe(t,"message",{signal:r}))if(e(n))return n},mbe=async(t,e,{signal:r})=>{await kO(t,"disconnect",{signal:r}),kH(e)},hbe=async(t,e,{signal:r})=>{let[n]=await kO(t,"strict:error",{signal:r});throw Ny(n,e)}});import{once as g9,on as gbe}from"node:events";var y9,EO,ybe,_be,bbe,h9,AO=y(()=>{Rc();Vd();Gd();y9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>EO({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),EO=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ic({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Gy(t)}),zy(e,o);let s=Bo(t,e,r),a=new AbortController,c={};return ybe(t,s,a),_be({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),bbe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},ybe=async(t,e,r)=>{try{await g9(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},_be=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await g9(t,"strict:error",{signal:r.signal});n.error=Ny(i,e),r.abort()}catch{}},bbe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of gbe(r,"message",{signal:o.signal}))h9(s),yield c}catch{h9(s)}finally{o.abort(),Ly(e,a),n||Pc(t),i&&await t}},h9=({error:t})=>{if(t)throw t}});import _9 from"node:process";var b9,v9,S9,TO=y(()=>{Yy();m9();AO();Hy();b9=(t,{ipc:e})=>{Object.assign(t,S9(t,!1,e))},v9=()=>{let t=_9,e=!0,r=_9.channel!==void 0;return{...S9(t,e,r),getCancelSignal:QH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},S9=(t,e,r)=>({sendMessage:Jy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:y9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as vbe}from"node:child_process";import{PassThrough as Sbe,Readable as wbe,Writable as xbe,Duplex as $be}from"node:stream";var w9,kbe,rf,Ebe,Abe,Tbe,Obe,x9=y(()=>{y_();Qd();f_();w9=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{fO(n);let a=new vbe;kbe(a,n),Object.assign(a,{readable:Ebe,writable:Abe,duplex:Tbe});let c=Mc({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Obe(c,s,i);return{subprocess:a,promise:l}},kbe=(t,e)=>{let r=rf(),n=rf(),i=rf(),o=Array.from({length:e.length-3},rf),s=rf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},rf=()=>{let t=new Sbe;return t.end(),t},Ebe=()=>new wbe({read(){}}),Abe=()=>new xbe({write(){}}),Tbe=()=>new $be({read(){},write(){}}),Obe=async(t,e,r)=>Fc(t,e,r)});import{createReadStream as $9,createWriteStream as k9}from"node:fs";import{Buffer as Ibe}from"node:buffer";import{Readable as nf,Writable as Pbe,Duplex as Rbe}from"node:stream";var A9,of,E9,Cbe,T9=y(()=>{x_();y_();hr();A9=(t,e)=>g_(Cbe,t,e,!1),of=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ho[t]}.`)},E9={fileNumber:of,generator:vO,asyncGenerator:vO,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Rbe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Cbe={input:{...E9,fileUrl:({value:t})=>({stream:$9(t)}),filePath:({value:{file:t}})=>({stream:$9(t)}),webStream:({value:t})=>({stream:nf.fromWeb(t)}),iterable:({value:t})=>({stream:nf.from(t)}),asyncIterable:({value:t})=>({stream:nf.from(t)}),string:({value:t})=>({stream:nf.from(t)}),uint8Array:({value:t})=>({stream:nf.from(Ibe.from(t))})},output:{...E9,fileUrl:({value:t})=>({stream:k9(t)}),filePath:({value:{file:t,append:e}})=>({stream:k9(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Pbe.fromWeb(t)}),iterable:of,asyncIterable:of,string:of,uint8Array:of}}});import{on as Dbe,once as O9}from"node:events";import{PassThrough as Nbe,getDefaultHighWaterMark as jbe}from"node:stream";import{finished as R9}from"node:stream/promises";function sa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)IO(i);let e=t.some(({readableObjectMode:i})=>i),r=Mbe(t,e),n=new OO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Mbe,OO,Fbe,zbe,Lbe,IO,Ube,qbe,Bbe,Hbe,Zbe,C9,D9,PO,N9,Gbe,E_,I9,P9,A_=y(()=>{Mbe=(t,e)=>{if(t.length===0)return jbe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},OO=class extends Nbe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(IO(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Fbe(this,this.#t,this.#o);let r=Ube({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(IO(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Fbe=async(t,e,r)=>{E_(t,I9);let n=new AbortController;try{await Promise.race([zbe(t,n),Lbe(t,e,r,n)])}finally{n.abort(),E_(t,-I9)}},zbe=async(t,{signal:e})=>{try{await R9(t,{signal:e,cleanup:!0})}catch(r){throw C9(t,r),r}},Lbe=async(t,e,r,{signal:n})=>{for await(let[i]of Dbe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},IO=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Ube=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{E_(t,P9);let a=new AbortController;try{await Promise.race([qbe(o,e,a),Bbe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Hbe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),E_(t,-P9)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?PO(t):Zbe(t))},qbe=async(t,e,{signal:r})=>{try{await t,r.aborted||PO(e)}catch(n){r.aborted||C9(e,n)}},Bbe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await R9(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;D9(s)?i.add(e):N9(t,s)}},Hbe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await O9(t,i,{signal:o}),!t.readable)return O9(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Zbe=t=>{t.writable&&t.end()},C9=(t,e)=>{D9(e)?PO(t):N9(t,e)},D9=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",PO=t=>{(t.readable||t.writable)&&t.destroy()},N9=(t,e)=>{t.destroyed||(t.once("error",Gbe),t.destroy(e))},Gbe=()=>{},E_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I9=2,P9=1});import{finished as j9}from"node:stream/promises";var Lc,Vbe,RO,Wbe,CO,T_=y(()=>{Xi();Lc=(t,e)=>{t.pipe(e),Vbe(t,e),Wbe(t,e)},Vbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RO(e)}},RO=t=>{t.writable&&t.end()},Wbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(e,{cleanup:!0,readable:!1,writable:!0})}catch{}CO(t)}},CO=t=>{t.readable&&t.destroy()}});var M9,Kbe,Jbe,Ybe,Xbe,Qbe,F9=y(()=>{A_();Xi();Fy();hr();T_();M9=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>gn.has(c)))Kbe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!gn.has(c)))Ybe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:sa(o);Lc(s,i)}},Kbe=(t,e,r,n)=>{r==="output"?Lc(t.stdio[n],e):Lc(e,t.stdio[n]);let i=Jbe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Jbe=["stdin","stdout","stderr"],Ybe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Xbe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Xbe=(t,{signal:e})=>{Ln(t)&&Qs(t,Qbe,e)},Qbe=2});var aa,z9=y(()=>{aa=[];aa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&aa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&aa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var O_,DO,NO,eve,jO,I_,tve,MO,FO,zO,L9,n7e,i7e,U9=y(()=>{z9();O_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",DO=Symbol.for("signal-exit emitter"),NO=globalThis,eve=Object.defineProperty.bind(Object),jO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(NO[DO])return NO[DO];eve(NO,DO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},I_=class{},tve=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),MO=class extends I_{onExit(){return()=>{}}load(){}unload(){}},FO=class extends I_{#t=zO.platform==="win32"?"SIGINT":"SIGHUP";#r=new jO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of aa)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!O_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of aa)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,aa.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return O_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&O_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},zO=globalThis.process,{onExit:L9,load:n7e,unload:i7e}=tve(O_(zO)?new FO(zO):new MO)});import{addAbortListener as rve}from"node:events";var q9,B9=y(()=>{U9();q9=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L9(()=>{t.kill()});rve(n,()=>{i()})}});var Z9,nve,ive,H9,ove,G9=y(()=>{lT();ky();qo();$c();Z9=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=$y(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=nve(r,n,i),{sourceStream:d,sourceError:f}=ove(t,l),{options:p,fileDescriptors:m}=gi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},nve=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ive(t,e,...r),a=My(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ive=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(H9,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aT(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=py(r,...n);return{destination:e(H9)(i,o,s),pipeOptions:s}}if(gi.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},H9=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ove=(t,e)=>{try{return{sourceStream:Dc(t,e)}}catch(r){return{sourceError:r}}}});var W9,sve,LO,V9,UO=y(()=>{Qd();T_();W9=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=sve({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw LO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},sve=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return CO(t),n;if(e!==void 0)return RO(r),e},LO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Mc({error:t,command:V9,escapedCommand:V9,fileDescriptors:e,options:r,startTime:n,isSync:!1}),V9="source.pipe(destination)"});var K9,J9=y(()=>{K9=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ave}from"node:stream/promises";var Y9,cve,lve,uve,P_,dve,fve,X9=y(()=>{A_();Fy();T_();Y9=(t,e,r)=>{let n=P_.has(e)?lve(t,e):cve(t,e);return Qs(t,dve,r.signal),Qs(e,fve,r.signal),uve(e),n},cve=(t,e)=>{let r=sa([t]);return Lc(r,e),P_.set(e,r),r},lve=(t,e)=>{let r=P_.get(e);return r.add(t),r},uve=async t=>{try{await ave(t,{cleanup:!0,readable:!1,writable:!0})}catch{}P_.delete(t)},P_=new WeakMap,dve=2,fve=1});import{aborted as pve}from"node:util";var Q9,mve,eV=y(()=>{UO();Q9=(t,e)=>t===void 0?[]:[mve(t,e)],mve=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await pve(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw LO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var R_,hve,gve,tV=y(()=>{Ji();G9();UO();J9();X9();eV();R_=(t,...e)=>{if(Et(e[0]))return R_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z9(t,...e),i=hve({...n,destination:r});return i.pipe=R_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},hve=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=gve(t,i);W9({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Y9(e,o,d);return await Promise.race([K9(u),...Q9(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},gve=(t,e)=>Promise.allSettled([t,e])});import{on as yve}from"node:events";import{getDefaultHighWaterMark as _ve}from"node:stream";var C_,bve,qO,vve,nV,BO,rV,Sve,wve,D_=y(()=>{gO();b_();bO();C_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bve(e,s),nV({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bve=async(t,e)=>{try{await t}catch{}finally{e.abort()}},qO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vve(e,s,t);let a=t.readableObjectMode&&!o;return nV({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vve=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nV=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=yve(t,"data",{signal:e.signal,highWaterMark:rV,highWatermark:rV});return Sve({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},BO=_ve(!0),rV=BO,Sve=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=wve({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*oa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*tf(a)}},wve=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[v_(t,r,!e),__(t,i,!n,{})].filter(Boolean)});import{setImmediate as xve}from"node:timers/promises";var iV,$ve,kve,Eve,HO,oV,ZO=y(()=>{l_();Vr();SO();D_();na();ef();iV=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=$ve({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([kve(t),d]);return}let f=pO(c,r),p=qO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Eve({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},$ve=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!$_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=qO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await QG(a,t,r,o)},kve=async t=>{await xve(),t.readableFlowing===null&&t.resume()},Eve=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await o_(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await s_(r,{maxBuffer:o})):await c_(r,{maxBuffer:o})}catch(a){return oV(MZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},HO=async t=>{try{return await t}catch(e){return oV(e)}},oV=({bufferedData:t})=>O6(t)?new Uint8Array(t):t});import{finished as Ave}from"node:stream/promises";var sf,Tve,Ove,Ive,Pve,Rve,GO,N_,sV,j_=y(()=>{sf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Tve(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ave(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Pve(a,e,r,n)}finally{s.abort()}},Tve=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ove(t,r,n),n},Ove=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Ive(e,r),n.call(t,...i)}},Ive=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Pve=(t,e,r,n)=>{if(!Rve(t,e,r,n))throw t},Rve=(t,e,r,n=!0)=>r.propagating?sV(t)||N_(t):(r.propagating=!0,GO(r,e)===n?sV(t):N_(t)),GO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",N_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sV=t=>t?.code==="EPIPE"});var aV,VO,WO=y(()=>{ZO();j_();aV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>VO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),VO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=sf(t,e,l);if(GO(l,e)){await u;return}let[d]=await Promise.all([iV({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var cV,lV,Cve,Dve,KO=y(()=>{A_();WO();cV=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?sa([t,e].filter(Boolean)):void 0,lV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>VO({...Cve(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Dve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Cve=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Dve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var uV,dV,fV=y(()=>{Ac();Lo();uV=t=>Ec(t,"ipc"),dV=(t,e)=>{let r=xy(t);mi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var pV,mV,hV=y(()=>{na();fV();eo();AO();pV=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uV(o),a=Qi(e,"ipc"),c=Qi(r,"ipc");for await(let l of EO({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(FZ(t,i,c),i.push(l)),s&&dV(l,o);return i},mV=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Nve}from"node:events";var gV,jve,Mve,Fve,yV=y(()=>{ra();qT();CT();UT();Xi();hr();ZO();hV();HT();KO();WO();$O();j_();gV=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=s9(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=aV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=lV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=pV({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=jve(h,t,S),C=Mve(m,S);try{return await Promise.race([Promise.all([{},c9(_),Promise.all(x),w,A,lZ(t,d),...E,...C]),g,Fve(t,b),...iZ(t,o,f,b),...$H({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...rZ({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(L=>HO(L))),HO(w),mV(A,R),Promise.allSettled(E),Promise.allSettled(C)])}},jve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sf(n,i,r)),Mve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Bn(o,{checkOpen:!1})&&!Ln(o)).map(({type:i,value:o,stream:s=o})=>sf(s,n,e,{isSameDirection:gn.has(i),stopOnExit:i==="native"}))),Fve=async(t,{signal:e})=>{let[r]=await Nve(t,"error",{signal:e});throw r}});var _V,af,Uc,M_=y(()=>{Cc();_V=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),af=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=hi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Uc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as bV}from"node:stream/promises";var JO,vV,YO,XO,F_,z_,QO=y(()=>{j_();JO=async t=>{if(t!==void 0)try{await YO(t)}catch{}},vV=async t=>{if(t!==void 0)try{await XO(t)}catch{}},YO=async t=>{await bV(t,{cleanup:!0,readable:!1,writable:!0})},XO=async t=>{await bV(t,{cleanup:!0,readable:!0,writable:!1})},F_=async(t,e)=>{if(await t,e)throw e},z_=(t,e,r)=>{r&&!N_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as zve}from"node:stream";import{callbackify as Lve}from"node:util";var SV,eI,tI,rI,Uve,nI,iI,wV,oI=y(()=>{ea();qo();D_();Cc();M_();QO();SV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Wr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tI(a,s),{read:f,onStdoutDataDone:p}=rI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new zve({read:f,destroy:Lve(iI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},eI=(t,e,r)=>{let n=Dc(t,e),i=af(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:BO},rI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=hi(),s=C_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Uve(this,s,o)},onStdoutDataDone:o}},Uve=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await XO(t),await n,await JO(i),await e,r.readable&&r.push(null)}catch(o){await JO(i),wV(r,o)}},iI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Uc(r,e)&&(wV(t,n),await F_(e,n))},wV=(t,e)=>{z_(t,t.readable,e)}});import{Writable as qve}from"node:stream";import{callbackify as xV}from"node:util";var $V,sI,aI,Bve,Hve,cI,lI,kV,uI=y(()=>{qo();M_();QO();$V=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=sI(t,r,e),s=new qve({...aI(n,t,i),destroy:xV(lI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cI(n,s),s},sI=(t,e,r)=>{let n=My(t,e),i=af(r,n,"writableFinal"),o=af(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},aI=(t,e,r)=>({write:Bve.bind(void 0,t),final:xV(Hve.bind(void 0,t,e,r))}),Bve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hve=async(t,e,r)=>{await Uc(r,e)&&(t.writable&&t.end(),await e)},cI=async(t,e,r)=>{try{await YO(t),e.writable&&e.end()}catch(n){await vV(r),kV(e,n)}},lI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Uc(r,e),await Uc(n,e)&&(kV(t,i),await F_(e,i))},kV=(t,e)=>{z_(t,t.writable,e)}});import{Duplex as Zve}from"node:stream";import{callbackify as Gve}from"node:util";var EV,Vve,AV=y(()=>{ea();oI();uI();EV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Wr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=tI(c,a),{read:g,onStdoutDataDone:b}=rI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Zve({read:g,...aI(u,t,d),destroy:Gve(Vve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return nI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),cI(u,_,c),_},Vve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([iI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),lI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var dI,Wve,TV=y(()=>{ea();qo();D_();dI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Wr.has(e),s=Dc(t,r),a=C_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Wve(a,s,t)},Wve=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var OV,IV=y(()=>{M_();oI();uI();AV();TV();OV=(t,{encoding:e})=>{let r=_V();t.readable=SV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=$V.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=EV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=dI.bind(void 0,t,e),t[Symbol.asyncIterator]=dI.bind(void 0,t,e,{})}});var PV,Kve,Jve,RV=y(()=>{PV=(t,e)=>{for(let[r,n]of Jve){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Kve=(async()=>{})().constructor.prototype,Jve=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Kve,t)])});import{setMaxListeners as Yve}from"node:events";import{spawn as Xve}from"node:child_process";var CV,Qve,eSe,tSe,rSe,nSe,DV=y(()=>{l_();bT();VT();qo();WT();TO();Qd();f_();x9();T9();ef();F9();Cy();B9();tV();KO();yV();IV();Cc();RV();CV=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Qve(t,e,r),{subprocess:f,promise:p}=tSe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=R_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PV(f,p),gi.set(f,{options:u,fileDescriptors:d}),f},Qve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Ey(t,e,r),{file:a,commandArguments:c,options:l}=Qy(t,e,r),u=eSe(l),d=A9(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},eSe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},tSe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Xve(...e_(t,e,r))}catch(m){return w9({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Yve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];M9(c,a,l),q9(c,r,l);let d={},f=hi();c.kill=wH.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cV(c,r),OV(c,r),b9(c,r);let p=rSe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},rSe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await gV({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ro(x,e,w)),_=ro(h,e,"all"),S=nSe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Fc(S,n,e)},nSe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Xd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):d_({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var L_,iSe,oSe,NV=y(()=>{Ji();eo();L_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,iSe(n,t[n],i)]));return{...t,...r}},iSe=(t,e,r)=>oSe.has(t)&&Et(e)&&Et(r)?{...e,...r}:r,oSe=new Set(["env",...mT])});var Zo,sSe,aSe,jV=y(()=>{Ji();lT();M6();f9();DV();NV();Zo=(t,e,r,n)=>{let i=(s,a,c)=>Zo(s,a,r,c),o=(...s)=>sSe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},sSe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Et(o))return i(t,L_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=aSe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?d9(a,c,l):CV(a,c,l,i)},aSe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=N6(e)?j6(e,r):[e,...r],[s,a,c]=py(...o),l=L_(L_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var MV,FV,zV,cSe,lSe,LV=y(()=>{MV=({file:t,commandArguments:e})=>zV(t,e),FV=({file:t,commandArguments:e})=>({...zV(t,e),isSync:!0}),zV=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=cSe(t);return{file:r,commandArguments:n}},cSe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(lSe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},lSe=/ +/g});var UV,qV,uSe,BV,dSe,HV,ZV=y(()=>{UV=(t,e,r)=>{t.sync=e(uSe,r),t.s=t.sync},qV=({options:t})=>BV(t),uSe=({options:t})=>({...BV(t),isSync:!0}),BV=t=>({options:{...dSe(t),...t}}),dSe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},HV={preferLocal:!0}});var Ket,et,Jet,Yet,Xet,Qet,ett,ttt,rtt,ntt,Ir=y(()=>{jV();LV();BT();ZV();TO();Ket=Zo(()=>({})),et=Zo(()=>({isSync:!0})),Jet=Zo(MV),Yet=Zo(FV),Xet=Zo(sZ),Qet=Zo(qV,{},HV,UV),{sendMessage:ett,getOneMessage:ttt,getEachMessage:rtt,getCancelSignal:ntt}=v9()});import{existsSync as U_,statSync as fSe}from"node:fs";import{dirname as fI,extname as pSe,isAbsolute as GV,join as pI,relative as mI,resolve as q_,sep as mSe}from"node:path";function B_(t){return t==="./gradlew"||t==="gradle"}function hSe(t){return(U_(pI(t,"build.gradle.kts"))||U_(pI(t,"build.gradle")))&&U_(pI(t,"gradle.properties"))}function gSe(t,e){let n=mI(t,e).split(mSe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function Go(t,e){return t===":"?`:${e}`:`${t}:${e}`}function ySe(t,e){let r=q_(t,e),n=r;U_(r)?fSe(r).isFile()&&(n=fI(r)):pSe(r)!==""&&(n=fI(r));let i=mI(t,n);if(i.startsWith("..")||GV(i))return null;let o=n;for(;;){if(hSe(o))return o;if(q_(o)===q_(t))return null;let s=fI(o);if(s===o)return null;let a=mI(t,s);if(a.startsWith("..")||GV(a))return null;o=s}}function H_(t,e){let r=q_(t),n=new Map,i=[];for(let o of e){let s=ySe(r,o);if(!s){i.push(o);continue}let a=gSe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Z_=y(()=>{"use strict"});import{existsSync as _Se,readFileSync as bSe}from"node:fs";import{join as vSe}from"node:path";function qc(t="."){let e=vSe(t,".cladding","config.yaml");if(!_Se(e))return hI;try{let n=(0,VV.parse)(bSe(e,"utf8"))?.gate;if(!n)return hI;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of SSe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return hI}}function WV(t,e){let r=[],n=!1;for(let i of t){let o=wSe.exec(i);if(o){n=!0;for(let s of e)r.push(Go(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var VV,SSe,hI,wSe,G_=y(()=>{"use strict";VV=kt(or(),1);Z_();SSe=["type","lint","test","coverage"],hI={scope:"feature"};wSe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yI,readFileSync as KV,readdirSync as xSe,statSync as $Se}from"node:fs";import{join as V_}from"node:path";function vI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=V_(t,e);if(yI(r))try{if(JV.test(KV(r,"utf8")))return!0}catch{}}return!1}function YV(t){try{return yI(t)&&JV.test(KV(t,"utf8"))}catch{return!1}}function XV(t,e=0){if(e>4||!yI(t))return!1;let r;try{r=xSe(t)}catch{return!1}for(let n of r){let i=V_(t,n),o=!1;try{o=$Se(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(XV(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&YV(i))return!0}return!1}function ASe(t){if(vI(t))return!0;for(let e of kSe)if(YV(V_(t,e)))return!0;for(let e of ESe)if(XV(V_(t,e)))return!0;return!1}function QV(t="."){let e=qc(t).coverage;return e||(ASe(t)?"kover":"jacoco")}function eW(t="."){return _I[QV(t)]}function tW(t="."){return gI[QV(t)]}var _I,gI,bI,JV,kSe,ESe,W_=y(()=>{"use strict";G_();_I={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bI=[gI.kover,gI.jacoco],JV=/kover/i;kSe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ESe=["buildSrc","build-logic"]});import{existsSync as SI,readdirSync as rW}from"node:fs";import{join as K_}from"node:path";function wI(t){return SI(K_(t,"gradlew"))?"./gradlew":"gradle"}function TSe(t){let e=wI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[eW(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function ISe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function CSe(t,e){for(let r of e)if(SI(K_(t,r)))return r}function DSe(t,e){try{return rW(t).find(n=>n.endsWith(e))}catch{return}}function jSe(t,e){for(let r of NSe)if(r.configs.some(n=>SI(K_(t,n))))return r.gate;return e}function pt(t="."){for(let e of PSe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=DSe(t,o):r=CSe(t,[o]),r)break;if(!r||e.requiresSource&&!ISe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:jSe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return RSe}var OSe,PSe,RSe,NSe,yn=y(()=>{"use strict";W_();OSe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PSe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit"]},lint:{cmd:"npx",args:["--no-install","eslint","."]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TSe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],RSe={language:"unknown",manifest:"",gates:{}};NSe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as MSe,readFileSync as FSe}from"node:fs";import{join as zSe}from"node:path";function cf(t){return t.code==="ENOENT"}function J_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return nW.test(o)||nW.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function zt(t,e,r){return cf(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function sr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Bc(t,e){let r=zSe(t,"package.json");if(!MSe(r))return!1;try{return!!JSON.parse(FSe(r,"utf8")).scripts?.[e]}catch{return!1}}var nW,_n=y(()=>{"use strict";nW=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function LSe(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.arch;if(!n)return[{detector:Y_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return cf(i)?[{detector:Y_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:J_(i,Y_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Y_,X_,xI=y(()=>{"use strict";Ir();yn();_n();Y_="ARCHITECTURE_VIOLATION";X_={name:Y_,run:LSe}});import iW from"node:process";function ca(t={}){let r=X_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:USe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` + if (condition) { yield value; }`)}});import{Buffer as I_e}from"node:buffer";import{StringDecoder as P_e}from"node:string_decoder";var v_,R_e,C_e,D_e,gO=y(()=>{Vr();v_=(t,e,r)=>{if(r)return;if(t)return{transform:R_e.bind(void 0,new TextEncoder)};let n=new P_e(e);return{transform:C_e.bind(void 0,n),final:D_e.bind(void 0,n)}},R_e=function*(t,e){I_e.isBuffer(e)?yield Yi(e):typeof e=="string"?yield t.encode(e):yield e},C_e=function*(t,e){yield Ft(e)?t.write(e):e},D_e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as HG}from"node:util";var yO,S_,ZG,N_e,GG,j_e,VG=y(()=>{yO=HG(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),S_=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=j_e}=e[r];for await(let i of n(t))yield*S_(i,e,r+1)},ZG=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N_e(r,Number(e),t)},N_e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*S_(n,r,e+1)},GG=HG(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),j_e=function*(t){yield t}});var _O,WG,oa,tf,M_e,F_e,bO=y(()=>{_O=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},WG=(t,e)=>[...e.flatMap(r=>[...oa(r,t,0)]),...tf(t)],oa=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=F_e}=e[r];for(let i of n(t))yield*oa(i,e,r+1)},tf=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M_e(r,Number(e),t)},M_e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*oa(n,r,e+1)},F_e=function*(t){yield t}});import{Transform as z_e,getDefaultHighWaterMark as KG}from"node:stream";var vO,w_,JG,x_=y(()=>{hr();b_();BG();gO();VG();bO();vO=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=JG(t,s,o),l=ia(e),u=ia(r),d=l?yO.bind(void 0,S_,a):_O.bind(void 0,oa),f=l||u?yO.bind(void 0,ZG,a):_O.bind(void 0,tf),p=l||u?GG.bind(void 0,a):void 0;return{stream:new z_e({writableObjectMode:n,writableHighWaterMark:KG(n),readableObjectMode:i,readableHighWaterMark:KG(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},w_=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=JG(s,r,a);t=WG(c,t)}return t},JG=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:LG(n,a)},v_(r,s,n),__(r,o,n,c),{transform:t,final:e},{transform:UG(i,a)},zG({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var YG,L_e,U_e,q_e,B_e,XG=y(()=>{x_();Vr();hr();YG=(t,e)=>{for(let r of L_e(t))U_e(t,r,e)},L_e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U_e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ho[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>q_e(a,n));r.input=zd(s)},q_e=(t,e)=>{let r=w_(t,e,"utf8",!0);return B_e(r),zd(r)},B_e=t=>{let e=t.find(r=>typeof r!="string"&&!Ft(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)}});var $_,H_e,Z_e,QG,e9,G_e,t9,SO=y(()=>{ea();hr();Ac();Lo();$_=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ec(r,n)&&!Wr.has(e)&&H_e(n)&&(t.some(({type:i,value:o})=>i==="native"&&Z_e.has(o))||t.every(({type:i})=>gn.has(i))),H_e=t=>t===1||t===2,Z_e=new Set(["pipe","overlapped"]),QG=async(t,e,r,n)=>{for await(let i of t)G_e(e)||t9(i,r,n)},e9=(t,e,r)=>{for(let n of t)t9(n,e,r)},G_e=t=>t._readableState.pipes.length>0,t9=(t,e,r)=>{let n=xy(t);mi({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as V_e,appendFileSync as W_e}from"node:fs";var r9,K_e,J_e,Y_e,X_e,Q_e,n9=y(()=>{SO();x_();b_();Vr();hr();na();r9=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>K_e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},K_e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=UZ(t,o,d),p=Yi(f),{stdioItems:m,objectMode:h}=e[r],g=J_e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Y_e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});X_e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&Q_e(b,m,i),S}catch(x){return n.error=x,S}},J_e=(t,e,r,n)=>{try{return w_(t,e,r,!1)}catch(i){return n.error=i,t}},Y_e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:zd(t)};let s=P6(t,r);return n[o]?{serializedResult:s,finalResult:hO(s,!i[o],e)}:{serializedResult:s}},X_e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!$_({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=hO(t,!1,s);try{e9(a,e,n)}catch(c){r.error??=c}},Q_e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>h_.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?W_e(n,t):(r.add(o),V_e(n,t))}}});var i9,o9=y(()=>{Vr();ef();i9=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ro(e,r,"all")]:Array.isArray(e)?[ro(t,r,"all"),...e]:Ft(t)&&Ft(e)?uT([t,e]):`${t}${e}`}});import{once as wO}from"node:events";var s9,ebe,a9,c9,tbe,xO,$O=y(()=>{Xs();s9=async(t,e)=>{let[r,n]=await ebe(t);return e.isForcefullyTerminated??=!1,[r,n]},ebe=async t=>{let[e,r]=await Promise.allSettled([wO(t,"spawn"),wO(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?a9(t):r.value},a9=async t=>{try{return await wO(t,"exit")}catch{return a9(t)}},c9=async t=>{let[e,r]=await t;if(!tbe(e,r)&&xO(e,r))throw new Un;return[e,r]},tbe=(t,e)=>t===void 0&&e===void 0,xO=(t,e)=>t!==0||e!==null});var l9,rbe,u9=y(()=>{Xs();na();$O();l9=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=rbe(t,e,r),s=o?.code==="ETIMEDOUT",a=LZ(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},rbe=(t,e,r)=>t!==void 0?t:xO(e,r)?new Un:void 0});import{spawnSync as nbe}from"node:child_process";var d9,ibe,obe,sbe,k_,abe,cbe,lbe,ube,f9=y(()=>{bT();VT();WT();Qd();f_();jG();ef();XG();n9();na();o9();u9();d9=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=ibe(t,e,r),d=abe({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Fc(d,c,l)},ibe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Ey(t,e,r),a=obe(r),{file:c,commandArguments:l,options:u}=Qy(t,e,a);sbe(u);let d=DG(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},obe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,sbe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&k_("ipcInput"),t&&k_("ipc: true"),r&&k_("detached: true"),n&&k_("cancelSignal")},k_=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},abe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=cbe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=l9(c,r),{output:m,error:h=l}=r9({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ro(_,r,S)),b=ro(i9(m,r),r,"all");return ube({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},cbe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{YG(o,r);let a=lbe(r);return nbe(...e_(t,e,a))}catch(a){return Mc({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},lbe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:u_(e)}),ube=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?d_({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):Xd({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as kO,on as dbe}from"node:events";var p9,fbe,pbe,mbe,hbe,m9=y(()=>{Rc();Vd();Gd();p9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ic({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:Gy(t)}),fbe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),fbe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{zy(e,i);let o=Bo(t,e,r),s=new AbortController;try{return await Promise.race([pbe(o,n,s),mbe(o,r,s),hbe(o,r,s)])}catch(a){throw Pc(t),a}finally{s.abort(),Ly(e,i)}},pbe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await kO(t,"message",{signal:r});return n}for await(let[n]of dbe(t,"message",{signal:r}))if(e(n))return n},mbe=async(t,e,{signal:r})=>{await kO(t,"disconnect",{signal:r}),kH(e)},hbe=async(t,e,{signal:r})=>{let[n]=await kO(t,"strict:error",{signal:r});throw Ny(n,e)}});import{once as g9,on as gbe}from"node:events";var y9,EO,ybe,_be,bbe,h9,AO=y(()=>{Rc();Vd();Gd();y9=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>EO({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),EO=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ic({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:Gy(t)}),zy(e,o);let s=Bo(t,e,r),a=new AbortController,c={};return ybe(t,s,a),_be({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),bbe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},ybe=async(t,e,r)=>{try{await g9(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},_be=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await g9(t,"strict:error",{signal:r.signal});n.error=Ny(i,e),r.abort()}catch{}},bbe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of gbe(r,"message",{signal:o.signal}))h9(s),yield c}catch{h9(s)}finally{o.abort(),Ly(e,a),n||Pc(t),i&&await t}},h9=({error:t})=>{if(t)throw t}});import _9 from"node:process";var b9,v9,S9,TO=y(()=>{Yy();m9();AO();Hy();b9=(t,{ipc:e})=>{Object.assign(t,S9(t,!1,e))},v9=()=>{let t=_9,e=!0,r=_9.channel!==void 0;return{...S9(t,e,r),getCancelSignal:QH.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},S9=(t,e,r)=>({sendMessage:Jy.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:p9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:y9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as vbe}from"node:child_process";import{PassThrough as Sbe,Readable as wbe,Writable as xbe,Duplex as $be}from"node:stream";var w9,kbe,rf,Ebe,Abe,Tbe,Obe,x9=y(()=>{y_();Qd();f_();w9=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{fO(n);let a=new vbe;kbe(a,n),Object.assign(a,{readable:Ebe,writable:Abe,duplex:Tbe});let c=Mc({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=Obe(c,s,i);return{subprocess:a,promise:l}},kbe=(t,e)=>{let r=rf(),n=rf(),i=rf(),o=Array.from({length:e.length-3},rf),s=rf(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},rf=()=>{let t=new Sbe;return t.end(),t},Ebe=()=>new wbe({read(){}}),Abe=()=>new xbe({write(){}}),Tbe=()=>new $be({read(){},write(){}}),Obe=async(t,e,r)=>Fc(t,e,r)});import{createReadStream as $9,createWriteStream as k9}from"node:fs";import{Buffer as Ibe}from"node:buffer";import{Readable as nf,Writable as Pbe,Duplex as Rbe}from"node:stream";var A9,of,E9,Cbe,T9=y(()=>{x_();y_();hr();A9=(t,e)=>g_(Cbe,t,e,!1),of=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ho[t]}.`)},E9={fileNumber:of,generator:vO,asyncGenerator:vO,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Rbe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Cbe={input:{...E9,fileUrl:({value:t})=>({stream:$9(t)}),filePath:({value:{file:t}})=>({stream:$9(t)}),webStream:({value:t})=>({stream:nf.fromWeb(t)}),iterable:({value:t})=>({stream:nf.from(t)}),asyncIterable:({value:t})=>({stream:nf.from(t)}),string:({value:t})=>({stream:nf.from(t)}),uint8Array:({value:t})=>({stream:nf.from(Ibe.from(t))})},output:{...E9,fileUrl:({value:t})=>({stream:k9(t)}),filePath:({value:{file:t,append:e}})=>({stream:k9(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Pbe.fromWeb(t)}),iterable:of,asyncIterable:of,string:of,uint8Array:of}}});import{on as Dbe,once as O9}from"node:events";import{PassThrough as Nbe,getDefaultHighWaterMark as jbe}from"node:stream";import{finished as R9}from"node:stream/promises";function sa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)IO(i);let e=t.some(({readableObjectMode:i})=>i),r=Mbe(t,e),n=new OO({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var Mbe,OO,Fbe,zbe,Lbe,IO,Ube,qbe,Bbe,Hbe,Zbe,C9,D9,PO,N9,Gbe,E_,I9,P9,A_=y(()=>{Mbe=(t,e)=>{if(t.length===0)return jbe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},OO=class extends Nbe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(IO(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Fbe(this,this.#t,this.#o);let r=Ube({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(IO(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Fbe=async(t,e,r)=>{E_(t,I9);let n=new AbortController;try{await Promise.race([zbe(t,n),Lbe(t,e,r,n)])}finally{n.abort(),E_(t,-I9)}},zbe=async(t,{signal:e})=>{try{await R9(t,{signal:e,cleanup:!0})}catch(r){throw C9(t,r),r}},Lbe=async(t,e,r,{signal:n})=>{for await(let[i]of Dbe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},IO=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Ube=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{E_(t,P9);let a=new AbortController;try{await Promise.race([qbe(o,e,a),Bbe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Hbe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),E_(t,-P9)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?PO(t):Zbe(t))},qbe=async(t,e,{signal:r})=>{try{await t,r.aborted||PO(e)}catch(n){r.aborted||C9(e,n)}},Bbe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await R9(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;D9(s)?i.add(e):N9(t,s)}},Hbe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await O9(t,i,{signal:o}),!t.readable)return O9(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},Zbe=t=>{t.writable&&t.end()},C9=(t,e)=>{D9(e)?PO(t):N9(t,e)},D9=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",PO=t=>{(t.readable||t.writable)&&t.destroy()},N9=(t,e)=>{t.destroyed||(t.once("error",Gbe),t.destroy(e))},Gbe=()=>{},E_=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},I9=2,P9=1});import{finished as j9}from"node:stream/promises";var Lc,Vbe,RO,Wbe,CO,T_=y(()=>{Xi();Lc=(t,e)=>{t.pipe(e),Vbe(t,e),Wbe(t,e)},Vbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(t,{cleanup:!0,readable:!0,writable:!1})}catch{}RO(e)}},RO=t=>{t.writable&&t.end()},Wbe=async(t,e)=>{if(!(Ln(t)||Ln(e))){try{await j9(e,{cleanup:!0,readable:!1,writable:!0})}catch{}CO(t)}},CO=t=>{t.readable&&t.destroy()}});var M9,Kbe,Jbe,Ybe,Xbe,Qbe,F9=y(()=>{A_();Xi();Fy();hr();T_();M9=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>gn.has(c)))Kbe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!gn.has(c)))Ybe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:sa(o);Lc(s,i)}},Kbe=(t,e,r,n)=>{r==="output"?Lc(t.stdio[n],e):Lc(e,t.stdio[n]);let i=Jbe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},Jbe=["stdin","stdout","stderr"],Ybe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Xbe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},Xbe=(t,{signal:e})=>{Ln(t)&&Qs(t,Qbe,e)},Qbe=2});var aa,z9=y(()=>{aa=[];aa.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&aa.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&aa.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var O_,DO,NO,eve,jO,I_,tve,MO,FO,zO,L9,n7e,i7e,U9=y(()=>{z9();O_=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",DO=Symbol.for("signal-exit emitter"),NO=globalThis,eve=Object.defineProperty.bind(Object),jO=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(NO[DO])return NO[DO];eve(NO,DO,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},I_=class{},tve=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),MO=class extends I_{onExit(){return()=>{}}load(){}unload(){}},FO=class extends I_{#t=zO.platform==="win32"?"SIGINT":"SIGHUP";#r=new jO;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of aa)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!O_(this.#e))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of aa)try{let r=this.#i[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,aa.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#o,this.#r.count-=1)}#a(e){return O_(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#o.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&O_(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let i=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),i}else return n.call(this.#e,e,...r)}},zO=globalThis.process,{onExit:L9,load:n7e,unload:i7e}=tve(O_(zO)?new FO(zO):new MO)});import{addAbortListener as rve}from"node:events";var q9,B9=y(()=>{U9();q9=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=L9(()=>{t.kill()});rve(n,()=>{i()})}});var Z9,nve,ive,H9,ove,G9=y(()=>{lT();ky();qo();$c();Z9=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=$y(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=nve(r,n,i),{sourceStream:d,sourceError:f}=ove(t,l),{options:p,fileDescriptors:m}=gi.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:m,startTime:o}},nve=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ive(t,e,...r),a=My(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ive=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(H9,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aT(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=py(r,...n);return{destination:e(H9)(i,o,s),pipeOptions:s}}if(gi.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},H9=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ove=(t,e)=>{try{return{sourceStream:Dc(t,e)}}catch(r){return{sourceError:r}}}});var W9,sve,LO,V9,UO=y(()=>{Qd();T_();W9=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=sve({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw LO({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},sve=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return CO(t),n;if(e!==void 0)return RO(r),e},LO=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Mc({error:t,command:V9,escapedCommand:V9,fileDescriptors:e,options:r,startTime:n,isSync:!1}),V9="source.pipe(destination)"});var K9,J9=y(()=>{K9=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s}});import{finished as ave}from"node:stream/promises";var Y9,cve,lve,uve,P_,dve,fve,X9=y(()=>{A_();Fy();T_();Y9=(t,e,r)=>{let n=P_.has(e)?lve(t,e):cve(t,e);return Qs(t,dve,r.signal),Qs(e,fve,r.signal),uve(e),n},cve=(t,e)=>{let r=sa([t]);return Lc(r,e),P_.set(e,r),r},lve=(t,e)=>{let r=P_.get(e);return r.add(t),r},uve=async t=>{try{await ave(t,{cleanup:!0,readable:!1,writable:!0})}catch{}P_.delete(t)},P_=new WeakMap,dve=2,fve=1});import{aborted as pve}from"node:util";var Q9,mve,eV=y(()=>{UO();Q9=(t,e)=>t===void 0?[]:[mve(t,e)],mve=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await pve(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw LO({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var R_,hve,gve,tV=y(()=>{Ji();G9();UO();J9();X9();eV();R_=(t,...e)=>{if(Et(e[0]))return R_.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Z9(t,...e),i=hve({...n,destination:r});return i.pipe=R_.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},hve=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=gve(t,i);W9({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Y9(e,o,d);return await Promise.race([K9(u),...Q9(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},gve=(t,e)=>Promise.allSettled([t,e])});import{on as yve}from"node:events";import{getDefaultHighWaterMark as _ve}from"node:stream";var C_,bve,qO,vve,nV,BO,rV,Sve,wve,D_=y(()=>{gO();b_();bO();C_=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return bve(e,s),nV({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},bve=async(t,e)=>{try{await t}catch{}finally{e.abort()}},qO=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;vve(e,s,t);let a=t.readableObjectMode&&!o;return nV({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},vve=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},nV=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=yve(t,"data",{signal:e.signal,highWaterMark:rV,highWatermark:rV});return Sve({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},BO=_ve(!0),rV=BO,Sve=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=wve({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*oa(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*tf(a)}},wve=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[v_(t,r,!e),__(t,i,!n,{})].filter(Boolean)});import{setImmediate as xve}from"node:timers/promises";var iV,$ve,kve,Eve,HO,oV,ZO=y(()=>{l_();Vr();SO();D_();na();ef();iV=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=$ve({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([kve(t),d]);return}let f=pO(c,r),p=qO({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Eve({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},$ve=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!$_({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=qO({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await QG(a,t,r,o)},kve=async t=>{await xve(),t.readableFlowing===null&&t.resume()},Eve=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await o_(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await s_(r,{maxBuffer:o})):await c_(r,{maxBuffer:o})}catch(a){return oV(MZ({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},HO=async t=>{try{return await t}catch(e){return oV(e)}},oV=({bufferedData:t})=>O6(t)?new Uint8Array(t):t});import{finished as Ave}from"node:stream/promises";var sf,Tve,Ove,Ive,Pve,Rve,GO,N_,sV,j_=y(()=>{sf=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Tve(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Ave(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Pve(a,e,r,n)}finally{s.abort()}},Tve=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ove(t,r,n),n},Ove=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Ive(e,r),n.call(t,...i)}},Ive=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Pve=(t,e,r,n)=>{if(!Rve(t,e,r,n))throw t},Rve=(t,e,r,n=!0)=>r.propagating?sV(t)||N_(t):(r.propagating=!0,GO(r,e)===n?sV(t):N_(t)),GO=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",N_=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",sV=t=>t?.code==="EPIPE"});var aV,VO,WO=y(()=>{ZO();j_();aV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>VO({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),VO=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=sf(t,e,l);if(GO(l,e)){await u;return}let[d]=await Promise.all([iV({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var cV,lV,Cve,Dve,KO=y(()=>{A_();WO();cV=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?sa([t,e].filter(Boolean)):void 0,lV=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>VO({...Cve(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Dve(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Cve=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},Dve=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var uV,dV,fV=y(()=>{Ac();Lo();uV=t=>Ec(t,"ipc"),dV=(t,e)=>{let r=xy(t);mi({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var pV,mV,hV=y(()=>{na();fV();eo();AO();pV=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=uV(o),a=Qi(e,"ipc"),c=Qi(r,"ipc");for await(let l of EO({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(FZ(t,i,c),i.push(l)),s&&dV(l,o);return i},mV=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Nve}from"node:events";var gV,jve,Mve,Fve,yV=y(()=>{ra();qT();CT();UT();Xi();hr();ZO();hV();HT();KO();WO();$O();j_();gV=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:m,originalStreams:h,onInternalError:g,controller:b})=>{let _=s9(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=aV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=lV({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=pV({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),E=jve(h,t,S),C=Mve(m,S);try{return await Promise.race([Promise.all([{},c9(_),Promise.all(x),w,A,lZ(t,d),...E,...C]),g,Fve(t,b),...iZ(t,o,f,b),...$H({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...rZ({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(k){return f.terminationReason??="other",Promise.all([{error:k},_,Promise.all(x.map(L=>HO(L))),HO(w),mV(A,R),Promise.allSettled(E),Promise.allSettled(C)])}},jve=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:sf(n,i,r)),Mve=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Bn(o,{checkOpen:!1})&&!Ln(o)).map(({type:i,value:o,stream:s=o})=>sf(s,n,e,{isSameDirection:gn.has(i),stopOnExit:i==="native"}))),Fve=async(t,{signal:e})=>{let[r]=await Nve(t,"error",{signal:e});throw r}});var _V,af,Uc,M_=y(()=>{Cc();_V=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),af=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=hi();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Uc=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n}});import{finished as bV}from"node:stream/promises";var JO,vV,YO,XO,F_,z_,QO=y(()=>{j_();JO=async t=>{if(t!==void 0)try{await YO(t)}catch{}},vV=async t=>{if(t!==void 0)try{await XO(t)}catch{}},YO=async t=>{await bV(t,{cleanup:!0,readable:!1,writable:!0})},XO=async t=>{await bV(t,{cleanup:!0,readable:!0,writable:!1})},F_=async(t,e)=>{if(await t,e)throw e},z_=(t,e,r)=>{r&&!N_(r)?t.destroy(r):e&&t.destroy()}});import{Readable as zve}from"node:stream";import{callbackify as Lve}from"node:util";var SV,eI,tI,rI,Uve,nI,iI,wV,oI=y(()=>{ea();qo();D_();Cc();M_();QO();SV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Wr.has(r),{subprocessStdout:a,waitReadableDestroy:c}=eI(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=tI(a,s),{read:f,onStdoutDataDone:p}=rI({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new zve({read:f,destroy:Lve(iI.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return nI({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},eI=(t,e,r)=>{let n=Dc(t,e),i=af(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},tI=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:BO},rI=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=hi(),s=C_({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Uve(this,s,o)},onStdoutDataDone:o}},Uve=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},nI=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await XO(t),await n,await JO(i),await e,r.readable&&r.push(null)}catch(o){await JO(i),wV(r,o)}},iI=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Uc(r,e)&&(wV(t,n),await F_(e,n))},wV=(t,e)=>{z_(t,t.readable,e)}});import{Writable as qve}from"node:stream";import{callbackify as xV}from"node:util";var $V,sI,aI,Bve,Hve,cI,lI,kV,uI=y(()=>{qo();M_();QO();$V=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=sI(t,r,e),s=new qve({...aI(n,t,i),destroy:xV(lI.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return cI(n,s),s},sI=(t,e,r)=>{let n=My(t,e),i=af(r,n,"writableFinal"),o=af(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},aI=(t,e,r)=>({write:Bve.bind(void 0,t),final:xV(Hve.bind(void 0,t,e,r))}),Bve=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Hve=async(t,e,r)=>{await Uc(r,e)&&(t.writable&&t.end(),await e)},cI=async(t,e,r)=>{try{await YO(t),e.writable&&e.end()}catch(n){await vV(r),kV(e,n)}},lI=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Uc(r,e),await Uc(n,e)&&(kV(t,i),await F_(e,i))},kV=(t,e)=>{z_(t,t.writable,e)}});import{Duplex as Zve}from"node:stream";import{callbackify as Gve}from"node:util";var EV,Vve,AV=y(()=>{ea();oI();uI();EV=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Wr.has(r),{subprocessStdout:c,waitReadableDestroy:l}=eI(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=sI(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=tI(c,a),{read:g,onStdoutDataDone:b}=rI({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Zve({read:g,...aI(u,t,d),destroy:Gve(Vve.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:h,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:m,writableObjectMode:u.writableObjectMode,encoding:p});return nI({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),cI(u,_,c),_},Vve=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([iI({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),lI({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var dI,Wve,TV=y(()=>{ea();qo();D_();dI=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Wr.has(e),s=Dc(t,r),a=C_({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Wve(a,s,t)},Wve=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var OV,IV=y(()=>{M_();oI();uI();AV();TV();OV=(t,{encoding:e})=>{let r=_V();t.readable=SV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=$V.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=EV.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=dI.bind(void 0,t,e),t[Symbol.asyncIterator]=dI.bind(void 0,t,e,{})}});var PV,Kve,Jve,RV=y(()=>{PV=(t,e)=>{for(let[r,n]of Jve){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Kve=(async()=>{})().constructor.prototype,Jve=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Kve,t)])});import{setMaxListeners as Yve}from"node:events";import{spawn as Xve}from"node:child_process";var CV,Qve,eSe,tSe,rSe,nSe,DV=y(()=>{l_();bT();VT();qo();WT();TO();Qd();f_();x9();T9();ef();F9();Cy();B9();tV();KO();yV();IV();Cc();RV();CV=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=Qve(t,e,r),{subprocess:f,promise:p}=tSe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=R_.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),PV(f,p),gi.set(f,{options:u,fileDescriptors:d}),f},Qve=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=Ey(t,e,r),{file:a,commandArguments:c,options:l}=Qy(t,e,r),u=eSe(l),d=A9(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},eSe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},tSe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=Xve(...e_(t,e,r))}catch(m){return w9({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Yve(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];M9(c,a,l),q9(c,r,l);let d={},f=hi();c.kill=wH.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=cV(c,r),OV(c,r),b9(c,r);let p=rSe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},rSe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],m,h,g]=await gV({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let b=m.map((x,w)=>ro(x,e,w)),_=ro(h,e,"all"),S=nSe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Fc(S,n,e)},nSe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Xd({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yi,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):d_({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var L_,iSe,oSe,NV=y(()=>{Ji();eo();L_=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,iSe(n,t[n],i)]));return{...t,...r}},iSe=(t,e,r)=>oSe.has(t)&&Et(e)&&Et(r)?{...e,...r}:r,oSe=new Set(["env",...mT])});var Zo,sSe,aSe,jV=y(()=>{Ji();lT();M6();f9();DV();NV();Zo=(t,e,r,n)=>{let i=(s,a,c)=>Zo(s,a,r,c),o=(...s)=>sSe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},sSe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Et(o))return i(t,L_(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=aSe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?d9(a,c,l):CV(a,c,l,i)},aSe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=N6(e)?j6(e,r):[e,...r],[s,a,c]=py(...o),l=L_(L_(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}}});var MV,FV,zV,cSe,lSe,LV=y(()=>{MV=({file:t,commandArguments:e})=>zV(t,e),FV=({file:t,commandArguments:e})=>({...zV(t,e),isSync:!0}),zV=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=cSe(t);return{file:r,commandArguments:n}},cSe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(lSe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},lSe=/ +/g});var UV,qV,uSe,BV,dSe,HV,ZV=y(()=>{UV=(t,e,r)=>{t.sync=e(uSe,r),t.s=t.sync},qV=({options:t})=>BV(t),uSe=({options:t})=>({...BV(t),isSync:!0}),BV=t=>({options:{...dSe(t),...t}}),dSe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},HV={preferLocal:!0}});var Ket,et,Jet,Yet,Xet,Qet,ett,ttt,rtt,ntt,Ir=y(()=>{jV();LV();BT();ZV();TO();Ket=Zo(()=>({})),et=Zo(()=>({isSync:!0})),Jet=Zo(MV),Yet=Zo(FV),Xet=Zo(sZ),Qet=Zo(qV,{},HV,UV),{sendMessage:ett,getOneMessage:ttt,getEachMessage:rtt,getCancelSignal:ntt}=v9()});import{existsSync as U_,statSync as fSe}from"node:fs";import{dirname as fI,extname as pSe,isAbsolute as GV,join as pI,relative as mI,resolve as q_,sep as mSe}from"node:path";function B_(t){return t==="./gradlew"||t==="gradle"}function hSe(t){return(U_(pI(t,"build.gradle.kts"))||U_(pI(t,"build.gradle")))&&U_(pI(t,"gradle.properties"))}function gSe(t,e){let n=mI(t,e).split(mSe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function Go(t,e){return t===":"?`:${e}`:`${t}:${e}`}function ySe(t,e){let r=q_(t,e),n=r;U_(r)?fSe(r).isFile()&&(n=fI(r)):pSe(r)!==""&&(n=fI(r));let i=mI(t,n);if(i.startsWith("..")||GV(i))return null;let o=n;for(;;){if(hSe(o))return o;if(q_(o)===q_(t))return null;let s=fI(o);if(s===o)return null;let a=mI(t,s);if(a.startsWith("..")||GV(a))return null;o=s}}function H_(t,e){let r=q_(t),n=new Map,i=[];for(let o of e){let s=ySe(r,o);if(!s){i.push(o);continue}let a=gSe(r,s);n.has(a)||n.set(a,{path:a,dir:s})}if(i.length>0)throw new Error(`cannot map module(s) to a Gradle project (no build.gradle[.kts] + gradle.properties ancestor under ${r}): ${i.join(", ")}`);return[...n.values()].sort((o,s)=>o.paths.path?1:0)}var Z_=y(()=>{"use strict"});import{existsSync as _Se,readFileSync as bSe}from"node:fs";import{join as vSe}from"node:path";function qc(t="."){let e=vSe(t,".cladding","config.yaml");if(!_Se(e))return hI;try{let n=(0,VV.parse)(bSe(e,"utf8"))?.gate;if(!n)return hI;let i=n.scope==="repo"?"repo":"feature",o=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,s=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of SSe){let u=n.commands[l];Array.isArray(u)&&u.every(d=>typeof d=="string")&&(a[l]=u)}let c={scope:i};return Object.keys(a).length>0&&(c.commands=a),o&&(c.coverage=o),s&&(c.testReport=s),c}catch{return hI}}function WV(t,e){let r=[],n=!1;for(let i of t){let o=wSe.exec(i);if(o){n=!0;for(let s of e)r.push(Go(s.path,o[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var VV,SSe,hI,wSe,G_=y(()=>{"use strict";VV=kt(or(),1);Z_();SSe=["type","lint","test","coverage"],hI={scope:"feature"};wSe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as yI,readFileSync as KV,readdirSync as xSe,statSync as $Se}from"node:fs";import{join as V_}from"node:path";function vI(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=V_(t,e);if(yI(r))try{if(JV.test(KV(r,"utf8")))return!0}catch{}}return!1}function YV(t){try{return yI(t)&&JV.test(KV(t,"utf8"))}catch{return!1}}function XV(t,e=0){if(e>4||!yI(t))return!1;let r;try{r=xSe(t)}catch{return!1}for(let n of r){let i=V_(t,n),o=!1;try{o=$Se(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(XV(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&YV(i))return!0}return!1}function ASe(t){if(vI(t))return!0;for(let e of kSe)if(YV(V_(t,e)))return!0;for(let e of ESe)if(XV(V_(t,e)))return!0;return!1}function QV(t="."){let e=qc(t).coverage;return e||(ASe(t)?"kover":"jacoco")}function eW(t="."){return _I[QV(t)]}function tW(t="."){return gI[QV(t)]}var _I,gI,bI,JV,kSe,ESe,W_=y(()=>{"use strict";G_();_I={kover:"koverXmlReport",jacoco:"jacocoTestReport"},gI={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},bI=[gI.kover,gI.jacoco],JV=/kover/i;kSe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],ESe=["buildSrc","build-logic"]});import{existsSync as SI,readdirSync as rW}from"node:fs";import{join as K_}from"node:path";function wI(t){return SI(K_(t,"gradlew"))?"./gradlew":"gradle"}function TSe(t){let e=wI(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[eW(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function ISe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function CSe(t,e){for(let r of e)if(SI(K_(t,r)))return r}function DSe(t,e){try{return rW(t).find(n=>n.endsWith(e))}catch{return}}function jSe(t,e){for(let r of NSe)if(r.configs.some(n=>SI(K_(t,n))))return r.gate;return e}function pt(t="."){for(let e of PSe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=DSe(t,o):r=CSe(t,[o]),r)break;if(!r||e.requiresSource&&!ISe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"&&n.lint?{...n,lint:jSe(t,n.lint)}:n;return{language:e.language,manifest:r,gates:i}}return RSe}var OSe,PSe,RSe,NSe,yn=y(()=>{"use strict";W_();OSe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);PSe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:["--no-install","tsc","--noEmit","--incremental","--tsBuildInfoFile",".cladding/cache/tsc.tsbuildinfo"]},lint:{cmd:"npx",args:["--no-install","eslint",".","--cache","--cache-location",".cladding/cache/eslint"]},test:{cmd:"npx",args:["--no-install","vitest","run"]},coverage:{cmd:"npx",args:["--no-install","vitest","run","--coverage"]},secret:{cmd:"npx",args:["--no-install","secretlint","**/*"]},arch:{cmd:"npx",args:["--no-install","madge","--circular","--extensions","ts","."]},smoke:{cmd:"npm",args:["run","--silent","smoke"]},perf:{cmd:"npm",args:["run","--silent","perf"]},visual:{cmd:"npm",args:["run","--silent","visual"]}}},{language:"python",manifests:["pyproject.toml","setup.py","requirements.txt"],gates:{type:{cmd:"mypy",args:["."]},lint:{cmd:"ruff",args:["check","."]},test:{cmd:"pytest",args:[]},coverage:{cmd:"coverage",args:["run","-m","pytest"]},secret:{cmd:"detect-secrets",args:["scan"]},arch:{cmd:"lint-imports",args:[]}}},{language:"rust",manifests:["Cargo.toml"],gates:{type:{cmd:"cargo",args:["check"]},lint:{cmd:"cargo",args:["clippy","--","-D","warnings"]},test:{cmd:"cargo",args:["test"]},coverage:{cmd:"cargo",args:["llvm-cov"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"go",manifests:["go.mod"],gates:{type:{cmd:"go",args:["vet","./..."]},lint:{cmd:"golangci-lint",args:["run"]},test:{cmd:"go",args:["test","./..."]},coverage:{cmd:"go",args:["test","-cover","./..."]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"kotlin",manifests:["build.gradle.kts","build.gradle","pom.xml"],requiresSource:[".kt",".kts"],gates:TSe},{language:"java",manifests:["pom.xml","build.gradle","build.gradle.kts"],gates:{type:{cmd:"mvn",args:["compile","-q"]},lint:{cmd:"mvn",args:["checkstyle:check","-q"]},test:{cmd:"mvn",args:["test","-q"]},coverage:{cmd:"mvn",args:["jacoco:report","-q"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"php",manifests:["composer.json"],gates:{type:{cmd:"phpstan",args:["analyse"]},lint:{cmd:"phpcs",args:[]},test:{cmd:"phpunit",args:[]},coverage:{cmd:"phpunit",args:["--coverage-text"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"ruby",manifests:["Gemfile"],gates:{type:{cmd:"srb",args:["tc"]},lint:{cmd:"rubocop",args:[]},test:{cmd:"bundle",args:["exec","rspec"]},coverage:{cmd:"bundle",args:["exec","rspec","--format","documentation"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"elixir",manifests:["mix.exs"],gates:{type:{cmd:"mix",args:["dialyzer"]},lint:{cmd:"mix",args:["credo"]},test:{cmd:"mix",args:["test"]},coverage:{cmd:"mix",args:["coveralls"]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}},{language:"dotnet",manifests:[".csproj",".sln",".fsproj"],gates:{type:{cmd:"dotnet",args:["build","--nologo","-v","q"]},lint:{cmd:"dotnet",args:["format","--verify-no-changes"]},test:{cmd:"dotnet",args:["test","--nologo"]},coverage:{cmd:"dotnet",args:["test",'--collect:"XPlat Code Coverage"']},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}],RSe={language:"unknown",manifest:"",gates:{}};NSe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:["--no-install","biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:["--no-install","oxlint"]}}]});import{existsSync as MSe,readFileSync as FSe}from"node:fs";import{join as zSe}from"node:path";function cf(t){return t.code==="ENOENT"}function J_(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let o=(t.stderr??"").toString().trim(),s=(t.stdout??"").toString().trim(),a=(o||s||`exit ${i}`).slice(0,200);return nW.test(o)||nW.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function zt(t,e,r){return cf(r)?{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`}:null}function sr(t,e){if((e.exitCode??1)===0)return{stage:t,pass:!0,exitCode:0};let n=String(e.stderr??"").trim()||String(e.stdout??"").trim();return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Bc(t,e){let r=zSe(t,"package.json");if(!MSe(r))return!1;try{return!!JSON.parse(FSe(r,"utf8")).scripts?.[e]}catch{return!1}}var nW,_n=y(()=>{"use strict";nW=/config (is |file )?not found|no such file|ENOENT|cannot find (a |the )?(config|module|package|preset)|require[sd]?\b.{0,40}\bconfig|canceled due to missing packages|could not determine executable/i});function LSe(t){let{cwd:e="."}=t,r=pt(e),n=r.gates.arch;if(!n)return[{detector:Y_,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=et(n.cmd,[...n.args],{cwd:e,reject:!1});return cf(i)?[{detector:Y_,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:J_(i,Y_,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Y_,X_,xI=y(()=>{"use strict";Ir();yn();_n();Y_="ARCHITECTURE_VIOLATION";X_={name:Y_,run:LSe}});import iW from"node:process";function ca(t={}){let r=X_.run(t).filter(o=>o.severity==="error"),n=r.length===0,i={stage:USe,pass:n,exitCode:n?0:1};return n?i:{...i,stderr:r.map(o=>o.message).join(` `)}}var USe,qSe,Q_=y(()=>{"use strict";xI();USe="stage_1.5";qSe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${iW.argv[1]}`;if(qSe){let t=ca();console.log(JSON.stringify(t)),iW.exit(t.exitCode)}});import{existsSync as $I,readdirSync as oW}from"node:fs";import{join as eb}from"node:path";function HSe(t,e){let r=eb(t,e.path);if(!$I(r))return!0;if(e.isDirectory)try{return oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function ZSe(t){let{cwd:e="."}=t,r=[];for(let i of BSe)HSe(e,i)&&r.push({detector:lf,severity:i.severity,path:i.path,message:`${i.path} is absent \u2014 cladding scaffold incomplete (${i.purpose}). Run \`clad init --intent ""\` to populate it.`});let n=eb(e,"spec.yaml");if($I(n)){let i=WSe(n),o=i?null:GSe(e);if(i)r.push({detector:lf,severity:"error",path:"spec.yaml",message:`spec.yaml is present but unreadable (${i}) \u2014 cladding is governing nothing. Fix the SSoT root, then \`clad sync\` to validate.`});else if(o)r.push({detector:lf,severity:"error",path:o.path,message:`spec shard '${o.path}' is present but unparseable (${o.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let s=VSe(e);s&&r.push({detector:lf,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${s}) \u2014 every spec-gated detector then degrades to non-blocking info, so the gate would pass GREEN on an unloadable SSoT. Fix it, then \`clad sync\` to validate.`})}}return r}function GSe(t){for(let e of["spec/features","spec/scenarios"]){let r=eb(t,e);if(!$I(r))continue;let n;try{n=oW(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{di(eb(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function VSe(t){try{return Y(t),null}catch(e){return e.message}}function WSe(t){let e;try{e=di(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var lf,BSe,sW,aW=y(()=>{"use strict";at();cy();lf="ABSENCE_OF_GOVERNANCE",BSe=[{path:"spec.yaml",severity:"error",purpose:"SSoT root \u2014 every spec-gated detector needs it"},{path:"spec/architecture.yaml",severity:"warn",purpose:"architecture invariants (layers + forbidden_imports)"},{path:"spec/capabilities.yaml",severity:"warn",purpose:"capability \u2194 feature traceability"},{path:"docs/project-context.md",severity:"warn",purpose:"intent narrative + decision history"},{path:"docs/conventions.md",severity:"info",purpose:"project style guide (recommended)"},{path:"spec/scenarios",severity:"info",purpose:"user-journey scenarios (recommended)",isDirectory:!0}];sW={name:lf,run:ZSe}});function tb(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function kI(t,e){let r=e?.trim()??"";if(!t)return r.length>0?"condition is present but ears pattern is not declared":null;if(t==="ubiquitous")return r.length>0?`ears='ubiquitous' but condition is present ('${r.slice(0,40)}\u2026')`:null;if(t==="complex"){if(r.length===0)return"ears='complex' requires a 'while' precondition and a 'when' trigger \u2014 empty";let i=tb(r)==="while",o=JSe.test(r);return i?o?null:"ears='complex' requires a 'when' trigger clause after the 'while' precondition \u2014 none found":`ears='complex' requires the condition to start with 'while' (precondition) \u2014 got '${tb(r)}'`}let n=KSe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:tb(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${tb(r)}'`:null}function YSe(t,e){let r=kI(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function cW(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...YSe(r,n));return e}var KSe,JSe,EI=y(()=>{"use strict";KSe={event:"when",state:"while",optional:"where",unwanted:"if"},JSe=/\bwhen\b/i});function pe(t,e,r){let n;try{n=Y(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var _t=y(()=>{"use strict";at()});function XSe(t){let{cwd:e="."}=t;return pe(e,rb,QSe)}function QSe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),o=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!o&&e.push({detector:rb,severity:"error",message:`${r.id}.${n.id} has neither rendered text nor any EARS field (condition/action/response) \u2014 structurally empty AC`})}for(let r of cW(t.features))e.push({detector:rb,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var rb,lW,uW=y(()=>{"use strict";EI();_t();rb="AC_DRIFT";lW={name:rb,run:XSe}});function bi(t=".",e){let n=(e??"").trim().toLowerCase()||pt(t).language;return nwe[n]??dW}var ewe,twe,dW,rwe,nwe,Hc=y(()=>{"use strict";yn();ewe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,twe=/^[ \t]*import\s+([\w.]+)/gm,dW={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:ewe,importStyle:"relative"},rwe={ext:"kt",extensions:[".kt",".kts"],sourceRoots:["src/main/kotlin","src/test/kotlin"],mainRoot:"src/main/kotlin",testGlobs:["src/test/kotlin/**/*Test.kt","src/test/kotlin/**/*Tests.kt"],coverageSummary:"build/reports/jacoco/test/jacocoTestReport.xml",coverageFormat:"jacoco-xml",importMatcher:twe,importStyle:"dotted"},nwe={typescript:dW,kotlin:rwe}});import{existsSync as iwe,readFileSync as owe,readdirSync as swe,statSync as awe}from"node:fs";import{join as pW,relative as fW}from"node:path";function cwe(t,e){if(!iwe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=swe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=pW(i,s),c;try{c=awe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function lwe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function dwe(t){return uwe.test(t)}function fwe(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=bi(e,r.project?.language),o=i.sourceRoots.flatMap(a=>cwe(pW(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=owe(a,"utf8")}catch{continue}let l=c.split(` `);for(let u=0;u{"use strict";at();Hc();mW="AI_HINTS_FORBIDDEN_PATTERN";uwe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;hW={name:mW,run:fwe}});function pwe(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}let n=[];for(let i of r.features){let o=(i.acceptance_criteria??[]).map(a=>a.id),s=new Map;for(let a of o)s.set(a,(s.get(a)??0)+1);for(let[a,c]of s)c>1&&n.push({detector:yW,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var yW,_W,bW=y(()=>{"use strict";at();yW="AC_DUPLICATE_WITHIN_FEATURE";_W={name:yW,run:pwe}});import{createRequire as mwe}from"module";import{basename as hwe,dirname as TI,normalize as gwe,relative as ywe,resolve as _we,sep as wW}from"path";import*as bwe from"fs";function vwe(t){let e=gwe(t);return e.length>1&&e[e.length-1]===wW&&(e=e.substring(0,e.length-1)),e}function xW(t,e){return t.replace(Swe,e)}function xwe(t){return t==="/"||wwe.test(t)}function AI(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=_we(t)),(n||o)&&(t=vwe(t)),t===".")return"";let s=t[t.length-1]!==i;return xW(s?t+i:t,i)}function $W(t,e){return e+t}function $we(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:xW(ywe(t,n),e.pathSeparator)+e.pathSeparator+r}}function kwe(t){return t}function Ewe(t,e,r){return e+t+r}function Awe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?$we(t,e):n?$W:kwe}function Twe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function Owe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function Cwe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?Owe(t):Twe(t):n&&n.length?Pwe:Iwe:Rwe}function zwe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?Fwe:r&&r.length?n?Dwe:Nwe:n?jwe:Mwe}function qwe(t){return t.group?Uwe:Lwe}function Zwe(t){return t.group?Bwe:Hwe}function Wwe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Vwe:Gwe}function kW(t,e,r){if(r.options.useRealPaths)return Kwe(e,r);let n=TI(t),i=1;for(;n!==r.root&&i<2;){let o=r.symlinks.get(n);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?i++:n=TI(n)}return r.symlinks.set(t,e),i>1}function Kwe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function nb(t,e,r,n){e(t&&!n?t:null,r)}function ixe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?Jwe:exe:n?e?Ywe:nxe:i?e?Qwe:rxe:e?Xwe:txe}function axe(t){return t?sxe:oxe}function dxe(t,e){return new Promise((r,n)=>{TW(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function TW(t,e,r){new AW(t,e,r).start()}function fxe(t,e){return new AW(t,e).start()}var vW,Swe,wwe,Iwe,Pwe,Rwe,Dwe,Nwe,jwe,Mwe,Fwe,Lwe,Uwe,Bwe,Hwe,Gwe,Vwe,Jwe,Ywe,Xwe,Qwe,exe,txe,rxe,nxe,EW,oxe,sxe,cxe,lxe,uxe,AW,SW,OW,IW,PW=y(()=>{vW=mwe(import.meta.url);Swe=/[\\/]/g;wwe=/^[a-z]:[\\/]$/i;Iwe=(t,e)=>{e.push(t||".")},Pwe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},Rwe=()=>{};Dwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},Nwe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},jwe=(t,e,r,n)=>{r.files++},Mwe=(t,e)=>{e.push(t)},Fwe=()=>{};Lwe=t=>t,Uwe=()=>[""].slice(0,0);Bwe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Hwe=()=>{};Gwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue(),i.realpath(t,(s,a)=>{if(s)return n.dequeue(o?null:s,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(o?null:c,e);if(l.isDirectory()&&kW(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},Vwe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:o}}=e;n.enqueue();try{let s=i.realpathSync(t),a=i.statSync(s);if(a.isDirectory()&&kW(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};Jwe=t=>t.counts,Ywe=t=>t.groups,Xwe=t=>t.paths,Qwe=t=>t.paths.slice(0,t.options.maxFiles),exe=(t,e,r)=>(nb(e,r,t.counts,t.options.suppressErrors),null),txe=(t,e,r)=>(nb(e,r,t.paths,t.options.suppressErrors),null),rxe=(t,e,r)=>(nb(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),nxe=(t,e,r)=>(nb(e,r,t.groups,t.options.suppressErrors),null);EW={withFileTypes:!0},oxe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",EW,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},sxe=(t,e,r,n,i)=>{let{fs:o}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let s=[];try{s=o.readdirSync(e||".",EW)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};cxe=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},lxe=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},uxe=class{aborted=!1;abort(){this.aborted=!0}},AW=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=ixe(e,this.isSynchronous),this.root=AI(t,e),this.state={root:xwe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new lxe,options:e,queue:new cxe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new uxe,fs:e.fs||bwe},this.joinPath=Awe(this.root,e),this.pushDirectory=Cwe(this.root,e),this.pushFile=zwe(e),this.getArray=qwe(e),this.groupFiles=Zwe(e),this.resolveSymlink=Wwe(e,this.isSynchronous),this.walkDirectory=axe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,r)=>{let{paths:n,options:{filters:i,resolveSymlinks:o,excludeSymlinks:s,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:f}=this.state;if(f.aborted||l&&l.aborted||c&&n.length>c)return;let p=this.getArray(this.state.paths);for(let m=0;m{if(b.isDirectory()){if(_=AI(_,this.state.options),a&&a(h.name,u?_:g+d))return;this.walkDirectory(this.state,_,u?_:g+d,r-1,this.walk)}else{_=u?_:g;let S=hwe(_),x=AI(TI(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};SW=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return dxe(this.root,this.options)}withCallback(t){TW(this.root,this.options,t)}sync(){return fxe(this.root,this.options)}},OW=null;try{vW.resolve("picomatch"),OW=vW("picomatch")}catch{}IW=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:wW,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new SW(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new SW(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||OW;if(!r)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=r(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(i=>n(i)),this}}});var uf=v((ort,jW)=>{"use strict";var RW="[^\\\\/]",pxe="(?=.)",CW="[^/]",OI="(?:\\/|$)",DW="(?:^|\\/)",II=`\\.{1,2}${OI}`,mxe="(?!\\.)",hxe=`(?!${DW}${II})`,gxe=`(?!\\.{0,1}${OI})`,yxe=`(?!${II})`,_xe="[^.\\/]",bxe=`${CW}*?`,vxe="/",NW={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:pxe,QMARK:CW,END_ANCHOR:OI,DOTS_SLASH:II,NO_DOT:mxe,NO_DOTS:hxe,NO_DOT_SLASH:gxe,NO_DOTS_SLASH:yxe,QMARK_NO_DOT:_xe,STAR:bxe,START_ANCHOR:DW,SEP:vxe},Sxe={...NW,SLASH_LITERAL:"[\\\\/]",QMARK:RW,STAR:`${RW}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},wxe={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};jW.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:wxe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Sxe:NW}}});var df=v(Pr=>{"use strict";var{REGEX_BACKSLASH:xxe,REGEX_REMOVE_BACKSLASH:$xe,REGEX_SPECIAL_CHARS:kxe,REGEX_SPECIAL_CHARS_GLOBAL:Exe}=uf();Pr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pr.hasRegexChars=t=>kxe.test(t);Pr.isRegexChar=t=>t.length===1&&Pr.hasRegexChars(t);Pr.escapeRegex=t=>t.replace(Exe,"\\$1");Pr.toPosixSlashes=t=>t.replace(xxe,"/");Pr.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};Pr.removeBackslashes=t=>t.replace($xe,e=>e==="\\"?"":e);Pr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Pr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Pr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Pr.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var HW=v((art,BW)=>{"use strict";var MW=df(),{CHAR_ASTERISK:PI,CHAR_AT:Axe,CHAR_BACKWARD_SLASH:ff,CHAR_COMMA:Txe,CHAR_DOT:RI,CHAR_EXCLAMATION_MARK:CI,CHAR_FORWARD_SLASH:qW,CHAR_LEFT_CURLY_BRACE:DI,CHAR_LEFT_PARENTHESES:NI,CHAR_LEFT_SQUARE_BRACKET:Oxe,CHAR_PLUS:Ixe,CHAR_QUESTION_MARK:FW,CHAR_RIGHT_CURLY_BRACE:Pxe,CHAR_RIGHT_PARENTHESES:zW,CHAR_RIGHT_SQUARE_BRACKET:Rxe}=uf(),LW=t=>t===qW||t===ff,UW=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Cxe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,E,C={value:"",depth:0,isGlob:!1},k=()=>l>=n,L=()=>c.charCodeAt(l+1),te=()=>(A=E,c.charCodeAt(++l));for(;l0&&(O=c.slice(0,u),c=c.slice(u),d-=u),be&&m===!0&&d>0?(be=c.slice(0,d),P=c.slice(d)):m===!0?(be="",P=c):be=c,be&&be!==""&&be!=="/"&&be!==c&&LW(be.charCodeAt(be.length-1))&&(be=be.slice(0,-1)),r.unescape===!0&&(P&&(P=MW.removeBackslashes(P)),be&&_===!0&&(be=MW.removeBackslashes(be)));let $t={prefix:O,input:t,start:u,base:be,glob:P,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&($t.maxDepth=0,LW(E)||s.push(C),$t.tokens=s),r.parts===!0||r.tokens===!0){let je;for(let Me=0;Me{"use strict";var pf=uf(),Kr=df(),{MAX_LENGTH:ib,POSIX_REGEX_SOURCE:Dxe,REGEX_NON_SPECIAL_CHARS:Nxe,REGEX_SPECIAL_CHARS_BACKREF:jxe,REPLACEMENTS:ZW}=pf,Mxe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Kr.escapeRegex(i)).join("..")}return r},Zc=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,GW=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},Fxe=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},VW=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Fxe(e))return e.replace(/\\(.)/g,"$1")},zxe=t=>{let e=t.map(VW).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},Lxe=t=>{let e=0,r=[];for(;ea.trim());if(o.length!==1)return;let s=VW(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Kr.escapeRegex(r[0]):`[${r.map(i=>Kr.escapeRegex(i)).join("")}]`}*`},Uxe=t=>{let e=0,r=t.trim(),n=jI(r);for(;n;)e++,r=n.body.trim(),n=jI(r);return e},qxe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:pf.DEFAULT_MAX_EXTGLOB_RECURSION,n=GW(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||zxe(n)))return{risky:!0};for(let i of n){let o=Lxe(i);if(o)return{risky:!0,safeOutput:o};if(Uxe(i)>r)return{risky:!0}}return{risky:!1}},MI=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ZW[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(ib,r.maxLength):ib,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=pf.globChars(r.windows),l=pf.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=q=>`(${a}(?:(?!${w}${q.dot?m:u}).)*?)`,A=r.dot?"":h,E=r.dot?_:S,C=r.bash===!0?R(r):x;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let k={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Kr.removePrefix(t,k),i=t.length;let L=[],te=[],be=[],O=o,P,$t=()=>k.index===i-1,je=k.peek=(q=1)=>t[k.index+q],Me=k.advance=()=>t[++k.index]||"",Kt=()=>t.slice(k.index+1),Gt=(q="",ut=0)=>{k.consumed+=q,k.index+=ut},Br=q=>{k.output+=q.output!=null?q.output:q.value,Gt(q.value)},jn=()=>{let q=1;for(;je()==="!"&&(je(2)!=="("||je(3)==="?");)Me(),k.start++,q++;return q%2===0?!1:(k.negated=!0,k.start++,!0)},Bi=q=>{k[q]++,be.push(q)},ko=q=>{k[q]--,be.pop()},Ee=q=>{if(O.type==="globstar"){let ut=k.braces>0&&(q.type==="comma"||q.type==="brace"),U=q.extglob===!0||L.length&&(q.type==="pipe"||q.type==="paren");q.type!=="slash"&&q.type!=="paren"&&!ut&&!U&&(k.output=k.output.slice(0,-O.output.length),O.type="star",O.value="*",O.output=C,k.output+=O.output)}if(L.length&&q.type!=="paren"&&(L[L.length-1].inner+=q.value),(q.value||q.output)&&Br(q),O&&O.type==="text"&&q.type==="text"){O.output=(O.output||O.value)+q.value,O.value+=q.value;return}q.prev=O,s.push(q),O=q},Yh=(q,ut)=>{let U={...l[ut],conditions:1,inner:""};U.prev=O,U.parens=k.parens,U.output=k.output,U.startIndex=k.index,U.tokensIndex=s.length;let Ae=(r.capture?"(":"")+U.open;Bi("parens"),Ee({type:q,value:ut,output:k.output?"":p}),Ee({type:"paren",extglob:!0,value:Me(),output:Ae}),L.push(U)},Rae=q=>{let ut=t.slice(q.startIndex,k.index+1),U=t.slice(q.startIndex+2,k.index),Ae=qxe(U,r);if((q.type==="plus"||q.type==="star")&&Ae.risky){let ot=Ae.safeOutput?(q.output?"":p)+(r.capture?`(${Ae.safeOutput})`:Ae.safeOutput):void 0,ai=s[q.tokensIndex];ai.type="text",ai.value=ut,ai.output=ot||Kr.escapeRegex(ut);for(let ci=q.tokensIndex+1;ci1&&q.inner.includes("/")&&(ot=R(r)),(ot!==C||$t()||/^\)+$/.test(Kt()))&&(st=q.close=`)$))${ot}`),q.inner.includes("*")&&(jt=Kt())&&/^\.[^\\/.]+$/.test(jt)){let ai=MI(jt,{...e,fastpaths:!1}).output;st=q.close=`)${ai})${ot})`}q.prev.type==="bos"&&(k.negatedExtglob=!0)}Ee({type:"paren",extglob:!0,value:P,output:st}),ko("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let q=!1,ut=t.replace(jxe,(U,Ae,st,jt,ot,ai)=>jt==="\\"?(q=!0,U):jt==="?"?Ae?Ae+jt+(ot?_.repeat(ot.length):""):ai===0?E+(ot?_.repeat(ot.length):""):_.repeat(st.length):jt==="."?u.repeat(st.length):jt==="*"?Ae?Ae+jt+(ot?C:""):C:Ae?U:`\\${U}`);return q===!0&&(r.unescape===!0?ut=ut.replace(/\\/g,""):ut=ut.replace(/\\+/g,U=>U.length%2===0?"\\\\":U?"\\":"")),ut===t&&r.contains===!0?(k.output=t,k):(k.output=Kr.wrapOutput(ut,k,e),k)}for(;!$t();){if(P=Me(),P==="\0")continue;if(P==="\\"){let U=je();if(U==="/"&&r.bash!==!0||U==="."||U===";")continue;if(!U){P+="\\",Ee({type:"text",value:P});continue}let Ae=/^\\+/.exec(Kt()),st=0;if(Ae&&Ae[0].length>2&&(st=Ae[0].length,k.index+=st,st%2!==0&&(P+="\\")),r.unescape===!0?P=Me():P+=Me(),k.brackets===0){Ee({type:"text",value:P});continue}}if(k.brackets>0&&(P!=="]"||O.value==="["||O.value==="[^")){if(r.posix!==!1&&P===":"){let U=O.value.slice(1);if(U.includes("[")&&(O.posix=!0,U.includes(":"))){let Ae=O.value.lastIndexOf("["),st=O.value.slice(0,Ae),jt=O.value.slice(Ae+2),ot=Dxe[jt];if(ot){O.value=st+ot,k.backtrack=!0,Me(),!o.output&&s.indexOf(O)===1&&(o.output=p);continue}}}(P==="["&&je()!==":"||P==="-"&&je()==="]")&&(P=`\\${P}`),P==="]"&&(O.value==="["||O.value==="[^")&&(P=`\\${P}`),r.posix===!0&&P==="!"&&O.value==="["&&(P="^"),O.value+=P,Br({value:P});continue}if(k.quotes===1&&P!=='"'){P=Kr.escapeRegex(P),O.value+=P,Br({value:P});continue}if(P==='"'){k.quotes=k.quotes===1?0:1,r.keepQuotes===!0&&Ee({type:"text",value:P});continue}if(P==="("){Bi("parens"),Ee({type:"paren",value:P});continue}if(P===")"){if(k.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Zc("opening","("));let U=L[L.length-1];if(U&&k.parens===U.parens+1){Rae(L.pop());continue}Ee({type:"paren",value:P,output:k.parens?")":"\\)"}),ko("parens");continue}if(P==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Zc("closing","]"));P=`\\${P}`}else Bi("brackets");Ee({type:"bracket",value:P});continue}if(P==="]"){if(r.nobracket===!0||O&&O.type==="bracket"&&O.value.length===1){Ee({type:"text",value:P,output:`\\${P}`});continue}if(k.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Zc("opening","["));Ee({type:"text",value:P,output:`\\${P}`});continue}ko("brackets");let U=O.value.slice(1);if(O.posix!==!0&&U[0]==="^"&&!U.includes("/")&&(P=`/${P}`),O.value+=P,Br({value:P}),r.literalBrackets===!1||Kr.hasRegexChars(U))continue;let Ae=Kr.escapeRegex(O.value);if(k.output=k.output.slice(0,-O.value.length),r.literalBrackets===!0){k.output+=Ae,O.value=Ae;continue}O.value=`(${a}${Ae}|${O.value})`,k.output+=O.value;continue}if(P==="{"&&r.nobrace!==!0){Bi("braces");let U={type:"brace",value:P,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};te.push(U),Ee(U);continue}if(P==="}"){let U=te[te.length-1];if(r.nobrace===!0||!U){Ee({type:"text",value:P,output:P});continue}let Ae=")";if(U.dots===!0){let st=s.slice(),jt=[];for(let ot=st.length-1;ot>=0&&(s.pop(),st[ot].type!=="brace");ot--)st[ot].type!=="dots"&&jt.unshift(st[ot].value);Ae=Mxe(jt,r),k.backtrack=!0}if(U.comma!==!0&&U.dots!==!0){let st=k.output.slice(0,U.outputIndex),jt=k.tokens.slice(U.tokensIndex);U.value=U.output="\\{",P=Ae="\\}",k.output=st;for(let ot of jt)k.output+=ot.output||ot.value}Ee({type:"brace",value:P,output:Ae}),ko("braces"),te.pop();continue}if(P==="|"){L.length>0&&L[L.length-1].conditions++,Ee({type:"text",value:P});continue}if(P===","){let U=P,Ae=te[te.length-1];Ae&&be[be.length-1]==="braces"&&(Ae.comma=!0,U="|"),Ee({type:"comma",value:P,output:U});continue}if(P==="/"){if(O.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",s.pop(),O=o;continue}Ee({type:"slash",value:P,output:f});continue}if(P==="."){if(k.braces>0&&O.type==="dot"){O.value==="."&&(O.output=u);let U=te[te.length-1];O.type="dots",O.output+=P,O.value+=P,U.dots=!0;continue}if(k.braces+k.parens===0&&O.type!=="bos"&&O.type!=="slash"){Ee({type:"text",value:P,output:u});continue}Ee({type:"dot",value:P,output:u});continue}if(P==="?"){if(!(O&&O.value==="(")&&r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Yh("qmark",P);continue}if(O&&O.type==="paren"){let Ae=je(),st=P;(O.value==="("&&!/[!=<:]/.test(Ae)||Ae==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(st=`\\${P}`),Ee({type:"text",value:P,output:st});continue}if(r.dot!==!0&&(O.type==="slash"||O.type==="bos")){Ee({type:"qmark",value:P,output:S});continue}Ee({type:"qmark",value:P,output:_});continue}if(P==="!"){if(r.noextglob!==!0&&je()==="("&&(je(2)!=="?"||!/[!=<:]/.test(je(3)))){Yh("negate",P);continue}if(r.nonegate!==!0&&k.index===0){jn();continue}}if(P==="+"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Yh("plus",P);continue}if(O&&O.value==="("||r.regex===!1){Ee({type:"plus",value:P,output:d});continue}if(O&&(O.type==="bracket"||O.type==="paren"||O.type==="brace")||k.parens>0){Ee({type:"plus",value:P});continue}Ee({type:"plus",value:d});continue}if(P==="@"){if(r.noextglob!==!0&&je()==="("&&je(2)!=="?"){Ee({type:"at",extglob:!0,value:P,output:""});continue}Ee({type:"text",value:P});continue}if(P!=="*"){(P==="$"||P==="^")&&(P=`\\${P}`);let U=Nxe.exec(Kt());U&&(P+=U[0],k.index+=U[0].length),Ee({type:"text",value:P});continue}if(O&&(O.type==="globstar"||O.star===!0)){O.type="star",O.star=!0,O.value+=P,O.output=C,k.backtrack=!0,k.globstar=!0,Gt(P);continue}let q=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(q)){Yh("star",P);continue}if(O.type==="star"){if(r.noglobstar===!0){Gt(P);continue}let U=O.prev,Ae=U.prev,st=U.type==="slash"||U.type==="bos",jt=Ae&&(Ae.type==="star"||Ae.type==="globstar");if(r.bash===!0&&(!st||q[0]&&q[0]!=="/")){Ee({type:"star",value:P,output:""});continue}let ot=k.braces>0&&(U.type==="comma"||U.type==="brace"),ai=L.length&&(U.type==="pipe"||U.type==="paren");if(!st&&U.type!=="paren"&&!ot&&!ai){Ee({type:"star",value:P,output:""});continue}for(;q.slice(0,3)==="/**";){let ci=t[k.index+4];if(ci&&ci!=="/")break;q=q.slice(3),Gt("/**",3)}if(U.type==="bos"&&$t()){O.type="globstar",O.value+=P,O.output=R(r),k.output=O.output,k.globstar=!0,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&!jt&&$t()){k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=R(r)+(r.strictSlashes?")":"|$)"),O.value+=P,k.globstar=!0,k.output+=U.output+O.output,Gt(P);continue}if(U.type==="slash"&&U.prev.type!=="bos"&&q[0]==="/"){let ci=q[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(U.output+O.output).length),U.output=`(?:${U.output}`,O.type="globstar",O.output=`${R(r)}${f}|${f}${ci})`,O.value+=P,k.output+=U.output+O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}if(U.type==="bos"&&q[0]==="/"){O.type="globstar",O.value+=P,O.output=`(?:^|${f}|${R(r)}${f})`,k.output=O.output,k.globstar=!0,Gt(P+Me()),Ee({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-O.output.length),O.type="globstar",O.output=R(r),O.value+=P,k.output+=O.output,k.globstar=!0,Gt(P);continue}let ut={type:"star",value:P,output:C};if(r.bash===!0){ut.output=".*?",(O.type==="bos"||O.type==="slash")&&(ut.output=A+ut.output),Ee(ut);continue}if(O&&(O.type==="bracket"||O.type==="paren")&&r.regex===!0){ut.output=P,Ee(ut);continue}(k.index===k.start||O.type==="slash"||O.type==="dot")&&(O.type==="dot"?(k.output+=g,O.output+=g):r.dot===!0?(k.output+=b,O.output+=b):(k.output+=A,O.output+=A),je()!=="*"&&(k.output+=p,O.output+=p)),Ee(ut)}for(;k.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zc("closing","]"));k.output=Kr.escapeLast(k.output,"["),ko("brackets")}for(;k.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zc("closing",")"));k.output=Kr.escapeLast(k.output,"("),ko("parens")}for(;k.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Zc("closing","}"));k.output=Kr.escapeLast(k.output,"{"),ko("braces")}if(r.strictSlashes!==!0&&(O.type==="star"||O.type==="bracket")&&Ee({type:"maybe_slash",value:"",output:`${f}?`}),k.backtrack===!0){k.output="";for(let q of k.tokens)k.output+=q.output!=null?q.output:q.value,q.suffix&&(k.output+=q.suffix)}return k};MI.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(ib,r.maxLength):ib,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=ZW[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:p}=pf.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let E=/^(.*?)\.(\w+)$/.exec(A);if(!E)return;let C=x(E[1]);return C?C+o+E[2]:void 0}}},w=Kr.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};WW.exports=MI});var XW=v((lrt,YW)=>{"use strict";var Bxe=HW(),FI=KW(),JW=df(),Hxe=uf(),Zxe=t=>t&&typeof t=="object"&&!Array.isArray(t),At=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>At(f,e,r));return f=>{for(let p of u){let m=p(f);if(m)return m}return!1}}let n=Zxe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=i.windows,s=n?At.compileRe(t,e):At.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=At(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:m}=At.test(u,s,e,{glob:t,posix:o}),h={glob:t,state:a,regex:s,posix:o,input:u,output:m,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(h),f===!1?(h.isMatch=!1,d?h:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(h),h.isMatch=!1,d?h:!1):(typeof i.onMatch=="function"&&i.onMatch(h),d?h:!0)};return r&&(l.state=a),l};At.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?JW.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=At.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};At.matchBase=(t,e,r)=>(e instanceof RegExp?e:At.makeRe(e,r)).test(JW.basename(t));At.isMatch=(t,e,r)=>At(e,r)(t);At.parse=(t,e)=>Array.isArray(t)?t.map(r=>At.parse(r,e)):FI(t,{...e,fastpaths:!1});At.scan=(t,e)=>Bxe(t,e);At.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=At.toRegex(a,e);return n===!0&&(c.state=t),c};At.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=FI.fastpaths(t,e)),i.output||(i=FI(t,e)),At.compileRe(i,e,r,n)};At.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};At.constants=Hxe;YW.exports=At});var rK=v((urt,tK)=>{"use strict";var QW=XW(),Gxe=df();function eK(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Gxe.isWindows()}),QW(t,e,r)}Object.assign(eK,QW);tK.exports=eK});import{readdir as Vxe,readdirSync as Wxe,realpath as Kxe,realpathSync as Jxe,stat as Yxe,statSync as Xxe}from"fs";import{isAbsolute as Qxe,posix as la,resolve as e0e}from"path";import{fileURLToPath as t0e}from"url";function i0e(t,e={}){let r=t.length,n=Array(r),i=Array(r),o,s;for(o=0;o{let c=a.split("/");if(c[0]===".."&&n0e.test(a))return!0;for(o=0;oo.slice(i,s?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,o)=>{if(i===".")return n;let s=`${n}/${i}`;return o?s.slice(0,-1):s}:(i,o)=>o&&i!=="."?i.slice(0,-1):i}return r?n=>la.relative(t,n)||".":n=>la.relative(t,`${e}/${n}`)||"."}function a0e(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=la.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function sK(t){var e;let r=Gc.default.scan(t,c0e);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function m0e(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Gc.default.scan(t);return r.isGlob||r.negated}function mf(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function aK(t){return typeof t=="string"?[t]:t??[]}function zI(t,e,r,n){var i;let o=e.cwd,s=t;t[t.length-1]==="/"&&(s=t.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let a=p0e(o);s=Qxe(s.replace(g0e,""))?la.relative(a,s):la.normalize(s);let c=(i=h0e.exec(s))===null||i===void 0?void 0:i[0],l=sK(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=m,r.depthOffset=-d+f)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],f=Math.min(r.commonPath.length,l.length);for(let p=0;p0?la.join(o,...d):o}return s}function y0e(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(zI(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(zI(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(zI(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function _0e(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=y0e(t,e,n);t.debug&&mf("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(iK,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Gc.default)(i.match,f),m=(0,Gc.default)(i.ignore,f),h=i0e(i.match,f),g=nK(r,d,o),b=o?g:nK(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new IW({filters:[a?(w,R)=>{let A=g(w,R),E=p(A)&&!m(A);return E&&mf(`matched ${A}`),E}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return mf(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&mf("internal properties:",{...n,root:d}),[x,r!==d&&!o&&a0e(r,d)]}function b0e(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function S0e(t){let e={...v0e,...t};return e.cwd=(e.cwd instanceof URL?t0e(e.cwd):e0e(e.cwd)).replace(iK,"/"),e.ignore=aK(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Vxe,readdirSync:e.fs.readdirSync||Wxe,realpath:e.fs.realpath||Kxe,realpathSync:e.fs.realpathSync||Jxe,stat:e.fs.stat||Yxe,statSync:e.fs.statSync||Xxe}),e.debug&&mf("globbing with options:",e),e}function w0e(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=r0e(t)||typeof t=="string",i=aK((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=S0e(n?e:t);return i.length>0?_0e(o,i):[]}function Vo(t,e){let[r,n]=w0e(t,e);return r?b0e(r.sync(),n):[]}var Gc,r0e,iK,oK,n0e,o0e,s0e,c0e,l0e,u0e,d0e,f0e,p0e,h0e,g0e,v0e,hf=y(()=>{PW();Gc=kt(rK(),1),r0e=Array.isArray,iK=/\\/g,oK=process.platform==="win32",n0e=/^(\/?\.\.)+$/;o0e=/^[A-Z]:\/$/i,s0e=oK?t=>o0e.test(t):t=>t==="/";c0e={parts:!0};l0e=/(?t.replace(l0e,"\\$&"),f0e=t=>t.replace(u0e,"\\$&"),p0e=oK?f0e:d0e;h0e=/^(\/?\.\.)+/,g0e=/\\(?=[()[\]{}!*+?@|])/g;v0e={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as ob,readFileSync as x0e,readdirSync as $0e,statSync as cK}from"node:fs";import{join as Vc}from"node:path";function k0e(t){let{cwd:e="."}=t,r,n;try{let c=Y(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=bi(e,n),o=[],{layers:s,forbiddenImports:a}=LI(r);return s.size>0&&(E0e(e,i,s,o),A0e(e,i,s,o)),a.length>0&&T0e(e,i,a,o),o}function LI(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let o of i)e.add(o);else{let o=i;if(typeof o.name=="string"&&o.name.length>0){e.add(o.name);for(let s of o.forbidden_imports??[])typeof s=="string"&&r.push({from:o.name,to:s})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function E0e(t,e,r,n){let i=e.mainRoot,o=Vc(t,i);if(ob(o))for(let s of $0e(o)){let a=Vc(o,s);cK(a).isDirectory()&&(r.has(s)||n.push({detector:sb,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function A0e(t,e,r,n){let i=e.mainRoot,o=Vc(t,i);if(ob(o))for(let s of r){let a=Vc(o,s);ob(a)&&cK(a).isDirectory()||n.push({detector:sb,severity:"warn",path:`${i}/${s}/`,message:`spec/architecture.yaml declares layer '${s}' but ${i}/${s}/ does not exist \u2014 fix the spec or create the directory`})}}function T0e(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Vc(t,i,s.from);if(!ob(a))continue;let c=Vo([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Vc(a,l),d;try{d=x0e(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];O0e(p,s.to,e.importStyle)&&n.push({detector:sb,severity:"error",path:`${i}/${s.from}/${l}`,message:`${i}/${s.from}/${l} imports from '${p}' which crosses into the '${s.to}' layer \u2014 spec/architecture.yaml forbids imports from '${s.from}' to '${s.to}'`})}}}}function O0e(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var sb,lK,UI=y(()=>{"use strict";hf();at();Hc();sb="ARCHITECTURE_FROM_SPEC";lK={name:sb,run:k0e}});import{existsSync as I0e,readFileSync as P0e}from"node:fs";import{join as R0e}from"node:path";function C0e(t){let{cwd:e="."}=t,r=R0e(e,"spec/capabilities.yaml");if(!I0e(r))return[];let n;try{let c=P0e(r,"utf8"),l=uK.default.parse(c);if(!l||typeof l!="object")return[];n=l}catch{return[]}let i=n.capabilities??[];if(i.length===0)return[];let o;try{let c=Y(e);o=new Set(c.features.map(l=>l.id))}catch{return[]}let s=[],a=new Set;for(let c of i){if(typeof c!="object"||c===null)continue;let l=String(c.id??"(unnamed)"),u=Array.isArray(c.features)?c.features:[];if(u.length===0){s.push({detector:ab,severity:"warn",path:"spec/capabilities.yaml",message:`capability "${l}" has no features mapped \u2014 bind at least one feature via the features[] field, or remove the capability if it's no longer relevant`});continue}for(let d of u){let f=String(d);o.has(f)?a.add(f):s.push({detector:ab,severity:"error",path:"spec/capabilities.yaml",message:`capability "${l}" references feature ${f} which does not exist in spec.yaml \u2014 either add the feature or remove it from this capability's features[]`})}}for(let c of o)a.has(c)||s.push({detector:ab,severity:"info",path:"spec.yaml",message:`feature ${c} is not claimed by any capability \u2014 if it's user-facing, consider adding it to a capability's features[] in spec/capabilities.yaml`});return s}var uK,ab,dK,fK=y(()=>{"use strict";uK=kt(or(),1);at();ab="CAPABILITIES_FEATURE_MAPPING";dK={name:ab,run:C0e}});import{existsSync as D0e,readFileSync as N0e}from"node:fs";import{join as j0e}from"node:path";function M0e(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")}function F0e(t){let{cwd:e="."}=t;return pe(e,qI,r=>z0e(r,e))}function z0e(t,e){let r=bi(e,t.project?.language),n=[];for(let i of t.features)for(let o of i.modules??[]){if(!r.extensions.some(c=>o.endsWith(c)))continue;let s=j0e(e,o);if(!D0e(s))continue;let a=N0e(s,"utf8");M0e(a)||n.push({detector:qI,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var qI,pK,mK=y(()=>{"use strict";Hc();_t();qI="CONVENTION_DRIFT";pK={name:qI,run:F0e}});import{existsSync as BI,readFileSync as hK}from"node:fs";import{join as cb}from"node:path";function L0e(t){return JSON.parse(t).total?.lines?.pct??0}function gK(t){let e=/BI(cb(c.dir,d)));if(!l){s.push(c.path);continue}let u=gK(hK(cb(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:no,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=yK(n,i);return a0?[{detector:no,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function B0e(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let s=q0e(e,t.focusModules);if(s)return s}let r=bi(e),n=pt(e).language==="kotlin"?bI.find(s=>BI(cb(e,s)))??tW(e):r.coverageSummary,i=cb(e,n);if(!BI(i))return[{detector:no,severity:"info",message:`${n} not present \u2014 run stage_2.2 first`}];let o;try{let s=hK(i,"utf8");o=r.coverageFormat==="jacoco-xml"?U0e(s):L0e(s)}catch(s){return[{detector:no,severity:"warn",message:`${n} unparseable: ${s.message}`}]}return o===null?[{detector:no,severity:"warn",message:`${n} contained no line-coverage counter`}]:o>=lb?[]:[{detector:no,severity:"warn",message:`line coverage ${o.toFixed(1)}% < floor ${lb}%`}]}var no,lb,_K,bK=y(()=>{"use strict";W_();Hc();Z_();yn();no="COVERAGE_DROP",lb=70;_K={name:no,run:B0e}});import{existsSync as H0e}from"node:fs";import{join as Z0e}from"node:path";function G0e(t){let{cwd:e="."}=t;return pe(e,ub,r=>V0e(r,e))}function V0e(t,e){let r=t.project.deliverable,n=t.features.filter(i=>i.status==="done"&&(i.modules?.length??0)>0);return r?H0e(Z0e(e,r.path))?[]:[{detector:ub,severity:"error",path:r.path,message:`project.deliverable.path '${r.path}' is declared but does not exist on disk.`}]:n.length===0?[]:[{detector:ub,severity:"warn",message:`${n.length} done feature(s) ship modules but project.deliverable is not declared \u2014 the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4).`}]}var ub,vK,SK=y(()=>{"use strict";_t();ub="DELIVERABLE_INTEGRITY";vK={name:ub,run:G0e}});function W0e(t){let e=(t.features??[]).filter(i=>i.status==="done");return e.length===0?[]:!t.project?.deliverable?[]:(t.project?.smoke??[]).length>0?[]:[{detector:HI,severity:"warn",path:"spec.yaml",message:`${e.length} feature(s) are done and the project ships a runnable deliverable, but no functional smoke probe is declared (project.smoke) \u2014 an exit-only deliverable is liveness, not AC-verification. Declare a smoke probe with an expect.token so the gate re-executes the shipped entry against its AC result.`}]}function K0e(t){let{cwd:e="."}=t;return pe(e,HI,r=>W0e(r))}var HI,wK,xK=y(()=>{"use strict";_t();HI="SMOKE_PROBE_DEMAND";wK={name:HI,run:K0e}});function J0e(t){let{cwd:e="."}=t;return pe(e,db,r=>Y0e(r,e))}function Y0e(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=wc(e);if(n===null)return[{detector:db,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=n.get(o.id),a=Md(e,o.modules??[]);s!==a&&i.push({detector:db,severity:"warn",path:"spec/attestation.yaml",message:s===void 0?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var db,fb,ZI=y(()=>{"use strict";Fd();_t();db="STALE_ATTESTATION";fb={name:db,run:J0e}});function X0e(t){let{cwd:e="."}=t,r;try{r=Y(e)}catch{return[]}return Q0e(r)}function Q0e(t){let e=new Set(t.features.map(d=>d.id)),r=new Map;for(let d of t.features)r.set(d.id,(d.depends_on??[]).filter(f=>e.has(f)));let n=0,i=1,o=2,s=new Map;for(let d of r.keys())s.set(d,n);let a=[],c=new Set,l=[];function u(d){s.set(d,i),l.push(d);for(let f of r.get(d)??[]){let p=s.get(f);if(p===i){let m=l.indexOf(f),h=l.slice(m).concat(f),g=[...h].sort().join(",");c.has(g)||(c.add(g),a.push({detector:$K,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${h.join(" \u2192 ")} \u2014 these features can never all become ready, so the drive loop deadlocks. Break the cycle by removing one edge.`}))}else p===n&&u(f)}l.pop(),s.set(d,o)}for(let d of r.keys())s.get(d)===n&&u(d);return a}var $K,pb,GI=y(()=>{"use strict";at();$K="DEPENDENCY_CYCLE";pb={name:$K,run:X0e}});import{appendFileSync as e$e,existsSync as kK,mkdirSync as t$e,readFileSync as r$e}from"node:fs";import{dirname as n$e,join as i$e}from"node:path";function EK(t){return i$e(t,o$e,s$e)}function AK(t){return VI.add(t),()=>VI.delete(t)}function ua(t,e){let r=EK(t),n=n$e(r);kK(n)||t$e(n,{recursive:!0}),e$e(r,`${JSON.stringify(e)} `,"utf8");for(let i of VI)try{i(t,e)}catch{}}function bn(t){let e=EK(t);if(!kK(e))return[];let r=r$e(e,"utf8").trim();return r.length===0?[]:r.split(` diff --git a/spec.yaml b/spec.yaml index 6c74ff9a..688bf76b 100644 --- a/spec.yaml +++ b/spec.yaml @@ -49,8 +49,8 @@ project: # Auto-maintained by `clad sync` (F-5b9f9f). Do not edit by hand. inventory: - features: 200 + features: 201 scenarios: 2 capabilities: 6 - test_files: 171 - last_synced: "2026-07-02" + test_files: 172 + last_synced: "2026-07-03" diff --git a/spec/attestation.yaml b/spec/attestation.yaml index c985a4a5..c54e56d3 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -4,10 +4,10 @@ # --tier=pre-push --strict` GREEN refreshes. Content-anchored: survives # fresh clones and squash/rebase (suggested .gitattributes: merge=union). attested: - F-001: 1eb56cee6b065fbe + F-001: 830ae324d89c3fce F-002: c116a9d32f862ee9 F-003: c9578f9a6e70dcdf - F-004: 791125e674b98fb5 + F-004: b6e68a1ab2d8fe81 F-005: 70c3b7166f297bff F-006: 488cb6f2d452a286 F-007: d1c159c46d5a454f @@ -29,7 +29,7 @@ attested: F-021: 8a1a82a59a1c45c7 F-022: 8f596a1c737f6d42 F-02343cd1: ef8aab92031314d2 - F-023: 0c14948e5a91bb0f + F-023: c347678282dafd98 F-024: f67a86816b06f8ee F-025: 187339b684896b8e F-026: bb35faf43ba582cb @@ -50,7 +50,7 @@ attested: F-041: cddb50fc41e49066 F-042: d1f661281bb9fb6e F-043: 2c5f4a94e3e57e9b - F-044: c695f1e075720068 + F-044: 31cb47e11008aa1b F-045: b494c9a80442ac20 F-046: 4b563fce74b6bb4b F-047: baf5a2dbb9bb5a4b @@ -85,7 +85,7 @@ attested: F-076: a1a83ee1367c9a62 F-077: b05585ff764719ca F-078: b00a896e952776b8 - F-079: c4a31cfa2a639cdd + F-079: 3a3668c7caffda4f F-080: 1c19da74d32894e6 F-081: 248f9660cfb1b02b F-098d3b: 42d61bf806ce462b @@ -107,10 +107,10 @@ attested: F-2de65d: 84ad71574d306c81 F-315fd7: c3b042c80fa7c187 F-31eeb8: d88a9880d29ae411 - F-32b1e0: c1fc15020d878236 + F-32b1e0: edfc8ec05a88784a F-3788c2: af9778dea8687b29 F-37b4a8: e067655bad681488 - F-3a5339: 73f69ea99b45711e + F-3a5339: 17a1c49e257cf786 F-3b3690: 6a36aad282d36f3a F-40327b: 8295358f7b813c8a F-417ff0: f438ae2713e9bfbf @@ -125,7 +125,7 @@ attested: F-570a3f: 5e39856f9d2aa4b1 F-59f093: 26735424fba6308c F-5b188856: d1e2e4184aa76c12 - F-5b9f9f: b5251329ea5686c2 + F-5b9f9f: b36bb8b83de6e35e F-5d3ed2: 9452eac28760fb99 F-5f6b45: 15323c4f5b619de7 F-64a5c159: a8afca34fb00d0f3 @@ -163,7 +163,7 @@ attested: F-aee61f: e009b9eb07addd30 F-af45042a: 17c898c92c9ac27e F-af96b1: 108264660d611b56 - F-b2094740: f379bf4feef6771a + F-b2094740: 2ea89b77e7c8e740 F-b43066: 9402b630adcf1eae F-b61449: 7095ce00662e987d F-b84c38: 5df890ae36e3d072 @@ -173,6 +173,7 @@ attested: F-bb15e6: ea9b217fd8ac6fe0 F-bd07d7: 4bf7e1baddf5d754 F-bdcd90: e19b8ee840ef58c4 + F-bfe14aac: 2ea89b77e7c8e740 F-c037ae: 0601d791da73a6f3 F-c2c996: d82fdaab2e6ded77 F-c48eb2: 899bf69592c91775 @@ -185,11 +186,11 @@ attested: F-d2c806: 1cf20a658d36f4db F-d3bde4: 915d13b33258d3fc F-d49585: ca1e61197a081bd6 - F-d6b93648: 17a042248a45dbcc + F-d6b93648: 8aef22fc6905f130 F-d7312b: d5592f2eb809487f F-d8223c: 0501e9564231899b F-d980359c: 8f1559276afc5c03 - F-dd51b42c: 496eeffa2641169d + F-dd51b42c: 30b7e2a656892648 F-dddb89: f5625354e55eba9b F-e0f6c7: 36f3f085741af993 F-eb732f: d8abb536ff850a7a diff --git a/spec/features/incremental-ts-gate-bfe14aac.yaml b/spec/features/incremental-ts-gate-bfe14aac.yaml new file mode 100644 index 00000000..96ea7885 --- /dev/null +++ b/spec/features/incremental-ts-gate-bfe14aac.yaml @@ -0,0 +1,33 @@ +id: F-bfe14aac +slug: incremental-ts-gate +title: "Incremental TS gate — tsc --incremental + eslint --cache (sound; ~3.4s faster on warm re-runs)" +status: done +modules: + - src/stages/toolchain/detect.ts +acceptance_criteria: + - id: AC-41107118 + ears: ubiquitous + action: "run the TypeScript type gate as tsc --noEmit --incremental with a tsBuildInfoFile under .cladding/cache, so an unchanged re-check reuses the build cache" + response: "detectToolchain's typescript gates.type carries --incremental + --tsBuildInfoFile .cladding/cache/tsc.tsbuildinfo" + text: "The system shall run the TS type gate with tsc --incremental and a .cladding/cache build-info file." + test_refs: ["tests/stages/incremental-gate.test.ts"] + - id: AC-1f2116fa + ears: ubiquitous + action: "run the TypeScript lint gate as eslint --cache with a cache-location under .cladding/cache, so unchanged files reuse cached lint results" + response: "detectToolchain's typescript gates.lint carries --cache + --cache-location .cladding/cache/eslint" + text: "The system shall run the TS lint gate with eslint --cache and a .cladding/cache cache-location." + test_refs: ["tests/stages/incremental-gate.test.ts"] + - id: AC-f253b9fa + ears: state + condition: "while a build cache from a prior run exists and the tree is unchanged" + action: "still catch a newly-introduced type/lint error (incremental is sound, not a correctness shortcut)" + response: "tsc --incremental rebuilds the affected program slice and eslint --cache keys on file+config hash, so a real error is never masked — the cache only skips proven-unchanged work" + text: "While a cache exists, the system shall still catch any real type/lint error (sound incrementality)." + test_refs: ["tests/stages/incremental-gate.test.ts"] + - id: AC-dd80d585 + ears: unwanted + condition: "if the gate writes its incremental caches" + action: "keep them under the .cladding/ namespace so they never pollute the managed project's git status" + response: "both cache paths live under .cladding/cache (already gitignored), not the project root" + text: "If the gate caches, then it shall write under .cladding/ so the project tree stays clean." + test_refs: ["tests/stages/incremental-gate.test.ts"] diff --git a/spec/index.yaml b/spec/index.yaml index d987955b..cac687ef 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -174,6 +174,7 @@ features: F-bb15e6: {slug: clad-doctor, status: done, modules: 3} F-bd07d7: {slug: greenfield-seeds, status: done, modules: 5} F-bdcd90: {slug: oracle-policy-risk-weighted, status: done, modules: 8} + F-bfe14aac: {slug: incremental-ts-gate, status: done, modules: 1} F-c037ae: {slug: test-refs-repair, status: done, modules: 4} F-c2c996: {slug: checkpoint-events, status: done, modules: 3} F-c48eb2: {slug: scan-source-roots, status: done, modules: 5} diff --git a/src/stages/toolchain/detect.ts b/src/stages/toolchain/detect.ts index 0d243a5c..fcbd1594 100644 --- a/src/stages/toolchain/detect.ts +++ b/src/stages/toolchain/detect.ts @@ -111,8 +111,15 @@ const CHAIN: readonly Entry[] = [ // "not found" → the stage's missing-tool classification → skip (exit 2), // which the strict demand table (F-67d2e9) escalates when the spec // relies on the stage. - type: {cmd: 'npx', args: ['--no-install', 'tsc', '--noEmit']}, - lint: {cmd: 'npx', args: ['--no-install', 'eslint', '.']}, + // Incremental caches (F-bfe14aac): tsc --incremental reuses a build-info + // file and eslint --cache reuses per-file results, so an unchanged re-run + // (the local pre-commit/pre-push loop) skips proven-unchanged work — + // ~3.4s faster on cladding's own tree. SOUND, not a shortcut: tsc rebuilds + // the affected program slice (a new type error is still caught) and eslint + // keys the cache on file+config hash. Caches live under .cladding/ (already + // gitignored) so they never pollute the managed project's git status. + type: {cmd: 'npx', args: ['--no-install', 'tsc', '--noEmit', '--incremental', '--tsBuildInfoFile', '.cladding/cache/tsc.tsbuildinfo']}, + lint: {cmd: 'npx', args: ['--no-install', 'eslint', '.', '--cache', '--cache-location', '.cladding/cache/eslint']}, test: {cmd: 'npx', args: ['--no-install', 'vitest', 'run']}, coverage: {cmd: 'npx', args: ['--no-install', 'vitest', 'run', '--coverage']}, secret: {cmd: 'npx', args: ['--no-install', 'secretlint', '**/*']}, diff --git a/tests/stages/incremental-gate.test.ts b/tests/stages/incremental-gate.test.ts new file mode 100644 index 00000000..420bcd7f --- /dev/null +++ b/tests/stages/incremental-gate.test.ts @@ -0,0 +1,77 @@ +import {afterEach, beforeEach, describe, expect, it} from 'vitest'; +import {mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; + +import {detectToolchain} from '../../src/stages/toolchain/detect.js'; + +let dir: string; +beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'incr-gate-')); +}); +afterEach(() => { + rmSync(dir, {recursive: true, force: true}); +}); + +const ts = () => writeFileSync(join(dir, 'package.json'), '{}'); +const py = () => writeFileSync(join(dir, 'pyproject.toml'), ''); + +const after = (args: readonly string[], flag: string) => + args[args.indexOf(flag) + 1]; + +describe('incremental TS gate (F-bfe14aac)', () => { + it('type gate uses incremental with cladding tsbuildinfo', () => { + ts(); + const {gates} = detectToolchain(dir); + expect(gates.type).toBeDefined(); + const {cmd, args} = gates.type!; + expect(cmd).toBe('npx'); + expect(args.slice(0, 3)).toEqual(['--no-install', 'tsc', '--noEmit']); + expect(args).toContain('--incremental'); + expect(args).toContain('--tsBuildInfoFile'); + expect(after(args, '--tsBuildInfoFile')).toBe( + '.cladding/cache/tsc.tsbuildinfo', + ); + }); + + it('lint gate uses eslint cache under cladding', () => { + ts(); + const {gates} = detectToolchain(dir); + expect(gates.lint).toBeDefined(); + const {args} = gates.lint!; + expect(args.slice(0, 3)).toEqual(['--no-install', 'eslint', '.']); + expect(args).toContain('--cache'); + expect(args).toContain('--cache-location'); + expect(after(args, '--cache-location')).toBe('.cladding/cache/eslint'); + }); + + it('all cache paths stay under .cladding/ (no project-root pollution)', () => { + ts(); + const {gates} = detectToolchain(dir); + const tsCache = after(gates.type!.args, '--tsBuildInfoFile'); + const lintCache = after(gates.lint!.args, '--cache-location'); + expect(tsCache.startsWith('.cladding/')).toBe(true); + expect(lintCache.startsWith('.cladding/')).toBe(true); + }); + + it('test and coverage gates are unchanged', () => { + ts(); + const {gates} = detectToolchain(dir); + expect(gates.test).toBeDefined(); + expect(gates.coverage).toBeDefined(); + expect(gates.test!.args).toEqual(['--no-install', 'vitest', 'run']); + expect(gates.coverage!.args).toEqual([ + '--no-install', + 'vitest', + 'run', + '--coverage', + ]); + }); + + it('non-TS (python) project is unaffected by incremental flags', () => { + py(); + const {gates} = detectToolchain(dir); + expect(gates.type?.args).not.toContain('--incremental'); + expect(gates.lint?.args).not.toContain('--cache'); + }); +}); diff --git a/tests/stages/toolchain.test.ts b/tests/stages/toolchain.test.ts index ac1b1a40..2b0cbfdb 100644 --- a/tests/stages/toolchain.test.ts +++ b/tests/stages/toolchain.test.ts @@ -146,7 +146,7 @@ describe('detectToolchain', () => { // State-transition: proves resolveTsLint actually reads the filesystem each call, // not a hard-coded return (defeats the one-way-test critique). writeFileSync(join(dir, 'package.json'), '{}'); - const eslintGate = {cmd: 'npx', args: ['--no-install', 'eslint', '.']}; + const eslintGate = {cmd: 'npx', args: ['--no-install', 'eslint', '.', '--cache', '--cache-location', '.cladding/cache/eslint']}; expect(detectToolchain(dir).gates.lint).toEqual(eslintGate); writeFileSync(join(dir, 'biome.json'), '{}'); expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'biome', 'lint', '.']}); @@ -156,7 +156,7 @@ describe('detectToolchain', () => { test('typescript with no linter config → lint gate stays eslint (default preserved)', () => { writeFileSync(join(dir, 'package.json'), '{}'); - expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'eslint', '.']}); + expect(detectToolchain(dir).gates.lint).toEqual({cmd: 'npx', args: ['--no-install', 'eslint', '.', '--cache', '--cache-location', '.cladding/cache/eslint']}); }); test('biome takes precedence over oxlint when both configs present', () => { @@ -170,7 +170,7 @@ describe('detectToolchain', () => { writeFileSync(join(dir, 'package.json'), '{}'); writeFileSync(join(dir, 'biome.json'), '{}'); const tc = detectToolchain(dir); - expect(tc.gates.type).toEqual({cmd: 'npx', args: ['--no-install', 'tsc', '--noEmit']}); + expect(tc.gates.type).toEqual({cmd: 'npx', args: ['--no-install', 'tsc', '--noEmit', '--incremental', '--tsBuildInfoFile', '.cladding/cache/tsc.tsbuildinfo']}); expect(tc.gates.test).toEqual({cmd: 'npx', args: ['--no-install', 'vitest', 'run']}); });