@netlify/agent-runner-cli 1.163.0-PAW-328.2 → 1.163.0-PAW-328.3
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 +11 -22
- package/dist/bin.js +11 -22
- package/dist/index.js +100 -111
- package/package.json +1 -1
package/dist/bin-local.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:t$},K$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Z$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:K$e};import{Buffer as J$e}from"buffer";var Pre=(t,e)=>t?void 0:X$e.bind(void 0,e),X$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!J$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Ore=(t,e)=>t?Q$e.bind(void 0,e):e1e.bind(void 0,e),Q$e=function*(t,e){Nre(t,e),yield e},e1e=function*(t,e){if(Nre(t,e),typeof e!="string"&&!jt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Nre=(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 t1e}from"buffer";import{StringDecoder as r1e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:n1e.bind(void 0,new TextEncoder)};let n=new r1e(e);return{transform:i1e.bind(void 0,n),final:o1e.bind(void 0,n)}},n1e=function*(t,e){t1e.isBuffer(e)?yield ms(e):typeof e=="string"?yield t.encode(e):yield e},i1e=function*(t,e){yield jt(e)?t.write(e):e},o1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kre}from"util";var n$=kre(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=a1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},Mre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*s1e(r,Number(e),t)},s1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},Dre=kre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),a1e=function*(t){yield t};var i$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Lre=(t,e)=>[...e.flatMap(r=>[...Ul(r,t,0)]),...$_(t)],Ul=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=l1e}=e[r];for(let i of n(t))yield*Ul(i,e,r+1)},$_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*c1e(r,Number(e),t)},c1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ul(n,r,e+1)},l1e=function*(t){yield t};var o$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Ure(t,s,o),l=$l(e),u=$l(r),d=l?n$.bind(void 0,Ow,a):i$.bind(void 0,Ul),f=l||u?n$.bind(void 0,Mre,a):i$.bind(void 0,$_),p=l||u?Dre.bind(void 0,a):void 0;return{stream:new u1e({writableObjectMode:n,writableHighWaterMark:$re(n),readableObjectMode:i,readableHighWaterMark:$re(i),transform(m,S,E){d([m,c,0],this,E)},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=Ure(s,r,a);t=Lre(c,t)}return t},Ure=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Pre(n,a)},Pw(r,s,n),Cw(r,o,n,c),{transform:t,final:e},{transform:Ore(i,a)},Cre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Fre=(t,e)=>{for(let r of d1e(t))f1e(t,r,e)},d1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),f1e=(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 ${La[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>p1e(a,n));r.input=R_(s)},p1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return h1e(r),R_(r)},h1e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(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 y1e,appendFileSync as S1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Sf(r,n)&&!Tn.has(e)&&m1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&g1e.has(o))||t.every(({type:i})=>Xn.has(i))),m1e=t=>t===1||t===2,g1e=new Set(["pipe","overlapped"]),Bre=async(t,e,r,n)=>{for await(let i of t)_1e(e)||zre(i,r,n)},jre=(t,e,r)=>{for(let n of t)zre(n,e,r)},_1e=t=>t._readableState.pipes.length>0,zre=(t,e,r)=>{let n=WA(t);go({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Gre=({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)=>E1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},E1e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=qte(t,o,d),p=ms(f),{stdioItems:h,objectMode:m}=e[r],S=v1e([p],h,c,n),{serializedResult:E,finalResult:b=E}=T1e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});b1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&A1e(E,h,i),A}catch(y){return n.error=y,A}},v1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},T1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:R_(t)};let s=i7(t,r);return n[o]?{serializedResult:s,finalResult:r$(s,!i[o],e)}:{serializedResult:s}},b1e=({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=r$(t,!1,s);try{jre(a,e,n)}catch(c){r.error??=c}},A1e=(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)?S1e(n,t):(r.add(o),y1e(n,t))}};var qre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ys(e,r,"all")]:Array.isArray(e)?[ys(t,r,"all"),...e]:jt(t)&&jt(e)?dL([t,e]):`${t}${e}`};import{once as s$}from"events";var Vre=async(t,e)=>{let[r,n]=await w1e(t);return e.isForcefullyTerminated??=!1,[r,n]},w1e=async t=>{let[e,r]=await Promise.allSettled([s$(t,"spawn"),s$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Hre(t):r.value},Hre=async t=>{try{return await s$(t,"exit")}catch{return Hre(t)}},Wre=async t=>{let[e,r]=await t;if(!x1e(e,r)&&a$(e,r))throw new Pi;return[e,r]},x1e=(t,e)=>t===void 0&&e===void 0,a$=(t,e)=>t!==0||e!==null;var Yre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Gte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R1e=(t,e,r)=>t!==void 0?t:a$(e,r)?new Pi:void 0;var Kre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=C1e(t,e,r),d=N1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cf(d,c,l)},C1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=P1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);O1e(u);let d=wre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},P1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,O1e=({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.`)},N1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=k1e({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}=Yre(c,r),{output:h,error:m=l}=Gre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ys(b,r,A)),E=ys(qre(h,r),r,"all");return D1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},k1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Fre(o,r);let a=M1e(r);return I1e(...gw(t,e,a))}catch(a){return If({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),D1e=({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}):L_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as TFe}from"events";import{spawn as bFe}from"child_process";import ene from"process";import{once as c$,on as L1e}from"events";var Zre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Tf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),$1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),$1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=Da(t,e,r),s=new AbortController;try{return await Promise.race([U1e(o,n,s),F1e(o,r,s),B1e(o,r,s)])}catch(a){throw bf(t),a}finally{s.abort(),sw(e,i)}},U1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await c$(t,"message",{signal:r});return n}for await(let[n]of L1e(t,"message",{signal:r}))if(e(n))return n},F1e=async(t,e,{signal:r})=>{await c$(t,"disconnect",{signal:r}),Lee(e)},B1e=async(t,e,{signal:r})=>{let[n]=await c$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Xre,on as j1e}from"events";var Qre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>l$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),l$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Tf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=Da(t,e,r),a=new AbortController,c={};return z1e(t,s,a),G1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),q1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},z1e=async(t,e,r)=>{try{await Xre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},G1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Xre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},q1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of j1e(r,"message",{signal:o.signal}))Jre(s),yield c}catch{Jre(s)}finally{o.abort(),sw(e,a),n||bf(t),i&&await t}},Jre=({error:t})=>{if(t)throw t};var tne=(t,{ipc:e})=>{Object.assign(t,nne(t,!1,e))},rne=()=>{let t=ene,e=!0,r=ene.channel!==void 0;return{...nne(t,e,r),getCancelSignal:lte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Zre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Qre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as V1e}from"child_process";import{PassThrough as H1e,Readable as W1e,Writable as Y1e,Duplex as K1e}from"stream";var ine=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QL(n);let a=new V1e;Z1e(a,n),Object.assign(a,{readable:J1e,writable:X1e,duplex:Q1e});let c=If({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=eUe(c,s,i);return{subprocess:a,promise:l}},Z1e=(t,e)=>{let r=U_(),n=U_(),i=U_(),o=Array.from({length:e.length-3},U_),s=U_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},U_=()=>{let t=new H1e;return t.end(),t},J1e=()=>new W1e({read(){}}),X1e=()=>new Y1e({write(){}}),Q1e=()=>new K1e({read(){},write(){}}),eUe=async(t,e,r)=>Cf(t,e,r);import{createReadStream as one,createWriteStream as sne}from"fs";import{Buffer as tUe}from"buffer";import{Readable as F_,Writable as rUe,Duplex as nUe}from"stream";var cne=(t,e)=>Iw(iUe,t,e,!1),B_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${La[t]}.`)},ane={fileNumber:B_,generator:o$,asyncGenerator:o$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:nUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},iUe={input:{...ane,fileUrl:({value:t})=>({stream:one(t)}),filePath:({value:{file:t}})=>({stream:one(t)}),webStream:({value:t})=>({stream:F_.fromWeb(t)}),iterable:({value:t})=>({stream:F_.from(t)}),asyncIterable:({value:t})=>({stream:F_.from(t)}),string:({value:t})=>({stream:F_.from(t)}),uint8Array:({value:t})=>({stream:F_.from(tUe.from(t))})},output:{...ane,fileUrl:({value:t})=>({stream:sne(t)}),filePath:({value:{file:t,append:e}})=>({stream:sne(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:rUe.fromWeb(t)}),iterable:B_,asyncIterable:B_,string:B_,uint8Array:B_}};import{on as oUe,once as lne}from"events";import{PassThrough as sUe,getDefaultHighWaterMark as aUe}from"stream";import{finished as fne}from"stream/promises";function Fl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)d$(i);let e=t.some(({readableObjectMode:i})=>i),r=cUe(t,e),n=new u$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var cUe=(t,e)=>{if(t.length===0)return aUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},u$=class extends sUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(d$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=lUe(this,this.#e,this.#o);let r=fUe({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(d$(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)}},lUe=async(t,e,r)=>{Dw(t,une);let n=new AbortController;try{await Promise.race([uUe(t,n),dUe(t,e,r,n)])}finally{n.abort(),Dw(t,-une)}},uUe=async(t,{signal:e})=>{try{await fne(t,{signal:e,cleanup:!0})}catch(r){throw pne(t,r),r}},dUe=async(t,e,r,{signal:n})=>{for await(let[i]of oUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},d$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},fUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,dne);let a=new AbortController;try{await Promise.race([pUe(o,e,a),hUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),mUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-dne)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?f$(t):gUe(t))},pUe=async(t,e,{signal:r})=>{try{await t,r.aborted||f$(e)}catch(n){r.aborted||pne(e,n)}},hUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await fne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;hne(s)?i.add(e):mne(t,s)}},mUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await lne(t,i,{signal:o}),!t.readable)return lne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},gUe=t=>{t.writable&&t.end()},pne=(t,e)=>{hne(e)?f$(t):mne(t,e)},hne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",f$=t=>{(t.readable||t.writable)&&t.destroy()},mne=(t,e)=>{t.destroyed||(t.once("error",_Ue),t.destroy(e))},_Ue=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},une=2,dne=1;import{finished as gne}from"stream/promises";var Of=(t,e)=>{t.pipe(e),yUe(t,e),SUe(t,e)},yUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}p$(e)}},p$=t=>{t.writable&&t.end()},SUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}h$(t)}},h$=t=>{t.readable&&t.destroy()};var _ne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Xn.has(c)))EUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Xn.has(c)))TUe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fl(o);Of(s,i)}},EUe=(t,e,r,n)=>{r==="output"?Of(t.stdio[n],e):Of(e,t.stdio[n]);let i=vUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},vUe=["stdin","stdout","stderr"],TUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;bUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},bUe=(t,{signal:e})=>{Ci(t)&&Dl(t,AUe,e)},AUe=2;import{addAbortListener as RUe}from"events";var Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var 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",m$=Symbol.for("signal-exit emitter"),g$=globalThis,wUe=Object.defineProperty.bind(Object),_$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(g$[m$])return g$[m$];wUe(g$,m$,{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{},xUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),y$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},S$=class extends $w{#e=E$.platform==="win32"?"SIGINT":"SIGHUP";#r=new _$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Bl)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!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 Bl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Bl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return 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)}},E$=globalThis.process,{onExit:yne,load:$vt,unload:Uvt}=xUe(Lw(E$)?new S$(E$):new y$);var Sne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=yne(()=>{t.kill()});RUe(n,()=>{i()})};var vne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=IUe(r,n,i),{sourceStream:d,sourceError:f}=PUe(t,l),{options:p,fileDescriptors:h}=yo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},IUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=CUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},CUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ene,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||lL(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(Ene)(i,o,s),pipeOptions:s}}if(yo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ene=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),PUe=(t,e)=>{try{return{sourceStream:Af(t,e)}}catch(r){return{sourceError:r}}};var bne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=OUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw v$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},OUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return h$(t),n;if(e!==void 0)return p$(r),e},v$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>If({error:t,command:Tne,escapedCommand:Tne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Tne="source.pipe(destination)";var Ane=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 NUe}from"stream/promises";var wne=(t,e,r)=>{let n=Uw.has(e)?MUe(t,e):kUe(t,e);return Dl(t,LUe,r.signal),Dl(e,$Ue,r.signal),DUe(e),n},kUe=(t,e)=>{let r=Fl([t]);return Of(r,e),Uw.set(e,r),r},MUe=(t,e)=>{let r=Uw.get(e);return r.add(t),r},DUe=async t=>{try{await NUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,LUe=2,$Ue=1;import{aborted as UUe}from"util";var xne=(t,e)=>t===void 0?[]:[FUe(t,e)],FUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await UUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw v$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Ot(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vne(t,...e),i=BUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},BUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=jUe(t,i);bne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=wne(e,o,d);return await Promise.race([Ane(u),...xne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},jUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as YUe}from"timers/promises";import{on as zUe}from"events";import{getDefaultHighWaterMark as GUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return qUe(e,s),Ine({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},qUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},T$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;VUe(e,s,t);let a=t.readableObjectMode&&!o;return Ine({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},VUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ine=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=zUe(t,"data",{signal:e.signal,highWaterMark:Rne,highWatermark:Rne});return HUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},b$=GUe(!0),Rne=b$,HUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=WUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ul(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*$_(a)}},WUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Cw(t,i,!n,{})].filter(Boolean);var Cne=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=KUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ZUe(t),d]);return}let f=e$(c,r),p=T$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([JUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},KUe=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=T$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Bre(a,t,r,o)},ZUe=async t=>{await YUe(),t.readableFlowing===null&&t.resume()},JUe=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 Rf(r,{maxBuffer:o})}catch(a){return Pne(Bte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},A$=async t=>{try{return await t}catch(e){return Pne(e)}},Pne=({bufferedData:t})=>r7(t)?new Uint8Array(t):t;import{finished as XUe}from"stream/promises";var j_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=QUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],XUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||rFe(a,e,r,n)}finally{s.abort()}},QUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&eFe(t,r,n),n},eFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{tFe(e,r),n.call(t,...i)}},tFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},rFe=(t,e,r,n)=>{if(!nFe(t,e,r,n))throw t},nFe=(t,e,r,n=!0)=>r.propagating?One(t)||jw(t):(r.propagating=!0,w$(r,e)===n?One(t):jw(t)),w$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",One=t=>t?.code==="EPIPE";var Nne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>x$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),x$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=j_(t,e,l);if(w$(l,e)){await u;return}let[d]=await Promise.all([Cne({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 kne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fl([t,e].filter(Boolean)):void 0,Mne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>x$({...iFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:oFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),iFe=({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}},oFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as sFe}from"events";var Dne=t=>Sf(t,"ipc"),Lne=(t,e)=>{let r=WA(t);go({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var $ne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Dne(o),a=gs(e,"ipc"),c=gs(r,"ipc");for await(let l of l$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(jte(t,i,c),i.push(l)),s&&Lne(l,o);return i},Une=async(t,e)=>(await Promise.allSettled([t]),e);var Fne=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:S,controller:E})=>{let b=Vre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=Nne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Mne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),C=[],O=$ne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:C,verboseInfo:p}),N=aFe(m,t,A),R=cFe(h,A);try{return await Promise.race([Promise.all([{},Wre(b),Promise.all(y),x,O,Ste(t,d),...N,...R]),S,lFe(t,E),...hte(t,o,f,E),...Dee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...fte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},b,Promise.all(y.map(_=>A$(_))),A$(x),Une(O,C),Promise.allSettled(N),Promise.allSettled(R)])}},aFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:j_(n,i,r)),cFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ni(o,{checkOpen:!1})&&!Ci(o)).map(({type:i,value:o,stream:s=o})=>j_(s,n,e,{isSameDirection:Xn.has(i),stopOnExit:i==="native"}))),lFe=async(t,{signal:e})=>{let[r]=await sFe(t,"error",{signal:e});throw r};var Bne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_o();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Nf=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 uFe}from"stream";import{callbackify as dFe}from"util";import{finished as jne}from"stream/promises";var R$=async t=>{if(t!==void 0)try{await I$(t)}catch{}},zne=async t=>{if(t!==void 0)try{await C$(t)}catch{}},I$=async t=>{await jne(t,{cleanup:!0,readable:!1,writable:!0})},C$=async t=>{await jne(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 Gne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Tn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=P$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=O$(a,s),{read:f,onStdoutDataDone:p}=N$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new uFe({read:f,destroy:dFe(M$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return k$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},P$=(t,e,r)=>{let n=Af(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},O$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:b$},N$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){fFe(this,s,o)},onStdoutDataDone:o}},fFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},k$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await C$(t),await n,await R$(i),await e,r.readable&&r.push(null)}catch(o){await R$(i),qne(r,o)}},M$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Nf(r,e)&&(qne(t,n),await zw(e,n))},qne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as pFe}from"stream";import{callbackify as Vne}from"util";var Hne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=D$(t,r,e),s=new pFe({...L$(n,t,i),destroy:Vne(U$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return $$(n,s),s},D$=(t,e,r)=>{let n=iw(t,e),i=z_(r,n,"writableFinal"),o=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},L$=(t,e,r)=>({write:hFe.bind(void 0,t),final:Vne(mFe.bind(void 0,t,e,r))}),hFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},mFe=async(t,e,r)=>{await Nf(r,e)&&(t.writable&&t.end(),await e)},$$=async(t,e,r)=>{try{await I$(t),e.writable&&e.end()}catch(n){await zne(r),Wne(e,n)}},U$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Nf(r,e),await Nf(n,e)&&(Wne(t,i),await zw(e,i))},Wne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as gFe}from"stream";import{callbackify as _Fe}from"util";var Yne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Tn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=P$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=D$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=O$(c,a),{read:S,onStdoutDataDone:E}=N$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new gFe({read:S,...L$(u,t,d),destroy:_Fe(yFe.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 k$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),$$(u,b,c),b},yFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([M$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),U$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var F$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Tn.has(e),s=Af(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return SFe(a,s,t)},SFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kne=(t,{encoding:e})=>{let r=Bne();t.readable=Gne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Hne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Yne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=F$.bind(void 0,t,e),t[Symbol.asyncIterator]=F$.bind(void 0,t,e,{})};var Zne=(t,e)=>{for(let[r,n]of vFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},EFe=(async()=>{})().constructor.prototype,vFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(EFe,t)]);var Jne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=AFe(t,e,r),{subprocess:f,promise:p}=xFe({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}),Zne(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},AFe=(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=wFe(l),d=cne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},wFe=({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}},xFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=bFe(...gw(t,e,r))}catch(h){return ine({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;TFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_ne(c,a,l),Sne(c,r,l);let d={},f=_o();c.kill=kee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kne(c,r),Kne(c,r),tne(c,r);let p=RFe({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}},RFe=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,S]=await Fne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((y,x)=>ys(y,e,x)),b=ys(m,e,"all"),A=IFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cf(A,n,e)},IFe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?L_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof So,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):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,CFe(n,t[n],i)]));return{...t,...r}},CFe=(t,e,r)=>PFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,PFe=new Set(["env",...mL]);var $a=(t,e,r,n)=>{let i=(s,a,c)=>$a(s,a,r,c),o=(...s)=>OFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},OFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=NFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Kre(a,c,l):Jne(a,c,l,i)},NFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=c7(e)?l7(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 Xne=({file:t,commandArguments:e})=>eie(t,e),Qne=({file:t,commandArguments:e})=>({...eie(t,e),isSync:!0}),eie=(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]=kFe(t);return{file:r,commandArguments:n}},kFe=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(MFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},MFe=/ +/g;var tie=(t,e,r)=>{t.sync=e(DFe,r),t.s=t.sync},rie=({options:t})=>nie(t),DFe=({options:t})=>({...nie(t),isSync:!0}),nie=t=>({options:{...LFe(t),...t}}),LFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},iie={preferLocal:!0};var oie=$a(()=>({})),RAt=$a(()=>({isSync:!0})),sie=$a(Xne),IAt=$a(Qne),CAt=$a(gte),PAt=$a(rie,{},iie,tie),{sendMessage:OAt,getOneMessage:NAt,getEachMessage:kAt,getCancelSignal:MAt}=rne();var aie=!1,cie=()=>{aie=!0},vo=()=>aie;var G_=null,lie=t=>(G_&&G_.destroy(),G_=new Ss({totalAllowedTime:t}),G_),uie=()=>G_;var Ss=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&vo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await PA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ce.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 die={name:"@netlify/agent-runner-cli",type:"module",version:"1.163.0-PAW-328.2",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: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 BFe=UFe(import.meta.url),jFe=Es.dirname(BFe),zFe=FFe(import.meta.url),kf=ue("shell"),B$=new Set,fie={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=GFe(e,r),o={...fie,...i},s=oie(t,n,o);hie(s,o),_ie(s);let a=r?.idleTimeout;return a&&a>0&&gie(s,a),s},pie=(t,e)=>{let r={...fie,...e},n=sie(t,r);return hie(n,r),_ie(n),e?.idleTimeout&&e.idleTimeout>0&&gie(n,e.idleTimeout),n},GFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},hie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(vs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new __).pipe(vs.stdout),t.stderr?.pipe(new __).pipe(vs.stderr);return}t.stdout?.pipe(vs.stdout),t.stderr?.pipe(vs.stderr)},j$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(vs.kill(-t.pid,e),kf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return kf.error("Error killing process:",r),!1}},mie=t=>j$(t,"SIGKILL"),gie=(t,e)=>{let r=null,n=()=>{kf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing idle process ${t.pid}`),mie(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)},_ie=t=>{B$.add(t);let e=uie();if(e){let r=e.onTimesUp(()=>{kf.log(`Global timer expired, killing process ${t.pid}`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing process ${t.pid} after timeout`),mie(t))},5e3)});t.on("exit",()=>{B$.delete(t),r()}),t.on("error",()=>{B$.delete(t),r()})}};function Hw(t,e){return!!ki(t,e)}function ki(t,e){if(!vs.env.NETLIFY_LOCAL_MODE)try{let i=zFe.resolve(die.name),o=Es.dirname(i);for(;o!==Es.dirname(o);){let s=Es.dirname(o);if(Es.basename(s)==="node_modules"){let a=Es.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(vs.env.NODE_PATH){let i=Es.join(vs.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=Es.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=Es.join(jFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var qFe=ue("utils"),VFe=t=>new Promise(e=>{setTimeout(e,t)});var z$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ww=(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 VFe(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},Ua=(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},yie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):qFe.error("Could not parse JSON",n))}},HFe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():HFe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Yw=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Sie=(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 G$=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}},WFe=1e4,q$=(t,e=WFe)=>{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 YFe}from"crypto";import{createReadStream as KFe}from"fs";import Kw from"fs/promises";import Aie from"os";import Zw from"path";var Eie=ue("repo"),wie="runner-diffs-",xie=t=>`${wie}${t}-`,Rie=async t=>{let e=Aie.tmpdir(),r;try{r=await Kw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(wie)&&!n.startsWith(xie(t))).map(n=>Kw.rm(Zw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},nn=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Jw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Eie.info("Getting runner diffs");let n=await JFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=QFe(o);await eBe(h,r)}Eie.info("Changes after processing"),await H$(r);let s=await W$(o,r);if(await V$(s,r),i=await XFe(r),!i)return{hasChanges:!1,ignored:s};await nn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Kw.mkdtemp(Zw.join(Aie.tmpdir(),xie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=Zw.join(a,S);await nn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Kw.stat(b);return{path:b,size:y}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await bie(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 Tie(d,h)||(f=h)}await bie(r),ce.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Tie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},vie=async t=>{let e=YFe("sha256");for await(let r of KFe(t))e.update(r);return e.digest("hex")},Tie=async(t,e)=>t.size===e.size&&await vie(t.path)===await vie(e.path),bie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await nn(["reset","--soft","HEAD~1"],{cwd:t})},V$=async(t=[],e=process.cwd())=>{await nn(["add",".",...t],{cwd:e})},H$=async(t=process.cwd())=>{let e=await nn(["status","-s"],{cwd:t});return String(e.stdout??"")},Iie=/.. (.+)?\.log$/,ZFe=[Iie],JFe=async(t=process.cwd())=>{let e=await H$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
114
|
+
if (condition) { yield value; }`)};import{Buffer as t1e}from"buffer";import{StringDecoder as r1e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:n1e.bind(void 0,new TextEncoder)};let n=new r1e(e);return{transform:i1e.bind(void 0,n),final:o1e.bind(void 0,n)}},n1e=function*(t,e){t1e.isBuffer(e)?yield ms(e):typeof e=="string"?yield t.encode(e):yield e},i1e=function*(t,e){yield jt(e)?t.write(e):e},o1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kre}from"util";var n$=kre(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=a1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},Mre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*s1e(r,Number(e),t)},s1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},Dre=kre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),a1e=function*(t){yield t};var i$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Lre=(t,e)=>[...e.flatMap(r=>[...Ul(r,t,0)]),...$_(t)],Ul=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=l1e}=e[r];for(let i of n(t))yield*Ul(i,e,r+1)},$_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*c1e(r,Number(e),t)},c1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ul(n,r,e+1)},l1e=function*(t){yield t};var o$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Ure(t,s,o),l=$l(e),u=$l(r),d=l?n$.bind(void 0,Ow,a):i$.bind(void 0,Ul),f=l||u?n$.bind(void 0,Mre,a):i$.bind(void 0,$_),p=l||u?Dre.bind(void 0,a):void 0;return{stream:new u1e({writableObjectMode:n,writableHighWaterMark:$re(n),readableObjectMode:i,readableHighWaterMark:$re(i),transform(m,S,E){d([m,c,0],this,E)},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=Ure(s,r,a);t=Lre(c,t)}return t},Ure=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Pre(n,a)},Pw(r,s,n),Cw(r,o,n,c),{transform:t,final:e},{transform:Ore(i,a)},Cre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Fre=(t,e)=>{for(let r of d1e(t))f1e(t,r,e)},d1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),f1e=(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 ${La[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>p1e(a,n));r.input=R_(s)},p1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return h1e(r),R_(r)},h1e=t=>{let e=t.find(r=>typeof r!="string"&&!jt(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 y1e,appendFileSync as S1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Sf(r,n)&&!Tn.has(e)&&m1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&g1e.has(o))||t.every(({type:i})=>Xn.has(i))),m1e=t=>t===1||t===2,g1e=new Set(["pipe","overlapped"]),Bre=async(t,e,r,n)=>{for await(let i of t)_1e(e)||zre(i,r,n)},jre=(t,e,r)=>{for(let n of t)zre(n,e,r)},_1e=t=>t._readableState.pipes.length>0,zre=(t,e,r)=>{let n=WA(t);go({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Gre=({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)=>E1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},E1e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=qte(t,o,d),p=ms(f),{stdioItems:h,objectMode:m}=e[r],S=v1e([p],h,c,n),{serializedResult:E,finalResult:b=E}=T1e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});b1e({serializedResult:E,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let A=a[r]?b:void 0;try{return n.error===void 0&&A1e(E,h,i),A}catch(y){return n.error=y,A}},v1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},T1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:R_(t)};let s=i7(t,r);return n[o]?{serializedResult:s,finalResult:r$(s,!i[o],e)}:{serializedResult:s}},b1e=({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=r$(t,!1,s);try{jre(a,e,n)}catch(c){r.error??=c}},A1e=(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)?S1e(n,t):(r.add(o),y1e(n,t))}};var qre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ys(e,r,"all")]:Array.isArray(e)?[ys(t,r,"all"),...e]:jt(t)&&jt(e)?dL([t,e]):`${t}${e}`};import{once as s$}from"events";var Vre=async(t,e)=>{let[r,n]=await w1e(t);return e.isForcefullyTerminated??=!1,[r,n]},w1e=async t=>{let[e,r]=await Promise.allSettled([s$(t,"spawn"),s$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Hre(t):r.value},Hre=async t=>{try{return await s$(t,"exit")}catch{return Hre(t)}},Wre=async t=>{let[e,r]=await t;if(!x1e(e,r)&&a$(e,r))throw new Pi;return[e,r]},x1e=(t,e)=>t===void 0&&e===void 0,a$=(t,e)=>t!==0||e!==null;var Yre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=R1e(t,e,r),s=o?.code==="ETIMEDOUT",a=Gte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},R1e=(t,e,r)=>t!==void 0?t:a$(e,r)?new Pi:void 0;var Kre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=C1e(t,e,r),d=N1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Cf(d,c,l)},C1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=P1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);O1e(u);let d=wre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},P1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,O1e=({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.`)},N1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=k1e({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}=Yre(c,r),{output:h,error:m=l}=Gre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ys(b,r,A)),E=ys(qre(h,r),r,"all");return D1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},k1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Fre(o,r);let a=M1e(r);return I1e(...gw(t,e,a))}catch(a){return If({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},M1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),D1e=({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}):L_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as TFe}from"events";import{spawn as bFe}from"child_process";import ene from"process";import{once as c$,on as L1e}from"events";var Zre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Tf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),$1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),$1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=Da(t,e,r),s=new AbortController;try{return await Promise.race([U1e(o,n,s),F1e(o,r,s),B1e(o,r,s)])}catch(a){throw bf(t),a}finally{s.abort(),sw(e,i)}},U1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await c$(t,"message",{signal:r});return n}for await(let[n]of L1e(t,"message",{signal:r}))if(e(n))return n},F1e=async(t,e,{signal:r})=>{await c$(t,"disconnect",{signal:r}),Lee(e)},B1e=async(t,e,{signal:r})=>{let[n]=await c$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Xre,on as j1e}from"events";var Qre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>l$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),l$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Tf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=Da(t,e,r),a=new AbortController,c={};return z1e(t,s,a),G1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),q1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},z1e=async(t,e,r)=>{try{await Xre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},G1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Xre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},q1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of j1e(r,"message",{signal:o.signal}))Jre(s),yield c}catch{Jre(s)}finally{o.abort(),sw(e,a),n||bf(t),i&&await t}},Jre=({error:t})=>{if(t)throw t};var tne=(t,{ipc:e})=>{Object.assign(t,nne(t,!1,e))},rne=()=>{let t=ene,e=!0,r=ene.channel!==void 0;return{...nne(t,e,r),getCancelSignal:lte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Zre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Qre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as V1e}from"child_process";import{PassThrough as H1e,Readable as W1e,Writable as Y1e,Duplex as K1e}from"stream";var ine=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{QL(n);let a=new V1e;Z1e(a,n),Object.assign(a,{readable:J1e,writable:X1e,duplex:Q1e});let c=If({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=eUe(c,s,i);return{subprocess:a,promise:l}},Z1e=(t,e)=>{let r=U_(),n=U_(),i=U_(),o=Array.from({length:e.length-3},U_),s=U_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},U_=()=>{let t=new H1e;return t.end(),t},J1e=()=>new W1e({read(){}}),X1e=()=>new Y1e({write(){}}),Q1e=()=>new K1e({read(){},write(){}}),eUe=async(t,e,r)=>Cf(t,e,r);import{createReadStream as one,createWriteStream as sne}from"fs";import{Buffer as tUe}from"buffer";import{Readable as F_,Writable as rUe,Duplex as nUe}from"stream";var cne=(t,e)=>Iw(iUe,t,e,!1),B_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${La[t]}.`)},ane={fileNumber:B_,generator:o$,asyncGenerator:o$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:nUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},iUe={input:{...ane,fileUrl:({value:t})=>({stream:one(t)}),filePath:({value:{file:t}})=>({stream:one(t)}),webStream:({value:t})=>({stream:F_.fromWeb(t)}),iterable:({value:t})=>({stream:F_.from(t)}),asyncIterable:({value:t})=>({stream:F_.from(t)}),string:({value:t})=>({stream:F_.from(t)}),uint8Array:({value:t})=>({stream:F_.from(tUe.from(t))})},output:{...ane,fileUrl:({value:t})=>({stream:sne(t)}),filePath:({value:{file:t,append:e}})=>({stream:sne(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:rUe.fromWeb(t)}),iterable:B_,asyncIterable:B_,string:B_,uint8Array:B_}};import{on as oUe,once as lne}from"events";import{PassThrough as sUe,getDefaultHighWaterMark as aUe}from"stream";import{finished as fne}from"stream/promises";function Fl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)d$(i);let e=t.some(({readableObjectMode:i})=>i),r=cUe(t,e),n=new u$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var cUe=(t,e)=>{if(t.length===0)return aUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},u$=class extends sUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(d$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=lUe(this,this.#e,this.#o);let r=fUe({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(d$(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)}},lUe=async(t,e,r)=>{Dw(t,une);let n=new AbortController;try{await Promise.race([uUe(t,n),dUe(t,e,r,n)])}finally{n.abort(),Dw(t,-une)}},uUe=async(t,{signal:e})=>{try{await fne(t,{signal:e,cleanup:!0})}catch(r){throw pne(t,r),r}},dUe=async(t,e,r,{signal:n})=>{for await(let[i]of oUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},d$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},fUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,dne);let a=new AbortController;try{await Promise.race([pUe(o,e,a),hUe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),mUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-dne)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?f$(t):gUe(t))},pUe=async(t,e,{signal:r})=>{try{await t,r.aborted||f$(e)}catch(n){r.aborted||pne(e,n)}},hUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await fne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;hne(s)?i.add(e):mne(t,s)}},mUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await lne(t,i,{signal:o}),!t.readable)return lne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},gUe=t=>{t.writable&&t.end()},pne=(t,e)=>{hne(e)?f$(t):mne(t,e)},hne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",f$=t=>{(t.readable||t.writable)&&t.destroy()},mne=(t,e)=>{t.destroyed||(t.once("error",_Ue),t.destroy(e))},_Ue=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},une=2,dne=1;import{finished as gne}from"stream/promises";var Of=(t,e)=>{t.pipe(e),yUe(t,e),SUe(t,e)},yUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}p$(e)}},p$=t=>{t.writable&&t.end()},SUe=async(t,e)=>{if(!(Ci(t)||Ci(e))){try{await gne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}h$(t)}},h$=t=>{t.readable&&t.destroy()};var _ne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Xn.has(c)))EUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Xn.has(c)))TUe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fl(o);Of(s,i)}},EUe=(t,e,r,n)=>{r==="output"?Of(t.stdio[n],e):Of(e,t.stdio[n]);let i=vUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},vUe=["stdin","stdout","stderr"],TUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;bUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},bUe=(t,{signal:e})=>{Ci(t)&&Dl(t,AUe,e)},AUe=2;import{addAbortListener as RUe}from"events";var Bl=[];Bl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var 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",m$=Symbol.for("signal-exit emitter"),g$=globalThis,wUe=Object.defineProperty.bind(Object),_$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(g$[m$])return g$[m$];wUe(g$,m$,{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{},xUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),y$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},S$=class extends $w{#e=E$.platform==="win32"?"SIGINT":"SIGHUP";#r=new _$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Bl)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!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 Bl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Bl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return 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)}},E$=globalThis.process,{onExit:yne,load:$vt,unload:Uvt}=xUe(Lw(E$)?new S$(E$):new y$);var Sne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=yne(()=>{t.kill()});RUe(n,()=>{i()})};var vne=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=IUe(r,n,i),{sourceStream:d,sourceError:f}=PUe(t,l),{options:p,fileDescriptors:h}=yo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},IUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=CUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},CUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ene,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||lL(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(Ene)(i,o,s),pipeOptions:s}}if(yo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ene=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),PUe=(t,e)=>{try{return{sourceStream:Af(t,e)}}catch(r){return{sourceError:r}}};var bne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=OUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw v$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},OUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return h$(t),n;if(e!==void 0)return p$(r),e},v$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>If({error:t,command:Tne,escapedCommand:Tne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Tne="source.pipe(destination)";var Ane=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 NUe}from"stream/promises";var wne=(t,e,r)=>{let n=Uw.has(e)?MUe(t,e):kUe(t,e);return Dl(t,LUe,r.signal),Dl(e,$Ue,r.signal),DUe(e),n},kUe=(t,e)=>{let r=Fl([t]);return Of(r,e),Uw.set(e,r),r},MUe=(t,e)=>{let r=Uw.get(e);return r.add(t),r},DUe=async t=>{try{await NUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,LUe=2,$Ue=1;import{aborted as UUe}from"util";var xne=(t,e)=>t===void 0?[]:[FUe(t,e)],FUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await UUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw v$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Ot(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vne(t,...e),i=BUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},BUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=jUe(t,i);bne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=wne(e,o,d);return await Promise.race([Ane(u),...xne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},jUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as YUe}from"timers/promises";import{on as zUe}from"events";import{getDefaultHighWaterMark as GUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return qUe(e,s),Ine({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},qUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},T$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;VUe(e,s,t);let a=t.readableObjectMode&&!o;return Ine({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},VUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Ine=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=zUe(t,"data",{signal:e.signal,highWaterMark:Rne,highWatermark:Rne});return HUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},b$=GUe(!0),Rne=b$,HUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=WUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ul(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*$_(a)}},WUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Cw(t,i,!n,{})].filter(Boolean);var Cne=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=KUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([ZUe(t),d]);return}let f=e$(c,r),p=T$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([JUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},KUe=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=T$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Bre(a,t,r,o)},ZUe=async t=>{await YUe(),t.readableFlowing===null&&t.resume()},JUe=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 Rf(r,{maxBuffer:o})}catch(a){return Pne(Bte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},A$=async t=>{try{return await t}catch(e){return Pne(e)}},Pne=({bufferedData:t})=>r7(t)?new Uint8Array(t):t;import{finished as XUe}from"stream/promises";var j_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=QUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],XUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||rFe(a,e,r,n)}finally{s.abort()}},QUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&eFe(t,r,n),n},eFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{tFe(e,r),n.call(t,...i)}},tFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},rFe=(t,e,r,n)=>{if(!nFe(t,e,r,n))throw t},nFe=(t,e,r,n=!0)=>r.propagating?One(t)||jw(t):(r.propagating=!0,w$(r,e)===n?One(t):jw(t)),w$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",One=t=>t?.code==="EPIPE";var Nne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>x$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),x$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=j_(t,e,l);if(w$(l,e)){await u;return}let[d]=await Promise.all([Cne({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 kne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fl([t,e].filter(Boolean)):void 0,Mne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>x$({...iFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:oFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),iFe=({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}},oFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as sFe}from"events";var Dne=t=>Sf(t,"ipc"),Lne=(t,e)=>{let r=WA(t);go({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var $ne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Dne(o),a=gs(e,"ipc"),c=gs(r,"ipc");for await(let l of l$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(jte(t,i,c),i.push(l)),s&&Lne(l,o);return i},Une=async(t,e)=>(await Promise.allSettled([t]),e);var Fne=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:S,controller:E})=>{let b=Vre(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=Nne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Mne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),C=[],O=$ne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:C,verboseInfo:p}),N=aFe(m,t,A),R=cFe(h,A);try{return await Promise.race([Promise.all([{},Wre(b),Promise.all(y),x,O,Ste(t,d),...N,...R]),S,lFe(t,E),...hte(t,o,f,E),...Dee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...fte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch($){return f.terminationReason??="other",Promise.all([{error:$},b,Promise.all(y.map(_=>A$(_))),A$(x),Une(O,C),Promise.allSettled(N),Promise.allSettled(R)])}},aFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:j_(n,i,r)),cFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ni(o,{checkOpen:!1})&&!Ci(o)).map(({type:i,value:o,stream:s=o})=>j_(s,n,e,{isSameDirection:Xn.has(i),stopOnExit:i==="native"}))),lFe=async(t,{signal:e})=>{let[r]=await sFe(t,"error",{signal:e});throw r};var Bne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=_o();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},Nf=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 uFe}from"stream";import{callbackify as dFe}from"util";import{finished as jne}from"stream/promises";var R$=async t=>{if(t!==void 0)try{await I$(t)}catch{}},zne=async t=>{if(t!==void 0)try{await C$(t)}catch{}},I$=async t=>{await jne(t,{cleanup:!0,readable:!1,writable:!0})},C$=async t=>{await jne(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 Gne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Tn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=P$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=O$(a,s),{read:f,onStdoutDataDone:p}=N$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new uFe({read:f,destroy:dFe(M$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return k$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},P$=(t,e,r)=>{let n=Af(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},O$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:b$},N$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=_o(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){fFe(this,s,o)},onStdoutDataDone:o}},fFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},k$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await C$(t),await n,await R$(i),await e,r.readable&&r.push(null)}catch(o){await R$(i),qne(r,o)}},M$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Nf(r,e)&&(qne(t,n),await zw(e,n))},qne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as pFe}from"stream";import{callbackify as Vne}from"util";var Hne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=D$(t,r,e),s=new pFe({...L$(n,t,i),destroy:Vne(U$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return $$(n,s),s},D$=(t,e,r)=>{let n=iw(t,e),i=z_(r,n,"writableFinal"),o=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},L$=(t,e,r)=>({write:hFe.bind(void 0,t),final:Vne(mFe.bind(void 0,t,e,r))}),hFe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},mFe=async(t,e,r)=>{await Nf(r,e)&&(t.writable&&t.end(),await e)},$$=async(t,e,r)=>{try{await I$(t),e.writable&&e.end()}catch(n){await zne(r),Wne(e,n)}},U$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Nf(r,e),await Nf(n,e)&&(Wne(t,i),await zw(e,i))},Wne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as gFe}from"stream";import{callbackify as _Fe}from"util";var Yne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Tn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=P$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=D$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=O$(c,a),{read:S,onStdoutDataDone:E}=N$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new gFe({read:S,...L$(u,t,d),destroy:_Fe(yFe.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 k$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),$$(u,b,c),b},yFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([M$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),U$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var F$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Tn.has(e),s=Af(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return SFe(a,s,t)},SFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kne=(t,{encoding:e})=>{let r=Bne();t.readable=Gne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Hne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Yne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=F$.bind(void 0,t,e),t[Symbol.asyncIterator]=F$.bind(void 0,t,e,{})};var Zne=(t,e)=>{for(let[r,n]of vFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},EFe=(async()=>{})().constructor.prototype,vFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(EFe,t)]);var Jne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=AFe(t,e,r),{subprocess:f,promise:p}=xFe({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}),Zne(f,p),yo.set(f,{options:u,fileDescriptors:d}),f},AFe=(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=wFe(l),d=cne(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},wFe=({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}},xFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=bFe(...gw(t,e,r))}catch(h){return ine({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;TFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_ne(c,a,l),Sne(c,r,l);let d={},f=_o();c.kill=kee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kne(c,r),Kne(c,r),tne(c,r);let p=RFe({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}},RFe=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,S]=await Fne({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let E=h.map((y,x)=>ys(y,e,x)),b=ys(m,e,"all"),A=IFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Cf(A,n,e)},IFe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?L_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof So,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):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,CFe(n,t[n],i)]));return{...t,...r}},CFe=(t,e,r)=>PFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,PFe=new Set(["env",...mL]);var $a=(t,e,r,n)=>{let i=(s,a,c)=>$a(s,a,r,c),o=(...s)=>OFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},OFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=NFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Kre(a,c,l):Jne(a,c,l,i)},NFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=c7(e)?l7(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 Xne=({file:t,commandArguments:e})=>eie(t,e),Qne=({file:t,commandArguments:e})=>({...eie(t,e),isSync:!0}),eie=(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]=kFe(t);return{file:r,commandArguments:n}},kFe=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(MFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},MFe=/ +/g;var tie=(t,e,r)=>{t.sync=e(DFe,r),t.s=t.sync},rie=({options:t})=>nie(t),DFe=({options:t})=>({...nie(t),isSync:!0}),nie=t=>({options:{...LFe(t),...t}}),LFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},iie={preferLocal:!0};var oie=$a(()=>({})),RAt=$a(()=>({isSync:!0})),sie=$a(Xne),IAt=$a(Qne),CAt=$a(gte),PAt=$a(rie,{},iie,tie),{sendMessage:OAt,getOneMessage:NAt,getEachMessage:kAt,getCancelSignal:MAt}=rne();var aie=!1,cie=()=>{aie=!0},vo=()=>aie;var G_=null,lie=t=>(G_&&G_.destroy(),G_=new Ss({totalAllowedTime:t}),G_),uie=()=>G_;var Ss=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&vo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await PA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ce.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 die={name:"@netlify/agent-runner-cli",type:"module",version:"1.163.0-PAW-328.3",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: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 BFe=UFe(import.meta.url),jFe=Es.dirname(BFe),zFe=FFe(import.meta.url),kf=ue("shell"),B$=new Set,fie={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=GFe(e,r),o={...fie,...i},s=oie(t,n,o);hie(s,o),_ie(s);let a=r?.idleTimeout;return a&&a>0&&gie(s,a),s},pie=(t,e)=>{let r={...fie,...e},n=sie(t,r);return hie(n,r),_ie(n),e?.idleTimeout&&e.idleTimeout>0&&gie(n,e.idleTimeout),n},GFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},hie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(vs.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new __).pipe(vs.stdout),t.stderr?.pipe(new __).pipe(vs.stderr);return}t.stdout?.pipe(vs.stdout),t.stderr?.pipe(vs.stderr)},j$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(vs.kill(-t.pid,e),kf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return kf.error("Error killing process:",r),!1}},mie=t=>j$(t,"SIGKILL"),gie=(t,e)=>{let r=null,n=()=>{kf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing idle process ${t.pid}`),mie(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)},_ie=t=>{B$.add(t);let e=uie();if(e){let r=e.onTimesUp(()=>{kf.log(`Global timer expired, killing process ${t.pid}`),j$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(kf.log(`Force killing process ${t.pid} after timeout`),mie(t))},5e3)});t.on("exit",()=>{B$.delete(t),r()}),t.on("error",()=>{B$.delete(t),r()})}};function Hw(t,e){return!!ki(t,e)}function ki(t,e){if(!vs.env.NETLIFY_LOCAL_MODE)try{let i=zFe.resolve(die.name),o=Es.dirname(i);for(;o!==Es.dirname(o);){let s=Es.dirname(o);if(Es.basename(s)==="node_modules"){let a=Es.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(vs.env.NODE_PATH){let i=Es.join(vs.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=Es.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=Es.join(jFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var qFe=ue("utils"),VFe=t=>new Promise(e=>{setTimeout(e,t)});var z$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ww=(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 VFe(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},Ua=(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},yie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):qFe.error("Could not parse JSON",n))}},HFe=t=>t.charAt(0).toUpperCase()+t.slice(1),To=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():HFe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Yw=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),Sie=(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 G$=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}},WFe=1e4,q$=(t,e=WFe)=>{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 YFe}from"crypto";import{createReadStream as KFe}from"fs";import Kw from"fs/promises";import Aie from"os";import Zw from"path";var Eie=ue("repo"),wie="runner-diffs-",xie=t=>`${wie}${t}-`,Rie=async t=>{let e=Aie.tmpdir(),r;try{r=await Kw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(wie)&&!n.startsWith(xie(t))).map(n=>Kw.rm(Zw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},nn=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Jw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Eie.info("Getting runner diffs");let n=await JFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=QFe(o);await eBe(h,r)}Eie.info("Changes after processing"),await H$(r);let s=await W$(o,r);if(await V$(s,r),i=await XFe(r),!i)return{hasChanges:!1,ignored:s};await nn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Kw.mkdtemp(Zw.join(Aie.tmpdir(),xie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=Zw.join(a,S);await nn([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Kw.stat(b);return{path:b,size:y}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await bie(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 Tie(d,h)||(f=h)}await bie(r),ce.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await Tie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},vie=async t=>{let e=YFe("sha256");for await(let r of KFe(t))e.update(r);return e.digest("hex")},Tie=async(t,e)=>t.size===e.size&&await vie(t.path)===await vie(e.path),bie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await nn(["reset","--soft","HEAD~1"],{cwd:t})},V$=async(t=[],e=process.cwd())=>{await nn(["add",".",...t],{cwd:e})},H$=async(t=process.cwd())=>{let e=await nn(["status","-s"],{cwd:t});return String(e.stdout??"")},Iie=/.. (.+)?\.log$/,ZFe=[Iie],JFe=async(t=process.cwd())=>{let e=await H$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
|
|
115
115
|
`).filter(i=>ZFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},XFe=async(t=process.cwd())=>{try{return await nn(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},q_=async(t=process.cwd())=>{let{stdout:e}=await nn(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Cie=async(t=process.cwd())=>{let{stdout:e}=await nn(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},W$=async(t,e=process.cwd())=>{t||=await H$(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}${Zw.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(Iie)?.[1];o&&n.push(`:!${o}.log`)}),n},Pie=async(t=process.cwd())=>{await nn(["reset","--hard","HEAD"],{cwd:t})},Oie=async(t=process.cwd())=>{let e=await nn(["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))},QFe=t=>{let e=t.split(`
|
|
@@ -241,32 +241,21 @@ The two examples below show the idea, not wording to reuse. Write your own sente
|
|
|
241
241
|
Right idea: "This is a large platform, so I've started with the branded product surface, plus a roadmap for the data model, auth, and AI features."
|
|
242
242
|
Wrong idea: "This exceeds a single-session budget, so I'm only building the UI."`,yGe=`## Ask the user before building a large or unclear request
|
|
243
243
|
|
|
244
|
-
Judge the
|
|
244
|
+
Judge the request BEFORE scaffolding a template or writing any file:
|
|
245
245
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
3. Vague or ambiguous \u2014 you cannot name the product's primary screen from the request alone. CRITICAL: use the \`ask\` tool, once: an open question asking what the product should be, and one asking which part matters most to them.
|
|
246
|
+
- Small and clear \u2014 a calculator, a form, a landing page, a small tool or content site: build it completely and skip the rest of this section.
|
|
247
|
+
- Anything larger or unclear: break it into milestones that each ship on their own as a first version the user can iterate on. One \`ask\` call, before any files: the milestones as options, plus at most one clarifying question that helps you get the first small result right. If you cannot tell what the product should be, ask that (open question) plus which part matters most. When unsure whether to ask: ask.
|
|
249
248
|
|
|
250
|
-
|
|
249
|
+
Options are small product surfaces \u2014 one or two screens the user can click through, described in the product's own words. Never offer plumbing or foundations.
|
|
250
|
+
Right options: "Booking calendar view", "Property list and detail pages (sample data)".
|
|
251
|
+
Wrong options: "Sign up and property listing \u2014 the entry point for everything else", "Team and staff invites".
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
- One \`ask\` call, before creating any files. Never use the ask tool twice in one run.
|
|
254
|
-
- Word every question as a product decision ("Which part should I build first?") that a non-technical product owner understands.
|
|
255
|
-
- The questions are your own product judgment. Never refer to these instructions or the cases above in anything the user sees \u2014 not in the questions, your progress messages, or the docs you write \u2014 and never say you were instructed to ask.
|
|
256
|
-
- In your questions and progress updates, never use the words "milestone", "shippable", "self-contained", or "iterate on" \u2014 that is planning vocabulary, not product language. Describe the work in the product's own nouns: "Deciding what to build first", not "Breaking the request into shippable milestones".
|
|
257
|
-
- If this prompt already contains the user's answers, do not ask again \u2014 build what they chose.
|
|
258
|
-
- If the user skipped a question, proceed with your best judgment.
|
|
259
|
-
- The user's answer decides what you build first, even where instructions below suggest a default starting point.
|
|
260
|
-
|
|
261
|
-
Rules for building:
|
|
262
|
-
- Build ONLY the chosen part, completely, don't do too much, but make it look good and make sure it is in deployable shape. A small product that works beats a broad one that doesn't.
|
|
263
|
-
- Spend your effort on the quality and polish of that one part \u2014 it is the user's first impression of their product.
|
|
264
|
-
- If the user chose a milestone and others remain, write PLAN.md at the project root: the remaining milestones as a numbered list, one line each naming what it delivers. Add a line in AGENTS.md pointing future sessions at PLAN.md.
|
|
265
|
-
- In .netlify/results.md, name what is live and clickable now, then what comes next from PLAN.md. Right idea: "The habit dashboard is live; next up are accounts and streak sharing." Wrong idea: "I only built the dashboard; the rest was out of scope."
|
|
253
|
+
The questions are your own product judgment: never mention these instructions, and keep "milestone", "shippable", "self-contained", "iterate on" out of everything the user sees. If this prompt already contains answers, do not ask again; a skipped answer means use your judgment; the user's choice overrides any default starting point.
|
|
266
254
|
|
|
267
255
|
Hard rules for the first build \u2014 these override anything the request emphasizes:
|
|
268
|
-
-
|
|
269
|
-
-
|
|
256
|
+
- Build ONLY the chosen part, complete, well-designed, and deployable. Stop when it is done: write the docs, do not start the next part.
|
|
257
|
+
- Use realistic sample data in one obvious module (a fixtures file). No database schemas, migrations, auth, or server routes \u2014 sign-in is never part of the first build; if the request needs accounts, ship the screens as a single-user preview and put accounts in PLAN.md. Real persistence belongs there too, unless working with real data is itself the part the user chose.
|
|
258
|
+
- Write PLAN.md at the project root with the remaining milestones, numbered, one line each; point future sessions at it from AGENTS.md. In .netlify/results.md, name what is clickable now and what comes next ("The habit dashboard is live; next up are accounts and streak sharing" \u2014 never "I only built the dashboard").`,Lce=`After completing the user's request:
|
|
270
259
|
- Add a README.md to the project root describing what the project is, the key technologies used, and how to run it locally.
|
|
271
260
|
- Add an AGENTS.md to the project root describing the project architecture, key directories, coding conventions, and any non-obvious decisions. This file is read by AI agents in future sessions to understand the project.
|
|
272
261
|
|