@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/index.js
CHANGED
|
@@ -111,7 +111,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
111
111
|
`,LF:`
|
|
112
112
|
`,concatBytes:QL},q$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},V$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:q$e};import{Buffer as H$e}from"buffer";var Cre=(t,e)=>t?void 0:W$e.bind(void 0,e),W$e=function*(t,e){if(typeof e!="string"&&!zt(e)&&!H$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Ire=(t,e)=>t?Y$e.bind(void 0,e):K$e.bind(void 0,e),Y$e=function*(t,e){Pre(t,e),yield e},K$e=function*(t,e){if(Pre(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},Pre=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
|
|
113
113
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
114
|
-
if (condition) { yield value; }`)};import{Buffer as Z$e}from"buffer";import{StringDecoder as J$e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:X$e.bind(void 0,new TextEncoder)};let n=new J$e(e);return{transform:Q$e.bind(void 0,n),final:e1e.bind(void 0,n)}},X$e=function*(t,e){Z$e.isBuffer(e)?yield hs(e):typeof e=="string"?yield t.encode(e):yield e},Q$e=function*(t,e){yield zt(e)?t.write(e):e},e1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Ore}from"util";var t$=Ore(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ow=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=r1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},Nre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*t1e(r,Number(e),t)},t1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},kre=Ore(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),r1e=function*(t){yield t};var r$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Mre=(t,e)=>[...e.flatMap(r=>[...Ll(r,t,0)]),...M_(t)],Ll=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=i1e}=e[r];for(let i of n(t))yield*Ll(i,e,r+1)},M_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*n1e(r,Number(e),t)},n1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ll(n,r,e+1)},i1e=function*(t){yield t};var n$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Lre(t,s,o),l=Dl(e),u=Dl(r),d=l?t$.bind(void 0,Ow,a):r$.bind(void 0,Ll),f=l||u?t$.bind(void 0,Nre,a):r$.bind(void 0,M_),p=l||u?kre.bind(void 0,a):void 0;return{stream:new o1e({writableObjectMode:n,writableHighWaterMark:Dre(n),readableObjectMode:i,readableHighWaterMark:Dre(i),transform(m,y,v){d([m,c,0],this,v)},flush(m){f([c],this,m)},destroy:p})}},Nw=(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=Lre(s,r,a);t=Mre(c,t)}return t},Lre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Cre(n,a)},Pw(r,s,n),Iw(r,o,n,c),{transform:t,final:e},{transform:Ire(i,a)},Rre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var $re=(t,e)=>{for(let r of s1e(t))a1e(t,r,e)},s1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),a1e=(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 ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>c1e(a,n));r.input=A_(s)},c1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return l1e(r),A_(r)},l1e=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 p1e,appendFileSync as h1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&mf(r,n)&&!yn.has(e)&&u1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&d1e.has(o))||t.every(({type:i})=>Zn.has(i))),u1e=t=>t===1||t===2,d1e=new Set(["pipe","overlapped"]),Ure=async(t,e,r,n)=>{for await(let i of t)f1e(e)||Bre(i,r,n)},Fre=(t,e,r)=>{for(let n of t)Bre(n,e,r)},f1e=t=>t._readableState.pipes.length>0,Bre=(t,e,r)=>{let n=WA(t);fo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var jre=({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)=>m1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},m1e=({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=zte(t,o,d),p=hs(f),{stdioItems:h,objectMode:m}=e[r],y=g1e([p],h,c,n),{serializedResult:v,finalResult:b=v}=_1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});y1e({serializedResult:v,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let w=a[r]?b:void 0;try{return n.error===void 0&&S1e(v,h,i),w}catch(S){return n.error=S,w}},g1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},_1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:A_(t)};let s=r7(t,r);return n[o]?{serializedResult:s,finalResult:e$(s,!i[o],e)}:{serializedResult:s}},y1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!kw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=e$(t,!1,s);try{Fre(a,e,n)}catch(c){r.error??=c}},S1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Rw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?h1e(n,t):(r.add(o),p1e(n,t))}};var zre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,_s(e,r,"all")]:Array.isArray(e)?[_s(t,r,"all"),...e]:zt(t)&&zt(e)?lL([t,e]):`${t}${e}`};import{once as i$}from"events";var Gre=async(t,e)=>{let[r,n]=await E1e(t);return e.isForcefullyTerminated??=!1,[r,n]},E1e=async t=>{let[e,r]=await Promise.allSettled([i$(t,"spawn"),i$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qre(t):r.value},qre=async t=>{try{return await i$(t,"exit")}catch{return qre(t)}},Vre=async t=>{let[e,r]=await t;if(!v1e(e,r)&&o$(e,r))throw new Ri;return[e,r]},v1e=(t,e)=>t===void 0&&e===void 0,o$=(t,e)=>t!==0||e!==null;var Hre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=T1e(t,e,r),s=o?.code==="ETIMEDOUT",a=jte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},T1e=(t,e,r)=>t!==void 0?t:o$(e,r)?new Ri:void 0;var Wre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=A1e(t,e,r),d=R1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return wf(d,c,l)},A1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=w1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);x1e(u);let d=bre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},w1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,x1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Mw("ipcInput"),t&&Mw("ipc: true"),r&&Mw("detached: true"),n&&Mw("cancelSignal")},Mw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},R1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=C1e({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}=Hre(c,r),{output:h,error:m=l}=jre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,w)=>_s(b,r,w)),v=_s(zre(h,r),r,"all");return P1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:v,options:r,command:n,escapedCommand:i,startTime:a})},C1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{$re(o,r);let a=I1e(r);return b1e(...gw(t,e,a))}catch(a){return Af({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},I1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),P1e=({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?Aw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):k_({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 _Fe}from"events";import{spawn as yFe}from"child_process";import Xre from"process";import{once as s$,on as O1e}from"events";var Yre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(yf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),N1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),N1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([k1e(o,n,s),M1e(o,r,s),D1e(o,r,s)])}catch(a){throw Sf(t),a}finally{s.abort(),sw(e,i)}},k1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await s$(t,"message",{signal:r});return n}for await(let[n]of O1e(t,"message",{signal:r}))if(e(n))return n},M1e=async(t,e,{signal:r})=>{await s$(t,"disconnect",{signal:r}),Mee(e)},D1e=async(t,e,{signal:r})=>{let[n]=await s$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Zre,on as L1e}from"events";var Jre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>a$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),a$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{yf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=ka(t,e,r),a=new AbortController,c={};return $1e(t,s,a),U1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),F1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},$1e=async(t,e,r)=>{try{await Zre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},U1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Zre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},F1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of L1e(r,"message",{signal:o.signal}))Kre(s),yield c}catch{Kre(s)}finally{o.abort(),sw(e,a),n||Sf(t),i&&await t}},Kre=({error:t})=>{if(t)throw t};var Qre=(t,{ipc:e})=>{Object.assign(t,tne(t,!1,e))},ene=()=>{let t=Xre,e=!0,r=Xre.channel!==void 0;return{...tne(t,e,r),getCancelSignal:ate.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},tne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Yre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Jre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as B1e}from"child_process";import{PassThrough as j1e,Readable as z1e,Writable as G1e,Duplex as q1e}from"stream";var rne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{JL(n);let a=new B1e;V1e(a,n),Object.assign(a,{readable:H1e,writable:W1e,duplex:Y1e});let c=Af({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=K1e(c,s,i);return{subprocess:a,promise:l}},V1e=(t,e)=>{let r=D_(),n=D_(),i=D_(),o=Array.from({length:e.length-3},D_),s=D_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},D_=()=>{let t=new j1e;return t.end(),t},H1e=()=>new z1e({read(){}}),W1e=()=>new G1e({write(){}}),Y1e=()=>new q1e({read(){},write(){}}),K1e=async(t,e,r)=>wf(t,e,r);import{createReadStream as nne,createWriteStream as ine}from"fs";import{Buffer as Z1e}from"buffer";import{Readable as L_,Writable as J1e,Duplex as X1e}from"stream";var sne=(t,e)=>Cw(Q1e,t,e,!1),$_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},one={fileNumber:$_,generator:n$,asyncGenerator:n$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:X1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Q1e={input:{...one,fileUrl:({value:t})=>({stream:nne(t)}),filePath:({value:{file:t}})=>({stream:nne(t)}),webStream:({value:t})=>({stream:L_.fromWeb(t)}),iterable:({value:t})=>({stream:L_.from(t)}),asyncIterable:({value:t})=>({stream:L_.from(t)}),string:({value:t})=>({stream:L_.from(t)}),uint8Array:({value:t})=>({stream:L_.from(Z1e.from(t))})},output:{...one,fileUrl:({value:t})=>({stream:ine(t)}),filePath:({value:{file:t,append:e}})=>({stream:ine(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:J1e.fromWeb(t)}),iterable:$_,asyncIterable:$_,string:$_,uint8Array:$_}};import{on as eUe,once as ane}from"events";import{PassThrough as tUe,getDefaultHighWaterMark as rUe}from"stream";import{finished as une}from"stream/promises";function $l(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)l$(i);let e=t.some(({readableObjectMode:i})=>i),r=nUe(t,e),n=new c$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var nUe=(t,e)=>{if(t.length===0)return rUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},c$=class extends tUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(l$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=iUe(this,this.#e,this.#o);let r=aUe({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(l$(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)}},iUe=async(t,e,r)=>{Dw(t,cne);let n=new AbortController;try{await Promise.race([oUe(t,n),sUe(t,e,r,n)])}finally{n.abort(),Dw(t,-cne)}},oUe=async(t,{signal:e})=>{try{await une(t,{signal:e,cleanup:!0})}catch(r){throw dne(t,r),r}},sUe=async(t,e,r,{signal:n})=>{for await(let[i]of eUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},l$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},aUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,lne);let a=new AbortController;try{await Promise.race([cUe(o,e,a),lUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),uUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-lne)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?u$(t):dUe(t))},cUe=async(t,e,{signal:r})=>{try{await t,r.aborted||u$(e)}catch(n){r.aborted||dne(e,n)}},lUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await une(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;fne(s)?i.add(e):pne(t,s)}},uUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await ane(t,i,{signal:o}),!t.readable)return ane(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},dUe=t=>{t.writable&&t.end()},dne=(t,e)=>{fne(e)?u$(t):pne(t,e)},fne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",u$=t=>{(t.readable||t.writable)&&t.destroy()},pne=(t,e)=>{t.destroyed||(t.once("error",fUe),t.destroy(e))},fUe=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},cne=2,lne=1;import{finished as hne}from"stream/promises";var Rf=(t,e)=>{t.pipe(e),pUe(t,e),hUe(t,e)},pUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await hne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}d$(e)}},d$=t=>{t.writable&&t.end()},hUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await hne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}f$(t)}},f$=t=>{t.readable&&t.destroy()};var mne=(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})=>Zn.has(c)))mUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Zn.has(c)))_Ue({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]:$l(o);Rf(s,i)}},mUe=(t,e,r,n)=>{r==="output"?Rf(t.stdio[n],e):Rf(e,t.stdio[n]);let i=gUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},gUe=["stdin","stdout","stderr"],_Ue=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;yUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},yUe=(t,{signal:e})=>{xi(t)&&kl(t,SUe,e)},SUe=2;import{addAbortListener as TUe}from"events";var Ul=[];Ul.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ul.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ul.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Lw=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",p$=Symbol.for("signal-exit emitter"),h$=globalThis,EUe=Object.defineProperty.bind(Object),m$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(h$[p$])return h$[p$];EUe(h$,p$,{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}},$w=class{},vUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),g$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},_$=class extends $w{#e=y$.platform==="win32"?"SIGINT":"SIGHUP";#r=new m$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ul)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(!Lw(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 Ul)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,Ul.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 Lw(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"&&Lw(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)}},y$=globalThis.process,{onExit:gne,load:qvt,unload:Vvt}=vUe(Lw(y$)?new _$(y$):new g$);var _ne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=gne(()=>{t.kill()});TUe(n,()=>{i()})};var Sne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=bUe(r,n,i),{sourceStream:d,sourceError:f}=wUe(t,l),{options:p,fileDescriptors:h}=ho.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},bUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=AUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},AUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(yne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aL(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]=UA(r,...n);return{destination:e(yne)(i,o,s),pipeOptions:s}}if(ho.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}`)},yne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),wUe=(t,e)=>{try{return{sourceStream:Ef(t,e)}}catch(r){return{sourceError:r}}};var vne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=xUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw S$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},xUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return f$(t),n;if(e!==void 0)return d$(r),e},S$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Af({error:t,command:Ene,escapedCommand:Ene,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Ene="source.pipe(destination)";var Tne=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 RUe}from"stream/promises";var bne=(t,e,r)=>{let n=Uw.has(e)?IUe(t,e):CUe(t,e);return kl(t,OUe,r.signal),kl(e,NUe,r.signal),PUe(e),n},CUe=(t,e)=>{let r=$l([t]);return Rf(r,e),Uw.set(e,r),r},IUe=(t,e)=>{let r=Uw.get(e);return r.add(t),r},PUe=async t=>{try{await RUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,OUe=2,NUe=1;import{aborted as kUe}from"util";var Ane=(t,e)=>t===void 0?[]:[MUe(t,e)],MUe=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 S$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Nt(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Sne(t,...e),i=DUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},DUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=LUe(t,i);vne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=bne(e,o,d);return await Promise.race([Tne(u),...Ane(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},LUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as GUe}from"timers/promises";import{on as $Ue}from"events";import{getDefaultHighWaterMark as UUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return FUe(e,s),xne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},FUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},E$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;BUe(e,s,t);let a=t.readableObjectMode&&!o;return xne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},BUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},xne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=$Ue(t,"data",{signal:e.signal,highWaterMark:wne,highWatermark:wne});return jUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},v$=UUe(!0),wne=v$,jUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=zUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ll(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*M_(a)}},zUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Iw(t,i,!n,{})].filter(Boolean);var Rne=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=qUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([VUe(t),d]);return}let f=XL(c,r),p=E$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([HUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},qUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!kw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=E$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Ure(a,t,r,o)},VUe=async t=>{await GUe(),t.readableFlowing===null&&t.resume()},HUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ew(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await vw(r,{maxBuffer:o})):await bf(r,{maxBuffer:o})}catch(a){return Cne(Ute({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},T$=async t=>{try{return await t}catch(e){return Cne(e)}},Cne=({bufferedData:t})=>e7(t)?new Uint8Array(t):t;import{finished as WUe}from"stream/promises";var U_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=YUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],WUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||JUe(a,e,r,n)}finally{s.abort()}},YUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&KUe(t,r,n),n},KUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{ZUe(e,r),n.call(t,...i)}},ZUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},JUe=(t,e,r,n)=>{if(!XUe(t,e,r,n))throw t},XUe=(t,e,r,n=!0)=>r.propagating?Ine(t)||jw(t):(r.propagating=!0,b$(r,e)===n?Ine(t):jw(t)),b$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Ine=t=>t?.code==="EPIPE";var Pne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>A$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),A$=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=U_(t,e,l);if(b$(l,e)){await u;return}let[d]=await Promise.all([Rne({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 One=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?$l([t,e].filter(Boolean)):void 0,Nne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>A$({...QUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:eFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),QUe=({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}},eFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as tFe}from"events";var kne=t=>mf(t,"ipc"),Mne=(t,e)=>{let r=WA(t);fo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Dne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=kne(o),a=ms(e,"ipc"),c=ms(r,"ipc");for await(let l of a$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Fte(t,i,c),i.push(l)),s&&Mne(l,o);return i},Lne=async(t,e)=>(await Promise.allSettled([t]),e);var $ne=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:v})=>{let b=Gre(t,f),w={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=Pne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),I=Nne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),P=[],D=Dne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),k=rFe(m,t,w),C=nFe(h,w);try{return await Promise.race([Promise.all([{},Vre(b),Promise.all(S),I,D,_te(t,d),...k,...C]),y,iFe(t,v),...fte(t,o,f,v),...kee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:v}),...ute({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:v})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(S.map(_=>T$(_))),T$(I),Lne(D,P),Promise.allSettled(k),Promise.allSettled(C)])}},rFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:U_(n,i,r)),nFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>U_(s,n,e,{isSameDirection:Zn.has(i),stopOnExit:i==="native"}))),iFe=async(t,{signal:e})=>{let[r]=await tFe(t,"error",{signal:e});throw r};var Une=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),F_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=po();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Cf=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 oFe}from"stream";import{callbackify as sFe}from"util";import{finished as Fne}from"stream/promises";var w$=async t=>{if(t!==void 0)try{await x$(t)}catch{}},Bne=async t=>{if(t!==void 0)try{await R$(t)}catch{}},x$=async t=>{await Fne(t,{cleanup:!0,readable:!1,writable:!0})},R$=async t=>{await Fne(t,{cleanup:!0,readable:!0,writable:!1})},zw=async(t,e)=>{if(await t,e)throw e},Gw=(t,e,r)=>{r&&!jw(r)?t.destroy(r):e&&t.destroy()};var jne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||yn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=C$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=I$(a,s),{read:f,onStdoutDataDone:p}=P$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new oFe({read:f,destroy:sFe(N$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return O$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},C$=(t,e,r)=>{let n=Ef(t,e),i=F_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},I$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:v$},P$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=po(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){aFe(this,s,o)},onStdoutDataDone:o}},aFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},O$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await R$(t),await n,await w$(i),await e,r.readable&&r.push(null)}catch(o){await w$(i),zne(r,o)}},N$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Cf(r,e)&&(zne(t,n),await zw(e,n))},zne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as cFe}from"stream";import{callbackify as Gne}from"util";var qne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=k$(t,r,e),s=new cFe({...M$(n,t,i),destroy:Gne(L$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return D$(n,s),s},k$=(t,e,r)=>{let n=iw(t,e),i=F_(r,n,"writableFinal"),o=F_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},M$=(t,e,r)=>({write:lFe.bind(void 0,t),final:Gne(uFe.bind(void 0,t,e,r))}),lFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},uFe=async(t,e,r)=>{await Cf(r,e)&&(t.writable&&t.end(),await e)},D$=async(t,e,r)=>{try{await x$(t),e.writable&&e.end()}catch(n){await Bne(r),Vne(e,n)}},L$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Cf(r,e),await Cf(n,e)&&(Vne(t,i),await zw(e,i))},Vne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as dFe}from"stream";import{callbackify as fFe}from"util";var Hne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||yn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=C$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=k$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=I$(c,a),{read:y,onStdoutDataDone:v}=P$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new dFe({read:y,...M$(u,t,d),destroy:fFe(pFe.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 O$({subprocessStdout:c,onStdoutDataDone:v,readable:b,subprocess:t,subprocessStdin:u}),D$(u,b,c),b},pFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([N$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),L$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var $$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||yn.has(e),s=Ef(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return hFe(a,s,t)},hFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Wne=(t,{encoding:e})=>{let r=Une();t.readable=jne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=qne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Hne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=$$.bind(void 0,t,e),t[Symbol.asyncIterator]=$$.bind(void 0,t,e,{})};var Yne=(t,e)=>{for(let[r,n]of gFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},mFe=(async()=>{})().constructor.prototype,gFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(mFe,t)]);var Kne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=SFe(t,e,r),{subprocess:f,promise:p}=vFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Fw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Yne(f,p),ho.set(f,{options:u,fileDescriptors:d}),f},SFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),{file:a,commandArguments:c,options:l}=mw(t,e,r),u=EFe(l),d=sne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},EFe=({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}},vFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=yFe(...gw(t,e,r))}catch(h){return rne({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;_Fe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];mne(c,a,l),_ne(c,r,l);let d={},f=po();c.kill=Oee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=One(c,r),Wne(c,r),Qre(c,r);let p=TFe({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}},TFe=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 $ne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let v=h.map((S,I)=>_s(S,e,I)),b=_s(m,e,"all"),w=bFe({errorInfo:d,exitCode:f,signal:p,stdio:v,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return wf(w,n,e)},bFe=({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?k_({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 mo,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Aw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var qw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,AFe(n,t[n],i)]));return{...t,...r}},AFe=(t,e,r)=>wFe.has(t)&&Nt(e)&&Nt(r)?{...e,...r}:r,wFe=new Set(["env",...pL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>xFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},xFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Nt(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=RFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Wre(a,c,l):Kne(a,c,l,i)},RFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=s7(e)?a7(e,r):[e,...r],[s,a,c]=UA(...o),l=qw(qw(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 Zne=({file:t,commandArguments:e})=>Xne(t,e),Jne=({file:t,commandArguments:e})=>({...Xne(t,e),isSync:!0}),Xne=(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]=CFe(t);return{file:r,commandArguments:n}},CFe=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(IFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},IFe=/ +/g;var Qne=(t,e,r)=>{t.sync=e(PFe,r),t.s=t.sync},eie=({options:t})=>tie(t),PFe=({options:t})=>({...tie(t),isSync:!0}),tie=t=>({options:{...OFe(t),...t}}),OFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},rie={preferLocal:!0};var nie=Da(()=>({})),MAt=Da(()=>({isSync:!0})),iie=Da(Zne),DAt=Da(Jne),LAt=Da(hte),$At=Da(eie,{},rie,Qne),{sendMessage:UAt,getOneMessage:FAt,getEachMessage:BAt,getCancelSignal:jAt}=ene();var oie=!1,sie=()=>{oie=!0},_o=()=>oie;var B_=null,aie=t=>(B_&&B_.destroy(),B_=new yo({totalAllowedTime:t}),B_),cie=()=>B_;var yo=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&&_o())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 IA({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 lie={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 DFe=kFe(import.meta.url),LFe=ys.dirname(DFe),$Fe=MFe(import.meta.url),If=ue("shell"),U$=new Set,uie={preferLocal:!0},dr=(t,e,r)=>{let[n,i]=UFe(e,r),o={...uie,...i},s=nie(t,n,o);fie(s,o),mie(s);let a=r?.idleTimeout;return a&&a>0&&hie(s,a),s},die=(t,e)=>{let r={...uie,...e},n=iie(t,r);return fie(n,r),mie(n),e?.idleTimeout&&e.idleTimeout>0&&hie(n,e.idleTimeout),n},UFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},fie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Ss.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new h_).pipe(Ss.stdout),t.stderr?.pipe(new h_).pipe(Ss.stderr);return}t.stdout?.pipe(Ss.stdout),t.stderr?.pipe(Ss.stderr)},F$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ss.kill(-t.pid,e),If.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return If.error("Error killing process:",r),!1}},pie=t=>F$(t,"SIGKILL"),hie=(t,e)=>{let r=null,n=()=>{If.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),F$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(If.log(`Force killing idle process ${t.pid}`),pie(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)},mie=t=>{U$.add(t);let e=cie();if(e){let r=e.onTimesUp(()=>{If.log(`Global timer expired, killing process ${t.pid}`),F$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(If.log(`Force killing process ${t.pid} after timeout`),pie(t))},5e3)});t.on("exit",()=>{U$.delete(t),r()}),t.on("error",()=>{U$.delete(t),r()})}};function So(t,e){if(!Ss.env.NETLIFY_LOCAL_MODE)try{let i=$Fe.resolve(lie.name),o=ys.dirname(i);for(;o!==ys.dirname(o);){let s=ys.dirname(o);if(ys.basename(s)==="node_modules"){let a=ys.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(Ss.env.NODE_PATH){let i=ys.join(Ss.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=ys.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=ys.join(LFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var FFe=ue("utils"),BFe=t=>new Promise(e=>{setTimeout(e,t)});var B$=t=>{try{return new URL(t).hostname||null}catch{return null}},Hw=(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 BFe(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},La=(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},gie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):FFe.error("Could not parse JSON",n))}},jFe=t=>t.charAt(0).toUpperCase()+t.slice(1),Eo=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():jFe(e)).join(" ");function Es(t,e){e&&t.log(`Skill invoked: ${e}`)}var Ww=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),_ie=(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 j$=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}},zFe=1e4,z$=(t,e=zFe)=>{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 GFe}from"crypto";import{createReadStream as qFe}from"fs";import Yw from"fs/promises";import Tie from"os";import Kw from"path";var yie=ue("repo"),bie="runner-diffs-",Aie=t=>`${bie}${t}-`,wie=async t=>{let e=Tie.tmpdir(),r;try{r=await Yw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(bie)&&!n.startsWith(Aie(t))).map(n=>Yw.rm(Kw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>dr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Zw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{yie.info("Getting runner diffs");let n=await HFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=YFe(o);await KFe(h,r)}yie.info("Changes after processing"),await q$(r);let s=await H$(o,r);if(await G$(s,r),i=await WFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Yw.mkdtemp(Kw.join(Tie.tmpdir(),Aie(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:v})=>{let b=Kw.join(a,y);await Xr([...v?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Yw.stat(b);return{path:b,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await vie(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 Eie(d,h)||(f=h)}await vie(r),se.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Eie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Sie=async t=>{let e=GFe("sha256");for await(let r of qFe(t))e.update(r);return e.digest("hex")},Eie=async(t,e)=>t.size===e.size&&await Sie(t.path)===await Sie(e.path),vie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},G$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},q$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},xie=/.. (.+)?\.log$/,VFe=[xie],HFe=async(t=process.cwd())=>{let e=await q$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
114
|
+
if (condition) { yield value; }`)};import{Buffer as Z$e}from"buffer";import{StringDecoder as J$e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:X$e.bind(void 0,new TextEncoder)};let n=new J$e(e);return{transform:Q$e.bind(void 0,n),final:e1e.bind(void 0,n)}},X$e=function*(t,e){Z$e.isBuffer(e)?yield hs(e):typeof e=="string"?yield t.encode(e):yield e},Q$e=function*(t,e){yield zt(e)?t.write(e):e},e1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Ore}from"util";var t$=Ore(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ow=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=r1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},Nre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*t1e(r,Number(e),t)},t1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},kre=Ore(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),r1e=function*(t){yield t};var r$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Mre=(t,e)=>[...e.flatMap(r=>[...Ll(r,t,0)]),...M_(t)],Ll=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=i1e}=e[r];for(let i of n(t))yield*Ll(i,e,r+1)},M_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*n1e(r,Number(e),t)},n1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ll(n,r,e+1)},i1e=function*(t){yield t};var n$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Lre(t,s,o),l=Dl(e),u=Dl(r),d=l?t$.bind(void 0,Ow,a):r$.bind(void 0,Ll),f=l||u?t$.bind(void 0,Nre,a):r$.bind(void 0,M_),p=l||u?kre.bind(void 0,a):void 0;return{stream:new o1e({writableObjectMode:n,writableHighWaterMark:Dre(n),readableObjectMode:i,readableHighWaterMark:Dre(i),transform(m,y,v){d([m,c,0],this,v)},flush(m){f([c],this,m)},destroy:p})}},Nw=(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=Lre(s,r,a);t=Mre(c,t)}return t},Lre=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Cre(n,a)},Pw(r,s,n),Iw(r,o,n,c),{transform:t,final:e},{transform:Ire(i,a)},Rre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var $re=(t,e)=>{for(let r of s1e(t))a1e(t,r,e)},s1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),a1e=(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 ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>c1e(a,n));r.input=A_(s)},c1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return l1e(r),A_(r)},l1e=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 p1e,appendFileSync as h1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&mf(r,n)&&!yn.has(e)&&u1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&d1e.has(o))||t.every(({type:i})=>Zn.has(i))),u1e=t=>t===1||t===2,d1e=new Set(["pipe","overlapped"]),Ure=async(t,e,r,n)=>{for await(let i of t)f1e(e)||Bre(i,r,n)},Fre=(t,e,r)=>{for(let n of t)Bre(n,e,r)},f1e=t=>t._readableState.pipes.length>0,Bre=(t,e,r)=>{let n=WA(t);fo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var jre=({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)=>m1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},m1e=({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=zte(t,o,d),p=hs(f),{stdioItems:h,objectMode:m}=e[r],y=g1e([p],h,c,n),{serializedResult:v,finalResult:b=v}=_1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});y1e({serializedResult:v,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let w=a[r]?b:void 0;try{return n.error===void 0&&S1e(v,h,i),w}catch(S){return n.error=S,w}},g1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},_1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:A_(t)};let s=r7(t,r);return n[o]?{serializedResult:s,finalResult:e$(s,!i[o],e)}:{serializedResult:s}},y1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!kw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=e$(t,!1,s);try{Fre(a,e,n)}catch(c){r.error??=c}},S1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Rw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?h1e(n,t):(r.add(o),p1e(n,t))}};var zre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,_s(e,r,"all")]:Array.isArray(e)?[_s(t,r,"all"),...e]:zt(t)&&zt(e)?lL([t,e]):`${t}${e}`};import{once as i$}from"events";var Gre=async(t,e)=>{let[r,n]=await E1e(t);return e.isForcefullyTerminated??=!1,[r,n]},E1e=async t=>{let[e,r]=await Promise.allSettled([i$(t,"spawn"),i$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qre(t):r.value},qre=async t=>{try{return await i$(t,"exit")}catch{return qre(t)}},Vre=async t=>{let[e,r]=await t;if(!v1e(e,r)&&o$(e,r))throw new Ri;return[e,r]},v1e=(t,e)=>t===void 0&&e===void 0,o$=(t,e)=>t!==0||e!==null;var Hre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=T1e(t,e,r),s=o?.code==="ETIMEDOUT",a=jte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},T1e=(t,e,r)=>t!==void 0?t:o$(e,r)?new Ri:void 0;var Wre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=A1e(t,e,r),d=R1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return wf(d,c,l)},A1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=w1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);x1e(u);let d=bre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},w1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,x1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Mw("ipcInput"),t&&Mw("ipc: true"),r&&Mw("detached: true"),n&&Mw("cancelSignal")},Mw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},R1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=C1e({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}=Hre(c,r),{output:h,error:m=l}=jre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,w)=>_s(b,r,w)),v=_s(zre(h,r),r,"all");return P1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:v,options:r,command:n,escapedCommand:i,startTime:a})},C1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{$re(o,r);let a=I1e(r);return b1e(...gw(t,e,a))}catch(a){return Af({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},I1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),P1e=({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?Aw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):k_({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 _Fe}from"events";import{spawn as yFe}from"child_process";import Xre from"process";import{once as s$,on as O1e}from"events";var Yre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(yf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),N1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),N1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([k1e(o,n,s),M1e(o,r,s),D1e(o,r,s)])}catch(a){throw Sf(t),a}finally{s.abort(),sw(e,i)}},k1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await s$(t,"message",{signal:r});return n}for await(let[n]of O1e(t,"message",{signal:r}))if(e(n))return n},M1e=async(t,e,{signal:r})=>{await s$(t,"disconnect",{signal:r}),Mee(e)},D1e=async(t,e,{signal:r})=>{let[n]=await s$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Zre,on as L1e}from"events";var Jre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>a$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),a$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{yf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=ka(t,e,r),a=new AbortController,c={};return $1e(t,s,a),U1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),F1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},$1e=async(t,e,r)=>{try{await Zre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},U1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Zre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},F1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of L1e(r,"message",{signal:o.signal}))Kre(s),yield c}catch{Kre(s)}finally{o.abort(),sw(e,a),n||Sf(t),i&&await t}},Kre=({error:t})=>{if(t)throw t};var Qre=(t,{ipc:e})=>{Object.assign(t,tne(t,!1,e))},ene=()=>{let t=Xre,e=!0,r=Xre.channel!==void 0;return{...tne(t,e,r),getCancelSignal:ate.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},tne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Yre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Jre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as B1e}from"child_process";import{PassThrough as j1e,Readable as z1e,Writable as G1e,Duplex as q1e}from"stream";var rne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{JL(n);let a=new B1e;V1e(a,n),Object.assign(a,{readable:H1e,writable:W1e,duplex:Y1e});let c=Af({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=K1e(c,s,i);return{subprocess:a,promise:l}},V1e=(t,e)=>{let r=D_(),n=D_(),i=D_(),o=Array.from({length:e.length-3},D_),s=D_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},D_=()=>{let t=new j1e;return t.end(),t},H1e=()=>new z1e({read(){}}),W1e=()=>new G1e({write(){}}),Y1e=()=>new q1e({read(){},write(){}}),K1e=async(t,e,r)=>wf(t,e,r);import{createReadStream as nne,createWriteStream as ine}from"fs";import{Buffer as Z1e}from"buffer";import{Readable as L_,Writable as J1e,Duplex as X1e}from"stream";var sne=(t,e)=>Cw(Q1e,t,e,!1),$_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},one={fileNumber:$_,generator:n$,asyncGenerator:n$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:X1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Q1e={input:{...one,fileUrl:({value:t})=>({stream:nne(t)}),filePath:({value:{file:t}})=>({stream:nne(t)}),webStream:({value:t})=>({stream:L_.fromWeb(t)}),iterable:({value:t})=>({stream:L_.from(t)}),asyncIterable:({value:t})=>({stream:L_.from(t)}),string:({value:t})=>({stream:L_.from(t)}),uint8Array:({value:t})=>({stream:L_.from(Z1e.from(t))})},output:{...one,fileUrl:({value:t})=>({stream:ine(t)}),filePath:({value:{file:t,append:e}})=>({stream:ine(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:J1e.fromWeb(t)}),iterable:$_,asyncIterable:$_,string:$_,uint8Array:$_}};import{on as eUe,once as ane}from"events";import{PassThrough as tUe,getDefaultHighWaterMark as rUe}from"stream";import{finished as une}from"stream/promises";function $l(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)l$(i);let e=t.some(({readableObjectMode:i})=>i),r=nUe(t,e),n=new c$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var nUe=(t,e)=>{if(t.length===0)return rUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},c$=class extends tUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(l$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=iUe(this,this.#e,this.#o);let r=aUe({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(l$(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)}},iUe=async(t,e,r)=>{Dw(t,cne);let n=new AbortController;try{await Promise.race([oUe(t,n),sUe(t,e,r,n)])}finally{n.abort(),Dw(t,-cne)}},oUe=async(t,{signal:e})=>{try{await une(t,{signal:e,cleanup:!0})}catch(r){throw dne(t,r),r}},sUe=async(t,e,r,{signal:n})=>{for await(let[i]of eUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},l$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},aUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,lne);let a=new AbortController;try{await Promise.race([cUe(o,e,a),lUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),uUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-lne)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?u$(t):dUe(t))},cUe=async(t,e,{signal:r})=>{try{await t,r.aborted||u$(e)}catch(n){r.aborted||dne(e,n)}},lUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await une(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;fne(s)?i.add(e):pne(t,s)}},uUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await ane(t,i,{signal:o}),!t.readable)return ane(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},dUe=t=>{t.writable&&t.end()},dne=(t,e)=>{fne(e)?u$(t):pne(t,e)},fne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",u$=t=>{(t.readable||t.writable)&&t.destroy()},pne=(t,e)=>{t.destroyed||(t.once("error",fUe),t.destroy(e))},fUe=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},cne=2,lne=1;import{finished as hne}from"stream/promises";var Rf=(t,e)=>{t.pipe(e),pUe(t,e),hUe(t,e)},pUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await hne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}d$(e)}},d$=t=>{t.writable&&t.end()},hUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await hne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}f$(t)}},f$=t=>{t.readable&&t.destroy()};var mne=(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})=>Zn.has(c)))mUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Zn.has(c)))_Ue({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]:$l(o);Rf(s,i)}},mUe=(t,e,r,n)=>{r==="output"?Rf(t.stdio[n],e):Rf(e,t.stdio[n]);let i=gUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},gUe=["stdin","stdout","stderr"],_Ue=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;yUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},yUe=(t,{signal:e})=>{xi(t)&&kl(t,SUe,e)},SUe=2;import{addAbortListener as TUe}from"events";var Ul=[];Ul.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ul.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ul.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Lw=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",p$=Symbol.for("signal-exit emitter"),h$=globalThis,EUe=Object.defineProperty.bind(Object),m$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(h$[p$])return h$[p$];EUe(h$,p$,{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}},$w=class{},vUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),g$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},_$=class extends $w{#e=y$.platform==="win32"?"SIGINT":"SIGHUP";#r=new m$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ul)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(!Lw(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 Ul)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,Ul.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 Lw(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"&&Lw(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)}},y$=globalThis.process,{onExit:gne,load:qvt,unload:Vvt}=vUe(Lw(y$)?new _$(y$):new g$);var _ne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=gne(()=>{t.kill()});TUe(n,()=>{i()})};var Sne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=bUe(r,n,i),{sourceStream:d,sourceError:f}=wUe(t,l),{options:p,fileDescriptors:h}=ho.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},bUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=AUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},AUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(yne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||aL(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]=UA(r,...n);return{destination:e(yne)(i,o,s),pipeOptions:s}}if(ho.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}`)},yne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),wUe=(t,e)=>{try{return{sourceStream:Ef(t,e)}}catch(r){return{sourceError:r}}};var vne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=xUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw S$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},xUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return f$(t),n;if(e!==void 0)return d$(r),e},S$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Af({error:t,command:Ene,escapedCommand:Ene,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Ene="source.pipe(destination)";var Tne=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 RUe}from"stream/promises";var bne=(t,e,r)=>{let n=Uw.has(e)?IUe(t,e):CUe(t,e);return kl(t,OUe,r.signal),kl(e,NUe,r.signal),PUe(e),n},CUe=(t,e)=>{let r=$l([t]);return Rf(r,e),Uw.set(e,r),r},IUe=(t,e)=>{let r=Uw.get(e);return r.add(t),r},PUe=async t=>{try{await RUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,OUe=2,NUe=1;import{aborted as kUe}from"util";var Ane=(t,e)=>t===void 0?[]:[MUe(t,e)],MUe=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 S$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Nt(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Sne(t,...e),i=DUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},DUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=LUe(t,i);vne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=bne(e,o,d);return await Promise.race([Tne(u),...Ane(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},LUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as GUe}from"timers/promises";import{on as $Ue}from"events";import{getDefaultHighWaterMark as UUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return FUe(e,s),xne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},FUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},E$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;BUe(e,s,t);let a=t.readableObjectMode&&!o;return xne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},BUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},xne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=$Ue(t,"data",{signal:e.signal,highWaterMark:wne,highWatermark:wne});return jUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},v$=UUe(!0),wne=v$,jUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=zUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ll(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*M_(a)}},zUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Iw(t,i,!n,{})].filter(Boolean);var Rne=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=qUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([VUe(t),d]);return}let f=XL(c,r),p=E$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([HUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},qUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!kw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=E$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Ure(a,t,r,o)},VUe=async t=>{await GUe(),t.readableFlowing===null&&t.resume()},HUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ew(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await vw(r,{maxBuffer:o})):await bf(r,{maxBuffer:o})}catch(a){return Cne(Ute({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},T$=async t=>{try{return await t}catch(e){return Cne(e)}},Cne=({bufferedData:t})=>e7(t)?new Uint8Array(t):t;import{finished as WUe}from"stream/promises";var U_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=YUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],WUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||JUe(a,e,r,n)}finally{s.abort()}},YUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&KUe(t,r,n),n},KUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{ZUe(e,r),n.call(t,...i)}},ZUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},JUe=(t,e,r,n)=>{if(!XUe(t,e,r,n))throw t},XUe=(t,e,r,n=!0)=>r.propagating?Ine(t)||jw(t):(r.propagating=!0,b$(r,e)===n?Ine(t):jw(t)),b$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Ine=t=>t?.code==="EPIPE";var Pne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>A$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),A$=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=U_(t,e,l);if(b$(l,e)){await u;return}let[d]=await Promise.all([Rne({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 One=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?$l([t,e].filter(Boolean)):void 0,Nne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>A$({...QUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:eFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),QUe=({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}},eFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as tFe}from"events";var kne=t=>mf(t,"ipc"),Mne=(t,e)=>{let r=WA(t);fo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Dne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=kne(o),a=ms(e,"ipc"),c=ms(r,"ipc");for await(let l of a$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Fte(t,i,c),i.push(l)),s&&Mne(l,o);return i},Lne=async(t,e)=>(await Promise.allSettled([t]),e);var $ne=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:v})=>{let b=Gre(t,f),w={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},S=Pne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),I=Nne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),P=[],D=Dne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:P,verboseInfo:p}),k=rFe(m,t,w),C=nFe(h,w);try{return await Promise.race([Promise.all([{},Vre(b),Promise.all(S),I,D,_te(t,d),...k,...C]),y,iFe(t,v),...fte(t,o,f,v),...kee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:v}),...ute({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:v})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(S.map(_=>T$(_))),T$(I),Lne(D,P),Promise.allSettled(k),Promise.allSettled(C)])}},rFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:U_(n,i,r)),nFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>U_(s,n,e,{isSameDirection:Zn.has(i),stopOnExit:i==="native"}))),iFe=async(t,{signal:e})=>{let[r]=await tFe(t,"error",{signal:e});throw r};var Une=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),F_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=po();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Cf=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 oFe}from"stream";import{callbackify as sFe}from"util";import{finished as Fne}from"stream/promises";var w$=async t=>{if(t!==void 0)try{await x$(t)}catch{}},Bne=async t=>{if(t!==void 0)try{await R$(t)}catch{}},x$=async t=>{await Fne(t,{cleanup:!0,readable:!1,writable:!0})},R$=async t=>{await Fne(t,{cleanup:!0,readable:!0,writable:!1})},zw=async(t,e)=>{if(await t,e)throw e},Gw=(t,e,r)=>{r&&!jw(r)?t.destroy(r):e&&t.destroy()};var jne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||yn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=C$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=I$(a,s),{read:f,onStdoutDataDone:p}=P$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new oFe({read:f,destroy:sFe(N$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return O$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},C$=(t,e,r)=>{let n=Ef(t,e),i=F_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},I$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:v$},P$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=po(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){aFe(this,s,o)},onStdoutDataDone:o}},aFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},O$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await R$(t),await n,await w$(i),await e,r.readable&&r.push(null)}catch(o){await w$(i),zne(r,o)}},N$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Cf(r,e)&&(zne(t,n),await zw(e,n))},zne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as cFe}from"stream";import{callbackify as Gne}from"util";var qne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=k$(t,r,e),s=new cFe({...M$(n,t,i),destroy:Gne(L$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return D$(n,s),s},k$=(t,e,r)=>{let n=iw(t,e),i=F_(r,n,"writableFinal"),o=F_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},M$=(t,e,r)=>({write:lFe.bind(void 0,t),final:Gne(uFe.bind(void 0,t,e,r))}),lFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},uFe=async(t,e,r)=>{await Cf(r,e)&&(t.writable&&t.end(),await e)},D$=async(t,e,r)=>{try{await x$(t),e.writable&&e.end()}catch(n){await Bne(r),Vne(e,n)}},L$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Cf(r,e),await Cf(n,e)&&(Vne(t,i),await zw(e,i))},Vne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as dFe}from"stream";import{callbackify as fFe}from"util";var Hne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||yn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=C$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=k$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=I$(c,a),{read:y,onStdoutDataDone:v}=P$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new dFe({read:y,...M$(u,t,d),destroy:fFe(pFe.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 O$({subprocessStdout:c,onStdoutDataDone:v,readable:b,subprocess:t,subprocessStdin:u}),D$(u,b,c),b},pFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([N$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),L$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var $$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||yn.has(e),s=Ef(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return hFe(a,s,t)},hFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Wne=(t,{encoding:e})=>{let r=Une();t.readable=jne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=qne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Hne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=$$.bind(void 0,t,e),t[Symbol.asyncIterator]=$$.bind(void 0,t,e,{})};var Yne=(t,e)=>{for(let[r,n]of gFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},mFe=(async()=>{})().constructor.prototype,gFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(mFe,t)]);var Kne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=SFe(t,e,r),{subprocess:f,promise:p}=vFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Fw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Yne(f,p),ho.set(f,{options:u,fileDescriptors:d}),f},SFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),{file:a,commandArguments:c,options:l}=mw(t,e,r),u=EFe(l),d=sne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},EFe=({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}},vFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=yFe(...gw(t,e,r))}catch(h){return rne({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;_Fe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];mne(c,a,l),_ne(c,r,l);let d={},f=po();c.kill=Oee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=One(c,r),Wne(c,r),Qre(c,r);let p=TFe({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}},TFe=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 $ne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let v=h.map((S,I)=>_s(S,e,I)),b=_s(m,e,"all"),w=bFe({errorInfo:d,exitCode:f,signal:p,stdio:v,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return wf(w,n,e)},bFe=({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?k_({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 mo,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Aw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var qw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,AFe(n,t[n],i)]));return{...t,...r}},AFe=(t,e,r)=>wFe.has(t)&&Nt(e)&&Nt(r)?{...e,...r}:r,wFe=new Set(["env",...pL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>xFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},xFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Nt(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=RFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Wre(a,c,l):Kne(a,c,l,i)},RFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=s7(e)?a7(e,r):[e,...r],[s,a,c]=UA(...o),l=qw(qw(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 Zne=({file:t,commandArguments:e})=>Xne(t,e),Jne=({file:t,commandArguments:e})=>({...Xne(t,e),isSync:!0}),Xne=(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]=CFe(t);return{file:r,commandArguments:n}},CFe=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(IFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},IFe=/ +/g;var Qne=(t,e,r)=>{t.sync=e(PFe,r),t.s=t.sync},eie=({options:t})=>tie(t),PFe=({options:t})=>({...tie(t),isSync:!0}),tie=t=>({options:{...OFe(t),...t}}),OFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},rie={preferLocal:!0};var nie=Da(()=>({})),MAt=Da(()=>({isSync:!0})),iie=Da(Zne),DAt=Da(Jne),LAt=Da(hte),$At=Da(eie,{},rie,Qne),{sendMessage:UAt,getOneMessage:FAt,getEachMessage:BAt,getCancelSignal:jAt}=ene();var oie=!1,sie=()=>{oie=!0},_o=()=>oie;var B_=null,aie=t=>(B_&&B_.destroy(),B_=new yo({totalAllowedTime:t}),B_),cie=()=>B_;var yo=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&&_o())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 IA({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 lie={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 DFe=kFe(import.meta.url),LFe=ys.dirname(DFe),$Fe=MFe(import.meta.url),If=ue("shell"),U$=new Set,uie={preferLocal:!0},dr=(t,e,r)=>{let[n,i]=UFe(e,r),o={...uie,...i},s=nie(t,n,o);fie(s,o),mie(s);let a=r?.idleTimeout;return a&&a>0&&hie(s,a),s},die=(t,e)=>{let r={...uie,...e},n=iie(t,r);return fie(n,r),mie(n),e?.idleTimeout&&e.idleTimeout>0&&hie(n,e.idleTimeout),n},UFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},fie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Ss.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new h_).pipe(Ss.stdout),t.stderr?.pipe(new h_).pipe(Ss.stderr);return}t.stdout?.pipe(Ss.stdout),t.stderr?.pipe(Ss.stderr)},F$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Ss.kill(-t.pid,e),If.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return If.error("Error killing process:",r),!1}},pie=t=>F$(t,"SIGKILL"),hie=(t,e)=>{let r=null,n=()=>{If.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),F$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(If.log(`Force killing idle process ${t.pid}`),pie(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)},mie=t=>{U$.add(t);let e=cie();if(e){let r=e.onTimesUp(()=>{If.log(`Global timer expired, killing process ${t.pid}`),F$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(If.log(`Force killing process ${t.pid} after timeout`),pie(t))},5e3)});t.on("exit",()=>{U$.delete(t),r()}),t.on("error",()=>{U$.delete(t),r()})}};function So(t,e){if(!Ss.env.NETLIFY_LOCAL_MODE)try{let i=$Fe.resolve(lie.name),o=ys.dirname(i);for(;o!==ys.dirname(o);){let s=ys.dirname(o);if(ys.basename(s)==="node_modules"){let a=ys.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(Ss.env.NODE_PATH){let i=ys.join(Ss.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=ys.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=ys.join(LFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var FFe=ue("utils"),BFe=t=>new Promise(e=>{setTimeout(e,t)});var B$=t=>{try{return new URL(t).hostname||null}catch{return null}},Hw=(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 BFe(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},La=(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},gie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):FFe.error("Could not parse JSON",n))}},jFe=t=>t.charAt(0).toUpperCase()+t.slice(1),Eo=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():jFe(e)).join(" ");function Es(t,e){e&&t.log(`Skill invoked: ${e}`)}var Ww=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),_ie=(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 j$=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}},zFe=1e4,z$=(t,e=zFe)=>{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 GFe}from"crypto";import{createReadStream as qFe}from"fs";import Yw from"fs/promises";import Tie from"os";import Kw from"path";var yie=ue("repo"),bie="runner-diffs-",Aie=t=>`${bie}${t}-`,wie=async t=>{let e=Tie.tmpdir(),r;try{r=await Yw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(bie)&&!n.startsWith(Aie(t))).map(n=>Yw.rm(Kw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>dr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Zw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{yie.info("Getting runner diffs");let n=await HFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=YFe(o);await KFe(h,r)}yie.info("Changes after processing"),await q$(r);let s=await H$(o,r);if(await G$(s,r),i=await WFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Yw.mkdtemp(Kw.join(Tie.tmpdir(),Aie(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:v})=>{let b=Kw.join(a,y);await Xr([...v?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:S}=await Yw.stat(b);return{path:b,size:S}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await vie(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 Eie(d,h)||(f=h)}await vie(r),se.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Eie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Sie=async t=>{let e=GFe("sha256");for await(let r of qFe(t))e.update(r);return e.digest("hex")},Eie=async(t,e)=>t.size===e.size&&await Sie(t.path)===await Sie(e.path),vie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},G$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},q$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},xie=/.. (.+)?\.log$/,VFe=[xie],HFe=async(t=process.cwd())=>{let e=await q$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
115
115
|
`).filter(i=>VFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},WFe=async(t=process.cwd())=>{try{return await Xr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},V$=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Rie=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},H$=async(t,e=process.cwd())=>{t||=await q$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
|
|
116
116
|
`).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${Kw.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(xie)?.[1];o&&n.push(`:!${o}.log`)}),n},Cie=async(t=process.cwd())=>{await Xr(["reset","--hard","HEAD"],{cwd:t})},Iie=async(t=process.cwd())=>{let e=await Xr(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
|
|
117
117
|
`).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},YFe=t=>{let e=t.split(`
|
|
@@ -510,6 +510,7 @@ You're an AI agent designed to assist with tasks related to a Netlify project. P
|
|
|
510
510
|
${S}
|
|
511
511
|
${SQ}
|
|
512
512
|
${b}
|
|
513
|
+
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.
|
|
513
514
|
${r}
|
|
514
515
|
</requirements>
|
|
515
516
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/agent-runner-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.166.0-alpha.0",
|
|
5
5
|
"description": "CLI tool for running Netlify agents",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@google/gemini-cli": "0.42.0",
|
|
87
87
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
88
88
|
"@netlify/cache-utils": "^6.0.5",
|
|
89
|
-
"@netlify/database-proxy": "^0.1
|
|
89
|
+
"@netlify/database-proxy": "^0.2.1",
|
|
90
90
|
"@netlify/otel": "^6.0.6",
|
|
91
91
|
"@netlify/ts-cli": "^1.2.0",
|
|
92
92
|
"@openai/codex": "0.128.0",
|