@netlify/agent-runner-cli 1.167.0 → 1.168.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin-local.js +1 -1
- package/dist/bin.js +289 -289
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/bin-local.js
CHANGED
|
@@ -133,7 +133,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
133
133
|
`,LF:`
|
|
134
134
|
`,concatBytes:c$},p1e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},h1e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:p1e};import{Buffer as m1e}from"buffer";var Fre=(t,e)=>t?void 0:g1e.bind(void 0,e),g1e=function*(t,e){if(typeof e!="string"&&!Bt(e)&&!m1e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Bre=(t,e)=>t?_1e.bind(void 0,e):y1e.bind(void 0,e),_1e=function*(t,e){jre(t,e),yield e},y1e=function*(t,e){if(jre(t,e),typeof e!="string"&&!Bt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},jre=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
|
|
135
135
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
136
|
-
if (condition) { yield value; }`)};import{Buffer as S1e}from"buffer";import{StringDecoder as E1e}from"string_decoder";var Mw=(t,e,r)=>{if(r)return;if(t)return{transform:v1e.bind(void 0,new TextEncoder)};let n=new E1e(e);return{transform:T1e.bind(void 0,n),final:b1e.bind(void 0,n)}},v1e=function*(t,e){S1e.isBuffer(e)?yield _s(e):typeof e=="string"?yield t.encode(e):yield e},T1e=function*(t,e){yield Bt(e)?t.write(e):e},b1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as zre}from"util";var u$=zre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Dw=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=w1e}=e[r];for await(let i of n(t))yield*Dw(i,e,r+1)},Gre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*A1e(r,Number(e),t)},A1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Dw(n,r,e+1)},qre=zre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),w1e=function*(t){yield t};var d$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Vre=(t,e)=>[...e.flatMap(r=>[...Ul(r,t,0)]),...L_(t)],Ul=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=R1e}=e[r];for(let i of n(t))yield*Ul(i,e,r+1)},L_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*x1e(r,Number(e),t)},x1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ul(n,r,e+1)},R1e=function*(t){yield t};var f$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Wre(t,s,o),l=$l(e),u=$l(r),d=l?u$.bind(void 0,Dw,a):d$.bind(void 0,Ul),f=l||u?u$.bind(void 0,Gre,a):d$.bind(void 0,L_),p=l||u?qre.bind(void 0,a):void 0;return{stream:new C1e({writableObjectMode:n,writableHighWaterMark:Hre(n),readableObjectMode:i,readableHighWaterMark:Hre(i),transform(m,y,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},Lw=(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=Wre(s,r,a);t=Vre(c,t)}return t},Wre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Fre(n,a)},Mw(r,s,n),kw(r,o,n,c),{transform:t,final:e},{transform:Bre(i,a)},Ure({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Yre=(t,e)=>{for(let r of I1e(t))P1e(t,r,e)},I1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),P1e=(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 ${$a[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>O1e(a,n));r.input=x_(s)},O1e=(t,e)=>{let r=Lw(t,e,"utf8",!0);return N1e(r),x_(r)},N1e=t=>{let e=t.find(r=>typeof r!="string"&&!Bt(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}.`)};import{writeFileSync as L1e,appendFileSync as $1e}from"fs";var $w=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&_f(r,n)&&!En.has(e)&&k1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&M1e.has(o))||t.every(({type:i})=>Xn.has(i))),k1e=t=>t===1||t===2,M1e=new Set(["pipe","overlapped"]),Kre=async(t,e,r,n)=>{for await(let i of t)D1e(e)||Jre(i,r,n)},Zre=(t,e,r)=>{for(let n of t)Jre(n,e,r)},D1e=t=>t._readableState.pipes.length>0,Jre=(t,e,r)=>{let n=JA(t);go({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Xre=({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)=>U1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},U1e=({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=Qte(t,o,d),p=_s(f),{stdioItems:h,objectMode:m}=e[r],y=F1e([p],h,c,n),{serializedResult:E,finalResult:b=E}=B1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});j1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&z1e(E,h,i),A}catch(S){return n.error=S,A}},F1e=(t,e,r,n)=>{try{return Lw(t,e,r,!1)}catch(i){return n.error=i,t}},B1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:x_(t)};let s=p7(t,r);return n[o]?{serializedResult:s,finalResult:l$(s,!i[o],e)}:{serializedResult:s}},j1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!$w({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=l$(t,!1,s);try{Zre(a,e,n)}catch(c){r.error??=c}},z1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Ow.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?$1e(n,t):(r.add(o),L1e(n,t))}};var Qre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Es(e,r,"all")]:Array.isArray(e)?[Es(t,r,"all"),...e]:Bt(t)&&Bt(e)?yL([t,e]):`${t}${e}`};import{once as p$}from"events";var ene=async(t,e)=>{let[r,n]=await G1e(t);return e.isForcefullyTerminated??=!1,[r,n]},G1e=async t=>{let[e,r]=await Promise.allSettled([p$(t,"spawn"),p$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?tne(t):r.value},tne=async t=>{try{return await p$(t,"exit")}catch{return tne(t)}},rne=async t=>{let[e,r]=await t;if(!q1e(e,r)&&h$(e,r))throw new Ii;return[e,r]},q1e=(t,e)=>t===void 0&&e===void 0,h$=(t,e)=>t!==0||e!==null;var nne=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=V1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Xte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},V1e=(t,e,r)=>t!==void 0?t:h$(e,r)?new Ii:void 0;var ine=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=W1e(t,e,r),d=Z1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Rf(d,c,l)},W1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=QA(t,e,r),a=Y1e(r),{file:c,commandArguments:l,options:u}=Sw(t,e,a);K1e(u);let d=Mre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Y1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,K1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Uw("ipcInput"),t&&Uw("ipc: true"),r&&Uw("detached: true"),n&&Uw("cancelSignal")},Uw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Z1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=J1e({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}=nne(c,r),{output:h,error:m=l}=Xre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,A)=>Es(b,r,A)),E=Es(Qre(h,r),r,"all");return Q1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:E,options:r,command:n,escapedCommand:i,startTime:a})},J1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Yre(o,r);let a=X1e(r);return H1e(...Ew(t,e,a))}catch(a){return xf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},X1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Rw(e)}),Q1e=({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?Cw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):D_({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{setMaxListeners as BFe}from"events";import{spawn as jFe}from"child_process";import lne from"process";import{once as m$,on as eUe}from"events";var one=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ef({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:pw(t)}),tUe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),tUe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{lw(e,i);let o=La(t,e,r),s=new AbortController;try{return await Promise.race([rUe(o,n,s),nUe(o,r,s),iUe(o,r,s)])}catch(a){throw vf(t),a}finally{s.abort(),uw(e,i)}},rUe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await m$(t,"message",{signal:r});return n}for await(let[n]of eUe(t,"message",{signal:r}))if(e(n))return n},nUe=async(t,e,{signal:r})=>{await m$(t,"disconnect",{signal:r}),Vee(e)},iUe=async(t,e,{signal:r})=>{let[n]=await m$(t,"strict:error",{signal:r});throw sw(n,e)};import{once as ane,on as oUe}from"events";var cne=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>g$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),g$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ef({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:pw(t)}),lw(e,o);let s=La(t,e,r),a=new AbortController,c={};return sUe(t,s,a),aUe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),cUe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},sUe=async(t,e,r)=>{try{await ane(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},aUe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await ane(t,"strict:error",{signal:r.signal});n.error=sw(i,e),r.abort()}catch{}},cUe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of oUe(r,"message",{signal:o.signal}))sne(s),yield c}catch{sne(s)}finally{o.abort(),uw(e,a),n||vf(t),i&&await t}},sne=({error:t})=>{if(t)throw t};var une=(t,{ipc:e})=>{Object.assign(t,fne(t,!1,e))},dne=()=>{let t=lne,e=!0,r=lne.channel!==void 0;return{...fne(t,e,r),getCancelSignal:yte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},fne=(t,e,r)=>({sendMessage:_w.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:one.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:cne.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as lUe}from"child_process";import{PassThrough as uUe,Readable as dUe,Writable as fUe,Duplex as pUe}from"stream";var pne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{s$(n);let a=new lUe;hUe(a,n),Object.assign(a,{readable:mUe,writable:gUe,duplex:_Ue});let c=xf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=yUe(c,s,i);return{subprocess:a,promise:l}},hUe=(t,e)=>{let r=$_(),n=$_(),i=$_(),o=Array.from({length:e.length-3},$_),s=$_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},$_=()=>{let t=new uUe;return t.end(),t},mUe=()=>new dUe({read(){}}),gUe=()=>new fUe({write(){}}),_Ue=()=>new pUe({read(){},write(){}}),yUe=async(t,e,r)=>Rf(t,e,r);import{createReadStream as hne,createWriteStream as mne}from"fs";import{Buffer as SUe}from"buffer";import{Readable as U_,Writable as EUe,Duplex as vUe}from"stream";var _ne=(t,e)=>Nw(TUe,t,e,!1),F_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${$a[t]}.`)},gne={fileNumber:F_,generator:f$,asyncGenerator:f$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:vUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},TUe={input:{...gne,fileUrl:({value:t})=>({stream:hne(t)}),filePath:({value:{file:t}})=>({stream:hne(t)}),webStream:({value:t})=>({stream:U_.fromWeb(t)}),iterable:({value:t})=>({stream:U_.from(t)}),asyncIterable:({value:t})=>({stream:U_.from(t)}),string:({value:t})=>({stream:U_.from(t)}),uint8Array:({value:t})=>({stream:U_.from(SUe.from(t))})},output:{...gne,fileUrl:({value:t})=>({stream:mne(t)}),filePath:({value:{file:t,append:e}})=>({stream:mne(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:EUe.fromWeb(t)}),iterable:F_,asyncIterable:F_,string:F_,uint8Array:F_}};import{on as bUe,once as yne}from"events";import{PassThrough as AUe,getDefaultHighWaterMark as wUe}from"stream";import{finished as vne}from"stream/promises";function Fl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)y$(i);let e=t.some(({readableObjectMode:i})=>i),r=xUe(t,e),n=new _$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var xUe=(t,e)=>{if(t.length===0)return wUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},_$=class extends AUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(y$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=RUe(this,this.#e,this.#o);let r=PUe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(y$(e),!this.#e.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)}},RUe=async(t,e,r)=>{Fw(t,Sne);let n=new AbortController;try{await Promise.race([CUe(t,n),IUe(t,e,r,n)])}finally{n.abort(),Fw(t,-Sne)}},CUe=async(t,{signal:e})=>{try{await vne(t,{signal:e,cleanup:!0})}catch(r){throw Tne(t,r),r}},IUe=async(t,e,r,{signal:n})=>{for await(let[i]of bUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},y$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},PUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Fw(t,Ene);let a=new AbortController;try{await Promise.race([OUe(o,e,a),NUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),kUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Fw(t,-Ene)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?S$(t):MUe(t))},OUe=async(t,e,{signal:r})=>{try{await t,r.aborted||S$(e)}catch(n){r.aborted||Tne(e,n)}},NUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await vne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;bne(s)?i.add(e):Ane(t,s)}},kUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await yne(t,i,{signal:o}),!t.readable)return yne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},MUe=t=>{t.writable&&t.end()},Tne=(t,e)=>{bne(e)?S$(t):Ane(t,e)},bne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",S$=t=>{(t.readable||t.writable)&&t.destroy()},Ane=(t,e)=>{t.destroyed||(t.once("error",DUe),t.destroy(e))},DUe=()=>{},Fw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Sne=2,Ene=1;import{finished as wne}from"stream/promises";var If=(t,e)=>{t.pipe(e),LUe(t,e),$Ue(t,e)},LUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await wne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}E$(e)}},E$=t=>{t.writable&&t.end()},$Ue=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await wne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}v$(t)}},v$=t=>{t.readable&&t.destroy()};var xne=(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})=>Xn.has(c)))UUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Xn.has(c)))BUe({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]:Fl(o);If(s,i)}},UUe=(t,e,r,n)=>{r==="output"?If(t.stdio[n],e):If(e,t.stdio[n]);let i=FUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},FUe=["stdin","stdout","stderr"],BUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;jUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},jUe=(t,{signal:e})=>{Ci(t)&&Dl(t,zUe,e)},zUe=2;import{addAbortListener as VUe}from"events";var Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Bw=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",T$=Symbol.for("signal-exit emitter"),b$=globalThis,GUe=Object.defineProperty.bind(Object),A$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(b$[T$])return b$[T$];GUe(b$,T$,{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}},jw=class{},qUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),w$=class extends jw{onExit(){return()=>{}}load(){}unload(){}},x$=class extends jw{#e=R$.platform==="win32"?"SIGINT":"SIGHUP";#r=new A$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Bl)this.#i[r]=()=>{let n=this.#t.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.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Bw(this.#t))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 Bl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Bl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Bw(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Bw(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},R$=globalThis.process,{onExit:Rne,load:mTt,unload:gTt}=qUe(Bw(R$)?new x$(R$):new w$);var Cne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Rne(()=>{t.kill()});VUe(n,()=>{i()})};var Pne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=XA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=HUe(r,n,i),{sourceStream:d,sourceError:f}=YUe(t,l),{options:p,fileDescriptors:h}=yo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},HUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=WUe(t,e,...r),a=cw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},WUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ine,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||gL(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]=zA(r,...n);return{destination:e(Ine)(i,o,s),pipeOptions:s}}if(yo.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}`)},Ine=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),YUe=(t,e)=>{try{return{sourceStream:Tf(t,e)}}catch(r){return{sourceError:r}}};var Nne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=KUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw C$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},KUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return v$(t),n;if(e!==void 0)return E$(r),e},C$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>xf({error:t,command:One,escapedCommand:One,fileDescriptors:e,options:r,startTime:n,isSync:!1}),One="source.pipe(destination)";var kne=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 ZUe}from"stream/promises";var Mne=(t,e,r)=>{let n=zw.has(e)?XUe(t,e):JUe(t,e);return Dl(t,eFe,r.signal),Dl(e,tFe,r.signal),QUe(e),n},JUe=(t,e)=>{let r=Fl([t]);return If(r,e),zw.set(e,r),r},XUe=(t,e)=>{let r=zw.get(e);return r.add(t),r},QUe=async t=>{try{await ZUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}zw.delete(t)},zw=new WeakMap,eFe=2,tFe=1;import{aborted as rFe}from"util";var Dne=(t,e)=>t===void 0?[]:[nFe(t,e)],nFe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await rFe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw C$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Gw=(t,...e)=>{if(Ot(e[0]))return Gw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Pne(t,...e),i=iFe({...n,destination:r});return i.pipe=Gw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},iFe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=oFe(t,i);Nne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Mne(e,o,d);return await Promise.race([kne(u),...Dne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},oFe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as fFe}from"timers/promises";import{on as sFe}from"events";import{getDefaultHighWaterMark as aFe}from"stream";var qw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return cFe(e,s),$ne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},cFe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},I$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;lFe(e,s,t);let a=t.readableObjectMode&&!o;return $ne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},lFe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},$ne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=sFe(t,"data",{signal:e.signal,highWaterMark:Lne,highWatermark:Lne});return uFe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},P$=aFe(!0),Lne=P$,uFe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=dFe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ul(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*L_(a)}},dFe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Mw(t,r,!e),kw(t,i,!n,{})].filter(Boolean);var Une=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=pFe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([hFe(t),d]);return}let f=a$(c,r),p=I$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([mFe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},pFe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!$w({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=I$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Kre(a,t,r,o)},hFe=async t=>{await fFe(),t.readableFlowing===null&&t.resume()},mFe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Aw(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ww(r,{maxBuffer:o})):await wf(r,{maxBuffer:o})}catch(a){return Fne(Kte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},O$=async t=>{try{return await t}catch(e){return Fne(e)}},Fne=({bufferedData:t})=>d7(t)?new Uint8Array(t):t;import{finished as gFe}from"stream/promises";var B_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=_Fe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],gFe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||EFe(a,e,r,n)}finally{s.abort()}},_Fe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&yFe(t,r,n),n},yFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{SFe(e,r),n.call(t,...i)}},SFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},EFe=(t,e,r,n)=>{if(!vFe(t,e,r,n))throw t},vFe=(t,e,r,n=!0)=>r.propagating?Bne(t)||Vw(t):(r.propagating=!0,N$(r,e)===n?Bne(t):Vw(t)),N$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Vw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Bne=t=>t?.code==="EPIPE";var jne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>k$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),k$=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=B_(t,e,l);if(N$(l,e)){await u;return}let[d]=await Promise.all([Une({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 zne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fl([t,e].filter(Boolean)):void 0,Gne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>k$({...TFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:bFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),TFe=({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}},bFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as AFe}from"events";var qne=t=>_f(t,"ipc"),Vne=(t,e)=>{let r=JA(t);go({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Hne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=qne(o),a=ys(e,"ipc"),c=ys(r,"ipc");for await(let l of g$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Zte(t,i,c),i.push(l)),s&&Vne(l,o);return i},Wne=async(t,e)=>(await Promise.allSettled([t]),e);var Yne=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:h,originalStreams:m,onInternalError:y,controller:E})=>{let b=ene(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=jne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Gne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),P=[],R=Hne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),N=wFe(m,t,A),k=xFe(h,A);try{return await Promise.race([Promise.all([{},rne(b),Promise.all(S),x,R,Cte(t,d),...N,...k]),y,RFe(t,E),...bte(t,o,f,E),...qee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...vte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},b,Promise.all(S.map(_=>O$(_))),O$(x),Wne(R,P),Promise.allSettled(N),Promise.allSettled(k)])}},wFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:B_(n,i,r)),xFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Oi(o,{checkOpen:!1})&&!Ci(o)).map(({type:i,value:o,stream:s=o})=>B_(s,n,e,{isSameDirection:Xn.has(i),stopOnExit:i==="native"}))),RFe=async(t,{signal:e})=>{let[r]=await AFe(t,"error",{signal:e});throw r};var Kne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),j_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_o();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as CFe}from"stream";import{callbackify as IFe}from"util";import{finished as Zne}from"stream/promises";var M$=async t=>{if(t!==void 0)try{await D$(t)}catch{}},Jne=async t=>{if(t!==void 0)try{await L$(t)}catch{}},D$=async t=>{await Zne(t,{cleanup:!0,readable:!1,writable:!0})},L$=async t=>{await Zne(t,{cleanup:!0,readable:!0,writable:!1})},Hw=async(t,e)=>{if(await t,e)throw e},Ww=(t,e,r)=>{r&&!Vw(r)?t.destroy(r):e&&t.destroy()};var Xne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||En.has(r),{subprocessStdout:a,waitReadableDestroy:c}=$$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=U$(a,s),{read:f,onStdoutDataDone:p}=F$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new CFe({read:f,destroy:IFe(j$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return B$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},$$=(t,e,r)=>{let n=Tf(t,e),i=j_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},U$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:P$},F$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=qw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){PFe(this,s,o)},onStdoutDataDone:o}},PFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},B$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await L$(t),await n,await M$(i),await e,r.readable&&r.push(null)}catch(o){await M$(i),Qne(r,o)}},j$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pf(r,e)&&(Qne(t,n),await Hw(e,n))},Qne=(t,e)=>{Ww(t,t.readable,e)};import{Writable as OFe}from"stream";import{callbackify as eie}from"util";var tie=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=z$(t,r,e),s=new OFe({...G$(n,t,i),destroy:eie(V$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return q$(n,s),s},z$=(t,e,r)=>{let n=cw(t,e),i=j_(r,n,"writableFinal"),o=j_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},G$=(t,e,r)=>({write:NFe.bind(void 0,t),final:eie(kFe.bind(void 0,t,e,r))}),NFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},kFe=async(t,e,r)=>{await Pf(r,e)&&(t.writable&&t.end(),await e)},q$=async(t,e,r)=>{try{await D$(t),e.writable&&e.end()}catch(n){await Jne(r),rie(e,n)}},V$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pf(r,e),await Pf(n,e)&&(rie(t,i),await Hw(e,i))},rie=(t,e)=>{Ww(t,t.writable,e)};import{Duplex as MFe}from"stream";import{callbackify as DFe}from"util";var nie=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||En.has(r),{subprocessStdout:c,waitReadableDestroy:l}=$$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=z$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=U$(c,a),{read:y,onStdoutDataDone:E}=F$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new MFe({read:y,...G$(u,t,d),destroy:DFe(LFe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return B$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),q$(u,b,c),b},LFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([j$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),V$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var H$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||En.has(e),s=Tf(t,r),a=qw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return $Fe(a,s,t)},$Fe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var iie=(t,{encoding:e})=>{let r=Kne();t.readable=Xne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=tie.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=nie.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=H$.bind(void 0,t,e),t[Symbol.asyncIterator]=H$.bind(void 0,t,e,{})};var oie=(t,e)=>{for(let[r,n]of FFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},UFe=(async()=>{})().constructor.prototype,FFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(UFe,t)]);var sie=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=zFe(t,e,r),{subprocess:f,promise:p}=qFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Gw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),oie(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},zFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=QA(t,e,r),{file:a,commandArguments:c,options:l}=Sw(t,e,r),u=GFe(l),d=_ne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},GFe=({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}},qFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=jFe(...Ew(t,e,r))}catch(h){return pne({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;BFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];xne(c,a,l),Cne(c,r,l);let d={},f=_o();c.kill=zee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=zne(c,r),iie(c,r),une(c,r);let p=VFe({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}},VFe=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],h,m,y]=await Yne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((S,x)=>Es(S,e,x)),b=Es(m,e,"all"),A=HFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Rf(A,n,e)},HFe=({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?D_({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 So,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Cw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Yw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,WFe(n,t[n],i)]));return{...t,...r}},WFe=(t,e,r)=>YFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,YFe=new Set(["env",...TL]);var Ua=(t,e,r,n)=>{let i=(s,a,c)=>Ua(s,a,r,c),o=(...s)=>KFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},KFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Yw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=ZFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ine(a,c,l):sie(a,c,l,i)},ZFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=_7(e)?y7(e,r):[e,...r],[s,a,c]=zA(...o),l=Yw(Yw(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 aie=({file:t,commandArguments:e})=>lie(t,e),cie=({file:t,commandArguments:e})=>({...lie(t,e),isSync:!0}),lie=(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]=JFe(t);return{file:r,commandArguments:n}},JFe=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(XFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},XFe=/ +/g;var uie=(t,e,r)=>{t.sync=e(QFe,r),t.s=t.sync},die=({options:t})=>fie(t),QFe=({options:t})=>({...fie(t),isSync:!0}),fie=t=>({options:{...eBe(t),...t}}),eBe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},pie={preferLocal:!0};var hie=Ua(()=>({})),owt=Ua(()=>({isSync:!0})),mie=Ua(aie),swt=Ua(cie),awt=Ua(wte),cwt=Ua(die,{},pie,uie),{sendMessage:lwt,getOneMessage:uwt,getEachMessage:dwt,getCancelSignal:fwt}=dne();var gie=!1,_ie=()=>{gie=!0},vo=()=>gie;var z_=null,yie=t=>(z_&&z_.destroy(),z_=new Ni({totalAllowedTime:t}),z_),Sie=()=>z_;var Ni=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&vo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await kA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ie.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Eie={name:"@netlify/agent-runner-cli",type:"module",version:"1.167.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:opencode":"vitest run test/integration/opencode.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.5","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.2.1","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var iBe=rBe(import.meta.url),oBe=vs.dirname(iBe),sBe=nBe(import.meta.url),Of=ce("shell"),W$=new Set,vie={preferLocal:!0},jt=(t,e,r)=>{let[n,i]=aBe(e,r),o={...vie,...i},s=hie(t,n,o);bie(s,o),xie(s);let a=r?.idleTimeout;return a&&a>0&&wie(s,a),s},Tie=(t,e)=>{let r={...vie,...e},n=mie(t,r);return bie(n,r),xie(n),e?.idleTimeout&&e.idleTimeout>0&&wie(n,e.idleTimeout),n},aBe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},bie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Ts.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new g_).pipe(Ts.stdout),t.stderr?.pipe(new g_).pipe(Ts.stderr);return}t.stdout?.pipe(Ts.stdout),t.stderr?.pipe(Ts.stderr)},Y$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ts.kill(-t.pid,e),Of.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Of.error("Error killing process:",r),!1}},Aie=t=>Y$(t,"SIGKILL"),wie=(t,e)=>{let r=null,n=()=>{Of.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),Y$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Of.log(`Force killing idle process ${t.pid}`),Aie(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},xie=t=>{W$.add(t);let e=Sie();if(e){let r=e.onTimesUp(()=>{Of.log(`Global timer expired, killing process ${t.pid}`),Y$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Of.log(`Force killing process ${t.pid} after timeout`),Aie(t))},5e3)});t.on("exit",()=>{W$.delete(t),r()}),t.on("error",()=>{W$.delete(t),r()})}};function Zw(t,e){return!!ki(t,e)}function ki(t,e){if(!Ts.env.NETLIFY_LOCAL_MODE)try{let i=sBe.resolve(Eie.name),o=vs.dirname(i);for(;o!==vs.dirname(o);){let s=vs.dirname(o);if(vs.basename(s)==="node_modules"){let a=vs.join(s,".bin",e);if(Kw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(Ts.env.NODE_PATH){let i=vs.join(Ts.env.NODE_PATH,".bin",e);if(Kw.existsSync(i))return i}let r=vs.join(t,"node_modules",".bin",e);if(Kw.existsSync(r))return r;let n=vs.join(oBe,"..","node_modules",".bin",e);if(Kw.existsSync(n))return n}var cBe=ce("utils"),lBe=t=>new Promise(e=>{setTimeout(e,t)});var K$=t=>{try{return new URL(t).hostname||null}catch{return null}},Jw=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await lBe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},Fa=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},Rie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):cBe.error("Could not parse JSON",n))}},uBe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():uBe(e)).join(" ");function bs(t,e){e&&t.log(`Skill invoked: ${e}`)}var Xw=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Cie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var Z$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},dBe=1e4,J$=(t,e=dBe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as fBe}from"crypto";import{createReadStream as pBe}from"fs";import Qw from"fs/promises";import kie from"os";import ex from"path";var Iie=ce("repo"),Mie="runner-diffs-",Die=t=>`${Mie}${t}-`,Lie=async t=>{let e=kie.tmpdir(),r;try{r=await Qw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Mie)&&!n.startsWith(Die(t))).map(n=>Qw.rm(ex.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},tn=(t,e={})=>jt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),tx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Iie.info("Getting runner diffs");let n=await mBe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=_Be(o);await yBe(h,r)}Iie.info("Changes after processing"),await Q$(r);let s=await e1(o,r);if(await X$(s,r),i=await gBe(r),!i)return{hasChanges:!1,ignored:s};await tn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Qw.mkdtemp(ex.join(kie.tmpdir(),Die(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:E})=>{let b=ex.join(a,y);await tn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Qw.stat(b);return{path:b,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Nie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await Oie(d,h)||(f=h)}await Nie(r),ie.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Oie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Pie=async t=>{let e=fBe("sha256");for await(let r of pBe(t))e.update(r);return e.digest("hex")},Oie=async(t,e)=>t.size===e.size&&await Pie(t.path)===await Pie(e.path),Nie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await tn(["reset","--soft","HEAD~1"],{cwd:t})},X$=async(t=[],e=process.cwd())=>{await tn(["add",".",...t],{cwd:e})},Q$=async(t=process.cwd())=>{let e=await tn(["status","-s"],{cwd:t});return String(e.stdout??"")},$ie=/.. (.+)?\.log$/,hBe=[$ie],mBe=async(t=process.cwd())=>{let e=await Q$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
136
|
+
if (condition) { yield value; }`)};import{Buffer as S1e}from"buffer";import{StringDecoder as E1e}from"string_decoder";var Mw=(t,e,r)=>{if(r)return;if(t)return{transform:v1e.bind(void 0,new TextEncoder)};let n=new E1e(e);return{transform:T1e.bind(void 0,n),final:b1e.bind(void 0,n)}},v1e=function*(t,e){S1e.isBuffer(e)?yield _s(e):typeof e=="string"?yield t.encode(e):yield e},T1e=function*(t,e){yield Bt(e)?t.write(e):e},b1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as zre}from"util";var u$=zre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Dw=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=w1e}=e[r];for await(let i of n(t))yield*Dw(i,e,r+1)},Gre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*A1e(r,Number(e),t)},A1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Dw(n,r,e+1)},qre=zre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),w1e=function*(t){yield t};var d$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Vre=(t,e)=>[...e.flatMap(r=>[...Ul(r,t,0)]),...L_(t)],Ul=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=R1e}=e[r];for(let i of n(t))yield*Ul(i,e,r+1)},L_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*x1e(r,Number(e),t)},x1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ul(n,r,e+1)},R1e=function*(t){yield t};var f$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Wre(t,s,o),l=$l(e),u=$l(r),d=l?u$.bind(void 0,Dw,a):d$.bind(void 0,Ul),f=l||u?u$.bind(void 0,Gre,a):d$.bind(void 0,L_),p=l||u?qre.bind(void 0,a):void 0;return{stream:new C1e({writableObjectMode:n,writableHighWaterMark:Hre(n),readableObjectMode:i,readableHighWaterMark:Hre(i),transform(m,y,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},Lw=(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=Wre(s,r,a);t=Vre(c,t)}return t},Wre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Fre(n,a)},Mw(r,s,n),kw(r,o,n,c),{transform:t,final:e},{transform:Bre(i,a)},Ure({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Yre=(t,e)=>{for(let r of I1e(t))P1e(t,r,e)},I1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),P1e=(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 ${$a[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>O1e(a,n));r.input=x_(s)},O1e=(t,e)=>{let r=Lw(t,e,"utf8",!0);return N1e(r),x_(r)},N1e=t=>{let e=t.find(r=>typeof r!="string"&&!Bt(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}.`)};import{writeFileSync as L1e,appendFileSync as $1e}from"fs";var $w=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&_f(r,n)&&!En.has(e)&&k1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&M1e.has(o))||t.every(({type:i})=>Xn.has(i))),k1e=t=>t===1||t===2,M1e=new Set(["pipe","overlapped"]),Kre=async(t,e,r,n)=>{for await(let i of t)D1e(e)||Jre(i,r,n)},Zre=(t,e,r)=>{for(let n of t)Jre(n,e,r)},D1e=t=>t._readableState.pipes.length>0,Jre=(t,e,r)=>{let n=JA(t);go({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Xre=({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)=>U1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},U1e=({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=Qte(t,o,d),p=_s(f),{stdioItems:h,objectMode:m}=e[r],y=F1e([p],h,c,n),{serializedResult:E,finalResult:b=E}=B1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});j1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&z1e(E,h,i),A}catch(S){return n.error=S,A}},F1e=(t,e,r,n)=>{try{return Lw(t,e,r,!1)}catch(i){return n.error=i,t}},B1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:x_(t)};let s=p7(t,r);return n[o]?{serializedResult:s,finalResult:l$(s,!i[o],e)}:{serializedResult:s}},j1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!$w({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=l$(t,!1,s);try{Zre(a,e,n)}catch(c){r.error??=c}},z1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Ow.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?$1e(n,t):(r.add(o),L1e(n,t))}};var Qre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Es(e,r,"all")]:Array.isArray(e)?[Es(t,r,"all"),...e]:Bt(t)&&Bt(e)?yL([t,e]):`${t}${e}`};import{once as p$}from"events";var ene=async(t,e)=>{let[r,n]=await G1e(t);return e.isForcefullyTerminated??=!1,[r,n]},G1e=async t=>{let[e,r]=await Promise.allSettled([p$(t,"spawn"),p$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?tne(t):r.value},tne=async t=>{try{return await p$(t,"exit")}catch{return tne(t)}},rne=async t=>{let[e,r]=await t;if(!q1e(e,r)&&h$(e,r))throw new Ii;return[e,r]},q1e=(t,e)=>t===void 0&&e===void 0,h$=(t,e)=>t!==0||e!==null;var nne=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=V1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Xte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},V1e=(t,e,r)=>t!==void 0?t:h$(e,r)?new Ii:void 0;var ine=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=W1e(t,e,r),d=Z1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Rf(d,c,l)},W1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=QA(t,e,r),a=Y1e(r),{file:c,commandArguments:l,options:u}=Sw(t,e,a);K1e(u);let d=Mre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},Y1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,K1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Uw("ipcInput"),t&&Uw("ipc: true"),r&&Uw("detached: true"),n&&Uw("cancelSignal")},Uw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},Z1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=J1e({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}=nne(c,r),{output:h,error:m=l}=Xre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,A)=>Es(b,r,A)),E=Es(Qre(h,r),r,"all");return Q1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:E,options:r,command:n,escapedCommand:i,startTime:a})},J1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Yre(o,r);let a=X1e(r);return H1e(...Ew(t,e,a))}catch(a){return xf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},X1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Rw(e)}),Q1e=({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?Cw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):D_({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{setMaxListeners as BFe}from"events";import{spawn as jFe}from"child_process";import lne from"process";import{once as m$,on as eUe}from"events";var one=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Ef({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:pw(t)}),tUe({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),tUe=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{lw(e,i);let o=La(t,e,r),s=new AbortController;try{return await Promise.race([rUe(o,n,s),nUe(o,r,s),iUe(o,r,s)])}catch(a){throw vf(t),a}finally{s.abort(),uw(e,i)}},rUe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await m$(t,"message",{signal:r});return n}for await(let[n]of eUe(t,"message",{signal:r}))if(e(n))return n},nUe=async(t,e,{signal:r})=>{await m$(t,"disconnect",{signal:r}),Vee(e)},iUe=async(t,e,{signal:r})=>{let[n]=await m$(t,"strict:error",{signal:r});throw sw(n,e)};import{once as ane,on as oUe}from"events";var cne=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>g$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),g$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Ef({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:pw(t)}),lw(e,o);let s=La(t,e,r),a=new AbortController,c={};return sUe(t,s,a),aUe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),cUe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},sUe=async(t,e,r)=>{try{await ane(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},aUe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await ane(t,"strict:error",{signal:r.signal});n.error=sw(i,e),r.abort()}catch{}},cUe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of oUe(r,"message",{signal:o.signal}))sne(s),yield c}catch{sne(s)}finally{o.abort(),uw(e,a),n||vf(t),i&&await t}},sne=({error:t})=>{if(t)throw t};var une=(t,{ipc:e})=>{Object.assign(t,fne(t,!1,e))},dne=()=>{let t=lne,e=!0,r=lne.channel!==void 0;return{...fne(t,e,r),getCancelSignal:yte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},fne=(t,e,r)=>({sendMessage:_w.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:one.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:cne.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as lUe}from"child_process";import{PassThrough as uUe,Readable as dUe,Writable as fUe,Duplex as pUe}from"stream";var pne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{s$(n);let a=new lUe;hUe(a,n),Object.assign(a,{readable:mUe,writable:gUe,duplex:_Ue});let c=xf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=yUe(c,s,i);return{subprocess:a,promise:l}},hUe=(t,e)=>{let r=$_(),n=$_(),i=$_(),o=Array.from({length:e.length-3},$_),s=$_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},$_=()=>{let t=new uUe;return t.end(),t},mUe=()=>new dUe({read(){}}),gUe=()=>new fUe({write(){}}),_Ue=()=>new pUe({read(){},write(){}}),yUe=async(t,e,r)=>Rf(t,e,r);import{createReadStream as hne,createWriteStream as mne}from"fs";import{Buffer as SUe}from"buffer";import{Readable as U_,Writable as EUe,Duplex as vUe}from"stream";var _ne=(t,e)=>Nw(TUe,t,e,!1),F_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${$a[t]}.`)},gne={fileNumber:F_,generator:f$,asyncGenerator:f$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:vUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},TUe={input:{...gne,fileUrl:({value:t})=>({stream:hne(t)}),filePath:({value:{file:t}})=>({stream:hne(t)}),webStream:({value:t})=>({stream:U_.fromWeb(t)}),iterable:({value:t})=>({stream:U_.from(t)}),asyncIterable:({value:t})=>({stream:U_.from(t)}),string:({value:t})=>({stream:U_.from(t)}),uint8Array:({value:t})=>({stream:U_.from(SUe.from(t))})},output:{...gne,fileUrl:({value:t})=>({stream:mne(t)}),filePath:({value:{file:t,append:e}})=>({stream:mne(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:EUe.fromWeb(t)}),iterable:F_,asyncIterable:F_,string:F_,uint8Array:F_}};import{on as bUe,once as yne}from"events";import{PassThrough as AUe,getDefaultHighWaterMark as wUe}from"stream";import{finished as vne}from"stream/promises";function Fl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)y$(i);let e=t.some(({readableObjectMode:i})=>i),r=xUe(t,e),n=new _$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var xUe=(t,e)=>{if(t.length===0)return wUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},_$=class extends AUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(y$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=RUe(this,this.#e,this.#o);let r=PUe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(y$(e),!this.#e.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)}},RUe=async(t,e,r)=>{Fw(t,Sne);let n=new AbortController;try{await Promise.race([CUe(t,n),IUe(t,e,r,n)])}finally{n.abort(),Fw(t,-Sne)}},CUe=async(t,{signal:e})=>{try{await vne(t,{signal:e,cleanup:!0})}catch(r){throw Tne(t,r),r}},IUe=async(t,e,r,{signal:n})=>{for await(let[i]of bUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},y$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},PUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Fw(t,Ene);let a=new AbortController;try{await Promise.race([OUe(o,e,a),NUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),kUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Fw(t,-Ene)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?S$(t):MUe(t))},OUe=async(t,e,{signal:r})=>{try{await t,r.aborted||S$(e)}catch(n){r.aborted||Tne(e,n)}},NUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await vne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;bne(s)?i.add(e):Ane(t,s)}},kUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await yne(t,i,{signal:o}),!t.readable)return yne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},MUe=t=>{t.writable&&t.end()},Tne=(t,e)=>{bne(e)?S$(t):Ane(t,e)},bne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",S$=t=>{(t.readable||t.writable)&&t.destroy()},Ane=(t,e)=>{t.destroyed||(t.once("error",DUe),t.destroy(e))},DUe=()=>{},Fw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Sne=2,Ene=1;import{finished as wne}from"stream/promises";var If=(t,e)=>{t.pipe(e),LUe(t,e),$Ue(t,e)},LUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await wne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}E$(e)}},E$=t=>{t.writable&&t.end()},$Ue=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await wne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}v$(t)}},v$=t=>{t.readable&&t.destroy()};var xne=(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})=>Xn.has(c)))UUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Xn.has(c)))BUe({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]:Fl(o);If(s,i)}},UUe=(t,e,r,n)=>{r==="output"?If(t.stdio[n],e):If(e,t.stdio[n]);let i=FUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},FUe=["stdin","stdout","stderr"],BUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;jUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},jUe=(t,{signal:e})=>{Ci(t)&&Dl(t,zUe,e)},zUe=2;import{addAbortListener as VUe}from"events";var Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Bw=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",T$=Symbol.for("signal-exit emitter"),b$=globalThis,GUe=Object.defineProperty.bind(Object),A$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(b$[T$])return b$[T$];GUe(b$,T$,{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}},jw=class{},qUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),w$=class extends jw{onExit(){return()=>{}}load(){}unload(){}},x$=class extends jw{#e=R$.platform==="win32"?"SIGINT":"SIGHUP";#r=new A$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Bl)this.#i[r]=()=>{let n=this.#t.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.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Bw(this.#t))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 Bl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Bl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Bw(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Bw(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},R$=globalThis.process,{onExit:Rne,load:mTt,unload:gTt}=qUe(Bw(R$)?new x$(R$):new w$);var Cne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Rne(()=>{t.kill()});VUe(n,()=>{i()})};var Pne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=XA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=HUe(r,n,i),{sourceStream:d,sourceError:f}=YUe(t,l),{options:p,fileDescriptors:h}=yo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},HUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=WUe(t,e,...r),a=cw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},WUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ine,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||gL(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]=zA(r,...n);return{destination:e(Ine)(i,o,s),pipeOptions:s}}if(yo.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}`)},Ine=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),YUe=(t,e)=>{try{return{sourceStream:Tf(t,e)}}catch(r){return{sourceError:r}}};var Nne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=KUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw C$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},KUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return v$(t),n;if(e!==void 0)return E$(r),e},C$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>xf({error:t,command:One,escapedCommand:One,fileDescriptors:e,options:r,startTime:n,isSync:!1}),One="source.pipe(destination)";var kne=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 ZUe}from"stream/promises";var Mne=(t,e,r)=>{let n=zw.has(e)?XUe(t,e):JUe(t,e);return Dl(t,eFe,r.signal),Dl(e,tFe,r.signal),QUe(e),n},JUe=(t,e)=>{let r=Fl([t]);return If(r,e),zw.set(e,r),r},XUe=(t,e)=>{let r=zw.get(e);return r.add(t),r},QUe=async t=>{try{await ZUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}zw.delete(t)},zw=new WeakMap,eFe=2,tFe=1;import{aborted as rFe}from"util";var Dne=(t,e)=>t===void 0?[]:[nFe(t,e)],nFe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await rFe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw C$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Gw=(t,...e)=>{if(Ot(e[0]))return Gw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Pne(t,...e),i=iFe({...n,destination:r});return i.pipe=Gw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},iFe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=oFe(t,i);Nne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Mne(e,o,d);return await Promise.race([kne(u),...Dne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},oFe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as fFe}from"timers/promises";import{on as sFe}from"events";import{getDefaultHighWaterMark as aFe}from"stream";var qw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return cFe(e,s),$ne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},cFe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},I$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;lFe(e,s,t);let a=t.readableObjectMode&&!o;return $ne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},lFe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},$ne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=sFe(t,"data",{signal:e.signal,highWaterMark:Lne,highWatermark:Lne});return uFe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},P$=aFe(!0),Lne=P$,uFe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=dFe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ul(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*L_(a)}},dFe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Mw(t,r,!e),kw(t,i,!n,{})].filter(Boolean);var Une=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=pFe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([hFe(t),d]);return}let f=a$(c,r),p=I$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([mFe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},pFe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!$w({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=I$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Kre(a,t,r,o)},hFe=async t=>{await fFe(),t.readableFlowing===null&&t.resume()},mFe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Aw(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await ww(r,{maxBuffer:o})):await wf(r,{maxBuffer:o})}catch(a){return Fne(Kte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},O$=async t=>{try{return await t}catch(e){return Fne(e)}},Fne=({bufferedData:t})=>d7(t)?new Uint8Array(t):t;import{finished as gFe}from"stream/promises";var B_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=_Fe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],gFe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||EFe(a,e,r,n)}finally{s.abort()}},_Fe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&yFe(t,r,n),n},yFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{SFe(e,r),n.call(t,...i)}},SFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},EFe=(t,e,r,n)=>{if(!vFe(t,e,r,n))throw t},vFe=(t,e,r,n=!0)=>r.propagating?Bne(t)||Vw(t):(r.propagating=!0,N$(r,e)===n?Bne(t):Vw(t)),N$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Vw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Bne=t=>t?.code==="EPIPE";var jne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>k$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),k$=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=B_(t,e,l);if(N$(l,e)){await u;return}let[d]=await Promise.all([Une({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 zne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fl([t,e].filter(Boolean)):void 0,Gne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>k$({...TFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:bFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),TFe=({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}},bFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as AFe}from"events";var qne=t=>_f(t,"ipc"),Vne=(t,e)=>{let r=JA(t);go({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Hne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=qne(o),a=ys(e,"ipc"),c=ys(r,"ipc");for await(let l of g$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Zte(t,i,c),i.push(l)),s&&Vne(l,o);return i},Wne=async(t,e)=>(await Promise.allSettled([t]),e);var Yne=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:h,originalStreams:m,onInternalError:y,controller:E})=>{let b=ene(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=jne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Gne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),P=[],R=Hne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),N=wFe(m,t,A),k=xFe(h,A);try{return await Promise.race([Promise.all([{},rne(b),Promise.all(S),x,R,Cte(t,d),...N,...k]),y,RFe(t,E),...bte(t,o,f,E),...qee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...vte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},b,Promise.all(S.map(_=>O$(_))),O$(x),Wne(R,P),Promise.allSettled(N),Promise.allSettled(k)])}},wFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:B_(n,i,r)),xFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Oi(o,{checkOpen:!1})&&!Ci(o)).map(({type:i,value:o,stream:s=o})=>B_(s,n,e,{isSameDirection:Xn.has(i),stopOnExit:i==="native"}))),RFe=async(t,{signal:e})=>{let[r]=await AFe(t,"error",{signal:e});throw r};var Kne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),j_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_o();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Pf=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as CFe}from"stream";import{callbackify as IFe}from"util";import{finished as Zne}from"stream/promises";var M$=async t=>{if(t!==void 0)try{await D$(t)}catch{}},Jne=async t=>{if(t!==void 0)try{await L$(t)}catch{}},D$=async t=>{await Zne(t,{cleanup:!0,readable:!1,writable:!0})},L$=async t=>{await Zne(t,{cleanup:!0,readable:!0,writable:!1})},Hw=async(t,e)=>{if(await t,e)throw e},Ww=(t,e,r)=>{r&&!Vw(r)?t.destroy(r):e&&t.destroy()};var Xne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||En.has(r),{subprocessStdout:a,waitReadableDestroy:c}=$$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=U$(a,s),{read:f,onStdoutDataDone:p}=F$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new CFe({read:f,destroy:IFe(j$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return B$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},$$=(t,e,r)=>{let n=Tf(t,e),i=j_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},U$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:P$},F$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=qw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){PFe(this,s,o)},onStdoutDataDone:o}},PFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},B$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await L$(t),await n,await M$(i),await e,r.readable&&r.push(null)}catch(o){await M$(i),Qne(r,o)}},j$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Pf(r,e)&&(Qne(t,n),await Hw(e,n))},Qne=(t,e)=>{Ww(t,t.readable,e)};import{Writable as OFe}from"stream";import{callbackify as eie}from"util";var tie=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=z$(t,r,e),s=new OFe({...G$(n,t,i),destroy:eie(V$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return q$(n,s),s},z$=(t,e,r)=>{let n=cw(t,e),i=j_(r,n,"writableFinal"),o=j_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},G$=(t,e,r)=>({write:NFe.bind(void 0,t),final:eie(kFe.bind(void 0,t,e,r))}),NFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},kFe=async(t,e,r)=>{await Pf(r,e)&&(t.writable&&t.end(),await e)},q$=async(t,e,r)=>{try{await D$(t),e.writable&&e.end()}catch(n){await Jne(r),rie(e,n)}},V$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Pf(r,e),await Pf(n,e)&&(rie(t,i),await Hw(e,i))},rie=(t,e)=>{Ww(t,t.writable,e)};import{Duplex as MFe}from"stream";import{callbackify as DFe}from"util";var nie=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||En.has(r),{subprocessStdout:c,waitReadableDestroy:l}=$$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=z$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=U$(c,a),{read:y,onStdoutDataDone:E}=F$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new MFe({read:y,...G$(u,t,d),destroy:DFe(LFe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return B$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),q$(u,b,c),b},LFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([j$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),V$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var H$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||En.has(e),s=Tf(t,r),a=qw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return $Fe(a,s,t)},$Fe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var iie=(t,{encoding:e})=>{let r=Kne();t.readable=Xne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=tie.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=nie.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=H$.bind(void 0,t,e),t[Symbol.asyncIterator]=H$.bind(void 0,t,e,{})};var oie=(t,e)=>{for(let[r,n]of FFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},UFe=(async()=>{})().constructor.prototype,FFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(UFe,t)]);var sie=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=zFe(t,e,r),{subprocess:f,promise:p}=qFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Gw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),oie(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},zFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=QA(t,e,r),{file:a,commandArguments:c,options:l}=Sw(t,e,r),u=GFe(l),d=_ne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},GFe=({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}},qFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=jFe(...Ew(t,e,r))}catch(h){return pne({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;BFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];xne(c,a,l),Cne(c,r,l);let d={},f=_o();c.kill=zee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=zne(c,r),iie(c,r),une(c,r);let p=VFe({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}},VFe=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],h,m,y]=await Yne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((S,x)=>Es(S,e,x)),b=Es(m,e,"all"),A=HFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Rf(A,n,e)},HFe=({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?D_({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 So,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Cw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Yw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,WFe(n,t[n],i)]));return{...t,...r}},WFe=(t,e,r)=>YFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,YFe=new Set(["env",...TL]);var Ua=(t,e,r,n)=>{let i=(s,a,c)=>Ua(s,a,r,c),o=(...s)=>KFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},KFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Yw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=ZFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ine(a,c,l):sie(a,c,l,i)},ZFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=_7(e)?y7(e,r):[e,...r],[s,a,c]=zA(...o),l=Yw(Yw(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 aie=({file:t,commandArguments:e})=>lie(t,e),cie=({file:t,commandArguments:e})=>({...lie(t,e),isSync:!0}),lie=(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]=JFe(t);return{file:r,commandArguments:n}},JFe=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(XFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},XFe=/ +/g;var uie=(t,e,r)=>{t.sync=e(QFe,r),t.s=t.sync},die=({options:t})=>fie(t),QFe=({options:t})=>({...fie(t),isSync:!0}),fie=t=>({options:{...eBe(t),...t}}),eBe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},pie={preferLocal:!0};var hie=Ua(()=>({})),owt=Ua(()=>({isSync:!0})),mie=Ua(aie),swt=Ua(cie),awt=Ua(wte),cwt=Ua(die,{},pie,uie),{sendMessage:lwt,getOneMessage:uwt,getEachMessage:dwt,getCancelSignal:fwt}=dne();var gie=!1,_ie=()=>{gie=!0},vo=()=>gie;var z_=null,yie=t=>(z_&&z_.destroy(),z_=new Ni({totalAllowedTime:t}),z_),Sie=()=>z_;var Ni=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&vo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await kA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ie.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var Eie={name:"@netlify/agent-runner-cli",type:"module",version:"1.168.0-alpha.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:opencode":"vitest run test/integration/opencode.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.5","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.2.1","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.12.1",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var iBe=rBe(import.meta.url),oBe=vs.dirname(iBe),sBe=nBe(import.meta.url),Of=ce("shell"),W$=new Set,vie={preferLocal:!0},jt=(t,e,r)=>{let[n,i]=aBe(e,r),o={...vie,...i},s=hie(t,n,o);bie(s,o),xie(s);let a=r?.idleTimeout;return a&&a>0&&wie(s,a),s},Tie=(t,e)=>{let r={...vie,...e},n=mie(t,r);return bie(n,r),xie(n),e?.idleTimeout&&e.idleTimeout>0&&wie(n,e.idleTimeout),n},aBe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},bie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Ts.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new g_).pipe(Ts.stdout),t.stderr?.pipe(new g_).pipe(Ts.stderr);return}t.stdout?.pipe(Ts.stdout),t.stderr?.pipe(Ts.stderr)},Y$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ts.kill(-t.pid,e),Of.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Of.error("Error killing process:",r),!1}},Aie=t=>Y$(t,"SIGKILL"),wie=(t,e)=>{let r=null,n=()=>{Of.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),Y$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Of.log(`Force killing idle process ${t.pid}`),Aie(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},xie=t=>{W$.add(t);let e=Sie();if(e){let r=e.onTimesUp(()=>{Of.log(`Global timer expired, killing process ${t.pid}`),Y$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Of.log(`Force killing process ${t.pid} after timeout`),Aie(t))},5e3)});t.on("exit",()=>{W$.delete(t),r()}),t.on("error",()=>{W$.delete(t),r()})}};function Zw(t,e){return!!ki(t,e)}function ki(t,e){if(!Ts.env.NETLIFY_LOCAL_MODE)try{let i=sBe.resolve(Eie.name),o=vs.dirname(i);for(;o!==vs.dirname(o);){let s=vs.dirname(o);if(vs.basename(s)==="node_modules"){let a=vs.join(s,".bin",e);if(Kw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(Ts.env.NODE_PATH){let i=vs.join(Ts.env.NODE_PATH,".bin",e);if(Kw.existsSync(i))return i}let r=vs.join(t,"node_modules",".bin",e);if(Kw.existsSync(r))return r;let n=vs.join(oBe,"..","node_modules",".bin",e);if(Kw.existsSync(n))return n}var cBe=ce("utils"),lBe=t=>new Promise(e=>{setTimeout(e,t)});var K$=t=>{try{return new URL(t).hostname||null}catch{return null}},Jw=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await lBe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},Fa=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},Rie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):cBe.error("Could not parse JSON",n))}},uBe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():uBe(e)).join(" ");function bs(t,e){e&&t.log(`Skill invoked: ${e}`)}var Xw=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Cie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var Z$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},dBe=1e4,J$=(t,e=dBe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as fBe}from"crypto";import{createReadStream as pBe}from"fs";import Qw from"fs/promises";import kie from"os";import ex from"path";var Iie=ce("repo"),Mie="runner-diffs-",Die=t=>`${Mie}${t}-`,Lie=async t=>{let e=kie.tmpdir(),r;try{r=await Qw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Mie)&&!n.startsWith(Die(t))).map(n=>Qw.rm(ex.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},tn=(t,e={})=>jt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),tx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Iie.info("Getting runner diffs");let n=await mBe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=_Be(o);await yBe(h,r)}Iie.info("Changes after processing"),await Q$(r);let s=await e1(o,r);if(await X$(s,r),i=await gBe(r),!i)return{hasChanges:!1,ignored:s};await tn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Qw.mkdtemp(ex.join(kie.tmpdir(),Die(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:E})=>{let b=ex.join(a,y);await tn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Qw.stat(b);return{path:b,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Nie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await Oie(d,h)||(f=h)}await Nie(r),ie.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Oie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Pie=async t=>{let e=fBe("sha256");for await(let r of pBe(t))e.update(r);return e.digest("hex")},Oie=async(t,e)=>t.size===e.size&&await Pie(t.path)===await Pie(e.path),Nie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await tn(["reset","--soft","HEAD~1"],{cwd:t})},X$=async(t=[],e=process.cwd())=>{await tn(["add",".",...t],{cwd:e})},Q$=async(t=process.cwd())=>{let e=await tn(["status","-s"],{cwd:t});return String(e.stdout??"")},$ie=/.. (.+)?\.log$/,hBe=[$ie],mBe=async(t=process.cwd())=>{let e=await Q$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
137
137
|
`).filter(i=>hBe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},gBe=async(t=process.cwd())=>{try{return await tn(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},G_=async(t=process.cwd())=>{let{stdout:e}=await tn(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Uie=async(t=process.cwd())=>{let{stdout:e}=await tn(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},e1=async(t,e=process.cwd())=>{t||=await Q$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
|
|
138
138
|
`).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${ex.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match($ie)?.[1];o&&n.push(`:!${o}.log`)}),n},Fie=async(t=process.cwd())=>{await tn(["reset","--hard","HEAD"],{cwd:t})},Bie=async(t=process.cwd())=>{let e=await tn(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
|
|
139
139
|
`).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},_Be=t=>{let e=t.split(`
|