@gitlab/duo-cli 8.29.0 → 8.29.1

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/index.js CHANGED
@@ -1162,7 +1162,7 @@ Please report this to https://github.com/markedjs/marked.`,A){let Q="<p>An error
1162
1162
  `]},Y))})})()]})})};var ha=(A)=>{VJ((D,_)=>{if(_.return)A()})},bP=(A)=>{VJ((D,_)=>{if(_.ctrl&&D==="c")A()})},_10=(A)=>{VJ((D,_)=>{if(_.ctrl&&D==="o")A()})},Q10=(A)=>{VJ((D,_)=>{if(_.ctrl&&D==="s")A()})};var E10=({input:A,callbacks:D})=>{let[_,Q]=B10.useState(A.lines.join(`
1163
1163
  `));return ha(()=>{D.onSubmit(_),Q("")}),bP(()=>{if(_.trim())Q("");else D.onExit()}),_A(ma,{value:_,onChange:(E)=>{Q(E)},placeholder:"Type your message here... • Ctrl+C to exit"})};var z10=({input:A,callbacks:D})=>{let _=A.choiceOptions||[],Q=A.selectedChoiceIndex??0;return bP(()=>{D.onExit()}),F4(EA,{flexDirection:"column",children:[_A(EA,{borderStyle:"single",borderColor:"gray",paddingX:1,children:_A(S0,{color:"dim",children:"Select an option:"})}),_A(EA,{flexDirection:"column",paddingLeft:2,paddingY:1,children:_.map((B,E)=>{let z=E===Q;return F4(EA,{marginBottom:B.description?0:0,children:[F4(S0,{color:z?"cyan":"white",bold:z,children:[z?"› ":" ",B.label]}),B.description&&F4(S0,{color:"dim",children:[" - ",B.description]})]},E)})}),_A(S0,{dimColor:!0,children:"Use ↑/↓ arrows to navigate • Enter to select • Ctrl+C to exit"})]})};var Pq={TEXT:"text",CHOICE:"choice"};var J10=({input:A,callbacks:D})=>{switch(VJ((_,Q)=>{D.onKeyPress(_,Q)}),A.inputType){case Pq.TEXT:return _A(E10,{input:A,callbacks:D});case Pq.CHOICE:return _A(z10,{input:A,callbacks:D});default:return null}};var X10=()=>{return _A(EA,{paddingLeft:2,children:_A(S0,{color:"yellow",children:"\uD83E\uDD16 Duo is thinking..."})})};var G10=({error:A})=>{return F4(EA,{flexDirection:"column",marginY:0,children:[_A(EA,{children:_A(S0,{color:"red",children:"❌ Error:"})}),_A(EA,{paddingLeft:2,children:_A(S0,{color:"red",children:A})}),_A(KG,{})]})};var Y10=({state:A,callbacks:D})=>{return _10(D.toggleExpanded),F4(EA,{flexDirection:"column",height:"100%",children:[_A(EA,{flexDirection:"column",flexGrow:1,marginBottom:1,children:A.elements.map((_,Q)=>{if(_.type==="message")return _A(Vi1,{message:_},`${_.id}-${Q}`);if(_.type==="error")return _A(G10,{error:_.error},`${_.id}-${Q}`);return _A(D10,{tool:_,expanded:A.expanded},`${_.id}-${Q}`)})}),_A(J10,{input:A.input,callbacks:D}),A.isLoading&&_A(X10,{})]})};var R_1=({state:A,callbacks:D})=>{return _A(Y10,{state:A,callbacks:D})};var ca=C0(j2(),1);var pa={gitlabRed:"#e2432a",gitlabOrange:"#fc6d27",gitlabYellow:"#fca326",gitlabPurple:"#554488",gitlabGrey:"#8c929d",white:"#FFFFFF"};var F10=()=>{let{gitlabRed:A,gitlabOrange:D,gitlabYellow:_}=pa;return F4(EA,{flexDirection:"column",children:[_A(S0,{color:A,children:" .. .. "}),_A(S0,{color:A,children:" .+= =+. "}),F4(S0,{children:[" ",_A(S0,{color:A,children:".-+*"}),_A(S0,{color:A,children:"===="}),_A(S0,{color:A,children:"*+-."})]}),F4(S0,{children:[" ",_A(S0,{color:D,children:".=="}),_A(S0,{color:A,children:"+****+"}),_A(S0,{color:D,children:"==."})]}),F4(S0,{children:[_A(S0,{color:D,children:" .==*"}),_A(S0,{color:A,children:"++"}),_A(S0,{color:D,children:"*==. "})]}),F4(S0,{children:[_A(S0,{color:D,children:" '.="}),_A(S0,{color:_,children:"--"}),_A(S0,{color:D,children:"=.' "})]}),_A(S0,{color:_,children:" '**' "})]})};var $10=({version:A})=>{return F4(EA,{borderStyle:"round",children:[_A(EA,{children:_A(F10,{})}),F4(EA,{flexDirection:"column",children:[_A(db,{}),_A(S0,{children:"GitLab Duo CLI"}),_A(KG,{}),F4(S0,{children:["Version: ",A]}),_A(db,{})]})]})};var{gitlabPurple:MvA,white:OvA}=pa,NvA=({entry:A,isActive:D})=>{let _=D?MvA:void 0,Q=D?OvA:void 0,B=A.value?Lq(A.value,A.isSensitive):"Not set";return F4(EA,{paddingX:1,paddingY:1,children:[_A(EA,{flexGrow:2,flexShrink:0,flexBasis:0,children:F4(S0,{color:Q,backgroundColor:_,children:[D?"▸ ":" ",A.displayName]})}),_A(EA,{flexGrow:2,flexShrink:0,flexBasis:0,paddingLeft:2,children:_A(S0,{children:B})}),_A(EA,{flexGrow:3,flexShrink:0,flexBasis:0,paddingLeft:2,children:_A(S0,{dimColor:!0,children:A.description})})]})},K10=({state:A,configurationIndex:D})=>{let _=A.configurationEntries[D];return F4(EA,{flexDirection:"column",children:[F4(EA,{paddingX:1,paddingTop:1,children:[_A(EA,{flexGrow:2,flexShrink:0,flexBasis:0,children:_A(S0,{bold:!0,children:"Setting"})}),_A(EA,{flexGrow:2,flexShrink:0,flexBasis:0,paddingLeft:2,children:_A(S0,{bold:!0,children:"Current Value"})}),_A(EA,{flexGrow:3,flexShrink:0,flexBasis:0,paddingLeft:2,children:_A(S0,{bold:!0,children:"Description"})})]}),A.configurationEntries.map((Q)=>_A(NvA,{entry:Q,isActive:Q.key===_.key},Q.key))]})};var Z10=({initialState:A,controller:D,duoCliVersion:_})=>{let[Q,B]=ca.useState(0),[E,z]=ca.useState(A),J=E.configurationEntries[Q],[X,G]=ca.useState(J.value);bP(()=>D.exit());let Y=()=>{B((F)=>{let Z=Math.min(E.configurationEntries.length-1,F+1);return G(E.configurationEntries[Z].value),Z})};VJ((F,Z)=>{if(Z.tab&&!Z.shift)Y();if(Z.tab&&Z.shift)B((U)=>{let C=Math.max(0,U-1);return G(E.configurationEntries[C].value),C})}),Q10(async()=>{(await D.saveConfig(E)).match(()=>{D.exit()},(Z)=>{throw Z})}),ha(()=>{let F=[...E.configurationEntries];F[Q].value=X||F[Q].defaultValue,z({configurationEntries:F}),Y()});let $=(F)=>{G(F)},K=J.defaultValue===""?`Please enter your ${J.displayName}.`:`Please enter your ${J.displayName}. Press Enter to use ${J.defaultValue}.`;return F4(EA,{flexDirection:"column",children:[_A($10,{version:_}),_A(K10,{state:E,configurationIndex:Q,inputValue:X,onValueChange:$}),_A(ma,{value:X,onChange:$,placeholder:K,masked:J.isSensitive}),_A(EA,{paddingX:2,paddingTop:1,children:_A(S0,{dimColor:!0,children:_A(gL,{markdown:"Press *Enter* to apply • *Tab/Shift+Tab* to navigate forward/back • *Ctrl+S* to save and exit • *Ctrl+C* to exit without saving"})})})]})};var kP={inputType:"text",lines:[""],cursorLine:0,cursorColumn:0},T_1={elements:[],isLoading:!1,input:kP,expanded:!1};var uO=C0(j2(),1);var U10=C0(OA(),1),f8=U10.createInterfaceId("GitLabApiService");var I10=C0(GG(),1);function w10(A){return(A.split(`
1164
1164
  `).find((D)=>D.trim())??A.replace(`
