@netlify/agent-runner-cli 1.165.0 → 1.166.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 +2 -1
- package/dist/bin.js +20 -19
- package/dist/index.js +2 -1
- package/package.json +2 -2
package/dist/bin-local.js
CHANGED
|
@@ -112,7 +112,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
112
112
|
`,LF:`
|
|
113
113
|
`,concatBytes:o$},s1e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},a1e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:s1e};import{Buffer as c1e}from"buffer";var Fre=(t,e)=>t?void 0:l1e.bind(void 0,e),l1e=function*(t,e){if(typeof e!="string"&&!zt(e)&&!c1e.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?u1e.bind(void 0,e):d1e.bind(void 0,e),u1e=function*(t,e){jre(t,e),yield e},d1e=function*(t,e){if(jre(t,e),typeof e!="string"&&!zt(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}\`.
|
|
114
114
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
115
|
-
if (condition) { yield value; }`)};import{Buffer as f1e}from"buffer";import{StringDecoder as p1e}from"string_decoder";var Dw=(t,e,r)=>{if(r)return;if(t)return{transform:h1e.bind(void 0,new TextEncoder)};let n=new p1e(e);return{transform:m1e.bind(void 0,n),final:g1e.bind(void 0,n)}},h1e=function*(t,e){f1e.isBuffer(e)?yield _s(e):typeof e=="string"?yield t.encode(e):yield e},m1e=function*(t,e){yield zt(e)?t.write(e):e},g1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as zre}from"util";var a$=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}}),Lw=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=y1e}=e[r];for await(let i of n(t))yield*Lw(i,e,r+1)},Gre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_1e(r,Number(e),t)},_1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Lw(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}),y1e=function*(t){yield t};var c$=(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=>[...Fl(r,t,0)]),...$_(t)],Fl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=E1e}=e[r];for(let i of n(t))yield*Fl(i,e,r+1)},$_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*S1e(r,Number(e),t)},S1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Fl(n,r,e+1)},E1e=function*(t){yield t};var l$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Wre(t,s,o),l=Ul(e),u=Ul(r),d=l?a$.bind(void 0,Lw,a):c$.bind(void 0,Fl),f=l||u?a$.bind(void 0,Gre,a):c$.bind(void 0,$_),p=l||u?qre.bind(void 0,a):void 0;return{stream:new v1e({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})}},$w=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=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)},Dw(r,s,n),Mw(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 b1e(t))T1e(t,r,e)},b1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),T1e=(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=>A1e(a,n));r.input=R_(s)},A1e=(t,e)=>{let r=$w(t,e,"utf8",!0);return w1e(r),R_(r)},w1e=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 I1e,appendFileSync as P1e}from"fs";var Uw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&yf(r,n)&&!En.has(e)&&x1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&R1e.has(o))||t.every(({type:i})=>Qn.has(i))),x1e=t=>t===1||t===2,R1e=new Set(["pipe","overlapped"]),Kre=async(t,e,r,n)=>{for await(let i of t)C1e(e)||Jre(i,r,n)},Zre=(t,e,r)=>{for(let n of t)Jre(n,e,r)},C1e=t=>t._readableState.pipes.length>0,Jre=(t,e,r)=>{let n=XA(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)=>O1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},O1e=({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=N1e([p],h,c,n),{serializedResult:E,finalResult:T=E}=k1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});M1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?T:void 0;try{return n.error===void 0&&D1e(E,h,i),A}catch(S){return n.error=S,A}},N1e=(t,e,r,n)=>{try{return $w(t,e,r,!1)}catch(i){return n.error=i,t}},k1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:R_(t)};let s=p7(t,r);return n[o]?{serializedResult:s,finalResult:s$(s,!i[o],e)}:{serializedResult:s}},M1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Uw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=s$(t,!1,s);try{Zre(a,e,n)}catch(c){r.error??=c}},D1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Nw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?P1e(n,t):(r.add(o),I1e(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]:zt(t)&&zt(e)?mL([t,e]):`${t}${e}`};import{once as u$}from"events";var ene=async(t,e)=>{let[r,n]=await L1e(t);return e.isForcefullyTerminated??=!1,[r,n]},L1e=async t=>{let[e,r]=await Promise.allSettled([u$(t,"spawn"),u$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?tne(t):r.value},tne=async t=>{try{return await u$(t,"exit")}catch{return tne(t)}},rne=async t=>{let[e,r]=await t;if(!$1e(e,r)&&d$(e,r))throw new Pi;return[e,r]},$1e=(t,e)=>t===void 0&&e===void 0,d$=(t,e)=>t!==0||e!==null;var nne=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=U1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Xte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},U1e=(t,e,r)=>t!==void 0?t:d$(e,r)?new Pi:void 0;var ine=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=B1e(t,e,r),d=G1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cf(d,c,l)},B1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ew(t,e,r),a=j1e(r),{file:c,commandArguments:l,options:u}=Ew(t,e,a);z1e(u);let d=Mre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},j1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,z1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Fw("ipcInput"),t&&Fw("ipc: true"),r&&Fw("detached: true"),n&&Fw("cancelSignal")},Fw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},G1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=q1e({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((T,A)=>Es(T,r,A)),E=Es(Qre(h,r),r,"all");return H1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:E,options:r,command:n,escapedCommand:i,startTime:a})},q1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Yre(o,r);let a=V1e(r);return F1e(...vw(t,e,a))}catch(a){return Rf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},V1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Cw(e)}),H1e=({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?Iw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):L_({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 kFe}from"events";import{spawn as MFe}from"child_process";import lne from"process";import{once as f$,on as W1e}from"events";var one=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(vf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:hw(t)}),Y1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Y1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{uw(e,i);let o=La(t,e,r),s=new AbortController;try{return await Promise.race([K1e(o,n,s),Z1e(o,r,s),J1e(o,r,s)])}catch(a){throw bf(t),a}finally{s.abort(),dw(e,i)}},K1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await f$(t,"message",{signal:r});return n}for await(let[n]of W1e(t,"message",{signal:r}))if(e(n))return n},Z1e=async(t,e,{signal:r})=>{await f$(t,"disconnect",{signal:r}),Vee(e)},J1e=async(t,e,{signal:r})=>{let[n]=await f$(t,"strict:error",{signal:r});throw aw(n,e)};import{once as ane,on as X1e}from"events";var cne=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>p$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),p$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{vf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:hw(t)}),uw(e,o);let s=La(t,e,r),a=new AbortController,c={};return Q1e(t,s,a),eUe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),tUe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Q1e=async(t,e,r)=>{try{await ane(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},eUe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await ane(t,"strict:error",{signal:r.signal});n.error=aw(i,e),r.abort()}catch{}},tUe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of X1e(r,"message",{signal:o.signal}))sne(s),yield c}catch{sne(s)}finally{o.abort(),dw(e,a),n||bf(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:yw.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 rUe}from"child_process";import{PassThrough as nUe,Readable as iUe,Writable as oUe,Duplex as sUe}from"stream";var pne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{n$(n);let a=new rUe;aUe(a,n),Object.assign(a,{readable:cUe,writable:lUe,duplex:uUe});let c=Rf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=dUe(c,s,i);return{subprocess:a,promise:l}},aUe=(t,e)=>{let r=U_(),n=U_(),i=U_(),o=Array.from({length:e.length-3},U_),s=U_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},U_=()=>{let t=new nUe;return t.end(),t},cUe=()=>new iUe({read(){}}),lUe=()=>new oUe({write(){}}),uUe=()=>new sUe({read(){},write(){}}),dUe=async(t,e,r)=>Cf(t,e,r);import{createReadStream as hne,createWriteStream as mne}from"fs";import{Buffer as fUe}from"buffer";import{Readable as F_,Writable as pUe,Duplex as hUe}from"stream";var _ne=(t,e)=>kw(mUe,t,e,!1),B_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${$a[t]}.`)},gne={fileNumber:B_,generator:l$,asyncGenerator:l$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:hUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},mUe={input:{...gne,fileUrl:({value:t})=>({stream:hne(t)}),filePath:({value:{file:t}})=>({stream:hne(t)}),webStream:({value:t})=>({stream:F_.fromWeb(t)}),iterable:({value:t})=>({stream:F_.from(t)}),asyncIterable:({value:t})=>({stream:F_.from(t)}),string:({value:t})=>({stream:F_.from(t)}),uint8Array:({value:t})=>({stream:F_.from(fUe.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:pUe.fromWeb(t)}),iterable:B_,asyncIterable:B_,string:B_,uint8Array:B_}};import{on as gUe,once as yne}from"events";import{PassThrough as _Ue,getDefaultHighWaterMark as yUe}from"stream";import{finished as vne}from"stream/promises";function Bl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)m$(i);let e=t.some(({readableObjectMode:i})=>i),r=SUe(t,e),n=new h$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var SUe=(t,e)=>{if(t.length===0)return yUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},h$=class extends _Ue{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(m$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=EUe(this,this.#e,this.#o);let r=TUe({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(m$(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)}},EUe=async(t,e,r)=>{Bw(t,Sne);let n=new AbortController;try{await Promise.race([vUe(t,n),bUe(t,e,r,n)])}finally{n.abort(),Bw(t,-Sne)}},vUe=async(t,{signal:e})=>{try{await vne(t,{signal:e,cleanup:!0})}catch(r){throw bne(t,r),r}},bUe=async(t,e,r,{signal:n})=>{for await(let[i]of gUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},m$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},TUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Bw(t,Ene);let a=new AbortController;try{await Promise.race([AUe(o,e,a),wUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),xUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Bw(t,-Ene)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?g$(t):RUe(t))},AUe=async(t,e,{signal:r})=>{try{await t,r.aborted||g$(e)}catch(n){r.aborted||bne(e,n)}},wUe=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;Tne(s)?i.add(e):Ane(t,s)}},xUe=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)},RUe=t=>{t.writable&&t.end()},bne=(t,e)=>{Tne(e)?g$(t):Ane(t,e)},Tne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",g$=t=>{(t.readable||t.writable)&&t.destroy()},Ane=(t,e)=>{t.destroyed||(t.once("error",CUe),t.destroy(e))},CUe=()=>{},Bw=(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 Pf=(t,e)=>{t.pipe(e),IUe(t,e),PUe(t,e)},IUe=async(t,e)=>{if(!(Ii(t)||Ii(e))){try{await wne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}_$(e)}},_$=t=>{t.writable&&t.end()},PUe=async(t,e)=>{if(!(Ii(t)||Ii(e))){try{await wne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}y$(t)}},y$=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})=>Qn.has(c)))OUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Qn.has(c)))kUe({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]:Bl(o);Pf(s,i)}},OUe=(t,e,r,n)=>{r==="output"?Pf(t.stdio[n],e):Pf(e,t.stdio[n]);let i=NUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},NUe=["stdin","stdout","stderr"],kUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;MUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},MUe=(t,{signal:e})=>{Ii(t)&&Ll(t,DUe,e)},DUe=2;import{addAbortListener as UUe}from"events";var jl=[];jl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&jl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var jw=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",S$=Symbol.for("signal-exit emitter"),E$=globalThis,LUe=Object.defineProperty.bind(Object),v$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(E$[S$])return E$[S$];LUe(E$,S$,{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}},zw=class{},$Ue=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),b$=class extends zw{onExit(){return()=>{}}load(){}unload(){}},T$=class extends zw{#e=A$.platform==="win32"?"SIGINT":"SIGHUP";#r=new v$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of jl)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(!jw(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 jl)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,jl.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 jw(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"&&jw(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)}},A$=globalThis.process,{onExit:Rne,load:abt,unload:cbt}=$Ue(jw(A$)?new T$(A$):new b$);var Cne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Rne(()=>{t.kill()});UUe(n,()=>{i()})};var Pne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=QA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=FUe(r,n,i),{sourceStream:d,sourceError:f}=jUe(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}},FUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=BUe(t,e,...r),a=lw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},BUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ine,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||pL(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]=GA(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}}),jUe=(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=zUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw w$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},zUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return y$(t),n;if(e!==void 0)return _$(r),e},w$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Rf({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 GUe}from"stream/promises";var Mne=(t,e,r)=>{let n=Gw.has(e)?VUe(t,e):qUe(t,e);return Ll(t,WUe,r.signal),Ll(e,YUe,r.signal),HUe(e),n},qUe=(t,e)=>{let r=Bl([t]);return Pf(r,e),Gw.set(e,r),r},VUe=(t,e)=>{let r=Gw.get(e);return r.add(t),r},HUe=async t=>{try{await GUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Gw.delete(t)},Gw=new WeakMap,WUe=2,YUe=1;import{aborted as KUe}from"util";var Dne=(t,e)=>t===void 0?[]:[ZUe(t,e)],ZUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await KUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw w$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var qw=(t,...e)=>{if(Nt(e[0]))return qw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Pne(t,...e),i=JUe({...n,destination:r});return i.pipe=qw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},JUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=XUe(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()}},XUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as oFe}from"timers/promises";import{on as QUe}from"events";import{getDefaultHighWaterMark as eFe}from"stream";var Vw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return tFe(e,s),$ne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},tFe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},x$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;rFe(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})},rFe=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=QUe(t,"data",{signal:e.signal,highWaterMark:Lne,highWatermark:Lne});return nFe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},R$=eFe(!0),Lne=R$,nFe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=iFe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Fl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*$_(a)}},iFe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Dw(t,r,!e),Mw(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=sFe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([aFe(t),d]);return}let f=i$(c,r),p=x$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([cFe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},sFe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Uw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=x$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Kre(a,t,r,o)},aFe=async t=>{await oFe(),t.readableFlowing===null&&t.resume()},cFe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await ww(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await xw(r,{maxBuffer:o})):await xf(r,{maxBuffer:o})}catch(a){return Fne(Kte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},C$=async t=>{try{return await t}catch(e){return Fne(e)}},Fne=({bufferedData:t})=>d7(t)?new Uint8Array(t):t;import{finished as lFe}from"stream/promises";var j_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=uFe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],lFe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||pFe(a,e,r,n)}finally{s.abort()}},uFe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&dFe(t,r,n),n},dFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{fFe(e,r),n.call(t,...i)}},fFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},pFe=(t,e,r,n)=>{if(!hFe(t,e,r,n))throw t},hFe=(t,e,r,n=!0)=>r.propagating?Bne(t)||Hw(t):(r.propagating=!0,I$(r,e)===n?Bne(t):Hw(t)),I$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Hw=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)=>P$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),P$=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=j_(t,e,l);if(I$(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)?Bl([t,e].filter(Boolean)):void 0,Gne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>P$({...mFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:gFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),mFe=({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}},gFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as _Fe}from"events";var qne=t=>yf(t,"ipc"),Vne=(t,e)=>{let r=XA(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 p$({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 T=ene(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:T,propagating:!1},S=jne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=Gne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),P=[],O=Hne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),N=yFe(m,t,A),C=SFe(h,A);try{return await Promise.race([Promise.all([{},rne(T),Promise.all(S),R,O,Cte(t,d),...N,...C]),y,EFe(t,E),...Tte(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(L){return f.terminationReason??="other",Promise.all([{error:L},T,Promise.all(S.map(_=>C$(_))),C$(R),Wne(O,P),Promise.allSettled(N),Promise.allSettled(C)])}},yFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:j_(n,i,r)),SFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ni(o,{checkOpen:!1})&&!Ii(o)).map(({type:i,value:o,stream:s=o})=>j_(s,n,e,{isSameDirection:Qn.has(i),stopOnExit:i==="native"}))),EFe=async(t,{signal:e})=>{let[r]=await _Fe(t,"error",{signal:e});throw r};var Kne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(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}},Of=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 vFe}from"stream";import{callbackify as bFe}from"util";import{finished as Zne}from"stream/promises";var O$=async t=>{if(t!==void 0)try{await N$(t)}catch{}},Jne=async t=>{if(t!==void 0)try{await k$(t)}catch{}},N$=async t=>{await Zne(t,{cleanup:!0,readable:!1,writable:!0})},k$=async t=>{await Zne(t,{cleanup:!0,readable:!0,writable:!1})},Ww=async(t,e)=>{if(await t,e)throw e},Yw=(t,e,r)=>{r&&!Hw(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}=M$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=D$(a,s),{read:f,onStdoutDataDone:p}=L$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new vFe({read:f,destroy:bFe(U$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return $$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},M$=(t,e,r)=>{let n=Tf(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},D$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:R$},L$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=Vw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){TFe(this,s,o)},onStdoutDataDone:o}},TFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},$$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await k$(t),await n,await O$(i),await e,r.readable&&r.push(null)}catch(o){await O$(i),Qne(r,o)}},U$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Of(r,e)&&(Qne(t,n),await Ww(e,n))},Qne=(t,e)=>{Yw(t,t.readable,e)};import{Writable as AFe}from"stream";import{callbackify as eie}from"util";var tie=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=F$(t,r,e),s=new AFe({...B$(n,t,i),destroy:eie(z$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return j$(n,s),s},F$=(t,e,r)=>{let n=lw(t,e),i=z_(r,n,"writableFinal"),o=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},B$=(t,e,r)=>({write:wFe.bind(void 0,t),final:eie(xFe.bind(void 0,t,e,r))}),wFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},xFe=async(t,e,r)=>{await Of(r,e)&&(t.writable&&t.end(),await e)},j$=async(t,e,r)=>{try{await N$(t),e.writable&&e.end()}catch(n){await Jne(r),rie(e,n)}},z$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Of(r,e),await Of(n,e)&&(rie(t,i),await Ww(e,i))},rie=(t,e)=>{Yw(t,t.writable,e)};import{Duplex as RFe}from"stream";import{callbackify as CFe}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}=M$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=F$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=D$(c,a),{read:y,onStdoutDataDone:E}=L$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),T=new RFe({read:y,...B$(u,t,d),destroy:CFe(IFe.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 $$({subprocessStdout:c,onStdoutDataDone:E,readable:T,subprocess:t,subprocessStdin:u}),j$(u,T,c),T},IFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([U$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),z$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var G$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||En.has(e),s=Tf(t,r),a=Vw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return PFe(a,s,t)},PFe=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=G$.bind(void 0,t,e),t[Symbol.asyncIterator]=G$.bind(void 0,t,e,{})};var oie=(t,e)=>{for(let[r,n]of NFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},OFe=(async()=>{})().constructor.prototype,NFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(OFe,t)]);var sie=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=DFe(t,e,r),{subprocess:f,promise:p}=$Fe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=qw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),oie(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},DFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ew(t,e,r),{file:a,commandArguments:c,options:l}=Ew(t,e,r),u=LFe(l),d=_ne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},LFe=({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}},$Fe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=MFe(...vw(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;kFe(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=UFe({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}},UFe=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,R)=>Es(S,e,R)),T=Es(m,e,"all"),A=FFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:T,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cf(A,n,e)},FFe=({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?L_({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}):Iw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Kw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,BFe(n,t[n],i)]));return{...t,...r}},BFe=(t,e,r)=>jFe.has(t)&&Nt(e)&&Nt(r)?{...e,...r}:r,jFe=new Set(["env",...SL]);var Ua=(t,e,r,n)=>{let i=(s,a,c)=>Ua(s,a,r,c),o=(...s)=>zFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},zFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Nt(o))return i(t,Kw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=GFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ine(a,c,l):sie(a,c,l,i)},GFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=_7(e)?y7(e,r):[e,...r],[s,a,c]=GA(...o),l=Kw(Kw(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]=qFe(t);return{file:r,commandArguments:n}},qFe=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(VFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},VFe=/ +/g;var uie=(t,e,r)=>{t.sync=e(HFe,r),t.s=t.sync},die=({options:t})=>fie(t),HFe=({options:t})=>({...fie(t),isSync:!0}),fie=t=>({options:{...WFe(t),...t}}),WFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},pie={preferLocal:!0};var hie=Ua(()=>({})),JAt=Ua(()=>({isSync:!0})),mie=Ua(aie),XAt=Ua(cie),QAt=Ua(wte),ewt=Ua(die,{},pie,uie),{sendMessage:twt,getOneMessage:rwt,getEachMessage:nwt,getCancelSignal:iwt}=dne();var gie=!1,_ie=()=>{gie=!0},vo=()=>gie;var G_=null,yie=t=>(G_&&G_.destroy(),G_=new bo({totalAllowedTime:t}),G_),Sie=()=>G_;var bo=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 MA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{se.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.165.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.1.5","@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 JFe=KFe(import.meta.url),XFe=vs.dirname(JFe),QFe=ZFe(import.meta.url),Nf=ue("shell"),q$=new Set,vie={preferLocal:!0},Gt=(t,e,r)=>{let[n,i]=eBe(e,r),o={...vie,...i},s=hie(t,n,o);Tie(s,o),xie(s);let a=r?.idleTimeout;return a&&a>0&&wie(s,a),s},bie=(t,e)=>{let r={...vie,...e},n=mie(t,r);return Tie(n,r),xie(n),e?.idleTimeout&&e.idleTimeout>0&&wie(n,e.idleTimeout),n},eBe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Tie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(bs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new __).pipe(bs.stdout),t.stderr?.pipe(new __).pipe(bs.stderr);return}t.stdout?.pipe(bs.stdout),t.stderr?.pipe(bs.stderr)},V$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(bs.kill(-t.pid,e),Nf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Nf.error("Error killing process:",r),!1}},Aie=t=>V$(t,"SIGKILL"),wie=(t,e)=>{let r=null,n=()=>{Nf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),V$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Nf.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=>{q$.add(t);let e=Sie();if(e){let r=e.onTimesUp(()=>{Nf.log(`Global timer expired, killing process ${t.pid}`),V$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Nf.log(`Force killing process ${t.pid} after timeout`),Aie(t))},5e3)});t.on("exit",()=>{q$.delete(t),r()}),t.on("error",()=>{q$.delete(t),r()})}};function Jw(t,e){return!!ki(t,e)}function ki(t,e){if(!bs.env.NETLIFY_LOCAL_MODE)try{let i=QFe.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(Zw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(bs.env.NODE_PATH){let i=vs.join(bs.env.NODE_PATH,".bin",e);if(Zw.existsSync(i))return i}let r=vs.join(t,"node_modules",".bin",e);if(Zw.existsSync(r))return r;let n=vs.join(XFe,"..","node_modules",".bin",e);if(Zw.existsSync(n))return n}var tBe=ue("utils"),rBe=t=>new Promise(e=>{setTimeout(e,t)});var H$=t=>{try{return new URL(t).hostname||null}catch{return null}},Xw=(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 rBe(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):tBe.error("Could not parse JSON",n))}},nBe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():nBe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Qw=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 W$=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}},iBe=1e4,Y$=(t,e=iBe)=>{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 oBe}from"crypto";import{createReadStream as sBe}from"fs";import ex from"fs/promises";import kie from"os";import tx from"path";var Iie=ue("repo"),Mie="runner-diffs-",Die=t=>`${Mie}${t}-`,Lie=async t=>{let e=kie.tmpdir(),r;try{r=await ex.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Mie)&&!n.startsWith(Die(t))).map(n=>ex.rm(tx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},tn=(t,e={})=>Gt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),rx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Iie.info("Getting runner diffs");let n=await cBe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=uBe(o);await dBe(h,r)}Iie.info("Changes after processing"),await Z$(r);let s=await J$(o,r);if(await K$(s,r),i=await lBe(r),!i)return{hasChanges:!1,ignored:s};await tn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await ex.mkdtemp(tx.join(kie.tmpdir(),Die(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:E})=>{let T=tx.join(a,y);await tn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${T}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await ex.stat(T);return{path:T,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),se.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=oBe("sha256");for await(let r of sBe(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})},K$=async(t=[],e=process.cwd())=>{await tn(["add",".",...t],{cwd:e})},Z$=async(t=process.cwd())=>{let e=await tn(["status","-s"],{cwd:t});return String(e.stdout??"")},$ie=/.. (.+)?\.log$/,aBe=[$ie],cBe=async(t=process.cwd())=>{let e=await Z$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
115
|
+
if (condition) { yield value; }`)};import{Buffer as f1e}from"buffer";import{StringDecoder as p1e}from"string_decoder";var Dw=(t,e,r)=>{if(r)return;if(t)return{transform:h1e.bind(void 0,new TextEncoder)};let n=new p1e(e);return{transform:m1e.bind(void 0,n),final:g1e.bind(void 0,n)}},h1e=function*(t,e){f1e.isBuffer(e)?yield _s(e):typeof e=="string"?yield t.encode(e):yield e},m1e=function*(t,e){yield zt(e)?t.write(e):e},g1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as zre}from"util";var a$=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}}),Lw=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=y1e}=e[r];for await(let i of n(t))yield*Lw(i,e,r+1)},Gre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*_1e(r,Number(e),t)},_1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Lw(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}),y1e=function*(t){yield t};var c$=(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=>[...Fl(r,t,0)]),...$_(t)],Fl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=E1e}=e[r];for(let i of n(t))yield*Fl(i,e,r+1)},$_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*S1e(r,Number(e),t)},S1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Fl(n,r,e+1)},E1e=function*(t){yield t};var l$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Wre(t,s,o),l=Ul(e),u=Ul(r),d=l?a$.bind(void 0,Lw,a):c$.bind(void 0,Fl),f=l||u?a$.bind(void 0,Gre,a):c$.bind(void 0,$_),p=l||u?qre.bind(void 0,a):void 0;return{stream:new v1e({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})}},$w=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=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)},Dw(r,s,n),Mw(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 b1e(t))T1e(t,r,e)},b1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),T1e=(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=>A1e(a,n));r.input=R_(s)},A1e=(t,e)=>{let r=$w(t,e,"utf8",!0);return w1e(r),R_(r)},w1e=t=>{let e=t.find(r=>typeof r!="string"&&!zt(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 I1e,appendFileSync as P1e}from"fs";var Uw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&yf(r,n)&&!En.has(e)&&x1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&R1e.has(o))||t.every(({type:i})=>Qn.has(i))),x1e=t=>t===1||t===2,R1e=new Set(["pipe","overlapped"]),Kre=async(t,e,r,n)=>{for await(let i of t)C1e(e)||Jre(i,r,n)},Zre=(t,e,r)=>{for(let n of t)Jre(n,e,r)},C1e=t=>t._readableState.pipes.length>0,Jre=(t,e,r)=>{let n=XA(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)=>O1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},O1e=({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=N1e([p],h,c,n),{serializedResult:E,finalResult:T=E}=k1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});M1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?T:void 0;try{return n.error===void 0&&D1e(E,h,i),A}catch(S){return n.error=S,A}},N1e=(t,e,r,n)=>{try{return $w(t,e,r,!1)}catch(i){return n.error=i,t}},k1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:R_(t)};let s=p7(t,r);return n[o]?{serializedResult:s,finalResult:s$(s,!i[o],e)}:{serializedResult:s}},M1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Uw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=s$(t,!1,s);try{Zre(a,e,n)}catch(c){r.error??=c}},D1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Nw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?P1e(n,t):(r.add(o),I1e(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]:zt(t)&&zt(e)?mL([t,e]):`${t}${e}`};import{once as u$}from"events";var ene=async(t,e)=>{let[r,n]=await L1e(t);return e.isForcefullyTerminated??=!1,[r,n]},L1e=async t=>{let[e,r]=await Promise.allSettled([u$(t,"spawn"),u$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?tne(t):r.value},tne=async t=>{try{return await u$(t,"exit")}catch{return tne(t)}},rne=async t=>{let[e,r]=await t;if(!$1e(e,r)&&d$(e,r))throw new Pi;return[e,r]},$1e=(t,e)=>t===void 0&&e===void 0,d$=(t,e)=>t!==0||e!==null;var nne=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=U1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Xte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},U1e=(t,e,r)=>t!==void 0?t:d$(e,r)?new Pi:void 0;var ine=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=B1e(t,e,r),d=G1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cf(d,c,l)},B1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ew(t,e,r),a=j1e(r),{file:c,commandArguments:l,options:u}=Ew(t,e,a);z1e(u);let d=Mre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},j1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,z1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Fw("ipcInput"),t&&Fw("ipc: true"),r&&Fw("detached: true"),n&&Fw("cancelSignal")},Fw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},G1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=q1e({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((T,A)=>Es(T,r,A)),E=Es(Qre(h,r),r,"all");return H1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:E,options:r,command:n,escapedCommand:i,startTime:a})},q1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Yre(o,r);let a=V1e(r);return F1e(...vw(t,e,a))}catch(a){return Rf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},V1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:Cw(e)}),H1e=({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?Iw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):L_({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 kFe}from"events";import{spawn as MFe}from"child_process";import lne from"process";import{once as f$,on as W1e}from"events";var one=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(vf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:hw(t)}),Y1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),Y1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{uw(e,i);let o=La(t,e,r),s=new AbortController;try{return await Promise.race([K1e(o,n,s),Z1e(o,r,s),J1e(o,r,s)])}catch(a){throw bf(t),a}finally{s.abort(),dw(e,i)}},K1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await f$(t,"message",{signal:r});return n}for await(let[n]of W1e(t,"message",{signal:r}))if(e(n))return n},Z1e=async(t,e,{signal:r})=>{await f$(t,"disconnect",{signal:r}),Vee(e)},J1e=async(t,e,{signal:r})=>{let[n]=await f$(t,"strict:error",{signal:r});throw aw(n,e)};import{once as ane,on as X1e}from"events";var cne=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>p$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),p$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{vf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:hw(t)}),uw(e,o);let s=La(t,e,r),a=new AbortController,c={};return Q1e(t,s,a),eUe({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),tUe({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},Q1e=async(t,e,r)=>{try{await ane(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},eUe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await ane(t,"strict:error",{signal:r.signal});n.error=aw(i,e),r.abort()}catch{}},tUe=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of X1e(r,"message",{signal:o.signal}))sne(s),yield c}catch{sne(s)}finally{o.abort(),dw(e,a),n||bf(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:yw.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 rUe}from"child_process";import{PassThrough as nUe,Readable as iUe,Writable as oUe,Duplex as sUe}from"stream";var pne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{n$(n);let a=new rUe;aUe(a,n),Object.assign(a,{readable:cUe,writable:lUe,duplex:uUe});let c=Rf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=dUe(c,s,i);return{subprocess:a,promise:l}},aUe=(t,e)=>{let r=U_(),n=U_(),i=U_(),o=Array.from({length:e.length-3},U_),s=U_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},U_=()=>{let t=new nUe;return t.end(),t},cUe=()=>new iUe({read(){}}),lUe=()=>new oUe({write(){}}),uUe=()=>new sUe({read(){},write(){}}),dUe=async(t,e,r)=>Cf(t,e,r);import{createReadStream as hne,createWriteStream as mne}from"fs";import{Buffer as fUe}from"buffer";import{Readable as F_,Writable as pUe,Duplex as hUe}from"stream";var _ne=(t,e)=>kw(mUe,t,e,!1),B_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${$a[t]}.`)},gne={fileNumber:B_,generator:l$,asyncGenerator:l$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:hUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},mUe={input:{...gne,fileUrl:({value:t})=>({stream:hne(t)}),filePath:({value:{file:t}})=>({stream:hne(t)}),webStream:({value:t})=>({stream:F_.fromWeb(t)}),iterable:({value:t})=>({stream:F_.from(t)}),asyncIterable:({value:t})=>({stream:F_.from(t)}),string:({value:t})=>({stream:F_.from(t)}),uint8Array:({value:t})=>({stream:F_.from(fUe.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:pUe.fromWeb(t)}),iterable:B_,asyncIterable:B_,string:B_,uint8Array:B_}};import{on as gUe,once as yne}from"events";import{PassThrough as _Ue,getDefaultHighWaterMark as yUe}from"stream";import{finished as vne}from"stream/promises";function Bl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)m$(i);let e=t.some(({readableObjectMode:i})=>i),r=SUe(t,e),n=new h$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var SUe=(t,e)=>{if(t.length===0)return yUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},h$=class extends _Ue{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(m$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=EUe(this,this.#e,this.#o);let r=TUe({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(m$(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)}},EUe=async(t,e,r)=>{Bw(t,Sne);let n=new AbortController;try{await Promise.race([vUe(t,n),bUe(t,e,r,n)])}finally{n.abort(),Bw(t,-Sne)}},vUe=async(t,{signal:e})=>{try{await vne(t,{signal:e,cleanup:!0})}catch(r){throw bne(t,r),r}},bUe=async(t,e,r,{signal:n})=>{for await(let[i]of gUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},m$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},TUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Bw(t,Ene);let a=new AbortController;try{await Promise.race([AUe(o,e,a),wUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),xUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Bw(t,-Ene)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?g$(t):RUe(t))},AUe=async(t,e,{signal:r})=>{try{await t,r.aborted||g$(e)}catch(n){r.aborted||bne(e,n)}},wUe=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;Tne(s)?i.add(e):Ane(t,s)}},xUe=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)},RUe=t=>{t.writable&&t.end()},bne=(t,e)=>{Tne(e)?g$(t):Ane(t,e)},Tne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",g$=t=>{(t.readable||t.writable)&&t.destroy()},Ane=(t,e)=>{t.destroyed||(t.once("error",CUe),t.destroy(e))},CUe=()=>{},Bw=(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 Pf=(t,e)=>{t.pipe(e),IUe(t,e),PUe(t,e)},IUe=async(t,e)=>{if(!(Ii(t)||Ii(e))){try{await wne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}_$(e)}},_$=t=>{t.writable&&t.end()},PUe=async(t,e)=>{if(!(Ii(t)||Ii(e))){try{await wne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}y$(t)}},y$=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})=>Qn.has(c)))OUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Qn.has(c)))kUe({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]:Bl(o);Pf(s,i)}},OUe=(t,e,r,n)=>{r==="output"?Pf(t.stdio[n],e):Pf(e,t.stdio[n]);let i=NUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},NUe=["stdin","stdout","stderr"],kUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;MUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},MUe=(t,{signal:e})=>{Ii(t)&&Ll(t,DUe,e)},DUe=2;import{addAbortListener as UUe}from"events";var jl=[];jl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&jl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var jw=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",S$=Symbol.for("signal-exit emitter"),E$=globalThis,LUe=Object.defineProperty.bind(Object),v$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(E$[S$])return E$[S$];LUe(E$,S$,{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}},zw=class{},$Ue=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),b$=class extends zw{onExit(){return()=>{}}load(){}unload(){}},T$=class extends zw{#e=A$.platform==="win32"?"SIGINT":"SIGHUP";#r=new v$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of jl)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(!jw(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 jl)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,jl.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 jw(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"&&jw(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)}},A$=globalThis.process,{onExit:Rne,load:abt,unload:cbt}=$Ue(jw(A$)?new T$(A$):new b$);var Cne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Rne(()=>{t.kill()});UUe(n,()=>{i()})};var Pne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=QA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=FUe(r,n,i),{sourceStream:d,sourceError:f}=jUe(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}},FUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=BUe(t,e,...r),a=lw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},BUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ine,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||pL(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]=GA(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}}),jUe=(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=zUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw w$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},zUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return y$(t),n;if(e!==void 0)return _$(r),e},w$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Rf({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 GUe}from"stream/promises";var Mne=(t,e,r)=>{let n=Gw.has(e)?VUe(t,e):qUe(t,e);return Ll(t,WUe,r.signal),Ll(e,YUe,r.signal),HUe(e),n},qUe=(t,e)=>{let r=Bl([t]);return Pf(r,e),Gw.set(e,r),r},VUe=(t,e)=>{let r=Gw.get(e);return r.add(t),r},HUe=async t=>{try{await GUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Gw.delete(t)},Gw=new WeakMap,WUe=2,YUe=1;import{aborted as KUe}from"util";var Dne=(t,e)=>t===void 0?[]:[ZUe(t,e)],ZUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await KUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw w$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var qw=(t,...e)=>{if(Nt(e[0]))return qw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Pne(t,...e),i=JUe({...n,destination:r});return i.pipe=qw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},JUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=XUe(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()}},XUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as oFe}from"timers/promises";import{on as QUe}from"events";import{getDefaultHighWaterMark as eFe}from"stream";var Vw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return tFe(e,s),$ne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},tFe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},x$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;rFe(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})},rFe=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=QUe(t,"data",{signal:e.signal,highWaterMark:Lne,highWatermark:Lne});return nFe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},R$=eFe(!0),Lne=R$,nFe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=iFe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Fl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*$_(a)}},iFe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Dw(t,r,!e),Mw(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=sFe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([aFe(t),d]);return}let f=i$(c,r),p=x$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([cFe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},sFe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Uw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=x$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Kre(a,t,r,o)},aFe=async t=>{await oFe(),t.readableFlowing===null&&t.resume()},cFe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await ww(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await xw(r,{maxBuffer:o})):await xf(r,{maxBuffer:o})}catch(a){return Fne(Kte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},C$=async t=>{try{return await t}catch(e){return Fne(e)}},Fne=({bufferedData:t})=>d7(t)?new Uint8Array(t):t;import{finished as lFe}from"stream/promises";var j_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=uFe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],lFe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||pFe(a,e,r,n)}finally{s.abort()}},uFe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&dFe(t,r,n),n},dFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{fFe(e,r),n.call(t,...i)}},fFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},pFe=(t,e,r,n)=>{if(!hFe(t,e,r,n))throw t},hFe=(t,e,r,n=!0)=>r.propagating?Bne(t)||Hw(t):(r.propagating=!0,I$(r,e)===n?Bne(t):Hw(t)),I$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Hw=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)=>P$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),P$=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=j_(t,e,l);if(I$(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)?Bl([t,e].filter(Boolean)):void 0,Gne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>P$({...mFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:gFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),mFe=({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}},gFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as _Fe}from"events";var qne=t=>yf(t,"ipc"),Vne=(t,e)=>{let r=XA(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 p$({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 T=ene(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:T,propagating:!1},S=jne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=Gne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),P=[],O=Hne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),N=yFe(m,t,A),C=SFe(h,A);try{return await Promise.race([Promise.all([{},rne(T),Promise.all(S),R,O,Cte(t,d),...N,...C]),y,EFe(t,E),...Tte(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(L){return f.terminationReason??="other",Promise.all([{error:L},T,Promise.all(S.map(_=>C$(_))),C$(R),Wne(O,P),Promise.allSettled(N),Promise.allSettled(C)])}},yFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:j_(n,i,r)),SFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ni(o,{checkOpen:!1})&&!Ii(o)).map(({type:i,value:o,stream:s=o})=>j_(s,n,e,{isSameDirection:Qn.has(i),stopOnExit:i==="native"}))),EFe=async(t,{signal:e})=>{let[r]=await _Fe(t,"error",{signal:e});throw r};var Kne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(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}},Of=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 vFe}from"stream";import{callbackify as bFe}from"util";import{finished as Zne}from"stream/promises";var O$=async t=>{if(t!==void 0)try{await N$(t)}catch{}},Jne=async t=>{if(t!==void 0)try{await k$(t)}catch{}},N$=async t=>{await Zne(t,{cleanup:!0,readable:!1,writable:!0})},k$=async t=>{await Zne(t,{cleanup:!0,readable:!0,writable:!1})},Ww=async(t,e)=>{if(await t,e)throw e},Yw=(t,e,r)=>{r&&!Hw(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}=M$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=D$(a,s),{read:f,onStdoutDataDone:p}=L$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new vFe({read:f,destroy:bFe(U$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return $$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},M$=(t,e,r)=>{let n=Tf(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},D$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:R$},L$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=Vw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){TFe(this,s,o)},onStdoutDataDone:o}},TFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},$$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await k$(t),await n,await O$(i),await e,r.readable&&r.push(null)}catch(o){await O$(i),Qne(r,o)}},U$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Of(r,e)&&(Qne(t,n),await Ww(e,n))},Qne=(t,e)=>{Yw(t,t.readable,e)};import{Writable as AFe}from"stream";import{callbackify as eie}from"util";var tie=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=F$(t,r,e),s=new AFe({...B$(n,t,i),destroy:eie(z$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return j$(n,s),s},F$=(t,e,r)=>{let n=lw(t,e),i=z_(r,n,"writableFinal"),o=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},B$=(t,e,r)=>({write:wFe.bind(void 0,t),final:eie(xFe.bind(void 0,t,e,r))}),wFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},xFe=async(t,e,r)=>{await Of(r,e)&&(t.writable&&t.end(),await e)},j$=async(t,e,r)=>{try{await N$(t),e.writable&&e.end()}catch(n){await Jne(r),rie(e,n)}},z$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Of(r,e),await Of(n,e)&&(rie(t,i),await Ww(e,i))},rie=(t,e)=>{Yw(t,t.writable,e)};import{Duplex as RFe}from"stream";import{callbackify as CFe}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}=M$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=F$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=D$(c,a),{read:y,onStdoutDataDone:E}=L$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),T=new RFe({read:y,...B$(u,t,d),destroy:CFe(IFe.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 $$({subprocessStdout:c,onStdoutDataDone:E,readable:T,subprocess:t,subprocessStdin:u}),j$(u,T,c),T},IFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([U$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),z$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var G$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||En.has(e),s=Tf(t,r),a=Vw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return PFe(a,s,t)},PFe=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=G$.bind(void 0,t,e),t[Symbol.asyncIterator]=G$.bind(void 0,t,e,{})};var oie=(t,e)=>{for(let[r,n]of NFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},OFe=(async()=>{})().constructor.prototype,NFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(OFe,t)]);var sie=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=DFe(t,e,r),{subprocess:f,promise:p}=$Fe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=qw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),oie(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},DFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=ew(t,e,r),{file:a,commandArguments:c,options:l}=Ew(t,e,r),u=LFe(l),d=_ne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},LFe=({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}},$Fe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=MFe(...vw(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;kFe(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=UFe({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}},UFe=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,R)=>Es(S,e,R)),T=Es(m,e,"all"),A=FFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:T,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cf(A,n,e)},FFe=({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?L_({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}):Iw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Kw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,BFe(n,t[n],i)]));return{...t,...r}},BFe=(t,e,r)=>jFe.has(t)&&Nt(e)&&Nt(r)?{...e,...r}:r,jFe=new Set(["env",...SL]);var Ua=(t,e,r,n)=>{let i=(s,a,c)=>Ua(s,a,r,c),o=(...s)=>zFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},zFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Nt(o))return i(t,Kw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=GFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ine(a,c,l):sie(a,c,l,i)},GFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=_7(e)?y7(e,r):[e,...r],[s,a,c]=GA(...o),l=Kw(Kw(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]=qFe(t);return{file:r,commandArguments:n}},qFe=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(VFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},VFe=/ +/g;var uie=(t,e,r)=>{t.sync=e(HFe,r),t.s=t.sync},die=({options:t})=>fie(t),HFe=({options:t})=>({...fie(t),isSync:!0}),fie=t=>({options:{...WFe(t),...t}}),WFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},pie={preferLocal:!0};var hie=Ua(()=>({})),JAt=Ua(()=>({isSync:!0})),mie=Ua(aie),XAt=Ua(cie),QAt=Ua(wte),ewt=Ua(die,{},pie,uie),{sendMessage:twt,getOneMessage:rwt,getEachMessage:nwt,getCancelSignal:iwt}=dne();var gie=!1,_ie=()=>{gie=!0},vo=()=>gie;var G_=null,yie=t=>(G_&&G_.destroy(),G_=new bo({totalAllowedTime:t}),G_),Sie=()=>G_;var bo=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 MA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{se.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.166.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.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var JFe=KFe(import.meta.url),XFe=vs.dirname(JFe),QFe=ZFe(import.meta.url),Nf=ue("shell"),q$=new Set,vie={preferLocal:!0},Gt=(t,e,r)=>{let[n,i]=eBe(e,r),o={...vie,...i},s=hie(t,n,o);Tie(s,o),xie(s);let a=r?.idleTimeout;return a&&a>0&&wie(s,a),s},bie=(t,e)=>{let r={...vie,...e},n=mie(t,r);return Tie(n,r),xie(n),e?.idleTimeout&&e.idleTimeout>0&&wie(n,e.idleTimeout),n},eBe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},Tie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(bs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new __).pipe(bs.stdout),t.stderr?.pipe(new __).pipe(bs.stderr);return}t.stdout?.pipe(bs.stdout),t.stderr?.pipe(bs.stderr)},V$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(bs.kill(-t.pid,e),Nf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Nf.error("Error killing process:",r),!1}},Aie=t=>V$(t,"SIGKILL"),wie=(t,e)=>{let r=null,n=()=>{Nf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),V$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Nf.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=>{q$.add(t);let e=Sie();if(e){let r=e.onTimesUp(()=>{Nf.log(`Global timer expired, killing process ${t.pid}`),V$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Nf.log(`Force killing process ${t.pid} after timeout`),Aie(t))},5e3)});t.on("exit",()=>{q$.delete(t),r()}),t.on("error",()=>{q$.delete(t),r()})}};function Jw(t,e){return!!ki(t,e)}function ki(t,e){if(!bs.env.NETLIFY_LOCAL_MODE)try{let i=QFe.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(Zw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(bs.env.NODE_PATH){let i=vs.join(bs.env.NODE_PATH,".bin",e);if(Zw.existsSync(i))return i}let r=vs.join(t,"node_modules",".bin",e);if(Zw.existsSync(r))return r;let n=vs.join(XFe,"..","node_modules",".bin",e);if(Zw.existsSync(n))return n}var tBe=ue("utils"),rBe=t=>new Promise(e=>{setTimeout(e,t)});var H$=t=>{try{return new URL(t).hostname||null}catch{return null}},Xw=(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 rBe(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):tBe.error("Could not parse JSON",n))}},nBe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():nBe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Qw=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 W$=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}},iBe=1e4,Y$=(t,e=iBe)=>{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 oBe}from"crypto";import{createReadStream as sBe}from"fs";import ex from"fs/promises";import kie from"os";import tx from"path";var Iie=ue("repo"),Mie="runner-diffs-",Die=t=>`${Mie}${t}-`,Lie=async t=>{let e=kie.tmpdir(),r;try{r=await ex.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Mie)&&!n.startsWith(Die(t))).map(n=>ex.rm(tx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},tn=(t,e={})=>Gt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),rx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Iie.info("Getting runner diffs");let n=await cBe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=uBe(o);await dBe(h,r)}Iie.info("Changes after processing"),await Z$(r);let s=await J$(o,r);if(await K$(s,r),i=await lBe(r),!i)return{hasChanges:!1,ignored:s};await tn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await ex.mkdtemp(tx.join(kie.tmpdir(),Die(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:E})=>{let T=tx.join(a,y);await tn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${T}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await ex.stat(T);return{path:T,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),se.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=oBe("sha256");for await(let r of sBe(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})},K$=async(t=[],e=process.cwd())=>{await tn(["add",".",...t],{cwd:e})},Z$=async(t=process.cwd())=>{let e=await tn(["status","-s"],{cwd:t});return String(e.stdout??"")},$ie=/.. (.+)?\.log$/,aBe=[$ie],cBe=async(t=process.cwd())=>{let e=await Z$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
116
116
|
`).filter(i=>aBe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},lBe=async(t=process.cwd())=>{try{return await tn(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},q_=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()},J$=async(t,e=process.cwd())=>{t||=await Z$(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(`
|
|
117
117
|
`).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${tx.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(`
|
|
118
118
|
`).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},uBe=t=>{let e=t.split(`
|
|
@@ -511,6 +511,7 @@ You're an AI agent designed to assist with tasks related to a Netlify project. P
|
|
|
511
511
|
${S}
|
|
512
512
|
${OQ}
|
|
513
513
|
${T}
|
|
514
|
+
MAXIMIZE EFFICIENCY: For maximum efficiency, whenever you need to perform multiple independent operations, always invoke all relevant tools simultaneously. Never make sequential tool calls when they can be combined.
|
|
514
515
|
${r}
|
|
515
516
|
</requirements>
|
|
516
517
|
|