@netlify/agent-runner-cli 1.156.0-ask-clarify.1 → 1.156.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin-local.js CHANGED
@@ -99,7 +99,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
99
99
  `,LF:`
100
100
  `,concatBytes:qL},v$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},T$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:v$e};import{Buffer as b$e}from"buffer";var gre=(t,e)=>t?void 0:A$e.bind(void 0,e),A$e=function*(t,e){if(typeof e!="string"&&!jt(e)&&!b$e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},_re=(t,e)=>t?x$e.bind(void 0,e):w$e.bind(void 0,e),x$e=function*(t,e){yre(t,e),yield e},w$e=function*(t,e){if(yre(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},yre=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
101
101
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
102
- if (condition) { yield value; }`)};import{Buffer as R$e}from"buffer";import{StringDecoder as I$e}from"string_decoder";var vx=(t,e,r)=>{if(r)return;if(t)return{transform:C$e.bind(void 0,new TextEncoder)};let n=new I$e(e);return{transform:P$e.bind(void 0,n),final:O$e.bind(void 0,n)}},C$e=function*(t,e){R$e.isBuffer(e)?yield fs(e):typeof e=="string"?yield t.encode(e):yield e},P$e=function*(t,e){yield jt(e)?t.write(e):e},O$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Sre}from"util";var HL=Sre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Tx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=k$e}=e[r];for await(let i of n(t))yield*Tx(i,e,r+1)},Ere=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N$e(r,Number(e),t)},N$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tx(n,r,e+1)},vre=Sre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),k$e=function*(t){yield t};var WL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Tre=(t,e)=>[...e.flatMap(r=>[...Nl(r,t,0)]),...P_(t)],Nl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=D$e}=e[r];for(let i of n(t))yield*Nl(i,e,r+1)},P_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M$e(r,Number(e),t)},M$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Nl(n,r,e+1)},D$e=function*(t){yield t};var YL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Are(t,s,o),l=Ol(e),u=Ol(r),d=l?HL.bind(void 0,Tx,a):WL.bind(void 0,Nl),f=l||u?HL.bind(void 0,Ere,a):WL.bind(void 0,P_),p=l||u?vre.bind(void 0,a):void 0;return{stream:new L$e({writableObjectMode:n,writableHighWaterMark:bre(n),readableObjectMode:i,readableHighWaterMark:bre(i),transform(m,S,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},bx=(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=Are(s,r,a);t=Tre(c,t)}return t},Are=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:gre(n,a)},vx(r,s,n),Ex(r,o,n,c),{transform:t,final:e},{transform:_re(i,a)},mre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var xre=(t,e)=>{for(let r of $$e(t))U$e(t,r,e)},$$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>F$e(a,n));r.input=E_(s)},F$e=(t,e)=>{let r=bx(t,e,"utf8",!0);return B$e(r),E_(r)},B$e=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 q$e,appendFileSync as V$e}from"fs";var Ax=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&uf(r,n)&&!_n.has(e)&&j$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&z$e.has(o))||t.every(({type:i})=>Wn.has(i))),j$e=t=>t===1||t===2,z$e=new Set(["pipe","overlapped"]),wre=async(t,e,r,n)=>{for await(let i of t)G$e(e)||Ire(i,r,n)},Rre=(t,e,r)=>{for(let n of t)Ire(n,e,r)},G$e=t=>t._readableState.pipes.length>0,Ire=(t,e,r)=>{let n=UA(t);uo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Cre=({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)=>H$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},H$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Pte(t,o,d),p=fs(f),{stdioItems:h,objectMode:m}=e[r],S=W$e([p],h,c,n),{serializedResult:E,finalResult:b=E}=Y$e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});K$e({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&&Z$e(E,h,i),A}catch(y){return n.error=y,A}},W$e=(t,e,r,n)=>{try{return bx(t,e,r,!1)}catch(i){return n.error=i,t}},Y$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:E_(t)};let s=qQ(t,r);return n[o]?{serializedResult:s,finalResult:VL(s,!i[o],e)}:{serializedResult:s}},K$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Ax({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=VL(t,!1,s);try{Rre(a,e,n)}catch(c){r.error??=c}},Z$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>yx.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?V$e(n,t):(r.add(o),q$e(n,t))}};var Pre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ms(e,r,"all")]:Array.isArray(e)?[ms(t,r,"all"),...e]:jt(t)&&jt(e)?eL([t,e]):`${t}${e}`};import{once as KL}from"events";var Ore=async(t,e)=>{let[r,n]=await J$e(t);return e.isForcefullyTerminated??=!1,[r,n]},J$e=async t=>{let[e,r]=await Promise.allSettled([KL(t,"spawn"),KL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Nre(t):r.value},Nre=async t=>{try{return await KL(t,"exit")}catch{return Nre(t)}},kre=async t=>{let[e,r]=await t;if(!X$e(e,r)&&ZL(e,r))throw new wi;return[e,r]},X$e=(t,e)=>t===void 0&&e===void 0,ZL=(t,e)=>t!==0||e!==null;var Mre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Q$e(t,e,r),s=o?.code==="ETIMEDOUT",a=Cte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Q$e=(t,e,r)=>t!==void 0?t:ZL(e,r)?new wi:void 0;var Dre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=t1e(t,e,r),d=i1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ef(d,c,l)},t1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),a=r1e(r),{file:c,commandArguments:l,options:u}=sx(t,e,a);n1e(u);let d=dre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},r1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,n1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&xx("ipcInput"),t&&xx("ipc: true"),r&&xx("detached: true"),n&&xx("cancelSignal")},xx=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},i1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=o1e({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}=Mre(c,r),{output:h,error:m=l}=Cre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ms(b,r,A)),E=ms(Pre(h,r),r,"all");return a1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},o1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{xre(o,r);let a=s1e(r);return e1e(...ax(t,e,a))}catch(a){return Sf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},s1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:hx(e)}),a1e=({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?mx({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):C_({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 YUe}from"events";import{spawn as KUe}from"child_process";import Bre from"process";import{once as JL,on as c1e}from"events";var Lre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(pf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),l1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),l1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ZA(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([u1e(o,n,s),d1e(o,r,s),f1e(o,r,s)])}catch(a){throw hf(t),a}finally{s.abort(),JA(e,i)}},u1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await JL(t,"message",{signal:r});return n}for await(let[n]of c1e(t,"message",{signal:r}))if(e(n))return n},d1e=async(t,e,{signal:r})=>{await JL(t,"disconnect",{signal:r}),Tee(e)},f1e=async(t,e,{signal:r})=>{let[n]=await JL(t,"strict:error",{signal:r});throw WA(n,e)};import{once as Ure,on as p1e}from"events";var Fre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>XL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),XL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{pf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),ZA(e,o);let s=ka(t,e,r),a=new AbortController,c={};return h1e(t,s,a),m1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),g1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},h1e=async(t,e,r)=>{try{await Ure(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},m1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Ure(t,"strict:error",{signal:r.signal});n.error=WA(i,e),r.abort()}catch{}},g1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of p1e(r,"message",{signal:o.signal}))$re(s),yield c}catch{$re(s)}finally{o.abort(),JA(e,a),n||hf(t),i&&await t}},$re=({error:t})=>{if(t)throw t};var jre=(t,{ipc:e})=>{Object.assign(t,Gre(t,!1,e))},zre=()=>{let t=Bre,e=!0,r=Bre.channel!==void 0;return{...Gre(t,e,r),getCancelSignal:Kee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Gre=(t,e,r)=>({sendMessage:ix.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Lre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Fre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as _1e}from"child_process";import{PassThrough as y1e,Readable as S1e,Writable as E1e,Duplex as v1e}from"stream";var qre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{zL(n);let a=new _1e;T1e(a,n),Object.assign(a,{readable:b1e,writable:A1e,duplex:x1e});let c=Sf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=w1e(c,s,i);return{subprocess:a,promise:l}},T1e=(t,e)=>{let r=O_(),n=O_(),i=O_(),o=Array.from({length:e.length-3},O_),s=O_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},O_=()=>{let t=new y1e;return t.end(),t},b1e=()=>new S1e({read(){}}),A1e=()=>new E1e({write(){}}),x1e=()=>new v1e({read(){},write(){}}),w1e=async(t,e,r)=>Ef(t,e,r);import{createReadStream as Vre,createWriteStream as Hre}from"fs";import{Buffer as R1e}from"buffer";import{Readable as N_,Writable as I1e,Duplex as C1e}from"stream";var Yre=(t,e)=>Sx(P1e,t,e,!1),k_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},Wre={fileNumber:k_,generator:YL,asyncGenerator:YL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:C1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},P1e={input:{...Wre,fileUrl:({value:t})=>({stream:Vre(t)}),filePath:({value:{file:t}})=>({stream:Vre(t)}),webStream:({value:t})=>({stream:N_.fromWeb(t)}),iterable:({value:t})=>({stream:N_.from(t)}),asyncIterable:({value:t})=>({stream:N_.from(t)}),string:({value:t})=>({stream:N_.from(t)}),uint8Array:({value:t})=>({stream:N_.from(R1e.from(t))})},output:{...Wre,fileUrl:({value:t})=>({stream:Hre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Hre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:I1e.fromWeb(t)}),iterable:k_,asyncIterable:k_,string:k_,uint8Array:k_}};import{on as O1e,once as Kre}from"events";import{PassThrough as N1e,getDefaultHighWaterMark as k1e}from"stream";import{finished as Xre}from"stream/promises";function kl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)e$(i);let e=t.some(({readableObjectMode:i})=>i),r=M1e(t,e),n=new QL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var M1e=(t,e)=>{if(t.length===0)return k1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},QL=class extends N1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(e$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=D1e(this,this.#e,this.#o);let r=U1e({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(e$(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)}},D1e=async(t,e,r)=>{wx(t,Zre);let n=new AbortController;try{await Promise.race([L1e(t,n),$1e(t,e,r,n)])}finally{n.abort(),wx(t,-Zre)}},L1e=async(t,{signal:e})=>{try{await Xre(t,{signal:e,cleanup:!0})}catch(r){throw Qre(t,r),r}},$1e=async(t,e,r,{signal:n})=>{for await(let[i]of O1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},e$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},U1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{wx(t,Jre);let a=new AbortController;try{await Promise.race([F1e(o,e,a),B1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),j1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),wx(t,-Jre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?t$(t):z1e(t))},F1e=async(t,e,{signal:r})=>{try{await t,r.aborted||t$(e)}catch(n){r.aborted||Qre(e,n)}},B1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Xre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;ene(s)?i.add(e):tne(t,s)}},j1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Kre(t,i,{signal:o}),!t.readable)return Kre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},z1e=t=>{t.writable&&t.end()},Qre=(t,e)=>{ene(e)?t$(t):tne(t,e)},ene=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",t$=t=>{(t.readable||t.writable)&&t.destroy()},tne=(t,e)=>{t.destroyed||(t.once("error",G1e),t.destroy(e))},G1e=()=>{},wx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Zre=2,Jre=1;import{finished as rne}from"stream/promises";var Tf=(t,e)=>{t.pipe(e),q1e(t,e),V1e(t,e)},q1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}r$(e)}},r$=t=>{t.writable&&t.end()},V1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}n$(t)}},n$=t=>{t.readable&&t.destroy()};var nne=(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})=>Wn.has(c)))H1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Wn.has(c)))Y1e({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]:kl(o);Tf(s,i)}},H1e=(t,e,r,n)=>{r==="output"?Tf(t.stdio[n],e):Tf(e,t.stdio[n]);let i=W1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},W1e=["stdin","stdout","stderr"],Y1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;K1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},K1e=(t,{signal:e})=>{xi(t)&&Cl(t,Z1e,e)},Z1e=2;import{addAbortListener as Q1e}from"events";var Ml=[];Ml.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ml.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ml.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Rx=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",i$=Symbol.for("signal-exit emitter"),o$=globalThis,J1e=Object.defineProperty.bind(Object),s$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(o$[i$])return o$[i$];J1e(o$,i$,{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}},Ix=class{},X1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),a$=class extends Ix{onExit(){return()=>{}}load(){}unload(){}},c$=class extends Ix{#e=l$.platform==="win32"?"SIGINT":"SIGHUP";#r=new s$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ml)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(!Rx(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 Ml)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,Ml.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 Rx(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"&&Rx(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)}},l$=globalThis.process,{onExit:ine,load:nvt,unload:ivt}=X1e(Rx(l$)?new c$(l$):new a$);var one=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ine(()=>{t.kill()});Q1e(n,()=>{i()})};var ane=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=FA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=eUe(r,n,i),{sourceStream:d,sourceError:f}=rUe(t,l),{options:p,fileDescriptors:h}=po.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},eUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=tUe(t,e,...r),a=KA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},tUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(sne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||XD(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]=CA(r,...n);return{destination:e(sne)(i,o,s),pipeOptions:s}}if(po.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}`)},sne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),rUe=(t,e)=>{try{return{sourceStream:mf(t,e)}}catch(r){return{sourceError:r}}};var lne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=nUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw u$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},nUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return n$(t),n;if(e!==void 0)return r$(r),e},u$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Sf({error:t,command:cne,escapedCommand:cne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),cne="source.pipe(destination)";var une=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 iUe}from"stream/promises";var dne=(t,e,r)=>{let n=Cx.has(e)?sUe(t,e):oUe(t,e);return Cl(t,cUe,r.signal),Cl(e,lUe,r.signal),aUe(e),n},oUe=(t,e)=>{let r=kl([t]);return Tf(r,e),Cx.set(e,r),r},sUe=(t,e)=>{let r=Cx.get(e);return r.add(t),r},aUe=async t=>{try{await iUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Cx.delete(t)},Cx=new WeakMap,cUe=2,lUe=1;import{aborted as uUe}from"util";var fne=(t,e)=>t===void 0?[]:[dUe(t,e)],dUe=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 u$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Px=(t,...e)=>{if(Ot(e[0]))return Px.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=ane(t,...e),i=fUe({...n,destination:r});return i.pipe=Px.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},fUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=pUe(t,i);lne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=dne(e,o,d);return await Promise.race([une(u),...fne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},pUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as EUe}from"timers/promises";import{on as hUe}from"events";import{getDefaultHighWaterMark as mUe}from"stream";var Ox=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return gUe(e,s),hne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},gUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},d$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;_Ue(e,s,t);let a=t.readableObjectMode&&!o;return hne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},_Ue=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},hne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=hUe(t,"data",{signal:e.signal,highWaterMark:pne,highWatermark:pne});return yUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},f$=mUe(!0),pne=f$,yUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=SUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Nl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*P_(a)}},SUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vx(t,r,!e),Ex(t,i,!n,{})].filter(Boolean);var mne=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=vUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([TUe(t),d]);return}let f=GL(c,r),p=d$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([bUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},vUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Ax({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=d$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await wre(a,t,r,o)},TUe=async t=>{await EUe(),t.readableFlowing===null&&t.resume()},bUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await dx(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await fx(r,{maxBuffer:o})):await yf(r,{maxBuffer:o})}catch(a){return gne(wte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},p$=async t=>{try{return await t}catch(e){return gne(e)}},gne=({bufferedData:t})=>zQ(t)?new Uint8Array(t):t;import{finished as AUe}from"stream/promises";var M_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=xUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],AUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||IUe(a,e,r,n)}finally{s.abort()}},xUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&wUe(t,r,n),n},wUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{RUe(e,r),n.call(t,...i)}},RUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},IUe=(t,e,r,n)=>{if(!CUe(t,e,r,n))throw t},CUe=(t,e,r,n=!0)=>r.propagating?_ne(t)||Nx(t):(r.propagating=!0,h$(r,e)===n?_ne(t):Nx(t)),h$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Nx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_ne=t=>t?.code==="EPIPE";var yne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>m$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),m$=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=M_(t,e,l);if(h$(l,e)){await u;return}let[d]=await Promise.all([mne({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 Sne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?kl([t,e].filter(Boolean)):void 0,Ene=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>m$({...PUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:OUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),PUe=({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}},OUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as NUe}from"events";var vne=t=>uf(t,"ipc"),Tne=(t,e)=>{let r=UA(t);uo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var bne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=vne(o),a=ps(e,"ipc"),c=ps(r,"ipc");for await(let l of XL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Rte(t,i,c),i.push(l)),s&&Tne(l,o);return i},Ane=async(t,e)=>(await Promise.allSettled([t]),e);var xne=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=Ore(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=yne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Ene({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=[],C=bne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=kUe(m,t,A),k=MUe(h,A);try{return await Promise.race([Promise.all([{},kre(b),Promise.all(y),x,C,ote(t,d),...O,...k]),S,DUe(t,E),...ete(t,o,f,E),...vee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...Xee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(y.map(_=>p$(_))),p$(x),Ane(C,R),Promise.allSettled(O),Promise.allSettled(k)])}},kUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:M_(n,i,r)),MUe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>M_(s,n,e,{isSameDirection:Wn.has(i),stopOnExit:i==="native"}))),DUe=async(t,{signal:e})=>{let[r]=await NUe(t,"error",{signal:e});throw r};var wne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),D_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=fo();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},bf=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 LUe}from"stream";import{callbackify as $Ue}from"util";import{finished as Rne}from"stream/promises";var g$=async t=>{if(t!==void 0)try{await _$(t)}catch{}},Ine=async t=>{if(t!==void 0)try{await y$(t)}catch{}},_$=async t=>{await Rne(t,{cleanup:!0,readable:!1,writable:!0})},y$=async t=>{await Rne(t,{cleanup:!0,readable:!0,writable:!1})},kx=async(t,e)=>{if(await t,e)throw e},Mx=(t,e,r)=>{r&&!Nx(r)?t.destroy(r):e&&t.destroy()};var Cne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_n.has(r),{subprocessStdout:a,waitReadableDestroy:c}=S$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=E$(a,s),{read:f,onStdoutDataDone:p}=v$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new LUe({read:f,destroy:$Ue(b$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return T$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},S$=(t,e,r)=>{let n=mf(t,e),i=D_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},E$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:f$},v$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=fo(),s=Ox({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){UUe(this,s,o)},onStdoutDataDone:o}},UUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},T$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await y$(t),await n,await g$(i),await e,r.readable&&r.push(null)}catch(o){await g$(i),Pne(r,o)}},b$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bf(r,e)&&(Pne(t,n),await kx(e,n))},Pne=(t,e)=>{Mx(t,t.readable,e)};import{Writable as FUe}from"stream";import{callbackify as One}from"util";var Nne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=A$(t,r,e),s=new FUe({...x$(n,t,i),destroy:One(R$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return w$(n,s),s},A$=(t,e,r)=>{let n=KA(t,e),i=D_(r,n,"writableFinal"),o=D_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},x$=(t,e,r)=>({write:BUe.bind(void 0,t),final:One(jUe.bind(void 0,t,e,r))}),BUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},jUe=async(t,e,r)=>{await bf(r,e)&&(t.writable&&t.end(),await e)},w$=async(t,e,r)=>{try{await _$(t),e.writable&&e.end()}catch(n){await Ine(r),kne(e,n)}},R$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bf(r,e),await bf(n,e)&&(kne(t,i),await kx(e,i))},kne=(t,e)=>{Mx(t,t.writable,e)};import{Duplex as zUe}from"stream";import{callbackify as GUe}from"util";var Mne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||_n.has(r),{subprocessStdout:c,waitReadableDestroy:l}=S$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=A$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=E$(c,a),{read:S,onStdoutDataDone:E}=v$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new zUe({read:S,...x$(u,t,d),destroy:GUe(qUe.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 T$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),w$(u,b,c),b},qUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([b$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),R$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var I$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||_n.has(e),s=mf(t,r),a=Ox({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return VUe(a,s,t)},VUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Dne=(t,{encoding:e})=>{let r=wne();t.readable=Cne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Nne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Mne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=I$.bind(void 0,t,e),t[Symbol.asyncIterator]=I$.bind(void 0,t,e,{})};var Lne=(t,e)=>{for(let[r,n]of WUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},HUe=(async()=>{})().constructor.prototype,WUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(HUe,t)]);var $ne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=ZUe(t,e,r),{subprocess:f,promise:p}=XUe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Px.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Lne(f,p),po.set(f,{options:u,fileDescriptors:d}),f},ZUe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),{file:a,commandArguments:c,options:l}=sx(t,e,r),u=JUe(l),d=Yre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},JUe=({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}},XUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=KUe(...ax(t,e,r))}catch(h){return qre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;YUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];nne(c,a,l),one(c,r,l);let d={},f=fo();c.kill=See.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Sne(c,r),Dne(c,r),jre(c,r);let p=QUe({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}},QUe=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 xne({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)=>ms(y,e,x)),b=ms(m,e,"all"),A=eFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ef(A,n,e)},eFe=({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?C_({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 ho,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):mx({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Dx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,tFe(n,t[n],i)]));return{...t,...r}},tFe=(t,e,r)=>rFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,rFe=new Set(["env",...iL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>nFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},nFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Dx(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=iFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Dre(a,c,l):$ne(a,c,l,i)},iFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=YQ(e)?KQ(e,r):[e,...r],[s,a,c]=CA(...o),l=Dx(Dx(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 Une=({file:t,commandArguments:e})=>Bne(t,e),Fne=({file:t,commandArguments:e})=>({...Bne(t,e),isSync:!0}),Bne=(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]=oFe(t);return{file:r,commandArguments:n}},oFe=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(sFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},sFe=/ +/g;var jne=(t,e,r)=>{t.sync=e(aFe,r),t.s=t.sync},zne=({options:t})=>Gne(t),aFe=({options:t})=>({...Gne(t),isSync:!0}),Gne=t=>({options:{...cFe(t),...t}}),cFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},qne={preferLocal:!0};var Vne=Da(()=>({})),Wbt=Da(()=>({isSync:!0})),Hne=Da(Une),Ybt=Da(Fne),Kbt=Da(rte),Zbt=Da(zne,{},qne,jne),{sendMessage:Jbt,getOneMessage:Xbt,getEachMessage:Qbt,getCancelSignal:eAt}=zre();var Wne=!1,Yne=()=>{Wne=!0},go=()=>Wne;var L_=null,Kne=t=>(L_&&L_.destroy(),L_=new gs({totalAllowedTime:t}),L_),Zne=()=>L_;var gs=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&&go())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 TA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{de.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 Jne={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0-ask-clarify.1",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:{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.2","@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.5","@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 fFe=uFe(import.meta.url),pFe=_s.dirname(fFe),hFe=dFe(import.meta.url),Af=pe("shell"),C$=new Set,Xne={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=mFe(e,r),o={...Xne,...i},s=Vne(t,n,o);eie(s,o),nie(s);let a=r?.idleTimeout;return a&&a>0&&rie(s,a),s},Qne=(t,e)=>{let r={...Xne,...e},n=Hne(t,r);return eie(n,r),nie(n),e?.idleTimeout&&e.idleTimeout>0&&rie(n,e.idleTimeout),n},mFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},eie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(ys.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new u_).pipe(ys.stdout),t.stderr?.pipe(new u_).pipe(ys.stderr);return}t.stdout?.pipe(ys.stdout),t.stderr?.pipe(ys.stderr)},P$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(ys.kill(-t.pid,e),Af.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Af.error("Error killing process:",r),!1}},tie=t=>P$(t,"SIGKILL"),rie=(t,e)=>{let r=null,n=()=>{Af.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing idle process ${t.pid}`),tie(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)},nie=t=>{C$.add(t);let e=Zne();if(e){let r=e.onTimesUp(()=>{Af.log(`Global timer expired, killing process ${t.pid}`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing process ${t.pid} after timeout`),tie(t))},5e3)});t.on("exit",()=>{C$.delete(t),r()}),t.on("error",()=>{C$.delete(t),r()})}};function $x(t,e){return!!Ci(t,e)}function Ci(t,e){if(!ys.env.NETLIFY_LOCAL_MODE)try{let i=hFe.resolve(Jne.name),o=_s.dirname(i);for(;o!==_s.dirname(o);){let s=_s.dirname(o);if(_s.basename(s)==="node_modules"){let a=_s.join(s,".bin",e);if(Lx.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(ys.env.NODE_PATH){let i=_s.join(ys.env.NODE_PATH,".bin",e);if(Lx.existsSync(i))return i}let r=_s.join(t,"node_modules",".bin",e);if(Lx.existsSync(r))return r;let n=_s.join(pFe,"..","node_modules",".bin",e);if(Lx.existsSync(n))return n}var gFe=pe("utils"),_Fe=t=>new Promise(e=>{setTimeout(e,t)});var O$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ux=(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 _Fe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},La=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},iie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):gFe.error("Could not parse JSON",n))}},yFe=t=>t.charAt(0).toUpperCase()+t.slice(1),_o=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():yFe(e)).join(" ");function Ss(t,e){e&&t.log(`Skill invoked: ${e}`)}var Fx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),oie=(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 N$=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}},SFe=1e4,k$=(t,e=SFe)=>{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 EFe}from"crypto";import{createReadStream as vFe}from"fs";import Bx from"fs/promises";import uie from"os";import jx from"path";var sie=pe("repo"),die="runner-diffs-",fie=t=>`${die}${t}-`,pie=async t=>{let e=uie.tmpdir(),r;try{r=await Bx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(die)&&!n.startsWith(fie(t))).map(n=>Bx.rm(jx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),zx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{sie.info("Getting runner diffs");let n=await bFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=xFe(o);await wFe(h,r)}sie.info("Changes after processing"),await D$(r);let s=await L$(o,r);if(await M$(s,r),i=await AFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Bx.mkdtemp(jx.join(uie.tmpdir(),fie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=jx.join(a,S);await Xr([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Bx.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 lie(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 cie(d,h)||(f=h)}await lie(r),de.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await cie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},aie=async t=>{let e=EFe("sha256");for await(let r of vFe(t))e.update(r);return e.digest("hex")},cie=async(t,e)=>t.size===e.size&&await aie(t.path)===await aie(e.path),lie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},M$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},D$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},hie=/.. (.+)?\.log$/,TFe=[hie],bFe=async(t=process.cwd())=>{let e=await D$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
102
+ if (condition) { yield value; }`)};import{Buffer as R$e}from"buffer";import{StringDecoder as I$e}from"string_decoder";var vx=(t,e,r)=>{if(r)return;if(t)return{transform:C$e.bind(void 0,new TextEncoder)};let n=new I$e(e);return{transform:P$e.bind(void 0,n),final:O$e.bind(void 0,n)}},C$e=function*(t,e){R$e.isBuffer(e)?yield fs(e):typeof e=="string"?yield t.encode(e):yield e},P$e=function*(t,e){yield jt(e)?t.write(e):e},O$e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Sre}from"util";var HL=Sre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Tx=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=k$e}=e[r];for await(let i of n(t))yield*Tx(i,e,r+1)},Ere=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*N$e(r,Number(e),t)},N$e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Tx(n,r,e+1)},vre=Sre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),k$e=function*(t){yield t};var WL=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Tre=(t,e)=>[...e.flatMap(r=>[...Nl(r,t,0)]),...P_(t)],Nl=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=D$e}=e[r];for(let i of n(t))yield*Nl(i,e,r+1)},P_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M$e(r,Number(e),t)},M$e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Nl(n,r,e+1)},D$e=function*(t){yield t};var YL=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=Are(t,s,o),l=Ol(e),u=Ol(r),d=l?HL.bind(void 0,Tx,a):WL.bind(void 0,Nl),f=l||u?HL.bind(void 0,Ere,a):WL.bind(void 0,P_),p=l||u?vre.bind(void 0,a):void 0;return{stream:new L$e({writableObjectMode:n,writableHighWaterMark:bre(n),readableObjectMode:i,readableHighWaterMark:bre(i),transform(m,S,E){d([m,c,0],this,E)},flush(m){f([c],this,m)},destroy:p})}},bx=(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=Are(s,r,a);t=Tre(c,t)}return t},Are=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:gre(n,a)},vx(r,s,n),Ex(r,o,n,c),{transform:t,final:e},{transform:_re(i,a)},mre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var xre=(t,e)=>{for(let r of $$e(t))U$e(t,r,e)},$$e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),U$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ma[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>F$e(a,n));r.input=E_(s)},F$e=(t,e)=>{let r=bx(t,e,"utf8",!0);return B$e(r),E_(r)},B$e=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 q$e,appendFileSync as V$e}from"fs";var Ax=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&uf(r,n)&&!_n.has(e)&&j$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&z$e.has(o))||t.every(({type:i})=>Wn.has(i))),j$e=t=>t===1||t===2,z$e=new Set(["pipe","overlapped"]),wre=async(t,e,r,n)=>{for await(let i of t)G$e(e)||Ire(i,r,n)},Rre=(t,e,r)=>{for(let n of t)Ire(n,e,r)},G$e=t=>t._readableState.pipes.length>0,Ire=(t,e,r)=>{let n=UA(t);uo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var Cre=({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)=>H$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},H$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Pte(t,o,d),p=fs(f),{stdioItems:h,objectMode:m}=e[r],S=W$e([p],h,c,n),{serializedResult:E,finalResult:b=E}=Y$e({chunks:S,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});K$e({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&&Z$e(E,h,i),A}catch(y){return n.error=y,A}},W$e=(t,e,r,n)=>{try{return bx(t,e,r,!1)}catch(i){return n.error=i,t}},Y$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:E_(t)};let s=qQ(t,r);return n[o]?{serializedResult:s,finalResult:VL(s,!i[o],e)}:{serializedResult:s}},K$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!Ax({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=VL(t,!1,s);try{Rre(a,e,n)}catch(c){r.error??=c}},Z$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>yx.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?V$e(n,t):(r.add(o),q$e(n,t))}};var Pre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ms(e,r,"all")]:Array.isArray(e)?[ms(t,r,"all"),...e]:jt(t)&&jt(e)?eL([t,e]):`${t}${e}`};import{once as KL}from"events";var Ore=async(t,e)=>{let[r,n]=await J$e(t);return e.isForcefullyTerminated??=!1,[r,n]},J$e=async t=>{let[e,r]=await Promise.allSettled([KL(t,"spawn"),KL(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Nre(t):r.value},Nre=async t=>{try{return await KL(t,"exit")}catch{return Nre(t)}},kre=async t=>{let[e,r]=await t;if(!X$e(e,r)&&ZL(e,r))throw new wi;return[e,r]},X$e=(t,e)=>t===void 0&&e===void 0,ZL=(t,e)=>t!==0||e!==null;var Mre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=Q$e(t,e,r),s=o?.code==="ETIMEDOUT",a=Cte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},Q$e=(t,e,r)=>t!==void 0?t:ZL(e,r)?new wi:void 0;var Dre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=t1e(t,e,r),d=i1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ef(d,c,l)},t1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),a=r1e(r),{file:c,commandArguments:l,options:u}=sx(t,e,a);n1e(u);let d=dre(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},r1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,n1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&xx("ipcInput"),t&&xx("ipc: true"),r&&xx("detached: true"),n&&xx("cancelSignal")},xx=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},i1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=o1e({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}=Mre(c,r),{output:h,error:m=l}=Cre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),S=h.map((b,A)=>ms(b,r,A)),E=ms(Pre(h,r),r,"all");return a1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:S,all:E,options:r,command:n,escapedCommand:i,startTime:a})},o1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{xre(o,r);let a=s1e(r);return e1e(...ax(t,e,a))}catch(a){return Sf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},s1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:hx(e)}),a1e=({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?mx({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):C_({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 YUe}from"events";import{spawn as KUe}from"child_process";import Bre from"process";import{once as JL,on as c1e}from"events";var Lre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(pf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),l1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),l1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ZA(e,i);let o=ka(t,e,r),s=new AbortController;try{return await Promise.race([u1e(o,n,s),d1e(o,r,s),f1e(o,r,s)])}catch(a){throw hf(t),a}finally{s.abort(),JA(e,i)}},u1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await JL(t,"message",{signal:r});return n}for await(let[n]of c1e(t,"message",{signal:r}))if(e(n))return n},d1e=async(t,e,{signal:r})=>{await JL(t,"disconnect",{signal:r}),Tee(e)},f1e=async(t,e,{signal:r})=>{let[n]=await JL(t,"strict:error",{signal:r});throw WA(n,e)};import{once as Ure,on as p1e}from"events";var Fre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>XL({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),XL=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{pf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:ex(t)}),ZA(e,o);let s=ka(t,e,r),a=new AbortController,c={};return h1e(t,s,a),m1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),g1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},h1e=async(t,e,r)=>{try{await Ure(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},m1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Ure(t,"strict:error",{signal:r.signal});n.error=WA(i,e),r.abort()}catch{}},g1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of p1e(r,"message",{signal:o.signal}))$re(s),yield c}catch{$re(s)}finally{o.abort(),JA(e,a),n||hf(t),i&&await t}},$re=({error:t})=>{if(t)throw t};var jre=(t,{ipc:e})=>{Object.assign(t,Gre(t,!1,e))},zre=()=>{let t=Bre,e=!0,r=Bre.channel!==void 0;return{...Gre(t,e,r),getCancelSignal:Kee.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},Gre=(t,e,r)=>({sendMessage:ix.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Lre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Fre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as _1e}from"child_process";import{PassThrough as y1e,Readable as S1e,Writable as E1e,Duplex as v1e}from"stream";var qre=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{zL(n);let a=new _1e;T1e(a,n),Object.assign(a,{readable:b1e,writable:A1e,duplex:x1e});let c=Sf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=w1e(c,s,i);return{subprocess:a,promise:l}},T1e=(t,e)=>{let r=O_(),n=O_(),i=O_(),o=Array.from({length:e.length-3},O_),s=O_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},O_=()=>{let t=new y1e;return t.end(),t},b1e=()=>new S1e({read(){}}),A1e=()=>new E1e({write(){}}),x1e=()=>new v1e({read(){},write(){}}),w1e=async(t,e,r)=>Ef(t,e,r);import{createReadStream as Vre,createWriteStream as Hre}from"fs";import{Buffer as R1e}from"buffer";import{Readable as N_,Writable as I1e,Duplex as C1e}from"stream";var Yre=(t,e)=>Sx(P1e,t,e,!1),k_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ma[t]}.`)},Wre={fileNumber:k_,generator:YL,asyncGenerator:YL,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:C1e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},P1e={input:{...Wre,fileUrl:({value:t})=>({stream:Vre(t)}),filePath:({value:{file:t}})=>({stream:Vre(t)}),webStream:({value:t})=>({stream:N_.fromWeb(t)}),iterable:({value:t})=>({stream:N_.from(t)}),asyncIterable:({value:t})=>({stream:N_.from(t)}),string:({value:t})=>({stream:N_.from(t)}),uint8Array:({value:t})=>({stream:N_.from(R1e.from(t))})},output:{...Wre,fileUrl:({value:t})=>({stream:Hre(t)}),filePath:({value:{file:t,append:e}})=>({stream:Hre(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:I1e.fromWeb(t)}),iterable:k_,asyncIterable:k_,string:k_,uint8Array:k_}};import{on as O1e,once as Kre}from"events";import{PassThrough as N1e,getDefaultHighWaterMark as k1e}from"stream";import{finished as Xre}from"stream/promises";function kl(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)e$(i);let e=t.some(({readableObjectMode:i})=>i),r=M1e(t,e),n=new QL({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var M1e=(t,e)=>{if(t.length===0)return k1e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},QL=class extends N1e{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(e$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=D1e(this,this.#e,this.#o);let r=U1e({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(e$(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)}},D1e=async(t,e,r)=>{wx(t,Zre);let n=new AbortController;try{await Promise.race([L1e(t,n),$1e(t,e,r,n)])}finally{n.abort(),wx(t,-Zre)}},L1e=async(t,{signal:e})=>{try{await Xre(t,{signal:e,cleanup:!0})}catch(r){throw Qre(t,r),r}},$1e=async(t,e,r,{signal:n})=>{for await(let[i]of O1e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},e$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},U1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{wx(t,Jre);let a=new AbortController;try{await Promise.race([F1e(o,e,a),B1e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),j1e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),wx(t,-Jre)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?t$(t):z1e(t))},F1e=async(t,e,{signal:r})=>{try{await t,r.aborted||t$(e)}catch(n){r.aborted||Qre(e,n)}},B1e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Xre(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;ene(s)?i.add(e):tne(t,s)}},j1e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await Kre(t,i,{signal:o}),!t.readable)return Kre(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},z1e=t=>{t.writable&&t.end()},Qre=(t,e)=>{ene(e)?t$(t):tne(t,e)},ene=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",t$=t=>{(t.readable||t.writable)&&t.destroy()},tne=(t,e)=>{t.destroyed||(t.once("error",G1e),t.destroy(e))},G1e=()=>{},wx=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Zre=2,Jre=1;import{finished as rne}from"stream/promises";var Tf=(t,e)=>{t.pipe(e),q1e(t,e),V1e(t,e)},q1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}r$(e)}},r$=t=>{t.writable&&t.end()},V1e=async(t,e)=>{if(!(xi(t)||xi(e))){try{await rne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}n$(t)}},n$=t=>{t.readable&&t.destroy()};var nne=(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})=>Wn.has(c)))H1e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Wn.has(c)))Y1e({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]:kl(o);Tf(s,i)}},H1e=(t,e,r,n)=>{r==="output"?Tf(t.stdio[n],e):Tf(e,t.stdio[n]);let i=W1e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},W1e=["stdin","stdout","stderr"],Y1e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;K1e(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},K1e=(t,{signal:e})=>{xi(t)&&Cl(t,Z1e,e)},Z1e=2;import{addAbortListener as Q1e}from"events";var Ml=[];Ml.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ml.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ml.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Rx=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",i$=Symbol.for("signal-exit emitter"),o$=globalThis,J1e=Object.defineProperty.bind(Object),s$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(o$[i$])return o$[i$];J1e(o$,i$,{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}},Ix=class{},X1e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),a$=class extends Ix{onExit(){return()=>{}}load(){}unload(){}},c$=class extends Ix{#e=l$.platform==="win32"?"SIGINT":"SIGHUP";#r=new s$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Ml)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(!Rx(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 Ml)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,Ml.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 Rx(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"&&Rx(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)}},l$=globalThis.process,{onExit:ine,load:nvt,unload:ivt}=X1e(Rx(l$)?new c$(l$):new a$);var one=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ine(()=>{t.kill()});Q1e(n,()=>{i()})};var ane=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=FA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=eUe(r,n,i),{sourceStream:d,sourceError:f}=rUe(t,l),{options:p,fileDescriptors:h}=po.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},eUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=tUe(t,e,...r),a=KA(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},tUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(sne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||XD(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]=CA(r,...n);return{destination:e(sne)(i,o,s),pipeOptions:s}}if(po.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}`)},sne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),rUe=(t,e)=>{try{return{sourceStream:mf(t,e)}}catch(r){return{sourceError:r}}};var lne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=nUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw u$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},nUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return n$(t),n;if(e!==void 0)return r$(r),e},u$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Sf({error:t,command:cne,escapedCommand:cne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),cne="source.pipe(destination)";var une=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 iUe}from"stream/promises";var dne=(t,e,r)=>{let n=Cx.has(e)?sUe(t,e):oUe(t,e);return Cl(t,cUe,r.signal),Cl(e,lUe,r.signal),aUe(e),n},oUe=(t,e)=>{let r=kl([t]);return Tf(r,e),Cx.set(e,r),r},sUe=(t,e)=>{let r=Cx.get(e);return r.add(t),r},aUe=async t=>{try{await iUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Cx.delete(t)},Cx=new WeakMap,cUe=2,lUe=1;import{aborted as uUe}from"util";var fne=(t,e)=>t===void 0?[]:[dUe(t,e)],dUe=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 u$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Px=(t,...e)=>{if(Ot(e[0]))return Px.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=ane(t,...e),i=fUe({...n,destination:r});return i.pipe=Px.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},fUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=pUe(t,i);lne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=dne(e,o,d);return await Promise.race([une(u),...fne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},pUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as EUe}from"timers/promises";import{on as hUe}from"events";import{getDefaultHighWaterMark as mUe}from"stream";var Ox=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return gUe(e,s),hne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},gUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},d$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;_Ue(e,s,t);let a=t.readableObjectMode&&!o;return hne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},_Ue=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},hne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=hUe(t,"data",{signal:e.signal,highWaterMark:pne,highWatermark:pne});return yUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},f$=mUe(!0),pne=f$,yUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=SUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Nl(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*P_(a)}},SUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vx(t,r,!e),Ex(t,i,!n,{})].filter(Boolean);var mne=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=vUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([TUe(t),d]);return}let f=GL(c,r),p=d$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([bUe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},vUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!Ax({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=d$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await wre(a,t,r,o)},TUe=async t=>{await EUe(),t.readableFlowing===null&&t.resume()},bUe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await dx(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await fx(r,{maxBuffer:o})):await yf(r,{maxBuffer:o})}catch(a){return gne(wte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},p$=async t=>{try{return await t}catch(e){return gne(e)}},gne=({bufferedData:t})=>zQ(t)?new Uint8Array(t):t;import{finished as AUe}from"stream/promises";var M_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=xUe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],AUe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||IUe(a,e,r,n)}finally{s.abort()}},xUe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&wUe(t,r,n),n},wUe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{RUe(e,r),n.call(t,...i)}},RUe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},IUe=(t,e,r,n)=>{if(!CUe(t,e,r,n))throw t},CUe=(t,e,r,n=!0)=>r.propagating?_ne(t)||Nx(t):(r.propagating=!0,h$(r,e)===n?_ne(t):Nx(t)),h$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",Nx=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",_ne=t=>t?.code==="EPIPE";var yne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>m$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),m$=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=M_(t,e,l);if(h$(l,e)){await u;return}let[d]=await Promise.all([mne({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 Sne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?kl([t,e].filter(Boolean)):void 0,Ene=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>m$({...PUe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:OUe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),PUe=({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}},OUe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as NUe}from"events";var vne=t=>uf(t,"ipc"),Tne=(t,e)=>{let r=UA(t);uo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var bne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=vne(o),a=ps(e,"ipc"),c=ps(r,"ipc");for await(let l of XL({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Rte(t,i,c),i.push(l)),s&&Tne(l,o);return i},Ane=async(t,e)=>(await Promise.allSettled([t]),e);var xne=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=Ore(t,f),A={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},y=yne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),x=Ene({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:A}),R=[],C=bne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=kUe(m,t,A),k=MUe(h,A);try{return await Promise.race([Promise.all([{},kre(b),Promise.all(y),x,C,ote(t,d),...O,...k]),S,DUe(t,E),...ete(t,o,f,E),...vee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:E}),...Xee({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:E})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(y.map(_=>p$(_))),p$(x),Ane(C,R),Promise.allSettled(O),Promise.allSettled(k)])}},kUe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:M_(n,i,r)),MUe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>M_(s,n,e,{isSameDirection:Wn.has(i),stopOnExit:i==="native"}))),DUe=async(t,{signal:e})=>{let[r]=await NUe(t,"error",{signal:e});throw r};var wne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),D_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=fo();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},bf=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 LUe}from"stream";import{callbackify as $Ue}from"util";import{finished as Rne}from"stream/promises";var g$=async t=>{if(t!==void 0)try{await _$(t)}catch{}},Ine=async t=>{if(t!==void 0)try{await y$(t)}catch{}},_$=async t=>{await Rne(t,{cleanup:!0,readable:!1,writable:!0})},y$=async t=>{await Rne(t,{cleanup:!0,readable:!0,writable:!1})},kx=async(t,e)=>{if(await t,e)throw e},Mx=(t,e,r)=>{r&&!Nx(r)?t.destroy(r):e&&t.destroy()};var Cne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||_n.has(r),{subprocessStdout:a,waitReadableDestroy:c}=S$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=E$(a,s),{read:f,onStdoutDataDone:p}=v$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new LUe({read:f,destroy:$Ue(b$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return T$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},S$=(t,e,r)=>{let n=mf(t,e),i=D_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},E$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:f$},v$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=fo(),s=Ox({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){UUe(this,s,o)},onStdoutDataDone:o}},UUe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},T$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await y$(t),await n,await g$(i),await e,r.readable&&r.push(null)}catch(o){await g$(i),Pne(r,o)}},b$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bf(r,e)&&(Pne(t,n),await kx(e,n))},Pne=(t,e)=>{Mx(t,t.readable,e)};import{Writable as FUe}from"stream";import{callbackify as One}from"util";var Nne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=A$(t,r,e),s=new FUe({...x$(n,t,i),destroy:One(R$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return w$(n,s),s},A$=(t,e,r)=>{let n=KA(t,e),i=D_(r,n,"writableFinal"),o=D_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},x$=(t,e,r)=>({write:BUe.bind(void 0,t),final:One(jUe.bind(void 0,t,e,r))}),BUe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},jUe=async(t,e,r)=>{await bf(r,e)&&(t.writable&&t.end(),await e)},w$=async(t,e,r)=>{try{await _$(t),e.writable&&e.end()}catch(n){await Ine(r),kne(e,n)}},R$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bf(r,e),await bf(n,e)&&(kne(t,i),await kx(e,i))},kne=(t,e)=>{Mx(t,t.writable,e)};import{Duplex as zUe}from"stream";import{callbackify as GUe}from"util";var Mne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||_n.has(r),{subprocessStdout:c,waitReadableDestroy:l}=S$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=A$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=E$(c,a),{read:S,onStdoutDataDone:E}=v$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new zUe({read:S,...x$(u,t,d),destroy:GUe(qUe.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 T$({subprocessStdout:c,onStdoutDataDone:E,readable:b,subprocess:t,subprocessStdin:u}),w$(u,b,c),b},qUe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([b$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),R$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var I$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||_n.has(e),s=mf(t,r),a=Ox({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return VUe(a,s,t)},VUe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Dne=(t,{encoding:e})=>{let r=wne();t.readable=Cne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Nne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Mne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=I$.bind(void 0,t,e),t[Symbol.asyncIterator]=I$.bind(void 0,t,e,{})};var Lne=(t,e)=>{for(let[r,n]of WUe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},HUe=(async()=>{})().constructor.prototype,WUe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(HUe,t)]);var $ne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=ZUe(t,e,r),{subprocess:f,promise:p}=XUe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Px.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Lne(f,p),po.set(f,{options:u,fileDescriptors:d}),f},ZUe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=BA(t,e,r),{file:a,commandArguments:c,options:l}=sx(t,e,r),u=JUe(l),d=Yre(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},JUe=({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}},XUe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=KUe(...ax(t,e,r))}catch(h){return qre({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;YUe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];nne(c,a,l),one(c,r,l);let d={},f=fo();c.kill=See.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Sne(c,r),Dne(c,r),jre(c,r);let p=QUe({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}},QUe=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 xne({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)=>ms(y,e,x)),b=ms(m,e,"all"),A=eFe({errorInfo:d,exitCode:f,signal:p,stdio:E,all:b,ipcOutput:S,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Ef(A,n,e)},eFe=({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?C_({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 ho,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):mx({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var Dx=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,tFe(n,t[n],i)]));return{...t,...r}},tFe=(t,e,r)=>rFe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,rFe=new Set(["env",...iL]);var Da=(t,e,r,n)=>{let i=(s,a,c)=>Da(s,a,r,c),o=(...s)=>nFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},nFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Ot(o))return i(t,Dx(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=iFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Dre(a,c,l):$ne(a,c,l,i)},iFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=YQ(e)?KQ(e,r):[e,...r],[s,a,c]=CA(...o),l=Dx(Dx(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 Une=({file:t,commandArguments:e})=>Bne(t,e),Fne=({file:t,commandArguments:e})=>({...Bne(t,e),isSync:!0}),Bne=(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]=oFe(t);return{file:r,commandArguments:n}},oFe=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(sFe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},sFe=/ +/g;var jne=(t,e,r)=>{t.sync=e(aFe,r),t.s=t.sync},zne=({options:t})=>Gne(t),aFe=({options:t})=>({...Gne(t),isSync:!0}),Gne=t=>({options:{...cFe(t),...t}}),cFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},qne={preferLocal:!0};var Vne=Da(()=>({})),Wbt=Da(()=>({isSync:!0})),Hne=Da(Une),Ybt=Da(Fne),Kbt=Da(rte),Zbt=Da(zne,{},qne,jne),{sendMessage:Jbt,getOneMessage:Xbt,getEachMessage:Qbt,getCancelSignal:eAt}=zre();var Wne=!1,Yne=()=>{Wne=!0},go=()=>Wne;var L_=null,Kne=t=>(L_&&L_.destroy(),L_=new gs({totalAllowedTime:t}),L_),Zne=()=>L_;var gs=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&&go())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 TA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{de.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 Jne={name:"@netlify/agent-runner-cli",type:"module",version:"1.156.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{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.2","@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.5","@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 fFe=uFe(import.meta.url),pFe=_s.dirname(fFe),hFe=dFe(import.meta.url),Af=pe("shell"),C$=new Set,Xne={preferLocal:!0},zt=(t,e,r)=>{let[n,i]=mFe(e,r),o={...Xne,...i},s=Vne(t,n,o);eie(s,o),nie(s);let a=r?.idleTimeout;return a&&a>0&&rie(s,a),s},Qne=(t,e)=>{let r={...Xne,...e},n=Hne(t,r);return eie(n,r),nie(n),e?.idleTimeout&&e.idleTimeout>0&&rie(n,e.idleTimeout),n},mFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},eie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(ys.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new u_).pipe(ys.stdout),t.stderr?.pipe(new u_).pipe(ys.stderr);return}t.stdout?.pipe(ys.stdout),t.stderr?.pipe(ys.stderr)},P$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(ys.kill(-t.pid,e),Af.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Af.error("Error killing process:",r),!1}},tie=t=>P$(t,"SIGKILL"),rie=(t,e)=>{let r=null,n=()=>{Af.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing idle process ${t.pid}`),tie(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)},nie=t=>{C$.add(t);let e=Zne();if(e){let r=e.onTimesUp(()=>{Af.log(`Global timer expired, killing process ${t.pid}`),P$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Af.log(`Force killing process ${t.pid} after timeout`),tie(t))},5e3)});t.on("exit",()=>{C$.delete(t),r()}),t.on("error",()=>{C$.delete(t),r()})}};function $x(t,e){return!!Ci(t,e)}function Ci(t,e){if(!ys.env.NETLIFY_LOCAL_MODE)try{let i=hFe.resolve(Jne.name),o=_s.dirname(i);for(;o!==_s.dirname(o);){let s=_s.dirname(o);if(_s.basename(s)==="node_modules"){let a=_s.join(s,".bin",e);if(Lx.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(ys.env.NODE_PATH){let i=_s.join(ys.env.NODE_PATH,".bin",e);if(Lx.existsSync(i))return i}let r=_s.join(t,"node_modules",".bin",e);if(Lx.existsSync(r))return r;let n=_s.join(pFe,"..","node_modules",".bin",e);if(Lx.existsSync(n))return n}var gFe=pe("utils"),_Fe=t=>new Promise(e=>{setTimeout(e,t)});var O$=t=>{try{return new URL(t).hostname||null}catch{return null}},Ux=(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 _Fe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},La=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},iie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):gFe.error("Could not parse JSON",n))}},yFe=t=>t.charAt(0).toUpperCase()+t.slice(1),_o=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():yFe(e)).join(" ");function Ss(t,e){e&&t.log(`Skill invoked: ${e}`)}var Fx=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),oie=(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 N$=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}},SFe=1e4,k$=(t,e=SFe)=>{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 EFe}from"crypto";import{createReadStream as vFe}from"fs";import Bx from"fs/promises";import uie from"os";import jx from"path";var sie=pe("repo"),die="runner-diffs-",fie=t=>`${die}${t}-`,pie=async t=>{let e=uie.tmpdir(),r;try{r=await Bx.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(die)&&!n.startsWith(fie(t))).map(n=>Bx.rm(jx.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},Xr=(t,e={})=>zt("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),zx=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{sie.info("Getting runner diffs");let n=await bFe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=xFe(o);await wFe(h,r)}sie.info("Changes after processing"),await D$(r);let s=await L$(o,r);if(await M$(s,r),i=await AFe(r),!i)return{hasChanges:!1,ignored:s};await Xr(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Bx.mkdtemp(jx.join(uie.tmpdir(),fie(t.sessionId))),c=async({from:h,to:m,fileName:S,binary:E})=>{let b=jx.join(a,S);await Xr([...E?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:y}=await Bx.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 lie(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 cie(d,h)||(f=h)}await lie(r),de.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await cie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},aie=async t=>{let e=EFe("sha256");for await(let r of vFe(t))e.update(r);return e.digest("hex")},cie=async(t,e)=>t.size===e.size&&await aie(t.path)===await aie(e.path),lie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await Xr(["reset","--soft","HEAD~1"],{cwd:t})},M$=async(t=[],e=process.cwd())=>{await Xr(["add",".",...t],{cwd:e})},D$=async(t=process.cwd())=>{let e=await Xr(["status","-s"],{cwd:t});return String(e.stdout??"")},hie=/.. (.+)?\.log$/,TFe=[hie],bFe=async(t=process.cwd())=>{let e=await D$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
103
103
  `).filter(i=>TFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},AFe=async(t=process.cwd())=>{try{return await Xr(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},$_=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},mie=async(t=process.cwd())=>{let{stdout:e}=await Xr(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},L$=async(t,e=process.cwd())=>{t||=await D$(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(`
104
104
  `).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${jx.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(hie)?.[1];o&&n.push(`:!${o}.log`)}),n},gie=async(t=process.cwd())=>{await Xr(["reset","--hard","HEAD"],{cwd:t})},_ie=async(t=process.cwd())=>{let e=await Xr(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
105
105
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},xFe=t=>{let e=t.split(`
@@ -419,12 +419,12 @@ ${t}
419
419
  </build_error_context>`:"",yqe=t=>`
420
420
  <mode_reminder>
421
421
  ${Az("ask")} Do NOT modify project files (including via Bash, sed, redirects, or npm/pnpm/yarn install). Do NOT build or deploy. Do NOT start a local dev server or any long-running/background process. If a fix is warranted, describe it \u2014 do not apply it. Any earlier instructions in this session to write a summary or answer to ${t}/${cs} no longer apply: that file is not writable in this mode, so do NOT attempt to write it. Deliver the answer as your final message.
422
- </mode_reminder>`,Sqe=({netlifyFolder:t,skillsDir:e,cliPath:r})=>`
422
+ </mode_reminder>`,Sqe=({netlifyFolder:t,skillsDir:e,cliPath:r,questionsEnabled:n=!1})=>`
423
423
  <mode_reminder>
424
424
  Earlier turns in this session ran in "Ask mode". Those restrictions no longer apply; ignore them and follow the instructions below instead:
425
425
  ${tue({netlifyFolder:t,resultsFilename:cs})}
426
- ${nue(e)}${sue(r)}
427
- </mode_reminder>`,uue=({dirPath:t,config:e,skillsDir:r,cliPath:n})=>e.mode==="ask"?yqe(pqe.basename(t)):e.previousSession?.mode==="ask"?Sqe({netlifyFolder:t,skillsDir:r,cliPath:n}):"",due=({sanitizedPrompt:t,buildErrorContextText:e,assetsSection:r,modeReminder:n})=>`
426
+ ${nue(e,n)}${sue(r)}
427
+ </mode_reminder>`,uue=({dirPath:t,config:e,skillsDir:r,cliPath:n,questionsEnabled:i=!1})=>e.mode==="ask"?yqe(pqe.basename(t)):e.previousSession?.mode==="ask"?Sqe({netlifyFolder:t,skillsDir:r,cliPath:n,questionsEnabled:i}):"",due=({sanitizedPrompt:t,buildErrorContextText:e,assetsSection:r,modeReminder:n})=>`
428
428
  <request>
429
429
  <user_request>
430
430
  ${t}
@@ -480,7 +480,7 @@ ${S.models.map(E=>`- \`${E}\``).join(`
480
480
  `);p=p.replace("<!-- AVAILABLE_MODELS -->",h),await Lt.writeFile(f,p,"utf-8"),on.log("Injected dynamic model list into AI Gateway skill",{modelList:h})}}catch(d){on.warn("Failed to inject dynamic model list into AI Gateway skill:",d.message),de.inc("context.degraded",1,{component:"model_list"})}return u.length>0&&(on.log(`Installed ${u.length} skills for ${t}: ${u.join(", ")}`,{runner:t,skills:u,targetDir:i}),et.getActiveSpan()?.setAttributes({"agent.skills_loaded":u,"agent.skills_loaded_count":u.length})),xz={key:l,skills:u},u},Nqe=t=>{let e=t?.constants||{};return{siteId:e.SITE_ID,accountId:Po.env.NETLIFY_TEAM_ID,userId:Po.env.NETLIFY_AGENT_RUNNER_USER_ID,siteSlug:Po.env.SITE_NAME,apiHost:e.NETLIFY_API_HOST,functionsDir:e.FUNCTIONS_DIST}},kqe=10,Mqe=async t=>{let{name:e,ext:r}=Qe.parse(t),n=t,i=Qe.join(Po.cwd(),ur,n),o=0;for(;await Dqe(i);){if(o>=kqe)throw new Error("Failed to generate context file");n=`${e}-${Eqe.randomUUID().slice(0,5)}${r}`,i=Qe.join(Po.cwd(),ur,n),o+=1}return n},Dqe=async t=>{try{return await Lt.access(t),!0}catch{return!1}},qI=async t=>{try{return(await Lt.readdir(t)).length>0}catch{return!1}},hue=async({cliPath:t,netlify:e,config:r,buildErrorContext:n,additionalContext:i,resumePrompt:o})=>{let s=Nqe(e),a=await Mqe(sQ),c=Qe.join(Po.cwd(),ur);await Lt.mkdir(c,{recursive:!0});let l=Qe.join(ur,a),u=Qe.join(Po.cwd(),l),d=Qe.join(Po.cwd(),ur,cs);try{await Lt.unlink(d),on.log(`Deleted old results file: ${d}`)}catch{}let f=lue(n),p=r.skillsTargetDir||fue[r.runner];if(r.runner&&await Oqe(r.runner,{targetDir:r.skillsTargetDir,mode:r.mode}),o){let x=VI(r.sessionId),R=x?Qe.join(c,bi,x):null,C=R&&await qI(R)?`
481
481
  <attachments>
482
482
  New uploads for this request are in ${R}/
483
- </attachments>`:"",O=uue({dirPath:c,config:r,skillsDir:p,cliPath:t}),k=due({sanitizedPrompt:wz(r.prompt),buildErrorContextText:f,assetsSection:C,modeReminder:O});return await Lt.writeFile(u,k,"utf-8"),on.log(`Generated minimal resume prompt at: ${u}`),k}let h="";r.siteContext&&r.siteContext.length!==0&&(h=`
483
+ </attachments>`:"",O=uue({dirPath:c,config:r,skillsDir:p,cliPath:t,questionsEnabled:Ve().questionsEnabled}),k=due({sanitizedPrompt:wz(r.prompt),buildErrorContextText:f,assetsSection:C,modeReminder:O});return await Lt.writeFile(u,k,"utf-8"),on.log(`Generated minimal resume prompt at: ${u}`),k}let h="";r.siteContext&&r.siteContext.length!==0&&(h=`
484
484
  <project_rules>
485
485
  ${r.siteContext.filter(R=>R.site_context).map(R=>typeof R.site_context=="string"?R.site_context:typeof R.site_context=="object"?JSON.stringify(R.site_context):"").join(`
486
486