1165
- `,"")).trim()}function LvA(A){return w10(A).match(/^(query|mutation|subscription)\s+/)?.[1]}function PvA(A){return w10(A).match(/(?:query|mutation|subscription)\s+(\w+)/)?.[1]}function da(A){let D=LvA(A),_=PvA(A);if(D)return`${D}: ${_??"anonymous"}`;return}var RvA=(A)=>{if(A.method==="GET"||A.method==="HEAD")return;if(!A.body)return;return a9("Body",JSON.stringify(A.body))},TvA=(A)=>{if(A.method==="POST"||A.method==="PATCH"||A.method==="PUT")return;if(!A.searchParams)return;return a9("Search Params",JSON.stringify(A.searchParams))},vvA=(A)=>{if(!A.headers)return;return a9("Headers",JSON.stringify(A.headers))},Yx=(A)=>{switch(A.type){case"graphql":return jB("GraphQL Request",a9("Query",A.query.replace(/[\s\n]+/g," ").trim()),a9("Variables",JSON.stringify(A.variables)));case"rest":return jB("REST Request",a9("Method",A.method),a9("Path",A.path),vvA(A),TvA(A),RvA(A));default:return a9("Unknown request type",A.type)}};var H10=(A)=>{try{return JSON.parse(A)?.error}catch{return}},yvA=(A)=>{if(!A)return"";try{return JSON.parse(A)?.error_description??""}catch{return""}},v_1=(A,D)=>Boolean(A.status===401&&D&&H10(D)==="invalid_token"),y_1=(A,D)=>Boolean(A.status===400&&D&&H10(D)==="invalid_grant");class la extends Error{request;cause;constructor(A,D,_){super(A);this.request=D,this.cause=_?.cause}get sanitizedMessage(){return"API request failed"}}class S_1 extends la{status;constructor(A,D,_,Q){super(A,D,Q);this.status=_}}class V10 extends S_1{type="rest";response;#A;constructor(A,D,_,Q){let B=`Fetching ${_} from ${D.url} failed. ${yvA(Q)}`;if(v_1(D,Q))B=`Request for ${_} failed because the token is expired or revoked.`;if(y_1(D,Q))B="Request to refresh token failed, because it's revoked or already refreshed.";super(B,A,D.status);this.response=D,this.#A=Q}isInvalidTokenOrInvalidRefresh(){return v_1(this.response,this.#A)||y_1(this.response,this.#A)}get ctx(){return jB("Error details",Yx(this.request),this.#D())}get sanitizedMessage(){if(v_1(this.response,this.#A))return"Request failed because the token is expired or revoked.";if(y_1(this.response,this.#A))return"Request to refresh token failed, because it's revoked or already refreshed.";return`Request failed with error code: ${this.response.status}`}#D(){let A=Object.fromEntries(this.response.headers.entries());return jB("Response",a9("Status",String(this.status)),!I10.default.isEmpty(A)?a9("Headers",JSON.stringify(A)):void 0,this.#A?a9("Response body",this.#A):void 0)}get body(){return this.#A}}var C10=(A)=>A.errors?.map((D)=>D.message).join(",")||"";class j_1 extends S_1{type="graphql";graphQlResponse;#A;constructor(A,D){let _=da(A.query),Q=`GraphQL request "${_}" failed with ${C10(D)}`;super(Q,A,D.status);this.graphQlResponse=D,this.#A=_}get sanitizedMessage(){return`GraphQL request "${this.#A}" failed with status ${this.graphQlResponse.status}`}get ctx(){return jB("Error details",Yx(this.request),this.#D())}#D(){return jB("Response",a9("Status",String(this.graphQlResponse.status)),a9("Errors",C10(this.graphQlResponse)))}}class ia extends la{type="network";cause;constructor(A,D){let _=D instanceof Error?D.message:`Network error occurred: ${D}`;super(_,A);this.cause=D}get ctx(){return jB("Error details",Yx(this.request),this.#A())}get sanitizedMessage(){let A=this.cause,D=A?.code||A?.errno,_=this.#D(D);return`Network error occurred${_?`: ${_}`:""}`}#A(){if(!this.cause||!(this.cause instanceof Error))return;let A=this.cause;if(A.code||A.errno){let D=A.code||A.errno,_=this.#D(D),Q=_?`${_} (${D})`:`Error code: ${D}`;return a9("Network issue",Q)}return}#D(A){return{ENOTFOUND:"DNS lookup failed - hostname could not be resolved",ECONNREFUSED:"Connection refused - server is not accepting connections",ECONNRESET:"Connection reset by peer - server closed the connection unexpectedly",ETIMEDOUT:"Connection timed out - server did not respond in time",EHOSTUNREACH:"Host unreachable - network route to server not available",ENETUNREACH:"Network unreachable - no network connectivity",ECONNABORTED:"Connection aborted - request was cancelled",EBADF:"Bad file descriptor - network connection issue",EPIPE:"Broken pipe - connection closed while writing data",EAI_AGAIN:"DNS lookup failed temporarily - try again later"}[A]}}class SvA extends la{type="timeout";#A;constructor(A,D){let _=`Request timed out${D?` after ${D}ms`:""}`;super(_,A);this.#A=_}get ctx(){return jB("Error details",Yx(this.request))}get sanitizedMessage(){return this.#A}}var q10=V10;var b_1={type:"rest",method:"GET",path:"/api/v4/version"};var aa=JSON;var W10=(A)=>A.toUpperCase(),M10=(A)=>{let D={};return A.forEach((_,Q)=>{D[Q]=_}),D};var O10=(A,D,_)=>{return A.document?A:{document:A,variables:D,requestHeaders:_,signal:void 0}},N10=(A,D,_)=>{return A.query?A:{query:A,variables:D,requestHeaders:_,signal:void 0}},L10=(A,D)=>{return A.documents?A:{documents:A,requestHeaders:D,signal:void 0}};var ln=C0(H90(),1),V90=(A)=>{let D=void 0,_=A.definitions.filter((Q)=>Q.kind==="OperationDefinition");if(_.length===1)D=_[0]?.name?.value;return D},lq=(A)=>{if(typeof A==="string"){let _=void 0;try{let Q=ln.parse(A);_=V90(Q)}catch(Q){}return{query:A,operationName:_}}let D=V90(A);return{query:ln.print(A),operationName:D}};class Kz extends Error{constructor(A,D){let _=`${Kz.extractMessage(A)}: ${JSON.stringify({response:A,request:D})}`;super(_);if(Object.setPrototypeOf(this,Kz.prototype),this.response=A,this.request=D,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,Kz)}static extractMessage(A){return A.errors?.[0]?.message??`GraphQL Error (Code: ${A.status})`}}var jC=C0(G50(),1);var YiA="connection_init",FiA="connection_ack",F50="ping",$50="pong",$iA="subscribe",KiA="next",ZiA="error",K50="complete";class SC{get type(){return this._type}get id(){return this._id}get payload(){return this._payload}constructor(A,D,_){this._type=A,this._payload=D,this._id=_}get text(){let A={type:this.type};if(this.id!=null&&this.id!=null)A.id=this.id;if(this.payload!=null&&this.payload!=null)A.payload=this.payload;return JSON.stringify(A)}static parse(A,D){let{type:_,payload:Q,id:B}=JSON.parse(A);return new SC(_,D(Q),B)}}class HE1{constructor(A,{onInit:D,onAcknowledged:_,onPing:Q,onPong:B}){this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=A,A.addEventListener("open",async(E)=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={},A.send(wiA(D?await D():null).text)}),A.addEventListener("close",(E)=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={}}),A.addEventListener("error",(E)=>{console.error(E)}),A.addEventListener("message",(E)=>{try{let z=UiA(E.data);switch(z.type){case FiA:{if(this.socketState.acknowledged)console.warn("Duplicate CONNECTION_ACK message ignored");else if(this.socketState.acknowledged=!0,_)_(z.payload);return}case F50:{if(Q)Q(z.payload).then((Y)=>A.send(Y50(Y).text));else A.send(Y50(null).text);return}case $50:{if(B)B(z.payload);return}}if(!this.socketState.acknowledged)return;if(z.id===void 0||z.id===null||!this.socketState.subscriptions[z.id])return;let{query:J,variables:X,subscriber:G}=this.socketState.subscriptions[z.id];switch(z.type){case KiA:{if(!z.payload.errors&&z.payload.data)G.next&&G.next(z.payload.data);if(z.payload.errors)G.error&&G.error(new Kz({...z.payload,status:200},{query:J,variables:X}));return}case ZiA:{G.error&&G.error(new Kz({errors:z.payload,status:200},{query:J,variables:X}));return}case K50:{G.complete&&G.complete(),delete this.socketState.subscriptions[z.id];return}}}catch(z){console.error(z),A.close(1006)}A.close(4400,"Unknown graphql-ws message.")})}makeSubscribe(A,D,_,Q){let B=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[B]={query:A,variables:Q,subscriber:_},this.socket.send(IiA(B,{query:A,operationName:D,variables:Q}).text),()=>{this.socket.send(HiA(B).text),delete this.socketState.subscriptions[B]}}rawRequest(A,D){return new Promise((_,Q)=>{let B;this.rawSubscribe(A,{next:(E,z)=>B={data:E,extensions:z},error:Q,complete:()=>_(B)},D)})}request(A,D){return new Promise((_,Q)=>{let B;this.subscribe(A,{next:(E)=>B=E,error:Q,complete:()=>_(B)},D)})}subscribe(A,D,_){let{query:Q,operationName:B}=lq(A);return this.makeSubscribe(Q,B,D,_)}rawSubscribe(A,D,_){return this.makeSubscribe(A,void 0,D,_)}ping(A){this.socket.send(CiA(A).text)}close(){this.socket.close(1000)}}HE1.PROTOCOL="graphql-transport-ws";function UiA(A,D=(_)=>_){return SC.parse(A,D)}function wiA(A){return new SC(YiA,A)}function CiA(A){return new SC(F50,A,void 0)}function Y50(A){return new SC($50,A,void 0)}function IiA(A,D){return new SC($iA,D,A)}function HiA(A){return new SC(K50,void 0,A)}var BR=(A)=>{let D={};if(A)if(typeof Headers!=="undefined"&&A instanceof Headers||jC&&jC.Headers&&A instanceof jC.Headers)D=M10(A);else if(Array.isArray(A))A.forEach(([_,Q])=>{if(_&&Q!==void 0)D[_]=Q});else D=A;return D},Z50=(A)=>A.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),ViA=(A)=>{if(!Array.isArray(A.query)){let Q=A,B=[`query=${encodeURIComponent(Z50(Q.query))}`];if(A.variables)B.push(`variables=${encodeURIComponent(Q.jsonSerializer.stringify(Q.variables))}`);if(Q.operationName)B.push(`operationName=${encodeURIComponent(Q.operationName)}`);return B.join("&")}if(typeof A.variables!=="undefined"&&!Array.isArray(A.variables))throw new Error("Cannot create query with given variable type, array expected");let D=A,_=A.query.reduce((Q,B,E)=>{return Q.push({query:Z50(B),variables:D.variables?D.jsonSerializer.stringify(D.variables[E]):void 0}),Q},[]);return`query=${encodeURIComponent(D.jsonSerializer.stringify(_))}`},qiA=(A)=>async(D)=>{let{url:_,query:Q,variables:B,operationName:E,fetch:z,fetchOptions:J,middleware:X}=D,G={...D.headers},Y="",$=void 0;if(A==="POST"){if($=WiA(Q,B,E,J.jsonSerializer),typeof $==="string")G["Content-Type"]="application/json"}else Y=ViA({query:Q,variables:B,operationName:E,jsonSerializer:J.jsonSerializer??aa});let K={method:A,headers:G,body:$,...J},F=_,Z=K;if(X){let U=await Promise.resolve(X({...K,url:_,operationName:E,variables:B})),{url:C,...V}=U;F=C,Z=V}if(Y)F=`${F}?${Y}`;return await z(F,Z)};class WE1{constructor(A,D={}){this.url=A,this.requestConfig=D,this.rawRequest=async(..._)=>{let[Q,B,E]=_,z=N10(Q,B,E),{headers:J,fetch:X=jC.default,method:G="POST",requestMiddleware:Y,responseMiddleware:$,...K}=this.requestConfig,{url:F}=this;if(z.signal!==void 0)K.signal=z.signal;let{operationName:Z}=lq(z.query);return VE1({url:F,query:z.query,variables:z.variables,headers:{...BR(qE1(J)),...BR(z.requestHeaders)},operationName:Z,fetch:X,method:G,fetchOptions:K,middleware:Y}).then((U)=>{if($)$(U);return U}).catch((U)=>{if($)$(U);throw U})}}async request(A,...D){let[_,Q]=D,B=O10(A,_,Q),{headers:E,fetch:z=jC.default,method:J="POST",requestMiddleware:X,responseMiddleware:G,...Y}=this.requestConfig,{url:$}=this;if(B.signal!==void 0)Y.signal=B.signal;let{query:K,operationName:F}=lq(B.document);return VE1({url:$,query:K,variables:B.variables,headers:{...BR(qE1(E)),...BR(B.requestHeaders)},operationName:F,fetch:z,method:J,fetchOptions:Y,middleware:X}).then((Z)=>{if(G)G(Z);return Z.data}).catch((Z)=>{if(G)G(Z);throw Z})}batchRequests(A,D){let _=L10(A,D),{headers:Q,...B}=this.requestConfig;if(_.signal!==void 0)B.signal=_.signal;let E=_.documents.map(({document:J})=>lq(J).query),z=_.documents.map(({variables:J})=>J);return VE1({url:this.url,query:E,variables:z,headers:{...BR(qE1(Q)),...BR(_.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??jC.default,method:this.requestConfig.method||"POST",fetchOptions:B,middleware:this.requestConfig.requestMiddleware}).then((J)=>{if(this.requestConfig.responseMiddleware)this.requestConfig.responseMiddleware(J);return J.data}).catch((J)=>{if(this.requestConfig.responseMiddleware)this.requestConfig.responseMiddleware(J);throw J})}setHeaders(A){return this.requestConfig.headers=A,this}setHeader(A,D){let{headers:_}=this.requestConfig;if(_)_[A]=D;else this.requestConfig.headers={[A]:D};return this}setEndpoint(A){return this.url=A,this}}var VE1=async(A)=>{let{query:D,variables:_,fetchOptions:Q}=A,B=qiA(W10(A.method??"post")),E=Array.isArray(A.query),z=await B(A),J=await MiA(z,Q.jsonSerializer??aa),X=Array.isArray(J)?!J.some(({data:Y})=>!Y):Boolean(J.data),G=Array.isArray(J)||!J.errors||Array.isArray(J.errors)&&!J.errors.length||Q.errorPolicy==="all"||Q.errorPolicy==="ignore";if(z.ok&&G&&X){let{errors:Y,...$}=Array.isArray(J)?J:J,K=Q.errorPolicy==="ignore"?$:J;return{...E?{data:K}:K,headers:z.headers,status:z.status}}else throw new Kz({...typeof J==="string"?{error:J}:J,status:z.status,headers:z.headers},{query:D,variables:_})};var WiA=(A,D,_,Q)=>{let B=Q??aa;if(!Array.isArray(A))return B.stringify({query:A,variables:D,operationName:_});if(typeof D!=="undefined"&&!Array.isArray(D))throw new Error("Cannot create request body with given variable type, array expected");let E=A.reduce((z,J,X)=>{return z.push({query:J,variables:D?D[X]:void 0}),z},[]);return B.stringify(E)},MiA=async(A,D)=>{let _;if(A.headers.forEach((Q,B)=>{if(B.toLowerCase()==="content-type")_=Q}),_&&(_.toLowerCase().startsWith("application/json")||_.toLowerCase().startsWith("application/graphql+json")||_.toLowerCase().startsWith("application/graphql-response+json")))return D.parse(await A.text());else return A.text()},qE1=(A)=>{return typeof A==="function"?A():A},fJ=(A,...D)=>{return A.reduce((_,Q,B)=>`${_}${Q}${B in D?String(D[B]):""}`,"")};var U50=async(A,D,_)=>{if(!D.ok){let Q=await D.text().catch(()=>{return});throw new q10(A,D,_,Q)}};function mQ(){return"8.29.0"}var w50=(A)=>{let D=A?`${A?.name}:${A?.version}`:"missing client info";return`gitlab-language-server:${mQ()} (${D})`};function C50(A){return A!==null&&A!==void 0}var ME1=(A,D)=>{return Object.entries(D).forEach(([_,Q])=>{if(C50(Q))A.searchParams.append(_,String(Q))}),A},en=(A)=>A.toString().replace(/\/?$/,"/"),ER=(A)=>A.replace(/^\.?\/?/,"./"),I50=(A)=>{if(A.startsWith("git@")){let D=A.match(/git@([^:]+):(.+)/);if(D){let[,_,Q]=D;return`https://${_}/${Q}`}}if(A.startsWith("git://"))return A.replace("git://","https://");if(A.startsWith("ssh://"))return A.replace("ssh://","https://").replace(/git@([^/]+)/,"$1");return A};var OiA=(A)=>A.split("/").pop()||"unknown resource";class OE1{#A;#D;#_;#Q;#B;constructor(A,D,_,Q,B){this.#A=A,this.#D=D,this.#_=new URL(en(Q)),this.#Q=B,this.#B=_}getDefaultHeaders(){return{Authorization:`Bearer ${this.#Q}`,"User-Agent":w50(this.#B),"X-Gitlab-Language-Server-Version":mQ()}}async fetchFromApiRaw(A){try{let D=`Unknown request method "${A.method}", request type "${A.type}"`;switch(A.method){case"GET":return await this.#z(A);case"POST":return await this.#J(A);case"PATCH":return await this.#X(A);case"PUT":return await this.#Y(A);case"HEAD":return await this.#G(A);default:throw new Error(D)}}catch(D){throw new ia(A,D)}}async fetchFromApi(A){if(A.type==="graphql")return this.#E(A);let D=await this.fetchFromApiRaw(A);return await U50(A,D,OiA(A.path)),D.json()}fetchOperation=(A)=>(D)=>this.fetchFromApi({...A,signal:D});async#E(A){let D=new URL("./api/graphql",this.#_),_=da(A.query);if(_)this.#A.debug(`[SimpleApiClient] Making GraphQL request: ${_}`);let Q=async(E,z)=>{let J=E instanceof URL?E.toString():E;return this.#D.post(J,{...z,headers:{...z?.headers},signal:A.signal})},B=new WE1(D.href,{fetch:Q,headers:{...this.getDefaultHeaders()}});try{return await B.request(A.query,A.variables)}catch(E){if(E instanceof Kz)throw new j_1(A,E.response);throw new ia(A,E)}}async#z(A){let D=ER(A.path),_=new URL(D,this.#_);return ME1(_,A.searchParams??{}),this.#D.get(_,{headers:{...this.getDefaultHeaders(),...A.headers},signal:A.signal})}async#J(A){let D=ER(A.path),_=new URL(D,this.#_);return this.#D.post(_,{headers:{"Content-Type":"application/json",...this.getDefaultHeaders(),...A.headers},body:JSON.stringify(A.body),signal:A.signal})}async#X(A){let D=ER(A.path),_=new URL(D,this.#_);return this.#D.patch(_,{headers:{"Content-Type":"application/json",...this.getDefaultHeaders(),...A.headers},body:JSON.stringify(A.body),signal:A.signal})}async#Y(A){let D=ER(A.path),_=new URL(D,this.#_);return this.#D.put(_,{headers:{"Content-Type":"application/json",...this.getDefaultHeaders(),...A.headers},body:JSON.stringify(A.body),signal:A.signal})}async#G(A){let D=ER(A.path),_=new URL(D,this.#_);return ME1(_,A.searchParams??{}),this.#D.head(_,{headers:{...this.getDefaultHeaders(),...A.headers},signal:A.signal})}}var Ao=C0(OA(),1);var NE1=Ao.createInterfaceId("ProjectService");class Bg{#A;#D;constructor(A,D){this.#A=D,this.#D=SA(A,"[ProjectService]")}async getProjectFromPathWithNamespace(A){return this.#D.debug(`Fetching details for project: ${A}`),this.#A.fetchFromApi({type:"rest",method:"GET",path:`/api/v4/projects/${encodeURIComponent(A)}`})}async getProjectIdsFromPaths(A){return(await this.#A.fetchFromApi({type:"graphql",query:fJ`
1165
+ `,"")).trim()}function LvA(A){return w10(A).match(/^(query|mutation|subscription)\s+/)?.[1]}function PvA(A){return w10(A).match(/(?:query|mutation|subscription)\s+(\w+)/)?.[1]}function da(A){let D=LvA(A),_=PvA(A);if(D)return`${D}: ${_??"anonymous"}`;return}var RvA=(A)=>{if(A.method==="GET"||A.method==="HEAD")return;if(!A.body)return;return a9("Body",JSON.stringify(A.body))},TvA=(A)=>{if(A.method==="POST"||A.method==="PATCH"||A.method==="PUT")return;if(!A.searchParams)return;return a9("Search Params",JSON.stringify(A.searchParams))},vvA=(A)=>{if(!A.headers)return;return a9("Headers",JSON.stringify(A.headers))},Yx=(A)=>{switch(A.type){case"graphql":return jB("GraphQL Request",a9("Query",A.query.replace(/[\s\n]+/g," ").trim()),a9("Variables",JSON.stringify(A.variables)));case"rest":return jB("REST Request",a9("Method",A.method),a9("Path",A.path),vvA(A),TvA(A),RvA(A));default:return a9("Unknown request type",A.type)}};var H10=(A)=>{try{return JSON.parse(A)?.error}catch{return}},yvA=(A)=>{if(!A)return"";try{return JSON.parse(A)?.error_description??""}catch{return""}},v_1=(A,D)=>Boolean(A.status===401&&D&&H10(D)==="invalid_token"),y_1=(A,D)=>Boolean(A.status===400&&D&&H10(D)==="invalid_grant");class la extends Error{request;cause;constructor(A,D,_){super(A);this.request=D,this.cause=_?.cause}get sanitizedMessage(){return"API request failed"}}class S_1 extends la{status;constructor(A,D,_,Q){super(A,D,Q);this.status=_}}class V10 extends S_1{type="rest";response;#A;constructor(A,D,_,Q){let B=`Fetching ${_} from ${D.url} failed. ${yvA(Q)}`;if(v_1(D,Q))B=`Request for ${_} failed because the token is expired or revoked.`;if(y_1(D,Q))B="Request to refresh token failed, because it's revoked or already refreshed.";super(B,A,D.status);this.response=D,this.#A=Q}isInvalidTokenOrInvalidRefresh(){return v_1(this.response,this.#A)||y_1(this.response,this.#A)}get ctx(){return jB("Error details",Yx(this.request),this.#D())}get sanitizedMessage(){if(v_1(this.response,this.#A))return"Request failed because the token is expired or revoked.";if(y_1(this.response,this.#A))return"Request to refresh token failed, because it's revoked or already refreshed.";return`Request failed with error code: ${this.response.status}`}#D(){let A=Object.fromEntries(this.response.headers.entries());return jB("Response",a9("Status",String(this.status)),!I10.default.isEmpty(A)?a9("Headers",JSON.stringify(A)):void 0,this.#A?a9("Response body",this.#A):void 0)}get body(){return this.#A}}var C10=(A)=>A.errors?.map((D)=>D.message).join(",")||"";class j_1 extends S_1{type="graphql";graphQlResponse;#A;constructor(A,D){let _=da(A.query),Q=`GraphQL request "${_}" failed with ${C10(D)}`;super(Q,A,D.status);this.graphQlResponse=D,this.#A=_}get sanitizedMessage(){return`GraphQL request "${this.#A}" failed with status ${this.graphQlResponse.status}`}get ctx(){return jB("Error details",Yx(this.request),this.#D())}#D(){return jB("Response",a9("Status",String(this.graphQlResponse.status)),a9("Errors",C10(this.graphQlResponse)))}}class ia extends la{type="network";cause;constructor(A,D){let _=D instanceof Error?D.message:`Network error occurred: ${D}`;super(_,A);this.cause=D}get ctx(){return jB("Error details",Yx(this.request),this.#A())}get sanitizedMessage(){let A=this.cause,D=A?.code||A?.errno,_=this.#D(D);return`Network error occurred${_?`: ${_}`:""}`}#A(){if(!this.cause||!(this.cause instanceof Error))return;let A=this.cause;if(A.code||A.errno){let D=A.code||A.errno,_=this.#D(D),Q=_?`${_} (${D})`:`Error code: ${D}`;return a9("Network issue",Q)}return}#D(A){return{ENOTFOUND:"DNS lookup failed - hostname could not be resolved",ECONNREFUSED:"Connection refused - server is not accepting connections",ECONNRESET:"Connection reset by peer - server closed the connection unexpectedly",ETIMEDOUT:"Connection timed out - server did not respond in time",EHOSTUNREACH:"Host unreachable - network route to server not available",ENETUNREACH:"Network unreachable - no network connectivity",ECONNABORTED:"Connection aborted - request was cancelled",EBADF:"Bad file descriptor - network connection issue",EPIPE:"Broken pipe - connection closed while writing data",EAI_AGAIN:"DNS lookup failed temporarily - try again later"}[A]}}class SvA extends la{type="timeout";#A;constructor(A,D){let _=`Request timed out${D?` after ${D}ms`:""}`;super(_,A);this.#A=_}get ctx(){return jB("Error details",Yx(this.request))}get sanitizedMessage(){return this.#A}}var q10=V10;var b_1={type:"rest",method:"GET",path:"/api/v4/version"};var aa=JSON;var W10=(A)=>A.toUpperCase(),M10=(A)=>{let D={};return A.forEach((_,Q)=>{D[Q]=_}),D};var O10=(A,D,_)=>{return A.document?A:{document:A,variables:D,requestHeaders:_,signal:void 0}},N10=(A,D,_)=>{return A.query?A:{query:A,variables:D,requestHeaders:_,signal:void 0}},L10=(A,D)=>{return A.documents?A:{documents:A,requestHeaders:D,signal:void 0}};var ln=C0(H90(),1),V90=(A)=>{let D=void 0,_=A.definitions.filter((Q)=>Q.kind==="OperationDefinition");if(_.length===1)D=_[0]?.name?.value;return D},lq=(A)=>{if(typeof A==="string"){let _=void 0;try{let Q=ln.parse(A);_=V90(Q)}catch(Q){}return{query:A,operationName:_}}let D=V90(A);return{query:ln.print(A),operationName:D}};class Kz extends Error{constructor(A,D){let _=`${Kz.extractMessage(A)}: ${JSON.stringify({response:A,request:D})}`;super(_);if(Object.setPrototypeOf(this,Kz.prototype),this.response=A,this.request=D,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,Kz)}static extractMessage(A){return A.errors?.[0]?.message??`GraphQL Error (Code: ${A.status})`}}var jC=C0(G50(),1);var YiA="connection_init",FiA="connection_ack",F50="ping",$50="pong",$iA="subscribe",KiA="next",ZiA="error",K50="complete";class SC{get type(){return this._type}get id(){return this._id}get payload(){return this._payload}constructor(A,D,_){this._type=A,this._payload=D,this._id=_}get text(){let A={type:this.type};if(this.id!=null&&this.id!=null)A.id=this.id;if(this.payload!=null&&this.payload!=null)A.payload=this.payload;return JSON.stringify(A)}static parse(A,D){let{type:_,payload:Q,id:B}=JSON.parse(A);return new SC(_,D(Q),B)}}class HE1{constructor(A,{onInit:D,onAcknowledged:_,onPing:Q,onPong:B}){this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=A,A.addEventListener("open",async(E)=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={},A.send(wiA(D?await D():null).text)}),A.addEventListener("close",(E)=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={}}),A.addEventListener("error",(E)=>{console.error(E)}),A.addEventListener("message",(E)=>{try{let z=UiA(E.data);switch(z.type){case FiA:{if(this.socketState.acknowledged)console.warn("Duplicate CONNECTION_ACK message ignored");else if(this.socketState.acknowledged=!0,_)_(z.payload);return}case F50:{if(Q)Q(z.payload).then((Y)=>A.send(Y50(Y).text));else A.send(Y50(null).text);return}case $50:{if(B)B(z.payload);return}}if(!this.socketState.acknowledged)return;if(z.id===void 0||z.id===null||!this.socketState.subscriptions[z.id])return;let{query:J,variables:X,subscriber:G}=this.socketState.subscriptions[z.id];switch(z.type){case KiA:{if(!z.payload.errors&&z.payload.data)G.next&&G.next(z.payload.data);if(z.payload.errors)G.error&&G.error(new Kz({...z.payload,status:200},{query:J,variables:X}));return}case ZiA:{G.error&&G.error(new Kz({errors:z.payload,status:200},{query:J,variables:X}));return}case K50:{G.complete&&G.complete(),delete this.socketState.subscriptions[z.id];return}}}catch(z){console.error(z),A.close(1006)}A.close(4400,"Unknown graphql-ws message.")})}makeSubscribe(A,D,_,Q){let B=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[B]={query:A,variables:Q,subscriber:_},this.socket.send(IiA(B,{query:A,operationName:D,variables:Q}).text),()=>{this.socket.send(HiA(B).text),delete this.socketState.subscriptions[B]}}rawRequest(A,D){return new Promise((_,Q)=>{let B;this.rawSubscribe(A,{next:(E,z)=>B={data:E,extensions:z},error:Q,complete:()=>_(B)},D)})}request(A,D){return new Promise((_,Q)=>{let B;this.subscribe(A,{next:(E)=>B=E,error:Q,complete:()=>_(B)},D)})}subscribe(A,D,_){let{query:Q,operationName:B}=lq(A);return this.makeSubscribe(Q,B,D,_)}rawSubscribe(A,D,_){return this.makeSubscribe(A,void 0,D,_)}ping(A){this.socket.send(CiA(A).text)}close(){this.socket.close(1000)}}HE1.PROTOCOL="graphql-transport-ws";function UiA(A,D=(_)=>_){return SC.parse(A,D)}function wiA(A){return new SC(YiA,A)}function CiA(A){return new SC(F50,A,void 0)}function Y50(A){return new SC($50,A,void 0)}function IiA(A,D){return new SC($iA,D,A)}function HiA(A){return new SC(K50,void 0,A)}var BR=(A)=>{let D={};if(A)if(typeof Headers!=="undefined"&&A instanceof Headers||jC&&jC.Headers&&A instanceof jC.Headers)D=M10(A);else if(Array.isArray(A))A.forEach(([_,Q])=>{if(_&&Q!==void 0)D[_]=Q});else D=A;return D},Z50=(A)=>A.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),ViA=(A)=>{if(!Array.isArray(A.query)){let Q=A,B=[`query=${encodeURIComponent(Z50(Q.query))}`];if(A.variables)B.push(`variables=${encodeURIComponent(Q.jsonSerializer.stringify(Q.variables))}`);if(Q.operationName)B.push(`operationName=${encodeURIComponent(Q.operationName)}`);return B.join("&")}if(typeof A.variables!=="undefined"&&!Array.isArray(A.variables))throw new Error("Cannot create query with given variable type, array expected");let D=A,_=A.query.reduce((Q,B,E)=>{return Q.push({query:Z50(B),variables:D.variables?D.jsonSerializer.stringify(D.variables[E]):void 0}),Q},[]);return`query=${encodeURIComponent(D.jsonSerializer.stringify(_))}`},qiA=(A)=>async(D)=>{let{url:_,query:Q,variables:B,operationName:E,fetch:z,fetchOptions:J,middleware:X}=D,G={...D.headers},Y="",$=void 0;if(A==="POST"){if($=WiA(Q,B,E,J.jsonSerializer),typeof $==="string")G["Content-Type"]="application/json"}else Y=ViA({query:Q,variables:B,operationName:E,jsonSerializer:J.jsonSerializer??aa});let K={method:A,headers:G,body:$,...J},F=_,Z=K;if(X){let U=await Promise.resolve(X({...K,url:_,operationName:E,variables:B})),{url:C,...V}=U;F=C,Z=V}if(Y)F=`${F}?${Y}`;return await z(F,Z)};class WE1{constructor(A,D={}){this.url=A,this.requestConfig=D,this.rawRequest=async(..._)=>{let[Q,B,E]=_,z=N10(Q,B,E),{headers:J,fetch:X=jC.default,method:G="POST",requestMiddleware:Y,responseMiddleware:$,...K}=this.requestConfig,{url:F}=this;if(z.signal!==void 0)K.signal=z.signal;let{operationName:Z}=lq(z.query);return VE1({url:F,query:z.query,variables:z.variables,headers:{...BR(qE1(J)),...BR(z.requestHeaders)},operationName:Z,fetch:X,method:G,fetchOptions:K,middleware:Y}).then((U)=>{if($)$(U);return U}).catch((U)=>{if($)$(U);throw U})}}async request(A,...D){let[_,Q]=D,B=O10(A,_,Q),{headers:E,fetch:z=jC.default,method:J="POST",requestMiddleware:X,responseMiddleware:G,...Y}=this.requestConfig,{url:$}=this;if(B.signal!==void 0)Y.signal=B.signal;let{query:K,operationName:F}=lq(B.document);return VE1({url:$,query:K,variables:B.variables,headers:{...BR(qE1(E)),...BR(B.requestHeaders)},operationName:F,fetch:z,method:J,fetchOptions:Y,middleware:X}).then((Z)=>{if(G)G(Z);return Z.data}).catch((Z)=>{if(G)G(Z);throw Z})}batchRequests(A,D){let _=L10(A,D),{headers:Q,...B}=this.requestConfig;if(_.signal!==void 0)B.signal=_.signal;let E=_.documents.map(({document:J})=>lq(J).query),z=_.documents.map(({variables:J})=>J);return VE1({url:this.url,query:E,variables:z,headers:{...BR(qE1(Q)),...BR(_.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??jC.default,method:this.requestConfig.method||"POST",fetchOptions:B,middleware:this.requestConfig.requestMiddleware}).then((J)=>{if(this.requestConfig.responseMiddleware)this.requestConfig.responseMiddleware(J);return J.data}).catch((J)=>{if(this.requestConfig.responseMiddleware)this.requestConfig.responseMiddleware(J);throw J})}setHeaders(A){return this.requestConfig.headers=A,this}setHeader(A,D){let{headers:_}=this.requestConfig;if(_)_[A]=D;else this.requestConfig.headers={[A]:D};return this}setEndpoint(A){return this.url=A,this}}var VE1=async(A)=>{let{query:D,variables:_,fetchOptions:Q}=A,B=qiA(W10(A.method??"post")),E=Array.isArray(A.query),z=await B(A),J=await MiA(z,Q.jsonSerializer??aa),X=Array.isArray(J)?!J.some(({data:Y})=>!Y):Boolean(J.data),G=Array.isArray(J)||!J.errors||Array.isArray(J.errors)&&!J.errors.length||Q.errorPolicy==="all"||Q.errorPolicy==="ignore";if(z.ok&&G&&X){let{errors:Y,...$}=Array.isArray(J)?J:J,K=Q.errorPolicy==="ignore"?$:J;return{...E?{data:K}:K,headers:z.headers,status:z.status}}else throw new Kz({...typeof J==="string"?{error:J}:J,status:z.status,headers:z.headers},{query:D,variables:_})};var WiA=(A,D,_,Q)=>{let B=Q??aa;if(!Array.isArray(A))return B.stringify({query:A,variables:D,operationName:_});if(typeof D!=="undefined"&&!Array.isArray(D))throw new Error("Cannot create request body with given variable type, array expected");let E=A.reduce((z,J,X)=>{return z.push({query:J,variables:D?D[X]:void 0}),z},[]);return B.stringify(E)},MiA=async(A,D)=>{let _;if(A.headers.forEach((Q,B)=>{if(B.toLowerCase()==="content-type")_=Q}),_&&(_.toLowerCase().startsWith("application/json")||_.toLowerCase().startsWith("application/graphql+json")||_.toLowerCase().startsWith("application/graphql-response+json")))return D.parse(await A.text());else return A.text()},qE1=(A)=>{return typeof A==="function"?A():A},fJ=(A,...D)=>{return A.reduce((_,Q,B)=>`${_}${Q}${B in D?String(D[B]):""}`,"")};var U50=async(A,D,_)=>{if(!D.ok){let Q=await D.text().catch(()=>{return});throw new q10(A,D,_,Q)}};function mQ(){return"8.29.1"}var w50=(A)=>{let D=A?`${A?.name}:${A?.version}`:"missing client info";return`gitlab-language-server:${mQ()} (${D})`};function C50(A){return A!==null&&A!==void 0}var ME1=(A,D)=>{return Object.entries(D).forEach(([_,Q])=>{if(C50(Q))A.searchParams.append(_,String(Q))}),A},en=(A)=>A.toString().replace(/\/?$/,"/"),ER=(A)=>A.replace(/^\.?\/?/,"./"),I50=(A)=>{if(A.startsWith("git@")){let D=A.match(/git@([^:]+):(.+)/);if(D){let[,_,Q]=D;return`https://${_}/${Q}`}}if(A.startsWith("git://"))return A.replace("git://","https://");if(A.startsWith("ssh://"))return A.replace("ssh://","https://").replace(/git@([^/]+)/,"$1");return A};var OiA=(A)=>A.split("/").pop()||"unknown resource";class OE1{#A;#D;#_;#Q;#B;constructor(A,D,_,Q,B){this.#A=A,this.#D=D,this.#_=new URL(en(Q)),this.#Q=B,this.#B=_}getDefaultHeaders(){return{Authorization:`Bearer ${this.#Q}`,"User-Agent":w50(this.#B),"X-Gitlab-Language-Server-Version":mQ()}}async fetchFromApiRaw(A){try{let D=`Unknown request method "${A.method}", request type "${A.type}"`;switch(A.method){case"GET":return await this.#z(A);case"POST":return await this.#J(A);case"PATCH":return await this.#X(A);case"PUT":return await this.#Y(A);case"HEAD":return await this.#G(A);default:throw new Error(D)}}catch(D){throw new ia(A,D)}}async fetchFromApi(A){if(A.type==="graphql")return this.#E(A);let D=await this.fetchFromApiRaw(A);return await U50(A,D,OiA(A.path)),D.json()}fetchOperation=(A)=>(D)=>this.fetchFromApi({...A,signal:D});async#E(A){let D=new URL("./api/graphql",this.#_),_=da(A.query);if(_)this.#A.debug(`[SimpleApiClient] Making GraphQL request: ${_}`);let Q=async(E,z)=>{let J=E instanceof URL?E.toString():E;return this.#D.post(J,{...z,headers:{...z?.headers},signal:A.signal})},B=new WE1(D.href,{fetch:Q,headers:{...this.getDefaultHeaders()}});try{return await B.request(A.query,A.variables)}catch(E){if(E instanceof Kz)throw new j_1(A,E.response);throw new ia(A,E)}}async#z(A){let D=ER(A.path),_=new URL(D,this.#_);return ME1(_,A.searchParams??{}),this.#D.get(_,{headers:{...this.getDefaultHeaders(),...A.headers},signal:A.signal})}async#J(A){let D=ER(A.path),_=new URL(D,this.#_);return this.#D.post(_,{headers:{"Content-Type":"application/json",...this.getDefaultHeaders(),...A.headers},body:JSON.stringify(A.body),signal:A.signal})}async#X(A){let D=ER(A.path),_=new URL(D,this.#_);return this.#D.patch(_,{headers:{"Content-Type":"application/json",...this.getDefaultHeaders(),...A.headers},body:JSON.stringify(A.body),signal:A.signal})}async#Y(A){let D=ER(A.path),_=new URL(D,this.#_);return this.#D.put(_,{headers:{"Content-Type":"application/json",...this.getDefaultHeaders(),...A.headers},body:JSON.stringify(A.body),signal:A.signal})}async#G(A){let D=ER(A.path),_=new URL(D,this.#_);return ME1(_,A.searchParams??{}),this.#D.head(_,{headers:{...this.getDefaultHeaders(),...A.headers},signal:A.signal})}}var Ao=C0(OA(),1);var NE1=Ao.createInterfaceId("ProjectService");class Bg{#A;#D;constructor(A,D){this.#A=D,this.#D=SA(A,"[ProjectService]")}async getProjectFromPathWithNamespace(A){return this.#D.debug(`Fetching details for project: ${A}`),this.#A.fetchFromApi({type:"rest",method:"GET",path:`/api/v4/projects/${encodeURIComponent(A)}`})}async getProjectIdsFromPaths(A){return(await this.#A.fetchFromApi({type:"graphql",query:fJ`
1166
1166
  query getProjectIds($fullPaths: [String!]!) {
1167
1167
  projects(fullPaths: $fullPaths) {
1168
1168
  nodes {
@@ -1794,5 +1794,5 @@ Use this for any git operations like status, log, diff, branch operations, etc.
1794
1794
  <current_time>${_}</current_time>
1795
1795
  <user_timezone>${Q}</user_timezone>`}}Kd=l0([E3A.Injectable(JO,[ZA])],Kd);function z3A(A){A.addClass(Kd)}function J3A(A){}function X3A(A){if(L81()==="anthropic")z3A(A);else J3A(A)}async function P81(A,D){let _=new yY.ServiceCollection;if(_.add(yY.createInstanceDescriptor({instance:D,aliases:[RX]})),A?.logDestination==="stdout")_.addClass(Lc);else _.addClass(yO);_.addClass(Nc,RK,Rf,qc),_.add(yY.createFactoryDescriptor({aliases:[Up],factory:(E)=>new N41(E,E.getRequiredService(ZA)),lifetime:yY.ServiceLifetime.Singleton})),_.addClass(Tf,Ky,Zy,wy,lS,$h),_.addClass(Jc),_.addClass(Pc,pS),Sq1(_),_.addClass(Hc,iS,BS,ES,Iy,Fy,hS,YS,FS,JS,Vc,$S,KS,dS,zS,GS,ZS,XS),_.add(yY.createInstanceDescriptor({instance:{getDiagnostics:async()=>[]},aliases:[Hp]})),_.add(yY.createInstanceDescriptor({instance:{isClientFlagEnabled:()=>!1,isInstanceFlagEnabled:()=>!1,updateInstanceFeatureFlags:async()=>{}},aliases:[tq]})),_.addClass(Bg),_.addClass(uf),_.add(yY.createInstanceDescriptor({instance:{isChatFeatureEnabled:()=>Promise.resolve(!0),isSuggestionsFeatureEnabled:()=>Promise.resolve(!0)},aliases:[L41]})),_.addClass(wp,Xc),_.addClass(Fd),_.addClass(Wc),_.addClass(Oc),_.addClass(Yd,Gd),X3A(_);let Q=_.build();return await Q.getRequiredService(tC).initialize(),global.__logger=Q.getRequiredService(ZA),Q}class lR1{#A;#D;constructor(){this.#A={...T_1}}initialize(A){this.#D=A}getState(){return this.#A}setState(A){if(this.#A=A,!this.#D)throw new Error("AppStore is not initialized");this.#D(this.#A)}}class iR1{onSubmit=()=>{};onStateChange=()=>{};clear=()=>{};handleKeyPress=(A,D)=>{}}class aR1{onSubmit=()=>{};onStateChange=()=>{};#A=[];#D=0;setChoice(A){this.#A=A,this.#D=0,this.#_()}handleKeyPress=(A,D)=>{if(D.return){this.onSubmit(this.#A[this.#D]?.value);return}if(D.upArrow)this.#D=Math.max(0,this.#D-1);if(D.downArrow)this.#D=Math.min(this.#A.length-1,this.#D+1);this.#_()};#_(){this.onStateChange({inputType:Pq.CHOICE,choiceOptions:this.#A,selectedChoiceIndex:this.#D})}}class nR1{#A;#D;#_=new lR1;#Q;#B;#E;#z=new Map;#J=new iR1;#X=new aR1;#Y;#G;constructor(A,D){this.#A=A,this.#B=D,this.#J.onSubmit=(_)=>this.#H({type:"SEND_PROMPT",prompt:_}),this.#X.onSubmit=(_)=>this.#U(_),this.#J.onStateChange=(_)=>this.#_.setState({...this.#_.getState(),input:_}),this.#X.onStateChange=(_)=>this.#_.setState({...this.#_.getState(),input:_})}async initialize(){this.#_.initialize((A)=>this.#A(A)),this.#K(),this.#G=this.#F()}async#F(){let A=await P81({logDestination:"file"},this.#B),D=A.getRequiredService($d);this.#D=D.backend,this.#Q=A.getRequiredService(ZA),await this.#D.initialize(),await this.#Z()}getCallbacks(){return{onKeyPress:(A,D)=>{if(D.escape&&this.#_.getState().isLoading&&this.#Y){this.#Q?.info("Cancelling stream due to ESC key press"),this.#Y.abort();return}if(this.#_.getState().input.inputType===Pq.TEXT)this.#J.handleKeyPress(A,D);else this.#X.handleKeyPress(A,D)},onSubmit:(A)=>{this.#J.onSubmit(A)},onExit:()=>this.#w(),toggleExpanded:()=>{let A=this.#_.getState();this.#_.setState({...A,expanded:!A.expanded})}}}#K(){let A={type:"message",id:"welcome",role:"assistant",content:"Hi!"};this.#_.setState({elements:[A],isLoading:!1,input:kP,expanded:!1})}async#Z(){if(!this.#D)throw new Error("Backend not initialized");let A=await this.#D.getWelcomeMessage(),D=this.#_.getState();this.#_.setState({...D,elements:D.elements.map((_)=>{return _.id==="welcome"?{..._,content:A}:_}),isLoading:!1})}async#U(A){let D=this.#_.getState();if(D.isLoading)return;this.#_.setState({...D,input:kP}),await this.#V(A)}async#H(A){if(this.#_.getState().isLoading||!A.prompt.trim())return;this.#J.clear();let _={id:Date.now().toString(),type:"message",role:"user",content:A.prompt};this.#$(_),await this.#V(A)}async#V(A){if(this.#_.setState({...this.#_.getState(),input:kP,isLoading:!0}),await this.#G,!this.#D)throw new Error("Backend not initialized");this.#Y=new AbortController;try{let D;for await(let _ of this.#D.sendMessageStream(A,this.#Y.signal))D=_,this.#I(_);if(D?.type==="TOOL_AWAITING_APPROVAL"){let _={type:"SEND_TOOL_APPROVAL",scope:"session",toolId:D.toolId,toolName:D.toolName};this.#X.setChoice([{label:"Approve",value:{..._,approved:!0}},{label:"Reject",value:{..._,approved:!1}}])}}catch(D){this.#Q?.error("Error in message streaming",D),this.#I({type:"ERROR",message:"Sorry, there was an error processing your message. Please try again."})}finally{this.#E=void 0,this.#z.clear(),this.#Y=void 0,this.#_.setState({...this.#_.getState(),isLoading:!1})}}#$(A){let D=this.#_.getState();this.#_.setState({...D,elements:[...D.elements,A]})}#I(A){if(!this.#_)throw new Error("Store not initialized");let D=this.#_.getState();switch(A.type){case"TEXT_CHUNK":{if(!this.#E||this.#E.id!==A.messageId)this.#E={id:A.messageId,type:"message",role:"assistant",content:A.content},this.#$(this.#E);else{this.#E.content+=A.content;let _=D.elements.map((Q)=>Q.type==="message"&&Q.id===A.messageId&&this.#E?this.#E:Q);this.#_.setState({...D,elements:_})}break}case"TOOL_START":{let _={id:A.toolId,type:"tool",name:A.name,input:A.input,state:{type:"loading"}};this.#z.set(A.toolId,_),this.#C(_);break}case"TOOL_AWAITING_APPROVAL":{let _={id:A.toolId,type:"tool",name:A.toolName,input:A.input,state:{type:"approval_request",content:""}};this.#z.set(A.toolId,_),this.#C(_);break}case"TOOL_COMPLETE":{let _=this.#z.get(A.toolId);if(_){let Q={..._,state:A.error?{type:"error",error:A.error}:{type:"success",output:A.result}};this.#C(Q),this.#z.delete(A.toolId)}break}case"ERROR":{this.#Q?.error("Agent error:",A.message);let _={id:`error-${Date.now()}`,type:"error",error:`${A.message}`};this.#$(_);break}default:this.#Q?.warn("Unknown agent event type:",A);break}}#C(A){let D=this.#_.getState(),_=D.elements.findIndex((B)=>B.type==="tool"&&B.id===A.id);if(_<0){this.#$(A);return}let Q=[...D.elements];Q[_]=A,this.#_.setState({...D,elements:Q})}#w(){process.exit(0)}}var ZG4=({runConfig:A,children:D})=>{if(A.environment==="development")return _A(uO.StrictMode,{children:D});return _A(rw,{children:D})},UG4=({runConfig:A})=>{let[D,_]=uO.useState(void 0),[Q]=uO.useState(()=>new nR1(_,A));if(uO.useEffect(()=>{Ug(Q.initialize())},[Q]),!D)return _A(S0,{children:"Initializing..."});return _A(R_1,{state:D,callbacks:Q.getCallbacks()})},G3A=(A)=>{process.stdout.write("\x1B[?2004h");let{waitUntilExit:D}=cb(_A(ZG4,{runConfig:A,children:_A(UG4,{runConfig:A})}),{exitOnCtrlC:!1});D().then(()=>{process.exit(0)}).catch((_)=>{console.error(_),process.exit(1)}),process.on("exit",()=>{process.stdout.write("\x1B[?2004l")})};class oR1{#A;#D;#_;#Q=null;constructor(A){this.#_=A}async initialize(){let A=await P81({logDestination:"stdout"},this.#_),D=A.getRequiredService($d);this.#A=D.backend,this.#D=A.getRequiredService(ZA),await this.#A.initialize()}async execute(){if(!this.#A||this.#_.command?.name!=="run")throw new Error("Controller not initialized. Call initialize() first.");let{goal:A}=this.#_.command;this.#D?.info(`Executing workflow: ${JSON.stringify({goal:A},null,4)}`);let D={id:Date.now().toString(),type:"message",role:"user",content:A};try{let _;for await(let Q of this.#A.sendMessageStream({type:"SEND_PROMPT",prompt:D.content}))this.#B(Q),_=Q;if(this.#Q)this.#D?.info(JSON.stringify(this.#Q,null,2));process.exit(_?.type==="ERROR"?1:0)}catch(_){throw this.#D?.error("Workflow failed:",_ instanceof Error?_.message:String(_)),_}}#B(A){switch(A.type){case"TEXT_CHUNK":{if(!this.#Q||this.#Q.id!==A.messageId){if(this.#Q)this.#D?.info(JSON.stringify(this.#Q,null,4));this.#Q={id:A.messageId,type:"message",role:"assistant",content:A.content}}else this.#Q.content+=A.content;break}case"TOOL_START":{this.#D?.info(`Tool started: ${A.name}`);break}case"TOOL_COMPLETE":{if(this.#D?.info(`Tool completed: ${A.toolId}`),A.error)this.#D?.error(`Tool error: ${A.error}`);break}case"TOOL_AWAITING_APPROVAL":break;case"ERROR":{this.#D?.error(`Error: ${A.message}`);break}default:{let D=A;this.#D?.warn(`Unexpected event received: ${JSON.stringify(D)}`);break}}}}var rR1=()=>{return"production"};import{statSync as wG4}from"node:fs";import{isAbsolute as CG4,normalize as IG4,resolve as HG4}from"node:path";function Y3A(A,D=process.cwd()){let _;if(CG4(A))_=IG4(A);else _=HG4(D,A);return VG4(_),_}function VG4(A){try{if(!wG4(A).isDirectory())throw new yw(`Path "${A}" exists but is not a directory`)}catch(D){if(D instanceof Error&&D.code==="ENOENT")throw new yw(`Directory "${A}" does not exist`);throw D}}function F3A(A){try{let D=JSON.parse(A);return qN1.array().parse(D).map((_)=>({..._,metadata:_.metadata||{}}))}catch(D){if(D instanceof SyntaxError)throw new yw(`Invalid JSON format: ${D.message}`);throw new yw(`AI Context Item schema error: ${D}`)}}var R3A=C0(L3A(),1),S81=C0(OA(),1);import{join as tG4,dirname as eG4}from"path";import{mkdirSync as AY4,existsSync as y81,writeFileSync as DY4,accessSync as P3A,constants as QT1,promises as wd}from"fs";import{homedir as _Y4}from"node:os";var j81=S81.createInterfaceId("PersistentStorage");class Kj{#A;#D;#_;constructor(A,D){this.#D=SA(A,"[PersistentStorage]");try{if(D)this.#A=D;else{let _=process.env.GITLAB_LSP_STORAGE_DIR||_Y4();this.#A=tG4(_,".gitlab","storage.json")}this.#D.info(`Initializing storage at: ${this.#A}`),this.#Q()}catch(_){this.#D.error("Failed to construct PersistentStorage:",_),this.#_={status:"failed",error:_}}}#Q(){try{let A=eG4(this.#A);if(this.#D.debug(`Creating directory: ${A}`),!y81(A))AY4(A,{recursive:!0}),this.#D.debug(`Directory created: ${A}`);try{P3A(A,QT1.W_OK)}catch(D){let _=new Error(`Cannot write to directory: ${A}`);throw this.#D.error("Directory write permission error:",D),_}if(!y81(this.#A))this.#D.debug("Creating initial storage file"),DY4(this.#A,JSON.stringify({}),"utf8");else try{P3A(this.#A,QT1.R_OK|QT1.W_OK),this.#D.debug("Storage file is accessible")}catch(D){let _=new Error(`Cannot access storage file: ${this.#A}`);throw this.#D.error("Storage access error:",D),_}this.#_={status:"initialized"},this.#D.info("Persistent storage initialized successfully")}catch(A){this.#_={status:"failed",error:A},this.#D.error("Failed to initialize persistent storage",A)}}isInitialized(){return this.#_?.status==="initialized"}async#B(){try{let A=await wd.readFile(this.#A,"utf8");return JSON.parse(A)}catch(A){this.#D.error("Failed to read storage file, recreating with empty data",A);try{if(y81(this.#A))await wd.unlink(this.#A),this.#D.info("Corrupted storage file removed");let D={};return await wd.writeFile(this.#A,JSON.stringify(D,null,2),"utf8"),this.#D.info("Storage file recreated with empty data"),D}catch(D){return this.#D.error("Failed to recreate storage file",D),{}}}}async#E(A){try{await wd.writeFile(this.#A,JSON.stringify(A,null,2),"utf8")}catch(D){throw this.#D.error("Failed to write storage file",D),D}}async#z(A){let D=null;try{if(!y81(this.#A))this.#D.debug("Storage file does not exist, creating it before locking"),await wd.writeFile(this.#A,JSON.stringify({}),"utf8");return D=await R3A.lock(this.#A,{retries:{retries:5,minTimeout:100,maxTimeout:1000},stale:5000}),await A()}catch(_){throw this.#D.error("Lock operation failed",_),_}finally{if(D)try{await D()}catch(_){this.#D.error("Failed to release lock",_)}}}async get(A){try{if(!this.isInitialized())throw this.#D.error(`Storage is not initialized: ${this.#_?.status==="failed"&&this.#_.error.message||"unknown error"}`),new Error("Storage is not initialized");this.#D.debug(`Getting value for key: ${A}`);let _=(await this.#B())[A];if(_===void 0){this.#D.debug(`No value found for key: ${A}`);return}return _}catch(D){throw this.#D.error(`Storage get error for key: ${A}`,D),D}}async set(A,D){if(!this.isInitialized())throw new Error("Storage is not initialized");this.#D.debug(`Setting value for key: ${A}`),await this.#z(async()=>{let _=await this.#B();_[A]=D,await this.#E(_),this.#D.debug(`Successfully set value for key: ${A}`)})}async delete(A){if(!this.isInitialized())throw new Error("Storage is not initialized");this.#D.debug(`Deleting value for key: ${A}`),await this.#z(async()=>{let D=await this.#B();if(D[A]!==void 0)delete D[A],await this.#E(D),this.#D.debug(`Successfully deleted value for key: ${A}`);else this.#D.debug(`Key not found for deletion: ${A}`)})}close(){this.#D.info("Storage closed"),this.#_={status:"closed"}}}Kj=l0([S81.Injectable(j81,[ZA])],Kj);var k81=C0(OA(),1);var T3A="selectedProjectInRepository",QY4=d.object({accountId:d.string(),namespaceWithPath:d.string(),remoteName:d.string(),remoteUrl:d.string(),repositoryRootPath:d.string()}),BT1={telemetry:d.object({enabled:d.boolean()})},ET1={telemetry:d.object({enabled:d.boolean()}),[T3A]:d.array(QY4)};var v3A=k81.createInterfaceId("UserPersistentStorage"),zT1="__global__";class b81{#A;#D;#_;#Q;constructor(A,D,_,Q){this.#A=A,this.#D=D,this.#_=_,this.#Q=SA(Q,"[UserPersistentStorage]")}#B(A,D,_){let Q=_.safeParse(D);if(Q.success)return Q.data;this.#Q.warn(`Validation failed for key: ${A} - error: ${JSON.stringify(Q.error.format())}, value: ${JSON.stringify(D)}`);return}#E(A,D,_){return`${A}:${D}:${_}`}async#z(A,D,_){try{let Q=this.#G;if(!Q){this.#Q.warn("No user ID available");return}let B=this.#E(Q,A,D);this.#Q.debug(`Getting value for key: ${D} - userId: ${Q}, client: ${A}`);let E=await this.#A.get(B);if(E===void 0){this.#Q.debug(`No value found for key: ${D}`);return}let z=this.#B(D,E,_);if(z===void 0)this.#Q.warn(`Stored value failed validation for key: ${D}`);return z}catch(Q){this.#Q.error(`Storage get error for key: ${D}`,Q);return}}async#J(A,D,_,Q){let B=this.#G;if(!B){this.#Q.warn("No user ID available, cannot set value");return}let E;try{E=Q.parse(_)}catch(J){throw this.#Q.error(`Validation failed for key: ${D}`,J),new Error(`Invalid value for key ${D}: ${J}`)}let z=this.#E(B,A,D);this.#Q.debug(`Setting value for key: ${D} - userId: ${B}, client: ${A}`),await this.#A.set(z,E),this.#Q.debug(`Successfully set value for key: ${D}`)}async#X(A,D){let _=this.#G;if(!_){this.#Q.warn("No user ID available, cannot delete value");return}let Q=this.#E(_,A,D);this.#Q.debug(`Deleting value for key: ${D} - userId: ${_}, client: ${A}`),await this.#A.delete(Q),this.#Q.debug(`Successfully deleted value for key: ${D}`)}async get(A){let D=this.#Y;if(!D)return;return await this.#z(D,A,ET1[A])}async set(A,D){let _=this.#Y;if(!_){this.#Q.warn("No client name available, cannot set value");return}await this.#J(_,A,D,ET1[A])}async delete(A){let D=this.#Y;if(!D){this.#Q.warn("No client name available, cannot delete value");return}await this.#X(D,A)}async getGlobal(A){return await this.#z(zT1,A,BT1[A])}async setGlobal(A,D){return this.#J(zT1,A,D,BT1[A])}async deleteGlobal(A){return this.#X(zT1,A)}get#Y(){let A=this.#D.get("clientInfo.name");if(!A){this.#Q.warn("No client name in config");return}return A}get#G(){let A=this.#_.user?.id;if(!A)this.#Q.debug("No user ID available from UserService");return A}}b81=l0([k81.Injectable(v3A,[j81,E_,oq,ZA])],b81);var BY4=d.object({gitlabBaseUrl:d.string().optional(),gitlabAuthToken:d.string().optional()}),y3A="duo-cli-config";class S3A{#A;#D;#_;constructor(A,D,_){this.#A=A,this.#_=_,this.#D=D}async saveConfig(A){try{let{configurationEntries:D}=A,_={gitlabAuthToken:"",gitlabBaseUrl:""};for(let Q of D){let B=Q.key;if(B in _)_[B]=Q.value}return this.#A=_,await this.#D.set(y3A,_),o_()}catch(D){return this.#_.error("Failed to save configuration:",D),Lz(D)}}exit(){process.exit(0)}getDuoConfiguration(){return this.#A}async initialize(){let A=await this.#D.get(y3A),D=BY4.safeParse(A);if(D.success)this.#A={...D.data,...this.#A}}isMissingConfiguration(){let{gitlabAuthToken:A,gitlabBaseUrl:D}=this.#A;return!A||!D}getConfigurationModel(){return{configurationEntries:[{key:"gitlabBaseUrl",value:this.#A.gitlabBaseUrl??"",displayName:"\uD83D\uDD17 GitLab Instance URL",description:"The URL of the GitLab instance to connect to.",defaultValue:"https://gitlab.com",isSensitive:!1},{key:"gitlabAuthToken",value:this.#A.gitlabAuthToken??"",displayName:"\uD83D\uDD16 GitLab Token",description:"GitLab access token with API permissions. Create one here: https://gitlab.com/-/user_settings/personal_access_tokens",defaultValue:"",isSensitive:!0}]}}}var JT1=async(A={})=>{let D=new yO,_=new s21("info"),Q=new RK(D,_),B=new Kj(Q),E=new S3A(A,B,Q);return await E.initialize(),E};var XT1=(A)=>{process.stdout.write("\x1B[?2004h");let D=A.getConfigurationModel(),_=mQ(),{waitUntilExit:Q}=cb(_A(Z10,{initialState:D,controller:A,duoCliVersion:_}),{exitOnCtrlC:!1});Q().then(()=>{process.exit(0)}).catch((B)=>{console.error(B),process.exit(1)}),process.on("exit",()=>{process.stdout.write("\x1B[?2004l")})};var EY4=process.platform==="win32",x81=B3A(),WU=new TT1,GT1=(A)=>{(global.__logger||console).error(A),process.exit(1)};process.on("unhandledRejection",GT1);process.on("uncaughtException",GT1);WU.name("duo").description("GitLab Duo for your command line");WU.name("duo").description("GitLab Duo for your command line").option("-C, --cwd <path>","change working directory",(A)=>Y3A(A),process.cwd()).addOption(new PQ("--gitlab-base-url <url>","Base URL of GitLab instance").env("GITLAB_URL").default(process.env.GITLAB_BASE_URL||"https://gitlab.com")).addOption(new PQ("--gitlab-auth-token <token>","Authentication token for GitLab instance").env("GITLAB_TOKEN").default(process.env.GITLAB_OAUTH_TOKEN)).addOption(new PQ("--log-level <level>","Set logging level").choices(Object.values(v_)).env("LOG_LEVEL").default(v_.DEBUG)).addOption(new PQ("--git-http-user <user>","Username for git HTTP authentication credentials").env("DUO_WORKFLOW_GIT_HTTP_USER")).addOption(new PQ("--git-http-password <password>","Password for git HTTP authentication credentials").env("DUO_WORKFLOW_GIT_HTTP_PASSWORD"));x81.registerOptions(WU.action(async(A)=>{let D=WU.opts(),{cwd:_,logLevel:Q,gitHttpUser:B,gitHttpPassword:E}=D,z=await JT1(D);if(z.isMissingConfiguration()){XT1(z);return}let X=z.getDuoConfiguration(),G=x81.mapConfig({cwd:_,logLevel:Q,gitlabBaseUrl:X.gitlabBaseUrl,gitlabAuthToken:X.gitlabAuthToken,environment:rR1(),gitHttpUser:B,gitHttpPassword:E,command:{name:"tui"}},{programConfig:D,commandConfig:A});G3A(G)}));var zY4=WU.command("config").description("configuration management commands");zY4.command("edit").description("edit duo CLI configuration").action(async()=>{let A=await JT1();XT1(A)});var g81=WU.command("log").description("log management commands");g81.command("last").description("open the last log file").action(()=>{Xv1()});g81.command("list").description("list all log files").action(()=>{Gv1()});g81.command("tail [args...]").description(`tail the last log file. "args" can be any standard ${EY4?'PowerShell "Get-Content"':'"tail"'} arguments`).allowUnknownOption().action((A)=>Yv1(A||[]));g81.command("clear").description("remove all existing log files").action(()=>{Fv1()});x81.registerOptions(WU.command("run").description("Run a workflow in non-interactive / headless mode").addOption(new PQ("-g, --goal <goal>","Goal/prompt for the session").default(process.env.DUO_WORKFLOW_GOAL).makeOptionMandatory()).addOption(new PQ("--ai-context-items <contextItems>","JSON encoded array of additional context items").default(process.env.DUO_WORKFLOW_ADDITIONAL_CONTEXT_CONTENT).argParser((A)=>F3A(A))).addOption(new PQ("--existing-session-id <sessionId>","ID of existing session to resume").default(process.env.DUO_WORKFLOW_WORKFLOW_ID)).action(async(A)=>{let D=WU.opts(),{cwd:_,gitlabBaseUrl:Q,gitlabAuthToken:B,logLevel:E,gitHttpUser:z,gitHttpPassword:J}=D,{goal:X,aiContextItems:G}=A;if(!B)throw new yw("--gitlab-auth-token / GITLAB_AUTH_TOKEN option is required.");let Y=x81.mapConfig({cwd:_,gitlabBaseUrl:Q,gitlabAuthToken:B,logLevel:E,environment:rR1(),gitHttpUser:z,gitHttpPassword:J,command:{name:"run",goal:X,aiContextItems:G}},{programConfig:D,commandConfig:A}),$=new oR1(Y);await $.initialize(),await $.execute()}));try{await WU.parseAsync(process.argv)}catch(A){GT1(A)}
1796
1796
 
1797
- //# debugId=64D5FD9ADB7CCDD664756E2164756E21
1797
+ //# debugId=282146D8D7152DA864756E2164756E21
1798
1798
  //# sourceMappingURL=index.js.map